Fix PowerPC64 ELFv2 icf_safe failures
[binutils-gdb.git] / gold / ChangeLog
1 2014-06-02 Alan Modra <amodra@gmail.com>
2
3 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
4 Only ignore relocs on ELFv1.
5 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
6
7 2014-05-30 Cary Coutant <ccoutant@google.com>
8
9 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
10 * testsuite/Makefile.in: Regenerate.
11 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
12
13 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
14
15 PR gold/16945
16 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
17 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
18
19 2014-05-15 Alan Modra <amodra@gmail.com>
20
21 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
22 Compare FDE contents with DW_CFA_nop rather than 0.
23
24 2014-05-13 Sriraman Tallam <tmsriram@google.com>
25
26 * symtab.h (may_need_copy_reloc): Remove check for position independent
27 code.
28 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
29 position independence before pc absolute may_need_copy_reloc call.
30 Add check for executable output befor pc relative may_need_copy_reloc
31 call.
32 * i386.cc: Ditto.
33 * arm.cc: Ditto.
34 * sparc.cc: Ditto.
35 * tilegx.cc: Ditto.
36 * powerpc.cc: Add check for no position independence before
37 may_need_copy_reloc calls.
38 * testsuite/pie_copyrelocs_test.cc: New file.
39 * testsuite/pie_copyrelocs_shared_test.cc: New file.
40 * Makefile.am (pie_copyrelocs_test): New test.
41 * Makefile.in: Regenerate.
42
43 2014-05-08 Martin Liška <mliska@suse.cz>
44
45 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
46
47 2014-05-06 Cary Coutant <ccoutant@google.com>
48
49 PR gold/16900
50 * i386.cc (Output_data_got_plt_i386): New class.
51 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
52 parameter. Change all callers.
53 (Output_data_plt_i386::layout_): Remove.
54 (Output_data_plt_i386::got_plt_): Change type.
55 (Target_i386::got_plt_): Change type. Change all references.
56 (Target_i386::got_section): Create instance of new class.
57 (Output_data_got_plt_i386::do_write): New function.
58 * x86_64.cc (Output_data_got_plt_x86_64): New class.
59 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
60 parameter. Change all callers.
61 (Output_data_plt_x86_64::layout_): Remove.
62 (Output_data_plt_x86_64::got_plt_): Change type.
63 (Target_x86_64::got_plt_): Change type. Change all references.
64 (Target_x86_64::got_section): Create instance of new class.
65 (Output_data_got_plt_x86_64::do_write): New function.
66 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
67 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
68 class.
69
70 2014-05-05 Cary Coutant <ccoutant@google.com>
71
72 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
73 if we have pubnames/pubtypes.
74
75 2014-05-02 Cary Coutant <ccoutant@google.com>
76
77 * defstd.cc (in_segment): Define __ehdr_start here...
78 * layout.cc (Layout::finalize): ...Instead of here. Set the
79 output segment when known.
80 * resolve.cc (Symbol::override_base_with_special): Remember
81 the original binding.
82 * symtab.cc (Symbol::set_output_segment): New function.
83 (Symbol::set_undefined): New function.
84 * symtab.h (Symbol::is_weak_undefined): Check original undef
85 binding.
86 (Symbol::is_strong_undefined): New function.
87 (Symbol::set_output_segment): New function.
88 (Symbol::set_undefined): New function.
89 * target-reloc.h (is_strong_undefined): Remove.
90 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
91 Check for hidden undefs.
92 (relocate_section): Call Symbol::is_strong_undefined.
93
94 * testsuite/Makefile.am (ehdr_start_test_1)
95 (ehdr_start_test_2, ehdr_start_test_3)
96 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
97 * testsuite/Makefile.in: Regenerate.
98 * testsuite/ehdr_start_def.cc: New source file.
99 * testsuite/ehdr_start_test.cc: New source file.
100 * testsuite/ehdr_start_test.t: New linker script.
101 * testsuite/ehdr_start_test_4.sh: New shell script.
102
103 2014-04-23 Cary Coutant <ccoutant@google.com>
104
105 PR gold/16870
106 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
107
108 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
109
110 * layout.cc (Layout::include_section): Allow a target to decide
111 whether to include a section.
112 * target.h (Target::should_include_section): New function.
113 (Target::do_should_include_section): New function.
114
115 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
116
117 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
118 inline into ...
119 (Copy_relocs::emit): ... here.
120 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
121 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
122 (Copy_reloc_entry::entries_): Change from private to protected.
123
124 2014-04-02 Sriraman Tallam <tmsriram@google.com>
125
126 * icf.cc (get_section_contents): Replace copies of reloc
127 vectors with const references.
128
129 2014-04-02 Cary Coutant <ccoutant@google.com>
130
131 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
132 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
133 * configure: Regenerate.
134 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
135 -fno-use-linker-plugin.
136 (LINK1, CXXLINK1): Add it to the link command.
137 * testsuite/Makefile.in: Regenerate.
138
139 2014-03-12 Alan Modra <amodra@gmail.com>
140
141 * Makefile.in: Regenerate.
142
143 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
144
145 * symtab.h (Symbol::set_nonvis): New function.
146
147 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
148
149 * symtab.cc (Sized_symbol<32>::init_output_data):
150 Instantiate the template.
151 (Sized_symbol<64>::init_output_data): Likewise.
152
153 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
154
155 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
156 adjust dynamic symbol value.
157 * target.h (Target::adjust_dyn_symbol): New function.
158 (Target::do_adjust_dyn_symbol): New function.
159
160 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
161
162 * output.cc (Output_data_dynamic::Dynamic_entry::write):
163 Get the value of DYNAMIC_CUSTOM dynamic entry.
164 * output.h (Output_data_dynamic::add_custom): New function.
165 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
166 dynamic entry.
167 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
168 * target.h (Target::dynamic_tag_custom_value): New function.
169 (Target::do_dynamic_tag_custom_value): New function.
170
171 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
172
173 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
174 dynsym indexes.
175 * target.h (Target::has_custom_set_dynsym_indexes): New function.
176 (Target::do_has_custom_set_dynsym_indexes): New function.
177 (Target::set_dynsym_indexes): New function.
178 (Target::do_set_dynsym_indexes): New function.
179
180 2014-03-07 Alan Modra <amodra@gmail.com>
181
182 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
183 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
184 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
185 (Powerpc_relocate_functions::has_overflow_bitfield,
186 overflowed): Use the above.
187 (Target_powerpc::Relocate::relocate): Correct overflow checking
188 for a number of relocations. Modify overflow test for 16-bit
189 fields in instructions to signed/unsigned according to whether
190 the field takes a signed or unsigned value.
191
192 2014-03-05 Alan Modra <amodra@gmail.com>
193
194 Update copyright years.
195
196 2014-03-05 Alan Modra <amodra@gmail.com>
197
198 * powerpc.cc (Target_powerpc::Scan::local, global): Support
199 R_PPC64_ADDR64_LOCAL.
200 (Target_powerpc::Relocate::relocate): Likewise.
201
202 2014-03-03 Alan Modra <amodra@gmail.com>
203
204 * dwp.cc (print_version): Update copyright year to current.
205
206 2014-02-10 Alan Modra <amodra@gmail.com>
207
208 * po/gold.pot: Regenerate.
209
210 2014-02-06 Cary Coutant <ccoutant@google.com>
211
212 Fix problem where -u is ignored when a weak undef is seen.
213
214 * archive.cc (Library_base::should_include_member): Reorder
215 code to check for -u option if a weak undef has already been seen.
216 * testsuite/Makefile.am (weak_undef_test_2): New test case.
217 * testsuite/Makefile.in: Regenerate.
218 * testsuite/weak_undef_file3.cc: New file.
219 * testsuite/weak_undef_file4.cc: New file.
220 * testsuite/weak_undef_test_2.cc: New file.
221
222 2014-02-05 Cary Coutant <ccoutant@google.com>
223
224 Fix issues with gold undefined symbol diagnostics.
225
226 PR binutils/15435
227 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
228 check to here.
229 * target-reloc.h (is_strong_undefined): New function.
230 (relocate_section): Move undef vtable symbol check from here.
231 Check for is_strong_undefined.
232
233 2014-02-05 Cary Coutant <ccoutant@google.com>
234
235 Fix problems with the --dynamic-list option.
236
237 PR gold/13577
238 * options.cc (General_options::parse_dynamic_list):
239 Set have_dynamic_list_.
240 (General_options::General_options): Initialize have_dynamic_list_.
241 (General_options::finalize): Turn off -Bsymbolic and
242 -Bsymbolic-functions if --dynamic-list provided.
243 * options.h (General_options::have_dynamic_list): New function.
244 (General_options::have_dynamic_list_): New data member.
245 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
246 correctly.
247
248 PR gold/16530
249 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
250 in --dynamic-list, mark it.
251
252 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
253 (dynamic_list_2): New test case.
254 * testsuite/Makefile.in: Regenerate.
255 * testsuite/dynamic_list_2.cc: New file.
256 * testsuite/dynamic_list_2.t: New file.
257 * testsuite/dynamic_list_lib1.cc: New file.
258 * testsuite/dynamic_list_lib2.cc: New file.
259 * testsuite/gc_dynamic_list_test.c: New file.
260 * testsuite/gc_dynamic_list_test.sh: New file.
261 * testsuite/gc_dynamic_list_test.t: New file.
262
263 2014-01-28 Cary Coutant <ccoutant@google.com>
264
265 Add .gdb_index version 7 support.
266
267 * gold/dwarf_reader.cc: include <utility> (for make_pair).
268 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
269 debug sections.
270 (Dwarf_ranges_table::read_ranges_table): Likewise.
271 (Dwarf_pubnames_table::read_section): Check for GNU-style
272 sections, and for compressed debug sections.
273 (Dwarf_pubnames_table::read_header): Compute end address of table.
274 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
275 for end of list by offset, not by offset == 0.
276 (Dwarf_info_reader::do_read_string_table): Check for compressed
277 debug sections.
278 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
279 Initialize new data members.
280 (Dwarf_pubnames_table::next_name): return flag_byte.
281 (Dwarf_pubnames_table::end_of_table_): New data member.
282 (Dwarf_pubnames_table::is_gnu_style_): New data member.
283 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
284 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
285 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
286 read skeleton type unit DIEs.
287 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
288 (Gdb_index::do_write): Write flag_byte.
289 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
290 (Gdb_index::Cu_vector): Store flags along with cu indexes.
291 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
292 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
293
294 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
295
296 * version.cc (print_version): Update copyright year to 2014.
297
298 2013-12-19 Dimitry Andric <dimitry@andric.com>
299
300 * stringpool.cc (Stringpool_template::reserve): Add
301 HAVE_UNORDERED_MAP case.
302 * stringpool.cc (Stringpool_template::print_stats): Likewise.
303
304 2013-12-18 Cary Coutant <ccoutant@google.com>
305
306 * configure.ac: Check for <unordered_set> and <unordered_map>.
307 * config.in: Regenerate.
308 * configure: Regenerate.
309 * system.h: Use <unordered_set> and <unordered_map> if available.
310
311 2013-12-10 Roland McGrath <mcgrathr@google.com>
312
313 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
314 with $(INSTALL_PROGRAM_ENV).
315 * Makefile.in: Regenerate.
316
317 2013-11-22 Cary Coutant <ccoutant@google.com>
318
319 * configure.ac: Add check for which library is needed for
320 dlopen.
321 * configure: Regenerate.
322
323 2013-11-22 Cary Coutant <ccoutant@google.com>
324
325 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
326 assembler.
327 * testsuite/Makefile.in: Regenerate.
328
329 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
330
331 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
332 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
333 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
334 (Target_x86_64<size>::Scan::local): Likewise.
335 (Target_x86_64<size>::Scan::global): Likewise.
336 (Target_x86_64<size>::Relocate::relocate): Likewise.
337 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
338 Likewise.
339 (Target_x86_64<size>::Scan::check_non_pic(): Handle
340 R_X86_64_PC32_BND.
341
342 * testsuite/Makefile.am (check_PROGRAMS): Add
343 exception_x86_64_bnd_test.
344 (exception_x86_64_bnd_test_SOURCES): New macro.
345 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
346 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
347 (exception_x86_64_bnd_test_LDADD): Likewise.
348 (exception_x86_64_bnd_1.o): New rule.
349 (exception_x86_64_bnd_2.o): Likewise.
350 * testsuite/Makefile.in: Regenerated.
351
352 2013-11-15 Alan Modra <amodra@gmail.com>
353
354 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
355 accessor.
356 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
357 Only call ppc64_local_entry_offset for 64-bit. Restrict
358 symval_for_branch lookup to ELFv1.
359 (Stub_table::add_plt_call_entry): Use unsigned int off.
360 (Output_data_glink::Address, invalid_address): New.
361 (Output_data_glink::add_eh_frame): Move out of line. Add
362 support for ELFv2.
363 (Output_data_glink::add_global_entry, find_global_entry,
364 global_entry_address): New functions.
365 (Output_data_glink::global_entry_stubs_, end_branch_table_,
366 ge_size): New variables.
367 (Output_data_glink::set_final_data_size): Add global entry
368 stub sizing.
369 (Output_data_glink::do_write): Write global entry stubs.
370 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
371 parameter. Return true for ELFv2. Adjust callers.
372 (Target_powerpc::Scan::local, global): Restrict opd lookup to
373 ELFv1. Similarly for ifunc and dynamic relocation processing
374 specific to ELFv1. Recognize that symbols are defined on
375 their plt entries for ELFv2.
376 (Target_powerpc::symval_for_branch): Assert if called for
377 ELFv2 or ppc32.
378 (Target_powerpc::Relocate::relocate): Use global entry plt
379 stub for symbol value if such exists on ELFv2.
380 (Target_powerpc::Relocate::relocate): Don't call
381 symval_for_branch when ELFv2. Do adjust for local entry
382 offset when ELFv2.
383 (Target_powerpc::do_dynsym_value): Set symbols to global entry
384 plt stub for ELFv2.
385 (Target_powerpc::do_plt_address_for_global): Similarly.
386
387 2013-11-14 Cary Coutant <ccoutant@google.com>
388
389 Revert patch -- this did not fix the problem, and there is
390 no race there.
391
392 2013-11-14 Cary Coutant <ccoutant@google.com>
393
394 PR gold/14860
395 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
396 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
397 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
398 updating fde_offsets_.
399 (Eh_frame_hdr::lock_): New data member.
400
401 2013-11-14 Cary Coutant <ccoutant@google.com>
402
403 * dwp.cc (Dwo_file_entry): New type.
404 (File_list): Use Dwo_file_entry.
405 (Dwo_file::verify): New function.
406 (Dwo_file::verify_dwo_list): New function.
407 (Dwo_file::sized_verify_dwo_list): New function.
408 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
409 list.
410 (Dwp_options): New enum type.
411 (dwp_options): Add --verify-only.
412 (usage): Likewise.
413 (main): Likewise.
414 * dwp.h (gold_info): Add declaration.
415
416 2013-11-14 Cary Coutant <ccoutant@google.com>
417
418 PR gold/14860
419 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
420 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
421 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
422 updating fde_offsets_.
423 (Eh_frame_hdr::lock_): New data member.
424
425 2013-11-06 Cary Coutant <ccoutant@google.com>
426
427 PR gold/15758
428 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
429 before reloc sections.
430
431 2013-11-04 Alan Modra <amodra@gmail.com>
432
433 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
434 (Symbol::needs_dynamic_reloc): Test new flag.
435 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
436 (Target_powerpc::Scan::get_reference_flags): Add target param.
437 Return FUNC_DESC_ABI for 64-bit ELFv1.
438 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
439 call.
440 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
441 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
442
443 2013-10-31 Cary Coutant <ccoutant@google.com>
444
445 Restore support for dwp v2 DWARF package file format.
446
447 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
448 tu_length parameter. Adjust all callers.
449 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
450 * dwp.cc: Include dwarf.h.
451 (Section_bounds): New struct type.
452 (Unit_set): New struct type.
453 (Dwo_file::Dwo_file): Initialize new data member.
454 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
455 Combine and rename to...
456 (Dwo_file::read_unit_index): ...this.
457 (Dwo_file::sized_read_compunit_index)
458 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
459 (Dwo_file::sized_read_unit_index): ...this.
460 (Dwo_file::copy_section): Remove section_name, is_str_offsets
461 parameters; add section_id parameter.
462 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
463 (Dwo_file::add_unit_set): ...this.
464 (Dwo_file::shndx_map_): Remove.
465 (Dwo_file::sect_offsets_): New data member.
466 (Dwp_output_file::Dwp_output_file): Initialize new data members.
467 (Dwp_output_file::add_section): Rename to...
468 (Dwp_output_file::add_contribution): ...this.
469 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
470 (Dwp_output_file::add_tu_set): Likewise.
471 (Dwp_output_file::Contribution): New type.
472 (Dwp_output_file::Section::contributions): New data member.
473 (Dwp_output_file::Cu_or_tu_set): Remove.
474 (Dwp_output_file::Section::Section): New ctor.
475 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
476 (Dwp_output_file::Dwp_index::Section_table): New type.
477 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
478 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
479 parameter.
480 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
481 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
482 (Dwp_output_file::Dwp_index::section_table): New member function.
483 (Dwp_output_file::Dwp_index::section_table_end): New member function.
484 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
485 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
486 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
487 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
488 (Dwp_output_file::Dwp_index::section_table_): New data member.
489 (Dwp_output_file::Dwp_index::section_mask_): New data member.
490 (Dwp_output_file::add_output_section): New member function.
491 (Dwp_output_file::write_new_section): New member function.
492 (Dwp_output_file::write_contributions): New member function.
493 (Dwp_output_file::section_id_map_): New data member.
494 (class Dwo_id_info_reader): Remove.
495 (class Unit_reader): New class.
496 (get_dwarf_section_name): New function.
497 (Dwo_file::read_executable): Adjust initializations of class data.
498 (Dwo_file::read): Add support for v2 package file format.
499 (Dwo_file::read_unit_index): Likewise.
500 (Dwo_file::sized_read_unit_index): Likewise.
501 (Dwo_file::copy_section): Likewise.
502 (Dwo_file::add_unit_set): Likewise.
503 (Dwp_output_file::add_output_section): Likewise.
504 (Dwp_output_file::add_contribution): Likewise.
505 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
506 for empty slot.
507 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
508 file format.
509 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
510 slot.
511 (Dwp_output_file::initialize): Remove unused function.
512 (Dwp_output_file::finalize): Add support for v2 package file format.
513 (Dwp_output_file::write_index): Likewise.
514 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
515 function prototype.
516
517 2013-10-31 Cary Coutant <ccoutant@google.com>
518
519 * configure.ac: Fix check for -fmerge-constants.
520 * configure.ac: Regenerate.
521
522 2013-10-30 Roland McGrath <mcgrathr@google.com>
523
524 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
525 Correct 9-byte nop sequence to match what the assembler generates.
526
527 2013-10-30 Alan Modra <amodra@gmail.com>
528
529 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
530 ppc64_local_entry_offset, ppc64_local_entry_offset,
531 do_read_symbols): New functions.
532 (Powerpc_relobj::e_flags_, st_other_): New vars.
533 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
534 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
535 (Powerpc_relobj::e_flags_): New var.
536 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
537 and adjust for ELFv2.
538 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
539 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
540 (Powerpc_dynobj::do_find_special_sections): Likewise.
541 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
542 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
543 to ELFv2 local entry.
544 (Target_powerpc::do_relax): No thread safe barriers needed for
545 ELFv2.
546 (Output_data_plt_powerpc::initial_plt_entry_size_,
547 plt_entry_size): Delete. Replace all uses with
548 first_plt_entry_offset() and plt_entry_size().
549 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
550 reserved_size parm. Update callers.
551 (Output_data_plt_powerpc::entry_count): Update.
552 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
553 and use Target_powerpc::first_plt_entry_offset().
554 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
555 rename to plt_entry_size.
556 (Output_data_plt_powerpc::add_ifunc_entry,
557 add_local_ifunc_entry): Adjust reloc for ELFv2.
558 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
559 (glink_eh_frame_fde_64v2): New.
560 (Stub_table::plt_call_size): Support ELFv2 sizing.
561 (Output_data_glink::add_eh_frame): Use the new FDE.
562 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
563 (Stub_table::do_write): Write ELFv2 stubs and glink.
564 (Target_powerpc::Relocate::relocate): Replaces nop after call
565 with ld 2,24(1) and adjust local offset destination for ELFv2.
566
567 2013-10-30 Alan Modra <amodra@gmail.com>
568
569 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
570 (Target_powerpc::Scan::global, local): Likewise.
571 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
572 on all ppc64 @h and @ha relocs.
573
574 2013-10-14 Alan Modra <amodra@gmail.com>
575
576 * output.h (Output_data_got::add_constant): Tidy.
577 (Output_data_got::add_constant_pair): New function.
578 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
579 methods used so as to first call reserve_ent().
580
581 2013-10-11 Roland McGrath <mcgrathr@google.com>
582
583 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
584 add_got_entry and add_got_entry_pair.
585
586 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
587 (HAVE_PUBNAMES): Likewise.
588 * configure: Regenerate.
589
590 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
591 * testsuite/Makefile.in: Regenerate.
592
593 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
594 Remove const from declaration.
595 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
596 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
597 * output.h (Output_file_header): Remove const from member target_
598 and corresponding constructor argument.
599 * output.cc (Output_file_header::Output_file_header): Update prototype.
600 (Output_file_header::do_sized_write): Use this->target_ in place
601 of parameters()->target().
602
603 * testsuite/undef_symbol.cc (Foo::get_a): New method.
604
605 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
606 * configure: Regenerate.
607 * Makefile.in: Regenerate.
608 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
609 * testsuite/merge_string_literals_2.c: Likewise.
610 * testsuite/Makefile.am
611 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
612 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
613 literal -fmerge-constants.
614 * testsuite/Makefile.in: Regenerate.
615
616 * i386.cc (Target_i386): Remove unused member dynbss_.
617 * arm.cc (Target_arm): Likewise.
618 * powerpc.cc (Target_powerpc): Likewise.
619 * sparc.cc (Target_sparc): Likewise.
620 * tilegx.cc (Target_tilegx): Likewise.
621 * x86_64.cc (Target_x86_64): Likewise.
622 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
623 type_signature_, type_offset_.
624 * plugin.h (Plugin_hook): Remove unused member layout_.
625 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
626 mapfile_.
627 (Read_member): Remove unused members input_objects_, symtab_,
628 mapfile_, layout_.
629 (Check_library): Remove unused member symtab_.
630 * archive.h (Lib_group): Remove unused member lib_.
631 * archive.cc (Lib_group::Lib_group): Update initializer.
632 * incremental.h (Incremental_binary): Remove unused member target_.
633 (Incremental_script_entry): Removed unused member script_.
634 * layout.h (Write_symbols_task): Remove unused member input_objects_.
635 * icf.h (Icf): Remove unused member num_tracked_relocs.
636
637 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
638 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
639 its only use.
640 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
641
642 * archive.h: Use struct rather than class for forward declaration
643 of Read_symbols_data.
644
645 2013-10-07 Cary Coutant <ccoutant@google.com>
646
647 PR gold/16010
648 * testsuite/Makefile.am (icf_test): Fix dependencies.
649 (icf_safe_test): Likewise.
650 (icf_safe_so_test): Likewise.
651 (large_symbol_alignment): Add empty _LDADD rule.
652 * testsuite/Makefile.in: Regenerate.
653
654 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
655
656 PR gold/15927
657 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
658 relocation for R_X86_64_32 on x32.
659
660 2013-08-27 Roland McGrath <mcgrathr@google.com>
661
662 * output.cc (Output_segment::set_section_addresses): Take new
663 Target* argument. If target->isolate_execinstr() and the segment
664 is executable and starts at a target->abi_pagesize() boundary,
665 pad its end out to a target->abi_pagesize() boundary with code fill.
666 * output.h (Output_segment::set_section_addresses): Update decl.
667 * layout.h (Layout::check_output_data_for_reset_values): Take new
668 argument RELAX_OUTPUTS.
669 (Layout): New member relax_output_list_.
670 (Layout::add_relax_output): New method.
671 * layout.cc (Layout::Layout): Update constructor.
672 (Layout::reset_relax_output): New method.
673 (Layout::clean_up_after_relaxation): Call it.
674 (Layout::prepare_for_relaxation): Update caller.
675 (Layout::set_segment_offsets): Update callers of set_section_addresses.
676 Call reset_relax_output before re-processing segments for
677 isolate_execinstr case.
678 (Layout::write_data): Handle relax_output_list_.
679 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
680 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
681
682 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
683
684 PR binutils/15834
685 * object.h: Fix typos.
686
687 2013-08-16 Roland McGrath <mcgrathr@google.com>
688
689 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
690 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
691
692 2013-08-07 Cary Coutant <ccoutant@google.com>
693
694 Revert support for v2 DWP files:
695
696 2013-03-01 Cary Coutant <ccoutant@google.com>
697
698 Add dwp support for v2 DWARF package file format.
699 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
700 tu_length parameter. Adjust all callers.
701 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
702 * dwp.cc: Include dwarf.h.
703 (Section_bounds): New struct type.
704 (Unit_set): New struct type.
705 (Dwo_file::Dwo_file): Initialize new data member.
706 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
707 Combine and rename to...
708 (Dwo_file::read_unit_index): ...this.
709 (Dwo_file::sized_read_compunit_index)
710 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
711 (Dwo_file::sized_read_unit_index): ...this.
712 (Dwo_file::copy_section): Remove section_name, is_str_offsets
713 parameters; add section_id parameter.
714 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
715 (Dwo_file::add_unit_set): ...this.
716 (Dwo_file::shndx_map_): Remove.
717 (Dwo_file::sect_offsets_): New data member.
718 (Dwp_output_file::Dwp_output_file): Initialize new data members.
719 (Dwp_output_file::add_section): Rename to...
720 (Dwp_output_file::add_contribution): ...this.
721 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
722 (Dwp_output_file::add_tu_set): Likewise.
723 (Dwp_output_file::Contribution): New type.
724 (Dwp_output_file::Section::contributions): New data member.
725 (Dwp_output_file::Cu_or_tu_set): Remove.
726 (Dwp_output_file::Section::Section): New ctor.
727 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
728 (Dwp_output_file::Dwp_index::Section_table): New type.
729 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
730 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
731 parameter.
732 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
733 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
734 (Dwp_output_file::Dwp_index::section_table): New member function.
735 (Dwp_output_file::Dwp_index::section_table_end): New member function.
736 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
737 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
738 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
739 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
740 (Dwp_output_file::Dwp_index::section_table_): New data member.
741 (Dwp_output_file::Dwp_index::section_mask_): New data member.
742 (Dwp_output_file::add_output_section): New member function.
743 (Dwp_output_file::write_new_section): New member function.
744 (Dwp_output_file::write_contributions): New member function.
745 (Dwp_output_file::section_id_map_): New data member.
746 (class Dwo_id_info_reader): Remove.
747 (class Unit_reader): New class.
748 (get_dwarf_section_name): New function.
749 (Dwo_file::read_executable): Adjust initializations of class data.
750 (Dwo_file::read): Add support for v2 package file format.
751 (Dwo_file::read_unit_index): Likewise.
752 (Dwo_file::sized_read_unit_index): Likewise.
753 (Dwo_file::copy_section): Likewise.
754 (Dwo_file::add_unit_set): Likewise.
755 (Dwp_output_file::add_output_section): Likewise.
756 (Dwp_output_file::add_contribution): Likewise.
757 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
758 for empty slot.
759 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
760 file format.
761 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
762 slot.
763 (Dwp_output_file::initialize): Remove unused function.
764 (Dwp_output_file::finalize): Add support for v2 package file format.
765 (Dwp_output_file::write_index): Likewise.
766 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
767 function prototype.
768
769 2013-07-31 Cary Coutant <ccoutant@google.com>
770
771 * object.cc (Sized_relobj::do_output_section_address): New function.
772 (Sized_relobj): Instantiate explicitly.
773 * object.h (Object::output_section_address): New function.
774 (Object::do_output_section_address): New function.
775 (Sized_relobj::do_output_section_address): New function.
776 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
777
778 2013-07-30 Cary Coutant <ccoutant@google.com>
779 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
780
781 * parameters.cc (Parameters::entry): Return target-specific entry
782 symbol name.
783 * target.h (Target::entry_symbol_name): New function.
784 (Target_info::entry_symbol_name): New data member.
785
786 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
787 * i386.cc (Target_i386::i386_info): Likewise.
788 (Target_i386_nacl::i386_nacl_info): Likewise.
789 * sparc.cc (Target_sparc::sparc_info): Likewise.
790 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
791 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
792 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
793 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
794
795 2013-07-22 Sterling Augustine <saugustine@google.com>
796
797 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
798 Convert parameter shndx to local variable. Add parameters symtab
799 and symtab_size. Scan over section names. Find relocation
800 section corresponding to current section. Create and initialize
801 reloc_mapper_ and reloc_type_.
802 (Dwarf_pubnames_table::read_header): Add assertion. Change
803 unit_length to off_t. Initialize member unit_length_. Fill in field
804 cu_offset_.
805 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
806 Initialize new fields unit_length_ and cu_offset_.
807 (Dwarf_pubnames_table::read_section): Update prototype.
808 (Dwarf_pubnames_table::cu_offset): New member function.
809 (Dwarf_pubnames_table::subsection_size): Likewise.
810 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
811 New fields.
812 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
813 member functions public.
814 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
815 Update comment. Rework logic. Move repeated parts to...
816 (Gdb_index_info_reader::read_pubtable): ...here. New function.
817 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
818 pubtypes_table_, and stmt_list_offset.
819 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
820 Gdb_index::find_pubtype_offset,
821 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
822 (Gdb_index::pubnames_read): Update prototype and rework logic.
823 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
824 Forward declare.
825 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
826 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
827 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
828 Gdb_index::map_pubtable_to_dies):
829 Declare functions.
830 (Gdb_index::pubnames_read): Update declaration.
831 (Gdb_index::Pubname_offset_map): New type.
832 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
833 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
834 Gdb_index::stmt_list_offset): Declare.
835 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
836 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
837 Gdb_index::pubtypes_offset_): Remove.
838
839 2013-07-19 Roland McGrath <mcgrathr@google.com>
840
841 * options.h (General_options): Add -Trodata-segment option.
842 * parameters.cc (Parameters::check_rodata_segment): New function.
843 (Parameters::set_target_once): Call it.
844 * parameters.h (Parameters): Declare it (private member function).
845 * layout.cc (load_seg_unusable_for_headers): New function, broken
846 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
847 then validate rodata segment rather than text segment.
848 (relaxation_loop_body): Call that.
849 (is_text_segment): New function. Don't admit a non-executable
850 segment if TARGET->isolate_execinstr().
851 (set_segment_offsets): Call it. Honor -Trodata-segment option.
852
853 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
854
855 PR gold/15070
856 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
857 * nacl.h (Sniff_file::View::View): Request aligned view.
858
859 2013-07-11 Cary Coutant <ccoutant@google.com>
860
861 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
862 correct BRLT entry size.
863
864 2013-07-03 Alan Modra <amodra@gmail.com>
865
866 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
867 comment.
868
869 2013-07-01 Cary Coutant <ccoutant@google.com>
870
871 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
872 reloc_type_.
873 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
874 (Dwarf_ranges_table::lookup_reloc): New function.
875 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
876 reloc_type_.
877 (Dwarf_ranges_table::lookup_reloc): New function.
878 (Dwarf_ranges_table::reloc_type_): New data member.
879
880 2013-06-27 Jing Yu <jingyu@google.com>
881
882 PR gold/15662
883 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
884 function.
885 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
886 (Target_powerpc::do_relax): Call the above.
887
888 2013-06-27 Cary Coutant <ccoutant@google.com>
889
890 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
891 on garbage collected .opd section.
892
893 2013-06-27 Alan Modra <amodra@gmail.com>
894
895 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
896 is non-zero.
897 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
898 (Target_powerpc::do_function_location): Likewise for loc->shndx.
899
900 2013-06-14 Cary Coutant <ccoutant@google.com>
901
902 * resolve.cc (Symbol::override_base): Don't override st_type
903 from plugin placeholder symbols.
904 (Symbol_table::resolve): Likewise.
905 (Symbol_table::should_override): Don't complain about TLS mismatch
906 if the TO symbol is a plugin placeholder.
907 * testsuite/Makefile.am (plugin_test_tls): New test.
908 * testsuite/Makefile.in: Regenerate.
909 * testsuite/plugin_test_tls.sh: New test script.
910 * testsuite/two_file_test_2_tls.cc: New test source.
911 * testsuite/two_file_test_tls.cc: New test source.
912
913 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
914
915 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
916 the maximum segment alignment is larger than the page size.
917 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
918 correctly aligns the symbols with large alignemnt.
919 * testsuite/Makefile.in: Regenerate.
920 * testsuite/large_symbol_alignment.cc: New file.
921
922 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
923 Sriraman Tallam <tmsriram@google.com>
924
925 * options.h (sort_section): New option.
926 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
927 Rename from Input_section_sort_section_name_special_ordering_compare.
928 (Input_section_sort_section_name_compare): New struct.
929 * output.cc (Output_section::Input_section_sort_section_name_compare::
930 operator()): New function.
931 (Output_section::sort_attached_input_sections): Use new sort function
932 for .text if --sort-section=name is specified.
933 * layout.cc (Layout::make_output_section):
934 Add sorting by name when --sort-section=name is specified.
935 * testsuite/Makefile.am (text_section_grouping): Test option
936 --sort-section=name.
937 * testsuite/Makefile.in: Regenerate.
938 * testsuite/section_sorting_name.cc: New file.
939 * testsuite/section_sorting_name.sh: New file.
940
941 2013-05-21 Cary Coutant <ccoutant@google.com>
942
943 * symtab.h (Symbol::is_cxx_vtable): New function.
944 * target-reloc.h (relocate_section): Check for vtable symbol.
945 * testsuite/Makefile.am (missing_key_func.sh): New test case.
946 * testsuite/Makefile.in: Regenerate.
947 * testsuite/missing_key_func.cc: New test source.
948 * testsuite/missing_key_func.sh: New test script.
949
950 2013-05-21 Cary Coutant <ccoutant@google.com>
951
952 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
953 type of enclosing symbol.
954 (Relocate_info::location): Check symbol type when describing symbol.
955 * object.h (Symbol_location_info): Remove unused line_number;
956 add enclosing_symbol_type.
957 * testsuite/debug_msg.sh: Adjust expected output.
958
959 2013-05-13 Cary Coutant <ccoutant@google.com>
960
961 * configure.ac: Export DEFAULT_TARGET.
962 * configure: Regenerate.
963 * Makefile.in: Regenerate.
964 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
965 * testsuite/Makefile.in: Regenerate.
966 * testsuite/debug_msg.sh: Delete duplicate tests.
967 Don't check undef_int error message match for powerpc where the
968 source file and line number aren't available.
969
970 2013-05-10 Roland McGrath <mcgrathr@google.com>
971
972 * options.h (General_options): Add --rosegment-gap option.
973 * options.cc (finalize): --rosegment-gap implies --rosegment.
974 * layout.cc (set_segment_offsets): Let user option override
975 target->rosegment_gap().
976
977 2013-05-10 Roland McGrath <mcgrathr@google.com>
978
979 * options.h (General_options): Remove leading space from help
980 messages for -nostdlib and --rosegment.
981
982 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
983
984 PR ld/15365
985 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
986
987 2013-05-03 Alan Modra <amodra@gmail.com>
988
989 * merge.cc (Output_merge_string::do_add_input_section): Correct
990 scan for number of strings. Rename vars to avoid shadowing.
991 Include missing terminator in input_size_.
992
993 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
994
995 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
996 Restore empty string handling.
997
998 2013-05-01 Cary Coutant <ccoutant@google.com>
999
1000 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1001 uninitialized warning.
1002
1003 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1004
1005 * output.cc (Output_section::add_merge_input_section): Allow
1006 to merge sections if the alignment is more than character size.
1007 * merge.h (Output_merge_string::Output_merge_string): Remove
1008 assert.
1009 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1010 only not-null strings. Check the alignment of strings.
1011 * stringpool.h
1012 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1013 alignment as the argument.
1014 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1015 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1016 Align non-zero length strings according to the addralign_.
1017 (Stringpool_template<Stringpool_char>::set_string_offsets):
1018 Updating offsets according to the given alignment.
1019 * testsuite/Makefile.am (text_section_grouping): Test if string
1020 literals are getting merged.
1021 * testsuite/Makefile.in: Regenerate.
1022 * testsuite/merge_string_literals_1.c: New file.
1023 * testsuite/merge_string_literals_2.c: Ditto.
1024 * testsuite/merge_string_literals.sh: Ditto.
1025
1026 2013-04-26 Ian Lance Taylor <iant@google.com>
1027
1028 * target-reloc.h (relocate_section): If the reloc offset is out of
1029 range, pass VIEW as NULL to relocate.relocate.
1030 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1031 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1032 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1033 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1034 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1035 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1036
1037 2013-04-26 Geoff Pike <gpike@chromium.org>
1038
1039 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1040 * layout.cc (Hash_task): New class.
1041 (Layout::queue_build_id_tasks): New function.
1042 (Layout::write_build_id): Handle single-thread portion of build ID
1043 computation. (In some cases, all of it is single-threaded.) Replace
1044 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1045 functionality in fewer lines of code.
1046 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1047 * options.h (General_options): make "--build-id" default to tree
1048 rather than sha1. Add two new options related to --build-id=tree:
1049 --build-id-chunk-size-for-treehash and
1050 --build-id-min-file-size-for-treehash.
1051 * Makefile.am: add testing of --build-id=tree and related new options
1052 (these tests will be invoked by "make check").
1053 * Makefile.in: Regenerate.
1054
1055 2013-04-25 Alan Modra <amodra@gmail.com>
1056
1057 * configure.tgt: Add powerpcle and powerpc64le.
1058
1059 2013-04-22 Alan Modra <amodra@gmail.com>
1060
1061 PR gold/15355
1062 * layout.cc (Layout::segment_precedes): Allow more than one
1063 segment with the same type and flags.
1064
1065 2013-04-15 Cary Coutant <ccoutant@google.com>
1066
1067 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1068 allocate space in file for BSS sections.
1069
1070 2013-04-15 Cary Coutant <ccoutant@google.com>
1071
1072 * script-sections.cc (Orphan_output_section): Reset address
1073 to zero after each orphaned section for relocatable links.
1074
1075 2013-04-15 Cary Coutant <ccoutant@google.com>
1076
1077 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1078 section starting address for relocatable link.
1079 * testsuite/Makefile.am (script_test_11): New test.
1080 * testsuite/Makefile.in: Regenerate.
1081 * testsuite/script_test_11.c: New source file.
1082 * testsuite/script_test_11.t: New linker script.
1083
1084 2013-04-13 Alan Modra <amodra@gmail.com>
1085
1086 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1087 owner when sections are not adjacent and exceed group size.
1088 (Target_powerpc::group_sections): Handle corner case.
1089 (Target_powerpc::Branch_info::make_stub): Handle case where
1090 stub table doesn't exist due to branches in non-exec sections.
1091 (Target_powerpc::Relocate::relocate): Likewise.
1092
1093 2013-04-11 Alan Modra <amodra@gmail.com>
1094
1095 PR gold/15354
1096 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1097 .branch_lt to match bfd ld. Adjust comments throughout file.
1098
1099 2013-04-04 Ian Lance Taylor <iant@google.com>
1100
1101 GCC PR c++/56840
1102 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1103 sections before checking whether they are included in the link.
1104
1105 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1106
1107 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1108 object before calling the plugin claim_file handler. Pass the elf
1109 object of the archive to the plugin. Delete the elf object if the
1110 plugin claims the file.
1111
1112 2013-03-21 Alan Modra <amodra@gmail.com>
1113
1114 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1115 segment when omagic.
1116
1117 2013-03-21 Alan Modra <amodra@gmail.com>
1118
1119 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1120 comparison warning.
1121 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1122 uninitialized" warning.
1123
1124 2013-03-20 Alan Modra <amodra@gmail.com>
1125
1126 * symtab.h (Symbol::clear_version): New function.
1127 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1128 is_needed by weak references. Clear version for symbols defined
1129 in as-needed objects that are not needed.
1130
1131 2013-03-15 Alan Modra <amodra@gmail.com>
1132
1133 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1134 static and public. Add report_err param. Return false for data refs.
1135 (Target_powerpc::rela_dyn_section): New overloaded function.
1136 (Target_powerpc::plt_, iplt_): Elucidate.
1137 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1138 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1139 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1140 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1141 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1142 push_branch and make_plt_entry for ifunc syms when
1143 reloc_needs_plt_for_ifunc.
1144 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1145 for ifunc unless reloc_needs_plt_for_ifunc.
1146
1147 2013-03-15 Alan Modra <amodra@gmail.com>
1148
1149 * gc.h (gc_process_relocs): Don't look through function descriptors.
1150 * icf.cc (get_section_contents): Do so here instead.
1151
1152 2013-03-13 Alan Modra <amodra@gmail.com>
1153
1154 * powerpc.cc (is_branch_reloc): Forward declare.
1155 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1156 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1157 false for 64-bit, true for 32-bit non-branch relocs.
1158 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1159 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1160 nm output.
1161 (icf_safe_test): Generate linker map file as well as nm output.
1162 (icf_safe_so_test): Likewise.
1163 * testsuite/Makefile.in: Regenerate.
1164 * testsuite/icf_test.sh: Parse linker map file to determine
1165 section folding.
1166 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1167 * testsuite/icf_safe_so_test.sh: Likewise.
1168 (X86_32_or_ARM_specific_safe_fold): Merge into..
1169 (arch_specific_safe_fold): ..this.
1170 (X86_64_specific_safe_fold): Delete unused function.
1171
1172 2013-03-12 Alan Modra <amodra@gmail.com>
1173
1174 * gc.h (gc_process_relocs): Look through function descriptors
1175 to determine shndx, symvalue and addend used by ICF. Tidy
1176 variable duplication.
1177
1178 2013-03-11 Alan Modra <amodra@gmail.com>
1179
1180 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1181 * layout.cc (Layout_task_runner::run): ..to here.
1182 * symtab.h (struct Symbol_location): Extract from..
1183 (class Symbol_table): ..here.
1184 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1185 * target.h (class Target): Add function_location and
1186 do_function_location functions.
1187 (class Sized_target): Add do_function_location.
1188 * object.h (class Sized_relobj_file): Move find_shdr..
1189 (class Object): ..to here.
1190 * object.cc: Likewise. Update to suit. Instantiate.
1191 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1192 * powerpc.cc (class Powerpc_dynobj): New.
1193 (Target_powerpc::do_function_location): New function.
1194 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1195 (Powerpc_dynobj::do_read_symbols): New function.
1196 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1197
1198 2013-03-08 Ian Lance Taylor <iant@google.com>
1199
1200 * options.cc (General_options::string_to_object_format): Accept
1201 "default".
1202
1203 2013-03-08 Alan Modra <amodra@gmail.com>
1204
1205 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1206 pointer to Post_fde.
1207 (struct Post_fde): Move definition to here..
1208 * ehframe.cc (struct Post_fde): ..from here.
1209 (Cie::write): Don't alloc Post_fde.
1210 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1211
1212 2013-03-07 Alan Modra <amodra@gmail.com>
1213
1214 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1215 relocation referencing .LC0.
1216 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1217
1218 2013-03-07 Alan Modra <amodra@gmail.com>
1219
1220 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1221 always_inline. Add assembly for powerpc to avoid GOT.
1222
1223 2013-03-07 Alan Modra <amodra@gmail.com>
1224
1225 * testsuite/script_test_10.sh: Don't test .bss section
1226 header number.
1227
1228 2013-03-06 Alan Modra <amodra@gmail.com>
1229
1230 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1231 (Target_powerpc::symval_for_branch): Add symtab param. Update
1232 all callers. Handle folded sections.
1233 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1234 to Powerpc_relobj.
1235 (Global_symbol_visitor_opd::operator()): Likewise.
1236
1237 2013-03-04 Alan Modra <amodra@gmail.com>
1238
1239 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1240 * testsuite/Makefile.in: Regenerate.
1241
1242 2013-03-01 Cary Coutant <ccoutant@google.com>
1243
1244 Add dwp support for v2 DWARF package file format.
1245 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1246 tu_length parameter. Adjust all callers.
1247 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1248 * dwp.cc: Include dwarf.h.
1249 (Section_bounds): New struct type.
1250 (Unit_set): New struct type.
1251 (Dwo_file::Dwo_file): Initialize new data member.
1252 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1253 Combine and rename to...
1254 (Dwo_file::read_unit_index): ...this.
1255 (Dwo_file::sized_read_compunit_index)
1256 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1257 (Dwo_file::sized_read_unit_index): ...this.
1258 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1259 parameters; add section_id parameter.
1260 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1261 (Dwo_file::add_unit_set): ...this.
1262 (Dwo_file::shndx_map_): Remove.
1263 (Dwo_file::sect_offsets_): New data member.
1264 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1265 (Dwp_output_file::add_section): Rename to...
1266 (Dwp_output_file::add_contribution): ...this.
1267 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1268 (Dwp_output_file::add_tu_set): Likewise.
1269 (Dwp_output_file::Contribution): New type.
1270 (Dwp_output_file::Section::contributions): New data member.
1271 (Dwp_output_file::Cu_or_tu_set): Remove.
1272 (Dwp_output_file::Section::Section): New ctor.
1273 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1274 (Dwp_output_file::Dwp_index::Section_table): New type.
1275 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1276 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1277 parameter.
1278 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1279 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1280 (Dwp_output_file::Dwp_index::section_table): New member function.
1281 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1282 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1283 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1284 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1285 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1286 (Dwp_output_file::Dwp_index::section_table_): New data member.
1287 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1288 (Dwp_output_file::add_output_section): New member function.
1289 (Dwp_output_file::write_new_section): New member function.
1290 (Dwp_output_file::write_contributions): New member function.
1291 (Dwp_output_file::section_id_map_): New data member.
1292 (class Dwo_id_info_reader): Remove.
1293 (class Unit_reader): New class.
1294 (get_dwarf_section_name): New function.
1295 (Dwo_file::read_executable): Adjust initializations of class data.
1296 (Dwo_file::read): Add support for v2 package file format.
1297 (Dwo_file::read_unit_index): Likewise.
1298 (Dwo_file::sized_read_unit_index): Likewise.
1299 (Dwo_file::copy_section): Likewise.
1300 (Dwo_file::add_unit_set): Likewise.
1301 (Dwp_output_file::add_output_section): Likewise.
1302 (Dwp_output_file::add_contribution): Likewise.
1303 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1304 for empty slot.
1305 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1306 file format.
1307 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1308 slot.
1309 (Dwp_output_file::initialize): Remove unused function.
1310 (Dwp_output_file::finalize): Add support for v2 package file format.
1311 (Dwp_output_file::write_index): Likewise.
1312 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1313 function prototype.
1314
1315 2013-03-01 Cary Coutant <ccoutant@google.com>
1316
1317 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1318 function into class definition in header file.
1319 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1320 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1321 New function.
1322 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1323
1324 2013-02-28 Alan Modra <amodra@gmail.com>
1325
1326 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1327 * target.cc (Target::do_plt_fde_location): New function.
1328 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1329 accessor function, and constructor param.
1330 (struct Post_fde, Post_fdes): Declare.
1331 (Cie::write): Add post_fdes param.
1332 * ehframe.cc (Fde::write): Use plt_fde_location.
1333 (struct Post_fde): Define.
1334 (Cie::write): Stash FDEs added post merge mapping.
1335 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1336 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1337 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1338 other FDEs.
1339 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1340 (Target_powerpc::has_glink): New function.
1341 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1342 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1343 glink_eh_frame_fde_32, default_fde): New data.
1344 (Stub_table::eh_frame_added_): New var.
1345 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1346 Make const.
1347 (Stub_table::add_eh_frame): New function.
1348 (Output_data_glink::add_eh_frame): New function.
1349 (Target_powerpc::make_glink_section): Call add_eh_frame.
1350
1351 2013-02-15 Ian Lance Taylor <iant@google.com>
1352
1353 * options.h (DEFINE_uint64_alias): Define.
1354 (class General_options): Add -Ttext-segment as an alias for
1355 -Ttext.
1356
1357 2013-02-15 Alan Modra <amodra@gmail.com>
1358
1359 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1360 (Stub_table::do_write): ..here, two places.
1361 (Stub_table::plt_call_size): Use it here too.
1362
1363 2013-02-11 Ian Lance Taylor <iant@google.com>
1364
1365 * descriptors.cc (Descriptors::close_all): New function.
1366 * descriptors.h (class Descriptors): Declare close_all.
1367 (close_all_descriptors): New inline function.
1368 * plugin.cc: Include "descriptors.h".
1369 (Plugin_manager::cleanup): Call close_all_descriptors.
1370
1371 2013-02-06 Alan Modra <amodra@gmail.com>
1372
1373 * README: Update coding style link.
1374
1375 2013-01-28 Cary Coutant <ccoutant@google.com>
1376
1377 * dwp.cc (File_list): New typedef.
1378 (Dwo_name_info_reader): New class.
1379 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1380 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1381 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1382 (Dwo_file::read_executable): New function.
1383 (Dwo_file::read): Move common setup code to ...
1384 (Dwo_file::make_object): ... here.
1385 (dwp_options): Add --exec/-e.
1386 (usage): Likewise.
1387 (main): Likewise.
1388
1389 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1390
1391 * layout.cc (Layout::layout): Check for option text_reorder.
1392 (Layout::make_output_section): Ditto.
1393 * options.h (text_reorder): New option.
1394 * output.cc (Input_section_sort_compare): Remove special ordering
1395 of section names.
1396 (Output_section::
1397 Input_section_sort_section_name_special_ordering_compare::
1398 operator()): New function.
1399 (Output_section::sort_attached_input_sections): Use new sort function
1400 for .text.
1401 * output.h (Input_section_sort_section_name_special_ordering_compare):
1402 New struct.
1403 * testsuite/Makefile.am (text_section_grouping): Test option
1404 --no-text-reorder
1405 * testsuite/Makefile.in: Regenerate.
1406 * testsuite/text_section_grouping.sh: Check order of functions without
1407 default text reordering.
1408
1409 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1410
1411 * options.h (General_options): Change default to true for new_dtags.
1412
1413 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1414
1415 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1416 when enable_new_dtags is false. Only add DT_RUNPATH when
1417 enable_new_dtags is true.
1418
1419 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1420
1421 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1422 used in declaration and definition consistent.
1423 (Target_powerpc::symval_for_branch): Ditto.
1424
1425 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1426
1427 * testsuite/plugin_final_layout.cc: Fix comment.
1428
1429 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1430
1431 * layout.cc (Layout::layout): Do not do default sorting for
1432 text sections when section ordering is specified.
1433 (make_output_section): Ditto.
1434 * testsuite/plugin_final_layout.cc: Name the function sections
1435 to catch reordering issues.
1436
1437 2013-01-15 Alan Modra <amodra@gmail.com>
1438
1439 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1440 plt-thread-safe.
1441
1442 2013-01-15 Alan Modra <amodra@gmail.com>
1443
1444 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1445 * testsuite/Makefile.in: Regenerate.
1446
1447 2013-01-14 Alan Modra <amodra@gmail.com>
1448
1449 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1450 * testsuite/Makefile.in: Regenerate.
1451
1452 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1453
1454 PR bfd/14430
1455 Fix mingw gold build with plugins enabled
1456 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1457 * configure.ac: Export DLOPEN_LIBS and add headers check.
1458 * plugin.cc: Handle non-dlfcn case.
1459 * Makefile.in: Regenerate.
1460 * config.in: Regenerate.
1461 * configure: Regenerate.
1462 * testsuite/Makefile.in: Regenerate.
1463
1464 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1465
1466 * output.h (sort_attached_input_sections): Change to be public.
1467 * script-sections.cc
1468 (Output_section_definition::set_section_addresses): Sort
1469 attached input sections according to section order before linker
1470 script assigns section addresses.
1471 (Orphan_output_section::set_section_addresses): Sort
1472 attached input sections according to section order before linker
1473 script assigns section addresses.
1474 * Makefile.am (final_layout.sh): Use a simple linker script to
1475 check if section ordering still works.
1476 * Makefile.in: Regenerate.
1477
1478 2013-01-09 Ben Cheng <bccheng@google.com>
1479
1480 * arm.cc (Target_arm::attributes_accept_div): New function.
1481 (Target_arm::attributes_forbid_div): New function.
1482 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1483 attribute using the same new functions as what bfd/elf32_arm.c
1484 does.
1485
1486 2013-01-07 Cary Coutant <ccoutant@google.com>
1487
1488 PR gold/14993
1489 * output.cc (Output_section::add_input_section): For incremental
1490 updates, don't track input sections that are allocated from patch
1491 space.
1492
1493 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1494 Ian Lance Taylor <iant@google.com>
1495
1496 PR gold/14897
1497 * configure.ac (--enable-ld): Removed.
1498 (install_as_default): Set to yes only for --enable-gold=default
1499 or --disable-ld.
1500 * configure: Regenerated.
1501
1502 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1503
1504 * options.h (General_options): Add -fuse-ld= for GCC linker
1505 option compatibility.
1506
1507 2013-01-04 Cary Coutant <ccoutant@google.com>
1508
1509 * configure.ac: Fix typo restoring CXXFLAGS.
1510 * configure: Regenerate.
1511
1512 2013-01-04 Cary Coutant <ccoutant@google.com>
1513
1514 * testsuite/Makefile.am (CXXLINK_S): New macro.
1515 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1516 * testsuite/Makefile.in: Regenerate.
1517
1518 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1519
1520 * version.cc (print_version): Update copyright year to 2013.
1521
1522 2012-12-20 Ian Lance Taylor <iant@google.com>
1523
1524 * layout.cc (Layout::special_ordering_of_input_section): New
1525 function.
1526 (Layout::layout): If input section requires special ordering, must
1527 sort input sections.
1528 (Layout::make_output_section): May sort .text input sections.
1529 (Layout::is_section_name_prefix_grouped): Remove.
1530 * layout.h (class Layout): Declare
1531 special_ordering_of_input_section. Don't declare
1532 is_section_name_prefix_grouped.
1533 * output.cc (Output_section::add_input_section): Revert last
1534 change.
1535 (Output_section::Input_section_sort::match_file_name): Don't crash
1536 if called on output section data.
1537 (Output_section::Input_section_sort_compare): Sort based on
1538 special ordering.
1539 (Output_section::Input_section_sort_section_order_index_compare):
1540 Revert last patch.
1541 (Output_section::sort_attached_input_sections): Likewise.
1542
1543 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1544
1545 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1546 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1547 * output.cc (Output_section::add_input_section): Check if section
1548 name contains special prefix. Keep input sections to sort such
1549 sections.
1550 (Output_section::Input_section_sort_section_order_index_compare
1551 ::operator()): Group sections according to prefixes.
1552 (Output_section::sort_attached_input_sections): Add condition to
1553 Input_section_entry constructor call.
1554 * testsuite/Makefile.am (text_section_grouping): New test.
1555 * testsuite/Makefile.in: Regenerate.
1556 * testsuite/text_section_grouping.cc: New file.
1557 * testsuite/text_section_grouping.sh: New file.
1558
1559 2012-12-17 Nick Clifton <nickc@redhat.com>
1560
1561 * Makefile.am: Add copyright notice.
1562 * NEWS: Likewise.
1563 * README: Likewise.
1564 * configure.ac: Likewise.
1565 * ftruncate.c: Likewise.
1566 * Makefile.in: Regenerate.
1567
1568 2012-12-14 Cary Coutant <ccoutant@google.com>
1569
1570 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1571 --no-as-needed flag.
1572 (exception_separate_shared_12_test): Likewise.
1573 (incremental_copy_test): Likewise.
1574 * testsuite/Makefile.in: Regenerate.
1575
1576 2012-12-14 Cary Coutant <ccoutant@google.com>
1577
1578 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1579 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1580
1581 2012-12-12 Alan Modra <amodra@gmail.com>
1582
1583 * powerpc.cc (class Track_tls): New.
1584 (class Relocate, class Scan): Inherit Track_tls.
1585 (Target_powerpc::Scan::local, global): Track tls optimization
1586 and avoid creating plt entry for __tls_get_addr if all uses
1587 are optimized away.
1588 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1589
1590 2012-12-12 Alan Modra <amodra@gmail.com>
1591
1592 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1593 Replace no_toc_optimize with toc_optimize.
1594 * output.h (Output_section::input_sections): Provide non-const variant.
1595 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1596 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1597 accessors.
1598 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1599 (class Sort_toc_sections): New.
1600 (Target_powerpc::do_finalize_sections): Sort toc sections.
1601 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1602
1603 2012-12-10 Roland McGrath <mcgrathr@google.com>
1604
1605 * testsuite/binary_unittest.cc (read_all): New function.
1606 (Sized_binary_test): Use it instead of ::read.
1607 * fileread.cc (do_read): Don't assume pread always reads the whole
1608 amount in a single call.
1609
1610 2012-12-10 Alan Modra <amodra@gmail.com>
1611
1612 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1613 Set EM_PPC64 or EM_PPC here.
1614 (Target_selector_powerpc::do_recognize): Delete.
1615
1616 2012-12-10 Alan Modra <amodra@gmail.com>
1617
1618 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1619 stub_table_.
1620 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1621
1622 2012-12-07 Roland McGrath <mcgrathr@google.com>
1623
1624 * testsuite/binary_unittest.cc (Sized_binary_test):
1625 Use open_descriptor rather than ::open.
1626
1627 2012-12-07 Alan Modra <amodra@gmail.com>
1628
1629 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1630 typedef and invalid_address constant.
1631 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1632 instantiate constants.
1633
1634 2012-12-06 Roland McGrath <mcgrathr@google.com>
1635
1636 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1637 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1638 * aclocal.m4: Regenerate.
1639 * configure: Regenerate.
1640 * Makefile.in: Regenerate.
1641 * testsuite/Makefile.in: Regenerate.
1642
1643 2012-12-07 Alan Modra <amodra@gmail.com>
1644
1645 * options.h (General_options): Add no_toc_optimize.
1646 * powerpc.cc (ok_lo_toc_insn): New function.
1647 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1648
1649 2012-12-06 Alan Modra <amodra@gmail.com>
1650
1651 * options.h (General_options): Add plt_align, plt_static_chain,
1652 plt_thread_safe. Update stub_group_size help text.
1653 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1654 for new plt_thread_safe_ var.
1655 (use_plt_offset): Correct comments.
1656 (Target_powerpc::do_relax): Look for thread creation symbols to
1657 determine default plt_thread_safe value. Clear plt call stubs
1658 as well as branch stubs each iteration.
1659 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1660 insn constants.
1661 (l, hi, ha, write_insn): Move earlier.
1662 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1663 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1664 plt stubs too.
1665 (Stub_table::update_size): Adjust.
1666 (Stub_table::prev_size, set_prev_size): Delete.
1667 (Stub_table::stub_align): Let --plt-align affect result.
1668 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1669 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1670 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1671 (Stub_table::do_write): Support more stub variants.
1672
1673 2012-12-04 Alan Modra <amodra@gmail.com>
1674
1675 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1676 (Target_powerpc::do_define_standard_symbols): New function.
1677
1678 2012-12-03 Alan Modra <amodra@gmail.com>
1679
1680 * output.h: Formatting, whitespace.
1681
1682 2012-12-03 Alan Modra <amodra@gmail.com>
1683
1684 * layout.h (Layout::get_executable_sections): Declare.
1685 * layout.cc (Layout::get_executable_sections): New function.
1686 * arm.cc (Target_arm::group_sections): Use it.
1687 (Arm_output_section::group_sections): Delete now redundant test.
1688 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1689 param to handle relative relocs.
1690 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1691 (Output_data_reloc::add_absolute): Adjust.
1692 (Output_data_reloc::add_relative): New function.
1693 (Output_data::reset_data_size): New function.
1694 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1695 (Output_section::set_addralign): New function.
1696 (Output_section::checkpoint_set_addralign): New function.
1697 (Output_section::clear_section_offsets_need_adjustment): New function.
1698 (Output_section::input_sections): Make public.
1699 * powerpc.cc (class Output_data_brlt_powerpc): New.
1700 (class Stub_table, class Stub_control): New.
1701 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1702 stub_table_, set_stub_table, stub_table): New vectors and accessor
1703 functions.
1704 (Target_powerpc::do_may_relax, do_relax, push_branch,
1705 new_stub_table, stub_tables, brlt_section, group_sections,
1706 add_branch_lookup_table, find_branch_lookup_table,
1707 write_branch_lookup_table, make_brlt_section): New functions.
1708 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1709 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1710 branch_info_): New vars.
1711 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1712 make call stubs here.
1713 (Output_data_glink): Remove all call stub handling from this class.
1714 (Target_powerpc::Scan::local, global): Save interesting branch
1715 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1716 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1717 functions on final link.
1718 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1719 Handle long branch destinations too.
1720 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1721 do_plt_address_for_local): Adjust lookup of plt call stubs.
1722
1723 2012-11-30 Alan Modra <amodra@gmail.com>
1724
1725 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1726 relocs against protected symbols when building 32-bit shared libs.
1727
1728 2012-11-30 Alan Modra <amodra@gmail.com>
1729
1730 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1731 param. Call got_section() to make .got. Update all callers
1732 and their callers and so on.
1733
1734 2012-11-30 Alan Modra <amodra@gmail.com>
1735
1736 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1737 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1738 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1739 value if it already exists.
1740
1741 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1742
1743 PR gold/14858
1744 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1745
1746 2012-11-14 Roland McGrath <mcgrathr@google.com>
1747
1748 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1749 than bfc instruction for data sandboxing.
1750
1751 2012-11-08 Alan Modra <amodra@gmail.com>
1752
1753 * po/POTFILES.in: Regenerate.
1754
1755 2012-11-05 Alan Modra <amodra@gmail.com>
1756
1757 * configure.ac: Apply 2012-09-10 change to config.in here.
1758 * configure: Regenerate.
1759
1760 2012-11-05 Alan Modra <amodra@gmail.com>
1761
1762 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1763 (struct Opd_ent): Use "Address" rather than "Offset".
1764 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1765 (Target_powerpc::got_section): Make public.
1766 (Target_powerpc::scan_relocs): Move code setting symbols..
1767 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1768 Create _SDA_BASE_ only when referenced.
1769
1770 2012-11-02 Roland McGrath <mcgrathr@google.com>
1771
1772 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1773 from last change.
1774
1775 2012-11-01 Roland McGrath <mcgrathr@google.com>
1776
1777 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1778 for offset_in_output_section parameter.
1779 (Sized_target::relocate_special_relocatable): Likewise.
1780 * arm.cc (Target_arm::relocate_relocs): Likewise.
1781 (Target_arm::relocate_special_relocatable): Likewise.
1782 * i386.cc (Target_i386::relocate_relocs): Likewise.
1783 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1784 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1785 * target-reloc.h (relocate_relocs): Likewise.
1786 * testsuite/testfile.cc (Target_test): Likewise.
1787 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1788 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1789
1790 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1791 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1792
1793 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1794 parameter, which is unused in the [!F_SETFD] case.
1795
1796 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1797 SYMNDX to off_t before comparing it to this->data_size().
1798 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1799 * incremental.cc (Output_section_incremental_inputs::do_write):
1800 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1801
1802 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1803
1804 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1805
1806 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1807 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1808 in EABI_VER5.
1809
1810 2012-10-29 Cary Coutant <ccoutant@google.com>
1811
1812 * dwp.cc (usage): Add file and exit status parameters;
1813 add --help and --version options.
1814 (print_version): New function.
1815 (main): Add --help and --version options.
1816
1817 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1818
1819 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1820 final_layout_sequence.txt.
1821 * testsuite/Makefile.in: Regenerated.
1822
1823 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1824
1825 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1826 COMPILE generated by automake.
1827 (LINK1): Likewise.
1828 (CXXCOMPILE1): Likewise.
1829 (CXXLINK1): Likewise.
1830 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1831 (LINK): Likewise.
1832 (CXXCOMPILE): Likewise.
1833 (CXXLINK): Likewise.
1834 * testsuite/Makefile.in: Regenerated.
1835
1836 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1837
1838 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1839 on bad fwrite return.
1840
1841 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1842
1843 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1844 on val.
1845
1846 2012-10-23 Cary Coutant <ccoutant@google.com>
1847
1848 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1849 * testsuite/Makefile.in: Regenerate.
1850 * testsuite/dwp_test.h: New source file.
1851 * testsuite/dwp_test_1.cc: New source file.
1852 * testsuite/dwp_test_1.s: New source file.
1853 * testsuite/dwp_test_1.sh: New source file.
1854 * testsuite/dwp_test_1b.cc: New source file.
1855 * testsuite/dwp_test_1b.s: New source file.
1856 * testsuite/dwp_test_2.cc: New source file.
1857 * testsuite/dwp_test_2.s: New source file.
1858 * testsuite/dwp_test_2.sh: New source file.
1859 * testsuite/dwp_test_main.cc: New source file.
1860 * testsuite/dwp_test_main.s: New source file.
1861
1862 2012-10-23 Cary Coutant <ccoutant@google.com>
1863
1864 * dwp.h: New header file.
1865 * dwp.cc: New source file.
1866 * gold.h: Move shared declarations to system.h.
1867 * system.h: New header file.
1868 * Makefile.am: Add dwp.
1869 * Makefile.in: Regenerate.
1870
1871 2012-10-23 Cary Coutant <ccoutant@google.com>
1872
1873 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1874 Dwarf_info_reader::read_from_pointer.
1875 (Dwarf_pubnames_table::read_header): Likewise.
1876 (Dwarf_pubnames_table::next_name): Likewise.
1877 (Dwarf_die::read_attributes): Likewise.
1878 (Dwarf_die::skip_attributes): Likewise.
1879 (Dwarf_info_reader::read_from_pointer): New function template.
1880 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1881 (Dwarf_pubnames_table): Likewise.
1882 (Dwarf_info_reader::read_from_pointer): New function template.
1883 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1884 Dwarf_pubnames_table ctor.
1885
1886 2012-10-23 Cary Coutant <ccoutant@google.com>
1887
1888 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1889 abbrev_shndx.
1890 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1891 abbrev_shndx_.
1892 (Dwarf_info_reader::set_abbrev_shndx): New method.
1893 (Dwarf_info_reader::abbrev_shndx_): New data member.
1894
1895 2012-10-23 Cary Coutant <ccoutant@google.com>
1896
1897 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1898 from object, not parameters.
1899 (Dwarf_info_reader::parse): Likewise.
1900 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1901 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1902 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1903 methods.
1904
1905 2012-10-23 Cary Coutant <ccoutant@google.com>
1906
1907 * fileread.cc (Input_file::Input_file): New constructor.
1908 * fileread.h (class Input_file): Add new constructor.
1909
1910 2012-10-18 Alan Modra <amodra@gmail.com>
1911
1912 PR gold/14727
1913 * object.cc (Relobj::is_section_name_included): Also match
1914 .sdata personality section.
1915
1916 2012-10-18 Alan Modra <amodra@gmail.com>
1917
1918 * target-reloc.h (class Default_comdat_behavior): New, package up..
1919 (get_comdat_behaviour): ..this.
1920 (relocate_section): Add Relocate_comdat_behavior template arg,
1921 adjust code to suit.
1922 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1923 (Target_arm::scan_reloc_section): Likewise.
1924 * i386.cc (Target_i386::relocate_section): Likewise.
1925 * sparc.cc (Target_sparc::relocate_section): Likewise.
1926 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1927 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1928 * powerpc.cc (class Relocate_comdat_behavior): New.
1929 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1930 gold::relocate_section with new template arg.
1931
1932 2012-10-18 Alan Modra <amodra@gmail.com>
1933
1934 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1935 dynamic relocs for GOT_TPREL got entries, without symbol if
1936 resolving locally.
1937 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1938 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1939 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1940
1941 2012-10-17 Alan Modra <amodra@gmail.com>
1942
1943 PR gold/14726
1944 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1945
1946 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1947
1948 * layout.cc (Layout::include_section): Keep sections marked
1949 SHF_EXCLUDE when doing relocatable links.
1950
1951 2012-10-16 Alan Modra <amodra@gmail.com>
1952
1953 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1954 (Target_powerpc::do_finalize_sections): Call it.
1955 (Output_data_save_res): New class and supporting functions.
1956 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1957 normal symbols defined in object files.
1958
1959 2012-10-12 Alan Modra <amodra@gmail.com>
1960
1961 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1962 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1963 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1964 section if scan_opd_relocs not yet called.
1965 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1966
1967 2012-10-12 Alan Modra <amodra@gmail.com>
1968
1969 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1970 add_local_ifunc_entry): Revert last change.
1971 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1972
1973 2012-10-05 Alan Modra <amodra@gmail.com>
1974
1975 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1976 do_plt_address_for_global): New functions.
1977 (Output_data_got_powerpc::do_write): Don't segfault when linking
1978 statically.
1979 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1980 add_local_ifunc_entry): Return true on adding entry..
1981 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1982 glink->add_entry call. Remove unused symtab param. Adjust calls.
1983 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1984 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1985 set up symbols here.
1986 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1987 syms here. Do so even when no .iplt. Don't segfault when linking
1988 statically.
1989 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1990 new variants without reloc param.
1991 (Glink_sym_ent::Glink_sym_ent): Likewise.
1992 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1993 reloc when refs will resolve to plt call stub.
1994 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1995 R_PPC_PLTREL24 to resolve locally.
1996 (Target_powerpc::Scan::global): Correct ifunc handling.
1997 (Target_powerpc::Relocate::relocate): Correct local sym glink
1998 lookup. Don't destroy "value" when we have a plt call stub,
1999 and when checking plt call validity.
2000 (Target_powerpc::do_dynsym_value): Simplify.
2001
2002 2012-10-05 Alan Modra <amodra@gmail.com>
2003
2004 * i386.cc (Output_data_plt_i386::address_for_global,
2005 address_for_local): Add plt offset to returned value. Adjust uses.
2006 * sparc.cc (Output_data_plt_sparc::address_for_global,
2007 address_for_local): Likewise.
2008 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2009 address_for_local): Likewise.
2010 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2011 address_for_local): Likewise.
2012 * target.h (Target::plt_address_for_global, plt_address_for_local):
2013 Update comment.
2014 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2015 (Output_data_got::Got_entry::write): Nor here.
2016 * output.h: Comment fix.
2017
2018 2012-10-02 Jiong Wang <jiwang@tilera.com>
2019
2020 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2021 global_offset_table_ value for larget got.
2022 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2023
2024 2012-09-29 Alan Modra <amodra@gmail.com>
2025
2026 * powerpc.cc (Target_powerpc::iplt_): New output section.
2027 (Target_powerpc::iplt_section, make_iplt_section,
2028 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2029 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2030 Target_powerpc::plt_entry_count): Count iplt entries too.
2031 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2032 reloc section in constructor. New params.
2033 (Target_powerpc::make_plt_section): Create reloc section here instead.
2034 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2035 functions.
2036 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2037 (Output_data_glink::add_entry, find_entry): New functions to
2038 deal with local syms.
2039 (Glink_sym_ent): Add support for local syms.
2040 (Output_data_glink::do_write): Handle ifunc plt entries.
2041 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2042 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2043 (Target_powerpc::Relocate::relocate): Likewise.
2044 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2045
2046 2012-09-25 Alan Modra <amodra@gmail.com>
2047
2048 * object.h (Sized_relobj_file::adjust_local_symbol,
2049 do_adjust_local_symbol): New functions.
2050 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2051 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2052 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2053 and irregular opd entry spacing.
2054 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2055 (Global_symbol_visitor_opd): New functor.
2056 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2057 on deleted opd entries.
2058
2059 2012-09-15 Jiong Wang <jiwang@tilera.com>
2060
2061 * tilegx.cc: New file.
2062 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2063 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2064 * configure.tgt: Add entries for tilegx*.
2065 * configure.ac: Likewise.
2066 * Makefile.in: Rebuild.
2067 * configure: Likewise.
2068 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2069 tilegx.
2070
2071 2012-09-13 Alan Modra <amodra@gmail.com>
2072
2073 * target-reloc.h (scan_relocs): Call scan.local for relocs
2074 against symbols in discarded sections. Pass is_discarded
2075 param.
2076 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2077 Add is_discarded param.
2078 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2079 is_discarded to flag opd entry as discarded. Don't emit dyn
2080 relocs on such entries.
2081 (Target_powerpc::Scan::global): Similarly detect and handle
2082 such opd entries.
2083 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2084 opd_ent_. Update all uses.
2085 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2086 (Target_powerpc::relocate_section): Zero out discarded opd
2087 entry relocs.
2088
2089 2012-09-12 Ian Lance Taylor <iant@google.com>
2090
2091 PR gold/14570
2092 * output.cc: Rename Output_data_got template parameter from size
2093 to got_size for all functions. Compile all variants of
2094 Output_data_got.
2095 (Output_data_got::Got_entry::write): Correct use of size for
2096 symbol value. Use local_is_tls rather than casting to
2097 Sized_relobj_file.
2098 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2099 (class Sized_relobj_file): Add do_local_is_tls.
2100 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2101
2102 2012-09-11 Alan Modra <amodra@gmail.com>
2103
2104 PR gold/14566
2105 * layout.cc (Layout::set_segment_offsets): When using
2106 common-page-size alignment, ensure we are on a new max-page-size
2107 page.
2108 * output.cc (Output_segment::set_section_addresses): Use
2109 abi_pagesize, not common_pagesize for relro boundary.
2110 (Output_segment::set_offset): Likewise.
2111
2112 2012-09-11 Alan Modra <amodra@gmail.com>
2113
2114 * output.h (Output_data_got::add_global_tls, add_local_tls,
2115 add_local_tls_pair): New functions.
2116 (Output_data_got::add_local_pair_with_rel): Remove second
2117 reloc param. Expand comment.
2118 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2119 use_plt_or_tls_offset_, similarly for constructor param.
2120 (Output_data_got::Got_entry::write): Add got_index param.
2121 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2122 add_local_tls_pair): New functions.
2123 (Output_data_got::Got_entry::write): Handle tls symbols
2124 with use_plt_or_tls_offset_ set specially.
2125 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2126 (Output_data_got::do_write): Replace iterator with index, pass
2127 index to entry write function.
2128 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2129 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2130 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2131 call.
2132 * i386.cc (Target_i386::Scan::local): Likewise.
2133 * sparc.cc (Target_sparc::Scan::local): Likewise.
2134 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2135 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2136 do_tls_offset_for_global): New functions.
2137 (Target_powerpc::Scan::local): Correct TLS relocations and got
2138 entry values.
2139 (Target_powerpc::Scan::global): Don't emit unnecessary
2140 dynamic relocations on TLS GOT entries.
2141
2142 2012-09-10 Matthias Klose <doko@ubuntu.com>
2143
2144 * config.in: Disable sanity check for kfreebsd.
2145
2146 2012-09-10 Sterling Augustine <saugustine@google.com>
2147
2148 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2149 (Gdb_index::pubtypes_read): New parameter.
2150 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2151 to calls.
2152 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2153 pubtypes_object_.
2154
2155 2012-09-09 Alan Modra <amodra@gmail.com>
2156
2157 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2158 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2159 * gc.h (gc_process_relocs): Call target gc_add_reference.
2160 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2161 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2162 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2163 unnecessary cast.
2164 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2165 to cater for when we don't need code offset. Update use.
2166 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2167 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2168 set_opd_valid): New functions.
2169 (Target_powerpc::do_gc_add_reference): New function.
2170 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2171 stashed refs.
2172 (Target_powerpc::do_gc_mark_symbol): New function.
2173
2174 2012-09-06 Cary Coutant <ccoutant@google.com>
2175
2176 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2177 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2178 (Dwarf_die::skip_attributes): Likewise.
2179 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2180 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2181 (main): Call it.
2182 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2183
2184 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2185
2186 * testsuite/script_test_3.t: Add .got.plt output section
2187 statement.
2188 * testsuite/script_test_4.t: Likewise.
2189
2190 2012-09-05 Alan Modra <amodra@gmail.com>
2191
2192 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2193 update all uses and lose "enum" when using type.
2194
2195 2012-09-05 Alan Modra <amodra@gmail.com>
2196
2197 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2198 * configure: Regenerate.
2199 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2200 (plugin_final_layout.stdout): Likewise.
2201 (memory_test): Set page sizes to 0x1000.
2202 * testsuite/Makefile.in: Regenerate.
2203 * testsuite/discard_locals_test.sh: Add FIXME comment.
2204 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2205 * testsuite/pr14265.t: Add .got output section statement.
2206 * testsuite/script_test_2.t: Likewise.
2207 * testsuite/script_test_3.t: Likewise.
2208 * testsuite/script_test_4.t: Likewise.
2209 * testsuite/script_test_5.t: Likewise.
2210 * testsuite/script_test_6.t: Likewise.
2211 * testsuite/script_test_7.t: Likewise.
2212 * testsuite/script_test_9.t: Likewise.
2213
2214 2012-09-05 Alan Modra <amodra@gmail.com>
2215
2216 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2217 (Powerpc_relocate_functions::Status): New typedef.
2218 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2219 (Target_powerpc::Scan::local): Handle REL64.
2220 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2221 for REL32 and REL64.
2222 (Target_powerpc::symval_for_branch): New function, extracted from..
2223 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2224 checks. Report overflow errors.
2225
2226 2012-09-05 Alan Modra <amodra@gmail.com>
2227
2228 * object.h (Sized_relobj_file::emit_relocs): Delete.
2229 (Sized_relobj_file::emit_relocs_reltype): Delete.
2230 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2231 relocate_relocs for --emit-relocs.
2232 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2233 * output.h: Update comment.
2234 (Output_segment::first_section): New function.
2235 (Output_segment::first_section_load_address): Use first_section.
2236 * output.cc (Output_segment::first_section): New function extracted..
2237 (Output_segment::first_section_load_address): ..from here. Delete.
2238 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2239 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2240 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2241 adjust call to target.h function.
2242 * i386.cc (Target_i386): Likewise.
2243 * sparc.cc (Target_sparc): Likewise.
2244 * x86_64.cc (Target_x86_64): Likewise.
2245 * powerpc.cc (Target_powerpc): Likewise.
2246 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2247 first tls section has section symbol for optimised local dynamic
2248 output relocs.
2249 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2250 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2251 optimised tls code.
2252 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2253 Rename to relocate_relocs. Update error message.
2254
2255 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2256
2257 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2258 --just-symbols.
2259
2260 2012-08-31 Alan Modra <amodra@gmail.com>
2261
2262 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2263 (Powerpc_relobj::toc_base_offset): New stub function.
2264 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2265 got_mod_index_offset to tlsld_got_offset. Update all refs.
2266 (Target_powerpc::Relocate::enum skip_tls): New.
2267 (Target_powerpc::call_tls_get_addr_): New var.
2268 (Target_powerpc::is_branch_reloc): Move to file scope.
2269 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2270 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2271 New functions.
2272 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2273 (powerpc_info): Correct common_pagesize for ppc64.
2274 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2275 (Powerpc_relocate_functions): Add overflow check enums and functions.
2276 Add non-shift version of rela, rela_ua. Delete all rel public
2277 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2278 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2279 addr16_ha3, addr14 functions.
2280 (Output_data_got_powerpc::add_constant_pair): New function.
2281 (Output_data_got_powerpc::got_base_offset): Likewise.
2282 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2283 (instruction constants): Sort, add some more.
2284 (Output_data_glink::do_write): Add and use Address typedef. Use
2285 object->toc_base_offset() stub for 64-bit.
2286 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2287 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2288 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2289 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2290 Always treat .opd relocs as against locally defined symbol.
2291 Correct condition for RELATIVE relocs.
2292 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2293 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2294 for 32-bit syms with a plt entry. Correct ppc64 toc base
2295 calculations. Handle TLS relocs, and more. Add overflow
2296 checking and adjust for Powerpc_relocate_functions changes.
2297 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2298 Reinstate --emit-relocs code with FIXME.
2299
2300 2012-08-30 Alan Modra <amodra@gmail.com>
2301
2302 * layout.cc (Layout::set_segment_offsets): Set p_align to
2303 abi_pagesize, not common_pagesize.
2304 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2305 to determine whether file header can go in segment.
2306
2307 2012-08-30 Alan Modra <amodra@gmail.com>
2308
2309 * output.h (Output_reloc::Output_reloc <output section>): Add
2310 is_relative param. Adjust calls.
2311 (Output_reloc::add_output_section_relative): New functions.
2312 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2313 is_relative.
2314 (Output_reloc::symbol_value): Handle SECTION_CODE.
2315
2316 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2317
2318 * gold.cc (queue_middle_tasks): Call layout again when unique
2319 segments for sections is desired.
2320 * layout.cc (Layout::Layout): Initialize new members.
2321 (Layout::get_output_section_flags): New function.
2322 (Layout::choose_output_section): Call get_output_section_flags.
2323 (Layout::layout): Make output section for mapping to a unique segment.
2324 (Layout::insert_section_segment_map): New function.
2325 (Layout::attach_allocated_section_to_segment): Make unique segment for
2326 output sections marked so.
2327 (Layout::segment_precedes): Check for unique segments when sorting.
2328 * layout.h (Layout::Unique_segment_info): New struct.
2329 (Layout::Section_segment_map): New typedef.
2330 (Layout::insert_section_segment_map): New function.
2331 (Layout::get_output_section_flags): New function.
2332 (Layout::is_unique_segment_for_sections_specified): New function.
2333 (Layout::set_unique_segment_for_sections_specified): New function.
2334 (Layout::unique_segment_for_sections_specified_): New member.
2335 (Layout::section_segment_map_): New member.
2336 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2337 Rename is_gc_pass_one to is_pass_one.
2338 Rename is_gc_pass_two to is_pass_two.
2339 Rename is_gc_or_icf to is_two_pass.
2340 Check for which pass based on whether symbols data is present.
2341 Make it two pass when unique segments for sections is desired.
2342 * output.cc (Output_section::Output_section): Initialize new
2343 members.
2344 * output.h (Output_section::is_unique_segment): New function.
2345 (Output_section::set_is_unique_segment): New function.
2346 (Output_section::is_unique_segment_): New member.
2347 (Output_section::extra_segment_flags): New function.
2348 (Output_section::set_extra_segment_flags): New function.
2349 (Output_section::extra_segment_flags_): New member.
2350 (Output_section::segment_alignment): New function.
2351 (Output_section::set_segment_alignment): New function.
2352 (Output_section::segment_alignment_): New member.
2353 (Output_segment::Output_segment): Initialize is_unique_segment_.
2354 (Output_segment::is_unique_segment): New function.
2355 (Output_segment::set_is_unique_segment): New function.
2356 (Output_segment::is_unique_segment_): New member.
2357 * plugin.cc (allow_unique_segment_for_sections): New function.
2358 (unique_segment_for_sections): New function.
2359 (Plugin::load): Add new functions to transfer vector.
2360 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2361 * Makefile.in: Regenerate.
2362 * testsuite/plugin_final_layout.sh: Check if unique segment
2363 functionality works.
2364 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2365 are available.
2366 (allow_unique_segment_for_sections): New global.
2367 (unique_segment_for_sections): New global.
2368 (claim_file_hook): Call allow_unique_segment_for_sections.
2369 (all_symbols_read_hook): Call unique_segment_for_sections.
2370
2371 2012-08-22 Cary Coutant <ccoutant@google.com>
2372
2373 * layout.cc (Layout::include_section): Don't assert on GROUP
2374 sections with --emit-relocs.
2375
2376 2012-08-21 Cary Coutant <ccoutant@google.com>
2377
2378 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2379 if --export-dynamic-symbol names an undef symbol.
2380
2381 2012-08-18 Alan Modra <amodra@gmail.com>
2382
2383 * powerpc.cc: Formatting and white space.
2384 (Powerpc_relobj): Rename got2_section_ to special_.
2385 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2386 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2387 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2388 (Target_powerpc): Add Address typedef and invalid_address. Use
2389 throughout.
2390 (Target_powerpc::is_branch_reloc): New function.
2391 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2392 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2393 for dst_mask, value and addend.
2394 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2395 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2396 (Output_data_glink::do_write): Correct toc base. Don't try to use
2397 uint16_t for 24-bit offset. Use get_output_section_offset and
2398 check return.
2399 (Target_powerpc::Scan::local): Handle more relocs.
2400 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2401 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2402 Plug in toc restoring insn after plt calls. Translate branches
2403 to function descriptor symbols to corresponding entry point.
2404 (Target_powerpc::relocate_for_relocatable): Check return from
2405 get_output_section_offset.
2406 * symtab.h: Comment typo.
2407
2408 2012-08-14 Ian Lance Taylor <iant@google.com>
2409
2410 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2411 unsupported_relocal_local to call unsupported_reloc_global.
2412
2413 2012-08-14 Nick Clifton <nickc@redhat.com>
2414
2415 PR ld/14265
2416 * script-sections.cc (Sections_element::output_section_name): Add
2417 keep return parameter.
2418 (Output_section_element::match_name): Add keep return parameter.
2419 Return the value of the keep_ member.
2420 * script-sections.h (class Output_section): Update
2421 output_section_name prototype.
2422 * layout.cc (Layout::keep_input_section): New public member
2423 function.
2424 (Layout::choose_output_section): Pass keep parameter to
2425 output_section_name.
2426 * layout.h (class Layout): Add keep_input_section.
2427 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2428 sections.
2429 * testsuite/Makefile.am: Add a test.
2430 * testsuite/Makefile.in: Regenerate.
2431 * testsuite/pr14265.c: Source file for the test.
2432 * testsuite/pr14265.t: Linker script for the test.
2433 * testsuite/pr14265.sh: Shell script for the test.
2434
2435 2012-08-14 Alan Modra <amodra@gmail.com>
2436
2437 * target.h (Target::output_section_name): New function.
2438 (Target::do_output_section_name): New function.
2439 * layout.cc (Layout::choose_output_section): Call the above.
2440 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2441
2442 2012-08-14 Alan Modra <amodra@gmail.com>
2443
2444 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2445 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2446 for replace_constant call.
2447 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2448 (Output_data_glink::do_print_to_mapfile): New function.
2449 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2450 (Target_powerpc::Relocate::relocate): Likewise.
2451
2452 2012-08-14 Alan Modra <amodra@gmail.com>
2453
2454 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2455 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2456 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2457 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2458 all references to shndx_. Handle special case for R_PPC_PLTREL24
2459 here.
2460 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2461 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2462 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2463 here.
2464 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2465 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2466
2467 2012-08-12 Alan Modra <amodra@gmail.com>
2468
2469 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2470 (glink insn constants): Use uint32_t.
2471 (Output_data_glink::add_entry): Use insert, not [] operator.
2472
2473 2012-08-11 Alan Modra <amodra@gmail.com>
2474
2475 * object.h (Sized_relobj_file::find_shdr): New function.
2476 (Sized_relobj_file::find_special_sections): New function.
2477 * object.cc (Sized_relobj_file::find_shdr): New function.
2478 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2479 (Sized_relobj_file::find_special_sections): New function, split out..
2480 (Sized_relobj_file::do_read_symbols): ..from here.
2481 * output.h (Output_data_got::replace_constant): New function.
2482 (Output_data_got::num_entries): New function.
2483 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2484 (Output_data_got::got_offset): Protected rather than private.
2485 (Output_data_got::replace_got_entry): New function.
2486 * output.cc (Output_data_got::replace_got_entry): New function.
2487 * powerpc.cc (class Powerpc_relobj): New.
2488 (class Powerpc_relocate_functions): Delete all psymval variants or
2489 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2490 Implement _ha functions using corresponding _hi function.
2491 (Powerpc_relobj::find_special_sections): New function.
2492 (Target_powerpc::do_make_elf_object): New function.
2493 (class Output_data_got_powerpc): New.
2494 (class Output_data_glink): New.
2495 (class Powerpc_scan_relocatable_reloc): New.
2496 Many more changes througout file.
2497
2498 2012-08-09 Nick Clifton <nickc@redhat.com>
2499
2500 * po/vi.po: Updated Vietnamese translation.
2501
2502 2012-08-07 Ian Lance Taylor <iant@google.com>
2503
2504 * layout.cc (Layout::add_target_dynamic_tags): If
2505 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2506 plt_rel.
2507
2508 2012-07-30 Nick Clifton <nickc@redhat.com>
2509
2510 * po/gold.pot: Updated template.
2511 * po/es.po: Updated Spanish translation.
2512
2513 2012-07-18 Cary Coutant <ccoutant@google.com>
2514
2515 PR gold/14344
2516 * configure.ac: Add check for -gpubnames support.
2517 * configure: Regenerate.
2518 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2519 support; force -gno-pubnames.
2520 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2521 support.
2522 (gdb_index_test_4): New test.
2523 * testsuite/Makefile.in: Regenerate.
2524 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2525 * testsuite/gdb_index_test_2.sh: Likewise.
2526 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2527 * testsuite/gdb_index_test_4.sh: New script.
2528 * testsuite/gdb_index_test_comm.sh: New script with common code;
2529 don't look for space after colon.
2530
2531 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2532
2533 * gold.cc (queue_middle_tasks): Update function order only after
2534 deferred objects due to plugins are processed.
2535
2536 2012-07-11 Ian Lance Taylor <iant@google.com>
2537
2538 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2539 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2540 (Target_arm::scan_reloc_for_stub): Likewise.
2541 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2542 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2543 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2544 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2545 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2546
2547 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2548 Ian Lance Taylor <iant@google.com>
2549
2550 PR gold/14309
2551 * configure.ac: Test whether std::tr1::hash<off_t> works.
2552 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2553 needed.
2554 * output.h (class Output_fill): Add virtual destructor.
2555 * configure, config.in: Rebuild.
2556
2557 2012-06-22 Roland McGrath <mcgrathr@google.com>
2558
2559 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2560
2561 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2562
2563 * plugin.cc (Plugin::load): Handle position independent executables.
2564
2565 2012-06-06 Cary Coutant <ccoutant@google.com>
2566
2567 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2568 add .debug_macro.
2569 (lines_only_debug_sections): Likewise.
2570 (gdb_fast_lookup_sections): New static array.
2571 (is_gdb_debug_section): Rename formal parameter.
2572 (is_lines_only_debug_section): Likewise.
2573 (is_gdb_fast_lookup_section): New function.
2574 (Layout::include_section): Check for ".zdebug_" prefix; pass
2575 section name suffix to is_gdb_debug_section, et al.; check for
2576 fast-lookup sections when building .gdb_index.
2577 * options.h (--strip-debug-gdb): Update GDB version number.
2578
2579 2012-06-06 Cary Coutant <ccoutant@google.com>
2580
2581 * configure.ac: Add check for fallocate.
2582 * configure: Regenerate.
2583 * config.in: Regenerate.
2584
2585 * options.h (class General_options): Add --mmap-output-file and
2586 --posix-fallocate options.
2587 * output.cc: (posix_fallocate): Remove; replace with...
2588 (gold_fallocate): New function.
2589 (Output_file::map_no_anonymous): Call gold_fallocate.
2590 (Output_file::map): Check --mmap-output-file option.
2591
2592 2012-06-05 Jing Yu <jingyu@google.com>
2593
2594 * gold.h (textdomain): Add do {} to empty while(0).
2595 (bindtextdomain): Likewise.
2596
2597 2012-06-04 Cary Coutant <ccoutant@google.com>
2598
2599 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2600 has_dynsym_index.
2601
2602 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2603
2604 * symtab.cc (Symbol_table::define_special_symbol):
2605 Initialize *poldsym to prevent uninitialized variable errors.
2606
2607 2012-05-23 Cary Coutant <ccoutant@google.com>
2608
2609 * layout.cc (Layout::section_name_mapping): Add rules to handle
2610 exact match on .data.rel.ro.local or .data.rel.ro.
2611 (Layout::output_section_name): Check for exact matches.
2612
2613 2012-05-23 Cary Coutant <ccoutant@google.com>
2614
2615 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2616 more carefully.
2617
2618 2012-05-22 Cary Coutant <ccoutant@google.com>
2619
2620 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2621 object before exporting symbol.
2622
2623 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2624
2625 * testsuite/tls_test.cc: Include "config.h" first.
2626 * testsuite/tls_test_c.c: Likewise.
2627
2628 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2629 Nick Clifton <nickc@redhat.com>
2630
2631 PR 14072
2632 * configure.in: Add check that sysdep.h has been included before
2633 any system header files.
2634 * configure: Regenerate.
2635 * config.in: Regenerate.
2636
2637 2012-05-14 Cary Coutant <ccoutant@google.com>
2638
2639 * layout.cc (Layout::make_output_section): Mark .tdata section
2640 as RELRO.
2641 * testsuite/relro_test.cc: Add a TLS variable.
2642
2643 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2644
2645 PR gold/14091
2646 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2647 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2648 R_X86_64_64.
2649
2650 2012-05-08 Cary Coutant <ccoutant@google.com>
2651
2652 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2653 (lines_only_debug_sections): Likewise.
2654
2655 2012-05-02 Roland McGrath <mcgrathr@google.com>
2656
2657 * nacl.cc: New file.
2658 * nacl.h: New file.
2659 * Makefile.am (CCFILES, HFILES): Add them.
2660 * Makefile.in: Regenerate.
2661 * i386.cc (Output_data_plt_i386_nacl): New class.
2662 (Output_data_plt_i386_nacl_exec): New class.
2663 (Output_data_plt_i386_nacl_dyn): New class.
2664 (Target_i386_nacl): New class.
2665 (Target_selector_i386_nacl): New class.
2666 (target_selector_i386): Use it instead of Target_selector_i386.
2667 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2668 (Target_x86_64_nacl): New class.
2669 (Target_selector_x86_64_nacl): New class.
2670 (target_selector_x86_64, target_selector_x32): Use it instead of
2671 Target_selector_x86_64.
2672 * arm.cc (Output_data_plt_arm_nacl): New class.
2673 (Target_arm_nacl): New class.
2674 (Target_selector_arm_nacl): New class.
2675 (target_selector_arm, target_selector_armbe): Use it instead of
2676 Target_selector_arm.
2677
2678 * target-select.cc (select_target): Take new Input_file* and off_t
2679 arguments, pass them on to recognize method of selector.
2680 * object.cc (make_elf_sized_object): Update caller.
2681 * parameters.cc (parameters_force_valid_target): Likewise.
2682 * incremental.cc (make_sized_incremental_binary): Likewise.
2683 * target-select.h: Update decl.
2684 (Target_selector::recognize): Take new Input_file* argument,
2685 pass it on to do_recognize.
2686 (Target_selector::do_recognize): Take new Input_file* argument.
2687 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2688 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2689 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2690 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2691
2692 * target.h (Target::Target_info): New members isolate_execinstr
2693 and rosegment_gap.
2694 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2695 * arm.cc (Target_arm::arm_info): Update initializer.
2696 * i386.cc (Target_i386::i386_info): Likewise.
2697 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2698 * sparc.cc (Target_sparc::sparc_info): Likewise.
2699 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2700 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2701 * layout.cc (Layout::attach_allocated_section_to_segment):
2702 Take new const Target* argument. If target->isolate_execinstr(), act
2703 like --rosegment.
2704 (Layout::find_first_load_seg): Take new const Target* argument;
2705 if target->isolate_execinstr(), reject PF_X segments.
2706 (Layout::relaxation_loop_body): Update caller.
2707 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2708 reset file offset to zero when we hit LOAD_SEG, and then do a second
2709 loop over the segments before LOAD_SEG to reassign offsets after
2710 addresses have been determined. Handle target->rosegment_gap().
2711 (Layout::attach_section_to_segment): Take new const Target* argument;
2712 pass it to attach_allocated_section_to_segment.
2713 (Layout::make_output_section): Update caller.
2714 (Layout::attach_sections_to_segments): Take new const Target* argument;
2715 pass it to attach_section_to_segment.
2716 * gold.cc (queue_middle_tasks): Update caller.
2717 * layout.h (Layout): Update method decls with new arguments.
2718
2719 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2720 Target_info pointer to use.
2721 (Target_arm::do_make_data_plt): New virtual method.
2722 (Target_arm::make_data_plt): New method that calls it.
2723 (Target_arm::make_plt_entry): Use it.
2724 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2725 for the section alignment.
2726 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2727 method.
2728 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2729 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2730 method.
2731 (Output_data_plt_arm::get_plt_entry_size): Call it.
2732 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2733 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2734 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2735 method.
2736 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2737 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2738 method instead of sizeof(plt_entry).
2739 (Output_data_plt_arm::add_entry): Likewise.
2740 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2741 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2742 than static method.
2743 (Target_arm::plt_entry_size): Likewise.
2744 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2745 Move to ...
2746 (Output_data_plt_arm_standard): ... here, new class.
2747 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2748 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2749 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2750
2751 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2752 Take additional argument for the PLT entry size.
2753 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2754 Use get_plt_entry_size method rather than plt_entry_size variable.
2755 (Output_data_plt_x86_64::reserve_slot): Likewise.
2756 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2757 (Output_data_plt_x86_64::add_entry): Likewise.
2758 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2759 (Output_data_plt_x86_64::address_for_global): Likewise.
2760 (Output_data_plt_x86_64::address_for_local): Likewise.
2761 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2762 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2763 Make method non-static.
2764 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2765 method.
2766 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2767 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2768 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2769 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2770 virtual method.
2771 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2772 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2773 virtual method.
2774 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2775 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2776 virtual method.
2777 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2778 (Output_data_plt_x86_64::plt_entry_size)
2779 (Output_data_plt_x86_64::first_plt_entry)
2780 (Output_data_plt_x86_64::plt_entry)
2781 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2782 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2783 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2784 (Output_data_plt_x86_64_standard): ... here, new class.
2785 (Target_x86_64::Target_x86_64): Take optional argument for the
2786 Target_info pointer to use.
2787 (Target_x86_64::do_make_data_plt): New virtual method.
2788 (Target_x86_64::make_data_plt): New method to call it.
2789 (Target_x86_64::init_got_plt_for_update): Use that.
2790 Call this->plt_->add_eh_frame method here.
2791 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2792 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2793 rather than static method.
2794 (Target_x86_64::plt_entry_size): Likewise.
2795 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2796 rather than plt_entry_size variable. Move guts of PLT filling to...
2797 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2798 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2799 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2800
2801 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2802 additional argument for the section alignment.
2803 Don't do add_eh_frame_for_plt here.
2804 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2805 non-static. Use get_plt_entry_size method rather than plt_entry_size
2806 variable.
2807 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2808 method.
2809 (Output_data_plt_i386::get_plt_entry_size): Call it.
2810 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2811 (Output_data_plt_i386::add_eh_frame): New method to call it.
2812 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2813 method.
2814 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2815 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2816 method.
2817 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2818 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2819 method instead of plt_entry_size.
2820 (Output_data_plt_i386::plt_entry_size)
2821 (Output_data_plt_i386::plt_eh_frame_fde_size)
2822 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2823 (Output_data_plt_i386_standard): ... here, new class.
2824 (Output_data_plt_i386_exec): New class.
2825 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2826 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2827 (Output_data_plt_i386::exec_plt_entry): Move to ...
2828 (Output_data_plt_i386_exec::plt_entry): ... here.
2829 (Output_data_plt_i386_dyn): New class.
2830 (Output_data_plt_i386::first_plt_entry): Move to ...
2831 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2832 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2833 (Output_data_plt_i386_dyn::plt_entry): ... here.
2834 (Target_i386::Target_i386): Take optional argument for the Target_info
2835 pointer to use.
2836 (Target_i386::do_make_data_plt): New virtual method.
2837 (Target_i386::make_data_plt): New method to call it.
2838 (Target_i386::make_plt_section): Use that.
2839 Call this->plt_->add_eh_frame method here.
2840 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2841 rather than plt_entry_size variable.
2842 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2843 (Output_data_plt_i386::address_for_local): Likewise.
2844 (Output_data_plt_i386::do_write): Likewise.
2845 Move guts of PLT filling to...
2846 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2847 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2848 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2849 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2850
2851 2012-05-01 Cary Coutant <ccoutant@google.com>
2852
2853 * dwarf_reader.cc (Dwarf_die::read_attributes)
2854 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2855 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2856 * reduced_debug_output.cc
2857 (Output_reduced_debug_info_section::get_die_end): Remove
2858 DW_FORM_GNU_ref_index. Add default case.
2859
2860 2012-04-26 Mark Wielaard <mjw@redhat.com>
2861
2862 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2863 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2864 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2865 DW_AT_high_pc as offset from DW_AT_low_pc.
2866
2867 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2868 * testsuite/Makefile.in: Regenerate.
2869 * testsuite/gdb_index_test_3.c: New test source file.
2870 * testsuite/gdb_index_test_3.sh: New test source file.
2871
2872 2012-04-25 Ian Lance Taylor <iant@google.com>
2873
2874 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2875 pointer.
2876 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2877 as a class, not a struct.
2878 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2879 (Target_arm::apply_cortex_a8_workaround): Likewise.
2880 * gc.h: Declare Reloc_types as a struct, not a class.
2881 * object.h: Declare Symbols_data as a struct.
2882 * reloc.h: Declare Read_relocs_data as a struct.
2883 * target.h: Declare Relocate_info as a struct.
2884
2885 2012-04-24 David S. Miller <davem@davemloft.net>
2886
2887 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2888 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2889 and R_SPARC_WPLT30.
2890
2891 2012-04-24 Cary Coutant <ccoutant@google.com>
2892
2893 * incremental-dump.cc (find_input_containing_global): Replace
2894 magic number with symbolic constant.
2895 (dump_incremental_inputs): Update version number.
2896 * incremental.cc (Output_section_incremental_inputs): Update version
2897 number; import symbolic constants from Incremental_inputs_reader.
2898 (Incremental_inputs::create_data_sections): Align relocations
2899 section correctly for 64-bit targets.
2900 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2901 constants; add padding.
2902 (Output_section_incremental_inputs::write_header): Add assert for
2903 header_size.
2904 (Output_section_incremental_inputs::write_input_files): Add assert
2905 for input_entry_size.
2906 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2907 add assert for object_info_size, input_section_entry_size,
2908 global_sym_entry_size.
2909 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2910 for data structure sizes; use them.
2911 (Incremental_input_entry_reader): Import symbolic constants from
2912 Incremental_inputs_reader; use them.
2913
2914 2012-04-23 David S. Miller <davem@davemloft.net>
2915
2916 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2917 and elf_flags_set_.
2918 (Target_sparc::Target_sparc): Initialize new fields.
2919 (Target_sparc::do_make_elf_object): New function.
2920 (Target_sparc::do_adjust_elf_header): New function.
2921
2922 2012-04-23 Cary Coutant <ccoutant@google.com>
2923
2924 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2925 CU range table of gdb index.
2926
2927 2012-04-20 David S. Miller <davem@davemloft.net>
2928
2929 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2930 instead of false.
2931
2932 2012-04-16 David S. Miller <davem@davemloft.net>
2933
2934 * sparc.cc (Target_sparc::got_address): New function.
2935 (Sparc_relocate_functions::gdop_hix22): New function.
2936 (Sparc_relocate_functions::gdop_lox10): New function.
2937 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2938 relocs.
2939 (Target_sparc::Scan::local): Likewise if the global symbol is not
2940 preemptible and is not IFUNC.
2941 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2942 transformations for local and non-preemptible non-IFUNC global
2943 symbols.
2944
2945 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2946 writing out 64-bit part of ranges.
2947
2948 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2949 -fpic and -fpie respectively.
2950 * Makefile.in: Regenerate.
2951
2952 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2953 (Target_sparc::Target_sparc): Initialize new field.
2954 (Target_sparc::do_plt_section_for_global): New function.
2955 (Target_sparc::do_plt_section_for_local): New function.
2956 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2957 (Target_sparc::make_plt_section): New function, broken out of
2958 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2959 (Target_sparc::make_plt_entry): Call make_plt_section.
2960 (Target_sparc::make_local_ifunc_plt_entry): New function.
2961 (Target_sparc::rela_ifunc_section): New function.
2962 (Target_sparc::plt_section): Remove const.
2963 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2964 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2965 and ifunc_count_ fields.
2966 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2967 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2968 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2969 (Output_data_plt_sparc::rela_ifunc): New function.
2970 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2971 (Output_data_plt_sparc::has_ifunc_section): New function.
2972 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2973 (Output_data_plt_sparc::address_for_global): New function.
2974 (Output_data_plt_sparc::address_for_local): New function.
2975 (Output_data_plt_sparc::plt_index_to_offset): New function.
2976 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2977 and entry_count.
2978 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2979 entry_count.
2980 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2981 R_SPARC_JMP_IREL to switch.
2982 (Target_sparc::Scan::check_non_pic): Likewise.
2983 (Target_sparc::Scan::local): Handle IFUNC symbols.
2984 (Target_sparc::Scan::local): Likewise.
2985 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2986 and plt_address_for_local.
2987 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2988 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2989
2990 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2991 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2992 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2993 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2994 global relocs too.
2995 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2996 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2997 calls.
2998 * sparc.cc (Target_sparc::Scan::global): Likewise.
2999 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3000
3001 2012-04-16 Cary Coutant <ccoutant@google.com>
3002
3003 * archive.cc (Library_base::should_include_member): Check for
3004 --export-dynamic-symbol.
3005 * options.h (class General_options): Add --export-dynamic-symbol.
3006 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3007 --export-dynamic-symbol.
3008 (Symbol_table::gc_mark_undef_symbols): Likewise.
3009 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3010
3011 2012-04-12 David S. Miller <davem@davemloft.net>
3012
3013 * sparc.cc (Reloc::wdisp10): New relocation method.
3014 (Reloc::h34): Likewise.
3015 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3016 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3017 R_SPARC_WDISP10.
3018 (Target_sparc::Scan::local): Likewise.
3019 (Target_sparc::Scan::global): Likewise.
3020 (Target_sparc::Relocate::relocate): Likewise.
3021
3022 2012-04-09 Cary Coutant <ccoutant@google.com>
3023
3024 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3025 low_pc == 0.
3026
3027 2012-04-06 Ian Lance Taylor <iant@google.com>
3028
3029 * timer.cc: #include <unistd.h>.
3030
3031 2012-04-06 Roland McGrath <mcgrathr@google.com>
3032
3033 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3034 * config.in: Regenerate.
3035 * configure: Regenerate.
3036
3037 2012-04-05 Nick Clifton <nickc@redhat.com>
3038
3039 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3040 (AM_LC_MESSAGES): Add.
3041 * aclocal.m4: Regenerate.
3042 * config.in: Regenerate.
3043 * configure: Regenerate.
3044
3045 2012-03-21 Cary Coutant <ccoutant@google.com>
3046
3047 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3048 * Makefile.in: Regenerate.
3049 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3050 (Sized_elf_reloc_mapper::symbol_section): New function.
3051 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3052 (make_elf_reloc_mapper): New function.
3053 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3054 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3055 (Dwarf_abbrev_table::do_get_abbrev): New function.
3056 (Dwarf_ranges_table::read_ranges_table): New function.
3057 (Dwarf_ranges_table::read_range_list): New function.
3058 (Dwarf_pubnames_table::read_section): New function.
3059 (Dwarf_pubnames_table::read_header): New function.
3060 (Dwarf_pubnames_table::next_name): New function.
3061 (Dwarf_die::Dwarf_die): New function.
3062 (Dwarf_die::read_attributes): New function.
3063 (Dwarf_die::skip_attributes): New function.
3064 (Dwarf_die::set_name): New function.
3065 (Dwarf_die::set_linkage_name): New function.
3066 (Dwarf_die::attribute): New function.
3067 (Dwarf_die::string_attribute): New function.
3068 (Dwarf_die::int_attribute): New function.
3069 (Dwarf_die::uint_attribute): New function.
3070 (Dwarf_die::ref_attribute): New function.
3071 (Dwarf_die::child_offset): New function.
3072 (Dwarf_die::sibling_offset): New function.
3073 (Dwarf_info_reader::check_buffer): New function.
3074 (Dwarf_info_reader::parse): New function.
3075 (Dwarf_info_reader::do_parse): New function.
3076 (Dwarf_info_reader::do_read_string_table): New function.
3077 (Dwarf_info_reader::lookup_reloc): New function.
3078 (Dwarf_info_reader::get_string): New function.
3079 (Dwarf_info_reader::visit_compilation_unit): New function.
3080 (Dwarf_info_reader::visit_type_unit): New function.
3081 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3082 Sized_elf_reloc_mapper.
3083 (Sized_dwarf_line_info::symbol_section): Remove function.
3084 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3085 (Sized_dwarf_line_info::read_line_mappings): Remove object
3086 parameter, adjust callers.
3087 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3088 * dwarf_reader.h: Include <sys/types.h>.
3089 (class Track_relocs): Remove forward declaration.
3090 (class Elf_reloc_mapper): New class.
3091 (class Sized_elf_reloc_mapper): New class.
3092 (class Dwarf_abbrev_table): New class.
3093 (class Dwarf_range_list): New class.
3094 (class Dwarf_ranges_table): New class.
3095 (class Dwarf_pubnames_table): New class.
3096 (class Dwarf_die): New class.
3097 (class Dwarf_info_reader): New class.
3098 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3099 (Sized_dwarf_line_info::symbol_section): Remove member function.
3100 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3101 base class.
3102 * gdb-index.cc: New source file.
3103 * gdb-index.h: New source file.
3104 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3105 and .debug_types sections, call Layout::add_to_gdb_index.
3106 (Sized_relobj_incr::do_section_name): Implement.
3107 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3108 return type; Implement.
3109 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3110 return type.
3111 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3112 parameter list and return type.
3113 (Sized_incr_dynobj::do_section_contents): Likewise.
3114 * layout.cc: Include gdb-index.h.
3115 (Layout::Layout): Initialize gdb_index_data_.
3116 (Layout::init_fixed_output_section): Check for .gdb_index section.
3117 (Layout::add_to_gdb_index): New function. Instantiate.
3118 * layout.h: Add forward declaration for class Gdb_index.
3119 (Layout::add_to_gdb_index): New member function.
3120 (Layout::gdb_index_data_): New data member.
3121 * main.cc: Include gdb-index.h.
3122 (main): Print statistics for gdb index.
3123 * object.cc (Object::section_contents): Move code into
3124 do_section_contents.
3125 (need_decompressed_section): Check for sections needed when building
3126 gdb index.
3127 (build_compressed_section_map): Likewise.
3128 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3129 gdb index.
3130 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3131 sections; call Layout::add_to_gdb_index.
3132 (Sized_relobj_file::do_decompressed_section_contents): Call
3133 do_section_contents directly.
3134 * object.h (Object::do_section_contents): Adjust parameter list and
3135 return type.
3136 (Object::do_decompressed_section_contents): Call do_section_contents
3137 directly.
3138 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3139 return type.
3140 * options.h (class General_options): Add --gdb-index option.
3141 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3142 list and return type.
3143 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3144 * reloc.h (Track_relocs::checkpoint): New function.
3145 (Track_relocs::reset): New function.
3146
3147 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3148 New test cases.
3149 * testsuite/Makefile.in: Regenerate.
3150 * testsuite/gdb_index_test.cc: New test source file.
3151 * testsuite/gdb_index_test_1.sh: New test source file.
3152 * testsuite/gdb_index_test_2.sh: New test source file.
3153
3154 2012-03-19 Doug Kwan <dougkwan@google.com>
3155
3156 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3157 (Target_arm::do_finalize_sections): Remove code which defines
3158 __exidx_start and __exidx_end. Make symbol table parameter
3159 anonymous as it is not used.
3160 * gold.cc (queue_middle_tasks): Call target hook to define any
3161 target-specific symbols.
3162 * target.h (Target::define_standard_symbols): New method.
3163 (Target::do_define_standard_symbols): Same.
3164 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3165 * testsuite/Makefile.in: Regenerate.
3166 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3167 and __exidx_end.
3168 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3169 relocations are generated for __exidx_start and __exidx_end.
3170
3171 2012-03-16 Doug Kwan <dougkwan@google.com>
3172
3173 * testsuite/Makefile.am: Disable test initpri3b.
3174 * testsuite/Makefile.in: Regenerate.
3175
3176 2012-03-15 Doug Kwan <dougkwan@google.com>
3177
3178 * arm.cc (Target_arm::got_section): Make .got section read-only
3179 if -z now is given.
3180
3181 2012-03-15 Ian Lance Taylor <iant@google.com>
3182
3183 PR gold/13850
3184 * layout.cc (Layout::make_output_section): Correctly mark
3185 SHT_INIT_ARRAY, et. al., as relro.
3186
3187 2012-03-14 Doug Kwan <dougkwan@google.com>
3188
3189 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3190 dynamic relocations for protected symbols in shared objects.
3191
3192 2012-03-13 Ian Lance Taylor <iant@google.com>
3193
3194 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3195 keep the larger alignment.
3196
3197 2012-03-12 Cary Coutant <ccoutant@google.com>
3198
3199 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3200 handling of DW_LNE_define_file.
3201
3202 2012-03-12 Cary Coutant <ccoutant@google.com>
3203
3204 * reduced_debug_output.cc
3205 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3206 codes to switch.
3207
3208 2012-02-29 Cary Coutant <ccoutant@google.com>
3209
3210 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3211
3212 2012-02-29 Cary Coutant <ccoutant@google.com>
3213
3214 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3215 Call Object::decompressed_section_contents.
3216 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3217 New dtor.
3218 (Sized_dwarf_line_info::buffer_start_): New data member.
3219 * merge.cc (Output_merge_data::do_add_input_section): Call
3220 Object::decompressed_section_contents.
3221 (Output_merge_string::do_add_input_section): Likewise.
3222 * object.cc (need_decompressed_section): New function.
3223 (build_compressed_section_map): Decompress sections needed later.
3224 (Sized_relobj_file::do_decompressed_section_contents): New function.
3225 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3226 * object.h (Object::decompressed_section_contents): New function.
3227 (Object::discard_decompressed_sections): New function.
3228 (Object::do_decompressed_section_contents): New function.
3229 (Object::do_discard_decompressed_sections): New function.
3230 (Compressed_section_info): New type.
3231 (Compressed_section_map): Include decompressed section contents.
3232 (Sized_relobj_file::do_decompressed_section_contents): New function.
3233 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3234
3235 2012-02-16 Cary Coutant <ccoutant@google.com>
3236
3237 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3238 * testsuite/Makefile.in: Regenerate.
3239
3240 2012-02-14 Cary Coutant <ccoutant@google.com>
3241
3242 * options.cc (General_options::finalize): Disallow -pie and -static.
3243
3244 2012-02-03 Doug Kwan <dougkwan@google.com>
3245
3246 * arm.cc (Arm_relocate_functions::abs8,
3247 Arm_relocate_functions::abs16): Use
3248 Bits::has_signed_unsigned_overflow32.
3249 (Arm_relocate_functions::thm_abs8): Correct range of
3250 overflow check.
3251 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3252 in assertions.
3253
3254 2012-02-02 Doug Kwan <dougkwan@google.com>
3255
3256 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3257 position independent outputs, not just shared objects.
3258
3259 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3260
3261 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3262 * configure: Regenerated.
3263
3264 2012-01-27 Ian Lance Taylor <iant@google.com>
3265
3266 * reloc.h (Bits): New class with static functions, copied from
3267 namespace utils in arm.cc.
3268 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3269 instead.
3270
3271 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3272
3273 * incremental.cc (write_info_blocks): Correct relocation offset.
3274
3275 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3276
3277 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3278 (Relocate::tls_gd_to_le): Likewise.
3279
3280 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3281
3282 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3283
3284 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3285
3286 * configure.ac: Check if -mcmodel=medium works.
3287 * configure: Regenerated.
3288
3289 2012-01-24 Cary Coutant <ccoutant@google.com>
3290
3291 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3292 definition and ...
3293 (read_unsigned_LEB_128_x): ... this new function.
3294 (read_signed_LEB_128): Replaced with inline definition and ...
3295 (read_signed_LEB_128_x): ... this new function.
3296 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3297 (read_unsigned_LEB_128): Add inline definition.
3298 (read_signed_LEB_128_x): New function.
3299 (read_signed_LEB_128): Add inline definition.
3300 * testsuite/Makefile.am (leb128_unittest): New unit test.
3301 * testsuite/Makefile.in: Regenerate.
3302 * testsuite/leb128_unittest.cc: New unit test.
3303
3304 2012-01-23 Ian Lance Taylor <iant@google.com>
3305
3306 PR gold/13617
3307 * i386.cc (Target_i386::do_code_fill): When using a jmp
3308 instruction, pad with nop instructions.
3309 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3310
3311 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3312
3313 * x86_64.cc (gc_process_relocs): Add typename on types used in
3314 template.
3315 (scan_relocs): Likewise.
3316 (relocate_section): Likewise.
3317 (apply_relocation): Likewise.
3318
3319 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3320
3321 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3322 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3323 under x32.
3324
3325 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3326
3327 * x86_64.cc: Initial support for x32.
3328
3329 2012-01-03 Cary Coutant <ccoutant@google.com>
3330
3331 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3332 Use abstract base class for GOT.
3333 * gold/output.h (class Output_data_got_base): New abstract base class.
3334 (class Output_data_got): Derive from new base class, adjust ctors.
3335 (Output_data_got::reserve_slot): Make virtual; rename to
3336 do_reserve_slot; Adjust callers.
3337 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3338 pointer to abstract base class.
3339 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3340
3341 2011-12-18 Ian Lance Taylor <iant@google.com>
3342
3343 * object.h (Relobj::local_symbol_value): New function.
3344 (Relobj::local_plt_offset): New function.
3345 (Relobj::local_has_got_offset): New function.
3346 (Relobj::local_got_offset): New function.
3347 (Relobj::set_local_got_offset): New function.
3348 (Relobj::do_local_symbol_value): New pure virtual function.
3349 (Relobj::do_local_plt_offset): Likewise.
3350 (Relobj::do_local_has_got_offset): Likewise.
3351 (Relobj::do_local_got_offset): Likewise.
3352 (Relobj::do_set_local_got_offset): Likewise.
3353 (Sized_relobj::do_local_has_got_offset): Rename from
3354 local_has_got_offset.
3355 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3356 (Sized_relobj::do_set_local_got_offset): Rename from
3357 set_local_got_offset.
3358 (Sized_relobj_file::do_local_plt_offset): Rename from
3359 local_plt_offset.
3360 (Sized_relobj_file::do_local_symbol_value): New function.
3361 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3362 local_plt_offset.
3363 * output.cc (Output_data_got::Got_entry::write): Change object to
3364 Relobj. Use local_symbol_value.
3365 (Output_data_got::add_global_with_rel): Change rel_dyn to
3366 Output_data_reloc_generic*. Use add_global_generic.
3367 (Output_data_got::add_global_with_rela): Remove. Change all
3368 callers to use add_global_with_rel.
3369 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3370 Output_data_reloc_generic*. Use add_global_generic.
3371 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3372 callers to use add_global_pair_with_rel.
3373 (Output_data_got::add_local): Change object to Relobj*.
3374 (Output_data_got::add_local_plt): Likewise.
3375 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3376 change rel_dyn to Output_data_reloc_generic*. Use
3377 add_local_generic.
3378 (Output_data_got::add_local_with_rela): Remove. Change all
3379 callers to use all_local_with_rel.
3380 (Output_data_got::add_local_pair_with_rel): Change object to
3381 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3382 add_output_section_generic.
3383 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3384 callers to use add_local_pair_with_rel.
3385 (Output_data_got::reserve_local): Change object to Relobj*.
3386 * output.h: (class Output_data_reloc_generic): Add pure virtual
3387 declarations for add_global_generic, add_local_generic,
3388 add_output_section_generic.
3389 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3390 functions for Output_data_reloc_generic. Update declarations for
3391 changes listed in output.cc.
3392 (class Output_data_got): Change template parameter to got_size.
3393 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3394 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3395 function.
3396 (Sized_relobj_incr::do_local_plt_offset): New function.
3397 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3398 add_global_generic.
3399
3400 2011-12-17 Cary Coutant <ccoutant@google.com>
3401
3402 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3403 * resolve.cc (Symbol_table::resolve): Likewise.
3404 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3405 arrays.
3406 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3407
3408 2011-12-16 Ian Lance Taylor <iant@google.com>
3409
3410 * output.h (Output_data_reloc_generic::add): Only call
3411 add_dynamic_reloc if this is a dynamic reloc section.
3412
3413 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3414
3415 PR gold/13505
3416 * target-reloc.h (apply_relocation): Replace <64, false> with
3417 <size, big_endian>.
3418
3419 2011-11-25 Nick Clifton <nickc@redhat.com>
3420
3421 * po/it.po: New Italian translation.
3422
3423 2011-11-17 Sterling Augustine <saugustine@google.com>
3424
3425 * script.cc (script_include_directive): Implement.
3426 (read_script_file): New local variables name and search_path. Update
3427 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3428 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3429 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3430
3431 2011-11-11 Sterling Augustine <saugustine@google.com>
3432
3433 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3434 (file_or_sections_cmd): Likewise.
3435
3436 2011-11-11 Doug Kwan <dougkwan@google.com>
3437
3438 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3439 if --just-symbols is given.
3440
3441 2011-11-10 Doug Kwan <dougkwan@google.com>
3442
3443 PR gold/13362
3444 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3445 when processing data relocs.
3446 * reloc.h (Relocate_functions::rel_unaligned): New method.
3447 (Relocate_functions::pcrel_unaligned): Ditto.
3448 (Relocate_functions::rel32_unaligned): Ditto.
3449 (Relocate_functions::pcrel32_unaligned): Ditto.
3450
3451 2011-11-09 Doug Kwan <dougkwan@google.com>
3452
3453 PR gold/13362
3454 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3455 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3456 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3457 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3458 (Relocate_functions::rel_unaligned): New.
3459 (Relocate_functions::rel32_unaligned): New.
3460 * target-reloc.h (relocate_for_relocatable): Add code to handle
3461 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3462 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3463 arm_unaligned_reloc_r): New targets.
3464 * testsuite/Makefile.in: Regenerate.
3465 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3466 linking.
3467
3468 2011-11-02 Ian Lance Taylor <iant@google.com>
3469
3470 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3471 NATIVE_LINKER.
3472 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3473 * options.cc (General_options::finalize): Use library search path
3474 from configure script if specified. If not native and no sysroot,
3475 only search TOOLLIBDIR.
3476 * options.h (Search_directory::Search_directory): Change name to
3477 const std::string&.
3478 (General_options::add_to_library_path_with_sysroot): Change arg to
3479 const std::string&.
3480 * configure, Makefile.in, config.in: Rebuild.
3481
3482 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3483
3484 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3485 we are working around the ARM1176 Erratum.
3486 * options.h (General_options::fix_arm1176): Add option.
3487 * testsuite/Makefile.am: Add testcases, and keep current ones
3488 working.
3489 * testsuite/Makefile.in: Regenerate.
3490 * testsuite/arm_fix_1176.s: New file.
3491 * testsuite/arm_fix_1176.sh: Likewise.
3492
3493 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3494
3495 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3496 may_use_blx_.
3497 (Target_arm::may_use_blx): Remove method.
3498 (Target_arm::set_may_use_blx): Likewise.
3499 (Target_arm::may_use_v4t_interworking): New method.
3500 (Target_arm::may_use_v5t_interworking): Likewise.
3501 (Target_arm::may_use_blx_): Remove member variable.
3502 (Arm_relocate_functions::arm_branch_common): Check for v5T
3503 interworking.
3504 (Arm_relocate_functions::thumb_branch_common): Likewise.
3505 (Reloc_stub::stub_type_for_reloc): Likewise.
3506 (Target_arm::do_finalize_sections): Correct interworking checks.
3507 * testsuite/Makefile.am: Add new tests.
3508 * testsuite/Makefile.in: Regenerate.
3509 * testsuite/arm_farcall_arm_arm.s: New test.
3510 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3511 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3512 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3513 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3514 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3515 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3516 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3517
3518 2011-10-31 Cary Coutant <ccoutant@google.com>
3519
3520 PR gold/13023
3521 * expression.cc (Expression::eval_with_dot): Add
3522 is_section_dot_assignment parameter.
3523 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3524 absolute and assigning to dot within a section.
3525 * script-sections.cc
3526 (Output_section_element_assignment::set_section_addresses): Pass
3527 dot_section to set_if_absolute.
3528 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3529 as is_section_dot_assignment flag to eval_with_dot.
3530 (Output_section_element_dot_assignment::set_section_addresses):
3531 Likewise.
3532 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3533 parameter. Also set value if relative to dot_section; set the
3534 symbol's output_section.
3535 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3536 parameter. Adjust all callers.
3537 (Expression::eval_maybe_dot): Likewise.
3538 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3539 Adjust all callers.
3540 * testsuite/script_test_2.t: Test assignment of an absolute value
3541 to dot within an output section element.
3542
3543 2011-10-31 Cary Coutant <ccoutant@google.com>
3544
3545 * options.h (class General_options): Add --[no-]gnu-unique options.
3546 * symtab.cc (Symbol_table::sized_write_globals): Convert
3547 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3548
3549 2011-10-31 Cary Coutant <ccoutant@google.com>
3550
3551 PR gold/13359
3552 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3553 unnecessary assertion.
3554 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3555
3556 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3557
3558 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3559 gc_mark_symbol.
3560 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3561 gc_mark_symbol.
3562 Change to just keep the section associated with symbol.
3563 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3564 they are externally visible and --export-dynamic is turned on.
3565 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3566
3567 2011-10-19 Ian Lance Taylor <iant@google.com>
3568
3569 PR gold/13163
3570 * script-sections.cc
3571 (Output_section_element_dot_assignment::needs_output_section): New
3572 function.
3573
3574 2011-10-19 Ian Lance Taylor <iant@google.com>
3575
3576 PR gold/13204
3577 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3578 --section-start option was seen.
3579 * options.h (General_options::any_section_start): New function.
3580
3581 2011-10-18 David S. Miller <davem@davemloft.net>
3582
3583 PR binutils/13301
3584 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3585 member to track relocation locations that have moved during TLS
3586 reloc optimizations.
3587 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3588 (Target_sparc::Relocate::relocate): Adjust view down by 4
3589 bytes if it matches reloc_adjust_addr_.
3590 (Target_sparc::Relocate::relocate_tls): Always move the
3591 __tls_get_addr call delay slot instruction forward 4 bytes when
3592 performing relaxation.
3593
3594 2011-10-18 Cary Coutant <ccoutant@google.com>
3595
3596 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3597 (Output_file::map_no_anonymous): Check for non-zero
3598 return code from posix_fallocate.
3599
3600 2011-10-17 Cary Coutant <ccoutant@google.com>
3601
3602 PR gold/13245
3603 * plugin.cc (is_visible_from_outside): Check for symbols
3604 referenced from dynamic objects.
3605 * resolve.cc (Symbol_table::resolve): Don't count references
3606 from dynamic objects as references from real ELF files.
3607 * testsuite/plugin_test_2.sh: Adjust expected result.
3608
3609 2011-10-17 Cary Coutant <ccoutant@google.com>
3610
3611 * gold.cc: Include timer.h.
3612 (queue_middle_tasks): Stamp time.
3613 (queue_final_tasks): Likewise.
3614 * main.cc (main): Store timer in parameters. Print timers
3615 for each pass.
3616 * parameters.cc (Parameters::Parameters): Initialize timer_.
3617 (Parameters::set_timer): New function.
3618 (set_parameters_timer): New function.
3619 * parameters.h (Parameters::set_timer): New function.
3620 (Parameters::timer): New function.
3621 (Parameters::timer_): New data member.
3622 (set_parameters_timer): New function.
3623 * timer.cc (Timer::stamp): New function.
3624 (Timer::get_pass_time): New function.
3625 * timer.h (Timer::stamp): New function.
3626 (Timer::get_pass_time): New function.
3627 (Timer::pass_times_): New data member.
3628
3629 2011-10-17 Cary Coutant <ccoutant@google.com>
3630
3631 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3632 task for members of lib groups.
3633
3634 2011-10-17 Cary Coutant <ccoutant@google.com>
3635
3636 PR gold/13288
3637 * fileread.cc (File_read::find_view): Add assert.
3638 (File_read::make_view): Move bounds check (replace with assert)...
3639 (File_read::find_or_make_view): ... to here.
3640
3641 2011-10-12 Cary Coutant <ccoutant@google.com>
3642
3643 * output.cc (Output_file::open_base_file): Handle case where
3644 ::read returns less than requested size.
3645
3646 2011-10-10 Cary Coutant <ccoutant@google.com>
3647
3648 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3649 Initialize defined_count_.
3650 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3651 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3652 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3653 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3654 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3655 * incremental.h (Sized_relobj_incr::defined_count_): New data
3656 member.
3657 (Sized_incr_dynobj::defined_count_): New data member.
3658 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3659 Return zeroes instead of internal error.
3660
3661 2011-10-10 Cary Coutant <ccoutant@google.com>
3662
3663 PR gold/13249
3664 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3665 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3666 * output.h (class Output_reloc): Add use_plt_offset flag.
3667 (Output_reloc::type_): Adjust size of bit field.
3668 (Output_reloc::use_plt_offset_): New bit field.
3669 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3670 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3671 flag. Adjust all callers.
3672 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3673 creating RELATIVE relocations.
3674
3675 2011-10-10 Nick Clifton <nickc@redhat.com>
3676
3677 * po/es.po: Updated Spanish translation.
3678 * po/fi.po: Updated Finnish translation.
3679
3680 2011-10-03 Diego Novillo <dnovillo@google.com>
3681
3682 * options.cc (parse_uint): Fix dereference of RETVAL.
3683
3684 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3685
3686 * layout.h (section_order_map_): New member.
3687 (get_section_order_map): New member function.
3688 * output.cc (Output_section::add_input_section): Check for patterns
3689 only when --section-ordering-file is specified.
3690 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3691 output_sections have been formed.
3692 * layout.cc (Layout_Layout): Initialize section_order_map_.
3693 * plugin.cc (update_section_order): Store order in order_map. Do not
3694 update the order.
3695 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3696 * testsuite/Makefile.in: Regenerate.
3697 * testsuite/plugin_section_order.c: New file.
3698 * testsuite/plugin_final_layout.cc: New file.
3699 * testsuite/plugin_final_layout.sh: New file.
3700
3701 2011-09-29 Cary Coutant <ccoutant@google.com>
3702
3703 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3704 Check for NULL.
3705 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3706 symbols during incremental update.
3707 (Symbol_table::add_from_dynobj): Likewise.
3708
3709 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3710 Ian Lance Taylor <iant@google.com>
3711
3712 * symtab.cc (Symbol_table::define_special_symbol): Always
3713 canonicalize version string.
3714
3715 2011-09-26 Cary Coutant <ccoutant@google.com>
3716
3717 * gold.cc (queue_initial_tasks): Move option checks ...
3718 * options.cc (General_options::finalize): ... to here. Disable
3719 some options; make others fatal.
3720
3721 2011-09-26 Cary Coutant <ccoutant@google.com>
3722
3723 gcc PR lto/47247
3724 * plugin.cc (get_symbols_v2): New function.
3725 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3726 (is_referenced_from_outside): New function.
3727 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3728 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3729 (get_symbols): Pass version parameter.
3730 (get_symbols_v2): New function.
3731 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3732 parameter.
3733 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3734 (onload): Add LDPT_GET_SYMBOLS_V2.
3735 (all_symbols_read_hook): Use get_symbols_v2; check for
3736 LDPR_PREVAILING_DEF_IRONLY_EXP.
3737 * testsuite/plugin_test_3.sh: Update expected results.
3738
3739 2011-09-23 Simon Baldwin <simonb@google.com>
3740
3741 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3742 configuration options.
3743 * configure: Regenerate.
3744 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3745 * Makefile.in: Regenerate.
3746 * testsuite/Makefile.in: Regenerate.
3747
3748 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3749
3750 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3751
3752 2011-09-19 Cary Coutant <ccoutant@google.com>
3753
3754 * incremental.cc (can_incremental_update): Fix typo in comment.
3755 * incremental.h (can_incremental_update): Likewise.
3756
3757 2011-09-18 Cary Coutant <ccoutant@google.com>
3758
3759 * incremental.cc (can_incremental_update): New function.
3760 * incremental.h (can_incremental_update): New function.
3761 * layout.cc (Layout::init_fixed_output_section): Call it.
3762 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3763 * object.cc (Sized_relobj_file::do_layout): Call
3764 can_incremental_update.
3765
3766 2011-09-13 Cary Coutant <ccoutant@google.com>
3767
3768 * configure.ac: Check for glibc support for gnu_indirect_function
3769 support with static linking, setting automake conditional
3770 IFUNC_STATIC.
3771 * Makefile.in: Regenerate.
3772 * configure: Regenerate.
3773
3774 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3775 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3776 for IFUNC_STATIC.
3777 * testsuite/Makefile.in: Regenerate.
3778
3779 2011-09-13 Cary Coutant <ccoutant@google.com>
3780
3781 * incremental.cc (Sized_relobj_incr::do_layout): Call
3782 report_comdat_group for kept comdat sections.
3783 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3784 * testsuite/Makefile.in: Regenerate.
3785 * testsuite/incr_comdat_test_1.cc: New source file.
3786 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3787 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3788 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3789
3790 2011-09-13 Ian Lance Taylor <iant@google.com>
3791
3792 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3793 variable external_symbols_offset.
3794
3795 2011-09-12 Ian Lance Taylor <iant@google.com>
3796
3797 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3798 triggered if object has no symbols.
3799
3800 2011-09-09 David S. Miller <davem@davemloft.net>
3801
3802 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3803 (Output_fill_debug_line::do_write): Likewise.
3804
3805 2011-08-29 Cary Coutant <ccoutant@google.com>
3806
3807 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3808 casts to match formatting specs.
3809 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3810
3811 2011-08-26 Cary Coutant <ccoutant@google.com>
3812
3813 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3814 remaining hole size when allocating.
3815 (Layout::make_output_section): Set fill methods for debug sections.
3816 * layout.h (Free_list::Free_list_node): Move from private to
3817 public.
3818 (Free_list::set_min_hole_size): New function.
3819 (Free_list::begin, Free_list::end): New functions.
3820 (Free_list::min_hole_): New data member.
3821 * output.cc: Include dwarf.h.
3822 (Output_fill_debug_info::do_minimum_hole_size): New function.
3823 (Output_fill_debug_info::do_write): New function.
3824 (Output_fill_debug_line::do_minimum_hole_size): New function.
3825 (Output_fill_debug_line::do_write): New function.
3826 (Output_section::Output_section): Initialize new data member.
3827 (Output_section::set_final_data_size): Ensure patch space is larger
3828 than minimum hole size.
3829 (Output_section::do_write): Fill holes in debug sections.
3830 * output.h (Output_fill): New class.
3831 (Output_fill_debug_info): New class.
3832 (Output_fill_debug_line): New class.
3833 (Output_section::set_free_space_fill): New function.
3834 (Output_section::free_space_fill_): New data member.
3835 * testsuite/Makefile.am (incremental_test_3): Add
3836 --incremental-patch option.
3837 (incremental_test_4): Likewise.
3838 (incremental_test_5): Likewise.
3839 (incremental_test_6): Likewise.
3840 (incremental_copy_test): Likewise.
3841 (incremental_common_test_1): Likewise.
3842 * testsuite/Makefile.in: Regenerate.
3843
3844 2011-08-26 Nick Clifton <nickc@redhat.com>
3845
3846 * po/es.po: Updated Spanish translation.
3847
3848 2011-08-01 Cary Coutant <ccoutant@google.com>
3849
3850 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3851 * gold/testsuite/Makefile.in: Regenerate.
3852 * gold/testsuite/justsyms_exec.c: New source file.
3853 * gold/testsuite/justsyms_lib.c: New source file.
3854
3855 2011-08-01 Cary Coutant <ccoutant@google.com>
3856
3857 * layout.cc (Layout::set_segment_offsets): Don't realign text
3858 segment if -Ttext was specified.
3859 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3860 file type.
3861 * object.h (Sized_relobj_file::e_type): New function.
3862 (Sized_relobj_file::e_type_): New data member.
3863 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3864 base address for ET_EXEC files.
3865 * target.cc (Target::do_make_elf_object_implementation): Allow
3866 ET_EXEC files with --just-symbols option.
3867
3868 2011-07-28 Cary Coutant <ccoutant@google.com>
3869
3870 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3871 Add thread_number parameter.
3872 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3873 * workqueue-threads.cc
3874 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3875 current thread if its thread number is greater than desired thread
3876 count.
3877 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3878 Add thread_number parameter.
3879 (Workqueue::should_cancel_thread): Likewise.
3880 (Workqueue::find_runnable_or_wait): Pass thread_number to
3881 should_cancel_thread.
3882 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3883 parameter.
3884
3885 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3886
3887 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3888 only after checking if it cannot be forced local.
3889 * symtab.h (is_externally_visible): Check if the symbol is not forced
3890 local.
3891
3892 2011-07-15 Ian Lance Taylor <iant@google.com>
3893
3894 * options.h (class General_options): Add --print-output-format.
3895 Move -EL next to -EB, for better --help output.
3896 * target-select.cc: Include <cstdio>, "options.h", and
3897 "parameters.h".
3898 (Target_selector::do_target_bfd_name): New function.
3899 (print_output_format): New function.
3900 * target-select.h (class Target_selector): Update declarations.
3901 (Target_selector::target_bfd_name): New function.
3902 (print_output_format): Declare.
3903 * main.cc: Include "target-select.h".
3904 (main): Handle --print-output-format.
3905 * gold.cc: Include "target-select.h".
3906 (queue_initial_tasks): Handle --print-output-format when there are
3907 no input files.
3908 * parameters.cc (parameters_force_valid_target): Give a better
3909 error message if -EB/-EL does not match target.
3910 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3911 function.
3912
3913 2011-07-15 Ian Lance Taylor <iant@google.com>
3914
3915 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3916 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3917 (Output_data_plt_i386::do_write): Write address of .dynamic
3918 section to first entry in .got.plt section.
3919 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3920 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3921 Initialize layout_.
3922 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3923 section to first entry in .got.plt section.
3924 * layout.h (Layout::dynamic_section): New function.
3925
3926 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3927
3928 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3929 to claim_file call.
3930 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3931 input_section_position_, and input_section_glob_.
3932 (read_layout_from_file): Call function section_ordering_specified.
3933 * layout.h (is_section_ordering_specified): New function.
3934 (section_ordering_specified): New function.
3935 (section_ordering_specified_): New boolean member.
3936 * main.cc(main): Call load_plugins after layout object is defined.
3937 * output.cc (Output_section::add_input_section): Use
3938 function section_ordering_specified to check if section ordering is
3939 needed.
3940 * output.cc (Output_section::add_relaxed_input_section): Use
3941 function section_ordering_specified to check if section ordering is
3942 needed.
3943 (Output_section::update_section_layout): New function.
3944 (Output_section::sort_attached_input_sections): Check if input section
3945 must be reordered.
3946 * output.h (Output_section::update_section_layout): New function.
3947 * plugin.cc (get_section_count): New function.
3948 (get_section_type): New function.
3949 (get_section_name): New function.
3950 (get_section_contents): New function.
3951 (update_section_order): New function.
3952 (allow_section_ordering): New function.
3953 (Plugin::load): Add the new interfaces to the transfer vector.
3954 (Plugin_manager::load_plugins): New parameter.
3955 (Plugin_manager::all_symbols_read): New parameter.
3956 (Plugin_manager::claim_file): New parameter. Save the elf object for
3957 unclaimed objects.
3958 (Plugin_manager::get_elf_object): New function.
3959 (Plugin_manager::get_view): Change to directly use the bool to check
3960 if get_view is called from claim_file_hook.
3961 * plugin.h (input_objects): New function
3962 (Plugin__manager::load_plugins): New parameter.
3963 (Plugin_manager::claim_file): New parameter.
3964 (Plugin_manager::get_elf_object): New function.
3965 (Plugin_manager::in_claim_file_handler): New function.
3966 (Plugin_manager::in_claim_file_handler_): New member.
3967 (layout): New function.
3968 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3969 handler with an extra parameter. Make the elf object before calling
3970 claim_file handler.
3971 * testsuite/plugin_test.c (get_section_count): New function pointer.
3972 (get_section_type): New function pointer.
3973 (get_section_name): New function pointer.
3974 (get_section_contents): New function pointer.
3975 (update_section_order): New function pointer.
3976 (allow_section_ordering): New function pointer.
3977 (onload): Check if the new interfaces exist.
3978
3979 2011-07-13 Ian Lance Taylor <iant@google.com>
3980
3981 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3982 relro section.
3983 * x86_64.cc (Target_x86_64::got_section): Likewise.
3984 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3985 (relro_now_test_SOURCES): New variable.
3986 (relro_now_test_DEPENDENCIES): New variable.
3987 (relro_now_test_LDFLAGS): New variable.
3988 (relro_now_test_LDADD): New variable.
3989 (relro_now_test.so): New target.
3990 * testsuite/Makefile.in: Rebuild.
3991
3992 2011-07-12 Ian Lance Taylor <iant@google.com>
3993
3994 PR gold/12980
3995 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3996 GLOB_DAT relocation rather than a RELATIVE relocation for a
3997 protected symbol when creating a shared library.
3998 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3999 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4000 * testsuite/protected_main_1.cc (main): Test that protected
4001 function has same address.
4002
4003 2011-07-11 Ian Lance Taylor <iant@google.com>
4004
4005 PR gold/12979
4006 * options.h (class General_options): Add -Bgroup.
4007 * options.cc (General_options::finalize): If -Bgroup is set,
4008 default to --unresolved-symbols=report-all.
4009 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4010 * target-reloc.h (issue_undefined_symbol_error): Handle
4011 --unresolved-symbols=report-all.
4012
4013 2011-07-08 Ian Lance Taylor <iant@google.com>
4014
4015 PR gold/11985
4016 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4017 if linker script discards key sections.
4018 (Layout::create_dynamic_symtab): Likewise.
4019 (Layout::assign_local_dynsym_offsets): Likewise.
4020 (Layout::sized_create_version_sections): Likewise.
4021 (Layout::create_interp): Likewise.
4022 (Layout::finish_dynamic_section): Likewise.
4023 (Layout::set_dynamic_symbol_size): Likewise.
4024
4025 2011-07-08 Ian Lance Taylor <iant@google.com>
4026
4027 PR gold/12386
4028 * options.h (class General_options): Add --unresolved-symbols.
4029 * target-reloc.h (issue_undefined_symbol_error): Check
4030 --unresolved-symbols. Add comments.
4031
4032 2011-07-08 Ian Lance Taylor <iant@google.com>
4033
4034 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4035 expression more complex.
4036
4037 2011-07-08 Ian Lance Taylor <iant@google.com>
4038
4039 PR gold/11317
4040 * target-reloc.h (issue_undefined_symbol_error): New inline
4041 function, broken out of relocate_section.
4042 (relocate_section): Call issue_undefined_symbol_error.
4043 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4044 there is no TLS segment if we are about to issue an undefined
4045 symbol error.
4046 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4047
4048 2011-07-08 Ian Lance Taylor <iant@google.com>
4049
4050 PR gold/12279
4051 * resolve.cc (Symbol_table::should_override): Add fromtype
4052 parameter. Change all callers. Give error when linking together
4053 TLS and non-TLS symbol.
4054 (Symbol_table::should_override_with_special): Add fromtype
4055 parameter. Change all callers.
4056 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4057 there is no TLS segment if we have reported some errors.
4058 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4059
4060 2011-07-08 Ian Lance Taylor <iant@google.com>
4061
4062 PR gold/12372
4063 * target.h (Target::plt_address_for_global): New function.
4064 (Target::plt_address_for_local): New function.
4065 (Target::plt_section_for_global): Remove.
4066 (Target::plt_section_for_local): Remove.
4067 (Target::do_plt_address_for_global): New virtual function.
4068 (Target::do_plt_address_for_local): New virtual function.
4069 (Target::do_plt_section_for_global): Remove.
4070 (Target::do_plt_section_for_local): Remove.
4071 (Target::register_global_plt_entry): Add Symbol_table and Layout
4072 parameters.
4073 * output.cc (Output_data_got::Got_entry::write): Use
4074 plt_address_for_global and plt_address_for_local.
4075 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4076 address of output section.
4077 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4078 got_irelative_, and irelative_count_ fields. Update
4079 declarations.
4080 (Output_data_plt_i386::has_irelative_section): New function.
4081 (Output_data_plt_i386::entry_count): Add irelative_count_.
4082 (Output_data_plt_i386::set_final_data_size): Likewise.
4083 (class Target_i386): Add got_irelative_ and rel_irelative_
4084 fields. Update declarations.
4085 (Target_i386::Target_i386): Initialize new fields.
4086 (Target_i386::do_plt_address_for_global): New function replacing
4087 do_plt_section_for_global.
4088 (Target_i386::do_plt_address_for_local): New function replacing
4089 do_plt_section_for_local.
4090 (Target_i386::got_section): Create got_irelative_.
4091 (Target_i386::rel_irelative_section): New function.
4092 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4093 fields. Don't define __rel_iplt_{start,end}.
4094 (Output_data_plt_i386::add_entry): Add symtab and layout
4095 parameters. Change all callers. Use different PLT and GOT for
4096 IFUNC symbols.
4097 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4098 layout parameters. Change all callers. Use different PLT and
4099 GOT.
4100 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4101 (Output_data_plt_i386::rel_irelative): New function.
4102 (Output_data_plt_i386::address_for_global): New function.
4103 (Output_data_plt_i386::address_for_local): New function.
4104 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4105 IRELATIVE GOT when changing IFUNC GOT entries.
4106 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4107 reloc.
4108 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4109 if we didn't create an IRELATIVE GOT.
4110 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4111 plt_address_for_local.
4112 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4113 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4114 got_irelative_, and irelative_count_ fields. Update
4115 declarations.
4116 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4117 Initialize new fields. Remove symtab parameter. Change all
4118 callers.
4119 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4120 irelative_count_.
4121 (Output_data_plt_x86_64::has_irelative_section): New function.
4122 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4123 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4124 fields. Update declarations.
4125 (Target_x86_64::Target_x86_64): Initialize new fields.
4126 (Target_x86_64::do_plt_address_for_global): New function replacing
4127 do_plt_section_for_global.
4128 (Target_x86_64::do_plt_address_for_local): New function replacing
4129 do_plt_section_for_local.
4130 (Target_x86_64::got_section): Create got_irelative_.
4131 (Target_x86_64::rela_irelative_section): New function.
4132 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4133 all callers. Don't create __rel_iplt_{start,end}.
4134 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4135 parameters. Change all callers. Use different PLT and GOT for
4136 IFUNC symbols.
4137 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4138 layout parameters. Change all callers. Use different PLT and
4139 GOT.
4140 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4141 parameters. Change all callers. Use different PLT and GOT for
4142 IFUNC symbols.
4143 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4144 (Output_data_plt_x86_64::rela_irelative): New function.
4145 (Output_data_plt_x86_64::address_for_global): New function.
4146 (Output_data_plt_x86_64::address_for_local): New function.
4147 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4148 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4149 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4150 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4151 parameters.
4152 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4153 reloc.
4154 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4155 symbols if we didn't create an IRELATIVE GOT.
4156 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4157 plt_address_for_local.
4158 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4159 * testsuite/ifuncvar1.c: New test file.
4160 * testsuite/ifuncvar2.c: New test file.
4161 * testsuite/ifuncvar3.c: New test file.
4162 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4163 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4164 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4165 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4166 * testsuite/Makefile.in: Rebuild.
4167
4168 2011-07-07 Cary Coutant <ccoutant@google.com>
4169
4170 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4171 (two_file_test_1_ndebug.o): Likewise.
4172 (two_file_test_1b_ndebug.o): Likewise.
4173 (two_file_test_2_ndebug.o): Likewise.
4174 (two_file_test_main_ndebug.o): Likewise.
4175 (incremental_test_2): Link with no-debug versions.
4176
4177 2011-07-06 Cary Coutant <ccoutant@google.com>
4178
4179 * gold/incremental.cc
4180 (Output_section_incremental_inputs::write_info_blocks): Check for
4181 hidden and internal symbols.
4182
4183 2011-07-06 Cary Coutant <ccoutant@google.com>
4184
4185 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4186 Check disposition for startup file.
4187 (Incremental_inputs::report_command_line): Ignore
4188 --incremental-startup-unchanged option.
4189 * options.cc (General_options::parse_incremental_startup_unchanged):
4190 New function.
4191 (General_options::General_options): Initialize new data member.
4192 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4193 (General_options): Add --incremental-startup-unchanged option.
4194 (General_options::incremental_startup_disposition): New function.
4195 (General_options::incremental_startup_disposition_): New data member.
4196
4197 2011-07-06 Cary Coutant <ccoutant@google.com>
4198
4199 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4200 input file index to Script_info ctor.
4201 (Sized_incremental_binary::do_file_has_changed): Find the
4202 command-line argument for files named in scripts.
4203 * incremental.h (Script_info::Script_info): New ctor
4204 with input file index.
4205 (Script_info::input_file_index): New function.
4206 (Script_info::input_file_index_): New data member.
4207 (Incremental_binary::get_library): Add const.
4208 (Incremental_binary::get_script_info): Add const.
4209 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4210 * testsuite/Makefile.am (incremental_test_5): New test case.
4211 (incremental_test_6): New test case.
4212 * testsuite/Makefile.in: Regenerate.
4213
4214 2011-07-06 Cary Coutant <ccoutant@google.com>
4215
4216 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4217 debug output when command lines differ.
4218
4219 2011-07-06 Cary Coutant <ccoutant@google.com>
4220
4221 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4222 --incremental-patch option.
4223 * layout.cc (Free_list::allocate): Extend allocation beyond original
4224 end if enabled.
4225 (Layout::make_output_section): Mark sections that should get
4226 patch space.
4227 * options.cc (parse_percent): New function.
4228 * options.h (parse_percent): New function.
4229 (DEFINE_percent): New macro.
4230 (General_options): Add --incremental-patch option.
4231 * output.cc (Output_section::Output_section): Initialize new data
4232 members.
4233 (Output_section::add_input_section): Print section name when out
4234 of patch space.
4235 (Output_section::add_output_section_data): Likewise.
4236 (Output_section::set_final_data_size): Add patch space when
4237 doing --incremental-full.
4238 (Output_section::do_reset_address_and_file_offset): Remove patch
4239 space.
4240 (Output_segment::set_section_list_addresses): Print debug output
4241 only if --incremental-update.
4242 * output.h (Output_section::set_is_patch_space_allowed): New function.
4243 (Output_section::is_patch_space_allowed_): New data member.
4244 (Output_section::patch_space_): New data member.
4245 * parameters.cc (Parameters::incremental_full): New function.
4246 * parameters.h (Parameters::incremental_full): New function
4247 * testsuite/Makefile.am (incremental_test_2): Add test for
4248 --incremental-patch option.
4249 * testsuite/Makefile.in: Regenerate.
4250 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4251 (t18): Remove function body.
4252
4253 2011-07-05 Doug Kwan <dougkwan@google.com>
4254
4255 PR gold/12771
4256 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4257 Arm_Address type for relocation result.
4258 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4259 overflow check.
4260 (Arm_relocate_functions::abs32): Use unaligned access.
4261 (Arm_relocate_functions::rel32): Ditto.
4262 (Arm_relocate_functions::prel31): Ditto.
4263 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4264 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4265 static data relocations.
4266 * testsuite/Makefile.in: Regnerate.
4267 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4268
4269 2011-07-05 Ian Lance Taylor <iant@google.com>
4270
4271 PR gold/12392
4272 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4273 symbols if necessary.
4274 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4275
4276 2011-07-05 Ian Lance Taylor <iant@google.com>
4277
4278 PR gold/12952
4279 * resolve.cc (Symbol::override_base_with_special): Simply override
4280 version with special symbol version, ignoring previous version.
4281
4282 2011-07-05 Ian Lance Taylor <iant@google.com>
4283
4284 * object.cc (Sized_relobj_file::include_section_group): Add
4285 information to comment about signature location.
4286
4287 2011-07-02 Ian Lance Taylor <iant@google.com>
4288
4289 PR gold/12957
4290 * options.h (class General_options): Add -f and -F.
4291 * options.cc (General_options::finalize): Fatal error if -f/-F
4292 are used without -shared.
4293 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4294
4295 2011-07-02 Ian Lance Taylor <iant@google.com>
4296
4297 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4298
4299 2011-07-01 Ian Lance Taylor <iant@google.com>
4300
4301 PR gold/12525
4302 PR gold/12952
4303 * resolve.cc (Symbol::override_base_with_special): Don't override
4304 the version if the overriding symbol has a different name.
4305 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4306 all callers. If we give an error about an undefined version,
4307 define the base version if necessary.
4308 * dynobj.h (class Versions): Update declaration.
4309 * testsuite/weak_alias_test_5.cc: New file.
4310 * testsuite/weak_alias_test.script: New file.
4311 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4312 and versioned_alias have the right value, and call t2.
4313 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4314 weak_alias_test_5.so.
4315 (weak_alias_test_LDADD): Likewise.
4316 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4317 * testsuite/Makefile.in: Rebuild.
4318
4319 2011-07-01 Ian Lance Taylor <iant@google.com>
4320
4321 PR gold/12525
4322 * options.h (class General_options): Support -z notext.
4323 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4324 -Wl,-z,notext.
4325 (two_file_shared_nonpic.so): Likewise.
4326 (two_file_shared_mixed.so): Likewise.
4327 (two_file_shared_mixed_1.so): Likewise.
4328 (weak_undef_lib_nonpic.so): Likewise.
4329 (alt/weak_undef_lib_nonpic.so): Likewise.
4330 (tls_test_shared_nonpic.so): Likewise.
4331 * testsuite/Makefile.in: Rebuild.
4332
4333 2011-07-01 Ian Lance Taylor <iant@google.com>
4334
4335 PR gold/12525
4336 * configure.ac: Test whether static linking works, setting
4337 the automake conditional HAVE_STATIC.
4338 * testsuite/Makefile.am: Disable tests using -static if
4339 HAVE_STATIC is not true.
4340 * configure, testsuite/Makefile.in: Rebuild.
4341
4342 2011-07-01 Ian Lance Taylor <iant@google.com>
4343
4344 PR gold/12525
4345 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4346 Assert if we see DW_EH_PE_indirect.
4347 * target.h (Target::ehframe_datarel_base): New function.
4348 (Target::do_ehframe_datarel_base): New target function.
4349 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4350 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4351 function.
4352
4353 2011-07-01 Ian Lance Taylor <iant@google.com>
4354
4355 PR gold/12571
4356 * options.h (class General_options): Add
4357 --ld-generated-unwind-info.
4358 * ehframe.cc (Fde::write): Add address parameter. Change all
4359 callers. If associated with PLT, fill in address and size.
4360 (Cie::set_output_offset): Only add merge mapping if there is an
4361 object.
4362 (Cie::write): Add address parameter. Change all callers.
4363 (Eh_frame::add_ehframe_for_plt): New function.
4364 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4365 input_offset_ fields into union u_, with new plt field.
4366 (Fde::Fde): Adjust for new union field.
4367 (Fde::Fde) [Output_data version]: New constructor.
4368 (Fde::add_mapping): Only add merge mapping if there is an object.
4369 (class Cie): Update declarations.
4370 (class Eh_frame): Declare add_ehframe_for_plt.
4371 * layout.cc (Layout::layout_eh_frame): Break out code into
4372 make_eh_frame_section, and call it.
4373 (Layout::make_eh_frame_section): New function.
4374 (Layout::add_eh_frame_for_plt): New function.
4375 * layout.h (class Layout): Update declarations.
4376 * merge.cc (Merge_map::add_mapping): Add assertion.
4377 * i386.cc: Include "dwarf.h".
4378 (class Output_data_plt_i386): Make first_plt_entry,
4379 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4380 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4381 and plt_eh_frame_fde.
4382 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4383 boundary. Call add_eh_frame_for_plt if appropriate.
4384 * x86_64.cc: Include "dwarf.h".
4385 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4386 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4387 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4388 and plt_eh_frame_fde.
4389 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4390 appropriate.
4391
4392 2011-06-29 Ian Lance Taylor <iant@google.com>
4393
4394 PR gold/12629
4395 * object.cc (Sized_relobj_file::layout_section): Change shdr
4396 parameter to be const.
4397 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4398 out of do_layout.
4399 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4400 appropriate. Call layout_eh_frame_section.
4401 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4402 sections.
4403 * object.h (class Sized_relobj_file): Update declarations.
4404
4405 2011-06-29 Ian Lance Taylor <iant@google.com>
4406
4407 PR gold/12652
4408 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4409 modifier.
4410 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4411
4412 2011-06-29 Ian Lance Taylor <iant@google.com>
4413
4414 PR gold/12675
4415 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4416 SHT_X86_64_UNWIND.
4417 * layout.cc (Layout::layout_eh_frame): Likewise.
4418
4419 2011-06-29 Ian Lance Taylor <iant@google.com>
4420
4421 PR gold/12695
4422 * layout.cc (Layout::symtab_section_shndx): New function.
4423 * layout.h (class Layout): Declare symtab_section_shndx.
4424 * output.cc (Output_section::write_header): Call it.
4425
4426 2011-06-29 Ian Lance Taylor <iant@google.com>
4427
4428 PR gold/12818
4429 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4430 symbols which are not used in a relocation.
4431
4432 2011-06-28 Ian Lance Taylor <iant@google.com>
4433
4434 PR gold/12898
4435 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4436 script create indistinguishable segments.
4437 (Layout::set_segment_offsets): Use stable_sort when sorting
4438 segments. Pass this to Compare_segments constructor.
4439 * layout.h (class Layout): Make segment_precedes non-static.
4440 (class Compare_segments): Change from struct to class. Add
4441 layout_ field. Add constructor.
4442 * script-sections.cc
4443 (Script_sections::attach_sections_using_phdrs_clause): Rename
4444 local orphan to is_orphan. Don't report failure to put empty
4445 section in segment. On attachment failure, report name of
4446 section, and attach to first PT_LOAD segment.
4447
4448 2011-06-28 Ian Lance Taylor <iant@google.com>
4449
4450 PR gold/12934
4451 * target-select.cc (Target_selector::Target_selector): Add
4452 emulation parameter. Change all callers.
4453 (select_target_by_bfd_name): Rename from select_target_by_name.
4454 Change all callers.
4455 (select_target_by_emulation): New function.
4456 (supported_emulation_names): New function.
4457 * target-select.h (class Target_selector): Add emulation_ field.
4458 Update declarations.
4459 (Target_selector::recognize_by_bfd_name): Rename from
4460 recognize_by_name. Change all callers.
4461 (Target_selector::supported_bfd_names): Rename from
4462 supported_names. Change all callers.
4463 (Target_selector::recognize_by_emulation): New function.
4464 (Target_selector::supported_emulations): New function.
4465 (Target_selector::emulation): New function.
4466 (Target_selector::do_recognize_by_bfd_name): Rename from
4467 do_recognize_by_name. Change all callers.
4468 (Target_selector::do_supported_bfd_names): Rename from
4469 do_supported_names. Change all callers.
4470 (Target_selector::do_recognize_by_emulation): New function.
4471 (Target_selector::do_supported_emulations): New function.
4472 (select_target_by_bfd_name): Change name in declaration.
4473 (select_target_by_emulation): Declare.
4474 (supported_emulation_names): Declare.
4475 * parameters.cc (parameters_force_valid_target): Try to find
4476 target based on emulation from -m option.
4477 * options.h (class General_options): Change doc string for -m.
4478 * options.cc (help): Print emulations.
4479 (General_options::parse_V): Likewise.
4480 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4481 Add emulation parameter. Change all callers.
4482
4483 2011-06-28 Ian Lance Taylor <iant@google.com>
4484
4485 * target.h (class Target): Add osabi_ field.
4486 (Target::osabi): New function.
4487 (Target::set_osabi): New function.
4488 (Target::Target): Initialize osabi_.
4489 (Target::do_adjust_elf_header): Make pure virtual.
4490 (Sized_target::do_adjust_elf_header): Declare.
4491 * target.cc (Sized_target::do_adjust_elf_header): New function.
4492 (class Sized_target): Instantiate all versions.
4493 * freebsd.h (class Target_freebsd): Remove.
4494 (Target_selector_freebsd::do_recognize): Call set_osabi on
4495 Target.
4496 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4497 (Target_selector_freebsd::set_osabi): Remove.
4498 * i386.cc (class Target_i386): Inherit from Sized_target rather
4499 than Target_freebsd.
4500 * x86_64.cc (class Target_x86_64): Likewise.
4501
4502 2011-06-28 Ian Lance Taylor <iant@google.com>
4503
4504 * target.h (Target::can_check_for_function_pointers): Rewrite.
4505 Make non-virtual.
4506 (Target::can_icf_inline_merge_sections): Likewise.
4507 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4508 (Target::Target_info): Add can_icf_inline_merge_sections field.
4509 (Target::do_can_check_for_function_pointers): New virtual
4510 function.
4511 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4512 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4513 from can_check_for_function_pointers, move in file.
4514 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4515 section_may_have_icf_unsafe_poineters, move in file.
4516 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4517 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4518 Rename from can_check_for_function_pointers, move in file.
4519 (Target_i386::can_icf_inline_merge_sections): Remove.
4520 (Target_i386::i386_info): Initialize
4521 can_icf_inline_merge_sections.
4522 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4523 Initialize can_icf_inline_merge_sections.
4524 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4525 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4526 Rename from can_check_for_function_pointers, move in file.
4527 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4528 (Target_x86_64::x86_64_info): Initialize
4529 can_icf_inline_merge_sections.
4530 * testsuite/testfile.cc (Target_test::test_target_info):
4531 Likewise.
4532 * icf.cc (get_section_contents): Correct formatting.
4533
4534 2011-06-27 Ian Lance Taylor <iant@google.com>
4535
4536 * symtab.cc (Symbol::versioned_name): New function.
4537 (Symbol_table::add_to_final_symtab): Use versioned_name when
4538 appropriate.
4539 (Symbol_table::sized_write_symbol): Likewise.
4540 * symtab.h (class Symbol): Declare versioned_name.
4541 * stringpool.h (class Stringpool_template): Add variant of add
4542 which takes a std::basic_string.
4543 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4544 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4545 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4546 (ver_test_12.o): New target.
4547 * testsuite/Makefile.in: Rebuild.
4548
4549 2011-06-27 Doug Kwan <dougkwan@google.com>
4550
4551 * arm.cc (Arm_relocate_functions::thm_jump8,
4552 Arm_relocate_functions::thm_jump11): Use a wider signed
4553 type to compute offset.
4554 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4555 arm_thm_jump8.
4556 * testsuite/Makefile.in: Regenerate.
4557 * testsuite/arm_branch_in_range.sh: Check test results of
4558 arm_thm_jump11 and arm_thm_jump8.
4559 * testsuite/arm_thm_jump11.s: New test source file.
4560 * testsuite/arm_thm_jump11.t: New linker script.
4561 * testsuite/arm_thm_jump8.s: New test source file.
4562 * testsuite/arm_thm_jump8.t: New linker script.
4563
4564 2011-06-24 Ian Lance Taylor <iant@google.com>
4565
4566 * layout.cc: Include "object.h".
4567 (ctors_sections_in_init_array): New static variable.
4568 (Layout::is_ctors_in_init_array): New function.
4569 (Layout::layout): Add entry to ctors_sections_in_init_array if
4570 appropriate.
4571 * layout.h (class Layout): Declare is_ctors_in_init_array.
4572 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4573 is_ctors_reverse_view is set.
4574 (Sized_relobj_file::write_sections): Add layout parameter. Change
4575 all callers. Set is_ctors_reverse_view field of View_size.
4576 (Sized_relobj_file::reverse_words): New function.
4577 * object.h (Sized_relobj_file::View_size): Add
4578 is_ctors_reverse_view field.
4579 (class Sized_relobj_file): Update declarations.
4580 * testsuite/initpri3.c: New test.
4581 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4582 initpri3b.
4583 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4584 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4585 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4586 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4587 * testsuite/Makefile.in: Rebuild.
4588
4589 2011-06-24 Cary Coutant <ccoutant@google.com>
4590
4591 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4592 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4593 (debug_msg_cdebug.err): New targets.
4594 * testsuite/Makefile.in: Regenerate.
4595 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4596 Fix checks for link with shared library.
4597
4598 2011-06-24 Doug Kwan <dougkwan@google.com>
4599
4600 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4601 skip empty text sections.
4602 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4603
4604 2011-06-22 Ian Lance Taylor <iant@google.com>
4605
4606 PR gold/12910
4607 * options.h (class General_options): Add --ctors-in-init-array.
4608 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4609 friends as SHT_PROGBITS for merging sections.
4610 (Layout::layout): Remove special handling of .init_array and
4611 friends. Don't sort if doing relocatable link. Sort for .ctors
4612 and .dtors if ctors_in_init_array.
4613 (Layout::make_output_section): Force correct section types for
4614 .init_array and friends. Don't sort if doing relocatable link,
4615 Don't sort .ctors and .dtors if ctors_in_init_array.
4616 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4617 (Layout::output_section_name): Add relobj parameter. Change all
4618 callers. Handle .ctors. and .dtors. in code rather than table.
4619 Handle .ctors and .dtors if ctors_in_init_array.
4620 (Layout::match_file_name): New function, moved from output.cc.
4621 * layout.h (class Layout): Update declarations.
4622 * output.cc: Include "layout.h".
4623 (Input_section_sort_entry::get_priority): New function.
4624 (Input_section_sort_entry::match_file_name): Just call
4625 Layout::match_file_name.
4626 (Output_section::Input_section_sort_init_fini_compare::operator()):
4627 Handle .ctors and .dtors. Sort by explicit priority rather than
4628 by name.
4629 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4630 * testsuite/initpri2.c: New test.
4631 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4632 (check_PROGRAMS): Add initpri2.
4633 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4634 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4635 * configure, testsuite/Makefile.in: Rebuild.
4636
4637 2011-06-19 Ian Lance Taylor <iant@google.com>
4638
4639 PR gold/12880
4640 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4641 .interp section to a PT_INTERP segment even if we have seen a
4642 --dynamic-linker option. Don't do it if we have seen a PHDRS
4643 clause in a linker script.
4644 (Layout::finalize): Don't create a .interp section if we've
4645 already create a PT_INTERP segment.
4646 (Layout::create_interp): Always call choose_output_section (revert
4647 patch of 2011-06-17). Don't create PT_INTERP segment.
4648 * script-sections.cc
4649 (Script_sections::create_note_and_tls_segments): Add a .interp
4650 section to a PT_INTERP segment even if we have seen a
4651 --dynamic-linker option.
4652
4653 2011-06-18 Ian Lance Taylor <iant@google.com>
4654
4655 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4656 merely because a non-PT_LOAD segment has a dynamic reloc.
4657
4658 2011-06-18 Ian Lance Taylor <iant@google.com>
4659
4660 * layout.cc (Layout::finish_dynamic_section): Don't create
4661 DT_FLAGS entry if not needed.
4662
4663 2011-06-18 Ian Lance Taylor <iant@google.com>
4664
4665 PR gold/12745
4666 * layout.cc (Layout::layout_eh_frame): Correct handling of
4667 writable .eh_frame section.
4668
4669 2011-06-17 Ian Lance Taylor <iant@google.com>
4670
4671 PR gold/12893
4672 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4673 symbol is redefined with the exact same object and value.
4674
4675 2011-06-17 Ian Lance Taylor <iant@google.com>
4676
4677 PR gold/12880
4678 * layout.h (class Layout): Add interp_segment_ field.
4679 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4680 (Layout::attach_allocated_section_to_segment): If making shared
4681 library, put .interp section in PT_INTERP segment.
4682 (Layout::finalize): Also call create_interp if -dynamic-linker
4683 option was used.
4684 (Layout::create_interp): Assert that there is no PT_INTERP
4685 segment. If not using a SECTIONS clause, use make_output_section.
4686 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4687 * script-sections.cc
4688 (Script_sections::create_note_and_tls_segments): If making shared
4689 library, put .interp section in PT_INTERP segment.
4690
4691 2011-06-17 Ian Lance Taylor <iant@google.com>
4692
4693 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4694 when making a shared library.
4695
4696 2011-06-17 Ian Lance Taylor <iant@google.com>
4697
4698 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4699 parameter. Change all callers. Don't issue warning about PC32
4700 against locally defined symbol.
4701
4702 2011-06-16 Ian Lance Taylor <iant@google.com>
4703
4704 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4705 occurs in same object.
4706
4707 2011-06-14 Alan Modra <amodra@gmail.com>
4708
4709 * po/POTFILES.in: Regenerate.
4710
4711 2011-06-09 Ian Lance Taylor <iant@google.com>
4712
4713 * script-sections.cc
4714 (Orphan_output_section::set_section_addresses): For a relocatable
4715 link set address to 0.
4716
4717 2011-06-09 Cary Coutant <ccoutant@google.com>
4718
4719 PR gold/12804
4720 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4721 used with --compress-debug-sections.
4722 * gold/object.cc (Sized_relobj_file::do_layout): Report
4723 uncompressed size of compressed input sections.
4724
4725 2011-06-08 Cary Coutant <ccoutant@google.com>
4726
4727 PR gold/12804
4728 * testsuite/two_file_test_2_v1.cc: Change initialization of
4729 v2 to keep it in .data.
4730
4731 2011-06-07 Cary Coutant <ccoutant@google.com>
4732
4733 * common.cc (Symbol_table::do_allocate_commons_list): Call
4734 gold_fallback.
4735 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4736 (Errors::fallback): New function.
4737 (gold_fallback): New function.
4738 * errors.h (Errors::fallback): New function.
4739 * gold.cc (gold_exit): Change status parameter to enum; adjust
4740 all callers.
4741 (queue_initial_tasks): Call gold_fallback.
4742 * gold.h: Include cstdlib.
4743 (Exit_status): New enum type.
4744 (gold_exit): Change status parameter to enum.
4745 (gold_fallback): New function.
4746 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4747 (Layout::create_symtab_sections): Likewise.
4748 (Layout::create_shdrs): Likewise.
4749 * main.cc (main): Adjust call to gold_exit.
4750 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4751 (Output_data_got::add_got_entry_pair): Likewise.
4752 (Output_section::add_input_section): Likewise.
4753 (Output_section::add_output_section_data): Likewise.
4754 (Output_segment::set_section_list_addresses): Likewise.
4755 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4756
4757 2011-06-07 Cary Coutant <ccoutant@google.com>
4758
4759 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4760 for incremental links.
4761 * output.cc (Output_segment::set_section_list_addresses): Remove
4762 FIXME and test for TLS or BSS.
4763
4764 2011-06-07 Cary Coutant <ccoutant@google.com>
4765
4766 * testsuite/Makefile.am: Add incremental_copy_test,
4767 incremental_common_test_1.
4768 * testsuite/Makefile.in: Regenerate.
4769 * testsuite/common_test_1_v1.c: New source file.
4770 * testsuite/common_test_1_v2.c: New source file.
4771 * testsuite/copy_test_v1.cc: New source file.
4772
4773 2011-06-07 Cary Coutant <ccoutant@google.com>
4774
4775 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4776 update, allocate common from bss section's free list.
4777 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4778 linker-defined symbols.
4779 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4780 Skip GOT and PLT entries that are no longer referenced.
4781 (Output_section_incremental_inputs::write_info_blocks): Mark
4782 linker-defined symbols.
4783 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4784 * output.cc (Output_section::allocate): New function.
4785 * output.h (Output_section::allocate): New function.
4786 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4787 linker-defined symbols.
4788 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4789 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4790 (Symbol::init_base_output_data): Likewise.
4791 (Symbol::init_base_output_segment): Likewise.
4792 (Symbol::init_base_constant): Likewise.
4793 (Sized_symbol::init_output_data): Likewise.
4794 (Sized_symbol::init_output_segment): Likewise.
4795 (Sized_symbol::init_constant): Likewise.
4796 (Symbol_table::do_define_in_output_data): Likewise.
4797 (Symbol_table::do_define_in_output_segment): Likewise.
4798 (Symbol_table::do_define_as_constant): Likewise.
4799 * symtab.h (Symbol::is_predefined): New function.
4800 (Symbol::init_base_output_data): Add is_predefined parameter.
4801 (Symbol::init_base_output_segment): Likewise.
4802 (Symbol::init_base_constant): Likewise.
4803 (Symbol::is_predefined_): New data member.
4804 (Sized_symbol::init_output_data): Add is_predefined parameter.
4805 (Sized_symbol::init_output_segment): Likewise.
4806 (Sized_symbol::init_constant): Likewise.
4807 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4808
4809 2011-06-07 Cary Coutant <ccoutant@google.com>
4810
4811 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4812 instead of emit_copy_reloc.
4813 (Copy_relocs::emit_copy_reloc): Refactor.
4814 (Copy_relocs::make_copy_reloc): New function.
4815 (Copy_relocs::add_copy_reloc): Remove.
4816 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4817 section.
4818 (Copy_relocs::make_copy_reloc): New function.
4819 (Copy_relocs::add_copy_reloc): Remove.
4820 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4821 unchanged input files.
4822 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4823 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4824 Reserve BSS space for COPY relocations.
4825 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4826 (Output_section_incremental_inputs::write_info_blocks): Record
4827 whether a symbol is copied from a shared object.
4828 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4829 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4830 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4831 (Incremental_input_entry_reader::get_output_symbol_index): Add
4832 is_copy parameter.
4833 (Incremental_binary::emit_copy_relocs): New function.
4834 (Incremental_binary::do_emit_copy_relocs): New function.
4835 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4836 new data member.
4837 (Sized_incremental_binary::add_copy_reloc): New function.
4838 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4839 (Sized_incremental_binary::Copy_reloc): New struct.
4840 (Sized_incremental_binary::Copy_relocs): New typedef.
4841 (Sized_incremental_binary::copy_relocs_): New data member.
4842 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4843 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4844 * target.h (Sized_target::emit_copy_reloc): New function.
4845 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4846
4847 2011-06-02 Cary Coutant <ccoutant@google.com>
4848
4849 PR gold/12163
4850 * gold/archive.cc (Archive::Archive): Initialize new data member.
4851 (Archive::include_all_members): Return if archive has already been
4852 included.
4853 * gold/archive.h (Archive::include_all_members_): New data member.
4854
4855 2011-06-02 Nick Clifton <nickc@redhat.com>
4856
4857 * dynobj.h: Fix spelling mistake in comment.
4858 * output.cc: Likewise.
4859
4860 2011-05-31 Doug Kwan <dougkwan@google.com>
4861 Asier Llano
4862
4863 PR gold/12826
4864 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4865 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4866 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4867 redundant arm_exidx_test.so.
4868 * testsuite/Makefile.in: Regenerate.
4869 (check_SCRIPTS): Add pr12826.sh
4870 (check_DATA): Add pr12826.stdout
4871 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4872 * testsuite/pr12826.sh: New file.
4873 * testsuite/pr12826_1.s: Ditto.
4874 * testsuite/pr12826_1.s: Ditto.
4875
4876 2011-05-30 Ian Lance Taylor <iant@google.com>
4877
4878 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4879 sections.
4880
4881 2011-05-29 Ian Lance Taylor <iant@google.com>
4882
4883 PR gold/12804
4884 * testsuite/Makefile.am: Use different file name for two_file_test
4885 temporary file for each incremental test.
4886 * testsuite/Makefile.in: Rebuild.
4887
4888 2011-05-29 Ian Lance Taylor <iant@google.com>
4889
4890 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4891 binary input file is empty.
4892
4893 2011-05-27 Ian Lance Taylor <iant@google.com>
4894
4895 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4896 (ver_test_9.so): Likewise.
4897 * testsuite/Makefile.in: Rebuild.
4898
4899 2011-05-26 Cary Coutant <ccoutant@google.com>
4900
4901 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4902 * incremental.cc (Incremental_inputs::report_input_section): Fix
4903 comment, indentation.
4904 (Incremental_inputs::report_comdat_group): New function.
4905 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4906 of data for incremental input file entry.
4907 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4908 group count, COMDAT group signatures.
4909 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4910 an unchanged input file.
4911 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4912 Initialize new data member.
4913 (Incremental_object_entry::add_comdat_group): New function.
4914 (Incremental_object_entry::get_comdat_group_count): New function.
4915 (Incremental_object_entry::get_comdat_signature_key): New function.
4916 (Incremental_object_entry::groups_): New data member.
4917 (Incremental_inputs::report_comdat_group): New function.
4918 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4919 data for incremental input file entry.
4920 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4921 (Incremental_input_entry_reader::get_input_section): Adjust size of
4922 data for incremental input file entry.
4923 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4924 (Incremental_input_entry_reader::get_comdat_group_signature): New
4925 function.
4926 * object.cc (Sized_relobj::include_section_group): Report kept
4927 COMDAT groups for incremental links.
4928
4929 2011-05-24 David Meyer <pdox@google.com>
4930
4931 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4932 with name parameter. Add found_name parameter.
4933 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4934 * dirsearch.h (class Dirsearch): Update declaration.
4935
4936 2011-05-24 Ian Lance Taylor <iant@google.com>
4937
4938 * archive.cc (Library_base::should_include_member): Pull in object
4939 from archive if it defines the entry symbol.
4940 * parameters.cc (Parameters::entry): New function.
4941 * parameters.h (class Parameters): Declare entry.
4942 * output.h (class Output_file_header): Remove entry_ field.
4943 * output.cc (Output_file_header::Output_file_header): Remove entry
4944 parameter. Change all callers.
4945 (Output_file_header::entry): Use parameters->entry.
4946 * gold.cc (queue_middle_tasks): Likewise.
4947 * plugin.cc (Plugin_hook::run): Likewise.
4948
4949 2011-05-24 Cary Coutant <ccoutant@google.com>
4950
4951 * gold.cc (queue_initial_tasks): Pass incremental base filename
4952 to Output_file::open_base_file; don't print error message.
4953 * incremental-dump.cc (main): Adjust call to
4954 Output_file::open_for_modification.
4955 * incremental-dump.cc (main): Likewise.
4956 * incremental.cc (Incremental_inputs::report_command_line):
4957 Ignore --incremental-base option when comparing command lines.
4958 Ignore parameter when given as separate argument.
4959 * options.h (class General_options): Add --incremental-base.
4960 * output.cc (Output_file::Output_file):
4961 (Output_file::open_base_file): Add base_name and writable parameters;
4962 read base file into new file; print error message here.
4963 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4964 callers.
4965 * output.h (Output_file::open_for_modification): Rename to...
4966 (Output_file::open_base_file): ...this; add base_name and
4967 writable parameters; adjust all callers.
4968 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4969 callers.
4970 * testsuite/Makefile.am (incremental_test_4): Test
4971 --incremental-base.
4972 * testsuite/Makefile.in: Regenerate.
4973
4974 2011-05-24 Cary Coutant <ccoutant@google.com>
4975
4976 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4977 incremental_test_4.
4978 * testsuite/Makefile.in: Regenerate.
4979 * testsuite/two_file_test_1_v1.cc: New test source file.
4980 * testsuite/two_file_test_1b_v1.cc: New test source file.
4981 * testsuite/two_file_test_2_v1.cc: New test source file.
4982
4983 2011-05-24 Cary Coutant <ccoutant@google.com>
4984
4985 * dynobj.h (Dynobj::do_dynobj): New function.
4986 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4987 flag and soname for shared objects.
4988 * incremental.cc (Incremental_inputs::report_object): Make
4989 either Incremental_object_entry or Incremental_dynobj_entry; add
4990 soname to string table.
4991 (Incremental_inputs::report_input_section): Add assertion.
4992 (Output_section_incremental_inputs::set_final_data_size): Adjust
4993 type of input file entry for shared libraries; adjust size of
4994 shared library info entry.
4995 (Output_section_incremental_inputs::write_input_files): Write
4996 as_needed flag for shared libraries.
4997 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4998 of input file entry for shared libraries; write soname.
4999 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5000 soname from incremental info.
5001 * incremental.h (enum Incremental_input_flags): Add
5002 INCREMENTAL_INPUT_AS_NEEDED.
5003 (Incremental_input_entry::Incremental_input_entry): Initialize new
5004 data member.
5005 (Incremental_input_entry::set_as_needed): New function.
5006 (Incremental_input_entry::as_needed): New function.
5007 (Incremental_input_entry::do_dynobj_entry): New function.
5008 (Incremental_input_entry::as_needed_): New data member.
5009 (Incremental_object_entry::Incremental_object_entry): Don't check
5010 for shared library.
5011 (Incremental_object_entry::do_type): Likewise.
5012 (class Incremental_dynobj_entry): New class.
5013 (Incremental_input_entry_reader::as_needed): New function.
5014 (Incremental_input_entry_reader::get_soname): New function.
5015 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5016 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5017 size of shared library info entry.
5018 * layout.cc (Layout::finish_dynamic_section): Don't test for
5019 incremental link when adding DT_NEEDED entries.
5020 * object.h (Object::Object): Initialize new data member.
5021 (Object::dynobj): New function.
5022 (Object::set_as_needed): New function.
5023 (Object::as_needed): New function.
5024 (Object::do_dynobj): New function.
5025 (Object::as_needed_): New data member.
5026
5027 2011-05-24 Cary Coutant <ccoutant@google.com>
5028
5029 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5030 info; adjust display of GOT entries.
5031 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5032 vector of input objects; remove file_status_.
5033 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5034 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5035 got_plt reader; call target hooks to reserve GOT entries.
5036 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5037 of input file info header and GOT info entry.
5038 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5039 relocation info.
5040 (Got_plt_view_info::got_descriptor): Remove.
5041 (Got_plt_view_info::sym_index): New data member.
5042 (Got_plt_view_info::input_index): New data member.
5043 (Local_got_offset_visitor::visit): Write input file index.
5044 (Global_got_offset_visitor::visit): Write 0 for input file index.
5045 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5046 with sym_index and input_index.
5047 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5048 incremental info GOT entry; replace got_descriptor with input_index.
5049 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5050 map from input file index to object.
5051 (Sized_relobj_incr::do_layout): Replace direct data member reference
5052 with accessor function.
5053 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5054 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5055 Adjust size of input file info header.
5056 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5057 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5058 (Incremental_input_entry_reader::get_input_section): Adjust size of
5059 input file info header.
5060 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5061 of incremental info GOT entry.
5062 (Incremental_got_plt_reader::get_got_desc): Remove.
5063 (Incremental_got_plt_reader::get_got_symndx): New function.
5064 (Incremental_got_plt_reader::get_got_input_index): New function.
5065 (Sized_incremental_binary::Sized_incremental_binary): Remove
5066 file_status_; add input_objects_.
5067 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5068 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5069 (Sized_incremental_binary::file_is_unchanged): Remove.
5070 (Sized_incremental_binary::set_input_object): New function.
5071 (Sized_incremental_binary::input_object): New function.
5072 (Sized_incremental_binary::file_status_): Remove.
5073 (Sized_incremental_binary::input_objects_): New data member.
5074 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5075 references.
5076 (Sized_relobj_incr::invalid_address): Move to base class.
5077 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5078 class.
5079 (Sized_relobj_incr::do_output_section_offset): Likewise.
5080 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5081 (Sized_relobj_incr::section_offsets_): Likewise.
5082 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5083 function.
5084 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5085 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5086 with accessor function.
5087 (Sized_relobj_file::do_layout): Likewise.
5088 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5089 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5090 (Sized_relobj_file::compute_final_local_value): Replace refs to
5091 section_offsets_ with accessor function.
5092 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5093 * object.h (Relobj::Relobj): Initialize new data members.
5094 (Relobj::add_dyn_reloc): New function.
5095 (Relobj::first_dyn_reloc): New function.
5096 (Relobj::dyn_reloc_count): New function.
5097 (Relobj::first_dyn_reloc_): New data member.
5098 (Relobj::dyn_reloc_count_): New data member.
5099 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5100 references.
5101 (Sized_relobj::Address): New typedef.
5102 (Sized_relobj::invalid_address): Move here from child class.
5103 (Sized_relobj::Sized_relobj): Initialize new data members.
5104 (Sized_relobj::sized_relobj): New function.
5105 (Sized_relobj::is_output_section_offset_invalid): Move here from
5106 child class.
5107 (Sized_relobj::get_output_section_offset): Likewise.
5108 (Sized_relobj::local_has_got_offset): Likewise.
5109 (Sized_relobj::local_got_offset): Likewise.
5110 (Sized_relobj::set_local_got_offset): Likewise.
5111 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5112 (Sized_relobj::clear_got_offsets): New function.
5113 (Sized_relobj::section_offsets): Move here from child class.
5114 (Sized_relobj::do_output_section_offset): Likewise.
5115 (Sized_relobj::do_set_section_offset): Likewise.
5116 (Sized_relobj::Local_got_offsets): Likewise.
5117 (Sized_relobj::local_got_offsets_): Likewise.
5118 (Sized_relobj::section_offsets_): Likewise.
5119 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5120 references.
5121 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5122 class.
5123 (Sized_relobj_file::sized_relobj): New function
5124 (Sized_relobj_file::local_has_got_offset): Move to base class.
5125 (Sized_relobj_file::local_got_offset): Likewise.
5126 (Sized_relobj_file::set_local_got_offset): Likewise.
5127 (Sized_relobj_file::get_output_section_offset): Likewise.
5128 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5129 (Sized_relobj_file::do_output_section_offset): Likewise.
5130 (Sized_relobj_file::do_set_section_offset): Likewise.
5131 (Sized_relobj_file::Local_got_offsets): Likewise.
5132 (Sized_relobj_file::local_got_offsets_): Likewise.
5133 (Sized_relobj_file::section_offsets_): Likewise.
5134 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5135 (all constructors).
5136 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5137 (Output_reloc::get_symbol_index): Likewise.
5138 (Output_reloc::local_section_offset): Likewise.
5139 (Output_reloc::get_address): Likewise.
5140 (Output_reloc::symbol_value): Likewise.
5141 (Output_data_got::reserve_slot): Move to class definition.
5142 (Output_data_got::reserve_local): New function.
5143 (Output_data_got::reserve_slot_for_global): Remove.
5144 (Output_data_got::reserve_global): New function.
5145 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5146 (all constructors, two instantiations).
5147 (Output_reloc::get_relobj): New function (two instantiations).
5148 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5149 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5150 (Output_data_reloc::add_global): Adjust type of relobj.
5151 (Output_data_reloc::add_global_relative): Likewise.
5152 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5153 (Output_data_reloc::add_local): Likewise.
5154 (Output_data_reloc::add_local_relative): Likewise.
5155 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5156 (Output_data_reloc::add_local_section): Likewise.
5157 (Output_data_reloc::add_output_section): Likewise.
5158 (Output_data_reloc::add_absolute): Likewise.
5159 (Output_data_reloc::add_target_specific): Likewise.
5160 (Output_data_got::reserve_slot): Move definition here.
5161 (Output_data_got::reserve_local): New function.
5162 (Output_data_got::reserve_global): New function.
5163 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5164 section_offsets_ with accessor function.
5165 (Sized_relobj_file::write_sections): Likewise.
5166 (Sized_relobj_file::do_relocate_sections): Likewise.
5167 * target.h (Sized_target::reserve_local_got_entry): New function.
5168 (Sized_target::reserve_global_got_entry): New function.
5169 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5170 (Target_x86_64::reserve_global_got_entry): New function.
5171 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5172
5173 2011-05-23 Cary Coutant <ccoutant@google.com>
5174
5175 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5176 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5177 bit when checking got_type.
5178 * incremental.cc (Sized_incremental_binary::setup_readers):
5179 Store symbol table and string table locations; initialize bit vector
5180 of file status flags.
5181 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5182 unchanged files.
5183 (Sized_incremental_binary::do_process_got_plt): New function.
5184 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5185 (Output_section_incremental_inputs::set_final_data_size): Record
5186 file index for each input file.
5187 (Output_section_incremental_inputs::write_got_plt): Store file index
5188 instead of input entry offset for each GOT entry.
5189 * incremental.h
5190 (Incremental_input_entry::Incremental_input_entry): Initialize new
5191 data member.
5192 (Incremental_input_entry::set_offset): Store file index.
5193 (Incremental_input_entry::get_file_index): New function.
5194 (Incremental_input_entry::file_index_): New data member.
5195 (Incremental_binary::process_got_plt): New function.
5196 (Incremental_binary::do_process_got_plt): New function.
5197 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5198 data members.
5199 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5200 (Sized_incremental_binary::set_file_is_unchanged): New function.
5201 (Sized_incremental_binary::file_is_unchanged): New function.
5202 (Sized_incremental_binary::do_process_got_plt): New function.
5203 (Sized_incremental_binary::file_status_): New data member.
5204 (Sized_incremental_binary::main_symtab_loc_): New data member.
5205 (Sized_incremental_binary::main_strtab_loc_): New data member.
5206 * output.cc (Output_data_got::Got_entry::write): Add case
5207 RESERVED_CODE.
5208 (Output_data_got::add_global): Call add_got_entry.
5209 (Output_data_got::add_global_plt): Likewise.
5210 (Output_data_got::add_global_with_rel): Likewise.
5211 (Output_data_got::add_global_with_rela): Likewise.
5212 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5213 (Output_data_got::add_global_pair_with_rela): Likewise.
5214 (Output_data_got::add_local): Call add_got_entry.
5215 (Output_data_got::add_local_plt): Likewise.
5216 (Output_data_got::add_local_with_rel): Likewise.
5217 (Output_data_got::add_local_with_rela): Likewise.
5218 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5219 (Output_data_got::add_local_pair_with_rela): Likewise.
5220 (Output_data_got::reserve_slot): New function.
5221 (Output_data_got::reserve_slot_for_global): New function.
5222 (Output_data_got::add_got_entry): New function.
5223 (Output_data_got::add_got_entry_pair): New function.
5224 (Output_section::add_output_section_data): Edit FIXME.
5225 * output.h
5226 (Output_section_data_build::Output_section_data_build): New
5227 constructor with size parameter.
5228 (Output_data_space::Output_data_space): Likewise.
5229 (Output_data_got::Output_data_got): Initialize new data member; new
5230 constructor with size parameter.
5231 (Output_data_got::add_constant): Call add_got_entry.
5232 (Output_data_got::reserve_slot): New function.
5233 (Output_data_got::reserve_slot_for_global): New function.
5234 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5235 (Output_data_got::add_got_entry): New function.
5236 (Output_data_got::add_got_entry_pair): New function.
5237 (Output_data_got::free_list_): New data member.
5238 * target.h (Sized_target::init_got_plt_for_update): New function.
5239 (Sized_target::register_global_plt_entry): New function.
5240 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5241 Initialize new data member; call init; add constructor with PLT count.
5242 (Output_data_plt_x86_64::init): New function.
5243 (Output_data_plt_x86_64::add_relocation): New function.
5244 (Output_data_plt_x86_64::reserve_slot): New function.
5245 (Output_data_plt_x86_64::free_list_): New data member.
5246 (Target_x86_64::init_got_plt_for_update): New function.
5247 (Target_x86_64::register_global_plt_entry): New function.
5248 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5249 incremental updates.
5250 (Output_data_plt_x86_64::add_relocation): New function.
5251 * testsuite/object_unittest.cc (Object_test): Set default options.
5252
5253 2011-05-16 Ian Lance Taylor <iant@google.com>
5254
5255 * options.h (class General_options): Make -i a synonym for -r.
5256
5257 2011-05-16 Ian Lance Taylor <iant@google.com>
5258
5259 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5260
5261 2011-05-10 Cary Coutant <ccoutant@google.com>
5262
5263 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5264 strip_all (-s).
5265
5266 2011-05-06 Ian Lance Taylor <iant@google.com>
5267
5268 * layout.cc (Layout::layout): If the output section flags change,
5269 update the ordering.
5270
5271 2011-04-25 Cary Coutant <ccoutant@google.com>
5272
5273 * incremental-dump.cc (dump_incremental_inputs): Print local
5274 symbol info for each input file.
5275 * incremental.cc
5276 (Output_section_incremental_inputs::set_final_data_size): Add local
5277 symbol info to input file entries in incremental info.
5278 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5279 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5280 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5281 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5282 implementation.
5283 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5284 (Sized_incr_relobj::do_relocate): Write the local symbols.
5285 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5286 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5287 Adjust size of input file header.
5288 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5289 (Incremental_inputs_reader::get_local_symbol_count): New function.
5290 (Incremental_inputs_reader::get_input_section): Adjust size of input
5291 file header.
5292 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5293 (Sized_incr_relobj::This): New typedef.
5294 (Sized_incr_relobj::sym_size): New const data member.
5295 (Sized_incr_relobj::Local_symbol): New struct.
5296 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5297 (Sized_incr_relobj::do_local_symbol_offset): New function.
5298 (Sized_incr_relobj::local_symbol_count_): New data member.
5299 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5300 (Sized_incr_relobj::local_symbol_index_): New data member.
5301 (Sized_incr_relobj::local_symbol_offset_): New data member.
5302 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5303 (Sized_incr_relobj::local_symbols_): New data member.
5304 * object.h (Relobj::output_local_symbol_count): New function.
5305 (Relobj::local_symbol_offset): New function.
5306 (Relobj::do_output_local_symbol_count): New function.
5307 (Relobj::do_local_symbol_offset): New function.
5308 (Sized_relobj::do_output_local_symbol_count): New function.
5309 (Sized_relobj::do_local_symbol_offset): New function.
5310
5311 2011-04-22 Vladimir Simonov <sv@sw.ru>
5312
5313 * descriptors.cc (set_close_on_exec): New function.
5314 (Descriptors::open): Use set_close_on_exec.
5315 * output.cc (S_ISLNK): Define if not defined.
5316
5317 2011-04-22 Cary Coutant <ccoutant@google.com>
5318
5319 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5320 global symbol map.
5321 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5322 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5323 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5324 relocations.
5325 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5326 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5327 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5328 * incremental.h
5329 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5330 function.
5331 (Incremental_binary::apply_incremental_relocs): New function.
5332 (Incremental_binary::do_apply_incremental_relocs): New function.
5333 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5334 data member.
5335 (Sized_incremental_binary::add_global_symbol): New function.
5336 (Sized_incremental_binary::global_symbol): New function.
5337 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5338 (Sized_incremental_binary::symbol_map_): New data member.
5339 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5340 * target.h (Sized_target::apply_relocation): New function.
5341 * target-reloc.h (apply_relocation): New function.
5342 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5343
5344 2011-04-22 Doug Kwan <dougkwan@google.com>
5345
5346 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5347 flag of a SHT_ARM_EXIDX section.
5348 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5349 * testsuite/Makefile.in: Regenerate.
5350 * testsuite/arm_exidx_test.s: New file.
5351 * testsuite/arm_exidx_test.sh: Same.
5352
5353 2011-04-20 Cary Coutant <ccoutant@google.com>
5354
5355 PR gold/12689
5356 * archive.h (Incremental_archive_entry::Archive_member):
5357 Initialize arg_serial_ (second constructor).
5358
5359 2011-04-17 Ian Lance Taylor <iant@google.com>
5360
5361 * object.cc (Relocate_info::location): Simplify location string.
5362 * errors.cc (Errors::error_at_location): Don't print program
5363 name.
5364 (Errors::warning_at_location): Likewise.
5365 (Errors::undefined_symbol): Likewise.
5366 * testsuite/debug_msg.sh: Update accordingly.
5367
5368 2011-04-14 Cary Coutant <ccoutant@google.com>
5369
5370 * gold/layout.cc (Layout::symtab_section_offset): New function.
5371 * gold/layout.h (Layout::symtab_section_offset): New function.
5372 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5373
5374 2011-04-12 Ian Lance Taylor <iant@google.com>
5375
5376 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5377 with MREMAP_MAYMOVE.
5378 * output.h (class Output_file): Add map_is_allocated_ field.
5379 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5380 not available, provide stubs. If mremap is not available, #define
5381 it to gold_mremap.
5382 (MREMAP_MAYMOVE): Define if not defined.
5383 (Output_file::Output_file): Initialize map_is_allocated_.
5384 (Output_file::resize): Check map_is_allocated_.
5385 (Output_file::map_anonymous): If mmap fails, use malloc.
5386 (Output_file::unmap): Don't do anything for an anonymous map.
5387 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5388 is not available, provide stubs.
5389 (File_read::View::~View): Use free rather than delete[].
5390 (File_read::make_view): Use malloc rather than new[]. If mmap
5391 fails, use malloc.
5392 (File_read::find_or_make_view): Use malloc rather than new[].
5393 * gold.h: Remove HAVE_REMAP code.
5394 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5395 exists. Rename mremap to gold_mremap. If mmap is not available
5396 don't do anything.
5397 * configure, config.in: Rebuild.
5398
5399 2011-04-11 Ian Lance Taylor <iant@google.com>
5400
5401 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5402 initialize local variable v.
5403
5404 2011-04-11 Cary Coutant <ccoutant@google.com>
5405
5406 * archive.cc (Archive::include_member): Adjust call to
5407 report_object.
5408 (Add_archive_symbols::run): Track argument serial numbers.
5409 (Lib_group::include_member): Likewise.
5410 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5411 * archive.h (Incremental_archive_entry::Archive_member):
5412 Initialize arg_serial_.
5413 (Archive_member::arg_serial_): New data member.
5414 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5415 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5416 incremental link.
5417 (Sized_dynobj::do_for_all_local_got_entries): New function.
5418 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5419 function.
5420 * fileread.cc (get_mtime): New function.
5421 * fileread.h (get_mtime): New function.
5422 * gold.cc (queue_initial_tasks): Check for incremental update.
5423 (process_incremental_input): New function.
5424 (queue_middle_tasks): Don't force valid target for incremental
5425 update.
5426 * incremental-dump.cc (find_input_containing_global): Adjust
5427 size of symbol info entry.
5428 (dump_incremental_inputs): Dump argument serial number and
5429 in_system_directory flag; bias shndx by 1; print symbol names
5430 when dumping per-file symbol lists; use new symbol info readers.
5431 * incremental.cc
5432 (Output_section_incremental_inputs:update_data_size): New function.
5433 (Sized_incremental_binary::setup_readers): Setup input readers
5434 for each input file; build maps for files added from libraries
5435 and scripts.
5436 (Sized_incremental_binary::check_input_args): New function.
5437 (Sized_incremental_binary::do_check_inputs): Build map of argument
5438 serial numbers to input arguments.
5439 (Sized_incremental_binary::do_file_has_changed): Rename
5440 do_file_is_unchanged to this; compare file modification times.
5441 (Sized_incremental_binary::do_init_layout): New function.
5442 (Sized_incremental_binary::do_reserve_layout): New function.
5443 (Sized_incremental_binary::do_get_input_reader): Remove.
5444 (Sized_incremental_binary::get_symtab_view): New function.
5445 (Incremental_checker::can_incrementally_link_output_file): Remove.
5446 (Incremental_inputs::report_command_line): Exclude --debug options.
5447 (Incremental_inputs::report_archive_begin): Add parameter; track
5448 argument serial numbers; don't put input file entry for archive
5449 before archive members.
5450 (Incremental_inputs::report_archive_end): Put input file entry
5451 for archive after archive members.
5452 (Incremental_inputs::report_object): Add parameter; track argument
5453 serial numbers and in_system_directory flag.
5454 (Incremental_inputs::report_script): Add parameter; track argument
5455 serial numbers.
5456 (Output_section_incremental_inputs::set_final_data_size): Adjust
5457 size of symbol info entry; check for forwarding symbols.
5458 (Output_section_incremental_inputs::write_input_files): Write
5459 in_system_directory flag and argument serial number.
5460 (Output_section_incremental_inputs::write_info_blocks): Map section
5461 indices between incremental info and original input file; store
5462 input section index for each symbol.
5463 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5464 change operator() to visit().
5465 (class Global_got_offset_visitor): Likewise.
5466 (class Global_symbol_visitor_got_plt):
5467 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5468 classes.
5469 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5470 (Sized_incr_relobj::do_read_symbols): New function.
5471 (Sized_incr_relobj::do_layout): New function.
5472 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5473 (Sized_incr_relobj::do_add_symbols): New function.
5474 (Sized_incr_relobj::do_should_include_member): New function.
5475 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5476 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5477 (Sized_incr_relobj::do_section_size): New function.
5478 (Sized_incr_relobj::do_section_name): New function.
5479 (Sized_incr_relobj::do_section_contents): New function.
5480 (Sized_incr_relobj::do_section_flags): New function.
5481 (Sized_incr_relobj::do_section_entsize): New function.
5482 (Sized_incr_relobj::do_section_address): New function.
5483 (Sized_incr_relobj::do_section_type): New function.
5484 (Sized_incr_relobj::do_section_link): New function.
5485 (Sized_incr_relobj::do_section_info): New function.
5486 (Sized_incr_relobj::do_section_addralign): New function.
5487 (Sized_incr_relobj::do_initialize_xindex): New function.
5488 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5489 (Sized_incr_relobj::do_read_relocs): New function.
5490 (Sized_incr_relobj::do_gc_process_relocs): New function.
5491 (Sized_incr_relobj::do_scan_relocs): New function.
5492 (Sized_incr_relobj::do_count_local_symbols): New function.
5493 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5494 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5495 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5496 (Sized_incr_relobj::do_relocate): New function.
5497 (Sized_incr_relobj::do_set_section_offset): New function.
5498 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5499 (Sized_incr_dynobj::do_read_symbols): New function.
5500 (Sized_incr_dynobj::do_layout): New function.
5501 (Sized_incr_dynobj::do_add_symbols): New function.
5502 (Sized_incr_dynobj::do_should_include_member): New function.
5503 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5504 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5505 (Sized_incr_dynobj::do_section_size): New function.
5506 (Sized_incr_dynobj::do_section_name): New function.
5507 (Sized_incr_dynobj::do_section_contents): New function.
5508 (Sized_incr_dynobj::do_section_flags): New function.
5509 (Sized_incr_dynobj::do_section_entsize): New function.
5510 (Sized_incr_dynobj::do_section_address): New function.
5511 (Sized_incr_dynobj::do_section_type): New function.
5512 (Sized_incr_dynobj::do_section_link): New function.
5513 (Sized_incr_dynobj::do_section_info): New function.
5514 (Sized_incr_dynobj::do_section_addralign): New function.
5515 (Sized_incr_dynobj::do_initialize_xindex): New function.
5516 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5517 (make_sized_incremental_object): New function.
5518 (Incremental_library::copy_unused_symbols): New function.
5519 (Incremental_library::do_for_all_unused_symbols): New function.
5520 * incremental.h (enum Incremental_input_flags): New type.
5521 (class Incremental_checker): Remove.
5522 (Incremental_input_entry::Incremental_input_entry): Add argument
5523 serial number.
5524 (Incremental_input_entry::arg_serial): New function.
5525 (Incremental_input_entry::set_is_in_system_directory): New function.
5526 (Incremental_input_entry::is_in_system_directory): New function.
5527 (Incremental_input_entry::arg_serial_): New data member.
5528 (Incremental_input_entry::is_in_system_directory_): New data member.
5529 (class Script_info): Move here from script.h.
5530 (Script_info::Script_info): Add filename parameter.
5531 (Script_info::filename): New function.
5532 (Script_info::filename_): New data member.
5533 (Incremental_script_entry::Incremental_script_entry): Add argument
5534 serial number.
5535 (Incremental_object_entry::Incremental_object_entry): Likewise.
5536 (Incremental_object_entry::add_input_section): Build list of input
5537 sections with map to original shndx.
5538 (Incremental_object_entry::get_input_section_index): New function.
5539 (Incremental_object_entry::shndx_): New data member.
5540 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5541 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5542 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5543 serial number.
5544 (Incremental_inputs::report_archive_begin): Likewise.
5545 (Incremental_inputs::report_object): Likewise.
5546 (Incremental_inputs::report_script): Likewise.
5547 (class Incremental_global_symbol_reader): New class.
5548 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5549 and store flags and input file type.
5550 (Incremental_input_entry_reader::arg_serial): New function.
5551 (Incremental_input_entry_reader::type): Extract type from flags.
5552 (Incremental_input_entry_reader::is_in_system_directory): New function.
5553 (Incremental_input_entry_reader::get_input_section_count): Call
5554 accessor function for type.
5555 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5556 function for type; adjust size of global symbol entry.
5557 (Incremental_input_entry_reader::get_global_symbol_count): Call
5558 accessor function for type.
5559 (Incremental_input_entry_reader::get_object_count): Likewise.
5560 (Incremental_input_entry_reader::get_object_offset): Likewise.
5561 (Incremental_input_entry_reader::get_member_count): Likewise.
5562 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5563 (Incremental_input_entry_reader::get_member_offset): Likewise.
5564 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5565 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5566 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5567 (Incremental_input_entry_reader::get_global_symbol_reader): New
5568 function.
5569 (Incremental_input_entry_reader::get_output_symbol_index): New
5570 function.
5571 (Incremental_input_entry_reader::type_): Remove.
5572 (Incremental_input_entry_reader::flags_): New data member.
5573 (Incremental_inputs_reader::input_file_offset): New function.
5574 (Incremental_inputs_reader::input_file_index): New function.
5575 (Incremental_inputs_reader::input_file): Call input_file_offset.
5576 (Incremental_inputs_reader::input_file_at_offset): New function.
5577 (Incremental_relocs_reader::get_r_type): Reformat.
5578 (Incremental_relocs_reader::get_r_shndx): Reformat.
5579 (Incremental_relocs_reader::get_r_offset): Reformat.
5580 (Incremental_relocs_reader::data): New function.
5581 (Incremental_binary::Incremental_binary): Initialize new data members.
5582 (Incremental_binary::check_inputs): Add cmdline parameter.
5583 (Incremental_binary::file_is_unchanged): Remove.
5584 (Input_reader::arg_serial): New function.
5585 (Input_reader::get_unused_symbol_count): New function.
5586 (Input_reader::get_unused_symbol): New function.
5587 (Input_reader::do_arg_serial): New function.
5588 (Input_reader::do_get_unused_symbol_count): New function.
5589 (Input_reader::do_get_unused_symbol): New function.
5590 (Incremental_binary::input_file_count): New function.
5591 (Incremental_binary::get_input_reader): Change signature to use
5592 index instead of filename.
5593 (Incremental_binary::file_has_changed): New function.
5594 (Incremental_binary::get_input_argument): New function.
5595 (Incremental_binary::get_library): New function.
5596 (Incremental_binary::get_script_info): New function.
5597 (Incremental_binary::init_layout): New function.
5598 (Incremental_binary::reserve_layout): New function.
5599 (Incremental_binary::output_file): New function.
5600 (Incremental_binary::do_check_inputs): New function.
5601 (Incremental_binary::do_file_is_unchanged): Remove.
5602 (Incremental_binary::do_file_has_changed): New function.
5603 (Incremental_binary::do_init_layout): New function.
5604 (Incremental_binary::do_reserve_layout): New function.
5605 (Incremental_binary::do_input_file_count): New function.
5606 (Incremental_binary::do_get_input_reader): Change signature.
5607 (Incremental_binary::input_args_map_): New data member.
5608 (Incremental_binary::library_map_): New data member.
5609 (Incremental_binary::script_map_): New data member.
5610 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5611 new data members.
5612 (Sized_incremental_binary::output_section): New function.
5613 (Sized_incremental_binary::inputs_reader): Add const.
5614 (Sized_incremental_binary::symtab_reader): Add const.
5615 (Sized_incremental_binary::relocs_reader): Add const.
5616 (Sized_incremental_binary::got_plt_reader): Add const.
5617 (Sized_incremental_binary::get_symtab_view): New function.
5618 (Sized_incremental_binary::Inputs_reader): New typedef.
5619 (Sized_incremental_binary::Input_entry_reader): New typedef.
5620 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5621 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5622 (Sized_incremental_binary::do_file_has_changed): New function.
5623 (Sized_incremental_binary::do_init_layout): New function.
5624 (Sized_incremental_binary::do_reserve_layout): New function.
5625 (Sized_input_reader::Inputs_reader): Remove.
5626 (Sized_input_reader::Input_entry_reader): Remove.
5627 (Sized_input_reader::do_arg_serial): New function.
5628 (Sized_input_reader::do_get_unused_symbol_count): New function.
5629 (Sized_input_reader::do_get_unused_symbol): New function.
5630 (Sized_incremental_binary::do_input_file_count): New function.
5631 (Sized_incremental_binary::do_get_input_reader): Change signature;
5632 use index instead of filename.
5633 (Sized_incremental_binary::section_map_): New data member.
5634 (Sized_incremental_binary::input_entry_readers_): New data member.
5635 (class Sized_incr_relobj): New class.
5636 (class Sized_incr_dynobj): New class.
5637 (make_sized_incremental_object): New function.
5638 (class Incremental_library): New class.
5639 * layout.cc (Free_list::num_lists): New static data member.
5640 (Free_list::num_nodes): New static data member.
5641 (Free_list::num_removes): New static data member.
5642 (Free_list::num_remove_visits): New static data member.
5643 (Free_list::num_allocates): New static data member.
5644 (Free_list::num_allocate_visits): New static data member.
5645 (Free_list::init): New function.
5646 (Free_list::remove): New function.
5647 (Free_list::allocate): New function.
5648 (Free_list::dump): New function.
5649 (Free_list::print_stats): New function.
5650 (Layout_task_runner::run): Resize output file for incremental updates.
5651 (Layout::Layout): Initialize new data members.
5652 (Layout::set_incremental_base): New function.
5653 (Layout::init_fixed_output_section): New function.
5654 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5655 incremental updates.
5656 (Layout::create_gold_note): Do not create gold note section for
5657 incremental updates.
5658 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5659 for incremental updates.
5660 (Layout::set_section_offsets): For incremental updates, allocate space
5661 from free list.
5662 (Layout::create_symtab_sections): Layout with offsets relative to
5663 start of section; for incremental updates, allocate space from free
5664 list.
5665 (Layout::create_shdrs): For incremental updates, allocate space from
5666 free list.
5667 (Layout::finish_dynamic_section): For incremental updates, do not
5668 check --as-needed (fixed in subsequent patch).
5669 * layout.h (class Free_list): New class.
5670 (Layout::set_incremental_base): New function.
5671 (Layout::incremental_base): New function.
5672 (Layout::init_fixed_output_section): New function.
5673 (Layout::allocate): New function.
5674 (Layout::incremental_base_): New data member.
5675 (Layout::free_list_): New data member.
5676 * main.cc (main): Print Free_list statistics.
5677 * object.cc (Relobj::finalize_incremental_relocs): Add
5678 clear_counts parameter; clear counts only when clear_counts is set.
5679 (Sized_relobj::Sized_relobj): Initialize new base class.
5680 (Sized_relobj::do_layout): Don't report special sections.
5681 (Sized_relobj::do_for_all_local_got_entries): New function.
5682 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5683 symtab_off to all symbol table offsets.
5684 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5685 * object.h (class Got_offset_list): Move to top of file.
5686 (Object::Object): Allow case where input_file == NULL.
5687 (Object::~Object): Likewise.
5688 (Object::input_file): Assert that input_file != NULL.
5689 (Object::lock): Allow case where input_file == NULL.
5690 (Object::unlock): Likewise.
5691 (Object::is_locked): Likewise.
5692 (Object::token): Likewise.
5693 (Object::release): Likewise.
5694 (Object::is_incremental): New function.
5695 (Object::get_mtime): New function.
5696 (Object::for_all_local_got_entries): New function.
5697 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5698 (Object::set_is_in_system_directory): New function.
5699 (Object::is_in_system_directory): New function.
5700 (Object::do_is_incremental): New function.
5701 (Object::do_get_mtime): New function.
5702 (Object::do_for_all_local_got_entries): New function.
5703 (Object::is_in_system_directory_): New data member.
5704 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5705 (class Sized_relobj_base): New class.
5706 (class Sized_relobj): Derive from Sized_relobj_base.
5707 (class Sized_relobj::Symbols): Redeclare from base class.
5708 (class Sized_relobj::local_got_offset_list): Remove.
5709 (class Sized_relobj::Output_sections): Redeclare from base class.
5710 (class Sized_relobj::do_for_all_local_got_entries): New function.
5711 (class Sized_relobj::write_local_symbols): Add offset parameter.
5712 (class Sized_relobj::local_symbol_offset_): Update comment.
5713 (class Sized_relobj::local_dynsym_offset_): Update comment.
5714 * options.cc (Input_arguments::add_file): Remove const.
5715 * options.h (Input_file_argument::Input_file_argument):
5716 Initialize arg_serial_ (all constructors).
5717 (Input_file_argument::set_arg_serial): New function.
5718 (Input_file_argument::arg_serial): New function.
5719 (Input_file_argument::arg_serial_): New data member.
5720 (Input_arguments::Input_arguments): Initialize file_count_.
5721 (Input_arguments::add_file): Remove const.
5722 (Input_arguments::number_of_input_files): New function.
5723 (Input_arguments::file_count_): New data member.
5724 (Command_line::number_of_input_files): Call
5725 Input_arguments::number_of_input_files.
5726 * output.cc (Output_segment_headers::Output_segment_headers):
5727 Set current size.
5728 (Output_section::Input_section::current_data_size): New function.
5729 (Output_section::Output_section): Initialize new data members.
5730 (Output_section::add_input_section): Don't do merge sections for
5731 an incremental link; allocate space from free list for an
5732 incremental update.
5733 (Output_section::add_output_section_data): Allocate space from
5734 free list for an incremental update.
5735 (Output_section::update_data_size): New function.
5736 (Output_section::set_fixed_layout): New function.
5737 (Output_section::reserve): New function.
5738 (Output_segment::set_section_addresses): Remove const.
5739 (Output_segment::set_section_list_addresses): Remove const; allocate
5740 space from free list for an incremental update.
5741 (Output_segment::set_offset): Adjust size of RELRO segment for an
5742 incremental update.
5743 * output.h (Output_data::current_data_size): Move here from
5744 child classes.
5745 (Output_data::pre_finalize_data_size): New function.
5746 (Output_data::update_data_size): New function.
5747 (Output_section_headers::update_data_size): new function.
5748 (Output_section_data_build::current_data_size): Move to Output_data.
5749 (Output_data_strtab::update_data_size): New function.
5750 (Output_section::current_data_size): Move to Output_data.
5751 (Output_section::set_fixed_layout): New function.
5752 (Output_section::has_fixed_layout): New function.
5753 (Output_section::reserve): New function.
5754 (Output_section::update_data_size): New function.
5755 (Output_section::has_fixed_layout_): New data member.
5756 (Output_section::free_list_): New data member.
5757 (Output_segment::set_section_addresses): Remove const.
5758 (Output_segment::set_section_list_addresses): Remove const.
5759 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5760 New function.
5761 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5762 New function.
5763 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5764 parameter when calling Add_symbols constructor; store argument
5765 serial number for members of a lib group.
5766 (Add_symbols::locks): Allow case where token == NULL.
5767 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5768 (Read_member::~Read_member): New function.
5769 (Read_member::is_runnable): New function.
5770 (Read_member::locks): New function.
5771 (Read_member::run): New function.
5772 (Check_script::~Check_script): New function.
5773 (Check_script::is_runnable): New function.
5774 (Check_script::locks): New function.
5775 (Check_script::run): New function.
5776 (Check_library::~Check_library): New function.
5777 (Check_library::is_runnable): New function.
5778 (Check_library::locks): New function.
5779 (Check_library::run): New function.
5780 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5781 (Add_symbols::library_): New data member.
5782 (class Read_member): New class.
5783 (class Check_script): New class.
5784 (class Check_library): New class.
5785 * reloc.cc (Read_relocs::is_runnable): Allow case where
5786 token == NULL.
5787 (Read_relocs::locks): Likewise.
5788 (Scan_relocs::locks): Likewise.
5789 (Relocate_task::locks): Likewise.
5790 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5791 to clear counters.
5792 (Sized_relobj::incremental_relocs_scan): Fix comment.
5793 (Sized_relobj::do_relocate): Pass output file offset to
5794 write_local_symbols.
5795 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5796 from class declaration.
5797 * script.cc (read_input_script): Allocate Script_info; pass
5798 argument serial number to report_script.
5799 * script.h (class Script_info): Move to incremental.h.
5800 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5801 * symtab.h (Symbol_table::add_from_incrobj): New function.
5802 (Symbol_table::set_file_offset): New function.
5803
5804 2011-04-05 Cary Coutant <ccoutant@google.com>
5805
5806 * incremental-dump.cc (dump_incremental_inputs): Change signature
5807 to take a Sized_incremental_binary; change caller. Use readers
5808 in Sized_incremental_binary.
5809 * incremental.cc
5810 (Sized_incremental_binary::find_incremental_inputs_sections):
5811 Rename do_find_incremental_inputs_sections to this.
5812 (Sized_incremental_binary::setup_readers): New function.
5813 (Sized_incremental_binary::do_check_inputs): Check
5814 has_incremental_info_ flag; move setup code to setup_readers;
5815 use input readers.
5816 (Sized_incremental_binary::do_file_is_unchanged): New function.
5817 (Sized_incremental_binary::do_get_input_reader): New function.
5818 * incremental.h (class Incremental_binary): Move to end of file.
5819 (Incremental_binary::file_is_unchanged): New function.
5820 (Incremental_binary::do_file_is_unchanged): New function.
5821 (Incremental_binary::Input_reader): New class.
5822 (Incremental_binary::get_input_reader): New function.
5823 (class Sized_incremental_binary): Move to end of file.
5824 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5825 input section reader classes.
5826 (Sized_incremental_binary::has_incremental_info): New function.
5827 (Sized_incremental_binary::inputs_reader): New function.
5828 (Sized_incremental_binary::symtab_reader): New function.
5829 (Sized_incremental_binary::relocs_reader): New function.
5830 (Sized_incremental_binary::got_plt_reader): New function.
5831 (Sized_incremental_binary::do_file_is_unchanged): New function.
5832 (Sized_incremental_binary::Sized_input_reader): New class.
5833 (Sized_incremental_binary::get_input_reader): New function.
5834 (Sized_incremental_binary::find_incremental_inputs_sections):
5835 Rename do_find_incremental_inputs_sections to this.
5836 (Sized_incremental_binary::setup_readers): New function.
5837 (Sized_incremental_binary::has_incremental_info_): New data member.
5838 (Sized_incremental_binary::inputs_reader_): New data member.
5839 (Sized_incremental_binary::symtab_reader_): New data member.
5840 (Sized_incremental_binary::relocs_reader_): New data member.
5841 (Sized_incremental_binary::got_plt_reader_): New data member.
5842 (Sized_incremental_binary::current_input_file_): New data member.
5843
5844 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5845
5846 PR gold/12640
5847 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5848 violation.
5849
5850 2011-03-30 Cary Coutant <ccoutant@google.com>
5851
5852 * archive.cc (Archive::include_member): Adjust call to report_object.
5853 (Add_archive_symbols::run): Add script_info to call to
5854 report_archive_begin.
5855 (Lib_group::include_member): Adjust call to report_object.
5856 (Add_lib_group_symbols::run): Adjust call to report_object.
5857 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5858 blocks. Add object count for script input files.
5859 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5860 script_info parameter; change all callers.
5861 (Incremental_inputs::report_object): Add script_info parameter;
5862 change all callers.
5863 (Incremental_inputs::report_script): Store backpointer to
5864 incremental info entry.
5865 (Output_section_incremental_inputs::set_final_data_size): Record
5866 additional information for scripts.
5867 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5868 * incremental.h (Incremental_script_entry::add_object): New function.
5869 (Incremental_script_entry::get_object_count): New function.
5870 (Incremental_script_entry::get_object): New function.
5871 (Incremental_script_entry::objects_): New data member; adjust
5872 constructor.
5873 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5874 (Incremental_inputs::report_object): Add script_info parameter.
5875 (Incremental_inputs_reader::get_object_count): New function.
5876 (Incremental_inputs_reader::get_object_offset): New function.
5877 * options.cc (Input_arguments::add_file): Return reference to
5878 new input argument.
5879 * options.h (Input_argument::set_script_info): New function.
5880 (Input_argument::script_info): New function.
5881 (Input_argument::script_info_): New data member; adjust all
5882 constructors.
5883 (Input_file_group::add_file): Return reference to new input argument.
5884 (Input_file_lib::add_file): Likewise.
5885 (Input_arguments::add_file): Likewise.
5886 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5887 * script.cc (Parser_closure::Parser_closure): Add script_info
5888 parameter; adjust all callers.
5889 (Parser_closure::script_info): New function.
5890 (Parser_closure::script_info_): New data member.
5891 (read_input_script): Report scripts earlier to incremental info.
5892 (script_add_file): Set script_info in Input_argument.
5893 (script_add_library): Likewise.
5894 * script.h (Script_options::Script_info): Rewrite class.
5895
5896 2011-03-29 Cary Coutant <ccoutant@google.com>
5897
5898 * archive.cc (Library_base::should_include_member): Move
5899 method here from class Archive.
5900 (Archive::Archive): Initialize base class.
5901 (Archive::should_include_member): Move to base class.
5902 (Archive::do_for_all_unused_symbols): New function.
5903 (Add_archive_symbols::run): Remove redundant access to
5904 incremental_inputs.
5905 (Lib_group::Lib_group): Initialize base class.
5906 (Lib_group::do_filename): New function.
5907 (Lib_group::include_member): Pass pointer to Lib_group to
5908 report_object.
5909 (Lib_group::do_for_all_unused_symbols): New function.
5910 (Add_lib_group_symbols::run): Report archive information for
5911 incremental links.
5912 * archive.h (class Library_base): New base class.
5913 (class Archive): Derive from Library_base.
5914 (Archive::filename): Move to base class.
5915 (Archive::set_incremental_info): Likewise.
5916 (Archive::incremental_info): Likewise.
5917 (Archive::Should_include): Likewise.
5918 (Archive::should_include_member): Likewise.
5919 (Archive::Armap_entry): Remove.
5920 (Archive::Unused_symbol_iterator): Remove.
5921 (Archive::unused_symbols_begin): Remove.
5922 (Archive::unused_symbols_end): Remove.
5923 (Archive::do_filename): New function.
5924 (Archive::do_get_mtime): New function.
5925 (Archive::do_for_all_unused_symbols): New function.
5926 (Archive::task_): Move to base class.
5927 (Archive::incremental_info_): Likewise.
5928 (class Lib_group): Derive from Library_base.
5929 (Lib_group::do_filename): New function.
5930 (Lib_group::do_get_mtime): New function.
5931 (Lib_group::do_for_all_unused_symbols): New function.
5932 (Lib_group::task_): Move to base class.
5933 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5934 function.
5935 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5936 function.
5937 * incremental.cc (Incremental_inputs::report_archive_begin):
5938 Use Library_base; call library's get_mtime; add incremental inputs
5939 entry before members.
5940 (class Unused_symbol_visitor): New class.
5941 (Incremental_inputs::report_archive_end): Use Library_base; use
5942 visitor class to record unused symbols; don't add incremental inputs
5943 entry after members.
5944 (Incremental_inputs::report_object): Use Library_base.
5945 * incremental.h
5946 (Incremental_archive_entry::Incremental_archive_entry): Remove
5947 unused Archive parameter.
5948 (Incremental_inputs::report_archive_begin): Use Library_base.
5949 (Incremental_inputs::report_archive_end): Likewise.
5950 (Incremental_inputs::report_object): Likewise.
5951 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5952 function.
5953 * object.h (Object::for_all_global_symbols): New function.
5954 (Object::do_for_all_global_symbols): New function.
5955 (Sized_relobj::do_for_all_global_symbols): New function.
5956 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5957 function.
5958 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5959 function.
5960
5961 2011-03-27 Ian Lance Taylor <iant@google.com>
5962
5963 * archive.cc (Archive::interpret_header): Return -1 if something
5964 goes wrong. Change callers accordingly.
5965
5966 2011-03-25 Cary Coutant <ccoutant@google.com>
5967
5968 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5969 * testsuite/Makefile.in: Regenerate.
5970
5971 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5972
5973 * plugin.cc (get_view): New.
5974 (Plugin::load): Pass get_view to the plugin.
5975 (Plugin_manager::get_view): New.
5976
5977 2011-03-21 Ian Lance Taylor <iant@google.com>
5978
5979 * testsuite/final_layout.sh: Rewrite to not use dc.
5980 * testsuite/relro_test.sh: Fail if dc is not present.
5981
5982 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5983
5984 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5985 Change == to -eq.
5986 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5987 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5988 Change == to -eq.
5989 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5990 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5991
5992 2011-03-14 Ian Lance Taylor <iant@google.com>
5993
5994 * script-sections.cc (Sort_output_sections::script_compare):
5995 Rename from is_before, change return type.
5996 (Sort_output_sections::operator()): Adjust accordingly.
5997
5998 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5999
6000 PR gold/12572
6001 * testsuite/odr_violation2.cc: Add comment to make all error line
6002 numbers double digits.
6003 * testsuite/debug_msg.sh: Adjust expected errors.
6004
6005 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6006
6007 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6008 but mark earlier ones as non-canonical
6009 (offset_to_iterator): Update search target and example
6010 (do_addr2line): Return extra lines in a vector*
6011 (format_file_lineno): Extract from do_addr2line
6012 (one_addr2line): Add vector* out-param
6013 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6014 when a lineno entry appeared last for its instruction
6015 (Dwarf_line_info): Add vector* out-param
6016 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6017 * symtab.cc (Odr_violation_compare): Include the lineno in the
6018 comparison again.
6019 (linenos_from_loc): New. Combine the canonical line for an
6020 address with its other lines.
6021 (True_if_intersect): New. Helper functor to make
6022 std::set_intersection a query.
6023 (detect_odr_violations): Compare sets of lines instead of just
6024 one line for each function. This became less deterministic, but
6025 has fewer false positives.
6026 * symtab.h: Declarations.
6027 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6028 mix an optimized and non-optimized object in the same binary
6029 (odr_violation2.so): Same.
6030 * testsuite/Makefile.in: Regenerate from Makefile.am.
6031 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6032 * testsuite/debug_msg.sh: Update line numbers and add
6033 assertions.
6034 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6035 non-optimized context.
6036 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6037 isn't inlined, and use OdrDerived in an optimized context.
6038 * testsuite/odr_header1.h: Defines OdrDerived, where
6039 optimization will change the
6040 first-instruction-in-the-destructor's file and line number.
6041 * testsuite/odr_header2.h: Defines OdrBase.
6042
6043 2011-03-09 Ian Lance Taylor <iant@google.com>
6044
6045 * fileread.cc (File_read::clear_views): Don't delete the whole
6046 file view.
6047
6048 2011-03-08 Ian Lance Taylor <iant@google.com>
6049
6050 PR gold/12525
6051 * fileread.cc: #include <climits>.
6052 (GOLD_IOV_MAX): Define.
6053 (File_read::read_multiple): Limit number of entries by iov_max.
6054 * fileread.h (class File_read): Always set max_readv_entries to
6055 128.
6056
6057 2011-03-07 Ian Lance Taylor <iant@google.com>
6058
6059 PR gold/12525
6060 * options.h (class General_options): Add -dy and -dn.
6061
6062 2011-03-02 Cary Coutant <ccoutant@google.com>
6063
6064 * testsuite/script_test_9.t: Add TLS segment.
6065
6066 2011-03-02 Simon Baldwin <simonb@google.com>
6067
6068 * configure.ac: Add check for gnu_indirect_function support in
6069 the toolchain building binutils.
6070 * configure: Rebuild.
6071
6072 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6073
6074 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6075 plugin only symbols.
6076 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6077 in plugin files as not needed in the symbol table.
6078
6079 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6080
6081 * output.cc (Output_section::add_input_section): Delay fill
6082 generation for section ordering.
6083
6084 2011-02-09 Ian Lance Taylor <iant@google.com>
6085
6086 PR gold/12316
6087 * object.h (class Sized_relobj): Remove clear_local_symbols.
6088 * reloc.cc (Sized_relobj::do_relocate): Don't call
6089 clear_local_symbols.
6090
6091 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6092
6093 * plugin.cc (is_visible_from_outside): Return true for symbols
6094 in the -u option.
6095
6096 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6097
6098 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6099 filename.
6100
6101 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6102
6103 * icf.h (is_section_foldable_candidate): Change type of parameter
6104 to std::string.
6105 * icf.cc (Icf::find_identical_sections): Change type of local variable
6106 section_name to be std::string.
6107 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6108
6109 2011-01-25 Ian Lance Taylor <iant@google.com>
6110
6111 * script.cc (script_add_extern): Rewrite to use
6112 add_symbol_reference.
6113
6114 2011-01-25 Doug Kwan <dougkwan@google.com>
6115
6116 * icf.cc (get_section_contents): Always lock section's object.
6117
6118 2011-01-24 Ian Lance Taylor <iant@google.com>
6119
6120 * options.h (class General_options): Accept
6121 --no-detect-odr-violations.
6122
6123 2011-01-24 Ian Lance Taylor <iant@google.com>
6124
6125 * version.cc (version_string): Bump to 1.11.
6126
6127 2011-01-24 Ian Lance Taylor <iant@google.com>
6128
6129 * plugin.cc (class Plugin_rescan): Define new class.
6130 (Plugin_manager::claim_file): Set any_claimed_.
6131 (Plugin_manager::save_archive): New function.
6132 (Plugin_manager::save_input_group): New function.
6133 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6134 necessary.
6135 (Plugin_manager::new_undefined_symbol): New function.
6136 (Plugin_manager::rescan): New function.
6137 (Plugin_manager::rescannable_defines): New function.
6138 (Plugin_manager::add_input_file): Set any_added_.
6139 * plugin.h (class Plugin_manager): define new fields rescannable_,
6140 undefined_symbols_, any_claimed_, and any_added_. Declare
6141 Plugin_rescan as friend. Declare new functions.
6142 (Plugin_manager::Rescannable): Define type.
6143 (Plugin_manager::Rescannable_list): Define type.
6144 (Plugin_manager::Undefined_symbol_list): Define type.
6145 (Plugin_manager::Plugin_manager): Initialize new fields.
6146 * archive.cc (Archive::defines_symbol): New function.
6147 (Add_archive_symbols::run): Pass archive to plugins if any.
6148 * archive.h (class Archive): Declare defines_symbol.
6149 * readsyms.cc (Input_group::~Input_group): New function.
6150 (Finish_group::run): Pass input_group to plugins if any.
6151 * readsyms.h (class Input_group): Declare destructor.
6152 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6153 any.
6154
6155 2011-01-10 Ian Lance Taylor <iant@google.com>
6156
6157 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6158 section as relro.
6159 (Layout::set_segment_offsets): Reset increase_relro before calling
6160 set_section_addresses a second time.
6161
6162 2011-01-04 Cary Coutant <ccoutant@google.com>
6163
6164 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6165 sections before NOBITS sections.
6166
6167 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6168
6169 * version.cc (print_version): Update copyright to 2011.
6170
6171 2010-12-23 Cary Coutant <ccoutant@google.com>
6172
6173 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6174 of OS to this->add. Add OD parameter to second form of the function.
6175
6176 2010-12-20 Ian Lance Taylor <iant@google.com>
6177
6178 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6179 second of two consecutive entries with same offset.
6180
6181 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6182
6183 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6184 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6185 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6186 to avoid unneeded links against $(LDADD).
6187 * testsuite/Makefile.in: Regenerate.
6188
6189 2010-12-15 Ian Lance Taylor <iant@google.com>
6190
6191 PR gold/12324
6192 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6193 for R_X86_64_32 and R_X86_64_PC32.
6194 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6195 ver_matching_def_pic.o.
6196 (ver_matching_def_pic.o): New target.
6197
6198 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6199
6200 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6201 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6202 Move definition before File_read::View member definitions.
6203 (File_read::View::~View): Initialize and hold lock before
6204 updating current_mapped_bytes.
6205
6206 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6207
6208 * dwarf_reader.cc: Remove outdated comment.
6209 * gold-threads.cc: Fix typo in error message.
6210 * archive.cc: Fix typos in comments.
6211 * archive.h: Likewise.
6212 * arm-reloc-property.cc: Likewise.
6213 * arm-reloc-property.h: Likewise.
6214 * arm-reloc.def: Likewise.
6215 * arm.cc: Likewise.
6216 * attributes.h: Likewise.
6217 * cref.cc: Likewise.
6218 * ehframe.cc: Likewise.
6219 * fileread.h: Likewise.
6220 * gold.h: Likewise.
6221 * i386.cc: Likewise.
6222 * icf.cc: Likewise.
6223 * incremental.h: Likewise.
6224 * int_encoding.cc: Likewise.
6225 * layout.h: Likewise.
6226 * main.cc: Likewise.
6227 * merge.h: Likewise.
6228 * object.cc: Likewise.
6229 * object.h: Likewise.
6230 * options.cc: Likewise.
6231 * readsyms.cc: Likewise.
6232 * reduced_debug_output.cc: Likewise.
6233 * reloc.cc: Likewise.
6234 * script-sections.cc: Likewise.
6235 * sparc.cc: Likewise.
6236 * symtab.h: Likewise.
6237 * target-reloc.h: Likewise.
6238 * target.cc: Likewise.
6239 * target.h: Likewise.
6240 * timer.cc: Likewise.
6241 * timer.h: Likewise.
6242 * x86_64.cc: Likewise.
6243
6244 2010-12-09 Cary Coutant <ccoutant@google.com>
6245
6246 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6247 stack.
6248 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6249 parameter; change all callers.
6250 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6251 * options.h (warn_execstack): New option.
6252
6253 2010-12-07 Doug Kwan <dougkwan@google.com>
6254
6255 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6256 like function call relocations.
6257
6258 2010-12-07 Ian Lance Taylor <iant@google.com>
6259
6260 * archive.cc (Archive::get_elf_object_for_member): Permit
6261 punconfigured to be NULL.
6262 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6263 (Archive::include_member): Pass NULL to get_elf_object_for_member
6264 if we searched for the archive and this is the first included
6265 object.
6266
6267 2010-12-01 Ian Lance Taylor <iant@google.com>
6268
6269 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6270 track_relocs_type_ field.
6271 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6272 Set track_relocs_type_.
6273 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6274 contents when using RELA relocs.
6275 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6276 reloc_map_.
6277 * reloc.cc (Track_relocs::next_addend): New function.
6278 * reloc.h (class Track_relocs): Declare next_addend.
6279
6280 2010-12-01 Ian Lance Taylor <iant@google.com>
6281
6282 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6283 virtual destructor.
6284
6285 2010-12-01 Ian Lance Taylor <iant@google.com>
6286
6287 * README: Update compilers known to work and fail.
6288
6289 2010-11-23 Matthias Klose <doko@ubuntu.com>
6290
6291 * configure.in: For --enable-gold, handle value `default' instead of
6292 `both*'. Always install ld as ld.bfd, install as ld if gold is
6293 not the default.
6294 * configure: Regenerate.
6295
6296 2010-11-18 Doug Kwan <dougkwan@google.com>
6297
6298 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6299 and right_alignment to be zero. Store result alignment only if it is
6300 greater than existing alignment.
6301
6302 2010-11-16 Cary Coutant <ccoutant@google.com>
6303
6304 PR gold/12220
6305 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6306 Check for ".zdebug_line".
6307
6308 2010-11-16 Doug Kwan <dougkwan@google.com>
6309 Cary Coutant <ccoutant@google.com>
6310
6311 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6312 by reference; adjust all callers.
6313 * output.cc (Output_segment::set_section_addresses): Adjust references
6314 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6315 list is empty.
6316 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6317 end at page boundary.
6318
6319 2010-11-16 Cary Coutant <ccoutant@google.com>
6320
6321 PR gold/12220
6322 * layout.cc (Layout::choose_output_section): Transform names of
6323 compressed sections even when using a script with a SECTIONS clause.
6324 (Layout::output_section_name): Remove code to transform
6325 compressed debug section names.
6326 * output.cc (Output_section::add_input_section): Use uncompressed
6327 section size when tracking input sections.
6328
6329 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6330
6331 * symtab.h (Symbol::NON_PIC_REF): Remove.
6332 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6333 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6334 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6335 (Symbol::use_plt_offset): Take a flags argument and pass it
6336 directly to needs_dynamic_reloc. Restrict check for undefined
6337 weak symbols to function calls.
6338 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6339 (Target_arm::Scan::global): Use it.
6340 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6341 (Target_arm::Relocate::relocate): Likewise.
6342 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6343 parameter with an r_type parameter. Use get_reference_flags
6344 to get the flags.
6345 (Target_arm::Relocate::relocate): Update accordingly.
6346 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6347 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6348 (Target_i386::Scan::global): Likewise.
6349 (Target_i386::Relocate::relocate): Likewise.
6350 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6351 parameter with an r_type parameter. Use get_reference_flags
6352 to get the flags.
6353 (Target_i386::Relocate::relocate): Update accordingly.
6354 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6355 (Target_powerpc::Scan::global): Use it.
6356 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6357 (Target_powerpc::Relocate::relocate): Likewise.
6358 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6359 (Target_sparc::Scan::global): Use it.
6360 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6361 (Target_sparc::Relocate::relocate): Likewise.
6362 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6363 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6364 (Target_x86_64::Scan::global): Likewise.
6365 (Target_x86_64::Relocate::relocate): Likewise.
6366
6367 2010-11-08 Doug Kwan <dougkwan@google.com>
6368 Cary Coutant <ccoutant@google.com>
6369
6370 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6371 (Arm_exidx_merge_section::section_contents_): New data member.
6372 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6373 (Arm_input_section::~Arm_input_section): De-allocate memory.
6374 (Arm_input_section::original_contents_): New data member.
6375 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6376 in parameters instead of calling Object::section_contents without
6377 locking.
6378 (Arm_output_section::group_section): New parameter TASK. Pass it
6379 to callees that need locking objects.
6380 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6381 to lock EXIDX input sections. Fix a formatting issue. Call
6382 Arm_exidx_merged_section::build_contents to create merged section
6383 contents.
6384 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6385 to lock object of stub table owner.
6386 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6387 TEXT_SIZE to initialize data member TEXT_SIZE_.
6388 (Arm_exidx_input_section::addralign): Fix typo in comment.
6389 (Arm_exidx_input_section::text_size): New method.
6390 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6391 that require locking objects. Lock objects before scanning for stubs
6392 and updating local symbols.
6393 (Arm_input_section<big_endian>::init): Copy contents of original
6394 input section.
6395 (Arm_input_section<big_endian>::do_write): Use saved contents of
6396 original input section instead of calling Object::section_contents
6397 without locking.
6398 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6399 size without calling Object::section_size().
6400 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6401 for size. Allocate a buffer for merged EXIDX entries.
6402 (Arm_exidx_merged_section::build_contents): New method.
6403 (Arm_exidx_merged_section::do_write): Move merge section contents
6404 building code to Arm_exidx_merged_section::build_contetns. Write
6405 out contetns in buffer instead of building it on the fly.
6406 (Arm_relobj::make_exidx_input_section): Also pass text section size
6407 to Arm_exidx_input_section constructor.
6408 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6409 (Arm_dynobj::do_read_symbols): Fix memory leak.
6410 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6411 * target.h: (class Task): Add forward declaration.
6412 (Target::relax): Add new parameter TASK and pass it to
6413 Target::do_relax().
6414 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6415
6416 2010-11-05 Cary Coutant <ccoutant@google.com>
6417
6418 PR gold/10708
6419 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6420 object when reading from the file.
6421 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6422 second layout pass.
6423 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6424 when reading section contents.
6425 (get_section_contents): Likewise.
6426 (icf::find_identical_sections): Likewise.
6427 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6428 object when reading from the file.
6429 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6430 the object when doing deferred section layout.
6431
6432 2010-11-03 Nick Clifton <nickc@redhat.com>
6433
6434 PR gold/12001
6435 * script.h (class Symbol_assignment: name): New member. Returns
6436 the name of the symbol.
6437 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6438 Returns true if the given symbol name is on the list of
6439 assignments wating to be processed.
6440 * archive.cc (should_incldue_member): If the symbol is undefined,
6441 check to see if it is on the list of symbols pending assignment.
6442
6443 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6444
6445 * script-sections.cc (Script_sections::find_memory_region): Check
6446 for a NULL output section pointer.
6447
6448 2010-10-29 Doug Kwan <dougkwan@google.com>
6449
6450 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6451 Output_section::add_relaxed_input_section.
6452 * output.cc (Output_section::add_relaxed_input_section): Add new
6453 arguments LAYOUT and NAME. Set section order index.
6454 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6455 Copy section order index.
6456 * output.h (Output_section::add_relaxed_input_section): Add new
6457 arguments LAYOUT and NAME.
6458
6459 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6460
6461 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6462 NATIVE_OR_CROSS_LINKER.
6463 * testsuite/Makefile.in: Regenerate.
6464
6465 2010-10-20 Doug Kwan <dougkwan@google.com>
6466
6467 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6468 without SHF_LINK_ORDER flags.
6469 * layout.cc (Layout::choose_output_section): Do not filter
6470 SHF_LINK_ORDER flag in a relocatable link.
6471
6472 2010-10-17 Cary Coutant <ccoutant@google.com>
6473
6474 * output.h (Output_segment::set_section_addresses): Change function
6475 signature. Update all callers.
6476 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6477 sections.
6478 (Output_segment::set_section_addresses): Align after last TLS
6479 section. Add padding before last relro section instead of after.
6480
6481 2010-10-17 Doug Kwan <dougkwan@google.com>
6482
6483 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6484 GOT output section to be writable.
6485
6486 2010-10-14 Cary Coutant <ccoutant@google.com>
6487
6488 * debug.h (DEBUG_INCREMENTAL): New flag.
6489 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6490 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6491 mode.
6492 * incremental.cc (report_command_line): Ignore all forms of
6493 --incremental.
6494 * layout.cc (Layout::Layout): Check parameters for incremental link
6495 mode.
6496 * options.cc (General_options::parse_incremental): New function.
6497 (General_options::parse_no_incremental): New function.
6498 (General_options::parse_incremental_full): New function.
6499 (General_options::parse_incremental_update): New function.
6500 (General_options::incremental_mode_): New data member.
6501 (General_options::finalize): Check incremental_mode_.
6502 * options.h (General_options): Update help text for --incremental.
6503 Add --no-incremental, --incremental-full, --incremental-update.
6504 (General_options::Incremental_mode): New enum type.
6505 (General_options::incremental_mode): New function.
6506 (General_options::incremental_mode_): New data member.
6507 * parameters.cc (Parameters::incremental_mode_): New data member.
6508 (Parameters::set_options): Set incremental_mode_.
6509 (Parameters::set_incremental_full): New function.
6510 (Parameters::incremental): New function.
6511 (Parameters::incremental_update): New function.
6512 (set_parameters_incremental_full): New function.
6513 * parameters.h (Parameters::set_incremental_full): New function.
6514 (Parameters::incremental): New function.
6515 (Parameters::incremental_update): New function.
6516 (Parameters::incremental_mode_): New data member.
6517 (set_parameters_incremental_full): New function.
6518 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6519 incremental link mode.
6520 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6521 (Sized_relobj::do_relocate_sections): Likewise.
6522 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6523 option.
6524 * testsuite/Makefile.in: Regenerate.
6525 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6526
6527 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6528
6529 * script-sections.h (class Script_sections): Make
6530 Sections_elements typedef public.
6531 * script-sections.cc (class Sort_output_sections): Add elements_
6532 field. Add constructor which sets it; change all callers.
6533 (Sort_output_sections::is_before): New function.
6534 (Sort_output_sections::operator()): Call is_before.
6535 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6536 conditional.
6537 * testsuite/script_test_10.sh: New test. Test script section
6538 order.
6539 * testsuite/script_test_10.t: Likewise.
6540 * testsuite/script_test_10.s: Likewise.
6541 * testsuite/Makefile.am: Wrap the cross linker tests and the
6542 common tests into NATIVE_OR_CROSS_LINKER.
6543 (check_SCRIPTS): Add script_test_10.sh.
6544 (check_DATA): Add script_test_10.stdout.
6545 (script_test_10.o, script_test_10): New targets.
6546 (script_test_10.stdout): New target.
6547 * configure, testsuite/Makefile.in: Regenerate.
6548
6549 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6550
6551 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6552 error for the deprecated relocations.
6553 (Target_arm::Scan::global): Likewise.
6554 (Target_arm::Relocate::relocate): Likewise.
6555
6556 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6557
6558 * fileread.cc (Input_file::find_file): Initialize *found_name
6559 and *namep when using the fallback search for case 4.
6560
6561 2010-10-11 Cary Coutant <ccoutant@google.com>
6562
6563 * options.h (class General_options): Redefine -z lazy as an alias for
6564 the negation of -z now.
6565
6566 2010-10-11 Ian Lance Taylor <iant@google.com>
6567
6568 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6569 binding.
6570
6571 2010-10-06 Nick Clifton <nickc@redhat.com>
6572
6573 * script-sections.cc(class Memory_region): Remove
6574 current_lma_offset_ field. Rename current_vma_offset_ to
6575 current_offset_. Add last_section_ field.
6576 (Memory_region::get_current_vma_address): Rename to
6577 get_current_address.
6578 (Memory_region::get_current_lma_address): Delete.
6579 (Memory_region::increment_vma_offset): Rename to
6580 increment_offset.
6581 (Memory_region::increment_lma_offset): Delete.
6582 (Memory_region::attributes_compatible): New method. Returns
6583 true if the provided section is compatible with the region.
6584 (Memory_region::get_last_section): New method. Returns the last
6585 section to use the region.
6586 (Memory_region::set_last_section): New method. Stores the last
6587 section to use the region.
6588 (Script_sections::block_in_region): New method. Returns true if
6589 a block of memory is contained within a region.
6590 (Script_sections::find_memory_region): New method. Locates a
6591 memory region to be used to set a VMA or LMA address.
6592 (Output_section_definition::set_section_addresses): Add code to
6593 check for addresses set by memory regions.
6594 (Output_segment::set_section_addresses): Remove memory region
6595 walking code.
6596 (Script_sections::create_segment): Add a warning if a header
6597 segment is created outside of any region.
6598 * script-sections.h (class Script_sections): Add prototypes for
6599 find_memory_region and block_in_region methods.
6600 * testsuite/memory_test.s: Use .long instead of .word.
6601 * testsuite/memory_test.t: Add some more output sections.
6602 * testsuite/memory_test.sh: Update expected output.
6603
6604 2010-10-02 Doug Kwan <dougkwan@google.com>
6605
6606 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6607 defintion to symtab.h
6608 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6609 declaration to defintion.
6610
6611 2010-10-01 Nick Clifton <nickc@redhat.com>
6612
6613 * expression.cc (eval): Replace dummy argument with NULL.
6614 (eval_maybe_dot): Check for a NULL result section pointer.
6615 (Symbol_expression::value): Likewise.
6616 (Dot_expression::value): Likewise.
6617 (BINARY_EXPRESSION): Likewise.
6618 (Max_expression::value): Likewise.
6619 (Min_expression::value): Likewise.
6620 (Absolute_expression::value): Likewise.
6621 (Addr_expression::value_from_output_section): Likewise.
6622 (Loaddddr_expression::value_from_output_section): Likewise.
6623 (Segment_start_expression::value): Likewise.
6624 * script-sections.cc
6625 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6626 argument with NULL.
6627 (Sections_elememt_dot_assignment::set_section_addresses):
6628 Likewise.
6629 (Output_data_expression::do_write_to_buffer): Likewise.
6630 (Output_section_definition::finalize_symbols): Likewise.
6631 (Output_section_definition::set_section_addresses): Likewise.
6632
6633 2010-09-30 Doug Kwan <dougkwan@google.com>
6634
6635 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6636
6637 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6638
6639 * target.h (Target::can_icf_inline_merge_sections): New virtual
6640 function.
6641 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6642 virtual function.
6643 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6644 virtual function.
6645 * icf.cc (get_section_contents): Inline merge sections only when
6646 target allows it.
6647
6648 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6649
6650 * configure: Regenerate.
6651
6652 2010-09-17 Ian Lance Taylor <iant@google.com>
6653
6654 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6655 * testsuite/Makefile.am (memory_test.o): New target.
6656 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6657 memory_test.t.
6658 * testsuite/Makefile.in: Rebuild.
6659
6660 2010-09-17 Doug Kwan <dougkwan@google.com>
6661
6662 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6663 defintion if relocation uses GOT entries of the symbol.
6664 * testsuite/icf_safe_test.sh: Fix test.
6665 * testsuite/icf_safe_so_test.sh: Fix test.
6666
6667 2010-09-16 Cary Coutant <ccoutant@google.com>
6668
6669 * script_sections.cc (class Memory_region): Remove "NULL" from
6670 vector initializations.
6671
6672 2010-09-15 Cary Coutant <ccoutant@google.com>
6673
6674 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6675 Resolve forwarding symbols.
6676
6677 2010-09-15 Doug Kwan <dougkwan@google.com>
6678
6679 * gold/testsuite/script_test_3.t: Add ARM special sections.
6680 * gold/testsuite/script_test_4.t: Same.
6681 * gold/testsuite/script_test_5.t: Same.
6682 * gold/testsuite/script_test_6.t: Same.
6683 * gold/testsuite/script_test_7.t: Same.
6684 * gold/testsuite/script_test_7.t: Same.
6685 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6686
6687 2010-09-14 Cary Coutant <ccoutant@google.com>
6688
6689 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6690 (Target_x86_64::Relocate::relocate_tls): Replace check for
6691 saw_tls_block_reloc_ with test for executable section.
6692
6693 2010-09-12 Cary Coutant <ccoutant@google.com>
6694
6695 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6696 position-independent executables to shared libraries need dynamic
6697 relocations.
6698 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6699 position-independent executables.
6700 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6701 * testsuite/Makefile.in: Regenerate.
6702
6703 2010-09-10 Nick Clifton <nickc@redhat.com>
6704
6705 PR gold/11997
6706 * testsuite/memory_test.t: Discard any sections that are not
6707 needed.
6708
6709 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6710
6711 PR gold/11996
6712 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6713 "This::" to work around a bug in gcc 4.2.
6714
6715 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6716
6717 2010-09-09 Rafael Espindola <espindola@google.com>
6718
6719 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6720 sections with different PF_X flags in the same segment.
6721 (Layout::find_first_load_seg): Search all segments to find the first
6722 one.
6723 * options.h (rosegment): New.
6724
6725 2010-09-08 Rafael Espindola <espindola@google.com>
6726
6727 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6728
6729 2010-09-08 Doug Kwan <dougkwan@google.com>
6730
6731 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6732 (Arm_relobj::do_relocate_sections): Add new parameter for output
6733 file to match the parent.
6734 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6735 of local symbols instead of input values. Update code to track
6736 changes in gold::relocate_section.
6737 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6738 (Sized_relobj::compute_final_local_value_internal): New methods.
6739 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6740 body into private version of Sized_relobj::compute_final_local_value.
6741 Call the inline method.
6742 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6743 merged symbol value if there is one.
6744 (Symbol_value::has_output_value): New method defintiion.
6745 (Sized_relobj::Compute_final_local_value_status): New enum type.
6746 (Sized_relobj::compute_final_local_value): New methods.
6747 (Sized_relobj::compute_final_local_value_internal): New methods.
6748 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6749 and arm_cortex_a8.sh.
6750 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6751 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6752 New tests.
6753 * Makefile.in: Regenerate.
6754 * testsuite/arm_bl_out_of_range.s: Update test.
6755 * testsuite/thumb_bl_out_of_range.s: Ditto.
6756 * testsuite/thumb_blx_out_of_range.s: Ditto.
6757 * testsuite/arm_branch_out_of_range.sh: New file.
6758 * testsuite/arm_cortex_a8.sh: Ditto.
6759 * testsuite/arm_cortex_a8_b.s: Ditto.
6760 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6761 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6762 * testsuite/arm_cortex_a8_bl.s: Ditto.
6763 * testsuite/arm_cortex_a8_blx.s: Ditto.
6764 * testsuite/arm_cortex_a8_local.s: Ditto.
6765 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6766 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6767
6768 2010-09-08 Rafael Espindola <espindola@google.com>
6769
6770 * Makefile.am (memory_test.stdout): Run readelf with -W.
6771 * Makefile.in: Regenerate.
6772 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6773 64 bit output.
6774
6775 2010-09-08 Rafael Espindola <espindola@google.com>
6776
6777 * script-sections.cc (Script_sections::add_memory_region): Convert
6778 field precision to int.
6779 * script.cc (script_set_section_region, script_set_section_region):
6780 Convert field precision to int.
6781
6782 2010-09-08 Rafael Espindola <espindola@google.com>
6783
6784 * arm.cc (do_finalize_sections): Create the __exidx_start and
6785 __exdix_end symbols even when the section is missing.
6786
6787 2010-09-08 Nick Clifton <nickc@redhat.com>
6788
6789 * README: Remove claim that MEMORY is not supported.
6790 * expression.cc (script_exp_function_origin)
6791 (script_exp_function_length): Move from here to ...
6792 * script.cc: ... here.
6793 (script_set_section_region, script_add_memory)
6794 (script_parse_memory_attr, script_include_directive): New
6795 functions.
6796 * script-sections.cc
6797 (class Memory_region): New class.
6798 (class Output_section_definition): Add set_memory_region,
6799 set_section_vma, set_section_lma and get_section_name methods.
6800 (class Script_Sections): Add add_memory_region,
6801 find_memory_region, find_memory_region_origin,
6802 find_memory_region_length and set_memory_region methods.
6803 Have set_section_addresses method walk the list of set memory
6804 regions.
6805 Extend the print methos to display memory regions.
6806 * script-sections.h: Add prototypes for new methods.
6807 Add enum for MEMORY region attributes.
6808 * yyscript.y: Add support for parsing MEMORY regions.
6809 * script-c.h: Add prototypes for new functions.
6810 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6811 * testsuite/Makefile.in: Regenerate.
6812 * testsuite/memory_test.sh: New script.
6813 * testsuite/memory_test.s: New assembler source file.
6814 * testsuite/memory_test.t: New linker script.
6815
6816 2010-08-27 Doug Kwan <dougkwan@google.com>
6817
6818 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6819 reference override an existing dynamic weak reference.
6820 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6821 * testsuite/Makefile.in: Regenerate.
6822 * testsuite/dyn_weak_ref.sh: New file.
6823 * testsuite/dyn_weak_ref_1.c: Ditto.
6824 * testsuite/dyn_weak_ref_2.c: Ditto.
6825
6826 2010-08-27 Ian Lance Taylor <iant@google.com>
6827
6828 * incremental.h (class Incremental_input_entry): Add virtual
6829 destructor.
6830
6831 2010-08-27 Ian Lance Taylor <iant@google.com>
6832
6833 * testsuite/start_lib_test_3.c: Mark t3 as used.
6834
6835 2010-08-27 Nick Clifton <nickc@redhat.com>
6836
6837 * options.cc (version_script): Fix small typo in previous
6838 whitespace tidyup.
6839
6840 2010-08-25 Nick Clifton <nickc@redhat.com>
6841
6842 * archive.cc: Formatting fixes: Remove whitespace between
6843 typename and following asterisk. Remove whitespace between
6844 function name and opening parenthesis.
6845 * archive.h: Likewise.
6846 * arm.cc: Likewise.
6847 * attributes.cc: Likewise.
6848 * attributes.h: Likewise.
6849 * common.cc: Likewise.
6850 * copy-relocs.cc: Likewise.
6851 * dirsearch.h: Likewise.
6852 * dynobj.cc: Likewise.
6853 * ehframe.cc: Likewise.
6854 * ehframe.h: Likewise.
6855 * expression.cc: Likewise.
6856 * fileread.cc: Likewise.
6857 * fileread.h: Likewise.
6858 * gc.h: Likewise.
6859 * gold-threads.cc: Likewise.
6860 * gold.cc: Likewise.
6861 * i386.cc: Likewise.
6862 * icf.h: Likewise.
6863 * incremental-dump.cc: Likewise.
6864 * incremental.cc: Likewise.
6865 * layout.cc: Likewise.
6866 * layout.h: Likewise.
6867 * main.cc: Likewise.
6868 * merge.cc: Likewise.
6869 * merge.h: Likewise.
6870 * object.cc: Likewise.
6871 * object.h: Likewise.
6872 * options.cc: Likewise.
6873 * options.h: Likewise.
6874 * output.cc: Likewise.
6875 * output.h: Likewise.
6876 * plugin.cc: Likewise.
6877 * plugin.h: Likewise.
6878 * powerpc.cc: Likewise.
6879 * reloc.cc: Likewise.
6880 * script-c.h: Likewise.
6881 * script-sections.cc: Likewise.
6882 * script.cc: Likewise.
6883 * stringpool.cc: Likewise.
6884 * symtab.cc: Likewise.
6885 * symtab.h: Likewise.
6886 * target.cc: Likewise.
6887 * timer.cc: Likewise.
6888 * timer.h: Likewise.
6889 * version.cc: Likewise.
6890 * x86_64.cc: Likewise.
6891
6892 2010-08-24 Nick Clifton <nickc@redhat.com>
6893
6894 PR 11899
6895 * layout.cc (segment_precedes): Sort segments by their physical
6896 addresses, if they have been set.
6897
6898 2010-08-23 Cary Coutant <ccoutant@google.com>
6899
6900 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6901 symbols data.
6902 (Lib_group::include_member): Unlock object after deleting its
6903 symbols data.
6904 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6905 the bug fixed here.
6906
6907 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6908 Cary Coutant <ccoutant@google.com>
6909
6910 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6911 constructor, and set_blocker.
6912 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6913 readsyms_blocker_.
6914 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6915 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6916 * testsuite/Makefile.am (start_lib_test): New test case.
6917 * testsuite/Makefile.in: Regenerate.
6918 * testsuite/start_lib_test_main.c: New file.
6919 * testsuite/start_lib_test_1.c: New file.
6920 * testsuite/start_lib_test_2.c: New file.
6921 * testsuite/start_lib_test_3.c: New file.
6922
6923 2010-08-19 Ian Lance Taylor <iant@google.com>
6924
6925 * Makefile.in: Rebuild with automake 1.11.1.
6926 * aclocal.m4: Likewise.
6927 * testsuite/Makefile.in: Likewise.
6928
6929 2010-08-19 Ian Lance Taylor <iant@google.com>
6930
6931 PR 10893
6932 * i386.cc (class Output_data_plt_i386): Update declarations.
6933 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6934 local_ifuncs_ fields.
6935 (Target_i386::do_plt_section_for_global): New function.
6936 (Target_i386::do_plt_section_for_local): New function.
6937 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6938 parameter; change all callers. Initialize global_ifuncs_ and
6939 local_ifuncs_. If doing a static link define __rel_iplt_start and
6940 __rel_iplt_end.
6941 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6942 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6943 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6944 symbols.
6945 (Target_i386::make_plt_section): New function, broken out of
6946 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6947 (Target_i386::make_plt_entry): Call make_plt_section.
6948 (Target_i386::make_local_ifunc_plt_entry): New function.
6949 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6950 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6951 R_386_IRELATIVE to switch.
6952 (Target_i386::Scan::global): Likewise.
6953 (Target_i386::Relocate::relocate): Likewise.
6954 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6955 switch.
6956 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6957 (Target_x86_64::do_plt_section_for_global): New function.
6958 (Target_x86_64::do_plt_section_for_local): New function.
6959 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6960 parameter; change all callers. If doing a static link define
6961 __rela_iplt_start and __rela_iplt_end.
6962 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6963 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6964 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6965 to point to .plt.
6966 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6967 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6968 switch.
6969 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6970 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6971 R_X86_64_IRELATIVE to switch.
6972 (Target_x86_64::Scan::global): Likewise.
6973 (Target_x86_64::Relocate::relocate): Likewise.
6974 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6975 switch.
6976 * target.h (class Target): Add plt_section_for_global and
6977 plt_section_for_local functions. Add do_plt_section_for_global
6978 and do_plt_section_for_local virtual functions.
6979 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6980 clarifying comments.
6981 (Symbol::use_plt_offset): Handle IFUNC symbol.
6982 * object.cc (Sized_relobj::Sized_relobj): Initialize
6983 local_plt_offsets_.
6984 (Sized_relobj::local_has_plt_offset): New function.
6985 (Sized_relobj::local_plt_offset): New function.
6986 (Sized_relobj::set_local_plt_offset): New function.
6987 (Sized_relobj::do_count): Handle IFUNC symbol.
6988 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6989 a bit away from input_shndx_ field. Add set_is_func_symbol and
6990 is_ifunc_symbol functions.
6991 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6992 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6993 local_plt_offsets_ field.
6994 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6995 * output.h (class Output_section_data): Add non-const
6996 output_section function.
6997 (class Output_data_got): Update declarations.
6998 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6999 Add use_plt_offset parameter to global and local constructors.
7000 Change all callers. Change local_sym_index_ field to 31 bits.
7001 Change GSYM_CODE and CONSTANT_CODE accordingly.
7002 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7003 doing a static link don't set sh_link field.
7004 (Output_data_got::Got_entry::write): Use PLT offset if
7005 appropriate.
7006 (Output_data_got::add_global_plt): New function.
7007 (Output_data_got::add_local_plt): New function.
7008 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7009 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7010 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7011 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7012 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7013 IFUNC conditional.
7014 * testsuite/ifunc-sel.h: New file.
7015 * testsuite/ifuncmain1.c: New file.
7016 * testsuite/ifuncmain1vis.c: New file.
7017 * testsuite/ifuncmod1.c: New file.
7018 * testsuite/ifuncdep2.c: New file.
7019 * testsuite/ifuncmain2.c: New file.
7020 * testsuite/ifuncmain3.c: New file.
7021 * testsuite/ifuncmod3.c: New file.
7022 * testsuite/ifuncmain4.c: New file.
7023 * testsuite/ifuncmain5.c: New file.
7024 * testsuite/ifuncmod5.c: New file.
7025 * testsuite/ifuncmain6pie.c: New file.
7026 * testsuite/ifuncmod6.c: New file.
7027 * testsuite/ifuncmain7.c: New file.
7028 * configure, testsuite/Makefile.in: Rebuild.
7029
7030 2010-08-18 Ian Lance Taylor <iant@google.com>
7031
7032 * incremental.cc
7033 (Output_section_incremental_inputs::write_input_files): Add cast
7034 to avoid signed/unsigned comparison warning.
7035 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7036
7037 2010-08-12 Cary Coutant <ccoutant@google.com>
7038
7039 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7040
7041 2010-08-13 Ian Lance Taylor <iant@google.com>
7042
7043 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7044
7045 2010-08-12 Cary Coutant <ccoutant@google.com>
7046 Doug Kwan <dougkwan@google.com>
7047
7048 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7049 defintion overrides non-weak undef, remember that the original undef
7050 is not weak.
7051 * symtab.cc (Symbol_table::sized_write_global): For undef without
7052 an original weak binding, set binding to global in output.
7053 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7054 * testsuite/Makefile.in: Regenerate.
7055 * testsuite/strong_ref_weak_def.sh: New file.
7056 * testsuite/strong_ref_weak_def_1.c: Ditto.
7057 * testsuite/strong_ref_weak_def_2.c: Ditto.
7058
7059 2010-08-12 Cary Coutant <ccoutant@google.com>
7060
7061 * testsuite/incremental_test.sh: Rewrite.
7062 * testsuite/incremental_test_1.c: Rewrite.
7063 * testsuite/incremental_test_2.c: Rewrite.
7064
7065 2010-08-12 Cary Coutant <ccoutant@google.com>
7066
7067 * arm.cc (Target_arm::got_size): Add const.
7068 (Target_arm::got_entry_count): New function.
7069 (Target_arm::plt_entry_count): New function.
7070 (Target_arm::first_plt_entry_offset): New function.
7071 (Target_arm::plt_entry_size): New function.
7072 (Output_data_plt_arm::entry_count): New function.
7073 (Output_data_plt_arm::first_plt_entry_offset): New function.
7074 (Output_data_plt_arm::get_plt_entry_size): New function.
7075 * i386.cc (Target_i386::got_size): Add const.
7076 (Target_i386::got_entry_count): New function.
7077 (Target_i386::plt_entry_count): New function.
7078 (Target_i386::first_plt_entry_offset): New function.
7079 (Target_i386::plt_entry_size): New function.
7080 (Output_data_plt_i386::entry_count): New function.
7081 (Output_data_plt_i386::first_plt_entry_offset): New function.
7082 (Output_data_plt_i386::get_plt_entry_size): New function.
7083 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7084 find_incremental_inputs_sections. Dump incremental_got_plt section.
7085 * incremental.cc: Include target.h.
7086 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7087 parameter. Adjust all callers. Find incremental_got_plt section.
7088 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7089 section.
7090 (Output_section_incremental_inputs::set_final_data_size): Calculate
7091 size of incremental_got_plt section.
7092 (Output_section_incremental_inputs::do_write): Write the
7093 incremental_got_plt section.
7094 (Got_plt_view_info): New struct.
7095 (Local_got_offset_visitor): New class.
7096 (Global_got_offset_visitor): New class.
7097 (Global_symbol_visitor_got_plt): New class.
7098 (Output_section_incremental_inputs::write_got_plt): New function.
7099 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7100 Add parameter. Adjust all callers.
7101 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7102 (Incremental_inputs::got_plt_section): New function.
7103 (Incremental_inputs::got_plt_section_): New data member.
7104 (Incremental_got_plt_reader): New class.
7105 * layout.cc (Layout::create_incremental_info_sections): Add the
7106 incremental_got_plt section.
7107 * object.h (Got_offset_list::get_list): New function.
7108 (Got offset_list::for_all_got_offsets): New function.
7109 (Sized_relobj::local_got_offset_list): New function.
7110 * powerpc.cc (Target_powerpc::got_size): Add const.
7111 (Target_powerpc::got_entry_count): New function.
7112 (Target_powerpc::plt_entry_count): New function.
7113 (Target_powerpc::first_plt_entry_offset): New function.
7114 (Target_powerpc::plt_entry_size): New function.
7115 (Output_data_plt_powerpc::entry_count): New function.
7116 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7117 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7118 * sparc.cc (Target_sparc::got_size): Add const.
7119 (Target_sparc::got_entry_count): New function.
7120 (Target_sparc::plt_entry_count): New function.
7121 (Target_sparc::first_plt_entry_offset): New function.
7122 (Target_sparc::plt_entry_size): New function.
7123 (Output_data_plt_sparc::entry_count): New function.
7124 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7125 (Output_data_plt_sparc::get_plt_entry_size): New function.
7126 * symtab.h (Symbol::got_offset_list): New function.
7127 (Symbol_table::for_all_symbols): New function.
7128 * target.h (Sized_target::got_entry_count): New function.
7129 (Sized_target::plt_entry_count): New function.
7130 (Sized_target::plt_entry_size): New function.
7131 * x86_64.cc (Target_x86_64::got_size): Add const.
7132 (Target_x86_64::got_entry_count): New function.
7133 (Target_x86_64::plt_entry_count): New function.
7134 (Target_x86_64::first_plt_entry_offset): New function.
7135 (Target_x86_64::plt_entry_size): New function.
7136 (Output_data_plt_x86_64::entry_count): New function.
7137 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7138 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7139
7140 2010-08-12 Cary Coutant <ccoutant@google.com>
7141
7142 * archive.cc: Include incremental.h.
7143 (Archive::Archive): Initialize incremental_info_.
7144 (Archive::include_member): Record archive members in incremental info.
7145 (Add_archive_symbols::run): Record begin and end of an archive in
7146 incremental info.
7147 (Lib_group::include_member): Record objects in incremental info.
7148 * archive.h (Incremental_archive_entry): Forward declaration.
7149 (Archive::set_incremental_info): New member function.
7150 (Archive::incremental_info): New member function.
7151 (Archive::Unused_symbol_iterator): New class.
7152 (Archive::unused_symbols_begin): New member function.
7153 (Archive::unused_symbols_end): New member function.
7154 (Archive::incremental_info_): New data member.
7155 * incremental-dump.cc (find_input_containing_global): New function.
7156 (dump_incremental_inputs): Dump new incremental info sections.
7157 * incremental.cc: Include symtab.h.
7158 (Output_section_incremental_inputs): New class.
7159 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7160 new incremental info sections.
7161 (Sized_incremental_binary::do_check_inputs): Likewise.
7162 (Incremental_inputs::report_archive): Remove.
7163 (Incremental_inputs::report_archive_begin): New function.
7164 (Incremental_inputs::report_archive_end): New function.
7165 (Incremental_inputs::report_object): New function.
7166 (Incremental_inputs::finalize_inputs): Remove.
7167 (Incremental_inputs::report_input_section): New function.
7168 (Incremental_inputs::report_script): Rewrite.
7169 (Incremental_inputs::finalize): Do nothing but finalize string table.
7170 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7171 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7172 (Incremental_inputs::create_data_sections): New function.
7173 (Incremental_inputs::relocs_entsize): New function.
7174 (Output_section_incremental_inputs::set_final_data_size): New function.
7175 (Output_section_incremental_inputs::do_write): New function.
7176 (Output_section_incremental_inputs::write_header): New function.
7177 (Output_section_incremental_inputs::write_input_files): New function.
7178 (Output_section_incremental_inputs::write_info_blocks): New function.
7179 (Output_section_incremental_inputs::write_symtab): New function.
7180 * incremental.h (Incremental_script_entry): Forward declaration.
7181 (Incremental_object_entry): Forward declaration.
7182 (Incremental_archive_entry): Forward declaration.
7183 (Incremental_inputs): Forward declaration.
7184 (Incremental_inputs_header_data): Remove.
7185 (Incremental_inputs_header): Remove.
7186 (Incremental_inputs_header_write): Remove.
7187 (Incremental_inputs_entry_data): Remove.
7188 (Incremental_inputs_entry): Remove.
7189 (Incremental_inputs_entry_write): Remove.
7190 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7191 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7192 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7193 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7194 Likewise.
7195 (Incremental_input_entry): New class.
7196 (Incremental_script_entry): New class.
7197 (Incremental_object_entry): New class.
7198 (Incremental_archive_entry): New class.
7199 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7200 (Incremental_inputs::report_inputs): Remove.
7201 (Incremental_inputs::report_archive): Remove.
7202 (Incremental_inputs::report_archive_begin): New function.
7203 (Incremental_inputs::report_archive_end): New function.
7204 (Incremental_inputs::report_object): Change prototype.
7205 (Incremental_inputs::report_input_section): New function.
7206 (Incremental_inputs::report_script): Change prototype.
7207 (Incremental_inputs::get_reloc_count): New function.
7208 (Incremental_inputs::set_reloc_count): New function.
7209 (Incremental_inputs::create_data_sections): New function.
7210 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7211 (Incremental_inputs::inputs_section): New function.
7212 (Incremental_inputs::symtab_section): New function.
7213 (Incremental_inputs::relocs_section): New function.
7214 (Incremental_inputs::get_stringpool): Add const.
7215 (Incremental_inputs::command_line): Add const.
7216 (Incremental_inputs::inputs): Remove.
7217 (Incremental_inputs::command_line_key): New function.
7218 (Incremental_inputs::input_file_count): New function.
7219 (Incremental_inputs::input_files): New function.
7220 (Incremental_inputs::relocs_entsize): New function.
7221 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7222 (Incremental_inputs::finalize_inputs): Remove.
7223 (Incremental_inputs::Input_info): Remove.
7224 (Incremental_inputs::lock_): Remove.
7225 (Incremental_inputs::inputs_): Change type.
7226 (Incremental_inputs::inputs_map_): Remove.
7227 (Incremental_inputs::current_object_entry_): New data member.
7228 (Incremental_inputs::inputs_section_): New data member.
7229 (Incremental_inputs::symtab_section_): New data member.
7230 (Incremental_inputs::relocs_section_): New data member.
7231 (Incremental_inputs::reloc_count_): New data member.
7232 (Incremental_inputs_reader): New class.
7233 (Incremental_symtab_reader): New class.
7234 (Incremental_relocs_reader): New class.
7235 * layout.cc (Layout::finalize): Move finalization of incremental info
7236 and creation of incremental info sections to follow finalization of
7237 symbol table. Set offsets for postprocessing sections.
7238 (Layout::create_incremental_info_sections): Call
7239 Incremental_inputs::create_data_sections. Add incremental symtab
7240 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7241 sections to layout after input sections.
7242 * layout.h (struct Timespec): Forward declaration.
7243 (Layout::incremental_inputs): Add const.
7244 (Layout::create_incremental_info_sections): Add parameter.
7245 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7246 * object.cc: Include incremental.h.
7247 (Relobj::finalize_incremental_relocs): New function.
7248 (Sized_relobj::do_layout): Record input sections in incremental info.
7249 * object.h (Object::output_section): New function.
7250 (Object::output_section_offset): Moved from Relobj.
7251 (Object::get_incremental_reloc_base): New function.
7252 (Object::get_incremental_reloc_count): New function.
7253 (Object::do_output_section): New function.
7254 (Object::do_output_section_offset): Moved from Relobj.
7255 (Object::do_get_incremental_reloc_base): New function.
7256 (Object::do_get_incremental_reloc_count): New function.
7257 (Object::Object): Initialize new data members.
7258 (Relobj::output_section): Renamed do_output_section and moved to
7259 protected.
7260 (Relobj::output_section_offset): Moved to Object.
7261 (Relobj::do_get_incremental_reloc_base): New function.
7262 (Relobj::do_get_incremental_reloc_count): New function.
7263 (Relobj::allocate_incremental_reloc_counts): New function.
7264 (Relobj::count_incremental_reloc): New function.
7265 (Relobj::finalize_incremental_relocs): New function.
7266 (Relobj::next_incremental_reloc_index): New function.
7267 (Relobj::reloc_counts_): New data member.
7268 (Relobj::reloc_bases_): New data member.
7269 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7270 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7271 (Sized_relobj::incremental_relocs_scan): New function.
7272 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7273 (Sized_relobj::incremental_relocs_write): New function.
7274 (Sized_relobj::incremental_relocs_write_reltype): New function.
7275 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7276 incremental link.
7277 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7278 archives and object files elsewhere.
7279 (Add_symbols::run): Report object files here.
7280 (Finish_group::run): Report end of archive at end of group.
7281 * reloc.cc: Include layout.h, incremental.h.
7282 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7283 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7284 (Sized_relobj::incremental_relocs_scan): New function.
7285 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7286 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7287 (Sized_relobj::incremental_relocs_write): New function.
7288 (Sized_relobj::incremental_relocs_write_reltype): New function.
7289 * script.cc (read_input_script): Rewrite test for incremental link.
7290 Change call to Incremental_inputs::report_script.
7291 * symtab.h (Symbol_table::first_global_index): New function.
7292 (Symbol_table::output_count): New function.
7293
7294 2010-08-12 Doug Kwan <dougkwan@google.com>
7295
7296 * arm.cc (Target_arm::merge_object_attributes): Check command line
7297 options --no-wchar-size-warning and --no-enum-size-warning.
7298 * options.h (General_options): Add ld-compatible options
7299 --no-enum-size-warning and --no-wchar-size-warning.
7300
7301 2010-08-04 Ian Lance Taylor <iant@google.com>
7302
7303 * x86_64.cc (Target_x86_64::Scan::local): Use
7304 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7305 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7306 (Target_x86_64::Scan::global): Likewise.
7307 (Target_x86_64::Relocate::relocate): Likewise.
7308 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7309 Likewise.
7310
7311 2010-08-03 Cary Coutant <ccoutant@google.com>
7312
7313 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7314 to reserve space in merged_strings vector. Keep total input size
7315 for stats.
7316 (Output_merge_string::do_print_merge_stats): Print total input size.
7317 * merge.h (Output_merge_string): Add input_size_ field.
7318 * stringpool.cc (Stringpool_template::string_length): Move
7319 implementations out of Stringpool_template class and place in
7320 stringpool.h.
7321 * stringpool.h (string_length): Move out of Stringpool_template.
7322
7323 2010-08-03 Ian Lance Taylor <iant@google.com>
7324
7325 PR 11712
7326 * layout.cc (relaxation_loop_body): If address of load segment is
7327 set, adjust address to include headers if possible.
7328
7329 2010-08-03 Ian Lance Taylor <iant@google.com>
7330
7331 * version.cc (version_string): Bump to 1.10.
7332
7333 2010-08-03 Ian Lance Taylor <iant@google.com>
7334
7335 PR 11805
7336 * layout.h (enum Output_section_order): Define.
7337 (class Layout): Update declarations.
7338 * layout.cc (Layout::get_output_section): Add order parameter.
7339 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7340 is_first_non_relro parameters. Change all callers.
7341 (Layout::choose_output_section): Likewise.
7342 (Layout::add_output_section_data): Likewise.
7343 (Layout::make_output_section): Likewise. Set order.
7344 (Layout::default_section_order): New function.
7345 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7346 * output.cc (Output_section::Output_section): Initialize order_.
7347 Don't initialize deleted fields.
7348 (Output_segment::Output_segment): Don't initialize deleted
7349 fields.
7350 (Output_segment::add_output_section_to_load): New function
7351 replacing add_output_section. Change all callers to call this or
7352 add_output_section_to_nonload.
7353 (Output_segment::add_output_section_to_nonload): New function.
7354 (Output_segment::remove_output_section): Rewrite.
7355 (Output_segment::add_initial_output_data): Likewise.
7356 (Output_segment::has_any_data_sections): Likewise.
7357 (Output_segment::is_first_section_relro): Likewise.
7358 (Output_segment::maximum_alignment): Likewise.
7359 (Output_segment::has_dynamic_reloc): New function replacing
7360 dynamic_reloc_count. Change all callers.
7361 (Output_segment::has_dynamic_reloc_list): New function replacing
7362 dynamic_reloc_count_list. Change all callers.
7363 (Output_segment::set_section_addresses): Rewrite.
7364 (Output_segment::set_offset): Rewrite.
7365 (Output_segment::find_first_and_last_list): Remove.
7366 (Output_segment::set_tls_offsets): Rewrite.
7367 (Output_segment::first_section_load_address): Likewise.
7368 (Output_segment::output_section_count): Likewise.
7369 (Output_segment::section_with_lowest_load_address): Likewise.
7370 (Output_segment::write_section_headers): Likewise.
7371 (Output_segment::print_sections_to_map): Likewise.
7372 * output.h (class Output_data): Remove dynamic_reloc_count_
7373 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7374 (Output_data::add_dynamic_reloc): Rewrite.
7375 (Output_data::has_dynamic_reloc): New function.
7376 (Output_data::dynamic_reloc_count): Remove.
7377 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7378 is_last_relro_, is_first_non_relro_, is_interp_,
7379 is_dynamic_linker_section_ fields. Add order and set_order
7380 functions. Remove is_relro_local, set_is_relro_local,
7381 is_last_relro, set_is_last_relro, is_first_non_relro,
7382 set_is_first_non_relro functions, is_interp, set_is_interp,
7383 is_dynamic_linker_section, and set_is_dynamic_linker_section
7384 functions.
7385 (class Output_segment): Change Output_data_list from std::list to
7386 std:;vector. Add output_lists_ field. Remove output_data_ and
7387 output_bss_ fields. Update declarations.
7388
7389 2010-08-02 Ian Lance Taylor <iant@google.com>
7390
7391 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7392 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7393 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7394
7395 2010-08-02 Ian Lance Taylor <iant@google.com>
7396
7397 PR 11855
7398 * script.cc (Script_options::Script_options): Initialize
7399 symbol_definitions_ and symbol_references_.
7400 (Script_options::add_symbol_assignment): Update
7401 symbol_definitions_ and symbol_references_.
7402 (Script_options::add_symbol_reference): New function.
7403 (script_symbol): New function.
7404 * script.h (class Script_options): Add symbol_definitions_ and
7405 symbol_references_ fields.
7406 (Script_options::referenced_const_iterator): New type.
7407 (Script_options::referenced_begin): New function.
7408 (Script_options::referenced_end): New function.
7409 (Script_options::is_referenced): New function.
7410 (Script_options::any_unreferenced): New function.
7411 * script-c.h (script_symbol): Declare.
7412 * yyscript.y (exp): Call script_symbol.
7413 * symtab.cc: Include "script.h".
7414 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7415 Change all callers. Check symbols referenced by scripts.
7416 (Symbol_table::add_undefined_symbols_from_command_line): Add
7417 layout parameter. Change all callers.
7418 (Symbol_table::do_add_undefined_symbols_from_command_line):
7419 Likewise. Break out loop body. Check symbols referenced by
7420 scripts.
7421 (Symbol_table::add_undefined_symbol_from_command_line): New
7422 function broken out of
7423 do_add_undefined_symbols_from_command_line.
7424 * symtab.h (class Symbol_table): Update declarations.
7425 * archive.cc: Include "layout.h".
7426 (Archive::should_include_member): Add layout parameter. Change
7427 all callers. Check for symbol mentioned in expression.
7428 * archive.h (class Archive): Update declaration.
7429 * object.cc (Sized_relobj::do_should_include_member): Add layout
7430 parameter.
7431 * object.h (Object::should_include_member): Add layout parameter.
7432 Change all callers.
7433 (Object::do_should_include_member): Add layout parameter.
7434 (class Sized_relobj): Update declaration.
7435 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7436 parameter.
7437 * dynobj.h (class Sized_dynobj): Update declaration.
7438 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7439 layout parameter.
7440 * plugin.h (class Sized_pluginobj): Update declaration.
7441
7442 2010-08-02 Ian Lance Taylor <iant@google.com>
7443
7444 PR 11866
7445 * output.cc (Output_segment::set_offset): Search for the first and
7446 last sections rather than assuming that the list is in order.
7447 (Output_segment::find_first_and_last_list): New function.
7448 * output.h (class Output_segment): Update declarations.
7449 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7450 (relro_strip_test_SOURCES): New variable.
7451 (relro_strip_test_DEPENDENCIES): New variable.
7452 (relro_strip_test_LDFLAGS): New variable.
7453 (relro_strip_test_LDADD): New variable.
7454 (relro_strip_test.so): New target.
7455
7456 2010-08-02 Ian Lance Taylor <iant@google.com>
7457
7458 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7459 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7460 (Target_i386::got_tlsdesc_section): New function.
7461 (Target_i386::got_section): Create space for GOT entries for
7462 TLSDESC relocations.
7463 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7464 R_386_TLS_GOTDESC.
7465 (Target_i386::Scan::global): Likewise.
7466 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7467 using TLSDESC GOT.
7468 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7469 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7470 (Target_x86_64::got_tlsdesc_section): New function.
7471 (Target_x86_64::got_section): Create space for GOT entries for
7472 TLSDESC relocations.
7473 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7474 R_386_TLS_GOTDESC.
7475 (Target_x86_64::Scan::global): Likewise.
7476 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7477 using TLSDESC GOT.
7478
7479 2010-08-02 Ian Lance Taylor <iant@google.com>
7480
7481 * testsuite/final_layout.sh: Use dc to convert from hex to
7482 decimal.
7483
7484 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7485
7486 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7487 paramter to the call to gold::gc_process_relocs.
7488 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7489 paramter to the call to gold::gc_process_relocs.
7490 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7491 parameter to the call to gold::gc_process_relocs.
7492 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7493 template parameter to the call to gold::gc_process_relocs.
7494 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7495 paramter to the call to gold::gc_process_relocs.
7496 * gc.h (get_embedded_addend_size): New function.
7497 (gc_process_relocs): Save the size of the reloc for use by ICF.
7498 * icf.cc (get_section_contents): Get the addend from the text section
7499 for SHT_REL relocation sections.
7500 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7501 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7502 * int_encoding.h (read_from_pointer): New overloaded function.
7503 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7504 * testsuite/icf_sht_rel_addend_test.sh: New file.
7505 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7506 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7507
7508 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7509
7510 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7511 * Makefile.in: Regenerate.
7512 * testsuite/Makefile.in: Regenerate.
7513
7514 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7515
7516 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7517 * gold/testsuite/debug_msg.cc: Likewise.
7518 * gold/testsuite/odr_violation1.cc
7519 * gold/testsuite/odr_violation2.cc
7520
7521 2010-07-21 Cary Coutant <ccoutant@google.com>
7522
7523 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7524 string, and length fields.
7525 (Output_merge_string::Merged_strings_list): New type.
7526 (Output_merge_string::Merged_strings_lists): New typedef.
7527 (Output_merge_string): Replace merged_strings_ with
7528 merged_strings_lists_.
7529 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7530 Merged_strings_list per input object and section. Don't store pointer
7531 to the string. Don't store length with each merged string entry.
7532 (Output_merge_string::finalize_merged_data): Loop over list of merged
7533 strings lists. Recompute length of each merged string.
7534
7535 2010-07-15 Cary Coutant <ccoutant@google.com>
7536
7537 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7538 here.
7539
7540 2010-07-14 Ian Lance Taylor <iant@google.com>
7541
7542 * descriptors.cc (Descriptors::open): Report correct name in error
7543 message.
7544
7545 2010-07-13 Doug Kwan <dougkwan@google.com>
7546
7547 * arm.cc (Arm_input_section::Arm_input_section): For a
7548 SHT_ARM_EXIDX section, always keeps the input sections.
7549 (Arm_input_section::set_exidx_section_link): New method.
7550 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7551 has_errors_ to false.
7552 (Arm_exidx_input_section::has_errors,
7553 Arm_exidx_input_section::set_has_errors): New methods.
7554 (Arm_exidx_input_section::has_errors_): New data member.
7555 (Arm_relobj::get_exidx_shndx_list): New method.
7556 (Arm_output_section::append_text_sections_to_list): Do not skip
7557 section without SHF_EXECINSTR.
7558 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7559 errors.
7560 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7561 section header. Make error messages more verbose. Check for
7562 a non-executable section linked to an EXIDX section.
7563 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7564 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7565 check that there is no deferred EXIDX section if we exit early.
7566 Instead of not making an EXIDX section in case of an error, make one
7567 and set the has_errors flag of it.
7568 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7569 in a relocatable link.
7570 (Target_arm::do_relax): Look for the EXIDX output section instead of
7571 assuming that it is called .ARM.exidx.
7572 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7573 section list. Do not check for SHF_EXECINSTR section flags but
7574 skip any input section with errors.
7575 * output.cc (Output_section::Output_section): Initialize
7576 always_keeps_input_sections_ to false.
7577 (Output_section::add_input_section): Check for
7578 always_keeps_input_sections_.
7579 * output.h (Output_section::always_keeps_input_sections,
7580 Output_section::set_always_keeps_input_sections): New methods.
7581 (Output_section::always_keeps_input_sections): New data member.
7582
7583 2010-07-13 Rafael Espindola <espindola@google.com>
7584
7585 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7586 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7587
7588 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7589 Ian Lance Taylor <iant@google.com>
7590
7591 * output.h (Output_section_lookup_maps::add_merge_section):
7592 Correct check of whether value was inserted.
7593 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7594 (Output_section_lookup_maps::add_relaxed_input_section):
7595 Likewise.
7596 * arm.cc (Target_arm::got_section): Remove used local os.
7597 * i386.cc (Target_i386::got_section): Likewise.
7598 * x86_64.cc (Target_x86_64::got_section): Likewise.
7599 * sparc.cc (Target_sparc::got_section): Likewise.
7600 (Target_sparc::relocate): Remove unused local have_got_offset.
7601 * powerpc.cc (Target_powerpc::relocate): Likewise.
7602
7603 2010-07-13 Ian Lance Taylor <iant@google.com>
7604
7605 * compressed_output.cc (zlib_decompress): Fix signature in
7606 !HAVE_ZLIB_H case.
7607
7608 * archive.cc (Archive::include_member): Unlock an external member
7609 of a thin archive. Don't bother to delete an object we know is
7610 NULL.
7611
7612 2010-07-12 Cary Coutant <ccoutant@google.com>
7613
7614 * compressed_output.cc (zlib_decompress): New function.
7615 (get_uncompressed_size): New function.
7616 (decompress_input_section): New function.
7617 * compressed_output.h (get_uncompressed_size): New function.
7618 (decompress_input_section): New function.
7619 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7620 Handle compressed debug sections.
7621 * layout.cc (is_compressed_debug_section): New function.
7622 (Layout::output_section_name): Map compressed section names to
7623 canonical names.
7624 * layout.h (is_compressed_debug_section): New function.
7625 (is_debug_info_section): Recognize compressed debug sections.
7626 * merge.cc: Include compressed_output.h.
7627 (Output_merge_data::do_add_input_section): Handle compressed
7628 debug sections.
7629 (Output_merge_string::do_add_input_section): Handle compressed
7630 debug sections.
7631 * object.cc: Include compressed_output.h.
7632 (Sized_relobj::Sized_relobj): Initialize new data members.
7633 (build_compressed_section_map): New function.
7634 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7635 * object.h (Object::section_is_compressed): New method.
7636 (Object::do_section_is_compressed): New method.
7637 (Sized_relobj::Compressed_section_map): New type.
7638 (Sized_relobj::do_section_is_compressed): New method.
7639 (Sized_relobj::compressed_sections_): New data member.
7640 * output.cc (Output_section::add_input_section): Handle compressed
7641 debug sections.
7642 * reloc.cc: Include compressed_output.h.
7643 (Sized_relobj::write_sections): Handle compressed debug sections.
7644
7645 2010-07-08 Cary Coutant <ccoutant@google.com>
7646
7647 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7648 weak when resolving to a dynamic def.
7649 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7650 for weak undef/dynamic def cases. Adjust callers.
7651 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7652 undef_binding_weak_.
7653 (Symbol_table::sized_write_globals): Adjust symbol binding.
7654 (Symbol_table::sized_write_symbol): Add binding parameter.
7655 * symtab.h (Symbol::set_undef_binding): New method.
7656 (Symbol::is_undef_binding_weak): New method.
7657 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7658 (Symbol_table::should_override): Add new parameter.
7659 (Symbol_table::sized_write_symbol): Add new parameter.
7660
7661 * testsuite/weak_undef_file1.cc: Add new test case.
7662 * testsuite/weak_undef_file2.cc: Fix header comment.
7663 * testsuite/weak_undef_test.cc: Add new test case.
7664
7665 2010-06-29 Doug Kwan <dougkwan@google.com>
7666
7667 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7668 Initialize USE_SYMBOL_.
7669 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7670 definition.
7671 (Arm_reloc_property::uses_symbol_): New data member declaration.
7672 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7673 uses symbol value and symbol is undefined but not weakly undefined.
7674
7675 2010-06-28 Rafael Espindola <espindola@google.com>
7676
7677 * plugin.cc (Plugin::load): Use dlerror.
7678
7679 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7680
7681 * symtab.cc (detect_odr_violations): When reporting an ODR
7682 violation, report an object where the symbol is defined.
7683
7684 2010-06-25 Doug Kwan <dougkwan@google.com>
7685
7686 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7687 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7688 definition.
7689 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7690 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7691 target hook to detect function points.
7692 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7693 * icf.h (Icf::check_section_for_function_pointers): Change type of
7694 parameter SECTION_NAME to const reference to std::string. Use
7695 target hook to determine if section may have unsafe pointers.
7696 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7697 method definition.
7698
7699 2010-06-21 Rafael Espindola <espindola@google.com>
7700
7701 * fileread.cc (Input_file::find_fie): New
7702 (Input_file::open): Use Input_file::find_fie.
7703 * fileread.h (Input_file::find_fie): New
7704 * plugin.cc (set_extra_library_path): New.
7705 (Plugin::load): Add set_extra_library_path to the transfer vector.
7706 (Plugin_manager::set_extra_library_path): New.
7707 (Plugin_manager::add_input_file): Use the extra search path if set.
7708 (set_extra_library_path(): New.
7709 * plugin.h (Plugin_manager): Add set_extra_library_path and
7710 extra_search_path_.
7711
7712 2010-06-19 Cary Coutant <ccoutant@google.com>
7713
7714 * layout.cc (gdb_sections): Add .debug_types.
7715 (lines_only_debug_sections): Likewise.
7716
7717 2010-06-18 Rafael Espindola <espindola@google.com>
7718
7719 * plugin.cc (add_input_file,add_input_library)
7720 (Plugin_manager::add_input_file): Make filename arguments const.
7721 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7722 const.
7723
7724 2010-06-16 Doug Kwan <dougkwan@google.com>
7725
7726 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7727 .ARM.attributes section if we have not merged any input
7728 attributes sections.
7729
7730 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7731
7732 * arm.cc: Allow combining objects with no EABI version
7733 information.
7734
7735 2010-06-15 Rafael Espindola <espindola@google.com>
7736
7737 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7738
7739 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7740
7741 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7742 (struct iovec): Correct !HAVE_READV definition.
7743
7744 2010-06-10 Cary Coutant <ccoutant@google.com>
7745
7746 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7747 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7748 reloc sections.
7749 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7750
7751 PR 11683
7752 * symtab.h (Symbol::is_placeholder): New member function.
7753 * target-reloc.h (relocate_section): Check for placeholder symbols.
7754
7755 * testsuite/Makefile.am (plugin_test_8): New test.
7756 (plugin_test_9): New test.
7757 * testsuite/Makefile.in: Regenerate.
7758
7759 2010-06-09 Nick Clifton <nickc@redhat.com>
7760
7761 * yyscript.y (input_list_element): Allow strings prefixed with
7762 the '-' character. Treat these as libraries.
7763 * script.cc (script_add_library): New function. Adds a library
7764 specified by "-l<name>" found in an input script.
7765 * script-c.h: Add prototype for script_add_library.
7766
7767 2010-06-07 Doug Kwan <dougkwan@google.com>
7768
7769 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7770 Restrict stub-group size to be within long conditional branch
7771 range when working around cortex-A8 erratum.
7772
7773 2010-06-07 Damien Diederen <dd@crosstwine.com>
7774
7775 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7776 #ifdef typo.
7777
7778 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7779
7780 PR gold/11658
7781 * output.cc
7782 (Output_section::Input_section_sort_entry::compare_section_ordering):
7783 Change to return non-zero correctly.
7784 (Output_section::Input_section_sort_section_order_index_compare
7785 ::operator()): Change to fix ambiguity in comparisons.
7786
7787 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7788
7789 * gold.h (is_wildcard_string): New function.
7790 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7791 (Layout::layout_eh_frame): Ditto.
7792 (Layout::find_section_order_index): New method.
7793 (Layout::read_layout_from_file): New method.
7794 * layout.h (Layout::find_section_order_index): New method.
7795 (Layout::read_layout_from_file): New method.
7796 (Layout::input_section_position_): New private member.
7797 (Layout::input_section_glob_): New private member.
7798 * main.cc (main): Call read_layout_from_file here.
7799 * options.h (--section-ordering-file): New option.
7800 * output.cc (Output_section::input_section_order_specified_): New
7801 member.
7802 (Output_section::Output_section): Initialize new member.
7803 (Output_section::add_input_section): Add new parameter.
7804 Keep input sections when --section-ordering-file is used.
7805 (Output_section::set_final_data_size): Sort input sections when
7806 section ordering file is specified.
7807 (Output_section::Input_section_sort_entry): Add new parameter.
7808 Check sorting type.
7809 (Output_section::Input_section_sort_entry::compare_section_ordering):
7810 New method.
7811 (Output_section::Input_section_sort_compare::operator()): Change to
7812 consider section_order_index.
7813 (Output_section::Input_section_sort_init_fini_compare::operator()):
7814 Change to consider section_order_index.
7815 (Output_section::Input_section_sort_section_order_index_compare
7816 ::operator()): New method.
7817 (Output_section::sort_attached_input_sections): Change to sort
7818 according to section order when specified.
7819 (Output_section::add_input_section<32, true>): Add new parameter.
7820 (Output_section::add_input_section<64, true>): Add new parameter.
7821 (Output_section::add_input_section<32, false>): Add new parameter.
7822 (Output_section::add_input_section<64, false>): Add new parameter.
7823 * output.h (Output_section::add_input_section): Add new parameter.
7824 (Output_section::input_section_order_specified): New
7825 method.
7826 (Output_section::set_input_section_order_specified): New method.
7827 (Input_section::Input_section): Initialize section_order_index_.
7828 (Input_section::section_order_index): New method.
7829 (Input_section::set_section_order_index): New method.
7830 (Input_section::section_order_index_): New member.
7831 (Input_section::Input_section_sort_section_order_index_compare): New
7832 struct.
7833 (Output_section::input_section_order_specified_): New member.
7834 * script-sections.cc (is_wildcard_string): Delete and move modified
7835 method to gold.h.
7836 (Output_section_element_input::Output_section_element_input): Modify
7837 call to is_wildcard_string.
7838 (Output_section_element_input::Input_section_pattern
7839 ::Input_section_pattern): Ditto.
7840 (Output_section_element_input::Output_section_element_input): Ditto.
7841 * testsuite/Makefile.am (final_layout): New test case.
7842 * testsuite/Makefile.in: Regenerate.
7843 * testsuite/final_layout.cc: New file.
7844 * testsuite/final_layout.sh: New file.
7845
7846 2010-06-01 Rafael Espindola <espindola@google.com>
7847
7848 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7849
7850 2010-06-01 Rafael Espindola <espindola@google.com>
7851
7852 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7853 visibility of symbols.
7854
7855 2010-05-27 Doug Kwan <dougkwan@google.com>
7856
7857 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7858 from start of output section instead of address for a local symbol
7859 in a merged or relaxed section when doing a relocatable link.
7860
7861 2010-05-26 Rafael Espindola <espindola@google.com>
7862
7863 PR 11604
7864 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7865 adding sections the garbage collector removed.
7866 * gold/testsuite/Makefile.am: Add test.
7867 * gold/testsuite/Makefile.in: Regenerate.
7868 * gold/testsuite/plugin_test_7.sh: New.
7869 * gold/testsuite/plugin_test_7_1.c: New.
7870 * gold/testsuite/plugin_test_7_2.c: New.
7871
7872 2010-05-26 Rafael Espindola <espindola@google.com>
7873
7874 * script-sections.cc (Output_section_definition::set_section_addresses):
7875 Check for --section-start.
7876
7877 2010-05-26 Doug Kwan <dougkwan@google.com>
7878
7879 * arm.cc (Arm_scan_relocatable_relocs): New class.
7880 (Target_arm::relocate_special_relocatable): New method.
7881 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7882 (Arm_relocate_functions::thumb_branch_common): Same.
7883 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7884 instead of Default_scan_relocatable_relocs.
7885 * target-reloc.h (relocate_for_relocatable): Let target handle
7886 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7887 * target.h (Sized_target::relocate_special_relocatable): New method.
7888
7889 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7890
7891 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7892
7893 2010-05-23 Doug Kwan <dougkwan@google.com>
7894
7895 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7896 instead of a cast.
7897 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7898 with a direct branch, not a conditional branch, to a stub.
7899 * merge.cc (Output_merge_base::record_input_section): New method
7900 defintion.
7901 (Output_merge_data::do_add_input_section): Record input section if
7902 keeps-input-sections flag is set.
7903 (Output_merge_string::do_add_input_section): Ditto.
7904 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7905 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7906 INPUT_SECTIONS_.
7907 (Output_merge_base::keeps_input_sections,
7908 Output_merge_base::set_keeps_input_sections,
7909 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7910 method definitions.
7911 (Output_merge_base::Input_sections): New type declaration.
7912 (Output_merge_base::input_sections_begin,
7913 Output_merge_base::input_sections_end,
7914 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7915 (Output_merge_base::bool keeps_input_sections_,
7916 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7917 Output_merge_base::input_sections_): New data members.
7918 (Output_merge_data::do_set_keeps_input_sections): New method
7919 defintion.
7920 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7921 * output.cc (Output_section::Input_section::relobj): Move method
7922 defintion from class declaration to here and handle merge sections.
7923 (Output_section::Input_section::shndx): Ditto.
7924 (Output_section::Output_section): Remove initializations of removed
7925 data members and initialize new data member LOOKUP_MAPS_.
7926 (Output_section::add_input_section): Set keeps-input-sections flag
7927 for a newly created merge output section as appropriate. Adjust code
7928 to use Output_section_lookup_maps class.
7929 (Output_section::add_relaxed_input_section): Adjst code for lookup
7930 maps code refactoring.
7931 (Output_section::add_merge_input_section): Add a new parameter
7932 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7933 class. If adding input section to a newly created merge output
7934 section fails, remove the new merge section.
7935 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7936 Adjust code for use of the Output_section_lookup_maps class.
7937 (Output_section::find_merge_section): Ditto.
7938 (Output_section::build_lookup_maps): New method defintion.
7939 (Output_section::find_relaxed_input_section): Adjust code to use
7940 Output_section_lookup_maps class.
7941 (Output_section::get_input_sections): Export merge sections. Adjust
7942 code to use Output_section_lookup_maps class.
7943 (Output_section:::add_script_input_section): Adjust code to use
7944 Output_section_lookup_maps class. Update lookup maps for merge
7945 sections also.
7946 (Output_section::discard_states): Use Output_section_lookup_maps.
7947 (Output_section::restore_states): Same.
7948 * output.h (Merge_section_properties): Move class defintion out of
7949 Output_section.
7950 (Output_section_lookup_maps): New class.
7951 (Output_section::Input_section::is_merge_section): New method
7952 defintion.
7953 (Output_section::Input_section::relobj): Move defintion out of class
7954 defintion. Declare method only.
7955 (Output_section::Input_section::shndx): Ditto.
7956 (Output_section::Input_section::output_merge_base): New method defintion.
7957 (Output_section::Input_section::u2_.pomb): New union field.
7958 (Output_section::Merge_section_by_properties_map,
7959 Output_section::Output_section_data_by_input_section_map,
7960 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7961 Remove types.
7962 (Output_section::add_merge_input_section): Add new parameter
7963 KEEPS_INPUT_SECTIONS.
7964 (Output_section::build_lookup_maps): New method declaration.
7965 (Output_section::merge_section_map_,
7966 Output_section::merge_section_by_properties_map_,
7967 Output_section::relaxed_input_section_map_,
7968 Output_section::is_relaxed_input_section_map_valid_): Remove data
7969 members.
7970 (Output_section::lookup_maps_): New data member.
7971
7972 2010-05-21 Doug Kwan <dougkwan@google.com>
7973
7974 PR gold/11619
7975 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7976 avoid a compilation error.
7977
7978 2010-05-19 Rafael Espindola <espindola@google.com>
7979
7980 * script-sections.cc (Output_section_definition::allocate_to_segment):
7981 Update the phdrs_list even when the output section is NULL.
7982 * testsuite/Makefile.am: Add test.
7983 * testsuite/Makefile.in: Regenerate.
7984 * testsuite/script_test_9.cc: New.
7985 * testsuite/script_test_9.sh: New.
7986 * testsuite/script_test_9.t: New.
7987
7988 2010-05-19 Doug Kwan <dougkwan@google.com>
7989
7990 * arm.cc (Arm_input_section::original_size): New method.
7991 (Arm_input_section::do_addralign): Add a cast.
7992 (Arm_input_section::do_output_offset): Remove static cast.
7993 (Arm_input_section::original_addralign,
7994 Arm_input_section::original_size_): Change type to uint32_t.
7995 (Arm_input_section::init): Add safe casts for section alignment
7996 and size.
7997 (Arm_input_section::set_final_data_size): Do not set address and
7998 offset of stub table.
7999 (Arm_output_section::fix_exidx_coverage): Change use of of
8000 Output_section::Simple_input_section to that of
8001 Output_section::Input_section.
8002 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8003 except for the first pass.
8004 * output.cc (Output_section::get_input_sections): Change type of
8005 input_sections to std::list<Input_section>.
8006 (Output_section::add_script_input_section): Rename from
8007 Output_section::add_simple_input_section. Change type of SIS
8008 parameter from Simple_input_section to Input_section.
8009 * output.h (Output_section::Simple_input_section): Remove class.
8010 (Output_section::Input_section): Change class visibility to public.
8011 (Output_section::Input_section::addralign): Use stored alignments
8012 for special input sections if set.
8013 (Output_section::Input_section::set_addralign): New method.
8014 (Output_section::get_input_sections): Change parameter type from
8015 list of Simple_input_section to list of Input_section.
8016 (Output_section::add_script_input_section): Rename from
8017 Output_section::add_simple_input_section. Change first parameter's
8018 type from Simple_input_section to Input_section and remove the
8019 second and third parameters.
8020 * script-sections.cc (Input_section::Input_section_list): Change
8021 type to list of Output_section::Input_section/
8022 (Input_section_info::Input_section_info): Change parameter type of
8023 INPUT_SECTION to Output_section::Input_section.
8024 (Input_section_info::input_section): Change return type.
8025 (Input_section_info::input_section_): Change type to
8026 Output_section::Input_section.
8027 (Output_section_element_input::set_section_addresses): Adjust code
8028 to use Output_section::Input_section instead of
8029 Output_section::Simple_input_section. Adjust code for renaming
8030 of Output_section::add_simple_input_section.
8031 (Orphan_output_section::set_section_addresses): Ditto.
8032
8033 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8034
8035 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8036 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8037
8038 2010-05-18 Rafael Espindola <espindola@google.com>
8039
8040 * options.cc (General_options::finalize): Handle -nostdlib.
8041 * options.h (nostdlib): New option.
8042 * script.cc (script_add_search_dir): Handle -nostdlib.
8043
8044 2010-05-12 Doug Kwan <dougkwan@google.com>
8045
8046 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8047 attributes section only if there no attributes section after merging.
8048 (Target_arm::merge_object_attributes): Move value of
8049 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8050 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8051 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8052 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8053 and arm_attr_merge_7.stdout.
8054 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8055 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8056 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8057 arm_attr_merge_7b.o): New rules.
8058 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8059 arm_attr_merge_7
8060 * testsuite/Makefile.in: Regenerate.
8061 * testsuite/arm_attr_merge.sh: New file.
8062 * testsuite/arm_attr_merge_[67][ab].s: Same.
8063
8064 2010-05-05 Nick Clifton <nickc@redhat.com>
8065
8066 * po/es.po: Updated Spanish translation.
8067
8068 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8069
8070 * Makefile.am (install-exec-local): Properly install gold as
8071 default cross linker.
8072 * Makefile.in: Regenerated.
8073
8074 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8075 Nick Clifton <nickc@redhat.com>
8076
8077 * configure.ac (install_as_default): Define and set to false
8078 unless --enable-gold or --enable-gold=both/gold has been
8079 specified.
8080 * configure: Regenerate.
8081
8082 * Makefile.am (install-exec-local): Install the executable as
8083 'ld.gold'. If install_as_default is true then also install it as
8084 'ld'.
8085 * Makefile.in: Regenerated.
8086
8087 2010-04-24 Ian Lance Taylor <iant@google.com>
8088
8089 * layout.cc (Layout::layout_reloc): In relocatable link don't
8090 combine reloc sections for grouped sections.
8091
8092 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8093
8094 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8095 sections that are not ordinary to icf.
8096 * icf.cc (get_section_contents): Handle relocation pointing to section
8097 with no object or shndx information.
8098 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8099 * testsuite/Makefile.in: Regenerate.
8100 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8101 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8102
8103 2010-04-22 Ian Lance Taylor <iant@google.com>
8104
8105 * expression.cc (Expression::Expression_eval_info): Add
8106 result_alignment_pointer field.
8107 (Expression::eval_with_dot): Add result_alignment_pointer
8108 parameter. Change all callers.
8109 (Expression::eval_maybe_dot): Likewise.
8110 (class Binary_expression): Add alignment_pointer parameter to
8111 left_value and right_value. Change all callers.
8112 (BINARY_EXPRESSION): Set result alignment.
8113 (class Trinary_expression): Add alignment_pointer parameter to
8114 arg2_value and arg3_value. Change all callers.
8115 (Trinary_cond::value): Set result alignment.
8116 (Max_expression::value, Min_expression::value): Likewise.
8117 (Align_expression::value): Likewise.
8118 * script-sections.cc (class Sections_element): Add dot_alignment
8119 parameter to set_section_addresses virtual function. Update
8120 instantiations.
8121 (class Output_section_element): Likewise.
8122 (Script_sections::create_segments): Add dot_alignment parameter.
8123 Change all callers.
8124 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8125 (Script_sections::set_phdrs_clause_addresses): Likewise.
8126 * script-sections.h: Update declarations.
8127 * script.h: Update declarations.
8128 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8129 min_p_align.
8130 * testsuite/script_test_3.t: Set large alignment.
8131 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8132 segment has expected alignment.
8133
8134 2010-04-22 Nick Clifton <nickc@redhat.com>
8135
8136 * po/gold.pot: Updated by the Translation project.
8137 * po/vi.po: Updated Vietnamese translation.
8138
8139 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8140
8141 * testsuite/Makefile.am (check_PROGRAMS): Add
8142 icf_virtual_function_folding_test.
8143 * testsuite/Makefile.in: Regenerated.
8144
8145 2010-04-15 Andrew Haley <aph@redhat.com>
8146
8147 * options.h (merge_exidx_entries): New option.
8148 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8149 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8150 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8151 (Target_arm::merge_exidx_entries): New function.
8152 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8153 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8154 to Arm_exidx_fixup constructor.
8155 Add new arg, merge_exidx_entries.
8156 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8157 Arm_output_section::fix_exidx_coverage.
8158
8159 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8160
8161 * icf.cc (get_section_contents): Check for preemptible functions.
8162 Ignore addend when appropriate.
8163 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8164 section folded.
8165 (add_from_relobj): Check for section folded.
8166 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8167 * symtab.h (should_add_dynsym_entry): Add new parameter.
8168 * target-reloc.h (scan_relocs): Check for section folded.
8169 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8170 Check reloc types for function pointers in shared objects.
8171 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8172 case.
8173 (icf_preemptible_functions_test): New test case.
8174 (icf_string_merge_test): New test case.
8175 * testsuite.Makefile.in: Regenerate.
8176 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8177 bar_glob. Refactor code.
8178 * testsuite/icf_preemptible_functions_test.cc: New file.
8179 * testsuite/icf_preemptible_functions_test.sh: New file.
8180 * testsuite/icf_string_merge_test.cc: New file.
8181 * testsuite/icf_string_merge_test.sh: New file.
8182 * testsuite/icf_virtual_function_folding_test.cc: New file.
8183 * testsuite/icf_virtual_function_folding_test.sh: New file.
8184
8185 2010-04-14 Doug Kwan <dougkwan@google.com>
8186
8187 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8188 for local symbol recounting if we remove a section due to ICF.
8189 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8190 there are no regular objects in input.
8191
8192 2010-04-13 Doug Kwan <dougkwan@google.com>
8193
8194 * arm.cc (Arm_input_section::set_final_data_size): Compute
8195 accurate final data size instead of using current data size.
8196
8197 2010-04-09 Doug Kwan <dougkwan@google.com>
8198
8199 * layout.cc (Layout::choose_output_section): Handle script section
8200 types.
8201 (Layout::make_output_section_for_script): Add section type parameter.
8202 Handle script section types.
8203 * layout.h (Layout::make_output_section_for_script): Add section
8204 type parameter.
8205 * output.cc (Output_section::Output_section): Initialize data member
8206 is_noload_.
8207 (Output_section::do_reset_address_and_file_offset): Do not set address
8208 to 0 if section is a NOLOAD section.
8209 * output.h (Output_section::is_noload): New method.
8210 (Output_section::set_is_noload): Ditto.
8211 (Output_section::is_noload_): New data member.
8212 * script-c.h (Script_section_type): New enum type.
8213 (struct Parser_output_section_header): Add new file section_type.
8214 * script-sections.cc (Sections_element::output_section_name): Add
8215 parameter for returning script section type.
8216 (Output_section_definition::output_section_name): Ditto.
8217 (Output_section_definition::section_type)P; New method.
8218 (Output_section_definiton::script_section_type_name): Ditto.
8219 (Output_section_definition::script_section_type_): New data member.
8220 (Output_section_definition::Output_section_definition): Initialize
8221 data member Output_section_definition::script_section_type_.
8222 (Output_section_definition::create_sections): Pass script section type
8223 to Layout::make_output_section_for_script.
8224 (Output_section_definition::output_section_name): Return script
8225 section type to caller.
8226 (Output_section_definition::set_section_address): Do not advance
8227 dot value and load address if section type is NOLOAD. Set address
8228 of NOLOAD sections regardless of section flags.
8229 (Output_section_definition::print): Print section type if it is
8230 not SCRIPT_SECTION_TYPE_NONE.
8231 (Output_section_definition::section_type): New method.
8232 (Output_section_definition::script_section_type_name): Ditto.
8233 (Script_sections::output_section_name): Add new parameter
8234 PSECTION_TYPE for returning script section type. Pass it to
8235 section elements. Handle discard sections.
8236 (Sort_output_sections::operator()): Handle NOLOAD sections.
8237 * script-sections.h (Script_sections::Section_type): New enum type.
8238 (Script_sections::output_section_name): Add a new parameter for
8239 returning script section type.
8240 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8241 INFO and NOLOAD.
8242 * yyscript.y (union): Add new field SECTION_TYPE.
8243 (COPY, DSECT, INFO, NOLOAD): New tokens.
8244 (opt_address_and_section_type): Change type to output_section_header.
8245 (section_type): New non-terminal
8246 (section_header): Handle section type.
8247 (opt_address_and_section_type): Return section type value.
8248
8249 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8250
8251 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8252 * testsuite/plugin_common_test_2.c (foo): Likewise.
8253
8254 2010-04-08 Doug Kwan <dougkwan@google.com>
8255
8256 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8257 Output_merge_data.
8258 * output.cc (Output_section::add_merge_input_section): Simplify
8259 code and return status of Output_merge_base::add_input_section.
8260 Update merge section map only if Output_merge_base::add_input_section
8261 returns true.
8262
8263 2010-04-07 Doug Kwan <dougkwan@google.com>
8264
8265 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8266 if section is marked as containing instructions but has no mapping
8267 symbols.
8268 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8269 correct section index.
8270 (Arm_relobj::find_linked_text_section): Ditto.
8271
8272 2010-04-07 Cary Coutant <ccoutant@google.com>
8273
8274 * archive.cc (include_member): Destroy Read_symbols_data object before
8275 releasing file.
8276 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8277 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8278 (Read_symbols_data::~Read_symbols_data) New destructor.
8279 (Section_relocs::Section_relocs) New constructor.
8280 (Section_relocs::~Section_relocs) New destructor.
8281 (Read_relocs_data::Read_relocs_data) New constructor.
8282 (Read_relocs_data::~Read_relocs_data) New destructor.
8283 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8284 pointers to NULL after deleting.
8285
8286 2010-04-07 Doug Kwan <dougkwan@google.com>
8287
8288 * arm.cc: Replace "endianity" with "endianness" in comments.
8289 (Arm_exidx_cantunwind): Ditto.
8290 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8291 (Arm_relobj::merge_flags_and_attributes): New method.
8292 (Arm_relobj::merge_flags_and_attributes_): New data member.
8293 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8294 (Arm_relobj::scan_sections_for_stubs): Ditto.
8295 (Arm_relobj::do_read_symbols): Check to see if we really want to
8296 merge processor-specific flags and attributes. Exit early if
8297 an object is empty except for section names and the undefined symbol.
8298 (Target_arm::do_finalize_sections): Move check for ELF format to
8299 Arm_relobj::do_read_symbols. Merge processor specific flags and
8300 attributes from a regular object only when we have determined that
8301 it is aapropriate. Do not create an .ARM.attributes section in
8302 output if there is no regular input object.
8303 (Target_arm::merge_processor_specific_flags): Check
8304 --warn-mismatch before printing any error.
8305 (Target_arm::merge_object_attributes): Ditto.
8306 * gold.cc (queue_middle_tasks): Handle the case in which there is
8307 no regular object in input.
8308 * options.cc (General_options::parse_EB): New method.
8309 (General_options::parse_EL): Same.
8310 (General_options::General_options): Initialize endianness_.
8311 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8312 New options.
8313 (General_options::Endianness): New enum.
8314 (General_options::endianness): New method.
8315 (General_options::endianness_): New data member.
8316 * parameters.cc (Parameters::set_options): Check target endianness.
8317 (Parameters::set_target_once): Ditto.
8318 (Parameters::check_target_endianness): New method.
8319 (parameters_force_valid_target): If either -EL or -EB is specified,
8320 use it to define endianness of default target.
8321 * parameters.h (Parameters::check_target_endianness): New method
8322 declaration.
8323 * target.h (class Target): Change "endianity" to "endianness"
8324 in comments.
8325
8326 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8327
8328 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8329 * configure: Regenerate.
8330 * Makefile.in: Regenerate.
8331 * testsuite/Makefile.in: Regenerate.
8332
8333 2010-04-06 Cary Coutant <ccoutant@google.com>
8334
8335 gcc PR lto/42757
8336 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8337 prevailing definitions of common symbols.
8338 * testsuite/plugin_test_6.sh: New test case.
8339 * testsuite/plugin_common_test_1.c: New test case.
8340 * testsuite/plugin_common_test_2.c: New test case.
8341 * testsuite/Makefile.am (plugin_test_6): New test case.
8342 * testsuite/Makefile.in: Regenerate.
8343
8344 2010-04-06 Nick Clifton <nickc@redhat.com>
8345
8346 * po/vi.po: New Vietnamese translation.
8347
8348 2010-03-30 Doug Kwan <dougkwan@google.com>
8349
8350 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8351
8352 2010-03-25 Doug Kwan <dougkwan@google.com>
8353
8354 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8355 to avoid a conversion warning on a 32-bit host.
8356
8357 2010-03-24 Ian Lance Taylor <iant@google.com>
8358
8359 * testsuite/script_test_3.t: Add a TLS segment.
8360 * testsuite/Makefile.am (check_PROGRAMS): Add
8361 tls_phdrs_script_test.
8362 (tls_phdrs_script_test_SOURCES): Define.
8363 (tls_phdrs_script_test_DEPENDENCIES): Define.
8364 (tls_phdrs_script_test_LDFLAGS): Define.
8365 (tls_phdrs_script_test_LDADD): Define.
8366 * testsuite/Makefile.in: Rebuild.
8367
8368 2010-03-23 Cary Coutant <ccoutant@google.com>
8369
8370 * fileread.cc (find_or_make_view): Fix comment.
8371
8372 2010-03-23 Ian Lance Taylor <iant@google.com>
8373
8374 * script-sections.cc (class Orphan_section_placement): Define
8375 PLACE_TLS and PLACE_TLS_BSS.
8376 (Orphan_section_placement::Orphan_section_placement): Initialize
8377 new places.
8378 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8379 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8380 (tls_script_test_SOURCES): Define.
8381 (tls_script_test_DEPENDENCIES): Define.
8382 (tls_script_test_LDFLAGS): Define.
8383 (tls_script_test_LDADD): Define.
8384 * testsuite/Makefile.in: Rebuild.
8385
8386 2010-03-22 Doug Kwan <dougkwan@google.com>
8387
8388 * arm.cc (Arm_relocate_functions::abs8,
8389 Arm_relocate_functions::abs16): Use correct check for overflow
8390 specified in the ARM ELF specs.
8391 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8392 target of a BLX instruction specially.
8393 (Reloc_stub::stub_type_for_reloc): Ditto.
8394 (Relocate::relocate): Use symbolic names instead of numeric relocation
8395 codes to report error.
8396 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8397 workaround.
8398 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8399 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8400 thumb2_blx_out_of_range.stdout
8401 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8402 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8403 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8404 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8405 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8406 thumb2_blx_in_range, thumb2_blx_in_range.o,
8407 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8408 thumb2_blx_out_of_range.o): New rules.
8409 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8410 thumb2_blx_in_range and thumb2_blx_out_of_range.
8411 * testsuite/Makefile.in: Regenerate.
8412 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8413 * testsuite/thumb_blx_in_range.s: New file.
8414 * testsuite/thumb_blx_out_of_range.s: New file.
8415
8416 2010-03-22 Rafael Espindola <espindola@google.com>
8417
8418 * archive.cc (Should_include): Move to archive.h.
8419 (should_include_member): Make it a member of Archive.
8420 (Lib_group): New.
8421 (Add_lib_group_symbols): New.
8422 * archive.h: Include options.h.
8423 (Archive_member): Moved from Archive.
8424 (Should_include): Moved from archive.cc.
8425 (Lib_group): New.
8426 (Add_lib_group_symbols): New.
8427 * dynobj.cc (do_should_include_member): New.
8428 * dynobj.h (do_should_include_member): New.
8429 * gold.cc (queue_initial_tasks): Update call to queue.
8430 * main.cc (main): Print lib group stats.
8431 * object.cc (do_should_include_member): New.
8432 * object.h: Include archive.h.
8433 (Object::should_include_member): New.
8434 (Object::do_should_include_member): New.
8435 (Sized_relobj::do_should_include_member): New.
8436 * options.cc (General_options::parse_start_lib): New.
8437 (General_options::parse_end_lib): New.
8438 (Input_arguments::add_file): Handle lib groups.
8439 (Input_arguments::start_group): Check we are not in a lib.
8440 (Input_arguments::start_lib): New.
8441 (Input_arguments::end_lib): New.
8442 * options.h (General_options): Add start_lib and end_lib.
8443 (Input_argument::lib_): New.
8444 (Input_argument::lib): New.
8445 (Input_argument::is_lib): New.
8446 (Input_file_lib): New.
8447 (Input_arguments::in_lib_): New.
8448 (Input_arguments::in_lib): New.
8449 (Input_arguments::start_lib): New.
8450 (Input_arguments::end_lib_): New.
8451 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8452 in unused members as preempted.
8453 (Sized_pluginobj::do_should_include_member): New.
8454 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8455 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8456 return the blocker.
8457 (Read_symbols::do_whole_lib_group): New.
8458 (Read_symbols::do_lib_group): New.
8459 (Read_symbols::do_read_symbols): Handle lib groups.
8460 (Read_symbols::get_name): Handle lib groups.
8461 * readsyms.h (Read_symbols): Add an archive member pointer.
8462 (Read_symbols::do_whole_lib_group): New.
8463 (Read_symbols::do_lib_group): New.
8464 (Read_symbols::member_): New.
8465 * script.cc (read_input_script): Update call to queue_soon.
8466
8467 2010-03-19 Doug Kwan <dougkwan@google.com>
8468
8469 * arm.cc (Stub_table::Stub_table): Initialize new data members
8470 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8471 (Stub_table::add_reloc_stub): Assign stub offset and update
8472 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8473 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8474 New data members.
8475 (Stub_table::update_data_size_and_addralign): Use
8476 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8477 instead of going over all reloc stubs.
8478 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8479 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8480 Stringpool_template::offset_ to size of Stringpool_char.
8481 (Stringpool_template::new_key_offset): Remove code to initialize
8482 Stringpool_template::offset_.
8483 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8484 Stringpool_template::offset_ to zero.
8485
8486 2010-03-15 Doug Kwan <dougkwan@google.com>
8487
8488 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8489 offset_.
8490 (Stringpool_template::new_key_offset): New method.
8491 (Stringpool_template::add_string): Assign offsets when adding new
8492 strings.
8493 (Stringpool_template::set_string_offsets): Do not set string offsets
8494 when not optimizing.
8495 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8496 member size_.
8497 (Chunked_vector::clear): Clear size_.
8498 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8499 (Chunked_vector::size): Return size_.
8500 (Chunked_vector::push_back): Use size_ to find insert position.
8501 (Chunked_vector::size_): New data member.
8502 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8503 (Stringpool_template::new_key_offset): New method declaration.
8504 (Stringpool_template::offset_): New data member.
8505
8506 2010-03-15 Rafael Espindola <espindola@google.com>
8507
8508 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8509 Add_symbols' constructor.
8510 * readsyms.h (Add_symbols): Remove the input_group member.
8511
8512 2010-03-10 Ian Lance Taylor <iant@google.com>
8513
8514 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8515 target to ask whether a reference to a symbol requires a stack
8516 split.
8517 * target.h (Target::is_call_to_non_split): New function.
8518 (Target::do_is_call_to_non_split): Declare virtual function.
8519 * target.cc: Include "symtab.h".
8520 (Target::do_is_call_to_non_split): New function.
8521 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8522
8523 2010-03-10 Cary Coutant <ccoutant@google.com>
8524
8525 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8526 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8527 (File_read::open[2]): Add whole_file_view_ to list of views.
8528 (File_read::make_view): Remove test of whole_file_view_.
8529 (File_read::find_or_make_view): Create whole_file_view_ if
8530 necessary.
8531 (File_read::clear_views): Replace bool parameter with enum;
8532 adjust all callers. Don't delete views with permanent data;
8533 do delete cached views and views from archives if
8534 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8535 if clearing the corresponding view.
8536 * fileread.h (File_read::Clear_views_mode): New enum.
8537 (File_read::View::is_permanent_view): New method.
8538 (File_read::clear_views): Replace bool parameter
8539 with enum; adjust all callers.
8540 * options.h (General_options): Change keep_files_mapped option;
8541 add map_whole_files.
8542 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8543 releasing the file.
8544 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8545 the file.
8546
8547 2010-03-10 David S. Miller <davem@davemloft.net>
8548
8549 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8550
8551 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8552
8553 * icf.cc (get_section_contents): Add '@' marker after processing the
8554 merge reloc.
8555
8556 2010-03-08 Doug Kwan <dougkwan@google.com>
8557
8558 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8559 due to a conversion warning.
8560 (Arm_relobj::update_output_local_symbol_count): Check for local
8561 symbol with unset output index.
8562
8563 2010-03-05 Ian Lance Taylor <iant@google.com>
8564
8565 * options.h (class General_options): Add --spare-dynamic-tags.
8566 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8567 --spare-dynamic-tags.
8568
8569 2010-03-05 Ian Lance Taylor <iant@google.com>
8570
8571 * incremental.cc: Include "libiberty.h".
8572
8573 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8574
8575 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8576 function, is_info_ member.
8577 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8578 (Versions::Versions): Update caller.
8579 (Versions::define_base_version): Likewise.
8580 (Versions::add_def): Likewise.
8581
8582 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8583
8584 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8585 (Scan::possible_function_pointer_reloc): New function.
8586 (Scan::local_reloc_may_be_function_pointer): Change to call
8587 possible_function_pointer_reloc.
8588 (Scan::global_reloc_may_be_function_pointer): Ditto.
8589 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8590 relocations in ".data.rel.ro._ZTV" section.
8591 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8592 * testsuite/icf_safe_so_test.cc: Ditto.
8593 * testsuite/icf_safe_test.cc: Ditto.
8594 * testsuite/icf_safe_test.sh: Ditto.
8595
8596 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8597 Ian Lance Taylor <iant@google.com>
8598
8599 * target-reloc.h (relocate_section): Check the symbol table index
8600 for -1U before setting the local symbol index.
8601 (scan_relocatable_relocs): If copying the relocation, record that
8602 the local symbol is required.
8603 * object.h (Symbol_value::is_output_symtab_index_set): New
8604 function.
8605 (Symbol_value::may_be_discarded_from_output_symtab): New
8606 function.
8607 (Symbol_value::has_output_symtab_entry): New function.
8608 (Symbol_value::needs_output_symtab_entry): Remove.
8609 (Symbol_value::output_symtab_index): Make sure the symbol index is
8610 set.
8611 (Symbol_value::set_output_symtab_index): Make sure the symbol
8612 index is not set. Make sure the new index is valid.
8613 (Symbol_value::set_must_have_output_symtab_entry): New function.
8614 (Symbol_value::has_output_dynsym_entry): New function.
8615 (Symbol_value::set_output_dynsym_index): Make sure the new index
8616 is valid.
8617 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8618 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8619 local symbol if permitted.
8620 (Sized_relobj::do_finalize_local_symbols): Call
8621 is_output_symtab_index_set rather than needs_output_symtab_entry.
8622 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8623 rather than needs_output_symtab_entry. Call
8624 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8625 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8626 is_output_symtab_index_set rather than needs_output_symtab_entry.
8627 * testsuite/discard_locals_relocatable_test.c: New file.
8628 * testsuite/discard_locals_test.sh: Test -r.
8629 * testsuite/Makefile.am (check_DATA): Add
8630 discard_locals_relocatable_test1.syms,
8631 discard_local_relocatable_test2.syms.
8632 (MOSTLYCLEANFILES): Likewise. Also add
8633 discard_locals_relocatable_test1.lout and
8634 discard_locals_relocatable_test2.out.
8635 (discard_locals_relocatable_test1.syms): New target.
8636 (discard_locals_relocatable_test.o): New target.
8637 (discard_locals_relocatable_test1.out): New target.
8638 (discard_locals_relocatable_test2.syms): New target.
8639 (discard_locals_relocatable_test2.out): New target.
8640 (various): Add missing ../ld-new dependencies.
8641 * testsuite/Makefile.in: Rebuild.
8642
8643 2010-03-03 Nick Clifton <nickc@redhat.com>
8644
8645 * po/fi.po: New Finnish translation.
8646
8647 2010-03-01 Doug Kwan <dougkwan@google.com>
8648
8649 * layout.cc (Layout::Layout): Force section types of .init_array*,
8650 .preinit_array* and .fini_array* sections.
8651 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8652 Fix check of return value of std::string::find.().
8653 (Output_section::Input_section_sort_compare::operator()): Remove
8654 comment about .init_array.
8655 (Output_section::Input_section_sort_init_fini_compare::operator()):
8656 New method.
8657 (Output_section::sort_attached_input_sections): Handle .init_array
8658 and .fini_array specially.
8659 * output.h (Output_section::Inut_section_sort_compare): Update
8660 comment.
8661 (Output_section::Input_section_sort_init_fini_compare): New struct.
8662
8663 2010-02-26 Doug Kwan <dougkwan@google.com>
8664
8665 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8666 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8667 * testsuite/debug_msg.sh: Avoid matching source line number for
8668 use of global variable undef_int.
8669
8670 2010-02-26 Doug Kwan <dougkwan@google.com>
8671
8672 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8673 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8674 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8675 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8676 * options.cc (General_options::General_options): Initialize member
8677 fix_v4bx_.
8678 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8679 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8680 and rm_no_fix_v4bx.stdout
8681 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8682 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8683 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8684 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8685 and arm_no_fix_v4bx.
8686 * Makefile.in: Regenerate.
8687 * testsuite/arm_fix_v4bx.s: New file.
8688 * testsuite/arm_fix_v4bx.sh: Ditto.
8689
8690 2010-02-24 Doug Kwan <dougkwan@google.com>
8691
8692 * arm.cc (Target_arm::got_section): Make the .got section the first
8693 non RELRO section in the data segment.
8694 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8695 suffixes of section names.
8696
8697 2010-02-24 Doug Kwan <dougkwan@google.com>
8698
8699 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8700 flags and attributes merging if an input file is a binary file.
8701 * fileread.cc (Input_file::open): Record format of original file.
8702 * fileread.h (Input_file::Format): New enum type.
8703 (Input_file::Input_file): Initialize data member format_.
8704 (Input_file::format): New method definition.
8705 (Input_file::format_):: New data member.
8706
8707 2010-02-24 Doug Kwan <dougkwan@google.com>
8708
8709 * arm.cc (Arm_output_data_got): New class.
8710 (ARM_TCB_SIZE): New constant
8711 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8712 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8713 If user uses a script with a SECTIONS clause, issue only a warning
8714 for a misplaced EXIDX input section. Otherwise, issue an error.
8715 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8716 garbage collection.
8717 (Target_arm::got_mode_index_entry): Handle static linking.
8718 (Target_arm::Scan::local): Ditto.
8719 (Target_arm::Scan::global): Ditto.
8720 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8721 all incorrectly implemented relocations.
8722 (Target_arm::fix_exidx_coverage): Pass layout to
8723 Arm_output_section::fix_exidx_coverage.
8724 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8725 from ".ARM.exidx." and ".ARM.extab.".
8726
8727 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8728
8729 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8730 section if it does not already exist.
8731 * attributes.cc (Attributes_section_data::Attributes_section_data):
8732 Don't crash if size is zero.
8733
8734 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8735 Ian Lance Taylor <iant@google.com>
8736
8737 * gold.cc (queue_middle_tasks): If no input files were opened,
8738 exit.
8739 * workqueue.h (Task_function::Task_function): Assert that there is
8740 a blocker.
8741
8742 2010-02-22 Doug Kwan <dougkwan@google.com>
8743
8744 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8745 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8746 types to avoid warnings due to different uint64_t implementations
8747 on different hosts.
8748
8749 2010-02-21 Doug Kwan <dougkwan@google.com>
8750
8751 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8752 handling of the maximum backward branch offset.
8753 (Arm_relocate_functions::thumb_branch_common): Ditto.
8754 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8755 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8756 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8757 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8758 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8759 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8760 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8761 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8762 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8763 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8764 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8765 thumb2_bl_out_of_range.o): New rules.
8766 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8767 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8768 thumb2_bl_out_of_range
8769 * testsuite/Makefile.in: Regenerate.
8770 * testsuite/arm_bl_in_range.s: New file.
8771 * testsuite/arm_bl_out_of_range.s: Ditto.
8772 * testsuite/arm_branch_in_range.sh: Ditto.
8773 * testsuite/arm_branch_range.t: Ditto.
8774 * testsuite/thumb2_branch_range.t: Ditto.
8775 * testsuite/thumb_bl_in_range.s: Ditto.
8776 * testsuite/thumb_bl_out_of_range.s: Ditto.
8777 * testsuite/thumb_branch_range.t: Ditto.
8778
8779 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8780
8781 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8782 Add reloc offset information.
8783 * icf.cc (get_section_contents): Change iterators to point to the new
8784 vectors. Add reloc offset information to the contents.
8785 * icf.h (Icf::Sections_reachable_info): New typedef.
8786 (Icf::Sections_reachable_list): New typedef.
8787 (Icf::Offset_info): New typedef.
8788 (Icf::Reloc_info): New struct typedef.
8789 (Icf::Reloc_info_list): New typedef.
8790 (Icf::symbol_reloc_list): Delete method.
8791 (Icf::addend_reloc_list): Delete method.
8792 (Icf::section_reloc_list): Delete method.
8793 (Icf::reloc_info_list): New method.
8794 (Icf::reloc_info_list_): New member.
8795
8796 2010-02-19 Doug Kwan <dougkwan@google.com>
8797
8798 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8799 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8800 * arm.cc (Arm_relocation_functions): New forward declaration.
8801 (Target_arm::Target_arm): Initialize new data members
8802 got_mod_index_offset_ and tls_base_symbol_defined_.
8803 (Target_arm::Relocate::relocate_tls): New method.
8804 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8805 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8806 New methods.
8807 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8808 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8809 (Target_arm::got_mod_index_offset_,
8810 Target_arm::tls_base_symbol_defined_): New data members.
8811 (Target_arm::Scan::local, Target::Scan::global,
8812 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8813 relocations.
8814
8815 2010-02-18 Doug Kwan <dougkwan@google.com>
8816
8817 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8818 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8819 text section as a parameter becuase some broken tools may not set
8820 the link in section header.
8821 (Target_arm::has_got_section): New method.
8822 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8823 without any mapping symbol as data only. Remove warning.
8824 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8825 link in its section header, try to discover the link by inspecting the
8826 REL31 relocation at the beginning of the section.
8827 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8828 in error message.
8829 (Target_arm::Scan::global): Treat any reference to the symbol
8830 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8831
8832 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8833
8834 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8835 (Scan::global_reloc_may_be_function_pointer): New function.
8836 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8837 (Scan::global_reloc_may_be_function_pointer): New function.
8838 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8839 (Scan::global_reloc_may_be_function_pointer): New function.
8840 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8841 (Scan::global_reloc_may_be_function_pointer): New function.
8842 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8843 (Scan::global_reloc_may_be_function_pointer): New function.
8844 (Scan::possible_function_pointer_reloc): New function.
8845 (Target_x86_64::can_check_for_function_pointers): New function.
8846 * gc.h (gc_process_relocs): Scan relocation types to determine if
8847 function pointers were taken for targets that support it.
8848 * icf.cc (Icf::find_identical_sections): Include functions for
8849 folding in safe ICF whose pointer is not taken.
8850 * icf.h (Secn_fptr_taken_set): New typedef.
8851 (fptr_section_id_): New member.
8852 (section_has_function_pointers): New function.
8853 (set_section_has_function_pointers): New function.
8854 (check_section_for_function_pointers): New function.
8855 * options.h: Fix comment for safe ICF option.
8856 * target.h (can_check_for_function_pointers): New function.
8857 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8858 Modify icf_safe_test for X86-64.
8859 * testsuite/Makefile.in: Regenerate.
8860 * testsuite/icf_safe_so_test.cc: New file.
8861 * testsuite/icf_safe_so_test.sh: New file.
8862 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8863 (main): Change to take pointer to function kept_func_3.
8864 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8865 folding is done correctly for X86-64.
8866
8867 2010-02-12 David S. Miller <davem@davemloft.net>
8868
8869 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8870 is_symbolless parameter.
8871 (Output_reloc<SHT_REL>::is_symbolless): New.
8872 (Output_reloc<SHT_REL>::is_symbolless_): New.
8873 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8874 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8875 (Output_reloc<SHT_RELA>::is_symbolless): New.
8876 (Output_data_reloc::add_global): Handle is_symbolless.
8877 (Output_data_reloc::add_global_relative): Likewise.
8878 (Output_data_reloc::add_local): Likewise.
8879 (Output_data_reloc::add_local_relative): Likewise.
8880 (Output_data_reloc::add_symbolless_global_addend): New.
8881 (Output_data_reloc::add_symbolless_local_addend): New.
8882 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8883 is_symbolless.
8884 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8885 instead of ->is_relative_
8886 (Output_reloc::write): Likewise.
8887 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8888 (Output_reloc::write_rel): Simplify.
8889
8890 * sparc.cc (Target_sparc::Scan::local): Use
8891 ->add_symbolless_local_addend as needed.
8892 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8893 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8894 based upon relocation offset.
8895
8896 2010-02-11 Doug Kwan <dougkwan@google.com>
8897
8898 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8899 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8900 beginning of function.
8901 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8902 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8903 parameter is_32bit in calls to should_apply_static_reloc.
8904 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8905 (check_DATA): Add arm_abs_global.stdout.
8906 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8907 arm_abs_global.stdout): New rules.
8908 (MOSTLLYCLEANFILES): Add arm_abs_global
8909 * Makefile.in: Regenerate.
8910 * testsuite/arm_abs_global.s: New file.
8911 * testsuite/arm_abs_global.sh: Ditto.
8912 * testsuite/arm_abs_lib.s: Ditto.
8913
8914 2010-02-11 Ian Lance Taylor <iant@google.com>
8915
8916 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8917 Read_relocs task.
8918 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8919 Allocate_commons_task first.
8920 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8921 task, rather than symtab_lock_.
8922 (Gc_process_relocs::~Gc_process_relocs): New function.
8923 (Gc_process_relocs::is_runnable): Check this_blocker_.
8924 (Gc_process_relocs::locks): Use next_blocker_ rather than
8925 blocker_.
8926 (Scan_relocs::~Scan_relocs): New function.
8927 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8928 symtab_lock_.
8929 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8930 next_blocker_.
8931 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8932 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8933 constructor accordingly.
8934 (class Gc_process_relocs): Likewise.
8935 (class Scan_relocs): Likewise.
8936 * common.h (class Allocate_commons_task): Remove symtab_lock_
8937 field, and corresponding constructor parameter.
8938 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8939 symtab_lock_.
8940 (Allocate_commons_task::locks): Likewise.
8941
8942 2010-02-11 Ian Lance Taylor <iant@google.com>
8943
8944 * gold-threads.h (class Once): Define.
8945 (class Initialize_lock): Rewrite as child of Once.
8946 * gold-threads.cc (class Once_initialize): Define.
8947 (once_pointer_control): New static variable.
8948 (once_pointer, once_arg): New static variables.
8949 (c_run_once): New static function.
8950 (Once::Once, Once::run_once, Once::internal_run): New functions.
8951 (class Initialize_lock_once): Remove.
8952 (initialize_lock_control): Remove.
8953 (initialize_lock_pointer): Remove.
8954 (initialize_lock_once): Remove.
8955 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8956 (Initialize_lock::initialize): Rewrite.
8957 (Initialize_lock::do_run_once): New function.
8958 * archive.cc (Archive::interpret_header): Only clear name if it is
8959 not already empty.
8960 * fileread.cc: Include "gold-threads.h"
8961 (file_counts_lock): New static variable.
8962 (file_counts_initialize_lock): Likewise.
8963 (File_read::release): Only increment counts when using --stats.
8964 Use a lock around the increment.
8965 * parameters.cc (class Set_parameters_target_once): Define.
8966 (set_parameters_target_once): New static variable.
8967 (Parameters::Parameters): Move here from parameters.h.
8968 (Parameters::set_target): Rewrite.
8969 (Parameters::set_target_once): New function.
8970 (Parameters::clear_target): Move here and rewrite.
8971 * parameters.h (class Parameters): Update declarations. Add
8972 set_parameters_target_once_ field.
8973 (Parameters::Parameters): Move to parameters.cc.
8974 (Parameters::clear_target): Likewise.
8975 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8976 task.
8977 (Start_group::~Start_group): New function.
8978 (Start_group::is_runnable): New function.
8979 (Start_group::locks, Start_group::run): New functions.
8980 (Finish_group::run): Change saw_undefined to size_t.
8981 * readsyms.h (class Start_group): Define.
8982 (class Finish_group): Change saw_undefined_ field to size_t.
8983 (Finish_group::Finish_group): Remove saw_undefined and
8984 this_blocker parameters. Change all callers.
8985 (Finish_group::set_saw_undefined): New function.
8986 (Finish_group::set_blocker): New function.
8987 * symtab.h (class Symbol_table): Change saw_undefined to return
8988 size_t. Change saw_undefined_ field to size_t.
8989 * target-select.cc (Set_target_once::do_run_once): New function.
8990 (Target_selector::Target_selector): Initialize set_target_once_
8991 field. Don't initialize lock_ and initialize_lock_ fields.
8992 (Target_selector::instantiate_target): Rewrite.
8993 (Target_selector::set_target): New function.
8994 * target-select.h (class Set_target_once): Define.
8995 (class Target_selector): Update declarations. Make
8996 Set_target_once a friend. Remove lock_ and initialize_lock_
8997 fields. Add set_target_once_ field.
8998
8999 2010-02-10 Ian Lance Taylor <iant@google.com>
9000
9001 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9002 queueing any tasks.
9003 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9004 (queue_middle_tasks): Add all blockers before queueing any tasks.
9005 (queue_final_tasks): Likewise.
9006 * token.h (Task_token::add_blockers): New function.
9007 * object.h (Input_objects::number_of_relobjs): New function.
9008
9009 2010-02-10 Ian Lance Taylor <iant@google.com>
9010
9011 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9012 shared, not if not position independent.
9013 * x86_64.cc (Relocate::relocate_tls): Likewise.
9014 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9015 (tls_pie_pic_test): New target.
9016 * testsuite/Makefile.in: Rebuild.
9017
9018 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9019 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9020 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9021 * testsuite/Makefile.in: Rebuild.
9022
9023 2010-02-09 David S. Miller <davem@davemloft.net>
9024
9025 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9026 R_SPARC_RELATIVE using ->add_local_relative().
9027 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9028
9029 * output.h (Output_data_dynamic::add_section_size): New method
9030 that takes two Output_data objects.
9031 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9032 entry param. Handle it in initializers.
9033 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9034 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9035 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9036 arg.
9037 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9038 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9039 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9040 for dynrel_includes_plt.
9041 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9042 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9043 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9044 before .rela.plt
9045 (Target_sparc::do_finalize_sections): Update to pass true for
9046 dynrel_includes_plt.
9047 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9048 output before .rela.plt
9049 (Target_powerpc::do_finalize_sections): Update to pass true for
9050 dynrel_includes_plt when 32-bit.
9051
9052 2010-02-08 Doug Kwan <dougkwan@google.com>
9053
9054 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9055 method.
9056 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9057 Arm_relobj::scan_section_for_cortex_a8_stubs,
9058 Arm_relobj::do_relocation_section): Instead of calling
9059 Output_section::output_address, use faster
9060 Arm_relobj::simple_input_section_output_address.
9061
9062 2010-02-08 David S. Miller <davem@davemloft.net>
9063
9064 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9065 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9066 relocation helper function.
9067
9068 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9069 just like R_SPARC_GOT{10,13,22}.
9070 (Target_sparc::Scan::local): Likewise.
9071 (Target_sparc::Relocate:relocate): Likewise.
9072
9073 2010-02-06 Ian Lance Taylor <iant@google.com>
9074
9075 * configure.ac: Rewrite targetobjs duplicate removal code to use
9076 only shell constructs.
9077 * configure: Rebuild.
9078
9079 2010-02-05 Doug Kwan <dougkwan@google.com>
9080
9081 PR 11247
9082 * arm.cc (Arm_relobj::section_is_scannable): New method.
9083 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9084 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9085
9086 2010-02-04 Doug Kwan <dougkwan@google.com>
9087
9088 PR 11247
9089 * arm-reloc-property.cc (cstdio): Include.
9090 * configure.ac (targetobjs): Remove duplicates.
9091 * configure: Regenerate.
9092 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9093 big and little endian version for a given address size.
9094
9095 2010-02-03 Doug Kwan <dougkwan@google.com>
9096
9097 * arm-reloc-property.cc
9098 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9099 definition.
9100 * arm-reloc-property.h
9101 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9102 New method definition.
9103 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9104 declaration.
9105 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9106 overflow to N.
9107 (GOT_PREL): Change implemented to Y.
9108 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9109 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9110 (Arm_relocate_functions::movw_abs_nc): Remove method.
9111 (Arm_relocate_functions::movt_abs): Ditto.
9112 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9113 (Arm_relocate_functions::thm_movt_abs): Ditto.
9114 (Arm_relocate_functions::movw_rel_nc): Ditto.
9115 (Arm_relocate_functions::movw_rel): Ditto.
9116 (Arm_relocate_functions::movt_rel): Ditto.
9117 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9118 (Arm_relocate_functions:thm_movw_rel): Ditto.
9119 (Arm_relocate_functions:thm_movt_rel): Ditto.
9120 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9121 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9122 New method definitions.
9123 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9124 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9125 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9126 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9127 (Target_arm::Relocate::relocate): Check for non-static or
9128 unimplemented relocation code and exit early. Change calls to
9129 Target_arm::reloc_uses_thumb_bit and
9130 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9131 instead. Refactor code to handle similar relocations to increase
9132 code sharing. Remove check for unsupported relocation code in switch
9133 statement.
9134 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9135 relocation property table to find out size. Change error message to
9136 print out the name of a relocation code instead of the numeric value.
9137 (Target_arm::scan_reloc_for_stub): Use relocation property table
9138 instead of calling Target_arm::reloc_uses_thumb_bit().
9139
9140 2010-02-02 Doug Kwan <dougkwan@google.com>
9141
9142 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9143 types of relaxed input section.
9144
9145 2010-02-02 Doug Kwan <dougkwan@google.com>
9146
9147 * Makefile.am (HFILES): Add arm-reloc-property.h.
9148 (DEFFILES): New.
9149 (TARGETSOURCES): Add arm-reloc-property.cc
9150 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9151 (libgold_a_SOURCES): $(DEFFILES)
9152 * Makefile.in: Regenerate.
9153 * arm-reloc-property.cc: New file.
9154 * arm-reloc-property.h: New file.
9155 * arm-reloc.def: New file.
9156 * arm.cc: Update comments.
9157 (arm-reloc-property.h): New included header.
9158 (arm_reloc_property_table): New global variable.
9159 (Target_arm::do_select_as_default_target): New method definition.
9160 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9161 arm-reloc-property to targ_extra_obj.
9162 * parameters.cc (set_parameters_target): Call
9163 Target::select_as_default_target().
9164 * target.h (Target::select_as_default_target): New method definition.
9165 (Target::do_select_as_default_target): Same.
9166
9167 2010-02-01 Doug Kwan <dougkwan@google.com>
9168
9169 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9170 first_output_text_section_.
9171 (Arm_exidx_fixup::first_output_text_section): New method definition.
9172 (Arm_exidx_fixup::first_output_text_section_): New data member.
9173 (Arm_exidx_fixup::process_exidx_section): Record the first text
9174 output section seen.
9175 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9176 and entsize in output section header.
9177
9178 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9179
9180 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9181 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9182 (Arm_relocate_functions::thm_alu11): New Method.
9183 (Arm_relocate_functions::thm_pc8): New Method.
9184 (Arm_relocate_functions::thm_pc12): New Method.
9185 (Target_arm::Scan::local): Handle the relocations.
9186 (Target_arm::Scan::global): Likewise.
9187 (Target_arm::Relocate::relocate): Likewise.
9188 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9189
9190 2010-01-29 Doug Kwan <dougkwan@google.com>
9191
9192 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9193 of relocation types as ld.
9194
9195 2010-01-29 Doug Kwan <dougkwan@google.com>
9196
9197 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9198 to public.
9199 (Arm_relocate_functions::thumb_branch_common): Ditto.
9200 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9201 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9202 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9203 Arm_relocate_functions::jump24): Remove.
9204 (Target_arm::Relocate::relocate): Adjust code to call
9205 Arm_relocation_functions::arm_branch_common and
9206 Arm_relocation_functions::thumb_branch_common instead of their removed
9207 wrappers. Merge switch-cases together to reduce source code size.
9208
9209 2010-01-29 Doug Kwan <dougkwan@google.com>
9210
9211 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9212 output_local_symbol_count_needs_update_.
9213 (Arm_relobj::output_local_symbol_count_needs_update,
9214 Arm_relobj::set_output_local_symbol_count_needs_update,
9215 Arm_relobj::update_output_local_symbol_count): New methods.
9216 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9217 member.
9218 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9219 of pointed function as in a R_ARM_PREL31 relocation.
9220 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9221 for output local symbol count updating.
9222 (Target_arm::do_relax): Update output local symbol counts in objects
9223 if necessary.
9224 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9225
9226 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9227
9228 * arm.cc: Added support for the ARM relocations:
9229 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9230 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9231 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9232 movw_prel_nc).
9233 (Arm_relocate_functions::movw_rel): New method.
9234 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9235 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9236 thm_movw_prel_nc).
9237 (Arm_relocate_functions::thm_movw_rel): New method.
9238 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9239 thm_movt_prel).
9240 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9241 relocations.
9242 (Target_arm::Scan::global): Likewise.
9243 (Target_arm::Relocate::relocate): Likewise.
9244 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9245 Likewise.
9246
9247 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9248
9249 * arm.cc: Added support for ARM group relocations.
9250 (Target_arm::reloc_needs_sym_origin): New method.
9251 (Arm_relocate_functions::calc_grp_kn): New method.
9252 (Arm_relocate_functions::calc_grp_residual): New method.
9253 (Arm_relocate_functions::calc_grp_gn): New method.
9254 (Arm_relocate_functions::arm_grp_alu): New Method.
9255 (Arm_relocate_functions::arm_grp_ldr): New Method.
9256 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9257 (Arm_relocate_functions::arm_grp_ldc): New Method.
9258 (Target_arm::Scan::local): Handle the ARM group relocations.
9259 (Target_arm::Scan::global): Likewise.
9260 (Target_arm::Relocate::relocate): Likewise.
9261 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9262 Likewise.
9263
9264 2010-01-26 Doug Kwan <dougkwan@google.com>
9265
9266 * arm.cc (set): Include.
9267 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9268 pointer type.
9269 (Arm_output_section::Text_section_list): New type.
9270 (Arm_output_section::append_text_sections_to_list): New method.
9271 (Arm_output_section::fix_exidx_coverage): Ditto.
9272 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9273 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9274 Relobj::set_section_offset() instead of
9275 Sized_relobj::invalidate_section_offset().
9276 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9277 parameter for section headers. Ignore relocation sections for
9278 unallocated sections and EXIDX sections.
9279 (Target_arm::fix_exidx_coverage): New method.
9280 (Target_arm::output_section_address_less_than): New type.
9281 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9282 linked text section instead of the EXIDX section.
9283 (Arm_output_section::create_stub_group): Add an assertion to check
9284 that this is not an EXIDX output section.
9285 (Arm_output_section::append_text_sections_to_list): New method.
9286 (Arm_output_section::fix_exidx_coverage): Ditto.
9287 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9288 Arm_relobj::section_needs_reloc_stub_scanning.
9289 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9290 first pass.
9291 (Target_arm::fix_exidx_coverage): New method.
9292 * object.h (Relobj::set_output_section): New method.
9293 (Sized_relobj::invalidate_section_offset): Remove method.
9294 (Sized_relobj::do_invalidate_section_offset): Remove method.
9295 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9296
9297 2010-01-25 Doug Kwan <dougkwan@google.com>
9298
9299 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9300 Fix warning due to signed and unsigned comparison on a 32-bit host.
9301
9302 2010-01-22 Doug Kwan <dougkwan@google.com>
9303
9304 * arm.cc (Target_arm::do_relax): Record an output section for section
9305 offset adjustment it contains any stub table that has changed.
9306 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9307 offsets in an output section if necessary.
9308 * output.cc (Output_section::Output_section): Initialize
9309 section_offsets_need_adjustments_.
9310 (Output_section::add_input_section_for_script): Renamed to
9311 Output_section::add_simple_input_section.
9312 (Output_section::save_states): Add a comment.
9313 (Output_section::discard_states): New method defintion.
9314 (Output_section::adjust_section_offsets): Same.
9315 * output.h (Output_section::add_input_section_for_script): Renamed to
9316 Output_section::add_simple_input_section.
9317 (Output_section::discard_states): New method declaration.
9318 (Output_section::adjust_section_offsets): Same.
9319 (Output_section::section_offsets_need_adjustment,
9320 Output_section::set_section_offsets_need_adjustment): New method
9321 definitions.
9322 (Output_section::section_offsets_need_adjustment_): New data member.
9323 * script-sections.cc
9324 (Output_section_element_input::set_section_address): Adjust code for
9325 renaming of Output_section::add_input_section_for_script.
9326 (Orphan_output_section::set_section_address): Same.
9327
9328 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9329
9330 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9331 Fix_v4bx enum values .
9332 * gold/options.h (General_options): New option definitions.
9333 (General_options::fix_v4bx): New method.
9334 (General_options::Fix_v4bx): New enum.
9335 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9336 (General_options::parse_fix_v4bx_interworking): New method.
9337
9338 2010-01-22 Doug Kwan <dougkwan@google.com>
9339
9340 * arm.cc (Arm_exidx_fixup): New class.
9341
9342 2010-01-21 Doug Kwan <dougkwan@google.com>
9343
9344 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9345 classes.
9346 (Arm_exidx_section_offset_map): New type.
9347
9348 2010-01-21 Doug Kwan <dougkwan@google.com>
9349
9350 * arm.cc (Arm_exidx_input_section): New class.
9351 (Arm_relobj::exidx_input_section_by_link,
9352 Arm_relobj::exidx_input_section_by_shndx,
9353 Arm_relobj::make_exidx_input_section): New methods.
9354 (read_arm_attributes_section): Remove.
9355 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9356 information about them.
9357 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9358 to here.
9359
9360 2010-01-20 Doug Kwan <dougkwan@google.com>
9361
9362 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9363 Input_section_specifier to Section_id.
9364 (Target_arm::new_arm_input_section: Adjust code for change of key
9365 type.
9366 (Target_arm::find_arm_input_section): Ditto.
9367 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9368 (Section_id): Remove.
9369 (Garbage_collection::Section_id_hash): Remove.
9370 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9371 (Section_id): Remove.
9372 (Icf::Section_id_hash): Remove.
9373 * object.h (Section_id, Const_section_id, Section_id_hash,
9374 Const_section_id_hash): New type definitions.
9375 * output.cc (Output_section::add_relaxed_input_section): Change to
9376 use Const_section_id instead of Input_section_specifier as key type.
9377 (Output_section::add_merge_input_section): Ditto.
9378 (Output_section::build_relaxation_map): Change to use Section_id
9379 instead of Input_section_specifier as key type.
9380 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9381 Ditto.
9382 (Output_section::convert_input_sections_to_relaxed_sections): Change
9383 to use Const_section_id instead of Input_section_specifier as key type.
9384 (Output_section::find_merge_section): Ditto.
9385 (Output_section::find_relaxed_input_section): Ditto.
9386 * output.h (Input_section_specifier): Remove class.
9387 (Output_section::Output_section_data_by_input_section_map): Change
9388 key type to Const_section_id.
9389 (Output_section::Output_relaxed_input_section_by_input_section_map):
9390 Ditto.
9391 (Output_section::Relaxation_map): Change key type to Section_id.
9392
9393 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9394
9395 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9396 (class Arm_v4bx_stub): New class.
9397 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9398 (Stub_factory::make_arm_v4bx_stub): New method.
9399 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9400 (Stub_table::empty): Handle v4bx stubs.
9401 (Stub_table::add_arm_v4bx_stub): New method.
9402 (Stub_table::find_arm_v4bx_stub): New method.
9403 (Arm_relocate_functions::v4bx): New method.
9404 (Target_arm::fix_v4bx): New method.
9405 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9406 (Stub_table::relocate_stubs): Likewise.
9407 (Stub_table::do_write): Likewise.
9408 (Stub_table::update_data_size_and_addralign): Likewise.
9409 (Stub_table::finalize_stubs): Likewise.
9410 (Target_arm::Scan::local): Likewise.
9411 (Target_arm::Scan::global): Likewise.
9412 (Target_arm::do_finalize_sections): Likewise.
9413 (Target_arm::Relocate::relocate): Likewise.
9414 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9415 Likewise.
9416 (Target_arm::scan_reloc_for_stub): Likewise.
9417 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9418
9419 2010-01-19 Ian Lance Taylor <iant@google.com>
9420
9421 * output.cc (Output_section_headers::do_sized_write): Write large
9422 segment count to sh_info field.
9423 (Output_file_header::do_sized_write): For large segment count,
9424 write PN_XNUM to e_phnum field.
9425
9426 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9427
9428 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9429 (Arm_relocate_functions::thm_jump8): New function.
9430 (Arm_relocate_functions::thm_jump11): New function.
9431 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9432 R_ARM_THM_JUMP11.
9433 (Target_arm::Scan::global): Likewise.
9434 (Target_arm::Relocate::relocate): Likewise.
9435 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9436 Likewise.
9437
9438 2010-01-14 Doug Kwan <dougkwan@google.com>
9439
9440 * arm.cc (map, utility): Include headers.
9441 (Target_arm::apply_cortex_a8_workaround): New method.
9442 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9443 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9444 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9445 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9446 the --[no-]fix-cortex-a8 command line options.
9447 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9448 (Target_arm::relocate_stub): Use addend in instruction template.
9449 * options.h (DEFINE_bool): Set the user-set flag.
9450 (General_options): Add --[no-]-fix-cortex options.
9451 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9452 : Update fast look-up map after conversion.
9453
9454 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9455
9456 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9457 in the first pass of do_layout.
9458
9459 2010-01-13 Doug Kwan <dougkwan@google.com>
9460
9461 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9462 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9463 apparent compiler problem of not folding static constant integral
9464 data members of elfcpp::Elf_sizes<32>.
9465
9466 2010-01-13 Doug Kwan <dougkwan@google.com>
9467
9468 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9469 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9470 Arm_relobj::scan_section_for_cortex_a8_erratum,
9471 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9472 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9473 sections to scan for relocation stubs into a new method
9474 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9475 relocation and Cortex-A8 stub scanning.
9476 (Target_arm::do_relax): Force stubs to be after stubbed sections
9477 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9478 the beginning of a new relaxation pass. Update a comment.
9479 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9480
9481 2010-01-12 Ian Lance Taylor <iant@google.com>
9482
9483 * target-reloc.h (visibility_error): New inline function.
9484 (relocate_section): Call visibility_error.
9485 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9486 (MOSTLYCLEANFILES): Likewise.
9487 (protected_4_pic.o, protected_3.err): New targets.
9488 * testsuite/protected_4.cc: New file.
9489
9490 2010-01-12 Doug Kwan <dougkwan@google.com>
9491
9492 * arm.cc (Cortex_a8_reloc): New class.
9493 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9494 and cortex_a8_relocs_info_.
9495 (Target_arm::fix_cortex_a8): New method definition.
9496 (Target_arm::Cortex_a8_relocs_info): New type.
9497 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9498 New data member declarations.
9499 (Target_arm::scan_reloc_for_stub): Record information about
9500 relocations for THUMB branches that might be exempted from the
9501 Cortex-A8 workaround.
9502 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9503 at the beginning of a relaxation pass.
9504
9505 2010-01-12 Doug Kwan <dougkwan@google.com>
9506
9507 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9508 (Arm_relobj::Mapping_symbol_position,
9509 Arm_reloj::Mapping_symbol_position_less,
9510 Arm_relobj::Mapping_symbols_info): New types.
9511 (Target_arm::is_mapping_symbol_name): New method definition.
9512 (Arm_relobj::do_count_local_symbols): Save information about mapping
9513 symbols.
9514
9515 2010-01-11 Doug Kwan <dougkwan@google.com>
9516
9517 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9518 Arm_relocate_functions::thumb32_branch_upper,
9519 Arm_relocate_functions::thumb32_branch_lower,
9520 Arm_relocate_functions::thumb32_cond_branch_offset,
9521 Arm_relocate_functions::thumb32_cond_branch_upper,
9522 Arm_relocate_functions::thumb32_cond_branch_lower,
9523 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9524 branch offset encoding.
9525 (Arm_relocate_functions::thumb_branch_common): Use new branch
9526 offset encoding methods to avoid code duplication.
9527 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9528 (Stub_addend_reader::operator()): Use new branch encoding method
9529 to avoid code duplication.
9530
9531 2010-01-11 Doug Kwan <dougkwan@google.com>
9532
9533 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9534 (Target_arm::do_finalize_sections): Define special EXIDX section
9535 symbols only if referenced.
9536 * gc.h (Garbage_collection::add_reference): New method.
9537 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9538 code duplication.
9539
9540 2010-01-11 Ian Lance Taylor <iant@google.com>
9541
9542 * script.cc (Version_script_info::build_expression_list_lookup):
9543 Change complaing about duplicate wildcard match from error to
9544 warning.
9545
9546 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9547 of 2009-12-30.
9548 (Version_script_info::Version_script_info): Initialize globs_,
9549 default_version_, default_is_global_, and exact_. Don't
9550 initialize globals_ or locals_.
9551 (Version_script_info::build_lookup_tables): Build local symbols
9552 first.
9553 (Version_script_info::unquote): New function.
9554 (Version_script_info::add_exact_match): New function.
9555 (Version_script_info::build_expression_list_lookup): Remove lookup
9556 parameter. Add is_global parameter. Change all callers. Handle
9557 wildcard pattern specially. Unquote pattern. Call
9558 add_exact_match.
9559 (Version_script_info::get_name_to_match): New function.
9560 (Version_script_info::get_symbol_version): New function.
9561 (Version_script_info::get_symbol_version_helper): Remove.
9562 (Version_script_info::check_unmatched_names): Call unquote.
9563 * script.h (class Version_script_info): Change get_symbol_version
9564 to be non-inline and add is_global parameter; change all callers.
9565 Rewrite symbol_is_local. Update declarations. Define struct
9566 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9567 Remove globals_ and locals_ members. Add exact_, globs_,
9568 default_version_, is_global_.
9569 (Version_script_info::Glob): Remove pattern, add expression and
9570 is_global. Update constructor. Change all callers.
9571 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9572 default version.
9573 (Versions::symbol_section_contents): If a symbol is undefined, or
9574 defined in a dynamic object, set the version index to
9575 VER_NDX_LOCAL.
9576 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9577 symbol_is_local.
9578 (Symbol_table::add_from_pluginobj): Likewise.
9579 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9580
9581 2010-01-11 Doug Kwan <dougkwan@google.com>
9582
9583 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9584 (incremental_dump_LDADD): Add linking option for libintl.
9585 * Makefile.in: Regenerate.
9586
9587 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9588
9589 PR gold/11144
9590 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9591 instead of -Ds.
9592 * testsuite/Makefile.in: Regenerated.
9593
9594 2010-01-10 Doug Kwan <dougkwan@google.com>
9595
9596 * options.h (DEFINE_var): Use parentheses around argument varname__
9597 in macro body to avoid any unintended subsequent substitutions.
9598
9599 2010-01-10 Ian Lance Taylor <iant@google.com>
9600
9601 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9602 candidates before doing symbol resolution.
9603
9604 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9605 ODR candidates if only one is weak.
9606
9607 2010-01-08 Ian Lance Taylor <iant@google.com>
9608
9609 * script.cc (Version_script_info::build_expression_list_lookup):
9610 Don't warn about ambiguous version, just record the ambiguity.
9611 (Version_script_info::get_symbol_version_helper): Give error if
9612 version is ambiguous.
9613
9614 2010-01-08 Doug Kwan <dougkwan@google.com>
9615
9616 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9617 prev_data_size_ and prev_addralign_. Remove initializer for
9618 deleted data member has_been_changed_.
9619 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9620 to determine if the table is empty.
9621 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9622 Remove.
9623 (Stub_table::add_reloc_stub): Define method in class definition
9624 instead of just declaring it there.
9625 (Stub_table::add_cortex_a8_stub): New method definition.
9626 (Stub_table::update_data_size_and_addralign): Ditto.
9627 (Stub_table::finalize_stubs): Ditto.
9628 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9629 (Stub_table::do_addralign_): Return address alignment in the
9630 (Stub_table::do_reset_address_and_file_offset): Define method in
9631 class definition instead of declaring it there. Set current data
9632 size to be the data size of the previous pass.
9633 (Stub_table::set_final_data_size): Use current data size as the
9634 final data size.
9635 (Stub_table::relocate_stub): Change parameter type of stub from
9636 Reloc_stub pointer to Stub pointer.
9637 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9638 (Stub_table::Cortex_a8_stub_list): New typedef.
9639 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9640 Stub_table::prev_addralign_): New data member.
9641 (Arm_relobj::Arm_relobj): Initialize data member
9642 section_has_cortex_a8_workaround_.
9643 (Arm_relobj::section_has_cortex_a8_workaround,
9644 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9645 definitions.
9646 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9647 declarations.
9648 (Target_arm::relocate_stub): Change parameter type of stub from
9649 Reloc_stub pointer to Stub pointer.
9650 (Insn_template::size, Insn_template::alignment): Handle
9651 THUMB16_SPECIAL_TYPE.
9652 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9653 Stub_table::update_data_size_and_addralign,
9654 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9655 definitions.
9656 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9657 (Stub_table::do_write): Ditto.
9658 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9659
9660 2010-01-08 Ian Lance Taylor <iant@google.com>
9661
9662 PR 11108
9663 * symtab.h (class Symbol): Remove fields is_target_special_ and
9664 has_plt_offset_. Add field is_defined_in_discarded_section_.
9665 (Symbol::is_defined_in_discarded_section): New function.
9666 (Symbol::set_is_defined_in_discarded_section): New function.
9667 (Symbol::has_plt_offset): Rewrite.
9668 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9669 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9670 Don't initialize is_target_special_ or has_plt_offset_.
9671 Initialize is_defined_in_discarded_section_.
9672 (Symbol_table::add_from_relobj): If appropriate, set
9673 is_defined_in_discarded_section.
9674 * resolve.cc (Symbol::override_base_with_special): Don't test
9675 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9676 * target-reloc.h (relocate_section): Do special handling for
9677 symbols defined in discarded sections for global symbols as well
9678 as local symbols.
9679
9680 2010-01-08 Ian Lance Taylor <iant@google.com>
9681
9682 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9683 the SHT_SYMTAB case.
9684
9685 2010-01-08 Ian Lance Taylor <iant@google.com>
9686
9687 * object.cc (Sized_relobj::do_layout): Don't get confused if
9688 layout_eh_frame returns NULL.
9689
9690 2010-01-08 Ian Lance Taylor <iant@google.com>
9691
9692 PR 11084
9693 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9694 dynamic symbol table, use the normal symbol table.
9695 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9696 symbol table.
9697
9698 2010-01-08 Ian Lance Taylor <iant@google.com>
9699
9700 PR 11072
9701 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9702 sections.
9703
9704 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9705
9706 * version.cc (print_version): Change to "Copyright 2010".
9707
9708 2010-01-08 Ian Lance Taylor <iant@google.com>
9709
9710 PR 10287
9711 PR 11063
9712 * i386.cc (class Target_i386): Change return type of plt_section
9713 to be non-const.
9714 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9715 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9716 tls_desc_rel_ field.
9717 (Output_data_plt_i386::rel_tls_desc): New function.
9718 (Target_i386::rel_tls_desc_section): New function.
9719 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9720 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9721 R_386_TLS_DESC reloc in rel_tls_desc_section.
9722 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9723 Define struct Tlsdesc_info.
9724 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9725 (Target_x86_64::do_reloc_symbol_index): New function.
9726 (Target_x86_64::add_tlsdesc_info): New function.
9727 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9728 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9729 tlsdesc_rel_ field.
9730 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9731 all callers.
9732 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9733 (Target_x86_64::rela_tlsdesc_section): New function.
9734 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9735 handling.
9736 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9737 (Target_x86_64::do_reloc_addend): New function.
9738 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9739 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9740 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9741 (Output_reloc::type): New function.
9742 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9743 (Output_reloc::is_target_specific): New function.
9744 (Output_reloc::target_arg): New function.
9745 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9746 absolute relocs and target specific relocs.
9747 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9748 add_target_specific.
9749 (class Output_data_reloc) [SHT_RELA]: Likewise.
9750 * output.cc (Output_reloc::Output_reloc): Add four new versions
9751 for absolute relocs and target specific relocs.
9752 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9753 (Output_reloc::get_symbol_index): Likewise.
9754 (Output_reloc::local_section_offset): Check that local_sym_index_
9755 is not TARGET_CODE or 0.
9756 (Output_reloc::symbol_value): Likewise.
9757 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9758 reloc.
9759 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9760 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9761 functions.
9762 * layout.cc (add_target_dynamic_tags): Use output section for
9763 DT_PLTRELSZ and DT_JMPREL.
9764
9765 2010-01-07 Ian Lance Taylor <iant@google.com>
9766
9767 PR 11061
9768 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9769 function.
9770 (class Output_data_reloc_generic): Define.
9771 (class Output_data_reloc_base): Change base class to
9772 Output_data_reloc_generic. Change add() method to call
9773 bump_relative_reloc_count for a relative reloc. Remove
9774 sort_relocs_ field.
9775 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9776 to sort_relocs().
9777 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9778 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9779 appropriate.
9780 * layout.h (class Layout): Update declaration.
9781
9782 2010-01-07 Ian Lance Taylor <iant@google.com>
9783
9784 * output.h (class Output_data): Add const version of
9785 output_section and do_output_section.
9786 (class Output_section_data): Add const version of
9787 do_output_section.
9788 (class Output_section): Likewise.
9789 * layout.cc (Layout::add_target_dynamic_tags): New function.
9790 * layout.h (class Layout): Update declarations.
9791 * arm.cc (Target_arm::do_finalize_sections): Use
9792 add_target_dynamic_tags.
9793 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9794 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9795 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9796 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9797
9798 2010-01-07 Ian Lance Taylor <iant@google.com>
9799
9800 PR 11042
9801 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9802 object as needed.
9803
9804 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9805 Ian Lance Taylor <iant@google.com>
9806
9807 PR 11019
9808 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9809 Xindex::read_symtab_xindex.
9810
9811 2010-01-07 Doug Kwan <dougkwan@google.com>
9812
9813 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9814 (Insn_template::thumb16_bcond_insn): New method declaration.
9815 (Insn_template): Fix spelling.
9816 (Stub::thumb16_special): New method declaration.
9817 (Stub::do_write): Define virtual method which was previously pure
9818 virtual.
9819 (Stub::do_thumb16_special): New method declaration.
9820 (Stub::do_fixed_endian_write): New template member.
9821 (Reloc_stub::do_write): Remove.
9822 (Reloc_stub::do_fixed_endian_write): Remove.
9823 (Cortex_a8_stub): New class definition.
9824 (Stub_factory::make_cortex_a8_stub): New method definition.
9825 (Stub_factory::Stub_factory): Add missing static storage class
9826 qualifier for elf32_arm_stub_a8_veneer_blx.
9827
9828 2010-01-07 Ian Lance Taylor <iant@google.com>
9829
9830 PR 10980
9831 * options.h (class General_options): Add --warn-unresolved-symbols
9832 and --error-unresolved-symbols.
9833 * errors.cc (Errors::undefined_symbol): Implement
9834 --warn-unresolved-symbols.
9835
9836 * options.h (class General_options): Add -z text and -z textoff.
9837 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9838
9839 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9840
9841 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9842 (Garbage_collection::cident_sections): New function.
9843 (Garbage_collection::add_cident_section): New function.
9844 (Garbage_collection::cident_sections_): New member.
9845 (gc_process_relocs): Add references to sections whose names are C
9846 identifiers.
9847 * gold.h (cident_section_start_prefix): New constant.
9848 (cident_section_stop_prefix): New constant.
9849 (is_cident): New function.
9850 * layout.cc (Layout::define_section_symbols): Replace string constants
9851 with the newly defined constants.
9852 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9853 C identifiers.
9854 * testsuite/Makefile.am: Add gc_orphan_section_test.
9855 * testsuite/Makefile.in: Regenerate.
9856 * testsuite/gc_orphan_section_test.cc: New file.
9857 * testsuite/gc_orphan_section_test.sh: New file.
9858
9859 2010-01-06 Ian Lance Taylor <iant@google.com>
9860
9861 PR 10980
9862 * options.h (class General_options): Add --warn-shared-textrel.
9863 * layout.cc (Layout::finish_dynamic_section): Implement
9864 --warn-shared-textrel.
9865
9866 PR 10980
9867 * options.h (class General_options): Add --warn-multiple-gp.
9868
9869 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9870
9871 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9872 $(THREADSLIB) and $(LIBDL).
9873 * Makefile.in: Rebuild.
9874
9875 2010-01-06 Ian Lance Taylor <iant@google.com>
9876
9877 PR 10980
9878 * options.cc (General_options::parse_section_start): New function.
9879 (General_options::section_start): New function.
9880 (General_options::General_options): Initialize all members.
9881 * options.h: Include <map>
9882 (class General_options): Add --section-start. Add section_starts_
9883 member.
9884 * layout.cc (Layout::attach_allocated_section_to_segment): If
9885 --section-start was used, set the address of the segment. Remove
9886 local sort_sections.
9887 (Layout::relaxation_loop_body): If the address of the load segment
9888 has been set by --section-start, don't use it.
9889 * output.h (Output_segment::update_flags_for_output_section): New
9890 function.
9891 * output.cc (Output_segment::add_output_section): Call
9892 update_flags_for_output_section.
9893
9894 2010-01-05 Ian Lance Taylor <iant@google.com>
9895
9896 PR 10980
9897 * options.h (class General_options): Add --undefined-version.
9898 * script.cc (struct Version_expression): Add was_matched_by_symbol
9899 field.
9900 (Version_script_info::matched_symbol): New function.
9901 (Version_script_info::get_symbol_version_helper): Call
9902 matched_symbol.
9903 (Version_script_info::check_unmatched_names): New function.
9904 * script.h (class Version_script_info): Update declarations.
9905 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9906
9907 * options.h (class General_options): Use DEFINE_bool_alias for
9908 allow_multiple_definition.
9909 * resolve.cc (Symbol_table::should_override): Don't test
9910 allow_multiple_definition.
9911
9912 PR 10980
9913 * options.h (class General_options): Add --cref.
9914 * main.cc (main): Print cref table if --cref. Don't close mapfile
9915 until after printing cref table.
9916 * cref.cc: Include "symtab.h".
9917 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9918 (Cref_table_compare::operator()): New function.
9919 (Cref_inputs::gather_cref): New function.
9920 (filecol): New static const.
9921 (Cref_inputs::print_cref): New function.
9922 (Cref::print_cref): New function.
9923 * cref.h: Include <cstdio>.
9924 (class Cref): Update declarations.
9925 * mapfile.h (Mapfile::file): New function.
9926 * object.h (class Object): Define Symbols. Declare virtual
9927 do_get_global_symbols.
9928 (Object::get_global_symbols): New function.
9929 * object.cc (Input_objects::add_object): Pass object to cref_ if
9930 --cref.
9931 (Input_objects::archive_start): Likewise.
9932 (Input_objects::archive_stop): Likewise.
9933 (Input_objects::print_cref): New function.
9934 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9935 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9936 --cref.
9937 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9938 function.
9939 * plugin.h (class Sized_pluginobj): Update declarations.
9940
9941 2010-01-05 Ian Lance Taylor <iant@google.com>
9942
9943 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9944 to is_default_version. Rename insdef to insdefault.
9945 (Symbol_table::add_from_relobj): Rename def to is_default_version
9946 and local to is_forced_local.
9947 (Symbol_table::add_from_pluginobj): Likewise.
9948 (Symbol_table::add_from_dynobj): Likewise.
9949 (Symbol_table::define_special_symbol): Rename insdef to
9950 insdefault.
9951
9952 2010-01-04 Ian Lance Taylor <iant@google.com>
9953
9954 PR 10980
9955 * options.h (class General_options): Add
9956 --allow-multiple-definition and -z muldefs.
9957 * resolve.cc (Symbol_table::should_override): Don't warn about a
9958 multiple symbol definition if --allow-multiple-definition or -z
9959 muldefs.
9960
9961 PR 10980
9962 * options.h (class General_options): Add --add-needed and
9963 --copy-dt-needed-entries. Tweak --as-needed help entry.
9964 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9965 error if --copy-dt-needed-entries aka --add-needed is used and
9966 would cause a change in behaviour.
9967
9968 PR 10980
9969 * options.h (class General_options): Add -G as a short version of
9970 --shared. Add no-op options -assert, -g, and -i.
9971
9972 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9973
9974 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9975 check for .text or .gnu.linkonce.t sections.
9976 * icf.cc (Icf::find_identical_sections): Ditto.
9977 Change the detection for mangled function name within the section
9978 name.
9979 * icf.h (is_section_foldable_candidate): New function.
9980
9981 2009-12-30 Ian Lance Taylor <iant@google.com>
9982
9983 PR 10980
9984 * options.h (class General_options): Permit two dashes with
9985 --retain-symbols-file.
9986
9987 2009-12-30 Ian Lance Taylor <iant@google.com>
9988
9989 PR 10979
9990 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9991 don't put the file header and segment headers in the text
9992 segment.
9993
9994 PR 10979
9995 * common.cc (Sort_commons::operator()): Stabilize sort when both
9996 entries are NULL.
9997 (Symbol_table::do_allocate_commons_list): When allocating common
9998 symbols, skip a symbol which is no longer common.
9999 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10000 an object before checking its type.
10001 * testsuite/common_test_2.c: New file.
10002 * testsuite/common_test_3.c: New file.
10003 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10004 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10005 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10006 (common_test_2_pic.o, common_test_2.so): New targets.
10007 (common_test_3_pic.o, common_test_3.so): New targets.
10008 * testsuite/Makefile.in: Rebuild.
10009
10010 PR 10979
10011 * script.cc (read_input_script): If we see a new SECTIONS clause,
10012 and we have added an input section, give an error.
10013 * layout.h (class Layout): Add have_added_input_section function.
10014 Add have_added_input_section_ field.
10015 * layout.cc (Layout::Layout): Initialize
10016 have_added_input_section_.
10017 (Layout::layout): Set have_added_input_section_.
10018 (Layout::layout_eh_frame): Likewise.
10019
10020 2009-12-30 Ian Lance Taylor <iant@google.com>
10021
10022 PR 10931
10023 * options.h (class General_options): Add --sort-common option.
10024 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10025 * common.cc (Sort_common): Add sort_order parameter to
10026 constructor. Add sort_order_ field.
10027 (Sort_commons::operator): Check sort_order_.
10028 (Symbol_table::allocate_commons): Determine the sort order.
10029 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10030 Change all callers.
10031 (Symbol_table::do_allocate_commons_list): Likewise.
10032
10033 2009-12-30 Ian Lance Taylor <iant@google.com>
10034
10035 PR 10916
10036 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10037 symbols from this object, don't change the visibility of an
10038 undefined symbol.
10039 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10040
10041 2009-12-30 Ian Lance Taylor <iant@google.com>
10042
10043 PR 10861
10044 * script.h (class Version_script_info): Define Language enum.
10045 Update declarations. Define Glob, Exact, and Lookup types. Add
10046 new fields globals_, locals_, and is_finalized_.
10047 * script.cc: Various formatting fixes.
10048 (class Parser_closure): Change language_stack_ from a vector of
10049 std::string to one of Version_script_info::Language. Adjust all
10050 uses accordingly.
10051 (class Lazy_demangler): Remove.
10052 (struct Version_expression): Change language from std::string to
10053 Version_script_info::Language.
10054 (Version_script_info::Version_script_info): New function.
10055 (Version_script_info::~Version_script_info): Don't call clear.
10056 (Version_script_info::finalize): New function.
10057 (Version_script_info::build_lookup_tables): New function.
10058 (Version_script_info::build_expression_list_lookup): New
10059 function.
10060 (Version_script_info::get_symbol_version_helper): Rewrite to use
10061 lookup tables.
10062 (Version_script_info::print_expression_list): Adjust to use
10063 Version_script_info::Language.
10064 (script_push_lex_into_version_mode): Check that the version script
10065 has not been finalized.
10066 (version_script_push_lang): Change language string to
10067 Version_script_info::Language.
10068 * options.cc (Command_line::version_script): New function.
10069 * options.h (class General_options): Add finalize_dynamic_list
10070 function. Change version_script from declaration to definition.
10071 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10072 * testsuite/version_script.map: Remove duplicate def of foo.
10073 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10074 version_script.map.
10075 * testsuite/Makefile.in: Rebuild.
10076
10077 2009-12-30 Ian Lance Taylor <iant@google.com>
10078
10079 PR 10843
10080 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10081 if the input symbol index is 0, make the output symbol index 0.
10082
10083 2009-12-30 Ian Lance Taylor <iant@google.com>
10084
10085 PR 10670
10086 * options.h (class General_options): Add -x/--discard-all.
10087 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10088 --discard-all. If the local symbol needs a dynamic entry, check
10089 that before handling --discard-locals.
10090
10091 2009-12-30 Ian Lance Taylor <iant@google.com>
10092
10093 PR 10450
10094 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10095 flags to PF_R.
10096 (Output_segment::add_output_section): Don't change the flags if
10097 the type is PT_TLS.
10098
10099 PR 10450
10100 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10101 GNU hash table if they need a dynamic value. Otherwise, don't add
10102 them if they are defined in a dynamic object or are forced local.
10103
10104 2009-12-29 Ian Lance Taylor <iant@google.com>
10105
10106 PR 10450
10107 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10108 .gnu.hash table for a 32-bit target.
10109
10110 PR 10450
10111 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10112 regular and a dynamic object only needs a dynamic symbol table
10113 entry if it is externally visible.
10114
10115 PR 10450
10116 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10117 constructor. Add global_offset_table_ field.
10118 (Target_i386::got_section): Set global_offset_table_.
10119 (Target_i386::do_finalize_sections): Set global_offset_table_
10120 size.
10121 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10122 in constructor. Add global_offset_table_ field.
10123 (Target_x86_64::got_section): Set global_offset_table_.
10124 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10125 size.
10126
10127 * layout.cc (Layout::Layout): Initialize increase_relro_.
10128 (Layout::get_output_section): Add is_relro, is_last_relro, and
10129 is_first_non_relro parameters. Change all callers.
10130 (Layout::choose_output_section): Likewise.
10131 (Layout::add_output_section_data): Likewise.
10132 (Layout::make_output_section): Likewise.
10133 (Layout::set_segment_offsets): Clear increase_relro when using a
10134 linker script.
10135 * layout.h (class Layout): Add increase_relro method. Add
10136 increase_relro_ field. Update declarations.
10137 * output.cc (Output_section::Output_section): Initialize
10138 is_last_relro_ and is_first_non_relro_.
10139 (Output_segment::add_output_section): Group relro sections is
10140 do_sort is true. Handle is_last_relro and is_first_non_relro.
10141 (Output_segment::maximum_alignment): Remove relro handling.
10142 (Output_segment::set_section_addresses): Add increase_relro
10143 parameter. Change all callers. Add initial alignment to align
10144 relro sections on separate page. Remove old relro handling.
10145 (Output_segment::set_section_list_addresses): Remove in_relro
10146 parameter. Change all callers.
10147 (Output_segment::set_offset): Add increase parameter. Change all
10148 callers. Remove old relro handling.
10149 * output.h (class Output_section): Add new methods: is_last_relro,
10150 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10151 Add is_last_relro_ and is_first_non_relro_ fields.
10152 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10153 Create separate .got.plt section. Call increase_relro.
10154 * x86_64.cc (Target_x86_64::got_section): Likewise.
10155 * testsuite/relro_script_test.t: Add .got.plt.
10156
10157 PR 10450
10158 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10159 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10160 (Layout::finalize): Call set_dynamic_symbol_size.
10161 (Layout::set_dynamic_symbol_size): New function.
10162 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10163 set_dynamic_symbol_size.
10164
10165 PR 10450
10166 * output.h (class Output_section): Add is_entsize_zero_ field.
10167 * output.cc (Output_section::Output_section): Initialize
10168 is_entsize_zero_.
10169 (Output_section::set_entsize): If two different entsizes are
10170 requested, force it to zero.
10171 (Output_section::add_input_section): Set flags for .debug_str
10172 before updating section flags. Set entsize.
10173 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10174 and SHF_STRING if all input sections have those flags.
10175
10176 2009-12-29 Rafael Espindola <espindola@google.com>
10177
10178 * main.cc (main): Fix the sys time reporting.
10179 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10180 reporting.
10181
10182 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10183
10184 * options.cc (General_options::parse_version): Allow -v to exit
10185 without an error if there is nothing to link.
10186
10187 2009-12-29 Ian Lance Taylor <iant@google.com>
10188
10189 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10190 using a version of gcc before 4.1.
10191 * configure: Rebuild.
10192
10193 2009-12-28 Chris Demetriou <cgd@google.com>
10194
10195 * attributes.cc (Output_attributes_section_data::do_write): Use
10196 std::vector::front rather than std::vector::data.
10197
10198 2009-12-28 Ian Lance Taylor <iant@google.com>
10199
10200 * symtab.h (class Symbol_table): Add enum Defined.
10201 * resolve.cc (Symbol_table::should_override): Add defined
10202 parameter. Change all callers. Test whether object is NULL
10203 before calling a method on it.
10204 (Symbol_table::report_resolve_problem): Add defined parameter.
10205 Change all callers.
10206 (Symbol_table::should_override_with_special): Likewise.
10207 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10208 parameter. Change all callers.
10209 (Symbol_table::do_define_in_output_data): Likewise.
10210 (Symbol_table::define_in_output_segment): Likewise.
10211 (Symbol_table::do_define_in_output_segment): Likewise.
10212 (Symbol_table::define_as_constant): Likewise.
10213 (Symbol_table::do_define_as_constant): Likewise.
10214 * script.h (class Symbol_assignment): Add is_defsym parameter to
10215 constructor; change all callers.
10216 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10217 parameter. Change all callers. Add is_defsym_ field.
10218 (class Parser_closure): Add parsing_defsym parameter to
10219 constructor; change all callers. Add parsing_defsym accessor
10220 function. Add parsing_defsym_ field.
10221
10222 2009-12-28 Ian Lance Taylor <iant@google.com>
10223
10224 * gold.cc (queue_middle_tasks): Fix formatting.
10225 * object.cc (Relobj::is_section_name_included): Likewise.
10226
10227 2009-12-23 Ian Lance Taylor <iant@google.com>
10228
10229 * i386.cc (Target_i386::do_calls_non_split): Recognize
10230 -fsplit-stack prologue for a function with a static chain.
10231 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10232 -fsplit-stack prologue when using %r11.
10233
10234 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10235
10236 * options.cc (General_options::parse_version): Make -v continue and do
10237 the link like GNU ld does.
10238
10239 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10240
10241 * Makefile.am (CCFILES): Add timer.cc.
10242 (HFILES): Add timer.h.
10243 * configure.ac: Check for sysconf and times.
10244 * main.cc: include timer.h.
10245 (main): Use Timer instead of get_run_time.
10246 * timer.cc: New.
10247 * timer.h: New.
10248 * workqueue.cc: include timer.h.
10249 (Workqueue::find_and_run_task):
10250 Report user, sys and wall time.
10251 * Makefile.in: Regenerate.
10252 * config.in: Regenerate.
10253 * configure: Regenerate.
10254
10255 2009-12-16 Doug Kwan <dougkwan@google.com>
10256
10257 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10258 sections.
10259 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10260 relaxed input sections.
10261 * output.cc (Output_section::find_relaxed_input_section): Change
10262 return type to Output_relaxed_input_section pointer. Adjust code
10263 for new type of relaxed_input_section_map_.
10264 * output.h (Output_section::find_relaxed_input_section): Change
10265 return type to Output_relaxed_input_section pointer.
10266 (Output_section::Output_relaxed_input_section_by_input_section_map):
10267 New type.
10268 (Output_section::relaxed_input_section_map_): Change type to
10269 Output_section::Output_relaxed_input_section_by_input_section_map.
10270 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10271 input section.
10272
10273 2009-12-15 Ian Lance Taylor <iant@google.com>
10274
10275 * layout.cc (Layout::create_shstrtab): Only write out after input
10276 sections if we are compressing debug sections.
10277
10278 2009-12-15 Ian Lance Taylor <iant@google.com>
10279
10280 * archive.cc (Archive::add_symbols): Only look up a symbol without
10281 a version if there is, in fact, a version.
10282
10283 2009-12-14 Ian Lance Taylor <iant@google.com>
10284
10285 Revert -Wshadow changes, all changes from:
10286 2009-12-11 Doug Kwan <dougkwan@google.com>
10287 2009-12-11 Nick Clifton <nickc@redhat.com>
10288 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10289
10290 2009-12-11 Doug Kwan <dougkwan@google.com>
10291
10292 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10293 due to -Wshadow.
10294 * attributes.cc (Object_attribute::size): Ditto.
10295 (Attributes_section_data::size): Ditto.
10296 (Attributes_section_data::Attributes_section_data): Ditto.
10297 (Output_attributes_section_data::do_write): Ditto.
10298 * attributes.h (Object_attribute::set_type): Ditto.
10299 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10300
10301 2009-12-11 Nick Clifton <nickc@redhat.com>
10302
10303 * archive.cc: Fix shadowed variable warnings.
10304 * arm.cc: Likewise.
10305 * compressed_output.cc: Likewise.
10306 * compressed_output.h: Likewise.
10307 * configure: Likewise.
10308 * dwarf_reader.cc: Likewise.
10309 * dynobj.cc: Likewise.
10310 * dynobj.h: Likewise.
10311 * ehframe.cc: Likewise.
10312 * ehframe.h: Likewise.
10313 * errors.cc: Likewise.
10314 * expression.cc: Likewise.
10315 * fileread.cc: Likewise.
10316 * fileread.h: Likewise.
10317 * freebsd.h: Likewise.
10318 * i386.cc: Likewise.
10319 * icf.cc: Likewise.
10320 * incremental.h: Likewise.
10321 * layout.cc: Likewise.
10322 * layout.h: Likewise.
10323 * mapfile.cc: Likewise.
10324 * merge.cc: Likewise.
10325 * merge.h: Likewise.
10326 * object.cc: Likewise.
10327 * object.h: Likewise.
10328 * options.h: Likewise.
10329 * output.cc: Likewise.
10330 * output.h: Likewise.
10331 * parameters.cc: Likewise.
10332 * plugin.cc: Likewise.
10333 * powerpc.cc: Likewise.
10334 * reduced_debug_output.cc: Likewise.
10335 * reduced_debug_output.h: Likewise.
10336 * reloc.cc: Likewise.
10337 * reloc.h: Likewise.
10338 * resolve.cc: Likewise.
10339 * script-sections.cc: Likewise.
10340 * script.cc: Likewise.
10341 * script.h: Likewise.
10342 * sparc.cc: Likewise.
10343 * symtab.cc: Likewise.
10344 * symtab.h: Likewise.
10345 * target-select.cc: Likewise.
10346 * target-select.h: Likewise.
10347 * token.h: Likewise.
10348 * workqueue.cc: Likewise.
10349 * workqueue.h: Likewise.
10350 * x86_64.cc: Likewise.
10351
10352 2009-12-10 Doug Kwan <dougkwan@google.com>
10353
10354 * arm.cc (attributes.h): New include.
10355 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10356 (Arm_relobj::~Arm_relobj): Delete object pointed by
10357 attributes_section_data_.
10358 (Arm_relobj::attributes_section_data): New method definition.
10359 (Arm_relobj::attributes_section_data_): New data member declaration.
10360 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10361 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10362 attributes_section_data_.
10363 (Arm_dynobj::attributes_section_data): New method definition.
10364 (Arm_dynobj::attributes_section_data_): New data member declaration.
10365 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10366 initialization value of may_use_blx_ to false.
10367 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10368 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10369 object attributes to compute results instead of hard-coding.
10370 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10371 Target_arm::get_secondary_compatible_arch,
10372 Target_arm::set_secondary_compatible_arch
10373 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10374 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10375 New method declarations.
10376 (Target_arm::get_aeabi_object_attribute): New method definition.
10377 (Target_arm::attributes_section_data_): New data member declaration.
10378 (read_arm_attributes_section): New template definition.
10379 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10380 (Arm_dynobj::do_read_symbols): Ditto.
10381 (Target_arm::do_finalize_sections): Merge attributes sections from
10382 input. Check for BLX use after attributes section merging.
10383 Fix __exidx_start and __exidx_end visibility. Create an
10384 .ARM.attributes section if necessary.
10385 (Target_arm::get_secondary_compatible_arch,
10386 Target_arm::set_secondary_compatible_arch,
10387 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10388 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10389 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10390 New method definitions.
10391
10392 2009-12-09 Ian Lance Taylor <iant@google.com>
10393
10394 * plugin.cc (Plugin::load): Don't cast from void* to a function
10395 pointer.
10396
10397 2009-12-09 Ian Lance Taylor <iant@google.com>
10398
10399 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10400 information fields.
10401
10402 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10403
10404 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10405 Replace two_file_shared_1.so with two_file_shared_2.so.
10406 * testsuite/Makefile.in: Regenerated.
10407
10408 2009-12-08 Doug Kwan <dougkwan@google.com>
10409
10410 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10411 (HFILES): Add attributes.h and int_encoding.h.
10412 * Makefile.in: Regenerate.
10413 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10414 function definitions to int_encoding.cc
10415 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10416 prototypes to int_encoding.h
10417 * reduced_debug_output.cc (int_encoding.h): New include.
10418 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10419 function definitions to int_encoding.cc
10420 (insert_into_vector, read_from_pointer): Move template definitions to
10421 int_encoding.h
10422 * attributes.cc: New file.
10423 * attributes.h: New file.
10424 * int_encoding.cc: New file.
10425 * int_encoding.h: New file.
10426
10427 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10428
10429 PR gold/11055
10430 * incremental-dump.cc (dump_incremental_inputs): New.
10431 (main): Use dump_incremental_inputs.
10432
10433 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10434
10435 PR gold/10893
10436 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10437 checking elfcpp::STT_FUNC.
10438 (Target_i386::Relocate::relocate): Likewise.
10439 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10440
10441 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10442 symbols from shared libraries into normal FUNC symbols.
10443
10444 * symtab.h (Symbol): Add is_func and use it.
10445
10446 2009-12-05 Doug Kwan <dougkwan@google.com>
10447
10448 * arm.cc (Target_arm::arm_info): Initialize new fields
10449 attributes_section and attributes_vendor.
10450 * i386.cc (Target_i386::i386_info): Same.
10451 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10452 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10453 fields attributes_section and attributes_vendor.
10454 * sparc.cc (Target_sparc::sparc_info): Same.
10455 * target.h (Target::attributes_section, Target::attributes_vendor,
10456 Target::is_attributes_section, Target::attribute_arg_type,
10457 Target::attributes_order): New method definitions.
10458 (Target::Target_info::attributes_section,
10459 Target::Target_info::attributes_vendor): New fields.
10460 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10461 virtual method definitions.
10462 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10463 attributes_section and attributes_vendor.
10464 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10465
10466 2009-12-05 Doug Kwan <dougkwan@google.com>
10467
10468 * arm.cc: Update comments about interworking and stub generation.
10469 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10470 considered as non-PIC.
10471 (Arm_relocate_functions::base_abs): Fix formatting.
10472 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10473 of function to use GOT entry address instead of offset.
10474 (Target_arm::Scan::global): Issue an error if a symbol would need a
10475 PLT does not get one because it is untyped. Remove code to create
10476 dynamic symbols for relative branches.
10477 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10478 takes unsigned integer instead of boolean.
10479
10480 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10481
10482 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10483 (two_file_test_LDADD): Likewise.
10484 (common_test_1_LDADD): Likewise.
10485 (exception_test_LDADD) Likewise.
10486 (weak_test_LDADD): Likewise.
10487 (many_sections_test_LDADD): Likewise.
10488 (initpri1_LDADD): Likewise.
10489 (script_test_1_LDADD): Likewise.
10490 (script_test_2_LDADD): Likewise.
10491 (justsyms_LDADD): Likewise.
10492 (binary_test_LDADD): Likewise.
10493 (large_LDADD): Likewise.
10494 * testsuite/Makefile.in: Regenerated.
10495
10496 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10497
10498 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10499 (Symbol_table::override_with_special): Likewise.
10500 (Symbol_table::add_from_object): Likewise.
10501
10502 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10503
10504 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10505 Don't set the data_offset twice.
10506
10507 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10508
10509 * testsuite/Makefile.in: Regenerate.
10510
10511 2009-12-03 Doug Kwan <dougkwan@google.com>
10512
10513 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10514 (Target_arm::do_finalize_sections): Add parameter for symbol table
10515 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10516 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10517 parameter for symbol table pointer.
10518 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10519 an additional parameter for a pointer to symbol table.
10520 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10521 parameter for a symbol table pointer.
10522 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10523 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10524 Ditto.
10525 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10526 parameter for a symbol table pointer.
10527
10528 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10529
10530 * incremental.cc (Incremental_inputs_header)
10531 (Incremental_inputs_header_write, Incremental_inputs_entry)
10532 (Incremental_inputs_entry_write): Move ...
10533 * incremental.h (Incremental_inputs_header)
10534 (Incremental_inputs_header_write, Incremental_inputs_entry)
10535 (Incremental_inputs_entry_write): here.
10536
10537 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10538
10539 * incremental.cc (make_sized_incremental_binary): Set the target.
10540 Error if it is incompatible.
10541 * output.h (Output_file): Add filename method.
10542
10543 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10544
10545 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10546 from the get_* methods.
10547
10548 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10549
10550 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10551 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10552 Write 0 for the data_offset of scripts.
10553
10554 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10555
10556 * testsuite/Makefile.am: Add the incremental_test.sh test.
10557 * testsuite/incremental_test.sh: New.
10558 * testsuite/incremental_test_1.c: New.
10559 * testsuite/incremental_test_2.c: New.
10560
10561 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10562
10563 * incremental-dump.cc (main): Fix typos.
10564
10565 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10566
10567 PR gold/11025
10568 * incremental-dump.cc (main): Use llu to print 64 bit values.
10569
10570 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10571 H.J. Lu <hongjiu.lu@intel.com>
10572
10573 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10574 $(LIBDL).
10575 (incremental_dump_LDADD): Likewise.
10576 * Makefile.in: Regenerated.
10577
10578 2009-11-25 Doug Kwan <dougkwan@google.com>
10579
10580 Revert:
10581
10582 2009-11-25 Doug Kwan <dougkwan@google.com>
10583
10584 * arm.cc (Target_arm::Target_arm): Move method definition
10585 outside of class definition. Add code to handle
10586 --target1-rel, --target1-abs and --target2= options.
10587 (Target_arm::get_reloc_reloc_type): Change method to be
10588 non-static and const.
10589 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10590 New data member declaration.
10591 (Target_arm::Scan::local, Target_arm::Scan::global,
10592 Target_arm::Relocate::relocate,
10593 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10594 Adjust call to Target_arm::get_real_reloc_type.
10595 (Target_arm::get_real_reloc_type): Use command line options
10596 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10597 * options.h (--target1-rel, --target1-abs, --target2): New
10598 ARM-only options.
10599
10600 2009-11-25 Doug Kwan <dougkwan@google.com>
10601
10602 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10603 class definition. Add code to handle --target1-rel, --target1-abs
10604 and --target2= options.
10605 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10606 and const.
10607 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10608 member declaration.
10609 (Target_arm::Scan::local, Target_arm::Scan::global,
10610 Target_arm::Relocate::relocate,
10611 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10612 call to Target_arm::get_real_reloc_type.
10613 (Target_arm::get_real_reloc_type): Use command line options to
10614 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10615 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10616 options.
10617
10618 2009-11-25 Doug Kwan <dougkwan@google.com>
10619
10620 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10621 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10622 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10623 formatting.
10624 (Arm_relocate_functions::thm_call): Replace body with a call to
10625 Arm_relocate_functions::thumb_branch_common.
10626 (Arm_relocate_functions::thm_jump24,
10627 Arm_relocate_functions::thm_xpc22): New method definitions.
10628 (Arm_relocate_functions::thumb_branch_common): New method definition.
10629 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10630 operator.
10631 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10632 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10633
10634 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10635
10636 * Makefile.am: Build incremental-dump
10637 * Makefile.in: Regenerate.
10638 * incremental-dump.cc: New.
10639 * incremental.cc (Incremental_inputs_header_data,
10640 Incremental_inputs_entry_data): Move to incremental.h
10641 * incremental.h: (Incremental_inputs_header_data,
10642 Incremental_inputs_entry_data): Move from incremental.cc
10643
10644 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10645
10646 * incremental.cc (Incremental_inputs_header,
10647 Incremental_inputs_header_write, Incremental_inputs_entry,
10648 Incremental_inputs_entry_write): Add a typedef with the data type.
10649
10650 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10651
10652 * incremental.cc (Incremental_inputs_header,
10653 Incremental_inputs_header_write, Incremental_inputs_entry,
10654 Incremental_inputs_entry_write): Update comment about which
10655 type has the filed descriptions.
10656
10657 2009-11-15 Doug Kwan <dougkwan@google.com>
10658
10659 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10660 (Arm_relocate_functions::arm_branch_common): Change method defintion
10661 in class definition to a method declaration and update list of formal
10662 parameters.
10663 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10664 Arm_relocation_functions::jump24): Adjust call to
10665 Arm_relocate_functions::arm_branch_common. Update list of formal
10666 parameters.
10667 (Arm_relocate_functions::xpc25): New method definition.
10668 (Arm_relocate_functions::arm_branch_common): Move method defintion
10669 out from class definition. Use stubs for mode-switching and extending
10670 branch ranges.
10671 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10672 specially. Change code to enable use of stubs in ARM branches.
10673
10674 2009-11-10 Doug Kwan <dougkwan@google.com>
10675
10676 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10677 in method declaration.
10678 (Target_arm::relocate_stub): New method declaration.
10679 (Target_arm::default_target): Change to return a pointer instead of
10680 a const reference.
10681 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10682 Target_arm::default_target.
10683 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10684 method definition.
10685 (Target_arm::relocate_section): Adjust view.
10686 (Target_arm::relocate_stub): New method definition.
10687
10688 2009-11-10 Doug Kwan <dougkwan@google.com>
10689
10690 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10691 a format warning.
10692 * incremental.cc (open_incremental_binary): Initialized local
10693 variables to avoid warnings.
10694 * object.cc (make_elf_object): Ditto.
10695 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10696 a format warning.
10697
10698 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10699
10700 PR gold/10930
10701 * testsuite/plugin_test.c: Include "config.h".
10702
10703 2009-11-09 Doug Kwan <dougkwan@google.com>
10704
10705 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10706 (arm_symbol_value): Remove.
10707 (Arm_relocate_functions::arm_branch_common,
10708 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10709 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10710 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10711 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10712 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10713 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10714 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10715 Arm_relocate_functions::thm_mobw_abs_nc,
10716 Arm_relocate_functions::thm_mov_abs,
10717 Arm_relocate_functions::movw_prel_nc,
10718 Arm_relocate_functions::thm_movt_abs,
10719 Arm_relocate_functions::movt_prel,
10720 Arm_relocate_functions::thm_movw_prel_nc,
10721 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10722 (Target_arm::Relocate::relocate): Only decompose address into two
10723 parts if relocation type uses the thumb-bit and pass the actual
10724 bit instead of a flag indicating that the thumb-bit is used. Adjust
10725 calls to methods in Arm_relocate_functions for this change.
10726
10727 2009-11-08 Ian Lance Taylor <iant@google.com>
10728
10729 PR 10925
10730 * reloc.cc: Instantiate
10731 Sized_relobj::initialize_input_to_output_maps and
10732 Sized_relobj:free_input_to_output_maps.
10733
10734 2009-11-06 Ian Lance Taylor <iant@google.com>
10735
10736 PR 10876
10737 * defstd.cc (in_segment): Set only_if_ref true for "end".
10738
10739 2009-11-06 Doug Kwan <dougkwan@google.com>
10740
10741 * arm.cc (class Reloc_stub): Correct a comment.
10742 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10743 (Target_arm::scan_section_for_stubs): New method declaration.
10744 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10745 Change methods from private to protected.
10746 (Target_arm::do_may_relax): New method definition.
10747 (Target_arm::do_relax, Target_arm::group_sections,
10748 Target_arm::scan_reloc_for_stub,
10749 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10750 (Target_arm::arm_input_section_map_): New data member declaration.
10751 (Target_arm::scan_reloc_for_stub,
10752 Target_arm::scan_reloc_section_for_stubs,
10753 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10754 Target_arm::do_relax): New method definitions.
10755
10756 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10757
10758 * configure.ac: Check for (struct stat)::st_mtim
10759 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10760 * config.in: Regenerate.
10761 * configure: Regenerate.
10762
10763 2009-11-05 Ian Lance Taylor <iant@google.com>
10764
10765 PR 10910
10766 * output.cc (Output_segment::add_output_section): Add missing
10767 return statement.
10768
10769 2009-11-04 Ian Lance Taylor <iant@google.com>
10770
10771 PR 10880
10772 * object.h (class Object): Add is_needed and set_is_needed
10773 methods. Add is_needed_ field. Make bool fields into bitfields.
10774 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10775 defined in a dynamic object and referenced by a regular object,
10776 set is_needed for the dynamic object.
10777 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10778 if the file is marked with as_needed and it is not needed.
10779
10780 2009-11-04 Ian Lance Taylor <iant@google.com>
10781
10782 PR 10887
10783 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10784 tags if data is discarded by linker script.
10785 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10786 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10787 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10788 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10789
10790 2009-11-04 Ian Lance Taylor <iant@google.com>
10791
10792 * layout.cc (Layout::get_output_section): Add is_interp and
10793 is_dynamic_linker_section parameters. Change all callers.
10794 (Layout::choose_output_section): Likewise.
10795 (Layout::make_output_section): Likewise.
10796 (Layout::add_output_section_data): Add is_dynamic_linker_section
10797 parameter. Change all callers.
10798 * layout.h (class Layout): Update declarations.
10799 * output.h (class Output_section): Add is_interp, set_is_interp,
10800 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10801 Add is_interp_, is_dynamic_linker_section_ fields. Change
10802 generate_code_fills_at_write_ to a bitfield.
10803 * output.cc (Output_section::Output_sections): Initialize new
10804 fields.
10805 (Output_segment::add_output_section): Add do_sort parameter.
10806 Change all callers.
10807
10808 2009-11-03 Ian Lance Taylor <iant@google.com>
10809
10810 PR 10860
10811 * options.h (class General_options): Add --warn-common.
10812 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10813 merging two common symbols.
10814 (Symbol_table::should_override): Handle --warn-common when merging
10815 a common symbol with a defined symbol. Use report_resolve_problem
10816 for multiple definitions.
10817 (Symbol_table::report_resolve_problem): New function.
10818 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10819
10820 2009-11-03 Doug Kwan <dougkwan@google.com>
10821
10822 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10823 stub_factory_.
10824 (Target_arm::stub_factory): New method definition.
10825 (Target_arm::new_arm_input_section,
10826 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10827 Target_arm::reloc_uses_thumb_bit): New method declarations.
10828 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10829 New type definitions.
10830 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10831 member declarations.
10832 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10833 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10834 New method definitions.
10835
10836 2009-11-03 Ian Lance Taylor <iant@google.com>
10837
10838 * options.h (class General_options): Add --warn_constructors.
10839
10840 2009-11-03 Ian Lance Taylor <iant@google.com>
10841
10842 PR 10893
10843 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10844 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10845
10846 2009-11-03 Ian Lance Taylor <iant@google.com>
10847
10848 PR 10895
10849 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10850 --msgid-bugs-address.
10851 (install-pdf): New target.
10852 (install-data_yes): Look up one directory to find mkinstalldirs.
10853
10854 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10855
10856 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10857 tree.
10858
10859 2009-10-30 Doug Kwan <dougkwan@google.com>
10860
10861 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10862
10863 2009-10-30 Doug Kwan <dougkwan@google.com>
10864
10865 * arm.cc (Stub_addend_reader): New struct template definition
10866 and partial specializations.
10867 (Stub_addend_reader::operator()): New method definition for a
10868 partially specialized template.
10869
10870 2009-10-30 Doug Kwan <dougkwan@google.com>
10871
10872 * arm.cc (Arm_relobj::processor_specific_flags): New method
10873 definition.
10874 (Arm_relobj::do_read_symbols): New method declaration.
10875 (Arm_relobj::processor_specific_flags_): New data member declaration.
10876 (Arm_dynobj): New class definition.
10877 (Target_arm::do_finalize_sections): Add input_objects parameter.
10878 (Target_arm::do_adjust_elf_header): New method declaration.
10879 (Target_arm::are_eabi_versions_compatible,
10880 (Target_arm::merge_processor_specific_flags): New method declaration.
10881 (Target_arm::do_make_elf_object): New overloaded method definitions
10882 and declaration.
10883 (Arm_relobj::do_read_symbols): New method definition.
10884 (Arm_dynobj::do_read_symbols): Ditto.
10885 (Target_arm::do_finalize_sections): Add input_objects parameters.
10886 Merge processor-specific flags from all input objects.
10887 (Target_arm::are_eabi_versions_compatible,
10888 Target_arm::merge_processor_specific_flags,
10889 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10890 New method definitions.
10891 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10892 Input_objects pointer type parameter.
10893 * layout.cc (Layout::finalize): Pass input objects to target's.
10894 finalize_sections function.
10895 * output.cc (Output_file_header::do_sized_write): Set ELF file
10896 header's processor-specific flags.
10897 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10898 Input_objects pointer type parameter.
10899 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10900 * target.h (Input_objects): New forward class declaration.
10901 (Target::processor_specific_flags,
10902 Target::are_processor_specific_flags_sect): New method definitions.
10903 (Target::finalize_sections): Add input_objects parameter.
10904 (Target::Target): Initialize processor_specific_flags_ and
10905 are_processor_specific_flags_set_.
10906 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10907 parameter.
10908 (Target::set_processor_specific_flags): New method definition.
10909 (Target::processor_specific_flags_,
10910 Target::are_processor_specific_flags_set_): New data member
10911 declarations.
10912 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10913 Input_objects pointer type parameter.
10914
10915 2009-10-30 Doug Kwan <dougkwan@google.com>
10916
10917 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10918
10919 2009-10-28 Ian Lance Taylor <iant@google.com>
10920
10921 * object.h (class Relobj): Drop options parameter from
10922 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10923 do_scan_relocs, do_relocate. Change all callers.
10924 (class Sized_relobj): Drop options parameters from
10925 do_gc_process_relocs, do_scan_relocs, do_relocate,
10926 do_relocate_sections, relocate_sections, emit_relocs_scan,
10927 emit_relocs_scan_reltype. Change all callers.
10928 (struct Relocate_info): Remove options field and all references to
10929 it.
10930 * reloc.h (class Read_relocs): Remove options constructor
10931 parameter and options_ field. Change all callers.
10932 (class Gc_process_relocs, class Scan_relocs): Likewise.
10933 (class Relocate_task): Likewise.
10934 * target-reloc.h (scan_relocs): Remove options parameter. Change
10935 all callers.
10936 (scan_relocatable_relocs): Likewise.
10937 * target.h (class Sized_target): Remove options parameter from
10938 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10939 all callers.
10940 * gc.h (gc_process_relocs): Remove options parameter. Change all
10941 callers.
10942 * arm.cc: Update functions to remove options parameters.
10943 * i386.cc: Likewise.
10944 * powerpc.cc: Likewise.
10945 * sparc.cc: Likewise.
10946 * x86_64.cc: Likewise.
10947 * testsuite/testfile.cc: Likewise.
10948
10949 2009-10-28 Doug Kwan <dougkwan@google.com>
10950
10951 * arm.cc (Arm_relobj): New class definition.
10952 (Arm_relobj::scan_sections_for_stubs,
10953 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10954 New method definitions.
10955
10956 2009-10-28 Cary Coutant <ccoutant@google.com>
10957
10958 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10959 (Plugin::cleanup_done_): New member.
10960 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10961 (Plugin_manager::cleanup_done_): Remove.
10962 (Plugin_manager::add_input_file): Edit error message.
10963 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10964 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10965
10966 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10967
10968 * fileread.cc: (File_read::View::~View): Use the new
10969 data_ownership_ filed.
10970 (File_read::~File_read): Dispose the new whole_file_view_.
10971 (File_read::open): Mmap the whole file if needed.
10972 (File_read::open): Use whole_file_view_ instead of contents_.
10973 (File_read::find_view): Use whole_file_view_ if applicable.
10974 (File_read::do_read): Use whole_file_view_ instead of contents_.
10975 (File_read::make_view): Use whole_file_view_ instead of contents_,
10976 update File_read::View::View call.
10977 (File_read::find_or_make_view): Update File_read::View::View
10978 call.
10979 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10980 remove contents_
10981 (File_read::View::Data_ownership): New enum.
10982 (File_read::View::View): Replace bool mapped_ with Data_ownership
10983 argument.
10984 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10985 (File_read::View::data_ownership_): New field.
10986 (File_read::contents_): Remove (replaced by whole_file_view_).
10987 (File_read::whole_file_view_): New field.
10988 * options.h (class General_options): Add --keep-files-mapped.
10989
10990 2009-10-27 Cary Coutant <ccoutant@google.com>
10991
10992 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10993 * testsuite/Makefile.am (plugin_test_5): New test case.
10994 * testsuite/Makefile.in: Regenerate.
10995
10996 2009-10-25 Doug Kwan <dougkwan@google.com>
10997
10998 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10999 from private to protected to allow access by child class.
11000 (Sized_relobj::do_relocate_sections): New method declaration.
11001 (Sized_relobj::relocate_sections): Virtualize.
11002 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11003 Sized_relobj::relocate_sections. Instantiate template explicitly
11004 for different target sizes and endianity.
11005
11006 2009-10-24 Doug Kwan <dougkwan@google.com>
11007
11008 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11009 (Arm_input_section::as_arm_input_section): New method.
11010 (Arm_output_section): New class definition.
11011 (Arm_output_section::create_stub_group,
11012 Arm_output_section::group_sections): New method definitions.
11013
11014 2009-10-22 Doug Kwan <dougkwan@google.com>
11015
11016 * arm.cc (Arm_input_section): New class definition.
11017 (Arm_input_section::init, Arm_input_section:do_write,
11018 Arm_input_section::set_final_data_size,
11019 Arm_input_section::do_reset_address_and_file_offset): New method
11020 definitions.
11021
11022 2009-10-21 Doug Kwan <dougkwan@google.com>
11023
11024 * arm.cc (Stub_table, Arm_input_section): New forward class
11025 declarations.
11026 (Stub_table): New class defintion.
11027 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11028 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11029 New method definition.
11030
11031 2009-10-21 Doug Kwan <dougkwan@google.com>
11032
11033 * arm.cc: Update copyright comments.
11034 (Target_arm): New forward class template declaration.
11035 (Arm_address): New type.
11036 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11037 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11038 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11039 constants.
11040 (Insn_template): Same.
11041 (DEF_STUBS): New macro.
11042 (Stub_type): New enum type.
11043 (Stub_template): New class definition.
11044 (Stub): Same.
11045 (Reloc_stub): Same.
11046 (Stub_factory): Same.
11047 (Target_arm::Target_arm): Initialize may_use_blx_ and
11048 should_force_pic_veneer_.
11049 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11050 Target_arm::should_force_pic_veneer,
11051 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11052 Target_arm::using_thumb_only, Target_arm:;default_target): New
11053 method defintions.
11054 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11055 New data member declarations.
11056 (Insn_template::size, Insn_template::alignment): New method defintions.
11057 (Stub_template::Stub_template): New method definition.
11058 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11059 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11060 (Stub_factory::Stub_factory): New method definition.
11061 * gold.h (string_hash): New template.
11062 * output.h (Input_section_specifier::hash_value): Use
11063 gold::string_hash.
11064 (Input_section_specifier::string_hash): Remove.
11065 * stringpool.cc (Stringpool_template::string_hash): Use
11066 gold::string_hash.
11067
11068 2009-10-20 Doug Kwan <dougkwan@google.com>
11069
11070 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11071 symbols of relaxed input sections.
11072 * output.h (Output_section::find_relaxed_input_section): Make
11073 method public.
11074
11075 2009-10-16 Doug Kwan <dougkwan@google.com>
11076
11077 * dynobj.cc (Versions::Versions): Initialize version_script_.
11078 Only insert base version symbol definition for a shared object
11079 if version script defines any version versions.
11080 (Versions::define_base_version): New method definition.
11081 (Versions::add_def): Check that base version is not needed.
11082 (Versions::add_need): Define base version lazily.
11083 * dynobj.h (Versions::define_base_version): New method declaration.
11084 (Versions::needs_base_version_): New data member declaration.
11085 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11086 (check_DATA): Add no_version_test.stdout.
11087 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11088 New make rules.
11089 * testsuite/Makefile.in: Regenerate.
11090 * testsuite/no_version_test.c: New file.
11091 * testsuite/no_version_test.sh: Ditto.
11092
11093 2009-10-16 Doug Kwan <dougkwan@google.com>
11094
11095 * expression.cc (class Segment_start_expression): New class definition.
11096 (Segment_start_expression::value): New method definition.
11097 (script_exp_function_segment_start): Return a new
11098 Segment_start_expression.
11099 * gold/script-c.h (script_saw_segment_start_expression): New function
11100 prototype.
11101 * script-sections.cc (Script_sections::Script_sections): Initialize
11102 SAW_SEGMENT_START_EXPRESSION_ to false.
11103 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11104 and -Tbbs options to specify section addresses if given in
11105 command line and no SEGMENT_START expression is seen in a script.
11106 * script-sections.h (Script_sections::saw_segment_start_expression,
11107 Script_sections::set_saw_segment_start_expression): New method
11108 definition.
11109 (Script_sections::saw_segment_start_expression_): New data member
11110 declaration.
11111 * script.cc (script_saw_segment_start_expression): New function.
11112 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11113 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11114 script_test_7.sh and script_test_8.sh.
11115 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11116 script_test_8.stdout.
11117 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11118 (script_test_6, script_test_6.stdout, script_test_7,
11119 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11120 * Makefile.in: Regenerate.
11121 * testsuite/script_test_6.sh: New file.
11122 * testsuite/script_test_6.t: Same.
11123 * testsuite/script_test_7.sh: Same.
11124 * testsuite/script_test_7.t: Same.
11125 * testsuite/script_test_8.sh: Same.
11126
11127 2009-10-16 Doug Kwan <dougkwan@google.com>
11128
11129 * output.cc (Output_segment::set_section_list_address): Cast
11130 expressions to unsigned long long type to avoid format warnings.
11131
11132 2009-10-15 Ian Lance Taylor <iant@google.com>
11133
11134 * script.cc (Script_options::add_symbol_assignment): Always add a
11135 dot assignment to script_sections_.
11136 * script-sections.cc (Script_sections::add_dot_assignment):
11137 Initialize if necessary.
11138
11139 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11140 program headers with no load segment if there is a linker script.
11141
11142 * layout.cc (Layout::set_segment_offsets): Align the file offset
11143 to the segment aligment for -N or -n with no load segment.
11144 * output.cc (Output_segment::add_output_section): Don't crash if
11145 the first section is a TLS section.
11146 (Output_segment::set_section_list_addresses): Print an error
11147 message if the address moves backward in a linker script.
11148 * script-sections.cc
11149 (Output_section_element_input::set_section_addresses): Don't
11150 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11151 (Orphan_output_section::set_section_addresses): Likewise.
11152
11153 2009-10-15 Doug Kwan <dougkwan@google.com>
11154
11155 * layout.cc (Layout::finish_dynamic_section): Generate tags
11156 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11157 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11158 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11159
11160 2009-10-14 Ian Lance Taylor <iant@google.com>
11161
11162 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11163 fields.
11164 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11165 data_shdr fields of relinfo.
11166 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11167 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11168 R_386_TLS_LDO_32, adjust based on section flags.
11169 (Target_i386::Relocate::fix_up_ldo): Remove.
11170
11171 2009-10-13 Ian Lance Taylor <iant@google.com>
11172
11173 Add support for -pie.
11174 * options.h (class General_options): Add -pie and
11175 --pic-executable.
11176 (General_options::output_is_position_independent): Test -pie.
11177 (General_options::output_is_executable): Return true if not shared
11178 and not relocatable.
11179 (General_options::output_is_pie): Remove.
11180 * options.cc (General_options::finalize): Reject incompatible uses
11181 of -pie.
11182 * gold.cc (queue_middle_tasks): A -pie link is not static.
11183 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11184 * symtab.cc (Symbol::final_value_is_known): Return false if
11185 output_is_position_independent.
11186 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11187 output_is_position_independent.
11188 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11189 output_is_position_independent.
11190 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11191 output_is_position_independent.
11192 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11193 two_file_pie_test.
11194 (basic_pie_test.o, basic_pie_test): New targets.
11195 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11196 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11197 (two_file_pie_test): New target.
11198 * testsuite/Makefile.in: Rebuild.
11199 * README: Remove note saying that -pie is not supported.
11200
11201 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11202
11203 * options.h (class General_options): Add -init and -fini.
11204 * layout.cc (Layout::finish_dynamic_section): Emit
11205 given init and fini functions.
11206
11207 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11208
11209 * gc.h (gc_process_relocs): Check if icf is enabled using new
11210 function.
11211 * gold.cc (queue_initial_tasks): Likewise.
11212 (queue_middle_tasks): Likewise.
11213 * object.cc (do_layout): Likewise.
11214 * symtab.cc (is_section_folded): Likewise.
11215 * main.cc (main): Likewise.
11216 * reloc.cc (Read_relocs::run): Likewise.
11217 (Sized_relobj::do_scan_relocs): Likewise.
11218 * icf.cc (is_function_ctor_or_dtor): New function.
11219 (Icf::find_identical_sections): Check if function is ctor or dtor when
11220 safe icf is chosen.
11221 * options.h (General_options::icf): Change option to be an enum.
11222 (Icf_status): New enum.
11223 (icf_enabled): New method.
11224 (icf_safe_folding): New method.
11225 (set_icf_status): New method.
11226 (icf_status_): New variable.
11227 * (options.cc) (General_options::finalize): Set icf_status_.
11228 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11229 icf_test and icf_keep_unique_test to use the --icf enum flag.
11230 * testsuite/icf_safe_test.sh: New file.
11231 * testsuite/icf_safe_test.cc: New file.
11232
11233 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11234
11235 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11236 includes to gc.h and icf.h.
11237 * arm.cc: Include gc.h.
11238 * gold.cc: Likewise.
11239 * i386.cc: Likewise.
11240 * powerpc.cc: Likewise.
11241 * sparc.cc: Likewise.
11242 * x86_64.cc: Likewise.
11243 * gc.h: Include icf.h.
11244
11245 2009-10-11 Ian Lance Taylor <iant@google.com>
11246
11247 * plugin.cc: Include "gold.h" before other header files.
11248
11249 2009-10-10 Chris Demetriou <cgd@google.com>
11250
11251 * options.h (Input_file_argument::Input_file_type): New enum.
11252 (Input_file_argument::is_lib_): Replace with...
11253 (Input_file_argument::type_): New member.
11254 (Input_file_argument::Input_file_argument): Take Input_file_type
11255 'type' rather than boolean 'is_lib' as second argument.
11256 (Input_file_argument::is_lib): Use type_.
11257 (Input_file_argument::is_searched_file): New function.
11258 (Input_file_argument::may_need_search): Handle is_searched_file.
11259 * options.cc (General_options::parse_library): Support -l:filename.
11260 (General_options::parse_just_symbols): Update for Input_file_argument
11261 changes.
11262 (Command_line::process): Likewise.
11263 * archive.cc (Archive::get_file_and_offset): Likewise.
11264 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11265 * script.cc (read_script_file, script_add_file): Likewise.
11266 * fileread.cc (Input_file::Input_file): Likewise.
11267 (Input_file::will_search_for): Handle is_searched_file.
11268 (Input_file::open): Likewise.
11269 * readsyms.cc (Read_symbols::get_name): Likewise.
11270 * testsuite/Makefile.am (searched_file_test): New test.
11271 * testsuite/Makefile.in: Regenerate.
11272 * testsuite/searched_file_test.cc: New file.
11273 * testsuite/searched_file_test_lib.cc: New file.
11274
11275 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11276 Ian Lance Taylor <iant@google.com>
11277
11278 * descriptor.cc: Include <cstdio> and "binary-io.h".
11279 (Descriptors::open): Open the files in binary mode always.
11280 * script.cc (Lex::get_token): Treat \r as whitespace.
11281
11282 2009-10-09 Ian Lance Taylor <iant@google.com>
11283
11284 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11285
11286 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11287 Ian Lance Taylor <iant@google.com>
11288
11289 * configure.ac: Check for readv function also.
11290 * fileread.cc (readv): Define if not HAVE_READV.
11291 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11292 does not exist.
11293 * config.in: Regenerate.
11294 * configure: Regenerate.
11295
11296 2009-10-09 Doug Kwan <dougkwan@google.com>
11297
11298 * layout.cc (Layout::make_output_section): Call target hook to make
11299 ordinary output section.
11300 (Layout::finalize): Adjust parameter list of call the
11301 Target::may_relax().
11302 * layout.h (class Layout::section_list): New method.
11303 * merge.h (Output_merge_base::entsize): Change visibility to public.
11304 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11305 New methods.
11306 (Output_merge_string::do_is_string): New method.
11307 * object.cc (Sized_relobj::do_setup): renamed from
11308 Sized_relobj::set_up.
11309 * object.h (Sized_relobj::adjust_shndx,
11310 Sized_relobj::initializ_input_to_output_maps,
11311 Sized_relobj::free_input_to_output_maps): Change visibilities to
11312 protected.
11313 (Sized_relobj::setup): Virtualize.
11314 (Sized_relobj::do_setup): New method declaration.
11315 (Sized_relobj::invalidate_section_offset,
11316 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11317 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11318 * options.cc (parse_int): New function.
11319 * options.h (parse_int): New declaration.
11320 (DEFINE_int): New macro.
11321 (stub_group_size): New option.
11322 * output.cc (Output_section::Output_section): Initialize memebers
11323 merge_section_map_, merge_section_by_properties_map_,
11324 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11325 (Output_section::add_input_section): Handled deferred code-fill
11326 generation and remove an old comment.
11327 (Output_section::add_relaxed_input_section): New method definition.
11328 (Output_section::add_merge_input_section): Use merge section by
11329 properties map to speed to search. Update merge section maps
11330 as appropriate.
11331 (Output_section::build_relaxation_map): New method definition.
11332 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11333 Same.
11334 (Output_section::relax_input_section): Renamed to
11335 Output_section::convert_input_sections_to_relaxed_sections and change
11336 interface to take a vector of pointers to relaxed sections.
11337 (Output_section::find_merge_section,
11338 Output_section::find_relaxed_input_section): New method definitions.
11339 (Output_section::is_input_address_mapped,
11340 Output_section::output_offset, Output_section::output_address):
11341 Use output section data maps to speed up searching.
11342 (Output_section::find_starting_output_address): Add comments.
11343 (Output_section::do_write,
11344 Output_section::write_to_postprocessing_buffer): Do code-fill
11345 generation as appropriate.
11346 (Output_section::get_input_sections): Invalidate relaxed input section
11347 map.
11348 (Output_section::restore_states): Adjust type of checkpoint .
11349 Invalidate relaxed input section map.
11350 * output.h (Output_merge_base): New class declaration.
11351 (Input_section_specifier): New class defintion.
11352 (class Output_relaxed_input_section) Change base class to
11353 Output_section_data_build.
11354 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11355 base class initializer.
11356 (Output_section::add_relaxed_input_section): New method declaration.
11357 (Output_section::Input_section): Change visibility to protected.
11358 (Output_section::Input_section::relobj,
11359 Output_section::Input_section::shndx): Handle relaxed input sections.
11360 Output_section::input_sections) Change visibility to protected. Also
11361 define overload to return a non-const pointer.
11362 (Output_section::Merge_section_properties): New class defintion.
11363 (Output_section::Merge_section_by_properties_map,
11364 Output_section::Output_section_data_by_input_section_map,
11365 Output_section::Relaxation_map): New types.
11366 (Output_section::relax_input_section): Rename method to
11367 Output_section::convert_input_sections_to_relaxed_sections and change
11368 interface to take a vector of relaxed section pointers.
11369 (Output_section::find_merge_section,
11370 Output_section::find_relaxed_input_section,
11371 Output_section::build_relaxation_map,
11372 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11373 New method declarations.
11374 (Output_section::merge_section_map_
11375 Output_section::merge_section_by_properties_map_,
11376 Output_section::relaxed_input_section_map_,
11377 Output_section::is_relaxed_input_section_map_valid_,
11378 Output_section::generate_code_fills_at_write_): New data members.
11379 * script-sections.cc
11380 (Output_section_element_input::set_section_addresses): Call
11381 current_data_size and addralign methods of relaxed input sections.
11382 (Orphan_output_section::set_section_addresses): Call current_data_size
11383 and addralign methods of relaxed input sections.
11384 * symtab.cc (Symbol_table::compute_final_value): Extract template
11385 from the body of Symbol_table::sized_finalize_symbol.
11386 (Symbol_table::sized_finalized_symbol): Call
11387 Symbol_table::compute_final_value.
11388 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11389 (Symbol_table::compute_final_value): New templated method declaration.
11390 * target.cc (Target::do_make_output_section): New method defintion.
11391 * target.h (Target::make_output_section): New method declaration.
11392 (Target::relax): Add more parameters for input objects, symbol table
11393 and layout. Adjust call to do_relax.
11394 (Target::do_make_output_section): New method declaration.
11395 (Target::do_relax): Add parameters for input objects, symbol table
11396 and layout.
11397
11398 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11399
11400 * pread.c: Include stdio.h.
11401
11402 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11403
11404 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11405 defined.
11406
11407 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11408
11409 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11410 Change read_shndx type to unsigned int.
11411 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11412 int.
11413 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11414 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11415 Change read_shndx type to unsigned int.
11416 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11417 int.
11418 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11419 * layout.cc (Layout::create_symtab_sections): Cast the result of
11420 local_symcount * symsize to off_t in the gold_assert.
11421
11422 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11423
11424 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11425 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11426 R_ARM_BASE_ABS.
11427 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11428 (Arm_relocate_functions::thm_abs5): New function.
11429 (Arm_relocate_functions::abs12): New function.
11430 (Arm_relocate_functions::abs16): New function.
11431 (Arm_relocate_functions::base_abs): New function.
11432 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11433 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11434 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11435 R_ARM_BASE_ABS.
11436 (Scan::global): Likewise.
11437 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11438 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11439 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11440 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11441 R_ARM_BASE_ABS.
11442
11443 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11444
11445 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11446 (Arm_relocate_functions::movt_prel): New function.
11447 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11448 (Arm_relocate_functions::thm_movt_prel): New function.
11449 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11450 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11451 (Scan::global, Relocate::relocate): Likewise.
11452 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11453
11454 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11455
11456 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11457 Incremental_checker.
11458 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11459 unsigned int.
11460 (class Incremental_inputs_header): New class.
11461 (Incremental_inputs_header_writer): Edit comment.
11462 (Incremental_inputs_entry): New class.
11463 (Incremental_inputs_entry_writer): Edit comment.
11464 (Sized_incremental_binary::do_find_incremental_inputs_section):
11465 Add *strtab_shndx parameter, fill it.
11466 (Sized_incremental_binary::do_check_inputs): New method.
11467 (Incremental_checker::can_incrementally_link_output_file): Use
11468 Sized_incremental_binary::check_inputs.
11469 (Incremental_inputs::report_command_line): Save command line in
11470 command_line_.
11471 * incremental.h:
11472 (Incremental_binary::find_incremental_inputs_section): New
11473 method.
11474 (Incremental_binary::do_find_incremental_inputs_section): Add
11475 strtab_shndx parameter.
11476 (Incremental_binary::do_check_inputs): New pure virtual method.
11477 (Sized_incremental_binary::do_check_inputs): Declare.
11478 (Incremental_checker::Incremental_checker): Add incremental_inputs
11479 parameter, use it to initialize incremental_inputs_.
11480 (Incremental_checker::incremental_inputs_): New field.
11481 (Incremental_checker::command_line): New method.
11482 (Incremental_checker::inputs): New method.
11483 (Incremental_checker::command_line_): New field.
11484
11485 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11486
11487 * incremental.cc: Include <cstdarg> and "target-select.h".
11488 (vexplain_no_incremental): New function.
11489 (explain_no_incremental): New function.
11490 (Incremental_binary::error): New method.
11491 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11492 method.
11493 (make_sized_incremental_binary): New function.
11494 (open_incremental_binary): New function.
11495 (can_incrementally_link_file): Add checks if output is ELF and has
11496 inputs section.
11497 * incremental.h: Include "elfcpp_file.h" and "output.h".
11498 (Incremental_binary): New class.
11499 (Sized_incremental_binary): New class.
11500 (open_incremental_binary): Declare.
11501 * object.cc (is_elf_object): Use
11502 elfcpp::Elf_recognizer::is_elf_file.
11503 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11504 * output.h (Output_file::filesize): New method.
11505
11506 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11507
11508 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11509 New function.
11510 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11511 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11512 function.
11513 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11514 function.
11515 (Arm_relocate_functions::movw_abs_nc): New function.
11516 (Arm_relocate_functions::movt_abs): New function.
11517 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11518 (Arm_relocate_functions::thm_movt_abs): New function.
11519 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11520 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11521 (Scan::global): Likewise.
11522 (Relocate::relocate): Likewise.
11523 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11524
11525 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11526
11527 * arm.cc (Arm_relocate_functions::got_prel) New function.
11528 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11529 (Relocate::relocate): Likewise.
11530 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11531
11532 2009-10-06 Ian Lance Taylor <iant@google.com>
11533
11534 * options.h (class General_options): Define
11535 split_stack_adjust_size parameter.
11536 * object.h (class Object): Add uses_split_stack_ and
11537 has_no_split_stack_ fields. Add uses_split_stack and
11538 has_no_split_stack accessor functions. Declare
11539 handle_split_stack_section.
11540 (class Reloc_symbol_changes): Define.
11541 (class Sized_relobj): Define Function_offsets. Declare
11542 split_stack_adjust, split_stack_adjust_reltype, and
11543 find_functions.
11544 * object.cc (Object::handle_split_stack_section): New function.
11545 (Sized_relobj::do_layout): Call handle_split_stack_section.
11546 * dynobj.cc (Sized_dynobj::do_layout): Call
11547 handle_split_stack_section.
11548 * reloc.cc (Sized_relobj::relocate_sections): Call
11549 split_stack_adjust for executable sections in split_stack
11550 objects. Pass reloc_map to relocate_section.
11551 (Sized_relobj::split_stack_adjust): New function.
11552 (Sized_relobj::split_stack_adjust_reltype): New function.
11553 (Sized_relobj::find_functions): New function.
11554 * target-reloc.h: Include "object.h".
11555 (relocate_section): Add reloc_symbol_changes parameter. Change
11556 all callers.
11557 * target.h (class Target): Add calls_non_split method. Declare
11558 do_calls_non_split virtual method. Declare match_view and
11559 set_view_to_nop.
11560 * target.cc: Include "elfcpp.h".
11561 (Target::do_calls_non_split): New function.
11562 (Target::match_view): New function.
11563 (Target::set_view_to_nop): New function.
11564 * gold.cc (queue_middle_tasks): Give an error if mixing
11565 split-stack and non-split-stack objects with -r.
11566 * i386.cc (Target_i386::relocate_section): Add
11567 reloc_symbol_changes parameter.
11568 (Target_i386::do_calls_non_split): New function.
11569 * x86_64.cc (Target_x86_64::relocate_section): Add
11570 reloc_symbol_changes parameter.
11571 (Target_x86_64::do_calls_non_split): New function.
11572 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11573 parameter.
11574 * powerpc.cc (Target_powerpc::relocate_section): Add
11575 reloc_symbol_changes parameter.
11576 * sparc.cc (Target_sparc::relocate_section): Add
11577 reloc_symbol_changes parameter.
11578 * configure.ac: Call AM_CONDITIONAL for the default target.
11579 * configure: Rebuild.
11580 * testsuite/Makefile.am (TEST_AS): New variable.
11581 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11582 (check_DATA): Add split_i386 and split_x86_64 files.
11583 (SPLIT_DEFSYMS): Define.
11584 (split_i386_[1234n].o): New targets.
11585 (split_i386_[124]): New targets.
11586 (split_i386_[1234r].stdout): New targets.
11587 (split_x86_64_[1234n].o): New targets.
11588 (split_x86_64_[124]): New targets.
11589 (split_x86_64_[1234r].stdout): New targets.
11590 (MOSTLYCLEANFILES): Add new executables.
11591 * testsuite/split_i386.sh: New file.
11592 * testsuite/split_x86_64.sh: New file.
11593 * testsuite/split_i386_1.s: New file.
11594 * testsuite/split_i386_2.s: New file.
11595 * testsuite/split_i386_3.s: New file.
11596 * testsuite/split_i386_4.s: New file.
11597 * testsuite/split_i386_n.s: New file.
11598 * testsuite/split_x86_64_1.s: New file.
11599 * testsuite/split_x86_64_2.s: New file.
11600 * testsuite/split_x86_64_3.s: New file.
11601 * testsuite/split_x86_64_4.s: New file.
11602 * testsuite/split_x86_64_n.s: New file.
11603 * testsuite/testfile.cc (Target_test): Update relocation_section
11604 function.
11605 * testsuite/Makefile.in: Rebuild.
11606
11607 2009-10-06 Ian Lance Taylor <iant@google.com>
11608
11609 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11610 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11611 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11612 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11613 the address on ldo_addrs_.
11614 (Target_i386::Relocate::fix_up_ldo): New function.
11615
11616 2009-10-06 Rafael Espindola <espindola@google.com>
11617
11618 * plugin.cc (add_input_library): New.
11619 (Plugin::load): Add add_input_library to tv.
11620 (Plugin_manager::add_input_file): Add the is_lib argument.
11621 (add_input_file): Update call to Plugin_manager::add_input_file.
11622 (add_input_library): New.
11623 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11624
11625 2009-09-30 Doug Kwan <dougkwan@google.com>
11626
11627 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11628 symbol and call Symbol::may_need_copy_reloc to determine if
11629 a copy reloc is needed.
11630 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11631 nocopyreloc is given in command line.
11632 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11633 given in command line.
11634 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11635 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11636 of the removed Target_i386::may_need_copy_reloc.
11637 * options.h (copyreloc): New option with default value false.
11638 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11639 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11640 instead of the removed Target_powerpc::may_need_copy_reloc.
11641 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11642 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11643 instead of the removed Target_sparc::may_need_copy_reloc.
11644 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11645 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11646 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11647 instead of the removed Target_x86_64::may_need_copy_reloc.
11648
11649 2009-09-30 Ian Lance Taylor <iant@google.com>
11650
11651 * object.h (class Object): Remove target_ field, and target,
11652 sized_target, and set_target methods.
11653 (Object::sized_target): Remove.
11654 (class Sized_relobj): Update declarations. Remove sized_target.
11655 * object.cc (Sized_relobj::setup): Remove target parameter.
11656 Change all callers.
11657 (Input_objects::add_object): Don't do anything with the target.
11658 (make_elf_sized_object): Add punconfigured parameter. Change all
11659 callers. Set or test parameter target.
11660 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11661 Change all callers.
11662 * parameters.cc (Parameters::set_target): Change parameter type to
11663 be non-const.
11664 (Parameters::default_target): Remove.
11665 (set_parameters_target): Change parameter type to be non-const.
11666 (parameters_force_valid_target): New function.
11667 (parameters_clear_target): New function.
11668 * parameters.h (class Parameters): Update declarations. Remove
11669 default_target method. Add sized_target and clear_target
11670 methods. Change target_ to be non-const.
11671 (set_parameters_target): Update declaration.
11672 (parameters_force_valid_target): Declare.
11673 (parameters_clear_target): Declare.
11674 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11675 as NULL if we aren't searching.
11676 (Add_symbols::run): Don't check for compatible target.
11677 * fileread.cc (Input_file::open_binary): Call
11678 parameters_force_valid_target.
11679 * gold.cc (queue_middle_tasks): Likewise.
11680 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11681 set_target on object.
11682 * dynobj.h (class Sized_dynobj): Update declarations.
11683 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11684 make_elf_object returns NULL.
11685 (Archive::include_member): Don't check whether object target is
11686 compatible.
11687 * output.cc (Output_section::add_input_section): Get target from
11688 parameters.
11689 (Output_section::relax_input_section): Likewise.
11690 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11691 parameters.
11692 (Sized_relobj::do_scan_relocs): Likewise.
11693 (Sized_relobj::relocate_sections): Likewise.
11694 * resolve.cc (Symbol_table::resolve): Likewise.
11695 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11696 parameter. Change all callers.
11697 (Symbol_table::add_from_object): Get target from parameters.
11698 (Symbol_table::add_from_relobj): Don't check object target.
11699 (Symbol_table::add_from_dynobj): Likewise.
11700 (Symbol_table::define_special_symbol): Get target from
11701 parameters.
11702 * symtab.h (class Symbol_table): Update declaration.
11703 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11704 parameter. Change all callers. Clear parameter target.
11705 (Binary_test): Test target here.
11706 * testsuite/object_unittest.cc (gold_testsuite): Remove
11707 target_test_pointer parameter. Change all callers.
11708 (Object_test): Test target here.
11709
11710 2009-09-26 Ian Lance Taylor <iant@google.com>
11711
11712 * testsuite/initpri1.c: Don't try to use constructor priorities if
11713 compiling with gcc before 4.3.
11714
11715 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11716
11717 * testsuite/retain_symbols_file_test.sh (check_present): Change
11718 output file name to retain_symbols_file_test.stdout.
11719 (check_absent): Likewise.
11720
11721 2009-09-18 Craig Silverstein <csilvers@google.com>
11722
11723 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11724 * options.cc: Include <cerrno> and <fstream>.
11725 (General_options::finalize): Parse -retain-symbols-file tag.
11726 * options.h: New flag.
11727 (General_options): New method should_retain_symbol, new
11728 variable symbols_to_retain.
11729 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11730 should_retain_symbol map.
11731 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11732 * testsuite/Makefile.in: Regenerate.
11733 * testsuite/retain_symbols_file_test.sh: New file.
11734
11735 2009-09-18 Nick Clifton <nickc@redhat.com>
11736
11737 * po/es.po: Updated Spanish translation.
11738
11739 2009-09-17 Doug Kwan <dougkwan@google.com>
11740
11741 * debug.h (DEBUG_RELAXATION): New constant.
11742 (DEBUG_ALL): Add DEBUG_RELAXATION.
11743 (debug_string_to_enum): Add relaxation debug option.
11744 * layout.cc
11745 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11746 Layout::Relaxation_debug_check::read_sections,
11747 Layout::Relaxation_debug_check::read_sections): New method definitions.
11748 (Layout::Layout): Initialize data members
11749 record_output_section_data_from_scrips_,
11750 script_output_section_data_list_ and relaxation_debug_check_.
11751 (Layout::save_segments, Layout::restore_segments,
11752 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11753 Layout::relaxation_loop_body): New method definitions.
11754 (Layout::finalize): Support relaxation. Move section layout code to
11755 Layout::relaxation_loop_body.
11756 (Layout::set_asection_address_from_script): Move code for orphan
11757 section placement out.
11758 (Layout::place_orphan_sections_in_script): New method definition.
11759 * layout.h (Output_segment_headers, Output_file_header):
11760 New forward class declarations.
11761 (Layout::~Layout): Define.
11762 (Layout::new_output_section_data_from_script): New method definition.
11763 (Layout::place_orphan_sections_in_script): New method declaration.
11764 (Layout::Segment_states): New type declaration.
11765 (Layout::save_segments, Layout::restore_segments,
11766 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11767 Layout::relaxation_loop_body): New method declarations.
11768 (Layout::Output_section_data_list): New type declaration.
11769 (Layout::Relaxation_debug_check): New class definition.
11770 (Layout::record_output_section_data_from_script_,
11771 Layout::script_output_section_data_list_, Layout::segment_states_,
11772 Layout::relaxation_debug_check_): New data members.
11773 * output.cc: (Output_section_headers::do_size): New method definition.
11774 (Output_section_headers::Output_section_headers): Move size
11775 computation to Output_section_headers::do_size.
11776 (Output_segment_headers::do_size): New method definition.
11777 (Output_file_header::Output_file_header): Move size computation to
11778 Output_file_header::do_size and call it.
11779 (Output_file_header::do_size): New method definition.
11780 (Output_data_group::Output_data_group): Adjust call to
11781 Output_section_data.
11782 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11783 (Output_symtab_xindex::do_write): Add array bound check.
11784 (Output_section::Input_section::print_to_mapfile): Handle
11785 RELAXED_INPUT_SECTION_CODE.
11786 (Output_section::Output_section): Initialize data member checkpoint_.
11787 (Output_section::~Output_section): Delete checkpoint object pointed
11788 by checkpoint_.
11789 (Output_section::add_input_section): Always add an Input_section if
11790 relaxing.
11791 (Output_section::add_merge_input_section): Add assert.
11792 (Output_section::relax_input_section): New method definition.
11793 (Output_section::set_final_data_size): Set load address to zero for
11794 an unallocated section.
11795 (Output_section::do_address_and_file_offset_have_reset_values):
11796 New method definition.
11797 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11798 Handle relaxed input section.
11799 (Output_section::sort_attached_input_sections): Checkpoint input
11800 section list lazily.
11801 (Output_section::get_input_sections): Change type of input_sections to
11802 list of Simple_input_section pointers. Checkpoint input section list
11803 lazily. Also handle relaxed input sections.
11804 (Output_section::add_input_section_for_script): Take a reference to
11805 a Simple_input_section object instead of Relobj pointer and section
11806 index as parameter. Handle relaxed input sections.
11807 (Output_section::save_states, Output_section::restore_states): New
11808 method definitions.
11809 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11810 (Output_data::is_data_size_fixed): New method definition.
11811 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11812 if it is fixed.
11813 (Output_data::address_and_file_offset_have_reset_values): New method
11814 definition.
11815 (Output_data::do_address_and_file_offset_have_reset_values): New method
11816 definition.
11817 (Output_data::set_data_size): Check that data size is not fixed.
11818 (Output_data::fix_data_size): New method definition.
11819 (Output_data::is_data_size_fixed_): New data member.
11820 (Output_section_headers::set_final_data_size): New method definition.
11821 (Output_section_headers::do_size): New method declaration.
11822 (Output_segment_headers::set_final_data_size): New method definition.
11823 (Output_segment_headers::do_size): New method declaration.
11824 (Output_file_header::set_final_data_size)::New method definition.
11825 (Output_file_header::do_size)::New method declaration.
11826 (Output_section_data::Output_section_data): Add new parameter
11827 is_data_size_fixed and use it to fix data size.
11828 (Output_data_const::Output_data_const): Adjust call to base class
11829 constructor and fix data size.
11830 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11831 base class constructor and fix data size.
11832 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11833 base class constructor and fix data size.
11834 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11835 class constructor and fix data size.
11836 (Output_data_group::set_final_data_size): New method definition.
11837 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11838 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11839 class constructor and fix data size.
11840 (Output_relaxed_input_section): New class definition.
11841 (Output_section::Simple_input_section): New class definition.
11842 (Output_section::get_input_sections): Adjust parameter list.
11843 (Output_section::add_input_section_for_script): Same.
11844 (Output_section::save_states, Output_section::restore_states,
11845 Output_section::do_address_and_file_offset_have_reset_values,
11846 (Output_section::Input_section::Input_section): Handle
11847 RELAXED_INPUT_SECTION_CODE. Add new overload for
11848 Output_relaxed_input_section.
11849 (Output_section::Input_section::is_input_section,
11850 Output_section::Input_section::set_output_section): Handle relaxed
11851 input section.
11852 (Output_section::Input_section::is_relaxed_input_section,
11853 Output_section::Input_section::output_section_data,
11854 Output_section::Input_section::relaxed_input_section): New method
11855 definitions.
11856 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11857 value.
11858 (Output_section::Input_section::u1_): Update comments.
11859 (Output_section::Input_section::u2_): Add new union member poris.
11860 (Output_section::Checkpoint_output_section): New classs definition.
11861 (Output_section::relax_input_section): New method declaration.
11862 (Output_section::checkpoint_): New data member.
11863 (Output_segment): Update comments.
11864 (Output_segment::Output_segment): Un-privatize copy constructor.
11865 (Output_segment::operator=): Un-privatize.
11866 * script-sections.cc (Output_section_element::Input_section_list):
11867 Change element type to Output_section::Simple_input_section.
11868 (Output_section_element_dot_assignment::set_section_addresses):
11869 Register output section data for relaxation clean up.
11870 (Output_data_exression::Output_data_expression): Adjust call to base
11871 constructor to fix data size.
11872 (Output_section_element_data::set_section_addresses): Register
11873 Output_data_expression object for relaxation clean up.
11874 (struct Input_section_info): Replace Relobj pointer and section index
11875 pair with Output_section::Simple_input_section and Convert struct to a
11876 class.
11877 (Input_section_sorter::operator()): Adjust access to
11878 Input_section_info data member to use accessors.
11879 (Output_section_element_input::set_section_addresses): Use layout
11880 parameter. Adjust code to use Output_section::Simple_input_section
11881 and Input_secction_info classes. Register filler for relaxation
11882 clean up.
11883 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11884 and section index pair with Output_section::Simple_input_section
11885 class. Adjust code accordingly.
11886 (Phdrs_element::release_segment): New method definition.
11887 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11888 segment list.
11889 (Script_sections::release_segments): New method definition.
11890 * gold/script-sections.h (Script_sections::release_segments): New
11891 method declaration.
11892 * gold/target.h (Target::may_relax, Target::relax,
11893 Target::do_may_relax, Target::do_relax): New method definitions.
11894
11895 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11896
11897 * arm.cc (has_signed_unsigned_overflow): New function.
11898 (Arm_relocate_functions::abs8): New function.
11899 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11900 (Target_arm::Scan::global): Likewise.
11901 (Target_arm::relocate::relocate): Likewise.
11902 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11903 Likewise.
11904
11905 2009-09-16 Cary Coutant <ccoutant@google.com>
11906
11907 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11908 * testsuite/Makefile.in: Regenerate.
11909
11910 2009-09-11 Nick Clifton <nickc@redhat.com>
11911
11912 * po/gold.pot: Updated by the Translation project.
11913
11914 2009-09-08 Cary Coutant <ccoutant@google.com>
11915
11916 * output.cc (Output_file::open): Add execute permission to empty file.
11917 * testsuite/Makefile.am (permission_test): New test.
11918 * testsuite/Makefile.in: Regenerate.
11919
11920 2009-09-02 Ian Lance Taylor <iant@google.com>
11921
11922 * output.cc (Output_file::resize): Call map_no_anonymous rather
11923 than map.
11924
11925 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11926
11927 * gold.cc: Include "incremental.h".
11928 (queue_initial_tasks): Call Incremental_checker methods.
11929 * incremental.cc: Include "output.h".
11930 (Incremental_checker::can_incrementally_link_output_file): New
11931 method.
11932 * incremental.h (Incremental_checker): New class.
11933
11934 * output.cc (Output_file::open_for_modification): New method.
11935 (Output_file::map_anonymous): Changed return type to bool. Record
11936 map in base_ field.
11937 (Output_file::map_no_anonymous): New method, broken out of map.
11938 (Output_file::map): Use map_no_anonymous and map_anonymous.
11939 * output.h (class Output_file): Update declarations.
11940
11941 2009-08-24 Cary Coutant <ccoutant@google.com>
11942
11943 * options.h (Command_line::Pre_options): New class.
11944 (Command_line::pre_options): New member.
11945 * options.cc (gold::options::ready_to_register): New variable.
11946 (One_option::register_option): Do nothing if not registering options.
11947 Assert if same short option registered twice.
11948 (General_options::General_options): Turn off option registration when
11949 done constructing.
11950 (Command_line::Pre_options::Pre_options): New constructor.
11951
11952 2009-08-24 Cary Coutant <ccoutant@google.com>
11953
11954 * options.h (General_options::no_keep_memory): Remove incorrect
11955 short option.
11956
11957 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11958
11959 * Makefile.am (am__skiplex, am__skipyacc): New.
11960 * Makefile.in: Regenerate.
11961
11962 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11963
11964 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11965 (INCLUDES): ... this.
11966 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11967 (AM_CPPFLAGS): Renamed from ...
11968 (INCLUDE): ... this.
11969 * Makefile.in, testsuite/Makefile.in: Regenerate.
11970
11971 * Makefile.in: Regenerate.
11972 * aclocal.m4: Likewise.
11973 * config.in: Likewise.
11974 * configure: Likewise.
11975 * testsuite/Makefile.in: Likewise.
11976
11977 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11978 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11979 * Makefile.in: Regenerate.
11980 * testsuite/Makefile.in: Regenerate.
11981
11982 2009-08-19 Cary Coutant <ccoutant@google.com>
11983
11984 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11985 symbols in shared libraries overridden by hidden or internal symbols
11986 in the main program.
11987
11988 2009-08-19 Chris Demetriou <cgd@google.com>
11989
11990 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11991 checking source file names in error messages.
11992
11993 2009-08-18 Doug Kwan <dougkwan@google.com>
11994
11995 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11996 an elcpp::Ehdr as parameter. Adjust call to set_target.
11997 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11998 an elfcpp::Ehdr as parameter.
11999 * object.cc (Object::set_target): Remove the version that looks up
12000 a target and sets it.
12001 (Sized_relobj::setup): Take a Target object instead of
12002 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12003 (make_elf_sized_object): Find target and ask target to
12004 make an ELF object.
12005 * object.h: (Object::set_target): Remove the version that looks up
12006 a target and sets it.
12007 (Sized_relobj::setup): Take a Target object instead of
12008 an elfcpp:Ehdr as parameter.
12009 * target.cc: Include dynobj.h.
12010 (Target::do_make_elf_object_implementation): New.
12011 (Target::do_make_elf_object): New.
12012 * target.h (Target::make_elf_object): New template declaration.
12013 (Target::do_make_elf_object): New method declarations.
12014 (Target::do_make_elf_object_implementation): New template declaration.
12015
12016 2009-08-14 Ian Lance Taylor <iant@google.com>
12017
12018 * gold.h (FUNCTION_NAME): Define.
12019 (gold_unreachable): Use FUNCTION_NAME.
12020
12021 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12022
12023 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12024 symbol in the --keep-unique list is not found.
12025
12026 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12027
12028 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12029 been maked as --keep-unique.
12030 (Icf::unfold_section): New function.
12031 * icf.h (Icf::unfold_section): New function.
12032 * options.h (General_options::keep_unique): New option.
12033 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12034 * testsuite/Makefile.in: Regenerate.
12035 * testsuite/icf_keep_unique_test.sh: New file.
12036 * testsuite/icf_keep_unique_test.cc: New file.
12037
12038 2009-08-12 Cary Coutant <ccoutant@google.com>
12039
12040 PR 10471
12041 * resolve.cc (Symbol_table::resolve): Check for references from
12042 dynamic objects to hidden and internal symbols.
12043 * testsuite/Makefile.am (hidden_test.sh): New test.
12044 * testsuite/Makefile.in: Regenerate.
12045 * testsuite/hidden_test.sh: New script.
12046 * testsuite/hidden_test_1.c: New test source.
12047 * testsuite/hidden_test_main.c: New test source.
12048
12049 2009-08-11 Doug Kwan <dougkwan@google.com>
12050
12051 * arm.cc: Update comments.
12052 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12053 segment to locate the .ARM.exidx section if present.
12054
12055 2009-08-09 Doug Kwan <dougkwan@google.com>
12056
12057 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12058 patch.
12059
12060 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12061 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12062 compiler warnings.
12063
12064 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12065
12066 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12067 valid tls_segment only for non-debug-section relocations.
12068 * testsuite/Makefile.am: Add gc_tls_test.
12069 * testsuite/Makefile.in: Regenerate.
12070 * testsuite/gc_tls_test.cc: New file.
12071 * testsuite/gc_tls_test.sh: New file.
12072
12073 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12074
12075 * icf.cc: New file.
12076 * icf.h: New file.
12077 * Makefile.am (CCFILES): Add icf.cc.
12078 (HFILES): Add icf.h
12079 * Makefile.in: Regenerate.
12080 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12081 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12082 section, symbol and addend information for the relocs.
12083 * gold.cc (queue_middle_tasks): Call identical code folding.
12084 * gold.h: Add defines for multimap.
12085 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12086 to the call of finalize_local_symbols.
12087 * main.cc (main): Create object of class Icf.
12088 * object.cc (Sized_relobj::do_layout): Allow this function to be
12089 called twice during icf.
12090 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12091 to sections marked as identical by icf.
12092 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12093 when available.
12094 (Sized_relobj::do_section_entsize): New function.
12095 * object.h (Object::section_entsize): New function.
12096 (Object::do_section_entsize): New pure virtual function.
12097 (Relobj::finalize_local_symbols): Add new parameter.
12098 (Relobj::do_section_entsize): New function.
12099 * options.h (General_options::icf): New option.
12100 (General_options::icf_iterations): New option.
12101 (General_options::print_icf_sections): New option.
12102 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12103 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12104 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12105 icf.
12106 * symtab.cc (Symbol_table::is_section_folded): New function.
12107 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12108 to sections marked as identical by icf.
12109 * symtab.h (Symbol_table::set_icf): New function.
12110 (Symbol_table::icf): New function.
12111 (Symbol_table::is_section_folded): New function.
12112 (Symbol_table::icf_): New data member.
12113 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12114 * testsuite/Makefile.am: Add commands to build icf_test.
12115 * testsuite/Makefile.in: Regenerate.
12116 * testsuite/icf_test.sh: New file.
12117 * testsuite/icf_test.cc: New file.
12118
12119 2009-07-24 Chris Demetriou <cgd@google.com>
12120
12121 * layout.cc (is_compressible_debug_section): Fix incorrect
12122 comment about compressed section names.
12123
12124 2009-07-20 Ian Lance Taylor <ian@airs.com>
12125
12126 PR 10419
12127 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12128
12129 2009-07-16 Ian Lance Taylor <iant@google.com>
12130
12131 PR 10400
12132 * layout.h: #include <map>.
12133 (class Kept_section): Change from struct to class. Add accessors
12134 and setters. Add section size to Comdat_group mapping. Change
12135 Comdat_group to std::map. Add is_comdat_ field. Add
12136 linkonce_size field in union.
12137 (class Layout): Update declaration of find_or_add_kept_section.
12138 Don't declare find_kept_object.
12139 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12140 parameter. Add object, shndx, is_comdat, and is_group_name
12141 parameters. Change all callers. Adjust for new Kept_section.
12142 (Layout::find_kept_object): Remove.
12143 * object.cc (Sized_relobj::include_section_group): Update use of
12144 Kept_section. Rename secnum to shndx. Only record
12145 Kept_comdat_section if sections are the same size.
12146 (Sized_relobj::include_linkonce_section): Update use of
12147 Kept_section. Only record Kept_comdat_section if sections are the
12148 same size. Set size of linkonce section.
12149 (Sized_relobj::map_to_kept_section): Update call to
12150 get_kept_comdat_section.
12151 * object.h (class Sized_relobj): Rename fields in
12152 Kept_comdat_section to drop trailing underscores; change object
12153 field to Relobj*. Change Kept_comdat_section_table to store
12154 struct rather than pointer.
12155 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12156 Add kept_object and kept_shndx parameters. Change all callers.
12157 (Sized_relobj::get_kept_comdat_section): Change return type to
12158 bool. Add kept_object and kept_shndx parameters. Change all
12159 callers.
12160 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12161 Layout::find_or_add_kept_section.
12162
12163 2009-07-09 Ian Lance Taylor <iant@google.com>
12164
12165 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12166 Reserve space in the hash table.
12167
12168 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12169
12170 * fileread.cc (File_read::get_mtime): New method.
12171 * fileread.h (Timespec): New structure.
12172 (File_read::get_mtime): New method.
12173 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12174 Renamed from timestamp_nsec.
12175 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12176 Elf_Xword.
12177 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12178 timestamp_nsec.
12179 (Incremental_inputs::report_archive): Save mtime; style fix.
12180 (Incremental_inputs::report_obejct): Save mtime; style fix.
12181 (Incremental_inputs::report_script): Save mtime; style fix.
12182 (Incremental_inputs::finalize_inputs): Style fix.
12183 (Incremental_inputs::finalize): Style fix.
12184 (Incremental_inputs::create_input_section_data): Store inputs
12185 mtime.
12186 * incremental.h (Incremental_inputs::report_script): Add mtime
12187 argument.
12188 (Incremental_inputs::Input_info::Input_info): Intialize only one
12189 union member.
12190 (Incremental_inputs::Input_info::archive): Move to nameless
12191 union.
12192 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12193 (Incremental_inputs::Input_info::script): Move to nameless union.
12194 (Incremental_inputs::mtime): New field.
12195 * script.cc (read_input_script): Pass file mtime to
12196 Incremental_input.
12197 * script.h (Script_info::inputs): Style fix.
12198
12199 2009-07-01 Ian Lance Taylor <ian@airs.com>
12200
12201 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12202 instead of 32.
12203
12204 2009-06-24 Ian Lance Taylor <iant@google.com>
12205
12206 PR 10156
12207 * layout.cc (Layout::choose_output_section): If we find an
12208 existing section, update the flags.
12209 (Layout::create_notes): New function, broken out of
12210 Layout::finalize.
12211 (Layout::finalize): Don't create note sections.
12212 (Layout::create_note): Don't crash if linker script discards
12213 section.
12214 (Layout::create_gold_note): Likewise.
12215 (Layout::create_build_id): Likewise. Don't set
12216 after_input_sections on the section.
12217 (Layout::create_executable_stack_info): Remove target parameter.
12218 Change caller.
12219 * layout.h (class Layout): Declare create_notes. Update
12220 declaration of create_executable_stack_info.
12221 * gold.cc (queue_middle_tasks): Call create_notes.
12222 * output.cc (Output_section::update_flags_for_input_section): Move
12223 here from output.h. If SHF_ALLOC flag is newly set, mark address
12224 invalid.
12225 * output.h (Output_data::mark_address_invalid): New function.
12226 (class Output_section): Only declare, not define,
12227 update_flags_for_input_section. Remove set_flags.
12228
12229 2009-06-24 Ian Lance Taylor <iant@google.com>
12230
12231 * script-sections.cc (Output_section_definition::
12232 set_section_addresses): Rename shadowing local load_address to
12233 laddr.
12234
12235 2009-06-24 Ian Lance Taylor <iant@google.com>
12236
12237 PR 10244
12238 * reloc.cc (relocate_sections): Skip empty relocation sections.
12239
12240 2009-06-23 Ian Lance Taylor <iant@google.com>
12241
12242 PR 10156
12243 * layout.cc (Layout::create_note): Use choose_output_section
12244 rather than make_output_section.
12245
12246 2009-06-23 Ian Lance Taylor <iant@google.com>
12247
12248 PR 10237
12249 * options.cc (General_options::parse_V): Set printed_version_.
12250 (General_options::General_options): Initialize printed_version_.
12251 * options.h (class General_options): Add printed_version_ field.
12252 * gold.cc (queue_initial_tasks): If there are no input files,
12253 don't give a fatal error if we printed the version information.
12254 (queue_middle_tasks): If using -r with a shared object, give a
12255 fatal error rather than an ordinary error.
12256
12257 2009-06-23 Ian Lance Taylor <iant@google.com>
12258
12259 PR 10219
12260 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12261 (Layout::make_output_section): Set have_stabstr_section_ if we see
12262 a .stab*str section.
12263 (Layout::finalize): Call link_stabs_sections.
12264 (Layout::link_stabs_sections): New file.
12265 * layout.h (class Layout): Add have_stabstr_section_ field.
12266 Declare link_stabs_sections.
12267
12268 2009-06-23 Doug Kwan <dougkwan@google.com>
12269
12270 * Makefile.am (libgold_a_LIBADD): New.
12271 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12272 * Makefile.in: Regenerate.
12273 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12274 * configure: Regenerate.
12275 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12276 * fileread.cc: Include sys/state.h
12277 * gold.h: Declare memmem and strndup if found missing.
12278 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12279
12280 2009-06-23 Ian Lance Taylor <iant@google.com>
12281
12282 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12283 * configure: Rebuild.
12284
12285 2009-06-23 Ian Lance Taylor <iant@google.com>
12286
12287 PR 10147
12288 * object.cc (Object::section_contents): Don't try to get a view if
12289 the section has length zero.
12290 (Object::handle_gnu_warning_section): If the section is empty, use
12291 the name of the section as the warning.
12292
12293 2009-06-23 Ian Lance Taylor <iant@google.com>
12294
12295 PR 10133
12296 * stringpool.h (class Stringpool_template): Add optimize_ field.
12297 (Stringpool_template::set_optimize): New function.
12298 * stringpool.cc (Stringpool_template::Stringpool_template):
12299 Initialize optimize_ field.
12300 (Stringpool_template::set_string_offsets): Test local optimize
12301 fild rather than parameter.
12302 * layout.cc (Layout::Layout): Call set_optimize on the section
12303 name stringpool.
12304
12305 2009-06-22 Ian Lance Taylor <iant@google.com>
12306
12307 PR 10030
12308 * yyscript.y: Parse TARGET.
12309 * script.cc (script_set_target): New function.
12310 * script-c.h (script_set_target): Declare.
12311 * options.cc (General_options::string_to_object_format): Rename
12312 from string_to_object_format in anonymous namespace. Change
12313 callers.
12314 * options.h (class General_options): Declare
12315 string_to_object_format.
12316
12317 2009-06-22 Ian Lance Taylor <iant@google.com>
12318
12319 * script-sections.cc (Script_sections::create_segments): Don't put
12320 program headers in a PT_LOAD segment if -n or -N.
12321
12322 2009-06-22 Ian Lance Taylor <iant@google.com>
12323
12324 PR 10141
12325 * options.h (class General_options): Add -z lazy and -z now. Sort
12326 -z options into alphabetical order.
12327 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12328
12329 2009-06-21 Ian Lance Taylor <iant@google.com>
12330
12331 * layout.cc (Layout::make_output_section): Call
12332 Target::new_output_section.
12333 (Layout::attach_allocated_section_to_segment): Put large section
12334 sections in a separate load segment with the large segment flag
12335 set.
12336 (Layout::segment_precedes): Sort large data segments after other
12337 load segments.
12338 (align_file_offset): New static function.
12339 (Layout::set_segment_offsets): Use align_file_offset.
12340 * output.h (class Output_section): Add is_small_section_ and
12341 is_large_section_ fields.
12342 (Output_section::is_small_section): New function.
12343 (Output_section::set_is_small_section): New function.
12344 (Output_section::is_large_section): New function.
12345 (Output_section::set_is_large_section): New function.
12346 (Output_section::is_large_data_section): New function.
12347 (class Output_segment): Add is_large_data_segment_ field.
12348 (Output_segment::is_large_data_segment): New function.
12349 (Output_segment::set_is_large_data_segment): New function.
12350 * output.cc (Output_section::Output_section): Initialize new
12351 fields.
12352 (Output_segment::Output_segment): Likewise.
12353 (Output_segment::add_output_section): Add assertion that large
12354 data sections always go in large data segments. Force small data
12355 sections to the end of the list of data sections. Force small BSS
12356 sections to the start of the list of BSS sections. For large BSS
12357 sections to the end of the list of BSS sections.
12358 * symtab.h (class Symbol): Declare is_common_shndx.
12359 (Symbol::is_defined): Check Symbol::is_common_shndx.
12360 (Symbol::is_common): Likewise.
12361 (class Symbol_table): Define enum Commons_section_type. Update
12362 declarations. Add small_commons_ and large_commons_ fields.
12363 * symtab.cc (Symbol::is_common_shndx): New function.
12364 (Symbol_table::Symbol_table): Initialize new fields.
12365 (Symbol_table::add_from_object): Put small and large common
12366 symbols in the right list.
12367 (Symbol_table::sized_finalized_symbol): Check
12368 Symbol::is_common_shndx.
12369 (Symbol_table::sized_write_globals): Likewise.
12370 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12371 common symbol lists. Don't call do_allocate_commons_list if the
12372 list is empty.
12373 (Symbol_table::do_allocate_commons_list): Remove is_tls
12374 parameter. Add comons_section_type parameter. Change all
12375 callers. Handle small and large common symbols.
12376 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12377 Symbol::is_common_shndx.
12378 * resolve.cc (symbol_to_bits): Likewise.
12379 * target.h (Target::small_common_shndx): New function.
12380 (Target::small_common_section_flags): New function.
12381 (Target::large_common_shndx): New function.
12382 (Target::large_common_section_flags): New function.
12383 (Target::new_output_section): New function.
12384 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12385 small_common_section_flags, and large_common_section_flags
12386 fields.
12387 (Target::do_new_output_section): New virtual function.
12388 * arm.cc (Target_arm::arm_info): Initialize new fields.
12389 * i386.cc (Target_i386::i386_info): Likewise.
12390 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12391 Likewise.
12392 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12393 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12394 (Target_x86_64::do_new_output_section): New function.
12395 * configure.ac: Define conditional MCMODEL_MEDIUM.
12396 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12397 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12398 (large_LDFLAGS): Define.
12399 * testsuite/large.c: New file.
12400 * testsuite/testfile.cc (Target_test::test_target_info):
12401 Initialize new fields.
12402 * configure, testsuite/Makefile.in: Rebuild.
12403
12404 2009-06-05 Doug Kwan <dougkwan@google.com>
12405
12406 * Makefile.am (CCFILES): Add target.cc.
12407 * Makefile.in: Regenerate.
12408 * i386.cc (class Target_i386): Define new virtual method to
12409 override do_is_local_label_name in parent.
12410 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12411 local symbols if --discard-locals or -X is given.
12412 * options.h (class General_options): Declare new options
12413 '--discard-locals' and '-X' for discarding locals.
12414 * target.h (class Target): Define new methods is_local_label_name.
12415 Declare new virtual method do_is_local_label_name.
12416 * target.cc: New file.
12417 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12418 (check_SCRIPTS): Add discard_locals_test.sh.
12419 (check_DATA): Add discard_local_tests.syms.
12420 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12421 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12422 * testsuite/Makefile.in: Regenerate.
12423 * testsuite/discard_locals_test.c: New file.
12424 * testsuite/discard_locals_test.sh: Same.
12425
12426 2009-06-05 Doug Kwan <dougkwan@google.com>
12427
12428 * object.cc (Sized_relobj::Sized_relobj): Initialize
12429 discarded_eh_frame_shndx_ to -1U.
12430 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12431 section.
12432 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12433 a discarded .eh_frame section.
12434 (Sized_relobj::do_finalize_local_symbols): Ditto.
12435 * object.h (class Sized_relobj): Declare new member
12436 discarded_eh_frame_shndx_.
12437 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12438 (local_labels_test.o, local_labels_test): New rules.
12439 * testsuite/Makefile.in: Regenerate.
12440
12441 2009-06-04 Doug Kwan <dougkwan@google.com>
12442
12443 * layout.cc (Layout::section_name_mapping): Add mapping for
12444 special ARM sections.
12445
12446 2009-06-03 Doug Kwan <dougkwan@google.com>
12447
12448 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12449 (utils::has_overflow): Same.
12450
12451 2009-06-03 Ian Lance Taylor <iant@google.com>
12452
12453 * layout.cc (Layout::section_name_mapping): New array, replacing
12454 Layout::linkonce_mapping.
12455 (Layout::section_name_mapping_count): New variable, replacing
12456 Layout::linkonce_mapping_count.
12457 (Layout::linkonce_output_name): Remove.
12458 (Layout::output_section_name): Rewrite.
12459 * layout.h (class Layout): Rename Linkonce_mapping to
12460 Section_name_mapping, linkonce_mapping to section_name_mapping,
12461 linkonce_mapping_count to section_name_mapping_count. Don't
12462 declare linkonce_output_name.
12463
12464 2009-06-03 Doug Kwan <dougkwan@google.com>
12465
12466 * gold/arm.cc (namespace utils): New.
12467 (Target_arm::reloc_is_non_pic): Define new method.
12468 (class Arm_relocate_functions): New.
12469 (Target_arm::Relocate::relocate): Handle relocation types used by
12470 Android.
12471
12472 2009-06-03 Ian Lance Taylor <iant@google.com>
12473
12474 * arm.cc (Target_arm::scan::global): Use || instead of |.
12475
12476 2009-06-02 Doug Kwan <dougkwan@google.com>
12477
12478 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12479 issued_non_pic_error_.
12480 (class Target_arm::Scan): Declare new method check_non_pic.
12481 Define new method symbol_needs_plt_entry.
12482 Declare new data member issued_non_pic_error_.
12483 (class Target_arm::Relocate): Declare new method
12484 should_apply_static_reloc.
12485 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12486 (Target_arm::Scan::check_non_pic): Define new method.
12487 (Target_arm::Scan::local): Handle a small subset of reloc types used
12488 by Android.
12489 (Target_arm::Scan::local): Same.
12490 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12491
12492 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12493
12494 * incremental.cc (Incremental_inputs::report_command_line): Filter
12495 out --incremental-* options.
12496
12497 2009-05-29 Doug Kwan <dougkwan@google.com>
12498
12499 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12500 template class.
12501 (class Target_arm): Update comment.
12502 (Target_arm::Target_arm): Initialize new data members GOT_,
12503 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12504 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12505 and Target_arm::rel_dyn_section.
12506 Declare new_enum Target_arm::Got_type.
12507 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12508 and DYNBSS_.
12509 Update commments for member do_dynsym_value.
12510 (Target_arm::got_size, Target_arm::plt_section,
12511 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12512 new methods inside class defintion.
12513 (Target_arm::got_section): Define new method.
12514 (Target_arm::rel_dyn_section): Same.
12515 (Output_data_plt_arm): New template class.
12516 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12517 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12518 (Output_data_plt_arm::add_entry): Same.
12519 (Output_data_plt_arm::first_plt_entry): Define new
12520 static data member for PLT instruction template.
12521 (Output_data_plt_arm::plt_entry): Same.
12522 (Output_data_plt_arm::do_write): Define new method.
12523 (Target_arm::make_plt_entry): Same.
12524 (Target_arm::do_finalize_sections): Same.
12525 (Target_arm::do_dynsym_value): Same.
12526
12527 2009-05-28 Doug Kwan <dougkwan@google.com>
12528
12529 * Makefile.am (TARGETSOURCES): Add arm.cc.
12530 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12531 * Makefile.in: Regenerate.
12532 * arm.cc: New file.
12533 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12534
12535 2009-05-26 Doug Kwan <dougkwan@google.com>
12536
12537 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12538 (General_options::check_excluded_libs): Strip off directories in
12539 archive name before matching like GNU ld does.
12540 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12541 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12542 (exclude_libs_test_LDFLAGS): Add linker option
12543 -Wl,--exclude-libs,libexclude_libs_test_3
12544 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12545 an explicit archive without using -l.
12546 (alt/libexclude_libs_test_3.a): New make rule.
12547 * testsuite/Makefile.in: Regenerate.
12548 * testsuite/exclude_libs_test.c : Declare lib3_default().
12549 (main): Call it.
12550 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12551 * exclude_libs_test_3.c: New file.
12552
12553 2009-05-26 Nick Clifton <nickc@redhat.com>
12554
12555 * po/id.po: New Indonesian translation.
12556 * po/gold.pot: Updated template file.
12557
12558 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12559
12560 * testsuite/Makefile.am: Add -ffunction-sections to compile
12561 gc_comdat_test files. Add -Wl,--gc-sections to build
12562 gc_comdat_test.
12563 * testsuite/Makefile.in: Regenerate.
12564 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12565
12566 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12567
12568 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12569 kept comdat section was garbage collected.
12570 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12571 * testsuite/Makefile.in: Regenerate.
12572 * testsuite/gc_comdat_test.sh: New file.
12573 * testsuite/gc_comdat_test_1.cc: New file.
12574 * testsuite/gc_comdat_test_2.cc: New file.
12575
12576 2009-05-19 Doug Kwan <dougkwan@google.com>
12577
12578 * archive.cc (Archive::Archive): Move constructor from archive.h
12579 to here. Initialize no_export_.
12580 (Archive::get_elf_object_for_member): Set no_export flag of object.
12581 * archive.h (Archive::Archive): Move constructor body to
12582 archive.cc.
12583 (Archive::no_export): New method.
12584 (Archive::no_export_): New field.
12585 * object.h (Object::Object): Initialize no_export_ to false.
12586 (Object::no_export, Object::set_no_export): New methods.
12587 (Object::no_export_): New field.
12588 * options.cc (General_options::parse_exclude_libs): New method.
12589 (General_options::check_excluded_libs) Same.
12590 * options.h (exclude_libs): New option.
12591 (General_options::check_excluded_libs): New method declaration.
12592 (General_options::excluded_libs_): New field.
12593 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12594 default or protected visibility if an object has no-export flag set.
12595 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12596 (check_SCRIPTS): Add exclude_libs_test.sh.
12597 (check_DATA): Add exclude_libs_test.syms.
12598 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12599 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12600 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12601 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12602 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12603 libexclude_libs_test_2.a): New rules.
12604 * testsuite/Makefile.in: Regenerate.
12605 * testsuite/exclude_libs_test.c: New file.
12606 * testsuite/exclude_libs_test.sh: Ditto.
12607 * testsuite/exclude_libs_test_1.c: Ditto.
12608 * testsuite/exclude_libs_test_2.c: Ditto.
12609
12610 2009-05-15 Ian Lance Taylor <iant@google.com>
12611
12612 * configure.ac: Check for declarations for cases where libiberty.h
12613 checks HAVE_DECL_xxx.
12614 * configure, config.in: Rebuild.
12615
12616 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12617
12618 * gold.h (Incremental_argument_list): Remove (invalid) forward
12619 declaration.
12620 * incremental.cc (Incremental_inputs::report_achive): New method.
12621 (Incremental_inputs::report_object): New method.
12622 (Incremental_inputs::report_script): New method.
12623 (Incremental_inputs::finalize_inputs): New method.
12624 (Incremental_inputs::finalize): Call finalize_inputs().
12625 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12626 Create inputs entries.
12627 * incremental.h (Incremental_input_type): New enum.
12628 (Incremental_inputs::Incremental_input): Initialize new fields.
12629 (Incremental_inputs::report_inputs): New method.
12630 (Incremental_inputs::report_achive): New method.
12631 (Incremental_inputs::report_object): New method.
12632 (Incremental_inputs::report_script): New method.
12633 (Incremental_inputs::finalize_inputs): New method.
12634 (Incremental_inputs::Input_info): New struct.
12635 (Incremental_inputs::Input_info_map): New typedef.
12636 (Incremental_inputs::lock_): New field.
12637 (Incremental_inputs::Inputs_): New field.
12638 (Incremental_inputs::Inputs_map): New field.
12639 * main.cc (main): Call Incremental_input::report_inputs.
12640 * options.h (Input_argument_list): Typedef moved from
12641 Input_arguments.
12642 (Input_file_group::Files): Remove, use ::Input_argument_list.
12643 (Input_file_group::Input_argument_list): Remove, use
12644 ::Input_argument_list.
12645 * plugin.cc (Plugin_manager::add_input_file): Add error in
12646 incremental build.
12647 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12648 functions.
12649 * script.cc (read_input_script): Call
12650 Incremental_input::report_script.
12651 * script.h (Script_info): New class.
12652
12653 2009-04-27 Ian Lance Taylor <iant@google.com>
12654
12655 * x86_64.cc (do_adjust_output_section): Set entsize to
12656 plt_entry_size.
12657
12658 2009-04-23 Elliott Hughes <enh@google.com>
12659
12660 * output.cc (Output_file::close): After short writes, continue
12661 writing from the correct offset in the buffer being written.
12662
12663 2009-04-23 Chris Demetriou <cgd@google.com>
12664
12665 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12666 * configure: Regenerate.
12667 * config.in: Regenerate.
12668 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12669 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12670
12671 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12672
12673 * incremental.cc (Incremental_inputs_header_data): Renamed from
12674 Incremental_input_header_data.
12675 (Incremental_inputs_header_data::data_size): New field.
12676 (Incremental_inputs_header_data::put_input_file_count): Renamed
12677 from input_file_count.
12678 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12679 from command_line_offset.
12680 (Incremental_inputs_header_data::put_reserved): Renamed from
12681 put_reserved.
12682 (Incremental_inputs_entry_data): Renamed from
12683 Incremental_input_entry_data.
12684 (Incremental_inputs_entry_data::data_size): New field.
12685 (Incremental_inputs::report_command_line): New method.
12686 (Incremental_inputs::finalize): New method.
12687 (Incremental_inputs::create_incremental_inputs_data): New method.
12688 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12689 * incremental.h: New file.
12690 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12691 (Layout::finalize): Create incremental inputs section in
12692 incremental builds.
12693 (Layout::create_incremental_info_sections): New method.
12694 * layout.h (Layout::incremental_inputs): New method.
12695 (Layout::create_incremental_info_sections): New method.
12696 (Layout::incremental_inputs_): New field.
12697 * main.cc (main): Notify Incremental_input of the command line.
12698
12699 2009-04-01 Ian Lance Taylor <iant@google.com>
12700 Mikolaj Zalewski <mikolajz@google.com>
12701
12702 * gold.h (reserve_unordered_map): Define, three versions, one for
12703 each version of Unordered_map.
12704 * layout.cc (Layout::Layout): Remove options parameter. Add
12705 number_of_input_files parameter. Don't initialize options_.
12706 Initialize number_of_input_files_ and resized_signatures_. Move
12707 sections_are_attached_.
12708 (Layout::layout_group): Reserve space for group_signatures_.
12709 (Layout::find_or_add_kept_section): Change name parameter to be a
12710 reference. Resize signatures_ map when it gets large enough.
12711 (Layout::layout_eh_frame): Use parameters->options() instead of
12712 this->options_.
12713 (Layout::make_output_section): Likewise.
12714 (Layout::attach_allocated_section_to_segment): Likewise.
12715 (Layout::finalize, Layout::create_executable_stack): Likewise.
12716 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12717 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12718 * layout.h (class Layout): Update declarations. Remove options_
12719 field. Add number_of_input_files_ and resized_signatures_
12720 fields. Move sections_are_attached_ field.
12721 * main.cc (main): Pass number of input files to Layout
12722 constructor. Don't pass options.
12723
12724 2009-03-30 Ian Lance Taylor <iant@google.com>
12725
12726 * ffsll.c (ffsll): Correct implementation.
12727
12728 2009-03-27 Ian Lance Taylor <iant@google.com>
12729
12730 * ffsll.c: New file.
12731 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12732 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12733 * ftruncate.c (ftruncate): Declare before definition.
12734 * mremap.c (mremap): Likewise.
12735 * pread.c (pread): Likewise.
12736 * configure, Makefile.in, config.in: Rebuild.
12737
12738 * mremap.c: New file.
12739 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12740 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12741 (mremap): Declare if HAVE_MREMAP is not defined.
12742 * configure, Makefile.in, config.in: Rebuild.
12743
12744 2009-03-27 Cary Coutant <ccoutant@google.com>
12745
12746 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12747 position independent.
12748 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12749 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12750
12751 2009-03-24 Cary Coutant <ccoutant@google.com>
12752
12753 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12754 an executable.
12755 (needs_dynamic_reloc): Likewise.
12756
12757 2009-03-24 Ian Lance Taylor <iant@google.com>
12758
12759 * yyscript.y (file_cmd): Recognize EXTERN.
12760 (extern_name_list, extern_name_list_body): New nonterminals.
12761 * script.cc (script_add_extern): Define.
12762 * script-c.h (script_add_extern): Declare.
12763
12764 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12765
12766 * object.cc (is_elf_object): Define.
12767 * object.h (is_elf_object): Declare.
12768 * archive.cc (Archive::get_elf_object_for_member): Call
12769 is_elf_object.
12770 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12771
12772 2009-03-24 Elliott Hughes <enh@google.com>
12773
12774 * output.cc (Output_file::map_anonymous): Define.
12775 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12776 try an anonymous one. Report the size if the mmap fails.
12777 * output.h (class Output_file): Declare map_anonymous.
12778
12779 2009-03-24 Ian Lance Taylor <iant@google.com>
12780
12781 * target-select.cc (instantiate_target): Don't acquire the lock if
12782 the instantiated_target_ field has already been set.
12783
12784 2009-03-23 Ian Lance Taylor <iant@google.com>
12785
12786 * gold-threads.h (class Initialize_lock): Define.
12787 * gold-threads.cc (class Initialize_lock_once): Define.
12788 (initialize_lock_control): New static variable.
12789 (initialize_lock_pointer): New static variable.
12790 (initialize_lock_once): New static function.
12791 (Initialize_lock::Initialize_lock): Define.
12792 (Initialize_lock::initialize): Define.
12793 * target-select.h: Include "gold-threads.h".
12794 (class Target_selector): Add lock_ and initialize_lock_ fields.
12795 Don't define instantiate_target, just declare it.
12796 * target-select.cc (Target_selector::Target_selector): Initialize
12797 new fields.
12798 (Target_selector::instantiate_target): Define.
12799 * descriptors.h: Include "gold-threads.h".
12800 (class Descriptors): Add initialize_lock_ field.
12801 * descriptors.cc (Descriptors::Descriptors): Initialize new
12802 field.
12803 (Descriptors::open): Use initialize_lock_ field
12804 * errors.h (class Errors): Add initialize_lock_ field.
12805 * errors.cc (Errors::Errors): Initialize new field.
12806 (Errors::initialize_lock): Use initialize_lock_ field.
12807 * powerpc.cc (class Target_selector_powerpc): Remove
12808 instantiated_target_ field. In do_recognize call
12809 instantiate_target rather than do_instantiate_target. In
12810 do_instantiate_target just allocate a new target.
12811 * sparc.cc (class Target_selector_sparc): Likewise.
12812
12813 * freebsd.h: New file.
12814 * i386.cc: Include "freebsd.h".
12815 (Target_i386): Derive from Target_freebsd rather than
12816 Sized_target.
12817 (Target_selector_i386): Derive from Target_selector_freebsd rather
12818 than Target_selector.
12819 * x86_64.cc: Include "freebsd.h".
12820 (Target_x86_64): Derive from Target_freebsd rather than
12821 Sized_target.
12822 (Target_selector_x86_64): Derive from Target_selector_freebsd
12823 rather than Target_selector.
12824 * target.h (class Target): Add adjust_elf_header and
12825 do_adjust_elf_header.
12826 * output.cc (Output_file_header:: do_sized_write): Call target
12827 adjust_elf_header routine.
12828 * configure.tgt: Set targ_osabi.
12829 * configure.ac: Define GOLD_DEFAULT_OSABI.
12830 * parameters.cc (Parameters::default_target): Pass
12831 GOLD_DEFAULT_OSABI to select_target.
12832 * target-select.h (class Target_selector): Make instantiate_target
12833 protected rather than private.
12834 * Makefile.am (HFILES): Add freebsd.h.
12835 * configure, Makefile.in, config.in: Rebuild.
12836
12837 * merge.cc (do_add_input_section): Correct pend value. Change
12838 message about last entry not being null terminated from error to
12839 warning.
12840
12841 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12842
12843 * incremental.cc: New file.
12844 * Makefile.am (CCFILES): Add incremental.cc.
12845 * Makefile.in: Rebuild.
12846
12847 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12848
12849 * layout.cc (Layout::output_section_name): Preserve names
12850 of '.note.' sections.
12851
12852 2009-03-19 Ian Lance Taylor <iant@google.com>
12853
12854 * descriptors.cc (Descriptors::open): Check that the options are
12855 valid before using them.
12856
12857 2009-03-18 Ian Lance Taylor <iant@google.com>
12858
12859 * script-sections.h: Include <list>.
12860 (class Script_sections): Change Sections_elements from std::vector
12861 to std::list. Typedef public Elements_iterator. Add
12862 orphan_section_placement_, data_segment_align_start_, and
12863 saw_data_segment_align_ fields. Remove data_segment_align_index_
12864 field.
12865 * script-sections.cc (class Orphan_section_placement): New class.
12866 (class Sections_element): Add virtual functions is_relro and
12867 orphan_section_init. Remove virtual function place_orphan_here.
12868 (class Output_section_definition): Add is_relro and
12869 orphan_section_init. Remove place_orphan_here.
12870 (class Orphan_output_section): Likewise.
12871 (Script_sections::Script_sections): Update for field changes.
12872 (Script_sections::data_segment_align): Set saw_data_segment_align_
12873 and data_segment_align_start_, not data_segment_align_index.
12874 (Script_sections::data_segment_relro_end): Check
12875 saw_data_segment_align_. Use data_segment_align_start_ rather
12876 than data_segment_align_index_.
12877 (Script_sections::place_orphan): Rewrite to use
12878 Orphan_section_placement.
12879
12880 2009-03-17 Ian Lance Taylor <iant@google.com>
12881
12882 * archive.cc (Archive::add_symbols): Check for a version attached
12883 to the symbol name in the archive map.
12884 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12885 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12886 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12887 (ver_test_11.a): New target.
12888 * testsuite/Makefile.in: Rebuild.
12889
12890 * configure.ac: Check for chsize and posix_fallocate. Replace
12891 ftruncate.
12892 * ftruncate.c: New file, from gnulib.
12893 * output.cc (posix_fallocate): Define dummy version if not
12894 HAVE_POSIX_FALLOCATE.
12895 (Output_file::map): Call posix_fallocate rather than lseek and
12896 write.
12897 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12898 * configure, Makefile.in, config.in: Rebuild.
12899
12900 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12901
12902 * layout.h (Layout::create_note): Add section_name parameter.
12903 * layout.cc (Layout::create_note): Likewise.
12904 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12905
12906 2009-03-17 Ian Lance Taylor <iant@google.com>
12907
12908 * descriptors.cc: Include "options.h".
12909 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12910 (Descriptors::open): Always use O_CLOEXEC when opening a new
12911 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12912 then set FD_CLOEXEC.
12913
12914 * sparc.cc (class Target_sparc): Add has_got_section.
12915 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12916 make sure we have a GOT section.
12917
12918 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12919 (Target_sparc::Scan::local): Likewise.
12920 (Target_sparc::Scan::global): Likewise.
12921 (Target_sparc::Relocate::relocate): Likewise.
12922 (Target_sparc::Relocate::relocate_tls): Likewise.
12923
12924 * symtab.cc (Symbol_table::define_default_version): New function,
12925 broken out of add_from_object.
12926 (Symbol_table::add_from_object): Call define_default_version.
12927 (Symbol_table::define_special_symbol): Add resolve_oldsym
12928 parameter. Change all callers. If the version for a symbol comes
12929 from a version script, resolve it with the symbol with the same
12930 name with no version. Also add the symbol without a version if
12931 appropriate.
12932 (do_define_in_output_data): If resolving with oldsym, don't delete
12933 sym.
12934 (do_define_in_output_segment): Likewise.
12935 (do_define_as_constant): Likewise.
12936 * symtab.h (class Symbol_table): Update declarations.
12937
12938 2009-03-13 Ian Lance Taylor <iant@google.com>
12939
12940 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12941 (Read_symbols::requeue): New function.
12942 (Read_symbols::do_read_symbols): If make_elf_object fails because
12943 the target type is not configured, and the file was searched for,
12944 issue a warning and retry with the next directory.
12945 (Add_symbols::run): If the file has an incompatible format, and
12946 it was searched for, requeue the Read_symbols task. On error,
12947 release the object.
12948 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12949 dirindex parameter to constructor. Change all callers. Declare
12950 incompatible_warning and requeue.
12951 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12952 input_argument_ and input_group_ fields. Add them to
12953 constructor. Change all callers.
12954 (class Read_script): Add dirindex_ field. Add it to constructor.
12955 Change all callers.
12956 * archive.cc (Archive::setup): Remove input_objects parameter.
12957 Change all callers.
12958 (Archive::get_file_and_offset): Likewise.
12959 (Archive::read_all_symbols): Likewise.
12960 (Archive::read_symbols): Likewise.
12961 (Archive::get_elf_object_for_member): Remove input_objects
12962 parameter. Add punconfigured parameter. Change all callers.
12963 (Archive::add_symbols): Change return type to bool. Check return
12964 value of include_member.
12965 (Archive::include_all_members): Likewise.
12966 (Archive::include_member): Change return type to bool. Return
12967 false if first included object has incompatible target. Set
12968 included_member_ field.
12969 (Add_archive_symbols::run): If add_symbols returns false, requeue
12970 Read_symbols task.
12971 * archive.h (class Archive): Add included_member_ field.
12972 Initialize it in constructor. Add input_file and searched_for
12973 methods. Update declarations.
12974 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12975 input_argument_ fields. Add them to constructor. Change all
12976 callers.
12977 * script.cc: Include "target-select.h".
12978 (class Parser_closure): Add skip_on_incompatible_target_ and
12979 found_incompatible_target_ fields. Add
12980 skip_on_incompatible_target parameter to constructor. Change all
12981 callers. Add methods skip_on_incompatible_target,
12982 clear_skip_on_incompatible_target, found_incompatible_target, and
12983 set_found_incompatible_target.
12984 (read_input_script): Add dirindex parameter. Change all callers.
12985 If parser finds an incompatible target, requeue Read_symbols
12986 task.
12987 (script_set_symbol): Clear skip_on_incompatible_target in
12988 closure.
12989 (script_add_assertion, script_parse_option): Likewise.
12990 (script_start_sections, script_add_phdr): Likewise.
12991 (script_check_output_format): New function.
12992 * script.h (read_input_script): Update declaration.
12993 * script-c.h (script_check_output_format): Declare.
12994 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12995 (ignore_cmd): Remove OUTPUT_FORMAT.
12996 * fileread.cc (Input_file::Input_file): Add explicit this.
12997 (Input_file::will_search_for): New function.
12998 (Input_file::open): Add pindex parameter. Change all callers.
12999 * fileread.h (class Input_file): Add input_file_argument method.
13000 Declare will_search_for. Update declarations.
13001 * object.cc (make_elf_object): Add punconfigured parameter.
13002 Change all callers.
13003 * object.h (class Object): Make input_file public. Add
13004 searched_for method.
13005 (make_elf_object): Update declaration.
13006 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13007 restart search.
13008 * dirsearch.h (class Dirsearch): Update declaration.
13009 * options.h (class General_options): Add --warn-search-mismatch.
13010 * parameters.cc (Parameters::is_compatible_target): New function.
13011 * parameters.h (class Parameters): Declare is_compatible_target.
13012 * workqueue.cc (Workqueue::add_blocker): New function.
13013 * workqueue.h (class Workqueue): Declare add_blocker.
13014
13015 * fileread.cc (Input_file::open): Remove options parameter.
13016 Change all callers.
13017 (Input_file::open_binary): Likewise.
13018 * script.cc (read_input_script): Likewise.
13019 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13020 options parameter from constructor. Change all callers.
13021 (class Read_script): Likewise.
13022 * fileread.h (class Input_file): Update declarations.
13023 * script.h (read_input_script): Update declaration.
13024
13025 2009-03-10 Nick Clifton <nickc@redhat.com>
13026
13027 * po/es.po: New Spanish translation.
13028
13029 2009-03-06 Cary Coutant <ccoutant@google.com>
13030
13031 * options.cc (parse_short_option): Keep dash_z from registering itself.
13032
13033 2009-03-03 Ian Lance Taylor <iant@google.com>
13034
13035 PR 9918
13036 * target-reloc.h (relocate_section): Pass output_section to
13037 relocate.
13038 * i386.cc (Target_i386::should_apply_static_reloc): Add
13039 output_section parameter. Change all callers.
13040 (Target_i386::Relocate::relocate): Add output_section parameter.
13041 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13042 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13043 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13044 * testsuite/two_file_shared.sh: New script.
13045 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13046 (check_DATA): Add two_file_shared.dbg.
13047 (two_file_shared.dbg): New target.
13048 * testsuite/Makefile.in: Rebuild.
13049
13050 2009-03-01 Ian Lance Taylor <iant@google.com>
13051
13052 * configure.ac: Check for byteswap.h.
13053 * configure: Rebuild.
13054 * config.in: Rebuild.
13055
13056 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13057
13058 * layout.cc (Layout::find_or_add_kept_section): New function.
13059 (Layout::add_comdat): Removed.
13060 * layout.h (struct Kept_section): Move out of class Layout.
13061 Remove trailing underscores from field names. Add group_sections
13062 field. Rename group_ field to is_group. Change all uses.
13063 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13064 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13065 comdat_groups_ field.
13066 (Sized_relobj::include_section_group): Use
13067 find_or_add_kept_section and Kept_section::group_sections.
13068 (Sized_relobj::include_linkonce_section): Likewise.
13069 * object.cc (class Sized_relobj): Don't define Comdat_group or
13070 Comdat_group_table. Remove find_comdat_group and
13071 add_comdat_group. Remove comdat_groups_ field.
13072 * plugin.cc (include_comdat_group): Use
13073 Layout::find_or_add_kept_section.
13074
13075 2009-02-28 Ian Lance Taylor <iant@google.com>
13076
13077 * README: --gc-sections and map files are now supported. Document
13078 some build requirements.
13079
13080 PR 6992
13081 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13082 relocatable link set the value of the section symbol to zero.
13083 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13084 relocatable link don't include the section address in the local
13085 symbol value.
13086
13087 2009-02-27 Ian Lance Taylor <iant@google.com>
13088
13089 PR 6811
13090 * options.h (class Search_directory): Add is_system_directory.
13091 (class General_options): Declare is_in_system_directory.
13092 * options.cc (get_relative_sysroot): Make static.
13093 (get_default_sysroot): Make static.
13094 (General_optoins::is_in_system_directory): New function.
13095 * fileread.cc (Input_file::is_in_system_directory): New function.
13096 * fileread.h (class Input_file): Declare is_in_system_directory.
13097 * object.h (class Object): Add is_in_system_directory.
13098 (class Input_objects): Remove system_library_directory_ field.
13099 * object.cc (Input_objects::add_object): Don't set
13100 system_library_directory_.
13101 (input_objects::found_in_system_library_directory): Remove.
13102 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13103 parameter. Change all callers.
13104 (Symbol_table::sized_write_globals): Likewise.
13105 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13106 Call Object::is_in_system_directory.
13107 * symtab.h (class Symbol_table): Update declarations.
13108
13109 PR 5990
13110 * descriptors.h (Open_descriptor): Add is_on_stack field.
13111 * descriptors.cc (Descriptors::open): If the descriptor is on the
13112 top of the stack, remove it. Initialize is_on_stack field.
13113 (Descriptors::release): Only add pod to stack if it is not on the
13114 stack already.
13115 (Descriptors::close_some_descriptor): Clear stack_next and
13116 is_on_stack fields.
13117
13118 PR 7091
13119 * output.cc (Output_section::find_starting_output_address): Rename
13120 from starting_output_address; add PADDR parameter; change return
13121 type.
13122 * output.h (class Output_section): Declare
13123 find_starting_output_address instead of starting_output_address.
13124 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13125 section symbol for which we can't find a merge section.
13126
13127 PR 9836
13128 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13129 hidden or internal, force the symbol to be local.
13130 * resolve.cc (Symbol::override_visibility): Define.
13131 (Symbol::override_base): Use override_visibility.
13132 (Symbol_table::resolve): Likewise.
13133 (Symbol::override_base_with_special): Likewise.
13134 (Symbol_table::override_with_special): If the visibility is hidden
13135 or internal, force the symbol to be local.
13136 * symtab.h (class Symbol): Add set_visibility and
13137 override_visibility.
13138 * testsuite/ver_test_1.sh: New file.
13139 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13140 (check_DATA): Add ver_test_1.syms.
13141 (ver_test_1.syms): New target.
13142 * testsuite/Makefile.in: Rebuild.
13143
13144 2009-02-25 Cary Coutant <ccoutant@google.com>
13145
13146 * layout.cc (Layout::choose_output_section): Don't rename sections
13147 when using a linker script that has a SECTIONS clause.
13148 * Makefile.in: Regenerate.
13149
13150 * testsuite/Makefile.am (script_test_5.sh): New test case.
13151 * testsuite/Makefile.in: Regenerate.
13152 * testsuite/script_test_5.cc: New file.
13153 * testsuite/script_test_5.sh: New file.
13154 * testsuite/script_test_5.t: New file.
13155
13156 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13157
13158 * archive.cc (Archive::include_member): Update calls to add_symbols.
13159 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13160 the Layout argument.
13161 * dynobj.h (do_add_symbols): Add the Layout argument.
13162 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13163 Layout argument.
13164 * object.h (Object::add_symbols): Add the Layout argument.
13165 (Object::do_add_symbols): Add the Layout argument.
13166 (Sized_relobj::do_add_symbols): Add the Layout argument.
13167 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13168 Unify the two versions.
13169 (Add_plugin_symbols): Remove.
13170 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13171 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13172 (Add_plugin_symbols): Remove.
13173 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13174 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13175 (Add_symbols::run): Make it work with Pulginobj.
13176
13177 2009-02-06 Ian Lance Taylor <iant@google.com>
13178
13179 * object.cc (Sized_relobj::do_layout): Make info message start
13180 with lower case letter.
13181
13182 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13183
13184 * binary.cc: Fix file comment.
13185
13186 * options.h (enum Incremental_disposition): Define.
13187 (class General_options): Add new options: --incremental,
13188 --incremental_changed, --incremental_unchanged,
13189 --incremental_unknown. Add incremental_disposition_ and
13190 implicit_incremental_ fields.
13191 (General_options::incremental_disposition): New function.
13192 (class Position_dependent_options): Add incremental_disposition
13193 option.
13194 (Position_dependent_options::copy_from_options): Set incremental
13195 dispositions.
13196 * options.cc (General_options::parse_incremental_changed): New
13197 function.
13198 (General_options::parse_incremental_unchanged): New function.
13199 (General_options::parse_incremental_unknown): New function.
13200 (General_options::General_options): Initialize new fields
13201 incremental_disposition_ and implicit_incremental_.
13202 (General_options::finalize): Check for uasge of --incremental-*
13203 without --incremental.
13204
13205 2009-02-06 Chris Demetriou <cgd@google.com>
13206
13207 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13208 pointer and to report location as the file name associated with
13209 the symbol.
13210 (gold_undefined_symbol_at_location): New function to replace the
13211 old gold_undefined_symbol functionality.
13212 * target-reloc.h (relocate_section): Update to use
13213 gold_undefined_symbol_at_location.
13214 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13215 Call gold_undefined_symbol function rather than gold_error.
13216 * errors.h (Errors::undefined_symbol): Take location as a
13217 string, rather than calculating it from a relocation.
13218 * errors.cc (Errors::fatal): Print "fatal error:" before the
13219 formatted message.
13220 (Errors::error, Errors::error_at_location): Print "error: "
13221 before the formatted message.
13222 (Errors::undefined_symbol): Take location as a string, rather
13223 than calculating it from a relocation.
13224 (gold_undefined_symbol_at_location): New function akin to
13225 old gold_undefined_symbol, calculates location from relocation.
13226 (gold_undefined_symbol): Change to take only a Symbol pointer
13227 and to report location as the file name associated with the symbol.
13228 * testsuite/debug_msg.sh: Update for changed error messages.
13229 * testsuite/undef_symbol.sh: Likewise.
13230
13231 2009-02-04 Duncan Sands <baldrick@free.fr>
13232
13233 PR 9812
13234 * reduced_debug_output.h
13235 (Output_reduced_debug_abbrev_section::failed): Use format for
13236 gold_warning.
13237 (Output_reduced_debug_info_section::faild): Likewise.
13238
13239 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13240
13241 * script.cc (Lazy_demangler): New class.
13242 (Version_script_info::get_symbol_version_helper): Demangle a
13243 symbol only once.
13244
13245 2009-01-29 Cary Coutant <ccoutant@google.com>
13246
13247 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13248 to __tls_get_addr.
13249 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13250
13251 2009-01-28 Ian Lance Taylor <iant@google.com>
13252
13253 * version.cc (version_string): Bump to 1.9.
13254
13255 * gold.h: Include <cstring> and <stdint.h>.
13256 * version.cc: Include <cstdio>.
13257 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13258 warning.
13259 * reduced_debug_output.cc (insert_into_vector): Rename from
13260 Insert_into_vector; change all callers. Use Swap_unaligned to
13261 avoid aliasing issue; remove union since it is unnecessary.
13262
13263 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13264
13265 * Makefile.am (CCFILES): Add gc.cc.
13266 (HFILES): Add gc.h.
13267 * Makefile.in: Regenerate.
13268 * gold.cc (Gc_runner): New class.
13269 (queue_initial_tasks): Call garbage collection related tasks
13270 when corresponding options are invoked.
13271 (queue_middle_gc_tasks): New function.
13272 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13273 processed early before laying out sections during garbage collection.
13274 * gold.h (queue_middle_gc_tasks): New function.
13275 (is_prefix_of): Move from "layout.cc".
13276 * i386.cc (Target_i386::gc_process_relocs): New function.
13277 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13278 * main.cc (main): Create object of class "Garbage_collection".
13279 * object.cc (Relobj::copy_symbols_data): New function.
13280 (Relobj::is_section_name_included): New function.
13281 (Sized_relobj::do_layout): Allow this function to be called twice
13282 during garbage collection and defer layout of section during the
13283 first call.
13284 * object.h (Relobj::get_symbols_data): New function.
13285 (Relobj::is_section_name_included): New function.
13286 (Relobj::copy_symbols_data): New function.
13287 (Relobj::set_symbols_data): New function.
13288 (Relobj::get_relocs_data): New function.
13289 (Relobj::set_relocs_data): New function.
13290 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13291 (Relobj::gc_process_relocs): New function.
13292 (Relobj::do_gc_process_relocs): New pure virtual function.
13293 (Relobj::sd_): New data member.
13294 (Sized_relobj::is_output_section_offset_invalid): New function.
13295 (Sized_relobj::do_gc_process_relocs): New function.
13296 * options.h (General_options::gc_sections): Modify to not be a no-op.
13297 (General_options::print_gc_sections): New option.
13298 * plugin.cc (Plugin_finish::run): Remove function call to
13299 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13300 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13301 * reloc.cc (Read_relocs::run): Add task to process relocs and
13302 determine unreferenced sections when doing garbage collection.
13303 (Gc_process_relocs): New class.
13304 (Sized_relobj::do_gc_process_relocs): New function.
13305 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13306 sections that are garbage collected.
13307 * reloc.h (Gc_process_relocs): New class.
13308 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13309 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13310 symbols whose corresponding sections are garbage collected.
13311 (Symbol_table::Symbol_table): Add new parameter for the garbage
13312 collection object.
13313 (Symbol_table::gc_mark_undef_symbols): New function.
13314 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13315 (Symbol_table::gc_mark_dyn_syms): New function.
13316 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13317 as garbage.
13318 (Symbol_table::add_from_object): Likewise.
13319 (Symbol_table::add_from_relobj): When building shared objects, do not
13320 treat externally visible symbols as garbage.
13321 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13322 table information for static and relocatable links.
13323 * symtab.h (Symbol_table::set_gc): New function.
13324 (Symbol_table::gc): New function.
13325 (Symbol_table::gc_mark_undef_symbols): New function.
13326 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13327 (Symbol_table::gc_mark_dyn_syms): New function.
13328 (Symbol_table::gc_): New data member.
13329 * target.h (Sized_target::gc_process_relocs): New pure virtual
13330 function.
13331 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13332 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13333
13334 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13335
13336 * options.h (General_options::gc_sections): Define as a no-op for now.
13337 (General_options::no_keep_memory): Ditto.
13338 (General_options::Bshareable): Define.
13339 * options.cc (General_options::finalize): Honor -Bshareable.
13340
13341 2009-01-20 Andreas Schwab <schwab@suse.de>
13342
13343 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13344 read the value in the contents, since we don't use it. Use the
13345 template endianness when writing.
13346 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13347
13348 2009-01-19 Andreas Schwab <schwab@suse.de>
13349
13350 * configure.tgt (powerpc64-*): Fix targ_obj.
13351
13352 2009-01-15 Ian Lance Taylor <iant@google.com>
13353
13354 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13355 local symbols when stripping all symbols.
13356
13357 2009-01-14 Cary Coutant <ccoutant@google.com>
13358
13359 * output.cc (Output_reloc): Add explicit instantiations.
13360
13361 2009-01-14 Cary Coutant <ccoutant@google.com>
13362
13363 * archive.cc (Archive::get_elf_object_for_member): Remove call
13364 to File_read::claim_for_plugin.
13365 * descriptors.cc (Descriptors::open): Remove reference to
13366 is_claimed.
13367 (Descriptors::claim_for_plugin): Remove.
13368 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13369 (Descriptors::is_claimed): Remove.
13370 (claim_descriptor_for_plugin): Remove.
13371 * fileread.cc (File_read::claim_for_plugin): Remove.
13372 * fileread.h (File_read::claim_for_plugin): Remove.
13373 (File_read::descriptor): Reopen descriptor if necessary.
13374 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13375 (Plugin_manager::all_symbols_read): Add task parameter. Change
13376 all callers.
13377 (Plugin_manager::get_input_file): New function.
13378 (Plugin_manager::release_input_file): New function.
13379 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13380 corresponding data member.
13381 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13382 and pass to base constructor. Change all callers.
13383 (get_input_file, release_input_file): New functions.
13384 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13385 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13386 (Plugin_manager::all_symbols_read): Add task parameter.
13387 (Plugin_manager::get_input_file): New function.
13388 (Plugin_manager::release_input_file): New function.
13389 (Plugin_manager::task_): New data member.
13390 (Pluginobj::Pluginobj): Add filesize parameter.
13391 (Pluginobj::filename): New function.
13392 (Pluginobj::descriptor): New function.
13393 (Pluginobj::filesize): New function.
13394 (Pluginobj::filesize_): New data member.
13395 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13396 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13397 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13398
13399 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13400 with archive libraries.
13401 * testsuite/Makefile.in: Regenerate.
13402 * testsuite/plugin_test.c (struct sym_info): New type.
13403 (get_input_file, release_input_file): New static variables.
13404 (onload): Capture new transfer vector entries.
13405 (claim_file_hook): Stop reading at end of file according to filesize.
13406 Factor out parsing of readelf output into separate function.
13407 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13408 APIs and get the source file name from the symbol table. Convert
13409 source file name to corresponding object file name. Print info
13410 message when adding new input files.
13411 (parse_readelf_line): New function.
13412 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13413 * testsuite/plugin_test_2.sh: Likewise.
13414 * testsuite/plugin_test_3.sh: Likewise.
13415 * testsuite/plugin_test_4.sh: New test case.
13416
13417 2009-01-07 Ian Lance Taylor <iant@google.com>
13418
13419 * version.cc (version_string): Bump to 1.8.
13420
13421 2008-12-23 Cary Coutant <ccoutant@google.com>
13422
13423 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13424 * plugin.cc (Plugin_manager::finish): Rename as
13425 layout_deferred_objects. Move cleanup to separate function.
13426 (Plugin_manager::cleanup): New function.
13427 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13428 separately.
13429 * plugin.h (Plugin_manager::finish): Rename as
13430 layout_deferred_objects.
13431 (Plugin_manager::cleanup): New function.
13432 (Plugin_manager::cleanup_done): New field.
13433
13434 2008-12-23 Cary Coutant <ccoutant@google.com>
13435
13436 * plugin.cc (is_visible_from_outside): New function.
13437 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13438 so we don't return "IR only" status for exported symbols or -r links.
13439
13440 * testsuite/Makefile.am (plugin_test_3): New test case.
13441 * testsuite/Makefile.in: Regenerate.
13442 * testsuite/plugin_test_3.sh: New file.
13443
13444 2008-12-22 Cary Coutant <ccoutant@google.com>
13445
13446 * object.cc (Sized_relobj::layout_section): New function.
13447 (Sized_relobj::do_layout): Defer layout of input sections until after
13448 plugin has provided replacement files.
13449 (Sized_relobj::do_layout_deferred_sections): New function.
13450 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13451 (Relobj::layout_deferred_sections): New function.
13452 (Relobj::do_layout_deferred_sections): New function.
13453 (Sized_relobj::do_layout_deferred_sections): New function.
13454 (Sized_relobj::layout_section): New function.
13455 (Sized_relobj::Deferred_layout): New structure.
13456 (Sized_relobj::deferred_layout_): New field.
13457 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13458 Change all callers. Layout deferred sections.
13459 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13460 references.
13461 (Plugin_hook::run): Move code from do_plugin_hook inline.
13462 (Plugin_hook::do_plugin_hook): Remove.
13463 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13464 (Plugin_manager::finish): Renamed, was cleanup.
13465 (Plugin_manager::should_defer_layout): New function.
13466 (Plugin_manager::add_deferred_layout_object): New function.
13467 (Plugin_manager::Deferred_layout_list): New type.
13468 (Plugin_manager::deferred_layout_objects_): New field.
13469 (Plugin_hook::do_plugin_hook): Remove.
13470
13471 2008-12-17 Ian Lance Taylor <iant@google.com>
13472
13473 * options.h (class General_options): Add --no case for
13474 --export-dynamic.
13475
13476 2008-12-16 Cary Coutant <ccoutant@google.com>
13477
13478 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13479 vector.
13480 (Plugin_manager::claim_file): Create plugin object even if
13481 plugin did not call the add_symbols callback.
13482 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13483 asking for more symbols than were added.
13484 * testsuite/Makefile.am (plugin_test_1): Add test case with
13485 no global symbols.
13486 (empty.syms): New target.
13487 * testsuite/Makefile.in: Regenerate.
13488 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13489 message. Don't call add_symbols if no globals.
13490 (all_symbols_read_hook): Don't provide replacement for empty
13491 claimed file.
13492
13493 2008-12-12 Ian Lance Taylor <iant@google.com>
13494
13495 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13496 r_type == 0 for a local symbol with r_sym == 0.
13497 (scan_relocatable_relocs): Pass r_sym to
13498 local_non_section_strategy.
13499 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13500 r_sym parameter.
13501
13502 * configure.ac: Update test for TLS descriptors: they are
13503 supported as of glibc 2.9.
13504 * configure: Rebuild.
13505
13506 2008-12-11 Ian Lance Taylor <iant@google.com>
13507
13508 PR 7091
13509 * target-reloc.h (Default_scan_relocatable_relocs): For each
13510 function, map r_type == 0 to RELOC_DISCARD.
13511
13512 2008-12-10 Cary Coutant <ccoutant@google.com>
13513
13514 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13515 object to override a kept COMDAT group from a plugin object.
13516
13517 2008-12-09 Ian Lance Taylor <iant@google.com>
13518
13519 PR 7088
13520 * yyscript.y (file_cmd): Handle INPUT.
13521
13522 * testsuite/initpri1.c: Change all declarations to be full
13523 prototypes by adding void, to avoid compiler warnings.
13524
13525 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13526
13527 * options.cc (General_options::parse_plugin_opt): New.
13528 (General_options::add_plugin): The argument now is just the filename.
13529 (General_options::add_plugin_option): New.
13530 * options.h (plugin_opt): New.
13531 (add_plugin): Change argument name.
13532 (add_plugin_option): New.
13533 * plugin.cc (Plugin::load): Don't parse the plugin option.
13534 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13535 (Plugin::add_option): New.
13536 (Plugin::args_): Change type.
13537 (Plugin::filename_): New.
13538 (Plugin_manager::add_plugin_option): New.
13539 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13540 * testsuite/Makefile.in: Regenerate.
13541
13542 2008-12-05 Cary Coutant <ccoutant@google.com>
13543
13544 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13545 Handle --strip-lto-sections option.
13546 * options.h (strip_lto_sections): New option.
13547
13548 2008-12-01 Cary Coutant <ccoutant@google.com>
13549
13550 * plugin.cc (ld_plugin_message): Change format parameter to const.
13551 Fix mismatch between new[] and delete.
13552
13553 2008-11-14 Cary Coutant <ccoutant@google.com>
13554
13555 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13556 instead of -1U.
13557
13558 2008-11-05 Craig Silverstein <csilvers@google.com>
13559
13560 * options.cc (General_options::parse_dynamic_list): New function.
13561 * options.h (General_options): New flags dynamic_list,
13562 dynamic_list_data, dynamic_list_cpp_new, and
13563 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13564 (General_options::in_dynamic_list): New function.
13565 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13566 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13567 (Lex::can_continue_name): Likewise.
13568 (yylex): Likewise.
13569 (read_script_file): New parameter script_options.
13570 (read_dynamic_list): New function.
13571 (Script_options::define_dynamic_list): New function.
13572 (dynamic_list_keyword_parsecodes): New variable.
13573 (dynamic_list_keywords): New variable.
13574 * script.h (Script_options::define_dynamic_list): New function
13575 prototype.
13576 (read_dynamic_list): New function prototype.
13577 * symtab.cc (strprefix): New macro.
13578 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13579 dynamic_list_data, dynamic_list_cpp_new, and
13580 dynamic_list_cpp_typeinfo.
13581 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13582 (dynamic_list_expr): New rule.
13583 (dynamic_list_nodes): Likewise.
13584 (dynamic_list_node): Likewise.
13585 * testsuite/Makefile.am (dynamic_list): New test.
13586 * testsuite/Makefile.in: Regenerated.
13587 * testsuite/dynamic_list.t: New file.
13588 * testsuite/dynamic_list.sh: New file.
13589
13590 2008-11-05 Craig Silverstein <csilvers@google.com>
13591
13592 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13593 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13594 (t11_last): Likewise.
13595 * testsuite/ver_test_6.c (main): Likewise.
13596
13597 2008-10-07 Cary Coutant <ccoutant@google.com>
13598
13599 * options.c (General_options::finalize): Add check for -static and
13600 -shared.
13601 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13602 is not empty.
13603
13604 2008-10-02 Cary Coutant <ccoutant@google.com>
13605
13606 * plugin.cc (make_sized_plugin_object): Fix conditional
13607 compilation to work when not all targets are enabled.
13608
13609 2008-09-29 Cary Coutant <ccoutant@google.com>
13610
13611 * archive.cc (Archive::get_file_and_offset): Use filename instead
13612 of name to get library path.
13613 (Archive::include_member): Unlock external member of a thin archive.
13614
13615 * testsuite/Makefile.am (TEST_AR): New variable.
13616 (thin_archive_test_1): New test.
13617 (thin_archive_test_2): New test.
13618 * testsuite/Makefile.in: Regenerate.
13619 * testsuite/thin_archive_main.cc: New file.
13620 * testsuite/thin_archive_test_1.cc: New file.
13621 * testsuite/thin_archive_test_2.cc: New file.
13622 * testsuite/thin_archive_test_3.cc: New file.
13623 * testsuite/thin_archive_test_4.cc: New file.
13624
13625 2008-09-29 Cary Coutant <ccoutant@google.com>
13626
13627 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13628 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13629 instead of -1U.
13630 (Sized_relobj::do_finalize_local_symbols): Likewise.
13631 (Sized_relobj::map_to_kept_section): Likewise.
13632 * object.h (Sized_relobj::invalid_address): New constant.
13633 (Sized_relobj::do_output_section_offset): Check for invalid_address
13634 and return -1ULL.
13635 * output.cc (Output_reloc::local_section_offset): Use constant
13636 invalid_address instead of -1U.
13637 (Output_reloc::get_address): Likewise.
13638 (Output_section::output_address): Change -1U to -1ULL.
13639 * output.h (Output_reloc::invalid_address): New constant.
13640 * reloc.cc (Sized_relobj::write_sections): Use constant
13641 invalid_address instead of -1U.
13642 (Sized_relobj::relocate_sections): Likewise.
13643 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13644 values for merge sections.
13645 * target-reloc.h (relocate_for_relocatable): Use constant
13646 invalid_address instead of -1U.
13647
13648 2008-09-19 Cary Coutant <ccoutant@google.com>
13649
13650 Add plugin functionality for link-time optimization (LTO).
13651 * configure.ac (plugins): Add --enable-plugins option.
13652 * configure: Regenerate.
13653 * config.in: Regenerate.
13654 * Makefile.am (LIBDL): New variable.
13655 (CCFILES): Add plugin.cc.
13656 (HFILES): Add plugin.h.
13657 (ldadd_var): Add LIBDL.
13658 * Makefile.in: Regenerate.
13659
13660 * archive.cc: Include "plugin.h".
13661 (Archive::setup): Don't preread archive symbols when using a plugin.
13662 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13663 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13664 files.
13665 (Archive::include_member): Add symbols from plugin objects.
13666 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13667 * descriptors.cc (Descriptors::open): Check for file descriptors
13668 abandoned by plugins.
13669 (Descriptors::claim_for_plugin): New function.
13670 * descriptors.h (Descriptors::claim_for_plugin): New function.
13671 (Open_descriptor::is_claimed): New field.
13672 (claim_descriptor_for_plugin): New function.
13673 * fileread.cc (File_read::claim_for_plugin): New function.
13674 * fileread.h (File_read::claim_for_plugin): New function.
13675 (File_read::descriptor): New function.
13676 * gold.cc: Include "plugin.h".
13677 (queue_initial_tasks): Add task to call plugin hooks for generating
13678 new object files.
13679 * main.cc: Include "plugin.h".
13680 (main): Load plugin libraries.
13681 * object.h (Pluginobj): Declare.
13682 (Object::pluginobj): New function.
13683 (Object::do_pluginobj): New function.
13684 (Object::set_target): New function.
13685 * options.cc: Include "plugin.h".
13686 (General_options::parse_plugin): New function.
13687 (General_options::General_options): Initialize plugins_ field.
13688 (General_options::add_plugin): New function.
13689 * options.h (Plugin_manager): Declare.
13690 (General_options): Add --plugin option.
13691 (General_options::has_plugins): New function.
13692 (General_options::plugins): New function.
13693 (General_options::add_plugin): New function.
13694 (General_options::plugins_): New field.
13695 * plugin.cc: New file.
13696 * plugin.h: New file.
13697 * readsyms.cc: Include "plugin.h".
13698 (Read_symbols::do_read_symbols): Check for archive before checking
13699 for ELF file. Call plugin hooks to claim files.
13700 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13701 from a real object file; force override when processing replacement
13702 files.
13703 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13704 (Symbol::init_base_object): Likewise.
13705 (Symbol::init_base_output_data): Likewise.
13706 (Symbol::init_base_output_segment): Likewise.
13707 (Symbol::init_base_constant): Likewise.
13708 (Symbol::init_base_undefined): Likewise.
13709 (Symbol::output_section): Assert that object is not a plugin.
13710 (Symbol_table::add_from_pluginobj): New function.
13711 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13712 undefined.
13713 (Symbol_table::sized_write_globals): Likewise.
13714 (Symbol_table::add_from_pluginobj): Instantiate template.
13715 * symtab.h (Sized_pluginobj): Declare.
13716 (Symbol::in_real_elf): New function.
13717 (Symbol::set_in_real_elf): New function.
13718 (Symbol::in_real_elf_): New field.
13719 (Symbol_table::add_from_pluginobj): New function.
13720
13721 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13722 (LIBDL): New variable.
13723 (LDADD): Add LIBDL.
13724 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13725 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13726 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13727 (MOSTLYCLEANFILES): Likewise.
13728 * testsuite/Makefile.in: Regenerate.
13729 * testsuite/plugin_test.c: New file.
13730 * testsuite/plugin_test_1.sh: New file.
13731 * testsuite/plugin_test_2.sh: New file.
13732
13733 2008-09-16 Ian Lance Taylor <iant@google.com>
13734
13735 * target-reloc.h (relocate_section): Check whether a symbol is
13736 defined by the ABI before reporting an undefined symbol error.
13737 * target.h (Target::is_defined_by_abi): Make parameter const.
13738 (Target::do_is_defined_by_abi): Likewise.
13739 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13740 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13741 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13742 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13743 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13744 * testsuite/Makefile.in: Rebuild.
13745
13746 * fileread.cc (make_view): Add casts to avoid warning.
13747
13748 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13749
13750 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13751 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13752
13753 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13754
13755 * options.h (General_options::output_is_executable): New.
13756 (General_options::output_is_pie): New.
13757 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13758 for shared libraries.
13759 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13760
13761 2008-09-11 Chris Demetriou <cgd@google.com>
13762
13763 * options.h (origin): New -z option.
13764 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13765 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13766 in DT_FLAGS_1.
13767
13768 2008-09-05 Cary Coutant <ccoutant@google.com>
13769
13770 * fileread.cc (File_read::make_view): Add check for attempt to map
13771 beyond end of file.
13772
13773 2008-09-05 Cary Coutant <ccoutant@google.com>
13774
13775 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13776 explicit instantiations.
13777
13778 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13779
13780 PR gold/6858
13781 * options.cc (General_options::finalize): Allow undefined symbols
13782 in shlibs if linking -shared.
13783
13784 PR gold/6859
13785 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13786 symbols as not needing a dynsym entry.
13787
13788 2008-08-20 Craig Silverstein <csilvers@google.com>
13789
13790 * fileread.cc (File_read::open): Do not lock the file unless it
13791 was successfully opened.
13792
13793 2008-08-14 Cary Coutant <ccoutant@google.com>
13794
13795 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13796 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13797 * testsuite/tls_test.cc (struct int128): 128-bit struct
13798 for testing TLS relocs with non-zero addend.
13799 (v12): New TLS variable.
13800 (t12): New test.
13801 (t_last): Add check for v12.
13802 * testsuite/tls_test.h (t12): New function.
13803 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13804
13805 2008-08-13 Ian Lance Taylor <iant@google.com>
13806
13807 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13808 set tls_segment_ or relro_segment_.
13809 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13810 when appropriate.
13811 * output.h (Output_section::clear_is_relro): New function.
13812 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13813 sections specially even when output_data_ is empty.
13814 (Output_segment::maximum_alignment): When first section is relro,
13815 only force alignment for PT_LOAD segments.
13816 * script.cc (script_data_segment_align): New function.
13817 (script_data_segment_relro_end): New function.
13818 * script-c.h (script_data_segment_align): Declare.
13819 (script_data_segment_relro_end): Declare.
13820 * script-sections.h (class Script_sections): Declare
13821 data_segment_align and data_segment_relro_end. Add fields
13822 segment_align_index_ and saw_relro_end_.
13823 * script-sections.cc (class Sections_element): Add set_is_relro
13824 virtual function. Add new bool* parameter to place_orphan_here.
13825 Add get_output_section virtual function.
13826 (class Output_section_definition): Add set_is_relro. Add new
13827 bool* parameter to place_orphan_here. Add get_output_section.
13828 Add is_relro_ field.
13829 (Output_section_definition::Output_section_definition): Initialize
13830 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13831 and is_relro_ fields.
13832 (Output_section_definition::place_orphan_here): Add is_relro
13833 parameter.
13834 (Output_section_definition::set_section_addresses): Set relro for
13835 output section.
13836 (Output_section_definition::alternate_constraint): Likewise.
13837 (class Orphan_output_section): Add new bool* parameter to
13838 place_orphan_here. Add get_output_section.
13839 (Orphan_output_section::place_orphan_here): Add is_relro
13840 parameter.
13841 (Script_sections::Script_sections): Initialize
13842 data_segment_align_index_ and saw_relro_end_.
13843 (Script_sections::data_segment_align): New function.
13844 (Script_sections::data_segment_relro_end): New function.
13845 (Script_sections::place_orphan): Set or clear is_relro.
13846 (Script_sections::set_section_addresses): Force alignment of first
13847 TLS section.
13848 * yyscript.y (exp): Call script_data_segment_align and
13849 script_data_segment_relro_end.
13850 * testsuite/relro_script_test.t: New file.
13851 * testsuite/relro_test.cc (using_script): Declare.
13852 (t1, t2): Test using_script.
13853 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13854 (relro_script_test_SOURCES): Define.
13855 (relro_script_test_DEPENDENCIES): Define.
13856 (relro_script_test_LDFLAGS): Define.
13857 (relro_script_test_LDADD): Define.
13858 (relro_script_test.so): New target.
13859 * testsuite/Makefile.in: Rebuild.
13860
13861 2008-08-06 Cary Coutant <ccoutant@google.com>
13862
13863 * archive.cc (Archive::total_archives, Archive::total_members)
13864 (Archive::total_members_loaded): New variables.
13865 (Archive::setup): Add parameter. Add option to preread
13866 archive symbols.
13867 (Archive::read_armap): Add counter.
13868 (Archive::get_file_and_offset): New function.
13869 (Archive::get_elf_object_for_member): New function.
13870 (Archive::read_all_symbols): New function.
13871 (Archive::read_symbols): New function.
13872 (Archive::add_symbols): Add counters.
13873 (Archive::include_all_members): Use armap to find members if it's
13874 already built.
13875 (Archive::include_member): Skip reading symbols if already read.
13876 Factored code into Archive::get_file_and_offset and
13877 Archive::get_elf_object_for_member. Changed call to
13878 Mapfile::report_include_archive_member.
13879 (Archive::print_stats): New function.
13880 * archive.h: Declare Object and Read_symbols_data classes.
13881 (Archive::Archive): Add initializers for new members.
13882 (Archive::setup): Add parameter.
13883 (Archive::print_stats): New function.
13884 (Archive::total_archives, Archive::total_members)
13885 (Archive::total_members_loaded): New variables.
13886 (Archive::get_file_and_offset): New function.
13887 (Archive::get_elf_object_for_member): New function.
13888 (Archive::read_all_symbols): New function.
13889 (Archive::read_symbols): New function.
13890 (Archive::Archive_member): New class.
13891 (Archive::members_): New member.
13892 (Archive::num_members_): New member.
13893 * main.cc: Include archive.h.
13894 (main): Call Archive::print_stats.
13895 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13896 archive parameter; member_name is now the fully-decorated name.
13897 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13898 * options.h: (General_options): Add --preread-archive-symbols option.
13899 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13900 Archive::setup.
13901
13902 2008-08-04 Ian Lance Taylor <iant@google.com>
13903
13904 * symtab.h (Symbol::use_plt_offset): New function.
13905 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13906 * powerpc.cc (Relocate::relocate): Likewise.
13907 * sparc.cc (Relocate::relocate): Likewise.
13908 * x86_64.cc (Relocate::relocate): Likewise.
13909 * testsuite/weak_plt.sh: New test.
13910 * testsuite/weak_plt_main.cc: New test.
13911 * testsuite/weak_plt_shared.cc: New test.
13912 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13913 (check_PROGRAMS): Add weak_plt.
13914 (check_DATA): Add weak_plt_shared.so.
13915 (weak_plt_main_pic.o, weak_plt): New targets.
13916 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13917 * testsuite/Makefile.in: Rebuild.
13918
13919 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13920 gcctestdir/ld.
13921 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13922 * testsuite/Makefile.in: Rebuild.
13923
13924 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13925
13926 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13927 * Makefile.in: Regenerate.
13928 * po/POTFILES.in: Regenerate.
13929
13930 2008-07-29 Ian Lance Taylor <iant@google.com>
13931
13932 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13933 symbols before other symbols.
13934 * testsuite/script_test_2.cc (test_addr): Declare.
13935 (test_addr_alias): Declare.
13936 (main): Check that test_addr and test_addr_alias have the right
13937 values.
13938 * testsuite/script_test_2.t: Define test_addr_alias and
13939 test_addr.
13940
13941 2008-07-24 Ian Lance Taylor <iant@google.com>
13942
13943 PR 5990
13944 * descriptors.cc: New file.
13945 * descriptors.h: New file.
13946 * gold-threads.h (class Hold_optional_lock): New class.
13947 * fileread.cc: Include "descriptors.h".
13948 (File_read::~File_read): Release descriptor rather than closing
13949 it.
13950 (File_read::open) [file]: Call open_descriptor rather than open.
13951 Set is_descriptor_opened_.
13952 (File_read::open) [memory]: Assert that descriptor is not open.
13953 (File_read::reopen_descriptor): New function.
13954 (File_read::release): Release descriptor.
13955 (File_read::do_read): Make non-const. Reopen descriptor.
13956 (File_read::read): Make non-const.
13957 (File_read::make_view): Reopen descriptor.
13958 (File_read::do_readv): Likewise.
13959 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13960 Update declarations.
13961 * layout.cc: Include "descriptors.h".
13962 (Layout::create_build_id): Use open_descriptor rather than open.
13963 * output.cc: Include "descriptors.h".
13964 (Output_file::open): Use open_descriptor rather than open.
13965 * archive.cc (Archive::const_iterator): Change Archive to be
13966 non-const.
13967 (Archive::begin, Archive::end): Make non-const.
13968 (Archive::count_members): Likewise.
13969 * archive.h (class Archive): Update declarations.
13970 * object.h (Object::read): Make non-const.
13971 * Makefile.am (CCFILES): Add descriptors.cc.
13972 (HFILES): Add descriptors.h.
13973 * Makefile.in: Rebuild.
13974
13975 PR 6716
13976 * gold.h: Always include <clocale>. Add Solaris workarounds
13977 following code in binutils/sysdep.h.
13978
13979 PR 6048
13980 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13981 this->eh_frame_hdr_ is NULL before using it.
13982
13983 * dynobj.cc (Versions::Versions): Update comment.
13984
13985 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13986 the base version name.
13987
13988 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13989 array size plus one.
13990 (Stringpool_template::set_string_offsets): Subtract one from key
13991 before using it as an array index.
13992 (Stringpool_template::get_offset_with_length): Likewise.
13993 (Stringpool_template::write_to_buffer): Likewise.
13994 * stringpool.h (Stringpool_template::get_offset_from_key):
13995 Likewise.
13996
13997 2008-07-23 Ian Lance Taylor <iant@google.com>
13998
13999 PR 6658
14000 * object.h (Merged_symbol_value::value): Do our best to handle a
14001 negative addend.
14002
14003 PR 6647
14004 * script.cc (Version_script_info::get_versions): Don't add empty
14005 version tag to return value.
14006 (Version_script_info::get_symbol_version_helper): Change return
14007 type to bool. Add pversion parameter. Change all callers.
14008 (script_register_vers_node): Don't require a non-NULL tag.
14009 * script.h (class Version_script_info): Update declarations.
14010 (Version_script_info::get_symbol_version): Change return type to
14011 bool. Add version parameter. Change all callers.
14012 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14013 handling. Handle an empty version from a version script.
14014 (Symbol_table::define_special_symbol): Likewise.
14015 * testsuite/ver_test_10.script: New file.
14016 * testsuite/ver_test_10.sh: New file.
14017 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14018 (check_DATA): Add ver_test_10.syms.
14019 (ver_test_10.syms, ver_test_10.so): New target.
14020 * testsuite/Makefile.in: Rebuild.
14021
14022 2008-07-23 Simon Baldwin <simonb@google.com>
14023
14024 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14025 to zero for undefined symbols from dynamic libraries.
14026
14027 2008-07-23 Ian Lance Taylor <iant@google.com>
14028
14029 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14030 Change all callers.
14031 * symtab.h (class Symbol_table): Update declaration.
14032 * testsuite/ver_test_9.cc: New file.
14033 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14034 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14035 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14036 (ver_test_9.so, ver_test_9.o): New targets.
14037 * testsuite/Makefile.in: Rebuild.
14038
14039 2008-07-22 Ian Lance Taylor <iant@google.com>
14040
14041 * options.h (class General_options): Define --check-sections.
14042 * layout.cc (Layout::set_segment_offsets): Handle
14043 --check-sections.
14044
14045 * options.h (class General_options): Define -n/--nmagic and
14046 -N/--omagic.
14047 * options.cc (General_options::finalize): For -n/--nmagic or
14048 -N/--omagic, set -static.
14049 * layout.cc (Layout::attach_allocated_section_to_segment): If
14050 -N/--omagic, don't put read-only and read-write sections in
14051 different segments.
14052 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14053 finding a read-only segment.
14054 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14055 don't set the minimum segment alignment to the common page size,
14056 and don't set the file offset to the address modulo the page size.
14057 * script-sections.cc (Script_sections::create_segments): If
14058 -n/--omagic, don't put read-only and read-write sections in
14059 different segments.
14060
14061 * cref.cc: New file.
14062 * cref.h: New file.
14063 * options.h (class General_options): Add --print-symbol-counts.
14064 * main.cc (main): Issue defined symbol report if requested.
14065 * archive.cc (Archive::interpret_header): Make into a const member
14066 function.
14067 (Archive::add_symbols): Call Input_objects::archive_start and
14068 archive_stop.
14069 (Archive::const_iterator): Define new class.
14070 (Archive::begin, Archive::end): New functions.
14071 (Archive::include_all_members): Rewrite to use iterator.
14072 (Archive::count_members): New function.
14073 * archive.h (class Archive): Update declarations.
14074 (Archive::filename): New function.
14075 * object.cc: Include "cref.h".
14076 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14077 (Sized_relobj::do_get_global_symbol_counts): New function.
14078 (Input_objects::add_object): Add object to cross-referencer.
14079 (Input_objects::archive_start): New function.
14080 (Input_objects::archive_stop): New function.
14081 (Input_objects::print_symbol_counts): New function.
14082 * object.h: Declare Cref and Archive.
14083 (Object::get_global_symbol_counts): New function.
14084 (Object::do_get_global_symbol_counts): New pure virtual function.
14085 (class Sized_relobj): Add defined_count_ field. Update
14086 declarations.
14087 (class Input_objects): Add cref_ field. Update constructor.
14088 Update declarations.
14089 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14090 defined_count_.
14091 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14092 symbol counts.
14093 (Sized_dynobj::do_get_global_symbol_counts): New function.
14094 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14095 defined_count_. Update declarations. Define Symbols typedef.
14096 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14097 parameter. Change all callers.
14098 (Symbol_table::add_from_dynobj): Add sympointers and defined
14099 parameters. Change all callers.
14100 * symtab.h (class Symbol_table): Update declarations.
14101 * Makefile.am (CCFILES): Add cref.cc.
14102 (HFILES): Add cref.h.
14103 * Makefile.in: Rebuild.
14104
14105 2008-07-22 Simon Baldwin <simonb@google.com>
14106
14107 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14108 to zero when writing undefined symbols.
14109
14110 2008-07-22 Ian Lance Taylor <iant@google.com>
14111
14112 * output.cc (Output_section::add_input_section): Don't try to
14113 merge empty merge sections.
14114
14115 2008-07-21 Craig Silverstein <csilvers@google.com>
14116
14117 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14118 Include symbol version in error message.
14119
14120 2008-07-20 Chris Demetriou <cgd@google.com>
14121
14122 * configure.ac (gold_cv_c_random_seed): New configured variable.
14123 (RANDOM_SEED_CFLAGS): New substituted variable.
14124 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14125 * configure: Rebuild.
14126 * Makefile.in: Likewise.
14127 * testsuite/Makefile.in: Likewise.
14128
14129 2008-07-18 Ian Lance Taylor <iant@google.com>
14130
14131 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14132 where we see NAME/NULL and NAME/VERSION as separate symbols.
14133 * testsuite/ver_test_main.cc (main): Call t4.
14134 (t4, t4_2a): Define.
14135 * testsuite/ver_test_2.cc (t4_2): Define.
14136 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14137 * testsuite/ver_test_4.cc (t4_2a): Define.
14138 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14139 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14140
14141 2008-07-17 Ian Lance Taylor <iant@google.com>
14142
14143 * dynobj.cc (Versions::add_def): If we give an error about a
14144 missing version, go ahead and create the version anyhow.
14145
14146 2008-07-10 Ian Lance Taylor <iant@google.com>
14147
14148 Handle output sections with more than 0x7fffffff bytes.
14149 * object.h (class Relobj): Change map_to_output_ to
14150 output_sections_, and just keep a section pointer. Change all
14151 uses. Move comdat group support to Sized_relobj.
14152 (Relobj::is_section_specially_mapped): Remove.
14153 (Relobj::output_section): Remove poff parameter. Change all
14154 callers.
14155 (Relobj::output_section_offset): New function.
14156 (Relobj::set_section_offset): Rewrite.
14157 (Relobj::map_to_output): Remove.
14158 (Relobj::output_sections): New function.
14159 (Relobj::do_output_section_offset): New pure virtual function.
14160 (Relobj::do_set_section_offset): Likewise.
14161 (class Sized_relobj): Add section_offsets_ field. Add comdat
14162 group support from Relobj. Update declarations.
14163 (Sized_relobj::get_output_section_offset): New function.
14164 (Sized_relobj::do_output_section_offset): New function.
14165 (Sized_relobj::do_set_section_offset): New function.
14166 * object.cc (Relobj::output_section_address): Remove.
14167 (Sized_relobj::Sized_relobj): Initialize new fields.
14168 (Sized_relobj::include_section_group): Cast find_kept_object to
14169 Sized_relobj.
14170 (Sized_relobj::include_linkonce_section): Likewise.
14171 (Sized_relobj::do_layout): Use separate arrays for output section
14172 and output offset.
14173 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14174 output_sections.
14175 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14176 output_sections and section_offsets.
14177 (Sized_relobj::write_local_symbols): Likewise.
14178 (map_to_kept_section): Compute output address directly.
14179 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14180 output_sections and section_offsets.
14181 (Sized_relobj::write_sections): Likewise.
14182 (Sized_relobj::relocate_sections): Likewise.
14183 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14184 * output.h (class Output_reloc): Update declarations. Change
14185 u2_.relobj to Sized_relobj*.
14186 (class Output_data_reloc): Change add functions to use
14187 Sized_relobj*.
14188 * output.cc (Output_reloc::Output_reloc): Change relobj to
14189 Sized_relobj*.
14190 (Output_reloc::local_section_offset): Change return type to
14191 Elf_Addr. Use get_output_section_offset.
14192 (Output_reloc::get_address): Likewise.
14193 (Output_section::is_input_address_mapped): Don't call
14194 is_section_specially_mapped.
14195 (Output_section::output_offset): Likewise.
14196 (Output_section::output_address): Likewise.
14197 (Output_section::starting_output_address): Likewise.
14198 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14199 parameter to Sized_relobj*.
14200 (Copy_relocs::need_copy_reloc): Likewise.
14201 (Copy_relocs::save): Likewise.
14202 * copy-relocs.h (class Copy_relocs): Update declarations.
14203 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14204 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14205 * target-reloc.h (relocate_for_relocatable): Change
14206 offset_in_output_section type to Elf_Addr. Change code that uses
14207 it as well.
14208 * layout.cc (Layout::layout): Always set *off.
14209 * mapfile.cc (Mapfile::print_input_section): Use
14210 output_section_offset.
14211 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14212 Sized_relobj*.
14213 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14214 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14215 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14216
14217 2008-07-03 Ian Lance Taylor <iant@google.com>
14218
14219 * layout.cc (Layout::include_section): Do not discard unrecognized
14220 SHT_STRTAB sections.
14221
14222 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14223
14224 * script.cc (Lex::can_continue_name): Make '?' allowable in
14225 version-script names.
14226 * testsuite/version_script.map: Change glob pattern to use '?'
14227
14228 2008-06-30 Manish Singh <yosh@gimp.org>
14229
14230 PR 6585
14231 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14232 Correct typo.
14233
14234 2008-06-30 Ian Lance Taylor <iant@google.com>
14235
14236 PR 6660
14237 PR 6682
14238 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14239 versions]: Don't try to read the value in the contents, since we
14240 don't use it. Use the template endianness when writing.
14241
14242 2008-06-25 Cary Coutant <ccoutant@google.com>
14243
14244 * fileread.cc (File_read::make_view): Assert on zero-length view.
14245 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14246 symbol table when there are no symbols to read.
14247
14248 2008-06-23 Craig Silverstein <csilvers@google.com>
14249
14250 * version.cc (version_string): Bump to 1.7
14251
14252 2008-06-18 Craig Silverstein <csilvers@google.com>
14253
14254 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14255 constant 0xFFFF to type Valtype.
14256 (Powerpc_relocate_functions::rel16_ha): Likewise.
14257
14258 2008-06-17 Ian Lance Taylor <iant@google.com>
14259
14260 * output.h (Output_section::Input_section): Initialize p2align_ to
14261 zero for Output_section_data constructors.
14262 (Output_section::Input_section::addralign): If not an input
14263 section, return the alignment of the Output_section_data.
14264 * testsuite/copy_test.cc: New file.
14265 * testsuite/copy_test_1.cc: New file.
14266 * testsuite/copy_test_2.cc: New file.
14267 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14268 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14269 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14270 (copy_test_1_pic.o, copy_test_1.so): New targets.
14271 (copy_test_2_pic.o, copy_test_2.so): New targets.
14272 * testsuite/Makefile.in: Rebuild.
14273
14274 * script-sections.cc (Script_sections::place_orphan): Initialize
14275 local variable exact.
14276
14277 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14278
14279 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14280
14281 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14282 David S. Miller <davem@davemloft.net>
14283
14284 * powerpc.cc: New file.
14285 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14286 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14287 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14288 * Makefile.in: Rebuild.
14289
14290 2008-06-09 Ian Lance Taylor <iant@google.com>
14291
14292 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14293 <exception>.
14294 (throwing, orig_terminate): New static variables.
14295 (terminate_handler): New static function.
14296 (t2): Set terminate handler.
14297
14298 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14299
14300 PR 6584
14301 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14302 alignment.
14303
14304 2008-05-30 Cary Coutant <ccoutant@google.com>
14305
14306 * archive.cc (Archive::include_all_members) Correct to step
14307 over symbol table and extended name table in thin archives.
14308
14309 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14310
14311 PR 6407
14312 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14313 calculation.
14314
14315 2008-05-28 Caleb Howe <cshowe@google.com>
14316
14317 * reduced_debug_output.cc: New file.
14318 * reduced_debug_output.h: New file.
14319 * options.h (class General_options): Add --strip-debug-non-line.
14320 * options.cc (General_options::finalize): Add strip_debug_non_line
14321 to the strip heirarchy.
14322 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14323 fields.
14324 * layout.cc: Include "reduced_debug_output.h".
14325 (Layout::Layout): Initialize new fields.
14326 (line_only_debug_sections): New static array.
14327 (is_lines_only_debug_sections): New static inline function.
14328 (Layout::include_section): Handle --strip-debug-non-line.
14329 (Layout::make_output_section): If --strip-debug-non-line, build
14330 new output sections for .debug_abbrev and .debug_info.
14331 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14332 gold. Warn about possible overflow.
14333 (read_signed_LEB_128): Likewise.
14334 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14335 (read_signed_LEB_128): Declare.
14336 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14337 (HFILES): Add reduced_debug_output.h.
14338 * Makefile.in: Rebuild.
14339
14340 2008-05-21 Ian Lance Taylor <iant@google.com>
14341
14342 * mapfile.cc: New file.
14343 * mapfile.h: New file.
14344 * options.h (class General_options): Add -M/--print-map and -Map.
14345 * options.cc (General_options::finalize): Make -M equivalent to
14346 -Map -.
14347 * main.cc: Include <cstdio> and "mapfile.h".
14348 (main): Open mapfile if requested.
14349 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14350 constructor. Change caller.
14351 (queue_initial_tasks): Add mapfile parameter. Change caller.
14352 (queue_middle_tasks): Likewise.
14353 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14354 declarations.
14355 * archive.cc: Include "mapfile.h".
14356 (Archive::add_symbols): Add mapfile parameter. Change all
14357 callers. Pass mapfile, symbol, and reason to include_member.
14358 (Archive::include_all_members): Add mapfile parameter. Change all
14359 callers.
14360 (Archive::include_member): Add mapfile, sym, and why parameters.
14361 Change all callers. Report inclusion to map file.
14362 * archive.h: Include "fileread.h".
14363 (class Archive): Update declarations.
14364 (Archive::file): New const method.
14365 (class Add_archive_symbols): Add mapfile_ field. Update
14366 constructor. Change all callers.
14367 * readsyms.h (class Read_symbols): Likewise.
14368 (class Finish_group): Likewise.
14369 (class Read_script): Likewise.
14370 * common.cc: Include "mapfile.h".
14371 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14372 all callers.
14373 (Symbol_table::do_allocate_commons): Likewise.
14374 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14375 symbol allocation to mapfile.
14376 * common.h (class Allocate_commons_task): Add mapfile_ field.
14377 Update constructor. Change all callers.
14378 * symtab.h (class Symbol_table): Update declarations.
14379 * layout.cc: Include "mapfile.h".
14380 (Layout_task_runner::run): Print information to mapfile.
14381 (Layout::create_gold_note): Change Output_data_fixed_space to
14382 Output_data_zero_fill.
14383 (Layout::create_build_id): Likewise.
14384 (Layout::print_to_mapfile): New function.
14385 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14386 constructor. Change caller.
14387 (class Layout): Declare print_to_mapfile.
14388 * output.cc (Output_section::Input_section::print_to_mapfile): New
14389 function.
14390 (Output_section::add_input_section): If producing a map, always
14391 add to input_sections_ list.
14392 (Output_section::do_print_to_mapfile): New function.
14393 (Output_segment::print_sections_to_mapfile): New function.
14394 (Output_segment::print_section_list_to_mapfile): New function.
14395 * output.h: Include "mapfile.h".
14396 (Output_data::print_to_mapfile): New function.
14397 (Output_data::do_print_to_mapfile): New virtual function.
14398 (Output_segment_headers::do_print_to_mapfile): New function.
14399 (Output_file_header::do_print_to_mapfile): New function.
14400 (Output_data_const::do_print_to_mapfile): New function.
14401 (class Output_data_const_buffer): Add map_name_ field. Update
14402 constructor. Change all callers. Add do_print_to_mapfile
14403 function.
14404 (class Output_data_fixed_space): Likewise.
14405 (class Output_data_space): Likewise.
14406 (class Output_data_zero_fill): New class.
14407 (Output_data_strtab::do_print_to_mapfile): New function.
14408 (Output_data_reloc_base::do_print_to_mapfile): New function.
14409 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14410 (Output_data_group::do_print_to_mapfile): New function.
14411 (Output_data_got::do_print_to_mapfile): New function.
14412 (Output_data_dynamic::do_print_to_mapfile): New function.
14413 (Output_symtab_xindex::do_print_to_mapfile): New function.
14414 (class Output_section): Declare do_print_to_mapflie. Declare
14415 print_to_mapfile in Input_section.
14416 (class Output_segment): Declare new functions.
14417 * object.h (Sized_relobj::symbol_count): New function.
14418 * script-sections.cc
14419 (Output_section_element_dot_assignment::set_section_addresses):
14420 Change Output_data_fixed_space to Output_data_zero_fill.
14421 (Output_data_expression::do_print_to_mapfile): New function.
14422 * script.cc (read_input_script): Add mapfile parameter. Change
14423 all callers.
14424 * script.h (read_input_script): Update declaration.
14425 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14426 (Eh_frame::do_print_to_mapfile): New function.
14427 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14428 (Output_merge_string::do_print_to_mapfile): New function.
14429 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14430 function.
14431 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14432 function.
14433 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14434 function.
14435 * Makefile.am (CCFILES): Add mapfile.cc.
14436 (HFILES): Add mapfile.h.
14437 * Makefile.in: Rebuild.
14438
14439 2008-05-19 Ian Lance Taylor <iant@google.com>
14440
14441 * options.h (class General_options): Add -z relro.
14442 * layout.cc (Layout::Layout): Initialize relro_segment_.
14443 (Layout::add_output_section_data): Return the output section.
14444 (Layout::make_output_section): Rcognize relro sections and mark
14445 them appropriately.
14446 (Layout::attach_allocated_section_to_segment): Put relro sections
14447 in a PT_GNU_RELRO segment.
14448 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14449 section as relro.
14450 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14451 PT_TLS segments.
14452 (Layout::linkonce_mapping): Map d.rel.ro.local to
14453 .data.rel.ro.local.
14454 (Layout::output_section_name): Us .data.rel.ro.local for any
14455 section which begins with that.
14456 * layout.h (class Layout): Update add_output_section_data
14457 declaration. Add relro_segment_ field.
14458 * output.cc (Output_section::Output_section): Initialize is_relro_
14459 and is_relro_local_ fields.
14460 (Output_segment::add_output_section): Group relro sections.
14461 (Output_segment::is_first_section_relro): New function.
14462 (Output_segment::maximum_alignment): If there is a relro section,
14463 align the segment to the common page size.
14464 (Output_segment::set_section_addresses): Track whether we are
14465 looking at relro sections. If the last section is a relro
14466 section, align to the common page size.
14467 (Output_segment::set_section_list_addresses): Add in_relro
14468 parameter. Change all callers. Align to the page size when
14469 moving from relro to non-relro section.
14470 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14471 segment.
14472 * output.h (class Output_section): Add is_relro_ and
14473 is_relro_local_ fields.
14474 (Output_section::is_relro): New function.
14475 (Output_section::set_is_relro): New function.
14476 (Output_section::is_relro_local): New function.
14477 (Output_section::set_is_relro_local): New function.
14478 (class Output_segment): Update declarations.
14479 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14480 * sparc.cc (Target_sparc::got_section): Likewise.
14481 * x86_64.cc (Target_x86_64::got_section): Likewise.
14482 * testsuite/relro_test_main.cc: New file.
14483 * testsuite/relro_test.cc: New file.
14484 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14485 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14486 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14487 (relro_test.so, relro_test_pic.o): New targets.
14488 * testsuite/Makefile.in: Rebuild.
14489
14490 2008-05-16 Ian Lance Taylor <iant@google.com>
14491
14492 * output.cc (Output_segment::add_output_section): Remove front
14493 parameter.
14494 * output.h (class Output_segment): Remove
14495 add_initial_output_section and overloaded add_output_section.
14496 Update declaration of remaining add_output_section.
14497 * layout.cc (Layout::create_interp): Call add_output_section
14498 rather than add_initial_output_section.
14499 (Layout::finish_dynamic_section): Likewise.
14500
14501 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14502 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14503 know the dynamic type.
14504 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14505 field. Initialize it in constructor.
14506 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14507 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14508 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14509 reloc.
14510
14511 * output.cc (Output_reloc::get_address): Change return type to
14512 Elf_Addr.
14513 * output.h (class Output_reloc): Update get_address declaration.
14514 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14515 for section addresses.
14516
14517 2008-05-09 Ian Lance Taylor <iant@google.com>
14518
14519 PR 6493
14520 * gold.cc (gold_nomem): Use return value of write.
14521
14522 2008-05-08 Ian Lance Taylor <iant@google.com>
14523
14524 * symtab.c (Symbol::init_base_output_data): Add version
14525 parameter. Change all callers.
14526 (Symbol::init_base_output_segment): Likewise.
14527 (Symbol::init_base_constant): Likewise.
14528 (Symbol::init_base_undefined): Likewise.
14529 (Sized_symbol::init_output_data): Likewise.
14530 (Sized_symbol::init_output_segment): Likewise.
14531 (Sized_symbol::init_constant): Likewise.
14532 (Sized_symbol::init_undefined): Likewise.
14533 (Symbol_table::do_define_in_output_data): If the new symbol has a
14534 version, mark it as the default.
14535 (Symbol_table::do_define_in_output_segment): Likewise.
14536 (Symbol_table::do_define_as_constant): Likewise.
14537 * symtab.h (class Symbol): Update declarations.
14538 (class Sized_symbol): Likewise.
14539 * resolve.cc (Symbol::override_version): New function.
14540 (Symbol::override_base): Call override_version.
14541 (Symbol::override_base_with_special): Likewise.
14542 * testsuite/ver_script_8.script: New file.
14543 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14544 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14545 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14546 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14547
14548 2008-05-06 Ian Lance Taylor <iant@google.com>
14549
14550 PR 6049
14551 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14552 functions.
14553 (class General_options): Remove existing --undefined, and add
14554 --no-undefined instead. Add new --undefined as synonym for -u.
14555 * archive.cc (Archive::add_symbols): Check whether symbol was
14556 named with -u.
14557 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14558 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14559 all uses. Add IS_UNDEFINED. Update declarations to split
14560 different versions of init_base. Declare init_base_undefined.
14561 (Symbol::is_defined): Handle IS_UNDEFINED.
14562 (Symbol::is_undefined): Likewise.
14563 (Symbol::is_weak_undefined): Call is_undefined.
14564 (Symbol::is_absolute): Handle IS_CONSTANT.
14565 (class Sized_symbol): Update declarations to split different
14566 versions of init. Declare init_undefined.
14567 (class Symbol_table): Declare new functions.
14568 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14569 Change all callers.
14570 (Symbol::init_base_output_data): Likewise.
14571 (Symbol::init_base_output_segment): Likewise.
14572 (Symbol::init_base_constant): Likewise.
14573 (Symbol::init_base_undefined): New function.
14574 (Sized_symbol::init_object): Rename from init. Change all
14575 callers.
14576 (Sized_symbol::init_output_data): Likewise.
14577 (Sized_symbol::init_output_segment): Likewise.
14578 (Sized_symbol::init_constant): Likewise.
14579 (Sized_symbol::init_undefined): New function.
14580 (Symbol_table::add_undefined_symbols_from_command_line): New
14581 function.
14582 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14583 function.
14584 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14585 (Symbol::output_section): Likewise.
14586 (Symbol::set_output_section): Likewise.
14587 (Symbol_table::sized_finalize_symbol): Likewise.
14588 (Symbol_table::sized_write_globals): Likewise.
14589 * resolve.cc (Symbol_table::should_override): Likewise.
14590 (Symbol::override_base_with_special): Likewise.
14591
14592 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14593 symbol, change it to have default visibility.
14594 * testsuite/protected_1.cc: New file.
14595 * testsuite/protected_2.cc: New file.
14596 * testsuite/protected_3.cc: New file.
14597 * testsuite/protected_main_1.cc: New file.
14598 * testsuite/protected_main_2.cc: New file.
14599 * testsuite/protected_main_3.cc: New file.
14600 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14601 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14602 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14603 (protected_1.so): New target.
14604 (protected_1_pic.o, protected_2_pic.o): New targets.
14605 (protected_3_pic.o): New target.
14606 (check_PROGRAMS): Add protected_2.
14607 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14608 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14609 * testsuite/Makefile.in: Rebuild.
14610
14611 * options.h (DEFINE_var): Add set_user_set_##varname__.
14612 (DEFINE_bool_alias): New macro.
14613 (class General_options): Define -Bstatic using DEFINE_bool_alias
14614 rather than DEFINE_special. Add --undefined as an alias for -z
14615 defs.
14616 * options.cc (General_options::parse_Bstatic): Remove.
14617
14618 * options.h (class General_options): Add --fatal-warnings.
14619 * main.cc (main): Implement --fatal-warnings.
14620 * errors.h (Errors::warning_count): New function.
14621
14622 * options.h (class General_options): Add -Bsymbolic-functions.
14623 * symtab.h (Symbol::is_preemptible): Check for
14624 -Bsymbolic-functions.
14625
14626 2008-05-05 Ian Lance Taylor <iant@google.com>
14627
14628 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14629 as noVARNAME rather than no-VARNAME.
14630 (class General_options): Add option -z combreloc.
14631 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14632 get_address.
14633 (Output_reloc::sort_before) [SHT_REL]: New function.
14634 (Output_reloc::sort_before) [SHT_RELA]: New function.
14635 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14636 Sort_relocs_comparison.
14637 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14638 parameter. Change all callers.
14639 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14640 sort_relocs parameter. Change all callers.
14641 * output.cc (Output_reloc::get_address): New function, broken out
14642 of write_rel.
14643 (Output_reloc::write_rel): Call it.
14644 (Output_reloc::compare): New function.
14645 (Output_data_reloc_base::do_write): Optionally sort relocs.
14646
14647 * configure.ac: If targ_extra_obj is set, link it in.
14648 * configure.tgt: Initialize all variables.
14649 (x86_64*): Set targ_extra_obj and targ_extra_size.
14650 * configure: Rebuild.
14651
14652 * object.cc (Sized_relobj::include_section_group): Adjust section
14653 indexes read from group data. Build vector to pass to
14654 layout_group.
14655 * layout.cc (Layout::layout_group): Add flags and shndxes
14656 parameters. Remove contents parameter. Change caller. Update
14657 explicit instantiations.
14658 * layout.h (class Layout): Update layout_group declaration.
14659 * output.cc (Output_data_group::Output_data_group): Add flags and
14660 input_shndxes parameters. Remove contents parameter. Change
14661 caller.
14662 (Output_data_group::do_write): Change input_sections_ to
14663 input_shndxes_.
14664 * output.h (class Output_data_group): Update constructor
14665 declaration. Rename input_sections_ to input_shndxes_.
14666 * testsuite/many_sections_test.cc: Add template.
14667
14668 2008-04-30 Cary Coutant <ccoutant@google.com>
14669
14670 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14671
14672 * layout.cc (Layout::include_section): Refactored check for debug
14673 info section.
14674 (Layout::add_comdat): Add new parameters. Change type
14675 of signature parameter. Add object and shndx to signatures table.
14676 (Layout::find_kept_object): New function.
14677 * layout.h: Include <cstring>.
14678 (Layout::is_debug_info_section): New function.
14679 (Layout::add_comdat): Add new parameters.
14680 (Layout::find_kept_object): New function.
14681 (Layout::Kept_section): New struct.
14682 (Layout::Signatures): Change type of map range.
14683 * object.cc (Relobj::output_section_address): New function.
14684 (Sized_relobj::include_section_group): Add new parameters. Change
14685 calls to Layout::add_comdat. Change to build table of kept comdat
14686 groups and table mapping discarded sections to kept sections.
14687 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14688 (Sized_relobj::do_layout): Change calls to include_section_group and
14689 include_linkonce_section.
14690 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14691 value to zero when section is discarded.
14692 (Sized_relobj::map_to_kept_section): New function.
14693 * object.h (Relobj::output_section_address): New function.
14694 (Relobj::Comdat_group): New type.
14695 (Relobj::find_comdat_group): New function.
14696 (Relobj::Comdat_group_table): New type.
14697 (Relobj::Kept_comdat_section): New type.
14698 (Relobj::Kept_comdat_section_table): New type.
14699 (Relobj::add_comdat_group): New function.
14700 (Relobj::set_kept_comdat_section): New function.
14701 (Relobj::get_kept_comdat_section): New function.
14702 (Relobj::comdat_groups_): New field.
14703 (Relobj::kept_comdat_sections_): New field.
14704 (Symbol_value::input_value): Update comment.
14705 (Sized_relobj::map_to_kept_section) New function.
14706 (Sized_relobj::include_linkonce_section): Add new parameter.
14707 * target-reloc.h (Comdat_behavior): New type.
14708 (get_comdat_behavior): New function.
14709 (relocate_section): Add code to map a discarded section to the
14710 corresponding kept section when applying a relocation.
14711
14712 2008-04-30 Craig Silverstein <csilvers@google.com>
14713
14714 * dwarf_reader.cc (next_generation_count): New static var.
14715 (Addr2line_cache_entry): New struct.
14716 (addr2line_cache): New static var.
14717 (Dwarf_line_info::one_addr2line): Added caching.
14718 (Dwarf_line_info::clear_addr2line_cache): New function.
14719 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14720 cache-size parameter.
14721 (Dwarf_line_info::one_addr2line_cache): New function.
14722 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14723 new cache-size argument to one_addr2line(), and clear cache.
14724
14725 2008-04-28 Cary Coutant <ccoutant@google.com>
14726
14727 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14728 R_386_PC8 relocations.
14729
14730 2008-04-23 Ian Lance Taylor <iant@google.com>
14731
14732 * object.cc (Sized_relobj::include_section_group): Check for
14733 invalid section group.
14734
14735 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14736 header size.
14737
14738 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14739 than read for file header.
14740 * archive.cc (Archive::include_member): Likewise.
14741
14742 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14743
14744 * aclocal.m4: Regenerate.
14745 * configure: Regenerate.
14746
14747 2008-04-19 Ian Lance Taylor <iant@google.com>
14748
14749 * version.cc (version_string): Bump to 1.6.
14750
14751 * testsuite/Makefile.am (many_sections_r_test): New target.
14752 (many_sections_r_test_SOURCES): Remove.
14753 (many_sections_r_test_DEPENDENCIES): Remove.
14754 (many_sections_r_test_LDFLAGS): Remove.
14755 (many_sections_r_test_LDADD): Remove.
14756
14757 * object.cc (Sized_relobj::do_add_symbols): Always pass
14758 local_symbol_count_ to add_from_relobj.
14759
14760 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14761 every thousand variables.
14762 * testsuite/Makefile.in: Rebuild.
14763
14764 * object.cc (Xindex::initialize_symtab_xindex): New function.
14765 (Xindex::read_symtab_xindex): New function.
14766 (Xindex::sym_xindex_to_shndx): New function.
14767 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14768 available.
14769 (Sized_relobj::do_initialize_xindex): New function.
14770 (Sized_relobj::do_read_symbols): Adjust section links.
14771 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14772 parameter. Change all callers.
14773 (Sized_relobj::include_section_group): Adjust section links and
14774 symbol section indexes.
14775 (Sized_relobj::do_layout): Adjust section links.
14776 (Sized_relobj::do_count_local_symbols): Adjust section links and
14777 symbol section indexes.
14778 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14779 ordinary and special symbols.
14780 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14781 dynsym_xindex parameters. Change all callers. Adjust section
14782 links. Use SHN_XINDEX when needed.
14783 (Sized_relobj::get_symbol_location_info): Adjust section links.
14784 Don't get fooled by special symbols.
14785 * object.h (class Xindex): Define.
14786 (class Object): Add xindex_ parameter. Declare virtual functoin
14787 do_initialize_xindex.
14788 (Object::adjust_sym_shndx): New function.
14789 (Object::set_xindex): New protected function.
14790 (class Symbol_value): Add is_ordinary_shndx_ field.
14791 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14792 (Symbol_value::value): Assert ordinary section.
14793 (Symbol_value::initialize_input_to_output_map): Likewise.
14794 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14795 Change all callers.
14796 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14797 all callers.
14798 (class Sized_relobj): Update declarations.
14799 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14800 parameter. Change all callers.
14801 (Sized_relobj::adjust_shndx): New function.
14802 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14803 field.
14804 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14805 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14806 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14807 (Sized_dynobj::read_dynsym_section): Adjust section links.
14808 (Sized_dynobj::read_dynamic): Likewise.
14809 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14810 section links.
14811 (Sized_dynobj::do_initialize_xindex): New function.
14812 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14813 do_initialize_xindex.
14814 (Sized_dynobj::adjust_shndx): New function.
14815 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14816 dynsym_xindex_ fields.
14817 (Layout::finalize): Add a call to set_section_indexes before
14818 creating the symtab sections.
14819 (Layout::set_section_indexes): Don't do anything if the section
14820 already has a section index.
14821 (Layout::create_symtab_sections): Add shnum parameter. Change
14822 caller. Create .symtab_shndx section if needed.
14823 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14824 caller.
14825 (Layout::allocated_output_section_count): New function.
14826 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14827 needed.
14828 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14829 fields. Update declarations.
14830 (Layout::symtab_xindex): New function.
14831 (Layout::dynsym_xindex): New function.
14832 (class Write_symbols_task): Add layout_ field.
14833 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14834 Change caller.
14835 * output.cc (Output_section_headers::Output_section_headers): Add
14836 shstrtab_section parameter. Change all callers.
14837 (Output_section_headers::do_sized_write): Store overflow values
14838 for section count and section string table section index in
14839 section header zero.
14840 (Output_file_header::do_sized_write): Check for overflow of
14841 section count and section string table section index.
14842 (Output_symtab_xindex::do_write): New function.
14843 (Output_symtab_xindex::endian_do_write): New function.
14844 * output.h (class Output_section_headers): Add shstrtab_section_.
14845 Update declarations.
14846 (class Output_symtab_xindex): Define.
14847 (Output_section::has_out_shndx): New function.
14848 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14849 field.
14850 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14851 Change all callers.
14852 (Sized_symbol::init): Likewise.
14853 (Symbol::output_section): Check for ordinary symbol.
14854 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14855 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14856 callers.
14857 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14858 Change all callers. Simplify handling of symbols from sections
14859 not included in the link.
14860 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14861 distinction.
14862 (Weak_alias_sorter::operator()): Assert that symbols are
14863 ordinary.
14864 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14865 distinction.
14866 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14867 parameters. Change all callers.
14868 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14869 symbol distinction. Use SHN_XINDEX when needed.
14870 (Symbol_table::write_section_symbol): Add symtab_xindex
14871 parameter. Change all callers.
14872 (Symbol_table::sized_write_section_symbol): Likewise. Use
14873 SHN_XINDEX when needed.
14874 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14875 declarations.
14876 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14877 (Symbol::is_defined): Check is_ordinary.
14878 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14879 (Symbol::is_absolute, Symbol::is_common): Likewise.
14880 (class Sized_symbol): Update declarations.
14881 (class Symbol_table): Update declarations.
14882 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14883 parameters. Change all callers.
14884 (Sized_symbol::override): Likewise.
14885 (Symbol_table::override): Likewise.
14886 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14887 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14888 is_ordinary, and orig_st_shndx parameters. Change all callers.
14889 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14890 to be in an ordinary section.
14891 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14892 object and is_ordinary parameters. Change all callers.
14893 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14894 Change all callers. Don't add undefined or non-ordinary symbols
14895 to reloc_map_.
14896 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14897 Change all callers.
14898 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14899 declarations.
14900 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14901 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14902 (Sized_relobj::relocate_sections): Likewise.
14903 * target-reloc.h (scan_relocs): Adjust section symbol index.
14904 (scan_relocatable_relocs): Likewise.
14905 * i386.cc (Scan::local): Check for ordinary symbols.
14906 * sparc.cc (Scan::local): Likewise.
14907 * x86_64.cc (Scan::local): Likewise.
14908 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14909 to symbol_section_and_value.
14910 * testsuite/many_sections_test.cc: New file.
14911 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14912 (check_PROGRAMS): Add many_sections_test.
14913 (many_sections_test_SOURCES): Define.
14914 (many_sections_test_DEPENDENCIES): Define.
14915 (many_sections_test_LDFLAGS): Define.
14916 (BUILT_SOURCES): Add many_sections_define.h.
14917 (many_sections_define.h): New target.
14918 (BUILT_SOURCES): Add many_sections_check.h.
14919 (many_sections_check.h): New target.
14920 (check_PROGRAMS): Add many_sections_r_test.
14921 (many_sections_r_test_SOURCES): Define.
14922 (many_sections_r_test_DEPENDENCIES): Define.
14923 (many_sections_r_test_LDFLAGS): Define.
14924 (many_sections_r_test_LDADD): Define.
14925 (many_sections_r_test.o): New target.
14926 * testsuite/Makefile.in: Rebuild.
14927
14928 2008-04-17 Cary Coutant <ccoutant@google.com>
14929
14930 * errors.cc (Errors::info): New function.
14931 (gold_info): New function.
14932 * errors.h (Errors::info): New function.
14933 * gold.h (gold_info): New function.
14934 * object.cc (Input_objects::add_object): Print trace output.
14935 * options.cc (options::parse_set): New function.
14936 (General_options::parse_wrap): Deleted.
14937 (General_options::General_options): Deleted initializer.
14938 * options.h (options::String_set): New typedef.
14939 (options::parse_set): New function.
14940 (DEFINE_set): New macro.
14941 (General_options::wrap): Changed to use DEFINE_set. Changed
14942 callers of any_wrap_symbols and is_wrap_symbol.
14943 (General_options::trace, General_options::trace_symbol):
14944 New options.
14945 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14946 (General_options::wrap_symbols_): Deleted.
14947 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14948
14949 2008-04-17 David S. Miller <davem@davemloft.net>
14950
14951 * options.cc (General_options::parse_V): New function.
14952 * options.h: Add entries for -V and -Qy.
14953
14954 2008-04-17 Ian Lance Taylor <iant@google.com>
14955
14956 * common.cc (Symbol_table::allocate_commons): Remove options
14957 parameter. Change caller.
14958 (Symbol_table::do_allocate_commons): Remove options parameter.
14959 Change caller. Just call do_allocate_commons_list twice.
14960 (Symbol_table::do_allocate_commons_list): New function, broken out
14961 of do_allocate_commons.
14962 * common.h (class Allocate_commons_task): Remove options_ field.
14963 Update constructor.
14964 * symtab.cc (Symbol_table::Symbol_table): Initialize
14965 tls_commons_.
14966 (Symbol_table::add_from_object): Put TLS common symbols on
14967 tls_commons_ list.
14968 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14969 which are IN_OUTPUT_DATA.
14970 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14971 allocate_commons and do_allocate_commons declarations. Declare
14972 do_allocate_commons_list.
14973 * gold.cc (queue_middle_tasks): Update creation of
14974 Allocate_commons_task to not pass options.
14975 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14976 (TLS_TEST_C_FLAGS): New variable.
14977 (tls_test_c_pic.o): New target.
14978 (tls_test_shared.so): Link in tls_test_c_pic.o.
14979 (tls_test_c_pic_ie.o): New target.
14980 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14981 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14982 (tls_test_c.o): New target.
14983 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14984 (tls_pic_test_LDADD): Likewise.
14985 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14986 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14987 (tls_test_c_gnu2.o): New target.
14988 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14989 tls_test_c_gnu2.o.
14990 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14991 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14992 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14993 * testsuite/tls_test.cc: Include "config.h".
14994 (t_last): Call t11_last.
14995 * testsuite/tls_test.h (t11, t11_last): Declare.
14996 * testsuite/tls_test_c.c: New file.
14997 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14998 * configure.ac: Check for OpenMP support.
14999 * configure, config.in, Makefile.in: Rebuild.
15000 * testsuite/Makefile.in: Rebuild.
15001
15002 2008-04-16 Cary Coutant <ccoutant@google.com>
15003
15004 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15005 (Target_i386::tls_base_symbol_defined_): New field.
15006 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15007 (Target_i386::Scan::global): Likewise.
15008 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15009 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15010 (Target_x86_64::tls_base_symbol_defined_): New field.
15011 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15012 (Target_x86_64::Scan::global): Likewise.
15013
15014 2008-04-16 Cary Coutant <ccoutant@google.com>
15015
15016 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15017 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15018 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15019 building shared libraries.
15020 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15021 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15022 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15023 * testsuite/Makefile.in: Rebuild.
15024 * testsuite/weak_undef.h: New file.
15025 * testsuite/weak_undef_file1.cc: Add extra test cases.
15026 * testsuite/weak_undef_file2.cc: Likewise.
15027 * testsuite/weak_undef_test.cc: Likewise.
15028
15029 2008-04-16 David S. Miller <davem@davemloft.net>
15030
15031 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15032 Add issued_non_pic_error_ field. Declare check_non_pic.
15033 (Target_sparc::Scan::check_non_pic): New function.
15034 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15035 (Target_sparc::Scan::global): Likewise.
15036
15037 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15038 * configure: Rebuild.
15039
15040 * options.h (DEFINE_enable): New macro.
15041 (new_dtags): New enable option.
15042 (initfirst, interpose, loadfltr, nodefaultlib,
15043 nodelete, nodlopen, nodump): New -z options.
15044 * layout.cc (Layout:finish_dynamic_section): If new
15045 dtags enabled, emit DT_RUNPATH. Also, emit a
15046 DT_FLAGS_1 containing any specified -z flags.
15047
15048 2008-04-16 Ian Lance Taylor <iant@google.com>
15049
15050 * copy-relocs.cc: New file.
15051 * copy-relocs.h: New file.
15052 * reloc.cc: Remove Copy_relocs code.
15053 * reloc.h: Likewise.
15054 * reloc-types.h (struct Reloc_types) [both versions]: Add
15055 get_reloc_addend_noerror.
15056 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15057 variants of add_global which take an addend which must be zero.
15058 * i386.cc: Include "copy-relocs.h".
15059 (class Target_i386): Change type of copy_relocs_ to variable,
15060 update initializer.
15061 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15062 Change all callers.
15063 (Target_i386::do_finalize_sections): Change handling of
15064 copy_relocs_.
15065 * sparc.cc: Include "copy-relocs.h".
15066 (class Target_sparc): Change type of copy_relocs_ to variable,
15067 update initializer.
15068 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15069 Change all callers.
15070 (Target_sparc::do_finalize_sections): Change handling of
15071 copy_relocs_.
15072 * x86_64.cc: Include "copy-relocs.h".
15073 (class Target_x86_64): Change type of copy_relocs_ to variable,
15074 update initializer.
15075 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15076 class. Change all callers.
15077 (Target_x86_64::do_finalize_sections): Change handling of
15078 copy_relocs_.
15079 * Makefile.am (CCFILES): Add copy-relocs.cc.
15080 (HFILES): Add copy-relocs.h.
15081
15082 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15083
15084 * testsuite/script_test_4.sh: Permit leading zeroes.
15085
15086 2008-04-15 Ian Lance Taylor <iant@google.com>
15087
15088 * script-sections.cc (Script_sections::create_segments): Use
15089 header_size_adjustment even when there is enough room for the
15090 headers.
15091 * testsuite/script_test_4.sh: New file.
15092 * testsuite/script_test_4.t: New file.
15093 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15094 (check_DATA): Add script_test_4.stdout.
15095 (MOSTLYCLEANFILES): Likewise.
15096 (script_test_4): New target.
15097 (script_test_4.stdout): New target.
15098 * testsuite/Makefile.in: Rebuild.
15099
15100 * sparc.cc: Add definitions for Output_data_plt_sparc class
15101 constants.
15102
15103 2008-04-14 David S. Miller <davem@davemloft.net>
15104
15105 * sparc.cc: New file.
15106 * Makefile.am (TARGETSOURCES): Add sparc.cc
15107 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15108 * configure.tgt: Document targ_extra_size and
15109 targ_extra_big_endian. Add entries for sparc-* and
15110 sparc64-*.
15111 * configure.ac: Handle targ_extra_size and
15112 targ_extra_big_endian.
15113 * Makefile.in: Rebuild.
15114 * configure: Likewise.
15115 * po/POTFILES.in: Likewise.
15116 * po/gold.pot: Likewise.
15117
15118 2008-04-14 Ian Lance Taylor <iant@google.com>
15119
15120 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15121 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15122 in the name/type/flags to section mapping. Don't call
15123 allocate_output_section.
15124 (Layout::choose_output_section): Change parameter from adjust_name
15125 to is_input_section. Don't permit input sections after sections
15126 are attached to segments. Don't call allocate_output_section.
15127 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15128 not write_enable_output_section.
15129 (Layout::make_output_section): Don't push to
15130 unattached_section_list_ nor call attach_to_segment. Call
15131 attach_section_to_segment if sections are attached.
15132 (Layout::attach_sections_to_segments): New function.
15133 (Layout::attach_section_to_segment): New function.
15134 (Layout::attach_allocated_section_to_segment): Rename from
15135 attach_to_segment. Remove flags parameter.
15136 (Layout::allocate_output_section): Remove function.
15137 (Layout::write_enable_output_section): Remove function.
15138 * layout.h (class Layout): Update for above changes. Add new
15139 field sections_are_attached_.
15140 * output.h (Output_section::update_flags_for_input_section): New
15141 function.
15142 * output.cc (Output_section::add_input_section): Call
15143 update_flags_for_input_section.
15144 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15145
15146 2008-04-11 Cary Coutant <ccoutant@google.com>
15147
15148 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15149 thought unnecessary.
15150 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15151
15152 2008-04-11 Ian Lance Taylor <iant@google.com>
15153
15154 * output.h (class Output_section_data): Remove inline definition
15155 of set_addralign.
15156 * output.cc (Output_section_data::set_addralign): New function.
15157
15158 2008-04-11 Cary Coutant <ccoutant@google.com>
15159
15160 Add support for TLS descriptors for i386 and x86_64.
15161 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15162 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15163 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15164 GOT_TYPE_TLS_DESC.
15165 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15166 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15167 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15168 relocations.
15169 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15170 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15171 Fix problem with initial-exec relocations.
15172 (Target_i386::Relocate::relocate_tls): Likewise.
15173 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15174 relaxation.
15175 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15176 support for section-plus-offset dynamic table entries.
15177 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15178 (Output_data_dynamic::Dynamic_entry): Add support for
15179 section-plus-offset dynamic table entries.
15180 (Output_data_dynamic::Classification): Likewise.
15181 (Output_data_dynamic::classification_): Renamed offset_.
15182 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15183 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15184 (Target_x86_64::make_plt_section): New function.
15185 (Target_x86_64::reserve_tlsdesc_entries): New function.
15186 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15187 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15188 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15189 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15190 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15191 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15192 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15193 add extra PLT entry for TLS descriptors.
15194 (Output_data_plt_x86_64::got_): New field.
15195 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15196 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15197 fields.
15198 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15199 descriptors.
15200 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15201 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15202 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15203 R_386_TLS_DESC_CALL relocations.
15204 (Target_x86_64::Scan::global): Likewise.
15205 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15206 for TLS descriptors.
15207 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15208 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15209 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15210 GD-to-IE relaxation.
15211 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15212 and TLS_DESCRIPTORS.
15213 * Makefile.in: Rebuild.
15214 * configure: Rebuild.
15215 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15216 (tls_test_shared2.so): New target.
15217 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15218 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15219 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15220 (tls_shared_gd_to_ie_test_LDADD): New variable.
15221 (tls_shared_gnu2_gd_to_ie_test): New target.
15222 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15223 New targets.
15224 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15225 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15226 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15227 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15228 (tls_shared_gnu2_test): New target.
15229 (tls_test_gnu2_shared.so): New target.
15230 (tls_shared_gnu2_test_SOURCES): New variable.
15231 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15232 (tls_shared_gnu2_test_LDFLAGS): New variable.
15233 (tls_shared_gnu2_test_LDADD): New variable.
15234 * testsuite/Makefile.in: Rebuild.
15235 * testsuite/Makefile.
15236
15237 2008-04-11 Ian Lance Taylor <iant@google.com>
15238
15239 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15240 justsyms.t.
15241 * testsuite/Makefile.in: Rebuild.
15242
15243 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15244 long.
15245 * testsuite/script_test_2.cc (main): Adjust test.
15246
15247 2008-04-11 David S. Miller <davem@davemloft.net>
15248 Ian Lance Taylor <iant@google.com>
15249
15250 * options.h (General_options): Add entries for '-Y' and
15251 '-relax'.
15252 * options.cc (General_options:finalize): If -Y was used, add those
15253 entries to the library path instead of the default "/lib" and
15254 "/usr/lib".
15255
15256 2008-04-11 David S. Miller <davem@davemloft.net>
15257
15258 * testsuite/justsyms.t: Start at 0x100.
15259 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15260 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15261 long.
15262 * testsuite/script_test_2.cc: Adjust string and section length
15263 checks.
15264
15265 2008-04-09 Ian Lance Taylor <iant@google.com>
15266
15267 PR gold/5996
15268 * script-sections.cc (Sections_element::allocate_to_segment): Add
15269 orphan parameter.
15270 (Output_section_definition::allocate_to_segment): Likewise.
15271 (Orphan_output_section::allocate_to_segment): Likewise.
15272 (Script_sections::attach_sections_using_phdrs_clause): Don't
15273 propagate non-PT_LOAD segments to orphan sections.
15274 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15275 readelf rather than objdump.
15276 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15277 .interp section and PT_INTERP segment are the same size.
15278 * testsuite/Makefile.in: Rebuild.
15279
15280 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15281 aliases for symbols defined in the same object.
15282 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15283 (weak_alias_test_SOURCES): New variable.
15284 (weak_alias_test_DEPENDENCIES): New variable.
15285 (weak_alias_test_LDFLAGS): New variable.
15286 (weak_alias_test_LDADD): New variable.
15287 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15288 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15289 (weak_alias_test_3.o): New target.
15290 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15291 * testsuite/weak_alias_test_main.cc: New file.
15292 * testsuite/weak_alias_test_1.cc: New file.
15293 * testsuite/weak_alias_test_2.cc: New file.
15294 * testsuite/weak_alias_test_3.cc: New file.
15295
15296 2008-04-08 Ian Lance Taylor <iant@google.com>
15297
15298 * options.h (class General_options): Add --noinhibit-exec option.
15299 * main.cc (main): Check --noinhibit-exec.
15300
15301 * options.h (class General_options): Define --wrap as a special
15302 option. Add wrap_symbols_ field.
15303 (General_options::any_wrap_symbols): New function.
15304 (General_options::is_wrap_symbol): New function.
15305 * options.cc (General_options::parse_wrap): New function.
15306 (General_options::General_options): Initialize wrap_symbols_.
15307 * symtab.cc (Symbol_table::wrap_symbol): New function.
15308 (Symbol_table::add_from_object): Handle --wrap.
15309 * symtab.h (class Symbol_table): Declare wrap_symbol.
15310 * target.h (Target::wrap_char): New function.
15311 (Target::Target_info): Add wrap_char field.
15312 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15313 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15314 * testsuite/testfile.cc (Target_test::test_target_info):
15315 Likewise.
15316
15317 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15318 there is one.
15319
15320 * layout.h (class Layout): Add added_eh_frame_data_ field.
15321 * layout.cc (Layout::Layout): Initialize new field.
15322 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15323 output section until we find a section we merged successfully.
15324 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15325 that the size be non-zero.
15326
15327 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15328 qualifier.
15329
15330 2008-04-08 Craig Silverstein <csilvers@google.com>
15331
15332 * configure.ac: Export new conditional variable HAVE_ZLIB.
15333 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15334 on HAVE_ZLIB.
15335 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15336 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15337
15338 2008-04-07 Ian Lance Taylor <iant@google.com>
15339
15340 * version.cc (version_string): Set to "1.5".
15341
15342 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15343 Add issued_non_pic_error_ field. Declare check_non_pic.
15344 (Target_x86_64::Scan::check_non_pic): New function.
15345 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15346 (Target_x86_64::Scan::global): Likewise.
15347
15348 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15349 addend parameter. Change caller. Handle merge sections.
15350 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15351 Address to Addend. Don't add in the result of
15352 local_section_offset, pass down the addend and use the returned
15353 value.
15354 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15355 Update declarations of local_section_offset and symbol_value.
15356 * testsuite/two_file_test_1.cc (t18): New function.
15357 * testsuite/two_file_test_2.cc (f18): New function.
15358 * testsuite/two_file_test_main.cc (main): Call t18.
15359 * testsuite/two_file_test.h (t18, f18): Declare.
15360
15361 * configure.ac: Don't test for objdump, c++filt, or readelf.
15362 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15363 conditionals.
15364 (TEST_READELF): New variable.
15365 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15366 (check_PROGRAMS): Add two_file_strip_test.
15367 (two_file_strip_test): New target.
15368 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15369 (two_file_same_shared_strip_test_SOURCES): New variable.
15370 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15371 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15372 (two_file_same_shared_strip_test_LDADD): New variable.
15373 (two_file_shared_strip.so): New target.
15374 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15375 (ver_test_5.syms, ver_test_7.syms): Likewise.
15376 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15377 (strip_test_3.stdout): Use TEST_OBJDUMP.
15378 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15379
15380 2008-04-04 Cary Coutant <ccoutant@google.com>
15381
15382 * symtab.h (Symbol::is_weak_undefined): New function.
15383 (Symbol::is_strong_undefined): New function.
15384 (Symbol::is_absolute): New function.
15385 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15386 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15387 absolute symbols.
15388 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15389 (weak_undef_test): New target.
15390 * testsuite/Makefile.in: Rebuild.
15391 * testsuite/weak_undef_file1.cc: New file.
15392 * testsuite/weak_undef_file2.cc: New file.
15393 * testsuite/weak_undef_test.cc: New file.
15394
15395 2008-04-03 Craig Silverstein <csilvers@google.com>
15396
15397 * compressed_output.h (class Output_compressed_section): Use
15398 unsigned buffer.
15399 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15400 add zlib header.
15401 (zlib_compressed_suffix): Removed.
15402 (Output_compressed_section::set_final_data_size): Use unsigned
15403 buffers.
15404 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15405 Fix linker invocation.
15406 (flagstest_o_specialfile_and_compress_debug_sections):
15407 Likewise.
15408 * testsuite/Makefile.in: Regenerated.
15409
15410 2008-04-02 David S. Miller <davem@davemloft.net>
15411
15412 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15413 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15414
15415 2008-04-02 Craig Silverstein <csilvers@google.com>
15416
15417 * TODO: New file.
15418
15419 2008-04-02 Ian Lance Taylor <iant@google.com>
15420
15421 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15422 parameters. Update for new key type to views_. Change all
15423 callers.
15424 (File_read::read): Adjust for byteshift in returned view.
15425 (File_read::add_view): New function, broken out of
15426 find_and_make_view.
15427 (File_read::make_view): New function, broken out of
15428 find_and_make_view.
15429 (File_read::find_or_make_view): Add offset and aligned
15430 parameters. Rewrite accordingly. Change all callers.
15431 (File_read::get_view): Add offset and aligned parameters. Adjust
15432 for byteshift in return value.
15433 (File_read::get_lasting_view): Likewise.
15434 * fileread.h (class File_read): Update declarations.
15435 (class File_read::View): Add byteshift_ field. Add byteshift to
15436 constructor. Add byteshift method.
15437 * archive.h (Archive::clear_uncached_views): New function.
15438 (Archive::get_view): Add aligned parameter. Change all callers.
15439 * object.h (Object::get_view): Add aligned parameter. Change all
15440 callers.
15441 (Object::get_lasting_view): Likewise.
15442
15443 * fileread.cc (File_read::release): Don't call clear_views if
15444 there are multiple objects.
15445 * fileread.h (File_read::clear_uncached_views): New function.
15446 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15447 on the archive.
15448
15449 2008-03-31 Cary Coutant <ccoutant@google.com>
15450
15451 Add thin archive support.
15452 * archive.cc (Archive::armagt): New const.
15453 (Archive::setup): Remove task parameter and calls to unlock.
15454 (Archive::unlock_nested_archives): New function.
15455 (Archive::read_header): Add nested_off parameter. Change
15456 all callers.
15457 (Archive::interpret_header): Likewise.
15458 (Archive::include_all_members): Change to handle thin
15459 archives.
15460 (Archive::include_member): Likewise.
15461 * archive.h (Archive::Archive): Add new parameters and
15462 initializers.
15463 (Archive::armagt): New const.
15464 (Archive::setup): Remove task parameter.
15465 (Archive::unlock_nested_archives): New function.
15466 (Archive::read_header): Add nested_off parameter.
15467 (Archive::interpret_header): Likewise.
15468 (Archive::Nested_archive_table): New typedef.
15469 (Archive::is_thin_archive_): New field.
15470 (Archive::nested_archives_): New field.
15471 (Archive::options_): New field.
15472 (Archive::dirpath_): New field.
15473 (Archive::task_): New field.
15474 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15475 for thin archives. Pass additional parameters to
15476 Archive::Archive. Unlock the archive file after calling
15477 Archive::setup.
15478
15479 2008-03-29 Ian Lance Taylor <iant@google.com>
15480
15481 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15482 version symbol to be local.
15483 * testsuite/ver_test_4.sh: New file.
15484 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15485 (check_DATA): Add ver_test_4.syms.
15486 (ver_test_4.syms): New target.
15487 * testsuite/Makefile.in: Rebuild.
15488
15489 * output.cc
15490 (Output_section::Input_section_sort_entry::has_priority): New
15491 function.
15492 (Output_section::Input_section_sort_entry::match_file_name): New
15493 function.
15494 (Output_section::Input_section_sort_entry::match_section_name):
15495 Remove.
15496 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15497 Remove.
15498 (Output_section::Input_section_sort_entry::match_section_file):
15499 Remove.
15500 (Output_section::Input_section_sort_compare::operator()): Rewrite
15501 using new Input_section_sort_entry functions. Sort crtbegin and
15502 crtend first. Sort sections with no priority before sections with
15503 a priority.
15504 * testsuite/initpri1.c (d3): Check j != 4.
15505 (cd5): New constructor/destructor function.
15506 (main): Check j != 2.
15507
15508 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15509 new symbol when resolving, don't call set_is_default.
15510 * testsuite/ver_test_7.cc: New file.
15511 * testsuite/ver_test_7.sh: New file.
15512 * testsuite/Makefile.am (ver_test_7.so): New target.
15513 (ver_test_7.o): New target.
15514 (check_SCRIPTS): Add ver_test_7.sh.
15515 (check_DATA): Add ver_test_7.syms.
15516 (ver_test_7.syms): New target.
15517
15518 2008-03-28 Ian Lance Taylor <iant@google.com>
15519
15520 * layout.cc (Layout::layout): If we see an input section with a
15521 name that needs sorting, set the must_sort flag for the output
15522 section.
15523 (Layout::make_output_section): If the name of the output section
15524 indicates that it might require sorting, set the may_sort flag.
15525 * output.h (Output_section::may_sort_attached_input_sections): New
15526 function.
15527 (Output_section::set_may_sort_attached_input_sections): New
15528 function.
15529 (Output_section::must_sort_attached_input_sections): New
15530 function.
15531 (Output_section::set_must_sort_attached_input_sections): New
15532 function.
15533 (class Output_section): Declare Input_section_sort_entry. Define
15534 Input_section_sort_compare. Declare
15535 sort_attached_input_sections. Add new fields:
15536 may_sort_attached_input_sections_,
15537 must_sort_attached_input_sections_,
15538 attached_input_sections_are_sorted_.
15539 * output.cc (Output_section::Output_section): Initialize new
15540 fields.
15541 (Output_section::add_input_section): Add an entry to
15542 input_sections_ if may_sort or must_sort are true.
15543 (Output_section::set_final_data_size): Call
15544 sort_attached_input_sections if necessary.
15545 (Output_section::Input_section_sort_entry): Define new class.
15546 (Output_section::Input_section_sort_compare::operator()): New
15547 function.
15548 (Output_section::sort_attached_input_sections): New function.
15549 * configure.ac: Check whether the compiler supports constructor
15550 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15551 * testsuite/initpri1.c: New file.
15552 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15553 CONSTRUCTOR_PRIORITY.
15554 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15555 (initpri1_LDFLAGS): New variable.
15556 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15557
15558 2008-03-27 Ian Lance Taylor <iant@google.com>
15559
15560 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15561 * testsuite/common_test_1.c: New file.
15562 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15563 (common_test_1_SOURCES): New variable.
15564 (common_test_1_DEPENDENCIES): New variable.
15565 (common_test_1_LDFLAGS): New variable.
15566
15567 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15568 and commons_ correctly when NAME/VERSION does not override
15569 NAME/NULL.
15570 * testsuite/ver_test_6.c: New file.
15571 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15572 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15573 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15574
15575 2008-03-26 Ian Lance Taylor <iant@google.com>
15576
15577 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15578 of an undefined symbol from a version script.
15579 * testsuite/Makefile.am (ver_test_5.so): New target.
15580 (ver_test_5.o): New target.
15581 (check_SCRIPTS): Add ver_test_5.sh.
15582 (check_DATA): Add ver_test_5.syms.
15583 (ver_test_5.syms): New target.
15584 * testsuite/ver_test_5.cc: New file.
15585 * testsuite/ver_test_5.script: New file.
15586 * testsuite/ver_test_5.sh: New file.
15587 * Makefile.in, testsuite/Makefile.in: Rebuild.
15588
15589 PR gold/5986
15590 Fix problems building gold with gcc 4.3.0.
15591 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15592 (gold_error_at_location, gold_warning_at_location): Use it.
15593 * configure.ac: Check whether we can compile and use a template
15594 function with a printf attribute.
15595 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15596 when jumping over bytes.
15597 * object.cc: Instantiate Object::read_section_data.
15598 * debug.h: Include <cstring>
15599 * dwarf_reader.cc: Include <algorithm>
15600 * main.cc: Include <cstring>.
15601 * options.cc: Include <cstring>.
15602 * output.cc: Include <cstring>.
15603 * script.cc: Include <cstring>.
15604 * script.h: Include <string>.
15605 * symtab.cc: Include <cstring> and <algorithm>.
15606 * target-select.cc: Include <cstring>.
15607 * version.cc: Include <string>.
15608 * testsuite/testmain.cc: Include <cstdlib>.
15609 * configure, config.in: Rebuild.
15610
15611 2008-03-25 Ian Lance Taylor <iant@google.com>
15612
15613 * options.cc: Include "../bfd/bfdver.h".
15614 (options::help): Print bug reporting address.
15615
15616 * version.cc (print_version): Adjust output for current value of
15617 BFD_VERSION_STRING.
15618
15619 * NEWS: New file.
15620
15621 * options.cc (options::help): Print list of supported targets.
15622 * target-select.h: Include <vector>.
15623 (class Target_selector): Make machine_, size_, and is_big_endian_
15624 fields const. Add bfd_name_ and instantiated_target_ fields.
15625 (Target_selector::Target_selector): Add bfd_name parameter.
15626 (Target_selector::recognize): Make non-virtual, call
15627 do_recognize.
15628 (Target_selector::recognize_by_name): Make non-virtual, call
15629 do_recognize_by_name.
15630 (Target_selector::supported_names): New function.
15631 (Target_selector::bfd_name): New function.
15632 (Target_selector::do_instantiate_target): New pure virtual
15633 function.
15634 (Target_selector::do_recognize): New virtual function.
15635 (Target_selector::do_recognize_by_name): New virtual function.
15636 (Target_selector::instantiate_target): New private function.
15637 (supported_target_names): Declare.
15638 * target-select.cc (Target_selector::Target_selector): Update for
15639 new parameter and fields.
15640 (select_target_by_name): Check that the name matches before
15641 calling recognize_by_name.
15642 (supported_target_names): New function.
15643 * i386.cc (class Target_selector_i386): Update Target_selector
15644 constructor call. Remove recognize and recognize_by_name. Add
15645 do_instantiate_target.
15646 * x86_64.cc (class Target_selector_x86_64): Likewise.
15647 * testsuite/testfile.cc (class Target_selector_test): Update for
15648 changes to Target_selector.
15649
15650 * README: Rewrite, with some notes on unsupported features.
15651
15652 2008-03-24 Cary Coutant <ccoutant@google.com>
15653
15654 * i386.cc (Target_i386::Got_type): New enum declaration.
15655 (Target_i386::Scan::local): Updated callers of Output_data_got
15656 member functions.
15657 (Target_i386::Scan::global): Likewise.
15658 (Target_i386::Relocate::relocate): Likewise.
15659 (Target_i386::Relocate::relocate_tls): Likewise.
15660 * object.h (Got_offset_list): New class.
15661 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15662 (Sized_relobj::local_got_offset): Likewise.
15663 (Sized_relobj::set_local_got_offset): Likewise.
15664 (Sized_relobj::local_has_tls_got_offset): Removed.
15665 (Sized_relobj::local_tls_got_offset): Removed.
15666 (Sized_relobj::set_local_tls_got_offset): Removed.
15667 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15668 * output.cc (Output_data_got::add_global): Added got_type parameter.
15669 (Output_data_got::add_global_with_rel): Likewise.
15670 (Output_data_got::add_global_with_rela): Likewise.
15671 (Output_data_got::add_global_pair_with_rel): New function.
15672 (Output_data_got::add_global_pair_with_rela): New function.
15673 (Output_data_got::add_local): Added got_type parameter.
15674 (Output_data_got::add_local_with_rel): Likewise.
15675 (Output_data_got::add_local_with_rela): Likewise.
15676 (Output_data_got::add_local_pair_with_rel): New function.
15677 (Output_data_got::add_local_pair_with_rela): New function.
15678 (Output_data_got::add_global_tls): Removed.
15679 (Output_data_got::add_global_tls_with_rel): Removed.
15680 (Output_data_got::add_global_tls_with_rela): Removed.
15681 (Output_data_got::add_local_tls): Removed.
15682 (Output_data_got::add_local_tls_with_rel): Removed.
15683 (Output_data_got::add_local_tls_with_rela): Removed.
15684 * output.h (Output_data_got::add_global): Added got_type parameter.
15685 (Output_data_got::add_global_with_rel): Likewise.
15686 (Output_data_got::add_global_with_rela): Likewise.
15687 (Output_data_got::add_global_pair_with_rel): New function.
15688 (Output_data_got::add_global_pair_with_rela): New function.
15689 (Output_data_got::add_local): Added got_type parameter.
15690 (Output_data_got::add_local_with_rel): Likewise.
15691 (Output_data_got::add_local_with_rela): Likewise.
15692 (Output_data_got::add_local_pair_with_rel): New function.
15693 (Output_data_got::add_local_pair_with_rela): New function.
15694 (Output_data_got::add_global_tls): Removed.
15695 (Output_data_got::add_global_tls_with_rel): Removed.
15696 (Output_data_got::add_global_tls_with_rela): Removed.
15697 (Output_data_got::add_local_tls): Removed.
15698 (Output_data_got::add_local_tls_with_rel): Removed.
15699 (Output_data_got::add_local_tls_with_rela): Removed.
15700 * resolve.cc (Symbol::override_base_with_special): Removed
15701 reference to has_got_offset_ field.
15702 * symtab.cc (Symbol::init_fields): Replaced initialization
15703 of got_offset_ with got_offsets_. Removed initialization
15704 of has_got_offset_
15705 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15706 (Symbol::got_offset): Likewise.
15707 (Symbol::set_got_offset): Likewise.
15708 (Symbol::has_tls_got_offset): Removed.
15709 (Symbol::tls_got_offset): Removed.
15710 (Symbol::set_tls_got_offset): Removed.
15711 (Symbol::got_offset_): Removed.
15712 (Symbol::tls_mod_got_offset_): Removed.
15713 (Symbol::tls_pair_got_offset_): Removed.
15714 (Symbol::got_offsets_): New field.
15715 (Symbol::has_got_offset): Removed.
15716 (Symbol::has_tls_mod_got_offset): Removed.
15717 (Symbol::has_tls_pair_got_offset): Removed.
15718 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15719 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15720 member functions.
15721 (Target_x86_64::Scan::global): Likewise.
15722 (Target_x86_64::Relocate::relocate): Likewise.
15723 (Target_x86_64::Relocate::relocate_tls): Likewise.
15724
15725 2008-03-25 Ben Elliston <bje@au.ibm.com>
15726
15727 * yyscript.y: Fix spelling error in comment.
15728
15729 2008-03-24 Ian Lance Taylor <iant@google.com>
15730
15731 * options.h (class General_options): Define build_id option.
15732 * layout.h (class Layout): Declare write_build_id, create_note,
15733 create_build_id. Add build_id_note_ member.
15734 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15735 "libiberty.h", "md5.h", "sha1.h".
15736 (Layout::Layout): Initialize eh_frame_data_,
15737 eh_frame_hdr_section_, and build_id_note_.
15738 (Layout::finalize): Call create_build_id.
15739 (Layout::create_note): New function, broken out of
15740 Layout::create_gold_note.
15741 (Layout::create_gold_note): Call create_note.
15742 (Layout::create_build_id): New function.
15743 (Layout::write_build_id): New function.
15744 (Close_task_runner::run): Call write_build_id.
15745
15746 * x86_64.cc: Correct license to GPLv3.
15747
15748 2008-03-23 Ian Lance Taylor <iant@google.com>
15749
15750 * options.cc: Include "demangle.h".
15751 (parse_optional_string): New function.
15752 (parse_long_option): Handle takes_optional_argument.
15753 (parse_short_option): Update dash_z initializer. Handle
15754 takes_optional_argument.
15755 (General_options::General_options): Initialize do_demangle_.
15756 (General_options::finalize): Set do_demangle_. Handle demangling
15757 style.
15758 * options.h (parse_optional_string): Declare.
15759 (struct One_option): Add optional_arg field. Update constructor.
15760 Update call constructor calls. Add takes_optional_argument
15761 function.
15762 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15763 (DEFINE_optional_string): Define.
15764 (General_options::demangle): Change from DEFINE_bool to
15765 DEFINE_optional_string.
15766 (General_options::no_demangle): New function.
15767 (General_options::do_demangle): New function.
15768 (General_options::set_do_demangle): New function.
15769 (General_options::execstack_status_): Move definition to end of
15770 class definition.
15771 (General_options::static_): Likewise.
15772 (General_options::do_demangle_): New field.
15773 * object.cc (big_endian>::get_symbol_location_info): Call
15774 Options::do_demangle, not Options::demangle.
15775 * symtab.cc (demangle): Likewise.
15776
15777 2008-03-22 Ian Lance Taylor <iant@google.com>
15778
15779 * gold.h: Include <cstddef> and <sys/types.h>
15780 * options.h: Include <cstring>.
15781
15782 2008-03-21 Ian Lance Taylor <iant@google.com>
15783
15784 * Added source code to GNU binutils.
15785 \f
15786 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15787
15788 Copying and distribution of this file, with or without modification,
15789 are permitted in any medium without royalty provided the copyright
15790 notice and this notice are preserved.
15791
15792 Local Variables:
15793 mode: change-log
15794 left-margin: 8
15795 fill-column: 74
15796 version-control: never
15797 End: