7039dd2d40b648ac2ea6c5e48a8d4d620dc42548
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2015-06-11 Cary Coutant <ccoutant@gmail.com>
2
3 * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
4 outside class body.
5 (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
6
7 2015-06-11 Cary Coutant <ccoutant@gmail.com>
8
9 PR gold/17731
10 * layout.cc (corresponding_uncompressed_section_name): New function.
11 (Layout::choose_output_section): Call it.
12 * layout.h (corresponding_uncompressed_section_name): New function.
13 * script-sections.cc (Input_section_info::set_section_name): Check
14 for compressed debug section (.zdebug style).
15
16 2015-06-11 Jing Yu <jingyu@google.com>
17
18 * testsuite/Makefile.am: Add -O0 for script_test_12 test.
19 * testsuite/Makefile.in: Regenerate.
20
21 2015-06-11 Davide Italiano <dccitaliano@gmail.com>
22
23 * gold.h (is_cident): Correct typo.
24
25 2015-06-10 Han Shen <shenhan@google.com>
26 Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
27
28 Now fixing for 843419 is fully functional.
29
30 The first part of the erratum fix CL is here -
31 https://sourceware.org/ml/binutils/2015-04/msg00229.html
32
33 * aarch64.cc(global enum): New constants representing stub types.
34 (Stub_template): New POD struct.
35 (Stub_template_repertoire): New class.
36 (Stub_base): New class.
37 (Erratum_stub): New class.
38 (Reloc_stub): Refactored to be a subclass of Stub_base.
39 (Reloc_stub::Stub_type): Removed.
40 (Reloc_stub::offset): Moved to Stub_base.
41 (Reloc_stub::set_offset): Moved to Stub_base.
42 (Reloc_stub::destination_address): Moved to Stub_base.
43 (Reloc_stub::set_destination_address): Moved to Stub_base.
44 (Reloc_stub::reset_destination_address): Moved to Stub_base.
45 (Reloc_stub::stub_type): Renamed and moved to Stub_base.
46 (Reloc_stub::stub_size): Renamed and moved to Stub_base.
47 (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
48 (Reloc_stub::write): Moved to Stub_base.
49 (Reloc_stub::invalid_offset): Moved to Stub_base.
50 (Reloc_stub::invalid_address): Moved to Stub_base.
51 (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
52 (Reloc_stub::stub_insns_): Moved to Stub_base.
53 (Reloc_stub::offset_): Moved to Stub_base.
54 (Reloc_stub::destination_address_): Moved to Stub_base.
55 (Stub_table::The_aarch64_relobj): New typedef.
56 (Stub_table::The_erratum_stub): New typedef.
57 (Stub_table::The_erratum_stub_less): New typedef.
58 (Stub_table::The_erratum_stub_set): New typedef.
59 (Stub_table::The_erratum_stub_set_iter): New typedef.
60 (Stub_table::empty): Added emptiness testing for erratum stubs.
61 (Stub_table::add_erratum_stub): New method to add an erratum stub.
62 (Stub_table::find_erratum_stub): New method.
63 (Stub_table::find_erratum_stubs_for_input_section): New method.
64 (Stub_table::erratum_stub_address): New method.
65 (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
66 (Stub_table::do_addralign): Modified to handle erratum stubs.
67 (Stub_table::erratum_stubs_): New member.
68 (Stub_table::erratum_stub_size_): New member.
69 (Stub_table::relocate_stubs): Modified to handle erratum stubs.
70 (Stub_table::do_write): Modified to handle erratum stubs.
71 (AArch64_relobj::The_erratum_stub): New typedef.
72 (AArch64_relobj::Erratum_stub_set_iter): New typedef.
73 (AArch64_relobj::fix_errata): New method.
74 (Target_aarch64::The_reloc_stub_type): Removed.
75 (Target_aarch64::The_erratum_stub): New typede.
76 (AArch64_relocate_functions::construct_b): New method.
77
78 2015-06-08 Nick Clifton <nickc@redhat.com>
79
80 * po/fr.po: New French Translation.
81
82 2015-06-07 Cary Coutant <ccoutant@gmail.com>
83
84 PR gold/18288
85 * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
86 callers. Don't use STT_COMMON to check for common symbols.
87 (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
88 symbol that's not in a common section.
89 * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
90 common symbols.
91
92 2015-06-04 Cary Coutant <ccoutant@gmail.com>
93
94 PR gold/18200
95 * Makefile.am (diststuff): Add target.
96 * Makefile.in: Regenerate.
97
98 2015-06-04 Cary Coutant <ccoutant@gmail.com>
99
100 PR gold/17498
101 * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
102 temporary locals in merge sections.
103 * options.cc (General_options::parse_discard_all): New method.
104 (General_options::parse_discard_locals): New method.
105 (General_options::parse_discard_none): New method.
106 (General_options::General_options): Initialize discard_locals_.
107 * options.h (--discard-all): Convert to special option.
108 (--discard-locals): Likewise.
109 (--discard-none): New option.
110 (General_options::discard_all): New method.
111 (General_options::discard_locals): New method.
112 (General_options::discard_sec_merge): New method.
113 (General_options::Discard_locals): New enum.
114 (General_options::discard_locals_): New data member.
115
116 2015-06-03 Cary Coutant <cary@google.com>
117
118 * script-sections.cc (Script_sections::Script_sections): Initialize
119 segments_created_.
120 (Script_sections::create_note_and_tls_segments): Set flag when
121 segments are created.
122 (Script_sections::expected_segment_count): Count PT_INTERP.
123 (Script_sections::attach_sections_using_phdrs_clause): Set flag when
124 segments are created.
125 * script-sections.h (Script_sections::segments_created_): New data
126 member.
127
128 2015-06-03 Cary Coutant <ccoutant@gmail.com>
129
130 PR gold/15370
131 * script-sections.cc
132 (Output_section_element_input::set_section_addresses): When there
133 are several patterns with no sort spec, put all sections in the same
134 bin.
135 * testsuite/Makefile.am (script_test_12): New testcase.
136 (script_test_12i): New testcase.
137 * testsuite/Makefile.in: Regenerate.
138 * testsuite/script_test_12.t: New test linker script.
139 * testsuite/script_test_12i.t: New test linker script.
140 * testsuite/script_test_12a.c: New test source file.
141 * testsuite/script_test_12b.c: New test source file.
142
143 2015-06-02 Cary Coutant <ccoutant@gmail.com>
144
145 * nacl.h (Sniff_file): Switch parameters to get_view to get an
146 aligned view.
147
148 2015-06-03 Cary Coutant <ccoutant@gmail.com>
149
150 PR gold/17819
151 * gold.cc (queue_final_tasks): When --build-id=tree, queue a
152 separate task to schedule the build id computation.
153 * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
154 add Output_file and offset.
155 (Hash_task::run): Get and release the input views.
156 (Hash_task::is_runnable): Always return NULL (always runnable).
157 (Layout::queue_build_id_tasks): Remove.
158 (Layout::write_build_id): Add array_of_hashes and size_of_hashes
159 parameters; use them instead of class members.
160 (Build_id_task_runner::run): New function.
161 (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
162 to write_build_id.
163 * layout.h (Layout::queue_build_id_tasks): Remove.
164 (Layout::write_build_id): Add array_of_hashes and size_of_hashes
165 parameters.
166 (Layout::array_of_hashes_): Remove.
167 (Layout::size_of_array_of_hashes_): Remove.
168 (Layout::input_view_): Remove.
169 (Build_id_task_runner): New class.
170 (Close_task_runner::Close_task_runner): Add array_of_hashes and
171 size_of_hashes parameters.
172 (Close_task_runner::array_of_hashes_): New data member.
173 (Close_task_runner::size_of_hashes_): New data member.
174 * testsuite/Makefile.am
175 (flagstest_compress_debug_sections_and_build_id_tree): New test.
176 * testsuite/Makefile.in: Regenerate.
177
178 2015-06-01 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
179
180 * merge.cc (get_input_merge_map): Update for data structure change.
181 (get_or_make_input_merge_map): Update for data structure change.
182 * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
183 a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
184
185 2015-05-16 Alan Modra <amodra@gmail.com>
186
187 * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
188 * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
189 (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
190 (lis_0): Rename from lis_0_0.
191
192 2015-04-29 Cary Coutant <cary@google.com>
193 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
194
195 * gc.h (Garbage_collection::is_section_garbage): Change Object*
196 to Relobj*.
197 (Garbage_collection::add_reference): Likewise.
198 (Garbage_collection::gc_process_relocs): Likewise. Don't push
199 object/shndx pair onto *secvec for dynamic objects. Don't follow
200 relocations pointing to dynamic objects for GC.
201 * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
202 (Icf::unfold_section): Likewise.
203 (Icf::is_section_folded): Likewise.
204 (Icf::get_folded_section): Likewise.
205 * icf.h: (Icf::get_folded_section): Likewise.
206 (Icf::unfold_section): Likewise.
207 (Icf::is_section_folded): Likewise.
208 (Icf::section_has_function_pointers): Likewise.
209 (Icf::set_section_has_function_pointers): Likewise.
210 * object.h (Section_id): Likewise.
211 (Const_section_id): Likewise.
212 * output.cc (Output_section::update_section_layout): Likewise.
213 * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
214 Likewise.
215 * plugin.cc (update_section_order): Likewise.
216 (unique_segment_for_sections): Likewise.
217 * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
218 (Target_powerpc::do_gc_add_reference): Likewise.
219 (Target_powerpc::gc_process_relocs): Likewise.
220 (Target_powerpc::do_gc_add_reference): Likewise.
221 * symtab.cc (Symbol_table::is_section_folded): Likewise.
222 (Symbol_table::gc_mark_symbol): Likewise.
223 * symtab.h: (Symbol_table::is_section_folded): Likewise.
224 * target.h: (Sized_target::gc_add_reference): Likewise.
225 (Sized_target::do_gc_add_reference): Likewise.
226
227 2015-04-29 Nick Clifton <nickc@redhat.com>
228
229 * po/fi.po: Updated Finnish translation.
230
231 2015-04-28 Alan Modra <amodra@gmail.com>
232
233 * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
234 than unsigned int for find_global_entry result temp. Compare
235 against invalid_address.
236 (Target_powerpc::do_plt_address_for_global): Likewise.
237 (Target_powerpc::Relocate::relocate): Likewise. Don't assert
238 on plt call stub existence for debug info. Do assert for plt
239 and global entry stub existence if an alloc section.
240
241 2015-04-28 Alan Modra <amodra@gmail.com>
242
243 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
244 on missing global entry stub due to bogus debug info.
245
246 2015-04-27 Han Shen <shenhan@google.com>
247
248 * options.h (--fix-cortex-a53-843419): Rename option.
249 * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
250 option.
251 (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
252
253 2015-04-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
254
255 PR gold/18327
256 * output.cc (Output_section::is_input_address_mapped): Assume a missing
257 entry is mapped.
258 * testsuite/Makefile.am: Add the eh_test test.
259 * testsuite/Makefile.in: Regenerate.
260 * testsuite/eh_test_a.cc: New test.
261 * testsuite/eh_test_b.cc: New test.
262
263 2015-04-23 Sriraman Tallam <tmsriram@google.com>
264
265 * options.h (--weak-unresolved-symbols): New option.
266 * symtab.cc (Symbol_table::sized_write_globals): Change symbol
267 binding to weak with new option.
268 * symtab.h (is_weak_undefined): Check for new option.
269 (is_strong_undefined): Check for new option.
270 * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
271 * testsuite/Makefile.in: Regenerate.
272 * testsuite/weak_unresolved_symbols_test.cc: New file.
273
274 2015-04-20 Ian Coolidge <icoolidge@google.com>
275
276 * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
277 GNU_UNIQUE.
278
279 2015-04-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
280
281 * gc.cc (Garbage_collection::do_transitive_closure): Use back and
282 push_back.
283 * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
284 * object.cc (Sized_relobj_file::do_layout): Use push_back.
285 * powerpc.cc (process_gc_mark): Use push_back.
286 (Target_powerpc::do_gc_mark_symbol): Use push_back.
287 * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
288
289 2015-04-16 Han Shen <shenhan@google.com>
290
291 * aarch64.cc (AArch64_insn_utilities): New utility class.
292 (AArch64_relobj::Mapping_symbol_position): New struct.
293 (AArch64_relobj::Mapping_symbol_info): New typedef.
294 (AArch64_relobj::do_count_local_symbols): New function overriding
295 parent's implementation.
296 (AArch64_relobj::mapping_symbol_info_): New member
297 (AArch64_relobj::scan_erratum_843419): New method.
298 (Target_aarch64::scan_erratum_843419_span): New method.
299 (Target_aarch64::is_erratum_843419_sequence): New method.
300 * options.h (fix_cortex_a53): New option.
301
302 2015-04-09 Cary Coutant <ccoutant@google.com>
303
304 * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
305 in a PIE link.
306 * testsuite/Makefile.am (tls_pie_test.sh): New test.
307 * testsuite/Makefile.in: Regenerate.
308 * testsuite/tls_pie_test.sh: New.
309
310 2015-04-09 Cary Coutant <ccoutant@google.com>
311
312 * debug.h (DEBUG_LOCATION): New.
313 (DEBUG_ALL): Include DEBUG_LOCATION.
314 (debug_string_to_enum): Add DEBUG_LOCATION.
315 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
316 output to print correct context.
317 (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
318 up to 4 more locations at the beginning of the function.
319 * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
320 result before sorting list of line numbers.
321 * testsuite/debug_msg.sh: Allow range of line numbers for
322 canonical results on optimized code.
323
324 2015-04-07 HC Yen <hc.yen@mediatek.com>
325
326 Add AArch32 support for gold linker.
327 gold/
328 * arm.cc: Add V8 arch combine table.
329
330 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
331
332 * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
333
334 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
335
336 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
337 to find by using the return value of insert.
338
339 2015-04-06 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
340
341 * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
342 constructor call.
343
344 2015-04-06 Ilya Tocar <ilya.tocar@intel.com>
345
346 PR gold/17641
347 * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
348 (Target_x86_64::Scan::local): Don't create GOT entry, when we
349 can convert mov to lea.
350 (Target_x86_64::Scan::global): Ditto.
351 (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
352 %reg to lea foo(%rip), %reg if possible.
353 * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
354 * testsuite/x86_64_mov_to_lea1.s: New.
355 * testsuite/x86_64_mov_to_lea2.s: Ditto.
356 * testsuite/x86_64_mov_to_lea3.s: Ditto.
357 * testsuite/x86_64_mov_to_lea4.s: Ditto.
358 * testsuite/x86_64_mov_to_lea.sh: Ditto.
359
360 2015-04-02 H.J. Lu <hongjiu.lu@intel.com>
361
362 * configure: Regenerated.
363
364 2015-04-01 Ilya Tocar <ilya.tocar@intel.com>
365
366 PR gold/17640
367 * i386.cc (Target_i386::can_convert_mov_to_lea): New.
368 (Target_i386::Scan::local): Don't create GOT entry, when we
369 can convert GOT to GOTOFF.
370 (Target_i386::Scan::global): Ditto.
371 (Target_i386::Relocate::relocate): Convert mov foo@GOT(%reg), %reg to
372 lea foo@GOTOFF(%reg), %reg if possible.
373 * testsuite/Makefile.am (i386_mov_to_lea): New test.
374 * testsuite/i386_mov_to_lea1.s: New.
375 * testsuite/i386_mov_to_lea2.s: Ditto.
376 * testsuite/i386_mov_to_lea3.s: Ditto.
377 * testsuite/i386_mov_to_lea4.s: Ditto.
378 * testsuite/i386_mov_to_lea5.s: Ditto.
379 * testsuite/i386_mov_to_lea.sh: Ditto.
380
381 2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
382
383 * Makefile.am (ZLIB): New.
384 (ZLIBINC): Likewise.
385 (AM_CFLAGS): Add $(ZLIBINC).
386 (AM_CXXFLAGS): Likewise.
387 (ldadd_varldadd_var): Add $(ZLIB).
388 (incremental_dump_LDADD): Likewise.
389 (dwp_LDADD): Likewise.
390 * compressed_output.cc: Don't check HAVE_ZLIB_H to include
391 <zlib.h>.
392 (zlib_compress): Don't check HAVE_ZLIB_H.
393 (zlib_decompress): Likewise.
394 * options.h (compress_debug_sections): Likewise.
395 * configure.ac (AM_CONDITIONAL): Removed.
396 * testsuite/Makefile.am (ZLIB): New.
397 (LDADD): Add $(ZLIB).
398 Don't check HAVE_ZLIB.
399 * Makefile.in: Regenerated.
400 * config.in: Likewise.
401 * configure: Likewise.
402 * testsuite/Makefile.in: Likewise.
403
404 2015-03-30 Jing Yu <jingyu@google.com>
405
406 * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
407 TLSLD_ADD_DTPREL_LO12_NC.
408 * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
409 _TLS_MODULE_BASE_ point to the start of tls segment.
410 (Target_aarch64::optimize_tls_reloc): Add cases for
411 R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
412 R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
413 (Target_aarch64::Scan::local): Likewise.
414 (Target_aarch64::Scan::global): Likewise.
415 (Target_aarch64::Relocate::relocate): Likewise.
416 (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
417 subtracting tls segment size from symbol value for TLSLD_*_DTPREL
418 relocations.
419
420 2015-03-27 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
421
422 * merge.cc (Object_merge_map::add_mapping): call
423 Object_merge_map::Input_merge_map::add_mapping.
424 (Object_merge_map::Input_merge_map::add_mapping): New.
425 (Output_merge_data::do_add_input_section): Call
426 get_or_make_input_merge_map before a loop.
427 (Output_merge_string<Char_type>::finalize_merged_data): Call
428 get_or_make_input_merge_map before a loop.
429 * merge.h (Object_merge_map): Make Input_merge_map public.
430 * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
431 (Relobj::get_or_create_merge_map): New.
432 * object.h (Relobj::get_or_create_merge_map): New.
433
434 2015-03-24 Alan Modra <amodra@gmail.com>
435
436 PR 18147
437 * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
438 relocation errors for branches to strong undefined symbols.
439
440 2015-03-23 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
441
442 * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
443 (Object_merge_map::is_merge_section_for): Remove.
444 (Object_merge_map::find_merge_section): New.
445 * merge.h (Object_merge_map::is_merge_section_for): Remove.
446 (Object_merge_map::find_merge_section): New.
447 (Object_merge_map::get_input_merge_map): Add a const version.
448 * object.cc (Relobj::is_merge_section_for): Remove.
449 (Relobj::find_merge_section): New.
450 * object.h (Relobj::is_merge_section_for): Remove.
451 (Relobj::find_merge_section): New.
452 * output.cc
453 (Output_section::Input_section::is_merge_section_for): Remove.
454 (Output_section::add_merge_input_section): Don't call
455 add_merge_input_section.
456 (Output_section::find_merge_section): Return const. Use
457 object->find_merge_section.
458 (Output_section::build_lookup_maps): Don't build a map for
459 merge sections.
460 (Output_section::is_input_address_mapped): Return false if
461 section is not found.
462 (Output_section::find_starting_output_address): Use
463 find_merge_section instead of is_merge_section_for.
464 (Output_section::add_script_input_section): Don't build a map for
465 merge sections.
466 * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
467 (Output_section_lookup_maps::find_merge_section): Remove.
468 (Output_section_lookup_maps::add_merge_input_section) Remove.
469 (Output_section::find_merge_section): Return const.
470
471 2015-03-22 Cary Coutant <cary@google.com>
472
473 PR gold/18106
474 * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
475 non-SIB form of lea, with nop after the call.
476
477 2015-03-21 Cary Coutant <cary@google.com>
478
479 PR gold/14217
480 * output.cc (Output_segment::is_first_section_relro): Don't ignore
481 .tdata section.
482 (Output_segment::set_section_addresses): Don't align size of relro
483 segment for .tbss.
484
485 2015-03-21 Cary Coutant <cary@google.com>
486
487 PR gold/18010
488 * stringpool.cc (Stringpool_template): Don't optimize if section
489 alignment is greater than sizeof(char).
490
491 2015-03-21 Cary Coutant <cary@google.com>
492
493 PR gold/18048
494 * script-c.h (script_include_directive): Add first_token parameter.
495 * script.cc (script_include_directive): Add first_token parameter, and
496 pass it to read_script_file.
497 * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
498 (PARSING_MEMORY_DEF): New tokens.
499 (top): Add new productions for INCLUDE files.
500 (file_cmd): Replace file_or_sections_cmd with copy of its productions.
501 Pass PARSING_LINKER_SCRIPT to script_include_directive.
502 (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
503 (section_cmd): Pass PARSING_SECTION_CMDS.
504 (file_or_sections_cmd): Remove.
505 (memory_def): Pass PARSING_MEMORY_DEF.
506 * testsuite/Makefile.am (memory_test_2): New test.
507 * testsuite/Makefile.in: Regenerate.
508 * testsuite/memory_test_inc.t: New script file.
509 * testsuite/memory_test_inc_1.t.src: New script file.
510 * testsuite/memory_test_inc_2.t.src: New script file.
511 * testsuite/memory_test_inc_3.t.src: New script file.
512
513 2015-03-21 Cary Coutant <cary@google.com>
514
515 * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
516 (Sized_relobj_dwo::setup): Build compressed section map.
517 (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
518 * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
519 section map.
520 * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
521 compressed_sections_ field.
522 (build_compressed_section_map): Take Object instead of
523 Sized_relobj_file parameter; add decompress_if_needed parameter.
524 (Sized_relobj_file::do_find_special_sections): Store compressed
525 section map in parent Object.
526 (Sized_relobj_file::do_decompressed_section_contents): Move
527 implementation to Object::decompressed_section_contents.
528 (Sized_relobj_file::do_discard_decompressed_sections): Move
529 implementation to Object::discard_decompressed_sections.
530 * object.h (build_compressed_section_map): Declare.
531 (Object::Object): Add compressed_sections_ field.
532 (Object::section_is_compressed): Move implementation here.
533 (Object::decompressed_section_contents): De-virtualize.
534 (Object::discard_decompressed_sections): De-virtualize.
535 (Object::do_section_is_compressed): Delete.
536 (Object::do_decompressed_section_contents): Delete.
537 (Object::set_compressed_sections): New method.
538 (Object::compressed_sections): New method.
539 (Object::compressed_sections_): New data member.
540 (Compressed_section_info, Compressed_section_map): Move to top of file.
541 (Sized_relobj_file::do_section_is_compressed): Delete.
542 (Sized_relobj_file::do_decompressed_section_contents): Delete.
543 (Sized_relobj_file::do_discard_decompressed_sections): Delete.
544 (Sized_relobj_file::compressed_sections_): Move to Object class.
545
546 2015-03-21 Cary Coutant <ccoutant@google.com>
547
548 PR gold/18152
549 * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
550 deferred objects.
551
552 2015-03-11 Cary Coutant <ccoutant@google.com>
553
554 * options.cc (General_options::finalize): Don't allow -z relro
555 with incremental linking.
556 * testsuite/Makefile.am (incremental_test): Add -z norelro.
557 (incremental_test_2): Likewise.
558 (incremental_test_3): Likewise.
559 (incremental_test_4): Likewise.
560 (incremental_test_5): Likewise.
561 (incremental_test_6): Likewise.
562 (incremental_copy_test): Likewise.
563 (incremental_common_test_1): Likewise.
564 (incremental_comdat_test_1): Likewise.
565 * testsuite/Makefile.in: Regenerate.
566
567 2015-03-09 Cary Coutant <ccoutant@google.com>
568
569 PR gold/14675
570 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
571 return enum indicating whether .eh_frame section is empty, optimizable,
572 unrecognized, or an end marker. Adjust explicit instantiations.
573 * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
574 (Eh_frame::add_ehframe_input_section): Change return type.
575 * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
576 * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
577 to the .eh_frame output section until we see the end marker.
578 (Layout::finalize_eh_frame_section): New.
579 * layout.h: (Layout::finalize_eh_frame_section): New.
580
581 2015-03-05 H.J. Lu <hongjiu.lu@intel.com>
582
583 * output.cc (Relobj::initialize_input_to_output_map<size>):
584 Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
585
586 2015-03-04 Cary Coutant <ccoutant@google.com>
587
588 * parameters.cc (Parameters::set_target_once): Call
589 Target::select_as_default_target just once from here...
590 (set_parameters_target): ...instead of from here.
591
592 2015-03-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
593
594 * ehframe.cc (Cie::set_output_offset): Pass in and use a
595 Output_section_data instead of a Merge_map.
596 (Eh_frame::Eh_frame): Don't initialize merge_map_.
597 (Eh_frame::read_cie): Use add_merge_mapping instead of
598 Merge_map::add_mapping.
599 (Eh_frame::read_fde): Ditto.
600 (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
601 (Eh_frame::do_output_offset): Use merge_output_offset istead of
602 merge_map_->get_output_offset.
603 (Eh_frame::do_is_merge_section_for): Delete.
604 * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
605 instead of a Merge_map.
606 (Cie::set_output_offset): Pass in a Output_section_data instead of a
607 Merge_map.
608 (Eh_frame::do_is_merge_section_for): Delete.
609 (Eh_frame::merge_map_): Delete.
610 * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
611 and use a Output_section_data instead of a Merge_map.
612 (Object_merge_map::add_mapping): Ditto.
613 (Object_merge_map::get_output_offset): Remove the merge_map argument.
614 (Object_merge_map::is_merge_section_for): Pass in and use a
615 Output_section_data instead of a Merge_map.
616 (Merge_map): Delete.
617 (Output_merge_base::do_output_offset): Use merge_output_offset instead
618 of merge_map_.get_output_offset.
619 (Output_merge_base::do_is_merge_section_for): Delete.
620 (Output_merge_data::do_add_input_section): Use
621 object->add_merge_mapping instead of add_mapping.
622 (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
623 * merge.h (Merge_map): Delete forward declaration.
624 (Object_merge_map::add_mapping): Pass in and use a Output_section_data
625 instead of a Merge_map.
626 (Object_merge_map::get_output_offset): Remove the merge_map argument.
627 (Object_merge_map::is_merge_section_for): Pass in and use a
628 Output_section_data instead of a Merge_map.
629 (Input_merge_map::Object_merge_map::merge_map): Replace with
630 output_data.
631 (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
632 Output_section_data instead of a Merge_map.
633 (Merge_map): Delete.
634 (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
635 (Output_merge_base::do_is_merge_section_for): Delete.
636 (Output_merge_base::add_mapping): Delete.
637 (Output_merge_base::merge_map_): Delete.
638 * object.cc (Relobj::initialize_input_to_output_map): New.
639 (Relobj::initialize_input_to_output_map): New.
640 (Relobj::merge_output_offset): New.
641 (Relobj::is_merge_section_for): New.
642 (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
643 bits.
644 * object.h (Relobj::merge_map): Delete.
645 (initialize_input_to_output_map): New.
646 (set_merge_map): Delete.
647 (add_merge_mapping): New.
648 (merge_output_offset): New.
649 (is_merge_section_for): New.
650 * output.cc (Output_section::Input_section::is_merge_section_for):
651 Use object->is_merge_section_for.
652 * output.h (Output_section_data::is_merge_section_for): Delete.
653 (Output_section_data::do_is_merge_section_for): Delete.
654 * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
655 Use object->initialize_input_to_output_map.
656 (Merged_symbol_value<size>::value_from_output_section): Use
657 object->merge_output_offset.
658
659 2015-03-02 Peter Collingbourne <pcc@google.com>
660 Cary Coutant <ccoutant@google.com>
661
662 * output.cc (Output_section::add_merge_input_section): Do not
663 attempt to merge sections with an entsize of 0.
664
665 2015-03-02 Khem Raj <raj.khem@gmail.com>
666
667 * attributes.h (class Output_attributes_section_data ): Add
668 do_print_to_mapfile function.
669
670 2015-02-24 Alan Modra <amodra@gmail.com>
671
672 PR 18010
673 * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
674 complain if value is not a multiple of four.
675 (Target_powerpc::Relocate::relocate): Correct handling of
676 R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
677
678 2015-02-21 H.J. Lu <hongjiu.lu@intel.com>
679
680 * configure.ac (default_size): Set to 32 for x32.
681 * configure: Regenerated.
682
683 2015-02-18 Alan Modra <amodra@gmail.com>
684
685 PR 17954
686 * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
687 visibility.
688
689 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
690
691 * gc.h (Garbage_collection::add_reference): Don't use find.
692
693 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
694
695 * object.cc (write_local_symbols): avoid std::vector copy.
696
697 2015-02-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
698
699 * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
700
701 2015-02-09 Mark Wielaard <mjw@redhat.com>
702
703 * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
704 DW_LANG_Fortran03 and DW_LANG_Fortran08.
705
706 2015-02-16 Cary Coutant <ccoutant@google.com>
707
708 PR gold/13577
709 PR gold/16992
710 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
711 DF_SYMBOLIC if --dynamic-list option is used.
712 * options.cc (General_options::finalize): --dynamic-list is not
713 mutually exclusive with -Bsymbolic.
714 * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
715 listed in --dynamic-list.
716 * testsuite/Makefile.am (dynamic_list_lib2.so): Add
717 -Bsymbolic-functions.
718 * testsuite/Makefile.in: Regenerate.
719
720 2015-02-16 Cary Coutant <ccoutant@google.com>
721
722 PR gold/17971
723 * incremental.cc: Remove redundant include of "output.h".
724
725 2015-02-12 Jing Yu <jingyu@google.com>
726
727 * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
728 TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
729 New relocation.
730 * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
731 TLSLE_MOVW_* relocations.
732 (Target_aarch64::Scan::global): Likewise.
733 (Target_aarch64::Relocate::relocate): Likewise.
734 (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
735 for new TLSLE_MOVW_* relocations.
736
737 2015-02-11 Will Newton <will.newton@linaro.org>
738
739 PR gold/13321
740 * arm.cc (Target_arm::make_plt_section): Create an ARM
741 state mapping symbol at the start of the PLT.
742
743 2015-02-09 H.J. Lu <hongjiu.lu@intel.com>
744
745 * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
746 Replace two_file_shared_2.so with two_file_shared_1.so.
747 * testsuite/Makefile.in: Regenerated.
748
749 2015-02-09 Alan Modra <amodra@gmail.com>
750
751 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
752 plugin_test_thin.a and defsym_test.
753 * testsuite/Makefile.in: Regenerate.
754
755 2015-02-04 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
756
757 * merge.cc (do_add_input_section): Combine loop epilogue into main loop
758 body.
759
760 2015-02-04 Peter Collingbourne <pcc@google.com>
761
762 * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
763 forwarding symbols when computing symbol resolution info for plugins.
764 * plugin.h (Plugin_manager::symtab): New method.
765 (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
766
767 2015-02-03 Cary Coutant <ccoutant@google.com>
768 Peter Collingbourne <pcc@google.com>
769
770 PR gold/15660
771 * archive.cc (Thin_archive_object_unlocker): New class.
772 (Archive::include_member): Unlock external members of thin archives.
773 * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
774 (plugin_test_2): Likewise.
775 (plugin_test_3): Likewise.
776 (plugin_test_4): Likewise.
777 (plugin_test_5): Likewise.
778 (plugin_test_6): Likewise.
779 (plugin_test_7): Likewise.
780 (plugin_test_8): Likewise.
781 (plugin_test_9): Likewise.
782 (plugin_test_10): Likewise.
783 (plugin_test_11): New test case.
784 * testsuite/Makefile.in: Regenerate.
785 * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
786 file to decide whether to claim file.
787 (all_symbols_read_hook): Likewise.
788 * testsuite/plugin_test_1.sh: Adjust expected output.
789 * testsuite/plugin_test_2.sh: Likewise.
790 * testsuite/plugin_test_3.sh: Likewise.
791 * testsuite/plugin_test_6.sh: Likewise.
792 * testsuite/plugin_test_tls.sh: Likewise.
793 * testsuite/plugin_test_11.sh: New testcase.
794
795 2015-02-03 Cary Coutant <ccoutant@google.com>
796
797 * descriptors.cc (Descriptors::open): Set artificially-low limit for
798 file descriptors when debugging enabled. Add debug output.
799 (Descriptors::release): Add debug output.
800 (Descriptors::close_some_descriptor): Likewise.
801 (Descriptors::close_all): Likewise.
802 * fileread.cc (File_read::lock): Likewise.
803 (File_read::unlock): Likewise.
804
805 2015-02-02 Cary Coutant <ccoutant@google.com>
806
807 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
808 executable output file.
809
810 2015-01-22 Han Shen <shenhan@google.com>
811
812 * arm.cc (Target_arm::Target_arm): Add initialization for new members.
813 (Target_arm::do_plt_address_for_global): New method.
814 (Target_arm::do_plt_address_for_local): New method.
815 (Target_arm::rel_irelative_section): New method.
816 (Target_arm::make_data_plt): Add more parameters for plt ctor.
817 (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
818 (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
819 (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
820 (Target_arm::Scan::check_non_pic): Add ifunc support.
821 (Target_arm::Scan::local): Add ifunc support.
822 (Target_arm::Scan::global): Add ifunc support.
823 (Target_arm::make_plt_section): New method.
824 (Target_arm::make_plt_entry): Change to call to make_plt_section.
825 (Target_arm::make_local_ifunc_plt_entry): New method.
826 (Target_arm::got_irelative_): New member.
827 (Target_arm::rel_irelative_): New member.
828 (Target_arm::got_section): Add creation for got_irelative_.
829 (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
830 (Target_arm::Relocate::relocate): Properly set local ifunc address.
831 (Target_arm::do_dynsym_value): Properly set global ifunc address.
832 (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
833 (Output_data_plt_arm::IRelative_data): New type.
834 (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
835 (Output_data_plt_arm::add_entry): Add more parameters.
836 (Output_data_plt_arm::add_relocation): New method.
837 (Output_data_plt_arm::add_local_ifunc_entry): New method.
838 (Output_data_plt_arm::rel_irelative): New method.
839 (Output_data_plt_arm::entry_count): Modified.
840 (Output_data_plt_arm::address_for_global): New method.
841 (Output_data_plt_arm::address_for_local): New method.
842 gold/
843 (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
844 (Output_data_plt_arm::insert_irelative_data): New method.
845 (Output_data_plt_arm::irelative_rel_): New member.
846 (Output_data_plt_arm::got_): New member.
847 (Output_data_plt_arm::got_irelative_): New member.
848 (Output_data_plt_arm::irelative_count_): New member.
849 (Output_data_plt_arm::IRelative_data_vec): New typedef.
850 (Output_data_plt_arm::irelative_data_vec_): New member.
851 (Output_data_plt_arm::do_write): Write out irelative entries.
852 (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
853 more parameters to ctor.
854 (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
855 more parameters to ctor.
856 * output.h (Output_data_reloc::add_local_relative): New method.
857 * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
858
859 2015-01-29 Alan Modra <amodra@gmail.com>
860
861 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
862 and GOT_TLSGD to LE optimization.
863
864 2015-01-28 Cary Coutant <ccoutant@google.com>
865
866 * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
867 for undef TLS symbols.
868 (Target_x86_64::Relocate::relocate_tls): Likewise.
869 (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
870
871 2015-01-25 Cary Coutant <ccoutant@google.com>
872
873 * output.cc (Output_segment::set_section_addresses): Fix calculation
874 of size of relro segment.
875
876 2015-01-22 Alan Modra <amodra@gmail.com>
877
878 * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
879 condition for need of ifunc plt entry.
880 (Target_powerpc::Scan::global <got relocs>): Likewise.
881
882 2015-01-14 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
883
884 * mips.cc (reloc_high): Add r_sym.
885 (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
886 reloc_high constructor.
887 (Mips_relocate_functions::relgot16_local): Likewise.
888 (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
889 r_type to decide whether LO16 matches HI16.
890 (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
891 rello16 and relgot16_local.
892
893 2015-01-09 Cary Coutant <ccoutant@google.com>
894
895 * layout.cc (Layout::set_segment_offsets): Don't align start of segment
896 unless alignment is larger than page size.
897
898 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
899 Cary Coutant <ccoutant@google.com>
900
901 PR gold/17729
902 * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
903 (DEFAULT_TARGET_X32): Set for x32.
904 * x86_64.cc (cmp_insn_32): New.
905 (lea_r10_insn_32): Likewise.
906 (lea_r11_insn_32): Likewise.
907 (cmp_insn_64): Likewise.
908 (lea_r10_insn_64): Likewise.
909 (lea_r11_insn_64): Likewise.
910 (Target_x86_64<size>::do_calls_non_split): Handle x32.
911 * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
912 (check_DATA): Add split_x32 files.
913 (split_x32_[1234n].o): New targets.
914 (split_x32_[124]): New targets.
915 (split_x32_[1234r].stdout): New targets.
916 * testsuite/split_x32.sh: New file.
917 * testsuite/split_x32_1.s: Likewise.
918 * testsuite/split_x32_2.s: Likewise.
919 * testsuite/split_x32_3.s: Likewise.
920 * testsuite/split_x32_4.s: Likewise.
921 * testsuite/split_x32_n.s: Likewise.
922 * configure: Regenerated.
923 * testsuite/Makefile.in: Likewise.
924
925 2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
926
927 PR gold/17809
928 * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
929 x32.
930
931 2015-01-02 Alan Modra <amodra@gmail.com>
932
933 * version.cc (print_version): Just print current year.
934 * dwp.cc (print_version): Likewise.
935
936 2015-01-01 Alan Modra <amodra@gmail.com>
937
938 Update year range in copyright notice of all files.
939
940 2014-12-25 Alan Modra <amodra@gmail.com>
941
942 * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
943 new enums.
944 (Target_arm::merge_object_attributes, ): Likewise.
945
946 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
947
948 * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
949 as hard float only when Tag_ABI_VFP_args is 1, using new enum value
950 AEABI_VFP_args_vfp to check that.
951 (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
952 value and replace hardcoded values by enum values.
953
954 2014-12-22 Cary Coutant <ccoutant@google.com>
955
956 * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
957
958 2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
959
960 PR gold/14608
961 * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
962 to "return i * i * 3;".
963
964 2014-12-16 Cary Coutant <ccoutant@google.com>
965
966 * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
967 (Mapfile::print_output_data): Use current_data_size() to avoid
968 assert for sections requiring postprocessing; if address is not valid,
969 print 0.
970 (Mapfile::print_output_section): Use current_data_size(); print note
971 that addresses and sizes are before compression.
972
973 2014-12-14 H.J. Lu <hongjiu.lu@intel.com>
974
975 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
976 Cast current_group_size to unsigned long when reporting error.
977
978 2014-12-10 Jing Yu <jingyu@google.com>
979
980 * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
981 (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
982 Update error message.
983 (Target_aarch64::do_relax): Use absolute value of option
984 stub_group_size. Replace local variable with class member
985 stub_group_size_.
986
987 2014-12-04 Alan Modra <amodra@gmail.com>
988
989 * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
990 addend of PLTREL24 reloc when not generating a plt stub. Make
991 max_branch_offset an "Address".
992 (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
993 (Target_powerpc::Relocate::relocate): Likewise.
994
995 2014-12-04 Alan Modra <amodra@gmail.com>
996
997 PR 17670
998 * symtab.cc (Symbol::set_undefined): Remove assertion.
999 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1000 on symbols defined in discarded sections, instead return false.
1001 Rearrange params, update all callers.
1002 (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1003 branches to syms in discarded sections.
1004 (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1005 undefined and flag as discarded.
1006 (Target_powerpc::Relocate::relocate): Localize variable.
1007
1008 2014-12-03 H.J. Lu <hongjiu.lu@intel.com>
1009
1010 PR gold/17675
1011 * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1012 * testsuite/Makefile.in: Regenerated.
1013
1014 2014-12-03 Alan Modra <amodra@gmail.com>
1015
1016 PR 17566
1017 * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1018 when adding dynamic relocations against section symbols.
1019
1020 2014-12-01 Dimitry Ivanov <dimitry@google.com>
1021
1022 * layout.cc (Layout::finish_dynamic_section): When '-z global'
1023 is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1024 * options.h (General_options): New -z option (global).
1025
1026 2014-12-01 Cary Coutant <ccoutant@google.com>
1027
1028 PR gold/17578
1029 * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1030 is given.
1031 (Layout::create_executable_stack_info): Warn when -z noexecstack is
1032 given but some inputs require executable stack.
1033
1034 2014-11-26 Cary Coutant <ccoutant@google.com>
1035
1036 * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1037 .debug_str_offsets; strip .debug_gnu_pubnames and
1038 .debug_gnu_pubtypes.
1039 (lines_only_debug_sections): Strip all four new sections.
1040
1041 2014-11-26 Jing Yu <jingyu@google.com>
1042
1043 * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1044 register to be x0 when to relax TLSDESC_LD64_LO12.
1045
1046 2014-11-26 Alan Modra <amodra@gmail.com>
1047
1048 * powerpc.cc (struct Stub_table_owner): New.
1049 (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1050 unsigned int vector. Update all references.
1051 (powerpc_relobj::set_stub_table): Take an unsigned int param
1052 rather than a Stub_table. Update callers.
1053 (Powerpc_relobj::clear_stub_table): New function.
1054 (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1055 stub_group_size_ vars.
1056 (Target_powerpc::new_stub_table): Delete.
1057 (max_branch_delta): New function, extracted from..
1058 (Target_powerpc::Relocate::relocate): ..here..
1059 (Target_powerpc::Branch_info::make_stub): ..and here. Return
1060 status on whether stub created successfully.
1061 (Stub_control::Stub_control): Add "no_size_errors" param. Move
1062 default sizing to..
1063 (Target_powerpc::do_relax): ..here. Init stub_group_size_ and
1064 reduce on relax failure.
1065 (Target_powerpc::group_sections): Add "no_size_errors" param.
1066 Use stub_group_size_. Set up group info in a temp vector,
1067 before building Stub_table vector. Account for input sections
1068 possibly already converted to relaxed sections.
1069 (Stub_table::init): Delete. Merge into..
1070 (Stub_table::Stub_table): ..here.
1071 (Stub_table::can_reach_stub): New function.
1072 (Stub_table::add_plt_call_entry): Add "from" parameter and
1073 return true iff stub could be reached.
1074 (Stub_table::add_long_branch_entry): Similarly. Add "r_type"
1075 param too.
1076 (Stub_table::clear_stubs): Add "all" param.
1077
1078 2014-11-26 Alan Modra <amodra@gmail.com>
1079
1080 * powerpc.cc (Stub_control::set_output_and_owner): New function.
1081 (Target_powerpc::group_sections): Use it.
1082
1083 2014-11-25 Cary Coutant <ccoutant@google.com>
1084
1085 * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1086 (Binary_to_elf::write_symbol): Add st_size parameter.
1087 * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1088
1089 2014-11-25 Cary Coutant <ccoutant@google.com>
1090
1091 PR gold/17639
1092 * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1093 (Sized_relobj_file::do_layout): Handle deferred sections properly
1094 during GC pass 1. Don't add reloc sections to deferred list twice.
1095 * object.h (Sized_relobj_file::is_deferred_layout): New function.
1096 (Sized_relobj_file::is_deferred_layout_): New data member.
1097
1098 2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
1099
1100 PR gold/17619
1101 * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1102 Check PC-relative offset overflow in PLT entry.
1103
1104 2014-11-21 Alan Modra <amodra@gmail.com>
1105
1106 * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1107 for undefined weaks.
1108
1109 2014-11-20 Alan Modra <amodra@gmail.com>
1110
1111 * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1112 from --stub-group-size parameter divided by 1024.
1113 (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1114 template parameter. Update all uses.
1115 (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1116 has_stub_value. Set for long branches. Don't report overflow for
1117 branch to undefined weak symbols. Print info message on
1118 overflowing branch to stub.
1119
1120 2014-11-20 Alan Modra <amodra@gmail.com>
1121
1122 * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1123
1124 2014-11-13 H.J. Lu <hongjiu.lu@intel.com>
1125
1126 * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1127 entry for R_X86_64_GOTPLT64.
1128 (Target_x86_64<size>::Relocate::relocate): Update comments for
1129 R_X86_64_GOTPLT64.
1130
1131 2014-11-06 Evgeniy Dushistov <dushistov@mail.ru>
1132
1133 * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1134 * plugin.h: add lock definition
1135
1136 2014-10-29 Han Shen <shenhan@google.com>
1137 Jing Yu <jingyu@google.com>
1138
1139 * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1140 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1141 TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1142 Symbol::TLS_REF.
1143 * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1144 method.
1145 (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1146 (Target_aarch64::tls_ld_to_le): New method.
1147 (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1148 for 64bit targets.
1149 (Output_data_plt_aarch64::irelative_rel_): New data member.
1150 (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1151 (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1152 (Output_data_plt_aarch64::add_relocation): New method.
1153 (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1154 offset. Add got_irelative size to got size.
1155 (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1156 type string with the new typename.
1157 (AArch64_relocate_functions::update_adr): Replace parameter x with
1158 immed.
1159 (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1160 (AArch64_relocate_functions::reloc_common): New method.
1161 (AArch64_relocate_funcsions::rela_general): Extract common part out
1162 into reloc_common method.
1163 (AArch64_relocate_functions::rela_general): Likewise.
1164 (AArch64_relocate_functions::pcrela_general): Likewise.
1165 (AArch64_relocate_functions::adr): New method.
1166 (AArch64_relocate_functions::adrp): Calculate immed before calling
1167 update_adr.
1168 (AArch64_relocate_functions::adrp): Likewise.
1169 (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1170 comparing x to 0. Calculate immed from ~x when x < 0.
1171 (Target_aarch64::optimize_tls_reloc): Add new cases for
1172 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1173 TLSLD_MOVW_DTPREL_G0_NC.
1174 (Target_aarch64::possible_function_pointer_reloc): Implement this
1175 method.
1176 (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1177 comment.
1178 (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1179 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1180 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1181 (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1182 symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1183 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1184 (Target_aarch64::make_plt_entry): Call add_entry with two more
1185 parameters.
1186 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1187 (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1188 ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1189 TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1190 (Target_aarch64::Relocate::relocate_tls): Add cases for
1191 TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1192 TLSLD_MOVW_DTPREL_G0_NC.
1193 * testsuite/icf_safe_so_test.cc: Correct test comment.
1194 * testsuite/icf_safe_test.sh: Add AArch64 arch.
1195
1196 2014-10-22 Alan Modra <amodra@gmail.com>
1197
1198 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1199 thread_starter.
1200
1201 2014-10-18 Andreas Schwab <schwab@linux-m68k.org>
1202
1203 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1204
1205 2014-10-17 Cary Coutant <ccoutant@google.com>
1206
1207 * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1208 Add "typename" keyword.
1209
1210 2014-10-15 Han Shen <shenhan@google.com>
1211 Jing Yu <jingyu@google.com>
1212
1213 Patch for gold aarch64 backend to support relaxation.
1214 * aarch64-reloc.def: Change format.
1215 * aarch64.cc (class Reloc_stub): New class.
1216 (class Stub_table): New class.
1217 (class AArch64_relobj): New class.
1218 (class AArch64_input_section): New class.
1219 (class AArch64_output_section): New class.
1220 (Target_aarch64::new_stub_table): New method.
1221 (Target_aarch64::new_aarch64_input_section): New method.
1222 (Target_aarch64::find_aarch64_input_section): New method.
1223 (Target_aarch64::scan_section_for_stubs): New method.
1224 (Target_aarch64::scan_reloc_section_for_stubs): New method.
1225 (Target_aarch64::relocate_stub): New method.
1226 (Target_aarch64::current_target): New method.
1227 (Target_aarch64::do_make_elf_object): New method.
1228 (Target_aarch64::do_may_relax): New method.
1229 (Target_aarch64::do_relax): New method.
1230 (Target_aarch64::group_sections): New method.
1231 (Target_aarch64::scan_reloc_for_stub): New method.
1232 (Target_aarch64::do_make_output_section): New method.
1233 (Target_aarch64::stub_tables_): New data member.
1234 (Target_aarch64::aarch64_input_section_map_): New data member.
1235 (AArch64_relocate_functions::maybe_apply_stub): New method.
1236
1237 2014-09-30 Cary Coutant <ccoutant@google.com>
1238
1239 PR gold/17432
1240 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1241
1242 2014-09-30 Kito Cheng <kito@0xlab.org>
1243
1244 PR gold/13597
1245 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1246 hash table before sysv-style hash table.
1247
1248 2014-09-29 Sriraman Tallam <tmsriram@google.com>
1249
1250 * options.h (--pic-executable): Add negative to alias to -no-pie.
1251
1252 2014-09-26 Cary Coutant <ccoutant@google.com>
1253
1254 PR gold/16773
1255 * object.cc (Sized_relobj_file): Compute value of section symbols
1256 for TLS sections the same as TLS symbols.
1257
1258 2014-09-25 Cary Coutant <ccoutant@google.com>
1259
1260 PR gold/17432
1261 * resolve.cc (Symbol_table::resolve): Override common placeholder
1262 symbols, but adjust sizes.
1263 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1264 symbols to common lists.
1265
1266 2014-09-24 Alan Modra <amodra@gmail.com>
1267
1268 * po/POTFILES.in: Regenerate.
1269
1270 2014-09-23 Taiju Tsuiki <tzik@google.com>
1271 Cary Coutant <ccoutant@google.com>
1272
1273 PR gold/14860
1274 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1275 on input_sections_blocker.
1276 * layout.cc (Write_sections_task::locks): Unblock
1277 input_sections_blocker_.
1278 * layout.h (Write_sections_task::Write_sections_task): Add
1279 input_sections_blocker.
1280 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1281 to DEPENDENCIES.
1282 * testsuite/Makefile.in: Regenerate.
1283
1284 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1285
1286 * testsuite/Makefile.am (plugin_test_10): New test.
1287 * testsuite/Makefile.in: Regenerate
1288 * testsuite/plugin_common_test_2.c (c1): Align to 8.
1289 * testsuite/plugin_test_10.sh: New file.
1290
1291 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1292
1293 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1294 * resolve.cc (Symbol_table::resolve): Don't override common symbols
1295 during the replacement phase.
1296
1297 2014-09-17 Han Shen <shenhan@google.com>
1298 Jing Yu <jingyu@google.com>
1299
1300 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1301 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1302 * aarch64.cc (Target_aarch64): Add data members
1303 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1304 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1305 constructor.
1306 (Target_aarch64::do_reloc_symbol_index): New method.
1307 (Target_aarch64::do_reloc_addend): New method.
1308 (Target_aarch64::add_tlsdesc_info): New method.
1309 (Target_aarch64::do_dynsym_value): New method.
1310 (Target_aarch64::do_make_data_plt): Add new parameters: got,
1311 got_irelative. Pass them to Output_data_plt_aarch64_standard.
1312 (Target_aarch64::make_data_plt): Add new parameters: got,
1313 got_irelative. Pass them to do_make_data_plt.
1314 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1315 (Target_aarch64::Relocate:tls_gd_to_le): New method.
1316 (Target_aarch64::Relocate:tls_ie_to_le): New method.
1317 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1318 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1319 (Target_aarch64::got_tlsdesc_section): New method.
1320 (Target_aarch64::make_local_ifunc_plt_entry): New method.
1321 (Target_aarch64::define_tls_base_symbol): New method.
1322 (Target_aarch64::reserve_tlsdesc_entries): New method.
1323 (Target_aarch64::got_mod_index_entry): New method.
1324 (Target_aarch64::rela_tlsdesc_section): New method.
1325 (Target_aarch64::rela_irelative_section): New method.
1326 (Target_aarch64::Tlsdesc_info): New struct.
1327 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1328 relocations and tlsdesc relocations.
1329 (Target_aarch64::optimize_tls_reloc): Implement method.
1330 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1331 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1332 in constructor.
1333 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1334 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1335 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1336 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1337 (Output_data_plt_aarch64::rela_tlsdesc): New method.
1338 (Output_data_plt_aarch64::rela_irelative): New method.
1339 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1340 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1341 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1342 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1343 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1344 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1345 (Output_data_plt_aarch64_standard): New member variables:
1346 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1347 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1348 New parameter: got, got_irelative.
1349 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1350 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1351 (Output_data_plt_aarch64::do_write): Replace got_address with
1352 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1353 (AArch64_relocate_functions::update_movnz): New method.
1354 (AArch64_relocate_functions): Correct format.
1355 (AArch64_relocate_functions::movnz): New method.
1356 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1357 before the switch. Add new cases to switch.
1358 Check ie_to_le relaxation on tlsie relocations. Add code handling
1359 tlsgd tlsdesc cases.
1360 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1361 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1362 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1363 Call reloc_name_in_error_message to print unsupported reloc.
1364 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1365 make_data_plt.
1366 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1367 relocs. Fill in some more dynamic tags.
1368 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1369 Skip call tls_get_addr when tlsgd is relaxed.
1370 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1371 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1372 tlsdesc->ie relaxation.
1373
1374 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1375
1376 * mips.cc (Target_mips_nacl): New class.
1377 (Target_selector_mips_nacl): New class.
1378 (target_selector_mips32): Rename from target_selector_mips32be and use
1379 Target_selector_mips_nacl instead of Target_selector_mips.
1380 (target_selector_mips32el): Rename from target_selector_mips32 and use
1381 Target_selector_mips_nacl instead of Target_selector_mips.
1382 (target_selector_mips64): Rename from target_selector_mips64be and use
1383 Target_selector_mips_nacl instead of Target_selector_mips.
1384 (target_selector_mips64el): Rename from target_selector_mips64 and use
1385 Target_selector_mips_nacl instead of Target_selector_mips.
1386 (Target_mips::mips_info): Add const attribute.
1387
1388 2014-09-02 Cary Coutant <ccoutant@google.com>
1389
1390 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1391 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1392 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1393 (Sized_incr_dynobj::do_section_name): Likewise.
1394 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1395 (Sized_incr_dynobj::do_section_name): Likewise.
1396 * object.h (Object::section_name): Likewise.
1397 (Object::do_section_name): Likewise.
1398 (Sized_relobj_file::do_section_name): Likewise.
1399 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1400 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1401
1402 2014-09-02 Cary Coutant <ccoutant@google.com>
1403
1404 PR gold/17005
1405 * ehframe.cc (Fde::write): Add output_offset parameter.
1406 (Cie::write): Likewise.
1407 (Eh_frame::set_final_data_size): Account for offset within output
1408 section.
1409 (Eh_frame::do_sized_write): Likewise.
1410 * ehframe.h (Fde::write): Add output_offset parameter.
1411 (Cie::write): Likewise.
1412 * output.cc (Output_section::Input_section_sort_entry): Remove
1413 section_has_name_; add output_section_name parameter. Use
1414 output section name for non-input sections.
1415 (Output_section::Input_section_sort_entry::section_has_name): Remove.
1416 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1417 (Output_section::Input_section_sort_compare): Remove logic for
1418 sections without names.
1419 (Output_section::Input_section_sort_init_fini_compare): Likewise.
1420 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1421 Likewise.
1422 (Output_section::Input_section_sort_section_name_compare): Likewise.
1423
1424 2014-08-29 Han Shen <shenhan@google.com>
1425 Jing Yu <jingyu@google.com>
1426
1427 * aarch64-reloc-property.cc
1428 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1429 reference reloc property in the table.
1430 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1431 3 other entries.
1432 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1433 2 new overloaded methods.
1434 (Output_data_got_aarch64::do_write): Add code to write out
1435 static relocs.
1436 (class Output_data_got_aarch64::Static_reloc): New class to wrap
1437 static relocs.
1438 (Output_data_got_aarch64::static_relocs): New vector to
1439 hold static relocs.
1440 (Target_aarch64::TCB_SIZE): New const static memeber.
1441 (Target_aarch64::tcb_size): New method.
1442 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1443 (Target_aarch64::Relocate::relocate_tls): New method.
1444 (Target_aarch64::Scan::local): Add code handling new reloc types.
1445 (Target_aarch64::Scan::global): Add code handling new reloc types.
1446
1447 2014-08-13 Sriraman Tallam <tmsriram@google.com>
1448
1449 * options.h (-no-pie): Add option.
1450
1451 2014-08-08 Jing Yu <jingyu@google.com>
1452 Han Shen <shenhan@google.com>
1453
1454 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1455 (DEFFILES): add aarch64-reloc.def.
1456 (TARGETSOURCES): Add aarch64-reloc-property.cc.
1457 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1458 * Makefile.in: Regenerate.
1459 * aarch64-reloc-property.cc: New file.
1460 * aarch64-reloc-property.h: New file.
1461 * aarch64-reloc.def: New file.
1462 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1463 with tab to make the format consistent.
1464 (Output_data_got_aarch64::symbol_table_): New method.
1465 (Target_aarch64::do_plt_address_for_global): New method.
1466 (Target_aarch64::do_plt_address_for_local): New method.
1467 (Target_aarch64::do_select_as_default_target): New method.
1468 (Target_aarch64::do_make_data_plt): New method.
1469 (Target_aarch64::make_data_plt): New method.
1470 (Output_data_plt_aarch64::has_irelative_section): New method.
1471 (Output_data_plt_aarch64::address_for_global): New method.
1472 (Output_data_plt_aarch64::address_for_local): New method.
1473 (Output_data_plt_aarch64::irelative_rel_): New parameter.
1474 (Output_data_plt_aarch64::add_entry): Implement contents.
1475 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1476 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1477 the got_pov entry to plt0.
1478 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1479 Implement contents.
1480 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1481 (AArch64_howto): New struct.
1482 (aarch64_howto[]): New static const array.
1483 (AArch64_relocate_functions): New class.
1484 (Target_aarch64::Scan::get_reference_flags): Remove method.
1485 (Target_aarch64::Scan::local): Implement to support a few relocations.
1486 (Target_aarch64::Scan::global): Implement to support a few relocations.
1487 (Target_aarch64::make_plt_section): Implement contents.
1488 (Target_aarch64::make_plt_entry): Implement contents.
1489 (Target_aarch64::do_finalize_sections): Implement contents.
1490 (Target_aarch64::Relocate::relocate): Implement a few relocations.
1491 (Target_aarch64::relocate_section): Implement contents.
1492
1493 2014-08-06 Alan Modra <amodra@gmail.com>
1494
1495 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1496
1497 2014-08-06 Alan Modra <amodra@gmail.com>
1498
1499 PR 13227
1500 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1501
1502 2014-07-21 Sriraman Tallam <tmsriram@google.com>
1503
1504 * object.cc (Relobj::is_section_name_included): Add
1505 ".rodata.nptl_version" to not garbage collect this section.
1506
1507 2014-07-08 Cary Coutant <ccoutant@google.com>
1508
1509 * expression.cc (struct Expression::Expression_eval_info): Add
1510 new fields type_pointer, vis_pointer, and nonvis_pointer.
1511 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1512 nonvis_pointer parameters. Adjust all calls.
1513 (Symbol_expression::value): Update type, visibility, and nonvis bits
1514 in caller.
1515 * script.cc (Symbol_assignment::sized_finalize): Update type,
1516 visibility, and remaining st_other bits for new symbol.
1517 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1518 vis_pointer, and nonvis_pointer parameters.
1519 * symtab.h (Symbol::set_type): New method.
1520
1521 * testsuite/Makefile.am (defsym_test): New test.
1522 * testsuite/Makefile.in: Regenerate.
1523 * testsuite/defsym_test.c: New file.
1524 * testsuite/defsym_test.sh: New file.
1525
1526 2014-07-08 Cary Coutant <ccoutant@google.com>
1527
1528 PR gold/15639
1529 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1530 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1531 (Sized_dynobj::base_read_symbols): ...new method.
1532 * object.h (Sized_relobj_file::base_read_symbols): New method.
1533 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1534 (Sized_relobj_file::base_read_symbols): ...new method.
1535 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1536 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1537 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1538
1539 2014-07-04 Alan Modra <amodra@gmail.com>
1540
1541 * po/POTFILES.in: Regenerate.
1542
1543 2014-07-02 Jing Yu <jingyu@google.com>
1544
1545 * aarch64.cc: New file
1546 * Makefile.am (TARGETSOURCES): Add aarch64.cc
1547 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1548 * Makefile.in: Regenerate.
1549 * configure.tgt: Add entries for aarch64*.
1550 * configure.ac: Likewise.
1551 * configure: Likewise.
1552
1553 2014-06-27 Alan Modra <amodra@gmail.com>
1554
1555 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1556
1557 2014-06-24 Cary Coutant <ccoutant@google.com>
1558
1559 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1560 sections.
1561 (Dwo_file::sized_read_unit_index): Likewise.
1562
1563 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1564
1565 * mips.cc: New file.
1566 * Makefile.am (TARGETSOURCES): Add mips.cc
1567 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1568 * configure.tgt: Add entries for mips*.
1569 * configure.ac: Likewise.
1570 * Makefile.in: Regenerate.
1571 * configure: Likewise.
1572
1573 2014-06-09 Cary Coutant <ccoutant@google.com>
1574
1575 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1576 unit_length is within section bounds.
1577
1578 2014-06-09 Cary Coutant <ccoutant@google.com>
1579
1580 PR gold/16980
1581 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1582 map.
1583
1584 2014-06-07 Alan Modra <amodra@gmail.com>
1585
1586 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1587
1588 2014-06-06 Cary Coutant <ccoutant@google.com>
1589
1590 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1591 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1592 (Dwarf_pubnames_table::read_header): Likewise.
1593 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1594 .debug_gnu_pubtypes.
1595
1596 2014-06-05 Joel Brobecker <brobecker@adacore.com>
1597
1598 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1599 * Makefile.in, configure: Regenerate.
1600
1601 2014-06-03 Alan Modra <amodra@gmail.com>
1602
1603 * powerpc.cc (addis_12_2): Define.
1604 (Stub_table::do_write): Support fusion on ELFv2 stubs.
1605
1606 2014-06-03 Alan Modra <amodra@gmail.com>
1607
1608 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1609 st_other output.
1610
1611 2014-06-02 Alan Modra <amodra@gmail.com>
1612
1613 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1614 Only ignore relocs on ELFv1.
1615 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1616
1617 2014-05-30 Cary Coutant <ccoutant@google.com>
1618
1619 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1620 * testsuite/Makefile.in: Regenerate.
1621 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1622
1623 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
1624
1625 PR gold/16945
1626 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1627 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
1628
1629 2014-05-15 Alan Modra <amodra@gmail.com>
1630
1631 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1632 Compare FDE contents with DW_CFA_nop rather than 0.
1633
1634 2014-05-13 Sriraman Tallam <tmsriram@google.com>
1635
1636 * symtab.h (may_need_copy_reloc): Remove check for position independent
1637 code.
1638 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1639 position independence before pc absolute may_need_copy_reloc call.
1640 Add check for executable output befor pc relative may_need_copy_reloc
1641 call.
1642 * i386.cc: Ditto.
1643 * arm.cc: Ditto.
1644 * sparc.cc: Ditto.
1645 * tilegx.cc: Ditto.
1646 * powerpc.cc: Add check for no position independence before
1647 may_need_copy_reloc calls.
1648 * testsuite/pie_copyrelocs_test.cc: New file.
1649 * testsuite/pie_copyrelocs_shared_test.cc: New file.
1650 * Makefile.am (pie_copyrelocs_test): New test.
1651 * Makefile.in: Regenerate.
1652
1653 2014-05-08 Martin Liška <mliska@suse.cz>
1654
1655 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1656
1657 2014-05-06 Cary Coutant <ccoutant@google.com>
1658
1659 PR gold/16900
1660 * i386.cc (Output_data_got_plt_i386): New class.
1661 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1662 parameter. Change all callers.
1663 (Output_data_plt_i386::layout_): Remove.
1664 (Output_data_plt_i386::got_plt_): Change type.
1665 (Target_i386::got_plt_): Change type. Change all references.
1666 (Target_i386::got_section): Create instance of new class.
1667 (Output_data_got_plt_i386::do_write): New function.
1668 * x86_64.cc (Output_data_got_plt_x86_64): New class.
1669 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1670 parameter. Change all callers.
1671 (Output_data_plt_x86_64::layout_): Remove.
1672 (Output_data_plt_x86_64::got_plt_): Change type.
1673 (Target_x86_64::got_plt_): Change type. Change all references.
1674 (Target_x86_64::got_section): Create instance of new class.
1675 (Output_data_got_plt_x86_64::do_write): New function.
1676 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1677 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1678 class.
1679
1680 2014-05-05 Cary Coutant <ccoutant@google.com>
1681
1682 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1683 if we have pubnames/pubtypes.
1684
1685 2014-05-02 Cary Coutant <ccoutant@google.com>
1686
1687 * defstd.cc (in_segment): Define __ehdr_start here...
1688 * layout.cc (Layout::finalize): ...Instead of here. Set the
1689 output segment when known.
1690 * resolve.cc (Symbol::override_base_with_special): Remember
1691 the original binding.
1692 * symtab.cc (Symbol::set_output_segment): New function.
1693 (Symbol::set_undefined): New function.
1694 * symtab.h (Symbol::is_weak_undefined): Check original undef
1695 binding.
1696 (Symbol::is_strong_undefined): New function.
1697 (Symbol::set_output_segment): New function.
1698 (Symbol::set_undefined): New function.
1699 * target-reloc.h (is_strong_undefined): Remove.
1700 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1701 Check for hidden undefs.
1702 (relocate_section): Call Symbol::is_strong_undefined.
1703
1704 * testsuite/Makefile.am (ehdr_start_test_1)
1705 (ehdr_start_test_2, ehdr_start_test_3)
1706 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1707 * testsuite/Makefile.in: Regenerate.
1708 * testsuite/ehdr_start_def.cc: New source file.
1709 * testsuite/ehdr_start_test.cc: New source file.
1710 * testsuite/ehdr_start_test.t: New linker script.
1711 * testsuite/ehdr_start_test_4.sh: New shell script.
1712
1713 2014-04-23 Cary Coutant <ccoutant@google.com>
1714
1715 PR gold/16870
1716 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1717
1718 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1719
1720 * layout.cc (Layout::include_section): Allow a target to decide
1721 whether to include a section.
1722 * target.h (Target::should_include_section): New function.
1723 (Target::do_should_include_section): New function.
1724
1725 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1726
1727 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1728 inline into ...
1729 (Copy_relocs::emit): ... here.
1730 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1731 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1732 (Copy_reloc_entry::entries_): Change from private to protected.
1733
1734 2014-04-02 Sriraman Tallam <tmsriram@google.com>
1735
1736 * icf.cc (get_section_contents): Replace copies of reloc
1737 vectors with const references.
1738
1739 2014-04-02 Cary Coutant <ccoutant@google.com>
1740
1741 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1742 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1743 * configure: Regenerate.
1744 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1745 -fno-use-linker-plugin.
1746 (LINK1, CXXLINK1): Add it to the link command.
1747 * testsuite/Makefile.in: Regenerate.
1748
1749 2014-03-12 Alan Modra <amodra@gmail.com>
1750
1751 * Makefile.in: Regenerate.
1752
1753 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1754
1755 * symtab.h (Symbol::set_nonvis): New function.
1756
1757 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1758
1759 * symtab.cc (Sized_symbol<32>::init_output_data):
1760 Instantiate the template.
1761 (Sized_symbol<64>::init_output_data): Likewise.
1762
1763 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1764
1765 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1766 adjust dynamic symbol value.
1767 * target.h (Target::adjust_dyn_symbol): New function.
1768 (Target::do_adjust_dyn_symbol): New function.
1769
1770 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1771
1772 * output.cc (Output_data_dynamic::Dynamic_entry::write):
1773 Get the value of DYNAMIC_CUSTOM dynamic entry.
1774 * output.h (Output_data_dynamic::add_custom): New function.
1775 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1776 dynamic entry.
1777 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1778 * target.h (Target::dynamic_tag_custom_value): New function.
1779 (Target::do_dynamic_tag_custom_value): New function.
1780
1781 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1782
1783 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1784 dynsym indexes.
1785 * target.h (Target::has_custom_set_dynsym_indexes): New function.
1786 (Target::do_has_custom_set_dynsym_indexes): New function.
1787 (Target::set_dynsym_indexes): New function.
1788 (Target::do_set_dynsym_indexes): New function.
1789
1790 2014-03-07 Alan Modra <amodra@gmail.com>
1791
1792 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1793 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1794 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1795 (Powerpc_relocate_functions::has_overflow_bitfield,
1796 overflowed): Use the above.
1797 (Target_powerpc::Relocate::relocate): Correct overflow checking
1798 for a number of relocations. Modify overflow test for 16-bit
1799 fields in instructions to signed/unsigned according to whether
1800 the field takes a signed or unsigned value.
1801
1802 2014-03-05 Alan Modra <amodra@gmail.com>
1803
1804 Update copyright years.
1805
1806 2014-03-05 Alan Modra <amodra@gmail.com>
1807
1808 * powerpc.cc (Target_powerpc::Scan::local, global): Support
1809 R_PPC64_ADDR64_LOCAL.
1810 (Target_powerpc::Relocate::relocate): Likewise.
1811
1812 2014-03-03 Alan Modra <amodra@gmail.com>
1813
1814 * dwp.cc (print_version): Update copyright year to current.
1815
1816 2014-02-10 Alan Modra <amodra@gmail.com>
1817
1818 * po/gold.pot: Regenerate.
1819
1820 2014-02-06 Cary Coutant <ccoutant@google.com>
1821
1822 Fix problem where -u is ignored when a weak undef is seen.
1823
1824 * archive.cc (Library_base::should_include_member): Reorder
1825 code to check for -u option if a weak undef has already been seen.
1826 * testsuite/Makefile.am (weak_undef_test_2): New test case.
1827 * testsuite/Makefile.in: Regenerate.
1828 * testsuite/weak_undef_file3.cc: New file.
1829 * testsuite/weak_undef_file4.cc: New file.
1830 * testsuite/weak_undef_test_2.cc: New file.
1831
1832 2014-02-05 Cary Coutant <ccoutant@google.com>
1833
1834 Fix issues with gold undefined symbol diagnostics.
1835
1836 PR binutils/15435
1837 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
1838 check to here.
1839 * target-reloc.h (is_strong_undefined): New function.
1840 (relocate_section): Move undef vtable symbol check from here.
1841 Check for is_strong_undefined.
1842
1843 2014-02-05 Cary Coutant <ccoutant@google.com>
1844
1845 Fix problems with the --dynamic-list option.
1846
1847 PR gold/13577
1848 * options.cc (General_options::parse_dynamic_list):
1849 Set have_dynamic_list_.
1850 (General_options::General_options): Initialize have_dynamic_list_.
1851 (General_options::finalize): Turn off -Bsymbolic and
1852 -Bsymbolic-functions if --dynamic-list provided.
1853 * options.h (General_options::have_dynamic_list): New function.
1854 (General_options::have_dynamic_list_): New data member.
1855 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
1856 correctly.
1857
1858 PR gold/16530
1859 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
1860 in --dynamic-list, mark it.
1861
1862 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
1863 (dynamic_list_2): New test case.
1864 * testsuite/Makefile.in: Regenerate.
1865 * testsuite/dynamic_list_2.cc: New file.
1866 * testsuite/dynamic_list_2.t: New file.
1867 * testsuite/dynamic_list_lib1.cc: New file.
1868 * testsuite/dynamic_list_lib2.cc: New file.
1869 * testsuite/gc_dynamic_list_test.c: New file.
1870 * testsuite/gc_dynamic_list_test.sh: New file.
1871 * testsuite/gc_dynamic_list_test.t: New file.
1872
1873 2014-01-28 Cary Coutant <ccoutant@google.com>
1874
1875 Add .gdb_index version 7 support.
1876
1877 * gold/dwarf_reader.cc: include <utility> (for make_pair).
1878 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
1879 debug sections.
1880 (Dwarf_ranges_table::read_ranges_table): Likewise.
1881 (Dwarf_pubnames_table::read_section): Check for GNU-style
1882 sections, and for compressed debug sections.
1883 (Dwarf_pubnames_table::read_header): Compute end address of table.
1884 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
1885 for end of list by offset, not by offset == 0.
1886 (Dwarf_info_reader::do_read_string_table): Check for compressed
1887 debug sections.
1888 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1889 Initialize new data members.
1890 (Dwarf_pubnames_table::next_name): return flag_byte.
1891 (Dwarf_pubnames_table::end_of_table_): New data member.
1892 (Dwarf_pubnames_table::is_gnu_style_): New data member.
1893 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
1894 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
1895 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
1896 read skeleton type unit DIEs.
1897 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
1898 (Gdb_index::do_write): Write flag_byte.
1899 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
1900 (Gdb_index::Cu_vector): Store flags along with cu indexes.
1901 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
1902 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
1903
1904 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
1905
1906 * version.cc (print_version): Update copyright year to 2014.
1907
1908 2013-12-19 Dimitry Andric <dimitry@andric.com>
1909
1910 * stringpool.cc (Stringpool_template::reserve): Add
1911 HAVE_UNORDERED_MAP case.
1912 * stringpool.cc (Stringpool_template::print_stats): Likewise.
1913
1914 2013-12-18 Cary Coutant <ccoutant@google.com>
1915
1916 * configure.ac: Check for <unordered_set> and <unordered_map>.
1917 * config.in: Regenerate.
1918 * configure: Regenerate.
1919 * system.h: Use <unordered_set> and <unordered_map> if available.
1920
1921 2013-12-10 Roland McGrath <mcgrathr@google.com>
1922
1923 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
1924 with $(INSTALL_PROGRAM_ENV).
1925 * Makefile.in: Regenerate.
1926
1927 2013-11-22 Cary Coutant <ccoutant@google.com>
1928
1929 * configure.ac: Add check for which library is needed for
1930 dlopen.
1931 * configure: Regenerate.
1932
1933 2013-11-22 Cary Coutant <ccoutant@google.com>
1934
1935 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
1936 assembler.
1937 * testsuite/Makefile.in: Regenerate.
1938
1939 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
1940
1941 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
1942 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
1943 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
1944 (Target_x86_64<size>::Scan::local): Likewise.
1945 (Target_x86_64<size>::Scan::global): Likewise.
1946 (Target_x86_64<size>::Relocate::relocate): Likewise.
1947 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
1948 Likewise.
1949 (Target_x86_64<size>::Scan::check_non_pic(): Handle
1950 R_X86_64_PC32_BND.
1951
1952 * testsuite/Makefile.am (check_PROGRAMS): Add
1953 exception_x86_64_bnd_test.
1954 (exception_x86_64_bnd_test_SOURCES): New macro.
1955 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
1956 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
1957 (exception_x86_64_bnd_test_LDADD): Likewise.
1958 (exception_x86_64_bnd_1.o): New rule.
1959 (exception_x86_64_bnd_2.o): Likewise.
1960 * testsuite/Makefile.in: Regenerated.
1961
1962 2013-11-15 Alan Modra <amodra@gmail.com>
1963
1964 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
1965 accessor.
1966 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
1967 Only call ppc64_local_entry_offset for 64-bit. Restrict
1968 symval_for_branch lookup to ELFv1.
1969 (Stub_table::add_plt_call_entry): Use unsigned int off.
1970 (Output_data_glink::Address, invalid_address): New.
1971 (Output_data_glink::add_eh_frame): Move out of line. Add
1972 support for ELFv2.
1973 (Output_data_glink::add_global_entry, find_global_entry,
1974 global_entry_address): New functions.
1975 (Output_data_glink::global_entry_stubs_, end_branch_table_,
1976 ge_size): New variables.
1977 (Output_data_glink::set_final_data_size): Add global entry
1978 stub sizing.
1979 (Output_data_glink::do_write): Write global entry stubs.
1980 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1981 parameter. Return true for ELFv2. Adjust callers.
1982 (Target_powerpc::Scan::local, global): Restrict opd lookup to
1983 ELFv1. Similarly for ifunc and dynamic relocation processing
1984 specific to ELFv1. Recognize that symbols are defined on
1985 their plt entries for ELFv2.
1986 (Target_powerpc::symval_for_branch): Assert if called for
1987 ELFv2 or ppc32.
1988 (Target_powerpc::Relocate::relocate): Use global entry plt
1989 stub for symbol value if such exists on ELFv2.
1990 (Target_powerpc::Relocate::relocate): Don't call
1991 symval_for_branch when ELFv2. Do adjust for local entry
1992 offset when ELFv2.
1993 (Target_powerpc::do_dynsym_value): Set symbols to global entry
1994 plt stub for ELFv2.
1995 (Target_powerpc::do_plt_address_for_global): Similarly.
1996
1997 2013-11-14 Cary Coutant <ccoutant@google.com>
1998
1999 Revert patch -- this did not fix the problem, and there is
2000 no race there.
2001
2002 2013-11-14 Cary Coutant <ccoutant@google.com>
2003
2004 PR gold/14860
2005 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2006 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2007 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2008 updating fde_offsets_.
2009 (Eh_frame_hdr::lock_): New data member.
2010
2011 2013-11-14 Cary Coutant <ccoutant@google.com>
2012
2013 * dwp.cc (Dwo_file_entry): New type.
2014 (File_list): Use Dwo_file_entry.
2015 (Dwo_file::verify): New function.
2016 (Dwo_file::verify_dwo_list): New function.
2017 (Dwo_file::sized_verify_dwo_list): New function.
2018 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2019 list.
2020 (Dwp_options): New enum type.
2021 (dwp_options): Add --verify-only.
2022 (usage): Likewise.
2023 (main): Likewise.
2024 * dwp.h (gold_info): Add declaration.
2025
2026 2013-11-14 Cary Coutant <ccoutant@google.com>
2027
2028 PR gold/14860
2029 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2030 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2031 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2032 updating fde_offsets_.
2033 (Eh_frame_hdr::lock_): New data member.
2034
2035 2013-11-06 Cary Coutant <ccoutant@google.com>
2036
2037 PR gold/15758
2038 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2039 before reloc sections.
2040
2041 2013-11-04 Alan Modra <amodra@gmail.com>
2042
2043 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2044 (Symbol::needs_dynamic_reloc): Test new flag.
2045 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2046 (Target_powerpc::Scan::get_reference_flags): Add target param.
2047 Return FUNC_DESC_ABI for 64-bit ELFv1.
2048 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2049 call.
2050 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2051 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2052
2053 2013-10-31 Cary Coutant <ccoutant@google.com>
2054
2055 Restore support for dwp v2 DWARF package file format.
2056
2057 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2058 tu_length parameter. Adjust all callers.
2059 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2060 * dwp.cc: Include dwarf.h.
2061 (Section_bounds): New struct type.
2062 (Unit_set): New struct type.
2063 (Dwo_file::Dwo_file): Initialize new data member.
2064 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2065 Combine and rename to...
2066 (Dwo_file::read_unit_index): ...this.
2067 (Dwo_file::sized_read_compunit_index)
2068 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2069 (Dwo_file::sized_read_unit_index): ...this.
2070 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2071 parameters; add section_id parameter.
2072 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2073 (Dwo_file::add_unit_set): ...this.
2074 (Dwo_file::shndx_map_): Remove.
2075 (Dwo_file::sect_offsets_): New data member.
2076 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2077 (Dwp_output_file::add_section): Rename to...
2078 (Dwp_output_file::add_contribution): ...this.
2079 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2080 (Dwp_output_file::add_tu_set): Likewise.
2081 (Dwp_output_file::Contribution): New type.
2082 (Dwp_output_file::Section::contributions): New data member.
2083 (Dwp_output_file::Cu_or_tu_set): Remove.
2084 (Dwp_output_file::Section::Section): New ctor.
2085 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2086 (Dwp_output_file::Dwp_index::Section_table): New type.
2087 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2088 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2089 parameter.
2090 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2091 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2092 (Dwp_output_file::Dwp_index::section_table): New member function.
2093 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2094 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2095 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2096 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2097 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2098 (Dwp_output_file::Dwp_index::section_table_): New data member.
2099 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2100 (Dwp_output_file::add_output_section): New member function.
2101 (Dwp_output_file::write_new_section): New member function.
2102 (Dwp_output_file::write_contributions): New member function.
2103 (Dwp_output_file::section_id_map_): New data member.
2104 (class Dwo_id_info_reader): Remove.
2105 (class Unit_reader): New class.
2106 (get_dwarf_section_name): New function.
2107 (Dwo_file::read_executable): Adjust initializations of class data.
2108 (Dwo_file::read): Add support for v2 package file format.
2109 (Dwo_file::read_unit_index): Likewise.
2110 (Dwo_file::sized_read_unit_index): Likewise.
2111 (Dwo_file::copy_section): Likewise.
2112 (Dwo_file::add_unit_set): Likewise.
2113 (Dwp_output_file::add_output_section): Likewise.
2114 (Dwp_output_file::add_contribution): Likewise.
2115 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2116 for empty slot.
2117 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2118 file format.
2119 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2120 slot.
2121 (Dwp_output_file::initialize): Remove unused function.
2122 (Dwp_output_file::finalize): Add support for v2 package file format.
2123 (Dwp_output_file::write_index): Likewise.
2124 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2125 function prototype.
2126
2127 2013-10-31 Cary Coutant <ccoutant@google.com>
2128
2129 * configure.ac: Fix check for -fmerge-constants.
2130 * configure.ac: Regenerate.
2131
2132 2013-10-30 Roland McGrath <mcgrathr@google.com>
2133
2134 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2135 Correct 9-byte nop sequence to match what the assembler generates.
2136
2137 2013-10-30 Alan Modra <amodra@gmail.com>
2138
2139 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2140 ppc64_local_entry_offset, ppc64_local_entry_offset,
2141 do_read_symbols): New functions.
2142 (Powerpc_relobj::e_flags_, st_other_): New vars.
2143 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2144 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2145 (Powerpc_relobj::e_flags_): New var.
2146 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2147 and adjust for ELFv2.
2148 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2149 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2150 (Powerpc_dynobj::do_find_special_sections): Likewise.
2151 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2152 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2153 to ELFv2 local entry.
2154 (Target_powerpc::do_relax): No thread safe barriers needed for
2155 ELFv2.
2156 (Output_data_plt_powerpc::initial_plt_entry_size_,
2157 plt_entry_size): Delete. Replace all uses with
2158 first_plt_entry_offset() and plt_entry_size().
2159 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2160 reserved_size parm. Update callers.
2161 (Output_data_plt_powerpc::entry_count): Update.
2162 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2163 and use Target_powerpc::first_plt_entry_offset().
2164 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2165 rename to plt_entry_size.
2166 (Output_data_plt_powerpc::add_ifunc_entry,
2167 add_local_ifunc_entry): Adjust reloc for ELFv2.
2168 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2169 (glink_eh_frame_fde_64v2): New.
2170 (Stub_table::plt_call_size): Support ELFv2 sizing.
2171 (Output_data_glink::add_eh_frame): Use the new FDE.
2172 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2173 (Stub_table::do_write): Write ELFv2 stubs and glink.
2174 (Target_powerpc::Relocate::relocate): Replaces nop after call
2175 with ld 2,24(1) and adjust local offset destination for ELFv2.
2176
2177 2013-10-30 Alan Modra <amodra@gmail.com>
2178
2179 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2180 (Target_powerpc::Scan::global, local): Likewise.
2181 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
2182 on all ppc64 @h and @ha relocs.
2183
2184 2013-10-14 Alan Modra <amodra@gmail.com>
2185
2186 * output.h (Output_data_got::add_constant): Tidy.
2187 (Output_data_got::add_constant_pair): New function.
2188 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2189 methods used so as to first call reserve_ent().
2190
2191 2013-10-11 Roland McGrath <mcgrathr@google.com>
2192
2193 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2194 add_got_entry and add_got_entry_pair.
2195
2196 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2197 (HAVE_PUBNAMES): Likewise.
2198 * configure: Regenerate.
2199
2200 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2201 * testsuite/Makefile.in: Regenerate.
2202
2203 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2204 Remove const from declaration.
2205 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2206 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2207 * output.h (Output_file_header): Remove const from member target_
2208 and corresponding constructor argument.
2209 * output.cc (Output_file_header::Output_file_header): Update prototype.
2210 (Output_file_header::do_sized_write): Use this->target_ in place
2211 of parameters()->target().
2212
2213 * testsuite/undef_symbol.cc (Foo::get_a): New method.
2214
2215 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2216 * configure: Regenerate.
2217 * Makefile.in: Regenerate.
2218 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2219 * testsuite/merge_string_literals_2.c: Likewise.
2220 * testsuite/Makefile.am
2221 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2222 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2223 literal -fmerge-constants.
2224 * testsuite/Makefile.in: Regenerate.
2225
2226 * i386.cc (Target_i386): Remove unused member dynbss_.
2227 * arm.cc (Target_arm): Likewise.
2228 * powerpc.cc (Target_powerpc): Likewise.
2229 * sparc.cc (Target_sparc): Likewise.
2230 * tilegx.cc (Target_tilegx): Likewise.
2231 * x86_64.cc (Target_x86_64): Likewise.
2232 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2233 type_signature_, type_offset_.
2234 * plugin.h (Plugin_hook): Remove unused member layout_.
2235 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2236 mapfile_.
2237 (Read_member): Remove unused members input_objects_, symtab_,
2238 mapfile_, layout_.
2239 (Check_library): Remove unused member symtab_.
2240 * archive.h (Lib_group): Remove unused member lib_.
2241 * archive.cc (Lib_group::Lib_group): Update initializer.
2242 * incremental.h (Incremental_binary): Remove unused member target_.
2243 (Incremental_script_entry): Removed unused member script_.
2244 * layout.h (Write_symbols_task): Remove unused member input_objects_.
2245 * icf.h (Icf): Remove unused member num_tracked_relocs.
2246
2247 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2248 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2249 its only use.
2250 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2251
2252 * archive.h: Use struct rather than class for forward declaration
2253 of Read_symbols_data.
2254
2255 2013-10-07 Cary Coutant <ccoutant@google.com>
2256
2257 PR gold/16010
2258 * testsuite/Makefile.am (icf_test): Fix dependencies.
2259 (icf_safe_test): Likewise.
2260 (icf_safe_so_test): Likewise.
2261 (large_symbol_alignment): Add empty _LDADD rule.
2262 * testsuite/Makefile.in: Regenerate.
2263
2264 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
2265
2266 PR gold/15927
2267 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2268 relocation for R_X86_64_32 on x32.
2269
2270 2013-08-27 Roland McGrath <mcgrathr@google.com>
2271
2272 * output.cc (Output_segment::set_section_addresses): Take new
2273 Target* argument. If target->isolate_execinstr() and the segment
2274 is executable and starts at a target->abi_pagesize() boundary,
2275 pad its end out to a target->abi_pagesize() boundary with code fill.
2276 * output.h (Output_segment::set_section_addresses): Update decl.
2277 * layout.h (Layout::check_output_data_for_reset_values): Take new
2278 argument RELAX_OUTPUTS.
2279 (Layout): New member relax_output_list_.
2280 (Layout::add_relax_output): New method.
2281 * layout.cc (Layout::Layout): Update constructor.
2282 (Layout::reset_relax_output): New method.
2283 (Layout::clean_up_after_relaxation): Call it.
2284 (Layout::prepare_for_relaxation): Update caller.
2285 (Layout::set_segment_offsets): Update callers of set_section_addresses.
2286 Call reset_relax_output before re-processing segments for
2287 isolate_execinstr case.
2288 (Layout::write_data): Handle relax_output_list_.
2289 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2290 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
2291
2292 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
2293
2294 PR binutils/15834
2295 * object.h: Fix typos.
2296
2297 2013-08-16 Roland McGrath <mcgrathr@google.com>
2298
2299 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2300 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2301
2302 2013-08-07 Cary Coutant <ccoutant@google.com>
2303
2304 Revert support for v2 DWP files:
2305
2306 2013-03-01 Cary Coutant <ccoutant@google.com>
2307
2308 Add dwp support for v2 DWARF package file format.
2309 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2310 tu_length parameter. Adjust all callers.
2311 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2312 * dwp.cc: Include dwarf.h.
2313 (Section_bounds): New struct type.
2314 (Unit_set): New struct type.
2315 (Dwo_file::Dwo_file): Initialize new data member.
2316 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2317 Combine and rename to...
2318 (Dwo_file::read_unit_index): ...this.
2319 (Dwo_file::sized_read_compunit_index)
2320 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2321 (Dwo_file::sized_read_unit_index): ...this.
2322 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2323 parameters; add section_id parameter.
2324 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2325 (Dwo_file::add_unit_set): ...this.
2326 (Dwo_file::shndx_map_): Remove.
2327 (Dwo_file::sect_offsets_): New data member.
2328 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2329 (Dwp_output_file::add_section): Rename to...
2330 (Dwp_output_file::add_contribution): ...this.
2331 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2332 (Dwp_output_file::add_tu_set): Likewise.
2333 (Dwp_output_file::Contribution): New type.
2334 (Dwp_output_file::Section::contributions): New data member.
2335 (Dwp_output_file::Cu_or_tu_set): Remove.
2336 (Dwp_output_file::Section::Section): New ctor.
2337 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2338 (Dwp_output_file::Dwp_index::Section_table): New type.
2339 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2340 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2341 parameter.
2342 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2343 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2344 (Dwp_output_file::Dwp_index::section_table): New member function.
2345 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2346 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2347 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2348 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2349 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2350 (Dwp_output_file::Dwp_index::section_table_): New data member.
2351 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2352 (Dwp_output_file::add_output_section): New member function.
2353 (Dwp_output_file::write_new_section): New member function.
2354 (Dwp_output_file::write_contributions): New member function.
2355 (Dwp_output_file::section_id_map_): New data member.
2356 (class Dwo_id_info_reader): Remove.
2357 (class Unit_reader): New class.
2358 (get_dwarf_section_name): New function.
2359 (Dwo_file::read_executable): Adjust initializations of class data.
2360 (Dwo_file::read): Add support for v2 package file format.
2361 (Dwo_file::read_unit_index): Likewise.
2362 (Dwo_file::sized_read_unit_index): Likewise.
2363 (Dwo_file::copy_section): Likewise.
2364 (Dwo_file::add_unit_set): Likewise.
2365 (Dwp_output_file::add_output_section): Likewise.
2366 (Dwp_output_file::add_contribution): Likewise.
2367 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2368 for empty slot.
2369 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2370 file format.
2371 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2372 slot.
2373 (Dwp_output_file::initialize): Remove unused function.
2374 (Dwp_output_file::finalize): Add support for v2 package file format.
2375 (Dwp_output_file::write_index): Likewise.
2376 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2377 function prototype.
2378
2379 2013-07-31 Cary Coutant <ccoutant@google.com>
2380
2381 * object.cc (Sized_relobj::do_output_section_address): New function.
2382 (Sized_relobj): Instantiate explicitly.
2383 * object.h (Object::output_section_address): New function.
2384 (Object::do_output_section_address): New function.
2385 (Sized_relobj::do_output_section_address): New function.
2386 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2387
2388 2013-07-30 Cary Coutant <ccoutant@google.com>
2389 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2390
2391 * parameters.cc (Parameters::entry): Return target-specific entry
2392 symbol name.
2393 * target.h (Target::entry_symbol_name): New function.
2394 (Target_info::entry_symbol_name): New data member.
2395
2396 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2397 * i386.cc (Target_i386::i386_info): Likewise.
2398 (Target_i386_nacl::i386_nacl_info): Likewise.
2399 * sparc.cc (Target_sparc::sparc_info): Likewise.
2400 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2401 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2402 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2403 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2404
2405 2013-07-22 Sterling Augustine <saugustine@google.com>
2406
2407 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2408 Convert parameter shndx to local variable. Add parameters symtab
2409 and symtab_size. Scan over section names. Find relocation
2410 section corresponding to current section. Create and initialize
2411 reloc_mapper_ and reloc_type_.
2412 (Dwarf_pubnames_table::read_header): Add assertion. Change
2413 unit_length to off_t. Initialize member unit_length_. Fill in field
2414 cu_offset_.
2415 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2416 Initialize new fields unit_length_ and cu_offset_.
2417 (Dwarf_pubnames_table::read_section): Update prototype.
2418 (Dwarf_pubnames_table::cu_offset): New member function.
2419 (Dwarf_pubnames_table::subsection_size): Likewise.
2420 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2421 New fields.
2422 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2423 member functions public.
2424 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2425 Update comment. Rework logic. Move repeated parts to...
2426 (Gdb_index_info_reader::read_pubtable): ...here. New function.
2427 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2428 pubtypes_table_, and stmt_list_offset.
2429 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2430 Gdb_index::find_pubtype_offset,
2431 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2432 (Gdb_index::pubnames_read): Update prototype and rework logic.
2433 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2434 Forward declare.
2435 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2436 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2437 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2438 Gdb_index::map_pubtable_to_dies):
2439 Declare functions.
2440 (Gdb_index::pubnames_read): Update declaration.
2441 (Gdb_index::Pubname_offset_map): New type.
2442 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2443 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2444 Gdb_index::stmt_list_offset): Declare.
2445 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2446 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2447 Gdb_index::pubtypes_offset_): Remove.
2448
2449 2013-07-19 Roland McGrath <mcgrathr@google.com>
2450
2451 * options.h (General_options): Add -Trodata-segment option.
2452 * parameters.cc (Parameters::check_rodata_segment): New function.
2453 (Parameters::set_target_once): Call it.
2454 * parameters.h (Parameters): Declare it (private member function).
2455 * layout.cc (load_seg_unusable_for_headers): New function, broken
2456 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
2457 then validate rodata segment rather than text segment.
2458 (relaxation_loop_body): Call that.
2459 (is_text_segment): New function. Don't admit a non-executable
2460 segment if TARGET->isolate_execinstr().
2461 (set_segment_offsets): Call it. Honor -Trodata-segment option.
2462
2463 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
2464
2465 PR gold/15070
2466 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2467 * nacl.h (Sniff_file::View::View): Request aligned view.
2468
2469 2013-07-11 Cary Coutant <ccoutant@google.com>
2470
2471 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2472 correct BRLT entry size.
2473
2474 2013-07-03 Alan Modra <amodra@gmail.com>
2475
2476 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2477 comment.
2478
2479 2013-07-01 Cary Coutant <ccoutant@google.com>
2480
2481 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2482 reloc_type_.
2483 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2484 (Dwarf_ranges_table::lookup_reloc): New function.
2485 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2486 reloc_type_.
2487 (Dwarf_ranges_table::lookup_reloc): New function.
2488 (Dwarf_ranges_table::reloc_type_): New data member.
2489
2490 2013-06-27 Jing Yu <jingyu@google.com>
2491
2492 PR gold/15662
2493 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2494 function.
2495 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2496 (Target_powerpc::do_relax): Call the above.
2497
2498 2013-06-27 Cary Coutant <ccoutant@google.com>
2499
2500 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2501 on garbage collected .opd section.
2502
2503 2013-06-27 Alan Modra <amodra@gmail.com>
2504
2505 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2506 is non-zero.
2507 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2508 (Target_powerpc::do_function_location): Likewise for loc->shndx.
2509
2510 2013-06-14 Cary Coutant <ccoutant@google.com>
2511
2512 * resolve.cc (Symbol::override_base): Don't override st_type
2513 from plugin placeholder symbols.
2514 (Symbol_table::resolve): Likewise.
2515 (Symbol_table::should_override): Don't complain about TLS mismatch
2516 if the TO symbol is a plugin placeholder.
2517 * testsuite/Makefile.am (plugin_test_tls): New test.
2518 * testsuite/Makefile.in: Regenerate.
2519 * testsuite/plugin_test_tls.sh: New test script.
2520 * testsuite/two_file_test_2_tls.cc: New test source.
2521 * testsuite/two_file_test_tls.cc: New test source.
2522
2523 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
2524
2525 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2526 the maximum segment alignment is larger than the page size.
2527 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2528 correctly aligns the symbols with large alignemnt.
2529 * testsuite/Makefile.in: Regenerate.
2530 * testsuite/large_symbol_alignment.cc: New file.
2531
2532 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
2533 Sriraman Tallam <tmsriram@google.com>
2534
2535 * options.h (sort_section): New option.
2536 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2537 Rename from Input_section_sort_section_name_special_ordering_compare.
2538 (Input_section_sort_section_name_compare): New struct.
2539 * output.cc (Output_section::Input_section_sort_section_name_compare::
2540 operator()): New function.
2541 (Output_section::sort_attached_input_sections): Use new sort function
2542 for .text if --sort-section=name is specified.
2543 * layout.cc (Layout::make_output_section):
2544 Add sorting by name when --sort-section=name is specified.
2545 * testsuite/Makefile.am (text_section_grouping): Test option
2546 --sort-section=name.
2547 * testsuite/Makefile.in: Regenerate.
2548 * testsuite/section_sorting_name.cc: New file.
2549 * testsuite/section_sorting_name.sh: New file.
2550
2551 2013-05-21 Cary Coutant <ccoutant@google.com>
2552
2553 * symtab.h (Symbol::is_cxx_vtable): New function.
2554 * target-reloc.h (relocate_section): Check for vtable symbol.
2555 * testsuite/Makefile.am (missing_key_func.sh): New test case.
2556 * testsuite/Makefile.in: Regenerate.
2557 * testsuite/missing_key_func.cc: New test source.
2558 * testsuite/missing_key_func.sh: New test script.
2559
2560 2013-05-21 Cary Coutant <ccoutant@google.com>
2561
2562 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2563 type of enclosing symbol.
2564 (Relocate_info::location): Check symbol type when describing symbol.
2565 * object.h (Symbol_location_info): Remove unused line_number;
2566 add enclosing_symbol_type.
2567 * testsuite/debug_msg.sh: Adjust expected output.
2568
2569 2013-05-13 Cary Coutant <ccoutant@google.com>
2570
2571 * configure.ac: Export DEFAULT_TARGET.
2572 * configure: Regenerate.
2573 * Makefile.in: Regenerate.
2574 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2575 * testsuite/Makefile.in: Regenerate.
2576 * testsuite/debug_msg.sh: Delete duplicate tests.
2577 Don't check undef_int error message match for powerpc where the
2578 source file and line number aren't available.
2579
2580 2013-05-10 Roland McGrath <mcgrathr@google.com>
2581
2582 * options.h (General_options): Add --rosegment-gap option.
2583 * options.cc (finalize): --rosegment-gap implies --rosegment.
2584 * layout.cc (set_segment_offsets): Let user option override
2585 target->rosegment_gap().
2586
2587 2013-05-10 Roland McGrath <mcgrathr@google.com>
2588
2589 * options.h (General_options): Remove leading space from help
2590 messages for -nostdlib and --rosegment.
2591
2592 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
2593
2594 PR ld/15365
2595 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2596
2597 2013-05-03 Alan Modra <amodra@gmail.com>
2598
2599 * merge.cc (Output_merge_string::do_add_input_section): Correct
2600 scan for number of strings. Rename vars to avoid shadowing.
2601 Include missing terminator in input_size_.
2602
2603 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
2604
2605 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2606 Restore empty string handling.
2607
2608 2013-05-01 Cary Coutant <ccoutant@google.com>
2609
2610 * stringpool.cc (Stringpool_template::new_key_offset): Fix
2611 uninitialized warning.
2612
2613 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
2614
2615 * output.cc (Output_section::add_merge_input_section): Allow
2616 to merge sections if the alignment is more than character size.
2617 * merge.h (Output_merge_string::Output_merge_string): Remove
2618 assert.
2619 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2620 only not-null strings. Check the alignment of strings.
2621 * stringpool.h
2622 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2623 alignment as the argument.
2624 (Stringpool_template<Stringpool_char>::addralign_): New class member.
2625 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2626 Align non-zero length strings according to the addralign_.
2627 (Stringpool_template<Stringpool_char>::set_string_offsets):
2628 Updating offsets according to the given alignment.
2629 * testsuite/Makefile.am (text_section_grouping): Test if string
2630 literals are getting merged.
2631 * testsuite/Makefile.in: Regenerate.
2632 * testsuite/merge_string_literals_1.c: New file.
2633 * testsuite/merge_string_literals_2.c: Ditto.
2634 * testsuite/merge_string_literals.sh: Ditto.
2635
2636 2013-04-26 Ian Lance Taylor <iant@google.com>
2637
2638 * target-reloc.h (relocate_section): If the reloc offset is out of
2639 range, pass VIEW as NULL to relocate.relocate.
2640 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2641 * i386.cc (Target_i386::Relocate::relocate): Likewise.
2642 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2643 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2644 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2645 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2646
2647 2013-04-26 Geoff Pike <gpike@chromium.org>
2648
2649 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2650 * layout.cc (Hash_task): New class.
2651 (Layout::queue_build_id_tasks): New function.
2652 (Layout::write_build_id): Handle single-thread portion of build ID
2653 computation. (In some cases, all of it is single-threaded.) Replace
2654 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2655 functionality in fewer lines of code.
2656 * layout.h (Layout::queue_build_id_tasks): New function declaration.
2657 * options.h (General_options): make "--build-id" default to tree
2658 rather than sha1. Add two new options related to --build-id=tree:
2659 --build-id-chunk-size-for-treehash and
2660 --build-id-min-file-size-for-treehash.
2661 * Makefile.am: add testing of --build-id=tree and related new options
2662 (these tests will be invoked by "make check").
2663 * Makefile.in: Regenerate.
2664
2665 2013-04-25 Alan Modra <amodra@gmail.com>
2666
2667 * configure.tgt: Add powerpcle and powerpc64le.
2668
2669 2013-04-22 Alan Modra <amodra@gmail.com>
2670
2671 PR gold/15355
2672 * layout.cc (Layout::segment_precedes): Allow more than one
2673 segment with the same type and flags.
2674
2675 2013-04-15 Cary Coutant <ccoutant@google.com>
2676
2677 * layout.cc (Layout::set_relocatable_section_offsets): Don't
2678 allocate space in file for BSS sections.
2679
2680 2013-04-15 Cary Coutant <ccoutant@google.com>
2681
2682 * script-sections.cc (Orphan_output_section): Reset address
2683 to zero after each orphaned section for relocatable links.
2684
2685 2013-04-15 Cary Coutant <ccoutant@google.com>
2686
2687 * symtab.cc (Symbol_table::sized_write_globals): Subtract
2688 section starting address for relocatable link.
2689 * testsuite/Makefile.am (script_test_11): New test.
2690 * testsuite/Makefile.in: Regenerate.
2691 * testsuite/script_test_11.c: New source file.
2692 * testsuite/script_test_11.t: New linker script.
2693
2694 2013-04-13 Alan Modra <amodra@gmail.com>
2695
2696 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2697 owner when sections are not adjacent and exceed group size.
2698 (Target_powerpc::group_sections): Handle corner case.
2699 (Target_powerpc::Branch_info::make_stub): Handle case where
2700 stub table doesn't exist due to branches in non-exec sections.
2701 (Target_powerpc::Relocate::relocate): Likewise.
2702
2703 2013-04-11 Alan Modra <amodra@gmail.com>
2704
2705 PR gold/15354
2706 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2707 .branch_lt to match bfd ld. Adjust comments throughout file.
2708
2709 2013-04-04 Ian Lance Taylor <iant@google.com>
2710
2711 GCC PR c++/56840
2712 * object.cc (do_layout_deferred_sections): Handle .eh_frame
2713 sections before checking whether they are included in the link.
2714
2715 2013-03-29 Sriraman Tallam <tmsriram@google.com>
2716
2717 * archive.cc (Archive::get_elf_object_for_member): Create the elf
2718 object before calling the plugin claim_file handler. Pass the elf
2719 object of the archive to the plugin. Delete the elf object if the
2720 plugin claims the file.
2721
2722 2013-03-21 Alan Modra <amodra@gmail.com>
2723
2724 * layout.cc (Layout::set_segment_offsets): Accept writable .text
2725 segment when omagic.
2726
2727 2013-03-21 Alan Modra <amodra@gmail.com>
2728
2729 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2730 comparison warning.
2731 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2732 uninitialized" warning.
2733
2734 2013-03-20 Alan Modra <amodra@gmail.com>
2735
2736 * symtab.h (Symbol::clear_version): New function.
2737 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2738 is_needed by weak references. Clear version for symbols defined
2739 in as-needed objects that are not needed.
2740
2741 2013-03-15 Alan Modra <amodra@gmail.com>
2742
2743 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2744 static and public. Add report_err param. Return false for data refs.
2745 (Target_powerpc::rela_dyn_section): New overloaded function.
2746 (Target_powerpc::plt_, iplt_): Elucidate.
2747 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2748 (Output_data_plt_powerpc::do_write): Don't write .iplt.
2749 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2750 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2751 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
2752 push_branch and make_plt_entry for ifunc syms when
2753 reloc_needs_plt_for_ifunc.
2754 (Target_powerpc::Relocate::relocate): Don't use plt entry value
2755 for ifunc unless reloc_needs_plt_for_ifunc.
2756
2757 2013-03-15 Alan Modra <amodra@gmail.com>
2758
2759 * gc.h (gc_process_relocs): Don't look through function descriptors.
2760 * icf.cc (get_section_contents): Do so here instead.
2761
2762 2013-03-13 Alan Modra <amodra@gmail.com>
2763
2764 * powerpc.cc (is_branch_reloc): Forward declare.
2765 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2766 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2767 false for 64-bit, true for 32-bit non-branch relocs.
2768 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2769 * testsuite/Makefile.am (icf_test): Use linker map file instead of
2770 nm output.
2771 (icf_safe_test): Generate linker map file as well as nm output.
2772 (icf_safe_so_test): Likewise.
2773 * testsuite/Makefile.in: Regenerate.
2774 * testsuite/icf_test.sh: Parse linker map file to determine
2775 section folding.
2776 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
2777 * testsuite/icf_safe_so_test.sh: Likewise.
2778 (X86_32_or_ARM_specific_safe_fold): Merge into..
2779 (arch_specific_safe_fold): ..this.
2780 (X86_64_specific_safe_fold): Delete unused function.
2781
2782 2013-03-12 Alan Modra <amodra@gmail.com>
2783
2784 * gc.h (gc_process_relocs): Look through function descriptors
2785 to determine shndx, symvalue and addend used by ICF. Tidy
2786 variable duplication.
2787
2788 2013-03-11 Alan Modra <amodra@gmail.com>
2789
2790 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2791 * layout.cc (Layout_task_runner::run): ..to here.
2792 * symtab.h (struct Symbol_location): Extract from..
2793 (class Symbol_table): ..here.
2794 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2795 * target.h (class Target): Add function_location and
2796 do_function_location functions.
2797 (class Sized_target): Add do_function_location.
2798 * object.h (class Sized_relobj_file): Move find_shdr..
2799 (class Object): ..to here.
2800 * object.cc: Likewise. Update to suit. Instantiate.
2801 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2802 * powerpc.cc (class Powerpc_dynobj): New.
2803 (Target_powerpc::do_function_location): New function.
2804 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
2805 (Powerpc_dynobj::do_read_symbols): New function.
2806 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
2807
2808 2013-03-08 Ian Lance Taylor <iant@google.com>
2809
2810 * options.cc (General_options::string_to_object_format): Accept
2811 "default".
2812
2813 2013-03-08 Alan Modra <amodra@gmail.com>
2814
2815 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
2816 pointer to Post_fde.
2817 (struct Post_fde): Move definition to here..
2818 * ehframe.cc (struct Post_fde): ..from here.
2819 (Cie::write): Don't alloc Post_fde.
2820 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
2821
2822 2013-03-07 Alan Modra <amodra@gmail.com>
2823
2824 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
2825 relocation referencing .LC0.
2826 * testsuite/discard_locals_test.sh: Remove FIXMEs.
2827
2828 2013-03-07 Alan Modra <amodra@gmail.com>
2829
2830 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
2831 always_inline. Add assembly for powerpc to avoid GOT.
2832
2833 2013-03-07 Alan Modra <amodra@gmail.com>
2834
2835 * testsuite/script_test_10.sh: Don't test .bss section
2836 header number.
2837
2838 2013-03-06 Alan Modra <amodra@gmail.com>
2839
2840 * powerpc.cc (class Powerpc_relobj): Move some member functions.
2841 (Target_powerpc::symval_for_branch): Add symtab param. Update
2842 all callers. Handle folded sections.
2843 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
2844 to Powerpc_relobj.
2845 (Global_symbol_visitor_opd::operator()): Likewise.
2846
2847 2013-03-04 Alan Modra <amodra@gmail.com>
2848
2849 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
2850 * testsuite/Makefile.in: Regenerate.
2851
2852 2013-03-01 Cary Coutant <ccoutant@google.com>
2853
2854 Add dwp support for v2 DWARF package file format.
2855 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2856 tu_length parameter. Adjust all callers.
2857 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2858 * dwp.cc: Include dwarf.h.
2859 (Section_bounds): New struct type.
2860 (Unit_set): New struct type.
2861 (Dwo_file::Dwo_file): Initialize new data member.
2862 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2863 Combine and rename to...
2864 (Dwo_file::read_unit_index): ...this.
2865 (Dwo_file::sized_read_compunit_index)
2866 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2867 (Dwo_file::sized_read_unit_index): ...this.
2868 (Dwo_file::copy_section): Remove section_name, is_str_offsets
2869 parameters; add section_id parameter.
2870 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2871 (Dwo_file::add_unit_set): ...this.
2872 (Dwo_file::shndx_map_): Remove.
2873 (Dwo_file::sect_offsets_): New data member.
2874 (Dwp_output_file::Dwp_output_file): Initialize new data members.
2875 (Dwp_output_file::add_section): Rename to...
2876 (Dwp_output_file::add_contribution): ...this.
2877 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2878 (Dwp_output_file::add_tu_set): Likewise.
2879 (Dwp_output_file::Contribution): New type.
2880 (Dwp_output_file::Section::contributions): New data member.
2881 (Dwp_output_file::Cu_or_tu_set): Remove.
2882 (Dwp_output_file::Section::Section): New ctor.
2883 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2884 (Dwp_output_file::Dwp_index::Section_table): New type.
2885 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2886 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2887 parameter.
2888 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2889 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2890 (Dwp_output_file::Dwp_index::section_table): New member function.
2891 (Dwp_output_file::Dwp_index::section_table_end): New member function.
2892 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2893 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2894 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2895 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2896 (Dwp_output_file::Dwp_index::section_table_): New data member.
2897 (Dwp_output_file::Dwp_index::section_mask_): New data member.
2898 (Dwp_output_file::add_output_section): New member function.
2899 (Dwp_output_file::write_new_section): New member function.
2900 (Dwp_output_file::write_contributions): New member function.
2901 (Dwp_output_file::section_id_map_): New data member.
2902 (class Dwo_id_info_reader): Remove.
2903 (class Unit_reader): New class.
2904 (get_dwarf_section_name): New function.
2905 (Dwo_file::read_executable): Adjust initializations of class data.
2906 (Dwo_file::read): Add support for v2 package file format.
2907 (Dwo_file::read_unit_index): Likewise.
2908 (Dwo_file::sized_read_unit_index): Likewise.
2909 (Dwo_file::copy_section): Likewise.
2910 (Dwo_file::add_unit_set): Likewise.
2911 (Dwp_output_file::add_output_section): Likewise.
2912 (Dwp_output_file::add_contribution): Likewise.
2913 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2914 for empty slot.
2915 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2916 file format.
2917 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2918 slot.
2919 (Dwp_output_file::initialize): Remove unused function.
2920 (Dwp_output_file::finalize): Add support for v2 package file format.
2921 (Dwp_output_file::write_index): Likewise.
2922 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2923 function prototype.
2924
2925 2013-03-01 Cary Coutant <ccoutant@google.com>
2926
2927 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
2928 function into class definition in header file.
2929 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
2930 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
2931 New function.
2932 (Dwarf_info_reader::check_buffer): Move here from .cc file.
2933
2934 2013-02-28 Alan Modra <amodra@gmail.com>
2935
2936 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
2937 * target.cc (Target::do_plt_fde_location): New function.
2938 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
2939 accessor function, and constructor param.
2940 (struct Post_fde, Post_fdes): Declare.
2941 (Cie::write): Add post_fdes param.
2942 * ehframe.cc (Fde::write): Use plt_fde_location.
2943 (struct Post_fde): Define.
2944 (Cie::write): Stash FDEs added post merge mapping.
2945 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
2946 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
2947 (Eh_frame::do_sized_write): Arrange to write post map FDES after
2948 other FDEs.
2949 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
2950 (Target_powerpc::has_glink): New function.
2951 (Target_powerpc::do_relax): Add eh_frame info for stubs.
2952 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
2953 glink_eh_frame_fde_32, default_fde): New data.
2954 (Stub_table::eh_frame_added_): New var.
2955 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
2956 Make const.
2957 (Stub_table::add_eh_frame): New function.
2958 (Output_data_glink::add_eh_frame): New function.
2959 (Target_powerpc::make_glink_section): Call add_eh_frame.
2960
2961 2013-02-15 Ian Lance Taylor <iant@google.com>
2962
2963 * options.h (DEFINE_uint64_alias): Define.
2964 (class General_options): Add -Ttext-segment as an alias for
2965 -Ttext.
2966
2967 2013-02-15 Alan Modra <amodra@gmail.com>
2968
2969 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
2970 (Stub_table::do_write): ..here, two places.
2971 (Stub_table::plt_call_size): Use it here too.
2972
2973 2013-02-11 Ian Lance Taylor <iant@google.com>
2974
2975 * descriptors.cc (Descriptors::close_all): New function.
2976 * descriptors.h (class Descriptors): Declare close_all.
2977 (close_all_descriptors): New inline function.
2978 * plugin.cc: Include "descriptors.h".
2979 (Plugin_manager::cleanup): Call close_all_descriptors.
2980
2981 2013-02-06 Alan Modra <amodra@gmail.com>
2982
2983 * README: Update coding style link.
2984
2985 2013-01-28 Cary Coutant <ccoutant@google.com>
2986
2987 * dwp.cc (File_list): New typedef.
2988 (Dwo_name_info_reader): New class.
2989 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2990 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2991 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2992 (Dwo_file::read_executable): New function.
2993 (Dwo_file::read): Move common setup code to ...
2994 (Dwo_file::make_object): ... here.
2995 (dwp_options): Add --exec/-e.
2996 (usage): Likewise.
2997 (main): Likewise.
2998
2999 2013-01-24 Sriraman Tallam <tmsriram@google.com>
3000
3001 * layout.cc (Layout::layout): Check for option text_reorder.
3002 (Layout::make_output_section): Ditto.
3003 * options.h (text_reorder): New option.
3004 * output.cc (Input_section_sort_compare): Remove special ordering
3005 of section names.
3006 (Output_section::
3007 Input_section_sort_section_name_special_ordering_compare::
3008 operator()): New function.
3009 (Output_section::sort_attached_input_sections): Use new sort function
3010 for .text.
3011 * output.h (Input_section_sort_section_name_special_ordering_compare):
3012 New struct.
3013 * testsuite/Makefile.am (text_section_grouping): Test option
3014 --no-text-reorder
3015 * testsuite/Makefile.in: Regenerate.
3016 * testsuite/text_section_grouping.sh: Check order of functions without
3017 default text reordering.
3018
3019 2013-01-18 Mike Frysinger <vapier@gentoo.org>
3020
3021 * options.h (General_options): Change default to true for new_dtags.
3022
3023 2013-01-18 Mike Frysinger <vapier@gentoo.org>
3024
3025 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3026 when enable_new_dtags is false. Only add DT_RUNPATH when
3027 enable_new_dtags is true.
3028
3029 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
3030
3031 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3032 used in declaration and definition consistent.
3033 (Target_powerpc::symval_for_branch): Ditto.
3034
3035 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3036
3037 * testsuite/plugin_final_layout.cc: Fix comment.
3038
3039 2013-01-16 Sriraman Tallam <tmsriram@google.com>
3040
3041 * layout.cc (Layout::layout): Do not do default sorting for
3042 text sections when section ordering is specified.
3043 (make_output_section): Ditto.
3044 * testsuite/plugin_final_layout.cc: Name the function sections
3045 to catch reordering issues.
3046
3047 2013-01-15 Alan Modra <amodra@gmail.com>
3048
3049 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3050 plt-thread-safe.
3051
3052 2013-01-15 Alan Modra <amodra@gmail.com>
3053
3054 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3055 * testsuite/Makefile.in: Regenerate.
3056
3057 2013-01-14 Alan Modra <amodra@gmail.com>
3058
3059 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3060 * testsuite/Makefile.in: Regenerate.
3061
3062 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
3063
3064 PR bfd/14430
3065 Fix mingw gold build with plugins enabled
3066 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3067 * configure.ac: Export DLOPEN_LIBS and add headers check.
3068 * plugin.cc: Handle non-dlfcn case.
3069 * Makefile.in: Regenerate.
3070 * config.in: Regenerate.
3071 * configure: Regenerate.
3072 * testsuite/Makefile.in: Regenerate.
3073
3074 2013-01-09 Sriraman Tallam <tmsriram@google.com>
3075
3076 * output.h (sort_attached_input_sections): Change to be public.
3077 * script-sections.cc
3078 (Output_section_definition::set_section_addresses): Sort
3079 attached input sections according to section order before linker
3080 script assigns section addresses.
3081 (Orphan_output_section::set_section_addresses): Sort
3082 attached input sections according to section order before linker
3083 script assigns section addresses.
3084 * Makefile.am (final_layout.sh): Use a simple linker script to
3085 check if section ordering still works.
3086 * Makefile.in: Regenerate.
3087
3088 2013-01-09 Ben Cheng <bccheng@google.com>
3089
3090 * arm.cc (Target_arm::attributes_accept_div): New function.
3091 (Target_arm::attributes_forbid_div): New function.
3092 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3093 attribute using the same new functions as what bfd/elf32_arm.c
3094 does.
3095
3096 2013-01-07 Cary Coutant <ccoutant@google.com>
3097
3098 PR gold/14993
3099 * output.cc (Output_section::add_input_section): For incremental
3100 updates, don't track input sections that are allocated from patch
3101 space.
3102
3103 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
3104 Ian Lance Taylor <iant@google.com>
3105
3106 PR gold/14897
3107 * configure.ac (--enable-ld): Removed.
3108 (install_as_default): Set to yes only for --enable-gold=default
3109 or --disable-ld.
3110 * configure: Regenerated.
3111
3112 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
3113
3114 * options.h (General_options): Add -fuse-ld= for GCC linker
3115 option compatibility.
3116
3117 2013-01-04 Cary Coutant <ccoutant@google.com>
3118
3119 * configure.ac: Fix typo restoring CXXFLAGS.
3120 * configure: Regenerate.
3121
3122 2013-01-04 Cary Coutant <ccoutant@google.com>
3123
3124 * testsuite/Makefile.am (CXXLINK_S): New macro.
3125 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3126 * testsuite/Makefile.in: Regenerate.
3127
3128 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
3129
3130 * version.cc (print_version): Update copyright year to 2013.
3131
3132 2012-12-20 Ian Lance Taylor <iant@google.com>
3133
3134 * layout.cc (Layout::special_ordering_of_input_section): New
3135 function.
3136 (Layout::layout): If input section requires special ordering, must
3137 sort input sections.
3138 (Layout::make_output_section): May sort .text input sections.
3139 (Layout::is_section_name_prefix_grouped): Remove.
3140 * layout.h (class Layout): Declare
3141 special_ordering_of_input_section. Don't declare
3142 is_section_name_prefix_grouped.
3143 * output.cc (Output_section::add_input_section): Revert last
3144 change.
3145 (Output_section::Input_section_sort::match_file_name): Don't crash
3146 if called on output section data.
3147 (Output_section::Input_section_sort_compare): Sort based on
3148 special ordering.
3149 (Output_section::Input_section_sort_section_order_index_compare):
3150 Revert last patch.
3151 (Output_section::sort_attached_input_sections): Likewise.
3152
3153 2012-12-18 Sriraman Tallam <tmsriram@google.com>
3154
3155 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3156 * layout.h (Layout::is_section_name_prefix_grouped): New function.
3157 * output.cc (Output_section::add_input_section): Check if section
3158 name contains special prefix. Keep input sections to sort such
3159 sections.
3160 (Output_section::Input_section_sort_section_order_index_compare
3161 ::operator()): Group sections according to prefixes.
3162 (Output_section::sort_attached_input_sections): Add condition to
3163 Input_section_entry constructor call.
3164 * testsuite/Makefile.am (text_section_grouping): New test.
3165 * testsuite/Makefile.in: Regenerate.
3166 * testsuite/text_section_grouping.cc: New file.
3167 * testsuite/text_section_grouping.sh: New file.
3168
3169 2012-12-17 Nick Clifton <nickc@redhat.com>
3170
3171 * Makefile.am: Add copyright notice.
3172 * NEWS: Likewise.
3173 * README: Likewise.
3174 * configure.ac: Likewise.
3175 * ftruncate.c: Likewise.
3176 * Makefile.in: Regenerate.
3177
3178 2012-12-14 Cary Coutant <ccoutant@google.com>
3179
3180 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3181 --no-as-needed flag.
3182 (exception_separate_shared_12_test): Likewise.
3183 (incremental_copy_test): Likewise.
3184 * testsuite/Makefile.in: Regenerate.
3185
3186 2012-12-14 Cary Coutant <ccoutant@google.com>
3187
3188 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3189 (Dwp_output_file::Dwp_index::enter_set): Add assert.
3190
3191 2012-12-12 Alan Modra <amodra@gmail.com>
3192
3193 * powerpc.cc (class Track_tls): New.
3194 (class Relocate, class Scan): Inherit Track_tls.
3195 (Target_powerpc::Scan::local, global): Track tls optimization
3196 and avoid creating plt entry for __tls_get_addr if all uses
3197 are optimized away.
3198 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3199
3200 2012-12-12 Alan Modra <amodra@gmail.com>
3201
3202 * options.h (General_options): Add --toc-sort/--no-toc-sort.
3203 Replace no_toc_optimize with toc_optimize.
3204 * output.h (Output_section::input_sections): Provide non-const variant.
3205 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3206 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3207 accessors.
3208 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3209 (class Sort_toc_sections): New.
3210 (Target_powerpc::do_finalize_sections): Sort toc sections.
3211 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3212
3213 2012-12-10 Roland McGrath <mcgrathr@google.com>
3214
3215 * testsuite/binary_unittest.cc (read_all): New function.
3216 (Sized_binary_test): Use it instead of ::read.
3217 * fileread.cc (do_read): Don't assume pread always reads the whole
3218 amount in a single call.
3219
3220 2012-12-10 Alan Modra <amodra@gmail.com>
3221
3222 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3223 Set EM_PPC64 or EM_PPC here.
3224 (Target_selector_powerpc::do_recognize): Delete.
3225
3226 2012-12-10 Alan Modra <amodra@gmail.com>
3227
3228 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3229 stub_table_.
3230 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3231
3232 2012-12-07 Roland McGrath <mcgrathr@google.com>
3233
3234 * testsuite/binary_unittest.cc (Sized_binary_test):
3235 Use open_descriptor rather than ::open.
3236
3237 2012-12-07 Alan Modra <amodra@gmail.com>
3238
3239 * powerpc.cc (Stub_table::do_write): Delete redundant Address
3240 typedef and invalid_address constant.
3241 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3242 instantiate constants.
3243
3244 2012-12-06 Roland McGrath <mcgrathr@google.com>
3245
3246 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3247 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3248 * aclocal.m4: Regenerate.
3249 * configure: Regenerate.
3250 * Makefile.in: Regenerate.
3251 * testsuite/Makefile.in: Regenerate.
3252
3253 2012-12-07 Alan Modra <amodra@gmail.com>
3254
3255 * options.h (General_options): Add no_toc_optimize.
3256 * powerpc.cc (ok_lo_toc_insn): New function.
3257 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3258
3259 2012-12-06 Alan Modra <amodra@gmail.com>
3260
3261 * options.h (General_options): Add plt_align, plt_static_chain,
3262 plt_thread_safe. Update stub_group_size help text.
3263 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3264 for new plt_thread_safe_ var.
3265 (use_plt_offset): Correct comments.
3266 (Target_powerpc::do_relax): Look for thread creation symbols to
3267 determine default plt_thread_safe value. Clear plt call stubs
3268 as well as branch stubs each iteration.
3269 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3270 insn constants.
3271 (l, hi, ha, write_insn): Move earlier.
3272 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3273 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3274 plt stubs too.
3275 (Stub_table::update_size): Adjust.
3276 (Stub_table::prev_size, set_prev_size): Delete.
3277 (Stub_table::stub_align): Let --plt-align affect result.
3278 (Stub_table::plt_call_size): Calculate sizes for various stubs.
3279 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3280 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3281 (Stub_table::do_write): Support more stub variants.
3282
3283 2012-12-04 Alan Modra <amodra@gmail.com>
3284
3285 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3286 (Target_powerpc::do_define_standard_symbols): New function.
3287
3288 2012-12-03 Alan Modra <amodra@gmail.com>
3289
3290 * output.h: Formatting, whitespace.
3291
3292 2012-12-03 Alan Modra <amodra@gmail.com>
3293
3294 * layout.h (Layout::get_executable_sections): Declare.
3295 * layout.cc (Layout::get_executable_sections): New function.
3296 * arm.cc (Target_arm::group_sections): Use it.
3297 (Arm_output_section::group_sections): Delete now redundant test.
3298 * output.cc (Output_reloc::Output_reloc): Add is_relative.
3299 param to handle relative relocs.
3300 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3301 (Output_data_reloc::add_absolute): Adjust.
3302 (Output_data_reloc::add_relative): New function.
3303 (Output_data::reset_data_size): New function.
3304 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3305 (Output_section::set_addralign): New function.
3306 (Output_section::checkpoint_set_addralign): New function.
3307 (Output_section::clear_section_offsets_need_adjustment): New function.
3308 (Output_section::input_sections): Make public.
3309 * powerpc.cc (class Output_data_brlt_powerpc): New.
3310 (class Stub_table, class Stub_control): New.
3311 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3312 stub_table_, set_stub_table, stub_table): New vectors and accessor
3313 functions.
3314 (Target_powerpc::do_may_relax, do_relax, push_branch,
3315 new_stub_table, stub_tables, brlt_section, group_sections,
3316 add_branch_lookup_table, find_branch_lookup_table,
3317 write_branch_lookup_table, make_brlt_section): New functions.
3318 (Target_powerpc::struct Sort_sections, class Branch_info): New.
3319 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3320 branch_info_): New vars.
3321 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3322 make call stubs here.
3323 (Output_data_glink): Remove all call stub handling from this class.
3324 (Target_powerpc::Scan::local, global): Save interesting branch
3325 relocs and relocs for ifunc. Adjust calls to plt entry functions.
3326 (Target_powerpc::do_finalize_sections): Only make reg save/restore
3327 functions on final link.
3328 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3329 Handle long branch destinations too.
3330 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3331 do_plt_address_for_local): Adjust lookup of plt call stubs.
3332
3333 2012-11-30 Alan Modra <amodra@gmail.com>
3334
3335 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3336 relocs against protected symbols when building 32-bit shared libs.
3337
3338 2012-11-30 Alan Modra <amodra@gmail.com>
3339
3340 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3341 param. Call got_section() to make .got. Update all callers
3342 and their callers and so on.
3343
3344 2012-11-30 Alan Modra <amodra@gmail.com>
3345
3346 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3347 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3348 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3349 value if it already exists.
3350
3351 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
3352
3353 PR gold/14858
3354 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3355
3356 2012-11-14 Roland McGrath <mcgrathr@google.com>
3357
3358 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3359 than bfc instruction for data sandboxing.
3360
3361 2012-11-08 Alan Modra <amodra@gmail.com>
3362
3363 * po/POTFILES.in: Regenerate.
3364
3365 2012-11-05 Alan Modra <amodra@gmail.com>
3366
3367 * configure.ac: Apply 2012-09-10 change to config.in here.
3368 * configure: Regenerate.
3369
3370 2012-11-05 Alan Modra <amodra@gmail.com>
3371
3372 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3373 (struct Opd_ent): Use "Address" rather than "Offset".
3374 (Output_data_got_powerpc::got_base_offset): Return Valtype.
3375 (Target_powerpc::got_section): Make public.
3376 (Target_powerpc::scan_relocs): Move code setting symbols..
3377 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3378 Create _SDA_BASE_ only when referenced.
3379
3380 2012-11-02 Roland McGrath <mcgrathr@google.com>
3381
3382 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3383 from last change.
3384
3385 2012-11-01 Roland McGrath <mcgrathr@google.com>
3386
3387 * target.h (Sized_target::relocate_relocs): Use Elf_Off
3388 for offset_in_output_section parameter.
3389 (Sized_target::relocate_special_relocatable): Likewise.
3390 * arm.cc (Target_arm::relocate_relocs): Likewise.
3391 (Target_arm::relocate_special_relocatable): Likewise.
3392 * i386.cc (Target_i386::relocate_relocs): Likewise.
3393 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3394 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3395 * target-reloc.h (relocate_relocs): Likewise.
3396 * testsuite/testfile.cc (Target_test): Likewise.
3397 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3398 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3399
3400 * system.h: Move inclusion of <clocale> to after <libintl.h> in
3401 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3402
3403 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3404 parameter, which is unused in the [!F_SETFD] case.
3405
3406 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3407 SYMNDX to off_t before comparing it to this->data_size().
3408 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3409 * incremental.cc (Output_section_incremental_inputs::do_write):
3410 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3411
3412 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3413
3414 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
3415
3416 * gold.cc (Target_arm::do_adjust_elf_header): Add the
3417 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3418 in EABI_VER5.
3419
3420 2012-10-29 Cary Coutant <ccoutant@google.com>
3421
3422 * dwp.cc (usage): Add file and exit status parameters;
3423 add --help and --version options.
3424 (print_version): New function.
3425 (main): Add --help and --version options.
3426
3427 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3428
3429 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3430 final_layout_sequence.txt.
3431 * testsuite/Makefile.in: Regenerated.
3432
3433 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3434
3435 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3436 COMPILE generated by automake.
3437 (LINK1): Likewise.
3438 (CXXCOMPILE1): Likewise.
3439 (CXXLINK1): Likewise.
3440 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3441 (LINK): Likewise.
3442 (CXXCOMPILE): Likewise.
3443 (CXXLINK): Likewise.
3444 * testsuite/Makefile.in: Regenerated.
3445
3446 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3447
3448 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3449 on bad fwrite return.
3450
3451 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
3452
3453 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3454 on val.
3455
3456 2012-10-23 Cary Coutant <ccoutant@google.com>
3457
3458 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3459 * testsuite/Makefile.in: Regenerate.
3460 * testsuite/dwp_test.h: New source file.
3461 * testsuite/dwp_test_1.cc: New source file.
3462 * testsuite/dwp_test_1.s: New source file.
3463 * testsuite/dwp_test_1.sh: New source file.
3464 * testsuite/dwp_test_1b.cc: New source file.
3465 * testsuite/dwp_test_1b.s: New source file.
3466 * testsuite/dwp_test_2.cc: New source file.
3467 * testsuite/dwp_test_2.s: New source file.
3468 * testsuite/dwp_test_2.sh: New source file.
3469 * testsuite/dwp_test_main.cc: New source file.
3470 * testsuite/dwp_test_main.s: New source file.
3471
3472 2012-10-23 Cary Coutant <ccoutant@google.com>
3473
3474 * dwp.h: New header file.
3475 * dwp.cc: New source file.
3476 * gold.h: Move shared declarations to system.h.
3477 * system.h: New header file.
3478 * Makefile.am: Add dwp.
3479 * Makefile.in: Regenerate.
3480
3481 2012-10-23 Cary Coutant <ccoutant@google.com>
3482
3483 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3484 Dwarf_info_reader::read_from_pointer.
3485 (Dwarf_pubnames_table::read_header): Likewise.
3486 (Dwarf_pubnames_table::next_name): Likewise.
3487 (Dwarf_die::read_attributes): Likewise.
3488 (Dwarf_die::skip_attributes): Likewise.
3489 (Dwarf_info_reader::read_from_pointer): New function template.
3490 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3491 (Dwarf_pubnames_table): Likewise.
3492 (Dwarf_info_reader::read_from_pointer): New function template.
3493 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3494 Dwarf_pubnames_table ctor.
3495
3496 2012-10-23 Cary Coutant <ccoutant@google.com>
3497
3498 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3499 abbrev_shndx.
3500 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3501 abbrev_shndx_.
3502 (Dwarf_info_reader::set_abbrev_shndx): New method.
3503 (Dwarf_info_reader::abbrev_shndx_): New data member.
3504
3505 2012-10-23 Cary Coutant <ccoutant@google.com>
3506
3507 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3508 from object, not parameters.
3509 (Dwarf_info_reader::parse): Likewise.
3510 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3511 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3512 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3513 methods.
3514
3515 2012-10-23 Cary Coutant <ccoutant@google.com>
3516
3517 * fileread.cc (Input_file::Input_file): New constructor.
3518 * fileread.h (class Input_file): Add new constructor.
3519
3520 2012-10-18 Alan Modra <amodra@gmail.com>
3521
3522 PR gold/14727
3523 * object.cc (Relobj::is_section_name_included): Also match
3524 .sdata personality section.
3525
3526 2012-10-18 Alan Modra <amodra@gmail.com>
3527
3528 * target-reloc.h (class Default_comdat_behavior): New, package up..
3529 (get_comdat_behaviour): ..this.
3530 (relocate_section): Add Relocate_comdat_behavior template arg,
3531 adjust code to suit.
3532 * arm.cc (Target_arm::relocate_section): Adjust to suit.
3533 (Target_arm::scan_reloc_section): Likewise.
3534 * i386.cc (Target_i386::relocate_section): Likewise.
3535 * sparc.cc (Target_sparc::relocate_section): Likewise.
3536 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3537 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3538 * powerpc.cc (class Relocate_comdat_behavior): New.
3539 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
3540 gold::relocate_section with new template arg.
3541
3542 2012-10-18 Alan Modra <amodra@gmail.com>
3543
3544 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3545 dynamic relocs for GOT_TPREL got entries, without symbol if
3546 resolving locally.
3547 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3548 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3549 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3550
3551 2012-10-17 Alan Modra <amodra@gmail.com>
3552
3553 PR gold/14726
3554 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3555
3556 2012-10-16 Sriraman Tallam <tmsriram@google.com>
3557
3558 * layout.cc (Layout::include_section): Keep sections marked
3559 SHF_EXCLUDE when doing relocatable links.
3560
3561 2012-10-16 Alan Modra <amodra@gmail.com>
3562
3563 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3564 (Target_powerpc::do_finalize_sections): Call it.
3565 (Output_data_save_res): New class and supporting functions.
3566 (Target_powerpc::symval_for_branch): Only look up .opd entry for
3567 normal symbols defined in object files.
3568
3569 2012-10-12 Alan Modra <amodra@gmail.com>
3570
3571 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3572 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
3573 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3574 section if scan_opd_relocs not yet called.
3575 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3576
3577 2012-10-12 Alan Modra <amodra@gmail.com>
3578
3579 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3580 add_local_ifunc_entry): Revert last change.
3581 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3582
3583 2012-10-05 Alan Modra <amodra@gmail.com>
3584
3585 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3586 do_plt_address_for_global): New functions.
3587 (Output_data_got_powerpc::do_write): Don't segfault when linking
3588 statically.
3589 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3590 add_local_ifunc_entry): Return true on adding entry..
3591 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3592 glink->add_entry call. Remove unused symtab param. Adjust calls.
3593 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3594 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
3595 set up symbols here.
3596 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3597 syms here. Do so even when no .iplt. Don't segfault when linking
3598 statically.
3599 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
3600 new variants without reloc param.
3601 (Glink_sym_ent::Glink_sym_ent): Likewise.
3602 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3603 reloc when refs will resolve to plt call stub.
3604 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
3605 R_PPC_PLTREL24 to resolve locally.
3606 (Target_powerpc::Scan::global): Correct ifunc handling.
3607 (Target_powerpc::Relocate::relocate): Correct local sym glink
3608 lookup. Don't destroy "value" when we have a plt call stub,
3609 and when checking plt call validity.
3610 (Target_powerpc::do_dynsym_value): Simplify.
3611
3612 2012-10-05 Alan Modra <amodra@gmail.com>
3613
3614 * i386.cc (Output_data_plt_i386::address_for_global,
3615 address_for_local): Add plt offset to returned value. Adjust uses.
3616 * sparc.cc (Output_data_plt_sparc::address_for_global,
3617 address_for_local): Likewise.
3618 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3619 address_for_local): Likewise.
3620 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3621 address_for_local): Likewise.
3622 * target.h (Target::plt_address_for_global, plt_address_for_local):
3623 Update comment.
3624 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3625 (Output_data_got::Got_entry::write): Nor here.
3626 * output.h: Comment fix.
3627
3628 2012-10-02 Jiong Wang <jiwang@tilera.com>
3629
3630 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3631 global_offset_table_ value for larget got.
3632 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3633
3634 2012-09-29 Alan Modra <amodra@gmail.com>
3635
3636 * powerpc.cc (Target_powerpc::iplt_): New output section.
3637 (Target_powerpc::iplt_section, make_iplt_section,
3638 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3639 (Target_powerpc::make_plt_entry): Handle ifunc syms.
3640 Target_powerpc::plt_entry_count): Count iplt entries too.
3641 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3642 reloc section in constructor. New params.
3643 (Target_powerpc::make_plt_section): Create reloc section here instead.
3644 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3645 functions.
3646 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3647 (Output_data_glink::add_entry, find_entry): New functions to
3648 deal with local syms.
3649 (Glink_sym_ent): Add support for local syms.
3650 (Output_data_glink::do_write): Handle ifunc plt entries.
3651 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3652 (Target_powerpc::Scan::local, global): Handle ifunc syms.
3653 (Target_powerpc::Relocate::relocate): Likewise.
3654 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3655
3656 2012-09-25 Alan Modra <amodra@gmail.com>
3657
3658 * object.h (Sized_relobj_file::adjust_local_symbol,
3659 do_adjust_local_symbol): New functions.
3660 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3661 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3662 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3663 and irregular opd entry spacing.
3664 (Powerpc_relobj::do_read_relocs): Add opd size checks.
3665 (Global_symbol_visitor_opd): New functor.
3666 (Target_powerpc::do_finalize_sections): Omit global symbols defined
3667 on deleted opd entries.
3668
3669 2012-09-15 Jiong Wang <jiwang@tilera.com>
3670
3671 * tilegx.cc: New file.
3672 * Makefile.am (TARGETSOURCES): Add tilegx.cc
3673 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3674 * configure.tgt: Add entries for tilegx*.
3675 * configure.ac: Likewise.
3676 * Makefile.in: Rebuild.
3677 * configure: Likewise.
3678 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3679 tilegx.
3680
3681 2012-09-13 Alan Modra <amodra@gmail.com>
3682
3683 * target-reloc.h (scan_relocs): Call scan.local for relocs
3684 against symbols in discarded sections. Pass is_discarded
3685 param.
3686 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3687 Add is_discarded param.
3688 * powerpc (Target_powerpc::Scan::local): Likewise. Use
3689 is_discarded to flag opd entry as discarded. Don't emit dyn
3690 relocs on such entries.
3691 (Target_powerpc::Scan::global): Similarly detect and handle
3692 such opd entries.
3693 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3694 opd_ent_. Update all uses.
3695 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3696 (Target_powerpc::relocate_section): Zero out discarded opd
3697 entry relocs.
3698
3699 2012-09-12 Ian Lance Taylor <iant@google.com>
3700
3701 PR gold/14570
3702 * output.cc: Rename Output_data_got template parameter from size
3703 to got_size for all functions. Compile all variants of
3704 Output_data_got.
3705 (Output_data_got::Got_entry::write): Correct use of size for
3706 symbol value. Use local_is_tls rather than casting to
3707 Sized_relobj_file.
3708 * object.h (class Object): Add local_is_tls and do_local_is_tls.
3709 (class Sized_relobj_file): Add do_local_is_tls.
3710 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3711
3712 2012-09-11 Alan Modra <amodra@gmail.com>
3713
3714 PR gold/14566
3715 * layout.cc (Layout::set_segment_offsets): When using
3716 common-page-size alignment, ensure we are on a new max-page-size
3717 page.
3718 * output.cc (Output_segment::set_section_addresses): Use
3719 abi_pagesize, not common_pagesize for relro boundary.
3720 (Output_segment::set_offset): Likewise.
3721
3722 2012-09-11 Alan Modra <amodra@gmail.com>
3723
3724 * output.h (Output_data_got::add_global_tls, add_local_tls,
3725 add_local_tls_pair): New functions.
3726 (Output_data_got::add_local_pair_with_rel): Remove second
3727 reloc param. Expand comment.
3728 (Output_data_got::Got_entry): Rename use_plt_offset_ to
3729 use_plt_or_tls_offset_, similarly for constructor param.
3730 (Output_data_got::Got_entry::write): Add got_index param.
3731 * output.cc (Output_data_got::add_global_tls, add_local_tls,
3732 add_local_tls_pair): New functions.
3733 (Output_data_got::Got_entry::write): Handle tls symbols
3734 with use_plt_or_tls_offset_ set specially.
3735 (Output_data_got::add_local_pair_with_rel): Only one reloc.
3736 (Output_data_got::do_write): Replace iterator with index, pass
3737 index to entry write function.
3738 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3739 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3740 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3741 call.
3742 * i386.cc (Target_i386::Scan::local): Likewise.
3743 * sparc.cc (Target_sparc::Scan::local): Likewise.
3744 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3745 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3746 do_tls_offset_for_global): New functions.
3747 (Target_powerpc::Scan::local): Correct TLS relocations and got
3748 entry values.
3749 (Target_powerpc::Scan::global): Don't emit unnecessary
3750 dynamic relocations on TLS GOT entries.
3751
3752 2012-09-10 Matthias Klose <doko@ubuntu.com>
3753
3754 * config.in: Disable sanity check for kfreebsd.
3755
3756 2012-09-10 Sterling Augustine <saugustine@google.com>
3757
3758 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3759 (Gdb_index::pubtypes_read): New parameter.
3760 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3761 to calls.
3762 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3763 pubtypes_object_.
3764
3765 2012-09-09 Alan Modra <amodra@gmail.com>
3766
3767 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3768 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3769 * gc.h (gc_process_relocs): Call target gc_add_reference.
3770 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3771 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3772 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3773 unnecessary cast.
3774 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3775 to cater for when we don't need code offset. Update use.
3776 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3777 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3778 set_opd_valid): New functions.
3779 (Target_powerpc::do_gc_add_reference): New function.
3780 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3781 stashed refs.
3782 (Target_powerpc::do_gc_mark_symbol): New function.
3783
3784 2012-09-06 Cary Coutant <ccoutant@google.com>
3785
3786 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3787 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3788 (Dwarf_die::skip_attributes): Likewise.
3789 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3790 * testsuite/gdb_index_test.cc (inline_func_1): New function.
3791 (main): Call it.
3792 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3793
3794 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
3795
3796 * testsuite/script_test_3.t: Add .got.plt output section
3797 statement.
3798 * testsuite/script_test_4.t: Likewise.
3799
3800 2012-09-05 Alan Modra <amodra@gmail.com>
3801
3802 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
3803 update all uses and lose "enum" when using type.
3804
3805 2012-09-05 Alan Modra <amodra@gmail.com>
3806
3807 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
3808 * configure: Regenerate.
3809 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
3810 (plugin_final_layout.stdout): Likewise.
3811 (memory_test): Set page sizes to 0x1000.
3812 * testsuite/Makefile.in: Regenerate.
3813 * testsuite/discard_locals_test.sh: Add FIXME comment.
3814 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
3815 * testsuite/pr14265.t: Add .got output section statement.
3816 * testsuite/script_test_2.t: Likewise.
3817 * testsuite/script_test_3.t: Likewise.
3818 * testsuite/script_test_4.t: Likewise.
3819 * testsuite/script_test_5.t: Likewise.
3820 * testsuite/script_test_6.t: Likewise.
3821 * testsuite/script_test_7.t: Likewise.
3822 * testsuite/script_test_9.t: Likewise.
3823
3824 2012-09-05 Alan Modra <amodra@gmail.com>
3825
3826 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
3827 (Powerpc_relocate_functions::Status): New typedef.
3828 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3829 (Target_powerpc::Scan::local): Handle REL64.
3830 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
3831 for REL32 and REL64.
3832 (Target_powerpc::symval_for_branch): New function, extracted from..
3833 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
3834 checks. Report overflow errors.
3835
3836 2012-09-05 Alan Modra <amodra@gmail.com>
3837
3838 * object.h (Sized_relobj_file::emit_relocs): Delete.
3839 (Sized_relobj_file::emit_relocs_reltype): Delete.
3840 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
3841 relocate_relocs for --emit-relocs.
3842 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
3843 * output.h: Update comment.
3844 (Output_segment::first_section): New function.
3845 (Output_segment::first_section_load_address): Use first_section.
3846 * output.cc (Output_segment::first_section): New function extracted..
3847 (Output_segment::first_section_load_address): ..from here. Delete.
3848 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
3849 * target.h (Sized_target::relocate_for_relocatable): Likewise.
3850 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
3851 adjust call to target.h function.
3852 * i386.cc (Target_i386): Likewise.
3853 * sparc.cc (Target_sparc): Likewise.
3854 * x86_64.cc (Target_x86_64): Likewise.
3855 * powerpc.cc (Target_powerpc): Likewise.
3856 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
3857 first tls section has section symbol for optimised local dynamic
3858 output relocs.
3859 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
3860 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
3861 optimised tls code.
3862 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
3863 Rename to relocate_relocs. Update error message.
3864
3865 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
3866
3867 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
3868 --just-symbols.
3869
3870 2012-08-31 Alan Modra <amodra@gmail.com>
3871
3872 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
3873 (Powerpc_relobj::toc_base_offset): New stub function.
3874 (Target_powerpc): Add tp_offset, dtp_offset. Rename
3875 got_mod_index_offset to tlsld_got_offset. Update all refs.
3876 (Target_powerpc::Relocate::enum skip_tls): New.
3877 (Target_powerpc::call_tls_get_addr_): New var.
3878 (Target_powerpc::is_branch_reloc): Move to file scope.
3879 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
3880 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
3881 New functions.
3882 (Target_powerpc::enum Got_type): Delete old values, add new ones.
3883 (powerpc_info): Correct common_pagesize for ppc64.
3884 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
3885 (Powerpc_relocate_functions): Add overflow check enums and functions.
3886 Add non-shift version of rela, rela_ua. Delete all rel public
3887 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
3888 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
3889 addr16_ha3, addr14 functions.
3890 (Output_data_got_powerpc::add_constant_pair): New function.
3891 (Output_data_got_powerpc::got_base_offset): Likewise.
3892 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
3893 (instruction constants): Sort, add some more.
3894 (Output_data_glink::do_write): Add and use Address typedef. Use
3895 object->toc_base_offset() stub for 64-bit.
3896 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
3897 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3898 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
3899 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
3900 Always treat .opd relocs as against locally defined symbol.
3901 Correct condition for RELATIVE relocs.
3902 (Target_powerpc::do_finalize_sections): Test for NULL sections.
3903 (Target_powerpc::Relocate::relocate): Use plt call stub as value
3904 for 32-bit syms with a plt entry. Correct ppc64 toc base
3905 calculations. Handle TLS relocs, and more. Add overflow
3906 checking and adjust for Powerpc_relocate_functions changes.
3907 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
3908 Reinstate --emit-relocs code with FIXME.
3909
3910 2012-08-30 Alan Modra <amodra@gmail.com>
3911
3912 * layout.cc (Layout::set_segment_offsets): Set p_align to
3913 abi_pagesize, not common_pagesize.
3914 (Layout::relaxation_loop_body): Similarly use abi_pagesize
3915 to determine whether file header can go in segment.
3916
3917 2012-08-30 Alan Modra <amodra@gmail.com>
3918
3919 * output.h (Output_reloc::Output_reloc <output section>): Add
3920 is_relative param. Adjust calls.
3921 (Output_reloc::add_output_section_relative): New functions.
3922 * output.cc (Output_reloc::Output_reloc <output section>): Handle
3923 is_relative.
3924 (Output_reloc::symbol_value): Handle SECTION_CODE.
3925
3926 2012-08-24 Sriraman Tallam <tmsriram@google.com>
3927
3928 * gold.cc (queue_middle_tasks): Call layout again when unique
3929 segments for sections is desired.
3930 * layout.cc (Layout::Layout): Initialize new members.
3931 (Layout::get_output_section_flags): New function.
3932 (Layout::choose_output_section): Call get_output_section_flags.
3933 (Layout::layout): Make output section for mapping to a unique segment.
3934 (Layout::insert_section_segment_map): New function.
3935 (Layout::attach_allocated_section_to_segment): Make unique segment for
3936 output sections marked so.
3937 (Layout::segment_precedes): Check for unique segments when sorting.
3938 * layout.h (Layout::Unique_segment_info): New struct.
3939 (Layout::Section_segment_map): New typedef.
3940 (Layout::insert_section_segment_map): New function.
3941 (Layout::get_output_section_flags): New function.
3942 (Layout::is_unique_segment_for_sections_specified): New function.
3943 (Layout::set_unique_segment_for_sections_specified): New function.
3944 (Layout::unique_segment_for_sections_specified_): New member.
3945 (Layout::section_segment_map_): New member.
3946 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
3947 Rename is_gc_pass_one to is_pass_one.
3948 Rename is_gc_pass_two to is_pass_two.
3949 Rename is_gc_or_icf to is_two_pass.
3950 Check for which pass based on whether symbols data is present.
3951 Make it two pass when unique segments for sections is desired.
3952 * output.cc (Output_section::Output_section): Initialize new
3953 members.
3954 * output.h (Output_section::is_unique_segment): New function.
3955 (Output_section::set_is_unique_segment): New function.
3956 (Output_section::is_unique_segment_): New member.
3957 (Output_section::extra_segment_flags): New function.
3958 (Output_section::set_extra_segment_flags): New function.
3959 (Output_section::extra_segment_flags_): New member.
3960 (Output_section::segment_alignment): New function.
3961 (Output_section::set_segment_alignment): New function.
3962 (Output_section::segment_alignment_): New member.
3963 (Output_segment::Output_segment): Initialize is_unique_segment_.
3964 (Output_segment::is_unique_segment): New function.
3965 (Output_segment::set_is_unique_segment): New function.
3966 (Output_segment::is_unique_segment_): New member.
3967 * plugin.cc (allow_unique_segment_for_sections): New function.
3968 (unique_segment_for_sections): New function.
3969 (Plugin::load): Add new functions to transfer vector.
3970 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
3971 * Makefile.in: Regenerate.
3972 * testsuite/plugin_final_layout.sh: Check if unique segment
3973 functionality works.
3974 * testsuite/plugin_section_order.c (onload): Check if new interfaces
3975 are available.
3976 (allow_unique_segment_for_sections): New global.
3977 (unique_segment_for_sections): New global.
3978 (claim_file_hook): Call allow_unique_segment_for_sections.
3979 (all_symbols_read_hook): Call unique_segment_for_sections.
3980
3981 2012-08-22 Cary Coutant <ccoutant@google.com>
3982
3983 * layout.cc (Layout::include_section): Don't assert on GROUP
3984 sections with --emit-relocs.
3985
3986 2012-08-21 Cary Coutant <ccoutant@google.com>
3987
3988 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3989 if --export-dynamic-symbol names an undef symbol.
3990
3991 2012-08-18 Alan Modra <amodra@gmail.com>
3992
3993 * powerpc.cc: Formatting and white space.
3994 (Powerpc_relobj): Rename got2_section_ to special_.
3995 Add opd_ent_shndx_ and opd_ent_off_ vectors.
3996 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3997 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3998 (Target_powerpc): Add Address typedef and invalid_address. Use
3999 throughout.
4000 (Target_powerpc::is_branch_reloc): New function.
4001 (Powerpc_relocate_functions): Add Address typedef, use throughout.
4002 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4003 for dst_mask, value and addend.
4004 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4005 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4006 (Output_data_glink::do_write): Correct toc base. Don't try to use
4007 uint16_t for 24-bit offset. Use get_output_section_offset and
4008 check return.
4009 (Target_powerpc::Scan::local): Handle more relocs.
4010 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4011 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4012 Plug in toc restoring insn after plt calls. Translate branches
4013 to function descriptor symbols to corresponding entry point.
4014 (Target_powerpc::relocate_for_relocatable): Check return from
4015 get_output_section_offset.
4016 * symtab.h: Comment typo.
4017
4018 2012-08-14 Ian Lance Taylor <iant@google.com>
4019
4020 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4021 unsupported_relocal_local to call unsupported_reloc_global.
4022
4023 2012-08-14 Nick Clifton <nickc@redhat.com>
4024
4025 PR ld/14265
4026 * script-sections.cc (Sections_element::output_section_name): Add
4027 keep return parameter.
4028 (Output_section_element::match_name): Add keep return parameter.
4029 Return the value of the keep_ member.
4030 * script-sections.h (class Output_section): Update
4031 output_section_name prototype.
4032 * layout.cc (Layout::keep_input_section): New public member
4033 function.
4034 (Layout::choose_output_section): Pass keep parameter to
4035 output_section_name.
4036 * layout.h (class Layout): Add keep_input_section.
4037 * object.cc (Sized_relobj_file::do_layout): Check for kept input
4038 sections.
4039 * testsuite/Makefile.am: Add a test.
4040 * testsuite/Makefile.in: Regenerate.
4041 * testsuite/pr14265.c: Source file for the test.
4042 * testsuite/pr14265.t: Linker script for the test.
4043 * testsuite/pr14265.sh: Shell script for the test.
4044
4045 2012-08-14 Alan Modra <amodra@gmail.com>
4046
4047 * target.h (Target::output_section_name): New function.
4048 (Target::do_output_section_name): New function.
4049 * layout.cc (Layout::choose_output_section): Call the above.
4050 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4051
4052 2012-08-14 Alan Modra <amodra@gmail.com>
4053
4054 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4055 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4056 for replace_constant call.
4057 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4058 (Output_data_glink::do_print_to_mapfile): New function.
4059 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4060 (Target_powerpc::Relocate::relocate): Likewise.
4061
4062 2012-08-14 Alan Modra <amodra@gmail.com>
4063
4064 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4065 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4066 (Output_data_glink::add_entry,find_entry): Remove shndx param.
4067 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
4068 all references to shndx_. Handle special case for R_PPC_PLTREL24
4069 here.
4070 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4071 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4072 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4073 here.
4074 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4075 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4076
4077 2012-08-12 Alan Modra <amodra@gmail.com>
4078
4079 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
4080 (glink insn constants): Use uint32_t.
4081 (Output_data_glink::add_entry): Use insert, not [] operator.
4082
4083 2012-08-11 Alan Modra <amodra@gmail.com>
4084
4085 * object.h (Sized_relobj_file::find_shdr): New function.
4086 (Sized_relobj_file::find_special_sections): New function.
4087 * object.cc (Sized_relobj_file::find_shdr): New function.
4088 (Sized_relobj_file::find_eh_frame): Use find_shdr.
4089 (Sized_relobj_file::find_special_sections): New function, split out..
4090 (Sized_relobj_file::do_read_symbols): ..from here.
4091 * output.h (Output_data_got::replace_constant): New function.
4092 (Output_data_got::num_entries): New function.
4093 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4094 (Output_data_got::got_offset): Protected rather than private.
4095 (Output_data_got::replace_got_entry): New function.
4096 * output.cc (Output_data_got::replace_got_entry): New function.
4097 * powerpc.cc (class Powerpc_relobj): New.
4098 (class Powerpc_relocate_functions): Delete all psymval variants or
4099 convert to value,addend type. Delete pcrela, pcrela_unaligned.
4100 Implement _ha functions using corresponding _hi function.
4101 (Powerpc_relobj::find_special_sections): New function.
4102 (Target_powerpc::do_make_elf_object): New function.
4103 (class Output_data_got_powerpc): New.
4104 (class Output_data_glink): New.
4105 (class Powerpc_scan_relocatable_reloc): New.
4106 Many more changes througout file.
4107
4108 2012-08-09 Nick Clifton <nickc@redhat.com>
4109
4110 * po/vi.po: Updated Vietnamese translation.
4111
4112 2012-08-07 Ian Lance Taylor <iant@google.com>
4113
4114 * layout.cc (Layout::add_target_dynamic_tags): If
4115 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4116 plt_rel.
4117
4118 2012-07-30 Nick Clifton <nickc@redhat.com>
4119
4120 * po/gold.pot: Updated template.
4121 * po/es.po: Updated Spanish translation.
4122
4123 2012-07-18 Cary Coutant <ccoutant@google.com>
4124
4125 PR gold/14344
4126 * configure.ac: Add check for -gpubnames support.
4127 * configure: Regenerate.
4128 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4129 support; force -gno-pubnames.
4130 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4131 support.
4132 (gdb_index_test_4): New test.
4133 * testsuite/Makefile.in: Regenerate.
4134 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4135 * testsuite/gdb_index_test_2.sh: Likewise.
4136 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4137 * testsuite/gdb_index_test_4.sh: New script.
4138 * testsuite/gdb_index_test_comm.sh: New script with common code;
4139 don't look for space after colon.
4140
4141 2012-07-16 Sriraman Tallam <tmsriram@google.com>
4142
4143 * gold.cc (queue_middle_tasks): Update function order only after
4144 deferred objects due to plugins are processed.
4145
4146 2012-07-11 Ian Lance Taylor <iant@google.com>
4147
4148 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4149 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4150 (Target_arm::scan_reloc_for_stub): Likewise.
4151 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4152 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4153 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4154 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4155 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4156
4157 2012-07-10 Dodji Seketeli <dodji@redhat.com>
4158 Ian Lance Taylor <iant@google.com>
4159
4160 PR gold/14309
4161 * configure.ac: Test whether std::tr1::hash<off_t> works.
4162 * gold.h: Add a specialization for std::tr1::hash<off_t> if
4163 needed.
4164 * output.h (class Output_fill): Add virtual destructor.
4165 * configure, config.in: Rebuild.
4166
4167 2012-06-22 Roland McGrath <mcgrathr@google.com>
4168
4169 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4170
4171 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
4172
4173 * plugin.cc (Plugin::load): Handle position independent executables.
4174
4175 2012-06-06 Cary Coutant <ccoutant@google.com>
4176
4177 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4178 add .debug_macro.
4179 (lines_only_debug_sections): Likewise.
4180 (gdb_fast_lookup_sections): New static array.
4181 (is_gdb_debug_section): Rename formal parameter.
4182 (is_lines_only_debug_section): Likewise.
4183 (is_gdb_fast_lookup_section): New function.
4184 (Layout::include_section): Check for ".zdebug_" prefix; pass
4185 section name suffix to is_gdb_debug_section, et al.; check for
4186 fast-lookup sections when building .gdb_index.
4187 * options.h (--strip-debug-gdb): Update GDB version number.
4188
4189 2012-06-06 Cary Coutant <ccoutant@google.com>
4190
4191 * configure.ac: Add check for fallocate.
4192 * configure: Regenerate.
4193 * config.in: Regenerate.
4194
4195 * options.h (class General_options): Add --mmap-output-file and
4196 --posix-fallocate options.
4197 * output.cc: (posix_fallocate): Remove; replace with...
4198 (gold_fallocate): New function.
4199 (Output_file::map_no_anonymous): Call gold_fallocate.
4200 (Output_file::map): Check --mmap-output-file option.
4201
4202 2012-06-05 Jing Yu <jingyu@google.com>
4203
4204 * gold.h (textdomain): Add do {} to empty while(0).
4205 (bindtextdomain): Likewise.
4206
4207 2012-06-04 Cary Coutant <ccoutant@google.com>
4208
4209 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4210 has_dynsym_index.
4211
4212 2012-05-25 Sriraman Tallam <tmsriram@google.com>
4213
4214 * symtab.cc (Symbol_table::define_special_symbol):
4215 Initialize *poldsym to prevent uninitialized variable errors.
4216
4217 2012-05-23 Cary Coutant <ccoutant@google.com>
4218
4219 * layout.cc (Layout::section_name_mapping): Add rules to handle
4220 exact match on .data.rel.ro.local or .data.rel.ro.
4221 (Layout::output_section_name): Check for exact matches.
4222
4223 2012-05-23 Cary Coutant <ccoutant@google.com>
4224
4225 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4226 more carefully.
4227
4228 2012-05-22 Cary Coutant <ccoutant@google.com>
4229
4230 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4231 object before exporting symbol.
4232
4233 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
4234
4235 * testsuite/tls_test.cc: Include "config.h" first.
4236 * testsuite/tls_test_c.c: Likewise.
4237
4238 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
4239 Nick Clifton <nickc@redhat.com>
4240
4241 PR 14072
4242 * configure.in: Add check that sysdep.h has been included before
4243 any system header files.
4244 * configure: Regenerate.
4245 * config.in: Regenerate.
4246
4247 2012-05-14 Cary Coutant <ccoutant@google.com>
4248
4249 * layout.cc (Layout::make_output_section): Mark .tdata section
4250 as RELRO.
4251 * testsuite/relro_test.cc: Add a TLS variable.
4252
4253 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
4254
4255 PR gold/14091
4256 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4257 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4258 R_X86_64_64.
4259
4260 2012-05-08 Cary Coutant <ccoutant@google.com>
4261
4262 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4263 (lines_only_debug_sections): Likewise.
4264
4265 2012-05-02 Roland McGrath <mcgrathr@google.com>
4266
4267 * nacl.cc: New file.
4268 * nacl.h: New file.
4269 * Makefile.am (CCFILES, HFILES): Add them.
4270 * Makefile.in: Regenerate.
4271 * i386.cc (Output_data_plt_i386_nacl): New class.
4272 (Output_data_plt_i386_nacl_exec): New class.
4273 (Output_data_plt_i386_nacl_dyn): New class.
4274 (Target_i386_nacl): New class.
4275 (Target_selector_i386_nacl): New class.
4276 (target_selector_i386): Use it instead of Target_selector_i386.
4277 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4278 (Target_x86_64_nacl): New class.
4279 (Target_selector_x86_64_nacl): New class.
4280 (target_selector_x86_64, target_selector_x32): Use it instead of
4281 Target_selector_x86_64.
4282 * arm.cc (Output_data_plt_arm_nacl): New class.
4283 (Target_arm_nacl): New class.
4284 (Target_selector_arm_nacl): New class.
4285 (target_selector_arm, target_selector_armbe): Use it instead of
4286 Target_selector_arm.
4287
4288 * target-select.cc (select_target): Take new Input_file* and off_t
4289 arguments, pass them on to recognize method of selector.
4290 * object.cc (make_elf_sized_object): Update caller.
4291 * parameters.cc (parameters_force_valid_target): Likewise.
4292 * incremental.cc (make_sized_incremental_binary): Likewise.
4293 * target-select.h: Update decl.
4294 (Target_selector::recognize): Take new Input_file* argument,
4295 pass it on to do_recognize.
4296 (Target_selector::do_recognize): Take new Input_file* argument.
4297 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4298 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4299 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4300 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4301
4302 * target.h (Target::Target_info): New members isolate_execinstr
4303 and rosegment_gap.
4304 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4305 * arm.cc (Target_arm::arm_info): Update initializer.
4306 * i386.cc (Target_i386::i386_info): Likewise.
4307 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4308 * sparc.cc (Target_sparc::sparc_info): Likewise.
4309 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4310 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4311 * layout.cc (Layout::attach_allocated_section_to_segment):
4312 Take new const Target* argument. If target->isolate_execinstr(), act
4313 like --rosegment.
4314 (Layout::find_first_load_seg): Take new const Target* argument;
4315 if target->isolate_execinstr(), reject PF_X segments.
4316 (Layout::relaxation_loop_body): Update caller.
4317 (Layout::set_segment_offsets): If target->isolate_execinstr(),
4318 reset file offset to zero when we hit LOAD_SEG, and then do a second
4319 loop over the segments before LOAD_SEG to reassign offsets after
4320 addresses have been determined. Handle target->rosegment_gap().
4321 (Layout::attach_section_to_segment): Take new const Target* argument;
4322 pass it to attach_allocated_section_to_segment.
4323 (Layout::make_output_section): Update caller.
4324 (Layout::attach_sections_to_segments): Take new const Target* argument;
4325 pass it to attach_section_to_segment.
4326 * gold.cc (queue_middle_tasks): Update caller.
4327 * layout.h (Layout): Update method decls with new arguments.
4328
4329 * arm.cc (Target_arm::Target_arm): Take optional argument for the
4330 Target_info pointer to use.
4331 (Target_arm::do_make_data_plt): New virtual method.
4332 (Target_arm::make_data_plt): New method that calls it.
4333 (Target_arm::make_plt_entry): Use it.
4334 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4335 for the section alignment.
4336 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4337 method.
4338 (Output_data_plt_arm::first_plt_entry_offset): Call it.
4339 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4340 method.
4341 (Output_data_plt_arm::get_plt_entry_size): Call it.
4342 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4343 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4344 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4345 method.
4346 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4347 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4348 method instead of sizeof(plt_entry).
4349 (Output_data_plt_arm::add_entry): Likewise.
4350 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4351 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4352 than static method.
4353 (Target_arm::plt_entry_size): Likewise.
4354 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4355 Move to ...
4356 (Output_data_plt_arm_standard): ... here, new class.
4357 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4358 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4359 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4360
4361 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4362 Take additional argument for the PLT entry size.
4363 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4364 Use get_plt_entry_size method rather than plt_entry_size variable.
4365 (Output_data_plt_x86_64::reserve_slot): Likewise.
4366 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4367 (Output_data_plt_x86_64::add_entry): Likewise.
4368 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4369 (Output_data_plt_x86_64::address_for_global): Likewise.
4370 (Output_data_plt_x86_64::address_for_local): Likewise.
4371 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4372 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4373 Make method non-static.
4374 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4375 method.
4376 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4377 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4378 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4379 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4380 virtual method.
4381 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4382 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4383 virtual method.
4384 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4385 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4386 virtual method.
4387 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4388 (Output_data_plt_x86_64::plt_entry_size)
4389 (Output_data_plt_x86_64::first_plt_entry)
4390 (Output_data_plt_x86_64::plt_entry)
4391 (Output_data_plt_x86_64::tlsdesc_plt_entry)
4392 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4393 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4394 (Output_data_plt_x86_64_standard): ... here, new class.
4395 (Target_x86_64::Target_x86_64): Take optional argument for the
4396 Target_info pointer to use.
4397 (Target_x86_64::do_make_data_plt): New virtual method.
4398 (Target_x86_64::make_data_plt): New method to call it.
4399 (Target_x86_64::init_got_plt_for_update): Use that.
4400 Call this->plt_->add_eh_frame method here.
4401 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4402 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4403 rather than static method.
4404 (Target_x86_64::plt_entry_size): Likewise.
4405 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4406 rather than plt_entry_size variable. Move guts of PLT filling to...
4407 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4408 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4409 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4410
4411 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4412 additional argument for the section alignment.
4413 Don't do add_eh_frame_for_plt here.
4414 (Output_data_plt_i386::first_plt_entry_offset): Make the method
4415 non-static. Use get_plt_entry_size method rather than plt_entry_size
4416 variable.
4417 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4418 method.
4419 (Output_data_plt_i386::get_plt_entry_size): Call it.
4420 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4421 (Output_data_plt_i386::add_eh_frame): New method to call it.
4422 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4423 method.
4424 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4425 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4426 method.
4427 (Output_data_plt_i386::fill_plt_entry): New method to call it.
4428 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4429 method instead of plt_entry_size.
4430 (Output_data_plt_i386::plt_entry_size)
4431 (Output_data_plt_i386::plt_eh_frame_fde_size)
4432 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4433 (Output_data_plt_i386_standard): ... here, new class.
4434 (Output_data_plt_i386_exec): New class.
4435 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4436 (Output_data_plt_i386_exec::first_plt_entry): ... here.
4437 (Output_data_plt_i386::exec_plt_entry): Move to ...
4438 (Output_data_plt_i386_exec::plt_entry): ... here.
4439 (Output_data_plt_i386_dyn): New class.
4440 (Output_data_plt_i386::first_plt_entry): Move to ...
4441 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4442 (Output_data_plt_i386::dyn_plt_entry): Move to ...
4443 (Output_data_plt_i386_dyn::plt_entry): ... here.
4444 (Target_i386::Target_i386): Take optional argument for the Target_info
4445 pointer to use.
4446 (Target_i386::do_make_data_plt): New virtual method.
4447 (Target_i386::make_data_plt): New method to call it.
4448 (Target_i386::make_plt_section): Use that.
4449 Call this->plt_->add_eh_frame method here.
4450 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4451 rather than plt_entry_size variable.
4452 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4453 (Output_data_plt_i386::address_for_local): Likewise.
4454 (Output_data_plt_i386::do_write): Likewise.
4455 Move guts of PLT filling to...
4456 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4457 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4458 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4459 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4460
4461 2012-05-01 Cary Coutant <ccoutant@google.com>
4462
4463 * dwarf_reader.cc (Dwarf_die::read_attributes)
4464 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4465 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4466 * reduced_debug_output.cc
4467 (Output_reduced_debug_info_section::get_die_end): Remove
4468 DW_FORM_GNU_ref_index. Add default case.
4469
4470 2012-04-26 Mark Wielaard <mjw@redhat.com>
4471
4472 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4473 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4474 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4475 DW_AT_high_pc as offset from DW_AT_low_pc.
4476
4477 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4478 * testsuite/Makefile.in: Regenerate.
4479 * testsuite/gdb_index_test_3.c: New test source file.
4480 * testsuite/gdb_index_test_3.sh: New test source file.
4481
4482 2012-04-25 Ian Lance Taylor <iant@google.com>
4483
4484 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4485 pointer.
4486 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4487 as a class, not a struct.
4488 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4489 (Target_arm::apply_cortex_a8_workaround): Likewise.
4490 * gc.h: Declare Reloc_types as a struct, not a class.
4491 * object.h: Declare Symbols_data as a struct.
4492 * reloc.h: Declare Read_relocs_data as a struct.
4493 * target.h: Declare Relocate_info as a struct.
4494
4495 2012-04-24 David S. Miller <davem@davemloft.net>
4496
4497 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4498 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4499 and R_SPARC_WPLT30.
4500
4501 2012-04-24 Cary Coutant <ccoutant@google.com>
4502
4503 * incremental-dump.cc (find_input_containing_global): Replace
4504 magic number with symbolic constant.
4505 (dump_incremental_inputs): Update version number.
4506 * incremental.cc (Output_section_incremental_inputs): Update version
4507 number; import symbolic constants from Incremental_inputs_reader.
4508 (Incremental_inputs::create_data_sections): Align relocations
4509 section correctly for 64-bit targets.
4510 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4511 constants; add padding.
4512 (Output_section_incremental_inputs::write_header): Add assert for
4513 header_size.
4514 (Output_section_incremental_inputs::write_input_files): Add assert
4515 for input_entry_size.
4516 (Output_section_incremental_inputs::write_info_blocks): Add padding;
4517 add assert for object_info_size, input_section_entry_size,
4518 global_sym_entry_size.
4519 * incremental.h (Incremental_inputs_reader): Add symbolic constants
4520 for data structure sizes; use them.
4521 (Incremental_input_entry_reader): Import symbolic constants from
4522 Incremental_inputs_reader; use them.
4523
4524 2012-04-23 David S. Miller <davem@davemloft.net>
4525
4526 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4527 and elf_flags_set_.
4528 (Target_sparc::Target_sparc): Initialize new fields.
4529 (Target_sparc::do_make_elf_object): New function.
4530 (Target_sparc::do_adjust_elf_header): New function.
4531
4532 2012-04-23 Cary Coutant <ccoutant@google.com>
4533
4534 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4535 CU range table of gdb index.
4536
4537 2012-04-20 David S. Miller <davem@davemloft.net>
4538
4539 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4540 instead of false.
4541
4542 2012-04-16 David S. Miller <davem@davemloft.net>
4543
4544 * sparc.cc (Target_sparc::got_address): New function.
4545 (Sparc_relocate_functions::gdop_hix22): New function.
4546 (Sparc_relocate_functions::gdop_lox10): New function.
4547 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4548 relocs.
4549 (Target_sparc::Scan::local): Likewise if the global symbol is not
4550 preemptible and is not IFUNC.
4551 (Target_sparc::Relocate::relocate): Perform GOTDATA code
4552 transformations for local and non-preemptible non-IFUNC global
4553 symbols.
4554
4555 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4556 writing out 64-bit part of ranges.
4557
4558 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4559 -fpic and -fpie respectively.
4560 * Makefile.in: Regenerate.
4561
4562 * sparc.cc (class Target_sparc): Add rela_ifunc_.
4563 (Target_sparc::Target_sparc): Initialize new field.
4564 (Target_sparc::do_plt_section_for_global): New function.
4565 (Target_sparc::do_plt_section_for_local): New function.
4566 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4567 (Target_sparc::make_plt_section): New function, broken out of
4568 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
4569 (Target_sparc::make_plt_entry): Call make_plt_section.
4570 (Target_sparc::make_local_ifunc_plt_entry): New function.
4571 (Target_sparc::rela_ifunc_section): New function.
4572 (Target_sparc::plt_section): Remove const.
4573 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
4574 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4575 and ifunc_count_ fields.
4576 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4577 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4578 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4579 (Output_data_plt_sparc::rela_ifunc): New function.
4580 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4581 (Output_data_plt_sparc::has_ifunc_section): New function.
4582 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4583 (Output_data_plt_sparc::address_for_global): New function.
4584 (Output_data_plt_sparc::address_for_local): New function.
4585 (Output_data_plt_sparc::plt_index_to_offset): New function.
4586 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4587 and entry_count.
4588 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4589 entry_count.
4590 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4591 R_SPARC_JMP_IREL to switch.
4592 (Target_sparc::Scan::check_non_pic): Likewise.
4593 (Target_sparc::Scan::local): Handle IFUNC symbols.
4594 (Target_sparc::Scan::local): Likewise.
4595 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4596 and plt_address_for_local.
4597 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4598 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4599
4600 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4601 (class Output_data_reloc): Adjust calls to Output_reloc_type.
4602 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4603 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4604 global relocs too.
4605 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4606 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4607 calls.
4608 * sparc.cc (Target_sparc::Scan::global): Likewise.
4609 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4610
4611 2012-04-16 Cary Coutant <ccoutant@google.com>
4612
4613 * archive.cc (Library_base::should_include_member): Check for
4614 --export-dynamic-symbol.
4615 * options.h (class General_options): Add --export-dynamic-symbol.
4616 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4617 --export-dynamic-symbol.
4618 (Symbol_table::gc_mark_undef_symbols): Likewise.
4619 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4620
4621 2012-04-12 David S. Miller <davem@davemloft.net>
4622
4623 * sparc.cc (Reloc::wdisp10): New relocation method.
4624 (Reloc::h34): Likewise.
4625 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4626 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4627 R_SPARC_WDISP10.
4628 (Target_sparc::Scan::local): Likewise.
4629 (Target_sparc::Scan::global): Likewise.
4630 (Target_sparc::Relocate::relocate): Likewise.
4631
4632 2012-04-09 Cary Coutant <ccoutant@google.com>
4633
4634 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4635 low_pc == 0.
4636
4637 2012-04-06 Ian Lance Taylor <iant@google.com>
4638
4639 * timer.cc: #include <unistd.h>.
4640
4641 2012-04-06 Roland McGrath <mcgrathr@google.com>
4642
4643 * configure.in (AC_CHECK_HEADERS): Add locale.h.
4644 * config.in: Regenerate.
4645 * configure: Regenerate.
4646
4647 2012-04-05 Nick Clifton <nickc@redhat.com>
4648
4649 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4650 (AM_LC_MESSAGES): Add.
4651 * aclocal.m4: Regenerate.
4652 * config.in: Regenerate.
4653 * configure: Regenerate.
4654
4655 2012-03-21 Cary Coutant <ccoutant@google.com>
4656
4657 * Makefile.am: Add gdb-index.cc, gdb-index.h.
4658 * Makefile.in: Regenerate.
4659 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4660 (Sized_elf_reloc_mapper::symbol_section): New function.
4661 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4662 (make_elf_reloc_mapper): New function.
4663 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4664 (Dwarf_abbrev_table::do_read_abbrevs): New function.
4665 (Dwarf_abbrev_table::do_get_abbrev): New function.
4666 (Dwarf_ranges_table::read_ranges_table): New function.
4667 (Dwarf_ranges_table::read_range_list): New function.
4668 (Dwarf_pubnames_table::read_section): New function.
4669 (Dwarf_pubnames_table::read_header): New function.
4670 (Dwarf_pubnames_table::next_name): New function.
4671 (Dwarf_die::Dwarf_die): New function.
4672 (Dwarf_die::read_attributes): New function.
4673 (Dwarf_die::skip_attributes): New function.
4674 (Dwarf_die::set_name): New function.
4675 (Dwarf_die::set_linkage_name): New function.
4676 (Dwarf_die::attribute): New function.
4677 (Dwarf_die::string_attribute): New function.
4678 (Dwarf_die::int_attribute): New function.
4679 (Dwarf_die::uint_attribute): New function.
4680 (Dwarf_die::ref_attribute): New function.
4681 (Dwarf_die::child_offset): New function.
4682 (Dwarf_die::sibling_offset): New function.
4683 (Dwarf_info_reader::check_buffer): New function.
4684 (Dwarf_info_reader::parse): New function.
4685 (Dwarf_info_reader::do_parse): New function.
4686 (Dwarf_info_reader::do_read_string_table): New function.
4687 (Dwarf_info_reader::lookup_reloc): New function.
4688 (Dwarf_info_reader::get_string): New function.
4689 (Dwarf_info_reader::visit_compilation_unit): New function.
4690 (Dwarf_info_reader::visit_type_unit): New function.
4691 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4692 Sized_elf_reloc_mapper.
4693 (Sized_dwarf_line_info::symbol_section): Remove function.
4694 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4695 (Sized_dwarf_line_info::read_line_mappings): Remove object
4696 parameter, adjust callers.
4697 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4698 * dwarf_reader.h: Include <sys/types.h>.
4699 (class Track_relocs): Remove forward declaration.
4700 (class Elf_reloc_mapper): New class.
4701 (class Sized_elf_reloc_mapper): New class.
4702 (class Dwarf_abbrev_table): New class.
4703 (class Dwarf_range_list): New class.
4704 (class Dwarf_ranges_table): New class.
4705 (class Dwarf_pubnames_table): New class.
4706 (class Dwarf_die): New class.
4707 (class Dwarf_info_reader): New class.
4708 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4709 (Sized_dwarf_line_info::symbol_section): Remove member function.
4710 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4711 base class.
4712 * gdb-index.cc: New source file.
4713 * gdb-index.h: New source file.
4714 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4715 and .debug_types sections, call Layout::add_to_gdb_index.
4716 (Sized_relobj_incr::do_section_name): Implement.
4717 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4718 return type; Implement.
4719 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4720 return type.
4721 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4722 parameter list and return type.
4723 (Sized_incr_dynobj::do_section_contents): Likewise.
4724 * layout.cc: Include gdb-index.h.
4725 (Layout::Layout): Initialize gdb_index_data_.
4726 (Layout::init_fixed_output_section): Check for .gdb_index section.
4727 (Layout::add_to_gdb_index): New function. Instantiate.
4728 * layout.h: Add forward declaration for class Gdb_index.
4729 (Layout::add_to_gdb_index): New member function.
4730 (Layout::gdb_index_data_): New data member.
4731 * main.cc: Include gdb-index.h.
4732 (main): Print statistics for gdb index.
4733 * object.cc (Object::section_contents): Move code into
4734 do_section_contents.
4735 (need_decompressed_section): Check for sections needed when building
4736 gdb index.
4737 (build_compressed_section_map): Likewise.
4738 (Sized_relobj_file::do_read_symbols): Need local symbols when building
4739 gdb index.
4740 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4741 sections; call Layout::add_to_gdb_index.
4742 (Sized_relobj_file::do_decompressed_section_contents): Call
4743 do_section_contents directly.
4744 * object.h (Object::do_section_contents): Adjust parameter list and
4745 return type.
4746 (Object::do_decompressed_section_contents): Call do_section_contents
4747 directly.
4748 (Sized_relobj_file::do_section_contents): Adjust parameter list and
4749 return type.
4750 * options.h (class General_options): Add --gdb-index option.
4751 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4752 list and return type.
4753 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4754 * reloc.h (Track_relocs::checkpoint): New function.
4755 (Track_relocs::reset): New function.
4756
4757 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4758 New test cases.
4759 * testsuite/Makefile.in: Regenerate.
4760 * testsuite/gdb_index_test.cc: New test source file.
4761 * testsuite/gdb_index_test_1.sh: New test source file.
4762 * testsuite/gdb_index_test_2.sh: New test source file.
4763
4764 2012-03-19 Doug Kwan <dougkwan@google.com>
4765
4766 * arm.cc (Target_arm::do_define_standard_symbols): New method.
4767 (Target_arm::do_finalize_sections): Remove code which defines
4768 __exidx_start and __exidx_end. Make symbol table parameter
4769 anonymous as it is not used.
4770 * gold.cc (queue_middle_tasks): Call target hook to define any
4771 target-specific symbols.
4772 * target.h (Target::define_standard_symbols): New method.
4773 (Target::do_define_standard_symbols): Same.
4774 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4775 * testsuite/Makefile.in: Regenerate.
4776 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4777 and __exidx_end.
4778 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4779 relocations are generated for __exidx_start and __exidx_end.
4780
4781 2012-03-16 Doug Kwan <dougkwan@google.com>
4782
4783 * testsuite/Makefile.am: Disable test initpri3b.
4784 * testsuite/Makefile.in: Regenerate.
4785
4786 2012-03-15 Doug Kwan <dougkwan@google.com>
4787
4788 * arm.cc (Target_arm::got_section): Make .got section read-only
4789 if -z now is given.
4790
4791 2012-03-15 Ian Lance Taylor <iant@google.com>
4792
4793 PR gold/13850
4794 * layout.cc (Layout::make_output_section): Correctly mark
4795 SHT_INIT_ARRAY, et. al., as relro.
4796
4797 2012-03-14 Doug Kwan <dougkwan@google.com>
4798
4799 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4800 dynamic relocations for protected symbols in shared objects.
4801
4802 2012-03-13 Ian Lance Taylor <iant@google.com>
4803
4804 * resolve.cc (Symbol_table::resolve): When merging common symbols,
4805 keep the larger alignment.
4806
4807 2012-03-12 Cary Coutant <ccoutant@google.com>
4808
4809 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
4810 handling of DW_LNE_define_file.
4811
4812 2012-03-12 Cary Coutant <ccoutant@google.com>
4813
4814 * reduced_debug_output.cc
4815 (Output_reduced_debug_info_section::get_die_end): Add new FORM
4816 codes to switch.
4817
4818 2012-02-29 Cary Coutant <ccoutant@google.com>
4819
4820 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
4821
4822 2012-02-29 Cary Coutant <ccoutant@google.com>
4823
4824 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4825 Call Object::decompressed_section_contents.
4826 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
4827 New dtor.
4828 (Sized_dwarf_line_info::buffer_start_): New data member.
4829 * merge.cc (Output_merge_data::do_add_input_section): Call
4830 Object::decompressed_section_contents.
4831 (Output_merge_string::do_add_input_section): Likewise.
4832 * object.cc (need_decompressed_section): New function.
4833 (build_compressed_section_map): Decompress sections needed later.
4834 (Sized_relobj_file::do_decompressed_section_contents): New function.
4835 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4836 * object.h (Object::decompressed_section_contents): New function.
4837 (Object::discard_decompressed_sections): New function.
4838 (Object::do_decompressed_section_contents): New function.
4839 (Object::do_discard_decompressed_sections): New function.
4840 (Compressed_section_info): New type.
4841 (Compressed_section_map): Include decompressed section contents.
4842 (Sized_relobj_file::do_decompressed_section_contents): New function.
4843 (Sized_relobj_file::do_discard_decompressed_sections): New function.
4844
4845 2012-02-16 Cary Coutant <ccoutant@google.com>
4846
4847 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
4848 * testsuite/Makefile.in: Regenerate.
4849
4850 2012-02-14 Cary Coutant <ccoutant@google.com>
4851
4852 * options.cc (General_options::finalize): Disallow -pie and -static.
4853
4854 2012-02-03 Doug Kwan <dougkwan@google.com>
4855
4856 * arm.cc (Arm_relocate_functions::abs8,
4857 Arm_relocate_functions::abs16): Use
4858 Bits::has_signed_unsigned_overflow32.
4859 (Arm_relocate_functions::thm_abs8): Correct range of
4860 overflow check.
4861 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
4862 in assertions.
4863
4864 2012-02-02 Doug Kwan <dougkwan@google.com>
4865
4866 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
4867 position independent outputs, not just shared objects.
4868
4869 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
4870
4871 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
4872 * configure: Regenerated.
4873
4874 2012-01-27 Ian Lance Taylor <iant@google.com>
4875
4876 * reloc.h (Bits): New class with static functions, copied from
4877 namespace utils in arm.cc.
4878 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
4879 instead.
4880
4881 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4882
4883 * incremental.cc (write_info_blocks): Correct relocation offset.
4884
4885 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4886
4887 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
4888 (Relocate::tls_gd_to_le): Likewise.
4889
4890 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4891
4892 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
4893
4894 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
4895
4896 * configure.ac: Check if -mcmodel=medium works.
4897 * configure: Regenerated.
4898
4899 2012-01-24 Cary Coutant <ccoutant@google.com>
4900
4901 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
4902 definition and ...
4903 (read_unsigned_LEB_128_x): ... this new function.
4904 (read_signed_LEB_128): Replaced with inline definition and ...
4905 (read_signed_LEB_128_x): ... this new function.
4906 * int_encoding.h (read_unsigned_LEB_128_x): New function.
4907 (read_unsigned_LEB_128): Add inline definition.
4908 (read_signed_LEB_128_x): New function.
4909 (read_signed_LEB_128): Add inline definition.
4910 * testsuite/Makefile.am (leb128_unittest): New unit test.
4911 * testsuite/Makefile.in: Regenerate.
4912 * testsuite/leb128_unittest.cc: New unit test.
4913
4914 2012-01-23 Ian Lance Taylor <iant@google.com>
4915
4916 PR gold/13617
4917 * i386.cc (Target_i386::do_code_fill): When using a jmp
4918 instruction, pad with nop instructions.
4919 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4920
4921 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
4922
4923 * x86_64.cc (gc_process_relocs): Add typename on types used in
4924 template.
4925 (scan_relocs): Likewise.
4926 (relocate_section): Likewise.
4927 (apply_relocation): Likewise.
4928
4929 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
4930
4931 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
4932 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
4933 under x32.
4934
4935 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
4936
4937 * x86_64.cc: Initial support for x32.
4938
4939 2012-01-03 Cary Coutant <ccoutant@google.com>
4940
4941 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
4942 Use abstract base class for GOT.
4943 * gold/output.h (class Output_data_got_base): New abstract base class.
4944 (class Output_data_got): Derive from new base class, adjust ctors.
4945 (Output_data_got::reserve_slot): Make virtual; rename to
4946 do_reserve_slot; Adjust callers.
4947 * gold/target.h (Sized_target::init_got_plt_for_update): Return
4948 pointer to abstract base class.
4949 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
4950
4951 2011-12-18 Ian Lance Taylor <iant@google.com>
4952
4953 * object.h (Relobj::local_symbol_value): New function.
4954 (Relobj::local_plt_offset): New function.
4955 (Relobj::local_has_got_offset): New function.
4956 (Relobj::local_got_offset): New function.
4957 (Relobj::set_local_got_offset): New function.
4958 (Relobj::do_local_symbol_value): New pure virtual function.
4959 (Relobj::do_local_plt_offset): Likewise.
4960 (Relobj::do_local_has_got_offset): Likewise.
4961 (Relobj::do_local_got_offset): Likewise.
4962 (Relobj::do_set_local_got_offset): Likewise.
4963 (Sized_relobj::do_local_has_got_offset): Rename from
4964 local_has_got_offset.
4965 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
4966 (Sized_relobj::do_set_local_got_offset): Rename from
4967 set_local_got_offset.
4968 (Sized_relobj_file::do_local_plt_offset): Rename from
4969 local_plt_offset.
4970 (Sized_relobj_file::do_local_symbol_value): New function.
4971 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4972 local_plt_offset.
4973 * output.cc (Output_data_got::Got_entry::write): Change object to
4974 Relobj. Use local_symbol_value.
4975 (Output_data_got::add_global_with_rel): Change rel_dyn to
4976 Output_data_reloc_generic*. Use add_global_generic.
4977 (Output_data_got::add_global_with_rela): Remove. Change all
4978 callers to use add_global_with_rel.
4979 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4980 Output_data_reloc_generic*. Use add_global_generic.
4981 (Output_data_got::add_global_pair_with_rela): Remove. Change all
4982 callers to use add_global_pair_with_rel.
4983 (Output_data_got::add_local): Change object to Relobj*.
4984 (Output_data_got::add_local_plt): Likewise.
4985 (Output_data_got::add_local_with_rel): Change object to Relobj*,
4986 change rel_dyn to Output_data_reloc_generic*. Use
4987 add_local_generic.
4988 (Output_data_got::add_local_with_rela): Remove. Change all
4989 callers to use all_local_with_rel.
4990 (Output_data_got::add_local_pair_with_rel): Change object to
4991 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
4992 add_output_section_generic.
4993 (Output_data_got::add_local_pair_with_rela): Remove. Change all
4994 callers to use add_local_pair_with_rel.
4995 (Output_data_got::reserve_local): Change object to Relobj*.
4996 * output.h: (class Output_data_reloc_generic): Add pure virtual
4997 declarations for add_global_generic, add_local_generic,
4998 add_output_section_generic.
4999 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5000 functions for Output_data_reloc_generic. Update declarations for
5001 changes listed in output.cc.
5002 (class Output_data_got): Change template parameter to got_size.
5003 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
5004 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5005 function.
5006 (Sized_relobj_incr::do_local_plt_offset): New function.
5007 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5008 add_global_generic.
5009
5010 2011-12-17 Cary Coutant <ccoutant@google.com>
5011
5012 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5013 * resolve.cc (Symbol_table::resolve): Likewise.
5014 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5015 arrays.
5016 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5017
5018 2011-12-16 Ian Lance Taylor <iant@google.com>
5019
5020 * output.h (Output_data_reloc_generic::add): Only call
5021 add_dynamic_reloc if this is a dynamic reloc section.
5022
5023 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
5024
5025 PR gold/13505
5026 * target-reloc.h (apply_relocation): Replace <64, false> with
5027 <size, big_endian>.
5028
5029 2011-11-25 Nick Clifton <nickc@redhat.com>
5030
5031 * po/it.po: New Italian translation.
5032
5033 2011-11-17 Sterling Augustine <saugustine@google.com>
5034
5035 * script.cc (script_include_directive): Implement.
5036 (read_script_file): New local variables name and search_path. Update
5037 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5038 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5039 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5040
5041 2011-11-11 Sterling Augustine <saugustine@google.com>
5042
5043 * yyscript.y (section_cmd): Add support for INCLUDE directive.
5044 (file_or_sections_cmd): Likewise.
5045
5046 2011-11-11 Doug Kwan <dougkwan@google.com>
5047
5048 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5049 if --just-symbols is given.
5050
5051 2011-11-10 Doug Kwan <dougkwan@google.com>
5052
5053 PR gold/13362
5054 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5055 when processing data relocs.
5056 * reloc.h (Relocate_functions::rel_unaligned): New method.
5057 (Relocate_functions::pcrel_unaligned): Ditto.
5058 (Relocate_functions::rel32_unaligned): Ditto.
5059 (Relocate_functions::pcrel32_unaligned): Ditto.
5060
5061 2011-11-09 Doug Kwan <dougkwan@google.com>
5062
5063 PR gold/13362
5064 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5065 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5066 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5067 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5068 (Relocate_functions::rel_unaligned): New.
5069 (Relocate_functions::rel32_unaligned): New.
5070 * target-reloc.h (relocate_for_relocatable): Add code to handle
5071 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5072 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5073 arm_unaligned_reloc_r): New targets.
5074 * testsuite/Makefile.in: Regenerate.
5075 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5076 linking.
5077
5078 2011-11-02 Ian Lance Taylor <iant@google.com>
5079
5080 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
5081 NATIVE_LINKER.
5082 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5083 * options.cc (General_options::finalize): Use library search path
5084 from configure script if specified. If not native and no sysroot,
5085 only search TOOLLIBDIR.
5086 * options.h (Search_directory::Search_directory): Change name to
5087 const std::string&.
5088 (General_options::add_to_library_path_with_sysroot): Change arg to
5089 const std::string&.
5090 * configure, Makefile.in, config.in: Rebuild.
5091
5092 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5093
5094 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5095 we are working around the ARM1176 Erratum.
5096 * options.h (General_options::fix_arm1176): Add option.
5097 * testsuite/Makefile.am: Add testcases, and keep current ones
5098 working.
5099 * testsuite/Makefile.in: Regenerate.
5100 * testsuite/arm_fix_1176.s: New file.
5101 * testsuite/arm_fix_1176.sh: Likewise.
5102
5103 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
5104
5105 * arm.cc (Target_arm::Target_arm): Remove initialisation of
5106 may_use_blx_.
5107 (Target_arm::may_use_blx): Remove method.
5108 (Target_arm::set_may_use_blx): Likewise.
5109 (Target_arm::may_use_v4t_interworking): New method.
5110 (Target_arm::may_use_v5t_interworking): Likewise.
5111 (Target_arm::may_use_blx_): Remove member variable.
5112 (Arm_relocate_functions::arm_branch_common): Check for v5T
5113 interworking.
5114 (Arm_relocate_functions::thumb_branch_common): Likewise.
5115 (Reloc_stub::stub_type_for_reloc): Likewise.
5116 (Target_arm::do_finalize_sections): Correct interworking checks.
5117 * testsuite/Makefile.am: Add new tests.
5118 * testsuite/Makefile.in: Regenerate.
5119 * testsuite/arm_farcall_arm_arm.s: New test.
5120 * testsuite/arm_farcall_arm_arm.sh: Likewise.
5121 * testsuite/arm_farcall_arm_thumb.s: Likewise.
5122 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5123 * testsuite/arm_farcall_thumb_arm.s: Likewise.
5124 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5125 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5126 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5127
5128 2011-10-31 Cary Coutant <ccoutant@google.com>
5129
5130 PR gold/13023
5131 * expression.cc (Expression::eval_with_dot): Add
5132 is_section_dot_assignment parameter.
5133 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
5134 absolute and assigning to dot within a section.
5135 * script-sections.cc
5136 (Output_section_element_assignment::set_section_addresses): Pass
5137 dot_section to set_if_absolute.
5138 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5139 as is_section_dot_assignment flag to eval_with_dot.
5140 (Output_section_element_dot_assignment::set_section_addresses):
5141 Likewise.
5142 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5143 parameter. Also set value if relative to dot_section; set the
5144 symbol's output_section.
5145 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5146 parameter. Adjust all callers.
5147 (Expression::eval_maybe_dot): Likewise.
5148 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5149 Adjust all callers.
5150 * testsuite/script_test_2.t: Test assignment of an absolute value
5151 to dot within an output section element.
5152
5153 2011-10-31 Cary Coutant <ccoutant@google.com>
5154
5155 * options.h (class General_options): Add --[no-]gnu-unique options.
5156 * symtab.cc (Symbol_table::sized_write_globals): Convert
5157 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5158
5159 2011-10-31 Cary Coutant <ccoutant@google.com>
5160
5161 PR gold/13359
5162 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5163 unnecessary assertion.
5164 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5165
5166 2011-10-31 Sriraman Tallam <tmsriram@google.com>
5167
5168 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5169 gc_mark_symbol.
5170 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5171 gc_mark_symbol.
5172 Change to just keep the section associated with symbol.
5173 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5174 they are externally visible and --export-dynamic is turned on.
5175 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5176
5177 2011-10-19 Ian Lance Taylor <iant@google.com>
5178
5179 PR gold/13163
5180 * script-sections.cc
5181 (Output_section_element_dot_assignment::needs_output_section): New
5182 function.
5183
5184 2011-10-19 Ian Lance Taylor <iant@google.com>
5185
5186 PR gold/13204
5187 * layout.cc (Layout::segment_precedes): Don't assert failure if a
5188 --section-start option was seen.
5189 * options.h (General_options::any_section_start): New function.
5190
5191 2011-10-18 David S. Miller <davem@davemloft.net>
5192
5193 PR binutils/13301
5194 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5195 member to track relocation locations that have moved during TLS
5196 reloc optimizations.
5197 (Target_sparc::Relocate::Relocate): Initialize to NULL.
5198 (Target_sparc::Relocate::relocate): Adjust view down by 4
5199 bytes if it matches reloc_adjust_addr_.
5200 (Target_sparc::Relocate::relocate_tls): Always move the
5201 __tls_get_addr call delay slot instruction forward 4 bytes when
5202 performing relaxation.
5203
5204 2011-10-18 Cary Coutant <ccoutant@google.com>
5205
5206 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5207 (Output_file::map_no_anonymous): Check for non-zero
5208 return code from posix_fallocate.
5209
5210 2011-10-17 Cary Coutant <ccoutant@google.com>
5211
5212 PR gold/13245
5213 * plugin.cc (is_visible_from_outside): Check for symbols
5214 referenced from dynamic objects.
5215 * resolve.cc (Symbol_table::resolve): Don't count references
5216 from dynamic objects as references from real ELF files.
5217 * testsuite/plugin_test_2.sh: Adjust expected result.
5218
5219 2011-10-17 Cary Coutant <ccoutant@google.com>
5220
5221 * gold.cc: Include timer.h.
5222 (queue_middle_tasks): Stamp time.
5223 (queue_final_tasks): Likewise.
5224 * main.cc (main): Store timer in parameters. Print timers
5225 for each pass.
5226 * parameters.cc (Parameters::Parameters): Initialize timer_.
5227 (Parameters::set_timer): New function.
5228 (set_parameters_timer): New function.
5229 * parameters.h (Parameters::set_timer): New function.
5230 (Parameters::timer): New function.
5231 (Parameters::timer_): New data member.
5232 (set_parameters_timer): New function.
5233 * timer.cc (Timer::stamp): New function.
5234 (Timer::get_pass_time): New function.
5235 * timer.h (Timer::stamp): New function.
5236 (Timer::get_pass_time): New function.
5237 (Timer::pass_times_): New data member.
5238
5239 2011-10-17 Cary Coutant <ccoutant@google.com>
5240
5241 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5242 task for members of lib groups.
5243
5244 2011-10-17 Cary Coutant <ccoutant@google.com>
5245
5246 PR gold/13288
5247 * fileread.cc (File_read::find_view): Add assert.
5248 (File_read::make_view): Move bounds check (replace with assert)...
5249 (File_read::find_or_make_view): ... to here.
5250
5251 2011-10-12 Cary Coutant <ccoutant@google.com>
5252
5253 * output.cc (Output_file::open_base_file): Handle case where
5254 ::read returns less than requested size.
5255
5256 2011-10-10 Cary Coutant <ccoutant@google.com>
5257
5258 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5259 Initialize defined_count_.
5260 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5261 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5262 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5263 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5264 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5265 * incremental.h (Sized_relobj_incr::defined_count_): New data
5266 member.
5267 (Sized_incr_dynobj::defined_count_): New data member.
5268 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5269 Return zeroes instead of internal error.
5270
5271 2011-10-10 Cary Coutant <ccoutant@google.com>
5272
5273 PR gold/13249
5274 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5275 (Output_reloc::symbol_value): Return PLT offset if flag is set.
5276 * output.h (class Output_reloc): Add use_plt_offset flag.
5277 (Output_reloc::type_): Adjust size of bit field.
5278 (Output_reloc::use_plt_offset_): New bit field.
5279 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5280 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5281 flag. Adjust all callers.
5282 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5283 creating RELATIVE relocations.
5284
5285 2011-10-10 Nick Clifton <nickc@redhat.com>
5286
5287 * po/es.po: Updated Spanish translation.
5288 * po/fi.po: Updated Finnish translation.
5289
5290 2011-10-03 Diego Novillo <dnovillo@google.com>
5291
5292 * options.cc (parse_uint): Fix dereference of RETVAL.
5293
5294 2011-09-29 Sriraman Tallam <tmsriram@google.com>
5295
5296 * layout.h (section_order_map_): New member.
5297 (get_section_order_map): New member function.
5298 * output.cc (Output_section::add_input_section): Check for patterns
5299 only when --section-ordering-file is specified.
5300 * gold.cc (queue_middle_tasks): Delay updating order of sections till
5301 output_sections have been formed.
5302 * layout.cc (Layout_Layout): Initialize section_order_map_.
5303 * plugin.cc (update_section_order): Store order in order_map. Do not
5304 update the order.
5305 * testsuite/Makefile.am: Add test case for plugin_final_layout.
5306 * testsuite/Makefile.in: Regenerate.
5307 * testsuite/plugin_section_order.c: New file.
5308 * testsuite/plugin_final_layout.cc: New file.
5309 * testsuite/plugin_final_layout.sh: New file.
5310
5311 2011-09-29 Cary Coutant <ccoutant@google.com>
5312
5313 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5314 Check for NULL.
5315 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5316 symbols during incremental update.
5317 (Symbol_table::add_from_dynobj): Likewise.
5318
5319 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5320 Ian Lance Taylor <iant@google.com>
5321
5322 * symtab.cc (Symbol_table::define_special_symbol): Always
5323 canonicalize version string.
5324
5325 2011-09-26 Cary Coutant <ccoutant@google.com>
5326
5327 * gold.cc (queue_initial_tasks): Move option checks ...
5328 * options.cc (General_options::finalize): ... to here. Disable
5329 some options; make others fatal.
5330
5331 2011-09-26 Cary Coutant <ccoutant@google.com>
5332
5333 gcc PR lto/47247
5334 * plugin.cc (get_symbols_v2): New function.
5335 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5336 (is_referenced_from_outside): New function.
5337 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5338 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5339 (get_symbols): Pass version parameter.
5340 (get_symbols_v2): New function.
5341 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5342 parameter.
5343 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5344 (onload): Add LDPT_GET_SYMBOLS_V2.
5345 (all_symbols_read_hook): Use get_symbols_v2; check for
5346 LDPR_PREVAILING_DEF_IRONLY_EXP.
5347 * testsuite/plugin_test_3.sh: Update expected results.
5348
5349 2011-09-23 Simon Baldwin <simonb@google.com>
5350
5351 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5352 configuration options.
5353 * configure: Regenerate.
5354 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5355 * Makefile.in: Regenerate.
5356 * testsuite/Makefile.in: Regenerate.
5357
5358 2011-09-19 Sriraman Tallam <tmsriram@google.com>
5359
5360 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5361
5362 2011-09-19 Cary Coutant <ccoutant@google.com>
5363
5364 * incremental.cc (can_incremental_update): Fix typo in comment.
5365 * incremental.h (can_incremental_update): Likewise.
5366
5367 2011-09-18 Cary Coutant <ccoutant@google.com>
5368
5369 * incremental.cc (can_incremental_update): New function.
5370 * incremental.h (can_incremental_update): New function.
5371 * layout.cc (Layout::init_fixed_output_section): Call it.
5372 (Layout::make_output_section): Don't allow patch space in .eh_frame.
5373 * object.cc (Sized_relobj_file::do_layout): Call
5374 can_incremental_update.
5375
5376 2011-09-13 Cary Coutant <ccoutant@google.com>
5377
5378 * configure.ac: Check for glibc support for gnu_indirect_function
5379 support with static linking, setting automake conditional
5380 IFUNC_STATIC.
5381 * Makefile.in: Regenerate.
5382 * configure: Regenerate.
5383
5384 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5385 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5386 for IFUNC_STATIC.
5387 * testsuite/Makefile.in: Regenerate.
5388
5389 2011-09-13 Cary Coutant <ccoutant@google.com>
5390
5391 * incremental.cc (Sized_relobj_incr::do_layout): Call
5392 report_comdat_group for kept comdat sections.
5393 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5394 * testsuite/Makefile.in: Regenerate.
5395 * testsuite/incr_comdat_test_1.cc: New source file.
5396 * testsuite/incr_comdat_test_2_v1.cc: New source file.
5397 * testsuite/incr_comdat_test_2_v2.cc: New source file.
5398 * testsuite/incr_comdat_test_2_v3.cc: New source file.
5399
5400 2011-09-13 Ian Lance Taylor <iant@google.com>
5401
5402 * object.cc (Sized_relobj_file::do_layout): Remove unused local
5403 variable external_symbols_offset.
5404
5405 2011-09-12 Ian Lance Taylor <iant@google.com>
5406
5407 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5408 triggered if object has no symbols.
5409
5410 2011-09-09 David S. Miller <davem@davemloft.net>
5411
5412 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5413 (Output_fill_debug_line::do_write): Likewise.
5414
5415 2011-08-29 Cary Coutant <ccoutant@google.com>
5416
5417 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5418 casts to match formatting specs.
5419 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5420
5421 2011-08-26 Cary Coutant <ccoutant@google.com>
5422
5423 * layout.cc (Free_list::allocate): Provide guarantee of minimum
5424 remaining hole size when allocating.
5425 (Layout::make_output_section): Set fill methods for debug sections.
5426 * layout.h (Free_list::Free_list_node): Move from private to
5427 public.
5428 (Free_list::set_min_hole_size): New function.
5429 (Free_list::begin, Free_list::end): New functions.
5430 (Free_list::min_hole_): New data member.
5431 * output.cc: Include dwarf.h.
5432 (Output_fill_debug_info::do_minimum_hole_size): New function.
5433 (Output_fill_debug_info::do_write): New function.
5434 (Output_fill_debug_line::do_minimum_hole_size): New function.
5435 (Output_fill_debug_line::do_write): New function.
5436 (Output_section::Output_section): Initialize new data member.
5437 (Output_section::set_final_data_size): Ensure patch space is larger
5438 than minimum hole size.
5439 (Output_section::do_write): Fill holes in debug sections.
5440 * output.h (Output_fill): New class.
5441 (Output_fill_debug_info): New class.
5442 (Output_fill_debug_line): New class.
5443 (Output_section::set_free_space_fill): New function.
5444 (Output_section::free_space_fill_): New data member.
5445 * testsuite/Makefile.am (incremental_test_3): Add
5446 --incremental-patch option.
5447 (incremental_test_4): Likewise.
5448 (incremental_test_5): Likewise.
5449 (incremental_test_6): Likewise.
5450 (incremental_copy_test): Likewise.
5451 (incremental_common_test_1): Likewise.
5452 * testsuite/Makefile.in: Regenerate.
5453
5454 2011-08-26 Nick Clifton <nickc@redhat.com>
5455
5456 * po/es.po: Updated Spanish translation.
5457
5458 2011-08-01 Cary Coutant <ccoutant@google.com>
5459
5460 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5461 * gold/testsuite/Makefile.in: Regenerate.
5462 * gold/testsuite/justsyms_exec.c: New source file.
5463 * gold/testsuite/justsyms_lib.c: New source file.
5464
5465 2011-08-01 Cary Coutant <ccoutant@google.com>
5466
5467 * layout.cc (Layout::set_segment_offsets): Don't realign text
5468 segment if -Ttext was specified.
5469 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5470 file type.
5471 * object.h (Sized_relobj_file::e_type): New function.
5472 (Sized_relobj_file::e_type_): New data member.
5473 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5474 base address for ET_EXEC files.
5475 * target.cc (Target::do_make_elf_object_implementation): Allow
5476 ET_EXEC files with --just-symbols option.
5477
5478 2011-07-28 Cary Coutant <ccoutant@google.com>
5479
5480 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5481 Add thread_number parameter.
5482 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5483 * workqueue-threads.cc
5484 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5485 current thread if its thread number is greater than desired thread
5486 count.
5487 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5488 Add thread_number parameter.
5489 (Workqueue::should_cancel_thread): Likewise.
5490 (Workqueue::find_runnable_or_wait): Pass thread_number to
5491 should_cancel_thread.
5492 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5493 parameter.
5494
5495 2011-07-22 Sriraman Tallam <tmsriram@google.com>
5496
5497 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5498 only after checking if it cannot be forced local.
5499 * symtab.h (is_externally_visible): Check if the symbol is not forced
5500 local.
5501
5502 2011-07-15 Ian Lance Taylor <iant@google.com>
5503
5504 * options.h (class General_options): Add --print-output-format.
5505 Move -EL next to -EB, for better --help output.
5506 * target-select.cc: Include <cstdio>, "options.h", and
5507 "parameters.h".
5508 (Target_selector::do_target_bfd_name): New function.
5509 (print_output_format): New function.
5510 * target-select.h (class Target_selector): Update declarations.
5511 (Target_selector::target_bfd_name): New function.
5512 (print_output_format): Declare.
5513 * main.cc: Include "target-select.h".
5514 (main): Handle --print-output-format.
5515 * gold.cc: Include "target-select.h".
5516 (queue_initial_tasks): Handle --print-output-format when there are
5517 no input files.
5518 * parameters.cc (parameters_force_valid_target): Give a better
5519 error message if -EB/-EL does not match target.
5520 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5521 function.
5522
5523 2011-07-15 Ian Lance Taylor <iant@google.com>
5524
5525 * i386.cc (class Output_data_plt_i386): Add layout_ field.
5526 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5527 (Output_data_plt_i386::do_write): Write address of .dynamic
5528 section to first entry in .got.plt section.
5529 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5530 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5531 Initialize layout_.
5532 (Output_data_plt_x86_64::do_write): Write address of .dynamic
5533 section to first entry in .got.plt section.
5534 * layout.h (Layout::dynamic_section): New function.
5535
5536 2011-07-13 Sriraman Tallam <tmsriram@google.com>
5537
5538 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5539 to claim_file call.
5540 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5541 input_section_position_, and input_section_glob_.
5542 (read_layout_from_file): Call function section_ordering_specified.
5543 * layout.h (is_section_ordering_specified): New function.
5544 (section_ordering_specified): New function.
5545 (section_ordering_specified_): New boolean member.
5546 * main.cc(main): Call load_plugins after layout object is defined.
5547 * output.cc (Output_section::add_input_section): Use
5548 function section_ordering_specified to check if section ordering is
5549 needed.
5550 * output.cc (Output_section::add_relaxed_input_section): Use
5551 function section_ordering_specified to check if section ordering is
5552 needed.
5553 (Output_section::update_section_layout): New function.
5554 (Output_section::sort_attached_input_sections): Check if input section
5555 must be reordered.
5556 * output.h (Output_section::update_section_layout): New function.
5557 * plugin.cc (get_section_count): New function.
5558 (get_section_type): New function.
5559 (get_section_name): New function.
5560 (get_section_contents): New function.
5561 (update_section_order): New function.
5562 (allow_section_ordering): New function.
5563 (Plugin::load): Add the new interfaces to the transfer vector.
5564 (Plugin_manager::load_plugins): New parameter.
5565 (Plugin_manager::all_symbols_read): New parameter.
5566 (Plugin_manager::claim_file): New parameter. Save the elf object for
5567 unclaimed objects.
5568 (Plugin_manager::get_elf_object): New function.
5569 (Plugin_manager::get_view): Change to directly use the bool to check
5570 if get_view is called from claim_file_hook.
5571 * plugin.h (input_objects): New function
5572 (Plugin__manager::load_plugins): New parameter.
5573 (Plugin_manager::claim_file): New parameter.
5574 (Plugin_manager::get_elf_object): New function.
5575 (Plugin_manager::in_claim_file_handler): New function.
5576 (Plugin_manager::in_claim_file_handler_): New member.
5577 (layout): New function.
5578 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5579 handler with an extra parameter. Make the elf object before calling
5580 claim_file handler.
5581 * testsuite/plugin_test.c (get_section_count): New function pointer.
5582 (get_section_type): New function pointer.
5583 (get_section_name): New function pointer.
5584 (get_section_contents): New function pointer.
5585 (update_section_order): New function pointer.
5586 (allow_section_ordering): New function pointer.
5587 (onload): Check if the new interfaces exist.
5588
5589 2011-07-13 Ian Lance Taylor <iant@google.com>
5590
5591 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5592 relro section.
5593 * x86_64.cc (Target_x86_64::got_section): Likewise.
5594 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5595 (relro_now_test_SOURCES): New variable.
5596 (relro_now_test_DEPENDENCIES): New variable.
5597 (relro_now_test_LDFLAGS): New variable.
5598 (relro_now_test_LDADD): New variable.
5599 (relro_now_test.so): New target.
5600 * testsuite/Makefile.in: Rebuild.
5601
5602 2011-07-12 Ian Lance Taylor <iant@google.com>
5603
5604 PR gold/12980
5605 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5606 GLOB_DAT relocation rather than a RELATIVE relocation for a
5607 protected symbol when creating a shared library.
5608 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5609 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5610 * testsuite/protected_main_1.cc (main): Test that protected
5611 function has same address.
5612
5613 2011-07-11 Ian Lance Taylor <iant@google.com>
5614
5615 PR gold/12979
5616 * options.h (class General_options): Add -Bgroup.
5617 * options.cc (General_options::finalize): If -Bgroup is set,
5618 default to --unresolved-symbols=report-all.
5619 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5620 * target-reloc.h (issue_undefined_symbol_error): Handle
5621 --unresolved-symbols=report-all.
5622
5623 2011-07-08 Ian Lance Taylor <iant@google.com>
5624
5625 PR gold/11985
5626 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5627 if linker script discards key sections.
5628 (Layout::create_dynamic_symtab): Likewise.
5629 (Layout::assign_local_dynsym_offsets): Likewise.
5630 (Layout::sized_create_version_sections): Likewise.
5631 (Layout::create_interp): Likewise.
5632 (Layout::finish_dynamic_section): Likewise.
5633 (Layout::set_dynamic_symbol_size): Likewise.
5634
5635 2011-07-08 Ian Lance Taylor <iant@google.com>
5636
5637 PR gold/12386
5638 * options.h (class General_options): Add --unresolved-symbols.
5639 * target-reloc.h (issue_undefined_symbol_error): Check
5640 --unresolved-symbols. Add comments.
5641
5642 2011-07-08 Ian Lance Taylor <iant@google.com>
5643
5644 * testsuite/odr_violation2.cc (Ordering::operator()): Make
5645 expression more complex.
5646
5647 2011-07-08 Ian Lance Taylor <iant@google.com>
5648
5649 PR gold/11317
5650 * target-reloc.h (issue_undefined_symbol_error): New inline
5651 function, broken out of relocate_section.
5652 (relocate_section): Call issue_undefined_symbol_error.
5653 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5654 there is no TLS segment if we are about to issue an undefined
5655 symbol error.
5656 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5657
5658 2011-07-08 Ian Lance Taylor <iant@google.com>
5659
5660 PR gold/12279
5661 * resolve.cc (Symbol_table::should_override): Add fromtype
5662 parameter. Change all callers. Give error when linking together
5663 TLS and non-TLS symbol.
5664 (Symbol_table::should_override_with_special): Add fromtype
5665 parameter. Change all callers.
5666 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5667 there is no TLS segment if we have reported some errors.
5668 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5669
5670 2011-07-08 Ian Lance Taylor <iant@google.com>
5671
5672 PR gold/12372
5673 * target.h (Target::plt_address_for_global): New function.
5674 (Target::plt_address_for_local): New function.
5675 (Target::plt_section_for_global): Remove.
5676 (Target::plt_section_for_local): Remove.
5677 (Target::do_plt_address_for_global): New virtual function.
5678 (Target::do_plt_address_for_local): New virtual function.
5679 (Target::do_plt_section_for_global): Remove.
5680 (Target::do_plt_section_for_local): Remove.
5681 (Target::register_global_plt_entry): Add Symbol_table and Layout
5682 parameters.
5683 * output.cc (Output_data_got::Got_entry::write): Use
5684 plt_address_for_global and plt_address_for_local.
5685 * layout.cc (Layout::add_target_dynamic_tags): Use size and
5686 address of output section.
5687 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5688 got_irelative_, and irelative_count_ fields. Update
5689 declarations.
5690 (Output_data_plt_i386::has_irelative_section): New function.
5691 (Output_data_plt_i386::entry_count): Add irelative_count_.
5692 (Output_data_plt_i386::set_final_data_size): Likewise.
5693 (class Target_i386): Add got_irelative_ and rel_irelative_
5694 fields. Update declarations.
5695 (Target_i386::Target_i386): Initialize new fields.
5696 (Target_i386::do_plt_address_for_global): New function replacing
5697 do_plt_section_for_global.
5698 (Target_i386::do_plt_address_for_local): New function replacing
5699 do_plt_section_for_local.
5700 (Target_i386::got_section): Create got_irelative_.
5701 (Target_i386::rel_irelative_section): New function.
5702 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5703 fields. Don't define __rel_iplt_{start,end}.
5704 (Output_data_plt_i386::add_entry): Add symtab and layout
5705 parameters. Change all callers. Use different PLT and GOT for
5706 IFUNC symbols.
5707 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5708 layout parameters. Change all callers. Use different PLT and
5709 GOT.
5710 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5711 (Output_data_plt_i386::rel_irelative): New function.
5712 (Output_data_plt_i386::address_for_global): New function.
5713 (Output_data_plt_i386::address_for_local): New function.
5714 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
5715 IRELATIVE GOT when changing IFUNC GOT entries.
5716 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5717 reloc.
5718 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5719 if we didn't create an IRELATIVE GOT.
5720 (Target_i386::Relocate::relocate): Use plt_address_for_global and
5721 plt_address_for_local.
5722 (Target_i386::do_dynsym_value): Use plt_address_for_global.
5723 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5724 got_irelative_, and irelative_count_ fields. Update
5725 declarations.
5726 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5727 Initialize new fields. Remove symtab parameter. Change all
5728 callers.
5729 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5730 irelative_count_.
5731 (Output_data_plt_x86_64::has_irelative_section): New function.
5732 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5733 (class Target_x86_64): Add got_irelative_ and rel_irelative_
5734 fields. Update declarations.
5735 (Target_x86_64::Target_x86_64): Initialize new fields.
5736 (Target_x86_64::do_plt_address_for_global): New function replacing
5737 do_plt_section_for_global.
5738 (Target_x86_64::do_plt_address_for_local): New function replacing
5739 do_plt_section_for_local.
5740 (Target_x86_64::got_section): Create got_irelative_.
5741 (Target_x86_64::rela_irelative_section): New function.
5742 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
5743 all callers. Don't create __rel_iplt_{start,end}.
5744 (Output_data_plt_x86_64::add_entry): Add symtab and layout
5745 parameters. Change all callers. Use different PLT and GOT for
5746 IFUNC symbols.
5747 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5748 layout parameters. Change all callers. Use different PLT and
5749 GOT.
5750 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5751 parameters. Change all callers. Use different PLT and GOT for
5752 IFUNC symbols.
5753 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5754 (Output_data_plt_x86_64::rela_irelative): New function.
5755 (Output_data_plt_x86_64::address_for_global): New function.
5756 (Output_data_plt_x86_64::address_for_local): New function.
5757 (Output_data_plt_x86_64::set_final_data_size): Likewise.
5758 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5759 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5760 (Target_x86_64::register_global_plt_entry): Add symtab and layout
5761 parameters.
5762 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5763 reloc.
5764 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5765 symbols if we didn't create an IRELATIVE GOT.
5766 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5767 plt_address_for_local.
5768 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5769 * testsuite/ifuncvar1.c: New test file.
5770 * testsuite/ifuncvar2.c: New test file.
5771 * testsuite/ifuncvar3.c: New test file.
5772 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5773 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5774 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5775 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5776 * testsuite/Makefile.in: Rebuild.
5777
5778 2011-07-07 Cary Coutant <ccoutant@google.com>
5779
5780 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5781 (two_file_test_1_ndebug.o): Likewise.
5782 (two_file_test_1b_ndebug.o): Likewise.
5783 (two_file_test_2_ndebug.o): Likewise.
5784 (two_file_test_main_ndebug.o): Likewise.
5785 (incremental_test_2): Link with no-debug versions.
5786
5787 2011-07-06 Cary Coutant <ccoutant@google.com>
5788
5789 * gold/incremental.cc
5790 (Output_section_incremental_inputs::write_info_blocks): Check for
5791 hidden and internal symbols.
5792
5793 2011-07-06 Cary Coutant <ccoutant@google.com>
5794
5795 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5796 Check disposition for startup file.
5797 (Incremental_inputs::report_command_line): Ignore
5798 --incremental-startup-unchanged option.
5799 * options.cc (General_options::parse_incremental_startup_unchanged):
5800 New function.
5801 (General_options::General_options): Initialize new data member.
5802 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
5803 (General_options): Add --incremental-startup-unchanged option.
5804 (General_options::incremental_startup_disposition): New function.
5805 (General_options::incremental_startup_disposition_): New data member.
5806
5807 2011-07-06 Cary Coutant <ccoutant@google.com>
5808
5809 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
5810 input file index to Script_info ctor.
5811 (Sized_incremental_binary::do_file_has_changed): Find the
5812 command-line argument for files named in scripts.
5813 * incremental.h (Script_info::Script_info): New ctor
5814 with input file index.
5815 (Script_info::input_file_index): New function.
5816 (Script_info::input_file_index_): New data member.
5817 (Incremental_binary::get_library): Add const.
5818 (Incremental_binary::get_script_info): Add const.
5819 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
5820 * testsuite/Makefile.am (incremental_test_5): New test case.
5821 (incremental_test_6): New test case.
5822 * testsuite/Makefile.in: Regenerate.
5823
5824 2011-07-06 Cary Coutant <ccoutant@google.com>
5825
5826 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
5827 debug output when command lines differ.
5828
5829 2011-07-06 Cary Coutant <ccoutant@google.com>
5830
5831 * incremental.cc (Incremental_inputs::report_command_line): Ignore
5832 --incremental-patch option.
5833 * layout.cc (Free_list::allocate): Extend allocation beyond original
5834 end if enabled.
5835 (Layout::make_output_section): Mark sections that should get
5836 patch space.
5837 * options.cc (parse_percent): New function.
5838 * options.h (parse_percent): New function.
5839 (DEFINE_percent): New macro.
5840 (General_options): Add --incremental-patch option.
5841 * output.cc (Output_section::Output_section): Initialize new data
5842 members.
5843 (Output_section::add_input_section): Print section name when out
5844 of patch space.
5845 (Output_section::add_output_section_data): Likewise.
5846 (Output_section::set_final_data_size): Add patch space when
5847 doing --incremental-full.
5848 (Output_section::do_reset_address_and_file_offset): Remove patch
5849 space.
5850 (Output_segment::set_section_list_addresses): Print debug output
5851 only if --incremental-update.
5852 * output.h (Output_section::set_is_patch_space_allowed): New function.
5853 (Output_section::is_patch_space_allowed_): New data member.
5854 (Output_section::patch_space_): New data member.
5855 * parameters.cc (Parameters::incremental_full): New function.
5856 * parameters.h (Parameters::incremental_full): New function
5857 * testsuite/Makefile.am (incremental_test_2): Add test for
5858 --incremental-patch option.
5859 * testsuite/Makefile.in: Regenerate.
5860 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
5861 (t18): Remove function body.
5862
5863 2011-07-05 Doug Kwan <dougkwan@google.com>
5864
5865 PR gold/12771
5866 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
5867 Arm_Address type for relocation result.
5868 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
5869 overflow check.
5870 (Arm_relocate_functions::abs32): Use unaligned access.
5871 (Arm_relocate_functions::rel32): Ditto.
5872 (Arm_relocate_functions::prel31): Ditto.
5873 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
5874 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
5875 static data relocations.
5876 * testsuite/Makefile.in: Regnerate.
5877 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
5878
5879 2011-07-05 Ian Lance Taylor <iant@google.com>
5880
5881 PR gold/12392
5882 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
5883 symbols if necessary.
5884 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5885
5886 2011-07-05 Ian Lance Taylor <iant@google.com>
5887
5888 PR gold/12952
5889 * resolve.cc (Symbol::override_base_with_special): Simply override
5890 version with special symbol version, ignoring previous version.
5891
5892 2011-07-05 Ian Lance Taylor <iant@google.com>
5893
5894 * object.cc (Sized_relobj_file::include_section_group): Add
5895 information to comment about signature location.
5896
5897 2011-07-02 Ian Lance Taylor <iant@google.com>
5898
5899 PR gold/12957
5900 * options.h (class General_options): Add -f and -F.
5901 * options.cc (General_options::finalize): Fatal error if -f/-F
5902 are used without -shared.
5903 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
5904
5905 2011-07-02 Ian Lance Taylor <iant@google.com>
5906
5907 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
5908
5909 2011-07-01 Ian Lance Taylor <iant@google.com>
5910
5911 PR gold/12525
5912 PR gold/12952
5913 * resolve.cc (Symbol::override_base_with_special): Don't override
5914 the version if the overriding symbol has a different name.
5915 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
5916 all callers. If we give an error about an undefined version,
5917 define the base version if necessary.
5918 * dynobj.h (class Versions): Update declaration.
5919 * testsuite/weak_alias_test_5.cc: New file.
5920 * testsuite/weak_alias_test.script: New file.
5921 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
5922 and versioned_alias have the right value, and call t2.
5923 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
5924 weak_alias_test_5.so.
5925 (weak_alias_test_LDADD): Likewise.
5926 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
5927 * testsuite/Makefile.in: Rebuild.
5928
5929 2011-07-01 Ian Lance Taylor <iant@google.com>
5930
5931 PR gold/12525
5932 * options.h (class General_options): Support -z notext.
5933 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
5934 -Wl,-z,notext.
5935 (two_file_shared_nonpic.so): Likewise.
5936 (two_file_shared_mixed.so): Likewise.
5937 (two_file_shared_mixed_1.so): Likewise.
5938 (weak_undef_lib_nonpic.so): Likewise.
5939 (alt/weak_undef_lib_nonpic.so): Likewise.
5940 (tls_test_shared_nonpic.so): Likewise.
5941 * testsuite/Makefile.in: Rebuild.
5942
5943 2011-07-01 Ian Lance Taylor <iant@google.com>
5944
5945 PR gold/12525
5946 * configure.ac: Test whether static linking works, setting
5947 the automake conditional HAVE_STATIC.
5948 * testsuite/Makefile.am: Disable tests using -static if
5949 HAVE_STATIC is not true.
5950 * configure, testsuite/Makefile.in: Rebuild.
5951
5952 2011-07-01 Ian Lance Taylor <iant@google.com>
5953
5954 PR gold/12525
5955 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
5956 Assert if we see DW_EH_PE_indirect.
5957 * target.h (Target::ehframe_datarel_base): New function.
5958 (Target::do_ehframe_datarel_base): New target function.
5959 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
5960 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
5961 function.
5962
5963 2011-07-01 Ian Lance Taylor <iant@google.com>
5964
5965 PR gold/12571
5966 * options.h (class General_options): Add
5967 --ld-generated-unwind-info.
5968 * ehframe.cc (Fde::write): Add address parameter. Change all
5969 callers. If associated with PLT, fill in address and size.
5970 (Cie::set_output_offset): Only add merge mapping if there is an
5971 object.
5972 (Cie::write): Add address parameter. Change all callers.
5973 (Eh_frame::add_ehframe_for_plt): New function.
5974 * ehframe.h (class Fde): Update declarations. Move shndx_ and
5975 input_offset_ fields into union u_, with new plt field.
5976 (Fde::Fde): Adjust for new union field.
5977 (Fde::Fde) [Output_data version]: New constructor.
5978 (Fde::add_mapping): Only add merge mapping if there is an object.
5979 (class Cie): Update declarations.
5980 (class Eh_frame): Declare add_ehframe_for_plt.
5981 * layout.cc (Layout::layout_eh_frame): Break out code into
5982 make_eh_frame_section, and call it.
5983 (Layout::make_eh_frame_section): New function.
5984 (Layout::add_eh_frame_for_plt): New function.
5985 * layout.h (class Layout): Update declarations.
5986 * merge.cc (Merge_map::add_mapping): Add assertion.
5987 * i386.cc: Include "dwarf.h".
5988 (class Output_data_plt_i386): Make first_plt_entry,
5989 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
5990 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5991 and plt_eh_frame_fde.
5992 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5993 boundary. Call add_eh_frame_for_plt if appropriate.
5994 * x86_64.cc: Include "dwarf.h".
5995 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
5996 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
5997 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5998 and plt_eh_frame_fde.
5999 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6000 appropriate.
6001
6002 2011-06-29 Ian Lance Taylor <iant@google.com>
6003
6004 PR gold/12629
6005 * object.cc (Sized_relobj_file::layout_section): Change shdr
6006 parameter to be const.
6007 (Sized_relobj_file::layout_eh_frame_section): New function, broken
6008 out of do_layout.
6009 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6010 appropriate. Call layout_eh_frame_section.
6011 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6012 sections.
6013 * object.h (class Sized_relobj_file): Update declarations.
6014
6015 2011-06-29 Ian Lance Taylor <iant@google.com>
6016
6017 PR gold/12652
6018 * script.cc (Token::integer_value): Accept trailing M/m/K/k
6019 modifier.
6020 (Lex::gather_token): Accept trailing M/m/K/k for integers.
6021
6022 2011-06-29 Ian Lance Taylor <iant@google.com>
6023
6024 PR gold/12675
6025 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6026 SHT_X86_64_UNWIND.
6027 * layout.cc (Layout::layout_eh_frame): Likewise.
6028
6029 2011-06-29 Ian Lance Taylor <iant@google.com>
6030
6031 PR gold/12695
6032 * layout.cc (Layout::symtab_section_shndx): New function.
6033 * layout.h (class Layout): Declare symtab_section_shndx.
6034 * output.cc (Output_section::write_header): Call it.
6035
6036 2011-06-29 Ian Lance Taylor <iant@google.com>
6037
6038 PR gold/12818
6039 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6040 symbols which are not used in a relocation.
6041
6042 2011-06-28 Ian Lance Taylor <iant@google.com>
6043
6044 PR gold/12898
6045 * layout.cc (Layout::segment_precedes): Don't crash if a linker
6046 script create indistinguishable segments.
6047 (Layout::set_segment_offsets): Use stable_sort when sorting
6048 segments. Pass this to Compare_segments constructor.
6049 * layout.h (class Layout): Make segment_precedes non-static.
6050 (class Compare_segments): Change from struct to class. Add
6051 layout_ field. Add constructor.
6052 * script-sections.cc
6053 (Script_sections::attach_sections_using_phdrs_clause): Rename
6054 local orphan to is_orphan. Don't report failure to put empty
6055 section in segment. On attachment failure, report name of
6056 section, and attach to first PT_LOAD segment.
6057
6058 2011-06-28 Ian Lance Taylor <iant@google.com>
6059
6060 PR gold/12934
6061 * target-select.cc (Target_selector::Target_selector): Add
6062 emulation parameter. Change all callers.
6063 (select_target_by_bfd_name): Rename from select_target_by_name.
6064 Change all callers.
6065 (select_target_by_emulation): New function.
6066 (supported_emulation_names): New function.
6067 * target-select.h (class Target_selector): Add emulation_ field.
6068 Update declarations.
6069 (Target_selector::recognize_by_bfd_name): Rename from
6070 recognize_by_name. Change all callers.
6071 (Target_selector::supported_bfd_names): Rename from
6072 supported_names. Change all callers.
6073 (Target_selector::recognize_by_emulation): New function.
6074 (Target_selector::supported_emulations): New function.
6075 (Target_selector::emulation): New function.
6076 (Target_selector::do_recognize_by_bfd_name): Rename from
6077 do_recognize_by_name. Change all callers.
6078 (Target_selector::do_supported_bfd_names): Rename from
6079 do_supported_names. Change all callers.
6080 (Target_selector::do_recognize_by_emulation): New function.
6081 (Target_selector::do_supported_emulations): New function.
6082 (select_target_by_bfd_name): Change name in declaration.
6083 (select_target_by_emulation): Declare.
6084 (supported_emulation_names): Declare.
6085 * parameters.cc (parameters_force_valid_target): Try to find
6086 target based on emulation from -m option.
6087 * options.h (class General_options): Change doc string for -m.
6088 * options.cc (help): Print emulations.
6089 (General_options::parse_V): Likewise.
6090 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6091 Add emulation parameter. Change all callers.
6092
6093 2011-06-28 Ian Lance Taylor <iant@google.com>
6094
6095 * target.h (class Target): Add osabi_ field.
6096 (Target::osabi): New function.
6097 (Target::set_osabi): New function.
6098 (Target::Target): Initialize osabi_.
6099 (Target::do_adjust_elf_header): Make pure virtual.
6100 (Sized_target::do_adjust_elf_header): Declare.
6101 * target.cc (Sized_target::do_adjust_elf_header): New function.
6102 (class Sized_target): Instantiate all versions.
6103 * freebsd.h (class Target_freebsd): Remove.
6104 (Target_selector_freebsd::do_recognize): Call set_osabi on
6105 Target.
6106 (Target_selector_freebsd::do_recognize_by_name): Likewise.
6107 (Target_selector_freebsd::set_osabi): Remove.
6108 * i386.cc (class Target_i386): Inherit from Sized_target rather
6109 than Target_freebsd.
6110 * x86_64.cc (class Target_x86_64): Likewise.
6111
6112 2011-06-28 Ian Lance Taylor <iant@google.com>
6113
6114 * target.h (Target::can_check_for_function_pointers): Rewrite.
6115 Make non-virtual.
6116 (Target::can_icf_inline_merge_sections): Likewise.
6117 (Target::section_may_have_icf_unsafe_poineters): Likewise.
6118 (Target::Target_info): Add can_icf_inline_merge_sections field.
6119 (Target::do_can_check_for_function_pointers): New virtual
6120 function.
6121 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6122 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6123 from can_check_for_function_pointers, move in file.
6124 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6125 section_may_have_icf_unsafe_poineters, move in file.
6126 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6127 * i386.cc (Target_i386::do_can_check_for_function_pointers):
6128 Rename from can_check_for_function_pointers, move in file.
6129 (Target_i386::can_icf_inline_merge_sections): Remove.
6130 (Target_i386::i386_info): Initialize
6131 can_icf_inline_merge_sections.
6132 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6133 Initialize can_icf_inline_merge_sections.
6134 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6135 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6136 Rename from can_check_for_function_pointers, move in file.
6137 (Target_x86_64::can_icf_inline_merge_sections): Remove.
6138 (Target_x86_64::x86_64_info): Initialize
6139 can_icf_inline_merge_sections.
6140 * testsuite/testfile.cc (Target_test::test_target_info):
6141 Likewise.
6142 * icf.cc (get_section_contents): Correct formatting.
6143
6144 2011-06-27 Ian Lance Taylor <iant@google.com>
6145
6146 * symtab.cc (Symbol::versioned_name): New function.
6147 (Symbol_table::add_to_final_symtab): Use versioned_name when
6148 appropriate.
6149 (Symbol_table::sized_write_symbol): Likewise.
6150 * symtab.h (class Symbol): Declare versioned_name.
6151 * stringpool.h (class Stringpool_template): Add variant of add
6152 which takes a std::basic_string.
6153 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6154 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6155 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6156 (ver_test_12.o): New target.
6157 * testsuite/Makefile.in: Rebuild.
6158
6159 2011-06-27 Doug Kwan <dougkwan@google.com>
6160
6161 * arm.cc (Arm_relocate_functions::thm_jump8,
6162 Arm_relocate_functions::thm_jump11): Use a wider signed
6163 type to compute offset.
6164 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6165 arm_thm_jump8.
6166 * testsuite/Makefile.in: Regenerate.
6167 * testsuite/arm_branch_in_range.sh: Check test results of
6168 arm_thm_jump11 and arm_thm_jump8.
6169 * testsuite/arm_thm_jump11.s: New test source file.
6170 * testsuite/arm_thm_jump11.t: New linker script.
6171 * testsuite/arm_thm_jump8.s: New test source file.
6172 * testsuite/arm_thm_jump8.t: New linker script.
6173
6174 2011-06-24 Ian Lance Taylor <iant@google.com>
6175
6176 * layout.cc: Include "object.h".
6177 (ctors_sections_in_init_array): New static variable.
6178 (Layout::is_ctors_in_init_array): New function.
6179 (Layout::layout): Add entry to ctors_sections_in_init_array if
6180 appropriate.
6181 * layout.h (class Layout): Declare is_ctors_in_init_array.
6182 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6183 is_ctors_reverse_view is set.
6184 (Sized_relobj_file::write_sections): Add layout parameter. Change
6185 all callers. Set is_ctors_reverse_view field of View_size.
6186 (Sized_relobj_file::reverse_words): New function.
6187 * object.h (Sized_relobj_file::View_size): Add
6188 is_ctors_reverse_view field.
6189 (class Sized_relobj_file): Update declarations.
6190 * testsuite/initpri3.c: New test.
6191 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6192 initpri3b.
6193 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6194 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6195 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6196 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6197 * testsuite/Makefile.in: Rebuild.
6198
6199 2011-06-24 Cary Coutant <ccoutant@google.com>
6200
6201 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6202 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6203 (debug_msg_cdebug.err): New targets.
6204 * testsuite/Makefile.in: Regenerate.
6205 * testsuite/debug_msg.sh: Check output of link with compressed debug.
6206 Fix checks for link with shared library.
6207
6208 2011-06-24 Doug Kwan <dougkwan@google.com>
6209
6210 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6211 skip empty text sections.
6212 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6213
6214 2011-06-22 Ian Lance Taylor <iant@google.com>
6215
6216 PR gold/12910
6217 * options.h (class General_options): Add --ctors-in-init-array.
6218 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6219 friends as SHT_PROGBITS for merging sections.
6220 (Layout::layout): Remove special handling of .init_array and
6221 friends. Don't sort if doing relocatable link. Sort for .ctors
6222 and .dtors if ctors_in_init_array.
6223 (Layout::make_output_section): Force correct section types for
6224 .init_array and friends. Don't sort if doing relocatable link,
6225 Don't sort .ctors and .dtors if ctors_in_init_array.
6226 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6227 (Layout::output_section_name): Add relobj parameter. Change all
6228 callers. Handle .ctors. and .dtors. in code rather than table.
6229 Handle .ctors and .dtors if ctors_in_init_array.
6230 (Layout::match_file_name): New function, moved from output.cc.
6231 * layout.h (class Layout): Update declarations.
6232 * output.cc: Include "layout.h".
6233 (Input_section_sort_entry::get_priority): New function.
6234 (Input_section_sort_entry::match_file_name): Just call
6235 Layout::match_file_name.
6236 (Output_section::Input_section_sort_init_fini_compare::operator()):
6237 Handle .ctors and .dtors. Sort by explicit priority rather than
6238 by name.
6239 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6240 * testsuite/initpri2.c: New test.
6241 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6242 (check_PROGRAMS): Add initpri2.
6243 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6244 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6245 * configure, testsuite/Makefile.in: Rebuild.
6246
6247 2011-06-19 Ian Lance Taylor <iant@google.com>
6248
6249 PR gold/12880
6250 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6251 .interp section to a PT_INTERP segment even if we have seen a
6252 --dynamic-linker option. Don't do it if we have seen a PHDRS
6253 clause in a linker script.
6254 (Layout::finalize): Don't create a .interp section if we've
6255 already create a PT_INTERP segment.
6256 (Layout::create_interp): Always call choose_output_section (revert
6257 patch of 2011-06-17). Don't create PT_INTERP segment.
6258 * script-sections.cc
6259 (Script_sections::create_note_and_tls_segments): Add a .interp
6260 section to a PT_INTERP segment even if we have seen a
6261 --dynamic-linker option.
6262
6263 2011-06-18 Ian Lance Taylor <iant@google.com>
6264
6265 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6266 merely because a non-PT_LOAD segment has a dynamic reloc.
6267
6268 2011-06-18 Ian Lance Taylor <iant@google.com>
6269
6270 * layout.cc (Layout::finish_dynamic_section): Don't create
6271 DT_FLAGS entry if not needed.
6272
6273 2011-06-18 Ian Lance Taylor <iant@google.com>
6274
6275 PR gold/12745
6276 * layout.cc (Layout::layout_eh_frame): Correct handling of
6277 writable .eh_frame section.
6278
6279 2011-06-17 Ian Lance Taylor <iant@google.com>
6280
6281 PR gold/12893
6282 * resolve.cc (Symbol_table::resolve): Don't give an error if a
6283 symbol is redefined with the exact same object and value.
6284
6285 2011-06-17 Ian Lance Taylor <iant@google.com>
6286
6287 PR gold/12880
6288 * layout.h (class Layout): Add interp_segment_ field.
6289 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6290 (Layout::attach_allocated_section_to_segment): If making shared
6291 library, put .interp section in PT_INTERP segment.
6292 (Layout::finalize): Also call create_interp if -dynamic-linker
6293 option was used.
6294 (Layout::create_interp): Assert that there is no PT_INTERP
6295 segment. If not using a SECTIONS clause, use make_output_section.
6296 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6297 * script-sections.cc
6298 (Script_sections::create_note_and_tls_segments): If making shared
6299 library, put .interp section in PT_INTERP segment.
6300
6301 2011-06-17 Ian Lance Taylor <iant@google.com>
6302
6303 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6304 when making a shared library.
6305
6306 2011-06-17 Ian Lance Taylor <iant@google.com>
6307
6308 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6309 parameter. Change all callers. Don't issue warning about PC32
6310 against locally defined symbol.
6311
6312 2011-06-16 Ian Lance Taylor <iant@google.com>
6313
6314 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6315 occurs in same object.
6316
6317 2011-06-14 Alan Modra <amodra@gmail.com>
6318
6319 * po/POTFILES.in: Regenerate.
6320
6321 2011-06-09 Ian Lance Taylor <iant@google.com>
6322
6323 * script-sections.cc
6324 (Orphan_output_section::set_section_addresses): For a relocatable
6325 link set address to 0.
6326
6327 2011-06-09 Cary Coutant <ccoutant@google.com>
6328
6329 PR gold/12804
6330 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6331 used with --compress-debug-sections.
6332 * gold/object.cc (Sized_relobj_file::do_layout): Report
6333 uncompressed size of compressed input sections.
6334
6335 2011-06-08 Cary Coutant <ccoutant@google.com>
6336
6337 PR gold/12804
6338 * testsuite/two_file_test_2_v1.cc: Change initialization of
6339 v2 to keep it in .data.
6340
6341 2011-06-07 Cary Coutant <ccoutant@google.com>
6342
6343 * common.cc (Symbol_table::do_allocate_commons_list): Call
6344 gold_fallback.
6345 * errors.cc (Errors::fatal): Adjust call to gold_exit.
6346 (Errors::fallback): New function.
6347 (gold_fallback): New function.
6348 * errors.h (Errors::fallback): New function.
6349 * gold.cc (gold_exit): Change status parameter to enum; adjust
6350 all callers.
6351 (queue_initial_tasks): Call gold_fallback.
6352 * gold.h: Include cstdlib.
6353 (Exit_status): New enum type.
6354 (gold_exit): Change status parameter to enum.
6355 (gold_fallback): New function.
6356 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6357 (Layout::create_symtab_sections): Likewise.
6358 (Layout::create_shdrs): Likewise.
6359 * main.cc (main): Adjust call to gold_exit.
6360 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6361 (Output_data_got::add_got_entry_pair): Likewise.
6362 (Output_section::add_input_section): Likewise.
6363 (Output_section::add_output_section_data): Likewise.
6364 (Output_segment::set_section_list_addresses): Likewise.
6365 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6366
6367 2011-06-07 Cary Coutant <ccoutant@google.com>
6368
6369 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6370 for incremental links.
6371 * output.cc (Output_segment::set_section_list_addresses): Remove
6372 FIXME and test for TLS or BSS.
6373
6374 2011-06-07 Cary Coutant <ccoutant@google.com>
6375
6376 * testsuite/Makefile.am: Add incremental_copy_test,
6377 incremental_common_test_1.
6378 * testsuite/Makefile.in: Regenerate.
6379 * testsuite/common_test_1_v1.c: New source file.
6380 * testsuite/common_test_1_v2.c: New source file.
6381 * testsuite/copy_test_v1.cc: New source file.
6382
6383 2011-06-07 Cary Coutant <ccoutant@google.com>
6384
6385 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6386 update, allocate common from bss section's free list.
6387 * incremental-dump.cc (dump_incremental_inputs): Print flag for
6388 linker-defined symbols.
6389 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6390 Skip GOT and PLT entries that are no longer referenced.
6391 (Output_section_incremental_inputs::write_info_blocks): Mark
6392 linker-defined symbols.
6393 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6394 * output.cc (Output_section::allocate): New function.
6395 * output.h (Output_section::allocate): New function.
6396 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6397 linker-defined symbols.
6398 (Symbol::override_base_with_special): Copy is_predefined_ flag.
6399 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6400 (Symbol::init_base_output_data): Likewise.
6401 (Symbol::init_base_output_segment): Likewise.
6402 (Symbol::init_base_constant): Likewise.
6403 (Sized_symbol::init_output_data): Likewise.
6404 (Sized_symbol::init_output_segment): Likewise.
6405 (Sized_symbol::init_constant): Likewise.
6406 (Symbol_table::do_define_in_output_data): Likewise.
6407 (Symbol_table::do_define_in_output_segment): Likewise.
6408 (Symbol_table::do_define_as_constant): Likewise.
6409 * symtab.h (Symbol::is_predefined): New function.
6410 (Symbol::init_base_output_data): Add is_predefined parameter.
6411 (Symbol::init_base_output_segment): Likewise.
6412 (Symbol::init_base_constant): Likewise.
6413 (Symbol::is_predefined_): New data member.
6414 (Sized_symbol::init_output_data): Add is_predefined parameter.
6415 (Sized_symbol::init_output_segment): Likewise.
6416 (Sized_symbol::init_constant): Likewise.
6417 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6418
6419 2011-06-07 Cary Coutant <ccoutant@google.com>
6420
6421 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6422 instead of emit_copy_reloc.
6423 (Copy_relocs::emit_copy_reloc): Refactor.
6424 (Copy_relocs::make_copy_reloc): New function.
6425 (Copy_relocs::add_copy_reloc): Remove.
6426 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6427 section.
6428 (Copy_relocs::make_copy_reloc): New function.
6429 (Copy_relocs::add_copy_reloc): Remove.
6430 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6431 unchanged input files.
6432 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6433 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6434 Reserve BSS space for COPY relocations.
6435 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6436 (Output_section_incremental_inputs::write_info_blocks): Record
6437 whether a symbol is copied from a shared object.
6438 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6439 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6440 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6441 (Incremental_input_entry_reader::get_output_symbol_index): Add
6442 is_copy parameter.
6443 (Incremental_binary::emit_copy_relocs): New function.
6444 (Incremental_binary::do_emit_copy_relocs): New function.
6445 (Sized_incremental_binary::Sized_incremental_binary): Initialize
6446 new data member.
6447 (Sized_incremental_binary::add_copy_reloc): New function.
6448 (Sized_incremental_binary::do_emit_copy_relocs): New function.
6449 (Sized_incremental_binary::Copy_reloc): New struct.
6450 (Sized_incremental_binary::Copy_relocs): New typedef.
6451 (Sized_incremental_binary::copy_relocs_): New data member.
6452 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6453 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6454 * target.h (Sized_target::emit_copy_reloc): New function.
6455 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6456
6457 2011-06-02 Cary Coutant <ccoutant@google.com>
6458
6459 PR gold/12163
6460 * gold/archive.cc (Archive::Archive): Initialize new data member.
6461 (Archive::include_all_members): Return if archive has already been
6462 included.
6463 * gold/archive.h (Archive::include_all_members_): New data member.
6464
6465 2011-06-02 Nick Clifton <nickc@redhat.com>
6466
6467 * dynobj.h: Fix spelling mistake in comment.
6468 * output.cc: Likewise.
6469
6470 2011-05-31 Doug Kwan <dougkwan@google.com>
6471 Asier Llano
6472
6473 PR gold/12826
6474 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6475 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6476 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
6477 redundant arm_exidx_test.so.
6478 * testsuite/Makefile.in: Regenerate.
6479 (check_SCRIPTS): Add pr12826.sh
6480 (check_DATA): Add pr12826.stdout
6481 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6482 * testsuite/pr12826.sh: New file.
6483 * testsuite/pr12826_1.s: Ditto.
6484 * testsuite/pr12826_1.s: Ditto.
6485
6486 2011-05-30 Ian Lance Taylor <iant@google.com>
6487
6488 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6489 sections.
6490
6491 2011-05-29 Ian Lance Taylor <iant@google.com>
6492
6493 PR gold/12804
6494 * testsuite/Makefile.am: Use different file name for two_file_test
6495 temporary file for each incremental test.
6496 * testsuite/Makefile.in: Rebuild.
6497
6498 2011-05-29 Ian Lance Taylor <iant@google.com>
6499
6500 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6501 binary input file is empty.
6502
6503 2011-05-27 Ian Lance Taylor <iant@google.com>
6504
6505 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6506 (ver_test_9.so): Likewise.
6507 * testsuite/Makefile.in: Rebuild.
6508
6509 2011-05-26 Cary Coutant <ccoutant@google.com>
6510
6511 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6512 * incremental.cc (Incremental_inputs::report_input_section): Fix
6513 comment, indentation.
6514 (Incremental_inputs::report_comdat_group): New function.
6515 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6516 of data for incremental input file entry.
6517 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6518 group count, COMDAT group signatures.
6519 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6520 an unchanged input file.
6521 * incremental.h (Incremental_object_entry::Incremental_object_entry):
6522 Initialize new data member.
6523 (Incremental_object_entry::add_comdat_group): New function.
6524 (Incremental_object_entry::get_comdat_group_count): New function.
6525 (Incremental_object_entry::get_comdat_signature_key): New function.
6526 (Incremental_object_entry::groups_): New data member.
6527 (Incremental_inputs::report_comdat_group): New function.
6528 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6529 data for incremental input file entry.
6530 (Incremental_input_entry_reader::get_comdat_group_count): New function.
6531 (Incremental_input_entry_reader::get_input_section): Adjust size of
6532 data for incremental input file entry.
6533 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6534 (Incremental_input_entry_reader::get_comdat_group_signature): New
6535 function.
6536 * object.cc (Sized_relobj::include_section_group): Report kept
6537 COMDAT groups for incremental links.
6538
6539 2011-05-24 David Meyer <pdox@google.com>
6540
6541 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6542 with name parameter. Add found_name parameter.
6543 * fileread.cc (Input_file::find_file): Adjust code accordingly.
6544 * dirsearch.h (class Dirsearch): Update declaration.
6545
6546 2011-05-24 Ian Lance Taylor <iant@google.com>
6547
6548 * archive.cc (Library_base::should_include_member): Pull in object
6549 from archive if it defines the entry symbol.
6550 * parameters.cc (Parameters::entry): New function.
6551 * parameters.h (class Parameters): Declare entry.
6552 * output.h (class Output_file_header): Remove entry_ field.
6553 * output.cc (Output_file_header::Output_file_header): Remove entry
6554 parameter. Change all callers.
6555 (Output_file_header::entry): Use parameters->entry.
6556 * gold.cc (queue_middle_tasks): Likewise.
6557 * plugin.cc (Plugin_hook::run): Likewise.
6558
6559 2011-05-24 Cary Coutant <ccoutant@google.com>
6560
6561 * gold.cc (queue_initial_tasks): Pass incremental base filename
6562 to Output_file::open_base_file; don't print error message.
6563 * incremental-dump.cc (main): Adjust call to
6564 Output_file::open_for_modification.
6565 * incremental-dump.cc (main): Likewise.
6566 * incremental.cc (Incremental_inputs::report_command_line):
6567 Ignore --incremental-base option when comparing command lines.
6568 Ignore parameter when given as separate argument.
6569 * options.h (class General_options): Add --incremental-base.
6570 * output.cc (Output_file::Output_file):
6571 (Output_file::open_base_file): Add base_name and writable parameters;
6572 read base file into new file; print error message here.
6573 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6574 callers.
6575 * output.h (Output_file::open_for_modification): Rename to...
6576 (Output_file::open_base_file): ...this; add base_name and
6577 writable parameters; adjust all callers.
6578 (Output_file::map_no_anonymous): Add writable parameter; adjust all
6579 callers.
6580 * testsuite/Makefile.am (incremental_test_4): Test
6581 --incremental-base.
6582 * testsuite/Makefile.in: Regenerate.
6583
6584 2011-05-24 Cary Coutant <ccoutant@google.com>
6585
6586 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6587 incremental_test_4.
6588 * testsuite/Makefile.in: Regenerate.
6589 * testsuite/two_file_test_1_v1.cc: New test source file.
6590 * testsuite/two_file_test_1b_v1.cc: New test source file.
6591 * testsuite/two_file_test_2_v1.cc: New test source file.
6592
6593 2011-05-24 Cary Coutant <ccoutant@google.com>
6594
6595 * dynobj.h (Dynobj::do_dynobj): New function.
6596 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6597 flag and soname for shared objects.
6598 * incremental.cc (Incremental_inputs::report_object): Make
6599 either Incremental_object_entry or Incremental_dynobj_entry; add
6600 soname to string table.
6601 (Incremental_inputs::report_input_section): Add assertion.
6602 (Output_section_incremental_inputs::set_final_data_size): Adjust
6603 type of input file entry for shared libraries; adjust size of
6604 shared library info entry.
6605 (Output_section_incremental_inputs::write_input_files): Write
6606 as_needed flag for shared libraries.
6607 (Output_section_incremental_inputs::write_info_blocks): Adjust type
6608 of input file entry for shared libraries; write soname.
6609 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6610 soname from incremental info.
6611 * incremental.h (enum Incremental_input_flags): Add
6612 INCREMENTAL_INPUT_AS_NEEDED.
6613 (Incremental_input_entry::Incremental_input_entry): Initialize new
6614 data member.
6615 (Incremental_input_entry::set_as_needed): New function.
6616 (Incremental_input_entry::as_needed): New function.
6617 (Incremental_input_entry::do_dynobj_entry): New function.
6618 (Incremental_input_entry::as_needed_): New data member.
6619 (Incremental_object_entry::Incremental_object_entry): Don't check
6620 for shared library.
6621 (Incremental_object_entry::do_type): Likewise.
6622 (class Incremental_dynobj_entry): New class.
6623 (Incremental_input_entry_reader::as_needed): New function.
6624 (Incremental_input_entry_reader::get_soname): New function.
6625 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6626 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6627 size of shared library info entry.
6628 * layout.cc (Layout::finish_dynamic_section): Don't test for
6629 incremental link when adding DT_NEEDED entries.
6630 * object.h (Object::Object): Initialize new data member.
6631 (Object::dynobj): New function.
6632 (Object::set_as_needed): New function.
6633 (Object::as_needed): New function.
6634 (Object::do_dynobj): New function.
6635 (Object::as_needed_): New data member.
6636
6637 2011-05-24 Cary Coutant <ccoutant@google.com>
6638
6639 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6640 info; adjust display of GOT entries.
6641 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6642 vector of input objects; remove file_status_.
6643 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6644 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6645 got_plt reader; call target hooks to reserve GOT entries.
6646 (Output_section_incremental_inputs::set_final_data_size): Adjust size
6647 of input file info header and GOT info entry.
6648 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6649 relocation info.
6650 (Got_plt_view_info::got_descriptor): Remove.
6651 (Got_plt_view_info::sym_index): New data member.
6652 (Got_plt_view_info::input_index): New data member.
6653 (Local_got_offset_visitor::visit): Write input file index.
6654 (Global_got_offset_visitor::visit): Write 0 for input file index.
6655 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6656 with sym_index and input_index.
6657 (Output_section_incremental_inputs::write_got_plt): Adjust size of
6658 incremental info GOT entry; replace got_descriptor with input_index.
6659 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6660 map from input file index to object.
6661 (Sized_relobj_incr::do_layout): Replace direct data member reference
6662 with accessor function.
6663 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6664 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6665 Adjust size of input file info header.
6666 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6667 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6668 (Incremental_input_entry_reader::get_input_section): Adjust size of
6669 input file info header.
6670 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6671 of incremental info GOT entry.
6672 (Incremental_got_plt_reader::get_got_desc): Remove.
6673 (Incremental_got_plt_reader::get_got_symndx): New function.
6674 (Incremental_got_plt_reader::get_got_input_index): New function.
6675 (Sized_incremental_binary::Sized_incremental_binary): Remove
6676 file_status_; add input_objects_.
6677 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6678 (Sized_incremental_binary::set_file_is_unchanged): Remove.
6679 (Sized_incremental_binary::file_is_unchanged): Remove.
6680 (Sized_incremental_binary::set_input_object): New function.
6681 (Sized_incremental_binary::input_object): New function.
6682 (Sized_incremental_binary::file_status_): Remove.
6683 (Sized_incremental_binary::input_objects_): New data member.
6684 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6685 references.
6686 (Sized_relobj_incr::invalid_address): Move to base class.
6687 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6688 class.
6689 (Sized_relobj_incr::do_output_section_offset): Likewise.
6690 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6691 (Sized_relobj_incr::section_offsets_): Likewise.
6692 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6693 function.
6694 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6695 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6696 with accessor function.
6697 (Sized_relobj_file::do_layout): Likewise.
6698 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6699 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6700 (Sized_relobj_file::compute_final_local_value): Replace refs to
6701 section_offsets_ with accessor function.
6702 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6703 * object.h (Relobj::Relobj): Initialize new data members.
6704 (Relobj::add_dyn_reloc): New function.
6705 (Relobj::first_dyn_reloc): New function.
6706 (Relobj::dyn_reloc_count): New function.
6707 (Relobj::first_dyn_reloc_): New data member.
6708 (Relobj::dyn_reloc_count_): New data member.
6709 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6710 references.
6711 (Sized_relobj::Address): New typedef.
6712 (Sized_relobj::invalid_address): Move here from child class.
6713 (Sized_relobj::Sized_relobj): Initialize new data members.
6714 (Sized_relobj::sized_relobj): New function.
6715 (Sized_relobj::is_output_section_offset_invalid): Move here from
6716 child class.
6717 (Sized_relobj::get_output_section_offset): Likewise.
6718 (Sized_relobj::local_has_got_offset): Likewise.
6719 (Sized_relobj::local_got_offset): Likewise.
6720 (Sized_relobj::set_local_got_offset): Likewise.
6721 (Sized_relobj::do_for_all_local_got_entries): Likewise.
6722 (Sized_relobj::clear_got_offsets): New function.
6723 (Sized_relobj::section_offsets): Move here from child class.
6724 (Sized_relobj::do_output_section_offset): Likewise.
6725 (Sized_relobj::do_set_section_offset): Likewise.
6726 (Sized_relobj::Local_got_offsets): Likewise.
6727 (Sized_relobj::local_got_offsets_): Likewise.
6728 (Sized_relobj::section_offsets_): Likewise.
6729 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6730 references.
6731 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6732 class.
6733 (Sized_relobj_file::sized_relobj): New function
6734 (Sized_relobj_file::local_has_got_offset): Move to base class.
6735 (Sized_relobj_file::local_got_offset): Likewise.
6736 (Sized_relobj_file::set_local_got_offset): Likewise.
6737 (Sized_relobj_file::get_output_section_offset): Likewise.
6738 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6739 (Sized_relobj_file::do_output_section_offset): Likewise.
6740 (Sized_relobj_file::do_set_section_offset): Likewise.
6741 (Sized_relobj_file::Local_got_offsets): Likewise.
6742 (Sized_relobj_file::local_got_offsets_): Likewise.
6743 (Sized_relobj_file::section_offsets_): Likewise.
6744 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6745 (all constructors).
6746 (set_needs_dynsym_index): Convert relobj to derived class pointer.
6747 (Output_reloc::get_symbol_index): Likewise.
6748 (Output_reloc::local_section_offset): Likewise.
6749 (Output_reloc::get_address): Likewise.
6750 (Output_reloc::symbol_value): Likewise.
6751 (Output_data_got::reserve_slot): Move to class definition.
6752 (Output_data_got::reserve_local): New function.
6753 (Output_data_got::reserve_slot_for_global): Remove.
6754 (Output_data_got::reserve_global): New function.
6755 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6756 (all constructors, two instantiations).
6757 (Output_reloc::get_relobj): New function (two instantiations).
6758 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6759 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6760 (Output_data_reloc::add_global): Adjust type of relobj.
6761 (Output_data_reloc::add_global_relative): Likewise.
6762 (Output_data_reloc::add_symbolless_global_addend): Likewise.
6763 (Output_data_reloc::add_local): Likewise.
6764 (Output_data_reloc::add_local_relative): Likewise.
6765 (Output_data_reloc::add_symbolless_local_addend): Likewise.
6766 (Output_data_reloc::add_local_section): Likewise.
6767 (Output_data_reloc::add_output_section): Likewise.
6768 (Output_data_reloc::add_absolute): Likewise.
6769 (Output_data_reloc::add_target_specific): Likewise.
6770 (Output_data_got::reserve_slot): Move definition here.
6771 (Output_data_got::reserve_local): New function.
6772 (Output_data_got::reserve_global): New function.
6773 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6774 section_offsets_ with accessor function.
6775 (Sized_relobj_file::write_sections): Likewise.
6776 (Sized_relobj_file::do_relocate_sections): Likewise.
6777 * target.h (Sized_target::reserve_local_got_entry): New function.
6778 (Sized_target::reserve_global_got_entry): New function.
6779 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6780 (Target_x86_64::reserve_global_got_entry): New function.
6781 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6782
6783 2011-05-23 Cary Coutant <ccoutant@google.com>
6784
6785 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6786 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6787 bit when checking got_type.
6788 * incremental.cc (Sized_incremental_binary::setup_readers):
6789 Store symbol table and string table locations; initialize bit vector
6790 of file status flags.
6791 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6792 unchanged files.
6793 (Sized_incremental_binary::do_process_got_plt): New function.
6794 (Sized_incremental_binary::get_symtab_view): Use stored locations.
6795 (Output_section_incremental_inputs::set_final_data_size): Record
6796 file index for each input file.
6797 (Output_section_incremental_inputs::write_got_plt): Store file index
6798 instead of input entry offset for each GOT entry.
6799 * incremental.h
6800 (Incremental_input_entry::Incremental_input_entry): Initialize new
6801 data member.
6802 (Incremental_input_entry::set_offset): Store file index.
6803 (Incremental_input_entry::get_file_index): New function.
6804 (Incremental_input_entry::file_index_): New data member.
6805 (Incremental_binary::process_got_plt): New function.
6806 (Incremental_binary::do_process_got_plt): New function.
6807 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6808 data members.
6809 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
6810 (Sized_incremental_binary::set_file_is_unchanged): New function.
6811 (Sized_incremental_binary::file_is_unchanged): New function.
6812 (Sized_incremental_binary::do_process_got_plt): New function.
6813 (Sized_incremental_binary::file_status_): New data member.
6814 (Sized_incremental_binary::main_symtab_loc_): New data member.
6815 (Sized_incremental_binary::main_strtab_loc_): New data member.
6816 * output.cc (Output_data_got::Got_entry::write): Add case
6817 RESERVED_CODE.
6818 (Output_data_got::add_global): Call add_got_entry.
6819 (Output_data_got::add_global_plt): Likewise.
6820 (Output_data_got::add_global_with_rel): Likewise.
6821 (Output_data_got::add_global_with_rela): Likewise.
6822 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
6823 (Output_data_got::add_global_pair_with_rela): Likewise.
6824 (Output_data_got::add_local): Call add_got_entry.
6825 (Output_data_got::add_local_plt): Likewise.
6826 (Output_data_got::add_local_with_rel): Likewise.
6827 (Output_data_got::add_local_with_rela): Likewise.
6828 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
6829 (Output_data_got::add_local_pair_with_rela): Likewise.
6830 (Output_data_got::reserve_slot): New function.
6831 (Output_data_got::reserve_slot_for_global): New function.
6832 (Output_data_got::add_got_entry): New function.
6833 (Output_data_got::add_got_entry_pair): New function.
6834 (Output_section::add_output_section_data): Edit FIXME.
6835 * output.h
6836 (Output_section_data_build::Output_section_data_build): New
6837 constructor with size parameter.
6838 (Output_data_space::Output_data_space): Likewise.
6839 (Output_data_got::Output_data_got): Initialize new data member; new
6840 constructor with size parameter.
6841 (Output_data_got::add_constant): Call add_got_entry.
6842 (Output_data_got::reserve_slot): New function.
6843 (Output_data_got::reserve_slot_for_global): New function.
6844 (class Output_data_got::Got_entry): Add RESERVED_CODE.
6845 (Output_data_got::add_got_entry): New function.
6846 (Output_data_got::add_got_entry_pair): New function.
6847 (Output_data_got::free_list_): New data member.
6848 * target.h (Sized_target::init_got_plt_for_update): New function.
6849 (Sized_target::register_global_plt_entry): New function.
6850 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
6851 Initialize new data member; call init; add constructor with PLT count.
6852 (Output_data_plt_x86_64::init): New function.
6853 (Output_data_plt_x86_64::add_relocation): New function.
6854 (Output_data_plt_x86_64::reserve_slot): New function.
6855 (Output_data_plt_x86_64::free_list_): New data member.
6856 (Target_x86_64::init_got_plt_for_update): New function.
6857 (Target_x86_64::register_global_plt_entry): New function.
6858 (Output_data_plt_x86_64::add_entry): Allocate from free list for
6859 incremental updates.
6860 (Output_data_plt_x86_64::add_relocation): New function.
6861 * testsuite/object_unittest.cc (Object_test): Set default options.
6862
6863 2011-05-16 Ian Lance Taylor <iant@google.com>
6864
6865 * options.h (class General_options): Make -i a synonym for -r.
6866
6867 2011-05-16 Ian Lance Taylor <iant@google.com>
6868
6869 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
6870
6871 2011-05-10 Cary Coutant <ccoutant@google.com>
6872
6873 * object.cc (Sized_relobj::do_count_local_symbols): Check for
6874 strip_all (-s).
6875
6876 2011-05-06 Ian Lance Taylor <iant@google.com>
6877
6878 * layout.cc (Layout::layout): If the output section flags change,
6879 update the ordering.
6880
6881 2011-04-25 Cary Coutant <ccoutant@google.com>
6882
6883 * incremental-dump.cc (dump_incremental_inputs): Print local
6884 symbol info for each input file.
6885 * incremental.cc
6886 (Output_section_incremental_inputs::set_final_data_size): Add local
6887 symbol info to input file entries in incremental info.
6888 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6889 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
6890 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
6891 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
6892 implementation.
6893 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
6894 (Sized_incr_relobj::do_relocate): Write the local symbols.
6895 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
6896 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
6897 Adjust size of input file header.
6898 (Incremental_inputs_reader::get_local_symbol_offset): New function.
6899 (Incremental_inputs_reader::get_local_symbol_count): New function.
6900 (Incremental_inputs_reader::get_input_section): Adjust size of input
6901 file header.
6902 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
6903 (Sized_incr_relobj::This): New typedef.
6904 (Sized_incr_relobj::sym_size): New const data member.
6905 (Sized_incr_relobj::Local_symbol): New struct.
6906 (Sized_incr_relobj::do_output_local_symbol_count): New function.
6907 (Sized_incr_relobj::do_local_symbol_offset): New function.
6908 (Sized_incr_relobj::local_symbol_count_): New data member.
6909 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
6910 (Sized_incr_relobj::local_symbol_index_): New data member.
6911 (Sized_incr_relobj::local_symbol_offset_): New data member.
6912 (Sized_incr_relobj::local_dynsym_offset_): New data member.
6913 (Sized_incr_relobj::local_symbols_): New data member.
6914 * object.h (Relobj::output_local_symbol_count): New function.
6915 (Relobj::local_symbol_offset): New function.
6916 (Relobj::do_output_local_symbol_count): New function.
6917 (Relobj::do_local_symbol_offset): New function.
6918 (Sized_relobj::do_output_local_symbol_count): New function.
6919 (Sized_relobj::do_local_symbol_offset): New function.
6920
6921 2011-04-22 Vladimir Simonov <sv@sw.ru>
6922
6923 * descriptors.cc (set_close_on_exec): New function.
6924 (Descriptors::open): Use set_close_on_exec.
6925 * output.cc (S_ISLNK): Define if not defined.
6926
6927 2011-04-22 Cary Coutant <ccoutant@google.com>
6928
6929 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6930 global symbol map.
6931 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6932 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
6933 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
6934 relocations.
6935 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
6936 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
6937 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
6938 * incremental.h
6939 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
6940 function.
6941 (Incremental_binary::apply_incremental_relocs): New function.
6942 (Incremental_binary::do_apply_incremental_relocs): New function.
6943 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
6944 data member.
6945 (Sized_incremental_binary::add_global_symbol): New function.
6946 (Sized_incremental_binary::global_symbol): New function.
6947 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
6948 (Sized_incremental_binary::symbol_map_): New data member.
6949 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
6950 * target.h (Sized_target::apply_relocation): New function.
6951 * target-reloc.h (apply_relocation): New function.
6952 * x86_64.cc (Target_x86_64::apply_relocation): New function.
6953
6954 2011-04-22 Doug Kwan <dougkwan@google.com>
6955
6956 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
6957 flag of a SHT_ARM_EXIDX section.
6958 * testsuite/Makefile.am (arm_exidx_test): New test rules.
6959 * testsuite/Makefile.in: Regenerate.
6960 * testsuite/arm_exidx_test.s: New file.
6961 * testsuite/arm_exidx_test.sh: Same.
6962
6963 2011-04-20 Cary Coutant <ccoutant@google.com>
6964
6965 PR gold/12689
6966 * archive.h (Incremental_archive_entry::Archive_member):
6967 Initialize arg_serial_ (second constructor).
6968
6969 2011-04-17 Ian Lance Taylor <iant@google.com>
6970
6971 * object.cc (Relocate_info::location): Simplify location string.
6972 * errors.cc (Errors::error_at_location): Don't print program
6973 name.
6974 (Errors::warning_at_location): Likewise.
6975 (Errors::undefined_symbol): Likewise.
6976 * testsuite/debug_msg.sh: Update accordingly.
6977
6978 2011-04-14 Cary Coutant <ccoutant@google.com>
6979
6980 * gold/layout.cc (Layout::symtab_section_offset): New function.
6981 * gold/layout.h (Layout::symtab_section_offset): New function.
6982 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6983
6984 2011-04-12 Ian Lance Taylor <iant@google.com>
6985
6986 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
6987 with MREMAP_MAYMOVE.
6988 * output.h (class Output_file): Add map_is_allocated_ field.
6989 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
6990 not available, provide stubs. If mremap is not available, #define
6991 it to gold_mremap.
6992 (MREMAP_MAYMOVE): Define if not defined.
6993 (Output_file::Output_file): Initialize map_is_allocated_.
6994 (Output_file::resize): Check map_is_allocated_.
6995 (Output_file::map_anonymous): If mmap fails, use malloc.
6996 (Output_file::unmap): Don't do anything for an anonymous map.
6997 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
6998 is not available, provide stubs.
6999 (File_read::View::~View): Use free rather than delete[].
7000 (File_read::make_view): Use malloc rather than new[]. If mmap
7001 fails, use malloc.
7002 (File_read::find_or_make_view): Use malloc rather than new[].
7003 * gold.h: Remove HAVE_REMAP code.
7004 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
7005 exists. Rename mremap to gold_mremap. If mmap is not available
7006 don't do anything.
7007 * configure, config.in: Rebuild.
7008
7009 2011-04-11 Ian Lance Taylor <iant@google.com>
7010
7011 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7012 initialize local variable v.
7013
7014 2011-04-11 Cary Coutant <ccoutant@google.com>
7015
7016 * archive.cc (Archive::include_member): Adjust call to
7017 report_object.
7018 (Add_archive_symbols::run): Track argument serial numbers.
7019 (Lib_group::include_member): Likewise.
7020 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7021 * archive.h (Incremental_archive_entry::Archive_member):
7022 Initialize arg_serial_.
7023 (Archive_member::arg_serial_): New data member.
7024 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7025 (Sized_dynobj::do_add_symbols): Track symbols when doing an
7026 incremental link.
7027 (Sized_dynobj::do_for_all_local_got_entries): New function.
7028 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7029 function.
7030 * fileread.cc (get_mtime): New function.
7031 * fileread.h (get_mtime): New function.
7032 * gold.cc (queue_initial_tasks): Check for incremental update.
7033 (process_incremental_input): New function.
7034 (queue_middle_tasks): Don't force valid target for incremental
7035 update.
7036 * incremental-dump.cc (find_input_containing_global): Adjust
7037 size of symbol info entry.
7038 (dump_incremental_inputs): Dump argument serial number and
7039 in_system_directory flag; bias shndx by 1; print symbol names
7040 when dumping per-file symbol lists; use new symbol info readers.
7041 * incremental.cc
7042 (Output_section_incremental_inputs:update_data_size): New function.
7043 (Sized_incremental_binary::setup_readers): Setup input readers
7044 for each input file; build maps for files added from libraries
7045 and scripts.
7046 (Sized_incremental_binary::check_input_args): New function.
7047 (Sized_incremental_binary::do_check_inputs): Build map of argument
7048 serial numbers to input arguments.
7049 (Sized_incremental_binary::do_file_has_changed): Rename
7050 do_file_is_unchanged to this; compare file modification times.
7051 (Sized_incremental_binary::do_init_layout): New function.
7052 (Sized_incremental_binary::do_reserve_layout): New function.
7053 (Sized_incremental_binary::do_get_input_reader): Remove.
7054 (Sized_incremental_binary::get_symtab_view): New function.
7055 (Incremental_checker::can_incrementally_link_output_file): Remove.
7056 (Incremental_inputs::report_command_line): Exclude --debug options.
7057 (Incremental_inputs::report_archive_begin): Add parameter; track
7058 argument serial numbers; don't put input file entry for archive
7059 before archive members.
7060 (Incremental_inputs::report_archive_end): Put input file entry
7061 for archive after archive members.
7062 (Incremental_inputs::report_object): Add parameter; track argument
7063 serial numbers and in_system_directory flag.
7064 (Incremental_inputs::report_script): Add parameter; track argument
7065 serial numbers.
7066 (Output_section_incremental_inputs::set_final_data_size): Adjust
7067 size of symbol info entry; check for forwarding symbols.
7068 (Output_section_incremental_inputs::write_input_files): Write
7069 in_system_directory flag and argument serial number.
7070 (Output_section_incremental_inputs::write_info_blocks): Map section
7071 indices between incremental info and original input file; store
7072 input section index for each symbol.
7073 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7074 change operator() to visit().
7075 (class Global_got_offset_visitor): Likewise.
7076 (class Global_symbol_visitor_got_plt):
7077 (Output_section_incremental_inputs::write_got_plt): Use new visitor
7078 classes.
7079 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7080 (Sized_incr_relobj::do_read_symbols): New function.
7081 (Sized_incr_relobj::do_layout): New function.
7082 (Sized_incr_relobj::do_layout_deferred_sections): New function.
7083 (Sized_incr_relobj::do_add_symbols): New function.
7084 (Sized_incr_relobj::do_should_include_member): New function.
7085 (Sized_incr_relobj::do_for_all_global_symbols): New function.
7086 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7087 (Sized_incr_relobj::do_section_size): New function.
7088 (Sized_incr_relobj::do_section_name): New function.
7089 (Sized_incr_relobj::do_section_contents): New function.
7090 (Sized_incr_relobj::do_section_flags): New function.
7091 (Sized_incr_relobj::do_section_entsize): New function.
7092 (Sized_incr_relobj::do_section_address): New function.
7093 (Sized_incr_relobj::do_section_type): New function.
7094 (Sized_incr_relobj::do_section_link): New function.
7095 (Sized_incr_relobj::do_section_info): New function.
7096 (Sized_incr_relobj::do_section_addralign): New function.
7097 (Sized_incr_relobj::do_initialize_xindex): New function.
7098 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7099 (Sized_incr_relobj::do_read_relocs): New function.
7100 (Sized_incr_relobj::do_gc_process_relocs): New function.
7101 (Sized_incr_relobj::do_scan_relocs): New function.
7102 (Sized_incr_relobj::do_count_local_symbols): New function.
7103 (Sized_incr_relobj::do_finalize_local_symbols): New function.
7104 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7105 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7106 (Sized_incr_relobj::do_relocate): New function.
7107 (Sized_incr_relobj::do_set_section_offset): New function.
7108 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7109 (Sized_incr_dynobj::do_read_symbols): New function.
7110 (Sized_incr_dynobj::do_layout): New function.
7111 (Sized_incr_dynobj::do_add_symbols): New function.
7112 (Sized_incr_dynobj::do_should_include_member): New function.
7113 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7114 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7115 (Sized_incr_dynobj::do_section_size): New function.
7116 (Sized_incr_dynobj::do_section_name): New function.
7117 (Sized_incr_dynobj::do_section_contents): New function.
7118 (Sized_incr_dynobj::do_section_flags): New function.
7119 (Sized_incr_dynobj::do_section_entsize): New function.
7120 (Sized_incr_dynobj::do_section_address): New function.
7121 (Sized_incr_dynobj::do_section_type): New function.
7122 (Sized_incr_dynobj::do_section_link): New function.
7123 (Sized_incr_dynobj::do_section_info): New function.
7124 (Sized_incr_dynobj::do_section_addralign): New function.
7125 (Sized_incr_dynobj::do_initialize_xindex): New function.
7126 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7127 (make_sized_incremental_object): New function.
7128 (Incremental_library::copy_unused_symbols): New function.
7129 (Incremental_library::do_for_all_unused_symbols): New function.
7130 * incremental.h (enum Incremental_input_flags): New type.
7131 (class Incremental_checker): Remove.
7132 (Incremental_input_entry::Incremental_input_entry): Add argument
7133 serial number.
7134 (Incremental_input_entry::arg_serial): New function.
7135 (Incremental_input_entry::set_is_in_system_directory): New function.
7136 (Incremental_input_entry::is_in_system_directory): New function.
7137 (Incremental_input_entry::arg_serial_): New data member.
7138 (Incremental_input_entry::is_in_system_directory_): New data member.
7139 (class Script_info): Move here from script.h.
7140 (Script_info::Script_info): Add filename parameter.
7141 (Script_info::filename): New function.
7142 (Script_info::filename_): New data member.
7143 (Incremental_script_entry::Incremental_script_entry): Add argument
7144 serial number.
7145 (Incremental_object_entry::Incremental_object_entry): Likewise.
7146 (Incremental_object_entry::add_input_section): Build list of input
7147 sections with map to original shndx.
7148 (Incremental_object_entry::get_input_section_index): New function.
7149 (Incremental_object_entry::shndx_): New data member.
7150 (Incremental_object_entry::name_key_): Rename; adjust all refs.
7151 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7152 (Incremental_archive_entry::Incremental_archive_entry): Add argument
7153 serial number.
7154 (Incremental_inputs::report_archive_begin): Likewise.
7155 (Incremental_inputs::report_object): Likewise.
7156 (Incremental_inputs::report_script): Likewise.
7157 (class Incremental_global_symbol_reader): New class.
7158 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7159 and store flags and input file type.
7160 (Incremental_input_entry_reader::arg_serial): New function.
7161 (Incremental_input_entry_reader::type): Extract type from flags.
7162 (Incremental_input_entry_reader::is_in_system_directory): New function.
7163 (Incremental_input_entry_reader::get_input_section_count): Call
7164 accessor function for type.
7165 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7166 function for type; adjust size of global symbol entry.
7167 (Incremental_input_entry_reader::get_global_symbol_count): Call
7168 accessor function for type.
7169 (Incremental_input_entry_reader::get_object_count): Likewise.
7170 (Incremental_input_entry_reader::get_object_offset): Likewise.
7171 (Incremental_input_entry_reader::get_member_count): Likewise.
7172 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7173 (Incremental_input_entry_reader::get_member_offset): Likewise.
7174 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7175 (Incremental_input_entry_reader::Global_symbol_info): Remove.
7176 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7177 (Incremental_input_entry_reader::get_global_symbol_reader): New
7178 function.
7179 (Incremental_input_entry_reader::get_output_symbol_index): New
7180 function.
7181 (Incremental_input_entry_reader::type_): Remove.
7182 (Incremental_input_entry_reader::flags_): New data member.
7183 (Incremental_inputs_reader::input_file_offset): New function.
7184 (Incremental_inputs_reader::input_file_index): New function.
7185 (Incremental_inputs_reader::input_file): Call input_file_offset.
7186 (Incremental_inputs_reader::input_file_at_offset): New function.
7187 (Incremental_relocs_reader::get_r_type): Reformat.
7188 (Incremental_relocs_reader::get_r_shndx): Reformat.
7189 (Incremental_relocs_reader::get_r_offset): Reformat.
7190 (Incremental_relocs_reader::data): New function.
7191 (Incremental_binary::Incremental_binary): Initialize new data members.
7192 (Incremental_binary::check_inputs): Add cmdline parameter.
7193 (Incremental_binary::file_is_unchanged): Remove.
7194 (Input_reader::arg_serial): New function.
7195 (Input_reader::get_unused_symbol_count): New function.
7196 (Input_reader::get_unused_symbol): New function.
7197 (Input_reader::do_arg_serial): New function.
7198 (Input_reader::do_get_unused_symbol_count): New function.
7199 (Input_reader::do_get_unused_symbol): New function.
7200 (Incremental_binary::input_file_count): New function.
7201 (Incremental_binary::get_input_reader): Change signature to use
7202 index instead of filename.
7203 (Incremental_binary::file_has_changed): New function.
7204 (Incremental_binary::get_input_argument): New function.
7205 (Incremental_binary::get_library): New function.
7206 (Incremental_binary::get_script_info): New function.
7207 (Incremental_binary::init_layout): New function.
7208 (Incremental_binary::reserve_layout): New function.
7209 (Incremental_binary::output_file): New function.
7210 (Incremental_binary::do_check_inputs): New function.
7211 (Incremental_binary::do_file_is_unchanged): Remove.
7212 (Incremental_binary::do_file_has_changed): New function.
7213 (Incremental_binary::do_init_layout): New function.
7214 (Incremental_binary::do_reserve_layout): New function.
7215 (Incremental_binary::do_input_file_count): New function.
7216 (Incremental_binary::do_get_input_reader): Change signature.
7217 (Incremental_binary::input_args_map_): New data member.
7218 (Incremental_binary::library_map_): New data member.
7219 (Incremental_binary::script_map_): New data member.
7220 (Sized_incremental_binary::Sized_incremental_binary): Initialize
7221 new data members.
7222 (Sized_incremental_binary::output_section): New function.
7223 (Sized_incremental_binary::inputs_reader): Add const.
7224 (Sized_incremental_binary::symtab_reader): Add const.
7225 (Sized_incremental_binary::relocs_reader): Add const.
7226 (Sized_incremental_binary::got_plt_reader): Add const.
7227 (Sized_incremental_binary::get_symtab_view): New function.
7228 (Sized_incremental_binary::Inputs_reader): New typedef.
7229 (Sized_incremental_binary::Input_entry_reader): New typedef.
7230 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7231 (Sized_incremental_binary::do_file_is_unchanged): Remove.
7232 (Sized_incremental_binary::do_file_has_changed): New function.
7233 (Sized_incremental_binary::do_init_layout): New function.
7234 (Sized_incremental_binary::do_reserve_layout): New function.
7235 (Sized_input_reader::Inputs_reader): Remove.
7236 (Sized_input_reader::Input_entry_reader): Remove.
7237 (Sized_input_reader::do_arg_serial): New function.
7238 (Sized_input_reader::do_get_unused_symbol_count): New function.
7239 (Sized_input_reader::do_get_unused_symbol): New function.
7240 (Sized_incremental_binary::do_input_file_count): New function.
7241 (Sized_incremental_binary::do_get_input_reader): Change signature;
7242 use index instead of filename.
7243 (Sized_incremental_binary::section_map_): New data member.
7244 (Sized_incremental_binary::input_entry_readers_): New data member.
7245 (class Sized_incr_relobj): New class.
7246 (class Sized_incr_dynobj): New class.
7247 (make_sized_incremental_object): New function.
7248 (class Incremental_library): New class.
7249 * layout.cc (Free_list::num_lists): New static data member.
7250 (Free_list::num_nodes): New static data member.
7251 (Free_list::num_removes): New static data member.
7252 (Free_list::num_remove_visits): New static data member.
7253 (Free_list::num_allocates): New static data member.
7254 (Free_list::num_allocate_visits): New static data member.
7255 (Free_list::init): New function.
7256 (Free_list::remove): New function.
7257 (Free_list::allocate): New function.
7258 (Free_list::dump): New function.
7259 (Free_list::print_stats): New function.
7260 (Layout_task_runner::run): Resize output file for incremental updates.
7261 (Layout::Layout): Initialize new data members.
7262 (Layout::set_incremental_base): New function.
7263 (Layout::init_fixed_output_section): New function.
7264 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7265 incremental updates.
7266 (Layout::create_gold_note): Do not create gold note section for
7267 incremental updates.
7268 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7269 for incremental updates.
7270 (Layout::set_section_offsets): For incremental updates, allocate space
7271 from free list.
7272 (Layout::create_symtab_sections): Layout with offsets relative to
7273 start of section; for incremental updates, allocate space from free
7274 list.
7275 (Layout::create_shdrs): For incremental updates, allocate space from
7276 free list.
7277 (Layout::finish_dynamic_section): For incremental updates, do not
7278 check --as-needed (fixed in subsequent patch).
7279 * layout.h (class Free_list): New class.
7280 (Layout::set_incremental_base): New function.
7281 (Layout::incremental_base): New function.
7282 (Layout::init_fixed_output_section): New function.
7283 (Layout::allocate): New function.
7284 (Layout::incremental_base_): New data member.
7285 (Layout::free_list_): New data member.
7286 * main.cc (main): Print Free_list statistics.
7287 * object.cc (Relobj::finalize_incremental_relocs): Add
7288 clear_counts parameter; clear counts only when clear_counts is set.
7289 (Sized_relobj::Sized_relobj): Initialize new base class.
7290 (Sized_relobj::do_layout): Don't report special sections.
7291 (Sized_relobj::do_for_all_local_got_entries): New function.
7292 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7293 symtab_off to all symbol table offsets.
7294 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7295 * object.h (class Got_offset_list): Move to top of file.
7296 (Object::Object): Allow case where input_file == NULL.
7297 (Object::~Object): Likewise.
7298 (Object::input_file): Assert that input_file != NULL.
7299 (Object::lock): Allow case where input_file == NULL.
7300 (Object::unlock): Likewise.
7301 (Object::is_locked): Likewise.
7302 (Object::token): Likewise.
7303 (Object::release): Likewise.
7304 (Object::is_incremental): New function.
7305 (Object::get_mtime): New function.
7306 (Object::for_all_local_got_entries): New function.
7307 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7308 (Object::set_is_in_system_directory): New function.
7309 (Object::is_in_system_directory): New function.
7310 (Object::do_is_incremental): New function.
7311 (Object::do_get_mtime): New function.
7312 (Object::do_for_all_local_got_entries): New function.
7313 (Object::is_in_system_directory_): New data member.
7314 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7315 (class Sized_relobj_base): New class.
7316 (class Sized_relobj): Derive from Sized_relobj_base.
7317 (class Sized_relobj::Symbols): Redeclare from base class.
7318 (class Sized_relobj::local_got_offset_list): Remove.
7319 (class Sized_relobj::Output_sections): Redeclare from base class.
7320 (class Sized_relobj::do_for_all_local_got_entries): New function.
7321 (class Sized_relobj::write_local_symbols): Add offset parameter.
7322 (class Sized_relobj::local_symbol_offset_): Update comment.
7323 (class Sized_relobj::local_dynsym_offset_): Update comment.
7324 * options.cc (Input_arguments::add_file): Remove const.
7325 * options.h (Input_file_argument::Input_file_argument):
7326 Initialize arg_serial_ (all constructors).
7327 (Input_file_argument::set_arg_serial): New function.
7328 (Input_file_argument::arg_serial): New function.
7329 (Input_file_argument::arg_serial_): New data member.
7330 (Input_arguments::Input_arguments): Initialize file_count_.
7331 (Input_arguments::add_file): Remove const.
7332 (Input_arguments::number_of_input_files): New function.
7333 (Input_arguments::file_count_): New data member.
7334 (Command_line::number_of_input_files): Call
7335 Input_arguments::number_of_input_files.
7336 * output.cc (Output_segment_headers::Output_segment_headers):
7337 Set current size.
7338 (Output_section::Input_section::current_data_size): New function.
7339 (Output_section::Output_section): Initialize new data members.
7340 (Output_section::add_input_section): Don't do merge sections for
7341 an incremental link; allocate space from free list for an
7342 incremental update.
7343 (Output_section::add_output_section_data): Allocate space from
7344 free list for an incremental update.
7345 (Output_section::update_data_size): New function.
7346 (Output_section::set_fixed_layout): New function.
7347 (Output_section::reserve): New function.
7348 (Output_segment::set_section_addresses): Remove const.
7349 (Output_segment::set_section_list_addresses): Remove const; allocate
7350 space from free list for an incremental update.
7351 (Output_segment::set_offset): Adjust size of RELRO segment for an
7352 incremental update.
7353 * output.h (Output_data::current_data_size): Move here from
7354 child classes.
7355 (Output_data::pre_finalize_data_size): New function.
7356 (Output_data::update_data_size): New function.
7357 (Output_section_headers::update_data_size): new function.
7358 (Output_section_data_build::current_data_size): Move to Output_data.
7359 (Output_data_strtab::update_data_size): New function.
7360 (Output_section::current_data_size): Move to Output_data.
7361 (Output_section::set_fixed_layout): New function.
7362 (Output_section::has_fixed_layout): New function.
7363 (Output_section::reserve): New function.
7364 (Output_section::update_data_size): New function.
7365 (Output_section::has_fixed_layout_): New data member.
7366 (Output_section::free_list_): New data member.
7367 (Output_segment::set_section_addresses): Remove const.
7368 (Output_segment::set_section_list_addresses): Remove const.
7369 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7370 New function.
7371 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7372 New function.
7373 * readsyms.cc (Read_symbols::do_read_symbols): Add library
7374 parameter when calling Add_symbols constructor; store argument
7375 serial number for members of a lib group.
7376 (Add_symbols::locks): Allow case where token == NULL.
7377 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7378 (Read_member::~Read_member): New function.
7379 (Read_member::is_runnable): New function.
7380 (Read_member::locks): New function.
7381 (Read_member::run): New function.
7382 (Check_script::~Check_script): New function.
7383 (Check_script::is_runnable): New function.
7384 (Check_script::locks): New function.
7385 (Check_script::run): New function.
7386 (Check_library::~Check_library): New function.
7387 (Check_library::is_runnable): New function.
7388 (Check_library::locks): New function.
7389 (Check_library::run): New function.
7390 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7391 (Add_symbols::library_): New data member.
7392 (class Read_member): New class.
7393 (class Check_script): New class.
7394 (class Check_library): New class.
7395 * reloc.cc (Read_relocs::is_runnable): Allow case where
7396 token == NULL.
7397 (Read_relocs::locks): Likewise.
7398 (Scan_relocs::locks): Likewise.
7399 (Relocate_task::locks): Likewise.
7400 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7401 to clear counters.
7402 (Sized_relobj::incremental_relocs_scan): Fix comment.
7403 (Sized_relobj::do_relocate): Pass output file offset to
7404 write_local_symbols.
7405 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7406 from class declaration.
7407 * script.cc (read_input_script): Allocate Script_info; pass
7408 argument serial number to report_script.
7409 * script.h (class Script_info): Move to incremental.h.
7410 * symtab.cc (Symbol_table::add_from_incrobj): New function.
7411 * symtab.h (Symbol_table::add_from_incrobj): New function.
7412 (Symbol_table::set_file_offset): New function.
7413
7414 2011-04-05 Cary Coutant <ccoutant@google.com>
7415
7416 * incremental-dump.cc (dump_incremental_inputs): Change signature
7417 to take a Sized_incremental_binary; change caller. Use readers
7418 in Sized_incremental_binary.
7419 * incremental.cc
7420 (Sized_incremental_binary::find_incremental_inputs_sections):
7421 Rename do_find_incremental_inputs_sections to this.
7422 (Sized_incremental_binary::setup_readers): New function.
7423 (Sized_incremental_binary::do_check_inputs): Check
7424 has_incremental_info_ flag; move setup code to setup_readers;
7425 use input readers.
7426 (Sized_incremental_binary::do_file_is_unchanged): New function.
7427 (Sized_incremental_binary::do_get_input_reader): New function.
7428 * incremental.h (class Incremental_binary): Move to end of file.
7429 (Incremental_binary::file_is_unchanged): New function.
7430 (Incremental_binary::do_file_is_unchanged): New function.
7431 (Incremental_binary::Input_reader): New class.
7432 (Incremental_binary::get_input_reader): New function.
7433 (class Sized_incremental_binary): Move to end of file.
7434 (Sized_incremental_binary::Sized_incremental_binary): Setup the
7435 input section reader classes.
7436 (Sized_incremental_binary::has_incremental_info): New function.
7437 (Sized_incremental_binary::inputs_reader): New function.
7438 (Sized_incremental_binary::symtab_reader): New function.
7439 (Sized_incremental_binary::relocs_reader): New function.
7440 (Sized_incremental_binary::got_plt_reader): New function.
7441 (Sized_incremental_binary::do_file_is_unchanged): New function.
7442 (Sized_incremental_binary::Sized_input_reader): New class.
7443 (Sized_incremental_binary::get_input_reader): New function.
7444 (Sized_incremental_binary::find_incremental_inputs_sections):
7445 Rename do_find_incremental_inputs_sections to this.
7446 (Sized_incremental_binary::setup_readers): New function.
7447 (Sized_incremental_binary::has_incremental_info_): New data member.
7448 (Sized_incremental_binary::inputs_reader_): New data member.
7449 (Sized_incremental_binary::symtab_reader_): New data member.
7450 (Sized_incremental_binary::relocs_reader_): New data member.
7451 (Sized_incremental_binary::got_plt_reader_): New data member.
7452 (Sized_incremental_binary::current_input_file_): New data member.
7453
7454 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
7455
7456 PR gold/12640
7457 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7458 violation.
7459
7460 2011-03-30 Cary Coutant <ccoutant@google.com>
7461
7462 * archive.cc (Archive::include_member): Adjust call to report_object.
7463 (Add_archive_symbols::run): Add script_info to call to
7464 report_archive_begin.
7465 (Lib_group::include_member): Adjust call to report_object.
7466 (Add_lib_group_symbols::run): Adjust call to report_object.
7467 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7468 blocks. Add object count for script input files.
7469 * incremental.cc (Incremental_inputs::report_archive_begin): Add
7470 script_info parameter; change all callers.
7471 (Incremental_inputs::report_object): Add script_info parameter;
7472 change all callers.
7473 (Incremental_inputs::report_script): Store backpointer to
7474 incremental info entry.
7475 (Output_section_incremental_inputs::set_final_data_size): Record
7476 additional information for scripts.
7477 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7478 * incremental.h (Incremental_script_entry::add_object): New function.
7479 (Incremental_script_entry::get_object_count): New function.
7480 (Incremental_script_entry::get_object): New function.
7481 (Incremental_script_entry::objects_): New data member; adjust
7482 constructor.
7483 (Incremental_inputs::report_archive_begin): Add script_info parameter.
7484 (Incremental_inputs::report_object): Add script_info parameter.
7485 (Incremental_inputs_reader::get_object_count): New function.
7486 (Incremental_inputs_reader::get_object_offset): New function.
7487 * options.cc (Input_arguments::add_file): Return reference to
7488 new input argument.
7489 * options.h (Input_argument::set_script_info): New function.
7490 (Input_argument::script_info): New function.
7491 (Input_argument::script_info_): New data member; adjust all
7492 constructors.
7493 (Input_file_group::add_file): Return reference to new input argument.
7494 (Input_file_lib::add_file): Likewise.
7495 (Input_arguments::add_file): Likewise.
7496 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7497 * script.cc (Parser_closure::Parser_closure): Add script_info
7498 parameter; adjust all callers.
7499 (Parser_closure::script_info): New function.
7500 (Parser_closure::script_info_): New data member.
7501 (read_input_script): Report scripts earlier to incremental info.
7502 (script_add_file): Set script_info in Input_argument.
7503 (script_add_library): Likewise.
7504 * script.h (Script_options::Script_info): Rewrite class.
7505
7506 2011-03-29 Cary Coutant <ccoutant@google.com>
7507
7508 * archive.cc (Library_base::should_include_member): Move
7509 method here from class Archive.
7510 (Archive::Archive): Initialize base class.
7511 (Archive::should_include_member): Move to base class.
7512 (Archive::do_for_all_unused_symbols): New function.
7513 (Add_archive_symbols::run): Remove redundant access to
7514 incremental_inputs.
7515 (Lib_group::Lib_group): Initialize base class.
7516 (Lib_group::do_filename): New function.
7517 (Lib_group::include_member): Pass pointer to Lib_group to
7518 report_object.
7519 (Lib_group::do_for_all_unused_symbols): New function.
7520 (Add_lib_group_symbols::run): Report archive information for
7521 incremental links.
7522 * archive.h (class Library_base): New base class.
7523 (class Archive): Derive from Library_base.
7524 (Archive::filename): Move to base class.
7525 (Archive::set_incremental_info): Likewise.
7526 (Archive::incremental_info): Likewise.
7527 (Archive::Should_include): Likewise.
7528 (Archive::should_include_member): Likewise.
7529 (Archive::Armap_entry): Remove.
7530 (Archive::Unused_symbol_iterator): Remove.
7531 (Archive::unused_symbols_begin): Remove.
7532 (Archive::unused_symbols_end): Remove.
7533 (Archive::do_filename): New function.
7534 (Archive::do_get_mtime): New function.
7535 (Archive::do_for_all_unused_symbols): New function.
7536 (Archive::task_): Move to base class.
7537 (Archive::incremental_info_): Likewise.
7538 (class Lib_group): Derive from Library_base.
7539 (Lib_group::do_filename): New function.
7540 (Lib_group::do_get_mtime): New function.
7541 (Lib_group::do_for_all_unused_symbols): New function.
7542 (Lib_group::task_): Move to base class.
7543 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7544 function.
7545 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7546 function.
7547 * incremental.cc (Incremental_inputs::report_archive_begin):
7548 Use Library_base; call library's get_mtime; add incremental inputs
7549 entry before members.
7550 (class Unused_symbol_visitor): New class.
7551 (Incremental_inputs::report_archive_end): Use Library_base; use
7552 visitor class to record unused symbols; don't add incremental inputs
7553 entry after members.
7554 (Incremental_inputs::report_object): Use Library_base.
7555 * incremental.h
7556 (Incremental_archive_entry::Incremental_archive_entry): Remove
7557 unused Archive parameter.
7558 (Incremental_inputs::report_archive_begin): Use Library_base.
7559 (Incremental_inputs::report_archive_end): Likewise.
7560 (Incremental_inputs::report_object): Likewise.
7561 * object.cc (Sized_relobj::do_for_all_global_symbols): New
7562 function.
7563 * object.h (Object::for_all_global_symbols): New function.
7564 (Object::do_for_all_global_symbols): New function.
7565 (Sized_relobj::do_for_all_global_symbols): New function.
7566 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
7567 function.
7568 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
7569 function.
7570
7571 2011-03-27 Ian Lance Taylor <iant@google.com>
7572
7573 * archive.cc (Archive::interpret_header): Return -1 if something
7574 goes wrong. Change callers accordingly.
7575
7576 2011-03-25 Cary Coutant <ccoutant@google.com>
7577
7578 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7579 * testsuite/Makefile.in: Regenerate.
7580
7581 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
7582
7583 * plugin.cc (get_view): New.
7584 (Plugin::load): Pass get_view to the plugin.
7585 (Plugin_manager::get_view): New.
7586
7587 2011-03-21 Ian Lance Taylor <iant@google.com>
7588
7589 * testsuite/final_layout.sh: Rewrite to not use dc.
7590 * testsuite/relro_test.sh: Fail if dc is not present.
7591
7592 2011-03-21 Sriraman Tallam <tmsriram@google.com>
7593
7594 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7595 Change == to -eq.
7596 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7597 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7598 Change == to -eq.
7599 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7600 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7601
7602 2011-03-14 Ian Lance Taylor <iant@google.com>
7603
7604 * script-sections.cc (Sort_output_sections::script_compare):
7605 Rename from is_before, change return type.
7606 (Sort_output_sections::operator()): Adjust accordingly.
7607
7608 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
7609
7610 PR gold/12572
7611 * testsuite/odr_violation2.cc: Add comment to make all error line
7612 numbers double digits.
7613 * testsuite/debug_msg.sh: Adjust expected errors.
7614
7615 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
7616
7617 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7618 but mark earlier ones as non-canonical
7619 (offset_to_iterator): Update search target and example
7620 (do_addr2line): Return extra lines in a vector*
7621 (format_file_lineno): Extract from do_addr2line
7622 (one_addr2line): Add vector* out-param
7623 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7624 when a lineno entry appeared last for its instruction
7625 (Dwarf_line_info): Add vector* out-param
7626 * object.cc (Relocate_info): Pass NULL for the vector* out-param
7627 * symtab.cc (Odr_violation_compare): Include the lineno in the
7628 comparison again.
7629 (linenos_from_loc): New. Combine the canonical line for an
7630 address with its other lines.
7631 (True_if_intersect): New. Helper functor to make
7632 std::set_intersection a query.
7633 (detect_odr_violations): Compare sets of lines instead of just
7634 one line for each function. This became less deterministic, but
7635 has fewer false positives.
7636 * symtab.h: Declarations.
7637 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7638 mix an optimized and non-optimized object in the same binary
7639 (odr_violation2.so): Same.
7640 * testsuite/Makefile.in: Regenerate from Makefile.am.
7641 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7642 * testsuite/debug_msg.sh: Update line numbers and add
7643 assertions.
7644 * testsuite/odr_violation1.cc: Use OdrDerived, in a
7645 non-optimized context.
7646 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7647 isn't inlined, and use OdrDerived in an optimized context.
7648 * testsuite/odr_header1.h: Defines OdrDerived, where
7649 optimization will change the
7650 first-instruction-in-the-destructor's file and line number.
7651 * testsuite/odr_header2.h: Defines OdrBase.
7652
7653 2011-03-09 Ian Lance Taylor <iant@google.com>
7654
7655 * fileread.cc (File_read::clear_views): Don't delete the whole
7656 file view.
7657
7658 2011-03-08 Ian Lance Taylor <iant@google.com>
7659
7660 PR gold/12525
7661 * fileread.cc: #include <climits>.
7662 (GOLD_IOV_MAX): Define.
7663 (File_read::read_multiple): Limit number of entries by iov_max.
7664 * fileread.h (class File_read): Always set max_readv_entries to
7665 128.
7666
7667 2011-03-07 Ian Lance Taylor <iant@google.com>
7668
7669 PR gold/12525
7670 * options.h (class General_options): Add -dy and -dn.
7671
7672 2011-03-02 Cary Coutant <ccoutant@google.com>
7673
7674 * testsuite/script_test_9.t: Add TLS segment.
7675
7676 2011-03-02 Simon Baldwin <simonb@google.com>
7677
7678 * configure.ac: Add check for gnu_indirect_function support in
7679 the toolchain building binutils.
7680 * configure: Rebuild.
7681
7682 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
7683
7684 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7685 plugin only symbols.
7686 (Symbol_table::sized_finalize_symbol) Mark symbol only present
7687 in plugin files as not needed in the symbol table.
7688
7689 2011-02-11 Sriraman Tallam <tmsriram@google.com>
7690
7691 * output.cc (Output_section::add_input_section): Delay fill
7692 generation for section ordering.
7693
7694 2011-02-09 Ian Lance Taylor <iant@google.com>
7695
7696 PR gold/12316
7697 * object.h (class Sized_relobj): Remove clear_local_symbols.
7698 * reloc.cc (Sized_relobj::do_relocate): Don't call
7699 clear_local_symbols.
7700
7701 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
7702
7703 * plugin.cc (is_visible_from_outside): Return true for symbols
7704 in the -u option.
7705
7706 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
7707
7708 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7709 filename.
7710
7711 2011-02-02 Sriraman Tallam <tmsriram@google.com>
7712
7713 * icf.h (is_section_foldable_candidate): Change type of parameter
7714 to std::string.
7715 * icf.cc (Icf::find_identical_sections): Change type of local variable
7716 section_name to be std::string.
7717 (is_function_ctor_or_dtor): Change type of parameter to std::string.
7718
7719 2011-01-25 Ian Lance Taylor <iant@google.com>
7720
7721 * script.cc (script_add_extern): Rewrite to use
7722 add_symbol_reference.
7723
7724 2011-01-25 Doug Kwan <dougkwan@google.com>
7725
7726 * icf.cc (get_section_contents): Always lock section's object.
7727
7728 2011-01-24 Ian Lance Taylor <iant@google.com>
7729
7730 * options.h (class General_options): Accept
7731 --no-detect-odr-violations.
7732
7733 2011-01-24 Ian Lance Taylor <iant@google.com>
7734
7735 * version.cc (version_string): Bump to 1.11.
7736
7737 2011-01-24 Ian Lance Taylor <iant@google.com>
7738
7739 * plugin.cc (class Plugin_rescan): Define new class.
7740 (Plugin_manager::claim_file): Set any_claimed_.
7741 (Plugin_manager::save_archive): New function.
7742 (Plugin_manager::save_input_group): New function.
7743 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7744 necessary.
7745 (Plugin_manager::new_undefined_symbol): New function.
7746 (Plugin_manager::rescan): New function.
7747 (Plugin_manager::rescannable_defines): New function.
7748 (Plugin_manager::add_input_file): Set any_added_.
7749 * plugin.h (class Plugin_manager): define new fields rescannable_,
7750 undefined_symbols_, any_claimed_, and any_added_. Declare
7751 Plugin_rescan as friend. Declare new functions.
7752 (Plugin_manager::Rescannable): Define type.
7753 (Plugin_manager::Rescannable_list): Define type.
7754 (Plugin_manager::Undefined_symbol_list): Define type.
7755 (Plugin_manager::Plugin_manager): Initialize new fields.
7756 * archive.cc (Archive::defines_symbol): New function.
7757 (Add_archive_symbols::run): Pass archive to plugins if any.
7758 * archive.h (class Archive): Declare defines_symbol.
7759 * readsyms.cc (Input_group::~Input_group): New function.
7760 (Finish_group::run): Pass input_group to plugins if any.
7761 * readsyms.h (class Input_group): Declare destructor.
7762 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7763 any.
7764
7765 2011-01-10 Ian Lance Taylor <iant@google.com>
7766
7767 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7768 section as relro.
7769 (Layout::set_segment_offsets): Reset increase_relro before calling
7770 set_section_addresses a second time.
7771
7772 2011-01-04 Cary Coutant <ccoutant@google.com>
7773
7774 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7775 sections before NOBITS sections.
7776
7777 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
7778
7779 * version.cc (print_version): Update copyright to 2011.
7780
7781 2010-12-23 Cary Coutant <ccoutant@google.com>
7782
7783 * output.h (Output_data_reloc::add_output_section): Pass OD instead
7784 of OS to this->add. Add OD parameter to second form of the function.
7785
7786 2010-12-20 Ian Lance Taylor <iant@google.com>
7787
7788 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7789 second of two consecutive entries with same offset.
7790
7791 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7792
7793 * testsuite/Makefile.am (ifuncmain2static_LDADD)
7794 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7795 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7796 to avoid unneeded links against $(LDADD).
7797 * testsuite/Makefile.in: Regenerate.
7798
7799 2010-12-15 Ian Lance Taylor <iant@google.com>
7800
7801 PR gold/12324
7802 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
7803 for R_X86_64_32 and R_X86_64_PC32.
7804 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
7805 ver_matching_def_pic.o.
7806 (ver_matching_def_pic.o): New target.
7807
7808 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7809
7810 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
7811 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
7812 Move definition before File_read::View member definitions.
7813 (File_read::View::~View): Initialize and hold lock before
7814 updating current_mapped_bytes.
7815
7816 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7817
7818 * dwarf_reader.cc: Remove outdated comment.
7819 * gold-threads.cc: Fix typo in error message.
7820 * archive.cc: Fix typos in comments.
7821 * archive.h: Likewise.
7822 * arm-reloc-property.cc: Likewise.
7823 * arm-reloc-property.h: Likewise.
7824 * arm-reloc.def: Likewise.
7825 * arm.cc: Likewise.
7826 * attributes.h: Likewise.
7827 * cref.cc: Likewise.
7828 * ehframe.cc: Likewise.
7829 * fileread.h: Likewise.
7830 * gold.h: Likewise.
7831 * i386.cc: Likewise.
7832 * icf.cc: Likewise.
7833 * incremental.h: Likewise.
7834 * int_encoding.cc: Likewise.
7835 * layout.h: Likewise.
7836 * main.cc: Likewise.
7837 * merge.h: Likewise.
7838 * object.cc: Likewise.
7839 * object.h: Likewise.
7840 * options.cc: Likewise.
7841 * readsyms.cc: Likewise.
7842 * reduced_debug_output.cc: Likewise.
7843 * reloc.cc: Likewise.
7844 * script-sections.cc: Likewise.
7845 * sparc.cc: Likewise.
7846 * symtab.h: Likewise.
7847 * target-reloc.h: Likewise.
7848 * target.cc: Likewise.
7849 * target.h: Likewise.
7850 * timer.cc: Likewise.
7851 * timer.h: Likewise.
7852 * x86_64.cc: Likewise.
7853
7854 2010-12-09 Cary Coutant <ccoutant@google.com>
7855
7856 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
7857 stack.
7858 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
7859 parameter; change all callers.
7860 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
7861 * options.h (warn_execstack): New option.
7862
7863 2010-12-07 Doug Kwan <dougkwan@google.com>
7864
7865 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
7866 like function call relocations.
7867
7868 2010-12-07 Ian Lance Taylor <iant@google.com>
7869
7870 * archive.cc (Archive::get_elf_object_for_member): Permit
7871 punconfigured to be NULL.
7872 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
7873 (Archive::include_member): Pass NULL to get_elf_object_for_member
7874 if we searched for the archive and this is the first included
7875 object.
7876
7877 2010-12-01 Ian Lance Taylor <iant@google.com>
7878
7879 * dwarf_reader.h (class Sized_dwarf_line_info): Add
7880 track_relocs_type_ field.
7881 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7882 Set track_relocs_type_.
7883 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
7884 contents when using RELA relocs.
7885 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
7886 reloc_map_.
7887 * reloc.cc (Track_relocs::next_addend): New function.
7888 * reloc.h (class Track_relocs): Declare next_addend.
7889
7890 2010-12-01 Ian Lance Taylor <iant@google.com>
7891
7892 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
7893 virtual destructor.
7894
7895 2010-12-01 Ian Lance Taylor <iant@google.com>
7896
7897 * README: Update compilers known to work and fail.
7898
7899 2010-11-23 Matthias Klose <doko@ubuntu.com>
7900
7901 * configure.in: For --enable-gold, handle value `default' instead of
7902 `both*'. Always install ld as ld.bfd, install as ld if gold is
7903 not the default.
7904 * configure: Regenerate.
7905
7906 2010-11-18 Doug Kwan <dougkwan@google.com>
7907
7908 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
7909 and right_alignment to be zero. Store result alignment only if it is
7910 greater than existing alignment.
7911
7912 2010-11-16 Cary Coutant <ccoutant@google.com>
7913
7914 PR gold/12220
7915 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7916 Check for ".zdebug_line".
7917
7918 2010-11-16 Doug Kwan <dougkwan@google.com>
7919 Cary Coutant <ccoutant@google.com>
7920
7921 * output.h (Output_segment::set_section_addresses): Pass increase_relro
7922 by reference; adjust all callers.
7923 * output.cc (Output_segment::set_section_addresses): Adjust references
7924 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
7925 list is empty.
7926 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
7927 end at page boundary.
7928
7929 2010-11-16 Cary Coutant <ccoutant@google.com>
7930
7931 PR gold/12220
7932 * layout.cc (Layout::choose_output_section): Transform names of
7933 compressed sections even when using a script with a SECTIONS clause.
7934 (Layout::output_section_name): Remove code to transform
7935 compressed debug section names.
7936 * output.cc (Output_section::add_input_section): Use uncompressed
7937 section size when tracking input sections.
7938
7939 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
7940
7941 * symtab.h (Symbol::NON_PIC_REF): Remove.
7942 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
7943 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
7944 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
7945 (Symbol::use_plt_offset): Take a flags argument and pass it
7946 directly to needs_dynamic_reloc. Restrict check for undefined
7947 weak symbols to function calls.
7948 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
7949 (Target_arm::Scan::global): Use it.
7950 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
7951 (Target_arm::Relocate::relocate): Likewise.
7952 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
7953 parameter with an r_type parameter. Use get_reference_flags
7954 to get the flags.
7955 (Target_arm::Relocate::relocate): Update accordingly.
7956 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
7957 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
7958 (Target_i386::Scan::global): Likewise.
7959 (Target_i386::Relocate::relocate): Likewise.
7960 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
7961 parameter with an r_type parameter. Use get_reference_flags
7962 to get the flags.
7963 (Target_i386::Relocate::relocate): Update accordingly.
7964 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
7965 (Target_powerpc::Scan::global): Use it.
7966 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
7967 (Target_powerpc::Relocate::relocate): Likewise.
7968 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
7969 (Target_sparc::Scan::global): Use it.
7970 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
7971 (Target_sparc::Relocate::relocate): Likewise.
7972 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7973 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7974 (Target_x86_64::Scan::global): Likewise.
7975 (Target_x86_64::Relocate::relocate): Likewise.
7976
7977 2010-11-08 Doug Kwan <dougkwan@google.com>
7978 Cary Coutant <ccoutant@google.com>
7979
7980 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7981 (Arm_exidx_merge_section::section_contents_): New data member.
7982 (Arm_input_section::Arm_input_section): Initialize original_contents_.
7983 (Arm_input_section::~Arm_input_section): De-allocate memory.
7984 (Arm_input_section::original_contents_): New data member.
7985 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7986 in parameters instead of calling Object::section_contents without
7987 locking.
7988 (Arm_output_section::group_section): New parameter TASK. Pass it
7989 to callees that need locking objects.
7990 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
7991 to lock EXIDX input sections. Fix a formatting issue. Call
7992 Arm_exidx_merged_section::build_contents to create merged section
7993 contents.
7994 (Arm_output_section::create_stub_group): New parameter TASK. Use it
7995 to lock object of stub table owner.
7996 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7997 TEXT_SIZE to initialize data member TEXT_SIZE_.
7998 (Arm_exidx_input_section::addralign): Fix typo in comment.
7999 (Arm_exidx_input_section::text_size): New method.
8000 (Target_arm::do_relax): New parameter TASK. Pass it to callees
8001 that require locking objects. Lock objects before scanning for stubs
8002 and updating local symbols.
8003 (Arm_input_section<big_endian>::init): Copy contents of original
8004 input section.
8005 (Arm_input_section<big_endian>::do_write): Use saved contents of
8006 original input section instead of calling Object::section_contents
8007 without locking.
8008 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8009 size without calling Object::section_size().
8010 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8011 for size. Allocate a buffer for merged EXIDX entries.
8012 (Arm_exidx_merged_section::build_contents): New method.
8013 (Arm_exidx_merged_section::do_write): Move merge section contents
8014 building code to Arm_exidx_merged_section::build_contetns. Write
8015 out contetns in buffer instead of building it on the fly.
8016 (Arm_relobj::make_exidx_input_section): Also pass text section size
8017 to Arm_exidx_input_section constructor.
8018 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
8019 (Arm_dynobj::do_read_symbols): Fix memory leak.
8020 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8021 * target.h: (class Task): Add forward declaration.
8022 (Target::relax): Add new parameter TASK and pass it to
8023 Target::do_relax().
8024 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
8025
8026 2010-11-05 Cary Coutant <ccoutant@google.com>
8027
8028 PR gold/10708
8029 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8030 object when reading from the file.
8031 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8032 second layout pass.
8033 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8034 when reading section contents.
8035 (get_section_contents): Likewise.
8036 (icf::find_identical_sections): Likewise.
8037 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8038 object when reading from the file.
8039 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8040 the object when doing deferred section layout.
8041
8042 2010-11-03 Nick Clifton <nickc@redhat.com>
8043
8044 PR gold/12001
8045 * script.h (class Symbol_assignment: name): New member. Returns
8046 the name of the symbol.
8047 * scrfipt.cc (Script_options::is_pending_assignment): New member.
8048 Returns true if the given symbol name is on the list of
8049 assignments wating to be processed.
8050 * archive.cc (should_incldue_member): If the symbol is undefined,
8051 check to see if it is on the list of symbols pending assignment.
8052
8053 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
8054
8055 * script-sections.cc (Script_sections::find_memory_region): Check
8056 for a NULL output section pointer.
8057
8058 2010-10-29 Doug Kwan <dougkwan@google.com>
8059
8060 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8061 Output_section::add_relaxed_input_section.
8062 * output.cc (Output_section::add_relaxed_input_section): Add new
8063 arguments LAYOUT and NAME. Set section order index.
8064 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8065 Copy section order index.
8066 * output.h (Output_section::add_relaxed_input_section): Add new
8067 arguments LAYOUT and NAME.
8068
8069 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8070
8071 * testsuite/Makefile.am: Move gcctestdir/ld rule to
8072 NATIVE_OR_CROSS_LINKER.
8073 * testsuite/Makefile.in: Regenerate.
8074
8075 2010-10-20 Doug Kwan <dougkwan@google.com>
8076
8077 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8078 without SHF_LINK_ORDER flags.
8079 * layout.cc (Layout::choose_output_section): Do not filter
8080 SHF_LINK_ORDER flag in a relocatable link.
8081
8082 2010-10-17 Cary Coutant <ccoutant@google.com>
8083
8084 * output.h (Output_segment::set_section_addresses): Change function
8085 signature. Update all callers.
8086 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8087 sections.
8088 (Output_segment::set_section_addresses): Align after last TLS
8089 section. Add padding before last relro section instead of after.
8090
8091 2010-10-17 Doug Kwan <dougkwan@google.com>
8092
8093 * gold/arm.cc (Target_arm::got_section): Use correct order and set
8094 GOT output section to be writable.
8095
8096 2010-10-14 Cary Coutant <ccoutant@google.com>
8097
8098 * debug.h (DEBUG_INCREMENTAL): New flag.
8099 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8100 * gold.cc (queue_initial_tasks): Check parameters for incremental link
8101 mode.
8102 * incremental.cc (report_command_line): Ignore all forms of
8103 --incremental.
8104 * layout.cc (Layout::Layout): Check parameters for incremental link
8105 mode.
8106 * options.cc (General_options::parse_incremental): New function.
8107 (General_options::parse_no_incremental): New function.
8108 (General_options::parse_incremental_full): New function.
8109 (General_options::parse_incremental_update): New function.
8110 (General_options::incremental_mode_): New data member.
8111 (General_options::finalize): Check incremental_mode_.
8112 * options.h (General_options): Update help text for --incremental.
8113 Add --no-incremental, --incremental-full, --incremental-update.
8114 (General_options::Incremental_mode): New enum type.
8115 (General_options::incremental_mode): New function.
8116 (General_options::incremental_mode_): New data member.
8117 * parameters.cc (Parameters::incremental_mode_): New data member.
8118 (Parameters::set_options): Set incremental_mode_.
8119 (Parameters::set_incremental_full): New function.
8120 (Parameters::incremental): New function.
8121 (Parameters::incremental_update): New function.
8122 (set_parameters_incremental_full): New function.
8123 * parameters.h (Parameters::set_incremental_full): New function.
8124 (Parameters::incremental): New function.
8125 (Parameters::incremental_update): New function.
8126 (Parameters::incremental_mode_): New data member.
8127 (set_parameters_incremental_full): New function.
8128 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8129 incremental link mode.
8130 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8131 (Sized_relobj::do_relocate_sections): Likewise.
8132 * testsuite/Makefile.am (incremental_test): Use --incremental-full
8133 option.
8134 * testsuite/Makefile.in: Regenerate.
8135 * testsuite/incremental_test.sh: Filter all forms of --incremental.
8136
8137 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8138
8139 * script-sections.h (class Script_sections): Make
8140 Sections_elements typedef public.
8141 * script-sections.cc (class Sort_output_sections): Add elements_
8142 field. Add constructor which sets it; change all callers.
8143 (Sort_output_sections::is_before): New function.
8144 (Sort_output_sections::operator()): Call is_before.
8145 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8146 conditional.
8147 * testsuite/script_test_10.sh: New test. Test script section
8148 order.
8149 * testsuite/script_test_10.t: Likewise.
8150 * testsuite/script_test_10.s: Likewise.
8151 * testsuite/Makefile.am: Wrap the cross linker tests and the
8152 common tests into NATIVE_OR_CROSS_LINKER.
8153 (check_SCRIPTS): Add script_test_10.sh.
8154 (check_DATA): Add script_test_10.stdout.
8155 (script_test_10.o, script_test_10): New targets.
8156 (script_test_10.stdout): New target.
8157 * configure, testsuite/Makefile.in: Regenerate.
8158
8159 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8160
8161 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8162 error for the deprecated relocations.
8163 (Target_arm::Scan::global): Likewise.
8164 (Target_arm::Relocate::relocate): Likewise.
8165
8166 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
8167
8168 * fileread.cc (Input_file::find_file): Initialize *found_name
8169 and *namep when using the fallback search for case 4.
8170
8171 2010-10-11 Cary Coutant <ccoutant@google.com>
8172
8173 * options.h (class General_options): Redefine -z lazy as an alias for
8174 the negation of -z now.
8175
8176 2010-10-11 Ian Lance Taylor <iant@google.com>
8177
8178 * resolve.cc (symbol_to_bits): Report the value of the unsupported
8179 binding.
8180
8181 2010-10-06 Nick Clifton <nickc@redhat.com>
8182
8183 * script-sections.cc(class Memory_region): Remove
8184 current_lma_offset_ field. Rename current_vma_offset_ to
8185 current_offset_. Add last_section_ field.
8186 (Memory_region::get_current_vma_address): Rename to
8187 get_current_address.
8188 (Memory_region::get_current_lma_address): Delete.
8189 (Memory_region::increment_vma_offset): Rename to
8190 increment_offset.
8191 (Memory_region::increment_lma_offset): Delete.
8192 (Memory_region::attributes_compatible): New method. Returns
8193 true if the provided section is compatible with the region.
8194 (Memory_region::get_last_section): New method. Returns the last
8195 section to use the region.
8196 (Memory_region::set_last_section): New method. Stores the last
8197 section to use the region.
8198 (Script_sections::block_in_region): New method. Returns true if
8199 a block of memory is contained within a region.
8200 (Script_sections::find_memory_region): New method. Locates a
8201 memory region to be used to set a VMA or LMA address.
8202 (Output_section_definition::set_section_addresses): Add code to
8203 check for addresses set by memory regions.
8204 (Output_segment::set_section_addresses): Remove memory region
8205 walking code.
8206 (Script_sections::create_segment): Add a warning if a header
8207 segment is created outside of any region.
8208 * script-sections.h (class Script_sections): Add prototypes for
8209 find_memory_region and block_in_region methods.
8210 * testsuite/memory_test.s: Use .long instead of .word.
8211 * testsuite/memory_test.t: Add some more output sections.
8212 * testsuite/memory_test.sh: Update expected output.
8213
8214 2010-10-02 Doug Kwan <dougkwan@google.com>
8215
8216 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8217 defintion to symtab.h
8218 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8219 declaration to defintion.
8220
8221 2010-10-01 Nick Clifton <nickc@redhat.com>
8222
8223 * expression.cc (eval): Replace dummy argument with NULL.
8224 (eval_maybe_dot): Check for a NULL result section pointer.
8225 (Symbol_expression::value): Likewise.
8226 (Dot_expression::value): Likewise.
8227 (BINARY_EXPRESSION): Likewise.
8228 (Max_expression::value): Likewise.
8229 (Min_expression::value): Likewise.
8230 (Absolute_expression::value): Likewise.
8231 (Addr_expression::value_from_output_section): Likewise.
8232 (Loaddddr_expression::value_from_output_section): Likewise.
8233 (Segment_start_expression::value): Likewise.
8234 * script-sections.cc
8235 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8236 argument with NULL.
8237 (Sections_elememt_dot_assignment::set_section_addresses):
8238 Likewise.
8239 (Output_data_expression::do_write_to_buffer): Likewise.
8240 (Output_section_definition::finalize_symbols): Likewise.
8241 (Output_section_definition::set_section_addresses): Likewise.
8242
8243 2010-09-30 Doug Kwan <dougkwan@google.com>
8244
8245 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8246
8247 2010-09-28 Sriraman Tallam <tmsriram@google.com>
8248
8249 * target.h (Target::can_icf_inline_merge_sections): New virtual
8250 function.
8251 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8252 virtual function.
8253 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8254 virtual function.
8255 * icf.cc (get_section_contents): Inline merge sections only when
8256 target allows it.
8257
8258 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8259
8260 * configure: Regenerate.
8261
8262 2010-09-17 Ian Lance Taylor <iant@google.com>
8263
8264 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8265 * testsuite/Makefile.am (memory_test.o): New target.
8266 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8267 memory_test.t.
8268 * testsuite/Makefile.in: Rebuild.
8269
8270 2010-09-17 Doug Kwan <dougkwan@google.com>
8271
8272 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8273 defintion if relocation uses GOT entries of the symbol.
8274 * testsuite/icf_safe_test.sh: Fix test.
8275 * testsuite/icf_safe_so_test.sh: Fix test.
8276
8277 2010-09-16 Cary Coutant <ccoutant@google.com>
8278
8279 * script_sections.cc (class Memory_region): Remove "NULL" from
8280 vector initializations.
8281
8282 2010-09-15 Cary Coutant <ccoutant@google.com>
8283
8284 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8285 Resolve forwarding symbols.
8286
8287 2010-09-15 Doug Kwan <dougkwan@google.com>
8288
8289 * gold/testsuite/script_test_3.t: Add ARM special sections.
8290 * gold/testsuite/script_test_4.t: Same.
8291 * gold/testsuite/script_test_5.t: Same.
8292 * gold/testsuite/script_test_6.t: Same.
8293 * gold/testsuite/script_test_7.t: Same.
8294 * gold/testsuite/script_test_7.t: Same.
8295 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8296
8297 2010-09-14 Cary Coutant <ccoutant@google.com>
8298
8299 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8300 (Target_x86_64::Relocate::relocate_tls): Replace check for
8301 saw_tls_block_reloc_ with test for executable section.
8302
8303 2010-09-12 Cary Coutant <ccoutant@google.com>
8304
8305 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8306 position-independent executables to shared libraries need dynamic
8307 relocations.
8308 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8309 position-independent executables.
8310 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8311 * testsuite/Makefile.in: Regenerate.
8312
8313 2010-09-10 Nick Clifton <nickc@redhat.com>
8314
8315 PR gold/11997
8316 * testsuite/memory_test.t: Discard any sections that are not
8317 needed.
8318
8319 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
8320
8321 PR gold/11996
8322 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8323 "This::" to work around a bug in gcc 4.2.
8324
8325 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8326
8327 2010-09-09 Rafael Espindola <espindola@google.com>
8328
8329 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8330 sections with different PF_X flags in the same segment.
8331 (Layout::find_first_load_seg): Search all segments to find the first
8332 one.
8333 * options.h (rosegment): New.
8334
8335 2010-09-08 Rafael Espindola <espindola@google.com>
8336
8337 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8338
8339 2010-09-08 Doug Kwan <dougkwan@google.com>
8340
8341 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8342 (Arm_relobj::do_relocate_sections): Add new parameter for output
8343 file to match the parent.
8344 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8345 of local symbols instead of input values. Update code to track
8346 changes in gold::relocate_section.
8347 * object.cc (Sized_relobj::compute_final_local_value): New methods.
8348 (Sized_relobj::compute_final_local_value_internal): New methods.
8349 (Sized_relobj::do_finalize_local_symbols): Move code from loop
8350 body into private version of Sized_relobj::compute_final_local_value.
8351 Call the inline method.
8352 * object.h (Symbol_value::Symbol_value): Define destructor. Free
8353 merged symbol value if there is one.
8354 (Symbol_value::has_output_value): New method defintiion.
8355 (Sized_relobj::Compute_final_local_value_status): New enum type.
8356 (Sized_relobj::compute_final_local_value): New methods.
8357 (Sized_relobj::compute_final_local_value_internal): New methods.
8358 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8359 and arm_cortex_a8.sh.
8360 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8361 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8362 New tests.
8363 * Makefile.in: Regenerate.
8364 * testsuite/arm_bl_out_of_range.s: Update test.
8365 * testsuite/thumb_bl_out_of_range.s: Ditto.
8366 * testsuite/thumb_blx_out_of_range.s: Ditto.
8367 * testsuite/arm_branch_out_of_range.sh: New file.
8368 * testsuite/arm_cortex_a8.sh: Ditto.
8369 * testsuite/arm_cortex_a8_b.s: Ditto.
8370 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8371 * testsuite/arm_cortex_a8_b_local.s: Ditto.
8372 * testsuite/arm_cortex_a8_bl.s: Ditto.
8373 * testsuite/arm_cortex_a8_blx.s: Ditto.
8374 * testsuite/arm_cortex_a8_local.s: Ditto.
8375 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8376 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8377
8378 2010-09-08 Rafael Espindola <espindola@google.com>
8379
8380 * Makefile.am (memory_test.stdout): Run readelf with -W.
8381 * Makefile.in: Regenerate.
8382 * testsuite/memory_test.sh: Make the regexps accept both 32 and
8383 64 bit output.
8384
8385 2010-09-08 Rafael Espindola <espindola@google.com>
8386
8387 * script-sections.cc (Script_sections::add_memory_region): Convert
8388 field precision to int.
8389 * script.cc (script_set_section_region, script_set_section_region):
8390 Convert field precision to int.
8391
8392 2010-09-08 Rafael Espindola <espindola@google.com>
8393
8394 * arm.cc (do_finalize_sections): Create the __exidx_start and
8395 __exdix_end symbols even when the section is missing.
8396
8397 2010-09-08 Nick Clifton <nickc@redhat.com>
8398
8399 * README: Remove claim that MEMORY is not supported.
8400 * expression.cc (script_exp_function_origin)
8401 (script_exp_function_length): Move from here to ...
8402 * script.cc: ... here.
8403 (script_set_section_region, script_add_memory)
8404 (script_parse_memory_attr, script_include_directive): New
8405 functions.
8406 * script-sections.cc
8407 (class Memory_region): New class.
8408 (class Output_section_definition): Add set_memory_region,
8409 set_section_vma, set_section_lma and get_section_name methods.
8410 (class Script_Sections): Add add_memory_region,
8411 find_memory_region, find_memory_region_origin,
8412 find_memory_region_length and set_memory_region methods.
8413 Have set_section_addresses method walk the list of set memory
8414 regions.
8415 Extend the print methos to display memory regions.
8416 * script-sections.h: Add prototypes for new methods.
8417 Add enum for MEMORY region attributes.
8418 * yyscript.y: Add support for parsing MEMORY regions.
8419 * script-c.h: Add prototypes for new functions.
8420 * testsuite/Makefile.am: Add test of MEMORY region functionality.
8421 * testsuite/Makefile.in: Regenerate.
8422 * testsuite/memory_test.sh: New script.
8423 * testsuite/memory_test.s: New assembler source file.
8424 * testsuite/memory_test.t: New linker script.
8425
8426 2010-08-27 Doug Kwan <dougkwan@google.com>
8427
8428 * gold/resolve.cc (Symbol_table::should_override): Let a weak
8429 reference override an existing dynamic weak reference.
8430 * testsuite/Makefile.am: Add new test dyn_weak_ref.
8431 * testsuite/Makefile.in: Regenerate.
8432 * testsuite/dyn_weak_ref.sh: New file.
8433 * testsuite/dyn_weak_ref_1.c: Ditto.
8434 * testsuite/dyn_weak_ref_2.c: Ditto.
8435
8436 2010-08-27 Ian Lance Taylor <iant@google.com>
8437
8438 * incremental.h (class Incremental_input_entry): Add virtual
8439 destructor.
8440
8441 2010-08-27 Ian Lance Taylor <iant@google.com>
8442
8443 * testsuite/start_lib_test_3.c: Mark t3 as used.
8444
8445 2010-08-27 Nick Clifton <nickc@redhat.com>
8446
8447 * options.cc (version_script): Fix small typo in previous
8448 whitespace tidyup.
8449
8450 2010-08-25 Nick Clifton <nickc@redhat.com>
8451
8452 * archive.cc: Formatting fixes: Remove whitespace between
8453 typename and following asterisk. Remove whitespace between
8454 function name and opening parenthesis.
8455 * archive.h: Likewise.
8456 * arm.cc: Likewise.
8457 * attributes.cc: Likewise.
8458 * attributes.h: Likewise.
8459 * common.cc: Likewise.
8460 * copy-relocs.cc: Likewise.
8461 * dirsearch.h: Likewise.
8462 * dynobj.cc: Likewise.
8463 * ehframe.cc: Likewise.
8464 * ehframe.h: Likewise.
8465 * expression.cc: Likewise.
8466 * fileread.cc: Likewise.
8467 * fileread.h: Likewise.
8468 * gc.h: Likewise.
8469 * gold-threads.cc: Likewise.
8470 * gold.cc: Likewise.
8471 * i386.cc: Likewise.
8472 * icf.h: Likewise.
8473 * incremental-dump.cc: Likewise.
8474 * incremental.cc: Likewise.
8475 * layout.cc: Likewise.
8476 * layout.h: Likewise.
8477 * main.cc: Likewise.
8478 * merge.cc: Likewise.
8479 * merge.h: Likewise.
8480 * object.cc: Likewise.
8481 * object.h: Likewise.
8482 * options.cc: Likewise.
8483 * options.h: Likewise.
8484 * output.cc: Likewise.
8485 * output.h: Likewise.
8486 * plugin.cc: Likewise.
8487 * plugin.h: Likewise.
8488 * powerpc.cc: Likewise.
8489 * reloc.cc: Likewise.
8490 * script-c.h: Likewise.
8491 * script-sections.cc: Likewise.
8492 * script.cc: Likewise.
8493 * stringpool.cc: Likewise.
8494 * symtab.cc: Likewise.
8495 * symtab.h: Likewise.
8496 * target.cc: Likewise.
8497 * timer.cc: Likewise.
8498 * timer.h: Likewise.
8499 * version.cc: Likewise.
8500 * x86_64.cc: Likewise.
8501
8502 2010-08-24 Nick Clifton <nickc@redhat.com>
8503
8504 PR 11899
8505 * layout.cc (segment_precedes): Sort segments by their physical
8506 addresses, if they have been set.
8507
8508 2010-08-23 Cary Coutant <ccoutant@google.com>
8509
8510 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8511 symbols data.
8512 (Lib_group::include_member): Unlock object after deleting its
8513 symbols data.
8514 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8515 the bug fixed here.
8516
8517 2010-08-19 Neil Vachharajani <nvachhar@google.com>
8518 Cary Coutant <ccoutant@google.com>
8519
8520 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8521 constructor, and set_blocker.
8522 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8523 readsyms_blocker_.
8524 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8525 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8526 * testsuite/Makefile.am (start_lib_test): New test case.
8527 * testsuite/Makefile.in: Regenerate.
8528 * testsuite/start_lib_test_main.c: New file.
8529 * testsuite/start_lib_test_1.c: New file.
8530 * testsuite/start_lib_test_2.c: New file.
8531 * testsuite/start_lib_test_3.c: New file.
8532
8533 2010-08-19 Ian Lance Taylor <iant@google.com>
8534
8535 * Makefile.in: Rebuild with automake 1.11.1.
8536 * aclocal.m4: Likewise.
8537 * testsuite/Makefile.in: Likewise.
8538
8539 2010-08-19 Ian Lance Taylor <iant@google.com>
8540
8541 PR 10893
8542 * i386.cc (class Output_data_plt_i386): Update declarations.
8543 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
8544 local_ifuncs_ fields.
8545 (Target_i386::do_plt_section_for_global): New function.
8546 (Target_i386::do_plt_section_for_local): New function.
8547 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8548 parameter; change all callers. Initialize global_ifuncs_ and
8549 local_ifuncs_. If doing a static link define __rel_iplt_start and
8550 __rel_iplt_end.
8551 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8552 (Output_data_plt_i386::add_local_ifunc_entry): New function.
8553 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8554 symbols.
8555 (Target_i386::make_plt_section): New function, broken out of
8556 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
8557 (Target_i386::make_plt_entry): Call make_plt_section.
8558 (Target_i386::make_local_ifunc_plt_entry): New function.
8559 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8560 (Target_i386::Scan::local): Handle IFUNC symbols. Add
8561 R_386_IRELATIVE to switch.
8562 (Target_i386::Scan::global): Likewise.
8563 (Target_i386::Relocate::relocate): Likewise.
8564 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8565 switch.
8566 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8567 (Target_x86_64::do_plt_section_for_global): New function.
8568 (Target_x86_64::do_plt_section_for_local): New function.
8569 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8570 parameter; change all callers. If doing a static link define
8571 __rela_iplt_start and __rela_iplt_end.
8572 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8573 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8574 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8575 to point to .plt.
8576 (Target_x86_64::make_local_ifunc_plt_entry): New function.
8577 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8578 switch.
8579 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8580 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
8581 R_X86_64_IRELATIVE to switch.
8582 (Target_x86_64::Scan::global): Likewise.
8583 (Target_x86_64::Relocate::relocate): Likewise.
8584 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8585 switch.
8586 * target.h (class Target): Add plt_section_for_global and
8587 plt_section_for_local functions. Add do_plt_section_for_global
8588 and do_plt_section_for_local virtual functions.
8589 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
8590 clarifying comments.
8591 (Symbol::use_plt_offset): Handle IFUNC symbol.
8592 * object.cc (Sized_relobj::Sized_relobj): Initialize
8593 local_plt_offsets_.
8594 (Sized_relobj::local_has_plt_offset): New function.
8595 (Sized_relobj::local_plt_offset): New function.
8596 (Sized_relobj::set_local_plt_offset): New function.
8597 (Sized_relobj::do_count): Handle IFUNC symbol.
8598 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
8599 a bit away from input_shndx_ field. Add set_is_func_symbol and
8600 is_ifunc_symbol functions.
8601 (class Sized_relobj): Update declarations. Remove Tls_got_entry
8602 and Local_tls_got_offsets. Define Local_plt_offsets. Add
8603 local_plt_offsets_ field.
8604 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8605 * output.h (class Output_section_data): Add non-const
8606 output_section function.
8607 (class Output_data_got): Update declarations.
8608 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8609 Add use_plt_offset parameter to global and local constructors.
8610 Change all callers. Change local_sym_index_ field to 31 bits.
8611 Change GSYM_CODE and CONSTANT_CODE accordingly.
8612 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8613 doing a static link don't set sh_link field.
8614 (Output_data_got::Got_entry::write): Use PLT offset if
8615 appropriate.
8616 (Output_data_got::add_global_plt): New function.
8617 (Output_data_got::add_local_plt): New function.
8618 * target-reloc.h (relocate_section): Handle IFUNC symbol.
8619 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8620 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8621 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8622 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8623 IFUNC conditional.
8624 * testsuite/ifunc-sel.h: New file.
8625 * testsuite/ifuncmain1.c: New file.
8626 * testsuite/ifuncmain1vis.c: New file.
8627 * testsuite/ifuncmod1.c: New file.
8628 * testsuite/ifuncdep2.c: New file.
8629 * testsuite/ifuncmain2.c: New file.
8630 * testsuite/ifuncmain3.c: New file.
8631 * testsuite/ifuncmod3.c: New file.
8632 * testsuite/ifuncmain4.c: New file.
8633 * testsuite/ifuncmain5.c: New file.
8634 * testsuite/ifuncmod5.c: New file.
8635 * testsuite/ifuncmain6pie.c: New file.
8636 * testsuite/ifuncmod6.c: New file.
8637 * testsuite/ifuncmain7.c: New file.
8638 * configure, testsuite/Makefile.in: Rebuild.
8639
8640 2010-08-18 Ian Lance Taylor <iant@google.com>
8641
8642 * incremental.cc
8643 (Output_section_incremental_inputs::write_input_files): Add cast
8644 to avoid signed/unsigned comparison warning.
8645 (Output_section_incremental_inputs::write_info_blocks): Likewise.
8646
8647 2010-08-12 Cary Coutant <ccoutant@google.com>
8648
8649 * common.cc (Sort_commons::operator()): Remove unnecessary code.
8650
8651 2010-08-13 Ian Lance Taylor <iant@google.com>
8652
8653 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8654
8655 2010-08-12 Cary Coutant <ccoutant@google.com>
8656 Doug Kwan <dougkwan@google.com>
8657
8658 * resolve.cc (Symbol_table::should_override): When a weak dynamic
8659 defintion overrides non-weak undef, remember that the original undef
8660 is not weak.
8661 * symtab.cc (Symbol_table::sized_write_global): For undef without
8662 an original weak binding, set binding to global in output.
8663 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8664 * testsuite/Makefile.in: Regenerate.
8665 * testsuite/strong_ref_weak_def.sh: New file.
8666 * testsuite/strong_ref_weak_def_1.c: Ditto.
8667 * testsuite/strong_ref_weak_def_2.c: Ditto.
8668
8669 2010-08-12 Cary Coutant <ccoutant@google.com>
8670
8671 * testsuite/incremental_test.sh: Rewrite.
8672 * testsuite/incremental_test_1.c: Rewrite.
8673 * testsuite/incremental_test_2.c: Rewrite.
8674
8675 2010-08-12 Cary Coutant <ccoutant@google.com>
8676
8677 * arm.cc (Target_arm::got_size): Add const.
8678 (Target_arm::got_entry_count): New function.
8679 (Target_arm::plt_entry_count): New function.
8680 (Target_arm::first_plt_entry_offset): New function.
8681 (Target_arm::plt_entry_size): New function.
8682 (Output_data_plt_arm::entry_count): New function.
8683 (Output_data_plt_arm::first_plt_entry_offset): New function.
8684 (Output_data_plt_arm::get_plt_entry_size): New function.
8685 * i386.cc (Target_i386::got_size): Add const.
8686 (Target_i386::got_entry_count): New function.
8687 (Target_i386::plt_entry_count): New function.
8688 (Target_i386::first_plt_entry_offset): New function.
8689 (Target_i386::plt_entry_size): New function.
8690 (Output_data_plt_i386::entry_count): New function.
8691 (Output_data_plt_i386::first_plt_entry_offset): New function.
8692 (Output_data_plt_i386::get_plt_entry_size): New function.
8693 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8694 find_incremental_inputs_sections. Dump incremental_got_plt section.
8695 * incremental.cc: Include target.h.
8696 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8697 parameter. Adjust all callers. Find incremental_got_plt section.
8698 (Incremental_inputs::create_data_sections): Create incremental_got_plt
8699 section.
8700 (Output_section_incremental_inputs::set_final_data_size): Calculate
8701 size of incremental_got_plt section.
8702 (Output_section_incremental_inputs::do_write): Write the
8703 incremental_got_plt section.
8704 (Got_plt_view_info): New struct.
8705 (Local_got_offset_visitor): New class.
8706 (Global_got_offset_visitor): New class.
8707 (Global_symbol_visitor_got_plt): New class.
8708 (Output_section_incremental_inputs::write_got_plt): New function.
8709 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8710 Add parameter. Adjust all callers.
8711 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8712 (Incremental_inputs::got_plt_section): New function.
8713 (Incremental_inputs::got_plt_section_): New data member.
8714 (Incremental_got_plt_reader): New class.
8715 * layout.cc (Layout::create_incremental_info_sections): Add the
8716 incremental_got_plt section.
8717 * object.h (Got_offset_list::get_list): New function.
8718 (Got offset_list::for_all_got_offsets): New function.
8719 (Sized_relobj::local_got_offset_list): New function.
8720 * powerpc.cc (Target_powerpc::got_size): Add const.
8721 (Target_powerpc::got_entry_count): New function.
8722 (Target_powerpc::plt_entry_count): New function.
8723 (Target_powerpc::first_plt_entry_offset): New function.
8724 (Target_powerpc::plt_entry_size): New function.
8725 (Output_data_plt_powerpc::entry_count): New function.
8726 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8727 (Output_data_plt_powerpc::get_plt_entry_size): New function.
8728 * sparc.cc (Target_sparc::got_size): Add const.
8729 (Target_sparc::got_entry_count): New function.
8730 (Target_sparc::plt_entry_count): New function.
8731 (Target_sparc::first_plt_entry_offset): New function.
8732 (Target_sparc::plt_entry_size): New function.
8733 (Output_data_plt_sparc::entry_count): New function.
8734 (Output_data_plt_sparc::first_plt_entry_offset): New function.
8735 (Output_data_plt_sparc::get_plt_entry_size): New function.
8736 * symtab.h (Symbol::got_offset_list): New function.
8737 (Symbol_table::for_all_symbols): New function.
8738 * target.h (Sized_target::got_entry_count): New function.
8739 (Sized_target::plt_entry_count): New function.
8740 (Sized_target::plt_entry_size): New function.
8741 * x86_64.cc (Target_x86_64::got_size): Add const.
8742 (Target_x86_64::got_entry_count): New function.
8743 (Target_x86_64::plt_entry_count): New function.
8744 (Target_x86_64::first_plt_entry_offset): New function.
8745 (Target_x86_64::plt_entry_size): New function.
8746 (Output_data_plt_x86_64::entry_count): New function.
8747 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8748 (Output_data_plt_x86_64::get_plt_entry_size): New function.
8749
8750 2010-08-12 Cary Coutant <ccoutant@google.com>
8751
8752 * archive.cc: Include incremental.h.
8753 (Archive::Archive): Initialize incremental_info_.
8754 (Archive::include_member): Record archive members in incremental info.
8755 (Add_archive_symbols::run): Record begin and end of an archive in
8756 incremental info.
8757 (Lib_group::include_member): Record objects in incremental info.
8758 * archive.h (Incremental_archive_entry): Forward declaration.
8759 (Archive::set_incremental_info): New member function.
8760 (Archive::incremental_info): New member function.
8761 (Archive::Unused_symbol_iterator): New class.
8762 (Archive::unused_symbols_begin): New member function.
8763 (Archive::unused_symbols_end): New member function.
8764 (Archive::incremental_info_): New data member.
8765 * incremental-dump.cc (find_input_containing_global): New function.
8766 (dump_incremental_inputs): Dump new incremental info sections.
8767 * incremental.cc: Include symtab.h.
8768 (Output_section_incremental_inputs): New class.
8769 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8770 new incremental info sections.
8771 (Sized_incremental_binary::do_check_inputs): Likewise.
8772 (Incremental_inputs::report_archive): Remove.
8773 (Incremental_inputs::report_archive_begin): New function.
8774 (Incremental_inputs::report_archive_end): New function.
8775 (Incremental_inputs::report_object): New function.
8776 (Incremental_inputs::finalize_inputs): Remove.
8777 (Incremental_inputs::report_input_section): New function.
8778 (Incremental_inputs::report_script): Rewrite.
8779 (Incremental_inputs::finalize): Do nothing but finalize string table.
8780 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8781 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8782 (Incremental_inputs::create_data_sections): New function.
8783 (Incremental_inputs::relocs_entsize): New function.
8784 (Output_section_incremental_inputs::set_final_data_size): New function.
8785 (Output_section_incremental_inputs::do_write): New function.
8786 (Output_section_incremental_inputs::write_header): New function.
8787 (Output_section_incremental_inputs::write_input_files): New function.
8788 (Output_section_incremental_inputs::write_info_blocks): New function.
8789 (Output_section_incremental_inputs::write_symtab): New function.
8790 * incremental.h (Incremental_script_entry): Forward declaration.
8791 (Incremental_object_entry): Forward declaration.
8792 (Incremental_archive_entry): Forward declaration.
8793 (Incremental_inputs): Forward declaration.
8794 (Incremental_inputs_header_data): Remove.
8795 (Incremental_inputs_header): Remove.
8796 (Incremental_inputs_header_write): Remove.
8797 (Incremental_inputs_entry_data): Remove.
8798 (Incremental_inputs_entry): Remove.
8799 (Incremental_inputs_entry_write): Remove.
8800 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8801 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8802 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8803 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
8804 Likewise.
8805 (Incremental_input_entry): New class.
8806 (Incremental_script_entry): New class.
8807 (Incremental_object_entry): New class.
8808 (Incremental_archive_entry): New class.
8809 (Incremental_inputs::Incremental_inputs): Initialize new data members.
8810 (Incremental_inputs::report_inputs): Remove.
8811 (Incremental_inputs::report_archive): Remove.
8812 (Incremental_inputs::report_archive_begin): New function.
8813 (Incremental_inputs::report_archive_end): New function.
8814 (Incremental_inputs::report_object): Change prototype.
8815 (Incremental_inputs::report_input_section): New function.
8816 (Incremental_inputs::report_script): Change prototype.
8817 (Incremental_inputs::get_reloc_count): New function.
8818 (Incremental_inputs::set_reloc_count): New function.
8819 (Incremental_inputs::create_data_sections): New function.
8820 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8821 (Incremental_inputs::inputs_section): New function.
8822 (Incremental_inputs::symtab_section): New function.
8823 (Incremental_inputs::relocs_section): New function.
8824 (Incremental_inputs::get_stringpool): Add const.
8825 (Incremental_inputs::command_line): Add const.
8826 (Incremental_inputs::inputs): Remove.
8827 (Incremental_inputs::command_line_key): New function.
8828 (Incremental_inputs::input_file_count): New function.
8829 (Incremental_inputs::input_files): New function.
8830 (Incremental_inputs::relocs_entsize): New function.
8831 (Incremental_inputs::sized_create_inputs_section_data): Remove.
8832 (Incremental_inputs::finalize_inputs): Remove.
8833 (Incremental_inputs::Input_info): Remove.
8834 (Incremental_inputs::lock_): Remove.
8835 (Incremental_inputs::inputs_): Change type.
8836 (Incremental_inputs::inputs_map_): Remove.
8837 (Incremental_inputs::current_object_entry_): New data member.
8838 (Incremental_inputs::inputs_section_): New data member.
8839 (Incremental_inputs::symtab_section_): New data member.
8840 (Incremental_inputs::relocs_section_): New data member.
8841 (Incremental_inputs::reloc_count_): New data member.
8842 (Incremental_inputs_reader): New class.
8843 (Incremental_symtab_reader): New class.
8844 (Incremental_relocs_reader): New class.
8845 * layout.cc (Layout::finalize): Move finalization of incremental info
8846 and creation of incremental info sections to follow finalization of
8847 symbol table. Set offsets for postprocessing sections.
8848 (Layout::create_incremental_info_sections): Call
8849 Incremental_inputs::create_data_sections. Add incremental symtab
8850 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
8851 sections to layout after input sections.
8852 * layout.h (struct Timespec): Forward declaration.
8853 (Layout::incremental_inputs): Add const.
8854 (Layout::create_incremental_info_sections): Add parameter.
8855 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
8856 * object.cc: Include incremental.h.
8857 (Relobj::finalize_incremental_relocs): New function.
8858 (Sized_relobj::do_layout): Record input sections in incremental info.
8859 * object.h (Object::output_section): New function.
8860 (Object::output_section_offset): Moved from Relobj.
8861 (Object::get_incremental_reloc_base): New function.
8862 (Object::get_incremental_reloc_count): New function.
8863 (Object::do_output_section): New function.
8864 (Object::do_output_section_offset): Moved from Relobj.
8865 (Object::do_get_incremental_reloc_base): New function.
8866 (Object::do_get_incremental_reloc_count): New function.
8867 (Object::Object): Initialize new data members.
8868 (Relobj::output_section): Renamed do_output_section and moved to
8869 protected.
8870 (Relobj::output_section_offset): Moved to Object.
8871 (Relobj::do_get_incremental_reloc_base): New function.
8872 (Relobj::do_get_incremental_reloc_count): New function.
8873 (Relobj::allocate_incremental_reloc_counts): New function.
8874 (Relobj::count_incremental_reloc): New function.
8875 (Relobj::finalize_incremental_relocs): New function.
8876 (Relobj::next_incremental_reloc_index): New function.
8877 (Relobj::reloc_counts_): New data member.
8878 (Relobj::reloc_bases_): New data member.
8879 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
8880 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
8881 (Sized_relobj::incremental_relocs_scan): New function.
8882 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8883 (Sized_relobj::incremental_relocs_write): New function.
8884 (Sized_relobj::incremental_relocs_write_reltype): New function.
8885 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
8886 incremental link.
8887 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
8888 archives and object files elsewhere.
8889 (Add_symbols::run): Report object files here.
8890 (Finish_group::run): Report end of archive at end of group.
8891 * reloc.cc: Include layout.h, incremental.h.
8892 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
8893 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
8894 (Sized_relobj::incremental_relocs_scan): New function.
8895 (Sized_relobj::incremental_relocs_scan_reltype): New function.
8896 (Sized_relobj::do_relocate_sections): Write incremental relocations.
8897 (Sized_relobj::incremental_relocs_write): New function.
8898 (Sized_relobj::incremental_relocs_write_reltype): New function.
8899 * script.cc (read_input_script): Rewrite test for incremental link.
8900 Change call to Incremental_inputs::report_script.
8901 * symtab.h (Symbol_table::first_global_index): New function.
8902 (Symbol_table::output_count): New function.
8903
8904 2010-08-12 Doug Kwan <dougkwan@google.com>
8905
8906 * arm.cc (Target_arm::merge_object_attributes): Check command line
8907 options --no-wchar-size-warning and --no-enum-size-warning.
8908 * options.h (General_options): Add ld-compatible options
8909 --no-enum-size-warning and --no-wchar-size-warning.
8910
8911 2010-08-04 Ian Lance Taylor <iant@google.com>
8912
8913 * x86_64.cc (Target_x86_64::Scan::local): Use
8914 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
8915 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
8916 (Target_x86_64::Scan::global): Likewise.
8917 (Target_x86_64::Relocate::relocate): Likewise.
8918 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
8919 Likewise.
8920
8921 2010-08-03 Cary Coutant <ccoutant@google.com>
8922
8923 * merge.cc (Output_merge_string::do_add_input_section): Count strings
8924 to reserve space in merged_strings vector. Keep total input size
8925 for stats.
8926 (Output_merge_string::do_print_merge_stats): Print total input size.
8927 * merge.h (Output_merge_string): Add input_size_ field.
8928 * stringpool.cc (Stringpool_template::string_length): Move
8929 implementations out of Stringpool_template class and place in
8930 stringpool.h.
8931 * stringpool.h (string_length): Move out of Stringpool_template.
8932
8933 2010-08-03 Ian Lance Taylor <iant@google.com>
8934
8935 PR 11712
8936 * layout.cc (relaxation_loop_body): If address of load segment is
8937 set, adjust address to include headers if possible.
8938
8939 2010-08-03 Ian Lance Taylor <iant@google.com>
8940
8941 * version.cc (version_string): Bump to 1.10.
8942
8943 2010-08-03 Ian Lance Taylor <iant@google.com>
8944
8945 PR 11805
8946 * layout.h (enum Output_section_order): Define.
8947 (class Layout): Update declarations.
8948 * layout.cc (Layout::get_output_section): Add order parameter.
8949 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
8950 is_first_non_relro parameters. Change all callers.
8951 (Layout::choose_output_section): Likewise.
8952 (Layout::add_output_section_data): Likewise.
8953 (Layout::make_output_section): Likewise. Set order.
8954 (Layout::default_section_order): New function.
8955 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
8956 * output.cc (Output_section::Output_section): Initialize order_.
8957 Don't initialize deleted fields.
8958 (Output_segment::Output_segment): Don't initialize deleted
8959 fields.
8960 (Output_segment::add_output_section_to_load): New function
8961 replacing add_output_section. Change all callers to call this or
8962 add_output_section_to_nonload.
8963 (Output_segment::add_output_section_to_nonload): New function.
8964 (Output_segment::remove_output_section): Rewrite.
8965 (Output_segment::add_initial_output_data): Likewise.
8966 (Output_segment::has_any_data_sections): Likewise.
8967 (Output_segment::is_first_section_relro): Likewise.
8968 (Output_segment::maximum_alignment): Likewise.
8969 (Output_segment::has_dynamic_reloc): New function replacing
8970 dynamic_reloc_count. Change all callers.
8971 (Output_segment::has_dynamic_reloc_list): New function replacing
8972 dynamic_reloc_count_list. Change all callers.
8973 (Output_segment::set_section_addresses): Rewrite.
8974 (Output_segment::set_offset): Rewrite.
8975 (Output_segment::find_first_and_last_list): Remove.
8976 (Output_segment::set_tls_offsets): Rewrite.
8977 (Output_segment::first_section_load_address): Likewise.
8978 (Output_segment::output_section_count): Likewise.
8979 (Output_segment::section_with_lowest_load_address): Likewise.
8980 (Output_segment::write_section_headers): Likewise.
8981 (Output_segment::print_sections_to_map): Likewise.
8982 * output.h (class Output_data): Remove dynamic_reloc_count_
8983 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
8984 (Output_data::add_dynamic_reloc): Rewrite.
8985 (Output_data::has_dynamic_reloc): New function.
8986 (Output_data::dynamic_reloc_count): Remove.
8987 (class Output_section): Add order_ field. Remvoe is_relro_local_,
8988 is_last_relro_, is_first_non_relro_, is_interp_,
8989 is_dynamic_linker_section_ fields. Add order and set_order
8990 functions. Remove is_relro_local, set_is_relro_local,
8991 is_last_relro, set_is_last_relro, is_first_non_relro,
8992 set_is_first_non_relro functions, is_interp, set_is_interp,
8993 is_dynamic_linker_section, and set_is_dynamic_linker_section
8994 functions.
8995 (class Output_segment): Change Output_data_list from std::list to
8996 std:;vector. Add output_lists_ field. Remove output_data_ and
8997 output_bss_ fields. Update declarations.
8998
8999 2010-08-02 Ian Lance Taylor <iant@google.com>
9000
9001 * arm.cc (Target_arm::gc_process_relocs): Use typename.
9002 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9003 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9004
9005 2010-08-02 Ian Lance Taylor <iant@google.com>
9006
9007 PR 11855
9008 * script.cc (Script_options::Script_options): Initialize
9009 symbol_definitions_ and symbol_references_.
9010 (Script_options::add_symbol_assignment): Update
9011 symbol_definitions_ and symbol_references_.
9012 (Script_options::add_symbol_reference): New function.
9013 (script_symbol): New function.
9014 * script.h (class Script_options): Add symbol_definitions_ and
9015 symbol_references_ fields.
9016 (Script_options::referenced_const_iterator): New type.
9017 (Script_options::referenced_begin): New function.
9018 (Script_options::referenced_end): New function.
9019 (Script_options::is_referenced): New function.
9020 (Script_options::any_unreferenced): New function.
9021 * script-c.h (script_symbol): Declare.
9022 * yyscript.y (exp): Call script_symbol.
9023 * symtab.cc: Include "script.h".
9024 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9025 Change all callers. Check symbols referenced by scripts.
9026 (Symbol_table::add_undefined_symbols_from_command_line): Add
9027 layout parameter. Change all callers.
9028 (Symbol_table::do_add_undefined_symbols_from_command_line):
9029 Likewise. Break out loop body. Check symbols referenced by
9030 scripts.
9031 (Symbol_table::add_undefined_symbol_from_command_line): New
9032 function broken out of
9033 do_add_undefined_symbols_from_command_line.
9034 * symtab.h (class Symbol_table): Update declarations.
9035 * archive.cc: Include "layout.h".
9036 (Archive::should_include_member): Add layout parameter. Change
9037 all callers. Check for symbol mentioned in expression.
9038 * archive.h (class Archive): Update declaration.
9039 * object.cc (Sized_relobj::do_should_include_member): Add layout
9040 parameter.
9041 * object.h (Object::should_include_member): Add layout parameter.
9042 Change all callers.
9043 (Object::do_should_include_member): Add layout parameter.
9044 (class Sized_relobj): Update declaration.
9045 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9046 parameter.
9047 * dynobj.h (class Sized_dynobj): Update declaration.
9048 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9049 layout parameter.
9050 * plugin.h (class Sized_pluginobj): Update declaration.
9051
9052 2010-08-02 Ian Lance Taylor <iant@google.com>
9053
9054 PR 11866
9055 * output.cc (Output_segment::set_offset): Search for the first and
9056 last sections rather than assuming that the list is in order.
9057 (Output_segment::find_first_and_last_list): New function.
9058 * output.h (class Output_segment): Update declarations.
9059 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9060 (relro_strip_test_SOURCES): New variable.
9061 (relro_strip_test_DEPENDENCIES): New variable.
9062 (relro_strip_test_LDFLAGS): New variable.
9063 (relro_strip_test_LDADD): New variable.
9064 (relro_strip_test.so): New target.
9065
9066 2010-08-02 Ian Lance Taylor <iant@google.com>
9067
9068 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9069 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9070 (Target_i386::got_tlsdesc_section): New function.
9071 (Target_i386::got_section): Create space for GOT entries for
9072 TLSDESC relocations.
9073 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9074 R_386_TLS_GOTDESC.
9075 (Target_i386::Scan::global): Likewise.
9076 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9077 using TLSDESC GOT.
9078 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9079 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9080 (Target_x86_64::got_tlsdesc_section): New function.
9081 (Target_x86_64::got_section): Create space for GOT entries for
9082 TLSDESC relocations.
9083 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9084 R_386_TLS_GOTDESC.
9085 (Target_x86_64::Scan::global): Likewise.
9086 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9087 using TLSDESC GOT.
9088
9089 2010-08-02 Ian Lance Taylor <iant@google.com>
9090
9091 * testsuite/final_layout.sh: Use dc to convert from hex to
9092 decimal.
9093
9094 2010-07-29 Sriraman Tallam <tmsriram@google.com>
9095
9096 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9097 paramter to the call to gold::gc_process_relocs.
9098 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9099 paramter to the call to gold::gc_process_relocs.
9100 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9101 parameter to the call to gold::gc_process_relocs.
9102 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9103 template parameter to the call to gold::gc_process_relocs.
9104 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9105 paramter to the call to gold::gc_process_relocs.
9106 * gc.h (get_embedded_addend_size): New function.
9107 (gc_process_relocs): Save the size of the reloc for use by ICF.
9108 * icf.cc (get_section_contents): Get the addend from the text section
9109 for SHT_REL relocation sections.
9110 * icf.h (Icf::Reloc_addend_size_info): New typedef.
9111 (Icf::Reloc_info): Add new member reloc_addend_size_info.
9112 * int_encoding.h (read_from_pointer): New overloaded function.
9113 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9114 * testsuite/icf_sht_rel_addend_test.sh: New file.
9115 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9116 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9117
9118 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9119
9120 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9121 * Makefile.in: Regenerate.
9122 * testsuite/Makefile.in: Regenerate.
9123
9124 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
9125
9126 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9127 * gold/testsuite/debug_msg.cc: Likewise.
9128 * gold/testsuite/odr_violation1.cc
9129 * gold/testsuite/odr_violation2.cc
9130
9131 2010-07-21 Cary Coutant <ccoutant@google.com>
9132
9133 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9134 string, and length fields.
9135 (Output_merge_string::Merged_strings_list): New type.
9136 (Output_merge_string::Merged_strings_lists): New typedef.
9137 (Output_merge_string): Replace merged_strings_ with
9138 merged_strings_lists_.
9139 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9140 Merged_strings_list per input object and section. Don't store pointer
9141 to the string. Don't store length with each merged string entry.
9142 (Output_merge_string::finalize_merged_data): Loop over list of merged
9143 strings lists. Recompute length of each merged string.
9144
9145 2010-07-15 Cary Coutant <ccoutant@google.com>
9146
9147 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9148 here.
9149
9150 2010-07-14 Ian Lance Taylor <iant@google.com>
9151
9152 * descriptors.cc (Descriptors::open): Report correct name in error
9153 message.
9154
9155 2010-07-13 Doug Kwan <dougkwan@google.com>
9156
9157 * arm.cc (Arm_input_section::Arm_input_section): For a
9158 SHT_ARM_EXIDX section, always keeps the input sections.
9159 (Arm_input_section::set_exidx_section_link): New method.
9160 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9161 has_errors_ to false.
9162 (Arm_exidx_input_section::has_errors,
9163 Arm_exidx_input_section::set_has_errors): New methods.
9164 (Arm_exidx_input_section::has_errors_): New data member.
9165 (Arm_relobj::get_exidx_shndx_list): New method.
9166 (Arm_output_section::append_text_sections_to_list): Do not skip
9167 section without SHF_EXECINSTR.
9168 (Arm_output_section::fix_exidx_coverage): Skip input sections with
9169 errors.
9170 (Arm_relobj::make_exidx_input_section): Add new parameter for text
9171 section header. Make error messages more verbose. Check for
9172 a non-executable section linked to an EXIDX section.
9173 (Arm_relobj::do_read_symbols): Remove error checking, which has been
9174 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
9175 check that there is no deferred EXIDX section if we exit early.
9176 Instead of not making an EXIDX section in case of an error, make one
9177 and set the has_errors flag of it.
9178 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9179 in a relocatable link.
9180 (Target_arm::do_relax): Look for the EXIDX output section instead of
9181 assuming that it is called .ARM.exidx.
9182 (Target_arm::fix_exidx_coverage): Add a new parameter for input
9183 section list. Do not check for SHF_EXECINSTR section flags but
9184 skip any input section with errors.
9185 * output.cc (Output_section::Output_section): Initialize
9186 always_keeps_input_sections_ to false.
9187 (Output_section::add_input_section): Check for
9188 always_keeps_input_sections_.
9189 * output.h (Output_section::always_keeps_input_sections,
9190 Output_section::set_always_keeps_input_sections): New methods.
9191 (Output_section::always_keeps_input_sections): New data member.
9192
9193 2010-07-13 Rafael Espindola <espindola@google.com>
9194
9195 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9196 * fileread.h (Input_file): Add try_extra_search_path and find_file.
9197
9198 2010-07-13 Philip Herron <herron.philip@googlemail.com>
9199 Ian Lance Taylor <iant@google.com>
9200
9201 * output.h (Output_section_lookup_maps::add_merge_section):
9202 Correct check of whether value was inserted.
9203 (Output_section_lookup_maps::add_merge_input_section): Likewise.
9204 (Output_section_lookup_maps::add_relaxed_input_section):
9205 Likewise.
9206 * arm.cc (Target_arm::got_section): Remove used local os.
9207 * i386.cc (Target_i386::got_section): Likewise.
9208 * x86_64.cc (Target_x86_64::got_section): Likewise.
9209 * sparc.cc (Target_sparc::got_section): Likewise.
9210 (Target_sparc::relocate): Remove unused local have_got_offset.
9211 * powerpc.cc (Target_powerpc::relocate): Likewise.
9212
9213 2010-07-13 Ian Lance Taylor <iant@google.com>
9214
9215 * compressed_output.cc (zlib_decompress): Fix signature in
9216 !HAVE_ZLIB_H case.
9217
9218 * archive.cc (Archive::include_member): Unlock an external member
9219 of a thin archive. Don't bother to delete an object we know is
9220 NULL.
9221
9222 2010-07-12 Cary Coutant <ccoutant@google.com>
9223
9224 * compressed_output.cc (zlib_decompress): New function.
9225 (get_uncompressed_size): New function.
9226 (decompress_input_section): New function.
9227 * compressed_output.h (get_uncompressed_size): New function.
9228 (decompress_input_section): New function.
9229 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9230 Handle compressed debug sections.
9231 * layout.cc (is_compressed_debug_section): New function.
9232 (Layout::output_section_name): Map compressed section names to
9233 canonical names.
9234 * layout.h (is_compressed_debug_section): New function.
9235 (is_debug_info_section): Recognize compressed debug sections.
9236 * merge.cc: Include compressed_output.h.
9237 (Output_merge_data::do_add_input_section): Handle compressed
9238 debug sections.
9239 (Output_merge_string::do_add_input_section): Handle compressed
9240 debug sections.
9241 * object.cc: Include compressed_output.h.
9242 (Sized_relobj::Sized_relobj): Initialize new data members.
9243 (build_compressed_section_map): New function.
9244 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9245 * object.h (Object::section_is_compressed): New method.
9246 (Object::do_section_is_compressed): New method.
9247 (Sized_relobj::Compressed_section_map): New type.
9248 (Sized_relobj::do_section_is_compressed): New method.
9249 (Sized_relobj::compressed_sections_): New data member.
9250 * output.cc (Output_section::add_input_section): Handle compressed
9251 debug sections.
9252 * reloc.cc: Include compressed_output.h.
9253 (Sized_relobj::write_sections): Handle compressed debug sections.
9254
9255 2010-07-08 Cary Coutant <ccoutant@google.com>
9256
9257 * resolve.cc (Symbol_table::resolve): Remember whether undef was
9258 weak when resolving to a dynamic def.
9259 (Symbol_table::should_override): Add adjust_dyndef flag; set it
9260 for weak undef/dynamic def cases. Adjust callers.
9261 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9262 undef_binding_weak_.
9263 (Symbol_table::sized_write_globals): Adjust symbol binding.
9264 (Symbol_table::sized_write_symbol): Add binding parameter.
9265 * symtab.h (Symbol::set_undef_binding): New method.
9266 (Symbol::is_undef_binding_weak): New method.
9267 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9268 (Symbol_table::should_override): Add new parameter.
9269 (Symbol_table::sized_write_symbol): Add new parameter.
9270
9271 * testsuite/weak_undef_file1.cc: Add new test case.
9272 * testsuite/weak_undef_file2.cc: Fix header comment.
9273 * testsuite/weak_undef_test.cc: Add new test case.
9274
9275 2010-06-29 Doug Kwan <dougkwan@google.com>
9276
9277 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9278 Initialize USE_SYMBOL_.
9279 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9280 definition.
9281 (Arm_reloc_property::uses_symbol_): New data member declaration.
9282 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9283 uses symbol value and symbol is undefined but not weakly undefined.
9284
9285 2010-06-28 Rafael Espindola <espindola@google.com>
9286
9287 * plugin.cc (Plugin::load): Use dlerror.
9288
9289 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
9290
9291 * symtab.cc (detect_odr_violations): When reporting an ODR
9292 violation, report an object where the symbol is defined.
9293
9294 2010-06-25 Doug Kwan <dougkwan@google.com>
9295
9296 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9297 (Target_arm::section_may_have_icf_unsafe_pointers): New method
9298 definition.
9299 (Target_arm::Scan::local_reloc_may_be_function_pointer,
9300 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9301 target hook to detect function points.
9302 (Target_arm::Scan::possible_function_pointer_reloc): New method.
9303 * icf.h (Icf::check_section_for_function_pointers): Change type of
9304 parameter SECTION_NAME to const reference to std::string. Use
9305 target hook to determine if section may have unsafe pointers.
9306 * target.h (Target::section_may_have_icf_unsafe_pointers): New
9307 method definition.
9308
9309 2010-06-21 Rafael Espindola <espindola@google.com>
9310
9311 * fileread.cc (Input_file::find_fie): New
9312 (Input_file::open): Use Input_file::find_fie.
9313 * fileread.h (Input_file::find_fie): New
9314 * plugin.cc (set_extra_library_path): New.
9315 (Plugin::load): Add set_extra_library_path to the transfer vector.
9316 (Plugin_manager::set_extra_library_path): New.
9317 (Plugin_manager::add_input_file): Use the extra search path if set.
9318 (set_extra_library_path(): New.
9319 * plugin.h (Plugin_manager): Add set_extra_library_path and
9320 extra_search_path_.
9321
9322 2010-06-19 Cary Coutant <ccoutant@google.com>
9323
9324 * layout.cc (gdb_sections): Add .debug_types.
9325 (lines_only_debug_sections): Likewise.
9326
9327 2010-06-18 Rafael Espindola <espindola@google.com>
9328
9329 * plugin.cc (add_input_file,add_input_library)
9330 (Plugin_manager::add_input_file): Make filename arguments const.
9331 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9332 const.
9333
9334 2010-06-16 Doug Kwan <dougkwan@google.com>
9335
9336 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9337 .ARM.attributes section if we have not merged any input
9338 attributes sections.
9339
9340 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9341
9342 * arm.cc: Allow combining objects with no EABI version
9343 information.
9344
9345 2010-06-15 Rafael Espindola <espindola@google.com>
9346
9347 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9348
9349 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9350
9351 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9352 (struct iovec): Correct !HAVE_READV definition.
9353
9354 2010-06-10 Cary Coutant <ccoutant@google.com>
9355
9356 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9357 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9358 reloc sections.
9359 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9360
9361 PR 11683
9362 * symtab.h (Symbol::is_placeholder): New member function.
9363 * target-reloc.h (relocate_section): Check for placeholder symbols.
9364
9365 * testsuite/Makefile.am (plugin_test_8): New test.
9366 (plugin_test_9): New test.
9367 * testsuite/Makefile.in: Regenerate.
9368
9369 2010-06-09 Nick Clifton <nickc@redhat.com>
9370
9371 * yyscript.y (input_list_element): Allow strings prefixed with
9372 the '-' character. Treat these as libraries.
9373 * script.cc (script_add_library): New function. Adds a library
9374 specified by "-l<name>" found in an input script.
9375 * script-c.h: Add prototype for script_add_library.
9376
9377 2010-06-07 Doug Kwan <dougkwan@google.com>
9378
9379 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9380 Restrict stub-group size to be within long conditional branch
9381 range when working around cortex-A8 erratum.
9382
9383 2010-06-07 Damien Diederen <dd@crosstwine.com>
9384
9385 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9386 #ifdef typo.
9387
9388 2010-06-03 Sriraman Tallam <tmsriram@google.com>
9389
9390 PR gold/11658
9391 * output.cc
9392 (Output_section::Input_section_sort_entry::compare_section_ordering):
9393 Change to return non-zero correctly.
9394 (Output_section::Input_section_sort_section_order_index_compare
9395 ::operator()): Change to fix ambiguity in comparisons.
9396
9397 2010-06-01 Sriraman Tallam <tmsriram@google.com>
9398
9399 * gold.h (is_wildcard_string): New function.
9400 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9401 (Layout::layout_eh_frame): Ditto.
9402 (Layout::find_section_order_index): New method.
9403 (Layout::read_layout_from_file): New method.
9404 * layout.h (Layout::find_section_order_index): New method.
9405 (Layout::read_layout_from_file): New method.
9406 (Layout::input_section_position_): New private member.
9407 (Layout::input_section_glob_): New private member.
9408 * main.cc (main): Call read_layout_from_file here.
9409 * options.h (--section-ordering-file): New option.
9410 * output.cc (Output_section::input_section_order_specified_): New
9411 member.
9412 (Output_section::Output_section): Initialize new member.
9413 (Output_section::add_input_section): Add new parameter.
9414 Keep input sections when --section-ordering-file is used.
9415 (Output_section::set_final_data_size): Sort input sections when
9416 section ordering file is specified.
9417 (Output_section::Input_section_sort_entry): Add new parameter.
9418 Check sorting type.
9419 (Output_section::Input_section_sort_entry::compare_section_ordering):
9420 New method.
9421 (Output_section::Input_section_sort_compare::operator()): Change to
9422 consider section_order_index.
9423 (Output_section::Input_section_sort_init_fini_compare::operator()):
9424 Change to consider section_order_index.
9425 (Output_section::Input_section_sort_section_order_index_compare
9426 ::operator()): New method.
9427 (Output_section::sort_attached_input_sections): Change to sort
9428 according to section order when specified.
9429 (Output_section::add_input_section<32, true>): Add new parameter.
9430 (Output_section::add_input_section<64, true>): Add new parameter.
9431 (Output_section::add_input_section<32, false>): Add new parameter.
9432 (Output_section::add_input_section<64, false>): Add new parameter.
9433 * output.h (Output_section::add_input_section): Add new parameter.
9434 (Output_section::input_section_order_specified): New
9435 method.
9436 (Output_section::set_input_section_order_specified): New method.
9437 (Input_section::Input_section): Initialize section_order_index_.
9438 (Input_section::section_order_index): New method.
9439 (Input_section::set_section_order_index): New method.
9440 (Input_section::section_order_index_): New member.
9441 (Input_section::Input_section_sort_section_order_index_compare): New
9442 struct.
9443 (Output_section::input_section_order_specified_): New member.
9444 * script-sections.cc (is_wildcard_string): Delete and move modified
9445 method to gold.h.
9446 (Output_section_element_input::Output_section_element_input): Modify
9447 call to is_wildcard_string.
9448 (Output_section_element_input::Input_section_pattern
9449 ::Input_section_pattern): Ditto.
9450 (Output_section_element_input::Output_section_element_input): Ditto.
9451 * testsuite/Makefile.am (final_layout): New test case.
9452 * testsuite/Makefile.in: Regenerate.
9453 * testsuite/final_layout.cc: New file.
9454 * testsuite/final_layout.sh: New file.
9455
9456 2010-06-01 Rafael Espindola <espindola@google.com>
9457
9458 * plugin.cc (Plugin::load): Pass the output name to the plugin.
9459
9460 2010-06-01 Rafael Espindola <espindola@google.com>
9461
9462 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9463 visibility of symbols.
9464
9465 2010-05-27 Doug Kwan <dougkwan@google.com>
9466
9467 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9468 from start of output section instead of address for a local symbol
9469 in a merged or relaxed section when doing a relocatable link.
9470
9471 2010-05-26 Rafael Espindola <espindola@google.com>
9472
9473 PR 11604
9474 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9475 adding sections the garbage collector removed.
9476 * gold/testsuite/Makefile.am: Add test.
9477 * gold/testsuite/Makefile.in: Regenerate.
9478 * gold/testsuite/plugin_test_7.sh: New.
9479 * gold/testsuite/plugin_test_7_1.c: New.
9480 * gold/testsuite/plugin_test_7_2.c: New.
9481
9482 2010-05-26 Rafael Espindola <espindola@google.com>
9483
9484 * script-sections.cc (Output_section_definition::set_section_addresses):
9485 Check for --section-start.
9486
9487 2010-05-26 Doug Kwan <dougkwan@google.com>
9488
9489 * arm.cc (Arm_scan_relocatable_relocs): New class.
9490 (Target_arm::relocate_special_relocatable): New method.
9491 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9492 (Arm_relocate_functions::thumb_branch_common): Same.
9493 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9494 instead of Default_scan_relocatable_relocs.
9495 * target-reloc.h (relocate_for_relocatable): Let target handle
9496 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9497 * target.h (Sized_target::relocate_special_relocatable): New method.
9498
9499 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9500
9501 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9502
9503 2010-05-23 Doug Kwan <dougkwan@google.com>
9504
9505 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9506 instead of a cast.
9507 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9508 with a direct branch, not a conditional branch, to a stub.
9509 * merge.cc (Output_merge_base::record_input_section): New method
9510 defintion.
9511 (Output_merge_data::do_add_input_section): Record input section if
9512 keeps-input-sections flag is set.
9513 (Output_merge_string::do_add_input_section): Ditto.
9514 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9515 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9516 INPUT_SECTIONS_.
9517 (Output_merge_base::keeps_input_sections,
9518 Output_merge_base::set_keeps_input_sections,
9519 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9520 method definitions.
9521 (Output_merge_base::Input_sections): New type declaration.
9522 (Output_merge_base::input_sections_begin,
9523 Output_merge_base::input_sections_end,
9524 Output_merge_base::do_set_keeps_input_sections): New method definitions.
9525 (Output_merge_base::bool keeps_input_sections_,
9526 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9527 Output_merge_base::input_sections_): New data members.
9528 (Output_merge_data::do_set_keeps_input_sections): New method
9529 defintion.
9530 (Output_merge_string::do_set_keeps_input_sections): Ditto.
9531 * output.cc (Output_section::Input_section::relobj): Move method
9532 defintion from class declaration to here and handle merge sections.
9533 (Output_section::Input_section::shndx): Ditto.
9534 (Output_section::Output_section): Remove initializations of removed
9535 data members and initialize new data member LOOKUP_MAPS_.
9536 (Output_section::add_input_section): Set keeps-input-sections flag
9537 for a newly created merge output section as appropriate. Adjust code
9538 to use Output_section_lookup_maps class.
9539 (Output_section::add_relaxed_input_section): Adjst code for lookup
9540 maps code refactoring.
9541 (Output_section::add_merge_input_section): Add a new parameter
9542 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
9543 class. If adding input section to a newly created merge output
9544 section fails, remove the new merge section.
9545 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9546 Adjust code for use of the Output_section_lookup_maps class.
9547 (Output_section::find_merge_section): Ditto.
9548 (Output_section::build_lookup_maps): New method defintion.
9549 (Output_section::find_relaxed_input_section): Adjust code to use
9550 Output_section_lookup_maps class.
9551 (Output_section::get_input_sections): Export merge sections. Adjust
9552 code to use Output_section_lookup_maps class.
9553 (Output_section:::add_script_input_section): Adjust code to use
9554 Output_section_lookup_maps class. Update lookup maps for merge
9555 sections also.
9556 (Output_section::discard_states): Use Output_section_lookup_maps.
9557 (Output_section::restore_states): Same.
9558 * output.h (Merge_section_properties): Move class defintion out of
9559 Output_section.
9560 (Output_section_lookup_maps): New class.
9561 (Output_section::Input_section::is_merge_section): New method
9562 defintion.
9563 (Output_section::Input_section::relobj): Move defintion out of class
9564 defintion. Declare method only.
9565 (Output_section::Input_section::shndx): Ditto.
9566 (Output_section::Input_section::output_merge_base): New method defintion.
9567 (Output_section::Input_section::u2_.pomb): New union field.
9568 (Output_section::Merge_section_by_properties_map,
9569 Output_section::Output_section_data_by_input_section_map,
9570 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9571 Remove types.
9572 (Output_section::add_merge_input_section): Add new parameter
9573 KEEPS_INPUT_SECTIONS.
9574 (Output_section::build_lookup_maps): New method declaration.
9575 (Output_section::merge_section_map_,
9576 Output_section::merge_section_by_properties_map_,
9577 Output_section::relaxed_input_section_map_,
9578 Output_section::is_relaxed_input_section_map_valid_): Remove data
9579 members.
9580 (Output_section::lookup_maps_): New data member.
9581
9582 2010-05-21 Doug Kwan <dougkwan@google.com>
9583
9584 PR gold/11619
9585 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9586 avoid a compilation error.
9587
9588 2010-05-19 Rafael Espindola <espindola@google.com>
9589
9590 * script-sections.cc (Output_section_definition::allocate_to_segment):
9591 Update the phdrs_list even when the output section is NULL.
9592 * testsuite/Makefile.am: Add test.
9593 * testsuite/Makefile.in: Regenerate.
9594 * testsuite/script_test_9.cc: New.
9595 * testsuite/script_test_9.sh: New.
9596 * testsuite/script_test_9.t: New.
9597
9598 2010-05-19 Doug Kwan <dougkwan@google.com>
9599
9600 * arm.cc (Arm_input_section::original_size): New method.
9601 (Arm_input_section::do_addralign): Add a cast.
9602 (Arm_input_section::do_output_offset): Remove static cast.
9603 (Arm_input_section::original_addralign,
9604 Arm_input_section::original_size_): Change type to uint32_t.
9605 (Arm_input_section::init): Add safe casts for section alignment
9606 and size.
9607 (Arm_input_section::set_final_data_size): Do not set address and
9608 offset of stub table.
9609 (Arm_output_section::fix_exidx_coverage): Change use of of
9610 Output_section::Simple_input_section to that of
9611 Output_section::Input_section.
9612 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9613 except for the first pass.
9614 * output.cc (Output_section::get_input_sections): Change type of
9615 input_sections to std::list<Input_section>.
9616 (Output_section::add_script_input_section): Rename from
9617 Output_section::add_simple_input_section. Change type of SIS
9618 parameter from Simple_input_section to Input_section.
9619 * output.h (Output_section::Simple_input_section): Remove class.
9620 (Output_section::Input_section): Change class visibility to public.
9621 (Output_section::Input_section::addralign): Use stored alignments
9622 for special input sections if set.
9623 (Output_section::Input_section::set_addralign): New method.
9624 (Output_section::get_input_sections): Change parameter type from
9625 list of Simple_input_section to list of Input_section.
9626 (Output_section::add_script_input_section): Rename from
9627 Output_section::add_simple_input_section. Change first parameter's
9628 type from Simple_input_section to Input_section and remove the
9629 second and third parameters.
9630 * script-sections.cc (Input_section::Input_section_list): Change
9631 type to list of Output_section::Input_section/
9632 (Input_section_info::Input_section_info): Change parameter type of
9633 INPUT_SECTION to Output_section::Input_section.
9634 (Input_section_info::input_section): Change return type.
9635 (Input_section_info::input_section_): Change type to
9636 Output_section::Input_section.
9637 (Output_section_element_input::set_section_addresses): Adjust code
9638 to use Output_section::Input_section instead of
9639 Output_section::Simple_input_section. Adjust code for renaming
9640 of Output_section::add_simple_input_section.
9641 (Orphan_output_section::set_section_addresses): Ditto.
9642
9643 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9644
9645 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9646 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9647
9648 2010-05-18 Rafael Espindola <espindola@google.com>
9649
9650 * options.cc (General_options::finalize): Handle -nostdlib.
9651 * options.h (nostdlib): New option.
9652 * script.cc (script_add_search_dir): Handle -nostdlib.
9653
9654 2010-05-12 Doug Kwan <dougkwan@google.com>
9655
9656 * arm.cc (Target_arm::do_finalize_sections): Create an empty
9657 attributes section only if there no attributes section after merging.
9658 (Target_arm::merge_object_attributes): Move value of
9659 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9660 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9661 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9662 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9663 and arm_attr_merge_7.stdout.
9664 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9665 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9666 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9667 arm_attr_merge_7b.o): New rules.
9668 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9669 arm_attr_merge_7
9670 * testsuite/Makefile.in: Regenerate.
9671 * testsuite/arm_attr_merge.sh: New file.
9672 * testsuite/arm_attr_merge_[67][ab].s: Same.
9673
9674 2010-05-05 Nick Clifton <nickc@redhat.com>
9675
9676 * po/es.po: Updated Spanish translation.
9677
9678 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
9679
9680 * Makefile.am (install-exec-local): Properly install gold as
9681 default cross linker.
9682 * Makefile.in: Regenerated.
9683
9684 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
9685 Nick Clifton <nickc@redhat.com>
9686
9687 * configure.ac (install_as_default): Define and set to false
9688 unless --enable-gold or --enable-gold=both/gold has been
9689 specified.
9690 * configure: Regenerate.
9691
9692 * Makefile.am (install-exec-local): Install the executable as
9693 'ld.gold'. If install_as_default is true then also install it as
9694 'ld'.
9695 * Makefile.in: Regenerated.
9696
9697 2010-04-24 Ian Lance Taylor <iant@google.com>
9698
9699 * layout.cc (Layout::layout_reloc): In relocatable link don't
9700 combine reloc sections for grouped sections.
9701
9702 2010-04-23 Sriraman Tallam <tmsriram@google.com>
9703
9704 * gc.h (gc_process_relocs): Pass information on relocs pointing to
9705 sections that are not ordinary to icf.
9706 * icf.cc (get_section_contents): Handle relocation pointing to section
9707 with no object or shndx information.
9708 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9709 * testsuite/Makefile.in: Regenerate.
9710 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9711 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9712
9713 2010-04-22 Ian Lance Taylor <iant@google.com>
9714
9715 * expression.cc (Expression::Expression_eval_info): Add
9716 result_alignment_pointer field.
9717 (Expression::eval_with_dot): Add result_alignment_pointer
9718 parameter. Change all callers.
9719 (Expression::eval_maybe_dot): Likewise.
9720 (class Binary_expression): Add alignment_pointer parameter to
9721 left_value and right_value. Change all callers.
9722 (BINARY_EXPRESSION): Set result alignment.
9723 (class Trinary_expression): Add alignment_pointer parameter to
9724 arg2_value and arg3_value. Change all callers.
9725 (Trinary_cond::value): Set result alignment.
9726 (Max_expression::value, Min_expression::value): Likewise.
9727 (Align_expression::value): Likewise.
9728 * script-sections.cc (class Sections_element): Add dot_alignment
9729 parameter to set_section_addresses virtual function. Update
9730 instantiations.
9731 (class Output_section_element): Likewise.
9732 (Script_sections::create_segments): Add dot_alignment parameter.
9733 Change all callers.
9734 (Script_sections::create_segments_from_phdrs_clause): Likewise.
9735 (Script_sections::set_phdrs_clause_addresses): Likewise.
9736 * script-sections.h: Update declarations.
9737 * script.h: Update declarations.
9738 * output.h (Output_segment::set_minimum_p_align): Don't decrease
9739 min_p_align.
9740 * testsuite/script_test_3.t: Set large alignment.
9741 * testsuite/script_test_3.sh: Make sure that at least one LOAD
9742 segment has expected alignment.
9743
9744 2010-04-22 Nick Clifton <nickc@redhat.com>
9745
9746 * po/gold.pot: Updated by the Translation project.
9747 * po/vi.po: Updated Vietnamese translation.
9748
9749 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
9750
9751 * testsuite/Makefile.am (check_PROGRAMS): Add
9752 icf_virtual_function_folding_test.
9753 * testsuite/Makefile.in: Regenerated.
9754
9755 2010-04-15 Andrew Haley <aph@redhat.com>
9756
9757 * options.h (merge_exidx_entries): New option.
9758 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9759 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9760 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9761 (Target_arm::merge_exidx_entries): New function.
9762 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9763 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9764 to Arm_exidx_fixup constructor.
9765 Add new arg, merge_exidx_entries.
9766 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9767 Arm_output_section::fix_exidx_coverage.
9768
9769 2010-04-18 Sriraman Tallam <tmsriram@google.com>
9770
9771 * icf.cc (get_section_contents): Check for preemptible functions.
9772 Ignore addend when appropriate.
9773 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
9774 section folded.
9775 (add_from_relobj): Check for section folded.
9776 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9777 * symtab.h (should_add_dynsym_entry): Add new parameter.
9778 * target-reloc.h (scan_relocs): Check for section folded.
9779 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9780 Check reloc types for function pointers in shared objects.
9781 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9782 case.
9783 (icf_preemptible_functions_test): New test case.
9784 (icf_string_merge_test): New test case.
9785 * testsuite.Makefile.in: Regenerate.
9786 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9787 bar_glob. Refactor code.
9788 * testsuite/icf_preemptible_functions_test.cc: New file.
9789 * testsuite/icf_preemptible_functions_test.sh: New file.
9790 * testsuite/icf_string_merge_test.cc: New file.
9791 * testsuite/icf_string_merge_test.sh: New file.
9792 * testsuite/icf_virtual_function_folding_test.cc: New file.
9793 * testsuite/icf_virtual_function_folding_test.sh: New file.
9794
9795 2010-04-14 Doug Kwan <dougkwan@google.com>
9796
9797 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9798 for local symbol recounting if we remove a section due to ICF.
9799 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9800 there are no regular objects in input.
9801
9802 2010-04-13 Doug Kwan <dougkwan@google.com>
9803
9804 * arm.cc (Arm_input_section::set_final_data_size): Compute
9805 accurate final data size instead of using current data size.
9806
9807 2010-04-09 Doug Kwan <dougkwan@google.com>
9808
9809 * layout.cc (Layout::choose_output_section): Handle script section
9810 types.
9811 (Layout::make_output_section_for_script): Add section type parameter.
9812 Handle script section types.
9813 * layout.h (Layout::make_output_section_for_script): Add section
9814 type parameter.
9815 * output.cc (Output_section::Output_section): Initialize data member
9816 is_noload_.
9817 (Output_section::do_reset_address_and_file_offset): Do not set address
9818 to 0 if section is a NOLOAD section.
9819 * output.h (Output_section::is_noload): New method.
9820 (Output_section::set_is_noload): Ditto.
9821 (Output_section::is_noload_): New data member.
9822 * script-c.h (Script_section_type): New enum type.
9823 (struct Parser_output_section_header): Add new file section_type.
9824 * script-sections.cc (Sections_element::output_section_name): Add
9825 parameter for returning script section type.
9826 (Output_section_definition::output_section_name): Ditto.
9827 (Output_section_definition::section_type)P; New method.
9828 (Output_section_definiton::script_section_type_name): Ditto.
9829 (Output_section_definition::script_section_type_): New data member.
9830 (Output_section_definition::Output_section_definition): Initialize
9831 data member Output_section_definition::script_section_type_.
9832 (Output_section_definition::create_sections): Pass script section type
9833 to Layout::make_output_section_for_script.
9834 (Output_section_definition::output_section_name): Return script
9835 section type to caller.
9836 (Output_section_definition::set_section_address): Do not advance
9837 dot value and load address if section type is NOLOAD. Set address
9838 of NOLOAD sections regardless of section flags.
9839 (Output_section_definition::print): Print section type if it is
9840 not SCRIPT_SECTION_TYPE_NONE.
9841 (Output_section_definition::section_type): New method.
9842 (Output_section_definition::script_section_type_name): Ditto.
9843 (Script_sections::output_section_name): Add new parameter
9844 PSECTION_TYPE for returning script section type. Pass it to
9845 section elements. Handle discard sections.
9846 (Sort_output_sections::operator()): Handle NOLOAD sections.
9847 * script-sections.h (Script_sections::Section_type): New enum type.
9848 (Script_sections::output_section_name): Add a new parameter for
9849 returning script section type.
9850 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
9851 INFO and NOLOAD.
9852 * yyscript.y (union): Add new field SECTION_TYPE.
9853 (COPY, DSECT, INFO, NOLOAD): New tokens.
9854 (opt_address_and_section_type): Change type to output_section_header.
9855 (section_type): New non-terminal
9856 (section_header): Handle section type.
9857 (opt_address_and_section_type): Return section type value.
9858
9859 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
9860
9861 * testsuite/plugin_common_test_1.c (foo): Add prototype.
9862 * testsuite/plugin_common_test_2.c (foo): Likewise.
9863
9864 2010-04-08 Doug Kwan <dougkwan@google.com>
9865
9866 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
9867 Output_merge_data.
9868 * output.cc (Output_section::add_merge_input_section): Simplify
9869 code and return status of Output_merge_base::add_input_section.
9870 Update merge section map only if Output_merge_base::add_input_section
9871 returns true.
9872
9873 2010-04-07 Doug Kwan <dougkwan@google.com>
9874
9875 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
9876 if section is marked as containing instructions but has no mapping
9877 symbols.
9878 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
9879 correct section index.
9880 (Arm_relobj::find_linked_text_section): Ditto.
9881
9882 2010-04-07 Cary Coutant <ccoutant@google.com>
9883
9884 * archive.cc (include_member): Destroy Read_symbols_data object before
9885 releasing file.
9886 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
9887 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
9888 (Read_symbols_data::~Read_symbols_data) New destructor.
9889 (Section_relocs::Section_relocs) New constructor.
9890 (Section_relocs::~Section_relocs) New destructor.
9891 (Read_relocs_data::Read_relocs_data) New constructor.
9892 (Read_relocs_data::~Read_relocs_data) New destructor.
9893 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
9894 pointers to NULL after deleting.
9895
9896 2010-04-07 Doug Kwan <dougkwan@google.com>
9897
9898 * arm.cc: Replace "endianity" with "endianness" in comments.
9899 (Arm_exidx_cantunwind): Ditto.
9900 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
9901 (Arm_relobj::merge_flags_and_attributes): New method.
9902 (Arm_relobj::merge_flags_and_attributes_): New data member.
9903 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
9904 (Arm_relobj::scan_sections_for_stubs): Ditto.
9905 (Arm_relobj::do_read_symbols): Check to see if we really want to
9906 merge processor-specific flags and attributes. Exit early if
9907 an object is empty except for section names and the undefined symbol.
9908 (Target_arm::do_finalize_sections): Move check for ELF format to
9909 Arm_relobj::do_read_symbols. Merge processor specific flags and
9910 attributes from a regular object only when we have determined that
9911 it is aapropriate. Do not create an .ARM.attributes section in
9912 output if there is no regular input object.
9913 (Target_arm::merge_processor_specific_flags): Check
9914 --warn-mismatch before printing any error.
9915 (Target_arm::merge_object_attributes): Ditto.
9916 * gold.cc (queue_middle_tasks): Handle the case in which there is
9917 no regular object in input.
9918 * options.cc (General_options::parse_EB): New method.
9919 (General_options::parse_EL): Same.
9920 (General_options::General_options): Initialize endianness_.
9921 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
9922 New options.
9923 (General_options::Endianness): New enum.
9924 (General_options::endianness): New method.
9925 (General_options::endianness_): New data member.
9926 * parameters.cc (Parameters::set_options): Check target endianness.
9927 (Parameters::set_target_once): Ditto.
9928 (Parameters::check_target_endianness): New method.
9929 (parameters_force_valid_target): If either -EL or -EB is specified,
9930 use it to define endianness of default target.
9931 * parameters.h (Parameters::check_target_endianness): New method
9932 declaration.
9933 * target.h (class Target): Change "endianity" to "endianness"
9934 in comments.
9935
9936 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9937
9938 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
9939 * configure: Regenerate.
9940 * Makefile.in: Regenerate.
9941 * testsuite/Makefile.in: Regenerate.
9942
9943 2010-04-06 Cary Coutant <ccoutant@google.com>
9944
9945 gcc PR lto/42757
9946 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
9947 prevailing definitions of common symbols.
9948 * testsuite/plugin_test_6.sh: New test case.
9949 * testsuite/plugin_common_test_1.c: New test case.
9950 * testsuite/plugin_common_test_2.c: New test case.
9951 * testsuite/Makefile.am (plugin_test_6): New test case.
9952 * testsuite/Makefile.in: Regenerate.
9953
9954 2010-04-06 Nick Clifton <nickc@redhat.com>
9955
9956 * po/vi.po: New Vietnamese translation.
9957
9958 2010-03-30 Doug Kwan <dougkwan@google.com>
9959
9960 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
9961
9962 2010-03-25 Doug Kwan <dougkwan@google.com>
9963
9964 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
9965 to avoid a conversion warning on a 32-bit host.
9966
9967 2010-03-24 Ian Lance Taylor <iant@google.com>
9968
9969 * testsuite/script_test_3.t: Add a TLS segment.
9970 * testsuite/Makefile.am (check_PROGRAMS): Add
9971 tls_phdrs_script_test.
9972 (tls_phdrs_script_test_SOURCES): Define.
9973 (tls_phdrs_script_test_DEPENDENCIES): Define.
9974 (tls_phdrs_script_test_LDFLAGS): Define.
9975 (tls_phdrs_script_test_LDADD): Define.
9976 * testsuite/Makefile.in: Rebuild.
9977
9978 2010-03-23 Cary Coutant <ccoutant@google.com>
9979
9980 * fileread.cc (find_or_make_view): Fix comment.
9981
9982 2010-03-23 Ian Lance Taylor <iant@google.com>
9983
9984 * script-sections.cc (class Orphan_section_placement): Define
9985 PLACE_TLS and PLACE_TLS_BSS.
9986 (Orphan_section_placement::Orphan_section_placement): Initialize
9987 new places.
9988 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9989 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9990 (tls_script_test_SOURCES): Define.
9991 (tls_script_test_DEPENDENCIES): Define.
9992 (tls_script_test_LDFLAGS): Define.
9993 (tls_script_test_LDADD): Define.
9994 * testsuite/Makefile.in: Rebuild.
9995
9996 2010-03-22 Doug Kwan <dougkwan@google.com>
9997
9998 * arm.cc (Arm_relocate_functions::abs8,
9999 Arm_relocate_functions::abs16): Use correct check for overflow
10000 specified in the ARM ELF specs.
10001 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
10002 target of a BLX instruction specially.
10003 (Reloc_stub::stub_type_for_reloc): Ditto.
10004 (Relocate::relocate): Use symbolic names instead of numeric relocation
10005 codes to report error.
10006 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10007 workaround.
10008 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10009 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10010 thumb2_blx_out_of_range.stdout
10011 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10012 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10013 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10014 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10015 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10016 thumb2_blx_in_range, thumb2_blx_in_range.o,
10017 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10018 thumb2_blx_out_of_range.o): New rules.
10019 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10020 thumb2_blx_in_range and thumb2_blx_out_of_range.
10021 * testsuite/Makefile.in: Regenerate.
10022 * arm_branch_in_range.sh: Add tests for THUMB BLX.
10023 * testsuite/thumb_blx_in_range.s: New file.
10024 * testsuite/thumb_blx_out_of_range.s: New file.
10025
10026 2010-03-22 Rafael Espindola <espindola@google.com>
10027
10028 * archive.cc (Should_include): Move to archive.h.
10029 (should_include_member): Make it a member of Archive.
10030 (Lib_group): New.
10031 (Add_lib_group_symbols): New.
10032 * archive.h: Include options.h.
10033 (Archive_member): Moved from Archive.
10034 (Should_include): Moved from archive.cc.
10035 (Lib_group): New.
10036 (Add_lib_group_symbols): New.
10037 * dynobj.cc (do_should_include_member): New.
10038 * dynobj.h (do_should_include_member): New.
10039 * gold.cc (queue_initial_tasks): Update call to queue.
10040 * main.cc (main): Print lib group stats.
10041 * object.cc (do_should_include_member): New.
10042 * object.h: Include archive.h.
10043 (Object::should_include_member): New.
10044 (Object::do_should_include_member): New.
10045 (Sized_relobj::do_should_include_member): New.
10046 * options.cc (General_options::parse_start_lib): New.
10047 (General_options::parse_end_lib): New.
10048 (Input_arguments::add_file): Handle lib groups.
10049 (Input_arguments::start_group): Check we are not in a lib.
10050 (Input_arguments::start_lib): New.
10051 (Input_arguments::end_lib): New.
10052 * options.h (General_options): Add start_lib and end_lib.
10053 (Input_argument::lib_): New.
10054 (Input_argument::lib): New.
10055 (Input_argument::is_lib): New.
10056 (Input_file_lib): New.
10057 (Input_arguments::in_lib_): New.
10058 (Input_arguments::in_lib): New.
10059 (Input_arguments::start_lib): New.
10060 (Input_arguments::end_lib_): New.
10061 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10062 in unused members as preempted.
10063 (Sized_pluginobj::do_should_include_member): New.
10064 * plugin.h (Sized_pluginobj::do_should_include_member): New.
10065 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10066 return the blocker.
10067 (Read_symbols::do_whole_lib_group): New.
10068 (Read_symbols::do_lib_group): New.
10069 (Read_symbols::do_read_symbols): Handle lib groups.
10070 (Read_symbols::get_name): Handle lib groups.
10071 * readsyms.h (Read_symbols): Add an archive member pointer.
10072 (Read_symbols::do_whole_lib_group): New.
10073 (Read_symbols::do_lib_group): New.
10074 (Read_symbols::member_): New.
10075 * script.cc (read_input_script): Update call to queue_soon.
10076
10077 2010-03-19 Doug Kwan <dougkwan@google.com>
10078
10079 * arm.cc (Stub_table::Stub_table): Initialize new data members
10080 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10081 (Stub_table::add_reloc_stub): Assign stub offset and update
10082 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10083 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10084 New data members.
10085 (Stub_table::update_data_size_and_addralign): Use
10086 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10087 instead of going over all reloc stubs.
10088 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10089 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10090 Stringpool_template::offset_ to size of Stringpool_char.
10091 (Stringpool_template::new_key_offset): Remove code to initialize
10092 Stringpool_template::offset_.
10093 * stringpool.h (Stringpool_template::set_no_zero_null): Set
10094 Stringpool_template::offset_ to zero.
10095
10096 2010-03-15 Doug Kwan <dougkwan@google.com>
10097
10098 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10099 offset_.
10100 (Stringpool_template::new_key_offset): New method.
10101 (Stringpool_template::add_string): Assign offsets when adding new
10102 strings.
10103 (Stringpool_template::set_string_offsets): Do not set string offsets
10104 when not optimizing.
10105 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10106 member size_.
10107 (Chunked_vector::clear): Clear size_.
10108 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10109 (Chunked_vector::size): Return size_.
10110 (Chunked_vector::push_back): Use size_ to find insert position.
10111 (Chunked_vector::size_): New data member.
10112 (Stringpool_template::set_no_zero_null): Assert string set is empty.
10113 (Stringpool_template::new_key_offset): New method declaration.
10114 (Stringpool_template::offset_): New data member.
10115
10116 2010-03-15 Rafael Espindola <espindola@google.com>
10117
10118 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10119 Add_symbols' constructor.
10120 * readsyms.h (Add_symbols): Remove the input_group member.
10121
10122 2010-03-10 Ian Lance Taylor <iant@google.com>
10123
10124 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10125 target to ask whether a reference to a symbol requires a stack
10126 split.
10127 * target.h (Target::is_call_to_non_split): New function.
10128 (Target::do_is_call_to_non_split): Declare virtual function.
10129 * target.cc: Include "symtab.h".
10130 (Target::do_is_call_to_non_split): New function.
10131 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10132
10133 2010-03-10 Cary Coutant <ccoutant@google.com>
10134
10135 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10136 (File_read::open[1]): Remove initial mapping of whole_file_view_.
10137 (File_read::open[2]): Add whole_file_view_ to list of views.
10138 (File_read::make_view): Remove test of whole_file_view_.
10139 (File_read::find_or_make_view): Create whole_file_view_ if
10140 necessary.
10141 (File_read::clear_views): Replace bool parameter with enum;
10142 adjust all callers. Don't delete views with permanent data;
10143 do delete cached views and views from archives if
10144 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
10145 if clearing the corresponding view.
10146 * fileread.h (File_read::Clear_views_mode): New enum.
10147 (File_read::View::is_permanent_view): New method.
10148 (File_read::clear_views): Replace bool parameter
10149 with enum; adjust all callers.
10150 * options.h (General_options): Change keep_files_mapped option;
10151 add map_whole_files.
10152 * readsyms.cc (Add_symbols::run): Delete sd_ object before
10153 releasing the file.
10154 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10155 the file.
10156
10157 2010-03-10 David S. Miller <davem@davemloft.net>
10158
10159 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10160
10161 2010-03-09 Sriraman Tallam <tmsriram@google.com>
10162
10163 * icf.cc (get_section_contents): Add '@' marker after processing the
10164 merge reloc.
10165
10166 2010-03-08 Doug Kwan <dougkwan@google.com>
10167
10168 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10169 due to a conversion warning.
10170 (Arm_relobj::update_output_local_symbol_count): Check for local
10171 symbol with unset output index.
10172
10173 2010-03-05 Ian Lance Taylor <iant@google.com>
10174
10175 * options.h (class General_options): Add --spare-dynamic-tags.
10176 * output.cc (Output_data_dynamic::set_final_data_size): Implement
10177 --spare-dynamic-tags.
10178
10179 2010-03-05 Ian Lance Taylor <iant@google.com>
10180
10181 * incremental.cc: Include "libiberty.h".
10182
10183 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
10184
10185 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10186 function, is_info_ member.
10187 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10188 (Versions::Versions): Update caller.
10189 (Versions::define_base_version): Likewise.
10190 (Versions::add_def): Likewise.
10191
10192 2010-03-03 Sriraman Tallam <tmsriram@google.com>
10193
10194 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10195 (Scan::possible_function_pointer_reloc): New function.
10196 (Scan::local_reloc_may_be_function_pointer): Change to call
10197 possible_function_pointer_reloc.
10198 (Scan::global_reloc_may_be_function_pointer): Ditto.
10199 * icf.h (Icf::check_section_for_function_pointers): Change to reject
10200 relocations in ".data.rel.ro._ZTV" section.
10201 * testsuite/icf_safe_so_test.sh: Change to pass i386.
10202 * testsuite/icf_safe_so_test.cc: Ditto.
10203 * testsuite/icf_safe_test.cc: Ditto.
10204 * testsuite/icf_safe_test.sh: Ditto.
10205
10206 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10207 Ian Lance Taylor <iant@google.com>
10208
10209 * target-reloc.h (relocate_section): Check the symbol table index
10210 for -1U before setting the local symbol index.
10211 (scan_relocatable_relocs): If copying the relocation, record that
10212 the local symbol is required.
10213 * object.h (Symbol_value::is_output_symtab_index_set): New
10214 function.
10215 (Symbol_value::may_be_discarded_from_output_symtab): New
10216 function.
10217 (Symbol_value::has_output_symtab_entry): New function.
10218 (Symbol_value::needs_output_symtab_entry): Remove.
10219 (Symbol_value::output_symtab_index): Make sure the symbol index is
10220 set.
10221 (Symbol_value::set_output_symtab_index): Make sure the symbol
10222 index is not set. Make sure the new index is valid.
10223 (Symbol_value::set_must_have_output_symtab_entry): New function.
10224 (Symbol_value::has_output_dynsym_entry): New function.
10225 (Symbol_value::set_output_dynsym_index): Make sure the new index
10226 is valid.
10227 (Sized_relobj::set_must_have_output_symtab_entry): New function.
10228 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10229 local symbol if permitted.
10230 (Sized_relobj::do_finalize_local_symbols): Call
10231 is_output_symtab_index_set rather than needs_output_symtab_entry.
10232 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10233 rather than needs_output_symtab_entry. Call
10234 has_output_dynsym_entry rather than needs_output_dynsym_entry.
10235 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10236 is_output_symtab_index_set rather than needs_output_symtab_entry.
10237 * testsuite/discard_locals_relocatable_test.c: New file.
10238 * testsuite/discard_locals_test.sh: Test -r.
10239 * testsuite/Makefile.am (check_DATA): Add
10240 discard_locals_relocatable_test1.syms,
10241 discard_local_relocatable_test2.syms.
10242 (MOSTLYCLEANFILES): Likewise. Also add
10243 discard_locals_relocatable_test1.lout and
10244 discard_locals_relocatable_test2.out.
10245 (discard_locals_relocatable_test1.syms): New target.
10246 (discard_locals_relocatable_test.o): New target.
10247 (discard_locals_relocatable_test1.out): New target.
10248 (discard_locals_relocatable_test2.syms): New target.
10249 (discard_locals_relocatable_test2.out): New target.
10250 (various): Add missing ../ld-new dependencies.
10251 * testsuite/Makefile.in: Rebuild.
10252
10253 2010-03-03 Nick Clifton <nickc@redhat.com>
10254
10255 * po/fi.po: New Finnish translation.
10256
10257 2010-03-01 Doug Kwan <dougkwan@google.com>
10258
10259 * layout.cc (Layout::Layout): Force section types of .init_array*,
10260 .preinit_array* and .fini_array* sections.
10261 * output.cc (Output_section::Input_section_sort_entry::has_priority):
10262 Fix check of return value of std::string::find.().
10263 (Output_section::Input_section_sort_compare::operator()): Remove
10264 comment about .init_array.
10265 (Output_section::Input_section_sort_init_fini_compare::operator()):
10266 New method.
10267 (Output_section::sort_attached_input_sections): Handle .init_array
10268 and .fini_array specially.
10269 * output.h (Output_section::Inut_section_sort_compare): Update
10270 comment.
10271 (Output_section::Input_section_sort_init_fini_compare): New struct.
10272
10273 2010-02-26 Doug Kwan <dougkwan@google.com>
10274
10275 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10276 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10277 * testsuite/debug_msg.sh: Avoid matching source line number for
10278 use of global variable undef_int.
10279
10280 2010-02-26 Doug Kwan <dougkwan@google.com>
10281
10282 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10283 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10284 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10285 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10286 * options.cc (General_options::General_options): Initialize member
10287 fix_v4bx_.
10288 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10289 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10290 and rm_no_fix_v4bx.stdout
10291 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10292 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10293 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10294 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10295 and arm_no_fix_v4bx.
10296 * Makefile.in: Regenerate.
10297 * testsuite/arm_fix_v4bx.s: New file.
10298 * testsuite/arm_fix_v4bx.sh: Ditto.
10299
10300 2010-02-24 Doug Kwan <dougkwan@google.com>
10301
10302 * arm.cc (Target_arm::got_section): Make the .got section the first
10303 non RELRO section in the data segment.
10304 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10305 suffixes of section names.
10306
10307 2010-02-24 Doug Kwan <dougkwan@google.com>
10308
10309 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10310 flags and attributes merging if an input file is a binary file.
10311 * fileread.cc (Input_file::open): Record format of original file.
10312 * fileread.h (Input_file::Format): New enum type.
10313 (Input_file::Input_file): Initialize data member format_.
10314 (Input_file::format): New method definition.
10315 (Input_file::format_):: New data member.
10316
10317 2010-02-24 Doug Kwan <dougkwan@google.com>
10318
10319 * arm.cc (Arm_output_data_got): New class.
10320 (ARM_TCB_SIZE): New constant
10321 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10322 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10323 If user uses a script with a SECTIONS clause, issue only a warning
10324 for a misplaced EXIDX input section. Otherwise, issue an error.
10325 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10326 garbage collection.
10327 (Target_arm::got_mode_index_entry): Handle static linking.
10328 (Target_arm::Scan::local): Ditto.
10329 (Target_arm::Scan::global): Ditto.
10330 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
10331 all incorrectly implemented relocations.
10332 (Target_arm::fix_exidx_coverage): Pass layout to
10333 Arm_output_section::fix_exidx_coverage.
10334 * layout.cc (Layout::section_name_mapping): Remove trailing dots
10335 from ".ARM.exidx." and ".ARM.extab.".
10336
10337 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10338
10339 * arm.cc (Target_arm::do_finalize_sections): Create attribute
10340 section if it does not already exist.
10341 * attributes.cc (Attributes_section_data::Attributes_section_data):
10342 Don't crash if size is zero.
10343
10344 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10345 Ian Lance Taylor <iant@google.com>
10346
10347 * gold.cc (queue_middle_tasks): If no input files were opened,
10348 exit.
10349 * workqueue.h (Task_function::Task_function): Assert that there is
10350 a blocker.
10351
10352 2010-02-22 Doug Kwan <dougkwan@google.com>
10353
10354 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10355 * icf.cc (get_section_contents): Cast snprintf arguments to long long
10356 types to avoid warnings due to different uint64_t implementations
10357 on different hosts.
10358
10359 2010-02-21 Doug Kwan <dougkwan@google.com>
10360
10361 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10362 handling of the maximum backward branch offset.
10363 (Arm_relocate_functions::thumb_branch_common): Ditto.
10364 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10365 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10366 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10367 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10368 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10369 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10370 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10371 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10372 thumb_bl_out_of_range thumb_bl_out_of_range.o,
10373 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10374 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10375 thumb2_bl_out_of_range.o): New rules.
10376 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10377 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10378 thumb2_bl_out_of_range
10379 * testsuite/Makefile.in: Regenerate.
10380 * testsuite/arm_bl_in_range.s: New file.
10381 * testsuite/arm_bl_out_of_range.s: Ditto.
10382 * testsuite/arm_branch_in_range.sh: Ditto.
10383 * testsuite/arm_branch_range.t: Ditto.
10384 * testsuite/thumb2_branch_range.t: Ditto.
10385 * testsuite/thumb_bl_in_range.s: Ditto.
10386 * testsuite/thumb_bl_out_of_range.s: Ditto.
10387 * testsuite/thumb_branch_range.t: Ditto.
10388
10389 2010-02-20 Sriraman Tallam <tmsriram@google.com>
10390
10391 * gc.h (gc_process_relocs): Change vectors to point to the new list.
10392 Add reloc offset information.
10393 * icf.cc (get_section_contents): Change iterators to point to the new
10394 vectors. Add reloc offset information to the contents.
10395 * icf.h (Icf::Sections_reachable_info): New typedef.
10396 (Icf::Sections_reachable_list): New typedef.
10397 (Icf::Offset_info): New typedef.
10398 (Icf::Reloc_info): New struct typedef.
10399 (Icf::Reloc_info_list): New typedef.
10400 (Icf::symbol_reloc_list): Delete method.
10401 (Icf::addend_reloc_list): Delete method.
10402 (Icf::section_reloc_list): Delete method.
10403 (Icf::reloc_info_list): New method.
10404 (Icf::reloc_info_list_): New member.
10405
10406 2010-02-19 Doug Kwan <dougkwan@google.com>
10407
10408 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10409 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10410 * arm.cc (Arm_relocation_functions): New forward declaration.
10411 (Target_arm::Target_arm): Initialize new data members
10412 got_mod_index_offset_ and tls_base_symbol_defined_.
10413 (Target_arm::Relocate::relocate_tls): New method.
10414 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10415 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10416 New methods.
10417 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10418 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10419 (Target_arm::got_mod_index_offset_,
10420 Target_arm::tls_base_symbol_defined_): New data members.
10421 (Target_arm::Scan::local, Target::Scan::global,
10422 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10423 relocations.
10424
10425 2010-02-18 Doug Kwan <dougkwan@google.com>
10426
10427 * arm.cc (Arm_relobj::find_linked_text_section): New method.
10428 (Arm_relobj::make_exidx_input_section): Pass section index of linked
10429 text section as a parameter becuase some broken tools may not set
10430 the link in section header.
10431 (Target_arm::has_got_section): New method.
10432 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10433 without any mapping symbol as data only. Remove warning.
10434 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10435 link in its section header, try to discover the link by inspecting the
10436 REL31 relocation at the beginning of the section.
10437 (Target_arm::Scan::check_non_pic): Report name of offending relocation
10438 in error message.
10439 (Target_arm::Scan::global): Treat any reference to the symbol
10440 _GLOBAL_OFFSET_TABLE_ as a GOT access.
10441
10442 2010-02-12 Sriraman Tallam <tmsriram@google.com>
10443
10444 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10445 (Scan::global_reloc_may_be_function_pointer): New function.
10446 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10447 (Scan::global_reloc_may_be_function_pointer): New function.
10448 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10449 (Scan::global_reloc_may_be_function_pointer): New function.
10450 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10451 (Scan::global_reloc_may_be_function_pointer): New function.
10452 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10453 (Scan::global_reloc_may_be_function_pointer): New function.
10454 (Scan::possible_function_pointer_reloc): New function.
10455 (Target_x86_64::can_check_for_function_pointers): New function.
10456 * gc.h (gc_process_relocs): Scan relocation types to determine if
10457 function pointers were taken for targets that support it.
10458 * icf.cc (Icf::find_identical_sections): Include functions for
10459 folding in safe ICF whose pointer is not taken.
10460 * icf.h (Secn_fptr_taken_set): New typedef.
10461 (fptr_section_id_): New member.
10462 (section_has_function_pointers): New function.
10463 (set_section_has_function_pointers): New function.
10464 (check_section_for_function_pointers): New function.
10465 * options.h: Fix comment for safe ICF option.
10466 * target.h (can_check_for_function_pointers): New function.
10467 * testsuite/Makefile.am: Add icf_safe_so_test test case.
10468 Modify icf_safe_test for X86-64.
10469 * testsuite/Makefile.in: Regenerate.
10470 * testsuite/icf_safe_so_test.cc: New file.
10471 * testsuite/icf_safe_so_test.sh: New file.
10472 * testsuite/icf_safe_test.cc (kept_func_3): New function.
10473 (main): Change to take pointer to function kept_func_3.
10474 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10475 folding is done correctly for X86-64.
10476
10477 2010-02-12 David S. Miller <davem@davemloft.net>
10478
10479 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10480 is_symbolless parameter.
10481 (Output_reloc<SHT_REL>::is_symbolless): New.
10482 (Output_reloc<SHT_REL>::is_symbolless_): New.
10483 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10484 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10485 (Output_reloc<SHT_RELA>::is_symbolless): New.
10486 (Output_data_reloc::add_global): Handle is_symbolless.
10487 (Output_data_reloc::add_global_relative): Likewise.
10488 (Output_data_reloc::add_local): Likewise.
10489 (Output_data_reloc::add_local_relative): Likewise.
10490 (Output_data_reloc::add_symbolless_global_addend): New.
10491 (Output_data_reloc::add_symbolless_local_addend): New.
10492 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10493 is_symbolless.
10494 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10495 instead of ->is_relative_
10496 (Output_reloc::write): Likewise.
10497 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10498 (Output_reloc::write_rel): Simplify.
10499
10500 * sparc.cc (Target_sparc::Scan::local): Use
10501 ->add_symbolless_local_addend as needed.
10502 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10503 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
10504 based upon relocation offset.
10505
10506 2010-02-11 Doug Kwan <dougkwan@google.com>
10507
10508 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10509 (Target_arm::Scan::global): Ditto. Also remove a comment before the
10510 beginning of function.
10511 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10512 and MOVT_ABS relocations. Those are non issued in scanning. Fix
10513 parameter is_32bit in calls to should_apply_static_reloc.
10514 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10515 (check_DATA): Add arm_abs_global.stdout.
10516 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10517 arm_abs_global.stdout): New rules.
10518 (MOSTLLYCLEANFILES): Add arm_abs_global
10519 * Makefile.in: Regenerate.
10520 * testsuite/arm_abs_global.s: New file.
10521 * testsuite/arm_abs_global.sh: Ditto.
10522 * testsuite/arm_abs_lib.s: Ditto.
10523
10524 2010-02-11 Ian Lance Taylor <iant@google.com>
10525
10526 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10527 Read_relocs task.
10528 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
10529 Allocate_commons_task first.
10530 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10531 task, rather than symtab_lock_.
10532 (Gc_process_relocs::~Gc_process_relocs): New function.
10533 (Gc_process_relocs::is_runnable): Check this_blocker_.
10534 (Gc_process_relocs::locks): Use next_blocker_ rather than
10535 blocker_.
10536 (Scan_relocs::~Scan_relocs): New function.
10537 (Scan_relocs::is_runnable): Check this_blocker_ rather than
10538 symtab_lock_.
10539 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
10540 next_blocker_.
10541 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10542 fields. Add this_blocker_ and next_blocker_ fields. Adjust
10543 constructor accordingly.
10544 (class Gc_process_relocs): Likewise.
10545 (class Scan_relocs): Likewise.
10546 * common.h (class Allocate_commons_task): Remove symtab_lock_
10547 field, and corresponding constructor parameter.
10548 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10549 symtab_lock_.
10550 (Allocate_commons_task::locks): Likewise.
10551
10552 2010-02-11 Ian Lance Taylor <iant@google.com>
10553
10554 * gold-threads.h (class Once): Define.
10555 (class Initialize_lock): Rewrite as child of Once.
10556 * gold-threads.cc (class Once_initialize): Define.
10557 (once_pointer_control): New static variable.
10558 (once_pointer, once_arg): New static variables.
10559 (c_run_once): New static function.
10560 (Once::Once, Once::run_once, Once::internal_run): New functions.
10561 (class Initialize_lock_once): Remove.
10562 (initialize_lock_control): Remove.
10563 (initialize_lock_pointer): Remove.
10564 (initialize_lock_once): Remove.
10565 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10566 (Initialize_lock::initialize): Rewrite.
10567 (Initialize_lock::do_run_once): New function.
10568 * archive.cc (Archive::interpret_header): Only clear name if it is
10569 not already empty.
10570 * fileread.cc: Include "gold-threads.h"
10571 (file_counts_lock): New static variable.
10572 (file_counts_initialize_lock): Likewise.
10573 (File_read::release): Only increment counts when using --stats.
10574 Use a lock around the increment.
10575 * parameters.cc (class Set_parameters_target_once): Define.
10576 (set_parameters_target_once): New static variable.
10577 (Parameters::Parameters): Move here from parameters.h.
10578 (Parameters::set_target): Rewrite.
10579 (Parameters::set_target_once): New function.
10580 (Parameters::clear_target): Move here and rewrite.
10581 * parameters.h (class Parameters): Update declarations. Add
10582 set_parameters_target_once_ field.
10583 (Parameters::Parameters): Move to parameters.cc.
10584 (Parameters::clear_target): Likewise.
10585 * readsyms.cc (Read_symbols::do_group): Create a Start_group
10586 task.
10587 (Start_group::~Start_group): New function.
10588 (Start_group::is_runnable): New function.
10589 (Start_group::locks, Start_group::run): New functions.
10590 (Finish_group::run): Change saw_undefined to size_t.
10591 * readsyms.h (class Start_group): Define.
10592 (class Finish_group): Change saw_undefined_ field to size_t.
10593 (Finish_group::Finish_group): Remove saw_undefined and
10594 this_blocker parameters. Change all callers.
10595 (Finish_group::set_saw_undefined): New function.
10596 (Finish_group::set_blocker): New function.
10597 * symtab.h (class Symbol_table): Change saw_undefined to return
10598 size_t. Change saw_undefined_ field to size_t.
10599 * target-select.cc (Set_target_once::do_run_once): New function.
10600 (Target_selector::Target_selector): Initialize set_target_once_
10601 field. Don't initialize lock_ and initialize_lock_ fields.
10602 (Target_selector::instantiate_target): Rewrite.
10603 (Target_selector::set_target): New function.
10604 * target-select.h (class Set_target_once): Define.
10605 (class Target_selector): Update declarations. Make
10606 Set_target_once a friend. Remove lock_ and initialize_lock_
10607 fields. Add set_target_once_ field.
10608
10609 2010-02-10 Ian Lance Taylor <iant@google.com>
10610
10611 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10612 queueing any tasks.
10613 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
10614 (queue_middle_tasks): Add all blockers before queueing any tasks.
10615 (queue_final_tasks): Likewise.
10616 * token.h (Task_token::add_blockers): New function.
10617 * object.h (Input_objects::number_of_relobjs): New function.
10618
10619 2010-02-10 Ian Lance Taylor <iant@google.com>
10620
10621 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10622 shared, not if not position independent.
10623 * x86_64.cc (Relocate::relocate_tls): Likewise.
10624 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10625 (tls_pie_pic_test): New target.
10626 * testsuite/Makefile.in: Rebuild.
10627
10628 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10629 (tls_test_main_pie.o, tls_test_pie.o): New targets.
10630 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10631 * testsuite/Makefile.in: Rebuild.
10632
10633 2010-02-09 David S. Miller <davem@davemloft.net>
10634
10635 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10636 R_SPARC_RELATIVE using ->add_local_relative().
10637 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10638
10639 * output.h (Output_data_dynamic::add_section_size): New method
10640 that takes two Output_data objects.
10641 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10642 entry param. Handle it in initializers.
10643 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10644 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10645 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10646 arg.
10647 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10648 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10649 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10650 for dynrel_includes_plt.
10651 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10652 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10653 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10654 before .rela.plt
10655 (Target_sparc::do_finalize_sections): Update to pass true for
10656 dynrel_includes_plt.
10657 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10658 output before .rela.plt
10659 (Target_powerpc::do_finalize_sections): Update to pass true for
10660 dynrel_includes_plt when 32-bit.
10661
10662 2010-02-08 Doug Kwan <dougkwan@google.com>
10663
10664 * arm.cc (Arm_relobj::simple_input_section_output_address): New
10665 method.
10666 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10667 Arm_relobj::scan_section_for_cortex_a8_stubs,
10668 Arm_relobj::do_relocation_section): Instead of calling
10669 Output_section::output_address, use faster
10670 Arm_relobj::simple_input_section_output_address.
10671
10672 2010-02-08 David S. Miller <davem@davemloft.net>
10673
10674 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10675 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10676 relocation helper function.
10677
10678 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10679 just like R_SPARC_GOT{10,13,22}.
10680 (Target_sparc::Scan::local): Likewise.
10681 (Target_sparc::Relocate:relocate): Likewise.
10682
10683 2010-02-06 Ian Lance Taylor <iant@google.com>
10684
10685 * configure.ac: Rewrite targetobjs duplicate removal code to use
10686 only shell constructs.
10687 * configure: Rebuild.
10688
10689 2010-02-05 Doug Kwan <dougkwan@google.com>
10690
10691 PR 11247
10692 * arm.cc (Arm_relobj::section_is_scannable): New method.
10693 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10694 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10695
10696 2010-02-04 Doug Kwan <dougkwan@google.com>
10697
10698 PR 11247
10699 * arm-reloc-property.cc (cstdio): Include.
10700 * configure.ac (targetobjs): Remove duplicates.
10701 * configure: Regenerate.
10702 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10703 big and little endian version for a given address size.
10704
10705 2010-02-03 Doug Kwan <dougkwan@google.com>
10706
10707 * arm-reloc-property.cc
10708 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10709 definition.
10710 * arm-reloc-property.h
10711 (Arm_reloc_property_table::get_implemented_static_reloc_property):
10712 New method definition.
10713 (Arm_reloc_property_table::reloc_name_in_error_message): New method
10714 declaration.
10715 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10716 overflow to N.
10717 (GOT_PREL): Change implemented to Y.
10718 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10719 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10720 (Arm_relocate_functions::movw_abs_nc): Remove method.
10721 (Arm_relocate_functions::movt_abs): Ditto.
10722 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10723 (Arm_relocate_functions::thm_movt_abs): Ditto.
10724 (Arm_relocate_functions::movw_rel_nc): Ditto.
10725 (Arm_relocate_functions::movw_rel): Ditto.
10726 (Arm_relocate_functions::movt_rel): Ditto.
10727 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10728 (Arm_relocate_functions:thm_movw_rel): Ditto.
10729 (Arm_relocate_functions:thm_movt_rel): Ditto.
10730 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10731 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10732 New method definitions.
10733 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10734 (Arm_relocation_functions::arm_grp_ldr): Ditto.
10735 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10736 (Arm_relocation_functions::arm_grp_ldc): Ditto.
10737 (Target_arm::Relocate::relocate): Check for non-static or
10738 unimplemented relocation code and exit early. Change calls to
10739 Target_arm::reloc_uses_thumb_bit and
10740 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10741 instead. Refactor code to handle similar relocations to increase
10742 code sharing. Remove check for unsupported relocation code in switch
10743 statement.
10744 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10745 relocation property table to find out size. Change error message to
10746 print out the name of a relocation code instead of the numeric value.
10747 (Target_arm::scan_reloc_for_stub): Use relocation property table
10748 instead of calling Target_arm::reloc_uses_thumb_bit().
10749
10750 2010-02-02 Doug Kwan <dougkwan@google.com>
10751
10752 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10753 types of relaxed input section.
10754
10755 2010-02-02 Doug Kwan <dougkwan@google.com>
10756
10757 * Makefile.am (HFILES): Add arm-reloc-property.h.
10758 (DEFFILES): New.
10759 (TARGETSOURCES): Add arm-reloc-property.cc
10760 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10761 (libgold_a_SOURCES): $(DEFFILES)
10762 * Makefile.in: Regenerate.
10763 * arm-reloc-property.cc: New file.
10764 * arm-reloc-property.h: New file.
10765 * arm-reloc.def: New file.
10766 * arm.cc: Update comments.
10767 (arm-reloc-property.h): New included header.
10768 (arm_reloc_property_table): New global variable.
10769 (Target_arm::do_select_as_default_target): New method definition.
10770 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10771 arm-reloc-property to targ_extra_obj.
10772 * parameters.cc (set_parameters_target): Call
10773 Target::select_as_default_target().
10774 * target.h (Target::select_as_default_target): New method definition.
10775 (Target::do_select_as_default_target): Same.
10776
10777 2010-02-01 Doug Kwan <dougkwan@google.com>
10778
10779 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10780 first_output_text_section_.
10781 (Arm_exidx_fixup::first_output_text_section): New method definition.
10782 (Arm_exidx_fixup::first_output_text_section_): New data member.
10783 (Arm_exidx_fixup::process_exidx_section): Record the first text
10784 output section seen.
10785 (Arm_output_section::fix_exidx_coverage): Set correct linked section
10786 and entsize in output section header.
10787
10788 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10789
10790 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10791 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10792 (Arm_relocate_functions::thm_alu11): New Method.
10793 (Arm_relocate_functions::thm_pc8): New Method.
10794 (Arm_relocate_functions::thm_pc12): New Method.
10795 (Target_arm::Scan::local): Handle the relocations.
10796 (Target_arm::Scan::global): Likewise.
10797 (Target_arm::Relocate::relocate): Likewise.
10798 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10799
10800 2010-01-29 Doug Kwan <dougkwan@google.com>
10801
10802 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
10803 of relocation types as ld.
10804
10805 2010-01-29 Doug Kwan <dougkwan@google.com>
10806
10807 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
10808 to public.
10809 (Arm_relocate_functions::thumb_branch_common): Ditto.
10810 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
10811 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
10812 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
10813 Arm_relocate_functions::jump24): Remove.
10814 (Target_arm::Relocate::relocate): Adjust code to call
10815 Arm_relocation_functions::arm_branch_common and
10816 Arm_relocation_functions::thumb_branch_common instead of their removed
10817 wrappers. Merge switch-cases together to reduce source code size.
10818
10819 2010-01-29 Doug Kwan <dougkwan@google.com>
10820
10821 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
10822 output_local_symbol_count_needs_update_.
10823 (Arm_relobj::output_local_symbol_count_needs_update,
10824 Arm_relobj::set_output_local_symbol_count_needs_update,
10825 Arm_relobj::update_output_local_symbol_count): New methods.
10826 (Arm_relobj::output_local_symbol_count_needs_update_): New data
10827 member.
10828 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
10829 of pointed function as in a R_ARM_PREL31 relocation.
10830 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
10831 for output local symbol count updating.
10832 (Target_arm::do_relax): Update output local symbol counts in objects
10833 if necessary.
10834 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
10835
10836 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10837
10838 * arm.cc: Added support for the ARM relocations:
10839 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
10840 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
10841 (Arm_relocate_functions::movw_rel_nc): Renamed (was
10842 movw_prel_nc).
10843 (Arm_relocate_functions::movw_rel): New method.
10844 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
10845 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
10846 thm_movw_prel_nc).
10847 (Arm_relocate_functions::thm_movw_rel): New method.
10848 (Arm_relocate_functions::thm_movt_rel): Renamed (was
10849 thm_movt_prel).
10850 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
10851 relocations.
10852 (Target_arm::Scan::global): Likewise.
10853 (Target_arm::Relocate::relocate): Likewise.
10854 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10855 Likewise.
10856
10857 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10858
10859 * arm.cc: Added support for ARM group relocations.
10860 (Target_arm::reloc_needs_sym_origin): New method.
10861 (Arm_relocate_functions::calc_grp_kn): New method.
10862 (Arm_relocate_functions::calc_grp_residual): New method.
10863 (Arm_relocate_functions::calc_grp_gn): New method.
10864 (Arm_relocate_functions::arm_grp_alu): New Method.
10865 (Arm_relocate_functions::arm_grp_ldr): New Method.
10866 (Arm_relocate_functions::arm_grp_ldrs): New Method.
10867 (Arm_relocate_functions::arm_grp_ldc): New Method.
10868 (Target_arm::Scan::local): Handle the ARM group relocations.
10869 (Target_arm::Scan::global): Likewise.
10870 (Target_arm::Relocate::relocate): Likewise.
10871 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10872 Likewise.
10873
10874 2010-01-26 Doug Kwan <dougkwan@google.com>
10875
10876 * arm.cc (set): Include.
10877 (class Arm_exidx_fixup): Change type of last_input_section_ to const
10878 pointer type.
10879 (Arm_output_section::Text_section_list): New type.
10880 (Arm_output_section::append_text_sections_to_list): New method.
10881 (Arm_output_section::fix_exidx_coverage): Ditto.
10882 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
10883 (Arm_relobj::convert_input_section_to_relaxed_section): Use
10884 Relobj::set_section_offset() instead of
10885 Sized_relobj::invalidate_section_offset().
10886 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
10887 parameter for section headers. Ignore relocation sections for
10888 unallocated sections and EXIDX sections.
10889 (Target_arm::fix_exidx_coverage): New method.
10890 (Target_arm::output_section_address_less_than): New type.
10891 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
10892 linked text section instead of the EXIDX section.
10893 (Arm_output_section::create_stub_group): Add an assertion to check
10894 that this is not an EXIDX output section.
10895 (Arm_output_section::append_text_sections_to_list): New method.
10896 (Arm_output_section::fix_exidx_coverage): Ditto.
10897 (Arm_relobj::scan_sections_for_stubs): Adjust call to
10898 Arm_relobj::section_needs_reloc_stub_scanning.
10899 (Target_arm::do_relax): Fix EXIDX output section coverage in the
10900 first pass.
10901 (Target_arm::fix_exidx_coverage): New method.
10902 * object.h (Relobj::set_output_section): New method.
10903 (Sized_relobj::invalidate_section_offset): Remove method.
10904 (Sized_relobj::do_invalidate_section_offset): Remove method.
10905 (Sized_relobj::do_set_section_offset): Handle offset value -1.
10906
10907 2010-01-25 Doug Kwan <dougkwan@google.com>
10908
10909 * arm.cc (Arm_exidx_merged_section::do_output_offset):
10910 Fix warning due to signed and unsigned comparison on a 32-bit host.
10911
10912 2010-01-22 Doug Kwan <dougkwan@google.com>
10913
10914 * arm.cc (Target_arm::do_relax): Record an output section for section
10915 offset adjustment it contains any stub table that has changed.
10916 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
10917 offsets in an output section if necessary.
10918 * output.cc (Output_section::Output_section): Initialize
10919 section_offsets_need_adjustments_.
10920 (Output_section::add_input_section_for_script): Renamed to
10921 Output_section::add_simple_input_section.
10922 (Output_section::save_states): Add a comment.
10923 (Output_section::discard_states): New method defintion.
10924 (Output_section::adjust_section_offsets): Same.
10925 * output.h (Output_section::add_input_section_for_script): Renamed to
10926 Output_section::add_simple_input_section.
10927 (Output_section::discard_states): New method declaration.
10928 (Output_section::adjust_section_offsets): Same.
10929 (Output_section::section_offsets_need_adjustment,
10930 Output_section::set_section_offsets_need_adjustment): New method
10931 definitions.
10932 (Output_section::section_offsets_need_adjustment_): New data member.
10933 * script-sections.cc
10934 (Output_section_element_input::set_section_address): Adjust code for
10935 renaming of Output_section::add_input_section_for_script.
10936 (Orphan_output_section::set_section_address): Same.
10937
10938 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10939
10940 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
10941 Fix_v4bx enum values .
10942 * gold/options.h (General_options): New option definitions.
10943 (General_options::fix_v4bx): New method.
10944 (General_options::Fix_v4bx): New enum.
10945 * gold/options.cc (General_options::parse_fix_v4bx): New method.
10946 (General_options::parse_fix_v4bx_interworking): New method.
10947
10948 2010-01-22 Doug Kwan <dougkwan@google.com>
10949
10950 * arm.cc (Arm_exidx_fixup): New class.
10951
10952 2010-01-21 Doug Kwan <dougkwan@google.com>
10953
10954 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
10955 classes.
10956 (Arm_exidx_section_offset_map): New type.
10957
10958 2010-01-21 Doug Kwan <dougkwan@google.com>
10959
10960 * arm.cc (Arm_exidx_input_section): New class.
10961 (Arm_relobj::exidx_input_section_by_link,
10962 Arm_relobj::exidx_input_section_by_shndx,
10963 Arm_relobj::make_exidx_input_section): New methods.
10964 (read_arm_attributes_section): Remove.
10965 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
10966 information about them.
10967 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
10968 to here.
10969
10970 2010-01-20 Doug Kwan <dougkwan@google.com>
10971
10972 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10973 Input_section_specifier to Section_id.
10974 (Target_arm::new_arm_input_section: Adjust code for change of key
10975 type.
10976 (Target_arm::find_arm_input_section): Ditto.
10977 * gc.h (object.h): Include for Section_id nand Section_id_hash.
10978 (Section_id): Remove.
10979 (Garbage_collection::Section_id_hash): Remove.
10980 * icf.h (object.h): Include for Section_id nand Section_id_hash.
10981 (Section_id): Remove.
10982 (Icf::Section_id_hash): Remove.
10983 * object.h (Section_id, Const_section_id, Section_id_hash,
10984 Const_section_id_hash): New type definitions.
10985 * output.cc (Output_section::add_relaxed_input_section): Change to
10986 use Const_section_id instead of Input_section_specifier as key type.
10987 (Output_section::add_merge_input_section): Ditto.
10988 (Output_section::build_relaxation_map): Change to use Section_id
10989 instead of Input_section_specifier as key type.
10990 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10991 Ditto.
10992 (Output_section::convert_input_sections_to_relaxed_sections): Change
10993 to use Const_section_id instead of Input_section_specifier as key type.
10994 (Output_section::find_merge_section): Ditto.
10995 (Output_section::find_relaxed_input_section): Ditto.
10996 * output.h (Input_section_specifier): Remove class.
10997 (Output_section::Output_section_data_by_input_section_map): Change
10998 key type to Const_section_id.
10999 (Output_section::Output_relaxed_input_section_by_input_section_map):
11000 Ditto.
11001 (Output_section::Relaxation_map): Change key type to Section_id.
11002
11003 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11004
11005 * gold/arm.cc: Added support for R_ARM_V4BX relocation
11006 (class Arm_v4bx_stub): New class.
11007 (DEF_STUBS): Updated definition to support v4_veneer_bx.
11008 (Stub_factory::make_arm_v4bx_stub): New method.
11009 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11010 (Stub_table::empty): Handle v4bx stubs.
11011 (Stub_table::add_arm_v4bx_stub): New method.
11012 (Stub_table::find_arm_v4bx_stub): New method.
11013 (Arm_relocate_functions::v4bx): New method.
11014 (Target_arm::fix_v4bx): New method.
11015 (Target_arm::Target_arm): Handle R_ARM_V4BX.
11016 (Stub_table::relocate_stubs): Likewise.
11017 (Stub_table::do_write): Likewise.
11018 (Stub_table::update_data_size_and_addralign): Likewise.
11019 (Stub_table::finalize_stubs): Likewise.
11020 (Target_arm::Scan::local): Likewise.
11021 (Target_arm::Scan::global): Likewise.
11022 (Target_arm::do_finalize_sections): Likewise.
11023 (Target_arm::Relocate::relocate): Likewise.
11024 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11025 Likewise.
11026 (Target_arm::scan_reloc_for_stub): Likewise.
11027 (Target_arm::scan_reloc_section_for_stubs): Likewise.
11028
11029 2010-01-19 Ian Lance Taylor <iant@google.com>
11030
11031 * output.cc (Output_section_headers::do_sized_write): Write large
11032 segment count to sh_info field.
11033 (Output_file_header::do_sized_write): For large segment count,
11034 write PN_XNUM to e_phnum field.
11035
11036 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11037
11038 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11039 (Arm_relocate_functions::thm_jump8): New function.
11040 (Arm_relocate_functions::thm_jump11): New function.
11041 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11042 R_ARM_THM_JUMP11.
11043 (Target_arm::Scan::global): Likewise.
11044 (Target_arm::Relocate::relocate): Likewise.
11045 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11046 Likewise.
11047
11048 2010-01-14 Doug Kwan <dougkwan@google.com>
11049
11050 * arm.cc (map, utility): Include headers.
11051 (Target_arm::apply_cortex_a8_workaround): New method.
11052 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11053 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11054 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11055 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11056 the --[no-]fix-cortex-a8 command line options.
11057 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11058 (Target_arm::relocate_stub): Use addend in instruction template.
11059 * options.h (DEFINE_bool): Set the user-set flag.
11060 (General_options): Add --[no-]-fix-cortex options.
11061 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11062 : Update fast look-up map after conversion.
11063
11064 2010-01-14 Sriraman Tallam <tmsriram@google.com>
11065
11066 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11067 in the first pass of do_layout.
11068
11069 2010-01-13 Doug Kwan <dougkwan@google.com>
11070
11071 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11072 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11073 apparent compiler problem of not folding static constant integral
11074 data members of elfcpp::Elf_sizes<32>.
11075
11076 2010-01-13 Doug Kwan <dougkwan@google.com>
11077
11078 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11079 Arm_relobj::section_needs_cortex_a8_stub_scanning,
11080 Arm_relobj::scan_section_for_cortex_a8_erratum,
11081 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11082 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11083 sections to scan for relocation stubs into a new method
11084 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
11085 relocation and Cortex-A8 stub scanning.
11086 (Target_arm::do_relax): Force stubs to be after stubbed sections
11087 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
11088 the beginning of a new relaxation pass. Update a comment.
11089 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11090
11091 2010-01-12 Ian Lance Taylor <iant@google.com>
11092
11093 * target-reloc.h (visibility_error): New inline function.
11094 (relocate_section): Call visibility_error.
11095 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11096 (MOSTLYCLEANFILES): Likewise.
11097 (protected_4_pic.o, protected_3.err): New targets.
11098 * testsuite/protected_4.cc: New file.
11099
11100 2010-01-12 Doug Kwan <dougkwan@google.com>
11101
11102 * arm.cc (Cortex_a8_reloc): New class.
11103 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11104 and cortex_a8_relocs_info_.
11105 (Target_arm::fix_cortex_a8): New method definition.
11106 (Target_arm::Cortex_a8_relocs_info): New type.
11107 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11108 New data member declarations.
11109 (Target_arm::scan_reloc_for_stub): Record information about
11110 relocations for THUMB branches that might be exempted from the
11111 Cortex-A8 workaround.
11112 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11113 at the beginning of a relaxation pass.
11114
11115 2010-01-12 Doug Kwan <dougkwan@google.com>
11116
11117 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11118 (Arm_relobj::Mapping_symbol_position,
11119 Arm_reloj::Mapping_symbol_position_less,
11120 Arm_relobj::Mapping_symbols_info): New types.
11121 (Target_arm::is_mapping_symbol_name): New method definition.
11122 (Arm_relobj::do_count_local_symbols): Save information about mapping
11123 symbols.
11124
11125 2010-01-11 Doug Kwan <dougkwan@google.com>
11126
11127 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11128 Arm_relocate_functions::thumb32_branch_upper,
11129 Arm_relocate_functions::thumb32_branch_lower,
11130 Arm_relocate_functions::thumb32_cond_branch_offset,
11131 Arm_relocate_functions::thumb32_cond_branch_upper,
11132 Arm_relocate_functions::thumb32_cond_branch_lower,
11133 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11134 branch offset encoding.
11135 (Arm_relocate_functions::thumb_branch_common): Use new branch
11136 offset encoding methods to avoid code duplication.
11137 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11138 (Stub_addend_reader::operator()): Use new branch encoding method
11139 to avoid code duplication.
11140
11141 2010-01-11 Doug Kwan <dougkwan@google.com>
11142
11143 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11144 (Target_arm::do_finalize_sections): Define special EXIDX section
11145 symbols only if referenced.
11146 * gc.h (Garbage_collection::add_reference): New method.
11147 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11148 code duplication.
11149
11150 2010-01-11 Ian Lance Taylor <iant@google.com>
11151
11152 * script.cc (Version_script_info::build_expression_list_lookup):
11153 Change complaing about duplicate wildcard match from error to
11154 warning.
11155
11156 * script.cc (class Lazy_demangler): Recreate--revert part of patch
11157 of 2009-12-30.
11158 (Version_script_info::Version_script_info): Initialize globs_,
11159 default_version_, default_is_global_, and exact_. Don't
11160 initialize globals_ or locals_.
11161 (Version_script_info::build_lookup_tables): Build local symbols
11162 first.
11163 (Version_script_info::unquote): New function.
11164 (Version_script_info::add_exact_match): New function.
11165 (Version_script_info::build_expression_list_lookup): Remove lookup
11166 parameter. Add is_global parameter. Change all callers. Handle
11167 wildcard pattern specially. Unquote pattern. Call
11168 add_exact_match.
11169 (Version_script_info::get_name_to_match): New function.
11170 (Version_script_info::get_symbol_version): New function.
11171 (Version_script_info::get_symbol_version_helper): Remove.
11172 (Version_script_info::check_unmatched_names): Call unquote.
11173 * script.h (class Version_script_info): Change get_symbol_version
11174 to be non-inline and add is_global parameter; change all callers.
11175 Rewrite symbol_is_local. Update declarations. Define struct
11176 Version_tree_match, Exact, Globs. Don't define struct Lookup.
11177 Remove globals_ and locals_ members. Add exact_, globs_,
11178 default_version_, is_global_.
11179 (Version_script_info::Glob): Remove pattern, add expression and
11180 is_global. Update constructor. Change all callers.
11181 * dynobj.cc (Versions::finalize): Mark the version symbol as the
11182 default version.
11183 (Versions::symbol_section_contents): If a symbol is undefined, or
11184 defined in a dynamic object, set the version index to
11185 VER_NDX_LOCAL.
11186 * symtab.cc (Symbol_table::add_from_relobj): Don't call
11187 symbol_is_local.
11188 (Symbol_table::add_from_pluginobj): Likewise.
11189 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11190
11191 2010-01-11 Doug Kwan <dougkwan@google.com>
11192
11193 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11194 (incremental_dump_LDADD): Add linking option for libintl.
11195 * Makefile.in: Regenerate.
11196
11197 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
11198
11199 PR gold/11144
11200 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11201 instead of -Ds.
11202 * testsuite/Makefile.in: Regenerated.
11203
11204 2010-01-10 Doug Kwan <dougkwan@google.com>
11205
11206 * options.h (DEFINE_var): Use parentheses around argument varname__
11207 in macro body to avoid any unintended subsequent substitutions.
11208
11209 2010-01-10 Ian Lance Taylor <iant@google.com>
11210
11211 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11212 candidates before doing symbol resolution.
11213
11214 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11215 ODR candidates if only one is weak.
11216
11217 2010-01-08 Ian Lance Taylor <iant@google.com>
11218
11219 * script.cc (Version_script_info::build_expression_list_lookup):
11220 Don't warn about ambiguous version, just record the ambiguity.
11221 (Version_script_info::get_symbol_version_helper): Give error if
11222 version is ambiguous.
11223
11224 2010-01-08 Doug Kwan <dougkwan@google.com>
11225
11226 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11227 prev_data_size_ and prev_addralign_. Remove initializer for
11228 deleted data member has_been_changed_.
11229 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11230 to determine if the table is empty.
11231 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11232 Remove.
11233 (Stub_table::add_reloc_stub): Define method in class definition
11234 instead of just declaring it there.
11235 (Stub_table::add_cortex_a8_stub): New method definition.
11236 (Stub_table::update_data_size_and_addralign): Ditto.
11237 (Stub_table::finalize_stubs): Ditto.
11238 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11239 (Stub_table::do_addralign_): Return address alignment in the
11240 (Stub_table::do_reset_address_and_file_offset): Define method in
11241 class definition instead of declaring it there. Set current data
11242 size to be the data size of the previous pass.
11243 (Stub_table::set_final_data_size): Use current data size as the
11244 final data size.
11245 (Stub_table::relocate_stub): Change parameter type of stub from
11246 Reloc_stub pointer to Stub pointer.
11247 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11248 (Stub_table::Cortex_a8_stub_list): New typedef.
11249 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11250 Stub_table::prev_addralign_): New data member.
11251 (Arm_relobj::Arm_relobj): Initialize data member
11252 section_has_cortex_a8_workaround_.
11253 (Arm_relobj::section_has_cortex_a8_workaround,
11254 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11255 definitions.
11256 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11257 declarations.
11258 (Target_arm::relocate_stub): Change parameter type of stub from
11259 Reloc_stub pointer to Stub pointer.
11260 (Insn_template::size, Insn_template::alignment): Handle
11261 THUMB16_SPECIAL_TYPE.
11262 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11263 Stub_table::update_data_size_and_addralign,
11264 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11265 definitions.
11266 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11267 (Stub_table::do_write): Ditto.
11268 (Target_arm::do_relax): Adjust code for changes in Stub_table.
11269
11270 2010-01-08 Ian Lance Taylor <iant@google.com>
11271
11272 PR 11108
11273 * symtab.h (class Symbol): Remove fields is_target_special_ and
11274 has_plt_offset_. Add field is_defined_in_discarded_section_.
11275 (Symbol::is_defined_in_discarded_section): New function.
11276 (Symbol::set_is_defined_in_discarded_section): New function.
11277 (Symbol::has_plt_offset): Rewrite.
11278 (Symbol::set_plt_offset): Verify that new offset is not -1U.
11279 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11280 Don't initialize is_target_special_ or has_plt_offset_.
11281 Initialize is_defined_in_discarded_section_.
11282 (Symbol_table::add_from_relobj): If appropriate, set
11283 is_defined_in_discarded_section.
11284 * resolve.cc (Symbol::override_base_with_special): Don't test
11285 is_target_special_. Change has_plt_offset_ to has_plt_offset().
11286 * target-reloc.h (relocate_section): Do special handling for
11287 symbols defined in discarded sections for global symbols as well
11288 as local symbols.
11289
11290 2010-01-08 Ian Lance Taylor <iant@google.com>
11291
11292 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11293 the SHT_SYMTAB case.
11294
11295 2010-01-08 Ian Lance Taylor <iant@google.com>
11296
11297 * object.cc (Sized_relobj::do_layout): Don't get confused if
11298 layout_eh_frame returns NULL.
11299
11300 2010-01-08 Ian Lance Taylor <iant@google.com>
11301
11302 PR 11084
11303 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11304 dynamic symbol table, use the normal symbol table.
11305 (Sized_dynobj::do_read_symbols): Remove assertion about type of
11306 symbol table.
11307
11308 2010-01-08 Ian Lance Taylor <iant@google.com>
11309
11310 PR 11072
11311 * layout.cc (Layout::include_section): Remove .gnu_debuglink
11312 sections.
11313
11314 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
11315
11316 * version.cc (print_version): Change to "Copyright 2010".
11317
11318 2010-01-08 Ian Lance Taylor <iant@google.com>
11319
11320 PR 10287
11321 PR 11063
11322 * i386.cc (class Target_i386): Change return type of plt_section
11323 to be non-const.
11324 (class Output_data_plt_i386): Add tls_desc_rel_ field.
11325 (Output_data_plt_i386::Output_data_plt_i386): Initialize
11326 tls_desc_rel_ field.
11327 (Output_data_plt_i386::rel_tls_desc): New function.
11328 (Target_i386::rel_tls_desc_section): New function.
11329 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11330 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11331 R_386_TLS_DESC reloc in rel_tls_desc_section.
11332 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11333 Define struct Tlsdesc_info.
11334 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11335 (Target_x86_64::do_reloc_symbol_index): New function.
11336 (Target_x86_64::add_tlsdesc_info): New function.
11337 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11338 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11339 tlsdesc_rel_ field.
11340 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
11341 all callers.
11342 (Output_data_plt_x86_64::rela_tlsdesc): New function.
11343 (Target_x86_64::rela_tlsdesc_section): New function.
11344 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11345 handling.
11346 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11347 (Target_x86_64::do_reloc_addend): New function.
11348 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11349 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11350 declarations. Define TARGET_CODE. Add arg field to u1_ union.
11351 (Output_reloc::type): New function.
11352 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11353 (Output_reloc::is_target_specific): New function.
11354 (Output_reloc::target_arg): New function.
11355 (class Output_reloc) [SHT_RELA]: Add four new constructors for
11356 absolute relocs and target specific relocs.
11357 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11358 add_target_specific.
11359 (class Output_data_reloc) [SHT_RELA]: Likewise.
11360 * output.cc (Output_reloc::Output_reloc): Add four new versions
11361 for absolute relocs and target specific relocs.
11362 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11363 (Output_reloc::get_symbol_index): Likewise.
11364 (Output_reloc::local_section_offset): Check that local_sym_index_
11365 is not TARGET_CODE or 0.
11366 (Output_reloc::symbol_value): Likewise.
11367 (Output_reloc::write) [SHT_RELA]: Call target for target specific
11368 reloc.
11369 * target.h (class Target): Add reloc_symbol_index and reloc_addend
11370 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
11371 functions.
11372 * layout.cc (add_target_dynamic_tags): Use output section for
11373 DT_PLTRELSZ and DT_JMPREL.
11374
11375 2010-01-07 Ian Lance Taylor <iant@google.com>
11376
11377 PR 11061
11378 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11379 function.
11380 (class Output_data_reloc_generic): Define.
11381 (class Output_data_reloc_base): Change base class to
11382 Output_data_reloc_generic. Change add() method to call
11383 bump_relative_reloc_count for a relative reloc. Remove
11384 sort_relocs_ field.
11385 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11386 to sort_relocs().
11387 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11388 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
11389 appropriate.
11390 * layout.h (class Layout): Update declaration.
11391
11392 2010-01-07 Ian Lance Taylor <iant@google.com>
11393
11394 * output.h (class Output_data): Add const version of
11395 output_section and do_output_section.
11396 (class Output_section_data): Add const version of
11397 do_output_section.
11398 (class Output_section): Likewise.
11399 * layout.cc (Layout::add_target_dynamic_tags): New function.
11400 * layout.h (class Layout): Update declarations.
11401 * arm.cc (Target_arm::do_finalize_sections): Use
11402 add_target_dynamic_tags.
11403 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11404 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11405 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11406 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11407
11408 2010-01-07 Ian Lance Taylor <iant@google.com>
11409
11410 PR 11042
11411 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11412 object as needed.
11413
11414 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
11415 Ian Lance Taylor <iant@google.com>
11416
11417 PR 11019
11418 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11419 Xindex::read_symtab_xindex.
11420
11421 2010-01-07 Doug Kwan <dougkwan@google.com>
11422
11423 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11424 (Insn_template::thumb16_bcond_insn): New method declaration.
11425 (Insn_template): Fix spelling.
11426 (Stub::thumb16_special): New method declaration.
11427 (Stub::do_write): Define virtual method which was previously pure
11428 virtual.
11429 (Stub::do_thumb16_special): New method declaration.
11430 (Stub::do_fixed_endian_write): New template member.
11431 (Reloc_stub::do_write): Remove.
11432 (Reloc_stub::do_fixed_endian_write): Remove.
11433 (Cortex_a8_stub): New class definition.
11434 (Stub_factory::make_cortex_a8_stub): New method definition.
11435 (Stub_factory::Stub_factory): Add missing static storage class
11436 qualifier for elf32_arm_stub_a8_veneer_blx.
11437
11438 2010-01-07 Ian Lance Taylor <iant@google.com>
11439
11440 PR 10980
11441 * options.h (class General_options): Add --warn-unresolved-symbols
11442 and --error-unresolved-symbols.
11443 * errors.cc (Errors::undefined_symbol): Implement
11444 --warn-unresolved-symbols.
11445
11446 * options.h (class General_options): Add -z text and -z textoff.
11447 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11448
11449 2010-01-06 Sriraman Tallam <tmsriram@google.com>
11450
11451 * gc.h (Garbage_collection::Cident_section_map): New typedef.
11452 (Garbage_collection::cident_sections): New function.
11453 (Garbage_collection::add_cident_section): New function.
11454 (Garbage_collection::cident_sections_): New member.
11455 (gc_process_relocs): Add references to sections whose names are C
11456 identifiers.
11457 * gold.h (cident_section_start_prefix): New constant.
11458 (cident_section_stop_prefix): New constant.
11459 (is_cident): New function.
11460 * layout.cc (Layout::define_section_symbols): Replace string constants
11461 with the newly defined constants.
11462 * object.cc (Sized_relobj::do_layout): Track sections whose names are
11463 C identifiers.
11464 * testsuite/Makefile.am: Add gc_orphan_section_test.
11465 * testsuite/Makefile.in: Regenerate.
11466 * testsuite/gc_orphan_section_test.cc: New file.
11467 * testsuite/gc_orphan_section_test.sh: New file.
11468
11469 2010-01-06 Ian Lance Taylor <iant@google.com>
11470
11471 PR 10980
11472 * options.h (class General_options): Add --warn-shared-textrel.
11473 * layout.cc (Layout::finish_dynamic_section): Implement
11474 --warn-shared-textrel.
11475
11476 PR 10980
11477 * options.h (class General_options): Add --warn-multiple-gp.
11478
11479 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11480
11481 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11482 $(THREADSLIB) and $(LIBDL).
11483 * Makefile.in: Rebuild.
11484
11485 2010-01-06 Ian Lance Taylor <iant@google.com>
11486
11487 PR 10980
11488 * options.cc (General_options::parse_section_start): New function.
11489 (General_options::section_start): New function.
11490 (General_options::General_options): Initialize all members.
11491 * options.h: Include <map>
11492 (class General_options): Add --section-start. Add section_starts_
11493 member.
11494 * layout.cc (Layout::attach_allocated_section_to_segment): If
11495 --section-start was used, set the address of the segment. Remove
11496 local sort_sections.
11497 (Layout::relaxation_loop_body): If the address of the load segment
11498 has been set by --section-start, don't use it.
11499 * output.h (Output_segment::update_flags_for_output_section): New
11500 function.
11501 * output.cc (Output_segment::add_output_section): Call
11502 update_flags_for_output_section.
11503
11504 2010-01-05 Ian Lance Taylor <iant@google.com>
11505
11506 PR 10980
11507 * options.h (class General_options): Add --undefined-version.
11508 * script.cc (struct Version_expression): Add was_matched_by_symbol
11509 field.
11510 (Version_script_info::matched_symbol): New function.
11511 (Version_script_info::get_symbol_version_helper): Call
11512 matched_symbol.
11513 (Version_script_info::check_unmatched_names): New function.
11514 * script.h (class Version_script_info): Update declarations.
11515 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11516
11517 * options.h (class General_options): Use DEFINE_bool_alias for
11518 allow_multiple_definition.
11519 * resolve.cc (Symbol_table::should_override): Don't test
11520 allow_multiple_definition.
11521
11522 PR 10980
11523 * options.h (class General_options): Add --cref.
11524 * main.cc (main): Print cref table if --cref. Don't close mapfile
11525 until after printing cref table.
11526 * cref.cc: Include "symtab.h".
11527 (class Cref_inputs): Define Cref_table_compare and Cref_table.
11528 (Cref_table_compare::operator()): New function.
11529 (Cref_inputs::gather_cref): New function.
11530 (filecol): New static const.
11531 (Cref_inputs::print_cref): New function.
11532 (Cref::print_cref): New function.
11533 * cref.h: Include <cstdio>.
11534 (class Cref): Update declarations.
11535 * mapfile.h (Mapfile::file): New function.
11536 * object.h (class Object): Define Symbols. Declare virtual
11537 do_get_global_symbols.
11538 (Object::get_global_symbols): New function.
11539 * object.cc (Input_objects::add_object): Pass object to cref_ if
11540 --cref.
11541 (Input_objects::archive_start): Likewise.
11542 (Input_objects::archive_stop): Likewise.
11543 (Input_objects::print_cref): New function.
11544 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11545 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11546 --cref.
11547 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11548 function.
11549 * plugin.h (class Sized_pluginobj): Update declarations.
11550
11551 2010-01-05 Ian Lance Taylor <iant@google.com>
11552
11553 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11554 to is_default_version. Rename insdef to insdefault.
11555 (Symbol_table::add_from_relobj): Rename def to is_default_version
11556 and local to is_forced_local.
11557 (Symbol_table::add_from_pluginobj): Likewise.
11558 (Symbol_table::add_from_dynobj): Likewise.
11559 (Symbol_table::define_special_symbol): Rename insdef to
11560 insdefault.
11561
11562 2010-01-04 Ian Lance Taylor <iant@google.com>
11563
11564 PR 10980
11565 * options.h (class General_options): Add
11566 --allow-multiple-definition and -z muldefs.
11567 * resolve.cc (Symbol_table::should_override): Don't warn about a
11568 multiple symbol definition if --allow-multiple-definition or -z
11569 muldefs.
11570
11571 PR 10980
11572 * options.h (class General_options): Add --add-needed and
11573 --copy-dt-needed-entries. Tweak --as-needed help entry.
11574 * object.cc (Input_objects::check_dynamic_dependencies): Give an
11575 error if --copy-dt-needed-entries aka --add-needed is used and
11576 would cause a change in behaviour.
11577
11578 PR 10980
11579 * options.h (class General_options): Add -G as a short version of
11580 --shared. Add no-op options -assert, -g, and -i.
11581
11582 2010-01-04 Sriraman Tallam <tmsriram@google.com>
11583
11584 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11585 check for .text or .gnu.linkonce.t sections.
11586 * icf.cc (Icf::find_identical_sections): Ditto.
11587 Change the detection for mangled function name within the section
11588 name.
11589 * icf.h (is_section_foldable_candidate): New function.
11590
11591 2009-12-30 Ian Lance Taylor <iant@google.com>
11592
11593 PR 10980
11594 * options.h (class General_options): Permit two dashes with
11595 --retain-symbols-file.
11596
11597 2009-12-30 Ian Lance Taylor <iant@google.com>
11598
11599 PR 10979
11600 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11601 don't put the file header and segment headers in the text
11602 segment.
11603
11604 PR 10979
11605 * common.cc (Sort_commons::operator()): Stabilize sort when both
11606 entries are NULL.
11607 (Symbol_table::do_allocate_commons_list): When allocating common
11608 symbols, skip a symbol which is no longer common.
11609 * symtab.h (Symbol::is_common): Test whether the symbol comes from
11610 an object before checking its type.
11611 * testsuite/common_test_2.c: New file.
11612 * testsuite/common_test_3.c: New file.
11613 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11614 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11615 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11616 (common_test_2_pic.o, common_test_2.so): New targets.
11617 (common_test_3_pic.o, common_test_3.so): New targets.
11618 * testsuite/Makefile.in: Rebuild.
11619
11620 PR 10979
11621 * script.cc (read_input_script): If we see a new SECTIONS clause,
11622 and we have added an input section, give an error.
11623 * layout.h (class Layout): Add have_added_input_section function.
11624 Add have_added_input_section_ field.
11625 * layout.cc (Layout::Layout): Initialize
11626 have_added_input_section_.
11627 (Layout::layout): Set have_added_input_section_.
11628 (Layout::layout_eh_frame): Likewise.
11629
11630 2009-12-30 Ian Lance Taylor <iant@google.com>
11631
11632 PR 10931
11633 * options.h (class General_options): Add --sort-common option.
11634 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11635 * common.cc (Sort_common): Add sort_order parameter to
11636 constructor. Add sort_order_ field.
11637 (Sort_commons::operator): Check sort_order_.
11638 (Symbol_table::allocate_commons): Determine the sort order.
11639 (Symbol_table::do_allocate_commons): Add sort_order parameter.
11640 Change all callers.
11641 (Symbol_table::do_allocate_commons_list): Likewise.
11642
11643 2009-12-30 Ian Lance Taylor <iant@google.com>
11644
11645 PR 10916
11646 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11647 symbols from this object, don't change the visibility of an
11648 undefined symbol.
11649 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11650
11651 2009-12-30 Ian Lance Taylor <iant@google.com>
11652
11653 PR 10861
11654 * script.h (class Version_script_info): Define Language enum.
11655 Update declarations. Define Glob, Exact, and Lookup types. Add
11656 new fields globals_, locals_, and is_finalized_.
11657 * script.cc: Various formatting fixes.
11658 (class Parser_closure): Change language_stack_ from a vector of
11659 std::string to one of Version_script_info::Language. Adjust all
11660 uses accordingly.
11661 (class Lazy_demangler): Remove.
11662 (struct Version_expression): Change language from std::string to
11663 Version_script_info::Language.
11664 (Version_script_info::Version_script_info): New function.
11665 (Version_script_info::~Version_script_info): Don't call clear.
11666 (Version_script_info::finalize): New function.
11667 (Version_script_info::build_lookup_tables): New function.
11668 (Version_script_info::build_expression_list_lookup): New
11669 function.
11670 (Version_script_info::get_symbol_version_helper): Rewrite to use
11671 lookup tables.
11672 (Version_script_info::print_expression_list): Adjust to use
11673 Version_script_info::Language.
11674 (script_push_lex_into_version_mode): Check that the version script
11675 has not been finalized.
11676 (version_script_push_lang): Change language string to
11677 Version_script_info::Language.
11678 * options.cc (Command_line::version_script): New function.
11679 * options.h (class General_options): Add finalize_dynamic_list
11680 function. Change version_script from declaration to definition.
11681 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11682 * testsuite/version_script.map: Remove duplicate def of foo.
11683 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11684 version_script.map.
11685 * testsuite/Makefile.in: Rebuild.
11686
11687 2009-12-30 Ian Lance Taylor <iant@google.com>
11688
11689 PR 10843
11690 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11691 if the input symbol index is 0, make the output symbol index 0.
11692
11693 2009-12-30 Ian Lance Taylor <iant@google.com>
11694
11695 PR 10670
11696 * options.h (class General_options): Add -x/--discard-all.
11697 * object.cc (Sized_relobj::do_count_local_symbols): Handle
11698 --discard-all. If the local symbol needs a dynamic entry, check
11699 that before handling --discard-locals.
11700
11701 2009-12-30 Ian Lance Taylor <iant@google.com>
11702
11703 PR 10450
11704 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11705 flags to PF_R.
11706 (Output_segment::add_output_section): Don't change the flags if
11707 the type is PT_TLS.
11708
11709 PR 10450
11710 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11711 GNU hash table if they need a dynamic value. Otherwise, don't add
11712 them if they are defined in a dynamic object or are forced local.
11713
11714 2009-12-29 Ian Lance Taylor <iant@google.com>
11715
11716 PR 10450
11717 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11718 .gnu.hash table for a 32-bit target.
11719
11720 PR 10450
11721 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11722 regular and a dynamic object only needs a dynamic symbol table
11723 entry if it is externally visible.
11724
11725 PR 10450
11726 * i386.cc (class Target_i386): Initialize global_offset_table_ in
11727 constructor. Add global_offset_table_ field.
11728 (Target_i386::got_section): Set global_offset_table_.
11729 (Target_i386::do_finalize_sections): Set global_offset_table_
11730 size.
11731 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11732 in constructor. Add global_offset_table_ field.
11733 (Target_x86_64::got_section): Set global_offset_table_.
11734 (Target_x86_64::do_finalize_sections): Set global_offset_table_
11735 size.
11736
11737 * layout.cc (Layout::Layout): Initialize increase_relro_.
11738 (Layout::get_output_section): Add is_relro, is_last_relro, and
11739 is_first_non_relro parameters. Change all callers.
11740 (Layout::choose_output_section): Likewise.
11741 (Layout::add_output_section_data): Likewise.
11742 (Layout::make_output_section): Likewise.
11743 (Layout::set_segment_offsets): Clear increase_relro when using a
11744 linker script.
11745 * layout.h (class Layout): Add increase_relro method. Add
11746 increase_relro_ field. Update declarations.
11747 * output.cc (Output_section::Output_section): Initialize
11748 is_last_relro_ and is_first_non_relro_.
11749 (Output_segment::add_output_section): Group relro sections is
11750 do_sort is true. Handle is_last_relro and is_first_non_relro.
11751 (Output_segment::maximum_alignment): Remove relro handling.
11752 (Output_segment::set_section_addresses): Add increase_relro
11753 parameter. Change all callers. Add initial alignment to align
11754 relro sections on separate page. Remove old relro handling.
11755 (Output_segment::set_section_list_addresses): Remove in_relro
11756 parameter. Change all callers.
11757 (Output_segment::set_offset): Add increase parameter. Change all
11758 callers. Remove old relro handling.
11759 * output.h (class Output_section): Add new methods: is_last_relro,
11760 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11761 Add is_last_relro_ and is_first_non_relro_ fields.
11762 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11763 Create separate .got.plt section. Call increase_relro.
11764 * x86_64.cc (Target_x86_64::got_section): Likewise.
11765 * testsuite/relro_script_test.t: Add .got.plt.
11766
11767 PR 10450
11768 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11769 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11770 (Layout::finalize): Call set_dynamic_symbol_size.
11771 (Layout::set_dynamic_symbol_size): New function.
11772 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
11773 set_dynamic_symbol_size.
11774
11775 PR 10450
11776 * output.h (class Output_section): Add is_entsize_zero_ field.
11777 * output.cc (Output_section::Output_section): Initialize
11778 is_entsize_zero_.
11779 (Output_section::set_entsize): If two different entsizes are
11780 requested, force it to zero.
11781 (Output_section::add_input_section): Set flags for .debug_str
11782 before updating section flags. Set entsize.
11783 (Output_section::update_flags_for_input_section): Set SHF_MERGE
11784 and SHF_STRING if all input sections have those flags.
11785
11786 2009-12-29 Rafael Espindola <espindola@google.com>
11787
11788 * main.cc (main): Fix the sys time reporting.
11789 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11790 reporting.
11791
11792 2009-12-29 Sriraman Tallam <tmsriram@google.com>
11793
11794 * options.cc (General_options::parse_version): Allow -v to exit
11795 without an error if there is nothing to link.
11796
11797 2009-12-29 Ian Lance Taylor <iant@google.com>
11798
11799 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11800 using a version of gcc before 4.1.
11801 * configure: Rebuild.
11802
11803 2009-12-28 Chris Demetriou <cgd@google.com>
11804
11805 * attributes.cc (Output_attributes_section_data::do_write): Use
11806 std::vector::front rather than std::vector::data.
11807
11808 2009-12-28 Ian Lance Taylor <iant@google.com>
11809
11810 * symtab.h (class Symbol_table): Add enum Defined.
11811 * resolve.cc (Symbol_table::should_override): Add defined
11812 parameter. Change all callers. Test whether object is NULL
11813 before calling a method on it.
11814 (Symbol_table::report_resolve_problem): Add defined parameter.
11815 Change all callers.
11816 (Symbol_table::should_override_with_special): Likewise.
11817 * symtab.cc (Symbol_table::define_in_output_data): Add defined
11818 parameter. Change all callers.
11819 (Symbol_table::do_define_in_output_data): Likewise.
11820 (Symbol_table::define_in_output_segment): Likewise.
11821 (Symbol_table::do_define_in_output_segment): Likewise.
11822 (Symbol_table::define_as_constant): Likewise.
11823 (Symbol_table::do_define_as_constant): Likewise.
11824 * script.h (class Symbol_assignment): Add is_defsym parameter to
11825 constructor; change all callers.
11826 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
11827 parameter. Change all callers. Add is_defsym_ field.
11828 (class Parser_closure): Add parsing_defsym parameter to
11829 constructor; change all callers. Add parsing_defsym accessor
11830 function. Add parsing_defsym_ field.
11831
11832 2009-12-28 Ian Lance Taylor <iant@google.com>
11833
11834 * gold.cc (queue_middle_tasks): Fix formatting.
11835 * object.cc (Relobj::is_section_name_included): Likewise.
11836
11837 2009-12-23 Ian Lance Taylor <iant@google.com>
11838
11839 * i386.cc (Target_i386::do_calls_non_split): Recognize
11840 -fsplit-stack prologue for a function with a static chain.
11841 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
11842 -fsplit-stack prologue when using %r11.
11843
11844 2009-12-21 Sriraman Tallam <tmsriram@google.com>
11845
11846 * options.cc (General_options::parse_version): Make -v continue and do
11847 the link like GNU ld does.
11848
11849 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
11850
11851 * Makefile.am (CCFILES): Add timer.cc.
11852 (HFILES): Add timer.h.
11853 * configure.ac: Check for sysconf and times.
11854 * main.cc: include timer.h.
11855 (main): Use Timer instead of get_run_time.
11856 * timer.cc: New.
11857 * timer.h: New.
11858 * workqueue.cc: include timer.h.
11859 (Workqueue::find_and_run_task):
11860 Report user, sys and wall time.
11861 * Makefile.in: Regenerate.
11862 * config.in: Regenerate.
11863 * configure: Regenerate.
11864
11865 2009-12-16 Doug Kwan <dougkwan@google.com>
11866
11867 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
11868 sections.
11869 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
11870 relaxed input sections.
11871 * output.cc (Output_section::find_relaxed_input_section): Change
11872 return type to Output_relaxed_input_section pointer. Adjust code
11873 for new type of relaxed_input_section_map_.
11874 * output.h (Output_section::find_relaxed_input_section): Change
11875 return type to Output_relaxed_input_section pointer.
11876 (Output_section::Output_relaxed_input_section_by_input_section_map):
11877 New type.
11878 (Output_section::relaxed_input_section_map_): Change type to
11879 Output_section::Output_relaxed_input_section_by_input_section_map.
11880 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
11881 input section.
11882
11883 2009-12-15 Ian Lance Taylor <iant@google.com>
11884
11885 * layout.cc (Layout::create_shstrtab): Only write out after input
11886 sections if we are compressing debug sections.
11887
11888 2009-12-15 Ian Lance Taylor <iant@google.com>
11889
11890 * archive.cc (Archive::add_symbols): Only look up a symbol without
11891 a version if there is, in fact, a version.
11892
11893 2009-12-14 Ian Lance Taylor <iant@google.com>
11894
11895 Revert -Wshadow changes, all changes from:
11896 2009-12-11 Doug Kwan <dougkwan@google.com>
11897 2009-12-11 Nick Clifton <nickc@redhat.com>
11898 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
11899
11900 2009-12-11 Doug Kwan <dougkwan@google.com>
11901
11902 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
11903 due to -Wshadow.
11904 * attributes.cc (Object_attribute::size): Ditto.
11905 (Attributes_section_data::size): Ditto.
11906 (Attributes_section_data::Attributes_section_data): Ditto.
11907 (Output_attributes_section_data::do_write): Ditto.
11908 * attributes.h (Object_attribute::set_type): Ditto.
11909 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
11910
11911 2009-12-11 Nick Clifton <nickc@redhat.com>
11912
11913 * archive.cc: Fix shadowed variable warnings.
11914 * arm.cc: Likewise.
11915 * compressed_output.cc: Likewise.
11916 * compressed_output.h: Likewise.
11917 * configure: Likewise.
11918 * dwarf_reader.cc: Likewise.
11919 * dynobj.cc: Likewise.
11920 * dynobj.h: Likewise.
11921 * ehframe.cc: Likewise.
11922 * ehframe.h: Likewise.
11923 * errors.cc: Likewise.
11924 * expression.cc: Likewise.
11925 * fileread.cc: Likewise.
11926 * fileread.h: Likewise.
11927 * freebsd.h: Likewise.
11928 * i386.cc: Likewise.
11929 * icf.cc: Likewise.
11930 * incremental.h: Likewise.
11931 * layout.cc: Likewise.
11932 * layout.h: Likewise.
11933 * mapfile.cc: Likewise.
11934 * merge.cc: Likewise.
11935 * merge.h: Likewise.
11936 * object.cc: Likewise.
11937 * object.h: Likewise.
11938 * options.h: Likewise.
11939 * output.cc: Likewise.
11940 * output.h: Likewise.
11941 * parameters.cc: Likewise.
11942 * plugin.cc: Likewise.
11943 * powerpc.cc: Likewise.
11944 * reduced_debug_output.cc: Likewise.
11945 * reduced_debug_output.h: Likewise.
11946 * reloc.cc: Likewise.
11947 * reloc.h: Likewise.
11948 * resolve.cc: Likewise.
11949 * script-sections.cc: Likewise.
11950 * script.cc: Likewise.
11951 * script.h: Likewise.
11952 * sparc.cc: Likewise.
11953 * symtab.cc: Likewise.
11954 * symtab.h: Likewise.
11955 * target-select.cc: Likewise.
11956 * target-select.h: Likewise.
11957 * token.h: Likewise.
11958 * workqueue.cc: Likewise.
11959 * workqueue.h: Likewise.
11960 * x86_64.cc: Likewise.
11961
11962 2009-12-10 Doug Kwan <dougkwan@google.com>
11963
11964 * arm.cc (attributes.h): New include.
11965 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
11966 (Arm_relobj::~Arm_relobj): Delete object pointed by
11967 attributes_section_data_.
11968 (Arm_relobj::attributes_section_data): New method definition.
11969 (Arm_relobj::attributes_section_data_): New data member declaration.
11970 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
11971 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11972 attributes_section_data_.
11973 (Arm_dynobj::attributes_section_data): New method definition.
11974 (Arm_dynobj::attributes_section_data_): New data member declaration.
11975 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
11976 initialization value of may_use_blx_ to false.
11977 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11978 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11979 object attributes to compute results instead of hard-coding.
11980 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11981 Target_arm::get_secondary_compatible_arch,
11982 Target_arm::set_secondary_compatible_arch
11983 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11984 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11985 New method declarations.
11986 (Target_arm::get_aeabi_object_attribute): New method definition.
11987 (Target_arm::attributes_section_data_): New data member declaration.
11988 (read_arm_attributes_section): New template definition.
11989 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11990 (Arm_dynobj::do_read_symbols): Ditto.
11991 (Target_arm::do_finalize_sections): Merge attributes sections from
11992 input. Check for BLX use after attributes section merging.
11993 Fix __exidx_start and __exidx_end visibility. Create an
11994 .ARM.attributes section if necessary.
11995 (Target_arm::get_secondary_compatible_arch,
11996 Target_arm::set_secondary_compatible_arch,
11997 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11998 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11999 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12000 New method definitions.
12001
12002 2009-12-09 Ian Lance Taylor <iant@google.com>
12003
12004 * plugin.cc (Plugin::load): Don't cast from void* to a function
12005 pointer.
12006
12007 2009-12-09 Ian Lance Taylor <iant@google.com>
12008
12009 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12010 information fields.
12011
12012 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
12013
12014 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12015 Replace two_file_shared_1.so with two_file_shared_2.so.
12016 * testsuite/Makefile.in: Regenerated.
12017
12018 2009-12-08 Doug Kwan <dougkwan@google.com>
12019
12020 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12021 (HFILES): Add attributes.h and int_encoding.h.
12022 * Makefile.in: Regenerate.
12023 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12024 function definitions to int_encoding.cc
12025 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12026 prototypes to int_encoding.h
12027 * reduced_debug_output.cc (int_encoding.h): New include.
12028 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12029 function definitions to int_encoding.cc
12030 (insert_into_vector, read_from_pointer): Move template definitions to
12031 int_encoding.h
12032 * attributes.cc: New file.
12033 * attributes.h: New file.
12034 * int_encoding.cc: New file.
12035 * int_encoding.h: New file.
12036
12037 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
12038
12039 PR gold/11055
12040 * incremental-dump.cc (dump_incremental_inputs): New.
12041 (main): Use dump_incremental_inputs.
12042
12043 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
12044
12045 PR gold/10893
12046 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12047 checking elfcpp::STT_FUNC.
12048 (Target_i386::Relocate::relocate): Likewise.
12049 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12050
12051 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12052 symbols from shared libraries into normal FUNC symbols.
12053
12054 * symtab.h (Symbol): Add is_func and use it.
12055
12056 2009-12-05 Doug Kwan <dougkwan@google.com>
12057
12058 * arm.cc (Target_arm::arm_info): Initialize new fields
12059 attributes_section and attributes_vendor.
12060 * i386.cc (Target_i386::i386_info): Same.
12061 * object.cc (Sized_relobj::do_layout): Skip attribute section.
12062 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12063 fields attributes_section and attributes_vendor.
12064 * sparc.cc (Target_sparc::sparc_info): Same.
12065 * target.h (Target::attributes_section, Target::attributes_vendor,
12066 Target::is_attributes_section, Target::attribute_arg_type,
12067 Target::attributes_order): New method definitions.
12068 (Target::Target_info::attributes_section,
12069 Target::Target_info::attributes_vendor): New fields.
12070 (Target::do_attribute_arg_type, Target::do_attributes_order): New
12071 virtual method definitions.
12072 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12073 attributes_section and attributes_vendor.
12074 * testsuite/testfile.cc (Target_test::test_target_info): Same.
12075
12076 2009-12-05 Doug Kwan <dougkwan@google.com>
12077
12078 * arm.cc: Update comments about interworking and stub generation.
12079 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12080 considered as non-PIC.
12081 (Arm_relocate_functions::base_abs): Fix formatting.
12082 (Arm_relocate_functions::got_prel): Fix comment. Change interface
12083 of function to use GOT entry address instead of offset.
12084 (Target_arm::Scan::global): Issue an error if a symbol would need a
12085 PLT does not get one because it is untyped. Remove code to create
12086 dynamic symbols for relative branches.
12087 (Target_arm::Relocate::relocate: Use 0 instead of false since function
12088 takes unsigned integer instead of boolean.
12089
12090 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
12091
12092 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12093 (two_file_test_LDADD): Likewise.
12094 (common_test_1_LDADD): Likewise.
12095 (exception_test_LDADD) Likewise.
12096 (weak_test_LDADD): Likewise.
12097 (many_sections_test_LDADD): Likewise.
12098 (initpri1_LDADD): Likewise.
12099 (script_test_1_LDADD): Likewise.
12100 (script_test_2_LDADD): Likewise.
12101 (justsyms_LDADD): Likewise.
12102 (binary_test_LDADD): Likewise.
12103 (large_LDADD): Likewise.
12104 * testsuite/Makefile.in: Regenerated.
12105
12106 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
12107
12108 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12109 (Symbol_table::override_with_special): Likewise.
12110 (Symbol_table::add_from_object): Likewise.
12111
12112 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
12113
12114 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12115 Don't set the data_offset twice.
12116
12117 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
12118
12119 * testsuite/Makefile.in: Regenerate.
12120
12121 2009-12-03 Doug Kwan <dougkwan@google.com>
12122
12123 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12124 (Target_arm::do_finalize_sections): Add parameter for symbol table
12125 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
12126 * i386.cc (Target_i386::do_finalize_sections): Add an additional
12127 parameter for symbol table pointer.
12128 * layout.cc (Layout::finalize): Call Target::finalize_sections with
12129 an additional parameter for a pointer to symbol table.
12130 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12131 parameter for a symbol table pointer.
12132 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12133 * target.h (Target::finalize_sections, Target::do_finalize_sections):
12134 Ditto.
12135 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12136 parameter for a symbol table pointer.
12137
12138 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
12139
12140 * incremental.cc (Incremental_inputs_header)
12141 (Incremental_inputs_header_write, Incremental_inputs_entry)
12142 (Incremental_inputs_entry_write): Move ...
12143 * incremental.h (Incremental_inputs_header)
12144 (Incremental_inputs_header_write, Incremental_inputs_entry)
12145 (Incremental_inputs_entry_write): here.
12146
12147 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12148
12149 * incremental.cc (make_sized_incremental_binary): Set the target.
12150 Error if it is incompatible.
12151 * output.h (Output_file): Add filename method.
12152
12153 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12154
12155 * incremental.cc (Incremental_inputs_entry): Remove unused argument
12156 from the get_* methods.
12157
12158 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12159
12160 * incremental-dump.cc (main): Check that the offeset of a script is 0.
12161 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12162 Write 0 for the data_offset of scripts.
12163
12164 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
12165
12166 * testsuite/Makefile.am: Add the incremental_test.sh test.
12167 * testsuite/incremental_test.sh: New.
12168 * testsuite/incremental_test_1.c: New.
12169 * testsuite/incremental_test_2.c: New.
12170
12171 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
12172
12173 * incremental-dump.cc (main): Fix typos.
12174
12175 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
12176
12177 PR gold/11025
12178 * incremental-dump.cc (main): Use llu to print 64 bit values.
12179
12180 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
12181 H.J. Lu <hongjiu.lu@intel.com>
12182
12183 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12184 $(LIBDL).
12185 (incremental_dump_LDADD): Likewise.
12186 * Makefile.in: Regenerated.
12187
12188 2009-11-25 Doug Kwan <dougkwan@google.com>
12189
12190 Revert:
12191
12192 2009-11-25 Doug Kwan <dougkwan@google.com>
12193
12194 * arm.cc (Target_arm::Target_arm): Move method definition
12195 outside of class definition. Add code to handle
12196 --target1-rel, --target1-abs and --target2= options.
12197 (Target_arm::get_reloc_reloc_type): Change method to be
12198 non-static and const.
12199 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12200 New data member declaration.
12201 (Target_arm::Scan::local, Target_arm::Scan::global,
12202 Target_arm::Relocate::relocate,
12203 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12204 Adjust call to Target_arm::get_real_reloc_type.
12205 (Target_arm::get_real_reloc_type): Use command line options
12206 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12207 * options.h (--target1-rel, --target1-abs, --target2): New
12208 ARM-only options.
12209
12210 2009-11-25 Doug Kwan <dougkwan@google.com>
12211
12212 * arm.cc (Target_arm::Target_arm): Move method definition outside of
12213 class definition. Add code to handle --target1-rel, --target1-abs
12214 and --target2= options.
12215 (Target_arm::get_reloc_reloc_type): Change method to be non-static
12216 and const.
12217 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12218 member declaration.
12219 (Target_arm::Scan::local, Target_arm::Scan::global,
12220 Target_arm::Relocate::relocate,
12221 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12222 call to Target_arm::get_real_reloc_type.
12223 (Target_arm::get_real_reloc_type): Use command line options to
12224 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12225 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12226 options.
12227
12228 2009-11-25 Doug Kwan <dougkwan@google.com>
12229
12230 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12231 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12232 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12233 formatting.
12234 (Arm_relocate_functions::thm_call): Replace body with a call to
12235 Arm_relocate_functions::thumb_branch_common.
12236 (Arm_relocate_functions::thm_jump24,
12237 Arm_relocate_functions::thm_xpc22): New method definitions.
12238 (Arm_relocate_functions::thumb_branch_common): New method definition.
12239 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12240 operator.
12241 (Target_arm::Relocate::relocate): Adjust call to thm_call.
12242 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12243
12244 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12245
12246 * Makefile.am: Build incremental-dump
12247 * Makefile.in: Regenerate.
12248 * incremental-dump.cc: New.
12249 * incremental.cc (Incremental_inputs_header_data,
12250 Incremental_inputs_entry_data): Move to incremental.h
12251 * incremental.h: (Incremental_inputs_header_data,
12252 Incremental_inputs_entry_data): Move from incremental.cc
12253
12254 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12255
12256 * incremental.cc (Incremental_inputs_header,
12257 Incremental_inputs_header_write, Incremental_inputs_entry,
12258 Incremental_inputs_entry_write): Add a typedef with the data type.
12259
12260 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
12261
12262 * incremental.cc (Incremental_inputs_header,
12263 Incremental_inputs_header_write, Incremental_inputs_entry,
12264 Incremental_inputs_entry_write): Update comment about which
12265 type has the filed descriptions.
12266
12267 2009-11-15 Doug Kwan <dougkwan@google.com>
12268
12269 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12270 (Arm_relocate_functions::arm_branch_common): Change method defintion
12271 in class definition to a method declaration and update list of formal
12272 parameters.
12273 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12274 Arm_relocation_functions::jump24): Adjust call to
12275 Arm_relocate_functions::arm_branch_common. Update list of formal
12276 parameters.
12277 (Arm_relocate_functions::xpc25): New method definition.
12278 (Arm_relocate_functions::arm_branch_common): Move method defintion
12279 out from class definition. Use stubs for mode-switching and extending
12280 branch ranges.
12281 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12282 specially. Change code to enable use of stubs in ARM branches.
12283
12284 2009-11-10 Doug Kwan <dougkwan@google.com>
12285
12286 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12287 in method declaration.
12288 (Target_arm::relocate_stub): New method declaration.
12289 (Target_arm::default_target): Change to return a pointer instead of
12290 a const reference.
12291 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12292 Target_arm::default_target.
12293 (Arm_Relobj::do_relocate_sections): Remove options paramater in
12294 method definition.
12295 (Target_arm::relocate_section): Adjust view.
12296 (Target_arm::relocate_stub): New method definition.
12297
12298 2009-11-10 Doug Kwan <dougkwan@google.com>
12299
12300 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12301 a format warning.
12302 * incremental.cc (open_incremental_binary): Initialized local
12303 variables to avoid warnings.
12304 * object.cc (make_elf_object): Ditto.
12305 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12306 a format warning.
12307
12308 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
12309
12310 PR gold/10930
12311 * testsuite/plugin_test.c: Include "config.h".
12312
12313 2009-11-09 Doug Kwan <dougkwan@google.com>
12314
12315 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12316 (arm_symbol_value): Remove.
12317 (Arm_relocate_functions::arm_branch_common,
12318 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12319 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12320 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12321 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12322 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12323 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12324 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12325 Arm_relocate_functions::thm_mobw_abs_nc,
12326 Arm_relocate_functions::thm_mov_abs,
12327 Arm_relocate_functions::movw_prel_nc,
12328 Arm_relocate_functions::thm_movt_abs,
12329 Arm_relocate_functions::movt_prel,
12330 Arm_relocate_functions::thm_movw_prel_nc,
12331 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12332 (Target_arm::Relocate::relocate): Only decompose address into two
12333 parts if relocation type uses the thumb-bit and pass the actual
12334 bit instead of a flag indicating that the thumb-bit is used. Adjust
12335 calls to methods in Arm_relocate_functions for this change.
12336
12337 2009-11-08 Ian Lance Taylor <iant@google.com>
12338
12339 PR 10925
12340 * reloc.cc: Instantiate
12341 Sized_relobj::initialize_input_to_output_maps and
12342 Sized_relobj:free_input_to_output_maps.
12343
12344 2009-11-06 Ian Lance Taylor <iant@google.com>
12345
12346 PR 10876
12347 * defstd.cc (in_segment): Set only_if_ref true for "end".
12348
12349 2009-11-06 Doug Kwan <dougkwan@google.com>
12350
12351 * arm.cc (class Reloc_stub): Correct a comment.
12352 (Target_arm::Target_arm): Initialize arm_input_section_map_.
12353 (Target_arm::scan_section_for_stubs): New method declaration.
12354 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12355 Change methods from private to protected.
12356 (Target_arm::do_may_relax): New method definition.
12357 (Target_arm::do_relax, Target_arm::group_sections,
12358 Target_arm::scan_reloc_for_stub,
12359 Target_arm::scan_reloc_section_for_stubs): New method declarations.
12360 (Target_arm::arm_input_section_map_): New data member declaration.
12361 (Target_arm::scan_reloc_for_stub,
12362 Target_arm::scan_reloc_section_for_stubs,
12363 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12364 Target_arm::do_relax): New method definitions.
12365
12366 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
12367
12368 * configure.ac: Check for (struct stat)::st_mtim
12369 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12370 * config.in: Regenerate.
12371 * configure: Regenerate.
12372
12373 2009-11-05 Ian Lance Taylor <iant@google.com>
12374
12375 PR 10910
12376 * output.cc (Output_segment::add_output_section): Add missing
12377 return statement.
12378
12379 2009-11-04 Ian Lance Taylor <iant@google.com>
12380
12381 PR 10880
12382 * object.h (class Object): Add is_needed and set_is_needed
12383 methods. Add is_needed_ field. Make bool fields into bitfields.
12384 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12385 defined in a dynamic object and referenced by a regular object,
12386 set is_needed for the dynamic object.
12387 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12388 if the file is marked with as_needed and it is not needed.
12389
12390 2009-11-04 Ian Lance Taylor <iant@google.com>
12391
12392 PR 10887
12393 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12394 tags if data is discarded by linker script.
12395 * i386.cc (Target_i386::do_finalize_sections): Likewise.
12396 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12397 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12398 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12399
12400 2009-11-04 Ian Lance Taylor <iant@google.com>
12401
12402 * layout.cc (Layout::get_output_section): Add is_interp and
12403 is_dynamic_linker_section parameters. Change all callers.
12404 (Layout::choose_output_section): Likewise.
12405 (Layout::make_output_section): Likewise.
12406 (Layout::add_output_section_data): Add is_dynamic_linker_section
12407 parameter. Change all callers.
12408 * layout.h (class Layout): Update declarations.
12409 * output.h (class Output_section): Add is_interp, set_is_interp,
12410 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12411 Add is_interp_, is_dynamic_linker_section_ fields. Change
12412 generate_code_fills_at_write_ to a bitfield.
12413 * output.cc (Output_section::Output_sections): Initialize new
12414 fields.
12415 (Output_segment::add_output_section): Add do_sort parameter.
12416 Change all callers.
12417
12418 2009-11-03 Ian Lance Taylor <iant@google.com>
12419
12420 PR 10860
12421 * options.h (class General_options): Add --warn-common.
12422 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12423 merging two common symbols.
12424 (Symbol_table::should_override): Handle --warn-common when merging
12425 a common symbol with a defined symbol. Use report_resolve_problem
12426 for multiple definitions.
12427 (Symbol_table::report_resolve_problem): New function.
12428 * symtab.h (class Symbol_table): Declare report_resolve_problem.
12429
12430 2009-11-03 Doug Kwan <dougkwan@google.com>
12431
12432 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12433 stub_factory_.
12434 (Target_arm::stub_factory): New method definition.
12435 (Target_arm::new_arm_input_section,
12436 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12437 Target_arm::reloc_uses_thumb_bit): New method declarations.
12438 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12439 New type definitions.
12440 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12441 member declarations.
12442 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12443 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12444 New method definitions.
12445
12446 2009-11-03 Ian Lance Taylor <iant@google.com>
12447
12448 * options.h (class General_options): Add --warn_constructors.
12449
12450 2009-11-03 Ian Lance Taylor <iant@google.com>
12451
12452 PR 10893
12453 * defstd.cc (in_section): Add entries for __rel_iplt_start,
12454 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12455
12456 2009-11-03 Ian Lance Taylor <iant@google.com>
12457
12458 PR 10895
12459 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12460 --msgid-bugs-address.
12461 (install-pdf): New target.
12462 (install-data_yes): Look up one directory to find mkinstalldirs.
12463
12464 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
12465
12466 * po/Make-in (.po.gmo): Don't generate .gmo files in source
12467 tree.
12468
12469 2009-10-30 Doug Kwan <dougkwan@google.com>
12470
12471 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12472
12473 2009-10-30 Doug Kwan <dougkwan@google.com>
12474
12475 * arm.cc (Stub_addend_reader): New struct template definition
12476 and partial specializations.
12477 (Stub_addend_reader::operator()): New method definition for a
12478 partially specialized template.
12479
12480 2009-10-30 Doug Kwan <dougkwan@google.com>
12481
12482 * arm.cc (Arm_relobj::processor_specific_flags): New method
12483 definition.
12484 (Arm_relobj::do_read_symbols): New method declaration.
12485 (Arm_relobj::processor_specific_flags_): New data member declaration.
12486 (Arm_dynobj): New class definition.
12487 (Target_arm::do_finalize_sections): Add input_objects parameter.
12488 (Target_arm::do_adjust_elf_header): New method declaration.
12489 (Target_arm::are_eabi_versions_compatible,
12490 (Target_arm::merge_processor_specific_flags): New method declaration.
12491 (Target_arm::do_make_elf_object): New overloaded method definitions
12492 and declaration.
12493 (Arm_relobj::do_read_symbols): New method definition.
12494 (Arm_dynobj::do_read_symbols): Ditto.
12495 (Target_arm::do_finalize_sections): Add input_objects parameters.
12496 Merge processor-specific flags from all input objects.
12497 (Target_arm::are_eabi_versions_compatible,
12498 Target_arm::merge_processor_specific_flags,
12499 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12500 New method definitions.
12501 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12502 Input_objects pointer type parameter.
12503 * layout.cc (Layout::finalize): Pass input objects to target's.
12504 finalize_sections function.
12505 * output.cc (Output_file_header::do_sized_write): Set ELF file
12506 header's processor-specific flags.
12507 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12508 Input_objects pointer type parameter.
12509 * sparc.cc (Target_sparc::do_finalize_sections): Same.
12510 * target.h (Input_objects): New forward class declaration.
12511 (Target::processor_specific_flags,
12512 Target::are_processor_specific_flags_sect): New method definitions.
12513 (Target::finalize_sections): Add input_objects parameter.
12514 (Target::Target): Initialize processor_specific_flags_ and
12515 are_processor_specific_flags_set_.
12516 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12517 parameter.
12518 (Target::set_processor_specific_flags): New method definition.
12519 (Target::processor_specific_flags_,
12520 Target::are_processor_specific_flags_set_): New data member
12521 declarations.
12522 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12523 Input_objects pointer type parameter.
12524
12525 2009-10-30 Doug Kwan <dougkwan@google.com>
12526
12527 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12528
12529 2009-10-28 Ian Lance Taylor <iant@google.com>
12530
12531 * object.h (class Relobj): Drop options parameter from
12532 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12533 do_scan_relocs, do_relocate. Change all callers.
12534 (class Sized_relobj): Drop options parameters from
12535 do_gc_process_relocs, do_scan_relocs, do_relocate,
12536 do_relocate_sections, relocate_sections, emit_relocs_scan,
12537 emit_relocs_scan_reltype. Change all callers.
12538 (struct Relocate_info): Remove options field and all references to
12539 it.
12540 * reloc.h (class Read_relocs): Remove options constructor
12541 parameter and options_ field. Change all callers.
12542 (class Gc_process_relocs, class Scan_relocs): Likewise.
12543 (class Relocate_task): Likewise.
12544 * target-reloc.h (scan_relocs): Remove options parameter. Change
12545 all callers.
12546 (scan_relocatable_relocs): Likewise.
12547 * target.h (class Sized_target): Remove options parameter from
12548 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
12549 all callers.
12550 * gc.h (gc_process_relocs): Remove options parameter. Change all
12551 callers.
12552 * arm.cc: Update functions to remove options parameters.
12553 * i386.cc: Likewise.
12554 * powerpc.cc: Likewise.
12555 * sparc.cc: Likewise.
12556 * x86_64.cc: Likewise.
12557 * testsuite/testfile.cc: Likewise.
12558
12559 2009-10-28 Doug Kwan <dougkwan@google.com>
12560
12561 * arm.cc (Arm_relobj): New class definition.
12562 (Arm_relobj::scan_sections_for_stubs,
12563 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12564 New method definitions.
12565
12566 2009-10-28 Cary Coutant <ccoutant@google.com>
12567
12568 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12569 (Plugin::cleanup_done_): New member.
12570 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12571 (Plugin_manager::cleanup_done_): Remove.
12572 (Plugin_manager::add_input_file): Edit error message.
12573 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12574 (Plugin_manager::cleanup): Remove use of cleanup_done_.
12575
12576 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
12577
12578 * fileread.cc: (File_read::View::~View): Use the new
12579 data_ownership_ filed.
12580 (File_read::~File_read): Dispose the new whole_file_view_.
12581 (File_read::open): Mmap the whole file if needed.
12582 (File_read::open): Use whole_file_view_ instead of contents_.
12583 (File_read::find_view): Use whole_file_view_ if applicable.
12584 (File_read::do_read): Use whole_file_view_ instead of contents_.
12585 (File_read::make_view): Use whole_file_view_ instead of contents_,
12586 update File_read::View::View call.
12587 (File_read::find_or_make_view): Update File_read::View::View
12588 call.
12589 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12590 remove contents_
12591 (File_read::View::Data_ownership): New enum.
12592 (File_read::View::View): Replace bool mapped_ with Data_ownership
12593 argument.
12594 (File_read::View::mapped_): Remove (replaced by data_ownership_).
12595 (File_read::View::data_ownership_): New field.
12596 (File_read::contents_): Remove (replaced by whole_file_view_).
12597 (File_read::whole_file_view_): New field.
12598 * options.h (class General_options): Add --keep-files-mapped.
12599
12600 2009-10-27 Cary Coutant <ccoutant@google.com>
12601
12602 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12603 * testsuite/Makefile.am (plugin_test_5): New test case.
12604 * testsuite/Makefile.in: Regenerate.
12605
12606 2009-10-25 Doug Kwan <dougkwan@google.com>
12607
12608 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12609 from private to protected to allow access by child class.
12610 (Sized_relobj::do_relocate_sections): New method declaration.
12611 (Sized_relobj::relocate_sections): Virtualize.
12612 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12613 Sized_relobj::relocate_sections. Instantiate template explicitly
12614 for different target sizes and endianity.
12615
12616 2009-10-24 Doug Kwan <dougkwan@google.com>
12617
12618 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12619 (Arm_input_section::as_arm_input_section): New method.
12620 (Arm_output_section): New class definition.
12621 (Arm_output_section::create_stub_group,
12622 Arm_output_section::group_sections): New method definitions.
12623
12624 2009-10-22 Doug Kwan <dougkwan@google.com>
12625
12626 * arm.cc (Arm_input_section): New class definition.
12627 (Arm_input_section::init, Arm_input_section:do_write,
12628 Arm_input_section::set_final_data_size,
12629 Arm_input_section::do_reset_address_and_file_offset): New method
12630 definitions.
12631
12632 2009-10-21 Doug Kwan <dougkwan@google.com>
12633
12634 * arm.cc (Stub_table, Arm_input_section): New forward class
12635 declarations.
12636 (Stub_table): New class defintion.
12637 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12638 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12639 New method definition.
12640
12641 2009-10-21 Doug Kwan <dougkwan@google.com>
12642
12643 * arm.cc: Update copyright comments.
12644 (Target_arm): New forward class template declaration.
12645 (Arm_address): New type.
12646 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12647 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12648 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12649 constants.
12650 (Insn_template): Same.
12651 (DEF_STUBS): New macro.
12652 (Stub_type): New enum type.
12653 (Stub_template): New class definition.
12654 (Stub): Same.
12655 (Reloc_stub): Same.
12656 (Stub_factory): Same.
12657 (Target_arm::Target_arm): Initialize may_use_blx_ and
12658 should_force_pic_veneer_.
12659 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12660 Target_arm::should_force_pic_veneer,
12661 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12662 Target_arm::using_thumb_only, Target_arm:;default_target): New
12663 method defintions.
12664 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12665 New data member declarations.
12666 (Insn_template::size, Insn_template::alignment): New method defintions.
12667 (Stub_template::Stub_template): New method definition.
12668 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12669 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12670 (Stub_factory::Stub_factory): New method definition.
12671 * gold.h (string_hash): New template.
12672 * output.h (Input_section_specifier::hash_value): Use
12673 gold::string_hash.
12674 (Input_section_specifier::string_hash): Remove.
12675 * stringpool.cc (Stringpool_template::string_hash): Use
12676 gold::string_hash.
12677
12678 2009-10-20 Doug Kwan <dougkwan@google.com>
12679
12680 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12681 symbols of relaxed input sections.
12682 * output.h (Output_section::find_relaxed_input_section): Make
12683 method public.
12684
12685 2009-10-16 Doug Kwan <dougkwan@google.com>
12686
12687 * dynobj.cc (Versions::Versions): Initialize version_script_.
12688 Only insert base version symbol definition for a shared object
12689 if version script defines any version versions.
12690 (Versions::define_base_version): New method definition.
12691 (Versions::add_def): Check that base version is not needed.
12692 (Versions::add_need): Define base version lazily.
12693 * dynobj.h (Versions::define_base_version): New method declaration.
12694 (Versions::needs_base_version_): New data member declaration.
12695 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12696 (check_DATA): Add no_version_test.stdout.
12697 (libno_version_test.so, no_version_test.o no_version_test.stdout):
12698 New make rules.
12699 * testsuite/Makefile.in: Regenerate.
12700 * testsuite/no_version_test.c: New file.
12701 * testsuite/no_version_test.sh: Ditto.
12702
12703 2009-10-16 Doug Kwan <dougkwan@google.com>
12704
12705 * expression.cc (class Segment_start_expression): New class definition.
12706 (Segment_start_expression::value): New method definition.
12707 (script_exp_function_segment_start): Return a new
12708 Segment_start_expression.
12709 * gold/script-c.h (script_saw_segment_start_expression): New function
12710 prototype.
12711 * script-sections.cc (Script_sections::Script_sections): Initialize
12712 SAW_SEGMENT_START_EXPRESSION_ to false.
12713 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12714 and -Tbbs options to specify section addresses if given in
12715 command line and no SEGMENT_START expression is seen in a script.
12716 * script-sections.h (Script_sections::saw_segment_start_expression,
12717 Script_sections::set_saw_segment_start_expression): New method
12718 definition.
12719 (Script_sections::saw_segment_start_expression_): New data member
12720 declaration.
12721 * script.cc (script_saw_segment_start_expression): New function.
12722 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12723 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12724 script_test_7.sh and script_test_8.sh.
12725 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12726 script_test_8.stdout.
12727 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12728 (script_test_6, script_test_6.stdout, script_test_7,
12729 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12730 * Makefile.in: Regenerate.
12731 * testsuite/script_test_6.sh: New file.
12732 * testsuite/script_test_6.t: Same.
12733 * testsuite/script_test_7.sh: Same.
12734 * testsuite/script_test_7.t: Same.
12735 * testsuite/script_test_8.sh: Same.
12736
12737 2009-10-16 Doug Kwan <dougkwan@google.com>
12738
12739 * output.cc (Output_segment::set_section_list_address): Cast
12740 expressions to unsigned long long type to avoid format warnings.
12741
12742 2009-10-15 Ian Lance Taylor <iant@google.com>
12743
12744 * script.cc (Script_options::add_symbol_assignment): Always add a
12745 dot assignment to script_sections_.
12746 * script-sections.cc (Script_sections::add_dot_assignment):
12747 Initialize if necessary.
12748
12749 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12750 program headers with no load segment if there is a linker script.
12751
12752 * layout.cc (Layout::set_segment_offsets): Align the file offset
12753 to the segment aligment for -N or -n with no load segment.
12754 * output.cc (Output_segment::add_output_section): Don't crash if
12755 the first section is a TLS section.
12756 (Output_segment::set_section_list_addresses): Print an error
12757 message if the address moves backward in a linker script.
12758 * script-sections.cc
12759 (Output_section_element_input::set_section_addresses): Don't
12760 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12761 (Orphan_output_section::set_section_addresses): Likewise.
12762
12763 2009-10-15 Doug Kwan <dougkwan@google.com>
12764
12765 * layout.cc (Layout::finish_dynamic_section): Generate tags
12766 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12767 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12768 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12769
12770 2009-10-14 Ian Lance Taylor <iant@google.com>
12771
12772 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12773 fields.
12774 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12775 data_shdr fields of relinfo.
12776 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12777 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
12778 R_386_TLS_LDO_32, adjust based on section flags.
12779 (Target_i386::Relocate::fix_up_ldo): Remove.
12780
12781 2009-10-13 Ian Lance Taylor <iant@google.com>
12782
12783 Add support for -pie.
12784 * options.h (class General_options): Add -pie and
12785 --pic-executable.
12786 (General_options::output_is_position_independent): Test -pie.
12787 (General_options::output_is_executable): Return true if not shared
12788 and not relocatable.
12789 (General_options::output_is_pie): Remove.
12790 * options.cc (General_options::finalize): Reject incompatible uses
12791 of -pie.
12792 * gold.cc (queue_middle_tasks): A -pie link is not static.
12793 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12794 * symtab.cc (Symbol::final_value_is_known): Return false if
12795 output_is_position_independent.
12796 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12797 output_is_position_independent.
12798 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12799 output_is_position_independent.
12800 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12801 output_is_position_independent.
12802 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
12803 two_file_pie_test.
12804 (basic_pie_test.o, basic_pie_test): New targets.
12805 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
12806 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
12807 (two_file_pie_test): New target.
12808 * testsuite/Makefile.in: Rebuild.
12809 * README: Remove note saying that -pie is not supported.
12810
12811 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
12812
12813 * options.h (class General_options): Add -init and -fini.
12814 * layout.cc (Layout::finish_dynamic_section): Emit
12815 given init and fini functions.
12816
12817 2009-10-13 Sriraman Tallam <tmsriram@google.com>
12818
12819 * gc.h (gc_process_relocs): Check if icf is enabled using new
12820 function.
12821 * gold.cc (queue_initial_tasks): Likewise.
12822 (queue_middle_tasks): Likewise.
12823 * object.cc (do_layout): Likewise.
12824 * symtab.cc (is_section_folded): Likewise.
12825 * main.cc (main): Likewise.
12826 * reloc.cc (Read_relocs::run): Likewise.
12827 (Sized_relobj::do_scan_relocs): Likewise.
12828 * icf.cc (is_function_ctor_or_dtor): New function.
12829 (Icf::find_identical_sections): Check if function is ctor or dtor when
12830 safe icf is chosen.
12831 * options.h (General_options::icf): Change option to be an enum.
12832 (Icf_status): New enum.
12833 (icf_enabled): New method.
12834 (icf_safe_folding): New method.
12835 (set_icf_status): New method.
12836 (icf_status_): New variable.
12837 * (options.cc) (General_options::finalize): Set icf_status_.
12838 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
12839 icf_test and icf_keep_unique_test to use the --icf enum flag.
12840 * testsuite/icf_safe_test.sh: New file.
12841 * testsuite/icf_safe_test.cc: New file.
12842
12843 2009-10-12 Sriraman Tallam <tmsriram@google.com>
12844
12845 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
12846 includes to gc.h and icf.h.
12847 * arm.cc: Include gc.h.
12848 * gold.cc: Likewise.
12849 * i386.cc: Likewise.
12850 * powerpc.cc: Likewise.
12851 * sparc.cc: Likewise.
12852 * x86_64.cc: Likewise.
12853 * gc.h: Include icf.h.
12854
12855 2009-10-11 Ian Lance Taylor <iant@google.com>
12856
12857 * plugin.cc: Include "gold.h" before other header files.
12858
12859 2009-10-10 Chris Demetriou <cgd@google.com>
12860
12861 * options.h (Input_file_argument::Input_file_type): New enum.
12862 (Input_file_argument::is_lib_): Replace with...
12863 (Input_file_argument::type_): New member.
12864 (Input_file_argument::Input_file_argument): Take Input_file_type
12865 'type' rather than boolean 'is_lib' as second argument.
12866 (Input_file_argument::is_lib): Use type_.
12867 (Input_file_argument::is_searched_file): New function.
12868 (Input_file_argument::may_need_search): Handle is_searched_file.
12869 * options.cc (General_options::parse_library): Support -l:filename.
12870 (General_options::parse_just_symbols): Update for Input_file_argument
12871 changes.
12872 (Command_line::process): Likewise.
12873 * archive.cc (Archive::get_file_and_offset): Likewise.
12874 * plugin.cc (Plugin_manager::release_input_file): Likewise.
12875 * script.cc (read_script_file, script_add_file): Likewise.
12876 * fileread.cc (Input_file::Input_file): Likewise.
12877 (Input_file::will_search_for): Handle is_searched_file.
12878 (Input_file::open): Likewise.
12879 * readsyms.cc (Read_symbols::get_name): Likewise.
12880 * testsuite/Makefile.am (searched_file_test): New test.
12881 * testsuite/Makefile.in: Regenerate.
12882 * testsuite/searched_file_test.cc: New file.
12883 * testsuite/searched_file_test_lib.cc: New file.
12884
12885 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12886 Ian Lance Taylor <iant@google.com>
12887
12888 * descriptor.cc: Include <cstdio> and "binary-io.h".
12889 (Descriptors::open): Open the files in binary mode always.
12890 * script.cc (Lex::get_token): Treat \r as whitespace.
12891
12892 2009-10-09 Ian Lance Taylor <iant@google.com>
12893
12894 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
12895
12896 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
12897 Ian Lance Taylor <iant@google.com>
12898
12899 * configure.ac: Check for readv function also.
12900 * fileread.cc (readv): Define if not HAVE_READV.
12901 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
12902 does not exist.
12903 * config.in: Regenerate.
12904 * configure: Regenerate.
12905
12906 2009-10-09 Doug Kwan <dougkwan@google.com>
12907
12908 * layout.cc (Layout::make_output_section): Call target hook to make
12909 ordinary output section.
12910 (Layout::finalize): Adjust parameter list of call the
12911 Target::may_relax().
12912 * layout.h (class Layout::section_list): New method.
12913 * merge.h (Output_merge_base::entsize): Change visibility to public.
12914 (Output_merge_base::is_string, Output_merge_base::do_is_string):
12915 New methods.
12916 (Output_merge_string::do_is_string): New method.
12917 * object.cc (Sized_relobj::do_setup): renamed from
12918 Sized_relobj::set_up.
12919 * object.h (Sized_relobj::adjust_shndx,
12920 Sized_relobj::initializ_input_to_output_maps,
12921 Sized_relobj::free_input_to_output_maps): Change visibilities to
12922 protected.
12923 (Sized_relobj::setup): Virtualize.
12924 (Sized_relobj::do_setup): New method declaration.
12925 (Sized_relobj::invalidate_section_offset,
12926 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
12927 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
12928 * options.cc (parse_int): New function.
12929 * options.h (parse_int): New declaration.
12930 (DEFINE_int): New macro.
12931 (stub_group_size): New option.
12932 * output.cc (Output_section::Output_section): Initialize memebers
12933 merge_section_map_, merge_section_by_properties_map_,
12934 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
12935 (Output_section::add_input_section): Handled deferred code-fill
12936 generation and remove an old comment.
12937 (Output_section::add_relaxed_input_section): New method definition.
12938 (Output_section::add_merge_input_section): Use merge section by
12939 properties map to speed to search. Update merge section maps
12940 as appropriate.
12941 (Output_section::build_relaxation_map): New method definition.
12942 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
12943 Same.
12944 (Output_section::relax_input_section): Renamed to
12945 Output_section::convert_input_sections_to_relaxed_sections and change
12946 interface to take a vector of pointers to relaxed sections.
12947 (Output_section::find_merge_section,
12948 Output_section::find_relaxed_input_section): New method definitions.
12949 (Output_section::is_input_address_mapped,
12950 Output_section::output_offset, Output_section::output_address):
12951 Use output section data maps to speed up searching.
12952 (Output_section::find_starting_output_address): Add comments.
12953 (Output_section::do_write,
12954 Output_section::write_to_postprocessing_buffer): Do code-fill
12955 generation as appropriate.
12956 (Output_section::get_input_sections): Invalidate relaxed input section
12957 map.
12958 (Output_section::restore_states): Adjust type of checkpoint .
12959 Invalidate relaxed input section map.
12960 * output.h (Output_merge_base): New class declaration.
12961 (Input_section_specifier): New class defintion.
12962 (class Output_relaxed_input_section) Change base class to
12963 Output_section_data_build.
12964 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
12965 base class initializer.
12966 (Output_section::add_relaxed_input_section): New method declaration.
12967 (Output_section::Input_section): Change visibility to protected.
12968 (Output_section::Input_section::relobj,
12969 Output_section::Input_section::shndx): Handle relaxed input sections.
12970 Output_section::input_sections) Change visibility to protected. Also
12971 define overload to return a non-const pointer.
12972 (Output_section::Merge_section_properties): New class defintion.
12973 (Output_section::Merge_section_by_properties_map,
12974 Output_section::Output_section_data_by_input_section_map,
12975 Output_section::Relaxation_map): New types.
12976 (Output_section::relax_input_section): Rename method to
12977 Output_section::convert_input_sections_to_relaxed_sections and change
12978 interface to take a vector of relaxed section pointers.
12979 (Output_section::find_merge_section,
12980 Output_section::find_relaxed_input_section,
12981 Output_section::build_relaxation_map,
12982 Output_section::convert_input_sections_in_list_to_relaxed_sections):
12983 New method declarations.
12984 (Output_section::merge_section_map_
12985 Output_section::merge_section_by_properties_map_,
12986 Output_section::relaxed_input_section_map_,
12987 Output_section::is_relaxed_input_section_map_valid_,
12988 Output_section::generate_code_fills_at_write_): New data members.
12989 * script-sections.cc
12990 (Output_section_element_input::set_section_addresses): Call
12991 current_data_size and addralign methods of relaxed input sections.
12992 (Orphan_output_section::set_section_addresses): Call current_data_size
12993 and addralign methods of relaxed input sections.
12994 * symtab.cc (Symbol_table::compute_final_value): Extract template
12995 from the body of Symbol_table::sized_finalize_symbol.
12996 (Symbol_table::sized_finalized_symbol): Call
12997 Symbol_table::compute_final_value.
12998 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12999 (Symbol_table::compute_final_value): New templated method declaration.
13000 * target.cc (Target::do_make_output_section): New method defintion.
13001 * target.h (Target::make_output_section): New method declaration.
13002 (Target::relax): Add more parameters for input objects, symbol table
13003 and layout. Adjust call to do_relax.
13004 (Target::do_make_output_section): New method declaration.
13005 (Target::do_relax): Add parameters for input objects, symbol table
13006 and layout.
13007
13008 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13009
13010 * pread.c: Include stdio.h.
13011
13012 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13013
13014 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13015 defined.
13016
13017 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
13018
13019 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13020 Change read_shndx type to unsigned int.
13021 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13022 int.
13023 (Sized_dwarf_line_info::read_line_mappings): Likewise.
13024 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13025 Change read_shndx type to unsigned int.
13026 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13027 int.
13028 (Sized_dwarf_line_info::read_line_mappings): Likewise.
13029 * layout.cc (Layout::create_symtab_sections): Cast the result of
13030 local_symcount * symsize to off_t in the gold_assert.
13031
13032 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13033
13034 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13035 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13036 R_ARM_BASE_ABS.
13037 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13038 (Arm_relocate_functions::thm_abs5): New function.
13039 (Arm_relocate_functions::abs12): New function.
13040 (Arm_relocate_functions::abs16): New function.
13041 (Arm_relocate_functions::base_abs): New function.
13042 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13043 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
13044 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13045 R_ARM_BASE_ABS.
13046 (Scan::global): Likewise.
13047 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13048 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13049 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13050 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13051 R_ARM_BASE_ABS.
13052
13053 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13054
13055 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13056 (Arm_relocate_functions::movt_prel): New function.
13057 (Arm_relocate_functions::thm_movw_prel_nc): New function.
13058 (Arm_relocate_functions::thm_movt_prel): New function.
13059 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13060 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13061 (Scan::global, Relocate::relocate): Likewise.
13062 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13063
13064 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
13065
13066 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13067 Incremental_checker.
13068 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13069 unsigned int.
13070 (class Incremental_inputs_header): New class.
13071 (Incremental_inputs_header_writer): Edit comment.
13072 (Incremental_inputs_entry): New class.
13073 (Incremental_inputs_entry_writer): Edit comment.
13074 (Sized_incremental_binary::do_find_incremental_inputs_section):
13075 Add *strtab_shndx parameter, fill it.
13076 (Sized_incremental_binary::do_check_inputs): New method.
13077 (Incremental_checker::can_incrementally_link_output_file): Use
13078 Sized_incremental_binary::check_inputs.
13079 (Incremental_inputs::report_command_line): Save command line in
13080 command_line_.
13081 * incremental.h:
13082 (Incremental_binary::find_incremental_inputs_section): New
13083 method.
13084 (Incremental_binary::do_find_incremental_inputs_section): Add
13085 strtab_shndx parameter.
13086 (Incremental_binary::do_check_inputs): New pure virtual method.
13087 (Sized_incremental_binary::do_check_inputs): Declare.
13088 (Incremental_checker::Incremental_checker): Add incremental_inputs
13089 parameter, use it to initialize incremental_inputs_.
13090 (Incremental_checker::incremental_inputs_): New field.
13091 (Incremental_checker::command_line): New method.
13092 (Incremental_checker::inputs): New method.
13093 (Incremental_checker::command_line_): New field.
13094
13095 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
13096
13097 * incremental.cc: Include <cstdarg> and "target-select.h".
13098 (vexplain_no_incremental): New function.
13099 (explain_no_incremental): New function.
13100 (Incremental_binary::error): New method.
13101 (Sized_incremental_binary::do_find_incremental_inputs_section): New
13102 method.
13103 (make_sized_incremental_binary): New function.
13104 (open_incremental_binary): New function.
13105 (can_incrementally_link_file): Add checks if output is ELF and has
13106 inputs section.
13107 * incremental.h: Include "elfcpp_file.h" and "output.h".
13108 (Incremental_binary): New class.
13109 (Sized_incremental_binary): New class.
13110 (open_incremental_binary): Declare.
13111 * object.cc (is_elf_object): Use
13112 elfcpp::Elf_recognizer::is_elf_file.
13113 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13114 * output.h (Output_file::filesize): New method.
13115
13116 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13117
13118 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13119 New function.
13120 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13121 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13122 function.
13123 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13124 function.
13125 (Arm_relocate_functions::movw_abs_nc): New function.
13126 (Arm_relocate_functions::movt_abs): New function.
13127 (Arm_relocate_functions::thm_movw_abs_nc): New function.
13128 (Arm_relocate_functions::thm_movt_abs): New function.
13129 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13130 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13131 (Scan::global): Likewise.
13132 (Relocate::relocate): Likewise.
13133 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13134
13135 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13136
13137 * arm.cc (Arm_relocate_functions::got_prel) New function.
13138 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13139 (Relocate::relocate): Likewise.
13140 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13141
13142 2009-10-06 Ian Lance Taylor <iant@google.com>
13143
13144 * options.h (class General_options): Define
13145 split_stack_adjust_size parameter.
13146 * object.h (class Object): Add uses_split_stack_ and
13147 has_no_split_stack_ fields. Add uses_split_stack and
13148 has_no_split_stack accessor functions. Declare
13149 handle_split_stack_section.
13150 (class Reloc_symbol_changes): Define.
13151 (class Sized_relobj): Define Function_offsets. Declare
13152 split_stack_adjust, split_stack_adjust_reltype, and
13153 find_functions.
13154 * object.cc (Object::handle_split_stack_section): New function.
13155 (Sized_relobj::do_layout): Call handle_split_stack_section.
13156 * dynobj.cc (Sized_dynobj::do_layout): Call
13157 handle_split_stack_section.
13158 * reloc.cc (Sized_relobj::relocate_sections): Call
13159 split_stack_adjust for executable sections in split_stack
13160 objects. Pass reloc_map to relocate_section.
13161 (Sized_relobj::split_stack_adjust): New function.
13162 (Sized_relobj::split_stack_adjust_reltype): New function.
13163 (Sized_relobj::find_functions): New function.
13164 * target-reloc.h: Include "object.h".
13165 (relocate_section): Add reloc_symbol_changes parameter. Change
13166 all callers.
13167 * target.h (class Target): Add calls_non_split method. Declare
13168 do_calls_non_split virtual method. Declare match_view and
13169 set_view_to_nop.
13170 * target.cc: Include "elfcpp.h".
13171 (Target::do_calls_non_split): New function.
13172 (Target::match_view): New function.
13173 (Target::set_view_to_nop): New function.
13174 * gold.cc (queue_middle_tasks): Give an error if mixing
13175 split-stack and non-split-stack objects with -r.
13176 * i386.cc (Target_i386::relocate_section): Add
13177 reloc_symbol_changes parameter.
13178 (Target_i386::do_calls_non_split): New function.
13179 * x86_64.cc (Target_x86_64::relocate_section): Add
13180 reloc_symbol_changes parameter.
13181 (Target_x86_64::do_calls_non_split): New function.
13182 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13183 parameter.
13184 * powerpc.cc (Target_powerpc::relocate_section): Add
13185 reloc_symbol_changes parameter.
13186 * sparc.cc (Target_sparc::relocate_section): Add
13187 reloc_symbol_changes parameter.
13188 * configure.ac: Call AM_CONDITIONAL for the default target.
13189 * configure: Rebuild.
13190 * testsuite/Makefile.am (TEST_AS): New variable.
13191 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13192 (check_DATA): Add split_i386 and split_x86_64 files.
13193 (SPLIT_DEFSYMS): Define.
13194 (split_i386_[1234n].o): New targets.
13195 (split_i386_[124]): New targets.
13196 (split_i386_[1234r].stdout): New targets.
13197 (split_x86_64_[1234n].o): New targets.
13198 (split_x86_64_[124]): New targets.
13199 (split_x86_64_[1234r].stdout): New targets.
13200 (MOSTLYCLEANFILES): Add new executables.
13201 * testsuite/split_i386.sh: New file.
13202 * testsuite/split_x86_64.sh: New file.
13203 * testsuite/split_i386_1.s: New file.
13204 * testsuite/split_i386_2.s: New file.
13205 * testsuite/split_i386_3.s: New file.
13206 * testsuite/split_i386_4.s: New file.
13207 * testsuite/split_i386_n.s: New file.
13208 * testsuite/split_x86_64_1.s: New file.
13209 * testsuite/split_x86_64_2.s: New file.
13210 * testsuite/split_x86_64_3.s: New file.
13211 * testsuite/split_x86_64_4.s: New file.
13212 * testsuite/split_x86_64_n.s: New file.
13213 * testsuite/testfile.cc (Target_test): Update relocation_section
13214 function.
13215 * testsuite/Makefile.in: Rebuild.
13216
13217 2009-10-06 Ian Lance Taylor <iant@google.com>
13218
13219 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13220 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13221 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
13222 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13223 the address on ldo_addrs_.
13224 (Target_i386::Relocate::fix_up_ldo): New function.
13225
13226 2009-10-06 Rafael Espindola <espindola@google.com>
13227
13228 * plugin.cc (add_input_library): New.
13229 (Plugin::load): Add add_input_library to tv.
13230 (Plugin_manager::add_input_file): Add the is_lib argument.
13231 (add_input_file): Update call to Plugin_manager::add_input_file.
13232 (add_input_library): New.
13233 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13234
13235 2009-09-30 Doug Kwan <dougkwan@google.com>
13236
13237 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13238 symbol and call Symbol::may_need_copy_reloc to determine if
13239 a copy reloc is needed.
13240 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13241 nocopyreloc is given in command line.
13242 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13243 given in command line.
13244 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13245 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13246 of the removed Target_i386::may_need_copy_reloc.
13247 * options.h (copyreloc): New option with default value false.
13248 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13249 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13250 instead of the removed Target_powerpc::may_need_copy_reloc.
13251 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13252 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13253 instead of the removed Target_sparc::may_need_copy_reloc.
13254 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13255 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13256 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13257 instead of the removed Target_x86_64::may_need_copy_reloc.
13258
13259 2009-09-30 Ian Lance Taylor <iant@google.com>
13260
13261 * object.h (class Object): Remove target_ field, and target,
13262 sized_target, and set_target methods.
13263 (Object::sized_target): Remove.
13264 (class Sized_relobj): Update declarations. Remove sized_target.
13265 * object.cc (Sized_relobj::setup): Remove target parameter.
13266 Change all callers.
13267 (Input_objects::add_object): Don't do anything with the target.
13268 (make_elf_sized_object): Add punconfigured parameter. Change all
13269 callers. Set or test parameter target.
13270 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13271 Change all callers.
13272 * parameters.cc (Parameters::set_target): Change parameter type to
13273 be non-const.
13274 (Parameters::default_target): Remove.
13275 (set_parameters_target): Change parameter type to be non-const.
13276 (parameters_force_valid_target): New function.
13277 (parameters_clear_target): New function.
13278 * parameters.h (class Parameters): Update declarations. Remove
13279 default_target method. Add sized_target and clear_target
13280 methods. Change target_ to be non-const.
13281 (set_parameters_target): Update declaration.
13282 (parameters_force_valid_target): Declare.
13283 (parameters_clear_target): Declare.
13284 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13285 as NULL if we aren't searching.
13286 (Add_symbols::run): Don't check for compatible target.
13287 * fileread.cc (Input_file::open_binary): Call
13288 parameters_force_valid_target.
13289 * gold.cc (queue_middle_tasks): Likewise.
13290 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
13291 set_target on object.
13292 * dynobj.h (class Sized_dynobj): Update declarations.
13293 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13294 make_elf_object returns NULL.
13295 (Archive::include_member): Don't check whether object target is
13296 compatible.
13297 * output.cc (Output_section::add_input_section): Get target from
13298 parameters.
13299 (Output_section::relax_input_section): Likewise.
13300 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13301 parameters.
13302 (Sized_relobj::do_scan_relocs): Likewise.
13303 (Sized_relobj::relocate_sections): Likewise.
13304 * resolve.cc (Symbol_table::resolve): Likewise.
13305 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
13306 parameter. Change all callers.
13307 (Symbol_table::add_from_object): Get target from parameters.
13308 (Symbol_table::add_from_relobj): Don't check object target.
13309 (Symbol_table::add_from_dynobj): Likewise.
13310 (Symbol_table::define_special_symbol): Get target from
13311 parameters.
13312 * symtab.h (class Symbol_table): Update declaration.
13313 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13314 parameter. Change all callers. Clear parameter target.
13315 (Binary_test): Test target here.
13316 * testsuite/object_unittest.cc (gold_testsuite): Remove
13317 target_test_pointer parameter. Change all callers.
13318 (Object_test): Test target here.
13319
13320 2009-09-26 Ian Lance Taylor <iant@google.com>
13321
13322 * testsuite/initpri1.c: Don't try to use constructor priorities if
13323 compiling with gcc before 4.3.
13324
13325 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
13326
13327 * testsuite/retain_symbols_file_test.sh (check_present): Change
13328 output file name to retain_symbols_file_test.stdout.
13329 (check_absent): Likewise.
13330
13331 2009-09-18 Craig Silverstein <csilvers@google.com>
13332
13333 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13334 * options.cc: Include <cerrno> and <fstream>.
13335 (General_options::finalize): Parse -retain-symbols-file tag.
13336 * options.h: New flag.
13337 (General_options): New method should_retain_symbol, new
13338 variable symbols_to_retain.
13339 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13340 should_retain_symbol map.
13341 * testsuite/Makefile.am (retain_symbols_file_test): New test.
13342 * testsuite/Makefile.in: Regenerate.
13343 * testsuite/retain_symbols_file_test.sh: New file.
13344
13345 2009-09-18 Nick Clifton <nickc@redhat.com>
13346
13347 * po/es.po: Updated Spanish translation.
13348
13349 2009-09-17 Doug Kwan <dougkwan@google.com>
13350
13351 * debug.h (DEBUG_RELAXATION): New constant.
13352 (DEBUG_ALL): Add DEBUG_RELAXATION.
13353 (debug_string_to_enum): Add relaxation debug option.
13354 * layout.cc
13355 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13356 Layout::Relaxation_debug_check::read_sections,
13357 Layout::Relaxation_debug_check::read_sections): New method definitions.
13358 (Layout::Layout): Initialize data members
13359 record_output_section_data_from_scrips_,
13360 script_output_section_data_list_ and relaxation_debug_check_.
13361 (Layout::save_segments, Layout::restore_segments,
13362 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13363 Layout::relaxation_loop_body): New method definitions.
13364 (Layout::finalize): Support relaxation. Move section layout code to
13365 Layout::relaxation_loop_body.
13366 (Layout::set_asection_address_from_script): Move code for orphan
13367 section placement out.
13368 (Layout::place_orphan_sections_in_script): New method definition.
13369 * layout.h (Output_segment_headers, Output_file_header):
13370 New forward class declarations.
13371 (Layout::~Layout): Define.
13372 (Layout::new_output_section_data_from_script): New method definition.
13373 (Layout::place_orphan_sections_in_script): New method declaration.
13374 (Layout::Segment_states): New type declaration.
13375 (Layout::save_segments, Layout::restore_segments,
13376 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13377 Layout::relaxation_loop_body): New method declarations.
13378 (Layout::Output_section_data_list): New type declaration.
13379 (Layout::Relaxation_debug_check): New class definition.
13380 (Layout::record_output_section_data_from_script_,
13381 Layout::script_output_section_data_list_, Layout::segment_states_,
13382 Layout::relaxation_debug_check_): New data members.
13383 * output.cc: (Output_section_headers::do_size): New method definition.
13384 (Output_section_headers::Output_section_headers): Move size
13385 computation to Output_section_headers::do_size.
13386 (Output_segment_headers::do_size): New method definition.
13387 (Output_file_header::Output_file_header): Move size computation to
13388 Output_file_header::do_size and call it.
13389 (Output_file_header::do_size): New method definition.
13390 (Output_data_group::Output_data_group): Adjust call to
13391 Output_section_data.
13392 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13393 (Output_symtab_xindex::do_write): Add array bound check.
13394 (Output_section::Input_section::print_to_mapfile): Handle
13395 RELAXED_INPUT_SECTION_CODE.
13396 (Output_section::Output_section): Initialize data member checkpoint_.
13397 (Output_section::~Output_section): Delete checkpoint object pointed
13398 by checkpoint_.
13399 (Output_section::add_input_section): Always add an Input_section if
13400 relaxing.
13401 (Output_section::add_merge_input_section): Add assert.
13402 (Output_section::relax_input_section): New method definition.
13403 (Output_section::set_final_data_size): Set load address to zero for
13404 an unallocated section.
13405 (Output_section::do_address_and_file_offset_have_reset_values):
13406 New method definition.
13407 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13408 Handle relaxed input section.
13409 (Output_section::sort_attached_input_sections): Checkpoint input
13410 section list lazily.
13411 (Output_section::get_input_sections): Change type of input_sections to
13412 list of Simple_input_section pointers. Checkpoint input section list
13413 lazily. Also handle relaxed input sections.
13414 (Output_section::add_input_section_for_script): Take a reference to
13415 a Simple_input_section object instead of Relobj pointer and section
13416 index as parameter. Handle relaxed input sections.
13417 (Output_section::save_states, Output_section::restore_states): New
13418 method definitions.
13419 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13420 (Output_data::is_data_size_fixed): New method definition.
13421 (Output_data::reset_addresss_and_file_offset): Do not reset data size
13422 if it is fixed.
13423 (Output_data::address_and_file_offset_have_reset_values): New method
13424 definition.
13425 (Output_data::do_address_and_file_offset_have_reset_values): New method
13426 definition.
13427 (Output_data::set_data_size): Check that data size is not fixed.
13428 (Output_data::fix_data_size): New method definition.
13429 (Output_data::is_data_size_fixed_): New data member.
13430 (Output_section_headers::set_final_data_size): New method definition.
13431 (Output_section_headers::do_size): New method declaration.
13432 (Output_segment_headers::set_final_data_size): New method definition.
13433 (Output_segment_headers::do_size): New method declaration.
13434 (Output_file_header::set_final_data_size)::New method definition.
13435 (Output_file_header::do_size)::New method declaration.
13436 (Output_section_data::Output_section_data): Add new parameter
13437 is_data_size_fixed and use it to fix data size.
13438 (Output_data_const::Output_data_const): Adjust call to base class
13439 constructor and fix data size.
13440 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13441 base class constructor and fix data size.
13442 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13443 base class constructor and fix data size.
13444 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13445 class constructor and fix data size.
13446 (Output_data_group::set_final_data_size): New method definition.
13447 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13448 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13449 class constructor and fix data size.
13450 (Output_relaxed_input_section): New class definition.
13451 (Output_section::Simple_input_section): New class definition.
13452 (Output_section::get_input_sections): Adjust parameter list.
13453 (Output_section::add_input_section_for_script): Same.
13454 (Output_section::save_states, Output_section::restore_states,
13455 Output_section::do_address_and_file_offset_have_reset_values,
13456 (Output_section::Input_section::Input_section): Handle
13457 RELAXED_INPUT_SECTION_CODE. Add new overload for
13458 Output_relaxed_input_section.
13459 (Output_section::Input_section::is_input_section,
13460 Output_section::Input_section::set_output_section): Handle relaxed
13461 input section.
13462 (Output_section::Input_section::is_relaxed_input_section,
13463 Output_section::Input_section::output_section_data,
13464 Output_section::Input_section::relaxed_input_section): New method
13465 definitions.
13466 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13467 value.
13468 (Output_section::Input_section::u1_): Update comments.
13469 (Output_section::Input_section::u2_): Add new union member poris.
13470 (Output_section::Checkpoint_output_section): New classs definition.
13471 (Output_section::relax_input_section): New method declaration.
13472 (Output_section::checkpoint_): New data member.
13473 (Output_segment): Update comments.
13474 (Output_segment::Output_segment): Un-privatize copy constructor.
13475 (Output_segment::operator=): Un-privatize.
13476 * script-sections.cc (Output_section_element::Input_section_list):
13477 Change element type to Output_section::Simple_input_section.
13478 (Output_section_element_dot_assignment::set_section_addresses):
13479 Register output section data for relaxation clean up.
13480 (Output_data_exression::Output_data_expression): Adjust call to base
13481 constructor to fix data size.
13482 (Output_section_element_data::set_section_addresses): Register
13483 Output_data_expression object for relaxation clean up.
13484 (struct Input_section_info): Replace Relobj pointer and section index
13485 pair with Output_section::Simple_input_section and Convert struct to a
13486 class.
13487 (Input_section_sorter::operator()): Adjust access to
13488 Input_section_info data member to use accessors.
13489 (Output_section_element_input::set_section_addresses): Use layout
13490 parameter. Adjust code to use Output_section::Simple_input_section
13491 and Input_secction_info classes. Register filler for relaxation
13492 clean up.
13493 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13494 and section index pair with Output_section::Simple_input_section
13495 class. Adjust code accordingly.
13496 (Phdrs_element::release_segment): New method definition.
13497 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13498 segment list.
13499 (Script_sections::release_segments): New method definition.
13500 * gold/script-sections.h (Script_sections::release_segments): New
13501 method declaration.
13502 * gold/target.h (Target::may_relax, Target::relax,
13503 Target::do_may_relax, Target::do_relax): New method definitions.
13504
13505 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
13506
13507 * arm.cc (has_signed_unsigned_overflow): New function.
13508 (Arm_relocate_functions::abs8): New function.
13509 (Target_arm::Scan::local): Handle R_ARM_ABS8.
13510 (Target_arm::Scan::global): Likewise.
13511 (Target_arm::relocate::relocate): Likewise.
13512 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13513 Likewise.
13514
13515 2009-09-16 Cary Coutant <ccoutant@google.com>
13516
13517 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13518 * testsuite/Makefile.in: Regenerate.
13519
13520 2009-09-11 Nick Clifton <nickc@redhat.com>
13521
13522 * po/gold.pot: Updated by the Translation project.
13523
13524 2009-09-08 Cary Coutant <ccoutant@google.com>
13525
13526 * output.cc (Output_file::open): Add execute permission to empty file.
13527 * testsuite/Makefile.am (permission_test): New test.
13528 * testsuite/Makefile.in: Regenerate.
13529
13530 2009-09-02 Ian Lance Taylor <iant@google.com>
13531
13532 * output.cc (Output_file::resize): Call map_no_anonymous rather
13533 than map.
13534
13535 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
13536
13537 * gold.cc: Include "incremental.h".
13538 (queue_initial_tasks): Call Incremental_checker methods.
13539 * incremental.cc: Include "output.h".
13540 (Incremental_checker::can_incrementally_link_output_file): New
13541 method.
13542 * incremental.h (Incremental_checker): New class.
13543
13544 * output.cc (Output_file::open_for_modification): New method.
13545 (Output_file::map_anonymous): Changed return type to bool. Record
13546 map in base_ field.
13547 (Output_file::map_no_anonymous): New method, broken out of map.
13548 (Output_file::map): Use map_no_anonymous and map_anonymous.
13549 * output.h (class Output_file): Update declarations.
13550
13551 2009-08-24 Cary Coutant <ccoutant@google.com>
13552
13553 * options.h (Command_line::Pre_options): New class.
13554 (Command_line::pre_options): New member.
13555 * options.cc (gold::options::ready_to_register): New variable.
13556 (One_option::register_option): Do nothing if not registering options.
13557 Assert if same short option registered twice.
13558 (General_options::General_options): Turn off option registration when
13559 done constructing.
13560 (Command_line::Pre_options::Pre_options): New constructor.
13561
13562 2009-08-24 Cary Coutant <ccoutant@google.com>
13563
13564 * options.h (General_options::no_keep_memory): Remove incorrect
13565 short option.
13566
13567 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
13568
13569 * Makefile.am (am__skiplex, am__skipyacc): New.
13570 * Makefile.in: Regenerate.
13571
13572 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
13573
13574 * Makefile.am (AM_CPPFLAGS): Renamed from ...
13575 (INCLUDES): ... this.
13576 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13577 (AM_CPPFLAGS): Renamed from ...
13578 (INCLUDE): ... this.
13579 * Makefile.in, testsuite/Makefile.in: Regenerate.
13580
13581 * Makefile.in: Regenerate.
13582 * aclocal.m4: Likewise.
13583 * config.in: Likewise.
13584 * configure: Likewise.
13585 * testsuite/Makefile.in: Likewise.
13586
13587 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13588 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13589 * Makefile.in: Regenerate.
13590 * testsuite/Makefile.in: Regenerate.
13591
13592 2009-08-19 Cary Coutant <ccoutant@google.com>
13593
13594 * resolve.cc (Symbol_table::resolve): Don't complain about defined
13595 symbols in shared libraries overridden by hidden or internal symbols
13596 in the main program.
13597
13598 2009-08-19 Chris Demetriou <cgd@google.com>
13599
13600 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13601 checking source file names in error messages.
13602
13603 2009-08-18 Doug Kwan <dougkwan@google.com>
13604
13605 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13606 an elcpp::Ehdr as parameter. Adjust call to set_target.
13607 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13608 an elfcpp::Ehdr as parameter.
13609 * object.cc (Object::set_target): Remove the version that looks up
13610 a target and sets it.
13611 (Sized_relobj::setup): Take a Target object instead of
13612 an elfcpp::Ehdr as parameter. Adjust call to set_target.
13613 (make_elf_sized_object): Find target and ask target to
13614 make an ELF object.
13615 * object.h: (Object::set_target): Remove the version that looks up
13616 a target and sets it.
13617 (Sized_relobj::setup): Take a Target object instead of
13618 an elfcpp:Ehdr as parameter.
13619 * target.cc: Include dynobj.h.
13620 (Target::do_make_elf_object_implementation): New.
13621 (Target::do_make_elf_object): New.
13622 * target.h (Target::make_elf_object): New template declaration.
13623 (Target::do_make_elf_object): New method declarations.
13624 (Target::do_make_elf_object_implementation): New template declaration.
13625
13626 2009-08-14 Ian Lance Taylor <iant@google.com>
13627
13628 * gold.h (FUNCTION_NAME): Define.
13629 (gold_unreachable): Use FUNCTION_NAME.
13630
13631 2009-08-12 Sriraman Tallam <tmsriram@google.com>
13632
13633 * icf.cc (Icf::find_identical_sections): Issue a warning when a
13634 symbol in the --keep-unique list is not found.
13635
13636 2009-08-12 Sriraman Tallam <tmsriram@google.com>
13637
13638 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13639 been maked as --keep-unique.
13640 (Icf::unfold_section): New function.
13641 * icf.h (Icf::unfold_section): New function.
13642 * options.h (General_options::keep_unique): New option.
13643 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13644 * testsuite/Makefile.in: Regenerate.
13645 * testsuite/icf_keep_unique_test.sh: New file.
13646 * testsuite/icf_keep_unique_test.cc: New file.
13647
13648 2009-08-12 Cary Coutant <ccoutant@google.com>
13649
13650 PR 10471
13651 * resolve.cc (Symbol_table::resolve): Check for references from
13652 dynamic objects to hidden and internal symbols.
13653 * testsuite/Makefile.am (hidden_test.sh): New test.
13654 * testsuite/Makefile.in: Regenerate.
13655 * testsuite/hidden_test.sh: New script.
13656 * testsuite/hidden_test_1.c: New test source.
13657 * testsuite/hidden_test_main.c: New test source.
13658
13659 2009-08-11 Doug Kwan <dougkwan@google.com>
13660
13661 * arm.cc: Update comments.
13662 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13663 segment to locate the .ARM.exidx section if present.
13664
13665 2009-08-09 Doug Kwan <dougkwan@google.com>
13666
13667 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13668 patch.
13669
13670 2009-08-07 Sriraman Tallam <tmsriram@google.com>
13671 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13672 compiler warnings.
13673
13674 2009-08-06 Sriraman Tallam <tmsriram@google.com>
13675
13676 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13677 valid tls_segment only for non-debug-section relocations.
13678 * testsuite/Makefile.am: Add gc_tls_test.
13679 * testsuite/Makefile.in: Regenerate.
13680 * testsuite/gc_tls_test.cc: New file.
13681 * testsuite/gc_tls_test.sh: New file.
13682
13683 2009-08-05 Sriraman Tallam <tmsriram@google.com>
13684
13685 * icf.cc: New file.
13686 * icf.h: New file.
13687 * Makefile.am (CCFILES): Add icf.cc.
13688 (HFILES): Add icf.h
13689 * Makefile.in: Regenerate.
13690 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13691 * gc.h (gc_process_relocs): Populate lists used by icf to contain
13692 section, symbol and addend information for the relocs.
13693 * gold.cc (queue_middle_tasks): Call identical code folding.
13694 * gold.h: Add defines for multimap.
13695 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13696 to the call of finalize_local_symbols.
13697 * main.cc (main): Create object of class Icf.
13698 * object.cc (Sized_relobj::do_layout): Allow this function to be
13699 called twice during icf.
13700 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13701 to sections marked as identical by icf.
13702 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13703 when available.
13704 (Sized_relobj::do_section_entsize): New function.
13705 * object.h (Object::section_entsize): New function.
13706 (Object::do_section_entsize): New pure virtual function.
13707 (Relobj::finalize_local_symbols): Add new parameter.
13708 (Relobj::do_section_entsize): New function.
13709 * options.h (General_options::icf): New option.
13710 (General_options::icf_iterations): New option.
13711 (General_options::print_icf_sections): New option.
13712 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13713 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13714 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13715 icf.
13716 * symtab.cc (Symbol_table::is_section_folded): New function.
13717 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
13718 to sections marked as identical by icf.
13719 * symtab.h (Symbol_table::set_icf): New function.
13720 (Symbol_table::icf): New function.
13721 (Symbol_table::is_section_folded): New function.
13722 (Symbol_table::icf_): New data member.
13723 * target-reloc.h (relocate_section): Ignore sections folded by icf.
13724 * testsuite/Makefile.am: Add commands to build icf_test.
13725 * testsuite/Makefile.in: Regenerate.
13726 * testsuite/icf_test.sh: New file.
13727 * testsuite/icf_test.cc: New file.
13728
13729 2009-07-24 Chris Demetriou <cgd@google.com>
13730
13731 * layout.cc (is_compressible_debug_section): Fix incorrect
13732 comment about compressed section names.
13733
13734 2009-07-20 Ian Lance Taylor <ian@airs.com>
13735
13736 PR 10419
13737 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13738
13739 2009-07-16 Ian Lance Taylor <iant@google.com>
13740
13741 PR 10400
13742 * layout.h: #include <map>.
13743 (class Kept_section): Change from struct to class. Add accessors
13744 and setters. Add section size to Comdat_group mapping. Change
13745 Comdat_group to std::map. Add is_comdat_ field. Add
13746 linkonce_size field in union.
13747 (class Layout): Update declaration of find_or_add_kept_section.
13748 Don't declare find_kept_object.
13749 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13750 parameter. Add object, shndx, is_comdat, and is_group_name
13751 parameters. Change all callers. Adjust for new Kept_section.
13752 (Layout::find_kept_object): Remove.
13753 * object.cc (Sized_relobj::include_section_group): Update use of
13754 Kept_section. Rename secnum to shndx. Only record
13755 Kept_comdat_section if sections are the same size.
13756 (Sized_relobj::include_linkonce_section): Update use of
13757 Kept_section. Only record Kept_comdat_section if sections are the
13758 same size. Set size of linkonce section.
13759 (Sized_relobj::map_to_kept_section): Update call to
13760 get_kept_comdat_section.
13761 * object.h (class Sized_relobj): Rename fields in
13762 Kept_comdat_section to drop trailing underscores; change object
13763 field to Relobj*. Change Kept_comdat_section_table to store
13764 struct rather than pointer.
13765 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13766 Add kept_object and kept_shndx parameters. Change all callers.
13767 (Sized_relobj::get_kept_comdat_section): Change return type to
13768 bool. Add kept_object and kept_shndx parameters. Change all
13769 callers.
13770 * plugin.cc (Pluginobj::include_comdat_group): Update call to
13771 Layout::find_or_add_kept_section.
13772
13773 2009-07-09 Ian Lance Taylor <iant@google.com>
13774
13775 * merge.cc (Object_merge_map::initialize_input_to_output_map):
13776 Reserve space in the hash table.
13777
13778 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
13779
13780 * fileread.cc (File_read::get_mtime): New method.
13781 * fileread.h (Timespec): New structure.
13782 (File_read::get_mtime): New method.
13783 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13784 Renamed from timestamp_nsec.
13785 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13786 Elf_Xword.
13787 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13788 timestamp_nsec.
13789 (Incremental_inputs::report_archive): Save mtime; style fix.
13790 (Incremental_inputs::report_obejct): Save mtime; style fix.
13791 (Incremental_inputs::report_script): Save mtime; style fix.
13792 (Incremental_inputs::finalize_inputs): Style fix.
13793 (Incremental_inputs::finalize): Style fix.
13794 (Incremental_inputs::create_input_section_data): Store inputs
13795 mtime.
13796 * incremental.h (Incremental_inputs::report_script): Add mtime
13797 argument.
13798 (Incremental_inputs::Input_info::Input_info): Intialize only one
13799 union member.
13800 (Incremental_inputs::Input_info::archive): Move to nameless
13801 union.
13802 (Incremental_inputs::Input_info::obejct): Move to nameless union.
13803 (Incremental_inputs::Input_info::script): Move to nameless union.
13804 (Incremental_inputs::mtime): New field.
13805 * script.cc (read_input_script): Pass file mtime to
13806 Incremental_input.
13807 * script.h (Script_info::inputs): Style fix.
13808
13809 2009-07-01 Ian Lance Taylor <ian@airs.com>
13810
13811 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
13812 instead of 32.
13813
13814 2009-06-24 Ian Lance Taylor <iant@google.com>
13815
13816 PR 10156
13817 * layout.cc (Layout::choose_output_section): If we find an
13818 existing section, update the flags.
13819 (Layout::create_notes): New function, broken out of
13820 Layout::finalize.
13821 (Layout::finalize): Don't create note sections.
13822 (Layout::create_note): Don't crash if linker script discards
13823 section.
13824 (Layout::create_gold_note): Likewise.
13825 (Layout::create_build_id): Likewise. Don't set
13826 after_input_sections on the section.
13827 (Layout::create_executable_stack_info): Remove target parameter.
13828 Change caller.
13829 * layout.h (class Layout): Declare create_notes. Update
13830 declaration of create_executable_stack_info.
13831 * gold.cc (queue_middle_tasks): Call create_notes.
13832 * output.cc (Output_section::update_flags_for_input_section): Move
13833 here from output.h. If SHF_ALLOC flag is newly set, mark address
13834 invalid.
13835 * output.h (Output_data::mark_address_invalid): New function.
13836 (class Output_section): Only declare, not define,
13837 update_flags_for_input_section. Remove set_flags.
13838
13839 2009-06-24 Ian Lance Taylor <iant@google.com>
13840
13841 * script-sections.cc (Output_section_definition::
13842 set_section_addresses): Rename shadowing local load_address to
13843 laddr.
13844
13845 2009-06-24 Ian Lance Taylor <iant@google.com>
13846
13847 PR 10244
13848 * reloc.cc (relocate_sections): Skip empty relocation sections.
13849
13850 2009-06-23 Ian Lance Taylor <iant@google.com>
13851
13852 PR 10156
13853 * layout.cc (Layout::create_note): Use choose_output_section
13854 rather than make_output_section.
13855
13856 2009-06-23 Ian Lance Taylor <iant@google.com>
13857
13858 PR 10237
13859 * options.cc (General_options::parse_V): Set printed_version_.
13860 (General_options::General_options): Initialize printed_version_.
13861 * options.h (class General_options): Add printed_version_ field.
13862 * gold.cc (queue_initial_tasks): If there are no input files,
13863 don't give a fatal error if we printed the version information.
13864 (queue_middle_tasks): If using -r with a shared object, give a
13865 fatal error rather than an ordinary error.
13866
13867 2009-06-23 Ian Lance Taylor <iant@google.com>
13868
13869 PR 10219
13870 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
13871 (Layout::make_output_section): Set have_stabstr_section_ if we see
13872 a .stab*str section.
13873 (Layout::finalize): Call link_stabs_sections.
13874 (Layout::link_stabs_sections): New file.
13875 * layout.h (class Layout): Add have_stabstr_section_ field.
13876 Declare link_stabs_sections.
13877
13878 2009-06-23 Doug Kwan <dougkwan@google.com>
13879
13880 * Makefile.am (libgold_a_LIBADD): New.
13881 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
13882 * Makefile.in: Regenerate.
13883 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
13884 * configure: Regenerate.
13885 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
13886 * fileread.cc: Include sys/state.h
13887 * gold.h: Declare memmem and strndup if found missing.
13888 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
13889
13890 2009-06-23 Ian Lance Taylor <iant@google.com>
13891
13892 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
13893 * configure: Rebuild.
13894
13895 2009-06-23 Ian Lance Taylor <iant@google.com>
13896
13897 PR 10147
13898 * object.cc (Object::section_contents): Don't try to get a view if
13899 the section has length zero.
13900 (Object::handle_gnu_warning_section): If the section is empty, use
13901 the name of the section as the warning.
13902
13903 2009-06-23 Ian Lance Taylor <iant@google.com>
13904
13905 PR 10133
13906 * stringpool.h (class Stringpool_template): Add optimize_ field.
13907 (Stringpool_template::set_optimize): New function.
13908 * stringpool.cc (Stringpool_template::Stringpool_template):
13909 Initialize optimize_ field.
13910 (Stringpool_template::set_string_offsets): Test local optimize
13911 fild rather than parameter.
13912 * layout.cc (Layout::Layout): Call set_optimize on the section
13913 name stringpool.
13914
13915 2009-06-22 Ian Lance Taylor <iant@google.com>
13916
13917 PR 10030
13918 * yyscript.y: Parse TARGET.
13919 * script.cc (script_set_target): New function.
13920 * script-c.h (script_set_target): Declare.
13921 * options.cc (General_options::string_to_object_format): Rename
13922 from string_to_object_format in anonymous namespace. Change
13923 callers.
13924 * options.h (class General_options): Declare
13925 string_to_object_format.
13926
13927 2009-06-22 Ian Lance Taylor <iant@google.com>
13928
13929 * script-sections.cc (Script_sections::create_segments): Don't put
13930 program headers in a PT_LOAD segment if -n or -N.
13931
13932 2009-06-22 Ian Lance Taylor <iant@google.com>
13933
13934 PR 10141
13935 * options.h (class General_options): Add -z lazy and -z now. Sort
13936 -z options into alphabetical order.
13937 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
13938
13939 2009-06-21 Ian Lance Taylor <iant@google.com>
13940
13941 * layout.cc (Layout::make_output_section): Call
13942 Target::new_output_section.
13943 (Layout::attach_allocated_section_to_segment): Put large section
13944 sections in a separate load segment with the large segment flag
13945 set.
13946 (Layout::segment_precedes): Sort large data segments after other
13947 load segments.
13948 (align_file_offset): New static function.
13949 (Layout::set_segment_offsets): Use align_file_offset.
13950 * output.h (class Output_section): Add is_small_section_ and
13951 is_large_section_ fields.
13952 (Output_section::is_small_section): New function.
13953 (Output_section::set_is_small_section): New function.
13954 (Output_section::is_large_section): New function.
13955 (Output_section::set_is_large_section): New function.
13956 (Output_section::is_large_data_section): New function.
13957 (class Output_segment): Add is_large_data_segment_ field.
13958 (Output_segment::is_large_data_segment): New function.
13959 (Output_segment::set_is_large_data_segment): New function.
13960 * output.cc (Output_section::Output_section): Initialize new
13961 fields.
13962 (Output_segment::Output_segment): Likewise.
13963 (Output_segment::add_output_section): Add assertion that large
13964 data sections always go in large data segments. Force small data
13965 sections to the end of the list of data sections. Force small BSS
13966 sections to the start of the list of BSS sections. For large BSS
13967 sections to the end of the list of BSS sections.
13968 * symtab.h (class Symbol): Declare is_common_shndx.
13969 (Symbol::is_defined): Check Symbol::is_common_shndx.
13970 (Symbol::is_common): Likewise.
13971 (class Symbol_table): Define enum Commons_section_type. Update
13972 declarations. Add small_commons_ and large_commons_ fields.
13973 * symtab.cc (Symbol::is_common_shndx): New function.
13974 (Symbol_table::Symbol_table): Initialize new fields.
13975 (Symbol_table::add_from_object): Put small and large common
13976 symbols in the right list.
13977 (Symbol_table::sized_finalized_symbol): Check
13978 Symbol::is_common_shndx.
13979 (Symbol_table::sized_write_globals): Likewise.
13980 * common.cc (Symbol_table::do_allocate_commons): Allocate new
13981 common symbol lists. Don't call do_allocate_commons_list if the
13982 list is empty.
13983 (Symbol_table::do_allocate_commons_list): Remove is_tls
13984 parameter. Add comons_section_type parameter. Change all
13985 callers. Handle small and large common symbols.
13986 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13987 Symbol::is_common_shndx.
13988 * resolve.cc (symbol_to_bits): Likewise.
13989 * target.h (Target::small_common_shndx): New function.
13990 (Target::small_common_section_flags): New function.
13991 (Target::large_common_shndx): New function.
13992 (Target::large_common_section_flags): New function.
13993 (Target::new_output_section): New function.
13994 (Target::Target_info): Add small_common_shndx, large_common_shndx,
13995 small_common_section_flags, and large_common_section_flags
13996 fields.
13997 (Target::do_new_output_section): New virtual function.
13998 * arm.cc (Target_arm::arm_info): Initialize new fields.
13999 * i386.cc (Target_i386::i386_info): Likewise.
14000 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14001 Likewise.
14002 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14003 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14004 (Target_x86_64::do_new_output_section): New function.
14005 * configure.ac: Define conditional MCMODEL_MEDIUM.
14006 * testsuite/Makefile.am (check_PROGRAMS): Add large.
14007 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14008 (large_LDFLAGS): Define.
14009 * testsuite/large.c: New file.
14010 * testsuite/testfile.cc (Target_test::test_target_info):
14011 Initialize new fields.
14012 * configure, testsuite/Makefile.in: Rebuild.
14013
14014 2009-06-05 Doug Kwan <dougkwan@google.com>
14015
14016 * Makefile.am (CCFILES): Add target.cc.
14017 * Makefile.in: Regenerate.
14018 * i386.cc (class Target_i386): Define new virtual method to
14019 override do_is_local_label_name in parent.
14020 * object.cc (Sized_relobj::do_count_local_symbols): Discard
14021 local symbols if --discard-locals or -X is given.
14022 * options.h (class General_options): Declare new options
14023 '--discard-locals' and '-X' for discarding locals.
14024 * target.h (class Target): Define new methods is_local_label_name.
14025 Declare new virtual method do_is_local_label_name.
14026 * target.cc: New file.
14027 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14028 (check_SCRIPTS): Add discard_locals_test.sh.
14029 (check_DATA): Add discard_local_tests.syms.
14030 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14031 (discard_local_tests.syms, discard_locals_test.o): New make rules.
14032 * testsuite/Makefile.in: Regenerate.
14033 * testsuite/discard_locals_test.c: New file.
14034 * testsuite/discard_locals_test.sh: Same.
14035
14036 2009-06-05 Doug Kwan <dougkwan@google.com>
14037
14038 * object.cc (Sized_relobj::Sized_relobj): Initialize
14039 discarded_eh_frame_shndx_ to -1U.
14040 (Sized_relobj::do_layout): Record index of a discard .eh_frame
14041 section.
14042 (Sized_relobj::do_count_local_symbols): Skip local symbols in
14043 a discarded .eh_frame section.
14044 (Sized_relobj::do_finalize_local_symbols): Ditto.
14045 * object.h (class Sized_relobj): Declare new member
14046 discarded_eh_frame_shndx_.
14047 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14048 (local_labels_test.o, local_labels_test): New rules.
14049 * testsuite/Makefile.in: Regenerate.
14050
14051 2009-06-04 Doug Kwan <dougkwan@google.com>
14052
14053 * layout.cc (Layout::section_name_mapping): Add mapping for
14054 special ARM sections.
14055
14056 2009-06-03 Doug Kwan <dougkwan@google.com>
14057
14058 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14059 (utils::has_overflow): Same.
14060
14061 2009-06-03 Ian Lance Taylor <iant@google.com>
14062
14063 * layout.cc (Layout::section_name_mapping): New array, replacing
14064 Layout::linkonce_mapping.
14065 (Layout::section_name_mapping_count): New variable, replacing
14066 Layout::linkonce_mapping_count.
14067 (Layout::linkonce_output_name): Remove.
14068 (Layout::output_section_name): Rewrite.
14069 * layout.h (class Layout): Rename Linkonce_mapping to
14070 Section_name_mapping, linkonce_mapping to section_name_mapping,
14071 linkonce_mapping_count to section_name_mapping_count. Don't
14072 declare linkonce_output_name.
14073
14074 2009-06-03 Doug Kwan <dougkwan@google.com>
14075
14076 * gold/arm.cc (namespace utils): New.
14077 (Target_arm::reloc_is_non_pic): Define new method.
14078 (class Arm_relocate_functions): New.
14079 (Target_arm::Relocate::relocate): Handle relocation types used by
14080 Android.
14081
14082 2009-06-03 Ian Lance Taylor <iant@google.com>
14083
14084 * arm.cc (Target_arm::scan::global): Use || instead of |.
14085
14086 2009-06-02 Doug Kwan <dougkwan@google.com>
14087
14088 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
14089 issued_non_pic_error_.
14090 (class Target_arm::Scan): Declare new method check_non_pic.
14091 Define new method symbol_needs_plt_entry.
14092 Declare new data member issued_non_pic_error_.
14093 (class Target_arm::Relocate): Declare new method
14094 should_apply_static_reloc.
14095 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14096 (Target_arm::Scan::check_non_pic): Define new method.
14097 (Target_arm::Scan::local): Handle a small subset of reloc types used
14098 by Android.
14099 (Target_arm::Scan::local): Same.
14100 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14101
14102 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
14103
14104 * incremental.cc (Incremental_inputs::report_command_line): Filter
14105 out --incremental-* options.
14106
14107 2009-05-29 Doug Kwan <dougkwan@google.com>
14108
14109 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14110 template class.
14111 (class Target_arm): Update comment.
14112 (Target_arm::Target_arm): Initialize new data members GOT_,
14113 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14114 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14115 and Target_arm::rel_dyn_section.
14116 Declare new_enum Target_arm::Got_type.
14117 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14118 and DYNBSS_.
14119 Update commments for member do_dynsym_value.
14120 (Target_arm::got_size, Target_arm::plt_section,
14121 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14122 new methods inside class defintion.
14123 (Target_arm::got_section): Define new method.
14124 (Target_arm::rel_dyn_section): Same.
14125 (Output_data_plt_arm): New template class.
14126 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14127 (Output_data_plt_arm:do_adjust_output_section): Define new method.
14128 (Output_data_plt_arm::add_entry): Same.
14129 (Output_data_plt_arm::first_plt_entry): Define new
14130 static data member for PLT instruction template.
14131 (Output_data_plt_arm::plt_entry): Same.
14132 (Output_data_plt_arm::do_write): Define new method.
14133 (Target_arm::make_plt_entry): Same.
14134 (Target_arm::do_finalize_sections): Same.
14135 (Target_arm::do_dynsym_value): Same.
14136
14137 2009-05-28 Doug Kwan <dougkwan@google.com>
14138
14139 * Makefile.am (TARGETSOURCES): Add arm.cc.
14140 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14141 * Makefile.in: Regenerate.
14142 * arm.cc: New file.
14143 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14144
14145 2009-05-26 Doug Kwan <dougkwan@google.com>
14146
14147 * options.cc (General_options::parse_exclude_libs). Fix a comment.
14148 (General_options::check_excluded_libs): Strip off directories in
14149 archive name before matching like GNU ld does.
14150 * testsuite/Makefile.am (MOSTLYCLEANFILES,
14151 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14152 (exclude_libs_test_LDFLAGS): Add linker option
14153 -Wl,--exclude-libs,libexclude_libs_test_3
14154 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14155 an explicit archive without using -l.
14156 (alt/libexclude_libs_test_3.a): New make rule.
14157 * testsuite/Makefile.in: Regenerate.
14158 * testsuite/exclude_libs_test.c : Declare lib3_default().
14159 (main): Call it.
14160 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14161 * exclude_libs_test_3.c: New file.
14162
14163 2009-05-26 Nick Clifton <nickc@redhat.com>
14164
14165 * po/id.po: New Indonesian translation.
14166 * po/gold.pot: Updated template file.
14167
14168 2009-05-22 Sriraman Tallam <tmsriram@google.com>
14169
14170 * testsuite/Makefile.am: Add -ffunction-sections to compile
14171 gc_comdat_test files. Add -Wl,--gc-sections to build
14172 gc_comdat_test.
14173 * testsuite/Makefile.in: Regenerate.
14174 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14175
14176 2009-05-21 Sriraman Tallam <tmsriram@google.com>
14177
14178 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14179 kept comdat section was garbage collected.
14180 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14181 * testsuite/Makefile.in: Regenerate.
14182 * testsuite/gc_comdat_test.sh: New file.
14183 * testsuite/gc_comdat_test_1.cc: New file.
14184 * testsuite/gc_comdat_test_2.cc: New file.
14185
14186 2009-05-19 Doug Kwan <dougkwan@google.com>
14187
14188 * archive.cc (Archive::Archive): Move constructor from archive.h
14189 to here. Initialize no_export_.
14190 (Archive::get_elf_object_for_member): Set no_export flag of object.
14191 * archive.h (Archive::Archive): Move constructor body to
14192 archive.cc.
14193 (Archive::no_export): New method.
14194 (Archive::no_export_): New field.
14195 * object.h (Object::Object): Initialize no_export_ to false.
14196 (Object::no_export, Object::set_no_export): New methods.
14197 (Object::no_export_): New field.
14198 * options.cc (General_options::parse_exclude_libs): New method.
14199 (General_options::check_excluded_libs) Same.
14200 * options.h (exclude_libs): New option.
14201 (General_options::check_excluded_libs): New method declaration.
14202 (General_options::excluded_libs_): New field.
14203 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14204 default or protected visibility if an object has no-export flag set.
14205 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14206 (check_SCRIPTS): Add exclude_libs_test.sh.
14207 (check_DATA): Add exclude_libs_test.syms.
14208 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14209 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14210 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14211 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14212 (exclude_libs_test.syms, libexclude_libs_test_1.a,
14213 libexclude_libs_test_2.a): New rules.
14214 * testsuite/Makefile.in: Regenerate.
14215 * testsuite/exclude_libs_test.c: New file.
14216 * testsuite/exclude_libs_test.sh: Ditto.
14217 * testsuite/exclude_libs_test_1.c: Ditto.
14218 * testsuite/exclude_libs_test_2.c: Ditto.
14219
14220 2009-05-15 Ian Lance Taylor <iant@google.com>
14221
14222 * configure.ac: Check for declarations for cases where libiberty.h
14223 checks HAVE_DECL_xxx.
14224 * configure, config.in: Rebuild.
14225
14226 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
14227
14228 * gold.h (Incremental_argument_list): Remove (invalid) forward
14229 declaration.
14230 * incremental.cc (Incremental_inputs::report_achive): New method.
14231 (Incremental_inputs::report_object): New method.
14232 (Incremental_inputs::report_script): New method.
14233 (Incremental_inputs::finalize_inputs): New method.
14234 (Incremental_inputs::finalize): Call finalize_inputs().
14235 (Incremental_inputs::sized_create_incremental_inputs_section_data):
14236 Create inputs entries.
14237 * incremental.h (Incremental_input_type): New enum.
14238 (Incremental_inputs::Incremental_input): Initialize new fields.
14239 (Incremental_inputs::report_inputs): New method.
14240 (Incremental_inputs::report_achive): New method.
14241 (Incremental_inputs::report_object): New method.
14242 (Incremental_inputs::report_script): New method.
14243 (Incremental_inputs::finalize_inputs): New method.
14244 (Incremental_inputs::Input_info): New struct.
14245 (Incremental_inputs::Input_info_map): New typedef.
14246 (Incremental_inputs::lock_): New field.
14247 (Incremental_inputs::Inputs_): New field.
14248 (Incremental_inputs::Inputs_map): New field.
14249 * main.cc (main): Call Incremental_input::report_inputs.
14250 * options.h (Input_argument_list): Typedef moved from
14251 Input_arguments.
14252 (Input_file_group::Files): Remove, use ::Input_argument_list.
14253 (Input_file_group::Input_argument_list): Remove, use
14254 ::Input_argument_list.
14255 * plugin.cc (Plugin_manager::add_input_file): Add error in
14256 incremental build.
14257 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14258 functions.
14259 * script.cc (read_input_script): Call
14260 Incremental_input::report_script.
14261 * script.h (Script_info): New class.
14262
14263 2009-04-27 Ian Lance Taylor <iant@google.com>
14264
14265 * x86_64.cc (do_adjust_output_section): Set entsize to
14266 plt_entry_size.
14267
14268 2009-04-23 Elliott Hughes <enh@google.com>
14269
14270 * output.cc (Output_file::close): After short writes, continue
14271 writing from the correct offset in the buffer being written.
14272
14273 2009-04-23 Chris Demetriou <cgd@google.com>
14274
14275 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14276 * configure: Regenerate.
14277 * config.in: Regenerate.
14278 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14279 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14280
14281 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
14282
14283 * incremental.cc (Incremental_inputs_header_data): Renamed from
14284 Incremental_input_header_data.
14285 (Incremental_inputs_header_data::data_size): New field.
14286 (Incremental_inputs_header_data::put_input_file_count): Renamed
14287 from input_file_count.
14288 (Incremental_inputs_header_data::put_command_line_offset): Renamed
14289 from command_line_offset.
14290 (Incremental_inputs_header_data::put_reserved): Renamed from
14291 put_reserved.
14292 (Incremental_inputs_entry_data): Renamed from
14293 Incremental_input_entry_data.
14294 (Incremental_inputs_entry_data::data_size): New field.
14295 (Incremental_inputs::report_command_line): New method.
14296 (Incremental_inputs::finalize): New method.
14297 (Incremental_inputs::create_incremental_inputs_data): New method.
14298 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14299 * incremental.h: New file.
14300 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14301 (Layout::finalize): Create incremental inputs section in
14302 incremental builds.
14303 (Layout::create_incremental_info_sections): New method.
14304 * layout.h (Layout::incremental_inputs): New method.
14305 (Layout::create_incremental_info_sections): New method.
14306 (Layout::incremental_inputs_): New field.
14307 * main.cc (main): Notify Incremental_input of the command line.
14308
14309 2009-04-01 Ian Lance Taylor <iant@google.com>
14310 Mikolaj Zalewski <mikolajz@google.com>
14311
14312 * gold.h (reserve_unordered_map): Define, three versions, one for
14313 each version of Unordered_map.
14314 * layout.cc (Layout::Layout): Remove options parameter. Add
14315 number_of_input_files parameter. Don't initialize options_.
14316 Initialize number_of_input_files_ and resized_signatures_. Move
14317 sections_are_attached_.
14318 (Layout::layout_group): Reserve space for group_signatures_.
14319 (Layout::find_or_add_kept_section): Change name parameter to be a
14320 reference. Resize signatures_ map when it gets large enough.
14321 (Layout::layout_eh_frame): Use parameters->options() instead of
14322 this->options_.
14323 (Layout::make_output_section): Likewise.
14324 (Layout::attach_allocated_section_to_segment): Likewise.
14325 (Layout::finalize, Layout::create_executable_stack): Likewise.
14326 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14327 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14328 * layout.h (class Layout): Update declarations. Remove options_
14329 field. Add number_of_input_files_ and resized_signatures_
14330 fields. Move sections_are_attached_ field.
14331 * main.cc (main): Pass number of input files to Layout
14332 constructor. Don't pass options.
14333
14334 2009-03-30 Ian Lance Taylor <iant@google.com>
14335
14336 * ffsll.c (ffsll): Correct implementation.
14337
14338 2009-03-27 Ian Lance Taylor <iant@google.com>
14339
14340 * ffsll.c: New file.
14341 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14342 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14343 * ftruncate.c (ftruncate): Declare before definition.
14344 * mremap.c (mremap): Likewise.
14345 * pread.c (pread): Likewise.
14346 * configure, Makefile.in, config.in: Rebuild.
14347
14348 * mremap.c: New file.
14349 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14350 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14351 (mremap): Declare if HAVE_MREMAP is not defined.
14352 * configure, Makefile.in, config.in: Rebuild.
14353
14354 2009-03-27 Cary Coutant <ccoutant@google.com>
14355
14356 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14357 position independent.
14358 * sparc.cc (Target_sparc::check_non_pic): Likewise.
14359 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14360
14361 2009-03-24 Cary Coutant <ccoutant@google.com>
14362
14363 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14364 an executable.
14365 (needs_dynamic_reloc): Likewise.
14366
14367 2009-03-24 Ian Lance Taylor <iant@google.com>
14368
14369 * yyscript.y (file_cmd): Recognize EXTERN.
14370 (extern_name_list, extern_name_list_body): New nonterminals.
14371 * script.cc (script_add_extern): Define.
14372 * script-c.h (script_add_extern): Declare.
14373
14374 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
14375
14376 * object.cc (is_elf_object): Define.
14377 * object.h (is_elf_object): Declare.
14378 * archive.cc (Archive::get_elf_object_for_member): Call
14379 is_elf_object.
14380 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14381
14382 2009-03-24 Elliott Hughes <enh@google.com>
14383
14384 * output.cc (Output_file::map_anonymous): Define.
14385 (Output_file::map): Use map_anonymous. If the regular mmap fails,
14386 try an anonymous one. Report the size if the mmap fails.
14387 * output.h (class Output_file): Declare map_anonymous.
14388
14389 2009-03-24 Ian Lance Taylor <iant@google.com>
14390
14391 * target-select.cc (instantiate_target): Don't acquire the lock if
14392 the instantiated_target_ field has already been set.
14393
14394 2009-03-23 Ian Lance Taylor <iant@google.com>
14395
14396 * gold-threads.h (class Initialize_lock): Define.
14397 * gold-threads.cc (class Initialize_lock_once): Define.
14398 (initialize_lock_control): New static variable.
14399 (initialize_lock_pointer): New static variable.
14400 (initialize_lock_once): New static function.
14401 (Initialize_lock::Initialize_lock): Define.
14402 (Initialize_lock::initialize): Define.
14403 * target-select.h: Include "gold-threads.h".
14404 (class Target_selector): Add lock_ and initialize_lock_ fields.
14405 Don't define instantiate_target, just declare it.
14406 * target-select.cc (Target_selector::Target_selector): Initialize
14407 new fields.
14408 (Target_selector::instantiate_target): Define.
14409 * descriptors.h: Include "gold-threads.h".
14410 (class Descriptors): Add initialize_lock_ field.
14411 * descriptors.cc (Descriptors::Descriptors): Initialize new
14412 field.
14413 (Descriptors::open): Use initialize_lock_ field
14414 * errors.h (class Errors): Add initialize_lock_ field.
14415 * errors.cc (Errors::Errors): Initialize new field.
14416 (Errors::initialize_lock): Use initialize_lock_ field.
14417 * powerpc.cc (class Target_selector_powerpc): Remove
14418 instantiated_target_ field. In do_recognize call
14419 instantiate_target rather than do_instantiate_target. In
14420 do_instantiate_target just allocate a new target.
14421 * sparc.cc (class Target_selector_sparc): Likewise.
14422
14423 * freebsd.h: New file.
14424 * i386.cc: Include "freebsd.h".
14425 (Target_i386): Derive from Target_freebsd rather than
14426 Sized_target.
14427 (Target_selector_i386): Derive from Target_selector_freebsd rather
14428 than Target_selector.
14429 * x86_64.cc: Include "freebsd.h".
14430 (Target_x86_64): Derive from Target_freebsd rather than
14431 Sized_target.
14432 (Target_selector_x86_64): Derive from Target_selector_freebsd
14433 rather than Target_selector.
14434 * target.h (class Target): Add adjust_elf_header and
14435 do_adjust_elf_header.
14436 * output.cc (Output_file_header:: do_sized_write): Call target
14437 adjust_elf_header routine.
14438 * configure.tgt: Set targ_osabi.
14439 * configure.ac: Define GOLD_DEFAULT_OSABI.
14440 * parameters.cc (Parameters::default_target): Pass
14441 GOLD_DEFAULT_OSABI to select_target.
14442 * target-select.h (class Target_selector): Make instantiate_target
14443 protected rather than private.
14444 * Makefile.am (HFILES): Add freebsd.h.
14445 * configure, Makefile.in, config.in: Rebuild.
14446
14447 * merge.cc (do_add_input_section): Correct pend value. Change
14448 message about last entry not being null terminated from error to
14449 warning.
14450
14451 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
14452
14453 * incremental.cc: New file.
14454 * Makefile.am (CCFILES): Add incremental.cc.
14455 * Makefile.in: Rebuild.
14456
14457 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
14458
14459 * layout.cc (Layout::output_section_name): Preserve names
14460 of '.note.' sections.
14461
14462 2009-03-19 Ian Lance Taylor <iant@google.com>
14463
14464 * descriptors.cc (Descriptors::open): Check that the options are
14465 valid before using them.
14466
14467 2009-03-18 Ian Lance Taylor <iant@google.com>
14468
14469 * script-sections.h: Include <list>.
14470 (class Script_sections): Change Sections_elements from std::vector
14471 to std::list. Typedef public Elements_iterator. Add
14472 orphan_section_placement_, data_segment_align_start_, and
14473 saw_data_segment_align_ fields. Remove data_segment_align_index_
14474 field.
14475 * script-sections.cc (class Orphan_section_placement): New class.
14476 (class Sections_element): Add virtual functions is_relro and
14477 orphan_section_init. Remove virtual function place_orphan_here.
14478 (class Output_section_definition): Add is_relro and
14479 orphan_section_init. Remove place_orphan_here.
14480 (class Orphan_output_section): Likewise.
14481 (Script_sections::Script_sections): Update for field changes.
14482 (Script_sections::data_segment_align): Set saw_data_segment_align_
14483 and data_segment_align_start_, not data_segment_align_index.
14484 (Script_sections::data_segment_relro_end): Check
14485 saw_data_segment_align_. Use data_segment_align_start_ rather
14486 than data_segment_align_index_.
14487 (Script_sections::place_orphan): Rewrite to use
14488 Orphan_section_placement.
14489
14490 2009-03-17 Ian Lance Taylor <iant@google.com>
14491
14492 * archive.cc (Archive::add_symbols): Check for a version attached
14493 to the symbol name in the archive map.
14494 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14495 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14496 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14497 (ver_test_11.a): New target.
14498 * testsuite/Makefile.in: Rebuild.
14499
14500 * configure.ac: Check for chsize and posix_fallocate. Replace
14501 ftruncate.
14502 * ftruncate.c: New file, from gnulib.
14503 * output.cc (posix_fallocate): Define dummy version if not
14504 HAVE_POSIX_FALLOCATE.
14505 (Output_file::map): Call posix_fallocate rather than lseek and
14506 write.
14507 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14508 * configure, Makefile.in, config.in: Rebuild.
14509
14510 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
14511
14512 * layout.h (Layout::create_note): Add section_name parameter.
14513 * layout.cc (Layout::create_note): Likewise.
14514 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14515
14516 2009-03-17 Ian Lance Taylor <iant@google.com>
14517
14518 * descriptors.cc: Include "options.h".
14519 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14520 (Descriptors::open): Always use O_CLOEXEC when opening a new
14521 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
14522 then set FD_CLOEXEC.
14523
14524 * sparc.cc (class Target_sparc): Add has_got_section.
14525 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14526 make sure we have a GOT section.
14527
14528 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14529 (Target_sparc::Scan::local): Likewise.
14530 (Target_sparc::Scan::global): Likewise.
14531 (Target_sparc::Relocate::relocate): Likewise.
14532 (Target_sparc::Relocate::relocate_tls): Likewise.
14533
14534 * symtab.cc (Symbol_table::define_default_version): New function,
14535 broken out of add_from_object.
14536 (Symbol_table::add_from_object): Call define_default_version.
14537 (Symbol_table::define_special_symbol): Add resolve_oldsym
14538 parameter. Change all callers. If the version for a symbol comes
14539 from a version script, resolve it with the symbol with the same
14540 name with no version. Also add the symbol without a version if
14541 appropriate.
14542 (do_define_in_output_data): If resolving with oldsym, don't delete
14543 sym.
14544 (do_define_in_output_segment): Likewise.
14545 (do_define_as_constant): Likewise.
14546 * symtab.h (class Symbol_table): Update declarations.
14547
14548 2009-03-13 Ian Lance Taylor <iant@google.com>
14549
14550 * readsyms.cc (Read_symbols::incompatible_warning): New function.
14551 (Read_symbols::requeue): New function.
14552 (Read_symbols::do_read_symbols): If make_elf_object fails because
14553 the target type is not configured, and the file was searched for,
14554 issue a warning and retry with the next directory.
14555 (Add_symbols::run): If the file has an incompatible format, and
14556 it was searched for, requeue the Read_symbols task. On error,
14557 release the object.
14558 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
14559 dirindex parameter to constructor. Change all callers. Declare
14560 incompatible_warning and requeue.
14561 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14562 input_argument_ and input_group_ fields. Add them to
14563 constructor. Change all callers.
14564 (class Read_script): Add dirindex_ field. Add it to constructor.
14565 Change all callers.
14566 * archive.cc (Archive::setup): Remove input_objects parameter.
14567 Change all callers.
14568 (Archive::get_file_and_offset): Likewise.
14569 (Archive::read_all_symbols): Likewise.
14570 (Archive::read_symbols): Likewise.
14571 (Archive::get_elf_object_for_member): Remove input_objects
14572 parameter. Add punconfigured parameter. Change all callers.
14573 (Archive::add_symbols): Change return type to bool. Check return
14574 value of include_member.
14575 (Archive::include_all_members): Likewise.
14576 (Archive::include_member): Change return type to bool. Return
14577 false if first included object has incompatible target. Set
14578 included_member_ field.
14579 (Add_archive_symbols::run): If add_symbols returns false, requeue
14580 Read_symbols task.
14581 * archive.h (class Archive): Add included_member_ field.
14582 Initialize it in constructor. Add input_file and searched_for
14583 methods. Update declarations.
14584 (class Add_archive_symbols): Add dirpath_, dirindex_, and
14585 input_argument_ fields. Add them to constructor. Change all
14586 callers.
14587 * script.cc: Include "target-select.h".
14588 (class Parser_closure): Add skip_on_incompatible_target_ and
14589 found_incompatible_target_ fields. Add
14590 skip_on_incompatible_target parameter to constructor. Change all
14591 callers. Add methods skip_on_incompatible_target,
14592 clear_skip_on_incompatible_target, found_incompatible_target, and
14593 set_found_incompatible_target.
14594 (read_input_script): Add dirindex parameter. Change all callers.
14595 If parser finds an incompatible target, requeue Read_symbols
14596 task.
14597 (script_set_symbol): Clear skip_on_incompatible_target in
14598 closure.
14599 (script_add_assertion, script_parse_option): Likewise.
14600 (script_start_sections, script_add_phdr): Likewise.
14601 (script_check_output_format): New function.
14602 * script.h (read_input_script): Update declaration.
14603 * script-c.h (script_check_output_format): Declare.
14604 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14605 (ignore_cmd): Remove OUTPUT_FORMAT.
14606 * fileread.cc (Input_file::Input_file): Add explicit this.
14607 (Input_file::will_search_for): New function.
14608 (Input_file::open): Add pindex parameter. Change all callers.
14609 * fileread.h (class Input_file): Add input_file_argument method.
14610 Declare will_search_for. Update declarations.
14611 * object.cc (make_elf_object): Add punconfigured parameter.
14612 Change all callers.
14613 * object.h (class Object): Make input_file public. Add
14614 searched_for method.
14615 (make_elf_object): Update declaration.
14616 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
14617 restart search.
14618 * dirsearch.h (class Dirsearch): Update declaration.
14619 * options.h (class General_options): Add --warn-search-mismatch.
14620 * parameters.cc (Parameters::is_compatible_target): New function.
14621 * parameters.h (class Parameters): Declare is_compatible_target.
14622 * workqueue.cc (Workqueue::add_blocker): New function.
14623 * workqueue.h (class Workqueue): Declare add_blocker.
14624
14625 * fileread.cc (Input_file::open): Remove options parameter.
14626 Change all callers.
14627 (Input_file::open_binary): Likewise.
14628 * script.cc (read_input_script): Likewise.
14629 * readsyms.h (class Read_symbols): Remove options_ field. Remove
14630 options parameter from constructor. Change all callers.
14631 (class Read_script): Likewise.
14632 * fileread.h (class Input_file): Update declarations.
14633 * script.h (read_input_script): Update declaration.
14634
14635 2009-03-10 Nick Clifton <nickc@redhat.com>
14636
14637 * po/es.po: New Spanish translation.
14638
14639 2009-03-06 Cary Coutant <ccoutant@google.com>
14640
14641 * options.cc (parse_short_option): Keep dash_z from registering itself.
14642
14643 2009-03-03 Ian Lance Taylor <iant@google.com>
14644
14645 PR 9918
14646 * target-reloc.h (relocate_section): Pass output_section to
14647 relocate.
14648 * i386.cc (Target_i386::should_apply_static_reloc): Add
14649 output_section parameter. Change all callers.
14650 (Target_i386::Relocate::relocate): Add output_section parameter.
14651 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14652 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14653 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14654 * testsuite/two_file_shared.sh: New script.
14655 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14656 (check_DATA): Add two_file_shared.dbg.
14657 (two_file_shared.dbg): New target.
14658 * testsuite/Makefile.in: Rebuild.
14659
14660 2009-03-01 Ian Lance Taylor <iant@google.com>
14661
14662 * configure.ac: Check for byteswap.h.
14663 * configure: Rebuild.
14664 * config.in: Rebuild.
14665
14666 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
14667
14668 * layout.cc (Layout::find_or_add_kept_section): New function.
14669 (Layout::add_comdat): Removed.
14670 * layout.h (struct Kept_section): Move out of class Layout.
14671 Remove trailing underscores from field names. Add group_sections
14672 field. Rename group_ field to is_group. Change all uses.
14673 (class Layout): Declare find_or_add_kept_section, not add_comdat.
14674 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14675 comdat_groups_ field.
14676 (Sized_relobj::include_section_group): Use
14677 find_or_add_kept_section and Kept_section::group_sections.
14678 (Sized_relobj::include_linkonce_section): Likewise.
14679 * object.cc (class Sized_relobj): Don't define Comdat_group or
14680 Comdat_group_table. Remove find_comdat_group and
14681 add_comdat_group. Remove comdat_groups_ field.
14682 * plugin.cc (include_comdat_group): Use
14683 Layout::find_or_add_kept_section.
14684
14685 2009-02-28 Ian Lance Taylor <iant@google.com>
14686
14687 * README: --gc-sections and map files are now supported. Document
14688 some build requirements.
14689
14690 PR 6992
14691 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14692 relocatable link set the value of the section symbol to zero.
14693 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14694 relocatable link don't include the section address in the local
14695 symbol value.
14696
14697 2009-02-27 Ian Lance Taylor <iant@google.com>
14698
14699 PR 6811
14700 * options.h (class Search_directory): Add is_system_directory.
14701 (class General_options): Declare is_in_system_directory.
14702 * options.cc (get_relative_sysroot): Make static.
14703 (get_default_sysroot): Make static.
14704 (General_optoins::is_in_system_directory): New function.
14705 * fileread.cc (Input_file::is_in_system_directory): New function.
14706 * fileread.h (class Input_file): Declare is_in_system_directory.
14707 * object.h (class Object): Add is_in_system_directory.
14708 (class Input_objects): Remove system_library_directory_ field.
14709 * object.cc (Input_objects::add_object): Don't set
14710 system_library_directory_.
14711 (input_objects::found_in_system_library_directory): Remove.
14712 * symtab.cc (Symbol_table::write_globals): Remove input_objects
14713 parameter. Change all callers.
14714 (Symbol_table::sized_write_globals): Likewise.
14715 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14716 Call Object::is_in_system_directory.
14717 * symtab.h (class Symbol_table): Update declarations.
14718
14719 PR 5990
14720 * descriptors.h (Open_descriptor): Add is_on_stack field.
14721 * descriptors.cc (Descriptors::open): If the descriptor is on the
14722 top of the stack, remove it. Initialize is_on_stack field.
14723 (Descriptors::release): Only add pod to stack if it is not on the
14724 stack already.
14725 (Descriptors::close_some_descriptor): Clear stack_next and
14726 is_on_stack fields.
14727
14728 PR 7091
14729 * output.cc (Output_section::find_starting_output_address): Rename
14730 from starting_output_address; add PADDR parameter; change return
14731 type.
14732 * output.h (class Output_section): Declare
14733 find_starting_output_address instead of starting_output_address.
14734 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14735 section symbol for which we can't find a merge section.
14736
14737 PR 9836
14738 * symtab.cc (Symbol_table::add_from_object): If the visibility is
14739 hidden or internal, force the symbol to be local.
14740 * resolve.cc (Symbol::override_visibility): Define.
14741 (Symbol::override_base): Use override_visibility.
14742 (Symbol_table::resolve): Likewise.
14743 (Symbol::override_base_with_special): Likewise.
14744 (Symbol_table::override_with_special): If the visibility is hidden
14745 or internal, force the symbol to be local.
14746 * symtab.h (class Symbol): Add set_visibility and
14747 override_visibility.
14748 * testsuite/ver_test_1.sh: New file.
14749 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14750 (check_DATA): Add ver_test_1.syms.
14751 (ver_test_1.syms): New target.
14752 * testsuite/Makefile.in: Rebuild.
14753
14754 2009-02-25 Cary Coutant <ccoutant@google.com>
14755
14756 * layout.cc (Layout::choose_output_section): Don't rename sections
14757 when using a linker script that has a SECTIONS clause.
14758 * Makefile.in: Regenerate.
14759
14760 * testsuite/Makefile.am (script_test_5.sh): New test case.
14761 * testsuite/Makefile.in: Regenerate.
14762 * testsuite/script_test_5.cc: New file.
14763 * testsuite/script_test_5.sh: New file.
14764 * testsuite/script_test_5.t: New file.
14765
14766 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
14767
14768 * archive.cc (Archive::include_member): Update calls to add_symbols.
14769 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14770 the Layout argument.
14771 * dynobj.h (do_add_symbols): Add the Layout argument.
14772 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14773 Layout argument.
14774 * object.h (Object::add_symbols): Add the Layout argument.
14775 (Object::do_add_symbols): Add the Layout argument.
14776 (Sized_relobj::do_add_symbols): Add the Layout argument.
14777 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14778 Unify the two versions.
14779 (Add_plugin_symbols): Remove.
14780 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14781 (Sized_pluginobj::do_add_symbols): Unify the two versions.
14782 (Add_plugin_symbols): Remove.
14783 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14784 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14785 (Add_symbols::run): Make it work with Pulginobj.
14786
14787 2009-02-06 Ian Lance Taylor <iant@google.com>
14788
14789 * object.cc (Sized_relobj::do_layout): Make info message start
14790 with lower case letter.
14791
14792 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
14793
14794 * binary.cc: Fix file comment.
14795
14796 * options.h (enum Incremental_disposition): Define.
14797 (class General_options): Add new options: --incremental,
14798 --incremental_changed, --incremental_unchanged,
14799 --incremental_unknown. Add incremental_disposition_ and
14800 implicit_incremental_ fields.
14801 (General_options::incremental_disposition): New function.
14802 (class Position_dependent_options): Add incremental_disposition
14803 option.
14804 (Position_dependent_options::copy_from_options): Set incremental
14805 dispositions.
14806 * options.cc (General_options::parse_incremental_changed): New
14807 function.
14808 (General_options::parse_incremental_unchanged): New function.
14809 (General_options::parse_incremental_unknown): New function.
14810 (General_options::General_options): Initialize new fields
14811 incremental_disposition_ and implicit_incremental_.
14812 (General_options::finalize): Check for uasge of --incremental-*
14813 without --incremental.
14814
14815 2009-02-06 Chris Demetriou <cgd@google.com>
14816
14817 * gold.h (gold_undefined_symbol): Change to take only a Symbol
14818 pointer and to report location as the file name associated with
14819 the symbol.
14820 (gold_undefined_symbol_at_location): New function to replace the
14821 old gold_undefined_symbol functionality.
14822 * target-reloc.h (relocate_section): Update to use
14823 gold_undefined_symbol_at_location.
14824 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14825 Call gold_undefined_symbol function rather than gold_error.
14826 * errors.h (Errors::undefined_symbol): Take location as a
14827 string, rather than calculating it from a relocation.
14828 * errors.cc (Errors::fatal): Print "fatal error:" before the
14829 formatted message.
14830 (Errors::error, Errors::error_at_location): Print "error: "
14831 before the formatted message.
14832 (Errors::undefined_symbol): Take location as a string, rather
14833 than calculating it from a relocation.
14834 (gold_undefined_symbol_at_location): New function akin to
14835 old gold_undefined_symbol, calculates location from relocation.
14836 (gold_undefined_symbol): Change to take only a Symbol pointer
14837 and to report location as the file name associated with the symbol.
14838 * testsuite/debug_msg.sh: Update for changed error messages.
14839 * testsuite/undef_symbol.sh: Likewise.
14840
14841 2009-02-04 Duncan Sands <baldrick@free.fr>
14842
14843 PR 9812
14844 * reduced_debug_output.h
14845 (Output_reduced_debug_abbrev_section::failed): Use format for
14846 gold_warning.
14847 (Output_reduced_debug_info_section::faild): Likewise.
14848
14849 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
14850
14851 * script.cc (Lazy_demangler): New class.
14852 (Version_script_info::get_symbol_version_helper): Demangle a
14853 symbol only once.
14854
14855 2009-01-29 Cary Coutant <ccoutant@google.com>
14856
14857 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
14858 to __tls_get_addr.
14859 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14860
14861 2009-01-28 Ian Lance Taylor <iant@google.com>
14862
14863 * version.cc (version_string): Bump to 1.9.
14864
14865 * gold.h: Include <cstring> and <stdint.h>.
14866 * version.cc: Include <cstdio>.
14867 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
14868 warning.
14869 * reduced_debug_output.cc (insert_into_vector): Rename from
14870 Insert_into_vector; change all callers. Use Swap_unaligned to
14871 avoid aliasing issue; remove union since it is unnecessary.
14872
14873 2009-01-27 Sriraman Tallam <tmsriram@google.com>
14874
14875 * Makefile.am (CCFILES): Add gc.cc.
14876 (HFILES): Add gc.h.
14877 * Makefile.in: Regenerate.
14878 * gold.cc (Gc_runner): New class.
14879 (queue_initial_tasks): Call garbage collection related tasks
14880 when corresponding options are invoked.
14881 (queue_middle_gc_tasks): New function.
14882 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
14883 processed early before laying out sections during garbage collection.
14884 * gold.h (queue_middle_gc_tasks): New function.
14885 (is_prefix_of): Move from "layout.cc".
14886 * i386.cc (Target_i386::gc_process_relocs): New function.
14887 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
14888 * main.cc (main): Create object of class "Garbage_collection".
14889 * object.cc (Relobj::copy_symbols_data): New function.
14890 (Relobj::is_section_name_included): New function.
14891 (Sized_relobj::do_layout): Allow this function to be called twice
14892 during garbage collection and defer layout of section during the
14893 first call.
14894 * object.h (Relobj::get_symbols_data): New function.
14895 (Relobj::is_section_name_included): New function.
14896 (Relobj::copy_symbols_data): New function.
14897 (Relobj::set_symbols_data): New function.
14898 (Relobj::get_relocs_data): New function.
14899 (Relobj::set_relocs_data): New function.
14900 (Relobj::is_output_section_offset_invalid): New pure virtual function.
14901 (Relobj::gc_process_relocs): New function.
14902 (Relobj::do_gc_process_relocs): New pure virtual function.
14903 (Relobj::sd_): New data member.
14904 (Sized_relobj::is_output_section_offset_invalid): New function.
14905 (Sized_relobj::do_gc_process_relocs): New function.
14906 * options.h (General_options::gc_sections): Modify to not be a no-op.
14907 (General_options::print_gc_sections): New option.
14908 * plugin.cc (Plugin_finish::run): Remove function call to
14909 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
14910 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
14911 * reloc.cc (Read_relocs::run): Add task to process relocs and
14912 determine unreferenced sections when doing garbage collection.
14913 (Gc_process_relocs): New class.
14914 (Sized_relobj::do_gc_process_relocs): New function.
14915 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
14916 sections that are garbage collected.
14917 * reloc.h (Gc_process_relocs): New class.
14918 * sparc.cc (Target_sparc::gc_process_relocs): New function.
14919 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
14920 symbols whose corresponding sections are garbage collected.
14921 (Symbol_table::Symbol_table): Add new parameter for the garbage
14922 collection object.
14923 (Symbol_table::gc_mark_undef_symbols): New function.
14924 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14925 (Symbol_table::gc_mark_dyn_syms): New function.
14926 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
14927 as garbage.
14928 (Symbol_table::add_from_object): Likewise.
14929 (Symbol_table::add_from_relobj): When building shared objects, do not
14930 treat externally visible symbols as garbage.
14931 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
14932 table information for static and relocatable links.
14933 * symtab.h (Symbol_table::set_gc): New function.
14934 (Symbol_table::gc): New function.
14935 (Symbol_table::gc_mark_undef_symbols): New function.
14936 (Symbol_table::gc_mark_symbol_for_shlib): New function.
14937 (Symbol_table::gc_mark_dyn_syms): New function.
14938 (Symbol_table::gc_): New data member.
14939 * target.h (Sized_target::gc_process_relocs): New pure virtual
14940 function.
14941 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
14942 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
14943
14944 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
14945
14946 * options.h (General_options::gc_sections): Define as a no-op for now.
14947 (General_options::no_keep_memory): Ditto.
14948 (General_options::Bshareable): Define.
14949 * options.cc (General_options::finalize): Honor -Bshareable.
14950
14951 2009-01-20 Andreas Schwab <schwab@suse.de>
14952
14953 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
14954 read the value in the contents, since we don't use it. Use the
14955 template endianness when writing.
14956 (Relocate::relocate): Use it for R_PPC_REL16_HA.
14957
14958 2009-01-19 Andreas Schwab <schwab@suse.de>
14959
14960 * configure.tgt (powerpc64-*): Fix targ_obj.
14961
14962 2009-01-15 Ian Lance Taylor <iant@google.com>
14963
14964 * object.cc (Sized_relobj::write_local_symbols): Don't write out
14965 local symbols when stripping all symbols.
14966
14967 2009-01-14 Cary Coutant <ccoutant@google.com>
14968
14969 * output.cc (Output_reloc): Add explicit instantiations.
14970
14971 2009-01-14 Cary Coutant <ccoutant@google.com>
14972
14973 * archive.cc (Archive::get_elf_object_for_member): Remove call
14974 to File_read::claim_for_plugin.
14975 * descriptors.cc (Descriptors::open): Remove reference to
14976 is_claimed.
14977 (Descriptors::claim_for_plugin): Remove.
14978 * descriptors.h (Descriptors::claim_for_plugin): Remove.
14979 (Descriptors::is_claimed): Remove.
14980 (claim_descriptor_for_plugin): Remove.
14981 * fileread.cc (File_read::claim_for_plugin): Remove.
14982 * fileread.h (File_read::claim_for_plugin): Remove.
14983 (File_read::descriptor): Reopen descriptor if necessary.
14984 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
14985 (Plugin_manager::all_symbols_read): Add task parameter. Change
14986 all callers.
14987 (Plugin_manager::get_input_file): New function.
14988 (Plugin_manager::release_input_file): New function.
14989 (Pluginobj::Pluginobj): Add filesize parameter and initialize
14990 corresponding data member.
14991 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14992 and pass to base constructor. Change all callers.
14993 (get_input_file, release_input_file): New functions.
14994 (make_sized_plugin_object): Add filesize parameter. Change all callers.
14995 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14996 (Plugin_manager::all_symbols_read): Add task parameter.
14997 (Plugin_manager::get_input_file): New function.
14998 (Plugin_manager::release_input_file): New function.
14999 (Plugin_manager::task_): New data member.
15000 (Pluginobj::Pluginobj): Add filesize parameter.
15001 (Pluginobj::filename): New function.
15002 (Pluginobj::descriptor): New function.
15003 (Pluginobj::filesize): New function.
15004 (Pluginobj::filesize_): New data member.
15005 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15006 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15007 File_read::claim_for_plugin; use Object::unlock to unlock the file.
15008
15009 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15010 with archive libraries.
15011 * testsuite/Makefile.in: Regenerate.
15012 * testsuite/plugin_test.c (struct sym_info): New type.
15013 (get_input_file, release_input_file): New static variables.
15014 (onload): Capture new transfer vector entries.
15015 (claim_file_hook): Stop reading at end of file according to filesize.
15016 Factor out parsing of readelf output into separate function.
15017 (all_symbols_read_hook): Exercise get_input_file and release_input_file
15018 APIs and get the source file name from the symbol table. Convert
15019 source file name to corresponding object file name. Print info
15020 message when adding new input files.
15021 (parse_readelf_line): New function.
15022 * testsuite/plugin_test_1.sh: Add checks for new info messages.
15023 * testsuite/plugin_test_2.sh: Likewise.
15024 * testsuite/plugin_test_3.sh: Likewise.
15025 * testsuite/plugin_test_4.sh: New test case.
15026
15027 2009-01-07 Ian Lance Taylor <iant@google.com>
15028
15029 * version.cc (version_string): Bump to 1.8.
15030
15031 2008-12-23 Cary Coutant <ccoutant@google.com>
15032
15033 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15034 * plugin.cc (Plugin_manager::finish): Rename as
15035 layout_deferred_objects. Move cleanup to separate function.
15036 (Plugin_manager::cleanup): New function.
15037 (Plugin_finish::run): Call layout_deferred_objects and cleanup
15038 separately.
15039 * plugin.h (Plugin_manager::finish): Rename as
15040 layout_deferred_objects.
15041 (Plugin_manager::cleanup): New function.
15042 (Plugin_manager::cleanup_done): New field.
15043
15044 2008-12-23 Cary Coutant <ccoutant@google.com>
15045
15046 * plugin.cc (is_visible_from_outside): New function.
15047 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15048 so we don't return "IR only" status for exported symbols or -r links.
15049
15050 * testsuite/Makefile.am (plugin_test_3): New test case.
15051 * testsuite/Makefile.in: Regenerate.
15052 * testsuite/plugin_test_3.sh: New file.
15053
15054 2008-12-22 Cary Coutant <ccoutant@google.com>
15055
15056 * object.cc (Sized_relobj::layout_section): New function.
15057 (Sized_relobj::do_layout): Defer layout of input sections until after
15058 plugin has provided replacement files.
15059 (Sized_relobj::do_layout_deferred_sections): New function.
15060 * object.h (Relobj::set_section_offset): Remove virtual keyword.
15061 (Relobj::layout_deferred_sections): New function.
15062 (Relobj::do_layout_deferred_sections): New function.
15063 (Sized_relobj::do_layout_deferred_sections): New function.
15064 (Sized_relobj::layout_section): New function.
15065 (Sized_relobj::Deferred_layout): New structure.
15066 (Sized_relobj::deferred_layout_): New field.
15067 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15068 Change all callers. Layout deferred sections.
15069 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
15070 references.
15071 (Plugin_hook::run): Move code from do_plugin_hook inline.
15072 (Plugin_hook::do_plugin_hook): Remove.
15073 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15074 (Plugin_manager::finish): Renamed, was cleanup.
15075 (Plugin_manager::should_defer_layout): New function.
15076 (Plugin_manager::add_deferred_layout_object): New function.
15077 (Plugin_manager::Deferred_layout_list): New type.
15078 (Plugin_manager::deferred_layout_objects_): New field.
15079 (Plugin_hook::do_plugin_hook): Remove.
15080
15081 2008-12-17 Ian Lance Taylor <iant@google.com>
15082
15083 * options.h (class General_options): Add --no case for
15084 --export-dynamic.
15085
15086 2008-12-16 Cary Coutant <ccoutant@google.com>
15087
15088 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15089 vector.
15090 (Plugin_manager::claim_file): Create plugin object even if
15091 plugin did not call the add_symbols callback.
15092 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15093 asking for more symbols than were added.
15094 * testsuite/Makefile.am (plugin_test_1): Add test case with
15095 no global symbols.
15096 (empty.syms): New target.
15097 * testsuite/Makefile.in: Regenerate.
15098 * testsuite/plugin_test.c (claim_file_hook): Add new debug
15099 message. Don't call add_symbols if no globals.
15100 (all_symbols_read_hook): Don't provide replacement for empty
15101 claimed file.
15102
15103 2008-12-12 Ian Lance Taylor <iant@google.com>
15104
15105 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15106 r_type == 0 for a local symbol with r_sym == 0.
15107 (scan_relocatable_relocs): Pass r_sym to
15108 local_non_section_strategy.
15109 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15110 r_sym parameter.
15111
15112 * configure.ac: Update test for TLS descriptors: they are
15113 supported as of glibc 2.9.
15114 * configure: Rebuild.
15115
15116 2008-12-11 Ian Lance Taylor <iant@google.com>
15117
15118 PR 7091
15119 * target-reloc.h (Default_scan_relocatable_relocs): For each
15120 function, map r_type == 0 to RELOC_DISCARD.
15121
15122 2008-12-10 Cary Coutant <ccoutant@google.com>
15123
15124 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15125 object to override a kept COMDAT group from a plugin object.
15126
15127 2008-12-09 Ian Lance Taylor <iant@google.com>
15128
15129 PR 7088
15130 * yyscript.y (file_cmd): Handle INPUT.
15131
15132 * testsuite/initpri1.c: Change all declarations to be full
15133 prototypes by adding void, to avoid compiler warnings.
15134
15135 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
15136
15137 * options.cc (General_options::parse_plugin_opt): New.
15138 (General_options::add_plugin): The argument now is just the filename.
15139 (General_options::add_plugin_option): New.
15140 * options.h (plugin_opt): New.
15141 (add_plugin): Change argument name.
15142 (add_plugin_option): New.
15143 * plugin.cc (Plugin::load): Don't parse the plugin option.
15144 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15145 (Plugin::add_option): New.
15146 (Plugin::args_): Change type.
15147 (Plugin::filename_): New.
15148 (Plugin_manager::add_plugin_option): New.
15149 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15150 * testsuite/Makefile.in: Regenerate.
15151
15152 2008-12-05 Cary Coutant <ccoutant@google.com>
15153
15154 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15155 Handle --strip-lto-sections option.
15156 * options.h (strip_lto_sections): New option.
15157
15158 2008-12-01 Cary Coutant <ccoutant@google.com>
15159
15160 * plugin.cc (ld_plugin_message): Change format parameter to const.
15161 Fix mismatch between new[] and delete.
15162
15163 2008-11-14 Cary Coutant <ccoutant@google.com>
15164
15165 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15166 instead of -1U.
15167
15168 2008-11-05 Craig Silverstein <csilvers@google.com>
15169
15170 * options.cc (General_options::parse_dynamic_list): New function.
15171 * options.h (General_options): New flags dynamic_list,
15172 dynamic_list_data, dynamic_list_cpp_new, and
15173 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
15174 (General_options::in_dynamic_list): New function.
15175 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15176 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15177 (Lex::can_continue_name): Likewise.
15178 (yylex): Likewise.
15179 (read_script_file): New parameter script_options.
15180 (read_dynamic_list): New function.
15181 (Script_options::define_dynamic_list): New function.
15182 (dynamic_list_keyword_parsecodes): New variable.
15183 (dynamic_list_keywords): New variable.
15184 * script.h (Script_options::define_dynamic_list): New function
15185 prototype.
15186 (read_dynamic_list): New function prototype.
15187 * symtab.cc (strprefix): New macro.
15188 (Symbol::should_add_dynsym_entry): Support dynamic_list,
15189 dynamic_list_data, dynamic_list_cpp_new, and
15190 dynamic_list_cpp_typeinfo.
15191 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15192 (dynamic_list_expr): New rule.
15193 (dynamic_list_nodes): Likewise.
15194 (dynamic_list_node): Likewise.
15195 * testsuite/Makefile.am (dynamic_list): New test.
15196 * testsuite/Makefile.in: Regenerated.
15197 * testsuite/dynamic_list.t: New file.
15198 * testsuite/dynamic_list.sh: New file.
15199
15200 2008-11-05 Craig Silverstein <csilvers@google.com>
15201
15202 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15203 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15204 (t11_last): Likewise.
15205 * testsuite/ver_test_6.c (main): Likewise.
15206
15207 2008-10-07 Cary Coutant <ccoutant@google.com>
15208
15209 * options.c (General_options::finalize): Add check for -static and
15210 -shared.
15211 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15212 is not empty.
15213
15214 2008-10-02 Cary Coutant <ccoutant@google.com>
15215
15216 * plugin.cc (make_sized_plugin_object): Fix conditional
15217 compilation to work when not all targets are enabled.
15218
15219 2008-09-29 Cary Coutant <ccoutant@google.com>
15220
15221 * archive.cc (Archive::get_file_and_offset): Use filename instead
15222 of name to get library path.
15223 (Archive::include_member): Unlock external member of a thin archive.
15224
15225 * testsuite/Makefile.am (TEST_AR): New variable.
15226 (thin_archive_test_1): New test.
15227 (thin_archive_test_2): New test.
15228 * testsuite/Makefile.in: Regenerate.
15229 * testsuite/thin_archive_main.cc: New file.
15230 * testsuite/thin_archive_test_1.cc: New file.
15231 * testsuite/thin_archive_test_2.cc: New file.
15232 * testsuite/thin_archive_test_3.cc: New file.
15233 * testsuite/thin_archive_test_4.cc: New file.
15234
15235 2008-09-29 Cary Coutant <ccoutant@google.com>
15236
15237 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15238 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15239 instead of -1U.
15240 (Sized_relobj::do_finalize_local_symbols): Likewise.
15241 (Sized_relobj::map_to_kept_section): Likewise.
15242 * object.h (Sized_relobj::invalid_address): New constant.
15243 (Sized_relobj::do_output_section_offset): Check for invalid_address
15244 and return -1ULL.
15245 * output.cc (Output_reloc::local_section_offset): Use constant
15246 invalid_address instead of -1U.
15247 (Output_reloc::get_address): Likewise.
15248 (Output_section::output_address): Change -1U to -1ULL.
15249 * output.h (Output_reloc::invalid_address): New constant.
15250 * reloc.cc (Sized_relobj::write_sections): Use constant
15251 invalid_address instead of -1U.
15252 (Sized_relobj::relocate_sections): Likewise.
15253 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15254 values for merge sections.
15255 * target-reloc.h (relocate_for_relocatable): Use constant
15256 invalid_address instead of -1U.
15257
15258 2008-09-19 Cary Coutant <ccoutant@google.com>
15259
15260 Add plugin functionality for link-time optimization (LTO).
15261 * configure.ac (plugins): Add --enable-plugins option.
15262 * configure: Regenerate.
15263 * config.in: Regenerate.
15264 * Makefile.am (LIBDL): New variable.
15265 (CCFILES): Add plugin.cc.
15266 (HFILES): Add plugin.h.
15267 (ldadd_var): Add LIBDL.
15268 * Makefile.in: Regenerate.
15269
15270 * archive.cc: Include "plugin.h".
15271 (Archive::setup): Don't preread archive symbols when using a plugin.
15272 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
15273 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15274 files.
15275 (Archive::include_member): Add symbols from plugin objects.
15276 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15277 * descriptors.cc (Descriptors::open): Check for file descriptors
15278 abandoned by plugins.
15279 (Descriptors::claim_for_plugin): New function.
15280 * descriptors.h (Descriptors::claim_for_plugin): New function.
15281 (Open_descriptor::is_claimed): New field.
15282 (claim_descriptor_for_plugin): New function.
15283 * fileread.cc (File_read::claim_for_plugin): New function.
15284 * fileread.h (File_read::claim_for_plugin): New function.
15285 (File_read::descriptor): New function.
15286 * gold.cc: Include "plugin.h".
15287 (queue_initial_tasks): Add task to call plugin hooks for generating
15288 new object files.
15289 * main.cc: Include "plugin.h".
15290 (main): Load plugin libraries.
15291 * object.h (Pluginobj): Declare.
15292 (Object::pluginobj): New function.
15293 (Object::do_pluginobj): New function.
15294 (Object::set_target): New function.
15295 * options.cc: Include "plugin.h".
15296 (General_options::parse_plugin): New function.
15297 (General_options::General_options): Initialize plugins_ field.
15298 (General_options::add_plugin): New function.
15299 * options.h (Plugin_manager): Declare.
15300 (General_options): Add --plugin option.
15301 (General_options::has_plugins): New function.
15302 (General_options::plugins): New function.
15303 (General_options::add_plugin): New function.
15304 (General_options::plugins_): New field.
15305 * plugin.cc: New file.
15306 * plugin.h: New file.
15307 * readsyms.cc: Include "plugin.h".
15308 (Read_symbols::do_read_symbols): Check for archive before checking
15309 for ELF file. Call plugin hooks to claim files.
15310 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15311 from a real object file; force override when processing replacement
15312 files.
15313 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15314 (Symbol::init_base_object): Likewise.
15315 (Symbol::init_base_output_data): Likewise.
15316 (Symbol::init_base_output_segment): Likewise.
15317 (Symbol::init_base_constant): Likewise.
15318 (Symbol::init_base_undefined): Likewise.
15319 (Symbol::output_section): Assert that object is not a plugin.
15320 (Symbol_table::add_from_pluginobj): New function.
15321 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15322 undefined.
15323 (Symbol_table::sized_write_globals): Likewise.
15324 (Symbol_table::add_from_pluginobj): Instantiate template.
15325 * symtab.h (Sized_pluginobj): Declare.
15326 (Symbol::in_real_elf): New function.
15327 (Symbol::set_in_real_elf): New function.
15328 (Symbol::in_real_elf_): New field.
15329 (Symbol_table::add_from_pluginobj): New function.
15330
15331 * testsuite/Makefile.am (AM_CFLAGS): New variable.
15332 (LIBDL): New variable.
15333 (LDADD): Add LIBDL.
15334 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15335 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15336 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15337 (MOSTLYCLEANFILES): Likewise.
15338 * testsuite/Makefile.in: Regenerate.
15339 * testsuite/plugin_test.c: New file.
15340 * testsuite/plugin_test_1.sh: New file.
15341 * testsuite/plugin_test_2.sh: New file.
15342
15343 2008-09-16 Ian Lance Taylor <iant@google.com>
15344
15345 * target-reloc.h (relocate_section): Check whether a symbol is
15346 defined by the ABI before reporting an undefined symbol error.
15347 * target.h (Target::is_defined_by_abi): Make parameter const.
15348 (Target::do_is_defined_by_abi): Likewise.
15349 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15350 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15351 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15352 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15353 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15354 * testsuite/Makefile.in: Rebuild.
15355
15356 * fileread.cc (make_view): Add casts to avoid warning.
15357
15358 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15359
15360 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15361 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15362
15363 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
15364
15365 * options.h (General_options::output_is_executable): New.
15366 (General_options::output_is_pie): New.
15367 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15368 for shared libraries.
15369 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15370
15371 2008-09-11 Chris Demetriou <cgd@google.com>
15372
15373 * options.h (origin): New -z option.
15374 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15375 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15376 in DT_FLAGS_1.
15377
15378 2008-09-05 Cary Coutant <ccoutant@google.com>
15379
15380 * fileread.cc (File_read::make_view): Add check for attempt to map
15381 beyond end of file.
15382
15383 2008-09-05 Cary Coutant <ccoutant@google.com>
15384
15385 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15386 explicit instantiations.
15387
15388 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
15389
15390 PR gold/6858
15391 * options.cc (General_options::finalize): Allow undefined symbols
15392 in shlibs if linking -shared.
15393
15394 PR gold/6859
15395 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15396 symbols as not needing a dynsym entry.
15397
15398 2008-08-20 Craig Silverstein <csilvers@google.com>
15399
15400 * fileread.cc (File_read::open): Do not lock the file unless it
15401 was successfully opened.
15402
15403 2008-08-14 Cary Coutant <ccoutant@google.com>
15404
15405 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15406 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15407 * testsuite/tls_test.cc (struct int128): 128-bit struct
15408 for testing TLS relocs with non-zero addend.
15409 (v12): New TLS variable.
15410 (t12): New test.
15411 (t_last): Add check for v12.
15412 * testsuite/tls_test.h (t12): New function.
15413 * testsuite/tls_test_main.cc (thread_routine): Call new test.
15414
15415 2008-08-13 Ian Lance Taylor <iant@google.com>
15416
15417 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15418 set tls_segment_ or relro_segment_.
15419 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15420 when appropriate.
15421 * output.h (Output_section::clear_is_relro): New function.
15422 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15423 sections specially even when output_data_ is empty.
15424 (Output_segment::maximum_alignment): When first section is relro,
15425 only force alignment for PT_LOAD segments.
15426 * script.cc (script_data_segment_align): New function.
15427 (script_data_segment_relro_end): New function.
15428 * script-c.h (script_data_segment_align): Declare.
15429 (script_data_segment_relro_end): Declare.
15430 * script-sections.h (class Script_sections): Declare
15431 data_segment_align and data_segment_relro_end. Add fields
15432 segment_align_index_ and saw_relro_end_.
15433 * script-sections.cc (class Sections_element): Add set_is_relro
15434 virtual function. Add new bool* parameter to place_orphan_here.
15435 Add get_output_section virtual function.
15436 (class Output_section_definition): Add set_is_relro. Add new
15437 bool* parameter to place_orphan_here. Add get_output_section.
15438 Add is_relro_ field.
15439 (Output_section_definition::Output_section_definition): Initialize
15440 evaluated_address_, evaluated_load_address, evaluated_addralign_,
15441 and is_relro_ fields.
15442 (Output_section_definition::place_orphan_here): Add is_relro
15443 parameter.
15444 (Output_section_definition::set_section_addresses): Set relro for
15445 output section.
15446 (Output_section_definition::alternate_constraint): Likewise.
15447 (class Orphan_output_section): Add new bool* parameter to
15448 place_orphan_here. Add get_output_section.
15449 (Orphan_output_section::place_orphan_here): Add is_relro
15450 parameter.
15451 (Script_sections::Script_sections): Initialize
15452 data_segment_align_index_ and saw_relro_end_.
15453 (Script_sections::data_segment_align): New function.
15454 (Script_sections::data_segment_relro_end): New function.
15455 (Script_sections::place_orphan): Set or clear is_relro.
15456 (Script_sections::set_section_addresses): Force alignment of first
15457 TLS section.
15458 * yyscript.y (exp): Call script_data_segment_align and
15459 script_data_segment_relro_end.
15460 * testsuite/relro_script_test.t: New file.
15461 * testsuite/relro_test.cc (using_script): Declare.
15462 (t1, t2): Test using_script.
15463 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15464 (relro_script_test_SOURCES): Define.
15465 (relro_script_test_DEPENDENCIES): Define.
15466 (relro_script_test_LDFLAGS): Define.
15467 (relro_script_test_LDADD): Define.
15468 (relro_script_test.so): New target.
15469 * testsuite/Makefile.in: Rebuild.
15470
15471 2008-08-06 Cary Coutant <ccoutant@google.com>
15472
15473 * archive.cc (Archive::total_archives, Archive::total_members)
15474 (Archive::total_members_loaded): New variables.
15475 (Archive::setup): Add parameter. Add option to preread
15476 archive symbols.
15477 (Archive::read_armap): Add counter.
15478 (Archive::get_file_and_offset): New function.
15479 (Archive::get_elf_object_for_member): New function.
15480 (Archive::read_all_symbols): New function.
15481 (Archive::read_symbols): New function.
15482 (Archive::add_symbols): Add counters.
15483 (Archive::include_all_members): Use armap to find members if it's
15484 already built.
15485 (Archive::include_member): Skip reading symbols if already read.
15486 Factored code into Archive::get_file_and_offset and
15487 Archive::get_elf_object_for_member. Changed call to
15488 Mapfile::report_include_archive_member.
15489 (Archive::print_stats): New function.
15490 * archive.h: Declare Object and Read_symbols_data classes.
15491 (Archive::Archive): Add initializers for new members.
15492 (Archive::setup): Add parameter.
15493 (Archive::print_stats): New function.
15494 (Archive::total_archives, Archive::total_members)
15495 (Archive::total_members_loaded): New variables.
15496 (Archive::get_file_and_offset): New function.
15497 (Archive::get_elf_object_for_member): New function.
15498 (Archive::read_all_symbols): New function.
15499 (Archive::read_symbols): New function.
15500 (Archive::Archive_member): New class.
15501 (Archive::members_): New member.
15502 (Archive::num_members_): New member.
15503 * main.cc: Include archive.h.
15504 (main): Call Archive::print_stats.
15505 * mapfile.cc (Mapfile::report_include_archive_member): Delete
15506 archive parameter; member_name is now the fully-decorated name.
15507 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15508 * options.h: (General_options): Add --preread-archive-symbols option.
15509 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15510 Archive::setup.
15511
15512 2008-08-04 Ian Lance Taylor <iant@google.com>
15513
15514 * symtab.h (Symbol::use_plt_offset): New function.
15515 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15516 * powerpc.cc (Relocate::relocate): Likewise.
15517 * sparc.cc (Relocate::relocate): Likewise.
15518 * x86_64.cc (Relocate::relocate): Likewise.
15519 * testsuite/weak_plt.sh: New test.
15520 * testsuite/weak_plt_main.cc: New test.
15521 * testsuite/weak_plt_shared.cc: New test.
15522 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15523 (check_PROGRAMS): Add weak_plt.
15524 (check_DATA): Add weak_plt_shared.so.
15525 (weak_plt_main_pic.o, weak_plt): New targets.
15526 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15527 * testsuite/Makefile.in: Rebuild.
15528
15529 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15530 gcctestdir/ld.
15531 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15532 * testsuite/Makefile.in: Rebuild.
15533
15534 2008-08-04 Alan Modra <amodra@bigpond.net.au>
15535
15536 * Makefile.am (POTFILES.in): Set LC_ALL=C.
15537 * Makefile.in: Regenerate.
15538 * po/POTFILES.in: Regenerate.
15539
15540 2008-07-29 Ian Lance Taylor <iant@google.com>
15541
15542 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15543 symbols before other symbols.
15544 * testsuite/script_test_2.cc (test_addr): Declare.
15545 (test_addr_alias): Declare.
15546 (main): Check that test_addr and test_addr_alias have the right
15547 values.
15548 * testsuite/script_test_2.t: Define test_addr_alias and
15549 test_addr.
15550
15551 2008-07-24 Ian Lance Taylor <iant@google.com>
15552
15553 PR 5990
15554 * descriptors.cc: New file.
15555 * descriptors.h: New file.
15556 * gold-threads.h (class Hold_optional_lock): New class.
15557 * fileread.cc: Include "descriptors.h".
15558 (File_read::~File_read): Release descriptor rather than closing
15559 it.
15560 (File_read::open) [file]: Call open_descriptor rather than open.
15561 Set is_descriptor_opened_.
15562 (File_read::open) [memory]: Assert that descriptor is not open.
15563 (File_read::reopen_descriptor): New function.
15564 (File_read::release): Release descriptor.
15565 (File_read::do_read): Make non-const. Reopen descriptor.
15566 (File_read::read): Make non-const.
15567 (File_read::make_view): Reopen descriptor.
15568 (File_read::do_readv): Likewise.
15569 * fileread.h (class File_read): Add is_descriptor_opened_ field.
15570 Update declarations.
15571 * layout.cc: Include "descriptors.h".
15572 (Layout::create_build_id): Use open_descriptor rather than open.
15573 * output.cc: Include "descriptors.h".
15574 (Output_file::open): Use open_descriptor rather than open.
15575 * archive.cc (Archive::const_iterator): Change Archive to be
15576 non-const.
15577 (Archive::begin, Archive::end): Make non-const.
15578 (Archive::count_members): Likewise.
15579 * archive.h (class Archive): Update declarations.
15580 * object.h (Object::read): Make non-const.
15581 * Makefile.am (CCFILES): Add descriptors.cc.
15582 (HFILES): Add descriptors.h.
15583 * Makefile.in: Rebuild.
15584
15585 PR 6716
15586 * gold.h: Always include <clocale>. Add Solaris workarounds
15587 following code in binutils/sysdep.h.
15588
15589 PR 6048
15590 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15591 this->eh_frame_hdr_ is NULL before using it.
15592
15593 * dynobj.cc (Versions::Versions): Update comment.
15594
15595 * dynobj.cc (Versions::Versions): If there is an soname, use it as
15596 the base version name.
15597
15598 * stringpool.cc (Stringpool_template::add_with_length): Set key to
15599 array size plus one.
15600 (Stringpool_template::set_string_offsets): Subtract one from key
15601 before using it as an array index.
15602 (Stringpool_template::get_offset_with_length): Likewise.
15603 (Stringpool_template::write_to_buffer): Likewise.
15604 * stringpool.h (Stringpool_template::get_offset_from_key):
15605 Likewise.
15606
15607 2008-07-23 Ian Lance Taylor <iant@google.com>
15608
15609 PR 6658
15610 * object.h (Merged_symbol_value::value): Do our best to handle a
15611 negative addend.
15612
15613 PR 6647
15614 * script.cc (Version_script_info::get_versions): Don't add empty
15615 version tag to return value.
15616 (Version_script_info::get_symbol_version_helper): Change return
15617 type to bool. Add pversion parameter. Change all callers.
15618 (script_register_vers_node): Don't require a non-NULL tag.
15619 * script.h (class Version_script_info): Update declarations.
15620 (Version_script_info::get_symbol_version): Change return type to
15621 bool. Add version parameter. Change all callers.
15622 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15623 handling. Handle an empty version from a version script.
15624 (Symbol_table::define_special_symbol): Likewise.
15625 * testsuite/ver_test_10.script: New file.
15626 * testsuite/ver_test_10.sh: New file.
15627 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15628 (check_DATA): Add ver_test_10.syms.
15629 (ver_test_10.syms, ver_test_10.so): New target.
15630 * testsuite/Makefile.in: Rebuild.
15631
15632 2008-07-23 Simon Baldwin <simonb@google.com>
15633
15634 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15635 to zero for undefined symbols from dynamic libraries.
15636
15637 2008-07-23 Ian Lance Taylor <iant@google.com>
15638
15639 * symtab.cc (Symbol_table::resolve): Remove version parameter.
15640 Change all callers.
15641 * symtab.h (class Symbol_table): Update declaration.
15642 * testsuite/ver_test_9.cc: New file.
15643 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15644 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15645 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15646 (ver_test_9.so, ver_test_9.o): New targets.
15647 * testsuite/Makefile.in: Rebuild.
15648
15649 2008-07-22 Ian Lance Taylor <iant@google.com>
15650
15651 * options.h (class General_options): Define --check-sections.
15652 * layout.cc (Layout::set_segment_offsets): Handle
15653 --check-sections.
15654
15655 * options.h (class General_options): Define -n/--nmagic and
15656 -N/--omagic.
15657 * options.cc (General_options::finalize): For -n/--nmagic or
15658 -N/--omagic, set -static.
15659 * layout.cc (Layout::attach_allocated_section_to_segment): If
15660 -N/--omagic, don't put read-only and read-write sections in
15661 different segments.
15662 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15663 finding a read-only segment.
15664 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15665 don't set the minimum segment alignment to the common page size,
15666 and don't set the file offset to the address modulo the page size.
15667 * script-sections.cc (Script_sections::create_segments): If
15668 -n/--omagic, don't put read-only and read-write sections in
15669 different segments.
15670
15671 * cref.cc: New file.
15672 * cref.h: New file.
15673 * options.h (class General_options): Add --print-symbol-counts.
15674 * main.cc (main): Issue defined symbol report if requested.
15675 * archive.cc (Archive::interpret_header): Make into a const member
15676 function.
15677 (Archive::add_symbols): Call Input_objects::archive_start and
15678 archive_stop.
15679 (Archive::const_iterator): Define new class.
15680 (Archive::begin, Archive::end): New functions.
15681 (Archive::include_all_members): Rewrite to use iterator.
15682 (Archive::count_members): New function.
15683 * archive.h (class Archive): Update declarations.
15684 (Archive::filename): New function.
15685 * object.cc: Include "cref.h".
15686 (Sized_relobj::Sized_relobj): Initialize defined_count_.
15687 (Sized_relobj::do_get_global_symbol_counts): New function.
15688 (Input_objects::add_object): Add object to cross-referencer.
15689 (Input_objects::archive_start): New function.
15690 (Input_objects::archive_stop): New function.
15691 (Input_objects::print_symbol_counts): New function.
15692 * object.h: Declare Cref and Archive.
15693 (Object::get_global_symbol_counts): New function.
15694 (Object::do_get_global_symbol_counts): New pure virtual function.
15695 (class Sized_relobj): Add defined_count_ field. Update
15696 declarations.
15697 (class Input_objects): Add cref_ field. Update constructor.
15698 Update declarations.
15699 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15700 defined_count_.
15701 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15702 symbol counts.
15703 (Sized_dynobj::do_get_global_symbol_counts): New function.
15704 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15705 defined_count_. Update declarations. Define Symbols typedef.
15706 * symtab.cc (Symbol_table::add_from_relobj): Add defined
15707 parameter. Change all callers.
15708 (Symbol_table::add_from_dynobj): Add sympointers and defined
15709 parameters. Change all callers.
15710 * symtab.h (class Symbol_table): Update declarations.
15711 * Makefile.am (CCFILES): Add cref.cc.
15712 (HFILES): Add cref.h.
15713 * Makefile.in: Rebuild.
15714
15715 2008-07-22 Simon Baldwin <simonb@google.com>
15716
15717 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15718 to zero when writing undefined symbols.
15719
15720 2008-07-22 Ian Lance Taylor <iant@google.com>
15721
15722 * output.cc (Output_section::add_input_section): Don't try to
15723 merge empty merge sections.
15724
15725 2008-07-21 Craig Silverstein <csilvers@google.com>
15726
15727 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15728 Include symbol version in error message.
15729
15730 2008-07-20 Chris Demetriou <cgd@google.com>
15731
15732 * configure.ac (gold_cv_c_random_seed): New configured variable.
15733 (RANDOM_SEED_CFLAGS): New substituted variable.
15734 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15735 * configure: Rebuild.
15736 * Makefile.in: Likewise.
15737 * testsuite/Makefile.in: Likewise.
15738
15739 2008-07-18 Ian Lance Taylor <iant@google.com>
15740
15741 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15742 where we see NAME/NULL and NAME/VERSION as separate symbols.
15743 * testsuite/ver_test_main.cc (main): Call t4.
15744 (t4, t4_2a): Define.
15745 * testsuite/ver_test_2.cc (t4_2): Define.
15746 * testsuite/ver_test_2.script: Put t4_2a in VER2.
15747 * testsuite/ver_test_4.cc (t4_2a): Define.
15748 * testsuite/ver_test_4.script: Put t4_2a in VER2.
15749 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15750
15751 2008-07-17 Ian Lance Taylor <iant@google.com>
15752
15753 * dynobj.cc (Versions::add_def): If we give an error about a
15754 missing version, go ahead and create the version anyhow.
15755
15756 2008-07-10 Ian Lance Taylor <iant@google.com>
15757
15758 Handle output sections with more than 0x7fffffff bytes.
15759 * object.h (class Relobj): Change map_to_output_ to
15760 output_sections_, and just keep a section pointer. Change all
15761 uses. Move comdat group support to Sized_relobj.
15762 (Relobj::is_section_specially_mapped): Remove.
15763 (Relobj::output_section): Remove poff parameter. Change all
15764 callers.
15765 (Relobj::output_section_offset): New function.
15766 (Relobj::set_section_offset): Rewrite.
15767 (Relobj::map_to_output): Remove.
15768 (Relobj::output_sections): New function.
15769 (Relobj::do_output_section_offset): New pure virtual function.
15770 (Relobj::do_set_section_offset): Likewise.
15771 (class Sized_relobj): Add section_offsets_ field. Add comdat
15772 group support from Relobj. Update declarations.
15773 (Sized_relobj::get_output_section_offset): New function.
15774 (Sized_relobj::do_output_section_offset): New function.
15775 (Sized_relobj::do_set_section_offset): New function.
15776 * object.cc (Relobj::output_section_address): Remove.
15777 (Sized_relobj::Sized_relobj): Initialize new fields.
15778 (Sized_relobj::include_section_group): Cast find_kept_object to
15779 Sized_relobj.
15780 (Sized_relobj::include_linkonce_section): Likewise.
15781 (Sized_relobj::do_layout): Use separate arrays for output section
15782 and output offset.
15783 (Sized_relobj::do_count_local_symbols): Change map_to_output to
15784 output_sections.
15785 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15786 output_sections and section_offsets.
15787 (Sized_relobj::write_local_symbols): Likewise.
15788 (map_to_kept_section): Compute output address directly.
15789 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15790 output_sections and section_offsets.
15791 (Sized_relobj::write_sections): Likewise.
15792 (Sized_relobj::relocate_sections): Likewise.
15793 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15794 * output.h (class Output_reloc): Update declarations. Change
15795 u2_.relobj to Sized_relobj*.
15796 (class Output_data_reloc): Change add functions to use
15797 Sized_relobj*.
15798 * output.cc (Output_reloc::Output_reloc): Change relobj to
15799 Sized_relobj*.
15800 (Output_reloc::local_section_offset): Change return type to
15801 Elf_Addr. Use get_output_section_offset.
15802 (Output_reloc::get_address): Likewise.
15803 (Output_section::is_input_address_mapped): Don't call
15804 is_section_specially_mapped.
15805 (Output_section::output_offset): Likewise.
15806 (Output_section::output_address): Likewise.
15807 (Output_section::starting_output_address): Likewise.
15808 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
15809 parameter to Sized_relobj*.
15810 (Copy_relocs::need_copy_reloc): Likewise.
15811 (Copy_relocs::save): Likewise.
15812 * copy-relocs.h (class Copy_relocs): Update declarations.
15813 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
15814 Sized_relobj*. Change relobj_ field to Sized_relobj*.
15815 * target-reloc.h (relocate_for_relocatable): Change
15816 offset_in_output_section type to Elf_Addr. Change code that uses
15817 it as well.
15818 * layout.cc (Layout::layout): Always set *off.
15819 * mapfile.cc (Mapfile::print_input_section): Use
15820 output_section_offset.
15821 * i386.cc (Target_i386::copy_reloc): Change object parameter to
15822 Sized_relobj*.
15823 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15824 * sparc.cc (Target_sparc::copy_reloc): Likewise.
15825 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
15826
15827 2008-07-03 Ian Lance Taylor <iant@google.com>
15828
15829 * layout.cc (Layout::include_section): Do not discard unrecognized
15830 SHT_STRTAB sections.
15831
15832 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
15833
15834 * script.cc (Lex::can_continue_name): Make '?' allowable in
15835 version-script names.
15836 * testsuite/version_script.map: Change glob pattern to use '?'
15837
15838 2008-06-30 Manish Singh <yosh@gimp.org>
15839
15840 PR 6585
15841 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
15842 Correct typo.
15843
15844 2008-06-30 Ian Lance Taylor <iant@google.com>
15845
15846 PR 6660
15847 PR 6682
15848 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
15849 versions]: Don't try to read the value in the contents, since we
15850 don't use it. Use the template endianness when writing.
15851
15852 2008-06-25 Cary Coutant <ccoutant@google.com>
15853
15854 * fileread.cc (File_read::make_view): Assert on zero-length view.
15855 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
15856 symbol table when there are no symbols to read.
15857
15858 2008-06-23 Craig Silverstein <csilvers@google.com>
15859
15860 * version.cc (version_string): Bump to 1.7
15861
15862 2008-06-18 Craig Silverstein <csilvers@google.com>
15863
15864 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
15865 constant 0xFFFF to type Valtype.
15866 (Powerpc_relocate_functions::rel16_ha): Likewise.
15867
15868 2008-06-17 Ian Lance Taylor <iant@google.com>
15869
15870 * output.h (Output_section::Input_section): Initialize p2align_ to
15871 zero for Output_section_data constructors.
15872 (Output_section::Input_section::addralign): If not an input
15873 section, return the alignment of the Output_section_data.
15874 * testsuite/copy_test.cc: New file.
15875 * testsuite/copy_test_1.cc: New file.
15876 * testsuite/copy_test_2.cc: New file.
15877 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
15878 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
15879 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
15880 (copy_test_1_pic.o, copy_test_1.so): New targets.
15881 (copy_test_2_pic.o, copy_test_2.so): New targets.
15882 * testsuite/Makefile.in: Rebuild.
15883
15884 * script-sections.cc (Script_sections::place_orphan): Initialize
15885 local variable exact.
15886
15887 2008-06-13 David Edelsohn <edelsohn@gnu.org>
15888
15889 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
15890
15891 2008-06-12 David Edelsohn <edelsohn@gnu.org>
15892 David S. Miller <davem@davemloft.net>
15893
15894 * powerpc.cc: New file.
15895 * Makefile.am (TARGETSOURCES): Add powerpc.cc
15896 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
15897 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
15898 * Makefile.in: Rebuild.
15899
15900 2008-06-09 Ian Lance Taylor <iant@google.com>
15901
15902 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
15903 <exception>.
15904 (throwing, orig_terminate): New static variables.
15905 (terminate_handler): New static function.
15906 (t2): Set terminate handler.
15907
15908 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
15909
15910 PR 6584
15911 * binary.cc (Binary_to_elf::sized_convert): Fix .data
15912 alignment.
15913
15914 2008-05-30 Cary Coutant <ccoutant@google.com>
15915
15916 * archive.cc (Archive::include_all_members) Correct to step
15917 over symbol table and extended name table in thin archives.
15918
15919 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
15920
15921 PR 6407
15922 * target-reloc.h (relocate_for_relocatable): Fix new_offset
15923 calculation.
15924
15925 2008-05-28 Caleb Howe <cshowe@google.com>
15926
15927 * reduced_debug_output.cc: New file.
15928 * reduced_debug_output.h: New file.
15929 * options.h (class General_options): Add --strip-debug-non-line.
15930 * options.cc (General_options::finalize): Add strip_debug_non_line
15931 to the strip heirarchy.
15932 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
15933 fields.
15934 * layout.cc: Include "reduced_debug_output.h".
15935 (Layout::Layout): Initialize new fields.
15936 (line_only_debug_sections): New static array.
15937 (is_lines_only_debug_sections): New static inline function.
15938 (Layout::include_section): Handle --strip-debug-non-line.
15939 (Layout::make_output_section): If --strip-debug-non-line, build
15940 new output sections for .debug_abbrev and .debug_info.
15941 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
15942 gold. Warn about possible overflow.
15943 (read_signed_LEB_128): Likewise.
15944 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
15945 (read_signed_LEB_128): Declare.
15946 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
15947 (HFILES): Add reduced_debug_output.h.
15948 * Makefile.in: Rebuild.
15949
15950 2008-05-21 Ian Lance Taylor <iant@google.com>
15951
15952 * mapfile.cc: New file.
15953 * mapfile.h: New file.
15954 * options.h (class General_options): Add -M/--print-map and -Map.
15955 * options.cc (General_options::finalize): Make -M equivalent to
15956 -Map -.
15957 * main.cc: Include <cstdio> and "mapfile.h".
15958 (main): Open mapfile if requested.
15959 * gold.cc (class Middle_runner): Add mapfile_ field. Update
15960 constructor. Change caller.
15961 (queue_initial_tasks): Add mapfile parameter. Change caller.
15962 (queue_middle_tasks): Likewise.
15963 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
15964 declarations.
15965 * archive.cc: Include "mapfile.h".
15966 (Archive::add_symbols): Add mapfile parameter. Change all
15967 callers. Pass mapfile, symbol, and reason to include_member.
15968 (Archive::include_all_members): Add mapfile parameter. Change all
15969 callers.
15970 (Archive::include_member): Add mapfile, sym, and why parameters.
15971 Change all callers. Report inclusion to map file.
15972 * archive.h: Include "fileread.h".
15973 (class Archive): Update declarations.
15974 (Archive::file): New const method.
15975 (class Add_archive_symbols): Add mapfile_ field. Update
15976 constructor. Change all callers.
15977 * readsyms.h (class Read_symbols): Likewise.
15978 (class Finish_group): Likewise.
15979 (class Read_script): Likewise.
15980 * common.cc: Include "mapfile.h".
15981 (Symbol_table::allocate_commons): Add mapfile parameter. Change
15982 all callers.
15983 (Symbol_table::do_allocate_commons): Likewise.
15984 (Symbol_table::do_allocate_commons_list): Likewise. Report common
15985 symbol allocation to mapfile.
15986 * common.h (class Allocate_commons_task): Add mapfile_ field.
15987 Update constructor. Change all callers.
15988 * symtab.h (class Symbol_table): Update declarations.
15989 * layout.cc: Include "mapfile.h".
15990 (Layout_task_runner::run): Print information to mapfile.
15991 (Layout::create_gold_note): Change Output_data_fixed_space to
15992 Output_data_zero_fill.
15993 (Layout::create_build_id): Likewise.
15994 (Layout::print_to_mapfile): New function.
15995 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
15996 constructor. Change caller.
15997 (class Layout): Declare print_to_mapfile.
15998 * output.cc (Output_section::Input_section::print_to_mapfile): New
15999 function.
16000 (Output_section::add_input_section): If producing a map, always
16001 add to input_sections_ list.
16002 (Output_section::do_print_to_mapfile): New function.
16003 (Output_segment::print_sections_to_mapfile): New function.
16004 (Output_segment::print_section_list_to_mapfile): New function.
16005 * output.h: Include "mapfile.h".
16006 (Output_data::print_to_mapfile): New function.
16007 (Output_data::do_print_to_mapfile): New virtual function.
16008 (Output_segment_headers::do_print_to_mapfile): New function.
16009 (Output_file_header::do_print_to_mapfile): New function.
16010 (Output_data_const::do_print_to_mapfile): New function.
16011 (class Output_data_const_buffer): Add map_name_ field. Update
16012 constructor. Change all callers. Add do_print_to_mapfile
16013 function.
16014 (class Output_data_fixed_space): Likewise.
16015 (class Output_data_space): Likewise.
16016 (class Output_data_zero_fill): New class.
16017 (Output_data_strtab::do_print_to_mapfile): New function.
16018 (Output_data_reloc_base::do_print_to_mapfile): New function.
16019 (Output_relocatable_relocs::do_print_to_mapfile): New function.
16020 (Output_data_group::do_print_to_mapfile): New function.
16021 (Output_data_got::do_print_to_mapfile): New function.
16022 (Output_data_dynamic::do_print_to_mapfile): New function.
16023 (Output_symtab_xindex::do_print_to_mapfile): New function.
16024 (class Output_section): Declare do_print_to_mapflie. Declare
16025 print_to_mapfile in Input_section.
16026 (class Output_segment): Declare new functions.
16027 * object.h (Sized_relobj::symbol_count): New function.
16028 * script-sections.cc
16029 (Output_section_element_dot_assignment::set_section_addresses):
16030 Change Output_data_fixed_space to Output_data_zero_fill.
16031 (Output_data_expression::do_print_to_mapfile): New function.
16032 * script.cc (read_input_script): Add mapfile parameter. Change
16033 all callers.
16034 * script.h (read_input_script): Update declaration.
16035 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16036 (Eh_frame::do_print_to_mapfile): New function.
16037 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16038 (Output_merge_string::do_print_to_mapfile): New function.
16039 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16040 function.
16041 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16042 function.
16043 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16044 function.
16045 * Makefile.am (CCFILES): Add mapfile.cc.
16046 (HFILES): Add mapfile.h.
16047 * Makefile.in: Rebuild.
16048
16049 2008-05-19 Ian Lance Taylor <iant@google.com>
16050
16051 * options.h (class General_options): Add -z relro.
16052 * layout.cc (Layout::Layout): Initialize relro_segment_.
16053 (Layout::add_output_section_data): Return the output section.
16054 (Layout::make_output_section): Rcognize relro sections and mark
16055 them appropriately.
16056 (Layout::attach_allocated_section_to_segment): Put relro sections
16057 in a PT_GNU_RELRO segment.
16058 (Layout::create_initial_dynamic_sections): Mark the .dynamic
16059 section as relro.
16060 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16061 PT_TLS segments.
16062 (Layout::linkonce_mapping): Map d.rel.ro.local to
16063 .data.rel.ro.local.
16064 (Layout::output_section_name): Us .data.rel.ro.local for any
16065 section which begins with that.
16066 * layout.h (class Layout): Update add_output_section_data
16067 declaration. Add relro_segment_ field.
16068 * output.cc (Output_section::Output_section): Initialize is_relro_
16069 and is_relro_local_ fields.
16070 (Output_segment::add_output_section): Group relro sections.
16071 (Output_segment::is_first_section_relro): New function.
16072 (Output_segment::maximum_alignment): If there is a relro section,
16073 align the segment to the common page size.
16074 (Output_segment::set_section_addresses): Track whether we are
16075 looking at relro sections. If the last section is a relro
16076 section, align to the common page size.
16077 (Output_segment::set_section_list_addresses): Add in_relro
16078 parameter. Change all callers. Align to the page size when
16079 moving from relro to non-relro section.
16080 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16081 segment.
16082 * output.h (class Output_section): Add is_relro_ and
16083 is_relro_local_ fields.
16084 (Output_section::is_relro): New function.
16085 (Output_section::set_is_relro): New function.
16086 (Output_section::is_relro_local): New function.
16087 (Output_section::set_is_relro_local): New function.
16088 (class Output_segment): Update declarations.
16089 * i386.cc (Target_i386::got_section): Mark .got section as relro.
16090 * sparc.cc (Target_sparc::got_section): Likewise.
16091 * x86_64.cc (Target_x86_64::got_section): Likewise.
16092 * testsuite/relro_test_main.cc: New file.
16093 * testsuite/relro_test.cc: New file.
16094 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16095 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16096 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16097 (relro_test.so, relro_test_pic.o): New targets.
16098 * testsuite/Makefile.in: Rebuild.
16099
16100 2008-05-16 Ian Lance Taylor <iant@google.com>
16101
16102 * output.cc (Output_segment::add_output_section): Remove front
16103 parameter.
16104 * output.h (class Output_segment): Remove
16105 add_initial_output_section and overloaded add_output_section.
16106 Update declaration of remaining add_output_section.
16107 * layout.cc (Layout::create_interp): Call add_output_section
16108 rather than add_initial_output_section.
16109 (Layout::finish_dynamic_section): Likewise.
16110
16111 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16112 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
16113 know the dynamic type.
16114 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16115 field. Initialize it in constructor.
16116 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16117 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16118 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16119 reloc.
16120
16121 * output.cc (Output_reloc::get_address): Change return type to
16122 Elf_Addr.
16123 * output.h (class Output_reloc): Update get_address declaration.
16124 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16125 for section addresses.
16126
16127 2008-05-09 Ian Lance Taylor <iant@google.com>
16128
16129 PR 6493
16130 * gold.cc (gold_nomem): Use return value of write.
16131
16132 2008-05-08 Ian Lance Taylor <iant@google.com>
16133
16134 * symtab.c (Symbol::init_base_output_data): Add version
16135 parameter. Change all callers.
16136 (Symbol::init_base_output_segment): Likewise.
16137 (Symbol::init_base_constant): Likewise.
16138 (Symbol::init_base_undefined): Likewise.
16139 (Sized_symbol::init_output_data): Likewise.
16140 (Sized_symbol::init_output_segment): Likewise.
16141 (Sized_symbol::init_constant): Likewise.
16142 (Sized_symbol::init_undefined): Likewise.
16143 (Symbol_table::do_define_in_output_data): If the new symbol has a
16144 version, mark it as the default.
16145 (Symbol_table::do_define_in_output_segment): Likewise.
16146 (Symbol_table::do_define_as_constant): Likewise.
16147 * symtab.h (class Symbol): Update declarations.
16148 (class Sized_symbol): Likewise.
16149 * resolve.cc (Symbol::override_version): New function.
16150 (Symbol::override_base): Call override_version.
16151 (Symbol::override_base_with_special): Likewise.
16152 * testsuite/ver_script_8.script: New file.
16153 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16154 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16155 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16156 (ver_test_8_1.so, ver_test_8_2.so): New targets.
16157
16158 2008-05-06 Ian Lance Taylor <iant@google.com>
16159
16160 PR 6049
16161 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16162 functions.
16163 (class General_options): Remove existing --undefined, and add
16164 --no-undefined instead. Add new --undefined as synonym for -u.
16165 * archive.cc (Archive::add_symbols): Check whether symbol was
16166 named with -u.
16167 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16168 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16169 all uses. Add IS_UNDEFINED. Update declarations to split
16170 different versions of init_base. Declare init_base_undefined.
16171 (Symbol::is_defined): Handle IS_UNDEFINED.
16172 (Symbol::is_undefined): Likewise.
16173 (Symbol::is_weak_undefined): Call is_undefined.
16174 (Symbol::is_absolute): Handle IS_CONSTANT.
16175 (class Sized_symbol): Update declarations to split different
16176 versions of init. Declare init_undefined.
16177 (class Symbol_table): Declare new functions.
16178 * symtab.cc (Symbol::init_base_object): Rename from init_base.
16179 Change all callers.
16180 (Symbol::init_base_output_data): Likewise.
16181 (Symbol::init_base_output_segment): Likewise.
16182 (Symbol::init_base_constant): Likewise.
16183 (Symbol::init_base_undefined): New function.
16184 (Sized_symbol::init_object): Rename from init. Change all
16185 callers.
16186 (Sized_symbol::init_output_data): Likewise.
16187 (Sized_symbol::init_output_segment): Likewise.
16188 (Sized_symbol::init_constant): Likewise.
16189 (Sized_symbol::init_undefined): New function.
16190 (Symbol_table::add_undefined_symbols_from_command_line): New
16191 function.
16192 (Symbol_table::do_add_undefined_symbols_from_command_line): New
16193 function.
16194 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16195 (Symbol::output_section): Likewise.
16196 (Symbol::set_output_section): Likewise.
16197 (Symbol_table::sized_finalize_symbol): Likewise.
16198 (Symbol_table::sized_write_globals): Likewise.
16199 * resolve.cc (Symbol_table::should_override): Likewise.
16200 (Symbol::override_base_with_special): Likewise.
16201
16202 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16203 symbol, change it to have default visibility.
16204 * testsuite/protected_1.cc: New file.
16205 * testsuite/protected_2.cc: New file.
16206 * testsuite/protected_3.cc: New file.
16207 * testsuite/protected_main_1.cc: New file.
16208 * testsuite/protected_main_2.cc: New file.
16209 * testsuite/protected_main_3.cc: New file.
16210 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16211 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16212 (protected_1_LDFLAGS, protected_1_LDADD): Define.
16213 (protected_1.so): New target.
16214 (protected_1_pic.o, protected_2_pic.o): New targets.
16215 (protected_3_pic.o): New target.
16216 (check_PROGRAMS): Add protected_2.
16217 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16218 (protected_2_LDFLAGS, protected_2_LDADD): Define.
16219 * testsuite/Makefile.in: Rebuild.
16220
16221 * options.h (DEFINE_var): Add set_user_set_##varname__.
16222 (DEFINE_bool_alias): New macro.
16223 (class General_options): Define -Bstatic using DEFINE_bool_alias
16224 rather than DEFINE_special. Add --undefined as an alias for -z
16225 defs.
16226 * options.cc (General_options::parse_Bstatic): Remove.
16227
16228 * options.h (class General_options): Add --fatal-warnings.
16229 * main.cc (main): Implement --fatal-warnings.
16230 * errors.h (Errors::warning_count): New function.
16231
16232 * options.h (class General_options): Add -Bsymbolic-functions.
16233 * symtab.h (Symbol::is_preemptible): Check for
16234 -Bsymbolic-functions.
16235
16236 2008-05-05 Ian Lance Taylor <iant@google.com>
16237
16238 * options.h (DEFINE_bool): For DASH_Z, create the negative option
16239 as noVARNAME rather than no-VARNAME.
16240 (class General_options): Add option -z combreloc.
16241 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16242 get_address.
16243 (Output_reloc::sort_before) [SHT_REL]: New function.
16244 (Output_reloc::sort_before) [SHT_RELA]: New function.
16245 (class Output_data_reloc_base): Add sort_relocs_ field. Define
16246 Sort_relocs_comparison.
16247 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16248 parameter. Change all callers.
16249 (Output_data_reloc::Output_data_reloc) [both versions]: Add
16250 sort_relocs parameter. Change all callers.
16251 * output.cc (Output_reloc::get_address): New function, broken out
16252 of write_rel.
16253 (Output_reloc::write_rel): Call it.
16254 (Output_reloc::compare): New function.
16255 (Output_data_reloc_base::do_write): Optionally sort relocs.
16256
16257 * configure.ac: If targ_extra_obj is set, link it in.
16258 * configure.tgt: Initialize all variables.
16259 (x86_64*): Set targ_extra_obj and targ_extra_size.
16260 * configure: Rebuild.
16261
16262 * object.cc (Sized_relobj::include_section_group): Adjust section
16263 indexes read from group data. Build vector to pass to
16264 layout_group.
16265 * layout.cc (Layout::layout_group): Add flags and shndxes
16266 parameters. Remove contents parameter. Change caller. Update
16267 explicit instantiations.
16268 * layout.h (class Layout): Update layout_group declaration.
16269 * output.cc (Output_data_group::Output_data_group): Add flags and
16270 input_shndxes parameters. Remove contents parameter. Change
16271 caller.
16272 (Output_data_group::do_write): Change input_sections_ to
16273 input_shndxes_.
16274 * output.h (class Output_data_group): Update constructor
16275 declaration. Rename input_sections_ to input_shndxes_.
16276 * testsuite/many_sections_test.cc: Add template.
16277
16278 2008-04-30 Cary Coutant <ccoutant@google.com>
16279
16280 * target-reloc.h (relocate_section): Fix dead-pointer bug.
16281
16282 * layout.cc (Layout::include_section): Refactored check for debug
16283 info section.
16284 (Layout::add_comdat): Add new parameters. Change type
16285 of signature parameter. Add object and shndx to signatures table.
16286 (Layout::find_kept_object): New function.
16287 * layout.h: Include <cstring>.
16288 (Layout::is_debug_info_section): New function.
16289 (Layout::add_comdat): Add new parameters.
16290 (Layout::find_kept_object): New function.
16291 (Layout::Kept_section): New struct.
16292 (Layout::Signatures): Change type of map range.
16293 * object.cc (Relobj::output_section_address): New function.
16294 (Sized_relobj::include_section_group): Add new parameters. Change
16295 calls to Layout::add_comdat. Change to build table of kept comdat
16296 groups and table mapping discarded sections to kept sections.
16297 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
16298 (Sized_relobj::do_layout): Change calls to include_section_group and
16299 include_linkonce_section.
16300 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16301 value to zero when section is discarded.
16302 (Sized_relobj::map_to_kept_section): New function.
16303 * object.h (Relobj::output_section_address): New function.
16304 (Relobj::Comdat_group): New type.
16305 (Relobj::find_comdat_group): New function.
16306 (Relobj::Comdat_group_table): New type.
16307 (Relobj::Kept_comdat_section): New type.
16308 (Relobj::Kept_comdat_section_table): New type.
16309 (Relobj::add_comdat_group): New function.
16310 (Relobj::set_kept_comdat_section): New function.
16311 (Relobj::get_kept_comdat_section): New function.
16312 (Relobj::comdat_groups_): New field.
16313 (Relobj::kept_comdat_sections_): New field.
16314 (Symbol_value::input_value): Update comment.
16315 (Sized_relobj::map_to_kept_section) New function.
16316 (Sized_relobj::include_linkonce_section): Add new parameter.
16317 * target-reloc.h (Comdat_behavior): New type.
16318 (get_comdat_behavior): New function.
16319 (relocate_section): Add code to map a discarded section to the
16320 corresponding kept section when applying a relocation.
16321
16322 2008-04-30 Craig Silverstein <csilvers@google.com>
16323
16324 * dwarf_reader.cc (next_generation_count): New static var.
16325 (Addr2line_cache_entry): New struct.
16326 (addr2line_cache): New static var.
16327 (Dwarf_line_info::one_addr2line): Added caching.
16328 (Dwarf_line_info::clear_addr2line_cache): New function.
16329 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16330 cache-size parameter.
16331 (Dwarf_line_info::one_addr2line_cache): New function.
16332 * symtab.cc (Symbol_table::detect_odr_violations): Pass
16333 new cache-size argument to one_addr2line(), and clear cache.
16334
16335 2008-04-28 Cary Coutant <ccoutant@google.com>
16336
16337 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16338 R_386_PC8 relocations.
16339
16340 2008-04-23 Ian Lance Taylor <iant@google.com>
16341
16342 * object.cc (Sized_relobj::include_section_group): Check for
16343 invalid section group.
16344
16345 * object.cc (make_elf_object): Correct test for 64-bit ELF file
16346 header size.
16347
16348 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16349 than read for file header.
16350 * archive.cc (Archive::include_member): Likewise.
16351
16352 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
16353
16354 * aclocal.m4: Regenerate.
16355 * configure: Regenerate.
16356
16357 2008-04-19 Ian Lance Taylor <iant@google.com>
16358
16359 * version.cc (version_string): Bump to 1.6.
16360
16361 * testsuite/Makefile.am (many_sections_r_test): New target.
16362 (many_sections_r_test_SOURCES): Remove.
16363 (many_sections_r_test_DEPENDENCIES): Remove.
16364 (many_sections_r_test_LDFLAGS): Remove.
16365 (many_sections_r_test_LDADD): Remove.
16366
16367 * object.cc (Sized_relobj::do_add_symbols): Always pass
16368 local_symbol_count_ to add_from_relobj.
16369
16370 * testsuite/Makefile.am (many_sections_check.h): Only check one in
16371 every thousand variables.
16372 * testsuite/Makefile.in: Rebuild.
16373
16374 * object.cc (Xindex::initialize_symtab_xindex): New function.
16375 (Xindex::read_symtab_xindex): New function.
16376 (Xindex::sym_xindex_to_shndx): New function.
16377 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16378 available.
16379 (Sized_relobj::do_initialize_xindex): New function.
16380 (Sized_relobj::do_read_symbols): Adjust section links.
16381 (Sized_relobj::symbol_section_and_value): Add is_ordinary
16382 parameter. Change all callers.
16383 (Sized_relobj::include_section_group): Adjust section links and
16384 symbol section indexes.
16385 (Sized_relobj::do_layout): Adjust section links.
16386 (Sized_relobj::do_count_local_symbols): Adjust section links and
16387 symbol section indexes.
16388 (Sized_relobj::do_finalize_local_symbols): Distinguish between
16389 ordinary and special symbols.
16390 (Sized_relobj::write_local_symbols): Add symtab_xindex and
16391 dynsym_xindex parameters. Change all callers. Adjust section
16392 links. Use SHN_XINDEX when needed.
16393 (Sized_relobj::get_symbol_location_info): Adjust section links.
16394 Don't get fooled by special symbols.
16395 * object.h (class Xindex): Define.
16396 (class Object): Add xindex_ parameter. Declare virtual functoin
16397 do_initialize_xindex.
16398 (Object::adjust_sym_shndx): New function.
16399 (Object::set_xindex): New protected function.
16400 (class Symbol_value): Add is_ordinary_shndx_ field.
16401 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16402 (Symbol_value::value): Assert ordinary section.
16403 (Symbol_value::initialize_input_to_output_map): Likewise.
16404 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16405 Change all callers.
16406 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
16407 all callers.
16408 (class Sized_relobj): Update declarations.
16409 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16410 parameter. Change all callers.
16411 (Sized_relobj::adjust_shndx): New function.
16412 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16413 field.
16414 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16415 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
16416 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
16417 (Sized_dynobj::read_dynsym_section): Adjust section links.
16418 (Sized_dynobj::read_dynamic): Likewise.
16419 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
16420 section links.
16421 (Sized_dynobj::do_initialize_xindex): New function.
16422 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
16423 do_initialize_xindex.
16424 (Sized_dynobj::adjust_shndx): New function.
16425 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16426 dynsym_xindex_ fields.
16427 (Layout::finalize): Add a call to set_section_indexes before
16428 creating the symtab sections.
16429 (Layout::set_section_indexes): Don't do anything if the section
16430 already has a section index.
16431 (Layout::create_symtab_sections): Add shnum parameter. Change
16432 caller. Create .symtab_shndx section if needed.
16433 (Layout::create_shdrs): Add shstrtab_section parameter. Change
16434 caller.
16435 (Layout::allocated_output_section_count): New function.
16436 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16437 needed.
16438 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16439 fields. Update declarations.
16440 (Layout::symtab_xindex): New function.
16441 (Layout::dynsym_xindex): New function.
16442 (class Write_symbols_task): Add layout_ field.
16443 (Write_symbols_task::Write_symbols_task): Add layout parameter.
16444 Change caller.
16445 * output.cc (Output_section_headers::Output_section_headers): Add
16446 shstrtab_section parameter. Change all callers.
16447 (Output_section_headers::do_sized_write): Store overflow values
16448 for section count and section string table section index in
16449 section header zero.
16450 (Output_file_header::do_sized_write): Check for overflow of
16451 section count and section string table section index.
16452 (Output_symtab_xindex::do_write): New function.
16453 (Output_symtab_xindex::endian_do_write): New function.
16454 * output.h (class Output_section_headers): Add shstrtab_section_.
16455 Update declarations.
16456 (class Output_symtab_xindex): Define.
16457 (Output_section::has_out_shndx): New function.
16458 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16459 field.
16460 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16461 Change all callers.
16462 (Sized_symbol::init): Likewise.
16463 (Symbol::output_section): Check for ordinary symbol.
16464 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
16465 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
16466 callers.
16467 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16468 Change all callers. Simplify handling of symbols from sections
16469 not included in the link.
16470 (Symbol_table::add_from_dynobj): Handle ordinary symbol
16471 distinction.
16472 (Weak_alias_sorter::operator()): Assert that symbols are
16473 ordinary.
16474 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16475 distinction.
16476 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16477 parameters. Change all callers.
16478 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
16479 symbol distinction. Use SHN_XINDEX when needed.
16480 (Symbol_table::write_section_symbol): Add symtab_xindex
16481 parameter. Change all callers.
16482 (Symbol_table::sized_write_section_symbol): Likewise. Use
16483 SHN_XINDEX when needed.
16484 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
16485 declarations.
16486 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
16487 (Symbol::is_defined): Check is_ordinary.
16488 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16489 (Symbol::is_absolute, Symbol::is_common): Likewise.
16490 (class Sized_symbol): Update declarations.
16491 (class Symbol_table): Update declarations.
16492 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16493 parameters. Change all callers.
16494 (Sized_symbol::override): Likewise.
16495 (Symbol_table::override): Likewise.
16496 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
16497 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
16498 is_ordinary, and orig_st_shndx parameters. Change all callers.
16499 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16500 to be in an ordinary section.
16501 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16502 object and is_ordinary parameters. Change all callers.
16503 (Sized_dwarf_line_info::read_relocs): Add object parameter.
16504 Change all callers. Don't add undefined or non-ordinary symbols
16505 to reloc_map_.
16506 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16507 Change all callers.
16508 * dwarf_reader.h (class Sized_dwarf_line_info): Update
16509 declarations.
16510 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16511 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16512 (Sized_relobj::relocate_sections): Likewise.
16513 * target-reloc.h (scan_relocs): Adjust section symbol index.
16514 (scan_relocatable_relocs): Likewise.
16515 * i386.cc (Scan::local): Check for ordinary symbols.
16516 * sparc.cc (Scan::local): Likewise.
16517 * x86_64.cc (Scan::local): Likewise.
16518 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16519 to symbol_section_and_value.
16520 * testsuite/many_sections_test.cc: New file.
16521 * testsuite/Makefile.am (BUILT_SOURCES): Define.
16522 (check_PROGRAMS): Add many_sections_test.
16523 (many_sections_test_SOURCES): Define.
16524 (many_sections_test_DEPENDENCIES): Define.
16525 (many_sections_test_LDFLAGS): Define.
16526 (BUILT_SOURCES): Add many_sections_define.h.
16527 (many_sections_define.h): New target.
16528 (BUILT_SOURCES): Add many_sections_check.h.
16529 (many_sections_check.h): New target.
16530 (check_PROGRAMS): Add many_sections_r_test.
16531 (many_sections_r_test_SOURCES): Define.
16532 (many_sections_r_test_DEPENDENCIES): Define.
16533 (many_sections_r_test_LDFLAGS): Define.
16534 (many_sections_r_test_LDADD): Define.
16535 (many_sections_r_test.o): New target.
16536 * testsuite/Makefile.in: Rebuild.
16537
16538 2008-04-17 Cary Coutant <ccoutant@google.com>
16539
16540 * errors.cc (Errors::info): New function.
16541 (gold_info): New function.
16542 * errors.h (Errors::info): New function.
16543 * gold.h (gold_info): New function.
16544 * object.cc (Input_objects::add_object): Print trace output.
16545 * options.cc (options::parse_set): New function.
16546 (General_options::parse_wrap): Deleted.
16547 (General_options::General_options): Deleted initializer.
16548 * options.h (options::String_set): New typedef.
16549 (options::parse_set): New function.
16550 (DEFINE_set): New macro.
16551 (General_options::wrap): Changed to use DEFINE_set. Changed
16552 callers of any_wrap_symbols and is_wrap_symbol.
16553 (General_options::trace, General_options::trace_symbol):
16554 New options.
16555 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16556 (General_options::wrap_symbols_): Deleted.
16557 * symtab.cc (Symbol_table::add_from_object): Print trace output.
16558
16559 2008-04-17 David S. Miller <davem@davemloft.net>
16560
16561 * options.cc (General_options::parse_V): New function.
16562 * options.h: Add entries for -V and -Qy.
16563
16564 2008-04-17 Ian Lance Taylor <iant@google.com>
16565
16566 * common.cc (Symbol_table::allocate_commons): Remove options
16567 parameter. Change caller.
16568 (Symbol_table::do_allocate_commons): Remove options parameter.
16569 Change caller. Just call do_allocate_commons_list twice.
16570 (Symbol_table::do_allocate_commons_list): New function, broken out
16571 of do_allocate_commons.
16572 * common.h (class Allocate_commons_task): Remove options_ field.
16573 Update constructor.
16574 * symtab.cc (Symbol_table::Symbol_table): Initialize
16575 tls_commons_.
16576 (Symbol_table::add_from_object): Put TLS common symbols on
16577 tls_commons_ list.
16578 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16579 which are IN_OUTPUT_DATA.
16580 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
16581 allocate_commons and do_allocate_commons declarations. Declare
16582 do_allocate_commons_list.
16583 * gold.cc (queue_middle_tasks): Update creation of
16584 Allocate_commons_task to not pass options.
16585 * testsuite/Makefile.am (INCLUDES): Add -I.. .
16586 (TLS_TEST_C_FLAGS): New variable.
16587 (tls_test_c_pic.o): New target.
16588 (tls_test_shared.so): Link in tls_test_c_pic.o.
16589 (tls_test_c_pic_ie.o): New target.
16590 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16591 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16592 (tls_test_c.o): New target.
16593 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16594 (tls_pic_test_LDADD): Likewise.
16595 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16596 (tls_shared_gd_to_ie_test_LDADD): Likewise.
16597 (tls_test_c_gnu2.o): New target.
16598 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16599 tls_test_c_gnu2.o.
16600 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16601 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16602 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16603 * testsuite/tls_test.cc: Include "config.h".
16604 (t_last): Call t11_last.
16605 * testsuite/tls_test.h (t11, t11_last): Declare.
16606 * testsuite/tls_test_c.c: New file.
16607 * testsuite/tls_test_main.cc (thread_routine): Call t11.
16608 * configure.ac: Check for OpenMP support.
16609 * configure, config.in, Makefile.in: Rebuild.
16610 * testsuite/Makefile.in: Rebuild.
16611
16612 2008-04-16 Cary Coutant <ccoutant@google.com>
16613
16614 * i386.cc (Target_i386::define_tls_base_symbol): New function.
16615 (Target_i386::tls_base_symbol_defined_): New field.
16616 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16617 (Target_i386::Scan::global): Likewise.
16618 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16619 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16620 (Target_x86_64::tls_base_symbol_defined_): New field.
16621 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16622 (Target_x86_64::Scan::global): Likewise.
16623
16624 2008-04-16 Cary Coutant <ccoutant@google.com>
16625
16626 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16627 (Symbol::needs_plt_entry): Allow weak undefined symbols.
16628 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16629 building shared libraries.
16630 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16631 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16632 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16633 * testsuite/Makefile.in: Rebuild.
16634 * testsuite/weak_undef.h: New file.
16635 * testsuite/weak_undef_file1.cc: Add extra test cases.
16636 * testsuite/weak_undef_file2.cc: Likewise.
16637 * testsuite/weak_undef_test.cc: Likewise.
16638
16639 2008-04-16 David S. Miller <davem@davemloft.net>
16640
16641 * sparc.cc (Target_sparc::Scan): Change from struct to class.
16642 Add issued_non_pic_error_ field. Declare check_non_pic.
16643 (Target_sparc::Scan::check_non_pic): New function.
16644 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16645 (Target_sparc::Scan::global): Likewise.
16646
16647 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16648 * configure: Rebuild.
16649
16650 * options.h (DEFINE_enable): New macro.
16651 (new_dtags): New enable option.
16652 (initfirst, interpose, loadfltr, nodefaultlib,
16653 nodelete, nodlopen, nodump): New -z options.
16654 * layout.cc (Layout:finish_dynamic_section): If new
16655 dtags enabled, emit DT_RUNPATH. Also, emit a
16656 DT_FLAGS_1 containing any specified -z flags.
16657
16658 2008-04-16 Ian Lance Taylor <iant@google.com>
16659
16660 * copy-relocs.cc: New file.
16661 * copy-relocs.h: New file.
16662 * reloc.cc: Remove Copy_relocs code.
16663 * reloc.h: Likewise.
16664 * reloc-types.h (struct Reloc_types) [both versions]: Add
16665 get_reloc_addend_noerror.
16666 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16667 variants of add_global which take an addend which must be zero.
16668 * i386.cc: Include "copy-relocs.h".
16669 (class Target_i386): Change type of copy_relocs_ to variable,
16670 update initializer.
16671 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16672 Change all callers.
16673 (Target_i386::do_finalize_sections): Change handling of
16674 copy_relocs_.
16675 * sparc.cc: Include "copy-relocs.h".
16676 (class Target_sparc): Change type of copy_relocs_ to variable,
16677 update initializer.
16678 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16679 Change all callers.
16680 (Target_sparc::do_finalize_sections): Change handling of
16681 copy_relocs_.
16682 * x86_64.cc: Include "copy-relocs.h".
16683 (class Target_x86_64): Change type of copy_relocs_ to variable,
16684 update initializer.
16685 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16686 class. Change all callers.
16687 (Target_x86_64::do_finalize_sections): Change handling of
16688 copy_relocs_.
16689 * Makefile.am (CCFILES): Add copy-relocs.cc.
16690 (HFILES): Add copy-relocs.h.
16691
16692 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16693
16694 * testsuite/script_test_4.sh: Permit leading zeroes.
16695
16696 2008-04-15 Ian Lance Taylor <iant@google.com>
16697
16698 * script-sections.cc (Script_sections::create_segments): Use
16699 header_size_adjustment even when there is enough room for the
16700 headers.
16701 * testsuite/script_test_4.sh: New file.
16702 * testsuite/script_test_4.t: New file.
16703 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16704 (check_DATA): Add script_test_4.stdout.
16705 (MOSTLYCLEANFILES): Likewise.
16706 (script_test_4): New target.
16707 (script_test_4.stdout): New target.
16708 * testsuite/Makefile.in: Rebuild.
16709
16710 * sparc.cc: Add definitions for Output_data_plt_sparc class
16711 constants.
16712
16713 2008-04-14 David S. Miller <davem@davemloft.net>
16714
16715 * sparc.cc: New file.
16716 * Makefile.am (TARGETSOURCES): Add sparc.cc
16717 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16718 * configure.tgt: Document targ_extra_size and
16719 targ_extra_big_endian. Add entries for sparc-* and
16720 sparc64-*.
16721 * configure.ac: Handle targ_extra_size and
16722 targ_extra_big_endian.
16723 * Makefile.in: Rebuild.
16724 * configure: Likewise.
16725 * po/POTFILES.in: Likewise.
16726 * po/gold.pot: Likewise.
16727
16728 2008-04-14 Ian Lance Taylor <iant@google.com>
16729
16730 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16731 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16732 in the name/type/flags to section mapping. Don't call
16733 allocate_output_section.
16734 (Layout::choose_output_section): Change parameter from adjust_name
16735 to is_input_section. Don't permit input sections after sections
16736 are attached to segments. Don't call allocate_output_section.
16737 (Layout::layout_eh_frame): Call update_flags_for_input_section,
16738 not write_enable_output_section.
16739 (Layout::make_output_section): Don't push to
16740 unattached_section_list_ nor call attach_to_segment. Call
16741 attach_section_to_segment if sections are attached.
16742 (Layout::attach_sections_to_segments): New function.
16743 (Layout::attach_section_to_segment): New function.
16744 (Layout::attach_allocated_section_to_segment): Rename from
16745 attach_to_segment. Remove flags parameter.
16746 (Layout::allocate_output_section): Remove function.
16747 (Layout::write_enable_output_section): Remove function.
16748 * layout.h (class Layout): Update for above changes. Add new
16749 field sections_are_attached_.
16750 * output.h (Output_section::update_flags_for_input_section): New
16751 function.
16752 * output.cc (Output_section::add_input_section): Call
16753 update_flags_for_input_section.
16754 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16755
16756 2008-04-11 Cary Coutant <ccoutant@google.com>
16757
16758 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16759 thought unnecessary.
16760 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16761
16762 2008-04-11 Ian Lance Taylor <iant@google.com>
16763
16764 * output.h (class Output_section_data): Remove inline definition
16765 of set_addralign.
16766 * output.cc (Output_section_data::set_addralign): New function.
16767
16768 2008-04-11 Cary Coutant <ccoutant@google.com>
16769
16770 Add support for TLS descriptors for i386 and x86_64.
16771 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16772 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16773 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16774 GOT_TYPE_TLS_DESC.
16775 (Target_i386::got_mod_index_entry): Remove unnecessary code.
16776 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16777 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
16778 relocations.
16779 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16780 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16781 Fix problem with initial-exec relocations.
16782 (Target_i386::Relocate::relocate_tls): Likewise.
16783 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16784 relaxation.
16785 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16786 support for section-plus-offset dynamic table entries.
16787 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16788 (Output_data_dynamic::Dynamic_entry): Add support for
16789 section-plus-offset dynamic table entries.
16790 (Output_data_dynamic::Classification): Likewise.
16791 (Output_data_dynamic::classification_): Renamed offset_.
16792 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16793 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16794 (Target_x86_64::make_plt_section): New function.
16795 (Target_x86_64::reserve_tlsdesc_entries): New function.
16796 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16797 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16798 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16799 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16800 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16801 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16802 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
16803 add extra PLT entry for TLS descriptors.
16804 (Output_data_plt_x86_64::got_): New field.
16805 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
16806 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
16807 fields.
16808 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
16809 descriptors.
16810 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
16811 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
16812 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
16813 R_386_TLS_DESC_CALL relocations.
16814 (Target_x86_64::Scan::global): Likewise.
16815 (Target_x86_64::do_finalize_sections): Add dynamic table entries
16816 for TLS descriptors.
16817 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
16818 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
16819 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
16820 GD-to-IE relaxation.
16821 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
16822 and TLS_DESCRIPTORS.
16823 * Makefile.in: Rebuild.
16824 * configure: Rebuild.
16825 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
16826 (tls_test_shared2.so): New target.
16827 (tls_shared_gd_to_ie_test_SOURCES): New variable.
16828 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
16829 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
16830 (tls_shared_gd_to_ie_test_LDADD): New variable.
16831 (tls_shared_gnu2_gd_to_ie_test): New target.
16832 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
16833 New targets.
16834 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
16835 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
16836 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
16837 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
16838 (tls_shared_gnu2_test): New target.
16839 (tls_test_gnu2_shared.so): New target.
16840 (tls_shared_gnu2_test_SOURCES): New variable.
16841 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
16842 (tls_shared_gnu2_test_LDFLAGS): New variable.
16843 (tls_shared_gnu2_test_LDADD): New variable.
16844 * testsuite/Makefile.in: Rebuild.
16845 * testsuite/Makefile.
16846
16847 2008-04-11 Ian Lance Taylor <iant@google.com>
16848
16849 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
16850 justsyms.t.
16851 * testsuite/Makefile.in: Rebuild.
16852
16853 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
16854 long.
16855 * testsuite/script_test_2.cc (main): Adjust test.
16856
16857 2008-04-11 David S. Miller <davem@davemloft.net>
16858 Ian Lance Taylor <iant@google.com>
16859
16860 * options.h (General_options): Add entries for '-Y' and
16861 '-relax'.
16862 * options.cc (General_options:finalize): If -Y was used, add those
16863 entries to the library path instead of the default "/lib" and
16864 "/usr/lib".
16865
16866 2008-04-11 David S. Miller <davem@davemloft.net>
16867
16868 * testsuite/justsyms.t: Start at 0x100.
16869 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
16870 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
16871 long.
16872 * testsuite/script_test_2.cc: Adjust string and section length
16873 checks.
16874
16875 2008-04-09 Ian Lance Taylor <iant@google.com>
16876
16877 PR gold/5996
16878 * script-sections.cc (Sections_element::allocate_to_segment): Add
16879 orphan parameter.
16880 (Output_section_definition::allocate_to_segment): Likewise.
16881 (Orphan_output_section::allocate_to_segment): Likewise.
16882 (Script_sections::attach_sections_using_phdrs_clause): Don't
16883 propagate non-PT_LOAD segments to orphan sections.
16884 * testsuite/Makefile.am (script_test_3.stdout): Generate using
16885 readelf rather than objdump.
16886 * testsuite/script_test_3.sh: Adjust accordingly. Test that
16887 .interp section and PT_INTERP segment are the same size.
16888 * testsuite/Makefile.in: Rebuild.
16889
16890 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
16891 aliases for symbols defined in the same object.
16892 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
16893 (weak_alias_test_SOURCES): New variable.
16894 (weak_alias_test_DEPENDENCIES): New variable.
16895 (weak_alias_test_LDFLAGS): New variable.
16896 (weak_alias_test_LDADD): New variable.
16897 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
16898 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
16899 (weak_alias_test_3.o): New target.
16900 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
16901 * testsuite/weak_alias_test_main.cc: New file.
16902 * testsuite/weak_alias_test_1.cc: New file.
16903 * testsuite/weak_alias_test_2.cc: New file.
16904 * testsuite/weak_alias_test_3.cc: New file.
16905
16906 2008-04-08 Ian Lance Taylor <iant@google.com>
16907
16908 * options.h (class General_options): Add --noinhibit-exec option.
16909 * main.cc (main): Check --noinhibit-exec.
16910
16911 * options.h (class General_options): Define --wrap as a special
16912 option. Add wrap_symbols_ field.
16913 (General_options::any_wrap_symbols): New function.
16914 (General_options::is_wrap_symbol): New function.
16915 * options.cc (General_options::parse_wrap): New function.
16916 (General_options::General_options): Initialize wrap_symbols_.
16917 * symtab.cc (Symbol_table::wrap_symbol): New function.
16918 (Symbol_table::add_from_object): Handle --wrap.
16919 * symtab.h (class Symbol_table): Declare wrap_symbol.
16920 * target.h (Target::wrap_char): New function.
16921 (Target::Target_info): Add wrap_char field.
16922 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
16923 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
16924 * testsuite/testfile.cc (Target_test::test_target_info):
16925 Likewise.
16926
16927 * errors.cc (Errors::undefined_symbol): Mention symbol version if
16928 there is one.
16929
16930 * layout.h (class Layout): Add added_eh_frame_data_ field.
16931 * layout.cc (Layout::Layout): Initialize new field.
16932 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
16933 output section until we find a section we merged successfully.
16934 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
16935 that the size be non-zero.
16936
16937 * merge.cc (Object_merge_map::get_output_offset): Remove inline
16938 qualifier.
16939
16940 2008-04-08 Craig Silverstein <csilvers@google.com>
16941
16942 * configure.ac: Export new conditional variable HAVE_ZLIB.
16943 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
16944 on HAVE_ZLIB.
16945 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
16946 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16947
16948 2008-04-07 Ian Lance Taylor <iant@google.com>
16949
16950 * version.cc (version_string): Set to "1.5".
16951
16952 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
16953 Add issued_non_pic_error_ field. Declare check_non_pic.
16954 (Target_x86_64::Scan::check_non_pic): New function.
16955 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
16956 (Target_x86_64::Scan::global): Likewise.
16957
16958 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
16959 addend parameter. Change caller. Handle merge sections.
16960 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
16961 Address to Addend. Don't add in the result of
16962 local_section_offset, pass down the addend and use the returned
16963 value.
16964 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
16965 Update declarations of local_section_offset and symbol_value.
16966 * testsuite/two_file_test_1.cc (t18): New function.
16967 * testsuite/two_file_test_2.cc (f18): New function.
16968 * testsuite/two_file_test_main.cc (main): Call t18.
16969 * testsuite/two_file_test.h (t18, f18): Declare.
16970
16971 * configure.ac: Don't test for objdump, c++filt, or readelf.
16972 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16973 conditionals.
16974 (TEST_READELF): New variable.
16975 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16976 (check_PROGRAMS): Add two_file_strip_test.
16977 (two_file_strip_test): New target.
16978 (check_PROGRAMS): Add two_file_same_shared_strip_test.
16979 (two_file_same_shared_strip_test_SOURCES): New variable.
16980 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16981 (two_file_same_shared_strip_test_LDFLAGS): New variable.
16982 (two_file_same_shared_strip_test_LDADD): New variable.
16983 (two_file_shared_strip.so): New target.
16984 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16985 (ver_test_5.syms, ver_test_7.syms): Likewise.
16986 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16987 (strip_test_3.stdout): Use TEST_OBJDUMP.
16988 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16989
16990 2008-04-04 Cary Coutant <ccoutant@google.com>
16991
16992 * symtab.h (Symbol::is_weak_undefined): New function.
16993 (Symbol::is_strong_undefined): New function.
16994 (Symbol::is_absolute): New function.
16995 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16996 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16997 absolute symbols.
16998 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16999 (weak_undef_test): New target.
17000 * testsuite/Makefile.in: Rebuild.
17001 * testsuite/weak_undef_file1.cc: New file.
17002 * testsuite/weak_undef_file2.cc: New file.
17003 * testsuite/weak_undef_test.cc: New file.
17004
17005 2008-04-03 Craig Silverstein <csilvers@google.com>
17006
17007 * compressed_output.h (class Output_compressed_section): Use
17008 unsigned buffer.
17009 * compressed_output.cc (zlib_compress): Use unsigned buffers,
17010 add zlib header.
17011 (zlib_compressed_suffix): Removed.
17012 (Output_compressed_section::set_final_data_size): Use unsigned
17013 buffers.
17014 * testsuite/Makefile.am (flagstest_compress_debug_sections):
17015 Fix linker invocation.
17016 (flagstest_o_specialfile_and_compress_debug_sections):
17017 Likewise.
17018 * testsuite/Makefile.in: Regenerated.
17019
17020 2008-04-02 David S. Miller <davem@davemloft.net>
17021
17022 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17023 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17024
17025 2008-04-02 Craig Silverstein <csilvers@google.com>
17026
17027 * TODO: New file.
17028
17029 2008-04-02 Ian Lance Taylor <iant@google.com>
17030
17031 * fileread.cc (File_read::find_view): Add byteshift and vshifted
17032 parameters. Update for new key type to views_. Change all
17033 callers.
17034 (File_read::read): Adjust for byteshift in returned view.
17035 (File_read::add_view): New function, broken out of
17036 find_and_make_view.
17037 (File_read::make_view): New function, broken out of
17038 find_and_make_view.
17039 (File_read::find_or_make_view): Add offset and aligned
17040 parameters. Rewrite accordingly. Change all callers.
17041 (File_read::get_view): Add offset and aligned parameters. Adjust
17042 for byteshift in return value.
17043 (File_read::get_lasting_view): Likewise.
17044 * fileread.h (class File_read): Update declarations.
17045 (class File_read::View): Add byteshift_ field. Add byteshift to
17046 constructor. Add byteshift method.
17047 * archive.h (Archive::clear_uncached_views): New function.
17048 (Archive::get_view): Add aligned parameter. Change all callers.
17049 * object.h (Object::get_view): Add aligned parameter. Change all
17050 callers.
17051 (Object::get_lasting_view): Likewise.
17052
17053 * fileread.cc (File_read::release): Don't call clear_views if
17054 there are multiple objects.
17055 * fileread.h (File_read::clear_uncached_views): New function.
17056 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17057 on the archive.
17058
17059 2008-03-31 Cary Coutant <ccoutant@google.com>
17060
17061 Add thin archive support.
17062 * archive.cc (Archive::armagt): New const.
17063 (Archive::setup): Remove task parameter and calls to unlock.
17064 (Archive::unlock_nested_archives): New function.
17065 (Archive::read_header): Add nested_off parameter. Change
17066 all callers.
17067 (Archive::interpret_header): Likewise.
17068 (Archive::include_all_members): Change to handle thin
17069 archives.
17070 (Archive::include_member): Likewise.
17071 * archive.h (Archive::Archive): Add new parameters and
17072 initializers.
17073 (Archive::armagt): New const.
17074 (Archive::setup): Remove task parameter.
17075 (Archive::unlock_nested_archives): New function.
17076 (Archive::read_header): Add nested_off parameter.
17077 (Archive::interpret_header): Likewise.
17078 (Archive::Nested_archive_table): New typedef.
17079 (Archive::is_thin_archive_): New field.
17080 (Archive::nested_archives_): New field.
17081 (Archive::options_): New field.
17082 (Archive::dirpath_): New field.
17083 (Archive::task_): New field.
17084 * readsyms.cc (Read_symbols::do_read_symbols): Add check
17085 for thin archives. Pass additional parameters to
17086 Archive::Archive. Unlock the archive file after calling
17087 Archive::setup.
17088
17089 2008-03-29 Ian Lance Taylor <iant@google.com>
17090
17091 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17092 version symbol to be local.
17093 * testsuite/ver_test_4.sh: New file.
17094 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17095 (check_DATA): Add ver_test_4.syms.
17096 (ver_test_4.syms): New target.
17097 * testsuite/Makefile.in: Rebuild.
17098
17099 * output.cc
17100 (Output_section::Input_section_sort_entry::has_priority): New
17101 function.
17102 (Output_section::Input_section_sort_entry::match_file_name): New
17103 function.
17104 (Output_section::Input_section_sort_entry::match_section_name):
17105 Remove.
17106 (Output_section::Input_section_sort_entry::match_section_name_prefix):
17107 Remove.
17108 (Output_section::Input_section_sort_entry::match_section_file):
17109 Remove.
17110 (Output_section::Input_section_sort_compare::operator()): Rewrite
17111 using new Input_section_sort_entry functions. Sort crtbegin and
17112 crtend first. Sort sections with no priority before sections with
17113 a priority.
17114 * testsuite/initpri1.c (d3): Check j != 4.
17115 (cd5): New constructor/destructor function.
17116 (main): Check j != 2.
17117
17118 * symtab.cc (Symbol_table::add_from_object): If we don't use the
17119 new symbol when resolving, don't call set_is_default.
17120 * testsuite/ver_test_7.cc: New file.
17121 * testsuite/ver_test_7.sh: New file.
17122 * testsuite/Makefile.am (ver_test_7.so): New target.
17123 (ver_test_7.o): New target.
17124 (check_SCRIPTS): Add ver_test_7.sh.
17125 (check_DATA): Add ver_test_7.syms.
17126 (ver_test_7.syms): New target.
17127
17128 2008-03-28 Ian Lance Taylor <iant@google.com>
17129
17130 * layout.cc (Layout::layout): If we see an input section with a
17131 name that needs sorting, set the must_sort flag for the output
17132 section.
17133 (Layout::make_output_section): If the name of the output section
17134 indicates that it might require sorting, set the may_sort flag.
17135 * output.h (Output_section::may_sort_attached_input_sections): New
17136 function.
17137 (Output_section::set_may_sort_attached_input_sections): New
17138 function.
17139 (Output_section::must_sort_attached_input_sections): New
17140 function.
17141 (Output_section::set_must_sort_attached_input_sections): New
17142 function.
17143 (class Output_section): Declare Input_section_sort_entry. Define
17144 Input_section_sort_compare. Declare
17145 sort_attached_input_sections. Add new fields:
17146 may_sort_attached_input_sections_,
17147 must_sort_attached_input_sections_,
17148 attached_input_sections_are_sorted_.
17149 * output.cc (Output_section::Output_section): Initialize new
17150 fields.
17151 (Output_section::add_input_section): Add an entry to
17152 input_sections_ if may_sort or must_sort are true.
17153 (Output_section::set_final_data_size): Call
17154 sort_attached_input_sections if necessary.
17155 (Output_section::Input_section_sort_entry): Define new class.
17156 (Output_section::Input_section_sort_compare::operator()): New
17157 function.
17158 (Output_section::sort_attached_input_sections): New function.
17159 * configure.ac: Check whether the compiler supports constructor
17160 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
17161 * testsuite/initpri1.c: New file.
17162 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17163 CONSTRUCTOR_PRIORITY.
17164 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17165 (initpri1_LDFLAGS): New variable.
17166 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17167
17168 2008-03-27 Ian Lance Taylor <iant@google.com>
17169
17170 * common.cc (Sort_commons::operator): Correct sorting algorithm.
17171 * testsuite/common_test_1.c: New file.
17172 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17173 (common_test_1_SOURCES): New variable.
17174 (common_test_1_DEPENDENCIES): New variable.
17175 (common_test_1_LDFLAGS): New variable.
17176
17177 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17178 and commons_ correctly when NAME/VERSION does not override
17179 NAME/NULL.
17180 * testsuite/ver_test_6.c: New file.
17181 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17182 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17183 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17184
17185 2008-03-26 Ian Lance Taylor <iant@google.com>
17186
17187 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17188 of an undefined symbol from a version script.
17189 * testsuite/Makefile.am (ver_test_5.so): New target.
17190 (ver_test_5.o): New target.
17191 (check_SCRIPTS): Add ver_test_5.sh.
17192 (check_DATA): Add ver_test_5.syms.
17193 (ver_test_5.syms): New target.
17194 * testsuite/ver_test_5.cc: New file.
17195 * testsuite/ver_test_5.script: New file.
17196 * testsuite/ver_test_5.sh: New file.
17197 * Makefile.in, testsuite/Makefile.in: Rebuild.
17198
17199 PR gold/5986
17200 Fix problems building gold with gcc 4.3.0.
17201 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17202 (gold_error_at_location, gold_warning_at_location): Use it.
17203 * configure.ac: Check whether we can compile and use a template
17204 function with a printf attribute.
17205 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17206 when jumping over bytes.
17207 * object.cc: Instantiate Object::read_section_data.
17208 * debug.h: Include <cstring>
17209 * dwarf_reader.cc: Include <algorithm>
17210 * main.cc: Include <cstring>.
17211 * options.cc: Include <cstring>.
17212 * output.cc: Include <cstring>.
17213 * script.cc: Include <cstring>.
17214 * script.h: Include <string>.
17215 * symtab.cc: Include <cstring> and <algorithm>.
17216 * target-select.cc: Include <cstring>.
17217 * version.cc: Include <string>.
17218 * testsuite/testmain.cc: Include <cstdlib>.
17219 * configure, config.in: Rebuild.
17220
17221 2008-03-25 Ian Lance Taylor <iant@google.com>
17222
17223 * options.cc: Include "../bfd/bfdver.h".
17224 (options::help): Print bug reporting address.
17225
17226 * version.cc (print_version): Adjust output for current value of
17227 BFD_VERSION_STRING.
17228
17229 * NEWS: New file.
17230
17231 * options.cc (options::help): Print list of supported targets.
17232 * target-select.h: Include <vector>.
17233 (class Target_selector): Make machine_, size_, and is_big_endian_
17234 fields const. Add bfd_name_ and instantiated_target_ fields.
17235 (Target_selector::Target_selector): Add bfd_name parameter.
17236 (Target_selector::recognize): Make non-virtual, call
17237 do_recognize.
17238 (Target_selector::recognize_by_name): Make non-virtual, call
17239 do_recognize_by_name.
17240 (Target_selector::supported_names): New function.
17241 (Target_selector::bfd_name): New function.
17242 (Target_selector::do_instantiate_target): New pure virtual
17243 function.
17244 (Target_selector::do_recognize): New virtual function.
17245 (Target_selector::do_recognize_by_name): New virtual function.
17246 (Target_selector::instantiate_target): New private function.
17247 (supported_target_names): Declare.
17248 * target-select.cc (Target_selector::Target_selector): Update for
17249 new parameter and fields.
17250 (select_target_by_name): Check that the name matches before
17251 calling recognize_by_name.
17252 (supported_target_names): New function.
17253 * i386.cc (class Target_selector_i386): Update Target_selector
17254 constructor call. Remove recognize and recognize_by_name. Add
17255 do_instantiate_target.
17256 * x86_64.cc (class Target_selector_x86_64): Likewise.
17257 * testsuite/testfile.cc (class Target_selector_test): Update for
17258 changes to Target_selector.
17259
17260 * README: Rewrite, with some notes on unsupported features.
17261
17262 2008-03-24 Cary Coutant <ccoutant@google.com>
17263
17264 * i386.cc (Target_i386::Got_type): New enum declaration.
17265 (Target_i386::Scan::local): Updated callers of Output_data_got
17266 member functions.
17267 (Target_i386::Scan::global): Likewise.
17268 (Target_i386::Relocate::relocate): Likewise.
17269 (Target_i386::Relocate::relocate_tls): Likewise.
17270 * object.h (Got_offset_list): New class.
17271 (Sized_relobj::local_has_got_offset): Added got_type parameter.
17272 (Sized_relobj::local_got_offset): Likewise.
17273 (Sized_relobj::set_local_got_offset): Likewise.
17274 (Sized_relobj::local_has_tls_got_offset): Removed.
17275 (Sized_relobj::local_tls_got_offset): Removed.
17276 (Sized_relobj::set_local_tls_got_offset): Removed.
17277 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17278 * output.cc (Output_data_got::add_global): Added got_type parameter.
17279 (Output_data_got::add_global_with_rel): Likewise.
17280 (Output_data_got::add_global_with_rela): Likewise.
17281 (Output_data_got::add_global_pair_with_rel): New function.
17282 (Output_data_got::add_global_pair_with_rela): New function.
17283 (Output_data_got::add_local): Added got_type parameter.
17284 (Output_data_got::add_local_with_rel): Likewise.
17285 (Output_data_got::add_local_with_rela): Likewise.
17286 (Output_data_got::add_local_pair_with_rel): New function.
17287 (Output_data_got::add_local_pair_with_rela): New function.
17288 (Output_data_got::add_global_tls): Removed.
17289 (Output_data_got::add_global_tls_with_rel): Removed.
17290 (Output_data_got::add_global_tls_with_rela): Removed.
17291 (Output_data_got::add_local_tls): Removed.
17292 (Output_data_got::add_local_tls_with_rel): Removed.
17293 (Output_data_got::add_local_tls_with_rela): Removed.
17294 * output.h (Output_data_got::add_global): Added got_type parameter.
17295 (Output_data_got::add_global_with_rel): Likewise.
17296 (Output_data_got::add_global_with_rela): Likewise.
17297 (Output_data_got::add_global_pair_with_rel): New function.
17298 (Output_data_got::add_global_pair_with_rela): New function.
17299 (Output_data_got::add_local): Added got_type parameter.
17300 (Output_data_got::add_local_with_rel): Likewise.
17301 (Output_data_got::add_local_with_rela): Likewise.
17302 (Output_data_got::add_local_pair_with_rel): New function.
17303 (Output_data_got::add_local_pair_with_rela): New function.
17304 (Output_data_got::add_global_tls): Removed.
17305 (Output_data_got::add_global_tls_with_rel): Removed.
17306 (Output_data_got::add_global_tls_with_rela): Removed.
17307 (Output_data_got::add_local_tls): Removed.
17308 (Output_data_got::add_local_tls_with_rel): Removed.
17309 (Output_data_got::add_local_tls_with_rela): Removed.
17310 * resolve.cc (Symbol::override_base_with_special): Removed
17311 reference to has_got_offset_ field.
17312 * symtab.cc (Symbol::init_fields): Replaced initialization
17313 of got_offset_ with got_offsets_. Removed initialization
17314 of has_got_offset_
17315 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17316 (Symbol::got_offset): Likewise.
17317 (Symbol::set_got_offset): Likewise.
17318 (Symbol::has_tls_got_offset): Removed.
17319 (Symbol::tls_got_offset): Removed.
17320 (Symbol::set_tls_got_offset): Removed.
17321 (Symbol::got_offset_): Removed.
17322 (Symbol::tls_mod_got_offset_): Removed.
17323 (Symbol::tls_pair_got_offset_): Removed.
17324 (Symbol::got_offsets_): New field.
17325 (Symbol::has_got_offset): Removed.
17326 (Symbol::has_tls_mod_got_offset): Removed.
17327 (Symbol::has_tls_pair_got_offset): Removed.
17328 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17329 (Target_x86_64::Scan::local): Updated callers of Output_data_got
17330 member functions.
17331 (Target_x86_64::Scan::global): Likewise.
17332 (Target_x86_64::Relocate::relocate): Likewise.
17333 (Target_x86_64::Relocate::relocate_tls): Likewise.
17334
17335 2008-03-25 Ben Elliston <bje@au.ibm.com>
17336
17337 * yyscript.y: Fix spelling error in comment.
17338
17339 2008-03-24 Ian Lance Taylor <iant@google.com>
17340
17341 * options.h (class General_options): Define build_id option.
17342 * layout.h (class Layout): Declare write_build_id, create_note,
17343 create_build_id. Add build_id_note_ member.
17344 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17345 "libiberty.h", "md5.h", "sha1.h".
17346 (Layout::Layout): Initialize eh_frame_data_,
17347 eh_frame_hdr_section_, and build_id_note_.
17348 (Layout::finalize): Call create_build_id.
17349 (Layout::create_note): New function, broken out of
17350 Layout::create_gold_note.
17351 (Layout::create_gold_note): Call create_note.
17352 (Layout::create_build_id): New function.
17353 (Layout::write_build_id): New function.
17354 (Close_task_runner::run): Call write_build_id.
17355
17356 * x86_64.cc: Correct license to GPLv3.
17357
17358 2008-03-23 Ian Lance Taylor <iant@google.com>
17359
17360 * options.cc: Include "demangle.h".
17361 (parse_optional_string): New function.
17362 (parse_long_option): Handle takes_optional_argument.
17363 (parse_short_option): Update dash_z initializer. Handle
17364 takes_optional_argument.
17365 (General_options::General_options): Initialize do_demangle_.
17366 (General_options::finalize): Set do_demangle_. Handle demangling
17367 style.
17368 * options.h (parse_optional_string): Declare.
17369 (struct One_option): Add optional_arg field. Update constructor.
17370 Update call constructor calls. Add takes_optional_argument
17371 function.
17372 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
17373 (DEFINE_optional_string): Define.
17374 (General_options::demangle): Change from DEFINE_bool to
17375 DEFINE_optional_string.
17376 (General_options::no_demangle): New function.
17377 (General_options::do_demangle): New function.
17378 (General_options::set_do_demangle): New function.
17379 (General_options::execstack_status_): Move definition to end of
17380 class definition.
17381 (General_options::static_): Likewise.
17382 (General_options::do_demangle_): New field.
17383 * object.cc (big_endian>::get_symbol_location_info): Call
17384 Options::do_demangle, not Options::demangle.
17385 * symtab.cc (demangle): Likewise.
17386
17387 2008-03-22 Ian Lance Taylor <iant@google.com>
17388
17389 * gold.h: Include <cstddef> and <sys/types.h>
17390 * options.h: Include <cstring>.
17391
17392 2008-03-21 Ian Lance Taylor <iant@google.com>
17393
17394 * Added source code to GNU binutils.
17395 \f
17396 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17397
17398 Copying and distribution of this file, with or without modification,
17399 are permitted in any medium without royalty provided the copyright
17400 notice and this notice are preserved.
17401
17402 Local Variables:
17403 mode: change-log
17404 left-margin: 8
17405 fill-column: 74
17406 version-control: never
17407 End:
This page took 0.393821 seconds and 4 git commands to generate.