]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gold/ChangeLog
Allow target to derive from Copy_relocs class.
[thirdparty/binutils-gdb.git] / gold / ChangeLog
1 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
2
3 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
4 inline into ...
5 (Copy_relocs::emit): ... here.
6 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
7 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
8 (Copy_reloc_entry::entries_): Change from private to protected.
9
10 2014-04-02 Sriraman Tallam <tmsriram@google.com>
11
12 * icf.cc (get_section_contents): Replace copies of reloc
13 vectors with const references.
14
15 2014-04-02 Cary Coutant <ccoutant@google.com>
16
17 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
18 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
19 * configure: Regenerate.
20 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
21 -fno-use-linker-plugin.
22 (LINK1, CXXLINK1): Add it to the link command.
23 * testsuite/Makefile.in: Regenerate.
24
25 2014-03-12 Alan Modra <amodra@gmail.com>
26
27 * Makefile.in: Regenerate.
28
29 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
30
31 * symtab.h (Symbol::set_nonvis): New function.
32
33 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
34
35 * symtab.cc (Sized_symbol<32>::init_output_data):
36 Instantiate the template.
37 (Sized_symbol<64>::init_output_data): Likewise.
38
39 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
40
41 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
42 adjust dynamic symbol value.
43 * target.h (Target::adjust_dyn_symbol): New function.
44 (Target::do_adjust_dyn_symbol): New function.
45
46 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
47
48 * output.cc (Output_data_dynamic::Dynamic_entry::write):
49 Get the value of DYNAMIC_CUSTOM dynamic entry.
50 * output.h (Output_data_dynamic::add_custom): New function.
51 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
52 dynamic entry.
53 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
54 * target.h (Target::dynamic_tag_custom_value): New function.
55 (Target::do_dynamic_tag_custom_value): New function.
56
57 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
58
59 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
60 dynsym indexes.
61 * target.h (Target::has_custom_set_dynsym_indexes): New function.
62 (Target::do_has_custom_set_dynsym_indexes): New function.
63 (Target::set_dynsym_indexes): New function.
64 (Target::do_set_dynsym_indexes): New function.
65
66 2014-03-07 Alan Modra <amodra@gmail.com>
67
68 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
69 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
70 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
71 (Powerpc_relocate_functions::has_overflow_bitfield,
72 overflowed): Use the above.
73 (Target_powerpc::Relocate::relocate): Correct overflow checking
74 for a number of relocations. Modify overflow test for 16-bit
75 fields in instructions to signed/unsigned according to whether
76 the field takes a signed or unsigned value.
77
78 2014-03-05 Alan Modra <amodra@gmail.com>
79
80 Update copyright years.
81
82 2014-03-05 Alan Modra <amodra@gmail.com>
83
84 * powerpc.cc (Target_powerpc::Scan::local, global): Support
85 R_PPC64_ADDR64_LOCAL.
86 (Target_powerpc::Relocate::relocate): Likewise.
87
88 2014-03-03 Alan Modra <amodra@gmail.com>
89
90 * dwp.cc (print_version): Update copyright year to current.
91
92 2014-02-10 Alan Modra <amodra@gmail.com>
93
94 * po/gold.pot: Regenerate.
95
96 2014-02-06 Cary Coutant <ccoutant@google.com>
97
98 Fix problem where -u is ignored when a weak undef is seen.
99
100 * archive.cc (Library_base::should_include_member): Reorder
101 code to check for -u option if a weak undef has already been seen.
102 * testsuite/Makefile.am (weak_undef_test_2): New test case.
103 * testsuite/Makefile.in: Regenerate.
104 * testsuite/weak_undef_file3.cc: New file.
105 * testsuite/weak_undef_file4.cc: New file.
106 * testsuite/weak_undef_test_2.cc: New file.
107
108 2014-02-05 Cary Coutant <ccoutant@google.com>
109
110 Fix issues with gold undefined symbol diagnostics.
111
112 PR binutils/15435
113 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
114 check to here.
115 * target-reloc.h (is_strong_undefined): New function.
116 (relocate_section): Move undef vtable symbol check from here.
117 Check for is_strong_undefined.
118
119 2014-02-05 Cary Coutant <ccoutant@google.com>
120
121 Fix problems with the --dynamic-list option.
122
123 PR gold/13577
124 * options.cc (General_options::parse_dynamic_list):
125 Set have_dynamic_list_.
126 (General_options::General_options): Initialize have_dynamic_list_.
127 (General_options::finalize): Turn off -Bsymbolic and
128 -Bsymbolic-functions if --dynamic-list provided.
129 * options.h (General_options::have_dynamic_list): New function.
130 (General_options::have_dynamic_list_): New data member.
131 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
132 correctly.
133
134 PR gold/16530
135 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
136 in --dynamic-list, mark it.
137
138 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
139 (dynamic_list_2): New test case.
140 * testsuite/Makefile.in: Regenerate.
141 * testsuite/dynamic_list_2.cc: New file.
142 * testsuite/dynamic_list_2.t: New file.
143 * testsuite/dynamic_list_lib1.cc: New file.
144 * testsuite/dynamic_list_lib2.cc: New file.
145 * testsuite/gc_dynamic_list_test.c: New file.
146 * testsuite/gc_dynamic_list_test.sh: New file.
147 * testsuite/gc_dynamic_list_test.t: New file.
148
149 2014-01-28 Cary Coutant <ccoutant@google.com>
150
151 Add .gdb_index version 7 support.
152
153 * gold/dwarf_reader.cc: include <utility> (for make_pair).
154 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
155 debug sections.
156 (Dwarf_ranges_table::read_ranges_table): Likewise.
157 (Dwarf_pubnames_table::read_section): Check for GNU-style
158 sections, and for compressed debug sections.
159 (Dwarf_pubnames_table::read_header): Compute end address of table.
160 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
161 for end of list by offset, not by offset == 0.
162 (Dwarf_info_reader::do_read_string_table): Check for compressed
163 debug sections.
164 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
165 Initialize new data members.
166 (Dwarf_pubnames_table::next_name): return flag_byte.
167 (Dwarf_pubnames_table::end_of_table_): New data member.
168 (Dwarf_pubnames_table::is_gnu_style_): New data member.
169 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
170 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
171 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
172 read skeleton type unit DIEs.
173 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
174 (Gdb_index::do_write): Write flag_byte.
175 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
176 (Gdb_index::Cu_vector): Store flags along with cu indexes.
177 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
178 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
179
180 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
181
182 * version.cc (print_version): Update copyright year to 2014.
183
184 2013-12-19 Dimitry Andric <dimitry@andric.com>
185
186 * stringpool.cc (Stringpool_template::reserve): Add
187 HAVE_UNORDERED_MAP case.
188 * stringpool.cc (Stringpool_template::print_stats): Likewise.
189
190 2013-12-18 Cary Coutant <ccoutant@google.com>
191
192 * configure.ac: Check for <unordered_set> and <unordered_map>.
193 * config.in: Regenerate.
194 * configure: Regenerate.
195 * system.h: Use <unordered_set> and <unordered_map> if available.
196
197 2013-12-10 Roland McGrath <mcgrathr@google.com>
198
199 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
200 with $(INSTALL_PROGRAM_ENV).
201 * Makefile.in: Regenerate.
202
203 2013-11-22 Cary Coutant <ccoutant@google.com>
204
205 * configure.ac: Add check for which library is needed for
206 dlopen.
207 * configure: Regenerate.
208
209 2013-11-22 Cary Coutant <ccoutant@google.com>
210
211 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
212 assembler.
213 * testsuite/Makefile.in: Regenerate.
214
215 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
216
217 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
218 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
219 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
220 (Target_x86_64<size>::Scan::local): Likewise.
221 (Target_x86_64<size>::Scan::global): Likewise.
222 (Target_x86_64<size>::Relocate::relocate): Likewise.
223 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
224 Likewise.
225 (Target_x86_64<size>::Scan::check_non_pic(): Handle
226 R_X86_64_PC32_BND.
227
228 * testsuite/Makefile.am (check_PROGRAMS): Add
229 exception_x86_64_bnd_test.
230 (exception_x86_64_bnd_test_SOURCES): New macro.
231 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
232 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
233 (exception_x86_64_bnd_test_LDADD): Likewise.
234 (exception_x86_64_bnd_1.o): New rule.
235 (exception_x86_64_bnd_2.o): Likewise.
236 * testsuite/Makefile.in: Regenerated.
237
238 2013-11-15 Alan Modra <amodra@gmail.com>
239
240 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
241 accessor.
242 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
243 Only call ppc64_local_entry_offset for 64-bit. Restrict
244 symval_for_branch lookup to ELFv1.
245 (Stub_table::add_plt_call_entry): Use unsigned int off.
246 (Output_data_glink::Address, invalid_address): New.
247 (Output_data_glink::add_eh_frame): Move out of line. Add
248 support for ELFv2.
249 (Output_data_glink::add_global_entry, find_global_entry,
250 global_entry_address): New functions.
251 (Output_data_glink::global_entry_stubs_, end_branch_table_,
252 ge_size): New variables.
253 (Output_data_glink::set_final_data_size): Add global entry
254 stub sizing.
255 (Output_data_glink::do_write): Write global entry stubs.
256 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
257 parameter. Return true for ELFv2. Adjust callers.
258 (Target_powerpc::Scan::local, global): Restrict opd lookup to
259 ELFv1. Similarly for ifunc and dynamic relocation processing
260 specific to ELFv1. Recognize that symbols are defined on
261 their plt entries for ELFv2.
262 (Target_powerpc::symval_for_branch): Assert if called for
263 ELFv2 or ppc32.
264 (Target_powerpc::Relocate::relocate): Use global entry plt
265 stub for symbol value if such exists on ELFv2.
266 (Target_powerpc::Relocate::relocate): Don't call
267 symval_for_branch when ELFv2. Do adjust for local entry
268 offset when ELFv2.
269 (Target_powerpc::do_dynsym_value): Set symbols to global entry
270 plt stub for ELFv2.
271 (Target_powerpc::do_plt_address_for_global): Similarly.
272
273 2013-11-14 Cary Coutant <ccoutant@google.com>
274
275 Revert patch -- this did not fix the problem, and there is
276 no race there.
277
278 2013-11-14 Cary Coutant <ccoutant@google.com>
279
280 PR gold/14860
281 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
282 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
283 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
284 updating fde_offsets_.
285 (Eh_frame_hdr::lock_): New data member.
286
287 2013-11-14 Cary Coutant <ccoutant@google.com>
288
289 * dwp.cc (Dwo_file_entry): New type.
290 (File_list): Use Dwo_file_entry.
291 (Dwo_file::verify): New function.
292 (Dwo_file::verify_dwo_list): New function.
293 (Dwo_file::sized_verify_dwo_list): New function.
294 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
295 list.
296 (Dwp_options): New enum type.
297 (dwp_options): Add --verify-only.
298 (usage): Likewise.
299 (main): Likewise.
300 * dwp.h (gold_info): Add declaration.
301
302 2013-11-14 Cary Coutant <ccoutant@google.com>
303
304 PR gold/14860
305 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
306 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
307 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
308 updating fde_offsets_.
309 (Eh_frame_hdr::lock_): New data member.
310
311 2013-11-06 Cary Coutant <ccoutant@google.com>
312
313 PR gold/15758
314 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
315 before reloc sections.
316
317 2013-11-04 Alan Modra <amodra@gmail.com>
318
319 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
320 (Symbol::needs_dynamic_reloc): Test new flag.
321 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
322 (Target_powerpc::Scan::get_reference_flags): Add target param.
323 Return FUNC_DESC_ABI for 64-bit ELFv1.
324 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
325 call.
326 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
327 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
328
329 2013-10-31 Cary Coutant <ccoutant@google.com>
330
331 Restore support for dwp v2 DWARF package file format.
332
333 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
334 tu_length parameter. Adjust all callers.
335 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
336 * dwp.cc: Include dwarf.h.
337 (Section_bounds): New struct type.
338 (Unit_set): New struct type.
339 (Dwo_file::Dwo_file): Initialize new data member.
340 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
341 Combine and rename to...
342 (Dwo_file::read_unit_index): ...this.
343 (Dwo_file::sized_read_compunit_index)
344 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
345 (Dwo_file::sized_read_unit_index): ...this.
346 (Dwo_file::copy_section): Remove section_name, is_str_offsets
347 parameters; add section_id parameter.
348 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
349 (Dwo_file::add_unit_set): ...this.
350 (Dwo_file::shndx_map_): Remove.
351 (Dwo_file::sect_offsets_): New data member.
352 (Dwp_output_file::Dwp_output_file): Initialize new data members.
353 (Dwp_output_file::add_section): Rename to...
354 (Dwp_output_file::add_contribution): ...this.
355 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
356 (Dwp_output_file::add_tu_set): Likewise.
357 (Dwp_output_file::Contribution): New type.
358 (Dwp_output_file::Section::contributions): New data member.
359 (Dwp_output_file::Cu_or_tu_set): Remove.
360 (Dwp_output_file::Section::Section): New ctor.
361 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
362 (Dwp_output_file::Dwp_index::Section_table): New type.
363 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
364 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
365 parameter.
366 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
367 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
368 (Dwp_output_file::Dwp_index::section_table): New member function.
369 (Dwp_output_file::Dwp_index::section_table_end): New member function.
370 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
371 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
372 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
373 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
374 (Dwp_output_file::Dwp_index::section_table_): New data member.
375 (Dwp_output_file::Dwp_index::section_mask_): New data member.
376 (Dwp_output_file::add_output_section): New member function.
377 (Dwp_output_file::write_new_section): New member function.
378 (Dwp_output_file::write_contributions): New member function.
379 (Dwp_output_file::section_id_map_): New data member.
380 (class Dwo_id_info_reader): Remove.
381 (class Unit_reader): New class.
382 (get_dwarf_section_name): New function.
383 (Dwo_file::read_executable): Adjust initializations of class data.
384 (Dwo_file::read): Add support for v2 package file format.
385 (Dwo_file::read_unit_index): Likewise.
386 (Dwo_file::sized_read_unit_index): Likewise.
387 (Dwo_file::copy_section): Likewise.
388 (Dwo_file::add_unit_set): Likewise.
389 (Dwp_output_file::add_output_section): Likewise.
390 (Dwp_output_file::add_contribution): Likewise.
391 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
392 for empty slot.
393 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
394 file format.
395 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
396 slot.
397 (Dwp_output_file::initialize): Remove unused function.
398 (Dwp_output_file::finalize): Add support for v2 package file format.
399 (Dwp_output_file::write_index): Likewise.
400 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
401 function prototype.
402
403 2013-10-31 Cary Coutant <ccoutant@google.com>
404
405 * configure.ac: Fix check for -fmerge-constants.
406 * configure.ac: Regenerate.
407
408 2013-10-30 Roland McGrath <mcgrathr@google.com>
409
410 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
411 Correct 9-byte nop sequence to match what the assembler generates.
412
413 2013-10-30 Alan Modra <amodra@gmail.com>
414
415 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
416 ppc64_local_entry_offset, ppc64_local_entry_offset,
417 do_read_symbols): New functions.
418 (Powerpc_relobj::e_flags_, st_other_): New vars.
419 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
420 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
421 (Powerpc_relobj::e_flags_): New var.
422 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
423 and adjust for ELFv2.
424 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
425 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
426 (Powerpc_dynobj::do_find_special_sections): Likewise.
427 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
428 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
429 to ELFv2 local entry.
430 (Target_powerpc::do_relax): No thread safe barriers needed for
431 ELFv2.
432 (Output_data_plt_powerpc::initial_plt_entry_size_,
433 plt_entry_size): Delete. Replace all uses with
434 first_plt_entry_offset() and plt_entry_size().
435 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
436 reserved_size parm. Update callers.
437 (Output_data_plt_powerpc::entry_count): Update.
438 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
439 and use Target_powerpc::first_plt_entry_offset().
440 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
441 rename to plt_entry_size.
442 (Output_data_plt_powerpc::add_ifunc_entry,
443 add_local_ifunc_entry): Adjust reloc for ELFv2.
444 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
445 (glink_eh_frame_fde_64v2): New.
446 (Stub_table::plt_call_size): Support ELFv2 sizing.
447 (Output_data_glink::add_eh_frame): Use the new FDE.
448 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
449 (Stub_table::do_write): Write ELFv2 stubs and glink.
450 (Target_powerpc::Relocate::relocate): Replaces nop after call
451 with ld 2,24(1) and adjust local offset destination for ELFv2.
452
453 2013-10-30 Alan Modra <amodra@gmail.com>
454
455 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
456 (Target_powerpc::Scan::global, local): Likewise.
457 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
458 on all ppc64 @h and @ha relocs.
459
460 2013-10-14 Alan Modra <amodra@gmail.com>
461
462 * output.h (Output_data_got::add_constant): Tidy.
463 (Output_data_got::add_constant_pair): New function.
464 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
465 methods used so as to first call reserve_ent().
466
467 2013-10-11 Roland McGrath <mcgrathr@google.com>
468
469 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
470 add_got_entry and add_got_entry_pair.
471
472 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
473 (HAVE_PUBNAMES): Likewise.
474 * configure: Regenerate.
475
476 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
477 * testsuite/Makefile.in: Regenerate.
478
479 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
480 Remove const from declaration.
481 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
482 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
483 * output.h (Output_file_header): Remove const from member target_
484 and corresponding constructor argument.
485 * output.cc (Output_file_header::Output_file_header): Update prototype.
486 (Output_file_header::do_sized_write): Use this->target_ in place
487 of parameters()->target().
488
489 * testsuite/undef_symbol.cc (Foo::get_a): New method.
490
491 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
492 * configure: Regenerate.
493 * Makefile.in: Regenerate.
494 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
495 * testsuite/merge_string_literals_2.c: Likewise.
496 * testsuite/Makefile.am
497 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
498 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
499 literal -fmerge-constants.
500 * testsuite/Makefile.in: Regenerate.
501
502 * i386.cc (Target_i386): Remove unused member dynbss_.
503 * arm.cc (Target_arm): Likewise.
504 * powerpc.cc (Target_powerpc): Likewise.
505 * sparc.cc (Target_sparc): Likewise.
506 * tilegx.cc (Target_tilegx): Likewise.
507 * x86_64.cc (Target_x86_64): Likewise.
508 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
509 type_signature_, type_offset_.
510 * plugin.h (Plugin_hook): Remove unused member layout_.
511 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
512 mapfile_.
513 (Read_member): Remove unused members input_objects_, symtab_,
514 mapfile_, layout_.
515 (Check_library): Remove unused member symtab_.
516 * archive.h (Lib_group): Remove unused member lib_.
517 * archive.cc (Lib_group::Lib_group): Update initializer.
518 * incremental.h (Incremental_binary): Remove unused member target_.
519 (Incremental_script_entry): Removed unused member script_.
520 * layout.h (Write_symbols_task): Remove unused member input_objects_.
521 * icf.h (Icf): Remove unused member num_tracked_relocs.
522
523 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
524 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
525 its only use.
526 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
527
528 * archive.h: Use struct rather than class for forward declaration
529 of Read_symbols_data.
530
531 2013-10-07 Cary Coutant <ccoutant@google.com>
532
533 PR gold/16010
534 * testsuite/Makefile.am (icf_test): Fix dependencies.
535 (icf_safe_test): Likewise.
536 (icf_safe_so_test): Likewise.
537 (large_symbol_alignment): Add empty _LDADD rule.
538 * testsuite/Makefile.in: Regenerate.
539
540 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
541
542 PR gold/15927
543 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
544 relocation for R_X86_64_32 on x32.
545
546 2013-08-27 Roland McGrath <mcgrathr@google.com>
547
548 * output.cc (Output_segment::set_section_addresses): Take new
549 Target* argument. If target->isolate_execinstr() and the segment
550 is executable and starts at a target->abi_pagesize() boundary,
551 pad its end out to a target->abi_pagesize() boundary with code fill.
552 * output.h (Output_segment::set_section_addresses): Update decl.
553 * layout.h (Layout::check_output_data_for_reset_values): Take new
554 argument RELAX_OUTPUTS.
555 (Layout): New member relax_output_list_.
556 (Layout::add_relax_output): New method.
557 * layout.cc (Layout::Layout): Update constructor.
558 (Layout::reset_relax_output): New method.
559 (Layout::clean_up_after_relaxation): Call it.
560 (Layout::prepare_for_relaxation): Update caller.
561 (Layout::set_segment_offsets): Update callers of set_section_addresses.
562 Call reset_relax_output before re-processing segments for
563 isolate_execinstr case.
564 (Layout::write_data): Handle relax_output_list_.
565 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
566 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
567
568 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
569
570 PR binutils/15834
571 * object.h: Fix typos.
572
573 2013-08-16 Roland McGrath <mcgrathr@google.com>
574
575 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
576 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
577
578 2013-08-07 Cary Coutant <ccoutant@google.com>
579
580 Revert support for v2 DWP files:
581
582 2013-03-01 Cary Coutant <ccoutant@google.com>
583
584 Add dwp support for v2 DWARF package file format.
585 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
586 tu_length parameter. Adjust all callers.
587 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
588 * dwp.cc: Include dwarf.h.
589 (Section_bounds): New struct type.
590 (Unit_set): New struct type.
591 (Dwo_file::Dwo_file): Initialize new data member.
592 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
593 Combine and rename to...
594 (Dwo_file::read_unit_index): ...this.
595 (Dwo_file::sized_read_compunit_index)
596 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
597 (Dwo_file::sized_read_unit_index): ...this.
598 (Dwo_file::copy_section): Remove section_name, is_str_offsets
599 parameters; add section_id parameter.
600 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
601 (Dwo_file::add_unit_set): ...this.
602 (Dwo_file::shndx_map_): Remove.
603 (Dwo_file::sect_offsets_): New data member.
604 (Dwp_output_file::Dwp_output_file): Initialize new data members.
605 (Dwp_output_file::add_section): Rename to...
606 (Dwp_output_file::add_contribution): ...this.
607 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
608 (Dwp_output_file::add_tu_set): Likewise.
609 (Dwp_output_file::Contribution): New type.
610 (Dwp_output_file::Section::contributions): New data member.
611 (Dwp_output_file::Cu_or_tu_set): Remove.
612 (Dwp_output_file::Section::Section): New ctor.
613 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
614 (Dwp_output_file::Dwp_index::Section_table): New type.
615 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
616 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
617 parameter.
618 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
619 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
620 (Dwp_output_file::Dwp_index::section_table): New member function.
621 (Dwp_output_file::Dwp_index::section_table_end): New member function.
622 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
623 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
624 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
625 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
626 (Dwp_output_file::Dwp_index::section_table_): New data member.
627 (Dwp_output_file::Dwp_index::section_mask_): New data member.
628 (Dwp_output_file::add_output_section): New member function.
629 (Dwp_output_file::write_new_section): New member function.
630 (Dwp_output_file::write_contributions): New member function.
631 (Dwp_output_file::section_id_map_): New data member.
632 (class Dwo_id_info_reader): Remove.
633 (class Unit_reader): New class.
634 (get_dwarf_section_name): New function.
635 (Dwo_file::read_executable): Adjust initializations of class data.
636 (Dwo_file::read): Add support for v2 package file format.
637 (Dwo_file::read_unit_index): Likewise.
638 (Dwo_file::sized_read_unit_index): Likewise.
639 (Dwo_file::copy_section): Likewise.
640 (Dwo_file::add_unit_set): Likewise.
641 (Dwp_output_file::add_output_section): Likewise.
642 (Dwp_output_file::add_contribution): Likewise.
643 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
644 for empty slot.
645 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
646 file format.
647 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
648 slot.
649 (Dwp_output_file::initialize): Remove unused function.
650 (Dwp_output_file::finalize): Add support for v2 package file format.
651 (Dwp_output_file::write_index): Likewise.
652 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
653 function prototype.
654
655 2013-07-31 Cary Coutant <ccoutant@google.com>
656
657 * object.cc (Sized_relobj::do_output_section_address): New function.
658 (Sized_relobj): Instantiate explicitly.
659 * object.h (Object::output_section_address): New function.
660 (Object::do_output_section_address): New function.
661 (Sized_relobj::do_output_section_address): New function.
662 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
663
664 2013-07-30 Cary Coutant <ccoutant@google.com>
665 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
666
667 * parameters.cc (Parameters::entry): Return target-specific entry
668 symbol name.
669 * target.h (Target::entry_symbol_name): New function.
670 (Target_info::entry_symbol_name): New data member.
671
672 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
673 * i386.cc (Target_i386::i386_info): Likewise.
674 (Target_i386_nacl::i386_nacl_info): Likewise.
675 * sparc.cc (Target_sparc::sparc_info): Likewise.
676 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
677 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
678 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
679 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
680
681 2013-07-22 Sterling Augustine <saugustine@google.com>
682
683 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
684 Convert parameter shndx to local variable. Add parameters symtab
685 and symtab_size. Scan over section names. Find relocation
686 section corresponding to current section. Create and initialize
687 reloc_mapper_ and reloc_type_.
688 (Dwarf_pubnames_table::read_header): Add assertion. Change
689 unit_length to off_t. Initialize member unit_length_. Fill in field
690 cu_offset_.
691 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
692 Initialize new fields unit_length_ and cu_offset_.
693 (Dwarf_pubnames_table::read_section): Update prototype.
694 (Dwarf_pubnames_table::cu_offset): New member function.
695 (Dwarf_pubnames_table::subsection_size): Likewise.
696 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
697 New fields.
698 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
699 member functions public.
700 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
701 Update comment. Rework logic. Move repeated parts to...
702 (Gdb_index_info_reader::read_pubtable): ...here. New function.
703 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
704 pubtypes_table_, and stmt_list_offset.
705 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
706 Gdb_index::find_pubtype_offset,
707 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
708 (Gdb_index::pubnames_read): Update prototype and rework logic.
709 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
710 Forward declare.
711 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
712 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
713 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
714 Gdb_index::map_pubtable_to_dies):
715 Declare functions.
716 (Gdb_index::pubnames_read): Update declaration.
717 (Gdb_index::Pubname_offset_map): New type.
718 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
719 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
720 Gdb_index::stmt_list_offset): Declare.
721 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
722 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
723 Gdb_index::pubtypes_offset_): Remove.
724
725 2013-07-19 Roland McGrath <mcgrathr@google.com>
726
727 * options.h (General_options): Add -Trodata-segment option.
728 * parameters.cc (Parameters::check_rodata_segment): New function.
729 (Parameters::set_target_once): Call it.
730 * parameters.h (Parameters): Declare it (private member function).
731 * layout.cc (load_seg_unusable_for_headers): New function, broken
732 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
733 then validate rodata segment rather than text segment.
734 (relaxation_loop_body): Call that.
735 (is_text_segment): New function. Don't admit a non-executable
736 segment if TARGET->isolate_execinstr().
737 (set_segment_offsets): Call it. Honor -Trodata-segment option.
738
739 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
740
741 PR gold/15070
742 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
743 * nacl.h (Sniff_file::View::View): Request aligned view.
744
745 2013-07-11 Cary Coutant <ccoutant@google.com>
746
747 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
748 correct BRLT entry size.
749
750 2013-07-03 Alan Modra <amodra@gmail.com>
751
752 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
753 comment.
754
755 2013-07-01 Cary Coutant <ccoutant@google.com>
756
757 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
758 reloc_type_.
759 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
760 (Dwarf_ranges_table::lookup_reloc): New function.
761 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
762 reloc_type_.
763 (Dwarf_ranges_table::lookup_reloc): New function.
764 (Dwarf_ranges_table::reloc_type_): New data member.
765
766 2013-06-27 Jing Yu <jingyu@google.com>
767
768 PR gold/15662
769 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
770 function.
771 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
772 (Target_powerpc::do_relax): Call the above.
773
774 2013-06-27 Cary Coutant <ccoutant@google.com>
775
776 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
777 on garbage collected .opd section.
778
779 2013-06-27 Alan Modra <amodra@gmail.com>
780
781 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
782 is non-zero.
783 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
784 (Target_powerpc::do_function_location): Likewise for loc->shndx.
785
786 2013-06-14 Cary Coutant <ccoutant@google.com>
787
788 * resolve.cc (Symbol::override_base): Don't override st_type
789 from plugin placeholder symbols.
790 (Symbol_table::resolve): Likewise.
791 (Symbol_table::should_override): Don't complain about TLS mismatch
792 if the TO symbol is a plugin placeholder.
793 * testsuite/Makefile.am (plugin_test_tls): New test.
794 * testsuite/Makefile.in: Regenerate.
795 * testsuite/plugin_test_tls.sh: New test script.
796 * testsuite/two_file_test_2_tls.cc: New test source.
797 * testsuite/two_file_test_tls.cc: New test source.
798
799 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
800
801 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
802 the maximum segment alignment is larger than the page size.
803 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
804 correctly aligns the symbols with large alignemnt.
805 * testsuite/Makefile.in: Regenerate.
806 * testsuite/large_symbol_alignment.cc: New file.
807
808 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
809 Sriraman Tallam <tmsriram@google.com>
810
811 * options.h (sort_section): New option.
812 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
813 Rename from Input_section_sort_section_name_special_ordering_compare.
814 (Input_section_sort_section_name_compare): New struct.
815 * output.cc (Output_section::Input_section_sort_section_name_compare::
816 operator()): New function.
817 (Output_section::sort_attached_input_sections): Use new sort function
818 for .text if --sort-section=name is specified.
819 * layout.cc (Layout::make_output_section):
820 Add sorting by name when --sort-section=name is specified.
821 * testsuite/Makefile.am (text_section_grouping): Test option
822 --sort-section=name.
823 * testsuite/Makefile.in: Regenerate.
824 * testsuite/section_sorting_name.cc: New file.
825 * testsuite/section_sorting_name.sh: New file.
826
827 2013-05-21 Cary Coutant <ccoutant@google.com>
828
829 * symtab.h (Symbol::is_cxx_vtable): New function.
830 * target-reloc.h (relocate_section): Check for vtable symbol.
831 * testsuite/Makefile.am (missing_key_func.sh): New test case.
832 * testsuite/Makefile.in: Regenerate.
833 * testsuite/missing_key_func.cc: New test source.
834 * testsuite/missing_key_func.sh: New test script.
835
836 2013-05-21 Cary Coutant <ccoutant@google.com>
837
838 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
839 type of enclosing symbol.
840 (Relocate_info::location): Check symbol type when describing symbol.
841 * object.h (Symbol_location_info): Remove unused line_number;
842 add enclosing_symbol_type.
843 * testsuite/debug_msg.sh: Adjust expected output.
844
845 2013-05-13 Cary Coutant <ccoutant@google.com>
846
847 * configure.ac: Export DEFAULT_TARGET.
848 * configure: Regenerate.
849 * Makefile.in: Regenerate.
850 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
851 * testsuite/Makefile.in: Regenerate.
852 * testsuite/debug_msg.sh: Delete duplicate tests.
853 Don't check undef_int error message match for powerpc where the
854 source file and line number aren't available.
855
856 2013-05-10 Roland McGrath <mcgrathr@google.com>
857
858 * options.h (General_options): Add --rosegment-gap option.
859 * options.cc (finalize): --rosegment-gap implies --rosegment.
860 * layout.cc (set_segment_offsets): Let user option override
861 target->rosegment_gap().
862
863 2013-05-10 Roland McGrath <mcgrathr@google.com>
864
865 * options.h (General_options): Remove leading space from help
866 messages for -nostdlib and --rosegment.
867
868 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
869
870 PR ld/15365
871 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
872
873 2013-05-03 Alan Modra <amodra@gmail.com>
874
875 * merge.cc (Output_merge_string::do_add_input_section): Correct
876 scan for number of strings. Rename vars to avoid shadowing.
877 Include missing terminator in input_size_.
878
879 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
880
881 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
882 Restore empty string handling.
883
884 2013-05-01 Cary Coutant <ccoutant@google.com>
885
886 * stringpool.cc (Stringpool_template::new_key_offset): Fix
887 uninitialized warning.
888
889 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
890
891 * output.cc (Output_section::add_merge_input_section): Allow
892 to merge sections if the alignment is more than character size.
893 * merge.h (Output_merge_string::Output_merge_string): Remove
894 assert.
895 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
896 only not-null strings. Check the alignment of strings.
897 * stringpool.h
898 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
899 alignment as the argument.
900 (Stringpool_template<Stringpool_char>::addralign_): New class member.
901 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
902 Align non-zero length strings according to the addralign_.
903 (Stringpool_template<Stringpool_char>::set_string_offsets):
904 Updating offsets according to the given alignment.
905 * testsuite/Makefile.am (text_section_grouping): Test if string
906 literals are getting merged.
907 * testsuite/Makefile.in: Regenerate.
908 * testsuite/merge_string_literals_1.c: New file.
909 * testsuite/merge_string_literals_2.c: Ditto.
910 * testsuite/merge_string_literals.sh: Ditto.
911
912 2013-04-26 Ian Lance Taylor <iant@google.com>
913
914 * target-reloc.h (relocate_section): If the reloc offset is out of
915 range, pass VIEW as NULL to relocate.relocate.
916 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
917 * i386.cc (Target_i386::Relocate::relocate): Likewise.
918 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
919 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
920 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
921 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
922
923 2013-04-26 Geoff Pike <gpike@chromium.org>
924
925 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
926 * layout.cc (Hash_task): New class.
927 (Layout::queue_build_id_tasks): New function.
928 (Layout::write_build_id): Handle single-thread portion of build ID
929 computation. (In some cases, all of it is single-threaded.) Replace
930 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
931 functionality in fewer lines of code.
932 * layout.h (Layout::queue_build_id_tasks): New function declaration.
933 * options.h (General_options): make "--build-id" default to tree
934 rather than sha1. Add two new options related to --build-id=tree:
935 --build-id-chunk-size-for-treehash and
936 --build-id-min-file-size-for-treehash.
937 * Makefile.am: add testing of --build-id=tree and related new options
938 (these tests will be invoked by "make check").
939 * Makefile.in: Regenerate.
940
941 2013-04-25 Alan Modra <amodra@gmail.com>
942
943 * configure.tgt: Add powerpcle and powerpc64le.
944
945 2013-04-22 Alan Modra <amodra@gmail.com>
946
947 PR gold/15355
948 * layout.cc (Layout::segment_precedes): Allow more than one
949 segment with the same type and flags.
950
951 2013-04-15 Cary Coutant <ccoutant@google.com>
952
953 * layout.cc (Layout::set_relocatable_section_offsets): Don't
954 allocate space in file for BSS sections.
955
956 2013-04-15 Cary Coutant <ccoutant@google.com>
957
958 * script-sections.cc (Orphan_output_section): Reset address
959 to zero after each orphaned section for relocatable links.
960
961 2013-04-15 Cary Coutant <ccoutant@google.com>
962
963 * symtab.cc (Symbol_table::sized_write_globals): Subtract
964 section starting address for relocatable link.
965 * testsuite/Makefile.am (script_test_11): New test.
966 * testsuite/Makefile.in: Regenerate.
967 * testsuite/script_test_11.c: New source file.
968 * testsuite/script_test_11.t: New linker script.
969
970 2013-04-13 Alan Modra <amodra@gmail.com>
971
972 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
973 owner when sections are not adjacent and exceed group size.
974 (Target_powerpc::group_sections): Handle corner case.
975 (Target_powerpc::Branch_info::make_stub): Handle case where
976 stub table doesn't exist due to branches in non-exec sections.
977 (Target_powerpc::Relocate::relocate): Likewise.
978
979 2013-04-11 Alan Modra <amodra@gmail.com>
980
981 PR gold/15354
982 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
983 .branch_lt to match bfd ld. Adjust comments throughout file.
984
985 2013-04-04 Ian Lance Taylor <iant@google.com>
986
987 GCC PR c++/56840
988 * object.cc (do_layout_deferred_sections): Handle .eh_frame
989 sections before checking whether they are included in the link.
990
991 2013-03-29 Sriraman Tallam <tmsriram@google.com>
992
993 * archive.cc (Archive::get_elf_object_for_member): Create the elf
994 object before calling the plugin claim_file handler. Pass the elf
995 object of the archive to the plugin. Delete the elf object if the
996 plugin claims the file.
997
998 2013-03-21 Alan Modra <amodra@gmail.com>
999
1000 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1001 segment when omagic.
1002
1003 2013-03-21 Alan Modra <amodra@gmail.com>
1004
1005 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1006 comparison warning.
1007 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1008 uninitialized" warning.
1009
1010 2013-03-20 Alan Modra <amodra@gmail.com>
1011
1012 * symtab.h (Symbol::clear_version): New function.
1013 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1014 is_needed by weak references. Clear version for symbols defined
1015 in as-needed objects that are not needed.
1016
1017 2013-03-15 Alan Modra <amodra@gmail.com>
1018
1019 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1020 static and public. Add report_err param. Return false for data refs.
1021 (Target_powerpc::rela_dyn_section): New overloaded function.
1022 (Target_powerpc::plt_, iplt_): Elucidate.
1023 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1024 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1025 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1026 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1027 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1028 push_branch and make_plt_entry for ifunc syms when
1029 reloc_needs_plt_for_ifunc.
1030 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1031 for ifunc unless reloc_needs_plt_for_ifunc.
1032
1033 2013-03-15 Alan Modra <amodra@gmail.com>
1034
1035 * gc.h (gc_process_relocs): Don't look through function descriptors.
1036 * icf.cc (get_section_contents): Do so here instead.
1037
1038 2013-03-13 Alan Modra <amodra@gmail.com>
1039
1040 * powerpc.cc (is_branch_reloc): Forward declare.
1041 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1042 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1043 false for 64-bit, true for 32-bit non-branch relocs.
1044 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1045 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1046 nm output.
1047 (icf_safe_test): Generate linker map file as well as nm output.
1048 (icf_safe_so_test): Likewise.
1049 * testsuite/Makefile.in: Regenerate.
1050 * testsuite/icf_test.sh: Parse linker map file to determine
1051 section folding.
1052 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1053 * testsuite/icf_safe_so_test.sh: Likewise.
1054 (X86_32_or_ARM_specific_safe_fold): Merge into..
1055 (arch_specific_safe_fold): ..this.
1056 (X86_64_specific_safe_fold): Delete unused function.
1057
1058 2013-03-12 Alan Modra <amodra@gmail.com>
1059
1060 * gc.h (gc_process_relocs): Look through function descriptors
1061 to determine shndx, symvalue and addend used by ICF. Tidy
1062 variable duplication.
1063
1064 2013-03-11 Alan Modra <amodra@gmail.com>
1065
1066 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1067 * layout.cc (Layout_task_runner::run): ..to here.
1068 * symtab.h (struct Symbol_location): Extract from..
1069 (class Symbol_table): ..here.
1070 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1071 * target.h (class Target): Add function_location and
1072 do_function_location functions.
1073 (class Sized_target): Add do_function_location.
1074 * object.h (class Sized_relobj_file): Move find_shdr..
1075 (class Object): ..to here.
1076 * object.cc: Likewise. Update to suit. Instantiate.
1077 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1078 * powerpc.cc (class Powerpc_dynobj): New.
1079 (Target_powerpc::do_function_location): New function.
1080 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1081 (Powerpc_dynobj::do_read_symbols): New function.
1082 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1083
1084 2013-03-08 Ian Lance Taylor <iant@google.com>
1085
1086 * options.cc (General_options::string_to_object_format): Accept
1087 "default".
1088
1089 2013-03-08 Alan Modra <amodra@gmail.com>
1090
1091 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1092 pointer to Post_fde.
1093 (struct Post_fde): Move definition to here..
1094 * ehframe.cc (struct Post_fde): ..from here.
1095 (Cie::write): Don't alloc Post_fde.
1096 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1097
1098 2013-03-07 Alan Modra <amodra@gmail.com>
1099
1100 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1101 relocation referencing .LC0.
1102 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1103
1104 2013-03-07 Alan Modra <amodra@gmail.com>
1105
1106 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1107 always_inline. Add assembly for powerpc to avoid GOT.
1108
1109 2013-03-07 Alan Modra <amodra@gmail.com>
1110
1111 * testsuite/script_test_10.sh: Don't test .bss section
1112 header number.
1113
1114 2013-03-06 Alan Modra <amodra@gmail.com>
1115
1116 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1117 (Target_powerpc::symval_for_branch): Add symtab param. Update
1118 all callers. Handle folded sections.
1119 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1120 to Powerpc_relobj.
1121 (Global_symbol_visitor_opd::operator()): Likewise.
1122
1123 2013-03-04 Alan Modra <amodra@gmail.com>
1124
1125 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1126 * testsuite/Makefile.in: Regenerate.
1127
1128 2013-03-01 Cary Coutant <ccoutant@google.com>
1129
1130 Add dwp support for v2 DWARF package file format.
1131 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1132 tu_length parameter. Adjust all callers.
1133 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1134 * dwp.cc: Include dwarf.h.
1135 (Section_bounds): New struct type.
1136 (Unit_set): New struct type.
1137 (Dwo_file::Dwo_file): Initialize new data member.
1138 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1139 Combine and rename to...
1140 (Dwo_file::read_unit_index): ...this.
1141 (Dwo_file::sized_read_compunit_index)
1142 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1143 (Dwo_file::sized_read_unit_index): ...this.
1144 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1145 parameters; add section_id parameter.
1146 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1147 (Dwo_file::add_unit_set): ...this.
1148 (Dwo_file::shndx_map_): Remove.
1149 (Dwo_file::sect_offsets_): New data member.
1150 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1151 (Dwp_output_file::add_section): Rename to...
1152 (Dwp_output_file::add_contribution): ...this.
1153 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1154 (Dwp_output_file::add_tu_set): Likewise.
1155 (Dwp_output_file::Contribution): New type.
1156 (Dwp_output_file::Section::contributions): New data member.
1157 (Dwp_output_file::Cu_or_tu_set): Remove.
1158 (Dwp_output_file::Section::Section): New ctor.
1159 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1160 (Dwp_output_file::Dwp_index::Section_table): New type.
1161 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1162 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1163 parameter.
1164 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1165 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1166 (Dwp_output_file::Dwp_index::section_table): New member function.
1167 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1168 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1169 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1170 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1171 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1172 (Dwp_output_file::Dwp_index::section_table_): New data member.
1173 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1174 (Dwp_output_file::add_output_section): New member function.
1175 (Dwp_output_file::write_new_section): New member function.
1176 (Dwp_output_file::write_contributions): New member function.
1177 (Dwp_output_file::section_id_map_): New data member.
1178 (class Dwo_id_info_reader): Remove.
1179 (class Unit_reader): New class.
1180 (get_dwarf_section_name): New function.
1181 (Dwo_file::read_executable): Adjust initializations of class data.
1182 (Dwo_file::read): Add support for v2 package file format.
1183 (Dwo_file::read_unit_index): Likewise.
1184 (Dwo_file::sized_read_unit_index): Likewise.
1185 (Dwo_file::copy_section): Likewise.
1186 (Dwo_file::add_unit_set): Likewise.
1187 (Dwp_output_file::add_output_section): Likewise.
1188 (Dwp_output_file::add_contribution): Likewise.
1189 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1190 for empty slot.
1191 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1192 file format.
1193 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1194 slot.
1195 (Dwp_output_file::initialize): Remove unused function.
1196 (Dwp_output_file::finalize): Add support for v2 package file format.
1197 (Dwp_output_file::write_index): Likewise.
1198 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1199 function prototype.
1200
1201 2013-03-01 Cary Coutant <ccoutant@google.com>
1202
1203 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1204 function into class definition in header file.
1205 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1206 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1207 New function.
1208 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1209
1210 2013-02-28 Alan Modra <amodra@gmail.com>
1211
1212 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1213 * target.cc (Target::do_plt_fde_location): New function.
1214 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1215 accessor function, and constructor param.
1216 (struct Post_fde, Post_fdes): Declare.
1217 (Cie::write): Add post_fdes param.
1218 * ehframe.cc (Fde::write): Use plt_fde_location.
1219 (struct Post_fde): Define.
1220 (Cie::write): Stash FDEs added post merge mapping.
1221 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1222 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1223 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1224 other FDEs.
1225 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1226 (Target_powerpc::has_glink): New function.
1227 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1228 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1229 glink_eh_frame_fde_32, default_fde): New data.
1230 (Stub_table::eh_frame_added_): New var.
1231 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1232 Make const.
1233 (Stub_table::add_eh_frame): New function.
1234 (Output_data_glink::add_eh_frame): New function.
1235 (Target_powerpc::make_glink_section): Call add_eh_frame.
1236
1237 2013-02-15 Ian Lance Taylor <iant@google.com>
1238
1239 * options.h (DEFINE_uint64_alias): Define.
1240 (class General_options): Add -Ttext-segment as an alias for
1241 -Ttext.
1242
1243 2013-02-15 Alan Modra <amodra@gmail.com>
1244
1245 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1246 (Stub_table::do_write): ..here, two places.
1247 (Stub_table::plt_call_size): Use it here too.
1248
1249 2013-02-11 Ian Lance Taylor <iant@google.com>
1250
1251 * descriptors.cc (Descriptors::close_all): New function.
1252 * descriptors.h (class Descriptors): Declare close_all.
1253 (close_all_descriptors): New inline function.
1254 * plugin.cc: Include "descriptors.h".
1255 (Plugin_manager::cleanup): Call close_all_descriptors.
1256
1257 2013-02-06 Alan Modra <amodra@gmail.com>
1258
1259 * README: Update coding style link.
1260
1261 2013-01-28 Cary Coutant <ccoutant@google.com>
1262
1263 * dwp.cc (File_list): New typedef.
1264 (Dwo_name_info_reader): New class.
1265 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1266 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1267 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1268 (Dwo_file::read_executable): New function.
1269 (Dwo_file::read): Move common setup code to ...
1270 (Dwo_file::make_object): ... here.
1271 (dwp_options): Add --exec/-e.
1272 (usage): Likewise.
1273 (main): Likewise.
1274
1275 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1276
1277 * layout.cc (Layout::layout): Check for option text_reorder.
1278 (Layout::make_output_section): Ditto.
1279 * options.h (text_reorder): New option.
1280 * output.cc (Input_section_sort_compare): Remove special ordering
1281 of section names.
1282 (Output_section::
1283 Input_section_sort_section_name_special_ordering_compare::
1284 operator()): New function.
1285 (Output_section::sort_attached_input_sections): Use new sort function
1286 for .text.
1287 * output.h (Input_section_sort_section_name_special_ordering_compare):
1288 New struct.
1289 * testsuite/Makefile.am (text_section_grouping): Test option
1290 --no-text-reorder
1291 * testsuite/Makefile.in: Regenerate.
1292 * testsuite/text_section_grouping.sh: Check order of functions without
1293 default text reordering.
1294
1295 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1296
1297 * options.h (General_options): Change default to true for new_dtags.
1298
1299 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1300
1301 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1302 when enable_new_dtags is false. Only add DT_RUNPATH when
1303 enable_new_dtags is true.
1304
1305 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1306
1307 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1308 used in declaration and definition consistent.
1309 (Target_powerpc::symval_for_branch): Ditto.
1310
1311 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1312
1313 * testsuite/plugin_final_layout.cc: Fix comment.
1314
1315 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1316
1317 * layout.cc (Layout::layout): Do not do default sorting for
1318 text sections when section ordering is specified.
1319 (make_output_section): Ditto.
1320 * testsuite/plugin_final_layout.cc: Name the function sections
1321 to catch reordering issues.
1322
1323 2013-01-15 Alan Modra <amodra@gmail.com>
1324
1325 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1326 plt-thread-safe.
1327
1328 2013-01-15 Alan Modra <amodra@gmail.com>
1329
1330 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1331 * testsuite/Makefile.in: Regenerate.
1332
1333 2013-01-14 Alan Modra <amodra@gmail.com>
1334
1335 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1336 * testsuite/Makefile.in: Regenerate.
1337
1338 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1339
1340 PR bfd/14430
1341 Fix mingw gold build with plugins enabled
1342 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1343 * configure.ac: Export DLOPEN_LIBS and add headers check.
1344 * plugin.cc: Handle non-dlfcn case.
1345 * Makefile.in: Regenerate.
1346 * config.in: Regenerate.
1347 * configure: Regenerate.
1348 * testsuite/Makefile.in: Regenerate.
1349
1350 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1351
1352 * output.h (sort_attached_input_sections): Change to be public.
1353 * script-sections.cc
1354 (Output_section_definition::set_section_addresses): Sort
1355 attached input sections according to section order before linker
1356 script assigns section addresses.
1357 (Orphan_output_section::set_section_addresses): Sort
1358 attached input sections according to section order before linker
1359 script assigns section addresses.
1360 * Makefile.am (final_layout.sh): Use a simple linker script to
1361 check if section ordering still works.
1362 * Makefile.in: Regenerate.
1363
1364 2013-01-09 Ben Cheng <bccheng@google.com>
1365
1366 * arm.cc (Target_arm::attributes_accept_div): New function.
1367 (Target_arm::attributes_forbid_div): New function.
1368 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1369 attribute using the same new functions as what bfd/elf32_arm.c
1370 does.
1371
1372 2013-01-07 Cary Coutant <ccoutant@google.com>
1373
1374 PR gold/14993
1375 * output.cc (Output_section::add_input_section): For incremental
1376 updates, don't track input sections that are allocated from patch
1377 space.
1378
1379 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1380 Ian Lance Taylor <iant@google.com>
1381
1382 PR gold/14897
1383 * configure.ac (--enable-ld): Removed.
1384 (install_as_default): Set to yes only for --enable-gold=default
1385 or --disable-ld.
1386 * configure: Regenerated.
1387
1388 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1389
1390 * options.h (General_options): Add -fuse-ld= for GCC linker
1391 option compatibility.
1392
1393 2013-01-04 Cary Coutant <ccoutant@google.com>
1394
1395 * configure.ac: Fix typo restoring CXXFLAGS.
1396 * configure: Regenerate.
1397
1398 2013-01-04 Cary Coutant <ccoutant@google.com>
1399
1400 * testsuite/Makefile.am (CXXLINK_S): New macro.
1401 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1402 * testsuite/Makefile.in: Regenerate.
1403
1404 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1405
1406 * version.cc (print_version): Update copyright year to 2013.
1407
1408 2012-12-20 Ian Lance Taylor <iant@google.com>
1409
1410 * layout.cc (Layout::special_ordering_of_input_section): New
1411 function.
1412 (Layout::layout): If input section requires special ordering, must
1413 sort input sections.
1414 (Layout::make_output_section): May sort .text input sections.
1415 (Layout::is_section_name_prefix_grouped): Remove.
1416 * layout.h (class Layout): Declare
1417 special_ordering_of_input_section. Don't declare
1418 is_section_name_prefix_grouped.
1419 * output.cc (Output_section::add_input_section): Revert last
1420 change.
1421 (Output_section::Input_section_sort::match_file_name): Don't crash
1422 if called on output section data.
1423 (Output_section::Input_section_sort_compare): Sort based on
1424 special ordering.
1425 (Output_section::Input_section_sort_section_order_index_compare):
1426 Revert last patch.
1427 (Output_section::sort_attached_input_sections): Likewise.
1428
1429 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1430
1431 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1432 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1433 * output.cc (Output_section::add_input_section): Check if section
1434 name contains special prefix. Keep input sections to sort such
1435 sections.
1436 (Output_section::Input_section_sort_section_order_index_compare
1437 ::operator()): Group sections according to prefixes.
1438 (Output_section::sort_attached_input_sections): Add condition to
1439 Input_section_entry constructor call.
1440 * testsuite/Makefile.am (text_section_grouping): New test.
1441 * testsuite/Makefile.in: Regenerate.
1442 * testsuite/text_section_grouping.cc: New file.
1443 * testsuite/text_section_grouping.sh: New file.
1444
1445 2012-12-17 Nick Clifton <nickc@redhat.com>
1446
1447 * Makefile.am: Add copyright notice.
1448 * NEWS: Likewise.
1449 * README: Likewise.
1450 * configure.ac: Likewise.
1451 * ftruncate.c: Likewise.
1452 * Makefile.in: Regenerate.
1453
1454 2012-12-14 Cary Coutant <ccoutant@google.com>
1455
1456 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1457 --no-as-needed flag.
1458 (exception_separate_shared_12_test): Likewise.
1459 (incremental_copy_test): Likewise.
1460 * testsuite/Makefile.in: Regenerate.
1461
1462 2012-12-14 Cary Coutant <ccoutant@google.com>
1463
1464 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1465 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1466
1467 2012-12-12 Alan Modra <amodra@gmail.com>
1468
1469 * powerpc.cc (class Track_tls): New.
1470 (class Relocate, class Scan): Inherit Track_tls.
1471 (Target_powerpc::Scan::local, global): Track tls optimization
1472 and avoid creating plt entry for __tls_get_addr if all uses
1473 are optimized away.
1474 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1475
1476 2012-12-12 Alan Modra <amodra@gmail.com>
1477
1478 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1479 Replace no_toc_optimize with toc_optimize.
1480 * output.h (Output_section::input_sections): Provide non-const variant.
1481 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1482 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1483 accessors.
1484 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1485 (class Sort_toc_sections): New.
1486 (Target_powerpc::do_finalize_sections): Sort toc sections.
1487 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1488
1489 2012-12-10 Roland McGrath <mcgrathr@google.com>
1490
1491 * testsuite/binary_unittest.cc (read_all): New function.
1492 (Sized_binary_test): Use it instead of ::read.
1493 * fileread.cc (do_read): Don't assume pread always reads the whole
1494 amount in a single call.
1495
1496 2012-12-10 Alan Modra <amodra@gmail.com>
1497
1498 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1499 Set EM_PPC64 or EM_PPC here.
1500 (Target_selector_powerpc::do_recognize): Delete.
1501
1502 2012-12-10 Alan Modra <amodra@gmail.com>
1503
1504 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1505 stub_table_.
1506 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1507
1508 2012-12-07 Roland McGrath <mcgrathr@google.com>
1509
1510 * testsuite/binary_unittest.cc (Sized_binary_test):
1511 Use open_descriptor rather than ::open.
1512
1513 2012-12-07 Alan Modra <amodra@gmail.com>
1514
1515 * powerpc.cc (Stub_table::do_write): Delete redundant Address
1516 typedef and invalid_address constant.
1517 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1518 instantiate constants.
1519
1520 2012-12-06 Roland McGrath <mcgrathr@google.com>
1521
1522 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1523 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1524 * aclocal.m4: Regenerate.
1525 * configure: Regenerate.
1526 * Makefile.in: Regenerate.
1527 * testsuite/Makefile.in: Regenerate.
1528
1529 2012-12-07 Alan Modra <amodra@gmail.com>
1530
1531 * options.h (General_options): Add no_toc_optimize.
1532 * powerpc.cc (ok_lo_toc_insn): New function.
1533 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1534
1535 2012-12-06 Alan Modra <amodra@gmail.com>
1536
1537 * options.h (General_options): Add plt_align, plt_static_chain,
1538 plt_thread_safe. Update stub_group_size help text.
1539 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1540 for new plt_thread_safe_ var.
1541 (use_plt_offset): Correct comments.
1542 (Target_powerpc::do_relax): Look for thread creation symbols to
1543 determine default plt_thread_safe value. Clear plt call stubs
1544 as well as branch stubs each iteration.
1545 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1546 insn constants.
1547 (l, hi, ha, write_insn): Move earlier.
1548 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1549 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1550 plt stubs too.
1551 (Stub_table::update_size): Adjust.
1552 (Stub_table::prev_size, set_prev_size): Delete.
1553 (Stub_table::stub_align): Let --plt-align affect result.
1554 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1555 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1556 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1557 (Stub_table::do_write): Support more stub variants.
1558
1559 2012-12-04 Alan Modra <amodra@gmail.com>
1560
1561 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1562 (Target_powerpc::do_define_standard_symbols): New function.
1563
1564 2012-12-03 Alan Modra <amodra@gmail.com>
1565
1566 * output.h: Formatting, whitespace.
1567
1568 2012-12-03 Alan Modra <amodra@gmail.com>
1569
1570 * layout.h (Layout::get_executable_sections): Declare.
1571 * layout.cc (Layout::get_executable_sections): New function.
1572 * arm.cc (Target_arm::group_sections): Use it.
1573 (Arm_output_section::group_sections): Delete now redundant test.
1574 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1575 param to handle relative relocs.
1576 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1577 (Output_data_reloc::add_absolute): Adjust.
1578 (Output_data_reloc::add_relative): New function.
1579 (Output_data::reset_data_size): New function.
1580 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1581 (Output_section::set_addralign): New function.
1582 (Output_section::checkpoint_set_addralign): New function.
1583 (Output_section::clear_section_offsets_need_adjustment): New function.
1584 (Output_section::input_sections): Make public.
1585 * powerpc.cc (class Output_data_brlt_powerpc): New.
1586 (class Stub_table, class Stub_control): New.
1587 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1588 stub_table_, set_stub_table, stub_table): New vectors and accessor
1589 functions.
1590 (Target_powerpc::do_may_relax, do_relax, push_branch,
1591 new_stub_table, stub_tables, brlt_section, group_sections,
1592 add_branch_lookup_table, find_branch_lookup_table,
1593 write_branch_lookup_table, make_brlt_section): New functions.
1594 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1595 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1596 branch_info_): New vars.
1597 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1598 make call stubs here.
1599 (Output_data_glink): Remove all call stub handling from this class.
1600 (Target_powerpc::Scan::local, global): Save interesting branch
1601 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1602 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1603 functions on final link.
1604 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1605 Handle long branch destinations too.
1606 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1607 do_plt_address_for_local): Adjust lookup of plt call stubs.
1608
1609 2012-11-30 Alan Modra <amodra@gmail.com>
1610
1611 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1612 relocs against protected symbols when building 32-bit shared libs.
1613
1614 2012-11-30 Alan Modra <amodra@gmail.com>
1615
1616 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1617 param. Call got_section() to make .got. Update all callers
1618 and their callers and so on.
1619
1620 2012-11-30 Alan Modra <amodra@gmail.com>
1621
1622 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1623 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1624 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1625 value if it already exists.
1626
1627 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1628
1629 PR gold/14858
1630 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1631
1632 2012-11-14 Roland McGrath <mcgrathr@google.com>
1633
1634 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1635 than bfc instruction for data sandboxing.
1636
1637 2012-11-08 Alan Modra <amodra@gmail.com>
1638
1639 * po/POTFILES.in: Regenerate.
1640
1641 2012-11-05 Alan Modra <amodra@gmail.com>
1642
1643 * configure.ac: Apply 2012-09-10 change to config.in here.
1644 * configure: Regenerate.
1645
1646 2012-11-05 Alan Modra <amodra@gmail.com>
1647
1648 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1649 (struct Opd_ent): Use "Address" rather than "Offset".
1650 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1651 (Target_powerpc::got_section): Make public.
1652 (Target_powerpc::scan_relocs): Move code setting symbols..
1653 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1654 Create _SDA_BASE_ only when referenced.
1655
1656 2012-11-02 Roland McGrath <mcgrathr@google.com>
1657
1658 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1659 from last change.
1660
1661 2012-11-01 Roland McGrath <mcgrathr@google.com>
1662
1663 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1664 for offset_in_output_section parameter.
1665 (Sized_target::relocate_special_relocatable): Likewise.
1666 * arm.cc (Target_arm::relocate_relocs): Likewise.
1667 (Target_arm::relocate_special_relocatable): Likewise.
1668 * i386.cc (Target_i386::relocate_relocs): Likewise.
1669 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1670 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1671 * target-reloc.h (relocate_relocs): Likewise.
1672 * testsuite/testfile.cc (Target_test): Likewise.
1673 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1674 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1675
1676 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1677 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1678
1679 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1680 parameter, which is unused in the [!F_SETFD] case.
1681
1682 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1683 SYMNDX to off_t before comparing it to this->data_size().
1684 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1685 * incremental.cc (Output_section_incremental_inputs::do_write):
1686 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1687
1688 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1689
1690 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1691
1692 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1693 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1694 in EABI_VER5.
1695
1696 2012-10-29 Cary Coutant <ccoutant@google.com>
1697
1698 * dwp.cc (usage): Add file and exit status parameters;
1699 add --help and --version options.
1700 (print_version): New function.
1701 (main): Add --help and --version options.
1702
1703 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1704
1705 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1706 final_layout_sequence.txt.
1707 * testsuite/Makefile.in: Regenerated.
1708
1709 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1710
1711 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1712 COMPILE generated by automake.
1713 (LINK1): Likewise.
1714 (CXXCOMPILE1): Likewise.
1715 (CXXLINK1): Likewise.
1716 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1717 (LINK): Likewise.
1718 (CXXCOMPILE): Likewise.
1719 (CXXLINK): Likewise.
1720 * testsuite/Makefile.in: Regenerated.
1721
1722 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1723
1724 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1725 on bad fwrite return.
1726
1727 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1728
1729 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1730 on val.
1731
1732 2012-10-23 Cary Coutant <ccoutant@google.com>
1733
1734 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1735 * testsuite/Makefile.in: Regenerate.
1736 * testsuite/dwp_test.h: New source file.
1737 * testsuite/dwp_test_1.cc: New source file.
1738 * testsuite/dwp_test_1.s: New source file.
1739 * testsuite/dwp_test_1.sh: New source file.
1740 * testsuite/dwp_test_1b.cc: New source file.
1741 * testsuite/dwp_test_1b.s: New source file.
1742 * testsuite/dwp_test_2.cc: New source file.
1743 * testsuite/dwp_test_2.s: New source file.
1744 * testsuite/dwp_test_2.sh: New source file.
1745 * testsuite/dwp_test_main.cc: New source file.
1746 * testsuite/dwp_test_main.s: New source file.
1747
1748 2012-10-23 Cary Coutant <ccoutant@google.com>
1749
1750 * dwp.h: New header file.
1751 * dwp.cc: New source file.
1752 * gold.h: Move shared declarations to system.h.
1753 * system.h: New header file.
1754 * Makefile.am: Add dwp.
1755 * Makefile.in: Regenerate.
1756
1757 2012-10-23 Cary Coutant <ccoutant@google.com>
1758
1759 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1760 Dwarf_info_reader::read_from_pointer.
1761 (Dwarf_pubnames_table::read_header): Likewise.
1762 (Dwarf_pubnames_table::next_name): Likewise.
1763 (Dwarf_die::read_attributes): Likewise.
1764 (Dwarf_die::skip_attributes): Likewise.
1765 (Dwarf_info_reader::read_from_pointer): New function template.
1766 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1767 (Dwarf_pubnames_table): Likewise.
1768 (Dwarf_info_reader::read_from_pointer): New function template.
1769 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1770 Dwarf_pubnames_table ctor.
1771
1772 2012-10-23 Cary Coutant <ccoutant@google.com>
1773
1774 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1775 abbrev_shndx.
1776 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1777 abbrev_shndx_.
1778 (Dwarf_info_reader::set_abbrev_shndx): New method.
1779 (Dwarf_info_reader::abbrev_shndx_): New data member.
1780
1781 2012-10-23 Cary Coutant <ccoutant@google.com>
1782
1783 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1784 from object, not parameters.
1785 (Dwarf_info_reader::parse): Likewise.
1786 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1787 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1788 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1789 methods.
1790
1791 2012-10-23 Cary Coutant <ccoutant@google.com>
1792
1793 * fileread.cc (Input_file::Input_file): New constructor.
1794 * fileread.h (class Input_file): Add new constructor.
1795
1796 2012-10-18 Alan Modra <amodra@gmail.com>
1797
1798 PR gold/14727
1799 * object.cc (Relobj::is_section_name_included): Also match
1800 .sdata personality section.
1801
1802 2012-10-18 Alan Modra <amodra@gmail.com>
1803
1804 * target-reloc.h (class Default_comdat_behavior): New, package up..
1805 (get_comdat_behaviour): ..this.
1806 (relocate_section): Add Relocate_comdat_behavior template arg,
1807 adjust code to suit.
1808 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1809 (Target_arm::scan_reloc_section): Likewise.
1810 * i386.cc (Target_i386::relocate_section): Likewise.
1811 * sparc.cc (Target_sparc::relocate_section): Likewise.
1812 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1813 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1814 * powerpc.cc (class Relocate_comdat_behavior): New.
1815 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1816 gold::relocate_section with new template arg.
1817
1818 2012-10-18 Alan Modra <amodra@gmail.com>
1819
1820 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1821 dynamic relocs for GOT_TPREL got entries, without symbol if
1822 resolving locally.
1823 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1824 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1825 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1826
1827 2012-10-17 Alan Modra <amodra@gmail.com>
1828
1829 PR gold/14726
1830 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1831
1832 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1833
1834 * layout.cc (Layout::include_section): Keep sections marked
1835 SHF_EXCLUDE when doing relocatable links.
1836
1837 2012-10-16 Alan Modra <amodra@gmail.com>
1838
1839 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1840 (Target_powerpc::do_finalize_sections): Call it.
1841 (Output_data_save_res): New class and supporting functions.
1842 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1843 normal symbols defined in object files.
1844
1845 2012-10-12 Alan Modra <amodra@gmail.com>
1846
1847 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1848 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1849 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1850 section if scan_opd_relocs not yet called.
1851 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1852
1853 2012-10-12 Alan Modra <amodra@gmail.com>
1854
1855 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1856 add_local_ifunc_entry): Revert last change.
1857 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1858
1859 2012-10-05 Alan Modra <amodra@gmail.com>
1860
1861 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1862 do_plt_address_for_global): New functions.
1863 (Output_data_got_powerpc::do_write): Don't segfault when linking
1864 statically.
1865 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1866 add_local_ifunc_entry): Return true on adding entry..
1867 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1868 glink->add_entry call. Remove unused symtab param. Adjust calls.
1869 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1870 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1871 set up symbols here.
1872 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1873 syms here. Do so even when no .iplt. Don't segfault when linking
1874 statically.
1875 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1876 new variants without reloc param.
1877 (Glink_sym_ent::Glink_sym_ent): Likewise.
1878 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1879 reloc when refs will resolve to plt call stub.
1880 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1881 R_PPC_PLTREL24 to resolve locally.
1882 (Target_powerpc::Scan::global): Correct ifunc handling.
1883 (Target_powerpc::Relocate::relocate): Correct local sym glink
1884 lookup. Don't destroy "value" when we have a plt call stub,
1885 and when checking plt call validity.
1886 (Target_powerpc::do_dynsym_value): Simplify.
1887
1888 2012-10-05 Alan Modra <amodra@gmail.com>
1889
1890 * i386.cc (Output_data_plt_i386::address_for_global,
1891 address_for_local): Add plt offset to returned value. Adjust uses.
1892 * sparc.cc (Output_data_plt_sparc::address_for_global,
1893 address_for_local): Likewise.
1894 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1895 address_for_local): Likewise.
1896 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1897 address_for_local): Likewise.
1898 * target.h (Target::plt_address_for_global, plt_address_for_local):
1899 Update comment.
1900 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1901 (Output_data_got::Got_entry::write): Nor here.
1902 * output.h: Comment fix.
1903
1904 2012-10-02 Jiong Wang <jiwang@tilera.com>
1905
1906 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1907 global_offset_table_ value for larget got.
1908 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1909
1910 2012-09-29 Alan Modra <amodra@gmail.com>
1911
1912 * powerpc.cc (Target_powerpc::iplt_): New output section.
1913 (Target_powerpc::iplt_section, make_iplt_section,
1914 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1915 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1916 Target_powerpc::plt_entry_count): Count iplt entries too.
1917 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1918 reloc section in constructor. New params.
1919 (Target_powerpc::make_plt_section): Create reloc section here instead.
1920 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1921 functions.
1922 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1923 (Output_data_glink::add_entry, find_entry): New functions to
1924 deal with local syms.
1925 (Glink_sym_ent): Add support for local syms.
1926 (Output_data_glink::do_write): Handle ifunc plt entries.
1927 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1928 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1929 (Target_powerpc::Relocate::relocate): Likewise.
1930 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1931
1932 2012-09-25 Alan Modra <amodra@gmail.com>
1933
1934 * object.h (Sized_relobj_file::adjust_local_symbol,
1935 do_adjust_local_symbol): New functions.
1936 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1937 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1938 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1939 and irregular opd entry spacing.
1940 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1941 (Global_symbol_visitor_opd): New functor.
1942 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1943 on deleted opd entries.
1944
1945 2012-09-15 Jiong Wang <jiwang@tilera.com>
1946
1947 * tilegx.cc: New file.
1948 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1949 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1950 * configure.tgt: Add entries for tilegx*.
1951 * configure.ac: Likewise.
1952 * Makefile.in: Rebuild.
1953 * configure: Likewise.
1954 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1955 tilegx.
1956
1957 2012-09-13 Alan Modra <amodra@gmail.com>
1958
1959 * target-reloc.h (scan_relocs): Call scan.local for relocs
1960 against symbols in discarded sections. Pass is_discarded
1961 param.
1962 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1963 Add is_discarded param.
1964 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1965 is_discarded to flag opd entry as discarded. Don't emit dyn
1966 relocs on such entries.
1967 (Target_powerpc::Scan::global): Similarly detect and handle
1968 such opd entries.
1969 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1970 opd_ent_. Update all uses.
1971 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1972 (Target_powerpc::relocate_section): Zero out discarded opd
1973 entry relocs.
1974
1975 2012-09-12 Ian Lance Taylor <iant@google.com>
1976
1977 PR gold/14570
1978 * output.cc: Rename Output_data_got template parameter from size
1979 to got_size for all functions. Compile all variants of
1980 Output_data_got.
1981 (Output_data_got::Got_entry::write): Correct use of size for
1982 symbol value. Use local_is_tls rather than casting to
1983 Sized_relobj_file.
1984 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1985 (class Sized_relobj_file): Add do_local_is_tls.
1986 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1987
1988 2012-09-11 Alan Modra <amodra@gmail.com>
1989
1990 PR gold/14566
1991 * layout.cc (Layout::set_segment_offsets): When using
1992 common-page-size alignment, ensure we are on a new max-page-size
1993 page.
1994 * output.cc (Output_segment::set_section_addresses): Use
1995 abi_pagesize, not common_pagesize for relro boundary.
1996 (Output_segment::set_offset): Likewise.
1997
1998 2012-09-11 Alan Modra <amodra@gmail.com>
1999
2000 * output.h (Output_data_got::add_global_tls, add_local_tls,
2001 add_local_tls_pair): New functions.
2002 (Output_data_got::add_local_pair_with_rel): Remove second
2003 reloc param. Expand comment.
2004 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2005 use_plt_or_tls_offset_, similarly for constructor param.
2006 (Output_data_got::Got_entry::write): Add got_index param.
2007 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2008 add_local_tls_pair): New functions.
2009 (Output_data_got::Got_entry::write): Handle tls symbols
2010 with use_plt_or_tls_offset_ set specially.
2011 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2012 (Output_data_got::do_write): Replace iterator with index, pass
2013 index to entry write function.
2014 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2015 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2016 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2017 call.
2018 * i386.cc (Target_i386::Scan::local): Likewise.
2019 * sparc.cc (Target_sparc::Scan::local): Likewise.
2020 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2021 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2022 do_tls_offset_for_global): New functions.
2023 (Target_powerpc::Scan::local): Correct TLS relocations and got
2024 entry values.
2025 (Target_powerpc::Scan::global): Don't emit unnecessary
2026 dynamic relocations on TLS GOT entries.
2027
2028 2012-09-10 Matthias Klose <doko@ubuntu.com>
2029
2030 * config.in: Disable sanity check for kfreebsd.
2031
2032 2012-09-10 Sterling Augustine <saugustine@google.com>
2033
2034 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2035 (Gdb_index::pubtypes_read): New parameter.
2036 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2037 to calls.
2038 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2039 pubtypes_object_.
2040
2041 2012-09-09 Alan Modra <amodra@gmail.com>
2042
2043 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2044 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2045 * gc.h (gc_process_relocs): Call target gc_add_reference.
2046 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2047 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2048 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2049 unnecessary cast.
2050 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2051 to cater for when we don't need code offset. Update use.
2052 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2053 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2054 set_opd_valid): New functions.
2055 (Target_powerpc::do_gc_add_reference): New function.
2056 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2057 stashed refs.
2058 (Target_powerpc::do_gc_mark_symbol): New function.
2059
2060 2012-09-06 Cary Coutant <ccoutant@google.com>
2061
2062 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2063 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2064 (Dwarf_die::skip_attributes): Likewise.
2065 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2066 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2067 (main): Call it.
2068 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2069
2070 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2071
2072 * testsuite/script_test_3.t: Add .got.plt output section
2073 statement.
2074 * testsuite/script_test_4.t: Likewise.
2075
2076 2012-09-05 Alan Modra <amodra@gmail.com>
2077
2078 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2079 update all uses and lose "enum" when using type.
2080
2081 2012-09-05 Alan Modra <amodra@gmail.com>
2082
2083 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2084 * configure: Regenerate.
2085 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2086 (plugin_final_layout.stdout): Likewise.
2087 (memory_test): Set page sizes to 0x1000.
2088 * testsuite/Makefile.in: Regenerate.
2089 * testsuite/discard_locals_test.sh: Add FIXME comment.
2090 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2091 * testsuite/pr14265.t: Add .got output section statement.
2092 * testsuite/script_test_2.t: Likewise.
2093 * testsuite/script_test_3.t: Likewise.
2094 * testsuite/script_test_4.t: Likewise.
2095 * testsuite/script_test_5.t: Likewise.
2096 * testsuite/script_test_6.t: Likewise.
2097 * testsuite/script_test_7.t: Likewise.
2098 * testsuite/script_test_9.t: Likewise.
2099
2100 2012-09-05 Alan Modra <amodra@gmail.com>
2101
2102 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2103 (Powerpc_relocate_functions::Status): New typedef.
2104 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2105 (Target_powerpc::Scan::local): Handle REL64.
2106 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2107 for REL32 and REL64.
2108 (Target_powerpc::symval_for_branch): New function, extracted from..
2109 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2110 checks. Report overflow errors.
2111
2112 2012-09-05 Alan Modra <amodra@gmail.com>
2113
2114 * object.h (Sized_relobj_file::emit_relocs): Delete.
2115 (Sized_relobj_file::emit_relocs_reltype): Delete.
2116 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2117 relocate_relocs for --emit-relocs.
2118 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2119 * output.h: Update comment.
2120 (Output_segment::first_section): New function.
2121 (Output_segment::first_section_load_address): Use first_section.
2122 * output.cc (Output_segment::first_section): New function extracted..
2123 (Output_segment::first_section_load_address): ..from here. Delete.
2124 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2125 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2126 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2127 adjust call to target.h function.
2128 * i386.cc (Target_i386): Likewise.
2129 * sparc.cc (Target_sparc): Likewise.
2130 * x86_64.cc (Target_x86_64): Likewise.
2131 * powerpc.cc (Target_powerpc): Likewise.
2132 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2133 first tls section has section symbol for optimised local dynamic
2134 output relocs.
2135 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2136 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2137 optimised tls code.
2138 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2139 Rename to relocate_relocs. Update error message.
2140
2141 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2142
2143 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2144 --just-symbols.
2145
2146 2012-08-31 Alan Modra <amodra@gmail.com>
2147
2148 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2149 (Powerpc_relobj::toc_base_offset): New stub function.
2150 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2151 got_mod_index_offset to tlsld_got_offset. Update all refs.
2152 (Target_powerpc::Relocate::enum skip_tls): New.
2153 (Target_powerpc::call_tls_get_addr_): New var.
2154 (Target_powerpc::is_branch_reloc): Move to file scope.
2155 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2156 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2157 New functions.
2158 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2159 (powerpc_info): Correct common_pagesize for ppc64.
2160 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2161 (Powerpc_relocate_functions): Add overflow check enums and functions.
2162 Add non-shift version of rela, rela_ua. Delete all rel public
2163 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2164 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2165 addr16_ha3, addr14 functions.
2166 (Output_data_got_powerpc::add_constant_pair): New function.
2167 (Output_data_got_powerpc::got_base_offset): Likewise.
2168 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2169 (instruction constants): Sort, add some more.
2170 (Output_data_glink::do_write): Add and use Address typedef. Use
2171 object->toc_base_offset() stub for 64-bit.
2172 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2173 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2174 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2175 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2176 Always treat .opd relocs as against locally defined symbol.
2177 Correct condition for RELATIVE relocs.
2178 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2179 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2180 for 32-bit syms with a plt entry. Correct ppc64 toc base
2181 calculations. Handle TLS relocs, and more. Add overflow
2182 checking and adjust for Powerpc_relocate_functions changes.
2183 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2184 Reinstate --emit-relocs code with FIXME.
2185
2186 2012-08-30 Alan Modra <amodra@gmail.com>
2187
2188 * layout.cc (Layout::set_segment_offsets): Set p_align to
2189 abi_pagesize, not common_pagesize.
2190 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2191 to determine whether file header can go in segment.
2192
2193 2012-08-30 Alan Modra <amodra@gmail.com>
2194
2195 * output.h (Output_reloc::Output_reloc <output section>): Add
2196 is_relative param. Adjust calls.
2197 (Output_reloc::add_output_section_relative): New functions.
2198 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2199 is_relative.
2200 (Output_reloc::symbol_value): Handle SECTION_CODE.
2201
2202 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2203
2204 * gold.cc (queue_middle_tasks): Call layout again when unique
2205 segments for sections is desired.
2206 * layout.cc (Layout::Layout): Initialize new members.
2207 (Layout::get_output_section_flags): New function.
2208 (Layout::choose_output_section): Call get_output_section_flags.
2209 (Layout::layout): Make output section for mapping to a unique segment.
2210 (Layout::insert_section_segment_map): New function.
2211 (Layout::attach_allocated_section_to_segment): Make unique segment for
2212 output sections marked so.
2213 (Layout::segment_precedes): Check for unique segments when sorting.
2214 * layout.h (Layout::Unique_segment_info): New struct.
2215 (Layout::Section_segment_map): New typedef.
2216 (Layout::insert_section_segment_map): New function.
2217 (Layout::get_output_section_flags): New function.
2218 (Layout::is_unique_segment_for_sections_specified): New function.
2219 (Layout::set_unique_segment_for_sections_specified): New function.
2220 (Layout::unique_segment_for_sections_specified_): New member.
2221 (Layout::section_segment_map_): New member.
2222 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2223 Rename is_gc_pass_one to is_pass_one.
2224 Rename is_gc_pass_two to is_pass_two.
2225 Rename is_gc_or_icf to is_two_pass.
2226 Check for which pass based on whether symbols data is present.
2227 Make it two pass when unique segments for sections is desired.
2228 * output.cc (Output_section::Output_section): Initialize new
2229 members.
2230 * output.h (Output_section::is_unique_segment): New function.
2231 (Output_section::set_is_unique_segment): New function.
2232 (Output_section::is_unique_segment_): New member.
2233 (Output_section::extra_segment_flags): New function.
2234 (Output_section::set_extra_segment_flags): New function.
2235 (Output_section::extra_segment_flags_): New member.
2236 (Output_section::segment_alignment): New function.
2237 (Output_section::set_segment_alignment): New function.
2238 (Output_section::segment_alignment_): New member.
2239 (Output_segment::Output_segment): Initialize is_unique_segment_.
2240 (Output_segment::is_unique_segment): New function.
2241 (Output_segment::set_is_unique_segment): New function.
2242 (Output_segment::is_unique_segment_): New member.
2243 * plugin.cc (allow_unique_segment_for_sections): New function.
2244 (unique_segment_for_sections): New function.
2245 (Plugin::load): Add new functions to transfer vector.
2246 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2247 * Makefile.in: Regenerate.
2248 * testsuite/plugin_final_layout.sh: Check if unique segment
2249 functionality works.
2250 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2251 are available.
2252 (allow_unique_segment_for_sections): New global.
2253 (unique_segment_for_sections): New global.
2254 (claim_file_hook): Call allow_unique_segment_for_sections.
2255 (all_symbols_read_hook): Call unique_segment_for_sections.
2256
2257 2012-08-22 Cary Coutant <ccoutant@google.com>
2258
2259 * layout.cc (Layout::include_section): Don't assert on GROUP
2260 sections with --emit-relocs.
2261
2262 2012-08-21 Cary Coutant <ccoutant@google.com>
2263
2264 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2265 if --export-dynamic-symbol names an undef symbol.
2266
2267 2012-08-18 Alan Modra <amodra@gmail.com>
2268
2269 * powerpc.cc: Formatting and white space.
2270 (Powerpc_relobj): Rename got2_section_ to special_.
2271 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2272 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2273 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2274 (Target_powerpc): Add Address typedef and invalid_address. Use
2275 throughout.
2276 (Target_powerpc::is_branch_reloc): New function.
2277 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2278 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2279 for dst_mask, value and addend.
2280 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2281 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2282 (Output_data_glink::do_write): Correct toc base. Don't try to use
2283 uint16_t for 24-bit offset. Use get_output_section_offset and
2284 check return.
2285 (Target_powerpc::Scan::local): Handle more relocs.
2286 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2287 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2288 Plug in toc restoring insn after plt calls. Translate branches
2289 to function descriptor symbols to corresponding entry point.
2290 (Target_powerpc::relocate_for_relocatable): Check return from
2291 get_output_section_offset.
2292 * symtab.h: Comment typo.
2293
2294 2012-08-14 Ian Lance Taylor <iant@google.com>
2295
2296 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2297 unsupported_relocal_local to call unsupported_reloc_global.
2298
2299 2012-08-14 Nick Clifton <nickc@redhat.com>
2300
2301 PR ld/14265
2302 * script-sections.cc (Sections_element::output_section_name): Add
2303 keep return parameter.
2304 (Output_section_element::match_name): Add keep return parameter.
2305 Return the value of the keep_ member.
2306 * script-sections.h (class Output_section): Update
2307 output_section_name prototype.
2308 * layout.cc (Layout::keep_input_section): New public member
2309 function.
2310 (Layout::choose_output_section): Pass keep parameter to
2311 output_section_name.
2312 * layout.h (class Layout): Add keep_input_section.
2313 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2314 sections.
2315 * testsuite/Makefile.am: Add a test.
2316 * testsuite/Makefile.in: Regenerate.
2317 * testsuite/pr14265.c: Source file for the test.
2318 * testsuite/pr14265.t: Linker script for the test.
2319 * testsuite/pr14265.sh: Shell script for the test.
2320
2321 2012-08-14 Alan Modra <amodra@gmail.com>
2322
2323 * target.h (Target::output_section_name): New function.
2324 (Target::do_output_section_name): New function.
2325 * layout.cc (Layout::choose_output_section): Call the above.
2326 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2327
2328 2012-08-14 Alan Modra <amodra@gmail.com>
2329
2330 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2331 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2332 for replace_constant call.
2333 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2334 (Output_data_glink::do_print_to_mapfile): New function.
2335 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2336 (Target_powerpc::Relocate::relocate): Likewise.
2337
2338 2012-08-14 Alan Modra <amodra@gmail.com>
2339
2340 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2341 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2342 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2343 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2344 all references to shndx_. Handle special case for R_PPC_PLTREL24
2345 here.
2346 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2347 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2348 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2349 here.
2350 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2351 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2352
2353 2012-08-12 Alan Modra <amodra@gmail.com>
2354
2355 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2356 (glink insn constants): Use uint32_t.
2357 (Output_data_glink::add_entry): Use insert, not [] operator.
2358
2359 2012-08-11 Alan Modra <amodra@gmail.com>
2360
2361 * object.h (Sized_relobj_file::find_shdr): New function.
2362 (Sized_relobj_file::find_special_sections): New function.
2363 * object.cc (Sized_relobj_file::find_shdr): New function.
2364 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2365 (Sized_relobj_file::find_special_sections): New function, split out..
2366 (Sized_relobj_file::do_read_symbols): ..from here.
2367 * output.h (Output_data_got::replace_constant): New function.
2368 (Output_data_got::num_entries): New function.
2369 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2370 (Output_data_got::got_offset): Protected rather than private.
2371 (Output_data_got::replace_got_entry): New function.
2372 * output.cc (Output_data_got::replace_got_entry): New function.
2373 * powerpc.cc (class Powerpc_relobj): New.
2374 (class Powerpc_relocate_functions): Delete all psymval variants or
2375 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2376 Implement _ha functions using corresponding _hi function.
2377 (Powerpc_relobj::find_special_sections): New function.
2378 (Target_powerpc::do_make_elf_object): New function.
2379 (class Output_data_got_powerpc): New.
2380 (class Output_data_glink): New.
2381 (class Powerpc_scan_relocatable_reloc): New.
2382 Many more changes througout file.
2383
2384 2012-08-09 Nick Clifton <nickc@redhat.com>
2385
2386 * po/vi.po: Updated Vietnamese translation.
2387
2388 2012-08-07 Ian Lance Taylor <iant@google.com>
2389
2390 * layout.cc (Layout::add_target_dynamic_tags): If
2391 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2392 plt_rel.
2393
2394 2012-07-30 Nick Clifton <nickc@redhat.com>
2395
2396 * po/gold.pot: Updated template.
2397 * po/es.po: Updated Spanish translation.
2398
2399 2012-07-18 Cary Coutant <ccoutant@google.com>
2400
2401 PR gold/14344
2402 * configure.ac: Add check for -gpubnames support.
2403 * configure: Regenerate.
2404 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2405 support; force -gno-pubnames.
2406 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2407 support.
2408 (gdb_index_test_4): New test.
2409 * testsuite/Makefile.in: Regenerate.
2410 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2411 * testsuite/gdb_index_test_2.sh: Likewise.
2412 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2413 * testsuite/gdb_index_test_4.sh: New script.
2414 * testsuite/gdb_index_test_comm.sh: New script with common code;
2415 don't look for space after colon.
2416
2417 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2418
2419 * gold.cc (queue_middle_tasks): Update function order only after
2420 deferred objects due to plugins are processed.
2421
2422 2012-07-11 Ian Lance Taylor <iant@google.com>
2423
2424 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2425 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2426 (Target_arm::scan_reloc_for_stub): Likewise.
2427 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2428 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2429 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2430 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2431 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2432
2433 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2434 Ian Lance Taylor <iant@google.com>
2435
2436 PR gold/14309
2437 * configure.ac: Test whether std::tr1::hash<off_t> works.
2438 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2439 needed.
2440 * output.h (class Output_fill): Add virtual destructor.
2441 * configure, config.in: Rebuild.
2442
2443 2012-06-22 Roland McGrath <mcgrathr@google.com>
2444
2445 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2446
2447 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2448
2449 * plugin.cc (Plugin::load): Handle position independent executables.
2450
2451 2012-06-06 Cary Coutant <ccoutant@google.com>
2452
2453 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2454 add .debug_macro.
2455 (lines_only_debug_sections): Likewise.
2456 (gdb_fast_lookup_sections): New static array.
2457 (is_gdb_debug_section): Rename formal parameter.
2458 (is_lines_only_debug_section): Likewise.
2459 (is_gdb_fast_lookup_section): New function.
2460 (Layout::include_section): Check for ".zdebug_" prefix; pass
2461 section name suffix to is_gdb_debug_section, et al.; check for
2462 fast-lookup sections when building .gdb_index.
2463 * options.h (--strip-debug-gdb): Update GDB version number.
2464
2465 2012-06-06 Cary Coutant <ccoutant@google.com>
2466
2467 * configure.ac: Add check for fallocate.
2468 * configure: Regenerate.
2469 * config.in: Regenerate.
2470
2471 * options.h (class General_options): Add --mmap-output-file and
2472 --posix-fallocate options.
2473 * output.cc: (posix_fallocate): Remove; replace with...
2474 (gold_fallocate): New function.
2475 (Output_file::map_no_anonymous): Call gold_fallocate.
2476 (Output_file::map): Check --mmap-output-file option.
2477
2478 2012-06-05 Jing Yu <jingyu@google.com>
2479
2480 * gold.h (textdomain): Add do {} to empty while(0).
2481 (bindtextdomain): Likewise.
2482
2483 2012-06-04 Cary Coutant <ccoutant@google.com>
2484
2485 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2486 has_dynsym_index.
2487
2488 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2489
2490 * symtab.cc (Symbol_table::define_special_symbol):
2491 Initialize *poldsym to prevent uninitialized variable errors.
2492
2493 2012-05-23 Cary Coutant <ccoutant@google.com>
2494
2495 * layout.cc (Layout::section_name_mapping): Add rules to handle
2496 exact match on .data.rel.ro.local or .data.rel.ro.
2497 (Layout::output_section_name): Check for exact matches.
2498
2499 2012-05-23 Cary Coutant <ccoutant@google.com>
2500
2501 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2502 more carefully.
2503
2504 2012-05-22 Cary Coutant <ccoutant@google.com>
2505
2506 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2507 object before exporting symbol.
2508
2509 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2510
2511 * testsuite/tls_test.cc: Include "config.h" first.
2512 * testsuite/tls_test_c.c: Likewise.
2513
2514 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
2515 Nick Clifton <nickc@redhat.com>
2516
2517 PR 14072
2518 * configure.in: Add check that sysdep.h has been included before
2519 any system header files.
2520 * configure: Regenerate.
2521 * config.in: Regenerate.
2522
2523 2012-05-14 Cary Coutant <ccoutant@google.com>
2524
2525 * layout.cc (Layout::make_output_section): Mark .tdata section
2526 as RELRO.
2527 * testsuite/relro_test.cc: Add a TLS variable.
2528
2529 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2530
2531 PR gold/14091
2532 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2533 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2534 R_X86_64_64.
2535
2536 2012-05-08 Cary Coutant <ccoutant@google.com>
2537
2538 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2539 (lines_only_debug_sections): Likewise.
2540
2541 2012-05-02 Roland McGrath <mcgrathr@google.com>
2542
2543 * nacl.cc: New file.
2544 * nacl.h: New file.
2545 * Makefile.am (CCFILES, HFILES): Add them.
2546 * Makefile.in: Regenerate.
2547 * i386.cc (Output_data_plt_i386_nacl): New class.
2548 (Output_data_plt_i386_nacl_exec): New class.
2549 (Output_data_plt_i386_nacl_dyn): New class.
2550 (Target_i386_nacl): New class.
2551 (Target_selector_i386_nacl): New class.
2552 (target_selector_i386): Use it instead of Target_selector_i386.
2553 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2554 (Target_x86_64_nacl): New class.
2555 (Target_selector_x86_64_nacl): New class.
2556 (target_selector_x86_64, target_selector_x32): Use it instead of
2557 Target_selector_x86_64.
2558 * arm.cc (Output_data_plt_arm_nacl): New class.
2559 (Target_arm_nacl): New class.
2560 (Target_selector_arm_nacl): New class.
2561 (target_selector_arm, target_selector_armbe): Use it instead of
2562 Target_selector_arm.
2563
2564 * target-select.cc (select_target): Take new Input_file* and off_t
2565 arguments, pass them on to recognize method of selector.
2566 * object.cc (make_elf_sized_object): Update caller.
2567 * parameters.cc (parameters_force_valid_target): Likewise.
2568 * incremental.cc (make_sized_incremental_binary): Likewise.
2569 * target-select.h: Update decl.
2570 (Target_selector::recognize): Take new Input_file* argument,
2571 pass it on to do_recognize.
2572 (Target_selector::do_recognize): Take new Input_file* argument.
2573 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2574 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2575 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2576 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2577
2578 * target.h (Target::Target_info): New members isolate_execinstr
2579 and rosegment_gap.
2580 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2581 * arm.cc (Target_arm::arm_info): Update initializer.
2582 * i386.cc (Target_i386::i386_info): Likewise.
2583 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2584 * sparc.cc (Target_sparc::sparc_info): Likewise.
2585 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2586 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2587 * layout.cc (Layout::attach_allocated_section_to_segment):
2588 Take new const Target* argument. If target->isolate_execinstr(), act
2589 like --rosegment.
2590 (Layout::find_first_load_seg): Take new const Target* argument;
2591 if target->isolate_execinstr(), reject PF_X segments.
2592 (Layout::relaxation_loop_body): Update caller.
2593 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2594 reset file offset to zero when we hit LOAD_SEG, and then do a second
2595 loop over the segments before LOAD_SEG to reassign offsets after
2596 addresses have been determined. Handle target->rosegment_gap().
2597 (Layout::attach_section_to_segment): Take new const Target* argument;
2598 pass it to attach_allocated_section_to_segment.
2599 (Layout::make_output_section): Update caller.
2600 (Layout::attach_sections_to_segments): Take new const Target* argument;
2601 pass it to attach_section_to_segment.
2602 * gold.cc (queue_middle_tasks): Update caller.
2603 * layout.h (Layout): Update method decls with new arguments.
2604
2605 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2606 Target_info pointer to use.
2607 (Target_arm::do_make_data_plt): New virtual method.
2608 (Target_arm::make_data_plt): New method that calls it.
2609 (Target_arm::make_plt_entry): Use it.
2610 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2611 for the section alignment.
2612 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2613 method.
2614 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2615 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2616 method.
2617 (Output_data_plt_arm::get_plt_entry_size): Call it.
2618 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2619 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2620 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2621 method.
2622 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2623 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2624 method instead of sizeof(plt_entry).
2625 (Output_data_plt_arm::add_entry): Likewise.
2626 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2627 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2628 than static method.
2629 (Target_arm::plt_entry_size): Likewise.
2630 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2631 Move to ...
2632 (Output_data_plt_arm_standard): ... here, new class.
2633 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2634 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2635 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2636
2637 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2638 Take additional argument for the PLT entry size.
2639 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2640 Use get_plt_entry_size method rather than plt_entry_size variable.
2641 (Output_data_plt_x86_64::reserve_slot): Likewise.
2642 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2643 (Output_data_plt_x86_64::add_entry): Likewise.
2644 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2645 (Output_data_plt_x86_64::address_for_global): Likewise.
2646 (Output_data_plt_x86_64::address_for_local): Likewise.
2647 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2648 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2649 Make method non-static.
2650 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2651 method.
2652 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2653 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2654 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2655 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2656 virtual method.
2657 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2658 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2659 virtual method.
2660 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2661 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2662 virtual method.
2663 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2664 (Output_data_plt_x86_64::plt_entry_size)
2665 (Output_data_plt_x86_64::first_plt_entry)
2666 (Output_data_plt_x86_64::plt_entry)
2667 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2668 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2669 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2670 (Output_data_plt_x86_64_standard): ... here, new class.
2671 (Target_x86_64::Target_x86_64): Take optional argument for the
2672 Target_info pointer to use.
2673 (Target_x86_64::do_make_data_plt): New virtual method.
2674 (Target_x86_64::make_data_plt): New method to call it.
2675 (Target_x86_64::init_got_plt_for_update): Use that.
2676 Call this->plt_->add_eh_frame method here.
2677 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2678 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2679 rather than static method.
2680 (Target_x86_64::plt_entry_size): Likewise.
2681 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2682 rather than plt_entry_size variable. Move guts of PLT filling to...
2683 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2684 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2685 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2686
2687 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2688 additional argument for the section alignment.
2689 Don't do add_eh_frame_for_plt here.
2690 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2691 non-static. Use get_plt_entry_size method rather than plt_entry_size
2692 variable.
2693 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2694 method.
2695 (Output_data_plt_i386::get_plt_entry_size): Call it.
2696 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2697 (Output_data_plt_i386::add_eh_frame): New method to call it.
2698 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2699 method.
2700 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2701 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2702 method.
2703 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2704 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2705 method instead of plt_entry_size.
2706 (Output_data_plt_i386::plt_entry_size)
2707 (Output_data_plt_i386::plt_eh_frame_fde_size)
2708 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2709 (Output_data_plt_i386_standard): ... here, new class.
2710 (Output_data_plt_i386_exec): New class.
2711 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2712 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2713 (Output_data_plt_i386::exec_plt_entry): Move to ...
2714 (Output_data_plt_i386_exec::plt_entry): ... here.
2715 (Output_data_plt_i386_dyn): New class.
2716 (Output_data_plt_i386::first_plt_entry): Move to ...
2717 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2718 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2719 (Output_data_plt_i386_dyn::plt_entry): ... here.
2720 (Target_i386::Target_i386): Take optional argument for the Target_info
2721 pointer to use.
2722 (Target_i386::do_make_data_plt): New virtual method.
2723 (Target_i386::make_data_plt): New method to call it.
2724 (Target_i386::make_plt_section): Use that.
2725 Call this->plt_->add_eh_frame method here.
2726 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2727 rather than plt_entry_size variable.
2728 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2729 (Output_data_plt_i386::address_for_local): Likewise.
2730 (Output_data_plt_i386::do_write): Likewise.
2731 Move guts of PLT filling to...
2732 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2733 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2734 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2735 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2736
2737 2012-05-01 Cary Coutant <ccoutant@google.com>
2738
2739 * dwarf_reader.cc (Dwarf_die::read_attributes)
2740 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2741 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2742 * reduced_debug_output.cc
2743 (Output_reduced_debug_info_section::get_die_end): Remove
2744 DW_FORM_GNU_ref_index. Add default case.
2745
2746 2012-04-26 Mark Wielaard <mjw@redhat.com>
2747
2748 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2749 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2750 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2751 DW_AT_high_pc as offset from DW_AT_low_pc.
2752
2753 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2754 * testsuite/Makefile.in: Regenerate.
2755 * testsuite/gdb_index_test_3.c: New test source file.
2756 * testsuite/gdb_index_test_3.sh: New test source file.
2757
2758 2012-04-25 Ian Lance Taylor <iant@google.com>
2759
2760 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2761 pointer.
2762 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2763 as a class, not a struct.
2764 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2765 (Target_arm::apply_cortex_a8_workaround): Likewise.
2766 * gc.h: Declare Reloc_types as a struct, not a class.
2767 * object.h: Declare Symbols_data as a struct.
2768 * reloc.h: Declare Read_relocs_data as a struct.
2769 * target.h: Declare Relocate_info as a struct.
2770
2771 2012-04-24 David S. Miller <davem@davemloft.net>
2772
2773 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2774 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2775 and R_SPARC_WPLT30.
2776
2777 2012-04-24 Cary Coutant <ccoutant@google.com>
2778
2779 * incremental-dump.cc (find_input_containing_global): Replace
2780 magic number with symbolic constant.
2781 (dump_incremental_inputs): Update version number.
2782 * incremental.cc (Output_section_incremental_inputs): Update version
2783 number; import symbolic constants from Incremental_inputs_reader.
2784 (Incremental_inputs::create_data_sections): Align relocations
2785 section correctly for 64-bit targets.
2786 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2787 constants; add padding.
2788 (Output_section_incremental_inputs::write_header): Add assert for
2789 header_size.
2790 (Output_section_incremental_inputs::write_input_files): Add assert
2791 for input_entry_size.
2792 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2793 add assert for object_info_size, input_section_entry_size,
2794 global_sym_entry_size.
2795 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2796 for data structure sizes; use them.
2797 (Incremental_input_entry_reader): Import symbolic constants from
2798 Incremental_inputs_reader; use them.
2799
2800 2012-04-23 David S. Miller <davem@davemloft.net>
2801
2802 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2803 and elf_flags_set_.
2804 (Target_sparc::Target_sparc): Initialize new fields.
2805 (Target_sparc::do_make_elf_object): New function.
2806 (Target_sparc::do_adjust_elf_header): New function.
2807
2808 2012-04-23 Cary Coutant <ccoutant@google.com>
2809
2810 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2811 CU range table of gdb index.
2812
2813 2012-04-20 David S. Miller <davem@davemloft.net>
2814
2815 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2816 instead of false.
2817
2818 2012-04-16 David S. Miller <davem@davemloft.net>
2819
2820 * sparc.cc (Target_sparc::got_address): New function.
2821 (Sparc_relocate_functions::gdop_hix22): New function.
2822 (Sparc_relocate_functions::gdop_lox10): New function.
2823 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2824 relocs.
2825 (Target_sparc::Scan::local): Likewise if the global symbol is not
2826 preemptible and is not IFUNC.
2827 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2828 transformations for local and non-preemptible non-IFUNC global
2829 symbols.
2830
2831 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2832 writing out 64-bit part of ranges.
2833
2834 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2835 -fpic and -fpie respectively.
2836 * Makefile.in: Regenerate.
2837
2838 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2839 (Target_sparc::Target_sparc): Initialize new field.
2840 (Target_sparc::do_plt_section_for_global): New function.
2841 (Target_sparc::do_plt_section_for_local): New function.
2842 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2843 (Target_sparc::make_plt_section): New function, broken out of
2844 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2845 (Target_sparc::make_plt_entry): Call make_plt_section.
2846 (Target_sparc::make_local_ifunc_plt_entry): New function.
2847 (Target_sparc::rela_ifunc_section): New function.
2848 (Target_sparc::plt_section): Remove const.
2849 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2850 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2851 and ifunc_count_ fields.
2852 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2853 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2854 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2855 (Output_data_plt_sparc::rela_ifunc): New function.
2856 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2857 (Output_data_plt_sparc::has_ifunc_section): New function.
2858 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2859 (Output_data_plt_sparc::address_for_global): New function.
2860 (Output_data_plt_sparc::address_for_local): New function.
2861 (Output_data_plt_sparc::plt_index_to_offset): New function.
2862 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2863 and entry_count.
2864 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2865 entry_count.
2866 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2867 R_SPARC_JMP_IREL to switch.
2868 (Target_sparc::Scan::check_non_pic): Likewise.
2869 (Target_sparc::Scan::local): Handle IFUNC symbols.
2870 (Target_sparc::Scan::local): Likewise.
2871 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2872 and plt_address_for_local.
2873 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2874 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2875
2876 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2877 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2878 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2879 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2880 global relocs too.
2881 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2882 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2883 calls.
2884 * sparc.cc (Target_sparc::Scan::global): Likewise.
2885 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2886
2887 2012-04-16 Cary Coutant <ccoutant@google.com>
2888
2889 * archive.cc (Library_base::should_include_member): Check for
2890 --export-dynamic-symbol.
2891 * options.h (class General_options): Add --export-dynamic-symbol.
2892 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2893 --export-dynamic-symbol.
2894 (Symbol_table::gc_mark_undef_symbols): Likewise.
2895 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2896
2897 2012-04-12 David S. Miller <davem@davemloft.net>
2898
2899 * sparc.cc (Reloc::wdisp10): New relocation method.
2900 (Reloc::h34): Likewise.
2901 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2902 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2903 R_SPARC_WDISP10.
2904 (Target_sparc::Scan::local): Likewise.
2905 (Target_sparc::Scan::global): Likewise.
2906 (Target_sparc::Relocate::relocate): Likewise.
2907
2908 2012-04-09 Cary Coutant <ccoutant@google.com>
2909
2910 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2911 low_pc == 0.
2912
2913 2012-04-06 Ian Lance Taylor <iant@google.com>
2914
2915 * timer.cc: #include <unistd.h>.
2916
2917 2012-04-06 Roland McGrath <mcgrathr@google.com>
2918
2919 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2920 * config.in: Regenerate.
2921 * configure: Regenerate.
2922
2923 2012-04-05 Nick Clifton <nickc@redhat.com>
2924
2925 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2926 (AM_LC_MESSAGES): Add.
2927 * aclocal.m4: Regenerate.
2928 * config.in: Regenerate.
2929 * configure: Regenerate.
2930
2931 2012-03-21 Cary Coutant <ccoutant@google.com>
2932
2933 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2934 * Makefile.in: Regenerate.
2935 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2936 (Sized_elf_reloc_mapper::symbol_section): New function.
2937 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2938 (make_elf_reloc_mapper): New function.
2939 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2940 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2941 (Dwarf_abbrev_table::do_get_abbrev): New function.
2942 (Dwarf_ranges_table::read_ranges_table): New function.
2943 (Dwarf_ranges_table::read_range_list): New function.
2944 (Dwarf_pubnames_table::read_section): New function.
2945 (Dwarf_pubnames_table::read_header): New function.
2946 (Dwarf_pubnames_table::next_name): New function.
2947 (Dwarf_die::Dwarf_die): New function.
2948 (Dwarf_die::read_attributes): New function.
2949 (Dwarf_die::skip_attributes): New function.
2950 (Dwarf_die::set_name): New function.
2951 (Dwarf_die::set_linkage_name): New function.
2952 (Dwarf_die::attribute): New function.
2953 (Dwarf_die::string_attribute): New function.
2954 (Dwarf_die::int_attribute): New function.
2955 (Dwarf_die::uint_attribute): New function.
2956 (Dwarf_die::ref_attribute): New function.
2957 (Dwarf_die::child_offset): New function.
2958 (Dwarf_die::sibling_offset): New function.
2959 (Dwarf_info_reader::check_buffer): New function.
2960 (Dwarf_info_reader::parse): New function.
2961 (Dwarf_info_reader::do_parse): New function.
2962 (Dwarf_info_reader::do_read_string_table): New function.
2963 (Dwarf_info_reader::lookup_reloc): New function.
2964 (Dwarf_info_reader::get_string): New function.
2965 (Dwarf_info_reader::visit_compilation_unit): New function.
2966 (Dwarf_info_reader::visit_type_unit): New function.
2967 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2968 Sized_elf_reloc_mapper.
2969 (Sized_dwarf_line_info::symbol_section): Remove function.
2970 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2971 (Sized_dwarf_line_info::read_line_mappings): Remove object
2972 parameter, adjust callers.
2973 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2974 * dwarf_reader.h: Include <sys/types.h>.
2975 (class Track_relocs): Remove forward declaration.
2976 (class Elf_reloc_mapper): New class.
2977 (class Sized_elf_reloc_mapper): New class.
2978 (class Dwarf_abbrev_table): New class.
2979 (class Dwarf_range_list): New class.
2980 (class Dwarf_ranges_table): New class.
2981 (class Dwarf_pubnames_table): New class.
2982 (class Dwarf_die): New class.
2983 (class Dwarf_info_reader): New class.
2984 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2985 (Sized_dwarf_line_info::symbol_section): Remove member function.
2986 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2987 base class.
2988 * gdb-index.cc: New source file.
2989 * gdb-index.h: New source file.
2990 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2991 and .debug_types sections, call Layout::add_to_gdb_index.
2992 (Sized_relobj_incr::do_section_name): Implement.
2993 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2994 return type; Implement.
2995 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2996 return type.
2997 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2998 parameter list and return type.
2999 (Sized_incr_dynobj::do_section_contents): Likewise.
3000 * layout.cc: Include gdb-index.h.
3001 (Layout::Layout): Initialize gdb_index_data_.
3002 (Layout::init_fixed_output_section): Check for .gdb_index section.
3003 (Layout::add_to_gdb_index): New function. Instantiate.
3004 * layout.h: Add forward declaration for class Gdb_index.
3005 (Layout::add_to_gdb_index): New member function.
3006 (Layout::gdb_index_data_): New data member.
3007 * main.cc: Include gdb-index.h.
3008 (main): Print statistics for gdb index.
3009 * object.cc (Object::section_contents): Move code into
3010 do_section_contents.
3011 (need_decompressed_section): Check for sections needed when building
3012 gdb index.
3013 (build_compressed_section_map): Likewise.
3014 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3015 gdb index.
3016 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3017 sections; call Layout::add_to_gdb_index.
3018 (Sized_relobj_file::do_decompressed_section_contents): Call
3019 do_section_contents directly.
3020 * object.h (Object::do_section_contents): Adjust parameter list and
3021 return type.
3022 (Object::do_decompressed_section_contents): Call do_section_contents
3023 directly.
3024 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3025 return type.
3026 * options.h (class General_options): Add --gdb-index option.
3027 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3028 list and return type.
3029 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3030 * reloc.h (Track_relocs::checkpoint): New function.
3031 (Track_relocs::reset): New function.
3032
3033 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3034 New test cases.
3035 * testsuite/Makefile.in: Regenerate.
3036 * testsuite/gdb_index_test.cc: New test source file.
3037 * testsuite/gdb_index_test_1.sh: New test source file.
3038 * testsuite/gdb_index_test_2.sh: New test source file.
3039
3040 2012-03-19 Doug Kwan <dougkwan@google.com>
3041
3042 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3043 (Target_arm::do_finalize_sections): Remove code which defines
3044 __exidx_start and __exidx_end. Make symbol table parameter
3045 anonymous as it is not used.
3046 * gold.cc (queue_middle_tasks): Call target hook to define any
3047 target-specific symbols.
3048 * target.h (Target::define_standard_symbols): New method.
3049 (Target::do_define_standard_symbols): Same.
3050 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3051 * testsuite/Makefile.in: Regenerate.
3052 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3053 and __exidx_end.
3054 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3055 relocations are generated for __exidx_start and __exidx_end.
3056
3057 2012-03-16 Doug Kwan <dougkwan@google.com>
3058
3059 * testsuite/Makefile.am: Disable test initpri3b.
3060 * testsuite/Makefile.in: Regenerate.
3061
3062 2012-03-15 Doug Kwan <dougkwan@google.com>
3063
3064 * arm.cc (Target_arm::got_section): Make .got section read-only
3065 if -z now is given.
3066
3067 2012-03-15 Ian Lance Taylor <iant@google.com>
3068
3069 PR gold/13850
3070 * layout.cc (Layout::make_output_section): Correctly mark
3071 SHT_INIT_ARRAY, et. al., as relro.
3072
3073 2012-03-14 Doug Kwan <dougkwan@google.com>
3074
3075 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3076 dynamic relocations for protected symbols in shared objects.
3077
3078 2012-03-13 Ian Lance Taylor <iant@google.com>
3079
3080 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3081 keep the larger alignment.
3082
3083 2012-03-12 Cary Coutant <ccoutant@google.com>
3084
3085 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3086 handling of DW_LNE_define_file.
3087
3088 2012-03-12 Cary Coutant <ccoutant@google.com>
3089
3090 * reduced_debug_output.cc
3091 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3092 codes to switch.
3093
3094 2012-02-29 Cary Coutant <ccoutant@google.com>
3095
3096 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3097
3098 2012-02-29 Cary Coutant <ccoutant@google.com>
3099
3100 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3101 Call Object::decompressed_section_contents.
3102 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3103 New dtor.
3104 (Sized_dwarf_line_info::buffer_start_): New data member.
3105 * merge.cc (Output_merge_data::do_add_input_section): Call
3106 Object::decompressed_section_contents.
3107 (Output_merge_string::do_add_input_section): Likewise.
3108 * object.cc (need_decompressed_section): New function.
3109 (build_compressed_section_map): Decompress sections needed later.
3110 (Sized_relobj_file::do_decompressed_section_contents): New function.
3111 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3112 * object.h (Object::decompressed_section_contents): New function.
3113 (Object::discard_decompressed_sections): New function.
3114 (Object::do_decompressed_section_contents): New function.
3115 (Object::do_discard_decompressed_sections): New function.
3116 (Compressed_section_info): New type.
3117 (Compressed_section_map): Include decompressed section contents.
3118 (Sized_relobj_file::do_decompressed_section_contents): New function.
3119 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3120
3121 2012-02-16 Cary Coutant <ccoutant@google.com>
3122
3123 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3124 * testsuite/Makefile.in: Regenerate.
3125
3126 2012-02-14 Cary Coutant <ccoutant@google.com>
3127
3128 * options.cc (General_options::finalize): Disallow -pie and -static.
3129
3130 2012-02-03 Doug Kwan <dougkwan@google.com>
3131
3132 * arm.cc (Arm_relocate_functions::abs8,
3133 Arm_relocate_functions::abs16): Use
3134 Bits::has_signed_unsigned_overflow32.
3135 (Arm_relocate_functions::thm_abs8): Correct range of
3136 overflow check.
3137 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3138 in assertions.
3139
3140 2012-02-02 Doug Kwan <dougkwan@google.com>
3141
3142 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3143 position independent outputs, not just shared objects.
3144
3145 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3146
3147 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3148 * configure: Regenerated.
3149
3150 2012-01-27 Ian Lance Taylor <iant@google.com>
3151
3152 * reloc.h (Bits): New class with static functions, copied from
3153 namespace utils in arm.cc.
3154 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3155 instead.
3156
3157 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3158
3159 * incremental.cc (write_info_blocks): Correct relocation offset.
3160
3161 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3162
3163 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3164 (Relocate::tls_gd_to_le): Likewise.
3165
3166 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3167
3168 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3169
3170 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3171
3172 * configure.ac: Check if -mcmodel=medium works.
3173 * configure: Regenerated.
3174
3175 2012-01-24 Cary Coutant <ccoutant@google.com>
3176
3177 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3178 definition and ...
3179 (read_unsigned_LEB_128_x): ... this new function.
3180 (read_signed_LEB_128): Replaced with inline definition and ...
3181 (read_signed_LEB_128_x): ... this new function.
3182 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3183 (read_unsigned_LEB_128): Add inline definition.
3184 (read_signed_LEB_128_x): New function.
3185 (read_signed_LEB_128): Add inline definition.
3186 * testsuite/Makefile.am (leb128_unittest): New unit test.
3187 * testsuite/Makefile.in: Regenerate.
3188 * testsuite/leb128_unittest.cc: New unit test.
3189
3190 2012-01-23 Ian Lance Taylor <iant@google.com>
3191
3192 PR gold/13617
3193 * i386.cc (Target_i386::do_code_fill): When using a jmp
3194 instruction, pad with nop instructions.
3195 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3196
3197 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3198
3199 * x86_64.cc (gc_process_relocs): Add typename on types used in
3200 template.
3201 (scan_relocs): Likewise.
3202 (relocate_section): Likewise.
3203 (apply_relocation): Likewise.
3204
3205 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3206
3207 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3208 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3209 under x32.
3210
3211 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3212
3213 * x86_64.cc: Initial support for x32.
3214
3215 2012-01-03 Cary Coutant <ccoutant@google.com>
3216
3217 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3218 Use abstract base class for GOT.
3219 * gold/output.h (class Output_data_got_base): New abstract base class.
3220 (class Output_data_got): Derive from new base class, adjust ctors.
3221 (Output_data_got::reserve_slot): Make virtual; rename to
3222 do_reserve_slot; Adjust callers.
3223 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3224 pointer to abstract base class.
3225 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3226
3227 2011-12-18 Ian Lance Taylor <iant@google.com>
3228
3229 * object.h (Relobj::local_symbol_value): New function.
3230 (Relobj::local_plt_offset): New function.
3231 (Relobj::local_has_got_offset): New function.
3232 (Relobj::local_got_offset): New function.
3233 (Relobj::set_local_got_offset): New function.
3234 (Relobj::do_local_symbol_value): New pure virtual function.
3235 (Relobj::do_local_plt_offset): Likewise.
3236 (Relobj::do_local_has_got_offset): Likewise.
3237 (Relobj::do_local_got_offset): Likewise.
3238 (Relobj::do_set_local_got_offset): Likewise.
3239 (Sized_relobj::do_local_has_got_offset): Rename from
3240 local_has_got_offset.
3241 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3242 (Sized_relobj::do_set_local_got_offset): Rename from
3243 set_local_got_offset.
3244 (Sized_relobj_file::do_local_plt_offset): Rename from
3245 local_plt_offset.
3246 (Sized_relobj_file::do_local_symbol_value): New function.
3247 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3248 local_plt_offset.
3249 * output.cc (Output_data_got::Got_entry::write): Change object to
3250 Relobj. Use local_symbol_value.
3251 (Output_data_got::add_global_with_rel): Change rel_dyn to
3252 Output_data_reloc_generic*. Use add_global_generic.
3253 (Output_data_got::add_global_with_rela): Remove. Change all
3254 callers to use add_global_with_rel.
3255 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3256 Output_data_reloc_generic*. Use add_global_generic.
3257 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3258 callers to use add_global_pair_with_rel.
3259 (Output_data_got::add_local): Change object to Relobj*.
3260 (Output_data_got::add_local_plt): Likewise.
3261 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3262 change rel_dyn to Output_data_reloc_generic*. Use
3263 add_local_generic.
3264 (Output_data_got::add_local_with_rela): Remove. Change all
3265 callers to use all_local_with_rel.
3266 (Output_data_got::add_local_pair_with_rel): Change object to
3267 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3268 add_output_section_generic.
3269 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3270 callers to use add_local_pair_with_rel.
3271 (Output_data_got::reserve_local): Change object to Relobj*.
3272 * output.h: (class Output_data_reloc_generic): Add pure virtual
3273 declarations for add_global_generic, add_local_generic,
3274 add_output_section_generic.
3275 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3276 functions for Output_data_reloc_generic. Update declarations for
3277 changes listed in output.cc.
3278 (class Output_data_got): Change template parameter to got_size.
3279 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3280 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3281 function.
3282 (Sized_relobj_incr::do_local_plt_offset): New function.
3283 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3284 add_global_generic.
3285
3286 2011-12-17 Cary Coutant <ccoutant@google.com>
3287
3288 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3289 * resolve.cc (Symbol_table::resolve): Likewise.
3290 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3291 arrays.
3292 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3293
3294 2011-12-16 Ian Lance Taylor <iant@google.com>
3295
3296 * output.h (Output_data_reloc_generic::add): Only call
3297 add_dynamic_reloc if this is a dynamic reloc section.
3298
3299 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3300
3301 PR gold/13505
3302 * target-reloc.h (apply_relocation): Replace <64, false> with
3303 <size, big_endian>.
3304
3305 2011-11-25 Nick Clifton <nickc@redhat.com>
3306
3307 * po/it.po: New Italian translation.
3308
3309 2011-11-17 Sterling Augustine <saugustine@google.com>
3310
3311 * script.cc (script_include_directive): Implement.
3312 (read_script_file): New local variables name and search_path. Update
3313 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3314 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3315 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3316
3317 2011-11-11 Sterling Augustine <saugustine@google.com>
3318
3319 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3320 (file_or_sections_cmd): Likewise.
3321
3322 2011-11-11 Doug Kwan <dougkwan@google.com>
3323
3324 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3325 if --just-symbols is given.
3326
3327 2011-11-10 Doug Kwan <dougkwan@google.com>
3328
3329 PR gold/13362
3330 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3331 when processing data relocs.
3332 * reloc.h (Relocate_functions::rel_unaligned): New method.
3333 (Relocate_functions::pcrel_unaligned): Ditto.
3334 (Relocate_functions::rel32_unaligned): Ditto.
3335 (Relocate_functions::pcrel32_unaligned): Ditto.
3336
3337 2011-11-09 Doug Kwan <dougkwan@google.com>
3338
3339 PR gold/13362
3340 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3341 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3342 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3343 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3344 (Relocate_functions::rel_unaligned): New.
3345 (Relocate_functions::rel32_unaligned): New.
3346 * target-reloc.h (relocate_for_relocatable): Add code to handle
3347 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3348 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3349 arm_unaligned_reloc_r): New targets.
3350 * testsuite/Makefile.in: Regenerate.
3351 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3352 linking.
3353
3354 2011-11-02 Ian Lance Taylor <iant@google.com>
3355
3356 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3357 NATIVE_LINKER.
3358 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3359 * options.cc (General_options::finalize): Use library search path
3360 from configure script if specified. If not native and no sysroot,
3361 only search TOOLLIBDIR.
3362 * options.h (Search_directory::Search_directory): Change name to
3363 const std::string&.
3364 (General_options::add_to_library_path_with_sysroot): Change arg to
3365 const std::string&.
3366 * configure, Makefile.in, config.in: Rebuild.
3367
3368 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3369
3370 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3371 we are working around the ARM1176 Erratum.
3372 * options.h (General_options::fix_arm1176): Add option.
3373 * testsuite/Makefile.am: Add testcases, and keep current ones
3374 working.
3375 * testsuite/Makefile.in: Regenerate.
3376 * testsuite/arm_fix_1176.s: New file.
3377 * testsuite/arm_fix_1176.sh: Likewise.
3378
3379 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3380
3381 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3382 may_use_blx_.
3383 (Target_arm::may_use_blx): Remove method.
3384 (Target_arm::set_may_use_blx): Likewise.
3385 (Target_arm::may_use_v4t_interworking): New method.
3386 (Target_arm::may_use_v5t_interworking): Likewise.
3387 (Target_arm::may_use_blx_): Remove member variable.
3388 (Arm_relocate_functions::arm_branch_common): Check for v5T
3389 interworking.
3390 (Arm_relocate_functions::thumb_branch_common): Likewise.
3391 (Reloc_stub::stub_type_for_reloc): Likewise.
3392 (Target_arm::do_finalize_sections): Correct interworking checks.
3393 * testsuite/Makefile.am: Add new tests.
3394 * testsuite/Makefile.in: Regenerate.
3395 * testsuite/arm_farcall_arm_arm.s: New test.
3396 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3397 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3398 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3399 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3400 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3401 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3402 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3403
3404 2011-10-31 Cary Coutant <ccoutant@google.com>
3405
3406 PR gold/13023
3407 * expression.cc (Expression::eval_with_dot): Add
3408 is_section_dot_assignment parameter.
3409 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3410 absolute and assigning to dot within a section.
3411 * script-sections.cc
3412 (Output_section_element_assignment::set_section_addresses): Pass
3413 dot_section to set_if_absolute.
3414 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3415 as is_section_dot_assignment flag to eval_with_dot.
3416 (Output_section_element_dot_assignment::set_section_addresses):
3417 Likewise.
3418 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3419 parameter. Also set value if relative to dot_section; set the
3420 symbol's output_section.
3421 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3422 parameter. Adjust all callers.
3423 (Expression::eval_maybe_dot): Likewise.
3424 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3425 Adjust all callers.
3426 * testsuite/script_test_2.t: Test assignment of an absolute value
3427 to dot within an output section element.
3428
3429 2011-10-31 Cary Coutant <ccoutant@google.com>
3430
3431 * options.h (class General_options): Add --[no-]gnu-unique options.
3432 * symtab.cc (Symbol_table::sized_write_globals): Convert
3433 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3434
3435 2011-10-31 Cary Coutant <ccoutant@google.com>
3436
3437 PR gold/13359
3438 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3439 unnecessary assertion.
3440 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3441
3442 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3443
3444 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3445 gc_mark_symbol.
3446 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3447 gc_mark_symbol.
3448 Change to just keep the section associated with symbol.
3449 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3450 they are externally visible and --export-dynamic is turned on.
3451 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3452
3453 2011-10-19 Ian Lance Taylor <iant@google.com>
3454
3455 PR gold/13163
3456 * script-sections.cc
3457 (Output_section_element_dot_assignment::needs_output_section): New
3458 function.
3459
3460 2011-10-19 Ian Lance Taylor <iant@google.com>
3461
3462 PR gold/13204
3463 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3464 --section-start option was seen.
3465 * options.h (General_options::any_section_start): New function.
3466
3467 2011-10-18 David S. Miller <davem@davemloft.net>
3468
3469 PR binutils/13301
3470 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3471 member to track relocation locations that have moved during TLS
3472 reloc optimizations.
3473 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3474 (Target_sparc::Relocate::relocate): Adjust view down by 4
3475 bytes if it matches reloc_adjust_addr_.
3476 (Target_sparc::Relocate::relocate_tls): Always move the
3477 __tls_get_addr call delay slot instruction forward 4 bytes when
3478 performing relaxation.
3479
3480 2011-10-18 Cary Coutant <ccoutant@google.com>
3481
3482 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3483 (Output_file::map_no_anonymous): Check for non-zero
3484 return code from posix_fallocate.
3485
3486 2011-10-17 Cary Coutant <ccoutant@google.com>
3487
3488 PR gold/13245
3489 * plugin.cc (is_visible_from_outside): Check for symbols
3490 referenced from dynamic objects.
3491 * resolve.cc (Symbol_table::resolve): Don't count references
3492 from dynamic objects as references from real ELF files.
3493 * testsuite/plugin_test_2.sh: Adjust expected result.
3494
3495 2011-10-17 Cary Coutant <ccoutant@google.com>
3496
3497 * gold.cc: Include timer.h.
3498 (queue_middle_tasks): Stamp time.
3499 (queue_final_tasks): Likewise.
3500 * main.cc (main): Store timer in parameters. Print timers
3501 for each pass.
3502 * parameters.cc (Parameters::Parameters): Initialize timer_.
3503 (Parameters::set_timer): New function.
3504 (set_parameters_timer): New function.
3505 * parameters.h (Parameters::set_timer): New function.
3506 (Parameters::timer): New function.
3507 (Parameters::timer_): New data member.
3508 (set_parameters_timer): New function.
3509 * timer.cc (Timer::stamp): New function.
3510 (Timer::get_pass_time): New function.
3511 * timer.h (Timer::stamp): New function.
3512 (Timer::get_pass_time): New function.
3513 (Timer::pass_times_): New data member.
3514
3515 2011-10-17 Cary Coutant <ccoutant@google.com>
3516
3517 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3518 task for members of lib groups.
3519
3520 2011-10-17 Cary Coutant <ccoutant@google.com>
3521
3522 PR gold/13288
3523 * fileread.cc (File_read::find_view): Add assert.
3524 (File_read::make_view): Move bounds check (replace with assert)...
3525 (File_read::find_or_make_view): ... to here.
3526
3527 2011-10-12 Cary Coutant <ccoutant@google.com>
3528
3529 * output.cc (Output_file::open_base_file): Handle case where
3530 ::read returns less than requested size.
3531
3532 2011-10-10 Cary Coutant <ccoutant@google.com>
3533
3534 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3535 Initialize defined_count_.
3536 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3537 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3538 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3539 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3540 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3541 * incremental.h (Sized_relobj_incr::defined_count_): New data
3542 member.
3543 (Sized_incr_dynobj::defined_count_): New data member.
3544 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3545 Return zeroes instead of internal error.
3546
3547 2011-10-10 Cary Coutant <ccoutant@google.com>
3548
3549 PR gold/13249
3550 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3551 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3552 * output.h (class Output_reloc): Add use_plt_offset flag.
3553 (Output_reloc::type_): Adjust size of bit field.
3554 (Output_reloc::use_plt_offset_): New bit field.
3555 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3556 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3557 flag. Adjust all callers.
3558 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3559 creating RELATIVE relocations.
3560
3561 2011-10-10 Nick Clifton <nickc@redhat.com>
3562
3563 * po/es.po: Updated Spanish translation.
3564 * po/fi.po: Updated Finnish translation.
3565
3566 2011-10-03 Diego Novillo <dnovillo@google.com>
3567
3568 * options.cc (parse_uint): Fix dereference of RETVAL.
3569
3570 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3571
3572 * layout.h (section_order_map_): New member.
3573 (get_section_order_map): New member function.
3574 * output.cc (Output_section::add_input_section): Check for patterns
3575 only when --section-ordering-file is specified.
3576 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3577 output_sections have been formed.
3578 * layout.cc (Layout_Layout): Initialize section_order_map_.
3579 * plugin.cc (update_section_order): Store order in order_map. Do not
3580 update the order.
3581 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3582 * testsuite/Makefile.in: Regenerate.
3583 * testsuite/plugin_section_order.c: New file.
3584 * testsuite/plugin_final_layout.cc: New file.
3585 * testsuite/plugin_final_layout.sh: New file.
3586
3587 2011-09-29 Cary Coutant <ccoutant@google.com>
3588
3589 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3590 Check for NULL.
3591 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3592 symbols during incremental update.
3593 (Symbol_table::add_from_dynobj): Likewise.
3594
3595 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3596 Ian Lance Taylor <iant@google.com>
3597
3598 * symtab.cc (Symbol_table::define_special_symbol): Always
3599 canonicalize version string.
3600
3601 2011-09-26 Cary Coutant <ccoutant@google.com>
3602
3603 * gold.cc (queue_initial_tasks): Move option checks ...
3604 * options.cc (General_options::finalize): ... to here. Disable
3605 some options; make others fatal.
3606
3607 2011-09-26 Cary Coutant <ccoutant@google.com>
3608
3609 gcc PR lto/47247
3610 * plugin.cc (get_symbols_v2): New function.
3611 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3612 (is_referenced_from_outside): New function.
3613 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3614 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3615 (get_symbols): Pass version parameter.
3616 (get_symbols_v2): New function.
3617 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3618 parameter.
3619 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3620 (onload): Add LDPT_GET_SYMBOLS_V2.
3621 (all_symbols_read_hook): Use get_symbols_v2; check for
3622 LDPR_PREVAILING_DEF_IRONLY_EXP.
3623 * testsuite/plugin_test_3.sh: Update expected results.
3624
3625 2011-09-23 Simon Baldwin <simonb@google.com>
3626
3627 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3628 configuration options.
3629 * configure: Regenerate.
3630 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3631 * Makefile.in: Regenerate.
3632 * testsuite/Makefile.in: Regenerate.
3633
3634 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3635
3636 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3637
3638 2011-09-19 Cary Coutant <ccoutant@google.com>
3639
3640 * incremental.cc (can_incremental_update): Fix typo in comment.
3641 * incremental.h (can_incremental_update): Likewise.
3642
3643 2011-09-18 Cary Coutant <ccoutant@google.com>
3644
3645 * incremental.cc (can_incremental_update): New function.
3646 * incremental.h (can_incremental_update): New function.
3647 * layout.cc (Layout::init_fixed_output_section): Call it.
3648 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3649 * object.cc (Sized_relobj_file::do_layout): Call
3650 can_incremental_update.
3651
3652 2011-09-13 Cary Coutant <ccoutant@google.com>
3653
3654 * configure.ac: Check for glibc support for gnu_indirect_function
3655 support with static linking, setting automake conditional
3656 IFUNC_STATIC.
3657 * Makefile.in: Regenerate.
3658 * configure: Regenerate.
3659
3660 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3661 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3662 for IFUNC_STATIC.
3663 * testsuite/Makefile.in: Regenerate.
3664
3665 2011-09-13 Cary Coutant <ccoutant@google.com>
3666
3667 * incremental.cc (Sized_relobj_incr::do_layout): Call
3668 report_comdat_group for kept comdat sections.
3669 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3670 * testsuite/Makefile.in: Regenerate.
3671 * testsuite/incr_comdat_test_1.cc: New source file.
3672 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3673 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3674 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3675
3676 2011-09-13 Ian Lance Taylor <iant@google.com>
3677
3678 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3679 variable external_symbols_offset.
3680
3681 2011-09-12 Ian Lance Taylor <iant@google.com>
3682
3683 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3684 triggered if object has no symbols.
3685
3686 2011-09-09 David S. Miller <davem@davemloft.net>
3687
3688 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3689 (Output_fill_debug_line::do_write): Likewise.
3690
3691 2011-08-29 Cary Coutant <ccoutant@google.com>
3692
3693 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3694 casts to match formatting specs.
3695 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3696
3697 2011-08-26 Cary Coutant <ccoutant@google.com>
3698
3699 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3700 remaining hole size when allocating.
3701 (Layout::make_output_section): Set fill methods for debug sections.
3702 * layout.h (Free_list::Free_list_node): Move from private to
3703 public.
3704 (Free_list::set_min_hole_size): New function.
3705 (Free_list::begin, Free_list::end): New functions.
3706 (Free_list::min_hole_): New data member.
3707 * output.cc: Include dwarf.h.
3708 (Output_fill_debug_info::do_minimum_hole_size): New function.
3709 (Output_fill_debug_info::do_write): New function.
3710 (Output_fill_debug_line::do_minimum_hole_size): New function.
3711 (Output_fill_debug_line::do_write): New function.
3712 (Output_section::Output_section): Initialize new data member.
3713 (Output_section::set_final_data_size): Ensure patch space is larger
3714 than minimum hole size.
3715 (Output_section::do_write): Fill holes in debug sections.
3716 * output.h (Output_fill): New class.
3717 (Output_fill_debug_info): New class.
3718 (Output_fill_debug_line): New class.
3719 (Output_section::set_free_space_fill): New function.
3720 (Output_section::free_space_fill_): New data member.
3721 * testsuite/Makefile.am (incremental_test_3): Add
3722 --incremental-patch option.
3723 (incremental_test_4): Likewise.
3724 (incremental_test_5): Likewise.
3725 (incremental_test_6): Likewise.
3726 (incremental_copy_test): Likewise.
3727 (incremental_common_test_1): Likewise.
3728 * testsuite/Makefile.in: Regenerate.
3729
3730 2011-08-26 Nick Clifton <nickc@redhat.com>
3731
3732 * po/es.po: Updated Spanish translation.
3733
3734 2011-08-01 Cary Coutant <ccoutant@google.com>
3735
3736 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3737 * gold/testsuite/Makefile.in: Regenerate.
3738 * gold/testsuite/justsyms_exec.c: New source file.
3739 * gold/testsuite/justsyms_lib.c: New source file.
3740
3741 2011-08-01 Cary Coutant <ccoutant@google.com>
3742
3743 * layout.cc (Layout::set_segment_offsets): Don't realign text
3744 segment if -Ttext was specified.
3745 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3746 file type.
3747 * object.h (Sized_relobj_file::e_type): New function.
3748 (Sized_relobj_file::e_type_): New data member.
3749 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3750 base address for ET_EXEC files.
3751 * target.cc (Target::do_make_elf_object_implementation): Allow
3752 ET_EXEC files with --just-symbols option.
3753
3754 2011-07-28 Cary Coutant <ccoutant@google.com>
3755
3756 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3757 Add thread_number parameter.
3758 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3759 * workqueue-threads.cc
3760 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3761 current thread if its thread number is greater than desired thread
3762 count.
3763 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3764 Add thread_number parameter.
3765 (Workqueue::should_cancel_thread): Likewise.
3766 (Workqueue::find_runnable_or_wait): Pass thread_number to
3767 should_cancel_thread.
3768 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3769 parameter.
3770
3771 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3772
3773 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3774 only after checking if it cannot be forced local.
3775 * symtab.h (is_externally_visible): Check if the symbol is not forced
3776 local.
3777
3778 2011-07-15 Ian Lance Taylor <iant@google.com>
3779
3780 * options.h (class General_options): Add --print-output-format.
3781 Move -EL next to -EB, for better --help output.
3782 * target-select.cc: Include <cstdio>, "options.h", and
3783 "parameters.h".
3784 (Target_selector::do_target_bfd_name): New function.
3785 (print_output_format): New function.
3786 * target-select.h (class Target_selector): Update declarations.
3787 (Target_selector::target_bfd_name): New function.
3788 (print_output_format): Declare.
3789 * main.cc: Include "target-select.h".
3790 (main): Handle --print-output-format.
3791 * gold.cc: Include "target-select.h".
3792 (queue_initial_tasks): Handle --print-output-format when there are
3793 no input files.
3794 * parameters.cc (parameters_force_valid_target): Give a better
3795 error message if -EB/-EL does not match target.
3796 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3797 function.
3798
3799 2011-07-15 Ian Lance Taylor <iant@google.com>
3800
3801 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3802 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3803 (Output_data_plt_i386::do_write): Write address of .dynamic
3804 section to first entry in .got.plt section.
3805 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3806 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3807 Initialize layout_.
3808 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3809 section to first entry in .got.plt section.
3810 * layout.h (Layout::dynamic_section): New function.
3811
3812 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3813
3814 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3815 to claim_file call.
3816 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3817 input_section_position_, and input_section_glob_.
3818 (read_layout_from_file): Call function section_ordering_specified.
3819 * layout.h (is_section_ordering_specified): New function.
3820 (section_ordering_specified): New function.
3821 (section_ordering_specified_): New boolean member.
3822 * main.cc(main): Call load_plugins after layout object is defined.
3823 * output.cc (Output_section::add_input_section): Use
3824 function section_ordering_specified to check if section ordering is
3825 needed.
3826 * output.cc (Output_section::add_relaxed_input_section): Use
3827 function section_ordering_specified to check if section ordering is
3828 needed.
3829 (Output_section::update_section_layout): New function.
3830 (Output_section::sort_attached_input_sections): Check if input section
3831 must be reordered.
3832 * output.h (Output_section::update_section_layout): New function.
3833 * plugin.cc (get_section_count): New function.
3834 (get_section_type): New function.
3835 (get_section_name): New function.
3836 (get_section_contents): New function.
3837 (update_section_order): New function.
3838 (allow_section_ordering): New function.
3839 (Plugin::load): Add the new interfaces to the transfer vector.
3840 (Plugin_manager::load_plugins): New parameter.
3841 (Plugin_manager::all_symbols_read): New parameter.
3842 (Plugin_manager::claim_file): New parameter. Save the elf object for
3843 unclaimed objects.
3844 (Plugin_manager::get_elf_object): New function.
3845 (Plugin_manager::get_view): Change to directly use the bool to check
3846 if get_view is called from claim_file_hook.
3847 * plugin.h (input_objects): New function
3848 (Plugin__manager::load_plugins): New parameter.
3849 (Plugin_manager::claim_file): New parameter.
3850 (Plugin_manager::get_elf_object): New function.
3851 (Plugin_manager::in_claim_file_handler): New function.
3852 (Plugin_manager::in_claim_file_handler_): New member.
3853 (layout): New function.
3854 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3855 handler with an extra parameter. Make the elf object before calling
3856 claim_file handler.
3857 * testsuite/plugin_test.c (get_section_count): New function pointer.
3858 (get_section_type): New function pointer.
3859 (get_section_name): New function pointer.
3860 (get_section_contents): New function pointer.
3861 (update_section_order): New function pointer.
3862 (allow_section_ordering): New function pointer.
3863 (onload): Check if the new interfaces exist.
3864
3865 2011-07-13 Ian Lance Taylor <iant@google.com>
3866
3867 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3868 relro section.
3869 * x86_64.cc (Target_x86_64::got_section): Likewise.
3870 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3871 (relro_now_test_SOURCES): New variable.
3872 (relro_now_test_DEPENDENCIES): New variable.
3873 (relro_now_test_LDFLAGS): New variable.
3874 (relro_now_test_LDADD): New variable.
3875 (relro_now_test.so): New target.
3876 * testsuite/Makefile.in: Rebuild.
3877
3878 2011-07-12 Ian Lance Taylor <iant@google.com>
3879
3880 PR gold/12980
3881 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3882 GLOB_DAT relocation rather than a RELATIVE relocation for a
3883 protected symbol when creating a shared library.
3884 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3885 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3886 * testsuite/protected_main_1.cc (main): Test that protected
3887 function has same address.
3888
3889 2011-07-11 Ian Lance Taylor <iant@google.com>
3890
3891 PR gold/12979
3892 * options.h (class General_options): Add -Bgroup.
3893 * options.cc (General_options::finalize): If -Bgroup is set,
3894 default to --unresolved-symbols=report-all.
3895 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3896 * target-reloc.h (issue_undefined_symbol_error): Handle
3897 --unresolved-symbols=report-all.
3898
3899 2011-07-08 Ian Lance Taylor <iant@google.com>
3900
3901 PR gold/11985
3902 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3903 if linker script discards key sections.
3904 (Layout::create_dynamic_symtab): Likewise.
3905 (Layout::assign_local_dynsym_offsets): Likewise.
3906 (Layout::sized_create_version_sections): Likewise.
3907 (Layout::create_interp): Likewise.
3908 (Layout::finish_dynamic_section): Likewise.
3909 (Layout::set_dynamic_symbol_size): Likewise.
3910
3911 2011-07-08 Ian Lance Taylor <iant@google.com>
3912
3913 PR gold/12386
3914 * options.h (class General_options): Add --unresolved-symbols.
3915 * target-reloc.h (issue_undefined_symbol_error): Check
3916 --unresolved-symbols. Add comments.
3917
3918 2011-07-08 Ian Lance Taylor <iant@google.com>
3919
3920 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3921 expression more complex.
3922
3923 2011-07-08 Ian Lance Taylor <iant@google.com>
3924
3925 PR gold/11317
3926 * target-reloc.h (issue_undefined_symbol_error): New inline
3927 function, broken out of relocate_section.
3928 (relocate_section): Call issue_undefined_symbol_error.
3929 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3930 there is no TLS segment if we are about to issue an undefined
3931 symbol error.
3932 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3933
3934 2011-07-08 Ian Lance Taylor <iant@google.com>
3935
3936 PR gold/12279
3937 * resolve.cc (Symbol_table::should_override): Add fromtype
3938 parameter. Change all callers. Give error when linking together
3939 TLS and non-TLS symbol.
3940 (Symbol_table::should_override_with_special): Add fromtype
3941 parameter. Change all callers.
3942 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3943 there is no TLS segment if we have reported some errors.
3944 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3945
3946 2011-07-08 Ian Lance Taylor <iant@google.com>
3947
3948 PR gold/12372
3949 * target.h (Target::plt_address_for_global): New function.
3950 (Target::plt_address_for_local): New function.
3951 (Target::plt_section_for_global): Remove.
3952 (Target::plt_section_for_local): Remove.
3953 (Target::do_plt_address_for_global): New virtual function.
3954 (Target::do_plt_address_for_local): New virtual function.
3955 (Target::do_plt_section_for_global): Remove.
3956 (Target::do_plt_section_for_local): Remove.
3957 (Target::register_global_plt_entry): Add Symbol_table and Layout
3958 parameters.
3959 * output.cc (Output_data_got::Got_entry::write): Use
3960 plt_address_for_global and plt_address_for_local.
3961 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3962 address of output section.
3963 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3964 got_irelative_, and irelative_count_ fields. Update
3965 declarations.
3966 (Output_data_plt_i386::has_irelative_section): New function.
3967 (Output_data_plt_i386::entry_count): Add irelative_count_.
3968 (Output_data_plt_i386::set_final_data_size): Likewise.
3969 (class Target_i386): Add got_irelative_ and rel_irelative_
3970 fields. Update declarations.
3971 (Target_i386::Target_i386): Initialize new fields.
3972 (Target_i386::do_plt_address_for_global): New function replacing
3973 do_plt_section_for_global.
3974 (Target_i386::do_plt_address_for_local): New function replacing
3975 do_plt_section_for_local.
3976 (Target_i386::got_section): Create got_irelative_.
3977 (Target_i386::rel_irelative_section): New function.
3978 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3979 fields. Don't define __rel_iplt_{start,end}.
3980 (Output_data_plt_i386::add_entry): Add symtab and layout
3981 parameters. Change all callers. Use different PLT and GOT for
3982 IFUNC symbols.
3983 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3984 layout parameters. Change all callers. Use different PLT and
3985 GOT.
3986 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3987 (Output_data_plt_i386::rel_irelative): New function.
3988 (Output_data_plt_i386::address_for_global): New function.
3989 (Output_data_plt_i386::address_for_local): New function.
3990 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3991 IRELATIVE GOT when changing IFUNC GOT entries.
3992 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3993 reloc.
3994 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3995 if we didn't create an IRELATIVE GOT.
3996 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3997 plt_address_for_local.
3998 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3999 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4000 got_irelative_, and irelative_count_ fields. Update
4001 declarations.
4002 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4003 Initialize new fields. Remove symtab parameter. Change all
4004 callers.
4005 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4006 irelative_count_.
4007 (Output_data_plt_x86_64::has_irelative_section): New function.
4008 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4009 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4010 fields. Update declarations.
4011 (Target_x86_64::Target_x86_64): Initialize new fields.
4012 (Target_x86_64::do_plt_address_for_global): New function replacing
4013 do_plt_section_for_global.
4014 (Target_x86_64::do_plt_address_for_local): New function replacing
4015 do_plt_section_for_local.
4016 (Target_x86_64::got_section): Create got_irelative_.
4017 (Target_x86_64::rela_irelative_section): New function.
4018 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4019 all callers. Don't create __rel_iplt_{start,end}.
4020 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4021 parameters. Change all callers. Use different PLT and GOT for
4022 IFUNC symbols.
4023 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4024 layout parameters. Change all callers. Use different PLT and
4025 GOT.
4026 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4027 parameters. Change all callers. Use different PLT and GOT for
4028 IFUNC symbols.
4029 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4030 (Output_data_plt_x86_64::rela_irelative): New function.
4031 (Output_data_plt_x86_64::address_for_global): New function.
4032 (Output_data_plt_x86_64::address_for_local): New function.
4033 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4034 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4035 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4036 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4037 parameters.
4038 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4039 reloc.
4040 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4041 symbols if we didn't create an IRELATIVE GOT.
4042 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4043 plt_address_for_local.
4044 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4045 * testsuite/ifuncvar1.c: New test file.
4046 * testsuite/ifuncvar2.c: New test file.
4047 * testsuite/ifuncvar3.c: New test file.
4048 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4049 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4050 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4051 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4052 * testsuite/Makefile.in: Rebuild.
4053
4054 2011-07-07 Cary Coutant <ccoutant@google.com>
4055
4056 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4057 (two_file_test_1_ndebug.o): Likewise.
4058 (two_file_test_1b_ndebug.o): Likewise.
4059 (two_file_test_2_ndebug.o): Likewise.
4060 (two_file_test_main_ndebug.o): Likewise.
4061 (incremental_test_2): Link with no-debug versions.
4062
4063 2011-07-06 Cary Coutant <ccoutant@google.com>
4064
4065 * gold/incremental.cc
4066 (Output_section_incremental_inputs::write_info_blocks): Check for
4067 hidden and internal symbols.
4068
4069 2011-07-06 Cary Coutant <ccoutant@google.com>
4070
4071 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4072 Check disposition for startup file.
4073 (Incremental_inputs::report_command_line): Ignore
4074 --incremental-startup-unchanged option.
4075 * options.cc (General_options::parse_incremental_startup_unchanged):
4076 New function.
4077 (General_options::General_options): Initialize new data member.
4078 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4079 (General_options): Add --incremental-startup-unchanged option.
4080 (General_options::incremental_startup_disposition): New function.
4081 (General_options::incremental_startup_disposition_): New data member.
4082
4083 2011-07-06 Cary Coutant <ccoutant@google.com>
4084
4085 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4086 input file index to Script_info ctor.
4087 (Sized_incremental_binary::do_file_has_changed): Find the
4088 command-line argument for files named in scripts.
4089 * incremental.h (Script_info::Script_info): New ctor
4090 with input file index.
4091 (Script_info::input_file_index): New function.
4092 (Script_info::input_file_index_): New data member.
4093 (Incremental_binary::get_library): Add const.
4094 (Incremental_binary::get_script_info): Add const.
4095 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4096 * testsuite/Makefile.am (incremental_test_5): New test case.
4097 (incremental_test_6): New test case.
4098 * testsuite/Makefile.in: Regenerate.
4099
4100 2011-07-06 Cary Coutant <ccoutant@google.com>
4101
4102 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4103 debug output when command lines differ.
4104
4105 2011-07-06 Cary Coutant <ccoutant@google.com>
4106
4107 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4108 --incremental-patch option.
4109 * layout.cc (Free_list::allocate): Extend allocation beyond original
4110 end if enabled.
4111 (Layout::make_output_section): Mark sections that should get
4112 patch space.
4113 * options.cc (parse_percent): New function.
4114 * options.h (parse_percent): New function.
4115 (DEFINE_percent): New macro.
4116 (General_options): Add --incremental-patch option.
4117 * output.cc (Output_section::Output_section): Initialize new data
4118 members.
4119 (Output_section::add_input_section): Print section name when out
4120 of patch space.
4121 (Output_section::add_output_section_data): Likewise.
4122 (Output_section::set_final_data_size): Add patch space when
4123 doing --incremental-full.
4124 (Output_section::do_reset_address_and_file_offset): Remove patch
4125 space.
4126 (Output_segment::set_section_list_addresses): Print debug output
4127 only if --incremental-update.
4128 * output.h (Output_section::set_is_patch_space_allowed): New function.
4129 (Output_section::is_patch_space_allowed_): New data member.
4130 (Output_section::patch_space_): New data member.
4131 * parameters.cc (Parameters::incremental_full): New function.
4132 * parameters.h (Parameters::incremental_full): New function
4133 * testsuite/Makefile.am (incremental_test_2): Add test for
4134 --incremental-patch option.
4135 * testsuite/Makefile.in: Regenerate.
4136 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4137 (t18): Remove function body.
4138
4139 2011-07-05 Doug Kwan <dougkwan@google.com>
4140
4141 PR gold/12771
4142 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4143 Arm_Address type for relocation result.
4144 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4145 overflow check.
4146 (Arm_relocate_functions::abs32): Use unaligned access.
4147 (Arm_relocate_functions::rel32): Ditto.
4148 (Arm_relocate_functions::prel31): Ditto.
4149 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4150 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4151 static data relocations.
4152 * testsuite/Makefile.in: Regnerate.
4153 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4154
4155 2011-07-05 Ian Lance Taylor <iant@google.com>
4156
4157 PR gold/12392
4158 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4159 symbols if necessary.
4160 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4161
4162 2011-07-05 Ian Lance Taylor <iant@google.com>
4163
4164 PR gold/12952
4165 * resolve.cc (Symbol::override_base_with_special): Simply override
4166 version with special symbol version, ignoring previous version.
4167
4168 2011-07-05 Ian Lance Taylor <iant@google.com>
4169
4170 * object.cc (Sized_relobj_file::include_section_group): Add
4171 information to comment about signature location.
4172
4173 2011-07-02 Ian Lance Taylor <iant@google.com>
4174
4175 PR gold/12957
4176 * options.h (class General_options): Add -f and -F.
4177 * options.cc (General_options::finalize): Fatal error if -f/-F
4178 are used without -shared.
4179 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4180
4181 2011-07-02 Ian Lance Taylor <iant@google.com>
4182
4183 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4184
4185 2011-07-01 Ian Lance Taylor <iant@google.com>
4186
4187 PR gold/12525
4188 PR gold/12952
4189 * resolve.cc (Symbol::override_base_with_special): Don't override
4190 the version if the overriding symbol has a different name.
4191 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4192 all callers. If we give an error about an undefined version,
4193 define the base version if necessary.
4194 * dynobj.h (class Versions): Update declaration.
4195 * testsuite/weak_alias_test_5.cc: New file.
4196 * testsuite/weak_alias_test.script: New file.
4197 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4198 and versioned_alias have the right value, and call t2.
4199 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4200 weak_alias_test_5.so.
4201 (weak_alias_test_LDADD): Likewise.
4202 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4203 * testsuite/Makefile.in: Rebuild.
4204
4205 2011-07-01 Ian Lance Taylor <iant@google.com>
4206
4207 PR gold/12525
4208 * options.h (class General_options): Support -z notext.
4209 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4210 -Wl,-z,notext.
4211 (two_file_shared_nonpic.so): Likewise.
4212 (two_file_shared_mixed.so): Likewise.
4213 (two_file_shared_mixed_1.so): Likewise.
4214 (weak_undef_lib_nonpic.so): Likewise.
4215 (alt/weak_undef_lib_nonpic.so): Likewise.
4216 (tls_test_shared_nonpic.so): Likewise.
4217 * testsuite/Makefile.in: Rebuild.
4218
4219 2011-07-01 Ian Lance Taylor <iant@google.com>
4220
4221 PR gold/12525
4222 * configure.ac: Test whether static linking works, setting
4223 the automake conditional HAVE_STATIC.
4224 * testsuite/Makefile.am: Disable tests using -static if
4225 HAVE_STATIC is not true.
4226 * configure, testsuite/Makefile.in: Rebuild.
4227
4228 2011-07-01 Ian Lance Taylor <iant@google.com>
4229
4230 PR gold/12525
4231 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4232 Assert if we see DW_EH_PE_indirect.
4233 * target.h (Target::ehframe_datarel_base): New function.
4234 (Target::do_ehframe_datarel_base): New target function.
4235 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4236 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4237 function.
4238
4239 2011-07-01 Ian Lance Taylor <iant@google.com>
4240
4241 PR gold/12571
4242 * options.h (class General_options): Add
4243 --ld-generated-unwind-info.
4244 * ehframe.cc (Fde::write): Add address parameter. Change all
4245 callers. If associated with PLT, fill in address and size.
4246 (Cie::set_output_offset): Only add merge mapping if there is an
4247 object.
4248 (Cie::write): Add address parameter. Change all callers.
4249 (Eh_frame::add_ehframe_for_plt): New function.
4250 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4251 input_offset_ fields into union u_, with new plt field.
4252 (Fde::Fde): Adjust for new union field.
4253 (Fde::Fde) [Output_data version]: New constructor.
4254 (Fde::add_mapping): Only add merge mapping if there is an object.
4255 (class Cie): Update declarations.
4256 (class Eh_frame): Declare add_ehframe_for_plt.
4257 * layout.cc (Layout::layout_eh_frame): Break out code into
4258 make_eh_frame_section, and call it.
4259 (Layout::make_eh_frame_section): New function.
4260 (Layout::add_eh_frame_for_plt): New function.
4261 * layout.h (class Layout): Update declarations.
4262 * merge.cc (Merge_map::add_mapping): Add assertion.
4263 * i386.cc: Include "dwarf.h".
4264 (class Output_data_plt_i386): Make first_plt_entry,
4265 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4266 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4267 and plt_eh_frame_fde.
4268 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4269 boundary. Call add_eh_frame_for_plt if appropriate.
4270 * x86_64.cc: Include "dwarf.h".
4271 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4272 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4273 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4274 and plt_eh_frame_fde.
4275 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4276 appropriate.
4277
4278 2011-06-29 Ian Lance Taylor <iant@google.com>
4279
4280 PR gold/12629
4281 * object.cc (Sized_relobj_file::layout_section): Change shdr
4282 parameter to be const.
4283 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4284 out of do_layout.
4285 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4286 appropriate. Call layout_eh_frame_section.
4287 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4288 sections.
4289 * object.h (class Sized_relobj_file): Update declarations.
4290
4291 2011-06-29 Ian Lance Taylor <iant@google.com>
4292
4293 PR gold/12652
4294 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4295 modifier.
4296 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4297
4298 2011-06-29 Ian Lance Taylor <iant@google.com>
4299
4300 PR gold/12675
4301 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4302 SHT_X86_64_UNWIND.
4303 * layout.cc (Layout::layout_eh_frame): Likewise.
4304
4305 2011-06-29 Ian Lance Taylor <iant@google.com>
4306
4307 PR gold/12695
4308 * layout.cc (Layout::symtab_section_shndx): New function.
4309 * layout.h (class Layout): Declare symtab_section_shndx.
4310 * output.cc (Output_section::write_header): Call it.
4311
4312 2011-06-29 Ian Lance Taylor <iant@google.com>
4313
4314 PR gold/12818
4315 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4316 symbols which are not used in a relocation.
4317
4318 2011-06-28 Ian Lance Taylor <iant@google.com>
4319
4320 PR gold/12898
4321 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4322 script create indistinguishable segments.
4323 (Layout::set_segment_offsets): Use stable_sort when sorting
4324 segments. Pass this to Compare_segments constructor.
4325 * layout.h (class Layout): Make segment_precedes non-static.
4326 (class Compare_segments): Change from struct to class. Add
4327 layout_ field. Add constructor.
4328 * script-sections.cc
4329 (Script_sections::attach_sections_using_phdrs_clause): Rename
4330 local orphan to is_orphan. Don't report failure to put empty
4331 section in segment. On attachment failure, report name of
4332 section, and attach to first PT_LOAD segment.
4333
4334 2011-06-28 Ian Lance Taylor <iant@google.com>
4335
4336 PR gold/12934
4337 * target-select.cc (Target_selector::Target_selector): Add
4338 emulation parameter. Change all callers.
4339 (select_target_by_bfd_name): Rename from select_target_by_name.
4340 Change all callers.
4341 (select_target_by_emulation): New function.
4342 (supported_emulation_names): New function.
4343 * target-select.h (class Target_selector): Add emulation_ field.
4344 Update declarations.
4345 (Target_selector::recognize_by_bfd_name): Rename from
4346 recognize_by_name. Change all callers.
4347 (Target_selector::supported_bfd_names): Rename from
4348 supported_names. Change all callers.
4349 (Target_selector::recognize_by_emulation): New function.
4350 (Target_selector::supported_emulations): New function.
4351 (Target_selector::emulation): New function.
4352 (Target_selector::do_recognize_by_bfd_name): Rename from
4353 do_recognize_by_name. Change all callers.
4354 (Target_selector::do_supported_bfd_names): Rename from
4355 do_supported_names. Change all callers.
4356 (Target_selector::do_recognize_by_emulation): New function.
4357 (Target_selector::do_supported_emulations): New function.
4358 (select_target_by_bfd_name): Change name in declaration.
4359 (select_target_by_emulation): Declare.
4360 (supported_emulation_names): Declare.
4361 * parameters.cc (parameters_force_valid_target): Try to find
4362 target based on emulation from -m option.
4363 * options.h (class General_options): Change doc string for -m.
4364 * options.cc (help): Print emulations.
4365 (General_options::parse_V): Likewise.
4366 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4367 Add emulation parameter. Change all callers.
4368
4369 2011-06-28 Ian Lance Taylor <iant@google.com>
4370
4371 * target.h (class Target): Add osabi_ field.
4372 (Target::osabi): New function.
4373 (Target::set_osabi): New function.
4374 (Target::Target): Initialize osabi_.
4375 (Target::do_adjust_elf_header): Make pure virtual.
4376 (Sized_target::do_adjust_elf_header): Declare.
4377 * target.cc (Sized_target::do_adjust_elf_header): New function.
4378 (class Sized_target): Instantiate all versions.
4379 * freebsd.h (class Target_freebsd): Remove.
4380 (Target_selector_freebsd::do_recognize): Call set_osabi on
4381 Target.
4382 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4383 (Target_selector_freebsd::set_osabi): Remove.
4384 * i386.cc (class Target_i386): Inherit from Sized_target rather
4385 than Target_freebsd.
4386 * x86_64.cc (class Target_x86_64): Likewise.
4387
4388 2011-06-28 Ian Lance Taylor <iant@google.com>
4389
4390 * target.h (Target::can_check_for_function_pointers): Rewrite.
4391 Make non-virtual.
4392 (Target::can_icf_inline_merge_sections): Likewise.
4393 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4394 (Target::Target_info): Add can_icf_inline_merge_sections field.
4395 (Target::do_can_check_for_function_pointers): New virtual
4396 function.
4397 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4398 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4399 from can_check_for_function_pointers, move in file.
4400 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4401 section_may_have_icf_unsafe_poineters, move in file.
4402 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4403 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4404 Rename from can_check_for_function_pointers, move in file.
4405 (Target_i386::can_icf_inline_merge_sections): Remove.
4406 (Target_i386::i386_info): Initialize
4407 can_icf_inline_merge_sections.
4408 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4409 Initialize can_icf_inline_merge_sections.
4410 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4411 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4412 Rename from can_check_for_function_pointers, move in file.
4413 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4414 (Target_x86_64::x86_64_info): Initialize
4415 can_icf_inline_merge_sections.
4416 * testsuite/testfile.cc (Target_test::test_target_info):
4417 Likewise.
4418 * icf.cc (get_section_contents): Correct formatting.
4419
4420 2011-06-27 Ian Lance Taylor <iant@google.com>
4421
4422 * symtab.cc (Symbol::versioned_name): New function.
4423 (Symbol_table::add_to_final_symtab): Use versioned_name when
4424 appropriate.
4425 (Symbol_table::sized_write_symbol): Likewise.
4426 * symtab.h (class Symbol): Declare versioned_name.
4427 * stringpool.h (class Stringpool_template): Add variant of add
4428 which takes a std::basic_string.
4429 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4430 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4431 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4432 (ver_test_12.o): New target.
4433 * testsuite/Makefile.in: Rebuild.
4434
4435 2011-06-27 Doug Kwan <dougkwan@google.com>
4436
4437 * arm.cc (Arm_relocate_functions::thm_jump8,
4438 Arm_relocate_functions::thm_jump11): Use a wider signed
4439 type to compute offset.
4440 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4441 arm_thm_jump8.
4442 * testsuite/Makefile.in: Regenerate.
4443 * testsuite/arm_branch_in_range.sh: Check test results of
4444 arm_thm_jump11 and arm_thm_jump8.
4445 * testsuite/arm_thm_jump11.s: New test source file.
4446 * testsuite/arm_thm_jump11.t: New linker script.
4447 * testsuite/arm_thm_jump8.s: New test source file.
4448 * testsuite/arm_thm_jump8.t: New linker script.
4449
4450 2011-06-24 Ian Lance Taylor <iant@google.com>
4451
4452 * layout.cc: Include "object.h".
4453 (ctors_sections_in_init_array): New static variable.
4454 (Layout::is_ctors_in_init_array): New function.
4455 (Layout::layout): Add entry to ctors_sections_in_init_array if
4456 appropriate.
4457 * layout.h (class Layout): Declare is_ctors_in_init_array.
4458 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4459 is_ctors_reverse_view is set.
4460 (Sized_relobj_file::write_sections): Add layout parameter. Change
4461 all callers. Set is_ctors_reverse_view field of View_size.
4462 (Sized_relobj_file::reverse_words): New function.
4463 * object.h (Sized_relobj_file::View_size): Add
4464 is_ctors_reverse_view field.
4465 (class Sized_relobj_file): Update declarations.
4466 * testsuite/initpri3.c: New test.
4467 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4468 initpri3b.
4469 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4470 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4471 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4472 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4473 * testsuite/Makefile.in: Rebuild.
4474
4475 2011-06-24 Cary Coutant <ccoutant@google.com>
4476
4477 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4478 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4479 (debug_msg_cdebug.err): New targets.
4480 * testsuite/Makefile.in: Regenerate.
4481 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4482 Fix checks for link with shared library.
4483
4484 2011-06-24 Doug Kwan <dougkwan@google.com>
4485
4486 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4487 skip empty text sections.
4488 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4489
4490 2011-06-22 Ian Lance Taylor <iant@google.com>
4491
4492 PR gold/12910
4493 * options.h (class General_options): Add --ctors-in-init-array.
4494 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4495 friends as SHT_PROGBITS for merging sections.
4496 (Layout::layout): Remove special handling of .init_array and
4497 friends. Don't sort if doing relocatable link. Sort for .ctors
4498 and .dtors if ctors_in_init_array.
4499 (Layout::make_output_section): Force correct section types for
4500 .init_array and friends. Don't sort if doing relocatable link,
4501 Don't sort .ctors and .dtors if ctors_in_init_array.
4502 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4503 (Layout::output_section_name): Add relobj parameter. Change all
4504 callers. Handle .ctors. and .dtors. in code rather than table.
4505 Handle .ctors and .dtors if ctors_in_init_array.
4506 (Layout::match_file_name): New function, moved from output.cc.
4507 * layout.h (class Layout): Update declarations.
4508 * output.cc: Include "layout.h".
4509 (Input_section_sort_entry::get_priority): New function.
4510 (Input_section_sort_entry::match_file_name): Just call
4511 Layout::match_file_name.
4512 (Output_section::Input_section_sort_init_fini_compare::operator()):
4513 Handle .ctors and .dtors. Sort by explicit priority rather than
4514 by name.
4515 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4516 * testsuite/initpri2.c: New test.
4517 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4518 (check_PROGRAMS): Add initpri2.
4519 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4520 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4521 * configure, testsuite/Makefile.in: Rebuild.
4522
4523 2011-06-19 Ian Lance Taylor <iant@google.com>
4524
4525 PR gold/12880
4526 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4527 .interp section to a PT_INTERP segment even if we have seen a
4528 --dynamic-linker option. Don't do it if we have seen a PHDRS
4529 clause in a linker script.
4530 (Layout::finalize): Don't create a .interp section if we've
4531 already create a PT_INTERP segment.
4532 (Layout::create_interp): Always call choose_output_section (revert
4533 patch of 2011-06-17). Don't create PT_INTERP segment.
4534 * script-sections.cc
4535 (Script_sections::create_note_and_tls_segments): Add a .interp
4536 section to a PT_INTERP segment even if we have seen a
4537 --dynamic-linker option.
4538
4539 2011-06-18 Ian Lance Taylor <iant@google.com>
4540
4541 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4542 merely because a non-PT_LOAD segment has a dynamic reloc.
4543
4544 2011-06-18 Ian Lance Taylor <iant@google.com>
4545
4546 * layout.cc (Layout::finish_dynamic_section): Don't create
4547 DT_FLAGS entry if not needed.
4548
4549 2011-06-18 Ian Lance Taylor <iant@google.com>
4550
4551 PR gold/12745
4552 * layout.cc (Layout::layout_eh_frame): Correct handling of
4553 writable .eh_frame section.
4554
4555 2011-06-17 Ian Lance Taylor <iant@google.com>
4556
4557 PR gold/12893
4558 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4559 symbol is redefined with the exact same object and value.
4560
4561 2011-06-17 Ian Lance Taylor <iant@google.com>
4562
4563 PR gold/12880
4564 * layout.h (class Layout): Add interp_segment_ field.
4565 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4566 (Layout::attach_allocated_section_to_segment): If making shared
4567 library, put .interp section in PT_INTERP segment.
4568 (Layout::finalize): Also call create_interp if -dynamic-linker
4569 option was used.
4570 (Layout::create_interp): Assert that there is no PT_INTERP
4571 segment. If not using a SECTIONS clause, use make_output_section.
4572 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4573 * script-sections.cc
4574 (Script_sections::create_note_and_tls_segments): If making shared
4575 library, put .interp section in PT_INTERP segment.
4576
4577 2011-06-17 Ian Lance Taylor <iant@google.com>
4578
4579 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4580 when making a shared library.
4581
4582 2011-06-17 Ian Lance Taylor <iant@google.com>
4583
4584 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4585 parameter. Change all callers. Don't issue warning about PC32
4586 against locally defined symbol.
4587
4588 2011-06-16 Ian Lance Taylor <iant@google.com>
4589
4590 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4591 occurs in same object.
4592
4593 2011-06-14 Alan Modra <amodra@gmail.com>
4594
4595 * po/POTFILES.in: Regenerate.
4596
4597 2011-06-09 Ian Lance Taylor <iant@google.com>
4598
4599 * script-sections.cc
4600 (Orphan_output_section::set_section_addresses): For a relocatable
4601 link set address to 0.
4602
4603 2011-06-09 Cary Coutant <ccoutant@google.com>
4604
4605 PR gold/12804
4606 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4607 used with --compress-debug-sections.
4608 * gold/object.cc (Sized_relobj_file::do_layout): Report
4609 uncompressed size of compressed input sections.
4610
4611 2011-06-08 Cary Coutant <ccoutant@google.com>
4612
4613 PR gold/12804
4614 * testsuite/two_file_test_2_v1.cc: Change initialization of
4615 v2 to keep it in .data.
4616
4617 2011-06-07 Cary Coutant <ccoutant@google.com>
4618
4619 * common.cc (Symbol_table::do_allocate_commons_list): Call
4620 gold_fallback.
4621 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4622 (Errors::fallback): New function.
4623 (gold_fallback): New function.
4624 * errors.h (Errors::fallback): New function.
4625 * gold.cc (gold_exit): Change status parameter to enum; adjust
4626 all callers.
4627 (queue_initial_tasks): Call gold_fallback.
4628 * gold.h: Include cstdlib.
4629 (Exit_status): New enum type.
4630 (gold_exit): Change status parameter to enum.
4631 (gold_fallback): New function.
4632 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4633 (Layout::create_symtab_sections): Likewise.
4634 (Layout::create_shdrs): Likewise.
4635 * main.cc (main): Adjust call to gold_exit.
4636 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4637 (Output_data_got::add_got_entry_pair): Likewise.
4638 (Output_section::add_input_section): Likewise.
4639 (Output_section::add_output_section_data): Likewise.
4640 (Output_segment::set_section_list_addresses): Likewise.
4641 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4642
4643 2011-06-07 Cary Coutant <ccoutant@google.com>
4644
4645 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4646 for incremental links.
4647 * output.cc (Output_segment::set_section_list_addresses): Remove
4648 FIXME and test for TLS or BSS.
4649
4650 2011-06-07 Cary Coutant <ccoutant@google.com>
4651
4652 * testsuite/Makefile.am: Add incremental_copy_test,
4653 incremental_common_test_1.
4654 * testsuite/Makefile.in: Regenerate.
4655 * testsuite/common_test_1_v1.c: New source file.
4656 * testsuite/common_test_1_v2.c: New source file.
4657 * testsuite/copy_test_v1.cc: New source file.
4658
4659 2011-06-07 Cary Coutant <ccoutant@google.com>
4660
4661 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4662 update, allocate common from bss section's free list.
4663 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4664 linker-defined symbols.
4665 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4666 Skip GOT and PLT entries that are no longer referenced.
4667 (Output_section_incremental_inputs::write_info_blocks): Mark
4668 linker-defined symbols.
4669 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4670 * output.cc (Output_section::allocate): New function.
4671 * output.h (Output_section::allocate): New function.
4672 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4673 linker-defined symbols.
4674 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4675 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4676 (Symbol::init_base_output_data): Likewise.
4677 (Symbol::init_base_output_segment): Likewise.
4678 (Symbol::init_base_constant): Likewise.
4679 (Sized_symbol::init_output_data): Likewise.
4680 (Sized_symbol::init_output_segment): Likewise.
4681 (Sized_symbol::init_constant): Likewise.
4682 (Symbol_table::do_define_in_output_data): Likewise.
4683 (Symbol_table::do_define_in_output_segment): Likewise.
4684 (Symbol_table::do_define_as_constant): Likewise.
4685 * symtab.h (Symbol::is_predefined): New function.
4686 (Symbol::init_base_output_data): Add is_predefined parameter.
4687 (Symbol::init_base_output_segment): Likewise.
4688 (Symbol::init_base_constant): Likewise.
4689 (Symbol::is_predefined_): New data member.
4690 (Sized_symbol::init_output_data): Add is_predefined parameter.
4691 (Sized_symbol::init_output_segment): Likewise.
4692 (Sized_symbol::init_constant): Likewise.
4693 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4694
4695 2011-06-07 Cary Coutant <ccoutant@google.com>
4696
4697 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4698 instead of emit_copy_reloc.
4699 (Copy_relocs::emit_copy_reloc): Refactor.
4700 (Copy_relocs::make_copy_reloc): New function.
4701 (Copy_relocs::add_copy_reloc): Remove.
4702 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4703 section.
4704 (Copy_relocs::make_copy_reloc): New function.
4705 (Copy_relocs::add_copy_reloc): Remove.
4706 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4707 unchanged input files.
4708 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4709 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4710 Reserve BSS space for COPY relocations.
4711 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4712 (Output_section_incremental_inputs::write_info_blocks): Record
4713 whether a symbol is copied from a shared object.
4714 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4715 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4716 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4717 (Incremental_input_entry_reader::get_output_symbol_index): Add
4718 is_copy parameter.
4719 (Incremental_binary::emit_copy_relocs): New function.
4720 (Incremental_binary::do_emit_copy_relocs): New function.
4721 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4722 new data member.
4723 (Sized_incremental_binary::add_copy_reloc): New function.
4724 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4725 (Sized_incremental_binary::Copy_reloc): New struct.
4726 (Sized_incremental_binary::Copy_relocs): New typedef.
4727 (Sized_incremental_binary::copy_relocs_): New data member.
4728 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4729 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4730 * target.h (Sized_target::emit_copy_reloc): New function.
4731 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4732
4733 2011-06-02 Cary Coutant <ccoutant@google.com>
4734
4735 PR gold/12163
4736 * gold/archive.cc (Archive::Archive): Initialize new data member.
4737 (Archive::include_all_members): Return if archive has already been
4738 included.
4739 * gold/archive.h (Archive::include_all_members_): New data member.
4740
4741 2011-06-02 Nick Clifton <nickc@redhat.com>
4742
4743 * dynobj.h: Fix spelling mistake in comment.
4744 * output.cc: Likewise.
4745
4746 2011-05-31 Doug Kwan <dougkwan@google.com>
4747 Asier Llano
4748
4749 PR gold/12826
4750 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4751 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4752 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4753 redundant arm_exidx_test.so.
4754 * testsuite/Makefile.in: Regenerate.
4755 (check_SCRIPTS): Add pr12826.sh
4756 (check_DATA): Add pr12826.stdout
4757 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4758 * testsuite/pr12826.sh: New file.
4759 * testsuite/pr12826_1.s: Ditto.
4760 * testsuite/pr12826_1.s: Ditto.
4761
4762 2011-05-30 Ian Lance Taylor <iant@google.com>
4763
4764 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4765 sections.
4766
4767 2011-05-29 Ian Lance Taylor <iant@google.com>
4768
4769 PR gold/12804
4770 * testsuite/Makefile.am: Use different file name for two_file_test
4771 temporary file for each incremental test.
4772 * testsuite/Makefile.in: Rebuild.
4773
4774 2011-05-29 Ian Lance Taylor <iant@google.com>
4775
4776 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4777 binary input file is empty.
4778
4779 2011-05-27 Ian Lance Taylor <iant@google.com>
4780
4781 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4782 (ver_test_9.so): Likewise.
4783 * testsuite/Makefile.in: Rebuild.
4784
4785 2011-05-26 Cary Coutant <ccoutant@google.com>
4786
4787 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4788 * incremental.cc (Incremental_inputs::report_input_section): Fix
4789 comment, indentation.
4790 (Incremental_inputs::report_comdat_group): New function.
4791 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4792 of data for incremental input file entry.
4793 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4794 group count, COMDAT group signatures.
4795 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4796 an unchanged input file.
4797 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4798 Initialize new data member.
4799 (Incremental_object_entry::add_comdat_group): New function.
4800 (Incremental_object_entry::get_comdat_group_count): New function.
4801 (Incremental_object_entry::get_comdat_signature_key): New function.
4802 (Incremental_object_entry::groups_): New data member.
4803 (Incremental_inputs::report_comdat_group): New function.
4804 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4805 data for incremental input file entry.
4806 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4807 (Incremental_input_entry_reader::get_input_section): Adjust size of
4808 data for incremental input file entry.
4809 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4810 (Incremental_input_entry_reader::get_comdat_group_signature): New
4811 function.
4812 * object.cc (Sized_relobj::include_section_group): Report kept
4813 COMDAT groups for incremental links.
4814
4815 2011-05-24 David Meyer <pdox@google.com>
4816
4817 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4818 with name parameter. Add found_name parameter.
4819 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4820 * dirsearch.h (class Dirsearch): Update declaration.
4821
4822 2011-05-24 Ian Lance Taylor <iant@google.com>
4823
4824 * archive.cc (Library_base::should_include_member): Pull in object
4825 from archive if it defines the entry symbol.
4826 * parameters.cc (Parameters::entry): New function.
4827 * parameters.h (class Parameters): Declare entry.
4828 * output.h (class Output_file_header): Remove entry_ field.
4829 * output.cc (Output_file_header::Output_file_header): Remove entry
4830 parameter. Change all callers.
4831 (Output_file_header::entry): Use parameters->entry.
4832 * gold.cc (queue_middle_tasks): Likewise.
4833 * plugin.cc (Plugin_hook::run): Likewise.
4834
4835 2011-05-24 Cary Coutant <ccoutant@google.com>
4836
4837 * gold.cc (queue_initial_tasks): Pass incremental base filename
4838 to Output_file::open_base_file; don't print error message.
4839 * incremental-dump.cc (main): Adjust call to
4840 Output_file::open_for_modification.
4841 * incremental-dump.cc (main): Likewise.
4842 * incremental.cc (Incremental_inputs::report_command_line):
4843 Ignore --incremental-base option when comparing command lines.
4844 Ignore parameter when given as separate argument.
4845 * options.h (class General_options): Add --incremental-base.
4846 * output.cc (Output_file::Output_file):
4847 (Output_file::open_base_file): Add base_name and writable parameters;
4848 read base file into new file; print error message here.
4849 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4850 callers.
4851 * output.h (Output_file::open_for_modification): Rename to...
4852 (Output_file::open_base_file): ...this; add base_name and
4853 writable parameters; adjust all callers.
4854 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4855 callers.
4856 * testsuite/Makefile.am (incremental_test_4): Test
4857 --incremental-base.
4858 * testsuite/Makefile.in: Regenerate.
4859
4860 2011-05-24 Cary Coutant <ccoutant@google.com>
4861
4862 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4863 incremental_test_4.
4864 * testsuite/Makefile.in: Regenerate.
4865 * testsuite/two_file_test_1_v1.cc: New test source file.
4866 * testsuite/two_file_test_1b_v1.cc: New test source file.
4867 * testsuite/two_file_test_2_v1.cc: New test source file.
4868
4869 2011-05-24 Cary Coutant <ccoutant@google.com>
4870
4871 * dynobj.h (Dynobj::do_dynobj): New function.
4872 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4873 flag and soname for shared objects.
4874 * incremental.cc (Incremental_inputs::report_object): Make
4875 either Incremental_object_entry or Incremental_dynobj_entry; add
4876 soname to string table.
4877 (Incremental_inputs::report_input_section): Add assertion.
4878 (Output_section_incremental_inputs::set_final_data_size): Adjust
4879 type of input file entry for shared libraries; adjust size of
4880 shared library info entry.
4881 (Output_section_incremental_inputs::write_input_files): Write
4882 as_needed flag for shared libraries.
4883 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4884 of input file entry for shared libraries; write soname.
4885 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4886 soname from incremental info.
4887 * incremental.h (enum Incremental_input_flags): Add
4888 INCREMENTAL_INPUT_AS_NEEDED.
4889 (Incremental_input_entry::Incremental_input_entry): Initialize new
4890 data member.
4891 (Incremental_input_entry::set_as_needed): New function.
4892 (Incremental_input_entry::as_needed): New function.
4893 (Incremental_input_entry::do_dynobj_entry): New function.
4894 (Incremental_input_entry::as_needed_): New data member.
4895 (Incremental_object_entry::Incremental_object_entry): Don't check
4896 for shared library.
4897 (Incremental_object_entry::do_type): Likewise.
4898 (class Incremental_dynobj_entry): New class.
4899 (Incremental_input_entry_reader::as_needed): New function.
4900 (Incremental_input_entry_reader::get_soname): New function.
4901 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4902 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4903 size of shared library info entry.
4904 * layout.cc (Layout::finish_dynamic_section): Don't test for
4905 incremental link when adding DT_NEEDED entries.
4906 * object.h (Object::Object): Initialize new data member.
4907 (Object::dynobj): New function.
4908 (Object::set_as_needed): New function.
4909 (Object::as_needed): New function.
4910 (Object::do_dynobj): New function.
4911 (Object::as_needed_): New data member.
4912
4913 2011-05-24 Cary Coutant <ccoutant@google.com>
4914
4915 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4916 info; adjust display of GOT entries.
4917 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4918 vector of input objects; remove file_status_.
4919 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4920 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4921 got_plt reader; call target hooks to reserve GOT entries.
4922 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4923 of input file info header and GOT info entry.
4924 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4925 relocation info.
4926 (Got_plt_view_info::got_descriptor): Remove.
4927 (Got_plt_view_info::sym_index): New data member.
4928 (Got_plt_view_info::input_index): New data member.
4929 (Local_got_offset_visitor::visit): Write input file index.
4930 (Global_got_offset_visitor::visit): Write 0 for input file index.
4931 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4932 with sym_index and input_index.
4933 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4934 incremental info GOT entry; replace got_descriptor with input_index.
4935 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4936 map from input file index to object.
4937 (Sized_relobj_incr::do_layout): Replace direct data member reference
4938 with accessor function.
4939 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4940 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4941 Adjust size of input file info header.
4942 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4943 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4944 (Incremental_input_entry_reader::get_input_section): Adjust size of
4945 input file info header.
4946 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4947 of incremental info GOT entry.
4948 (Incremental_got_plt_reader::get_got_desc): Remove.
4949 (Incremental_got_plt_reader::get_got_symndx): New function.
4950 (Incremental_got_plt_reader::get_got_input_index): New function.
4951 (Sized_incremental_binary::Sized_incremental_binary): Remove
4952 file_status_; add input_objects_.
4953 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4954 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4955 (Sized_incremental_binary::file_is_unchanged): Remove.
4956 (Sized_incremental_binary::set_input_object): New function.
4957 (Sized_incremental_binary::input_object): New function.
4958 (Sized_incremental_binary::file_status_): Remove.
4959 (Sized_incremental_binary::input_objects_): New data member.
4960 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4961 references.
4962 (Sized_relobj_incr::invalid_address): Move to base class.
4963 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4964 class.
4965 (Sized_relobj_incr::do_output_section_offset): Likewise.
4966 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4967 (Sized_relobj_incr::section_offsets_): Likewise.
4968 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4969 function.
4970 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4971 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4972 with accessor function.
4973 (Sized_relobj_file::do_layout): Likewise.
4974 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4975 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4976 (Sized_relobj_file::compute_final_local_value): Replace refs to
4977 section_offsets_ with accessor function.
4978 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4979 * object.h (Relobj::Relobj): Initialize new data members.
4980 (Relobj::add_dyn_reloc): New function.
4981 (Relobj::first_dyn_reloc): New function.
4982 (Relobj::dyn_reloc_count): New function.
4983 (Relobj::first_dyn_reloc_): New data member.
4984 (Relobj::dyn_reloc_count_): New data member.
4985 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4986 references.
4987 (Sized_relobj::Address): New typedef.
4988 (Sized_relobj::invalid_address): Move here from child class.
4989 (Sized_relobj::Sized_relobj): Initialize new data members.
4990 (Sized_relobj::sized_relobj): New function.
4991 (Sized_relobj::is_output_section_offset_invalid): Move here from
4992 child class.
4993 (Sized_relobj::get_output_section_offset): Likewise.
4994 (Sized_relobj::local_has_got_offset): Likewise.
4995 (Sized_relobj::local_got_offset): Likewise.
4996 (Sized_relobj::set_local_got_offset): Likewise.
4997 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4998 (Sized_relobj::clear_got_offsets): New function.
4999 (Sized_relobj::section_offsets): Move here from child class.
5000 (Sized_relobj::do_output_section_offset): Likewise.
5001 (Sized_relobj::do_set_section_offset): Likewise.
5002 (Sized_relobj::Local_got_offsets): Likewise.
5003 (Sized_relobj::local_got_offsets_): Likewise.
5004 (Sized_relobj::section_offsets_): Likewise.
5005 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5006 references.
5007 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5008 class.
5009 (Sized_relobj_file::sized_relobj): New function
5010 (Sized_relobj_file::local_has_got_offset): Move to base class.
5011 (Sized_relobj_file::local_got_offset): Likewise.
5012 (Sized_relobj_file::set_local_got_offset): Likewise.
5013 (Sized_relobj_file::get_output_section_offset): Likewise.
5014 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5015 (Sized_relobj_file::do_output_section_offset): Likewise.
5016 (Sized_relobj_file::do_set_section_offset): Likewise.
5017 (Sized_relobj_file::Local_got_offsets): Likewise.
5018 (Sized_relobj_file::local_got_offsets_): Likewise.
5019 (Sized_relobj_file::section_offsets_): Likewise.
5020 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5021 (all constructors).
5022 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5023 (Output_reloc::get_symbol_index): Likewise.
5024 (Output_reloc::local_section_offset): Likewise.
5025 (Output_reloc::get_address): Likewise.
5026 (Output_reloc::symbol_value): Likewise.
5027 (Output_data_got::reserve_slot): Move to class definition.
5028 (Output_data_got::reserve_local): New function.
5029 (Output_data_got::reserve_slot_for_global): Remove.
5030 (Output_data_got::reserve_global): New function.
5031 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5032 (all constructors, two instantiations).
5033 (Output_reloc::get_relobj): New function (two instantiations).
5034 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5035 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5036 (Output_data_reloc::add_global): Adjust type of relobj.
5037 (Output_data_reloc::add_global_relative): Likewise.
5038 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5039 (Output_data_reloc::add_local): Likewise.
5040 (Output_data_reloc::add_local_relative): Likewise.
5041 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5042 (Output_data_reloc::add_local_section): Likewise.
5043 (Output_data_reloc::add_output_section): Likewise.
5044 (Output_data_reloc::add_absolute): Likewise.
5045 (Output_data_reloc::add_target_specific): Likewise.
5046 (Output_data_got::reserve_slot): Move definition here.
5047 (Output_data_got::reserve_local): New function.
5048 (Output_data_got::reserve_global): New function.
5049 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5050 section_offsets_ with accessor function.
5051 (Sized_relobj_file::write_sections): Likewise.
5052 (Sized_relobj_file::do_relocate_sections): Likewise.
5053 * target.h (Sized_target::reserve_local_got_entry): New function.
5054 (Sized_target::reserve_global_got_entry): New function.
5055 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5056 (Target_x86_64::reserve_global_got_entry): New function.
5057 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5058
5059 2011-05-23 Cary Coutant <ccoutant@google.com>
5060
5061 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5062 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5063 bit when checking got_type.
5064 * incremental.cc (Sized_incremental_binary::setup_readers):
5065 Store symbol table and string table locations; initialize bit vector
5066 of file status flags.
5067 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5068 unchanged files.
5069 (Sized_incremental_binary::do_process_got_plt): New function.
5070 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5071 (Output_section_incremental_inputs::set_final_data_size): Record
5072 file index for each input file.
5073 (Output_section_incremental_inputs::write_got_plt): Store file index
5074 instead of input entry offset for each GOT entry.
5075 * incremental.h
5076 (Incremental_input_entry::Incremental_input_entry): Initialize new
5077 data member.
5078 (Incremental_input_entry::set_offset): Store file index.
5079 (Incremental_input_entry::get_file_index): New function.
5080 (Incremental_input_entry::file_index_): New data member.
5081 (Incremental_binary::process_got_plt): New function.
5082 (Incremental_binary::do_process_got_plt): New function.
5083 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5084 data members.
5085 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5086 (Sized_incremental_binary::set_file_is_unchanged): New function.
5087 (Sized_incremental_binary::file_is_unchanged): New function.
5088 (Sized_incremental_binary::do_process_got_plt): New function.
5089 (Sized_incremental_binary::file_status_): New data member.
5090 (Sized_incremental_binary::main_symtab_loc_): New data member.
5091 (Sized_incremental_binary::main_strtab_loc_): New data member.
5092 * output.cc (Output_data_got::Got_entry::write): Add case
5093 RESERVED_CODE.
5094 (Output_data_got::add_global): Call add_got_entry.
5095 (Output_data_got::add_global_plt): Likewise.
5096 (Output_data_got::add_global_with_rel): Likewise.
5097 (Output_data_got::add_global_with_rela): Likewise.
5098 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5099 (Output_data_got::add_global_pair_with_rela): Likewise.
5100 (Output_data_got::add_local): Call add_got_entry.
5101 (Output_data_got::add_local_plt): Likewise.
5102 (Output_data_got::add_local_with_rel): Likewise.
5103 (Output_data_got::add_local_with_rela): Likewise.
5104 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5105 (Output_data_got::add_local_pair_with_rela): Likewise.
5106 (Output_data_got::reserve_slot): New function.
5107 (Output_data_got::reserve_slot_for_global): New function.
5108 (Output_data_got::add_got_entry): New function.
5109 (Output_data_got::add_got_entry_pair): New function.
5110 (Output_section::add_output_section_data): Edit FIXME.
5111 * output.h
5112 (Output_section_data_build::Output_section_data_build): New
5113 constructor with size parameter.
5114 (Output_data_space::Output_data_space): Likewise.
5115 (Output_data_got::Output_data_got): Initialize new data member; new
5116 constructor with size parameter.
5117 (Output_data_got::add_constant): Call add_got_entry.
5118 (Output_data_got::reserve_slot): New function.
5119 (Output_data_got::reserve_slot_for_global): New function.
5120 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5121 (Output_data_got::add_got_entry): New function.
5122 (Output_data_got::add_got_entry_pair): New function.
5123 (Output_data_got::free_list_): New data member.
5124 * target.h (Sized_target::init_got_plt_for_update): New function.
5125 (Sized_target::register_global_plt_entry): New function.
5126 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5127 Initialize new data member; call init; add constructor with PLT count.
5128 (Output_data_plt_x86_64::init): New function.
5129 (Output_data_plt_x86_64::add_relocation): New function.
5130 (Output_data_plt_x86_64::reserve_slot): New function.
5131 (Output_data_plt_x86_64::free_list_): New data member.
5132 (Target_x86_64::init_got_plt_for_update): New function.
5133 (Target_x86_64::register_global_plt_entry): New function.
5134 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5135 incremental updates.
5136 (Output_data_plt_x86_64::add_relocation): New function.
5137 * testsuite/object_unittest.cc (Object_test): Set default options.
5138
5139 2011-05-16 Ian Lance Taylor <iant@google.com>
5140
5141 * options.h (class General_options): Make -i a synonym for -r.
5142
5143 2011-05-16 Ian Lance Taylor <iant@google.com>
5144
5145 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5146
5147 2011-05-10 Cary Coutant <ccoutant@google.com>
5148
5149 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5150 strip_all (-s).
5151
5152 2011-05-06 Ian Lance Taylor <iant@google.com>
5153
5154 * layout.cc (Layout::layout): If the output section flags change,
5155 update the ordering.
5156
5157 2011-04-25 Cary Coutant <ccoutant@google.com>
5158
5159 * incremental-dump.cc (dump_incremental_inputs): Print local
5160 symbol info for each input file.
5161 * incremental.cc
5162 (Output_section_incremental_inputs::set_final_data_size): Add local
5163 symbol info to input file entries in incremental info.
5164 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5165 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5166 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5167 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5168 implementation.
5169 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5170 (Sized_incr_relobj::do_relocate): Write the local symbols.
5171 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5172 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5173 Adjust size of input file header.
5174 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5175 (Incremental_inputs_reader::get_local_symbol_count): New function.
5176 (Incremental_inputs_reader::get_input_section): Adjust size of input
5177 file header.
5178 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5179 (Sized_incr_relobj::This): New typedef.
5180 (Sized_incr_relobj::sym_size): New const data member.
5181 (Sized_incr_relobj::Local_symbol): New struct.
5182 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5183 (Sized_incr_relobj::do_local_symbol_offset): New function.
5184 (Sized_incr_relobj::local_symbol_count_): New data member.
5185 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5186 (Sized_incr_relobj::local_symbol_index_): New data member.
5187 (Sized_incr_relobj::local_symbol_offset_): New data member.
5188 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5189 (Sized_incr_relobj::local_symbols_): New data member.
5190 * object.h (Relobj::output_local_symbol_count): New function.
5191 (Relobj::local_symbol_offset): New function.
5192 (Relobj::do_output_local_symbol_count): New function.
5193 (Relobj::do_local_symbol_offset): New function.
5194 (Sized_relobj::do_output_local_symbol_count): New function.
5195 (Sized_relobj::do_local_symbol_offset): New function.
5196
5197 2011-04-22 Vladimir Simonov <sv@sw.ru>
5198
5199 * descriptors.cc (set_close_on_exec): New function.
5200 (Descriptors::open): Use set_close_on_exec.
5201 * output.cc (S_ISLNK): Define if not defined.
5202
5203 2011-04-22 Cary Coutant <ccoutant@google.com>
5204
5205 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5206 global symbol map.
5207 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5208 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5209 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5210 relocations.
5211 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5212 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5213 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5214 * incremental.h
5215 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5216 function.
5217 (Incremental_binary::apply_incremental_relocs): New function.
5218 (Incremental_binary::do_apply_incremental_relocs): New function.
5219 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5220 data member.
5221 (Sized_incremental_binary::add_global_symbol): New function.
5222 (Sized_incremental_binary::global_symbol): New function.
5223 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5224 (Sized_incremental_binary::symbol_map_): New data member.
5225 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5226 * target.h (Sized_target::apply_relocation): New function.
5227 * target-reloc.h (apply_relocation): New function.
5228 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5229
5230 2011-04-22 Doug Kwan <dougkwan@google.com>
5231
5232 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5233 flag of a SHT_ARM_EXIDX section.
5234 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5235 * testsuite/Makefile.in: Regenerate.
5236 * testsuite/arm_exidx_test.s: New file.
5237 * testsuite/arm_exidx_test.sh: Same.
5238
5239 2011-04-20 Cary Coutant <ccoutant@google.com>
5240
5241 PR gold/12689
5242 * archive.h (Incremental_archive_entry::Archive_member):
5243 Initialize arg_serial_ (second constructor).
5244
5245 2011-04-17 Ian Lance Taylor <iant@google.com>
5246
5247 * object.cc (Relocate_info::location): Simplify location string.
5248 * errors.cc (Errors::error_at_location): Don't print program
5249 name.
5250 (Errors::warning_at_location): Likewise.
5251 (Errors::undefined_symbol): Likewise.
5252 * testsuite/debug_msg.sh: Update accordingly.
5253
5254 2011-04-14 Cary Coutant <ccoutant@google.com>
5255
5256 * gold/layout.cc (Layout::symtab_section_offset): New function.
5257 * gold/layout.h (Layout::symtab_section_offset): New function.
5258 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5259
5260 2011-04-12 Ian Lance Taylor <iant@google.com>
5261
5262 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5263 with MREMAP_MAYMOVE.
5264 * output.h (class Output_file): Add map_is_allocated_ field.
5265 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5266 not available, provide stubs. If mremap is not available, #define
5267 it to gold_mremap.
5268 (MREMAP_MAYMOVE): Define if not defined.
5269 (Output_file::Output_file): Initialize map_is_allocated_.
5270 (Output_file::resize): Check map_is_allocated_.
5271 (Output_file::map_anonymous): If mmap fails, use malloc.
5272 (Output_file::unmap): Don't do anything for an anonymous map.
5273 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5274 is not available, provide stubs.
5275 (File_read::View::~View): Use free rather than delete[].
5276 (File_read::make_view): Use malloc rather than new[]. If mmap
5277 fails, use malloc.
5278 (File_read::find_or_make_view): Use malloc rather than new[].
5279 * gold.h: Remove HAVE_REMAP code.
5280 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5281 exists. Rename mremap to gold_mremap. If mmap is not available
5282 don't do anything.
5283 * configure, config.in: Rebuild.
5284
5285 2011-04-11 Ian Lance Taylor <iant@google.com>
5286
5287 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5288 initialize local variable v.
5289
5290 2011-04-11 Cary Coutant <ccoutant@google.com>
5291
5292 * archive.cc (Archive::include_member): Adjust call to
5293 report_object.
5294 (Add_archive_symbols::run): Track argument serial numbers.
5295 (Lib_group::include_member): Likewise.
5296 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5297 * archive.h (Incremental_archive_entry::Archive_member):
5298 Initialize arg_serial_.
5299 (Archive_member::arg_serial_): New data member.
5300 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5301 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5302 incremental link.
5303 (Sized_dynobj::do_for_all_local_got_entries): New function.
5304 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5305 function.
5306 * fileread.cc (get_mtime): New function.
5307 * fileread.h (get_mtime): New function.
5308 * gold.cc (queue_initial_tasks): Check for incremental update.
5309 (process_incremental_input): New function.
5310 (queue_middle_tasks): Don't force valid target for incremental
5311 update.
5312 * incremental-dump.cc (find_input_containing_global): Adjust
5313 size of symbol info entry.
5314 (dump_incremental_inputs): Dump argument serial number and
5315 in_system_directory flag; bias shndx by 1; print symbol names
5316 when dumping per-file symbol lists; use new symbol info readers.
5317 * incremental.cc
5318 (Output_section_incremental_inputs:update_data_size): New function.
5319 (Sized_incremental_binary::setup_readers): Setup input readers
5320 for each input file; build maps for files added from libraries
5321 and scripts.
5322 (Sized_incremental_binary::check_input_args): New function.
5323 (Sized_incremental_binary::do_check_inputs): Build map of argument
5324 serial numbers to input arguments.
5325 (Sized_incremental_binary::do_file_has_changed): Rename
5326 do_file_is_unchanged to this; compare file modification times.
5327 (Sized_incremental_binary::do_init_layout): New function.
5328 (Sized_incremental_binary::do_reserve_layout): New function.
5329 (Sized_incremental_binary::do_get_input_reader): Remove.
5330 (Sized_incremental_binary::get_symtab_view): New function.
5331 (Incremental_checker::can_incrementally_link_output_file): Remove.
5332 (Incremental_inputs::report_command_line): Exclude --debug options.
5333 (Incremental_inputs::report_archive_begin): Add parameter; track
5334 argument serial numbers; don't put input file entry for archive
5335 before archive members.
5336 (Incremental_inputs::report_archive_end): Put input file entry
5337 for archive after archive members.
5338 (Incremental_inputs::report_object): Add parameter; track argument
5339 serial numbers and in_system_directory flag.
5340 (Incremental_inputs::report_script): Add parameter; track argument
5341 serial numbers.
5342 (Output_section_incremental_inputs::set_final_data_size): Adjust
5343 size of symbol info entry; check for forwarding symbols.
5344 (Output_section_incremental_inputs::write_input_files): Write
5345 in_system_directory flag and argument serial number.
5346 (Output_section_incremental_inputs::write_info_blocks): Map section
5347 indices between incremental info and original input file; store
5348 input section index for each symbol.
5349 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5350 change operator() to visit().
5351 (class Global_got_offset_visitor): Likewise.
5352 (class Global_symbol_visitor_got_plt):
5353 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5354 classes.
5355 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5356 (Sized_incr_relobj::do_read_symbols): New function.
5357 (Sized_incr_relobj::do_layout): New function.
5358 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5359 (Sized_incr_relobj::do_add_symbols): New function.
5360 (Sized_incr_relobj::do_should_include_member): New function.
5361 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5362 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5363 (Sized_incr_relobj::do_section_size): New function.
5364 (Sized_incr_relobj::do_section_name): New function.
5365 (Sized_incr_relobj::do_section_contents): New function.
5366 (Sized_incr_relobj::do_section_flags): New function.
5367 (Sized_incr_relobj::do_section_entsize): New function.
5368 (Sized_incr_relobj::do_section_address): New function.
5369 (Sized_incr_relobj::do_section_type): New function.
5370 (Sized_incr_relobj::do_section_link): New function.
5371 (Sized_incr_relobj::do_section_info): New function.
5372 (Sized_incr_relobj::do_section_addralign): New function.
5373 (Sized_incr_relobj::do_initialize_xindex): New function.
5374 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5375 (Sized_incr_relobj::do_read_relocs): New function.
5376 (Sized_incr_relobj::do_gc_process_relocs): New function.
5377 (Sized_incr_relobj::do_scan_relocs): New function.
5378 (Sized_incr_relobj::do_count_local_symbols): New function.
5379 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5380 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5381 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5382 (Sized_incr_relobj::do_relocate): New function.
5383 (Sized_incr_relobj::do_set_section_offset): New function.
5384 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5385 (Sized_incr_dynobj::do_read_symbols): New function.
5386 (Sized_incr_dynobj::do_layout): New function.
5387 (Sized_incr_dynobj::do_add_symbols): New function.
5388 (Sized_incr_dynobj::do_should_include_member): New function.
5389 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5390 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5391 (Sized_incr_dynobj::do_section_size): New function.
5392 (Sized_incr_dynobj::do_section_name): New function.
5393 (Sized_incr_dynobj::do_section_contents): New function.
5394 (Sized_incr_dynobj::do_section_flags): New function.
5395 (Sized_incr_dynobj::do_section_entsize): New function.
5396 (Sized_incr_dynobj::do_section_address): New function.
5397 (Sized_incr_dynobj::do_section_type): New function.
5398 (Sized_incr_dynobj::do_section_link): New function.
5399 (Sized_incr_dynobj::do_section_info): New function.
5400 (Sized_incr_dynobj::do_section_addralign): New function.
5401 (Sized_incr_dynobj::do_initialize_xindex): New function.
5402 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5403 (make_sized_incremental_object): New function.
5404 (Incremental_library::copy_unused_symbols): New function.
5405 (Incremental_library::do_for_all_unused_symbols): New function.
5406 * incremental.h (enum Incremental_input_flags): New type.
5407 (class Incremental_checker): Remove.
5408 (Incremental_input_entry::Incremental_input_entry): Add argument
5409 serial number.
5410 (Incremental_input_entry::arg_serial): New function.
5411 (Incremental_input_entry::set_is_in_system_directory): New function.
5412 (Incremental_input_entry::is_in_system_directory): New function.
5413 (Incremental_input_entry::arg_serial_): New data member.
5414 (Incremental_input_entry::is_in_system_directory_): New data member.
5415 (class Script_info): Move here from script.h.
5416 (Script_info::Script_info): Add filename parameter.
5417 (Script_info::filename): New function.
5418 (Script_info::filename_): New data member.
5419 (Incremental_script_entry::Incremental_script_entry): Add argument
5420 serial number.
5421 (Incremental_object_entry::Incremental_object_entry): Likewise.
5422 (Incremental_object_entry::add_input_section): Build list of input
5423 sections with map to original shndx.
5424 (Incremental_object_entry::get_input_section_index): New function.
5425 (Incremental_object_entry::shndx_): New data member.
5426 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5427 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5428 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5429 serial number.
5430 (Incremental_inputs::report_archive_begin): Likewise.
5431 (Incremental_inputs::report_object): Likewise.
5432 (Incremental_inputs::report_script): Likewise.
5433 (class Incremental_global_symbol_reader): New class.
5434 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5435 and store flags and input file type.
5436 (Incremental_input_entry_reader::arg_serial): New function.
5437 (Incremental_input_entry_reader::type): Extract type from flags.
5438 (Incremental_input_entry_reader::is_in_system_directory): New function.
5439 (Incremental_input_entry_reader::get_input_section_count): Call
5440 accessor function for type.
5441 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5442 function for type; adjust size of global symbol entry.
5443 (Incremental_input_entry_reader::get_global_symbol_count): Call
5444 accessor function for type.
5445 (Incremental_input_entry_reader::get_object_count): Likewise.
5446 (Incremental_input_entry_reader::get_object_offset): Likewise.
5447 (Incremental_input_entry_reader::get_member_count): Likewise.
5448 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5449 (Incremental_input_entry_reader::get_member_offset): Likewise.
5450 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5451 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5452 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5453 (Incremental_input_entry_reader::get_global_symbol_reader): New
5454 function.
5455 (Incremental_input_entry_reader::get_output_symbol_index): New
5456 function.
5457 (Incremental_input_entry_reader::type_): Remove.
5458 (Incremental_input_entry_reader::flags_): New data member.
5459 (Incremental_inputs_reader::input_file_offset): New function.
5460 (Incremental_inputs_reader::input_file_index): New function.
5461 (Incremental_inputs_reader::input_file): Call input_file_offset.
5462 (Incremental_inputs_reader::input_file_at_offset): New function.
5463 (Incremental_relocs_reader::get_r_type): Reformat.
5464 (Incremental_relocs_reader::get_r_shndx): Reformat.
5465 (Incremental_relocs_reader::get_r_offset): Reformat.
5466 (Incremental_relocs_reader::data): New function.
5467 (Incremental_binary::Incremental_binary): Initialize new data members.
5468 (Incremental_binary::check_inputs): Add cmdline parameter.
5469 (Incremental_binary::file_is_unchanged): Remove.
5470 (Input_reader::arg_serial): New function.
5471 (Input_reader::get_unused_symbol_count): New function.
5472 (Input_reader::get_unused_symbol): New function.
5473 (Input_reader::do_arg_serial): New function.
5474 (Input_reader::do_get_unused_symbol_count): New function.
5475 (Input_reader::do_get_unused_symbol): New function.
5476 (Incremental_binary::input_file_count): New function.
5477 (Incremental_binary::get_input_reader): Change signature to use
5478 index instead of filename.
5479 (Incremental_binary::file_has_changed): New function.
5480 (Incremental_binary::get_input_argument): New function.
5481 (Incremental_binary::get_library): New function.
5482 (Incremental_binary::get_script_info): New function.
5483 (Incremental_binary::init_layout): New function.
5484 (Incremental_binary::reserve_layout): New function.
5485 (Incremental_binary::output_file): New function.
5486 (Incremental_binary::do_check_inputs): New function.
5487 (Incremental_binary::do_file_is_unchanged): Remove.
5488 (Incremental_binary::do_file_has_changed): New function.
5489 (Incremental_binary::do_init_layout): New function.
5490 (Incremental_binary::do_reserve_layout): New function.
5491 (Incremental_binary::do_input_file_count): New function.
5492 (Incremental_binary::do_get_input_reader): Change signature.
5493 (Incremental_binary::input_args_map_): New data member.
5494 (Incremental_binary::library_map_): New data member.
5495 (Incremental_binary::script_map_): New data member.
5496 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5497 new data members.
5498 (Sized_incremental_binary::output_section): New function.
5499 (Sized_incremental_binary::inputs_reader): Add const.
5500 (Sized_incremental_binary::symtab_reader): Add const.
5501 (Sized_incremental_binary::relocs_reader): Add const.
5502 (Sized_incremental_binary::got_plt_reader): Add const.
5503 (Sized_incremental_binary::get_symtab_view): New function.
5504 (Sized_incremental_binary::Inputs_reader): New typedef.
5505 (Sized_incremental_binary::Input_entry_reader): New typedef.
5506 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5507 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5508 (Sized_incremental_binary::do_file_has_changed): New function.
5509 (Sized_incremental_binary::do_init_layout): New function.
5510 (Sized_incremental_binary::do_reserve_layout): New function.
5511 (Sized_input_reader::Inputs_reader): Remove.
5512 (Sized_input_reader::Input_entry_reader): Remove.
5513 (Sized_input_reader::do_arg_serial): New function.
5514 (Sized_input_reader::do_get_unused_symbol_count): New function.
5515 (Sized_input_reader::do_get_unused_symbol): New function.
5516 (Sized_incremental_binary::do_input_file_count): New function.
5517 (Sized_incremental_binary::do_get_input_reader): Change signature;
5518 use index instead of filename.
5519 (Sized_incremental_binary::section_map_): New data member.
5520 (Sized_incremental_binary::input_entry_readers_): New data member.
5521 (class Sized_incr_relobj): New class.
5522 (class Sized_incr_dynobj): New class.
5523 (make_sized_incremental_object): New function.
5524 (class Incremental_library): New class.
5525 * layout.cc (Free_list::num_lists): New static data member.
5526 (Free_list::num_nodes): New static data member.
5527 (Free_list::num_removes): New static data member.
5528 (Free_list::num_remove_visits): New static data member.
5529 (Free_list::num_allocates): New static data member.
5530 (Free_list::num_allocate_visits): New static data member.
5531 (Free_list::init): New function.
5532 (Free_list::remove): New function.
5533 (Free_list::allocate): New function.
5534 (Free_list::dump): New function.
5535 (Free_list::print_stats): New function.
5536 (Layout_task_runner::run): Resize output file for incremental updates.
5537 (Layout::Layout): Initialize new data members.
5538 (Layout::set_incremental_base): New function.
5539 (Layout::init_fixed_output_section): New function.
5540 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5541 incremental updates.
5542 (Layout::create_gold_note): Do not create gold note section for
5543 incremental updates.
5544 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5545 for incremental updates.
5546 (Layout::set_section_offsets): For incremental updates, allocate space
5547 from free list.
5548 (Layout::create_symtab_sections): Layout with offsets relative to
5549 start of section; for incremental updates, allocate space from free
5550 list.
5551 (Layout::create_shdrs): For incremental updates, allocate space from
5552 free list.
5553 (Layout::finish_dynamic_section): For incremental updates, do not
5554 check --as-needed (fixed in subsequent patch).
5555 * layout.h (class Free_list): New class.
5556 (Layout::set_incremental_base): New function.
5557 (Layout::incremental_base): New function.
5558 (Layout::init_fixed_output_section): New function.
5559 (Layout::allocate): New function.
5560 (Layout::incremental_base_): New data member.
5561 (Layout::free_list_): New data member.
5562 * main.cc (main): Print Free_list statistics.
5563 * object.cc (Relobj::finalize_incremental_relocs): Add
5564 clear_counts parameter; clear counts only when clear_counts is set.
5565 (Sized_relobj::Sized_relobj): Initialize new base class.
5566 (Sized_relobj::do_layout): Don't report special sections.
5567 (Sized_relobj::do_for_all_local_got_entries): New function.
5568 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5569 symtab_off to all symbol table offsets.
5570 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5571 * object.h (class Got_offset_list): Move to top of file.
5572 (Object::Object): Allow case where input_file == NULL.
5573 (Object::~Object): Likewise.
5574 (Object::input_file): Assert that input_file != NULL.
5575 (Object::lock): Allow case where input_file == NULL.
5576 (Object::unlock): Likewise.
5577 (Object::is_locked): Likewise.
5578 (Object::token): Likewise.
5579 (Object::release): Likewise.
5580 (Object::is_incremental): New function.
5581 (Object::get_mtime): New function.
5582 (Object::for_all_local_got_entries): New function.
5583 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5584 (Object::set_is_in_system_directory): New function.
5585 (Object::is_in_system_directory): New function.
5586 (Object::do_is_incremental): New function.
5587 (Object::do_get_mtime): New function.
5588 (Object::do_for_all_local_got_entries): New function.
5589 (Object::is_in_system_directory_): New data member.
5590 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5591 (class Sized_relobj_base): New class.
5592 (class Sized_relobj): Derive from Sized_relobj_base.
5593 (class Sized_relobj::Symbols): Redeclare from base class.
5594 (class Sized_relobj::local_got_offset_list): Remove.
5595 (class Sized_relobj::Output_sections): Redeclare from base class.
5596 (class Sized_relobj::do_for_all_local_got_entries): New function.
5597 (class Sized_relobj::write_local_symbols): Add offset parameter.
5598 (class Sized_relobj::local_symbol_offset_): Update comment.
5599 (class Sized_relobj::local_dynsym_offset_): Update comment.
5600 * options.cc (Input_arguments::add_file): Remove const.
5601 * options.h (Input_file_argument::Input_file_argument):
5602 Initialize arg_serial_ (all constructors).
5603 (Input_file_argument::set_arg_serial): New function.
5604 (Input_file_argument::arg_serial): New function.
5605 (Input_file_argument::arg_serial_): New data member.
5606 (Input_arguments::Input_arguments): Initialize file_count_.
5607 (Input_arguments::add_file): Remove const.
5608 (Input_arguments::number_of_input_files): New function.
5609 (Input_arguments::file_count_): New data member.
5610 (Command_line::number_of_input_files): Call
5611 Input_arguments::number_of_input_files.
5612 * output.cc (Output_segment_headers::Output_segment_headers):
5613 Set current size.
5614 (Output_section::Input_section::current_data_size): New function.
5615 (Output_section::Output_section): Initialize new data members.
5616 (Output_section::add_input_section): Don't do merge sections for
5617 an incremental link; allocate space from free list for an
5618 incremental update.
5619 (Output_section::add_output_section_data): Allocate space from
5620 free list for an incremental update.
5621 (Output_section::update_data_size): New function.
5622 (Output_section::set_fixed_layout): New function.
5623 (Output_section::reserve): New function.
5624 (Output_segment::set_section_addresses): Remove const.
5625 (Output_segment::set_section_list_addresses): Remove const; allocate
5626 space from free list for an incremental update.
5627 (Output_segment::set_offset): Adjust size of RELRO segment for an
5628 incremental update.
5629 * output.h (Output_data::current_data_size): Move here from
5630 child classes.
5631 (Output_data::pre_finalize_data_size): New function.
5632 (Output_data::update_data_size): New function.
5633 (Output_section_headers::update_data_size): new function.
5634 (Output_section_data_build::current_data_size): Move to Output_data.
5635 (Output_data_strtab::update_data_size): New function.
5636 (Output_section::current_data_size): Move to Output_data.
5637 (Output_section::set_fixed_layout): New function.
5638 (Output_section::has_fixed_layout): New function.
5639 (Output_section::reserve): New function.
5640 (Output_section::update_data_size): New function.
5641 (Output_section::has_fixed_layout_): New data member.
5642 (Output_section::free_list_): New data member.
5643 (Output_segment::set_section_addresses): Remove const.
5644 (Output_segment::set_section_list_addresses): Remove const.
5645 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5646 New function.
5647 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5648 New function.
5649 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5650 parameter when calling Add_symbols constructor; store argument
5651 serial number for members of a lib group.
5652 (Add_symbols::locks): Allow case where token == NULL.
5653 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5654 (Read_member::~Read_member): New function.
5655 (Read_member::is_runnable): New function.
5656 (Read_member::locks): New function.
5657 (Read_member::run): New function.
5658 (Check_script::~Check_script): New function.
5659 (Check_script::is_runnable): New function.
5660 (Check_script::locks): New function.
5661 (Check_script::run): New function.
5662 (Check_library::~Check_library): New function.
5663 (Check_library::is_runnable): New function.
5664 (Check_library::locks): New function.
5665 (Check_library::run): New function.
5666 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5667 (Add_symbols::library_): New data member.
5668 (class Read_member): New class.
5669 (class Check_script): New class.
5670 (class Check_library): New class.
5671 * reloc.cc (Read_relocs::is_runnable): Allow case where
5672 token == NULL.
5673 (Read_relocs::locks): Likewise.
5674 (Scan_relocs::locks): Likewise.
5675 (Relocate_task::locks): Likewise.
5676 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5677 to clear counters.
5678 (Sized_relobj::incremental_relocs_scan): Fix comment.
5679 (Sized_relobj::do_relocate): Pass output file offset to
5680 write_local_symbols.
5681 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5682 from class declaration.
5683 * script.cc (read_input_script): Allocate Script_info; pass
5684 argument serial number to report_script.
5685 * script.h (class Script_info): Move to incremental.h.
5686 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5687 * symtab.h (Symbol_table::add_from_incrobj): New function.
5688 (Symbol_table::set_file_offset): New function.
5689
5690 2011-04-05 Cary Coutant <ccoutant@google.com>
5691
5692 * incremental-dump.cc (dump_incremental_inputs): Change signature
5693 to take a Sized_incremental_binary; change caller. Use readers
5694 in Sized_incremental_binary.
5695 * incremental.cc
5696 (Sized_incremental_binary::find_incremental_inputs_sections):
5697 Rename do_find_incremental_inputs_sections to this.
5698 (Sized_incremental_binary::setup_readers): New function.
5699 (Sized_incremental_binary::do_check_inputs): Check
5700 has_incremental_info_ flag; move setup code to setup_readers;
5701 use input readers.
5702 (Sized_incremental_binary::do_file_is_unchanged): New function.
5703 (Sized_incremental_binary::do_get_input_reader): New function.
5704 * incremental.h (class Incremental_binary): Move to end of file.
5705 (Incremental_binary::file_is_unchanged): New function.
5706 (Incremental_binary::do_file_is_unchanged): New function.
5707 (Incremental_binary::Input_reader): New class.
5708 (Incremental_binary::get_input_reader): New function.
5709 (class Sized_incremental_binary): Move to end of file.
5710 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5711 input section reader classes.
5712 (Sized_incremental_binary::has_incremental_info): New function.
5713 (Sized_incremental_binary::inputs_reader): New function.
5714 (Sized_incremental_binary::symtab_reader): New function.
5715 (Sized_incremental_binary::relocs_reader): New function.
5716 (Sized_incremental_binary::got_plt_reader): New function.
5717 (Sized_incremental_binary::do_file_is_unchanged): New function.
5718 (Sized_incremental_binary::Sized_input_reader): New class.
5719 (Sized_incremental_binary::get_input_reader): New function.
5720 (Sized_incremental_binary::find_incremental_inputs_sections):
5721 Rename do_find_incremental_inputs_sections to this.
5722 (Sized_incremental_binary::setup_readers): New function.
5723 (Sized_incremental_binary::has_incremental_info_): New data member.
5724 (Sized_incremental_binary::inputs_reader_): New data member.
5725 (Sized_incremental_binary::symtab_reader_): New data member.
5726 (Sized_incremental_binary::relocs_reader_): New data member.
5727 (Sized_incremental_binary::got_plt_reader_): New data member.
5728 (Sized_incremental_binary::current_input_file_): New data member.
5729
5730 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5731
5732 PR gold/12640
5733 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5734 violation.
5735
5736 2011-03-30 Cary Coutant <ccoutant@google.com>
5737
5738 * archive.cc (Archive::include_member): Adjust call to report_object.
5739 (Add_archive_symbols::run): Add script_info to call to
5740 report_archive_begin.
5741 (Lib_group::include_member): Adjust call to report_object.
5742 (Add_lib_group_symbols::run): Adjust call to report_object.
5743 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5744 blocks. Add object count for script input files.
5745 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5746 script_info parameter; change all callers.
5747 (Incremental_inputs::report_object): Add script_info parameter;
5748 change all callers.
5749 (Incremental_inputs::report_script): Store backpointer to
5750 incremental info entry.
5751 (Output_section_incremental_inputs::set_final_data_size): Record
5752 additional information for scripts.
5753 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5754 * incremental.h (Incremental_script_entry::add_object): New function.
5755 (Incremental_script_entry::get_object_count): New function.
5756 (Incremental_script_entry::get_object): New function.
5757 (Incremental_script_entry::objects_): New data member; adjust
5758 constructor.
5759 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5760 (Incremental_inputs::report_object): Add script_info parameter.
5761 (Incremental_inputs_reader::get_object_count): New function.
5762 (Incremental_inputs_reader::get_object_offset): New function.
5763 * options.cc (Input_arguments::add_file): Return reference to
5764 new input argument.
5765 * options.h (Input_argument::set_script_info): New function.
5766 (Input_argument::script_info): New function.
5767 (Input_argument::script_info_): New data member; adjust all
5768 constructors.
5769 (Input_file_group::add_file): Return reference to new input argument.
5770 (Input_file_lib::add_file): Likewise.
5771 (Input_arguments::add_file): Likewise.
5772 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5773 * script.cc (Parser_closure::Parser_closure): Add script_info
5774 parameter; adjust all callers.
5775 (Parser_closure::script_info): New function.
5776 (Parser_closure::script_info_): New data member.
5777 (read_input_script): Report scripts earlier to incremental info.
5778 (script_add_file): Set script_info in Input_argument.
5779 (script_add_library): Likewise.
5780 * script.h (Script_options::Script_info): Rewrite class.
5781
5782 2011-03-29 Cary Coutant <ccoutant@google.com>
5783
5784 * archive.cc (Library_base::should_include_member): Move
5785 method here from class Archive.
5786 (Archive::Archive): Initialize base class.
5787 (Archive::should_include_member): Move to base class.
5788 (Archive::do_for_all_unused_symbols): New function.
5789 (Add_archive_symbols::run): Remove redundant access to
5790 incremental_inputs.
5791 (Lib_group::Lib_group): Initialize base class.
5792 (Lib_group::do_filename): New function.
5793 (Lib_group::include_member): Pass pointer to Lib_group to
5794 report_object.
5795 (Lib_group::do_for_all_unused_symbols): New function.
5796 (Add_lib_group_symbols::run): Report archive information for
5797 incremental links.
5798 * archive.h (class Library_base): New base class.
5799 (class Archive): Derive from Library_base.
5800 (Archive::filename): Move to base class.
5801 (Archive::set_incremental_info): Likewise.
5802 (Archive::incremental_info): Likewise.
5803 (Archive::Should_include): Likewise.
5804 (Archive::should_include_member): Likewise.
5805 (Archive::Armap_entry): Remove.
5806 (Archive::Unused_symbol_iterator): Remove.
5807 (Archive::unused_symbols_begin): Remove.
5808 (Archive::unused_symbols_end): Remove.
5809 (Archive::do_filename): New function.
5810 (Archive::do_get_mtime): New function.
5811 (Archive::do_for_all_unused_symbols): New function.
5812 (Archive::task_): Move to base class.
5813 (Archive::incremental_info_): Likewise.
5814 (class Lib_group): Derive from Library_base.
5815 (Lib_group::do_filename): New function.
5816 (Lib_group::do_get_mtime): New function.
5817 (Lib_group::do_for_all_unused_symbols): New function.
5818 (Lib_group::task_): Move to base class.
5819 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5820 function.
5821 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5822 function.
5823 * incremental.cc (Incremental_inputs::report_archive_begin):
5824 Use Library_base; call library's get_mtime; add incremental inputs
5825 entry before members.
5826 (class Unused_symbol_visitor): New class.
5827 (Incremental_inputs::report_archive_end): Use Library_base; use
5828 visitor class to record unused symbols; don't add incremental inputs
5829 entry after members.
5830 (Incremental_inputs::report_object): Use Library_base.
5831 * incremental.h
5832 (Incremental_archive_entry::Incremental_archive_entry): Remove
5833 unused Archive parameter.
5834 (Incremental_inputs::report_archive_begin): Use Library_base.
5835 (Incremental_inputs::report_archive_end): Likewise.
5836 (Incremental_inputs::report_object): Likewise.
5837 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5838 function.
5839 * object.h (Object::for_all_global_symbols): New function.
5840 (Object::do_for_all_global_symbols): New function.
5841 (Sized_relobj::do_for_all_global_symbols): New function.
5842 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5843 function.
5844 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5845 function.
5846
5847 2011-03-27 Ian Lance Taylor <iant@google.com>
5848
5849 * archive.cc (Archive::interpret_header): Return -1 if something
5850 goes wrong. Change callers accordingly.
5851
5852 2011-03-25 Cary Coutant <ccoutant@google.com>
5853
5854 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5855 * testsuite/Makefile.in: Regenerate.
5856
5857 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5858
5859 * plugin.cc (get_view): New.
5860 (Plugin::load): Pass get_view to the plugin.
5861 (Plugin_manager::get_view): New.
5862
5863 2011-03-21 Ian Lance Taylor <iant@google.com>
5864
5865 * testsuite/final_layout.sh: Rewrite to not use dc.
5866 * testsuite/relro_test.sh: Fail if dc is not present.
5867
5868 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5869
5870 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5871 Change == to -eq.
5872 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5873 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5874 Change == to -eq.
5875 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5876 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5877
5878 2011-03-14 Ian Lance Taylor <iant@google.com>
5879
5880 * script-sections.cc (Sort_output_sections::script_compare):
5881 Rename from is_before, change return type.
5882 (Sort_output_sections::operator()): Adjust accordingly.
5883
5884 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5885
5886 PR gold/12572
5887 * testsuite/odr_violation2.cc: Add comment to make all error line
5888 numbers double digits.
5889 * testsuite/debug_msg.sh: Adjust expected errors.
5890
5891 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5892
5893 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5894 but mark earlier ones as non-canonical
5895 (offset_to_iterator): Update search target and example
5896 (do_addr2line): Return extra lines in a vector*
5897 (format_file_lineno): Extract from do_addr2line
5898 (one_addr2line): Add vector* out-param
5899 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5900 when a lineno entry appeared last for its instruction
5901 (Dwarf_line_info): Add vector* out-param
5902 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5903 * symtab.cc (Odr_violation_compare): Include the lineno in the
5904 comparison again.
5905 (linenos_from_loc): New. Combine the canonical line for an
5906 address with its other lines.
5907 (True_if_intersect): New. Helper functor to make
5908 std::set_intersection a query.
5909 (detect_odr_violations): Compare sets of lines instead of just
5910 one line for each function. This became less deterministic, but
5911 has fewer false positives.
5912 * symtab.h: Declarations.
5913 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5914 mix an optimized and non-optimized object in the same binary
5915 (odr_violation2.so): Same.
5916 * testsuite/Makefile.in: Regenerate from Makefile.am.
5917 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5918 * testsuite/debug_msg.sh: Update line numbers and add
5919 assertions.
5920 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5921 non-optimized context.
5922 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5923 isn't inlined, and use OdrDerived in an optimized context.
5924 * testsuite/odr_header1.h: Defines OdrDerived, where
5925 optimization will change the
5926 first-instruction-in-the-destructor's file and line number.
5927 * testsuite/odr_header2.h: Defines OdrBase.
5928
5929 2011-03-09 Ian Lance Taylor <iant@google.com>
5930
5931 * fileread.cc (File_read::clear_views): Don't delete the whole
5932 file view.
5933
5934 2011-03-08 Ian Lance Taylor <iant@google.com>
5935
5936 PR gold/12525
5937 * fileread.cc: #include <climits>.
5938 (GOLD_IOV_MAX): Define.
5939 (File_read::read_multiple): Limit number of entries by iov_max.
5940 * fileread.h (class File_read): Always set max_readv_entries to
5941 128.
5942
5943 2011-03-07 Ian Lance Taylor <iant@google.com>
5944
5945 PR gold/12525
5946 * options.h (class General_options): Add -dy and -dn.
5947
5948 2011-03-02 Cary Coutant <ccoutant@google.com>
5949
5950 * testsuite/script_test_9.t: Add TLS segment.
5951
5952 2011-03-02 Simon Baldwin <simonb@google.com>
5953
5954 * configure.ac: Add check for gnu_indirect_function support in
5955 the toolchain building binutils.
5956 * configure: Rebuild.
5957
5958 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5959
5960 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5961 plugin only symbols.
5962 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5963 in plugin files as not needed in the symbol table.
5964
5965 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5966
5967 * output.cc (Output_section::add_input_section): Delay fill
5968 generation for section ordering.
5969
5970 2011-02-09 Ian Lance Taylor <iant@google.com>
5971
5972 PR gold/12316
5973 * object.h (class Sized_relobj): Remove clear_local_symbols.
5974 * reloc.cc (Sized_relobj::do_relocate): Don't call
5975 clear_local_symbols.
5976
5977 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5978
5979 * plugin.cc (is_visible_from_outside): Return true for symbols
5980 in the -u option.
5981
5982 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5983
5984 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5985 filename.
5986
5987 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5988
5989 * icf.h (is_section_foldable_candidate): Change type of parameter
5990 to std::string.
5991 * icf.cc (Icf::find_identical_sections): Change type of local variable
5992 section_name to be std::string.
5993 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5994
5995 2011-01-25 Ian Lance Taylor <iant@google.com>
5996
5997 * script.cc (script_add_extern): Rewrite to use
5998 add_symbol_reference.
5999
6000 2011-01-25 Doug Kwan <dougkwan@google.com>
6001
6002 * icf.cc (get_section_contents): Always lock section's object.
6003
6004 2011-01-24 Ian Lance Taylor <iant@google.com>
6005
6006 * options.h (class General_options): Accept
6007 --no-detect-odr-violations.
6008
6009 2011-01-24 Ian Lance Taylor <iant@google.com>
6010
6011 * version.cc (version_string): Bump to 1.11.
6012
6013 2011-01-24 Ian Lance Taylor <iant@google.com>
6014
6015 * plugin.cc (class Plugin_rescan): Define new class.
6016 (Plugin_manager::claim_file): Set any_claimed_.
6017 (Plugin_manager::save_archive): New function.
6018 (Plugin_manager::save_input_group): New function.
6019 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6020 necessary.
6021 (Plugin_manager::new_undefined_symbol): New function.
6022 (Plugin_manager::rescan): New function.
6023 (Plugin_manager::rescannable_defines): New function.
6024 (Plugin_manager::add_input_file): Set any_added_.
6025 * plugin.h (class Plugin_manager): define new fields rescannable_,
6026 undefined_symbols_, any_claimed_, and any_added_. Declare
6027 Plugin_rescan as friend. Declare new functions.
6028 (Plugin_manager::Rescannable): Define type.
6029 (Plugin_manager::Rescannable_list): Define type.
6030 (Plugin_manager::Undefined_symbol_list): Define type.
6031 (Plugin_manager::Plugin_manager): Initialize new fields.
6032 * archive.cc (Archive::defines_symbol): New function.
6033 (Add_archive_symbols::run): Pass archive to plugins if any.
6034 * archive.h (class Archive): Declare defines_symbol.
6035 * readsyms.cc (Input_group::~Input_group): New function.
6036 (Finish_group::run): Pass input_group to plugins if any.
6037 * readsyms.h (class Input_group): Declare destructor.
6038 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6039 any.
6040
6041 2011-01-10 Ian Lance Taylor <iant@google.com>
6042
6043 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6044 section as relro.
6045 (Layout::set_segment_offsets): Reset increase_relro before calling
6046 set_section_addresses a second time.
6047
6048 2011-01-04 Cary Coutant <ccoutant@google.com>
6049
6050 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6051 sections before NOBITS sections.
6052
6053 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6054
6055 * version.cc (print_version): Update copyright to 2011.
6056
6057 2010-12-23 Cary Coutant <ccoutant@google.com>
6058
6059 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6060 of OS to this->add. Add OD parameter to second form of the function.
6061
6062 2010-12-20 Ian Lance Taylor <iant@google.com>
6063
6064 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6065 second of two consecutive entries with same offset.
6066
6067 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6068
6069 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6070 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6071 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6072 to avoid unneeded links against $(LDADD).
6073 * testsuite/Makefile.in: Regenerate.
6074
6075 2010-12-15 Ian Lance Taylor <iant@google.com>
6076
6077 PR gold/12324
6078 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6079 for R_X86_64_32 and R_X86_64_PC32.
6080 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6081 ver_matching_def_pic.o.
6082 (ver_matching_def_pic.o): New target.
6083
6084 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6085
6086 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6087 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6088 Move definition before File_read::View member definitions.
6089 (File_read::View::~View): Initialize and hold lock before
6090 updating current_mapped_bytes.
6091
6092 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6093
6094 * dwarf_reader.cc: Remove outdated comment.
6095 * gold-threads.cc: Fix typo in error message.
6096 * archive.cc: Fix typos in comments.
6097 * archive.h: Likewise.
6098 * arm-reloc-property.cc: Likewise.
6099 * arm-reloc-property.h: Likewise.
6100 * arm-reloc.def: Likewise.
6101 * arm.cc: Likewise.
6102 * attributes.h: Likewise.
6103 * cref.cc: Likewise.
6104 * ehframe.cc: Likewise.
6105 * fileread.h: Likewise.
6106 * gold.h: Likewise.
6107 * i386.cc: Likewise.
6108 * icf.cc: Likewise.
6109 * incremental.h: Likewise.
6110 * int_encoding.cc: Likewise.
6111 * layout.h: Likewise.
6112 * main.cc: Likewise.
6113 * merge.h: Likewise.
6114 * object.cc: Likewise.
6115 * object.h: Likewise.
6116 * options.cc: Likewise.
6117 * readsyms.cc: Likewise.
6118 * reduced_debug_output.cc: Likewise.
6119 * reloc.cc: Likewise.
6120 * script-sections.cc: Likewise.
6121 * sparc.cc: Likewise.
6122 * symtab.h: Likewise.
6123 * target-reloc.h: Likewise.
6124 * target.cc: Likewise.
6125 * target.h: Likewise.
6126 * timer.cc: Likewise.
6127 * timer.h: Likewise.
6128 * x86_64.cc: Likewise.
6129
6130 2010-12-09 Cary Coutant <ccoutant@google.com>
6131
6132 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6133 stack.
6134 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6135 parameter; change all callers.
6136 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6137 * options.h (warn_execstack): New option.
6138
6139 2010-12-07 Doug Kwan <dougkwan@google.com>
6140
6141 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6142 like function call relocations.
6143
6144 2010-12-07 Ian Lance Taylor <iant@google.com>
6145
6146 * archive.cc (Archive::get_elf_object_for_member): Permit
6147 punconfigured to be NULL.
6148 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6149 (Archive::include_member): Pass NULL to get_elf_object_for_member
6150 if we searched for the archive and this is the first included
6151 object.
6152
6153 2010-12-01 Ian Lance Taylor <iant@google.com>
6154
6155 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6156 track_relocs_type_ field.
6157 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6158 Set track_relocs_type_.
6159 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6160 contents when using RELA relocs.
6161 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6162 reloc_map_.
6163 * reloc.cc (Track_relocs::next_addend): New function.
6164 * reloc.h (class Track_relocs): Declare next_addend.
6165
6166 2010-12-01 Ian Lance Taylor <iant@google.com>
6167
6168 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6169 virtual destructor.
6170
6171 2010-12-01 Ian Lance Taylor <iant@google.com>
6172
6173 * README: Update compilers known to work and fail.
6174
6175 2010-11-23 Matthias Klose <doko@ubuntu.com>
6176
6177 * configure.in: For --enable-gold, handle value `default' instead of
6178 `both*'. Always install ld as ld.bfd, install as ld if gold is
6179 not the default.
6180 * configure: Regenerate.
6181
6182 2010-11-18 Doug Kwan <dougkwan@google.com>
6183
6184 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6185 and right_alignment to be zero. Store result alignment only if it is
6186 greater than existing alignment.
6187
6188 2010-11-16 Cary Coutant <ccoutant@google.com>
6189
6190 PR gold/12220
6191 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6192 Check for ".zdebug_line".
6193
6194 2010-11-16 Doug Kwan <dougkwan@google.com>
6195 Cary Coutant <ccoutant@google.com>
6196
6197 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6198 by reference; adjust all callers.
6199 * output.cc (Output_segment::set_section_addresses): Adjust references
6200 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6201 list is empty.
6202 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6203 end at page boundary.
6204
6205 2010-11-16 Cary Coutant <ccoutant@google.com>
6206
6207 PR gold/12220
6208 * layout.cc (Layout::choose_output_section): Transform names of
6209 compressed sections even when using a script with a SECTIONS clause.
6210 (Layout::output_section_name): Remove code to transform
6211 compressed debug section names.
6212 * output.cc (Output_section::add_input_section): Use uncompressed
6213 section size when tracking input sections.
6214
6215 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6216
6217 * symtab.h (Symbol::NON_PIC_REF): Remove.
6218 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6219 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6220 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6221 (Symbol::use_plt_offset): Take a flags argument and pass it
6222 directly to needs_dynamic_reloc. Restrict check for undefined
6223 weak symbols to function calls.
6224 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6225 (Target_arm::Scan::global): Use it.
6226 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6227 (Target_arm::Relocate::relocate): Likewise.
6228 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6229 parameter with an r_type parameter. Use get_reference_flags
6230 to get the flags.
6231 (Target_arm::Relocate::relocate): Update accordingly.
6232 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6233 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6234 (Target_i386::Scan::global): Likewise.
6235 (Target_i386::Relocate::relocate): Likewise.
6236 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6237 parameter with an r_type parameter. Use get_reference_flags
6238 to get the flags.
6239 (Target_i386::Relocate::relocate): Update accordingly.
6240 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6241 (Target_powerpc::Scan::global): Use it.
6242 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6243 (Target_powerpc::Relocate::relocate): Likewise.
6244 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6245 (Target_sparc::Scan::global): Use it.
6246 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6247 (Target_sparc::Relocate::relocate): Likewise.
6248 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6249 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6250 (Target_x86_64::Scan::global): Likewise.
6251 (Target_x86_64::Relocate::relocate): Likewise.
6252
6253 2010-11-08 Doug Kwan <dougkwan@google.com>
6254 Cary Coutant <ccoutant@google.com>
6255
6256 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6257 (Arm_exidx_merge_section::section_contents_): New data member.
6258 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6259 (Arm_input_section::~Arm_input_section): De-allocate memory.
6260 (Arm_input_section::original_contents_): New data member.
6261 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6262 in parameters instead of calling Object::section_contents without
6263 locking.
6264 (Arm_output_section::group_section): New parameter TASK. Pass it
6265 to callees that need locking objects.
6266 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6267 to lock EXIDX input sections. Fix a formatting issue. Call
6268 Arm_exidx_merged_section::build_contents to create merged section
6269 contents.
6270 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6271 to lock object of stub table owner.
6272 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6273 TEXT_SIZE to initialize data member TEXT_SIZE_.
6274 (Arm_exidx_input_section::addralign): Fix typo in comment.
6275 (Arm_exidx_input_section::text_size): New method.
6276 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6277 that require locking objects. Lock objects before scanning for stubs
6278 and updating local symbols.
6279 (Arm_input_section<big_endian>::init): Copy contents of original
6280 input section.
6281 (Arm_input_section<big_endian>::do_write): Use saved contents of
6282 original input section instead of calling Object::section_contents
6283 without locking.
6284 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6285 size without calling Object::section_size().
6286 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6287 for size. Allocate a buffer for merged EXIDX entries.
6288 (Arm_exidx_merged_section::build_contents): New method.
6289 (Arm_exidx_merged_section::do_write): Move merge section contents
6290 building code to Arm_exidx_merged_section::build_contetns. Write
6291 out contetns in buffer instead of building it on the fly.
6292 (Arm_relobj::make_exidx_input_section): Also pass text section size
6293 to Arm_exidx_input_section constructor.
6294 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6295 (Arm_dynobj::do_read_symbols): Fix memory leak.
6296 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6297 * target.h: (class Task): Add forward declaration.
6298 (Target::relax): Add new parameter TASK and pass it to
6299 Target::do_relax().
6300 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6301
6302 2010-11-05 Cary Coutant <ccoutant@google.com>
6303
6304 PR gold/10708
6305 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6306 object when reading from the file.
6307 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6308 second layout pass.
6309 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6310 when reading section contents.
6311 (get_section_contents): Likewise.
6312 (icf::find_identical_sections): Likewise.
6313 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6314 object when reading from the file.
6315 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6316 the object when doing deferred section layout.
6317
6318 2010-11-03 Nick Clifton <nickc@redhat.com>
6319
6320 PR gold/12001
6321 * script.h (class Symbol_assignment: name): New member. Returns
6322 the name of the symbol.
6323 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6324 Returns true if the given symbol name is on the list of
6325 assignments wating to be processed.
6326 * archive.cc (should_incldue_member): If the symbol is undefined,
6327 check to see if it is on the list of symbols pending assignment.
6328
6329 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6330
6331 * script-sections.cc (Script_sections::find_memory_region): Check
6332 for a NULL output section pointer.
6333
6334 2010-10-29 Doug Kwan <dougkwan@google.com>
6335
6336 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6337 Output_section::add_relaxed_input_section.
6338 * output.cc (Output_section::add_relaxed_input_section): Add new
6339 arguments LAYOUT and NAME. Set section order index.
6340 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6341 Copy section order index.
6342 * output.h (Output_section::add_relaxed_input_section): Add new
6343 arguments LAYOUT and NAME.
6344
6345 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6346
6347 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6348 NATIVE_OR_CROSS_LINKER.
6349 * testsuite/Makefile.in: Regenerate.
6350
6351 2010-10-20 Doug Kwan <dougkwan@google.com>
6352
6353 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6354 without SHF_LINK_ORDER flags.
6355 * layout.cc (Layout::choose_output_section): Do not filter
6356 SHF_LINK_ORDER flag in a relocatable link.
6357
6358 2010-10-17 Cary Coutant <ccoutant@google.com>
6359
6360 * output.h (Output_segment::set_section_addresses): Change function
6361 signature. Update all callers.
6362 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6363 sections.
6364 (Output_segment::set_section_addresses): Align after last TLS
6365 section. Add padding before last relro section instead of after.
6366
6367 2010-10-17 Doug Kwan <dougkwan@google.com>
6368
6369 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6370 GOT output section to be writable.
6371
6372 2010-10-14 Cary Coutant <ccoutant@google.com>
6373
6374 * debug.h (DEBUG_INCREMENTAL): New flag.
6375 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6376 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6377 mode.
6378 * incremental.cc (report_command_line): Ignore all forms of
6379 --incremental.
6380 * layout.cc (Layout::Layout): Check parameters for incremental link
6381 mode.
6382 * options.cc (General_options::parse_incremental): New function.
6383 (General_options::parse_no_incremental): New function.
6384 (General_options::parse_incremental_full): New function.
6385 (General_options::parse_incremental_update): New function.
6386 (General_options::incremental_mode_): New data member.
6387 (General_options::finalize): Check incremental_mode_.
6388 * options.h (General_options): Update help text for --incremental.
6389 Add --no-incremental, --incremental-full, --incremental-update.
6390 (General_options::Incremental_mode): New enum type.
6391 (General_options::incremental_mode): New function.
6392 (General_options::incremental_mode_): New data member.
6393 * parameters.cc (Parameters::incremental_mode_): New data member.
6394 (Parameters::set_options): Set incremental_mode_.
6395 (Parameters::set_incremental_full): New function.
6396 (Parameters::incremental): New function.
6397 (Parameters::incremental_update): New function.
6398 (set_parameters_incremental_full): New function.
6399 * parameters.h (Parameters::set_incremental_full): New function.
6400 (Parameters::incremental): New function.
6401 (Parameters::incremental_update): New function.
6402 (Parameters::incremental_mode_): New data member.
6403 (set_parameters_incremental_full): New function.
6404 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6405 incremental link mode.
6406 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6407 (Sized_relobj::do_relocate_sections): Likewise.
6408 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6409 option.
6410 * testsuite/Makefile.in: Regenerate.
6411 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6412
6413 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6414
6415 * script-sections.h (class Script_sections): Make
6416 Sections_elements typedef public.
6417 * script-sections.cc (class Sort_output_sections): Add elements_
6418 field. Add constructor which sets it; change all callers.
6419 (Sort_output_sections::is_before): New function.
6420 (Sort_output_sections::operator()): Call is_before.
6421 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6422 conditional.
6423 * testsuite/script_test_10.sh: New test. Test script section
6424 order.
6425 * testsuite/script_test_10.t: Likewise.
6426 * testsuite/script_test_10.s: Likewise.
6427 * testsuite/Makefile.am: Wrap the cross linker tests and the
6428 common tests into NATIVE_OR_CROSS_LINKER.
6429 (check_SCRIPTS): Add script_test_10.sh.
6430 (check_DATA): Add script_test_10.stdout.
6431 (script_test_10.o, script_test_10): New targets.
6432 (script_test_10.stdout): New target.
6433 * configure, testsuite/Makefile.in: Regenerate.
6434
6435 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6436
6437 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6438 error for the deprecated relocations.
6439 (Target_arm::Scan::global): Likewise.
6440 (Target_arm::Relocate::relocate): Likewise.
6441
6442 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6443
6444 * fileread.cc (Input_file::find_file): Initialize *found_name
6445 and *namep when using the fallback search for case 4.
6446
6447 2010-10-11 Cary Coutant <ccoutant@google.com>
6448
6449 * options.h (class General_options): Redefine -z lazy as an alias for
6450 the negation of -z now.
6451
6452 2010-10-11 Ian Lance Taylor <iant@google.com>
6453
6454 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6455 binding.
6456
6457 2010-10-06 Nick Clifton <nickc@redhat.com>
6458
6459 * script-sections.cc(class Memory_region): Remove
6460 current_lma_offset_ field. Rename current_vma_offset_ to
6461 current_offset_. Add last_section_ field.
6462 (Memory_region::get_current_vma_address): Rename to
6463 get_current_address.
6464 (Memory_region::get_current_lma_address): Delete.
6465 (Memory_region::increment_vma_offset): Rename to
6466 increment_offset.
6467 (Memory_region::increment_lma_offset): Delete.
6468 (Memory_region::attributes_compatible): New method. Returns
6469 true if the provided section is compatible with the region.
6470 (Memory_region::get_last_section): New method. Returns the last
6471 section to use the region.
6472 (Memory_region::set_last_section): New method. Stores the last
6473 section to use the region.
6474 (Script_sections::block_in_region): New method. Returns true if
6475 a block of memory is contained within a region.
6476 (Script_sections::find_memory_region): New method. Locates a
6477 memory region to be used to set a VMA or LMA address.
6478 (Output_section_definition::set_section_addresses): Add code to
6479 check for addresses set by memory regions.
6480 (Output_segment::set_section_addresses): Remove memory region
6481 walking code.
6482 (Script_sections::create_segment): Add a warning if a header
6483 segment is created outside of any region.
6484 * script-sections.h (class Script_sections): Add prototypes for
6485 find_memory_region and block_in_region methods.
6486 * testsuite/memory_test.s: Use .long instead of .word.
6487 * testsuite/memory_test.t: Add some more output sections.
6488 * testsuite/memory_test.sh: Update expected output.
6489
6490 2010-10-02 Doug Kwan <dougkwan@google.com>
6491
6492 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6493 defintion to symtab.h
6494 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6495 declaration to defintion.
6496
6497 2010-10-01 Nick Clifton <nickc@redhat.com>
6498
6499 * expression.cc (eval): Replace dummy argument with NULL.
6500 (eval_maybe_dot): Check for a NULL result section pointer.
6501 (Symbol_expression::value): Likewise.
6502 (Dot_expression::value): Likewise.
6503 (BINARY_EXPRESSION): Likewise.
6504 (Max_expression::value): Likewise.
6505 (Min_expression::value): Likewise.
6506 (Absolute_expression::value): Likewise.
6507 (Addr_expression::value_from_output_section): Likewise.
6508 (Loaddddr_expression::value_from_output_section): Likewise.
6509 (Segment_start_expression::value): Likewise.
6510 * script-sections.cc
6511 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6512 argument with NULL.
6513 (Sections_elememt_dot_assignment::set_section_addresses):
6514 Likewise.
6515 (Output_data_expression::do_write_to_buffer): Likewise.
6516 (Output_section_definition::finalize_symbols): Likewise.
6517 (Output_section_definition::set_section_addresses): Likewise.
6518
6519 2010-09-30 Doug Kwan <dougkwan@google.com>
6520
6521 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6522
6523 2010-09-28 Sriraman Tallam <tmsriram@google.com>
6524
6525 * target.h (Target::can_icf_inline_merge_sections): New virtual
6526 function.
6527 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6528 virtual function.
6529 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6530 virtual function.
6531 * icf.cc (get_section_contents): Inline merge sections only when
6532 target allows it.
6533
6534 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6535
6536 * configure: Regenerate.
6537
6538 2010-09-17 Ian Lance Taylor <iant@google.com>
6539
6540 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6541 * testsuite/Makefile.am (memory_test.o): New target.
6542 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6543 memory_test.t.
6544 * testsuite/Makefile.in: Rebuild.
6545
6546 2010-09-17 Doug Kwan <dougkwan@google.com>
6547
6548 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6549 defintion if relocation uses GOT entries of the symbol.
6550 * testsuite/icf_safe_test.sh: Fix test.
6551 * testsuite/icf_safe_so_test.sh: Fix test.
6552
6553 2010-09-16 Cary Coutant <ccoutant@google.com>
6554
6555 * script_sections.cc (class Memory_region): Remove "NULL" from
6556 vector initializations.
6557
6558 2010-09-15 Cary Coutant <ccoutant@google.com>
6559
6560 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6561 Resolve forwarding symbols.
6562
6563 2010-09-15 Doug Kwan <dougkwan@google.com>
6564
6565 * gold/testsuite/script_test_3.t: Add ARM special sections.
6566 * gold/testsuite/script_test_4.t: Same.
6567 * gold/testsuite/script_test_5.t: Same.
6568 * gold/testsuite/script_test_6.t: Same.
6569 * gold/testsuite/script_test_7.t: Same.
6570 * gold/testsuite/script_test_7.t: Same.
6571 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6572
6573 2010-09-14 Cary Coutant <ccoutant@google.com>
6574
6575 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6576 (Target_x86_64::Relocate::relocate_tls): Replace check for
6577 saw_tls_block_reloc_ with test for executable section.
6578
6579 2010-09-12 Cary Coutant <ccoutant@google.com>
6580
6581 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6582 position-independent executables to shared libraries need dynamic
6583 relocations.
6584 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6585 position-independent executables.
6586 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6587 * testsuite/Makefile.in: Regenerate.
6588
6589 2010-09-10 Nick Clifton <nickc@redhat.com>
6590
6591 PR gold/11997
6592 * testsuite/memory_test.t: Discard any sections that are not
6593 needed.
6594
6595 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6596
6597 PR gold/11996
6598 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6599 "This::" to work around a bug in gcc 4.2.
6600
6601 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6602
6603 2010-09-09 Rafael Espindola <espindola@google.com>
6604
6605 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6606 sections with different PF_X flags in the same segment.
6607 (Layout::find_first_load_seg): Search all segments to find the first
6608 one.
6609 * options.h (rosegment): New.
6610
6611 2010-09-08 Rafael Espindola <espindola@google.com>
6612
6613 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6614
6615 2010-09-08 Doug Kwan <dougkwan@google.com>
6616
6617 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6618 (Arm_relobj::do_relocate_sections): Add new parameter for output
6619 file to match the parent.
6620 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6621 of local symbols instead of input values. Update code to track
6622 changes in gold::relocate_section.
6623 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6624 (Sized_relobj::compute_final_local_value_internal): New methods.
6625 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6626 body into private version of Sized_relobj::compute_final_local_value.
6627 Call the inline method.
6628 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6629 merged symbol value if there is one.
6630 (Symbol_value::has_output_value): New method defintiion.
6631 (Sized_relobj::Compute_final_local_value_status): New enum type.
6632 (Sized_relobj::compute_final_local_value): New methods.
6633 (Sized_relobj::compute_final_local_value_internal): New methods.
6634 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6635 and arm_cortex_a8.sh.
6636 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6637 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6638 New tests.
6639 * Makefile.in: Regenerate.
6640 * testsuite/arm_bl_out_of_range.s: Update test.
6641 * testsuite/thumb_bl_out_of_range.s: Ditto.
6642 * testsuite/thumb_blx_out_of_range.s: Ditto.
6643 * testsuite/arm_branch_out_of_range.sh: New file.
6644 * testsuite/arm_cortex_a8.sh: Ditto.
6645 * testsuite/arm_cortex_a8_b.s: Ditto.
6646 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6647 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6648 * testsuite/arm_cortex_a8_bl.s: Ditto.
6649 * testsuite/arm_cortex_a8_blx.s: Ditto.
6650 * testsuite/arm_cortex_a8_local.s: Ditto.
6651 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6652 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6653
6654 2010-09-08 Rafael Espindola <espindola@google.com>
6655
6656 * Makefile.am (memory_test.stdout): Run readelf with -W.
6657 * Makefile.in: Regenerate.
6658 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6659 64 bit output.
6660
6661 2010-09-08 Rafael Espindola <espindola@google.com>
6662
6663 * script-sections.cc (Script_sections::add_memory_region): Convert
6664 field precision to int.
6665 * script.cc (script_set_section_region, script_set_section_region):
6666 Convert field precision to int.
6667
6668 2010-09-08 Rafael Espindola <espindola@google.com>
6669
6670 * arm.cc (do_finalize_sections): Create the __exidx_start and
6671 __exdix_end symbols even when the section is missing.
6672
6673 2010-09-08 Nick Clifton <nickc@redhat.com>
6674
6675 * README: Remove claim that MEMORY is not supported.
6676 * expression.cc (script_exp_function_origin)
6677 (script_exp_function_length): Move from here to ...
6678 * script.cc: ... here.
6679 (script_set_section_region, script_add_memory)
6680 (script_parse_memory_attr, script_include_directive): New
6681 functions.
6682 * script-sections.cc
6683 (class Memory_region): New class.
6684 (class Output_section_definition): Add set_memory_region,
6685 set_section_vma, set_section_lma and get_section_name methods.
6686 (class Script_Sections): Add add_memory_region,
6687 find_memory_region, find_memory_region_origin,
6688 find_memory_region_length and set_memory_region methods.
6689 Have set_section_addresses method walk the list of set memory
6690 regions.
6691 Extend the print methos to display memory regions.
6692 * script-sections.h: Add prototypes for new methods.
6693 Add enum for MEMORY region attributes.
6694 * yyscript.y: Add support for parsing MEMORY regions.
6695 * script-c.h: Add prototypes for new functions.
6696 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6697 * testsuite/Makefile.in: Regenerate.
6698 * testsuite/memory_test.sh: New script.
6699 * testsuite/memory_test.s: New assembler source file.
6700 * testsuite/memory_test.t: New linker script.
6701
6702 2010-08-27 Doug Kwan <dougkwan@google.com>
6703
6704 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6705 reference override an existing dynamic weak reference.
6706 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6707 * testsuite/Makefile.in: Regenerate.
6708 * testsuite/dyn_weak_ref.sh: New file.
6709 * testsuite/dyn_weak_ref_1.c: Ditto.
6710 * testsuite/dyn_weak_ref_2.c: Ditto.
6711
6712 2010-08-27 Ian Lance Taylor <iant@google.com>
6713
6714 * incremental.h (class Incremental_input_entry): Add virtual
6715 destructor.
6716
6717 2010-08-27 Ian Lance Taylor <iant@google.com>
6718
6719 * testsuite/start_lib_test_3.c: Mark t3 as used.
6720
6721 2010-08-27 Nick Clifton <nickc@redhat.com>
6722
6723 * options.cc (version_script): Fix small typo in previous
6724 whitespace tidyup.
6725
6726 2010-08-25 Nick Clifton <nickc@redhat.com>
6727
6728 * archive.cc: Formatting fixes: Remove whitespace between
6729 typename and following asterisk. Remove whitespace between
6730 function name and opening parenthesis.
6731 * archive.h: Likewise.
6732 * arm.cc: Likewise.
6733 * attributes.cc: Likewise.
6734 * attributes.h: Likewise.
6735 * common.cc: Likewise.
6736 * copy-relocs.cc: Likewise.
6737 * dirsearch.h: Likewise.
6738 * dynobj.cc: Likewise.
6739 * ehframe.cc: Likewise.
6740 * ehframe.h: Likewise.
6741 * expression.cc: Likewise.
6742 * fileread.cc: Likewise.
6743 * fileread.h: Likewise.
6744 * gc.h: Likewise.
6745 * gold-threads.cc: Likewise.
6746 * gold.cc: Likewise.
6747 * i386.cc: Likewise.
6748 * icf.h: Likewise.
6749 * incremental-dump.cc: Likewise.
6750 * incremental.cc: Likewise.
6751 * layout.cc: Likewise.
6752 * layout.h: Likewise.
6753 * main.cc: Likewise.
6754 * merge.cc: Likewise.
6755 * merge.h: Likewise.
6756 * object.cc: Likewise.
6757 * object.h: Likewise.
6758 * options.cc: Likewise.
6759 * options.h: Likewise.
6760 * output.cc: Likewise.
6761 * output.h: Likewise.
6762 * plugin.cc: Likewise.
6763 * plugin.h: Likewise.
6764 * powerpc.cc: Likewise.
6765 * reloc.cc: Likewise.
6766 * script-c.h: Likewise.
6767 * script-sections.cc: Likewise.
6768 * script.cc: Likewise.
6769 * stringpool.cc: Likewise.
6770 * symtab.cc: Likewise.
6771 * symtab.h: Likewise.
6772 * target.cc: Likewise.
6773 * timer.cc: Likewise.
6774 * timer.h: Likewise.
6775 * version.cc: Likewise.
6776 * x86_64.cc: Likewise.
6777
6778 2010-08-24 Nick Clifton <nickc@redhat.com>
6779
6780 PR 11899
6781 * layout.cc (segment_precedes): Sort segments by their physical
6782 addresses, if they have been set.
6783
6784 2010-08-23 Cary Coutant <ccoutant@google.com>
6785
6786 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6787 symbols data.
6788 (Lib_group::include_member): Unlock object after deleting its
6789 symbols data.
6790 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6791 the bug fixed here.
6792
6793 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6794 Cary Coutant <ccoutant@google.com>
6795
6796 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6797 constructor, and set_blocker.
6798 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6799 readsyms_blocker_.
6800 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6801 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6802 * testsuite/Makefile.am (start_lib_test): New test case.
6803 * testsuite/Makefile.in: Regenerate.
6804 * testsuite/start_lib_test_main.c: New file.
6805 * testsuite/start_lib_test_1.c: New file.
6806 * testsuite/start_lib_test_2.c: New file.
6807 * testsuite/start_lib_test_3.c: New file.
6808
6809 2010-08-19 Ian Lance Taylor <iant@google.com>
6810
6811 * Makefile.in: Rebuild with automake 1.11.1.
6812 * aclocal.m4: Likewise.
6813 * testsuite/Makefile.in: Likewise.
6814
6815 2010-08-19 Ian Lance Taylor <iant@google.com>
6816
6817 PR 10893
6818 * i386.cc (class Output_data_plt_i386): Update declarations.
6819 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6820 local_ifuncs_ fields.
6821 (Target_i386::do_plt_section_for_global): New function.
6822 (Target_i386::do_plt_section_for_local): New function.
6823 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6824 parameter; change all callers. Initialize global_ifuncs_ and
6825 local_ifuncs_. If doing a static link define __rel_iplt_start and
6826 __rel_iplt_end.
6827 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6828 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6829 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6830 symbols.
6831 (Target_i386::make_plt_section): New function, broken out of
6832 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6833 (Target_i386::make_plt_entry): Call make_plt_section.
6834 (Target_i386::make_local_ifunc_plt_entry): New function.
6835 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6836 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6837 R_386_IRELATIVE to switch.
6838 (Target_i386::Scan::global): Likewise.
6839 (Target_i386::Relocate::relocate): Likewise.
6840 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6841 switch.
6842 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6843 (Target_x86_64::do_plt_section_for_global): New function.
6844 (Target_x86_64::do_plt_section_for_local): New function.
6845 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6846 parameter; change all callers. If doing a static link define
6847 __rela_iplt_start and __rela_iplt_end.
6848 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6849 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6850 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6851 to point to .plt.
6852 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6853 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6854 switch.
6855 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6856 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6857 R_X86_64_IRELATIVE to switch.
6858 (Target_x86_64::Scan::global): Likewise.
6859 (Target_x86_64::Relocate::relocate): Likewise.
6860 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6861 switch.
6862 * target.h (class Target): Add plt_section_for_global and
6863 plt_section_for_local functions. Add do_plt_section_for_global
6864 and do_plt_section_for_local virtual functions.
6865 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6866 clarifying comments.
6867 (Symbol::use_plt_offset): Handle IFUNC symbol.
6868 * object.cc (Sized_relobj::Sized_relobj): Initialize
6869 local_plt_offsets_.
6870 (Sized_relobj::local_has_plt_offset): New function.
6871 (Sized_relobj::local_plt_offset): New function.
6872 (Sized_relobj::set_local_plt_offset): New function.
6873 (Sized_relobj::do_count): Handle IFUNC symbol.
6874 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6875 a bit away from input_shndx_ field. Add set_is_func_symbol and
6876 is_ifunc_symbol functions.
6877 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6878 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6879 local_plt_offsets_ field.
6880 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6881 * output.h (class Output_section_data): Add non-const
6882 output_section function.
6883 (class Output_data_got): Update declarations.
6884 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6885 Add use_plt_offset parameter to global and local constructors.
6886 Change all callers. Change local_sym_index_ field to 31 bits.
6887 Change GSYM_CODE and CONSTANT_CODE accordingly.
6888 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6889 doing a static link don't set sh_link field.
6890 (Output_data_got::Got_entry::write): Use PLT offset if
6891 appropriate.
6892 (Output_data_got::add_global_plt): New function.
6893 (Output_data_got::add_local_plt): New function.
6894 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6895 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6896 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6897 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6898 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6899 IFUNC conditional.
6900 * testsuite/ifunc-sel.h: New file.
6901 * testsuite/ifuncmain1.c: New file.
6902 * testsuite/ifuncmain1vis.c: New file.
6903 * testsuite/ifuncmod1.c: New file.
6904 * testsuite/ifuncdep2.c: New file.
6905 * testsuite/ifuncmain2.c: New file.
6906 * testsuite/ifuncmain3.c: New file.
6907 * testsuite/ifuncmod3.c: New file.
6908 * testsuite/ifuncmain4.c: New file.
6909 * testsuite/ifuncmain5.c: New file.
6910 * testsuite/ifuncmod5.c: New file.
6911 * testsuite/ifuncmain6pie.c: New file.
6912 * testsuite/ifuncmod6.c: New file.
6913 * testsuite/ifuncmain7.c: New file.
6914 * configure, testsuite/Makefile.in: Rebuild.
6915
6916 2010-08-18 Ian Lance Taylor <iant@google.com>
6917
6918 * incremental.cc
6919 (Output_section_incremental_inputs::write_input_files): Add cast
6920 to avoid signed/unsigned comparison warning.
6921 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6922
6923 2010-08-12 Cary Coutant <ccoutant@google.com>
6924
6925 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6926
6927 2010-08-13 Ian Lance Taylor <iant@google.com>
6928
6929 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6930
6931 2010-08-12 Cary Coutant <ccoutant@google.com>
6932 Doug Kwan <dougkwan@google.com>
6933
6934 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6935 defintion overrides non-weak undef, remember that the original undef
6936 is not weak.
6937 * symtab.cc (Symbol_table::sized_write_global): For undef without
6938 an original weak binding, set binding to global in output.
6939 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6940 * testsuite/Makefile.in: Regenerate.
6941 * testsuite/strong_ref_weak_def.sh: New file.
6942 * testsuite/strong_ref_weak_def_1.c: Ditto.
6943 * testsuite/strong_ref_weak_def_2.c: Ditto.
6944
6945 2010-08-12 Cary Coutant <ccoutant@google.com>
6946
6947 * testsuite/incremental_test.sh: Rewrite.
6948 * testsuite/incremental_test_1.c: Rewrite.
6949 * testsuite/incremental_test_2.c: Rewrite.
6950
6951 2010-08-12 Cary Coutant <ccoutant@google.com>
6952
6953 * arm.cc (Target_arm::got_size): Add const.
6954 (Target_arm::got_entry_count): New function.
6955 (Target_arm::plt_entry_count): New function.
6956 (Target_arm::first_plt_entry_offset): New function.
6957 (Target_arm::plt_entry_size): New function.
6958 (Output_data_plt_arm::entry_count): New function.
6959 (Output_data_plt_arm::first_plt_entry_offset): New function.
6960 (Output_data_plt_arm::get_plt_entry_size): New function.
6961 * i386.cc (Target_i386::got_size): Add const.
6962 (Target_i386::got_entry_count): New function.
6963 (Target_i386::plt_entry_count): New function.
6964 (Target_i386::first_plt_entry_offset): New function.
6965 (Target_i386::plt_entry_size): New function.
6966 (Output_data_plt_i386::entry_count): New function.
6967 (Output_data_plt_i386::first_plt_entry_offset): New function.
6968 (Output_data_plt_i386::get_plt_entry_size): New function.
6969 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6970 find_incremental_inputs_sections. Dump incremental_got_plt section.
6971 * incremental.cc: Include target.h.
6972 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6973 parameter. Adjust all callers. Find incremental_got_plt section.
6974 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6975 section.
6976 (Output_section_incremental_inputs::set_final_data_size): Calculate
6977 size of incremental_got_plt section.
6978 (Output_section_incremental_inputs::do_write): Write the
6979 incremental_got_plt section.
6980 (Got_plt_view_info): New struct.
6981 (Local_got_offset_visitor): New class.
6982 (Global_got_offset_visitor): New class.
6983 (Global_symbol_visitor_got_plt): New class.
6984 (Output_section_incremental_inputs::write_got_plt): New function.
6985 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6986 Add parameter. Adjust all callers.
6987 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6988 (Incremental_inputs::got_plt_section): New function.
6989 (Incremental_inputs::got_plt_section_): New data member.
6990 (Incremental_got_plt_reader): New class.
6991 * layout.cc (Layout::create_incremental_info_sections): Add the
6992 incremental_got_plt section.
6993 * object.h (Got_offset_list::get_list): New function.
6994 (Got offset_list::for_all_got_offsets): New function.
6995 (Sized_relobj::local_got_offset_list): New function.
6996 * powerpc.cc (Target_powerpc::got_size): Add const.
6997 (Target_powerpc::got_entry_count): New function.
6998 (Target_powerpc::plt_entry_count): New function.
6999 (Target_powerpc::first_plt_entry_offset): New function.
7000 (Target_powerpc::plt_entry_size): New function.
7001 (Output_data_plt_powerpc::entry_count): New function.
7002 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7003 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7004 * sparc.cc (Target_sparc::got_size): Add const.
7005 (Target_sparc::got_entry_count): New function.
7006 (Target_sparc::plt_entry_count): New function.
7007 (Target_sparc::first_plt_entry_offset): New function.
7008 (Target_sparc::plt_entry_size): New function.
7009 (Output_data_plt_sparc::entry_count): New function.
7010 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7011 (Output_data_plt_sparc::get_plt_entry_size): New function.
7012 * symtab.h (Symbol::got_offset_list): New function.
7013 (Symbol_table::for_all_symbols): New function.
7014 * target.h (Sized_target::got_entry_count): New function.
7015 (Sized_target::plt_entry_count): New function.
7016 (Sized_target::plt_entry_size): New function.
7017 * x86_64.cc (Target_x86_64::got_size): Add const.
7018 (Target_x86_64::got_entry_count): New function.
7019 (Target_x86_64::plt_entry_count): New function.
7020 (Target_x86_64::first_plt_entry_offset): New function.
7021 (Target_x86_64::plt_entry_size): New function.
7022 (Output_data_plt_x86_64::entry_count): New function.
7023 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7024 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7025
7026 2010-08-12 Cary Coutant <ccoutant@google.com>
7027
7028 * archive.cc: Include incremental.h.
7029 (Archive::Archive): Initialize incremental_info_.
7030 (Archive::include_member): Record archive members in incremental info.
7031 (Add_archive_symbols::run): Record begin and end of an archive in
7032 incremental info.
7033 (Lib_group::include_member): Record objects in incremental info.
7034 * archive.h (Incremental_archive_entry): Forward declaration.
7035 (Archive::set_incremental_info): New member function.
7036 (Archive::incremental_info): New member function.
7037 (Archive::Unused_symbol_iterator): New class.
7038 (Archive::unused_symbols_begin): New member function.
7039 (Archive::unused_symbols_end): New member function.
7040 (Archive::incremental_info_): New data member.
7041 * incremental-dump.cc (find_input_containing_global): New function.
7042 (dump_incremental_inputs): Dump new incremental info sections.
7043 * incremental.cc: Include symtab.h.
7044 (Output_section_incremental_inputs): New class.
7045 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7046 new incremental info sections.
7047 (Sized_incremental_binary::do_check_inputs): Likewise.
7048 (Incremental_inputs::report_archive): Remove.
7049 (Incremental_inputs::report_archive_begin): New function.
7050 (Incremental_inputs::report_archive_end): New function.
7051 (Incremental_inputs::report_object): New function.
7052 (Incremental_inputs::finalize_inputs): Remove.
7053 (Incremental_inputs::report_input_section): New function.
7054 (Incremental_inputs::report_script): Rewrite.
7055 (Incremental_inputs::finalize): Do nothing but finalize string table.
7056 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7057 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7058 (Incremental_inputs::create_data_sections): New function.
7059 (Incremental_inputs::relocs_entsize): New function.
7060 (Output_section_incremental_inputs::set_final_data_size): New function.
7061 (Output_section_incremental_inputs::do_write): New function.
7062 (Output_section_incremental_inputs::write_header): New function.
7063 (Output_section_incremental_inputs::write_input_files): New function.
7064 (Output_section_incremental_inputs::write_info_blocks): New function.
7065 (Output_section_incremental_inputs::write_symtab): New function.
7066 * incremental.h (Incremental_script_entry): Forward declaration.
7067 (Incremental_object_entry): Forward declaration.
7068 (Incremental_archive_entry): Forward declaration.
7069 (Incremental_inputs): Forward declaration.
7070 (Incremental_inputs_header_data): Remove.
7071 (Incremental_inputs_header): Remove.
7072 (Incremental_inputs_header_write): Remove.
7073 (Incremental_inputs_entry_data): Remove.
7074 (Incremental_inputs_entry): Remove.
7075 (Incremental_inputs_entry_write): Remove.
7076 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7077 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7078 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7079 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7080 Likewise.
7081 (Incremental_input_entry): New class.
7082 (Incremental_script_entry): New class.
7083 (Incremental_object_entry): New class.
7084 (Incremental_archive_entry): New class.
7085 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7086 (Incremental_inputs::report_inputs): Remove.
7087 (Incremental_inputs::report_archive): Remove.
7088 (Incremental_inputs::report_archive_begin): New function.
7089 (Incremental_inputs::report_archive_end): New function.
7090 (Incremental_inputs::report_object): Change prototype.
7091 (Incremental_inputs::report_input_section): New function.
7092 (Incremental_inputs::report_script): Change prototype.
7093 (Incremental_inputs::get_reloc_count): New function.
7094 (Incremental_inputs::set_reloc_count): New function.
7095 (Incremental_inputs::create_data_sections): New function.
7096 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7097 (Incremental_inputs::inputs_section): New function.
7098 (Incremental_inputs::symtab_section): New function.
7099 (Incremental_inputs::relocs_section): New function.
7100 (Incremental_inputs::get_stringpool): Add const.
7101 (Incremental_inputs::command_line): Add const.
7102 (Incremental_inputs::inputs): Remove.
7103 (Incremental_inputs::command_line_key): New function.
7104 (Incremental_inputs::input_file_count): New function.
7105 (Incremental_inputs::input_files): New function.
7106 (Incremental_inputs::relocs_entsize): New function.
7107 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7108 (Incremental_inputs::finalize_inputs): Remove.
7109 (Incremental_inputs::Input_info): Remove.
7110 (Incremental_inputs::lock_): Remove.
7111 (Incremental_inputs::inputs_): Change type.
7112 (Incremental_inputs::inputs_map_): Remove.
7113 (Incremental_inputs::current_object_entry_): New data member.
7114 (Incremental_inputs::inputs_section_): New data member.
7115 (Incremental_inputs::symtab_section_): New data member.
7116 (Incremental_inputs::relocs_section_): New data member.
7117 (Incremental_inputs::reloc_count_): New data member.
7118 (Incremental_inputs_reader): New class.
7119 (Incremental_symtab_reader): New class.
7120 (Incremental_relocs_reader): New class.
7121 * layout.cc (Layout::finalize): Move finalization of incremental info
7122 and creation of incremental info sections to follow finalization of
7123 symbol table. Set offsets for postprocessing sections.
7124 (Layout::create_incremental_info_sections): Call
7125 Incremental_inputs::create_data_sections. Add incremental symtab
7126 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7127 sections to layout after input sections.
7128 * layout.h (struct Timespec): Forward declaration.
7129 (Layout::incremental_inputs): Add const.
7130 (Layout::create_incremental_info_sections): Add parameter.
7131 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7132 * object.cc: Include incremental.h.
7133 (Relobj::finalize_incremental_relocs): New function.
7134 (Sized_relobj::do_layout): Record input sections in incremental info.
7135 * object.h (Object::output_section): New function.
7136 (Object::output_section_offset): Moved from Relobj.
7137 (Object::get_incremental_reloc_base): New function.
7138 (Object::get_incremental_reloc_count): New function.
7139 (Object::do_output_section): New function.
7140 (Object::do_output_section_offset): Moved from Relobj.
7141 (Object::do_get_incremental_reloc_base): New function.
7142 (Object::do_get_incremental_reloc_count): New function.
7143 (Object::Object): Initialize new data members.
7144 (Relobj::output_section): Renamed do_output_section and moved to
7145 protected.
7146 (Relobj::output_section_offset): Moved to Object.
7147 (Relobj::do_get_incremental_reloc_base): New function.
7148 (Relobj::do_get_incremental_reloc_count): New function.
7149 (Relobj::allocate_incremental_reloc_counts): New function.
7150 (Relobj::count_incremental_reloc): New function.
7151 (Relobj::finalize_incremental_relocs): New function.
7152 (Relobj::next_incremental_reloc_index): New function.
7153 (Relobj::reloc_counts_): New data member.
7154 (Relobj::reloc_bases_): New data member.
7155 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7156 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7157 (Sized_relobj::incremental_relocs_scan): New function.
7158 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7159 (Sized_relobj::incremental_relocs_write): New function.
7160 (Sized_relobj::incremental_relocs_write_reltype): New function.
7161 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7162 incremental link.
7163 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7164 archives and object files elsewhere.
7165 (Add_symbols::run): Report object files here.
7166 (Finish_group::run): Report end of archive at end of group.
7167 * reloc.cc: Include layout.h, incremental.h.
7168 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7169 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7170 (Sized_relobj::incremental_relocs_scan): New function.
7171 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7172 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7173 (Sized_relobj::incremental_relocs_write): New function.
7174 (Sized_relobj::incremental_relocs_write_reltype): New function.
7175 * script.cc (read_input_script): Rewrite test for incremental link.
7176 Change call to Incremental_inputs::report_script.
7177 * symtab.h (Symbol_table::first_global_index): New function.
7178 (Symbol_table::output_count): New function.
7179
7180 2010-08-12 Doug Kwan <dougkwan@google.com>
7181
7182 * arm.cc (Target_arm::merge_object_attributes): Check command line
7183 options --no-wchar-size-warning and --no-enum-size-warning.
7184 * options.h (General_options): Add ld-compatible options
7185 --no-enum-size-warning and --no-wchar-size-warning.
7186
7187 2010-08-04 Ian Lance Taylor <iant@google.com>
7188
7189 * x86_64.cc (Target_x86_64::Scan::local): Use
7190 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7191 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7192 (Target_x86_64::Scan::global): Likewise.
7193 (Target_x86_64::Relocate::relocate): Likewise.
7194 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7195 Likewise.
7196
7197 2010-08-03 Cary Coutant <ccoutant@google.com>
7198
7199 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7200 to reserve space in merged_strings vector. Keep total input size
7201 for stats.
7202 (Output_merge_string::do_print_merge_stats): Print total input size.
7203 * merge.h (Output_merge_string): Add input_size_ field.
7204 * stringpool.cc (Stringpool_template::string_length): Move
7205 implementations out of Stringpool_template class and place in
7206 stringpool.h.
7207 * stringpool.h (string_length): Move out of Stringpool_template.
7208
7209 2010-08-03 Ian Lance Taylor <iant@google.com>
7210
7211 PR 11712
7212 * layout.cc (relaxation_loop_body): If address of load segment is
7213 set, adjust address to include headers if possible.
7214
7215 2010-08-03 Ian Lance Taylor <iant@google.com>
7216
7217 * version.cc (version_string): Bump to 1.10.
7218
7219 2010-08-03 Ian Lance Taylor <iant@google.com>
7220
7221 PR 11805
7222 * layout.h (enum Output_section_order): Define.
7223 (class Layout): Update declarations.
7224 * layout.cc (Layout::get_output_section): Add order parameter.
7225 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7226 is_first_non_relro parameters. Change all callers.
7227 (Layout::choose_output_section): Likewise.
7228 (Layout::add_output_section_data): Likewise.
7229 (Layout::make_output_section): Likewise. Set order.
7230 (Layout::default_section_order): New function.
7231 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7232 * output.cc (Output_section::Output_section): Initialize order_.
7233 Don't initialize deleted fields.
7234 (Output_segment::Output_segment): Don't initialize deleted
7235 fields.
7236 (Output_segment::add_output_section_to_load): New function
7237 replacing add_output_section. Change all callers to call this or
7238 add_output_section_to_nonload.
7239 (Output_segment::add_output_section_to_nonload): New function.
7240 (Output_segment::remove_output_section): Rewrite.
7241 (Output_segment::add_initial_output_data): Likewise.
7242 (Output_segment::has_any_data_sections): Likewise.
7243 (Output_segment::is_first_section_relro): Likewise.
7244 (Output_segment::maximum_alignment): Likewise.
7245 (Output_segment::has_dynamic_reloc): New function replacing
7246 dynamic_reloc_count. Change all callers.
7247 (Output_segment::has_dynamic_reloc_list): New function replacing
7248 dynamic_reloc_count_list. Change all callers.
7249 (Output_segment::set_section_addresses): Rewrite.
7250 (Output_segment::set_offset): Rewrite.
7251 (Output_segment::find_first_and_last_list): Remove.
7252 (Output_segment::set_tls_offsets): Rewrite.
7253 (Output_segment::first_section_load_address): Likewise.
7254 (Output_segment::output_section_count): Likewise.
7255 (Output_segment::section_with_lowest_load_address): Likewise.
7256 (Output_segment::write_section_headers): Likewise.
7257 (Output_segment::print_sections_to_map): Likewise.
7258 * output.h (class Output_data): Remove dynamic_reloc_count_
7259 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7260 (Output_data::add_dynamic_reloc): Rewrite.
7261 (Output_data::has_dynamic_reloc): New function.
7262 (Output_data::dynamic_reloc_count): Remove.
7263 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7264 is_last_relro_, is_first_non_relro_, is_interp_,
7265 is_dynamic_linker_section_ fields. Add order and set_order
7266 functions. Remove is_relro_local, set_is_relro_local,
7267 is_last_relro, set_is_last_relro, is_first_non_relro,
7268 set_is_first_non_relro functions, is_interp, set_is_interp,
7269 is_dynamic_linker_section, and set_is_dynamic_linker_section
7270 functions.
7271 (class Output_segment): Change Output_data_list from std::list to
7272 std:;vector. Add output_lists_ field. Remove output_data_ and
7273 output_bss_ fields. Update declarations.
7274
7275 2010-08-02 Ian Lance Taylor <iant@google.com>
7276
7277 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7278 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7279 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7280
7281 2010-08-02 Ian Lance Taylor <iant@google.com>
7282
7283 PR 11855
7284 * script.cc (Script_options::Script_options): Initialize
7285 symbol_definitions_ and symbol_references_.
7286 (Script_options::add_symbol_assignment): Update
7287 symbol_definitions_ and symbol_references_.
7288 (Script_options::add_symbol_reference): New function.
7289 (script_symbol): New function.
7290 * script.h (class Script_options): Add symbol_definitions_ and
7291 symbol_references_ fields.
7292 (Script_options::referenced_const_iterator): New type.
7293 (Script_options::referenced_begin): New function.
7294 (Script_options::referenced_end): New function.
7295 (Script_options::is_referenced): New function.
7296 (Script_options::any_unreferenced): New function.
7297 * script-c.h (script_symbol): Declare.
7298 * yyscript.y (exp): Call script_symbol.
7299 * symtab.cc: Include "script.h".
7300 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7301 Change all callers. Check symbols referenced by scripts.
7302 (Symbol_table::add_undefined_symbols_from_command_line): Add
7303 layout parameter. Change all callers.
7304 (Symbol_table::do_add_undefined_symbols_from_command_line):
7305 Likewise. Break out loop body. Check symbols referenced by
7306 scripts.
7307 (Symbol_table::add_undefined_symbol_from_command_line): New
7308 function broken out of
7309 do_add_undefined_symbols_from_command_line.
7310 * symtab.h (class Symbol_table): Update declarations.
7311 * archive.cc: Include "layout.h".
7312 (Archive::should_include_member): Add layout parameter. Change
7313 all callers. Check for symbol mentioned in expression.
7314 * archive.h (class Archive): Update declaration.
7315 * object.cc (Sized_relobj::do_should_include_member): Add layout
7316 parameter.
7317 * object.h (Object::should_include_member): Add layout parameter.
7318 Change all callers.
7319 (Object::do_should_include_member): Add layout parameter.
7320 (class Sized_relobj): Update declaration.
7321 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7322 parameter.
7323 * dynobj.h (class Sized_dynobj): Update declaration.
7324 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7325 layout parameter.
7326 * plugin.h (class Sized_pluginobj): Update declaration.
7327
7328 2010-08-02 Ian Lance Taylor <iant@google.com>
7329
7330 PR 11866
7331 * output.cc (Output_segment::set_offset): Search for the first and
7332 last sections rather than assuming that the list is in order.
7333 (Output_segment::find_first_and_last_list): New function.
7334 * output.h (class Output_segment): Update declarations.
7335 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7336 (relro_strip_test_SOURCES): New variable.
7337 (relro_strip_test_DEPENDENCIES): New variable.
7338 (relro_strip_test_LDFLAGS): New variable.
7339 (relro_strip_test_LDADD): New variable.
7340 (relro_strip_test.so): New target.
7341
7342 2010-08-02 Ian Lance Taylor <iant@google.com>
7343
7344 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7345 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7346 (Target_i386::got_tlsdesc_section): New function.
7347 (Target_i386::got_section): Create space for GOT entries for
7348 TLSDESC relocations.
7349 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7350 R_386_TLS_GOTDESC.
7351 (Target_i386::Scan::global): Likewise.
7352 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7353 using TLSDESC GOT.
7354 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7355 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7356 (Target_x86_64::got_tlsdesc_section): New function.
7357 (Target_x86_64::got_section): Create space for GOT entries for
7358 TLSDESC relocations.
7359 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7360 R_386_TLS_GOTDESC.
7361 (Target_x86_64::Scan::global): Likewise.
7362 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7363 using TLSDESC GOT.
7364
7365 2010-08-02 Ian Lance Taylor <iant@google.com>
7366
7367 * testsuite/final_layout.sh: Use dc to convert from hex to
7368 decimal.
7369
7370 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7371
7372 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7373 paramter to the call to gold::gc_process_relocs.
7374 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7375 paramter to the call to gold::gc_process_relocs.
7376 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7377 parameter to the call to gold::gc_process_relocs.
7378 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7379 template parameter to the call to gold::gc_process_relocs.
7380 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7381 paramter to the call to gold::gc_process_relocs.
7382 * gc.h (get_embedded_addend_size): New function.
7383 (gc_process_relocs): Save the size of the reloc for use by ICF.
7384 * icf.cc (get_section_contents): Get the addend from the text section
7385 for SHT_REL relocation sections.
7386 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7387 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7388 * int_encoding.h (read_from_pointer): New overloaded function.
7389 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7390 * testsuite/icf_sht_rel_addend_test.sh: New file.
7391 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7392 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7393
7394 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7395
7396 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7397 * Makefile.in: Regenerate.
7398 * testsuite/Makefile.in: Regenerate.
7399
7400 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7401
7402 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7403 * gold/testsuite/debug_msg.cc: Likewise.
7404 * gold/testsuite/odr_violation1.cc
7405 * gold/testsuite/odr_violation2.cc
7406
7407 2010-07-21 Cary Coutant <ccoutant@google.com>
7408
7409 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7410 string, and length fields.
7411 (Output_merge_string::Merged_strings_list): New type.
7412 (Output_merge_string::Merged_strings_lists): New typedef.
7413 (Output_merge_string): Replace merged_strings_ with
7414 merged_strings_lists_.
7415 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7416 Merged_strings_list per input object and section. Don't store pointer
7417 to the string. Don't store length with each merged string entry.
7418 (Output_merge_string::finalize_merged_data): Loop over list of merged
7419 strings lists. Recompute length of each merged string.
7420
7421 2010-07-15 Cary Coutant <ccoutant@google.com>
7422
7423 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7424 here.
7425
7426 2010-07-14 Ian Lance Taylor <iant@google.com>
7427
7428 * descriptors.cc (Descriptors::open): Report correct name in error
7429 message.
7430
7431 2010-07-13 Doug Kwan <dougkwan@google.com>
7432
7433 * arm.cc (Arm_input_section::Arm_input_section): For a
7434 SHT_ARM_EXIDX section, always keeps the input sections.
7435 (Arm_input_section::set_exidx_section_link): New method.
7436 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7437 has_errors_ to false.
7438 (Arm_exidx_input_section::has_errors,
7439 Arm_exidx_input_section::set_has_errors): New methods.
7440 (Arm_exidx_input_section::has_errors_): New data member.
7441 (Arm_relobj::get_exidx_shndx_list): New method.
7442 (Arm_output_section::append_text_sections_to_list): Do not skip
7443 section without SHF_EXECINSTR.
7444 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7445 errors.
7446 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7447 section header. Make error messages more verbose. Check for
7448 a non-executable section linked to an EXIDX section.
7449 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7450 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7451 check that there is no deferred EXIDX section if we exit early.
7452 Instead of not making an EXIDX section in case of an error, make one
7453 and set the has_errors flag of it.
7454 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7455 in a relocatable link.
7456 (Target_arm::do_relax): Look for the EXIDX output section instead of
7457 assuming that it is called .ARM.exidx.
7458 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7459 section list. Do not check for SHF_EXECINSTR section flags but
7460 skip any input section with errors.
7461 * output.cc (Output_section::Output_section): Initialize
7462 always_keeps_input_sections_ to false.
7463 (Output_section::add_input_section): Check for
7464 always_keeps_input_sections_.
7465 * output.h (Output_section::always_keeps_input_sections,
7466 Output_section::set_always_keeps_input_sections): New methods.
7467 (Output_section::always_keeps_input_sections): New data member.
7468
7469 2010-07-13 Rafael Espindola <espindola@google.com>
7470
7471 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7472 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7473
7474 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7475 Ian Lance Taylor <iant@google.com>
7476
7477 * output.h (Output_section_lookup_maps::add_merge_section):
7478 Correct check of whether value was inserted.
7479 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7480 (Output_section_lookup_maps::add_relaxed_input_section):
7481 Likewise.
7482 * arm.cc (Target_arm::got_section): Remove used local os.
7483 * i386.cc (Target_i386::got_section): Likewise.
7484 * x86_64.cc (Target_x86_64::got_section): Likewise.
7485 * sparc.cc (Target_sparc::got_section): Likewise.
7486 (Target_sparc::relocate): Remove unused local have_got_offset.
7487 * powerpc.cc (Target_powerpc::relocate): Likewise.
7488
7489 2010-07-13 Ian Lance Taylor <iant@google.com>
7490
7491 * compressed_output.cc (zlib_decompress): Fix signature in
7492 !HAVE_ZLIB_H case.
7493
7494 * archive.cc (Archive::include_member): Unlock an external member
7495 of a thin archive. Don't bother to delete an object we know is
7496 NULL.
7497
7498 2010-07-12 Cary Coutant <ccoutant@google.com>
7499
7500 * compressed_output.cc (zlib_decompress): New function.
7501 (get_uncompressed_size): New function.
7502 (decompress_input_section): New function.
7503 * compressed_output.h (get_uncompressed_size): New function.
7504 (decompress_input_section): New function.
7505 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7506 Handle compressed debug sections.
7507 * layout.cc (is_compressed_debug_section): New function.
7508 (Layout::output_section_name): Map compressed section names to
7509 canonical names.
7510 * layout.h (is_compressed_debug_section): New function.
7511 (is_debug_info_section): Recognize compressed debug sections.
7512 * merge.cc: Include compressed_output.h.
7513 (Output_merge_data::do_add_input_section): Handle compressed
7514 debug sections.
7515 (Output_merge_string::do_add_input_section): Handle compressed
7516 debug sections.
7517 * object.cc: Include compressed_output.h.
7518 (Sized_relobj::Sized_relobj): Initialize new data members.
7519 (build_compressed_section_map): New function.
7520 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7521 * object.h (Object::section_is_compressed): New method.
7522 (Object::do_section_is_compressed): New method.
7523 (Sized_relobj::Compressed_section_map): New type.
7524 (Sized_relobj::do_section_is_compressed): New method.
7525 (Sized_relobj::compressed_sections_): New data member.
7526 * output.cc (Output_section::add_input_section): Handle compressed
7527 debug sections.
7528 * reloc.cc: Include compressed_output.h.
7529 (Sized_relobj::write_sections): Handle compressed debug sections.
7530
7531 2010-07-08 Cary Coutant <ccoutant@google.com>
7532
7533 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7534 weak when resolving to a dynamic def.
7535 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7536 for weak undef/dynamic def cases. Adjust callers.
7537 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7538 undef_binding_weak_.
7539 (Symbol_table::sized_write_globals): Adjust symbol binding.
7540 (Symbol_table::sized_write_symbol): Add binding parameter.
7541 * symtab.h (Symbol::set_undef_binding): New method.
7542 (Symbol::is_undef_binding_weak): New method.
7543 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7544 (Symbol_table::should_override): Add new parameter.
7545 (Symbol_table::sized_write_symbol): Add new parameter.
7546
7547 * testsuite/weak_undef_file1.cc: Add new test case.
7548 * testsuite/weak_undef_file2.cc: Fix header comment.
7549 * testsuite/weak_undef_test.cc: Add new test case.
7550
7551 2010-06-29 Doug Kwan <dougkwan@google.com>
7552
7553 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7554 Initialize USE_SYMBOL_.
7555 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7556 definition.
7557 (Arm_reloc_property::uses_symbol_): New data member declaration.
7558 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7559 uses symbol value and symbol is undefined but not weakly undefined.
7560
7561 2010-06-28 Rafael Espindola <espindola@google.com>
7562
7563 * plugin.cc (Plugin::load): Use dlerror.
7564
7565 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7566
7567 * symtab.cc (detect_odr_violations): When reporting an ODR
7568 violation, report an object where the symbol is defined.
7569
7570 2010-06-25 Doug Kwan <dougkwan@google.com>
7571
7572 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7573 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7574 definition.
7575 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7576 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7577 target hook to detect function points.
7578 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7579 * icf.h (Icf::check_section_for_function_pointers): Change type of
7580 parameter SECTION_NAME to const reference to std::string. Use
7581 target hook to determine if section may have unsafe pointers.
7582 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7583 method definition.
7584
7585 2010-06-21 Rafael Espindola <espindola@google.com>
7586
7587 * fileread.cc (Input_file::find_fie): New
7588 (Input_file::open): Use Input_file::find_fie.
7589 * fileread.h (Input_file::find_fie): New
7590 * plugin.cc (set_extra_library_path): New.
7591 (Plugin::load): Add set_extra_library_path to the transfer vector.
7592 (Plugin_manager::set_extra_library_path): New.
7593 (Plugin_manager::add_input_file): Use the extra search path if set.
7594 (set_extra_library_path(): New.
7595 * plugin.h (Plugin_manager): Add set_extra_library_path and
7596 extra_search_path_.
7597
7598 2010-06-19 Cary Coutant <ccoutant@google.com>
7599
7600 * layout.cc (gdb_sections): Add .debug_types.
7601 (lines_only_debug_sections): Likewise.
7602
7603 2010-06-18 Rafael Espindola <espindola@google.com>
7604
7605 * plugin.cc (add_input_file,add_input_library)
7606 (Plugin_manager::add_input_file): Make filename arguments const.
7607 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7608 const.
7609
7610 2010-06-16 Doug Kwan <dougkwan@google.com>
7611
7612 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7613 .ARM.attributes section if we have not merged any input
7614 attributes sections.
7615
7616 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7617
7618 * arm.cc: Allow combining objects with no EABI version
7619 information.
7620
7621 2010-06-15 Rafael Espindola <espindola@google.com>
7622
7623 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7624
7625 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7626
7627 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7628 (struct iovec): Correct !HAVE_READV definition.
7629
7630 2010-06-10 Cary Coutant <ccoutant@google.com>
7631
7632 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7633 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7634 reloc sections.
7635 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7636
7637 PR 11683
7638 * symtab.h (Symbol::is_placeholder): New member function.
7639 * target-reloc.h (relocate_section): Check for placeholder symbols.
7640
7641 * testsuite/Makefile.am (plugin_test_8): New test.
7642 (plugin_test_9): New test.
7643 * testsuite/Makefile.in: Regenerate.
7644
7645 2010-06-09 Nick Clifton <nickc@redhat.com>
7646
7647 * yyscript.y (input_list_element): Allow strings prefixed with
7648 the '-' character. Treat these as libraries.
7649 * script.cc (script_add_library): New function. Adds a library
7650 specified by "-l<name>" found in an input script.
7651 * script-c.h: Add prototype for script_add_library.
7652
7653 2010-06-07 Doug Kwan <dougkwan@google.com>
7654
7655 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7656 Restrict stub-group size to be within long conditional branch
7657 range when working around cortex-A8 erratum.
7658
7659 2010-06-07 Damien Diederen <dd@crosstwine.com>
7660
7661 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7662 #ifdef typo.
7663
7664 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7665
7666 PR gold/11658
7667 * output.cc
7668 (Output_section::Input_section_sort_entry::compare_section_ordering):
7669 Change to return non-zero correctly.
7670 (Output_section::Input_section_sort_section_order_index_compare
7671 ::operator()): Change to fix ambiguity in comparisons.
7672
7673 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7674
7675 * gold.h (is_wildcard_string): New function.
7676 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7677 (Layout::layout_eh_frame): Ditto.
7678 (Layout::find_section_order_index): New method.
7679 (Layout::read_layout_from_file): New method.
7680 * layout.h (Layout::find_section_order_index): New method.
7681 (Layout::read_layout_from_file): New method.
7682 (Layout::input_section_position_): New private member.
7683 (Layout::input_section_glob_): New private member.
7684 * main.cc (main): Call read_layout_from_file here.
7685 * options.h (--section-ordering-file): New option.
7686 * output.cc (Output_section::input_section_order_specified_): New
7687 member.
7688 (Output_section::Output_section): Initialize new member.
7689 (Output_section::add_input_section): Add new parameter.
7690 Keep input sections when --section-ordering-file is used.
7691 (Output_section::set_final_data_size): Sort input sections when
7692 section ordering file is specified.
7693 (Output_section::Input_section_sort_entry): Add new parameter.
7694 Check sorting type.
7695 (Output_section::Input_section_sort_entry::compare_section_ordering):
7696 New method.
7697 (Output_section::Input_section_sort_compare::operator()): Change to
7698 consider section_order_index.
7699 (Output_section::Input_section_sort_init_fini_compare::operator()):
7700 Change to consider section_order_index.
7701 (Output_section::Input_section_sort_section_order_index_compare
7702 ::operator()): New method.
7703 (Output_section::sort_attached_input_sections): Change to sort
7704 according to section order when specified.
7705 (Output_section::add_input_section<32, true>): Add new parameter.
7706 (Output_section::add_input_section<64, true>): Add new parameter.
7707 (Output_section::add_input_section<32, false>): Add new parameter.
7708 (Output_section::add_input_section<64, false>): Add new parameter.
7709 * output.h (Output_section::add_input_section): Add new parameter.
7710 (Output_section::input_section_order_specified): New
7711 method.
7712 (Output_section::set_input_section_order_specified): New method.
7713 (Input_section::Input_section): Initialize section_order_index_.
7714 (Input_section::section_order_index): New method.
7715 (Input_section::set_section_order_index): New method.
7716 (Input_section::section_order_index_): New member.
7717 (Input_section::Input_section_sort_section_order_index_compare): New
7718 struct.
7719 (Output_section::input_section_order_specified_): New member.
7720 * script-sections.cc (is_wildcard_string): Delete and move modified
7721 method to gold.h.
7722 (Output_section_element_input::Output_section_element_input): Modify
7723 call to is_wildcard_string.
7724 (Output_section_element_input::Input_section_pattern
7725 ::Input_section_pattern): Ditto.
7726 (Output_section_element_input::Output_section_element_input): Ditto.
7727 * testsuite/Makefile.am (final_layout): New test case.
7728 * testsuite/Makefile.in: Regenerate.
7729 * testsuite/final_layout.cc: New file.
7730 * testsuite/final_layout.sh: New file.
7731
7732 2010-06-01 Rafael Espindola <espindola@google.com>
7733
7734 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7735
7736 2010-06-01 Rafael Espindola <espindola@google.com>
7737
7738 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7739 visibility of symbols.
7740
7741 2010-05-27 Doug Kwan <dougkwan@google.com>
7742
7743 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7744 from start of output section instead of address for a local symbol
7745 in a merged or relaxed section when doing a relocatable link.
7746
7747 2010-05-26 Rafael Espindola <espindola@google.com>
7748
7749 PR 11604
7750 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7751 adding sections the garbage collector removed.
7752 * gold/testsuite/Makefile.am: Add test.
7753 * gold/testsuite/Makefile.in: Regenerate.
7754 * gold/testsuite/plugin_test_7.sh: New.
7755 * gold/testsuite/plugin_test_7_1.c: New.
7756 * gold/testsuite/plugin_test_7_2.c: New.
7757
7758 2010-05-26 Rafael Espindola <espindola@google.com>
7759
7760 * script-sections.cc (Output_section_definition::set_section_addresses):
7761 Check for --section-start.
7762
7763 2010-05-26 Doug Kwan <dougkwan@google.com>
7764
7765 * arm.cc (Arm_scan_relocatable_relocs): New class.
7766 (Target_arm::relocate_special_relocatable): New method.
7767 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7768 (Arm_relocate_functions::thumb_branch_common): Same.
7769 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7770 instead of Default_scan_relocatable_relocs.
7771 * target-reloc.h (relocate_for_relocatable): Let target handle
7772 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7773 * target.h (Sized_target::relocate_special_relocatable): New method.
7774
7775 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7776
7777 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7778
7779 2010-05-23 Doug Kwan <dougkwan@google.com>
7780
7781 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7782 instead of a cast.
7783 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7784 with a direct branch, not a conditional branch, to a stub.
7785 * merge.cc (Output_merge_base::record_input_section): New method
7786 defintion.
7787 (Output_merge_data::do_add_input_section): Record input section if
7788 keeps-input-sections flag is set.
7789 (Output_merge_string::do_add_input_section): Ditto.
7790 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7791 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7792 INPUT_SECTIONS_.
7793 (Output_merge_base::keeps_input_sections,
7794 Output_merge_base::set_keeps_input_sections,
7795 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7796 method definitions.
7797 (Output_merge_base::Input_sections): New type declaration.
7798 (Output_merge_base::input_sections_begin,
7799 Output_merge_base::input_sections_end,
7800 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7801 (Output_merge_base::bool keeps_input_sections_,
7802 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7803 Output_merge_base::input_sections_): New data members.
7804 (Output_merge_data::do_set_keeps_input_sections): New method
7805 defintion.
7806 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7807 * output.cc (Output_section::Input_section::relobj): Move method
7808 defintion from class declaration to here and handle merge sections.
7809 (Output_section::Input_section::shndx): Ditto.
7810 (Output_section::Output_section): Remove initializations of removed
7811 data members and initialize new data member LOOKUP_MAPS_.
7812 (Output_section::add_input_section): Set keeps-input-sections flag
7813 for a newly created merge output section as appropriate. Adjust code
7814 to use Output_section_lookup_maps class.
7815 (Output_section::add_relaxed_input_section): Adjst code for lookup
7816 maps code refactoring.
7817 (Output_section::add_merge_input_section): Add a new parameter
7818 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7819 class. If adding input section to a newly created merge output
7820 section fails, remove the new merge section.
7821 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7822 Adjust code for use of the Output_section_lookup_maps class.
7823 (Output_section::find_merge_section): Ditto.
7824 (Output_section::build_lookup_maps): New method defintion.
7825 (Output_section::find_relaxed_input_section): Adjust code to use
7826 Output_section_lookup_maps class.
7827 (Output_section::get_input_sections): Export merge sections. Adjust
7828 code to use Output_section_lookup_maps class.
7829 (Output_section:::add_script_input_section): Adjust code to use
7830 Output_section_lookup_maps class. Update lookup maps for merge
7831 sections also.
7832 (Output_section::discard_states): Use Output_section_lookup_maps.
7833 (Output_section::restore_states): Same.
7834 * output.h (Merge_section_properties): Move class defintion out of
7835 Output_section.
7836 (Output_section_lookup_maps): New class.
7837 (Output_section::Input_section::is_merge_section): New method
7838 defintion.
7839 (Output_section::Input_section::relobj): Move defintion out of class
7840 defintion. Declare method only.
7841 (Output_section::Input_section::shndx): Ditto.
7842 (Output_section::Input_section::output_merge_base): New method defintion.
7843 (Output_section::Input_section::u2_.pomb): New union field.
7844 (Output_section::Merge_section_by_properties_map,
7845 Output_section::Output_section_data_by_input_section_map,
7846 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7847 Remove types.
7848 (Output_section::add_merge_input_section): Add new parameter
7849 KEEPS_INPUT_SECTIONS.
7850 (Output_section::build_lookup_maps): New method declaration.
7851 (Output_section::merge_section_map_,
7852 Output_section::merge_section_by_properties_map_,
7853 Output_section::relaxed_input_section_map_,
7854 Output_section::is_relaxed_input_section_map_valid_): Remove data
7855 members.
7856 (Output_section::lookup_maps_): New data member.
7857
7858 2010-05-21 Doug Kwan <dougkwan@google.com>
7859
7860 PR gold/11619
7861 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7862 avoid a compilation error.
7863
7864 2010-05-19 Rafael Espindola <espindola@google.com>
7865
7866 * script-sections.cc (Output_section_definition::allocate_to_segment):
7867 Update the phdrs_list even when the output section is NULL.
7868 * testsuite/Makefile.am: Add test.
7869 * testsuite/Makefile.in: Regenerate.
7870 * testsuite/script_test_9.cc: New.
7871 * testsuite/script_test_9.sh: New.
7872 * testsuite/script_test_9.t: New.
7873
7874 2010-05-19 Doug Kwan <dougkwan@google.com>
7875
7876 * arm.cc (Arm_input_section::original_size): New method.
7877 (Arm_input_section::do_addralign): Add a cast.
7878 (Arm_input_section::do_output_offset): Remove static cast.
7879 (Arm_input_section::original_addralign,
7880 Arm_input_section::original_size_): Change type to uint32_t.
7881 (Arm_input_section::init): Add safe casts for section alignment
7882 and size.
7883 (Arm_input_section::set_final_data_size): Do not set address and
7884 offset of stub table.
7885 (Arm_output_section::fix_exidx_coverage): Change use of of
7886 Output_section::Simple_input_section to that of
7887 Output_section::Input_section.
7888 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7889 except for the first pass.
7890 * output.cc (Output_section::get_input_sections): Change type of
7891 input_sections to std::list<Input_section>.
7892 (Output_section::add_script_input_section): Rename from
7893 Output_section::add_simple_input_section. Change type of SIS
7894 parameter from Simple_input_section to Input_section.
7895 * output.h (Output_section::Simple_input_section): Remove class.
7896 (Output_section::Input_section): Change class visibility to public.
7897 (Output_section::Input_section::addralign): Use stored alignments
7898 for special input sections if set.
7899 (Output_section::Input_section::set_addralign): New method.
7900 (Output_section::get_input_sections): Change parameter type from
7901 list of Simple_input_section to list of Input_section.
7902 (Output_section::add_script_input_section): Rename from
7903 Output_section::add_simple_input_section. Change first parameter's
7904 type from Simple_input_section to Input_section and remove the
7905 second and third parameters.
7906 * script-sections.cc (Input_section::Input_section_list): Change
7907 type to list of Output_section::Input_section/
7908 (Input_section_info::Input_section_info): Change parameter type of
7909 INPUT_SECTION to Output_section::Input_section.
7910 (Input_section_info::input_section): Change return type.
7911 (Input_section_info::input_section_): Change type to
7912 Output_section::Input_section.
7913 (Output_section_element_input::set_section_addresses): Adjust code
7914 to use Output_section::Input_section instead of
7915 Output_section::Simple_input_section. Adjust code for renaming
7916 of Output_section::add_simple_input_section.
7917 (Orphan_output_section::set_section_addresses): Ditto.
7918
7919 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7920
7921 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7922 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7923
7924 2010-05-18 Rafael Espindola <espindola@google.com>
7925
7926 * options.cc (General_options::finalize): Handle -nostdlib.
7927 * options.h (nostdlib): New option.
7928 * script.cc (script_add_search_dir): Handle -nostdlib.
7929
7930 2010-05-12 Doug Kwan <dougkwan@google.com>
7931
7932 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7933 attributes section only if there no attributes section after merging.
7934 (Target_arm::merge_object_attributes): Move value of
7935 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7936 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7937 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7938 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7939 and arm_attr_merge_7.stdout.
7940 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7941 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7942 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7943 arm_attr_merge_7b.o): New rules.
7944 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7945 arm_attr_merge_7
7946 * testsuite/Makefile.in: Regenerate.
7947 * testsuite/arm_attr_merge.sh: New file.
7948 * testsuite/arm_attr_merge_[67][ab].s: Same.
7949
7950 2010-05-05 Nick Clifton <nickc@redhat.com>
7951
7952 * po/es.po: Updated Spanish translation.
7953
7954 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7955
7956 * Makefile.am (install-exec-local): Properly install gold as
7957 default cross linker.
7958 * Makefile.in: Regenerated.
7959
7960 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7961 Nick Clifton <nickc@redhat.com>
7962
7963 * configure.ac (install_as_default): Define and set to false
7964 unless --enable-gold or --enable-gold=both/gold has been
7965 specified.
7966 * configure: Regenerate.
7967
7968 * Makefile.am (install-exec-local): Install the executable as
7969 'ld.gold'. If install_as_default is true then also install it as
7970 'ld'.
7971 * Makefile.in: Regenerated.
7972
7973 2010-04-24 Ian Lance Taylor <iant@google.com>
7974
7975 * layout.cc (Layout::layout_reloc): In relocatable link don't
7976 combine reloc sections for grouped sections.
7977
7978 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7979
7980 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7981 sections that are not ordinary to icf.
7982 * icf.cc (get_section_contents): Handle relocation pointing to section
7983 with no object or shndx information.
7984 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7985 * testsuite/Makefile.in: Regenerate.
7986 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7987 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7988
7989 2010-04-22 Ian Lance Taylor <iant@google.com>
7990
7991 * expression.cc (Expression::Expression_eval_info): Add
7992 result_alignment_pointer field.
7993 (Expression::eval_with_dot): Add result_alignment_pointer
7994 parameter. Change all callers.
7995 (Expression::eval_maybe_dot): Likewise.
7996 (class Binary_expression): Add alignment_pointer parameter to
7997 left_value and right_value. Change all callers.
7998 (BINARY_EXPRESSION): Set result alignment.
7999 (class Trinary_expression): Add alignment_pointer parameter to
8000 arg2_value and arg3_value. Change all callers.
8001 (Trinary_cond::value): Set result alignment.
8002 (Max_expression::value, Min_expression::value): Likewise.
8003 (Align_expression::value): Likewise.
8004 * script-sections.cc (class Sections_element): Add dot_alignment
8005 parameter to set_section_addresses virtual function. Update
8006 instantiations.
8007 (class Output_section_element): Likewise.
8008 (Script_sections::create_segments): Add dot_alignment parameter.
8009 Change all callers.
8010 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8011 (Script_sections::set_phdrs_clause_addresses): Likewise.
8012 * script-sections.h: Update declarations.
8013 * script.h: Update declarations.
8014 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8015 min_p_align.
8016 * testsuite/script_test_3.t: Set large alignment.
8017 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8018 segment has expected alignment.
8019
8020 2010-04-22 Nick Clifton <nickc@redhat.com>
8021
8022 * po/gold.pot: Updated by the Translation project.
8023 * po/vi.po: Updated Vietnamese translation.
8024
8025 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8026
8027 * testsuite/Makefile.am (check_PROGRAMS): Add
8028 icf_virtual_function_folding_test.
8029 * testsuite/Makefile.in: Regenerated.
8030
8031 2010-04-15 Andrew Haley <aph@redhat.com>
8032
8033 * options.h (merge_exidx_entries): New option.
8034 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8035 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8036 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8037 (Target_arm::merge_exidx_entries): New function.
8038 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8039 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8040 to Arm_exidx_fixup constructor.
8041 Add new arg, merge_exidx_entries.
8042 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8043 Arm_output_section::fix_exidx_coverage.
8044
8045 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8046
8047 * icf.cc (get_section_contents): Check for preemptible functions.
8048 Ignore addend when appropriate.
8049 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8050 section folded.
8051 (add_from_relobj): Check for section folded.
8052 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8053 * symtab.h (should_add_dynsym_entry): Add new parameter.
8054 * target-reloc.h (scan_relocs): Check for section folded.
8055 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8056 Check reloc types for function pointers in shared objects.
8057 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8058 case.
8059 (icf_preemptible_functions_test): New test case.
8060 (icf_string_merge_test): New test case.
8061 * testsuite.Makefile.in: Regenerate.
8062 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8063 bar_glob. Refactor code.
8064 * testsuite/icf_preemptible_functions_test.cc: New file.
8065 * testsuite/icf_preemptible_functions_test.sh: New file.
8066 * testsuite/icf_string_merge_test.cc: New file.
8067 * testsuite/icf_string_merge_test.sh: New file.
8068 * testsuite/icf_virtual_function_folding_test.cc: New file.
8069 * testsuite/icf_virtual_function_folding_test.sh: New file.
8070
8071 2010-04-14 Doug Kwan <dougkwan@google.com>
8072
8073 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8074 for local symbol recounting if we remove a section due to ICF.
8075 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8076 there are no regular objects in input.
8077
8078 2010-04-13 Doug Kwan <dougkwan@google.com>
8079
8080 * arm.cc (Arm_input_section::set_final_data_size): Compute
8081 accurate final data size instead of using current data size.
8082
8083 2010-04-09 Doug Kwan <dougkwan@google.com>
8084
8085 * layout.cc (Layout::choose_output_section): Handle script section
8086 types.
8087 (Layout::make_output_section_for_script): Add section type parameter.
8088 Handle script section types.
8089 * layout.h (Layout::make_output_section_for_script): Add section
8090 type parameter.
8091 * output.cc (Output_section::Output_section): Initialize data member
8092 is_noload_.
8093 (Output_section::do_reset_address_and_file_offset): Do not set address
8094 to 0 if section is a NOLOAD section.
8095 * output.h (Output_section::is_noload): New method.
8096 (Output_section::set_is_noload): Ditto.
8097 (Output_section::is_noload_): New data member.
8098 * script-c.h (Script_section_type): New enum type.
8099 (struct Parser_output_section_header): Add new file section_type.
8100 * script-sections.cc (Sections_element::output_section_name): Add
8101 parameter for returning script section type.
8102 (Output_section_definition::output_section_name): Ditto.
8103 (Output_section_definition::section_type)P; New method.
8104 (Output_section_definiton::script_section_type_name): Ditto.
8105 (Output_section_definition::script_section_type_): New data member.
8106 (Output_section_definition::Output_section_definition): Initialize
8107 data member Output_section_definition::script_section_type_.
8108 (Output_section_definition::create_sections): Pass script section type
8109 to Layout::make_output_section_for_script.
8110 (Output_section_definition::output_section_name): Return script
8111 section type to caller.
8112 (Output_section_definition::set_section_address): Do not advance
8113 dot value and load address if section type is NOLOAD. Set address
8114 of NOLOAD sections regardless of section flags.
8115 (Output_section_definition::print): Print section type if it is
8116 not SCRIPT_SECTION_TYPE_NONE.
8117 (Output_section_definition::section_type): New method.
8118 (Output_section_definition::script_section_type_name): Ditto.
8119 (Script_sections::output_section_name): Add new parameter
8120 PSECTION_TYPE for returning script section type. Pass it to
8121 section elements. Handle discard sections.
8122 (Sort_output_sections::operator()): Handle NOLOAD sections.
8123 * script-sections.h (Script_sections::Section_type): New enum type.
8124 (Script_sections::output_section_name): Add a new parameter for
8125 returning script section type.
8126 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8127 INFO and NOLOAD.
8128 * yyscript.y (union): Add new field SECTION_TYPE.
8129 (COPY, DSECT, INFO, NOLOAD): New tokens.
8130 (opt_address_and_section_type): Change type to output_section_header.
8131 (section_type): New non-terminal
8132 (section_header): Handle section type.
8133 (opt_address_and_section_type): Return section type value.
8134
8135 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8136
8137 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8138 * testsuite/plugin_common_test_2.c (foo): Likewise.
8139
8140 2010-04-08 Doug Kwan <dougkwan@google.com>
8141
8142 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8143 Output_merge_data.
8144 * output.cc (Output_section::add_merge_input_section): Simplify
8145 code and return status of Output_merge_base::add_input_section.
8146 Update merge section map only if Output_merge_base::add_input_section
8147 returns true.
8148
8149 2010-04-07 Doug Kwan <dougkwan@google.com>
8150
8151 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8152 if section is marked as containing instructions but has no mapping
8153 symbols.
8154 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8155 correct section index.
8156 (Arm_relobj::find_linked_text_section): Ditto.
8157
8158 2010-04-07 Cary Coutant <ccoutant@google.com>
8159
8160 * archive.cc (include_member): Destroy Read_symbols_data object before
8161 releasing file.
8162 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8163 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8164 (Read_symbols_data::~Read_symbols_data) New destructor.
8165 (Section_relocs::Section_relocs) New constructor.
8166 (Section_relocs::~Section_relocs) New destructor.
8167 (Read_relocs_data::Read_relocs_data) New constructor.
8168 (Read_relocs_data::~Read_relocs_data) New destructor.
8169 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8170 pointers to NULL after deleting.
8171
8172 2010-04-07 Doug Kwan <dougkwan@google.com>
8173
8174 * arm.cc: Replace "endianity" with "endianness" in comments.
8175 (Arm_exidx_cantunwind): Ditto.
8176 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8177 (Arm_relobj::merge_flags_and_attributes): New method.
8178 (Arm_relobj::merge_flags_and_attributes_): New data member.
8179 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8180 (Arm_relobj::scan_sections_for_stubs): Ditto.
8181 (Arm_relobj::do_read_symbols): Check to see if we really want to
8182 merge processor-specific flags and attributes. Exit early if
8183 an object is empty except for section names and the undefined symbol.
8184 (Target_arm::do_finalize_sections): Move check for ELF format to
8185 Arm_relobj::do_read_symbols. Merge processor specific flags and
8186 attributes from a regular object only when we have determined that
8187 it is aapropriate. Do not create an .ARM.attributes section in
8188 output if there is no regular input object.
8189 (Target_arm::merge_processor_specific_flags): Check
8190 --warn-mismatch before printing any error.
8191 (Target_arm::merge_object_attributes): Ditto.
8192 * gold.cc (queue_middle_tasks): Handle the case in which there is
8193 no regular object in input.
8194 * options.cc (General_options::parse_EB): New method.
8195 (General_options::parse_EL): Same.
8196 (General_options::General_options): Initialize endianness_.
8197 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8198 New options.
8199 (General_options::Endianness): New enum.
8200 (General_options::endianness): New method.
8201 (General_options::endianness_): New data member.
8202 * parameters.cc (Parameters::set_options): Check target endianness.
8203 (Parameters::set_target_once): Ditto.
8204 (Parameters::check_target_endianness): New method.
8205 (parameters_force_valid_target): If either -EL or -EB is specified,
8206 use it to define endianness of default target.
8207 * parameters.h (Parameters::check_target_endianness): New method
8208 declaration.
8209 * target.h (class Target): Change "endianity" to "endianness"
8210 in comments.
8211
8212 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8213
8214 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8215 * configure: Regenerate.
8216 * Makefile.in: Regenerate.
8217 * testsuite/Makefile.in: Regenerate.
8218
8219 2010-04-06 Cary Coutant <ccoutant@google.com>
8220
8221 gcc PR lto/42757
8222 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8223 prevailing definitions of common symbols.
8224 * testsuite/plugin_test_6.sh: New test case.
8225 * testsuite/plugin_common_test_1.c: New test case.
8226 * testsuite/plugin_common_test_2.c: New test case.
8227 * testsuite/Makefile.am (plugin_test_6): New test case.
8228 * testsuite/Makefile.in: Regenerate.
8229
8230 2010-04-06 Nick Clifton <nickc@redhat.com>
8231
8232 * po/vi.po: New Vietnamese translation.
8233
8234 2010-03-30 Doug Kwan <dougkwan@google.com>
8235
8236 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8237
8238 2010-03-25 Doug Kwan <dougkwan@google.com>
8239
8240 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8241 to avoid a conversion warning on a 32-bit host.
8242
8243 2010-03-24 Ian Lance Taylor <iant@google.com>
8244
8245 * testsuite/script_test_3.t: Add a TLS segment.
8246 * testsuite/Makefile.am (check_PROGRAMS): Add
8247 tls_phdrs_script_test.
8248 (tls_phdrs_script_test_SOURCES): Define.
8249 (tls_phdrs_script_test_DEPENDENCIES): Define.
8250 (tls_phdrs_script_test_LDFLAGS): Define.
8251 (tls_phdrs_script_test_LDADD): Define.
8252 * testsuite/Makefile.in: Rebuild.
8253
8254 2010-03-23 Cary Coutant <ccoutant@google.com>
8255
8256 * fileread.cc (find_or_make_view): Fix comment.
8257
8258 2010-03-23 Ian Lance Taylor <iant@google.com>
8259
8260 * script-sections.cc (class Orphan_section_placement): Define
8261 PLACE_TLS and PLACE_TLS_BSS.
8262 (Orphan_section_placement::Orphan_section_placement): Initialize
8263 new places.
8264 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8265 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8266 (tls_script_test_SOURCES): Define.
8267 (tls_script_test_DEPENDENCIES): Define.
8268 (tls_script_test_LDFLAGS): Define.
8269 (tls_script_test_LDADD): Define.
8270 * testsuite/Makefile.in: Rebuild.
8271
8272 2010-03-22 Doug Kwan <dougkwan@google.com>
8273
8274 * arm.cc (Arm_relocate_functions::abs8,
8275 Arm_relocate_functions::abs16): Use correct check for overflow
8276 specified in the ARM ELF specs.
8277 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8278 target of a BLX instruction specially.
8279 (Reloc_stub::stub_type_for_reloc): Ditto.
8280 (Relocate::relocate): Use symbolic names instead of numeric relocation
8281 codes to report error.
8282 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8283 workaround.
8284 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8285 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8286 thumb2_blx_out_of_range.stdout
8287 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8288 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8289 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8290 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8291 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8292 thumb2_blx_in_range, thumb2_blx_in_range.o,
8293 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8294 thumb2_blx_out_of_range.o): New rules.
8295 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8296 thumb2_blx_in_range and thumb2_blx_out_of_range.
8297 * testsuite/Makefile.in: Regenerate.
8298 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8299 * testsuite/thumb_blx_in_range.s: New file.
8300 * testsuite/thumb_blx_out_of_range.s: New file.
8301
8302 2010-03-22 Rafael Espindola <espindola@google.com>
8303
8304 * archive.cc (Should_include): Move to archive.h.
8305 (should_include_member): Make it a member of Archive.
8306 (Lib_group): New.
8307 (Add_lib_group_symbols): New.
8308 * archive.h: Include options.h.
8309 (Archive_member): Moved from Archive.
8310 (Should_include): Moved from archive.cc.
8311 (Lib_group): New.
8312 (Add_lib_group_symbols): New.
8313 * dynobj.cc (do_should_include_member): New.
8314 * dynobj.h (do_should_include_member): New.
8315 * gold.cc (queue_initial_tasks): Update call to queue.
8316 * main.cc (main): Print lib group stats.
8317 * object.cc (do_should_include_member): New.
8318 * object.h: Include archive.h.
8319 (Object::should_include_member): New.
8320 (Object::do_should_include_member): New.
8321 (Sized_relobj::do_should_include_member): New.
8322 * options.cc (General_options::parse_start_lib): New.
8323 (General_options::parse_end_lib): New.
8324 (Input_arguments::add_file): Handle lib groups.
8325 (Input_arguments::start_group): Check we are not in a lib.
8326 (Input_arguments::start_lib): New.
8327 (Input_arguments::end_lib): New.
8328 * options.h (General_options): Add start_lib and end_lib.
8329 (Input_argument::lib_): New.
8330 (Input_argument::lib): New.
8331 (Input_argument::is_lib): New.
8332 (Input_file_lib): New.
8333 (Input_arguments::in_lib_): New.
8334 (Input_arguments::in_lib): New.
8335 (Input_arguments::start_lib): New.
8336 (Input_arguments::end_lib_): New.
8337 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8338 in unused members as preempted.
8339 (Sized_pluginobj::do_should_include_member): New.
8340 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8341 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8342 return the blocker.
8343 (Read_symbols::do_whole_lib_group): New.
8344 (Read_symbols::do_lib_group): New.
8345 (Read_symbols::do_read_symbols): Handle lib groups.
8346 (Read_symbols::get_name): Handle lib groups.
8347 * readsyms.h (Read_symbols): Add an archive member pointer.
8348 (Read_symbols::do_whole_lib_group): New.
8349 (Read_symbols::do_lib_group): New.
8350 (Read_symbols::member_): New.
8351 * script.cc (read_input_script): Update call to queue_soon.
8352
8353 2010-03-19 Doug Kwan <dougkwan@google.com>
8354
8355 * arm.cc (Stub_table::Stub_table): Initialize new data members
8356 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8357 (Stub_table::add_reloc_stub): Assign stub offset and update
8358 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8359 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8360 New data members.
8361 (Stub_table::update_data_size_and_addralign): Use
8362 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8363 instead of going over all reloc stubs.
8364 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8365 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8366 Stringpool_template::offset_ to size of Stringpool_char.
8367 (Stringpool_template::new_key_offset): Remove code to initialize
8368 Stringpool_template::offset_.
8369 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8370 Stringpool_template::offset_ to zero.
8371
8372 2010-03-15 Doug Kwan <dougkwan@google.com>
8373
8374 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8375 offset_.
8376 (Stringpool_template::new_key_offset): New method.
8377 (Stringpool_template::add_string): Assign offsets when adding new
8378 strings.
8379 (Stringpool_template::set_string_offsets): Do not set string offsets
8380 when not optimizing.
8381 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8382 member size_.
8383 (Chunked_vector::clear): Clear size_.
8384 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8385 (Chunked_vector::size): Return size_.
8386 (Chunked_vector::push_back): Use size_ to find insert position.
8387 (Chunked_vector::size_): New data member.
8388 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8389 (Stringpool_template::new_key_offset): New method declaration.
8390 (Stringpool_template::offset_): New data member.
8391
8392 2010-03-15 Rafael Espindola <espindola@google.com>
8393
8394 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8395 Add_symbols' constructor.
8396 * readsyms.h (Add_symbols): Remove the input_group member.
8397
8398 2010-03-10 Ian Lance Taylor <iant@google.com>
8399
8400 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8401 target to ask whether a reference to a symbol requires a stack
8402 split.
8403 * target.h (Target::is_call_to_non_split): New function.
8404 (Target::do_is_call_to_non_split): Declare virtual function.
8405 * target.cc: Include "symtab.h".
8406 (Target::do_is_call_to_non_split): New function.
8407 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8408
8409 2010-03-10 Cary Coutant <ccoutant@google.com>
8410
8411 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8412 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8413 (File_read::open[2]): Add whole_file_view_ to list of views.
8414 (File_read::make_view): Remove test of whole_file_view_.
8415 (File_read::find_or_make_view): Create whole_file_view_ if
8416 necessary.
8417 (File_read::clear_views): Replace bool parameter with enum;
8418 adjust all callers. Don't delete views with permanent data;
8419 do delete cached views and views from archives if
8420 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8421 if clearing the corresponding view.
8422 * fileread.h (File_read::Clear_views_mode): New enum.
8423 (File_read::View::is_permanent_view): New method.
8424 (File_read::clear_views): Replace bool parameter
8425 with enum; adjust all callers.
8426 * options.h (General_options): Change keep_files_mapped option;
8427 add map_whole_files.
8428 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8429 releasing the file.
8430 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8431 the file.
8432
8433 2010-03-10 David S. Miller <davem@davemloft.net>
8434
8435 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8436
8437 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8438
8439 * icf.cc (get_section_contents): Add '@' marker after processing the
8440 merge reloc.
8441
8442 2010-03-08 Doug Kwan <dougkwan@google.com>
8443
8444 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8445 due to a conversion warning.
8446 (Arm_relobj::update_output_local_symbol_count): Check for local
8447 symbol with unset output index.
8448
8449 2010-03-05 Ian Lance Taylor <iant@google.com>
8450
8451 * options.h (class General_options): Add --spare-dynamic-tags.
8452 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8453 --spare-dynamic-tags.
8454
8455 2010-03-05 Ian Lance Taylor <iant@google.com>
8456
8457 * incremental.cc: Include "libiberty.h".
8458
8459 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8460
8461 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8462 function, is_info_ member.
8463 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8464 (Versions::Versions): Update caller.
8465 (Versions::define_base_version): Likewise.
8466 (Versions::add_def): Likewise.
8467
8468 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8469
8470 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8471 (Scan::possible_function_pointer_reloc): New function.
8472 (Scan::local_reloc_may_be_function_pointer): Change to call
8473 possible_function_pointer_reloc.
8474 (Scan::global_reloc_may_be_function_pointer): Ditto.
8475 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8476 relocations in ".data.rel.ro._ZTV" section.
8477 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8478 * testsuite/icf_safe_so_test.cc: Ditto.
8479 * testsuite/icf_safe_test.cc: Ditto.
8480 * testsuite/icf_safe_test.sh: Ditto.
8481
8482 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8483 Ian Lance Taylor <iant@google.com>
8484
8485 * target-reloc.h (relocate_section): Check the symbol table index
8486 for -1U before setting the local symbol index.
8487 (scan_relocatable_relocs): If copying the relocation, record that
8488 the local symbol is required.
8489 * object.h (Symbol_value::is_output_symtab_index_set): New
8490 function.
8491 (Symbol_value::may_be_discarded_from_output_symtab): New
8492 function.
8493 (Symbol_value::has_output_symtab_entry): New function.
8494 (Symbol_value::needs_output_symtab_entry): Remove.
8495 (Symbol_value::output_symtab_index): Make sure the symbol index is
8496 set.
8497 (Symbol_value::set_output_symtab_index): Make sure the symbol
8498 index is not set. Make sure the new index is valid.
8499 (Symbol_value::set_must_have_output_symtab_entry): New function.
8500 (Symbol_value::has_output_dynsym_entry): New function.
8501 (Symbol_value::set_output_dynsym_index): Make sure the new index
8502 is valid.
8503 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8504 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8505 local symbol if permitted.
8506 (Sized_relobj::do_finalize_local_symbols): Call
8507 is_output_symtab_index_set rather than needs_output_symtab_entry.
8508 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8509 rather than needs_output_symtab_entry. Call
8510 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8511 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8512 is_output_symtab_index_set rather than needs_output_symtab_entry.
8513 * testsuite/discard_locals_relocatable_test.c: New file.
8514 * testsuite/discard_locals_test.sh: Test -r.
8515 * testsuite/Makefile.am (check_DATA): Add
8516 discard_locals_relocatable_test1.syms,
8517 discard_local_relocatable_test2.syms.
8518 (MOSTLYCLEANFILES): Likewise. Also add
8519 discard_locals_relocatable_test1.lout and
8520 discard_locals_relocatable_test2.out.
8521 (discard_locals_relocatable_test1.syms): New target.
8522 (discard_locals_relocatable_test.o): New target.
8523 (discard_locals_relocatable_test1.out): New target.
8524 (discard_locals_relocatable_test2.syms): New target.
8525 (discard_locals_relocatable_test2.out): New target.
8526 (various): Add missing ../ld-new dependencies.
8527 * testsuite/Makefile.in: Rebuild.
8528
8529 2010-03-03 Nick Clifton <nickc@redhat.com>
8530
8531 * po/fi.po: New Finnish translation.
8532
8533 2010-03-01 Doug Kwan <dougkwan@google.com>
8534
8535 * layout.cc (Layout::Layout): Force section types of .init_array*,
8536 .preinit_array* and .fini_array* sections.
8537 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8538 Fix check of return value of std::string::find.().
8539 (Output_section::Input_section_sort_compare::operator()): Remove
8540 comment about .init_array.
8541 (Output_section::Input_section_sort_init_fini_compare::operator()):
8542 New method.
8543 (Output_section::sort_attached_input_sections): Handle .init_array
8544 and .fini_array specially.
8545 * output.h (Output_section::Inut_section_sort_compare): Update
8546 comment.
8547 (Output_section::Input_section_sort_init_fini_compare): New struct.
8548
8549 2010-02-26 Doug Kwan <dougkwan@google.com>
8550
8551 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8552 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8553 * testsuite/debug_msg.sh: Avoid matching source line number for
8554 use of global variable undef_int.
8555
8556 2010-02-26 Doug Kwan <dougkwan@google.com>
8557
8558 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8559 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8560 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8561 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8562 * options.cc (General_options::General_options): Initialize member
8563 fix_v4bx_.
8564 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8565 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8566 and rm_no_fix_v4bx.stdout
8567 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8568 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8569 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8570 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8571 and arm_no_fix_v4bx.
8572 * Makefile.in: Regenerate.
8573 * testsuite/arm_fix_v4bx.s: New file.
8574 * testsuite/arm_fix_v4bx.sh: Ditto.
8575
8576 2010-02-24 Doug Kwan <dougkwan@google.com>
8577
8578 * arm.cc (Target_arm::got_section): Make the .got section the first
8579 non RELRO section in the data segment.
8580 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8581 suffixes of section names.
8582
8583 2010-02-24 Doug Kwan <dougkwan@google.com>
8584
8585 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8586 flags and attributes merging if an input file is a binary file.
8587 * fileread.cc (Input_file::open): Record format of original file.
8588 * fileread.h (Input_file::Format): New enum type.
8589 (Input_file::Input_file): Initialize data member format_.
8590 (Input_file::format): New method definition.
8591 (Input_file::format_):: New data member.
8592
8593 2010-02-24 Doug Kwan <dougkwan@google.com>
8594
8595 * arm.cc (Arm_output_data_got): New class.
8596 (ARM_TCB_SIZE): New constant
8597 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8598 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8599 If user uses a script with a SECTIONS clause, issue only a warning
8600 for a misplaced EXIDX input section. Otherwise, issue an error.
8601 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8602 garbage collection.
8603 (Target_arm::got_mode_index_entry): Handle static linking.
8604 (Target_arm::Scan::local): Ditto.
8605 (Target_arm::Scan::global): Ditto.
8606 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8607 all incorrectly implemented relocations.
8608 (Target_arm::fix_exidx_coverage): Pass layout to
8609 Arm_output_section::fix_exidx_coverage.
8610 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8611 from ".ARM.exidx." and ".ARM.extab.".
8612
8613 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8614
8615 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8616 section if it does not already exist.
8617 * attributes.cc (Attributes_section_data::Attributes_section_data):
8618 Don't crash if size is zero.
8619
8620 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8621 Ian Lance Taylor <iant@google.com>
8622
8623 * gold.cc (queue_middle_tasks): If no input files were opened,
8624 exit.
8625 * workqueue.h (Task_function::Task_function): Assert that there is
8626 a blocker.
8627
8628 2010-02-22 Doug Kwan <dougkwan@google.com>
8629
8630 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8631 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8632 types to avoid warnings due to different uint64_t implementations
8633 on different hosts.
8634
8635 2010-02-21 Doug Kwan <dougkwan@google.com>
8636
8637 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8638 handling of the maximum backward branch offset.
8639 (Arm_relocate_functions::thumb_branch_common): Ditto.
8640 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8641 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8642 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8643 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8644 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8645 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8646 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8647 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8648 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8649 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8650 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8651 thumb2_bl_out_of_range.o): New rules.
8652 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8653 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8654 thumb2_bl_out_of_range
8655 * testsuite/Makefile.in: Regenerate.
8656 * testsuite/arm_bl_in_range.s: New file.
8657 * testsuite/arm_bl_out_of_range.s: Ditto.
8658 * testsuite/arm_branch_in_range.sh: Ditto.
8659 * testsuite/arm_branch_range.t: Ditto.
8660 * testsuite/thumb2_branch_range.t: Ditto.
8661 * testsuite/thumb_bl_in_range.s: Ditto.
8662 * testsuite/thumb_bl_out_of_range.s: Ditto.
8663 * testsuite/thumb_branch_range.t: Ditto.
8664
8665 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8666
8667 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8668 Add reloc offset information.
8669 * icf.cc (get_section_contents): Change iterators to point to the new
8670 vectors. Add reloc offset information to the contents.
8671 * icf.h (Icf::Sections_reachable_info): New typedef.
8672 (Icf::Sections_reachable_list): New typedef.
8673 (Icf::Offset_info): New typedef.
8674 (Icf::Reloc_info): New struct typedef.
8675 (Icf::Reloc_info_list): New typedef.
8676 (Icf::symbol_reloc_list): Delete method.
8677 (Icf::addend_reloc_list): Delete method.
8678 (Icf::section_reloc_list): Delete method.
8679 (Icf::reloc_info_list): New method.
8680 (Icf::reloc_info_list_): New member.
8681
8682 2010-02-19 Doug Kwan <dougkwan@google.com>
8683
8684 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8685 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8686 * arm.cc (Arm_relocation_functions): New forward declaration.
8687 (Target_arm::Target_arm): Initialize new data members
8688 got_mod_index_offset_ and tls_base_symbol_defined_.
8689 (Target_arm::Relocate::relocate_tls): New method.
8690 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8691 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8692 New methods.
8693 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8694 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8695 (Target_arm::got_mod_index_offset_,
8696 Target_arm::tls_base_symbol_defined_): New data members.
8697 (Target_arm::Scan::local, Target::Scan::global,
8698 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8699 relocations.
8700
8701 2010-02-18 Doug Kwan <dougkwan@google.com>
8702
8703 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8704 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8705 text section as a parameter becuase some broken tools may not set
8706 the link in section header.
8707 (Target_arm::has_got_section): New method.
8708 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8709 without any mapping symbol as data only. Remove warning.
8710 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8711 link in its section header, try to discover the link by inspecting the
8712 REL31 relocation at the beginning of the section.
8713 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8714 in error message.
8715 (Target_arm::Scan::global): Treat any reference to the symbol
8716 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8717
8718 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8719
8720 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8721 (Scan::global_reloc_may_be_function_pointer): New function.
8722 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8723 (Scan::global_reloc_may_be_function_pointer): New function.
8724 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8725 (Scan::global_reloc_may_be_function_pointer): New function.
8726 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8727 (Scan::global_reloc_may_be_function_pointer): New function.
8728 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8729 (Scan::global_reloc_may_be_function_pointer): New function.
8730 (Scan::possible_function_pointer_reloc): New function.
8731 (Target_x86_64::can_check_for_function_pointers): New function.
8732 * gc.h (gc_process_relocs): Scan relocation types to determine if
8733 function pointers were taken for targets that support it.
8734 * icf.cc (Icf::find_identical_sections): Include functions for
8735 folding in safe ICF whose pointer is not taken.
8736 * icf.h (Secn_fptr_taken_set): New typedef.
8737 (fptr_section_id_): New member.
8738 (section_has_function_pointers): New function.
8739 (set_section_has_function_pointers): New function.
8740 (check_section_for_function_pointers): New function.
8741 * options.h: Fix comment for safe ICF option.
8742 * target.h (can_check_for_function_pointers): New function.
8743 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8744 Modify icf_safe_test for X86-64.
8745 * testsuite/Makefile.in: Regenerate.
8746 * testsuite/icf_safe_so_test.cc: New file.
8747 * testsuite/icf_safe_so_test.sh: New file.
8748 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8749 (main): Change to take pointer to function kept_func_3.
8750 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8751 folding is done correctly for X86-64.
8752
8753 2010-02-12 David S. Miller <davem@davemloft.net>
8754
8755 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8756 is_symbolless parameter.
8757 (Output_reloc<SHT_REL>::is_symbolless): New.
8758 (Output_reloc<SHT_REL>::is_symbolless_): New.
8759 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8760 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8761 (Output_reloc<SHT_RELA>::is_symbolless): New.
8762 (Output_data_reloc::add_global): Handle is_symbolless.
8763 (Output_data_reloc::add_global_relative): Likewise.
8764 (Output_data_reloc::add_local): Likewise.
8765 (Output_data_reloc::add_local_relative): Likewise.
8766 (Output_data_reloc::add_symbolless_global_addend): New.
8767 (Output_data_reloc::add_symbolless_local_addend): New.
8768 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8769 is_symbolless.
8770 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8771 instead of ->is_relative_
8772 (Output_reloc::write): Likewise.
8773 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8774 (Output_reloc::write_rel): Simplify.
8775
8776 * sparc.cc (Target_sparc::Scan::local): Use
8777 ->add_symbolless_local_addend as needed.
8778 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8779 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8780 based upon relocation offset.
8781
8782 2010-02-11 Doug Kwan <dougkwan@google.com>
8783
8784 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8785 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8786 beginning of function.
8787 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8788 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8789 parameter is_32bit in calls to should_apply_static_reloc.
8790 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8791 (check_DATA): Add arm_abs_global.stdout.
8792 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8793 arm_abs_global.stdout): New rules.
8794 (MOSTLLYCLEANFILES): Add arm_abs_global
8795 * Makefile.in: Regenerate.
8796 * testsuite/arm_abs_global.s: New file.
8797 * testsuite/arm_abs_global.sh: Ditto.
8798 * testsuite/arm_abs_lib.s: Ditto.
8799
8800 2010-02-11 Ian Lance Taylor <iant@google.com>
8801
8802 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8803 Read_relocs task.
8804 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8805 Allocate_commons_task first.
8806 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8807 task, rather than symtab_lock_.
8808 (Gc_process_relocs::~Gc_process_relocs): New function.
8809 (Gc_process_relocs::is_runnable): Check this_blocker_.
8810 (Gc_process_relocs::locks): Use next_blocker_ rather than
8811 blocker_.
8812 (Scan_relocs::~Scan_relocs): New function.
8813 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8814 symtab_lock_.
8815 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8816 next_blocker_.
8817 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8818 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8819 constructor accordingly.
8820 (class Gc_process_relocs): Likewise.
8821 (class Scan_relocs): Likewise.
8822 * common.h (class Allocate_commons_task): Remove symtab_lock_
8823 field, and corresponding constructor parameter.
8824 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8825 symtab_lock_.
8826 (Allocate_commons_task::locks): Likewise.
8827
8828 2010-02-11 Ian Lance Taylor <iant@google.com>
8829
8830 * gold-threads.h (class Once): Define.
8831 (class Initialize_lock): Rewrite as child of Once.
8832 * gold-threads.cc (class Once_initialize): Define.
8833 (once_pointer_control): New static variable.
8834 (once_pointer, once_arg): New static variables.
8835 (c_run_once): New static function.
8836 (Once::Once, Once::run_once, Once::internal_run): New functions.
8837 (class Initialize_lock_once): Remove.
8838 (initialize_lock_control): Remove.
8839 (initialize_lock_pointer): Remove.
8840 (initialize_lock_once): Remove.
8841 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8842 (Initialize_lock::initialize): Rewrite.
8843 (Initialize_lock::do_run_once): New function.
8844 * archive.cc (Archive::interpret_header): Only clear name if it is
8845 not already empty.
8846 * fileread.cc: Include "gold-threads.h"
8847 (file_counts_lock): New static variable.
8848 (file_counts_initialize_lock): Likewise.
8849 (File_read::release): Only increment counts when using --stats.
8850 Use a lock around the increment.
8851 * parameters.cc (class Set_parameters_target_once): Define.
8852 (set_parameters_target_once): New static variable.
8853 (Parameters::Parameters): Move here from parameters.h.
8854 (Parameters::set_target): Rewrite.
8855 (Parameters::set_target_once): New function.
8856 (Parameters::clear_target): Move here and rewrite.
8857 * parameters.h (class Parameters): Update declarations. Add
8858 set_parameters_target_once_ field.
8859 (Parameters::Parameters): Move to parameters.cc.
8860 (Parameters::clear_target): Likewise.
8861 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8862 task.
8863 (Start_group::~Start_group): New function.
8864 (Start_group::is_runnable): New function.
8865 (Start_group::locks, Start_group::run): New functions.
8866 (Finish_group::run): Change saw_undefined to size_t.
8867 * readsyms.h (class Start_group): Define.
8868 (class Finish_group): Change saw_undefined_ field to size_t.
8869 (Finish_group::Finish_group): Remove saw_undefined and
8870 this_blocker parameters. Change all callers.
8871 (Finish_group::set_saw_undefined): New function.
8872 (Finish_group::set_blocker): New function.
8873 * symtab.h (class Symbol_table): Change saw_undefined to return
8874 size_t. Change saw_undefined_ field to size_t.
8875 * target-select.cc (Set_target_once::do_run_once): New function.
8876 (Target_selector::Target_selector): Initialize set_target_once_
8877 field. Don't initialize lock_ and initialize_lock_ fields.
8878 (Target_selector::instantiate_target): Rewrite.
8879 (Target_selector::set_target): New function.
8880 * target-select.h (class Set_target_once): Define.
8881 (class Target_selector): Update declarations. Make
8882 Set_target_once a friend. Remove lock_ and initialize_lock_
8883 fields. Add set_target_once_ field.
8884
8885 2010-02-10 Ian Lance Taylor <iant@google.com>
8886
8887 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8888 queueing any tasks.
8889 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8890 (queue_middle_tasks): Add all blockers before queueing any tasks.
8891 (queue_final_tasks): Likewise.
8892 * token.h (Task_token::add_blockers): New function.
8893 * object.h (Input_objects::number_of_relobjs): New function.
8894
8895 2010-02-10 Ian Lance Taylor <iant@google.com>
8896
8897 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8898 shared, not if not position independent.
8899 * x86_64.cc (Relocate::relocate_tls): Likewise.
8900 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8901 (tls_pie_pic_test): New target.
8902 * testsuite/Makefile.in: Rebuild.
8903
8904 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8905 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8906 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8907 * testsuite/Makefile.in: Rebuild.
8908
8909 2010-02-09 David S. Miller <davem@davemloft.net>
8910
8911 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8912 R_SPARC_RELATIVE using ->add_local_relative().
8913 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8914
8915 * output.h (Output_data_dynamic::add_section_size): New method
8916 that takes two Output_data objects.
8917 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8918 entry param. Handle it in initializers.
8919 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8920 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8921 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8922 arg.
8923 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8924 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8925 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8926 for dynrel_includes_plt.
8927 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8928 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8929 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8930 before .rela.plt
8931 (Target_sparc::do_finalize_sections): Update to pass true for
8932 dynrel_includes_plt.
8933 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8934 output before .rela.plt
8935 (Target_powerpc::do_finalize_sections): Update to pass true for
8936 dynrel_includes_plt when 32-bit.
8937
8938 2010-02-08 Doug Kwan <dougkwan@google.com>
8939
8940 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8941 method.
8942 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8943 Arm_relobj::scan_section_for_cortex_a8_stubs,
8944 Arm_relobj::do_relocation_section): Instead of calling
8945 Output_section::output_address, use faster
8946 Arm_relobj::simple_input_section_output_address.
8947
8948 2010-02-08 David S. Miller <davem@davemloft.net>
8949
8950 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8951 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8952 relocation helper function.
8953
8954 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8955 just like R_SPARC_GOT{10,13,22}.
8956 (Target_sparc::Scan::local): Likewise.
8957 (Target_sparc::Relocate:relocate): Likewise.
8958
8959 2010-02-06 Ian Lance Taylor <iant@google.com>
8960
8961 * configure.ac: Rewrite targetobjs duplicate removal code to use
8962 only shell constructs.
8963 * configure: Rebuild.
8964
8965 2010-02-05 Doug Kwan <dougkwan@google.com>
8966
8967 PR 11247
8968 * arm.cc (Arm_relobj::section_is_scannable): New method.
8969 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8970 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8971
8972 2010-02-04 Doug Kwan <dougkwan@google.com>
8973
8974 PR 11247
8975 * arm-reloc-property.cc (cstdio): Include.
8976 * configure.ac (targetobjs): Remove duplicates.
8977 * configure: Regenerate.
8978 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8979 big and little endian version for a given address size.
8980
8981 2010-02-03 Doug Kwan <dougkwan@google.com>
8982
8983 * arm-reloc-property.cc
8984 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8985 definition.
8986 * arm-reloc-property.h
8987 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8988 New method definition.
8989 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8990 declaration.
8991 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8992 overflow to N.
8993 (GOT_PREL): Change implemented to Y.
8994 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8995 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8996 (Arm_relocate_functions::movw_abs_nc): Remove method.
8997 (Arm_relocate_functions::movt_abs): Ditto.
8998 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8999 (Arm_relocate_functions::thm_movt_abs): Ditto.
9000 (Arm_relocate_functions::movw_rel_nc): Ditto.
9001 (Arm_relocate_functions::movw_rel): Ditto.
9002 (Arm_relocate_functions::movt_rel): Ditto.
9003 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9004 (Arm_relocate_functions:thm_movw_rel): Ditto.
9005 (Arm_relocate_functions:thm_movt_rel): Ditto.
9006 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9007 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9008 New method definitions.
9009 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9010 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9011 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9012 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9013 (Target_arm::Relocate::relocate): Check for non-static or
9014 unimplemented relocation code and exit early. Change calls to
9015 Target_arm::reloc_uses_thumb_bit and
9016 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9017 instead. Refactor code to handle similar relocations to increase
9018 code sharing. Remove check for unsupported relocation code in switch
9019 statement.
9020 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9021 relocation property table to find out size. Change error message to
9022 print out the name of a relocation code instead of the numeric value.
9023 (Target_arm::scan_reloc_for_stub): Use relocation property table
9024 instead of calling Target_arm::reloc_uses_thumb_bit().
9025
9026 2010-02-02 Doug Kwan <dougkwan@google.com>
9027
9028 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9029 types of relaxed input section.
9030
9031 2010-02-02 Doug Kwan <dougkwan@google.com>
9032
9033 * Makefile.am (HFILES): Add arm-reloc-property.h.
9034 (DEFFILES): New.
9035 (TARGETSOURCES): Add arm-reloc-property.cc
9036 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9037 (libgold_a_SOURCES): $(DEFFILES)
9038 * Makefile.in: Regenerate.
9039 * arm-reloc-property.cc: New file.
9040 * arm-reloc-property.h: New file.
9041 * arm-reloc.def: New file.
9042 * arm.cc: Update comments.
9043 (arm-reloc-property.h): New included header.
9044 (arm_reloc_property_table): New global variable.
9045 (Target_arm::do_select_as_default_target): New method definition.
9046 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9047 arm-reloc-property to targ_extra_obj.
9048 * parameters.cc (set_parameters_target): Call
9049 Target::select_as_default_target().
9050 * target.h (Target::select_as_default_target): New method definition.
9051 (Target::do_select_as_default_target): Same.
9052
9053 2010-02-01 Doug Kwan <dougkwan@google.com>
9054
9055 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9056 first_output_text_section_.
9057 (Arm_exidx_fixup::first_output_text_section): New method definition.
9058 (Arm_exidx_fixup::first_output_text_section_): New data member.
9059 (Arm_exidx_fixup::process_exidx_section): Record the first text
9060 output section seen.
9061 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9062 and entsize in output section header.
9063
9064 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9065
9066 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9067 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9068 (Arm_relocate_functions::thm_alu11): New Method.
9069 (Arm_relocate_functions::thm_pc8): New Method.
9070 (Arm_relocate_functions::thm_pc12): New Method.
9071 (Target_arm::Scan::local): Handle the relocations.
9072 (Target_arm::Scan::global): Likewise.
9073 (Target_arm::Relocate::relocate): Likewise.
9074 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9075
9076 2010-01-29 Doug Kwan <dougkwan@google.com>
9077
9078 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9079 of relocation types as ld.
9080
9081 2010-01-29 Doug Kwan <dougkwan@google.com>
9082
9083 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9084 to public.
9085 (Arm_relocate_functions::thumb_branch_common): Ditto.
9086 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9087 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9088 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9089 Arm_relocate_functions::jump24): Remove.
9090 (Target_arm::Relocate::relocate): Adjust code to call
9091 Arm_relocation_functions::arm_branch_common and
9092 Arm_relocation_functions::thumb_branch_common instead of their removed
9093 wrappers. Merge switch-cases together to reduce source code size.
9094
9095 2010-01-29 Doug Kwan <dougkwan@google.com>
9096
9097 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9098 output_local_symbol_count_needs_update_.
9099 (Arm_relobj::output_local_symbol_count_needs_update,
9100 Arm_relobj::set_output_local_symbol_count_needs_update,
9101 Arm_relobj::update_output_local_symbol_count): New methods.
9102 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9103 member.
9104 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9105 of pointed function as in a R_ARM_PREL31 relocation.
9106 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9107 for output local symbol count updating.
9108 (Target_arm::do_relax): Update output local symbol counts in objects
9109 if necessary.
9110 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9111
9112 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9113
9114 * arm.cc: Added support for the ARM relocations:
9115 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9116 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9117 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9118 movw_prel_nc).
9119 (Arm_relocate_functions::movw_rel): New method.
9120 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9121 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9122 thm_movw_prel_nc).
9123 (Arm_relocate_functions::thm_movw_rel): New method.
9124 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9125 thm_movt_prel).
9126 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9127 relocations.
9128 (Target_arm::Scan::global): Likewise.
9129 (Target_arm::Relocate::relocate): Likewise.
9130 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9131 Likewise.
9132
9133 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9134
9135 * arm.cc: Added support for ARM group relocations.
9136 (Target_arm::reloc_needs_sym_origin): New method.
9137 (Arm_relocate_functions::calc_grp_kn): New method.
9138 (Arm_relocate_functions::calc_grp_residual): New method.
9139 (Arm_relocate_functions::calc_grp_gn): New method.
9140 (Arm_relocate_functions::arm_grp_alu): New Method.
9141 (Arm_relocate_functions::arm_grp_ldr): New Method.
9142 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9143 (Arm_relocate_functions::arm_grp_ldc): New Method.
9144 (Target_arm::Scan::local): Handle the ARM group relocations.
9145 (Target_arm::Scan::global): Likewise.
9146 (Target_arm::Relocate::relocate): Likewise.
9147 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9148 Likewise.
9149
9150 2010-01-26 Doug Kwan <dougkwan@google.com>
9151
9152 * arm.cc (set): Include.
9153 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9154 pointer type.
9155 (Arm_output_section::Text_section_list): New type.
9156 (Arm_output_section::append_text_sections_to_list): New method.
9157 (Arm_output_section::fix_exidx_coverage): Ditto.
9158 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9159 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9160 Relobj::set_section_offset() instead of
9161 Sized_relobj::invalidate_section_offset().
9162 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9163 parameter for section headers. Ignore relocation sections for
9164 unallocated sections and EXIDX sections.
9165 (Target_arm::fix_exidx_coverage): New method.
9166 (Target_arm::output_section_address_less_than): New type.
9167 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9168 linked text section instead of the EXIDX section.
9169 (Arm_output_section::create_stub_group): Add an assertion to check
9170 that this is not an EXIDX output section.
9171 (Arm_output_section::append_text_sections_to_list): New method.
9172 (Arm_output_section::fix_exidx_coverage): Ditto.
9173 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9174 Arm_relobj::section_needs_reloc_stub_scanning.
9175 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9176 first pass.
9177 (Target_arm::fix_exidx_coverage): New method.
9178 * object.h (Relobj::set_output_section): New method.
9179 (Sized_relobj::invalidate_section_offset): Remove method.
9180 (Sized_relobj::do_invalidate_section_offset): Remove method.
9181 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9182
9183 2010-01-25 Doug Kwan <dougkwan@google.com>
9184
9185 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9186 Fix warning due to signed and unsigned comparison on a 32-bit host.
9187
9188 2010-01-22 Doug Kwan <dougkwan@google.com>
9189
9190 * arm.cc (Target_arm::do_relax): Record an output section for section
9191 offset adjustment it contains any stub table that has changed.
9192 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9193 offsets in an output section if necessary.
9194 * output.cc (Output_section::Output_section): Initialize
9195 section_offsets_need_adjustments_.
9196 (Output_section::add_input_section_for_script): Renamed to
9197 Output_section::add_simple_input_section.
9198 (Output_section::save_states): Add a comment.
9199 (Output_section::discard_states): New method defintion.
9200 (Output_section::adjust_section_offsets): Same.
9201 * output.h (Output_section::add_input_section_for_script): Renamed to
9202 Output_section::add_simple_input_section.
9203 (Output_section::discard_states): New method declaration.
9204 (Output_section::adjust_section_offsets): Same.
9205 (Output_section::section_offsets_need_adjustment,
9206 Output_section::set_section_offsets_need_adjustment): New method
9207 definitions.
9208 (Output_section::section_offsets_need_adjustment_): New data member.
9209 * script-sections.cc
9210 (Output_section_element_input::set_section_address): Adjust code for
9211 renaming of Output_section::add_input_section_for_script.
9212 (Orphan_output_section::set_section_address): Same.
9213
9214 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9215
9216 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9217 Fix_v4bx enum values .
9218 * gold/options.h (General_options): New option definitions.
9219 (General_options::fix_v4bx): New method.
9220 (General_options::Fix_v4bx): New enum.
9221 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9222 (General_options::parse_fix_v4bx_interworking): New method.
9223
9224 2010-01-22 Doug Kwan <dougkwan@google.com>
9225
9226 * arm.cc (Arm_exidx_fixup): New class.
9227
9228 2010-01-21 Doug Kwan <dougkwan@google.com>
9229
9230 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9231 classes.
9232 (Arm_exidx_section_offset_map): New type.
9233
9234 2010-01-21 Doug Kwan <dougkwan@google.com>
9235
9236 * arm.cc (Arm_exidx_input_section): New class.
9237 (Arm_relobj::exidx_input_section_by_link,
9238 Arm_relobj::exidx_input_section_by_shndx,
9239 Arm_relobj::make_exidx_input_section): New methods.
9240 (read_arm_attributes_section): Remove.
9241 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9242 information about them.
9243 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9244 to here.
9245
9246 2010-01-20 Doug Kwan <dougkwan@google.com>
9247
9248 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9249 Input_section_specifier to Section_id.
9250 (Target_arm::new_arm_input_section: Adjust code for change of key
9251 type.
9252 (Target_arm::find_arm_input_section): Ditto.
9253 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9254 (Section_id): Remove.
9255 (Garbage_collection::Section_id_hash): Remove.
9256 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9257 (Section_id): Remove.
9258 (Icf::Section_id_hash): Remove.
9259 * object.h (Section_id, Const_section_id, Section_id_hash,
9260 Const_section_id_hash): New type definitions.
9261 * output.cc (Output_section::add_relaxed_input_section): Change to
9262 use Const_section_id instead of Input_section_specifier as key type.
9263 (Output_section::add_merge_input_section): Ditto.
9264 (Output_section::build_relaxation_map): Change to use Section_id
9265 instead of Input_section_specifier as key type.
9266 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9267 Ditto.
9268 (Output_section::convert_input_sections_to_relaxed_sections): Change
9269 to use Const_section_id instead of Input_section_specifier as key type.
9270 (Output_section::find_merge_section): Ditto.
9271 (Output_section::find_relaxed_input_section): Ditto.
9272 * output.h (Input_section_specifier): Remove class.
9273 (Output_section::Output_section_data_by_input_section_map): Change
9274 key type to Const_section_id.
9275 (Output_section::Output_relaxed_input_section_by_input_section_map):
9276 Ditto.
9277 (Output_section::Relaxation_map): Change key type to Section_id.
9278
9279 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9280
9281 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9282 (class Arm_v4bx_stub): New class.
9283 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9284 (Stub_factory::make_arm_v4bx_stub): New method.
9285 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9286 (Stub_table::empty): Handle v4bx stubs.
9287 (Stub_table::add_arm_v4bx_stub): New method.
9288 (Stub_table::find_arm_v4bx_stub): New method.
9289 (Arm_relocate_functions::v4bx): New method.
9290 (Target_arm::fix_v4bx): New method.
9291 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9292 (Stub_table::relocate_stubs): Likewise.
9293 (Stub_table::do_write): Likewise.
9294 (Stub_table::update_data_size_and_addralign): Likewise.
9295 (Stub_table::finalize_stubs): Likewise.
9296 (Target_arm::Scan::local): Likewise.
9297 (Target_arm::Scan::global): Likewise.
9298 (Target_arm::do_finalize_sections): Likewise.
9299 (Target_arm::Relocate::relocate): Likewise.
9300 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9301 Likewise.
9302 (Target_arm::scan_reloc_for_stub): Likewise.
9303 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9304
9305 2010-01-19 Ian Lance Taylor <iant@google.com>
9306
9307 * output.cc (Output_section_headers::do_sized_write): Write large
9308 segment count to sh_info field.
9309 (Output_file_header::do_sized_write): For large segment count,
9310 write PN_XNUM to e_phnum field.
9311
9312 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9313
9314 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9315 (Arm_relocate_functions::thm_jump8): New function.
9316 (Arm_relocate_functions::thm_jump11): New function.
9317 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9318 R_ARM_THM_JUMP11.
9319 (Target_arm::Scan::global): Likewise.
9320 (Target_arm::Relocate::relocate): Likewise.
9321 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9322 Likewise.
9323
9324 2010-01-14 Doug Kwan <dougkwan@google.com>
9325
9326 * arm.cc (map, utility): Include headers.
9327 (Target_arm::apply_cortex_a8_workaround): New method.
9328 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9329 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9330 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9331 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9332 the --[no-]fix-cortex-a8 command line options.
9333 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9334 (Target_arm::relocate_stub): Use addend in instruction template.
9335 * options.h (DEFINE_bool): Set the user-set flag.
9336 (General_options): Add --[no-]-fix-cortex options.
9337 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9338 : Update fast look-up map after conversion.
9339
9340 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9341
9342 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9343 in the first pass of do_layout.
9344
9345 2010-01-13 Doug Kwan <dougkwan@google.com>
9346
9347 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9348 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9349 apparent compiler problem of not folding static constant integral
9350 data members of elfcpp::Elf_sizes<32>.
9351
9352 2010-01-13 Doug Kwan <dougkwan@google.com>
9353
9354 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9355 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9356 Arm_relobj::scan_section_for_cortex_a8_erratum,
9357 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9358 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9359 sections to scan for relocation stubs into a new method
9360 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9361 relocation and Cortex-A8 stub scanning.
9362 (Target_arm::do_relax): Force stubs to be after stubbed sections
9363 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9364 the beginning of a new relaxation pass. Update a comment.
9365 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9366
9367 2010-01-12 Ian Lance Taylor <iant@google.com>
9368
9369 * target-reloc.h (visibility_error): New inline function.
9370 (relocate_section): Call visibility_error.
9371 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9372 (MOSTLYCLEANFILES): Likewise.
9373 (protected_4_pic.o, protected_3.err): New targets.
9374 * testsuite/protected_4.cc: New file.
9375
9376 2010-01-12 Doug Kwan <dougkwan@google.com>
9377
9378 * arm.cc (Cortex_a8_reloc): New class.
9379 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9380 and cortex_a8_relocs_info_.
9381 (Target_arm::fix_cortex_a8): New method definition.
9382 (Target_arm::Cortex_a8_relocs_info): New type.
9383 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9384 New data member declarations.
9385 (Target_arm::scan_reloc_for_stub): Record information about
9386 relocations for THUMB branches that might be exempted from the
9387 Cortex-A8 workaround.
9388 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9389 at the beginning of a relaxation pass.
9390
9391 2010-01-12 Doug Kwan <dougkwan@google.com>
9392
9393 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9394 (Arm_relobj::Mapping_symbol_position,
9395 Arm_reloj::Mapping_symbol_position_less,
9396 Arm_relobj::Mapping_symbols_info): New types.
9397 (Target_arm::is_mapping_symbol_name): New method definition.
9398 (Arm_relobj::do_count_local_symbols): Save information about mapping
9399 symbols.
9400
9401 2010-01-11 Doug Kwan <dougkwan@google.com>
9402
9403 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9404 Arm_relocate_functions::thumb32_branch_upper,
9405 Arm_relocate_functions::thumb32_branch_lower,
9406 Arm_relocate_functions::thumb32_cond_branch_offset,
9407 Arm_relocate_functions::thumb32_cond_branch_upper,
9408 Arm_relocate_functions::thumb32_cond_branch_lower,
9409 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9410 branch offset encoding.
9411 (Arm_relocate_functions::thumb_branch_common): Use new branch
9412 offset encoding methods to avoid code duplication.
9413 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9414 (Stub_addend_reader::operator()): Use new branch encoding method
9415 to avoid code duplication.
9416
9417 2010-01-11 Doug Kwan <dougkwan@google.com>
9418
9419 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9420 (Target_arm::do_finalize_sections): Define special EXIDX section
9421 symbols only if referenced.
9422 * gc.h (Garbage_collection::add_reference): New method.
9423 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9424 code duplication.
9425
9426 2010-01-11 Ian Lance Taylor <iant@google.com>
9427
9428 * script.cc (Version_script_info::build_expression_list_lookup):
9429 Change complaing about duplicate wildcard match from error to
9430 warning.
9431
9432 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9433 of 2009-12-30.
9434 (Version_script_info::Version_script_info): Initialize globs_,
9435 default_version_, default_is_global_, and exact_. Don't
9436 initialize globals_ or locals_.
9437 (Version_script_info::build_lookup_tables): Build local symbols
9438 first.
9439 (Version_script_info::unquote): New function.
9440 (Version_script_info::add_exact_match): New function.
9441 (Version_script_info::build_expression_list_lookup): Remove lookup
9442 parameter. Add is_global parameter. Change all callers. Handle
9443 wildcard pattern specially. Unquote pattern. Call
9444 add_exact_match.
9445 (Version_script_info::get_name_to_match): New function.
9446 (Version_script_info::get_symbol_version): New function.
9447 (Version_script_info::get_symbol_version_helper): Remove.
9448 (Version_script_info::check_unmatched_names): Call unquote.
9449 * script.h (class Version_script_info): Change get_symbol_version
9450 to be non-inline and add is_global parameter; change all callers.
9451 Rewrite symbol_is_local. Update declarations. Define struct
9452 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9453 Remove globals_ and locals_ members. Add exact_, globs_,
9454 default_version_, is_global_.
9455 (Version_script_info::Glob): Remove pattern, add expression and
9456 is_global. Update constructor. Change all callers.
9457 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9458 default version.
9459 (Versions::symbol_section_contents): If a symbol is undefined, or
9460 defined in a dynamic object, set the version index to
9461 VER_NDX_LOCAL.
9462 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9463 symbol_is_local.
9464 (Symbol_table::add_from_pluginobj): Likewise.
9465 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9466
9467 2010-01-11 Doug Kwan <dougkwan@google.com>
9468
9469 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9470 (incremental_dump_LDADD): Add linking option for libintl.
9471 * Makefile.in: Regenerate.
9472
9473 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9474
9475 PR gold/11144
9476 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9477 instead of -Ds.
9478 * testsuite/Makefile.in: Regenerated.
9479
9480 2010-01-10 Doug Kwan <dougkwan@google.com>
9481
9482 * options.h (DEFINE_var): Use parentheses around argument varname__
9483 in macro body to avoid any unintended subsequent substitutions.
9484
9485 2010-01-10 Ian Lance Taylor <iant@google.com>
9486
9487 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9488 candidates before doing symbol resolution.
9489
9490 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9491 ODR candidates if only one is weak.
9492
9493 2010-01-08 Ian Lance Taylor <iant@google.com>
9494
9495 * script.cc (Version_script_info::build_expression_list_lookup):
9496 Don't warn about ambiguous version, just record the ambiguity.
9497 (Version_script_info::get_symbol_version_helper): Give error if
9498 version is ambiguous.
9499
9500 2010-01-08 Doug Kwan <dougkwan@google.com>
9501
9502 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9503 prev_data_size_ and prev_addralign_. Remove initializer for
9504 deleted data member has_been_changed_.
9505 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9506 to determine if the table is empty.
9507 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9508 Remove.
9509 (Stub_table::add_reloc_stub): Define method in class definition
9510 instead of just declaring it there.
9511 (Stub_table::add_cortex_a8_stub): New method definition.
9512 (Stub_table::update_data_size_and_addralign): Ditto.
9513 (Stub_table::finalize_stubs): Ditto.
9514 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9515 (Stub_table::do_addralign_): Return address alignment in the
9516 (Stub_table::do_reset_address_and_file_offset): Define method in
9517 class definition instead of declaring it there. Set current data
9518 size to be the data size of the previous pass.
9519 (Stub_table::set_final_data_size): Use current data size as the
9520 final data size.
9521 (Stub_table::relocate_stub): Change parameter type of stub from
9522 Reloc_stub pointer to Stub pointer.
9523 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9524 (Stub_table::Cortex_a8_stub_list): New typedef.
9525 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9526 Stub_table::prev_addralign_): New data member.
9527 (Arm_relobj::Arm_relobj): Initialize data member
9528 section_has_cortex_a8_workaround_.
9529 (Arm_relobj::section_has_cortex_a8_workaround,
9530 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9531 definitions.
9532 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9533 declarations.
9534 (Target_arm::relocate_stub): Change parameter type of stub from
9535 Reloc_stub pointer to Stub pointer.
9536 (Insn_template::size, Insn_template::alignment): Handle
9537 THUMB16_SPECIAL_TYPE.
9538 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9539 Stub_table::update_data_size_and_addralign,
9540 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9541 definitions.
9542 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9543 (Stub_table::do_write): Ditto.
9544 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9545
9546 2010-01-08 Ian Lance Taylor <iant@google.com>
9547
9548 PR 11108
9549 * symtab.h (class Symbol): Remove fields is_target_special_ and
9550 has_plt_offset_. Add field is_defined_in_discarded_section_.
9551 (Symbol::is_defined_in_discarded_section): New function.
9552 (Symbol::set_is_defined_in_discarded_section): New function.
9553 (Symbol::has_plt_offset): Rewrite.
9554 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9555 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9556 Don't initialize is_target_special_ or has_plt_offset_.
9557 Initialize is_defined_in_discarded_section_.
9558 (Symbol_table::add_from_relobj): If appropriate, set
9559 is_defined_in_discarded_section.
9560 * resolve.cc (Symbol::override_base_with_special): Don't test
9561 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9562 * target-reloc.h (relocate_section): Do special handling for
9563 symbols defined in discarded sections for global symbols as well
9564 as local symbols.
9565
9566 2010-01-08 Ian Lance Taylor <iant@google.com>
9567
9568 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9569 the SHT_SYMTAB case.
9570
9571 2010-01-08 Ian Lance Taylor <iant@google.com>
9572
9573 * object.cc (Sized_relobj::do_layout): Don't get confused if
9574 layout_eh_frame returns NULL.
9575
9576 2010-01-08 Ian Lance Taylor <iant@google.com>
9577
9578 PR 11084
9579 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9580 dynamic symbol table, use the normal symbol table.
9581 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9582 symbol table.
9583
9584 2010-01-08 Ian Lance Taylor <iant@google.com>
9585
9586 PR 11072
9587 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9588 sections.
9589
9590 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9591
9592 * version.cc (print_version): Change to "Copyright 2010".
9593
9594 2010-01-08 Ian Lance Taylor <iant@google.com>
9595
9596 PR 10287
9597 PR 11063
9598 * i386.cc (class Target_i386): Change return type of plt_section
9599 to be non-const.
9600 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9601 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9602 tls_desc_rel_ field.
9603 (Output_data_plt_i386::rel_tls_desc): New function.
9604 (Target_i386::rel_tls_desc_section): New function.
9605 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9606 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9607 R_386_TLS_DESC reloc in rel_tls_desc_section.
9608 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9609 Define struct Tlsdesc_info.
9610 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9611 (Target_x86_64::do_reloc_symbol_index): New function.
9612 (Target_x86_64::add_tlsdesc_info): New function.
9613 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9614 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9615 tlsdesc_rel_ field.
9616 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9617 all callers.
9618 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9619 (Target_x86_64::rela_tlsdesc_section): New function.
9620 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9621 handling.
9622 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9623 (Target_x86_64::do_reloc_addend): New function.
9624 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9625 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9626 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9627 (Output_reloc::type): New function.
9628 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9629 (Output_reloc::is_target_specific): New function.
9630 (Output_reloc::target_arg): New function.
9631 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9632 absolute relocs and target specific relocs.
9633 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9634 add_target_specific.
9635 (class Output_data_reloc) [SHT_RELA]: Likewise.
9636 * output.cc (Output_reloc::Output_reloc): Add four new versions
9637 for absolute relocs and target specific relocs.
9638 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9639 (Output_reloc::get_symbol_index): Likewise.
9640 (Output_reloc::local_section_offset): Check that local_sym_index_
9641 is not TARGET_CODE or 0.
9642 (Output_reloc::symbol_value): Likewise.
9643 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9644 reloc.
9645 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9646 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9647 functions.
9648 * layout.cc (add_target_dynamic_tags): Use output section for
9649 DT_PLTRELSZ and DT_JMPREL.
9650
9651 2010-01-07 Ian Lance Taylor <iant@google.com>
9652
9653 PR 11061
9654 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9655 function.
9656 (class Output_data_reloc_generic): Define.
9657 (class Output_data_reloc_base): Change base class to
9658 Output_data_reloc_generic. Change add() method to call
9659 bump_relative_reloc_count for a relative reloc. Remove
9660 sort_relocs_ field.
9661 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9662 to sort_relocs().
9663 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9664 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9665 appropriate.
9666 * layout.h (class Layout): Update declaration.
9667
9668 2010-01-07 Ian Lance Taylor <iant@google.com>
9669
9670 * output.h (class Output_data): Add const version of
9671 output_section and do_output_section.
9672 (class Output_section_data): Add const version of
9673 do_output_section.
9674 (class Output_section): Likewise.
9675 * layout.cc (Layout::add_target_dynamic_tags): New function.
9676 * layout.h (class Layout): Update declarations.
9677 * arm.cc (Target_arm::do_finalize_sections): Use
9678 add_target_dynamic_tags.
9679 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9680 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9681 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9682 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9683
9684 2010-01-07 Ian Lance Taylor <iant@google.com>
9685
9686 PR 11042
9687 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9688 object as needed.
9689
9690 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9691 Ian Lance Taylor <iant@google.com>
9692
9693 PR 11019
9694 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9695 Xindex::read_symtab_xindex.
9696
9697 2010-01-07 Doug Kwan <dougkwan@google.com>
9698
9699 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9700 (Insn_template::thumb16_bcond_insn): New method declaration.
9701 (Insn_template): Fix spelling.
9702 (Stub::thumb16_special): New method declaration.
9703 (Stub::do_write): Define virtual method which was previously pure
9704 virtual.
9705 (Stub::do_thumb16_special): New method declaration.
9706 (Stub::do_fixed_endian_write): New template member.
9707 (Reloc_stub::do_write): Remove.
9708 (Reloc_stub::do_fixed_endian_write): Remove.
9709 (Cortex_a8_stub): New class definition.
9710 (Stub_factory::make_cortex_a8_stub): New method definition.
9711 (Stub_factory::Stub_factory): Add missing static storage class
9712 qualifier for elf32_arm_stub_a8_veneer_blx.
9713
9714 2010-01-07 Ian Lance Taylor <iant@google.com>
9715
9716 PR 10980
9717 * options.h (class General_options): Add --warn-unresolved-symbols
9718 and --error-unresolved-symbols.
9719 * errors.cc (Errors::undefined_symbol): Implement
9720 --warn-unresolved-symbols.
9721
9722 * options.h (class General_options): Add -z text and -z textoff.
9723 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9724
9725 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9726
9727 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9728 (Garbage_collection::cident_sections): New function.
9729 (Garbage_collection::add_cident_section): New function.
9730 (Garbage_collection::cident_sections_): New member.
9731 (gc_process_relocs): Add references to sections whose names are C
9732 identifiers.
9733 * gold.h (cident_section_start_prefix): New constant.
9734 (cident_section_stop_prefix): New constant.
9735 (is_cident): New function.
9736 * layout.cc (Layout::define_section_symbols): Replace string constants
9737 with the newly defined constants.
9738 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9739 C identifiers.
9740 * testsuite/Makefile.am: Add gc_orphan_section_test.
9741 * testsuite/Makefile.in: Regenerate.
9742 * testsuite/gc_orphan_section_test.cc: New file.
9743 * testsuite/gc_orphan_section_test.sh: New file.
9744
9745 2010-01-06 Ian Lance Taylor <iant@google.com>
9746
9747 PR 10980
9748 * options.h (class General_options): Add --warn-shared-textrel.
9749 * layout.cc (Layout::finish_dynamic_section): Implement
9750 --warn-shared-textrel.
9751
9752 PR 10980
9753 * options.h (class General_options): Add --warn-multiple-gp.
9754
9755 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9756
9757 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9758 $(THREADSLIB) and $(LIBDL).
9759 * Makefile.in: Rebuild.
9760
9761 2010-01-06 Ian Lance Taylor <iant@google.com>
9762
9763 PR 10980
9764 * options.cc (General_options::parse_section_start): New function.
9765 (General_options::section_start): New function.
9766 (General_options::General_options): Initialize all members.
9767 * options.h: Include <map>
9768 (class General_options): Add --section-start. Add section_starts_
9769 member.
9770 * layout.cc (Layout::attach_allocated_section_to_segment): If
9771 --section-start was used, set the address of the segment. Remove
9772 local sort_sections.
9773 (Layout::relaxation_loop_body): If the address of the load segment
9774 has been set by --section-start, don't use it.
9775 * output.h (Output_segment::update_flags_for_output_section): New
9776 function.
9777 * output.cc (Output_segment::add_output_section): Call
9778 update_flags_for_output_section.
9779
9780 2010-01-05 Ian Lance Taylor <iant@google.com>
9781
9782 PR 10980
9783 * options.h (class General_options): Add --undefined-version.
9784 * script.cc (struct Version_expression): Add was_matched_by_symbol
9785 field.
9786 (Version_script_info::matched_symbol): New function.
9787 (Version_script_info::get_symbol_version_helper): Call
9788 matched_symbol.
9789 (Version_script_info::check_unmatched_names): New function.
9790 * script.h (class Version_script_info): Update declarations.
9791 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9792
9793 * options.h (class General_options): Use DEFINE_bool_alias for
9794 allow_multiple_definition.
9795 * resolve.cc (Symbol_table::should_override): Don't test
9796 allow_multiple_definition.
9797
9798 PR 10980
9799 * options.h (class General_options): Add --cref.
9800 * main.cc (main): Print cref table if --cref. Don't close mapfile
9801 until after printing cref table.
9802 * cref.cc: Include "symtab.h".
9803 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9804 (Cref_table_compare::operator()): New function.
9805 (Cref_inputs::gather_cref): New function.
9806 (filecol): New static const.
9807 (Cref_inputs::print_cref): New function.
9808 (Cref::print_cref): New function.
9809 * cref.h: Include <cstdio>.
9810 (class Cref): Update declarations.
9811 * mapfile.h (Mapfile::file): New function.
9812 * object.h (class Object): Define Symbols. Declare virtual
9813 do_get_global_symbols.
9814 (Object::get_global_symbols): New function.
9815 * object.cc (Input_objects::add_object): Pass object to cref_ if
9816 --cref.
9817 (Input_objects::archive_start): Likewise.
9818 (Input_objects::archive_stop): Likewise.
9819 (Input_objects::print_cref): New function.
9820 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9821 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9822 --cref.
9823 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9824 function.
9825 * plugin.h (class Sized_pluginobj): Update declarations.
9826
9827 2010-01-05 Ian Lance Taylor <iant@google.com>
9828
9829 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9830 to is_default_version. Rename insdef to insdefault.
9831 (Symbol_table::add_from_relobj): Rename def to is_default_version
9832 and local to is_forced_local.
9833 (Symbol_table::add_from_pluginobj): Likewise.
9834 (Symbol_table::add_from_dynobj): Likewise.
9835 (Symbol_table::define_special_symbol): Rename insdef to
9836 insdefault.
9837
9838 2010-01-04 Ian Lance Taylor <iant@google.com>
9839
9840 PR 10980
9841 * options.h (class General_options): Add
9842 --allow-multiple-definition and -z muldefs.
9843 * resolve.cc (Symbol_table::should_override): Don't warn about a
9844 multiple symbol definition if --allow-multiple-definition or -z
9845 muldefs.
9846
9847 PR 10980
9848 * options.h (class General_options): Add --add-needed and
9849 --copy-dt-needed-entries. Tweak --as-needed help entry.
9850 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9851 error if --copy-dt-needed-entries aka --add-needed is used and
9852 would cause a change in behaviour.
9853
9854 PR 10980
9855 * options.h (class General_options): Add -G as a short version of
9856 --shared. Add no-op options -assert, -g, and -i.
9857
9858 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9859
9860 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9861 check for .text or .gnu.linkonce.t sections.
9862 * icf.cc (Icf::find_identical_sections): Ditto.
9863 Change the detection for mangled function name within the section
9864 name.
9865 * icf.h (is_section_foldable_candidate): New function.
9866
9867 2009-12-30 Ian Lance Taylor <iant@google.com>
9868
9869 PR 10980
9870 * options.h (class General_options): Permit two dashes with
9871 --retain-symbols-file.
9872
9873 2009-12-30 Ian Lance Taylor <iant@google.com>
9874
9875 PR 10979
9876 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9877 don't put the file header and segment headers in the text
9878 segment.
9879
9880 PR 10979
9881 * common.cc (Sort_commons::operator()): Stabilize sort when both
9882 entries are NULL.
9883 (Symbol_table::do_allocate_commons_list): When allocating common
9884 symbols, skip a symbol which is no longer common.
9885 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9886 an object before checking its type.
9887 * testsuite/common_test_2.c: New file.
9888 * testsuite/common_test_3.c: New file.
9889 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9890 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9891 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9892 (common_test_2_pic.o, common_test_2.so): New targets.
9893 (common_test_3_pic.o, common_test_3.so): New targets.
9894 * testsuite/Makefile.in: Rebuild.
9895
9896 PR 10979
9897 * script.cc (read_input_script): If we see a new SECTIONS clause,
9898 and we have added an input section, give an error.
9899 * layout.h (class Layout): Add have_added_input_section function.
9900 Add have_added_input_section_ field.
9901 * layout.cc (Layout::Layout): Initialize
9902 have_added_input_section_.
9903 (Layout::layout): Set have_added_input_section_.
9904 (Layout::layout_eh_frame): Likewise.
9905
9906 2009-12-30 Ian Lance Taylor <iant@google.com>
9907
9908 PR 10931
9909 * options.h (class General_options): Add --sort-common option.
9910 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9911 * common.cc (Sort_common): Add sort_order parameter to
9912 constructor. Add sort_order_ field.
9913 (Sort_commons::operator): Check sort_order_.
9914 (Symbol_table::allocate_commons): Determine the sort order.
9915 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9916 Change all callers.
9917 (Symbol_table::do_allocate_commons_list): Likewise.
9918
9919 2009-12-30 Ian Lance Taylor <iant@google.com>
9920
9921 PR 10916
9922 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9923 symbols from this object, don't change the visibility of an
9924 undefined symbol.
9925 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9926
9927 2009-12-30 Ian Lance Taylor <iant@google.com>
9928
9929 PR 10861
9930 * script.h (class Version_script_info): Define Language enum.
9931 Update declarations. Define Glob, Exact, and Lookup types. Add
9932 new fields globals_, locals_, and is_finalized_.
9933 * script.cc: Various formatting fixes.
9934 (class Parser_closure): Change language_stack_ from a vector of
9935 std::string to one of Version_script_info::Language. Adjust all
9936 uses accordingly.
9937 (class Lazy_demangler): Remove.
9938 (struct Version_expression): Change language from std::string to
9939 Version_script_info::Language.
9940 (Version_script_info::Version_script_info): New function.
9941 (Version_script_info::~Version_script_info): Don't call clear.
9942 (Version_script_info::finalize): New function.
9943 (Version_script_info::build_lookup_tables): New function.
9944 (Version_script_info::build_expression_list_lookup): New
9945 function.
9946 (Version_script_info::get_symbol_version_helper): Rewrite to use
9947 lookup tables.
9948 (Version_script_info::print_expression_list): Adjust to use
9949 Version_script_info::Language.
9950 (script_push_lex_into_version_mode): Check that the version script
9951 has not been finalized.
9952 (version_script_push_lang): Change language string to
9953 Version_script_info::Language.
9954 * options.cc (Command_line::version_script): New function.
9955 * options.h (class General_options): Add finalize_dynamic_list
9956 function. Change version_script from declaration to definition.
9957 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9958 * testsuite/version_script.map: Remove duplicate def of foo.
9959 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9960 version_script.map.
9961 * testsuite/Makefile.in: Rebuild.
9962
9963 2009-12-30 Ian Lance Taylor <iant@google.com>
9964
9965 PR 10843
9966 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9967 if the input symbol index is 0, make the output symbol index 0.
9968
9969 2009-12-30 Ian Lance Taylor <iant@google.com>
9970
9971 PR 10670
9972 * options.h (class General_options): Add -x/--discard-all.
9973 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9974 --discard-all. If the local symbol needs a dynamic entry, check
9975 that before handling --discard-locals.
9976
9977 2009-12-30 Ian Lance Taylor <iant@google.com>
9978
9979 PR 10450
9980 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9981 flags to PF_R.
9982 (Output_segment::add_output_section): Don't change the flags if
9983 the type is PT_TLS.
9984
9985 PR 10450
9986 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9987 GNU hash table if they need a dynamic value. Otherwise, don't add
9988 them if they are defined in a dynamic object or are forced local.
9989
9990 2009-12-29 Ian Lance Taylor <iant@google.com>
9991
9992 PR 10450
9993 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9994 .gnu.hash table for a 32-bit target.
9995
9996 PR 10450
9997 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9998 regular and a dynamic object only needs a dynamic symbol table
9999 entry if it is externally visible.
10000
10001 PR 10450
10002 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10003 constructor. Add global_offset_table_ field.
10004 (Target_i386::got_section): Set global_offset_table_.
10005 (Target_i386::do_finalize_sections): Set global_offset_table_
10006 size.
10007 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10008 in constructor. Add global_offset_table_ field.
10009 (Target_x86_64::got_section): Set global_offset_table_.
10010 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10011 size.
10012
10013 * layout.cc (Layout::Layout): Initialize increase_relro_.
10014 (Layout::get_output_section): Add is_relro, is_last_relro, and
10015 is_first_non_relro parameters. Change all callers.
10016 (Layout::choose_output_section): Likewise.
10017 (Layout::add_output_section_data): Likewise.
10018 (Layout::make_output_section): Likewise.
10019 (Layout::set_segment_offsets): Clear increase_relro when using a
10020 linker script.
10021 * layout.h (class Layout): Add increase_relro method. Add
10022 increase_relro_ field. Update declarations.
10023 * output.cc (Output_section::Output_section): Initialize
10024 is_last_relro_ and is_first_non_relro_.
10025 (Output_segment::add_output_section): Group relro sections is
10026 do_sort is true. Handle is_last_relro and is_first_non_relro.
10027 (Output_segment::maximum_alignment): Remove relro handling.
10028 (Output_segment::set_section_addresses): Add increase_relro
10029 parameter. Change all callers. Add initial alignment to align
10030 relro sections on separate page. Remove old relro handling.
10031 (Output_segment::set_section_list_addresses): Remove in_relro
10032 parameter. Change all callers.
10033 (Output_segment::set_offset): Add increase parameter. Change all
10034 callers. Remove old relro handling.
10035 * output.h (class Output_section): Add new methods: is_last_relro,
10036 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10037 Add is_last_relro_ and is_first_non_relro_ fields.
10038 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10039 Create separate .got.plt section. Call increase_relro.
10040 * x86_64.cc (Target_x86_64::got_section): Likewise.
10041 * testsuite/relro_script_test.t: Add .got.plt.
10042
10043 PR 10450
10044 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10045 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10046 (Layout::finalize): Call set_dynamic_symbol_size.
10047 (Layout::set_dynamic_symbol_size): New function.
10048 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10049 set_dynamic_symbol_size.
10050
10051 PR 10450
10052 * output.h (class Output_section): Add is_entsize_zero_ field.
10053 * output.cc (Output_section::Output_section): Initialize
10054 is_entsize_zero_.
10055 (Output_section::set_entsize): If two different entsizes are
10056 requested, force it to zero.
10057 (Output_section::add_input_section): Set flags for .debug_str
10058 before updating section flags. Set entsize.
10059 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10060 and SHF_STRING if all input sections have those flags.
10061
10062 2009-12-29 Rafael Espindola <espindola@google.com>
10063
10064 * main.cc (main): Fix the sys time reporting.
10065 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10066 reporting.
10067
10068 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10069
10070 * options.cc (General_options::parse_version): Allow -v to exit
10071 without an error if there is nothing to link.
10072
10073 2009-12-29 Ian Lance Taylor <iant@google.com>
10074
10075 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10076 using a version of gcc before 4.1.
10077 * configure: Rebuild.
10078
10079 2009-12-28 Chris Demetriou <cgd@google.com>
10080
10081 * attributes.cc (Output_attributes_section_data::do_write): Use
10082 std::vector::front rather than std::vector::data.
10083
10084 2009-12-28 Ian Lance Taylor <iant@google.com>
10085
10086 * symtab.h (class Symbol_table): Add enum Defined.
10087 * resolve.cc (Symbol_table::should_override): Add defined
10088 parameter. Change all callers. Test whether object is NULL
10089 before calling a method on it.
10090 (Symbol_table::report_resolve_problem): Add defined parameter.
10091 Change all callers.
10092 (Symbol_table::should_override_with_special): Likewise.
10093 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10094 parameter. Change all callers.
10095 (Symbol_table::do_define_in_output_data): Likewise.
10096 (Symbol_table::define_in_output_segment): Likewise.
10097 (Symbol_table::do_define_in_output_segment): Likewise.
10098 (Symbol_table::define_as_constant): Likewise.
10099 (Symbol_table::do_define_as_constant): Likewise.
10100 * script.h (class Symbol_assignment): Add is_defsym parameter to
10101 constructor; change all callers.
10102 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10103 parameter. Change all callers. Add is_defsym_ field.
10104 (class Parser_closure): Add parsing_defsym parameter to
10105 constructor; change all callers. Add parsing_defsym accessor
10106 function. Add parsing_defsym_ field.
10107
10108 2009-12-28 Ian Lance Taylor <iant@google.com>
10109
10110 * gold.cc (queue_middle_tasks): Fix formatting.
10111 * object.cc (Relobj::is_section_name_included): Likewise.
10112
10113 2009-12-23 Ian Lance Taylor <iant@google.com>
10114
10115 * i386.cc (Target_i386::do_calls_non_split): Recognize
10116 -fsplit-stack prologue for a function with a static chain.
10117 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10118 -fsplit-stack prologue when using %r11.
10119
10120 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10121
10122 * options.cc (General_options::parse_version): Make -v continue and do
10123 the link like GNU ld does.
10124
10125 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10126
10127 * Makefile.am (CCFILES): Add timer.cc.
10128 (HFILES): Add timer.h.
10129 * configure.ac: Check for sysconf and times.
10130 * main.cc: include timer.h.
10131 (main): Use Timer instead of get_run_time.
10132 * timer.cc: New.
10133 * timer.h: New.
10134 * workqueue.cc: include timer.h.
10135 (Workqueue::find_and_run_task):
10136 Report user, sys and wall time.
10137 * Makefile.in: Regenerate.
10138 * config.in: Regenerate.
10139 * configure: Regenerate.
10140
10141 2009-12-16 Doug Kwan <dougkwan@google.com>
10142
10143 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10144 sections.
10145 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10146 relaxed input sections.
10147 * output.cc (Output_section::find_relaxed_input_section): Change
10148 return type to Output_relaxed_input_section pointer. Adjust code
10149 for new type of relaxed_input_section_map_.
10150 * output.h (Output_section::find_relaxed_input_section): Change
10151 return type to Output_relaxed_input_section pointer.
10152 (Output_section::Output_relaxed_input_section_by_input_section_map):
10153 New type.
10154 (Output_section::relaxed_input_section_map_): Change type to
10155 Output_section::Output_relaxed_input_section_by_input_section_map.
10156 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10157 input section.
10158
10159 2009-12-15 Ian Lance Taylor <iant@google.com>
10160
10161 * layout.cc (Layout::create_shstrtab): Only write out after input
10162 sections if we are compressing debug sections.
10163
10164 2009-12-15 Ian Lance Taylor <iant@google.com>
10165
10166 * archive.cc (Archive::add_symbols): Only look up a symbol without
10167 a version if there is, in fact, a version.
10168
10169 2009-12-14 Ian Lance Taylor <iant@google.com>
10170
10171 Revert -Wshadow changes, all changes from:
10172 2009-12-11 Doug Kwan <dougkwan@google.com>
10173 2009-12-11 Nick Clifton <nickc@redhat.com>
10174 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10175
10176 2009-12-11 Doug Kwan <dougkwan@google.com>
10177
10178 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10179 due to -Wshadow.
10180 * attributes.cc (Object_attribute::size): Ditto.
10181 (Attributes_section_data::size): Ditto.
10182 (Attributes_section_data::Attributes_section_data): Ditto.
10183 (Output_attributes_section_data::do_write): Ditto.
10184 * attributes.h (Object_attribute::set_type): Ditto.
10185 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10186
10187 2009-12-11 Nick Clifton <nickc@redhat.com>
10188
10189 * archive.cc: Fix shadowed variable warnings.
10190 * arm.cc: Likewise.
10191 * compressed_output.cc: Likewise.
10192 * compressed_output.h: Likewise.
10193 * configure: Likewise.
10194 * dwarf_reader.cc: Likewise.
10195 * dynobj.cc: Likewise.
10196 * dynobj.h: Likewise.
10197 * ehframe.cc: Likewise.
10198 * ehframe.h: Likewise.
10199 * errors.cc: Likewise.
10200 * expression.cc: Likewise.
10201 * fileread.cc: Likewise.
10202 * fileread.h: Likewise.
10203 * freebsd.h: Likewise.
10204 * i386.cc: Likewise.
10205 * icf.cc: Likewise.
10206 * incremental.h: Likewise.
10207 * layout.cc: Likewise.
10208 * layout.h: Likewise.
10209 * mapfile.cc: Likewise.
10210 * merge.cc: Likewise.
10211 * merge.h: Likewise.
10212 * object.cc: Likewise.
10213 * object.h: Likewise.
10214 * options.h: Likewise.
10215 * output.cc: Likewise.
10216 * output.h: Likewise.
10217 * parameters.cc: Likewise.
10218 * plugin.cc: Likewise.
10219 * powerpc.cc: Likewise.
10220 * reduced_debug_output.cc: Likewise.
10221 * reduced_debug_output.h: Likewise.
10222 * reloc.cc: Likewise.
10223 * reloc.h: Likewise.
10224 * resolve.cc: Likewise.
10225 * script-sections.cc: Likewise.
10226 * script.cc: Likewise.
10227 * script.h: Likewise.
10228 * sparc.cc: Likewise.
10229 * symtab.cc: Likewise.
10230 * symtab.h: Likewise.
10231 * target-select.cc: Likewise.
10232 * target-select.h: Likewise.
10233 * token.h: Likewise.
10234 * workqueue.cc: Likewise.
10235 * workqueue.h: Likewise.
10236 * x86_64.cc: Likewise.
10237
10238 2009-12-10 Doug Kwan <dougkwan@google.com>
10239
10240 * arm.cc (attributes.h): New include.
10241 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10242 (Arm_relobj::~Arm_relobj): Delete object pointed by
10243 attributes_section_data_.
10244 (Arm_relobj::attributes_section_data): New method definition.
10245 (Arm_relobj::attributes_section_data_): New data member declaration.
10246 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10247 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10248 attributes_section_data_.
10249 (Arm_dynobj::attributes_section_data): New method definition.
10250 (Arm_dynobj::attributes_section_data_): New data member declaration.
10251 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10252 initialization value of may_use_blx_ to false.
10253 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10254 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10255 object attributes to compute results instead of hard-coding.
10256 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10257 Target_arm::get_secondary_compatible_arch,
10258 Target_arm::set_secondary_compatible_arch
10259 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10260 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10261 New method declarations.
10262 (Target_arm::get_aeabi_object_attribute): New method definition.
10263 (Target_arm::attributes_section_data_): New data member declaration.
10264 (read_arm_attributes_section): New template definition.
10265 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10266 (Arm_dynobj::do_read_symbols): Ditto.
10267 (Target_arm::do_finalize_sections): Merge attributes sections from
10268 input. Check for BLX use after attributes section merging.
10269 Fix __exidx_start and __exidx_end visibility. Create an
10270 .ARM.attributes section if necessary.
10271 (Target_arm::get_secondary_compatible_arch,
10272 Target_arm::set_secondary_compatible_arch,
10273 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10274 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10275 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10276 New method definitions.
10277
10278 2009-12-09 Ian Lance Taylor <iant@google.com>
10279
10280 * plugin.cc (Plugin::load): Don't cast from void* to a function
10281 pointer.
10282
10283 2009-12-09 Ian Lance Taylor <iant@google.com>
10284
10285 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10286 information fields.
10287
10288 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10289
10290 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10291 Replace two_file_shared_1.so with two_file_shared_2.so.
10292 * testsuite/Makefile.in: Regenerated.
10293
10294 2009-12-08 Doug Kwan <dougkwan@google.com>
10295
10296 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10297 (HFILES): Add attributes.h and int_encoding.h.
10298 * Makefile.in: Regenerate.
10299 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10300 function definitions to int_encoding.cc
10301 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10302 prototypes to int_encoding.h
10303 * reduced_debug_output.cc (int_encoding.h): New include.
10304 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10305 function definitions to int_encoding.cc
10306 (insert_into_vector, read_from_pointer): Move template definitions to
10307 int_encoding.h
10308 * attributes.cc: New file.
10309 * attributes.h: New file.
10310 * int_encoding.cc: New file.
10311 * int_encoding.h: New file.
10312
10313 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10314
10315 PR gold/11055
10316 * incremental-dump.cc (dump_incremental_inputs): New.
10317 (main): Use dump_incremental_inputs.
10318
10319 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10320
10321 PR gold/10893
10322 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10323 checking elfcpp::STT_FUNC.
10324 (Target_i386::Relocate::relocate): Likewise.
10325 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10326
10327 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10328 symbols from shared libraries into normal FUNC symbols.
10329
10330 * symtab.h (Symbol): Add is_func and use it.
10331
10332 2009-12-05 Doug Kwan <dougkwan@google.com>
10333
10334 * arm.cc (Target_arm::arm_info): Initialize new fields
10335 attributes_section and attributes_vendor.
10336 * i386.cc (Target_i386::i386_info): Same.
10337 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10338 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10339 fields attributes_section and attributes_vendor.
10340 * sparc.cc (Target_sparc::sparc_info): Same.
10341 * target.h (Target::attributes_section, Target::attributes_vendor,
10342 Target::is_attributes_section, Target::attribute_arg_type,
10343 Target::attributes_order): New method definitions.
10344 (Target::Target_info::attributes_section,
10345 Target::Target_info::attributes_vendor): New fields.
10346 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10347 virtual method definitions.
10348 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10349 attributes_section and attributes_vendor.
10350 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10351
10352 2009-12-05 Doug Kwan <dougkwan@google.com>
10353
10354 * arm.cc: Update comments about interworking and stub generation.
10355 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10356 considered as non-PIC.
10357 (Arm_relocate_functions::base_abs): Fix formatting.
10358 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10359 of function to use GOT entry address instead of offset.
10360 (Target_arm::Scan::global): Issue an error if a symbol would need a
10361 PLT does not get one because it is untyped. Remove code to create
10362 dynamic symbols for relative branches.
10363 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10364 takes unsigned integer instead of boolean.
10365
10366 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10367
10368 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10369 (two_file_test_LDADD): Likewise.
10370 (common_test_1_LDADD): Likewise.
10371 (exception_test_LDADD) Likewise.
10372 (weak_test_LDADD): Likewise.
10373 (many_sections_test_LDADD): Likewise.
10374 (initpri1_LDADD): Likewise.
10375 (script_test_1_LDADD): Likewise.
10376 (script_test_2_LDADD): Likewise.
10377 (justsyms_LDADD): Likewise.
10378 (binary_test_LDADD): Likewise.
10379 (large_LDADD): Likewise.
10380 * testsuite/Makefile.in: Regenerated.
10381
10382 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10383
10384 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10385 (Symbol_table::override_with_special): Likewise.
10386 (Symbol_table::add_from_object): Likewise.
10387
10388 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10389
10390 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10391 Don't set the data_offset twice.
10392
10393 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10394
10395 * testsuite/Makefile.in: Regenerate.
10396
10397 2009-12-03 Doug Kwan <dougkwan@google.com>
10398
10399 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10400 (Target_arm::do_finalize_sections): Add parameter for symbol table
10401 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10402 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10403 parameter for symbol table pointer.
10404 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10405 an additional parameter for a pointer to symbol table.
10406 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10407 parameter for a symbol table pointer.
10408 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10409 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10410 Ditto.
10411 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10412 parameter for a symbol table pointer.
10413
10414 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10415
10416 * incremental.cc (Incremental_inputs_header)
10417 (Incremental_inputs_header_write, Incremental_inputs_entry)
10418 (Incremental_inputs_entry_write): Move ...
10419 * incremental.h (Incremental_inputs_header)
10420 (Incremental_inputs_header_write, Incremental_inputs_entry)
10421 (Incremental_inputs_entry_write): here.
10422
10423 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10424
10425 * incremental.cc (make_sized_incremental_binary): Set the target.
10426 Error if it is incompatible.
10427 * output.h (Output_file): Add filename method.
10428
10429 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10430
10431 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10432 from the get_* methods.
10433
10434 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10435
10436 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10437 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10438 Write 0 for the data_offset of scripts.
10439
10440 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10441
10442 * testsuite/Makefile.am: Add the incremental_test.sh test.
10443 * testsuite/incremental_test.sh: New.
10444 * testsuite/incremental_test_1.c: New.
10445 * testsuite/incremental_test_2.c: New.
10446
10447 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10448
10449 * incremental-dump.cc (main): Fix typos.
10450
10451 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10452
10453 PR gold/11025
10454 * incremental-dump.cc (main): Use llu to print 64 bit values.
10455
10456 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10457 H.J. Lu <hongjiu.lu@intel.com>
10458
10459 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10460 $(LIBDL).
10461 (incremental_dump_LDADD): Likewise.
10462 * Makefile.in: Regenerated.
10463
10464 2009-11-25 Doug Kwan <dougkwan@google.com>
10465
10466 Revert:
10467
10468 2009-11-25 Doug Kwan <dougkwan@google.com>
10469
10470 * arm.cc (Target_arm::Target_arm): Move method definition
10471 outside of class definition. Add code to handle
10472 --target1-rel, --target1-abs and --target2= options.
10473 (Target_arm::get_reloc_reloc_type): Change method to be
10474 non-static and const.
10475 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10476 New data member declaration.
10477 (Target_arm::Scan::local, Target_arm::Scan::global,
10478 Target_arm::Relocate::relocate,
10479 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10480 Adjust call to Target_arm::get_real_reloc_type.
10481 (Target_arm::get_real_reloc_type): Use command line options
10482 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10483 * options.h (--target1-rel, --target1-abs, --target2): New
10484 ARM-only options.
10485
10486 2009-11-25 Doug Kwan <dougkwan@google.com>
10487
10488 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10489 class definition. Add code to handle --target1-rel, --target1-abs
10490 and --target2= options.
10491 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10492 and const.
10493 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10494 member declaration.
10495 (Target_arm::Scan::local, Target_arm::Scan::global,
10496 Target_arm::Relocate::relocate,
10497 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10498 call to Target_arm::get_real_reloc_type.
10499 (Target_arm::get_real_reloc_type): Use command line options to
10500 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10501 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10502 options.
10503
10504 2009-11-25 Doug Kwan <dougkwan@google.com>
10505
10506 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10507 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10508 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10509 formatting.
10510 (Arm_relocate_functions::thm_call): Replace body with a call to
10511 Arm_relocate_functions::thumb_branch_common.
10512 (Arm_relocate_functions::thm_jump24,
10513 Arm_relocate_functions::thm_xpc22): New method definitions.
10514 (Arm_relocate_functions::thumb_branch_common): New method definition.
10515 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10516 operator.
10517 (Target_arm::Relocate::relocate): Adjust call to thm_call.
10518 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10519
10520 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10521
10522 * Makefile.am: Build incremental-dump
10523 * Makefile.in: Regenerate.
10524 * incremental-dump.cc: New.
10525 * incremental.cc (Incremental_inputs_header_data,
10526 Incremental_inputs_entry_data): Move to incremental.h
10527 * incremental.h: (Incremental_inputs_header_data,
10528 Incremental_inputs_entry_data): Move from incremental.cc
10529
10530 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10531
10532 * incremental.cc (Incremental_inputs_header,
10533 Incremental_inputs_header_write, Incremental_inputs_entry,
10534 Incremental_inputs_entry_write): Add a typedef with the data type.
10535
10536 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10537
10538 * incremental.cc (Incremental_inputs_header,
10539 Incremental_inputs_header_write, Incremental_inputs_entry,
10540 Incremental_inputs_entry_write): Update comment about which
10541 type has the filed descriptions.
10542
10543 2009-11-15 Doug Kwan <dougkwan@google.com>
10544
10545 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10546 (Arm_relocate_functions::arm_branch_common): Change method defintion
10547 in class definition to a method declaration and update list of formal
10548 parameters.
10549 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10550 Arm_relocation_functions::jump24): Adjust call to
10551 Arm_relocate_functions::arm_branch_common. Update list of formal
10552 parameters.
10553 (Arm_relocate_functions::xpc25): New method definition.
10554 (Arm_relocate_functions::arm_branch_common): Move method defintion
10555 out from class definition. Use stubs for mode-switching and extending
10556 branch ranges.
10557 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10558 specially. Change code to enable use of stubs in ARM branches.
10559
10560 2009-11-10 Doug Kwan <dougkwan@google.com>
10561
10562 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10563 in method declaration.
10564 (Target_arm::relocate_stub): New method declaration.
10565 (Target_arm::default_target): Change to return a pointer instead of
10566 a const reference.
10567 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10568 Target_arm::default_target.
10569 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10570 method definition.
10571 (Target_arm::relocate_section): Adjust view.
10572 (Target_arm::relocate_stub): New method definition.
10573
10574 2009-11-10 Doug Kwan <dougkwan@google.com>
10575
10576 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10577 a format warning.
10578 * incremental.cc (open_incremental_binary): Initialized local
10579 variables to avoid warnings.
10580 * object.cc (make_elf_object): Ditto.
10581 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10582 a format warning.
10583
10584 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10585
10586 PR gold/10930
10587 * testsuite/plugin_test.c: Include "config.h".
10588
10589 2009-11-09 Doug Kwan <dougkwan@google.com>
10590
10591 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10592 (arm_symbol_value): Remove.
10593 (Arm_relocate_functions::arm_branch_common,
10594 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10595 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10596 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10597 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10598 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10599 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10600 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10601 Arm_relocate_functions::thm_mobw_abs_nc,
10602 Arm_relocate_functions::thm_mov_abs,
10603 Arm_relocate_functions::movw_prel_nc,
10604 Arm_relocate_functions::thm_movt_abs,
10605 Arm_relocate_functions::movt_prel,
10606 Arm_relocate_functions::thm_movw_prel_nc,
10607 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10608 (Target_arm::Relocate::relocate): Only decompose address into two
10609 parts if relocation type uses the thumb-bit and pass the actual
10610 bit instead of a flag indicating that the thumb-bit is used. Adjust
10611 calls to methods in Arm_relocate_functions for this change.
10612
10613 2009-11-08 Ian Lance Taylor <iant@google.com>
10614
10615 PR 10925
10616 * reloc.cc: Instantiate
10617 Sized_relobj::initialize_input_to_output_maps and
10618 Sized_relobj:free_input_to_output_maps.
10619
10620 2009-11-06 Ian Lance Taylor <iant@google.com>
10621
10622 PR 10876
10623 * defstd.cc (in_segment): Set only_if_ref true for "end".
10624
10625 2009-11-06 Doug Kwan <dougkwan@google.com>
10626
10627 * arm.cc (class Reloc_stub): Correct a comment.
10628 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10629 (Target_arm::scan_section_for_stubs): New method declaration.
10630 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10631 Change methods from private to protected.
10632 (Target_arm::do_may_relax): New method definition.
10633 (Target_arm::do_relax, Target_arm::group_sections,
10634 Target_arm::scan_reloc_for_stub,
10635 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10636 (Target_arm::arm_input_section_map_): New data member declaration.
10637 (Target_arm::scan_reloc_for_stub,
10638 Target_arm::scan_reloc_section_for_stubs,
10639 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10640 Target_arm::do_relax): New method definitions.
10641
10642 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10643
10644 * configure.ac: Check for (struct stat)::st_mtim
10645 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10646 * config.in: Regenerate.
10647 * configure: Regenerate.
10648
10649 2009-11-05 Ian Lance Taylor <iant@google.com>
10650
10651 PR 10910
10652 * output.cc (Output_segment::add_output_section): Add missing
10653 return statement.
10654
10655 2009-11-04 Ian Lance Taylor <iant@google.com>
10656
10657 PR 10880
10658 * object.h (class Object): Add is_needed and set_is_needed
10659 methods. Add is_needed_ field. Make bool fields into bitfields.
10660 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10661 defined in a dynamic object and referenced by a regular object,
10662 set is_needed for the dynamic object.
10663 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10664 if the file is marked with as_needed and it is not needed.
10665
10666 2009-11-04 Ian Lance Taylor <iant@google.com>
10667
10668 PR 10887
10669 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10670 tags if data is discarded by linker script.
10671 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10672 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10673 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10674 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10675
10676 2009-11-04 Ian Lance Taylor <iant@google.com>
10677
10678 * layout.cc (Layout::get_output_section): Add is_interp and
10679 is_dynamic_linker_section parameters. Change all callers.
10680 (Layout::choose_output_section): Likewise.
10681 (Layout::make_output_section): Likewise.
10682 (Layout::add_output_section_data): Add is_dynamic_linker_section
10683 parameter. Change all callers.
10684 * layout.h (class Layout): Update declarations.
10685 * output.h (class Output_section): Add is_interp, set_is_interp,
10686 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10687 Add is_interp_, is_dynamic_linker_section_ fields. Change
10688 generate_code_fills_at_write_ to a bitfield.
10689 * output.cc (Output_section::Output_sections): Initialize new
10690 fields.
10691 (Output_segment::add_output_section): Add do_sort parameter.
10692 Change all callers.
10693
10694 2009-11-03 Ian Lance Taylor <iant@google.com>
10695
10696 PR 10860
10697 * options.h (class General_options): Add --warn-common.
10698 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10699 merging two common symbols.
10700 (Symbol_table::should_override): Handle --warn-common when merging
10701 a common symbol with a defined symbol. Use report_resolve_problem
10702 for multiple definitions.
10703 (Symbol_table::report_resolve_problem): New function.
10704 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10705
10706 2009-11-03 Doug Kwan <dougkwan@google.com>
10707
10708 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10709 stub_factory_.
10710 (Target_arm::stub_factory): New method definition.
10711 (Target_arm::new_arm_input_section,
10712 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10713 Target_arm::reloc_uses_thumb_bit): New method declarations.
10714 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10715 New type definitions.
10716 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10717 member declarations.
10718 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10719 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10720 New method definitions.
10721
10722 2009-11-03 Ian Lance Taylor <iant@google.com>
10723
10724 * options.h (class General_options): Add --warn_constructors.
10725
10726 2009-11-03 Ian Lance Taylor <iant@google.com>
10727
10728 PR 10893
10729 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10730 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10731
10732 2009-11-03 Ian Lance Taylor <iant@google.com>
10733
10734 PR 10895
10735 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10736 --msgid-bugs-address.
10737 (install-pdf): New target.
10738 (install-data_yes): Look up one directory to find mkinstalldirs.
10739
10740 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10741
10742 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10743 tree.
10744
10745 2009-10-30 Doug Kwan <dougkwan@google.com>
10746
10747 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10748
10749 2009-10-30 Doug Kwan <dougkwan@google.com>
10750
10751 * arm.cc (Stub_addend_reader): New struct template definition
10752 and partial specializations.
10753 (Stub_addend_reader::operator()): New method definition for a
10754 partially specialized template.
10755
10756 2009-10-30 Doug Kwan <dougkwan@google.com>
10757
10758 * arm.cc (Arm_relobj::processor_specific_flags): New method
10759 definition.
10760 (Arm_relobj::do_read_symbols): New method declaration.
10761 (Arm_relobj::processor_specific_flags_): New data member declaration.
10762 (Arm_dynobj): New class definition.
10763 (Target_arm::do_finalize_sections): Add input_objects parameter.
10764 (Target_arm::do_adjust_elf_header): New method declaration.
10765 (Target_arm::are_eabi_versions_compatible,
10766 (Target_arm::merge_processor_specific_flags): New method declaration.
10767 (Target_arm::do_make_elf_object): New overloaded method definitions
10768 and declaration.
10769 (Arm_relobj::do_read_symbols): New method definition.
10770 (Arm_dynobj::do_read_symbols): Ditto.
10771 (Target_arm::do_finalize_sections): Add input_objects parameters.
10772 Merge processor-specific flags from all input objects.
10773 (Target_arm::are_eabi_versions_compatible,
10774 Target_arm::merge_processor_specific_flags,
10775 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10776 New method definitions.
10777 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10778 Input_objects pointer type parameter.
10779 * layout.cc (Layout::finalize): Pass input objects to target's.
10780 finalize_sections function.
10781 * output.cc (Output_file_header::do_sized_write): Set ELF file
10782 header's processor-specific flags.
10783 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10784 Input_objects pointer type parameter.
10785 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10786 * target.h (Input_objects): New forward class declaration.
10787 (Target::processor_specific_flags,
10788 Target::are_processor_specific_flags_sect): New method definitions.
10789 (Target::finalize_sections): Add input_objects parameter.
10790 (Target::Target): Initialize processor_specific_flags_ and
10791 are_processor_specific_flags_set_.
10792 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10793 parameter.
10794 (Target::set_processor_specific_flags): New method definition.
10795 (Target::processor_specific_flags_,
10796 Target::are_processor_specific_flags_set_): New data member
10797 declarations.
10798 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10799 Input_objects pointer type parameter.
10800
10801 2009-10-30 Doug Kwan <dougkwan@google.com>
10802
10803 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10804
10805 2009-10-28 Ian Lance Taylor <iant@google.com>
10806
10807 * object.h (class Relobj): Drop options parameter from
10808 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10809 do_scan_relocs, do_relocate. Change all callers.
10810 (class Sized_relobj): Drop options parameters from
10811 do_gc_process_relocs, do_scan_relocs, do_relocate,
10812 do_relocate_sections, relocate_sections, emit_relocs_scan,
10813 emit_relocs_scan_reltype. Change all callers.
10814 (struct Relocate_info): Remove options field and all references to
10815 it.
10816 * reloc.h (class Read_relocs): Remove options constructor
10817 parameter and options_ field. Change all callers.
10818 (class Gc_process_relocs, class Scan_relocs): Likewise.
10819 (class Relocate_task): Likewise.
10820 * target-reloc.h (scan_relocs): Remove options parameter. Change
10821 all callers.
10822 (scan_relocatable_relocs): Likewise.
10823 * target.h (class Sized_target): Remove options parameter from
10824 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10825 all callers.
10826 * gc.h (gc_process_relocs): Remove options parameter. Change all
10827 callers.
10828 * arm.cc: Update functions to remove options parameters.
10829 * i386.cc: Likewise.
10830 * powerpc.cc: Likewise.
10831 * sparc.cc: Likewise.
10832 * x86_64.cc: Likewise.
10833 * testsuite/testfile.cc: Likewise.
10834
10835 2009-10-28 Doug Kwan <dougkwan@google.com>
10836
10837 * arm.cc (Arm_relobj): New class definition.
10838 (Arm_relobj::scan_sections_for_stubs,
10839 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10840 New method definitions.
10841
10842 2009-10-28 Cary Coutant <ccoutant@google.com>
10843
10844 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10845 (Plugin::cleanup_done_): New member.
10846 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10847 (Plugin_manager::cleanup_done_): Remove.
10848 (Plugin_manager::add_input_file): Edit error message.
10849 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10850 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10851
10852 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10853
10854 * fileread.cc: (File_read::View::~View): Use the new
10855 data_ownership_ filed.
10856 (File_read::~File_read): Dispose the new whole_file_view_.
10857 (File_read::open): Mmap the whole file if needed.
10858 (File_read::open): Use whole_file_view_ instead of contents_.
10859 (File_read::find_view): Use whole_file_view_ if applicable.
10860 (File_read::do_read): Use whole_file_view_ instead of contents_.
10861 (File_read::make_view): Use whole_file_view_ instead of contents_,
10862 update File_read::View::View call.
10863 (File_read::find_or_make_view): Update File_read::View::View
10864 call.
10865 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10866 remove contents_
10867 (File_read::View::Data_ownership): New enum.
10868 (File_read::View::View): Replace bool mapped_ with Data_ownership
10869 argument.
10870 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10871 (File_read::View::data_ownership_): New field.
10872 (File_read::contents_): Remove (replaced by whole_file_view_).
10873 (File_read::whole_file_view_): New field.
10874 * options.h (class General_options): Add --keep-files-mapped.
10875
10876 2009-10-27 Cary Coutant <ccoutant@google.com>
10877
10878 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10879 * testsuite/Makefile.am (plugin_test_5): New test case.
10880 * testsuite/Makefile.in: Regenerate.
10881
10882 2009-10-25 Doug Kwan <dougkwan@google.com>
10883
10884 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10885 from private to protected to allow access by child class.
10886 (Sized_relobj::do_relocate_sections): New method declaration.
10887 (Sized_relobj::relocate_sections): Virtualize.
10888 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10889 Sized_relobj::relocate_sections. Instantiate template explicitly
10890 for different target sizes and endianity.
10891
10892 2009-10-24 Doug Kwan <dougkwan@google.com>
10893
10894 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10895 (Arm_input_section::as_arm_input_section): New method.
10896 (Arm_output_section): New class definition.
10897 (Arm_output_section::create_stub_group,
10898 Arm_output_section::group_sections): New method definitions.
10899
10900 2009-10-22 Doug Kwan <dougkwan@google.com>
10901
10902 * arm.cc (Arm_input_section): New class definition.
10903 (Arm_input_section::init, Arm_input_section:do_write,
10904 Arm_input_section::set_final_data_size,
10905 Arm_input_section::do_reset_address_and_file_offset): New method
10906 definitions.
10907
10908 2009-10-21 Doug Kwan <dougkwan@google.com>
10909
10910 * arm.cc (Stub_table, Arm_input_section): New forward class
10911 declarations.
10912 (Stub_table): New class defintion.
10913 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10914 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10915 New method definition.
10916
10917 2009-10-21 Doug Kwan <dougkwan@google.com>
10918
10919 * arm.cc: Update copyright comments.
10920 (Target_arm): New forward class template declaration.
10921 (Arm_address): New type.
10922 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10923 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10924 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10925 constants.
10926 (Insn_template): Same.
10927 (DEF_STUBS): New macro.
10928 (Stub_type): New enum type.
10929 (Stub_template): New class definition.
10930 (Stub): Same.
10931 (Reloc_stub): Same.
10932 (Stub_factory): Same.
10933 (Target_arm::Target_arm): Initialize may_use_blx_ and
10934 should_force_pic_veneer_.
10935 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10936 Target_arm::should_force_pic_veneer,
10937 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10938 Target_arm::using_thumb_only, Target_arm:;default_target): New
10939 method defintions.
10940 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10941 New data member declarations.
10942 (Insn_template::size, Insn_template::alignment): New method defintions.
10943 (Stub_template::Stub_template): New method definition.
10944 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10945 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10946 (Stub_factory::Stub_factory): New method definition.
10947 * gold.h (string_hash): New template.
10948 * output.h (Input_section_specifier::hash_value): Use
10949 gold::string_hash.
10950 (Input_section_specifier::string_hash): Remove.
10951 * stringpool.cc (Stringpool_template::string_hash): Use
10952 gold::string_hash.
10953
10954 2009-10-20 Doug Kwan <dougkwan@google.com>
10955
10956 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10957 symbols of relaxed input sections.
10958 * output.h (Output_section::find_relaxed_input_section): Make
10959 method public.
10960
10961 2009-10-16 Doug Kwan <dougkwan@google.com>
10962
10963 * dynobj.cc (Versions::Versions): Initialize version_script_.
10964 Only insert base version symbol definition for a shared object
10965 if version script defines any version versions.
10966 (Versions::define_base_version): New method definition.
10967 (Versions::add_def): Check that base version is not needed.
10968 (Versions::add_need): Define base version lazily.
10969 * dynobj.h (Versions::define_base_version): New method declaration.
10970 (Versions::needs_base_version_): New data member declaration.
10971 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10972 (check_DATA): Add no_version_test.stdout.
10973 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10974 New make rules.
10975 * testsuite/Makefile.in: Regenerate.
10976 * testsuite/no_version_test.c: New file.
10977 * testsuite/no_version_test.sh: Ditto.
10978
10979 2009-10-16 Doug Kwan <dougkwan@google.com>
10980
10981 * expression.cc (class Segment_start_expression): New class definition.
10982 (Segment_start_expression::value): New method definition.
10983 (script_exp_function_segment_start): Return a new
10984 Segment_start_expression.
10985 * gold/script-c.h (script_saw_segment_start_expression): New function
10986 prototype.
10987 * script-sections.cc (Script_sections::Script_sections): Initialize
10988 SAW_SEGMENT_START_EXPRESSION_ to false.
10989 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10990 and -Tbbs options to specify section addresses if given in
10991 command line and no SEGMENT_START expression is seen in a script.
10992 * script-sections.h (Script_sections::saw_segment_start_expression,
10993 Script_sections::set_saw_segment_start_expression): New method
10994 definition.
10995 (Script_sections::saw_segment_start_expression_): New data member
10996 declaration.
10997 * script.cc (script_saw_segment_start_expression): New function.
10998 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10999 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11000 script_test_7.sh and script_test_8.sh.
11001 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11002 script_test_8.stdout.
11003 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11004 (script_test_6, script_test_6.stdout, script_test_7,
11005 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11006 * Makefile.in: Regenerate.
11007 * testsuite/script_test_6.sh: New file.
11008 * testsuite/script_test_6.t: Same.
11009 * testsuite/script_test_7.sh: Same.
11010 * testsuite/script_test_7.t: Same.
11011 * testsuite/script_test_8.sh: Same.
11012
11013 2009-10-16 Doug Kwan <dougkwan@google.com>
11014
11015 * output.cc (Output_segment::set_section_list_address): Cast
11016 expressions to unsigned long long type to avoid format warnings.
11017
11018 2009-10-15 Ian Lance Taylor <iant@google.com>
11019
11020 * script.cc (Script_options::add_symbol_assignment): Always add a
11021 dot assignment to script_sections_.
11022 * script-sections.cc (Script_sections::add_dot_assignment):
11023 Initialize if necessary.
11024
11025 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11026 program headers with no load segment if there is a linker script.
11027
11028 * layout.cc (Layout::set_segment_offsets): Align the file offset
11029 to the segment aligment for -N or -n with no load segment.
11030 * output.cc (Output_segment::add_output_section): Don't crash if
11031 the first section is a TLS section.
11032 (Output_segment::set_section_list_addresses): Print an error
11033 message if the address moves backward in a linker script.
11034 * script-sections.cc
11035 (Output_section_element_input::set_section_addresses): Don't
11036 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11037 (Orphan_output_section::set_section_addresses): Likewise.
11038
11039 2009-10-15 Doug Kwan <dougkwan@google.com>
11040
11041 * layout.cc (Layout::finish_dynamic_section): Generate tags
11042 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11043 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11044 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11045
11046 2009-10-14 Ian Lance Taylor <iant@google.com>
11047
11048 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11049 fields.
11050 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11051 data_shdr fields of relinfo.
11052 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11053 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11054 R_386_TLS_LDO_32, adjust based on section flags.
11055 (Target_i386::Relocate::fix_up_ldo): Remove.
11056
11057 2009-10-13 Ian Lance Taylor <iant@google.com>
11058
11059 Add support for -pie.
11060 * options.h (class General_options): Add -pie and
11061 --pic-executable.
11062 (General_options::output_is_position_independent): Test -pie.
11063 (General_options::output_is_executable): Return true if not shared
11064 and not relocatable.
11065 (General_options::output_is_pie): Remove.
11066 * options.cc (General_options::finalize): Reject incompatible uses
11067 of -pie.
11068 * gold.cc (queue_middle_tasks): A -pie link is not static.
11069 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11070 * symtab.cc (Symbol::final_value_is_known): Return false if
11071 output_is_position_independent.
11072 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11073 output_is_position_independent.
11074 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11075 output_is_position_independent.
11076 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11077 output_is_position_independent.
11078 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11079 two_file_pie_test.
11080 (basic_pie_test.o, basic_pie_test): New targets.
11081 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11082 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11083 (two_file_pie_test): New target.
11084 * testsuite/Makefile.in: Rebuild.
11085 * README: Remove note saying that -pie is not supported.
11086
11087 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11088
11089 * options.h (class General_options): Add -init and -fini.
11090 * layout.cc (Layout::finish_dynamic_section): Emit
11091 given init and fini functions.
11092
11093 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11094
11095 * gc.h (gc_process_relocs): Check if icf is enabled using new
11096 function.
11097 * gold.cc (queue_initial_tasks): Likewise.
11098 (queue_middle_tasks): Likewise.
11099 * object.cc (do_layout): Likewise.
11100 * symtab.cc (is_section_folded): Likewise.
11101 * main.cc (main): Likewise.
11102 * reloc.cc (Read_relocs::run): Likewise.
11103 (Sized_relobj::do_scan_relocs): Likewise.
11104 * icf.cc (is_function_ctor_or_dtor): New function.
11105 (Icf::find_identical_sections): Check if function is ctor or dtor when
11106 safe icf is chosen.
11107 * options.h (General_options::icf): Change option to be an enum.
11108 (Icf_status): New enum.
11109 (icf_enabled): New method.
11110 (icf_safe_folding): New method.
11111 (set_icf_status): New method.
11112 (icf_status_): New variable.
11113 * (options.cc) (General_options::finalize): Set icf_status_.
11114 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11115 icf_test and icf_keep_unique_test to use the --icf enum flag.
11116 * testsuite/icf_safe_test.sh: New file.
11117 * testsuite/icf_safe_test.cc: New file.
11118
11119 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11120
11121 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11122 includes to gc.h and icf.h.
11123 * arm.cc: Include gc.h.
11124 * gold.cc: Likewise.
11125 * i386.cc: Likewise.
11126 * powerpc.cc: Likewise.
11127 * sparc.cc: Likewise.
11128 * x86_64.cc: Likewise.
11129 * gc.h: Include icf.h.
11130
11131 2009-10-11 Ian Lance Taylor <iant@google.com>
11132
11133 * plugin.cc: Include "gold.h" before other header files.
11134
11135 2009-10-10 Chris Demetriou <cgd@google.com>
11136
11137 * options.h (Input_file_argument::Input_file_type): New enum.
11138 (Input_file_argument::is_lib_): Replace with...
11139 (Input_file_argument::type_): New member.
11140 (Input_file_argument::Input_file_argument): Take Input_file_type
11141 'type' rather than boolean 'is_lib' as second argument.
11142 (Input_file_argument::is_lib): Use type_.
11143 (Input_file_argument::is_searched_file): New function.
11144 (Input_file_argument::may_need_search): Handle is_searched_file.
11145 * options.cc (General_options::parse_library): Support -l:filename.
11146 (General_options::parse_just_symbols): Update for Input_file_argument
11147 changes.
11148 (Command_line::process): Likewise.
11149 * archive.cc (Archive::get_file_and_offset): Likewise.
11150 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11151 * script.cc (read_script_file, script_add_file): Likewise.
11152 * fileread.cc (Input_file::Input_file): Likewise.
11153 (Input_file::will_search_for): Handle is_searched_file.
11154 (Input_file::open): Likewise.
11155 * readsyms.cc (Read_symbols::get_name): Likewise.
11156 * testsuite/Makefile.am (searched_file_test): New test.
11157 * testsuite/Makefile.in: Regenerate.
11158 * testsuite/searched_file_test.cc: New file.
11159 * testsuite/searched_file_test_lib.cc: New file.
11160
11161 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11162 Ian Lance Taylor <iant@google.com>
11163
11164 * descriptor.cc: Include <cstdio> and "binary-io.h".
11165 (Descriptors::open): Open the files in binary mode always.
11166 * script.cc (Lex::get_token): Treat \r as whitespace.
11167
11168 2009-10-09 Ian Lance Taylor <iant@google.com>
11169
11170 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11171
11172 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11173 Ian Lance Taylor <iant@google.com>
11174
11175 * configure.ac: Check for readv function also.
11176 * fileread.cc (readv): Define if not HAVE_READV.
11177 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11178 does not exist.
11179 * config.in: Regenerate.
11180 * configure: Regenerate.
11181
11182 2009-10-09 Doug Kwan <dougkwan@google.com>
11183
11184 * layout.cc (Layout::make_output_section): Call target hook to make
11185 ordinary output section.
11186 (Layout::finalize): Adjust parameter list of call the
11187 Target::may_relax().
11188 * layout.h (class Layout::section_list): New method.
11189 * merge.h (Output_merge_base::entsize): Change visibility to public.
11190 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11191 New methods.
11192 (Output_merge_string::do_is_string): New method.
11193 * object.cc (Sized_relobj::do_setup): renamed from
11194 Sized_relobj::set_up.
11195 * object.h (Sized_relobj::adjust_shndx,
11196 Sized_relobj::initializ_input_to_output_maps,
11197 Sized_relobj::free_input_to_output_maps): Change visibilities to
11198 protected.
11199 (Sized_relobj::setup): Virtualize.
11200 (Sized_relobj::do_setup): New method declaration.
11201 (Sized_relobj::invalidate_section_offset,
11202 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11203 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11204 * options.cc (parse_int): New function.
11205 * options.h (parse_int): New declaration.
11206 (DEFINE_int): New macro.
11207 (stub_group_size): New option.
11208 * output.cc (Output_section::Output_section): Initialize memebers
11209 merge_section_map_, merge_section_by_properties_map_,
11210 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11211 (Output_section::add_input_section): Handled deferred code-fill
11212 generation and remove an old comment.
11213 (Output_section::add_relaxed_input_section): New method definition.
11214 (Output_section::add_merge_input_section): Use merge section by
11215 properties map to speed to search. Update merge section maps
11216 as appropriate.
11217 (Output_section::build_relaxation_map): New method definition.
11218 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11219 Same.
11220 (Output_section::relax_input_section): Renamed to
11221 Output_section::convert_input_sections_to_relaxed_sections and change
11222 interface to take a vector of pointers to relaxed sections.
11223 (Output_section::find_merge_section,
11224 Output_section::find_relaxed_input_section): New method definitions.
11225 (Output_section::is_input_address_mapped,
11226 Output_section::output_offset, Output_section::output_address):
11227 Use output section data maps to speed up searching.
11228 (Output_section::find_starting_output_address): Add comments.
11229 (Output_section::do_write,
11230 Output_section::write_to_postprocessing_buffer): Do code-fill
11231 generation as appropriate.
11232 (Output_section::get_input_sections): Invalidate relaxed input section
11233 map.
11234 (Output_section::restore_states): Adjust type of checkpoint .
11235 Invalidate relaxed input section map.
11236 * output.h (Output_merge_base): New class declaration.
11237 (Input_section_specifier): New class defintion.
11238 (class Output_relaxed_input_section) Change base class to
11239 Output_section_data_build.
11240 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11241 base class initializer.
11242 (Output_section::add_relaxed_input_section): New method declaration.
11243 (Output_section::Input_section): Change visibility to protected.
11244 (Output_section::Input_section::relobj,
11245 Output_section::Input_section::shndx): Handle relaxed input sections.
11246 Output_section::input_sections) Change visibility to protected. Also
11247 define overload to return a non-const pointer.
11248 (Output_section::Merge_section_properties): New class defintion.
11249 (Output_section::Merge_section_by_properties_map,
11250 Output_section::Output_section_data_by_input_section_map,
11251 Output_section::Relaxation_map): New types.
11252 (Output_section::relax_input_section): Rename method to
11253 Output_section::convert_input_sections_to_relaxed_sections and change
11254 interface to take a vector of relaxed section pointers.
11255 (Output_section::find_merge_section,
11256 Output_section::find_relaxed_input_section,
11257 Output_section::build_relaxation_map,
11258 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11259 New method declarations.
11260 (Output_section::merge_section_map_
11261 Output_section::merge_section_by_properties_map_,
11262 Output_section::relaxed_input_section_map_,
11263 Output_section::is_relaxed_input_section_map_valid_,
11264 Output_section::generate_code_fills_at_write_): New data members.
11265 * script-sections.cc
11266 (Output_section_element_input::set_section_addresses): Call
11267 current_data_size and addralign methods of relaxed input sections.
11268 (Orphan_output_section::set_section_addresses): Call current_data_size
11269 and addralign methods of relaxed input sections.
11270 * symtab.cc (Symbol_table::compute_final_value): Extract template
11271 from the body of Symbol_table::sized_finalize_symbol.
11272 (Symbol_table::sized_finalized_symbol): Call
11273 Symbol_table::compute_final_value.
11274 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11275 (Symbol_table::compute_final_value): New templated method declaration.
11276 * target.cc (Target::do_make_output_section): New method defintion.
11277 * target.h (Target::make_output_section): New method declaration.
11278 (Target::relax): Add more parameters for input objects, symbol table
11279 and layout. Adjust call to do_relax.
11280 (Target::do_make_output_section): New method declaration.
11281 (Target::do_relax): Add parameters for input objects, symbol table
11282 and layout.
11283
11284 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11285
11286 * pread.c: Include stdio.h.
11287
11288 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11289
11290 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11291 defined.
11292
11293 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11294
11295 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11296 Change read_shndx type to unsigned int.
11297 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11298 int.
11299 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11300 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11301 Change read_shndx type to unsigned int.
11302 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11303 int.
11304 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11305 * layout.cc (Layout::create_symtab_sections): Cast the result of
11306 local_symcount * symsize to off_t in the gold_assert.
11307
11308 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11309
11310 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11311 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11312 R_ARM_BASE_ABS.
11313 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11314 (Arm_relocate_functions::thm_abs5): New function.
11315 (Arm_relocate_functions::abs12): New function.
11316 (Arm_relocate_functions::abs16): New function.
11317 (Arm_relocate_functions::base_abs): New function.
11318 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11319 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11320 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11321 R_ARM_BASE_ABS.
11322 (Scan::global): Likewise.
11323 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11324 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11325 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11326 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11327 R_ARM_BASE_ABS.
11328
11329 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11330
11331 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11332 (Arm_relocate_functions::movt_prel): New function.
11333 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11334 (Arm_relocate_functions::thm_movt_prel): New function.
11335 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11336 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11337 (Scan::global, Relocate::relocate): Likewise.
11338 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11339
11340 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11341
11342 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11343 Incremental_checker.
11344 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11345 unsigned int.
11346 (class Incremental_inputs_header): New class.
11347 (Incremental_inputs_header_writer): Edit comment.
11348 (Incremental_inputs_entry): New class.
11349 (Incremental_inputs_entry_writer): Edit comment.
11350 (Sized_incremental_binary::do_find_incremental_inputs_section):
11351 Add *strtab_shndx parameter, fill it.
11352 (Sized_incremental_binary::do_check_inputs): New method.
11353 (Incremental_checker::can_incrementally_link_output_file): Use
11354 Sized_incremental_binary::check_inputs.
11355 (Incremental_inputs::report_command_line): Save command line in
11356 command_line_.
11357 * incremental.h:
11358 (Incremental_binary::find_incremental_inputs_section): New
11359 method.
11360 (Incremental_binary::do_find_incremental_inputs_section): Add
11361 strtab_shndx parameter.
11362 (Incremental_binary::do_check_inputs): New pure virtual method.
11363 (Sized_incremental_binary::do_check_inputs): Declare.
11364 (Incremental_checker::Incremental_checker): Add incremental_inputs
11365 parameter, use it to initialize incremental_inputs_.
11366 (Incremental_checker::incremental_inputs_): New field.
11367 (Incremental_checker::command_line): New method.
11368 (Incremental_checker::inputs): New method.
11369 (Incremental_checker::command_line_): New field.
11370
11371 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11372
11373 * incremental.cc: Include <cstdarg> and "target-select.h".
11374 (vexplain_no_incremental): New function.
11375 (explain_no_incremental): New function.
11376 (Incremental_binary::error): New method.
11377 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11378 method.
11379 (make_sized_incremental_binary): New function.
11380 (open_incremental_binary): New function.
11381 (can_incrementally_link_file): Add checks if output is ELF and has
11382 inputs section.
11383 * incremental.h: Include "elfcpp_file.h" and "output.h".
11384 (Incremental_binary): New class.
11385 (Sized_incremental_binary): New class.
11386 (open_incremental_binary): Declare.
11387 * object.cc (is_elf_object): Use
11388 elfcpp::Elf_recognizer::is_elf_file.
11389 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11390 * output.h (Output_file::filesize): New method.
11391
11392 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11393
11394 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11395 New function.
11396 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11397 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11398 function.
11399 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11400 function.
11401 (Arm_relocate_functions::movw_abs_nc): New function.
11402 (Arm_relocate_functions::movt_abs): New function.
11403 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11404 (Arm_relocate_functions::thm_movt_abs): New function.
11405 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11406 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11407 (Scan::global): Likewise.
11408 (Relocate::relocate): Likewise.
11409 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11410
11411 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11412
11413 * arm.cc (Arm_relocate_functions::got_prel) New function.
11414 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11415 (Relocate::relocate): Likewise.
11416 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11417
11418 2009-10-06 Ian Lance Taylor <iant@google.com>
11419
11420 * options.h (class General_options): Define
11421 split_stack_adjust_size parameter.
11422 * object.h (class Object): Add uses_split_stack_ and
11423 has_no_split_stack_ fields. Add uses_split_stack and
11424 has_no_split_stack accessor functions. Declare
11425 handle_split_stack_section.
11426 (class Reloc_symbol_changes): Define.
11427 (class Sized_relobj): Define Function_offsets. Declare
11428 split_stack_adjust, split_stack_adjust_reltype, and
11429 find_functions.
11430 * object.cc (Object::handle_split_stack_section): New function.
11431 (Sized_relobj::do_layout): Call handle_split_stack_section.
11432 * dynobj.cc (Sized_dynobj::do_layout): Call
11433 handle_split_stack_section.
11434 * reloc.cc (Sized_relobj::relocate_sections): Call
11435 split_stack_adjust for executable sections in split_stack
11436 objects. Pass reloc_map to relocate_section.
11437 (Sized_relobj::split_stack_adjust): New function.
11438 (Sized_relobj::split_stack_adjust_reltype): New function.
11439 (Sized_relobj::find_functions): New function.
11440 * target-reloc.h: Include "object.h".
11441 (relocate_section): Add reloc_symbol_changes parameter. Change
11442 all callers.
11443 * target.h (class Target): Add calls_non_split method. Declare
11444 do_calls_non_split virtual method. Declare match_view and
11445 set_view_to_nop.
11446 * target.cc: Include "elfcpp.h".
11447 (Target::do_calls_non_split): New function.
11448 (Target::match_view): New function.
11449 (Target::set_view_to_nop): New function.
11450 * gold.cc (queue_middle_tasks): Give an error if mixing
11451 split-stack and non-split-stack objects with -r.
11452 * i386.cc (Target_i386::relocate_section): Add
11453 reloc_symbol_changes parameter.
11454 (Target_i386::do_calls_non_split): New function.
11455 * x86_64.cc (Target_x86_64::relocate_section): Add
11456 reloc_symbol_changes parameter.
11457 (Target_x86_64::do_calls_non_split): New function.
11458 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11459 parameter.
11460 * powerpc.cc (Target_powerpc::relocate_section): Add
11461 reloc_symbol_changes parameter.
11462 * sparc.cc (Target_sparc::relocate_section): Add
11463 reloc_symbol_changes parameter.
11464 * configure.ac: Call AM_CONDITIONAL for the default target.
11465 * configure: Rebuild.
11466 * testsuite/Makefile.am (TEST_AS): New variable.
11467 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11468 (check_DATA): Add split_i386 and split_x86_64 files.
11469 (SPLIT_DEFSYMS): Define.
11470 (split_i386_[1234n].o): New targets.
11471 (split_i386_[124]): New targets.
11472 (split_i386_[1234r].stdout): New targets.
11473 (split_x86_64_[1234n].o): New targets.
11474 (split_x86_64_[124]): New targets.
11475 (split_x86_64_[1234r].stdout): New targets.
11476 (MOSTLYCLEANFILES): Add new executables.
11477 * testsuite/split_i386.sh: New file.
11478 * testsuite/split_x86_64.sh: New file.
11479 * testsuite/split_i386_1.s: New file.
11480 * testsuite/split_i386_2.s: New file.
11481 * testsuite/split_i386_3.s: New file.
11482 * testsuite/split_i386_4.s: New file.
11483 * testsuite/split_i386_n.s: New file.
11484 * testsuite/split_x86_64_1.s: New file.
11485 * testsuite/split_x86_64_2.s: New file.
11486 * testsuite/split_x86_64_3.s: New file.
11487 * testsuite/split_x86_64_4.s: New file.
11488 * testsuite/split_x86_64_n.s: New file.
11489 * testsuite/testfile.cc (Target_test): Update relocation_section
11490 function.
11491 * testsuite/Makefile.in: Rebuild.
11492
11493 2009-10-06 Ian Lance Taylor <iant@google.com>
11494
11495 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11496 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11497 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11498 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11499 the address on ldo_addrs_.
11500 (Target_i386::Relocate::fix_up_ldo): New function.
11501
11502 2009-10-06 Rafael Espindola <espindola@google.com>
11503
11504 * plugin.cc (add_input_library): New.
11505 (Plugin::load): Add add_input_library to tv.
11506 (Plugin_manager::add_input_file): Add the is_lib argument.
11507 (add_input_file): Update call to Plugin_manager::add_input_file.
11508 (add_input_library): New.
11509 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11510
11511 2009-09-30 Doug Kwan <dougkwan@google.com>
11512
11513 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11514 symbol and call Symbol::may_need_copy_reloc to determine if
11515 a copy reloc is needed.
11516 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11517 nocopyreloc is given in command line.
11518 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11519 given in command line.
11520 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11521 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11522 of the removed Target_i386::may_need_copy_reloc.
11523 * options.h (copyreloc): New option with default value false.
11524 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11525 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11526 instead of the removed Target_powerpc::may_need_copy_reloc.
11527 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11528 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11529 instead of the removed Target_sparc::may_need_copy_reloc.
11530 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11531 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11532 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11533 instead of the removed Target_x86_64::may_need_copy_reloc.
11534
11535 2009-09-30 Ian Lance Taylor <iant@google.com>
11536
11537 * object.h (class Object): Remove target_ field, and target,
11538 sized_target, and set_target methods.
11539 (Object::sized_target): Remove.
11540 (class Sized_relobj): Update declarations. Remove sized_target.
11541 * object.cc (Sized_relobj::setup): Remove target parameter.
11542 Change all callers.
11543 (Input_objects::add_object): Don't do anything with the target.
11544 (make_elf_sized_object): Add punconfigured parameter. Change all
11545 callers. Set or test parameter target.
11546 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11547 Change all callers.
11548 * parameters.cc (Parameters::set_target): Change parameter type to
11549 be non-const.
11550 (Parameters::default_target): Remove.
11551 (set_parameters_target): Change parameter type to be non-const.
11552 (parameters_force_valid_target): New function.
11553 (parameters_clear_target): New function.
11554 * parameters.h (class Parameters): Update declarations. Remove
11555 default_target method. Add sized_target and clear_target
11556 methods. Change target_ to be non-const.
11557 (set_parameters_target): Update declaration.
11558 (parameters_force_valid_target): Declare.
11559 (parameters_clear_target): Declare.
11560 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11561 as NULL if we aren't searching.
11562 (Add_symbols::run): Don't check for compatible target.
11563 * fileread.cc (Input_file::open_binary): Call
11564 parameters_force_valid_target.
11565 * gold.cc (queue_middle_tasks): Likewise.
11566 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11567 set_target on object.
11568 * dynobj.h (class Sized_dynobj): Update declarations.
11569 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11570 make_elf_object returns NULL.
11571 (Archive::include_member): Don't check whether object target is
11572 compatible.
11573 * output.cc (Output_section::add_input_section): Get target from
11574 parameters.
11575 (Output_section::relax_input_section): Likewise.
11576 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11577 parameters.
11578 (Sized_relobj::do_scan_relocs): Likewise.
11579 (Sized_relobj::relocate_sections): Likewise.
11580 * resolve.cc (Symbol_table::resolve): Likewise.
11581 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11582 parameter. Change all callers.
11583 (Symbol_table::add_from_object): Get target from parameters.
11584 (Symbol_table::add_from_relobj): Don't check object target.
11585 (Symbol_table::add_from_dynobj): Likewise.
11586 (Symbol_table::define_special_symbol): Get target from
11587 parameters.
11588 * symtab.h (class Symbol_table): Update declaration.
11589 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11590 parameter. Change all callers. Clear parameter target.
11591 (Binary_test): Test target here.
11592 * testsuite/object_unittest.cc (gold_testsuite): Remove
11593 target_test_pointer parameter. Change all callers.
11594 (Object_test): Test target here.
11595
11596 2009-09-26 Ian Lance Taylor <iant@google.com>
11597
11598 * testsuite/initpri1.c: Don't try to use constructor priorities if
11599 compiling with gcc before 4.3.
11600
11601 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11602
11603 * testsuite/retain_symbols_file_test.sh (check_present): Change
11604 output file name to retain_symbols_file_test.stdout.
11605 (check_absent): Likewise.
11606
11607 2009-09-18 Craig Silverstein <csilvers@google.com>
11608
11609 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11610 * options.cc: Include <cerrno> and <fstream>.
11611 (General_options::finalize): Parse -retain-symbols-file tag.
11612 * options.h: New flag.
11613 (General_options): New method should_retain_symbol, new
11614 variable symbols_to_retain.
11615 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11616 should_retain_symbol map.
11617 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11618 * testsuite/Makefile.in: Regenerate.
11619 * testsuite/retain_symbols_file_test.sh: New file.
11620
11621 2009-09-18 Nick Clifton <nickc@redhat.com>
11622
11623 * po/es.po: Updated Spanish translation.
11624
11625 2009-09-17 Doug Kwan <dougkwan@google.com>
11626
11627 * debug.h (DEBUG_RELAXATION): New constant.
11628 (DEBUG_ALL): Add DEBUG_RELAXATION.
11629 (debug_string_to_enum): Add relaxation debug option.
11630 * layout.cc
11631 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11632 Layout::Relaxation_debug_check::read_sections,
11633 Layout::Relaxation_debug_check::read_sections): New method definitions.
11634 (Layout::Layout): Initialize data members
11635 record_output_section_data_from_scrips_,
11636 script_output_section_data_list_ and relaxation_debug_check_.
11637 (Layout::save_segments, Layout::restore_segments,
11638 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11639 Layout::relaxation_loop_body): New method definitions.
11640 (Layout::finalize): Support relaxation. Move section layout code to
11641 Layout::relaxation_loop_body.
11642 (Layout::set_asection_address_from_script): Move code for orphan
11643 section placement out.
11644 (Layout::place_orphan_sections_in_script): New method definition.
11645 * layout.h (Output_segment_headers, Output_file_header):
11646 New forward class declarations.
11647 (Layout::~Layout): Define.
11648 (Layout::new_output_section_data_from_script): New method definition.
11649 (Layout::place_orphan_sections_in_script): New method declaration.
11650 (Layout::Segment_states): New type declaration.
11651 (Layout::save_segments, Layout::restore_segments,
11652 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11653 Layout::relaxation_loop_body): New method declarations.
11654 (Layout::Output_section_data_list): New type declaration.
11655 (Layout::Relaxation_debug_check): New class definition.
11656 (Layout::record_output_section_data_from_script_,
11657 Layout::script_output_section_data_list_, Layout::segment_states_,
11658 Layout::relaxation_debug_check_): New data members.
11659 * output.cc: (Output_section_headers::do_size): New method definition.
11660 (Output_section_headers::Output_section_headers): Move size
11661 computation to Output_section_headers::do_size.
11662 (Output_segment_headers::do_size): New method definition.
11663 (Output_file_header::Output_file_header): Move size computation to
11664 Output_file_header::do_size and call it.
11665 (Output_file_header::do_size): New method definition.
11666 (Output_data_group::Output_data_group): Adjust call to
11667 Output_section_data.
11668 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11669 (Output_symtab_xindex::do_write): Add array bound check.
11670 (Output_section::Input_section::print_to_mapfile): Handle
11671 RELAXED_INPUT_SECTION_CODE.
11672 (Output_section::Output_section): Initialize data member checkpoint_.
11673 (Output_section::~Output_section): Delete checkpoint object pointed
11674 by checkpoint_.
11675 (Output_section::add_input_section): Always add an Input_section if
11676 relaxing.
11677 (Output_section::add_merge_input_section): Add assert.
11678 (Output_section::relax_input_section): New method definition.
11679 (Output_section::set_final_data_size): Set load address to zero for
11680 an unallocated section.
11681 (Output_section::do_address_and_file_offset_have_reset_values):
11682 New method definition.
11683 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11684 Handle relaxed input section.
11685 (Output_section::sort_attached_input_sections): Checkpoint input
11686 section list lazily.
11687 (Output_section::get_input_sections): Change type of input_sections to
11688 list of Simple_input_section pointers. Checkpoint input section list
11689 lazily. Also handle relaxed input sections.
11690 (Output_section::add_input_section_for_script): Take a reference to
11691 a Simple_input_section object instead of Relobj pointer and section
11692 index as parameter. Handle relaxed input sections.
11693 (Output_section::save_states, Output_section::restore_states): New
11694 method definitions.
11695 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11696 (Output_data::is_data_size_fixed): New method definition.
11697 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11698 if it is fixed.
11699 (Output_data::address_and_file_offset_have_reset_values): New method
11700 definition.
11701 (Output_data::do_address_and_file_offset_have_reset_values): New method
11702 definition.
11703 (Output_data::set_data_size): Check that data size is not fixed.
11704 (Output_data::fix_data_size): New method definition.
11705 (Output_data::is_data_size_fixed_): New data member.
11706 (Output_section_headers::set_final_data_size): New method definition.
11707 (Output_section_headers::do_size): New method declaration.
11708 (Output_segment_headers::set_final_data_size): New method definition.
11709 (Output_segment_headers::do_size): New method declaration.
11710 (Output_file_header::set_final_data_size)::New method definition.
11711 (Output_file_header::do_size)::New method declaration.
11712 (Output_section_data::Output_section_data): Add new parameter
11713 is_data_size_fixed and use it to fix data size.
11714 (Output_data_const::Output_data_const): Adjust call to base class
11715 constructor and fix data size.
11716 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11717 base class constructor and fix data size.
11718 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11719 base class constructor and fix data size.
11720 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11721 class constructor and fix data size.
11722 (Output_data_group::set_final_data_size): New method definition.
11723 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11724 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11725 class constructor and fix data size.
11726 (Output_relaxed_input_section): New class definition.
11727 (Output_section::Simple_input_section): New class definition.
11728 (Output_section::get_input_sections): Adjust parameter list.
11729 (Output_section::add_input_section_for_script): Same.
11730 (Output_section::save_states, Output_section::restore_states,
11731 Output_section::do_address_and_file_offset_have_reset_values,
11732 (Output_section::Input_section::Input_section): Handle
11733 RELAXED_INPUT_SECTION_CODE. Add new overload for
11734 Output_relaxed_input_section.
11735 (Output_section::Input_section::is_input_section,
11736 Output_section::Input_section::set_output_section): Handle relaxed
11737 input section.
11738 (Output_section::Input_section::is_relaxed_input_section,
11739 Output_section::Input_section::output_section_data,
11740 Output_section::Input_section::relaxed_input_section): New method
11741 definitions.
11742 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11743 value.
11744 (Output_section::Input_section::u1_): Update comments.
11745 (Output_section::Input_section::u2_): Add new union member poris.
11746 (Output_section::Checkpoint_output_section): New classs definition.
11747 (Output_section::relax_input_section): New method declaration.
11748 (Output_section::checkpoint_): New data member.
11749 (Output_segment): Update comments.
11750 (Output_segment::Output_segment): Un-privatize copy constructor.
11751 (Output_segment::operator=): Un-privatize.
11752 * script-sections.cc (Output_section_element::Input_section_list):
11753 Change element type to Output_section::Simple_input_section.
11754 (Output_section_element_dot_assignment::set_section_addresses):
11755 Register output section data for relaxation clean up.
11756 (Output_data_exression::Output_data_expression): Adjust call to base
11757 constructor to fix data size.
11758 (Output_section_element_data::set_section_addresses): Register
11759 Output_data_expression object for relaxation clean up.
11760 (struct Input_section_info): Replace Relobj pointer and section index
11761 pair with Output_section::Simple_input_section and Convert struct to a
11762 class.
11763 (Input_section_sorter::operator()): Adjust access to
11764 Input_section_info data member to use accessors.
11765 (Output_section_element_input::set_section_addresses): Use layout
11766 parameter. Adjust code to use Output_section::Simple_input_section
11767 and Input_secction_info classes. Register filler for relaxation
11768 clean up.
11769 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11770 and section index pair with Output_section::Simple_input_section
11771 class. Adjust code accordingly.
11772 (Phdrs_element::release_segment): New method definition.
11773 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11774 segment list.
11775 (Script_sections::release_segments): New method definition.
11776 * gold/script-sections.h (Script_sections::release_segments): New
11777 method declaration.
11778 * gold/target.h (Target::may_relax, Target::relax,
11779 Target::do_may_relax, Target::do_relax): New method definitions.
11780
11781 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11782
11783 * arm.cc (has_signed_unsigned_overflow): New function.
11784 (Arm_relocate_functions::abs8): New function.
11785 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11786 (Target_arm::Scan::global): Likewise.
11787 (Target_arm::relocate::relocate): Likewise.
11788 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11789 Likewise.
11790
11791 2009-09-16 Cary Coutant <ccoutant@google.com>
11792
11793 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11794 * testsuite/Makefile.in: Regenerate.
11795
11796 2009-09-11 Nick Clifton <nickc@redhat.com>
11797
11798 * po/gold.pot: Updated by the Translation project.
11799
11800 2009-09-08 Cary Coutant <ccoutant@google.com>
11801
11802 * output.cc (Output_file::open): Add execute permission to empty file.
11803 * testsuite/Makefile.am (permission_test): New test.
11804 * testsuite/Makefile.in: Regenerate.
11805
11806 2009-09-02 Ian Lance Taylor <iant@google.com>
11807
11808 * output.cc (Output_file::resize): Call map_no_anonymous rather
11809 than map.
11810
11811 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11812
11813 * gold.cc: Include "incremental.h".
11814 (queue_initial_tasks): Call Incremental_checker methods.
11815 * incremental.cc: Include "output.h".
11816 (Incremental_checker::can_incrementally_link_output_file): New
11817 method.
11818 * incremental.h (Incremental_checker): New class.
11819
11820 * output.cc (Output_file::open_for_modification): New method.
11821 (Output_file::map_anonymous): Changed return type to bool. Record
11822 map in base_ field.
11823 (Output_file::map_no_anonymous): New method, broken out of map.
11824 (Output_file::map): Use map_no_anonymous and map_anonymous.
11825 * output.h (class Output_file): Update declarations.
11826
11827 2009-08-24 Cary Coutant <ccoutant@google.com>
11828
11829 * options.h (Command_line::Pre_options): New class.
11830 (Command_line::pre_options): New member.
11831 * options.cc (gold::options::ready_to_register): New variable.
11832 (One_option::register_option): Do nothing if not registering options.
11833 Assert if same short option registered twice.
11834 (General_options::General_options): Turn off option registration when
11835 done constructing.
11836 (Command_line::Pre_options::Pre_options): New constructor.
11837
11838 2009-08-24 Cary Coutant <ccoutant@google.com>
11839
11840 * options.h (General_options::no_keep_memory): Remove incorrect
11841 short option.
11842
11843 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11844
11845 * Makefile.am (am__skiplex, am__skipyacc): New.
11846 * Makefile.in: Regenerate.
11847
11848 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11849
11850 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11851 (INCLUDES): ... this.
11852 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11853 (AM_CPPFLAGS): Renamed from ...
11854 (INCLUDE): ... this.
11855 * Makefile.in, testsuite/Makefile.in: Regenerate.
11856
11857 * Makefile.in: Regenerate.
11858 * aclocal.m4: Likewise.
11859 * config.in: Likewise.
11860 * configure: Likewise.
11861 * testsuite/Makefile.in: Likewise.
11862
11863 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11864 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11865 * Makefile.in: Regenerate.
11866 * testsuite/Makefile.in: Regenerate.
11867
11868 2009-08-19 Cary Coutant <ccoutant@google.com>
11869
11870 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11871 symbols in shared libraries overridden by hidden or internal symbols
11872 in the main program.
11873
11874 2009-08-19 Chris Demetriou <cgd@google.com>
11875
11876 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11877 checking source file names in error messages.
11878
11879 2009-08-18 Doug Kwan <dougkwan@google.com>
11880
11881 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11882 an elcpp::Ehdr as parameter. Adjust call to set_target.
11883 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11884 an elfcpp::Ehdr as parameter.
11885 * object.cc (Object::set_target): Remove the version that looks up
11886 a target and sets it.
11887 (Sized_relobj::setup): Take a Target object instead of
11888 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11889 (make_elf_sized_object): Find target and ask target to
11890 make an ELF object.
11891 * object.h: (Object::set_target): Remove the version that looks up
11892 a target and sets it.
11893 (Sized_relobj::setup): Take a Target object instead of
11894 an elfcpp:Ehdr as parameter.
11895 * target.cc: Include dynobj.h.
11896 (Target::do_make_elf_object_implementation): New.
11897 (Target::do_make_elf_object): New.
11898 * target.h (Target::make_elf_object): New template declaration.
11899 (Target::do_make_elf_object): New method declarations.
11900 (Target::do_make_elf_object_implementation): New template declaration.
11901
11902 2009-08-14 Ian Lance Taylor <iant@google.com>
11903
11904 * gold.h (FUNCTION_NAME): Define.
11905 (gold_unreachable): Use FUNCTION_NAME.
11906
11907 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11908
11909 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11910 symbol in the --keep-unique list is not found.
11911
11912 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11913
11914 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11915 been maked as --keep-unique.
11916 (Icf::unfold_section): New function.
11917 * icf.h (Icf::unfold_section): New function.
11918 * options.h (General_options::keep_unique): New option.
11919 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11920 * testsuite/Makefile.in: Regenerate.
11921 * testsuite/icf_keep_unique_test.sh: New file.
11922 * testsuite/icf_keep_unique_test.cc: New file.
11923
11924 2009-08-12 Cary Coutant <ccoutant@google.com>
11925
11926 PR 10471
11927 * resolve.cc (Symbol_table::resolve): Check for references from
11928 dynamic objects to hidden and internal symbols.
11929 * testsuite/Makefile.am (hidden_test.sh): New test.
11930 * testsuite/Makefile.in: Regenerate.
11931 * testsuite/hidden_test.sh: New script.
11932 * testsuite/hidden_test_1.c: New test source.
11933 * testsuite/hidden_test_main.c: New test source.
11934
11935 2009-08-11 Doug Kwan <dougkwan@google.com>
11936
11937 * arm.cc: Update comments.
11938 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11939 segment to locate the .ARM.exidx section if present.
11940
11941 2009-08-09 Doug Kwan <dougkwan@google.com>
11942
11943 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11944 patch.
11945
11946 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11947 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11948 compiler warnings.
11949
11950 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11951
11952 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11953 valid tls_segment only for non-debug-section relocations.
11954 * testsuite/Makefile.am: Add gc_tls_test.
11955 * testsuite/Makefile.in: Regenerate.
11956 * testsuite/gc_tls_test.cc: New file.
11957 * testsuite/gc_tls_test.sh: New file.
11958
11959 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11960
11961 * icf.cc: New file.
11962 * icf.h: New file.
11963 * Makefile.am (CCFILES): Add icf.cc.
11964 (HFILES): Add icf.h
11965 * Makefile.in: Regenerate.
11966 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11967 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11968 section, symbol and addend information for the relocs.
11969 * gold.cc (queue_middle_tasks): Call identical code folding.
11970 * gold.h: Add defines for multimap.
11971 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11972 to the call of finalize_local_symbols.
11973 * main.cc (main): Create object of class Icf.
11974 * object.cc (Sized_relobj::do_layout): Allow this function to be
11975 called twice during icf.
11976 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11977 to sections marked as identical by icf.
11978 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11979 when available.
11980 (Sized_relobj::do_section_entsize): New function.
11981 * object.h (Object::section_entsize): New function.
11982 (Object::do_section_entsize): New pure virtual function.
11983 (Relobj::finalize_local_symbols): Add new parameter.
11984 (Relobj::do_section_entsize): New function.
11985 * options.h (General_options::icf): New option.
11986 (General_options::icf_iterations): New option.
11987 (General_options::print_icf_sections): New option.
11988 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11989 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11990 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11991 icf.
11992 * symtab.cc (Symbol_table::is_section_folded): New function.
11993 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11994 to sections marked as identical by icf.
11995 * symtab.h (Symbol_table::set_icf): New function.
11996 (Symbol_table::icf): New function.
11997 (Symbol_table::is_section_folded): New function.
11998 (Symbol_table::icf_): New data member.
11999 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12000 * testsuite/Makefile.am: Add commands to build icf_test.
12001 * testsuite/Makefile.in: Regenerate.
12002 * testsuite/icf_test.sh: New file.
12003 * testsuite/icf_test.cc: New file.
12004
12005 2009-07-24 Chris Demetriou <cgd@google.com>
12006
12007 * layout.cc (is_compressible_debug_section): Fix incorrect
12008 comment about compressed section names.
12009
12010 2009-07-20 Ian Lance Taylor <ian@airs.com>
12011
12012 PR 10419
12013 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12014
12015 2009-07-16 Ian Lance Taylor <iant@google.com>
12016
12017 PR 10400
12018 * layout.h: #include <map>.
12019 (class Kept_section): Change from struct to class. Add accessors
12020 and setters. Add section size to Comdat_group mapping. Change
12021 Comdat_group to std::map. Add is_comdat_ field. Add
12022 linkonce_size field in union.
12023 (class Layout): Update declaration of find_or_add_kept_section.
12024 Don't declare find_kept_object.
12025 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12026 parameter. Add object, shndx, is_comdat, and is_group_name
12027 parameters. Change all callers. Adjust for new Kept_section.
12028 (Layout::find_kept_object): Remove.
12029 * object.cc (Sized_relobj::include_section_group): Update use of
12030 Kept_section. Rename secnum to shndx. Only record
12031 Kept_comdat_section if sections are the same size.
12032 (Sized_relobj::include_linkonce_section): Update use of
12033 Kept_section. Only record Kept_comdat_section if sections are the
12034 same size. Set size of linkonce section.
12035 (Sized_relobj::map_to_kept_section): Update call to
12036 get_kept_comdat_section.
12037 * object.h (class Sized_relobj): Rename fields in
12038 Kept_comdat_section to drop trailing underscores; change object
12039 field to Relobj*. Change Kept_comdat_section_table to store
12040 struct rather than pointer.
12041 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12042 Add kept_object and kept_shndx parameters. Change all callers.
12043 (Sized_relobj::get_kept_comdat_section): Change return type to
12044 bool. Add kept_object and kept_shndx parameters. Change all
12045 callers.
12046 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12047 Layout::find_or_add_kept_section.
12048
12049 2009-07-09 Ian Lance Taylor <iant@google.com>
12050
12051 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12052 Reserve space in the hash table.
12053
12054 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12055
12056 * fileread.cc (File_read::get_mtime): New method.
12057 * fileread.h (Timespec): New structure.
12058 (File_read::get_mtime): New method.
12059 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12060 Renamed from timestamp_nsec.
12061 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12062 Elf_Xword.
12063 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12064 timestamp_nsec.
12065 (Incremental_inputs::report_archive): Save mtime; style fix.
12066 (Incremental_inputs::report_obejct): Save mtime; style fix.
12067 (Incremental_inputs::report_script): Save mtime; style fix.
12068 (Incremental_inputs::finalize_inputs): Style fix.
12069 (Incremental_inputs::finalize): Style fix.
12070 (Incremental_inputs::create_input_section_data): Store inputs
12071 mtime.
12072 * incremental.h (Incremental_inputs::report_script): Add mtime
12073 argument.
12074 (Incremental_inputs::Input_info::Input_info): Intialize only one
12075 union member.
12076 (Incremental_inputs::Input_info::archive): Move to nameless
12077 union.
12078 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12079 (Incremental_inputs::Input_info::script): Move to nameless union.
12080 (Incremental_inputs::mtime): New field.
12081 * script.cc (read_input_script): Pass file mtime to
12082 Incremental_input.
12083 * script.h (Script_info::inputs): Style fix.
12084
12085 2009-07-01 Ian Lance Taylor <ian@airs.com>
12086
12087 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12088 instead of 32.
12089
12090 2009-06-24 Ian Lance Taylor <iant@google.com>
12091
12092 PR 10156
12093 * layout.cc (Layout::choose_output_section): If we find an
12094 existing section, update the flags.
12095 (Layout::create_notes): New function, broken out of
12096 Layout::finalize.
12097 (Layout::finalize): Don't create note sections.
12098 (Layout::create_note): Don't crash if linker script discards
12099 section.
12100 (Layout::create_gold_note): Likewise.
12101 (Layout::create_build_id): Likewise. Don't set
12102 after_input_sections on the section.
12103 (Layout::create_executable_stack_info): Remove target parameter.
12104 Change caller.
12105 * layout.h (class Layout): Declare create_notes. Update
12106 declaration of create_executable_stack_info.
12107 * gold.cc (queue_middle_tasks): Call create_notes.
12108 * output.cc (Output_section::update_flags_for_input_section): Move
12109 here from output.h. If SHF_ALLOC flag is newly set, mark address
12110 invalid.
12111 * output.h (Output_data::mark_address_invalid): New function.
12112 (class Output_section): Only declare, not define,
12113 update_flags_for_input_section. Remove set_flags.
12114
12115 2009-06-24 Ian Lance Taylor <iant@google.com>
12116
12117 * script-sections.cc (Output_section_definition::
12118 set_section_addresses): Rename shadowing local load_address to
12119 laddr.
12120
12121 2009-06-24 Ian Lance Taylor <iant@google.com>
12122
12123 PR 10244
12124 * reloc.cc (relocate_sections): Skip empty relocation sections.
12125
12126 2009-06-23 Ian Lance Taylor <iant@google.com>
12127
12128 PR 10156
12129 * layout.cc (Layout::create_note): Use choose_output_section
12130 rather than make_output_section.
12131
12132 2009-06-23 Ian Lance Taylor <iant@google.com>
12133
12134 PR 10237
12135 * options.cc (General_options::parse_V): Set printed_version_.
12136 (General_options::General_options): Initialize printed_version_.
12137 * options.h (class General_options): Add printed_version_ field.
12138 * gold.cc (queue_initial_tasks): If there are no input files,
12139 don't give a fatal error if we printed the version information.
12140 (queue_middle_tasks): If using -r with a shared object, give a
12141 fatal error rather than an ordinary error.
12142
12143 2009-06-23 Ian Lance Taylor <iant@google.com>
12144
12145 PR 10219
12146 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12147 (Layout::make_output_section): Set have_stabstr_section_ if we see
12148 a .stab*str section.
12149 (Layout::finalize): Call link_stabs_sections.
12150 (Layout::link_stabs_sections): New file.
12151 * layout.h (class Layout): Add have_stabstr_section_ field.
12152 Declare link_stabs_sections.
12153
12154 2009-06-23 Doug Kwan <dougkwan@google.com>
12155
12156 * Makefile.am (libgold_a_LIBADD): New.
12157 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12158 * Makefile.in: Regenerate.
12159 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12160 * configure: Regenerate.
12161 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12162 * fileread.cc: Include sys/state.h
12163 * gold.h: Declare memmem and strndup if found missing.
12164 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12165
12166 2009-06-23 Ian Lance Taylor <iant@google.com>
12167
12168 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12169 * configure: Rebuild.
12170
12171 2009-06-23 Ian Lance Taylor <iant@google.com>
12172
12173 PR 10147
12174 * object.cc (Object::section_contents): Don't try to get a view if
12175 the section has length zero.
12176 (Object::handle_gnu_warning_section): If the section is empty, use
12177 the name of the section as the warning.
12178
12179 2009-06-23 Ian Lance Taylor <iant@google.com>
12180
12181 PR 10133
12182 * stringpool.h (class Stringpool_template): Add optimize_ field.
12183 (Stringpool_template::set_optimize): New function.
12184 * stringpool.cc (Stringpool_template::Stringpool_template):
12185 Initialize optimize_ field.
12186 (Stringpool_template::set_string_offsets): Test local optimize
12187 fild rather than parameter.
12188 * layout.cc (Layout::Layout): Call set_optimize on the section
12189 name stringpool.
12190
12191 2009-06-22 Ian Lance Taylor <iant@google.com>
12192
12193 PR 10030
12194 * yyscript.y: Parse TARGET.
12195 * script.cc (script_set_target): New function.
12196 * script-c.h (script_set_target): Declare.
12197 * options.cc (General_options::string_to_object_format): Rename
12198 from string_to_object_format in anonymous namespace. Change
12199 callers.
12200 * options.h (class General_options): Declare
12201 string_to_object_format.
12202
12203 2009-06-22 Ian Lance Taylor <iant@google.com>
12204
12205 * script-sections.cc (Script_sections::create_segments): Don't put
12206 program headers in a PT_LOAD segment if -n or -N.
12207
12208 2009-06-22 Ian Lance Taylor <iant@google.com>
12209
12210 PR 10141
12211 * options.h (class General_options): Add -z lazy and -z now. Sort
12212 -z options into alphabetical order.
12213 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12214
12215 2009-06-21 Ian Lance Taylor <iant@google.com>
12216
12217 * layout.cc (Layout::make_output_section): Call
12218 Target::new_output_section.
12219 (Layout::attach_allocated_section_to_segment): Put large section
12220 sections in a separate load segment with the large segment flag
12221 set.
12222 (Layout::segment_precedes): Sort large data segments after other
12223 load segments.
12224 (align_file_offset): New static function.
12225 (Layout::set_segment_offsets): Use align_file_offset.
12226 * output.h (class Output_section): Add is_small_section_ and
12227 is_large_section_ fields.
12228 (Output_section::is_small_section): New function.
12229 (Output_section::set_is_small_section): New function.
12230 (Output_section::is_large_section): New function.
12231 (Output_section::set_is_large_section): New function.
12232 (Output_section::is_large_data_section): New function.
12233 (class Output_segment): Add is_large_data_segment_ field.
12234 (Output_segment::is_large_data_segment): New function.
12235 (Output_segment::set_is_large_data_segment): New function.
12236 * output.cc (Output_section::Output_section): Initialize new
12237 fields.
12238 (Output_segment::Output_segment): Likewise.
12239 (Output_segment::add_output_section): Add assertion that large
12240 data sections always go in large data segments. Force small data
12241 sections to the end of the list of data sections. Force small BSS
12242 sections to the start of the list of BSS sections. For large BSS
12243 sections to the end of the list of BSS sections.
12244 * symtab.h (class Symbol): Declare is_common_shndx.
12245 (Symbol::is_defined): Check Symbol::is_common_shndx.
12246 (Symbol::is_common): Likewise.
12247 (class Symbol_table): Define enum Commons_section_type. Update
12248 declarations. Add small_commons_ and large_commons_ fields.
12249 * symtab.cc (Symbol::is_common_shndx): New function.
12250 (Symbol_table::Symbol_table): Initialize new fields.
12251 (Symbol_table::add_from_object): Put small and large common
12252 symbols in the right list.
12253 (Symbol_table::sized_finalized_symbol): Check
12254 Symbol::is_common_shndx.
12255 (Symbol_table::sized_write_globals): Likewise.
12256 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12257 common symbol lists. Don't call do_allocate_commons_list if the
12258 list is empty.
12259 (Symbol_table::do_allocate_commons_list): Remove is_tls
12260 parameter. Add comons_section_type parameter. Change all
12261 callers. Handle small and large common symbols.
12262 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12263 Symbol::is_common_shndx.
12264 * resolve.cc (symbol_to_bits): Likewise.
12265 * target.h (Target::small_common_shndx): New function.
12266 (Target::small_common_section_flags): New function.
12267 (Target::large_common_shndx): New function.
12268 (Target::large_common_section_flags): New function.
12269 (Target::new_output_section): New function.
12270 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12271 small_common_section_flags, and large_common_section_flags
12272 fields.
12273 (Target::do_new_output_section): New virtual function.
12274 * arm.cc (Target_arm::arm_info): Initialize new fields.
12275 * i386.cc (Target_i386::i386_info): Likewise.
12276 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12277 Likewise.
12278 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12279 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12280 (Target_x86_64::do_new_output_section): New function.
12281 * configure.ac: Define conditional MCMODEL_MEDIUM.
12282 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12283 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12284 (large_LDFLAGS): Define.
12285 * testsuite/large.c: New file.
12286 * testsuite/testfile.cc (Target_test::test_target_info):
12287 Initialize new fields.
12288 * configure, testsuite/Makefile.in: Rebuild.
12289
12290 2009-06-05 Doug Kwan <dougkwan@google.com>
12291
12292 * Makefile.am (CCFILES): Add target.cc.
12293 * Makefile.in: Regenerate.
12294 * i386.cc (class Target_i386): Define new virtual method to
12295 override do_is_local_label_name in parent.
12296 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12297 local symbols if --discard-locals or -X is given.
12298 * options.h (class General_options): Declare new options
12299 '--discard-locals' and '-X' for discarding locals.
12300 * target.h (class Target): Define new methods is_local_label_name.
12301 Declare new virtual method do_is_local_label_name.
12302 * target.cc: New file.
12303 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12304 (check_SCRIPTS): Add discard_locals_test.sh.
12305 (check_DATA): Add discard_local_tests.syms.
12306 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12307 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12308 * testsuite/Makefile.in: Regenerate.
12309 * testsuite/discard_locals_test.c: New file.
12310 * testsuite/discard_locals_test.sh: Same.
12311
12312 2009-06-05 Doug Kwan <dougkwan@google.com>
12313
12314 * object.cc (Sized_relobj::Sized_relobj): Initialize
12315 discarded_eh_frame_shndx_ to -1U.
12316 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12317 section.
12318 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12319 a discarded .eh_frame section.
12320 (Sized_relobj::do_finalize_local_symbols): Ditto.
12321 * object.h (class Sized_relobj): Declare new member
12322 discarded_eh_frame_shndx_.
12323 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12324 (local_labels_test.o, local_labels_test): New rules.
12325 * testsuite/Makefile.in: Regenerate.
12326
12327 2009-06-04 Doug Kwan <dougkwan@google.com>
12328
12329 * layout.cc (Layout::section_name_mapping): Add mapping for
12330 special ARM sections.
12331
12332 2009-06-03 Doug Kwan <dougkwan@google.com>
12333
12334 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12335 (utils::has_overflow): Same.
12336
12337 2009-06-03 Ian Lance Taylor <iant@google.com>
12338
12339 * layout.cc (Layout::section_name_mapping): New array, replacing
12340 Layout::linkonce_mapping.
12341 (Layout::section_name_mapping_count): New variable, replacing
12342 Layout::linkonce_mapping_count.
12343 (Layout::linkonce_output_name): Remove.
12344 (Layout::output_section_name): Rewrite.
12345 * layout.h (class Layout): Rename Linkonce_mapping to
12346 Section_name_mapping, linkonce_mapping to section_name_mapping,
12347 linkonce_mapping_count to section_name_mapping_count. Don't
12348 declare linkonce_output_name.
12349
12350 2009-06-03 Doug Kwan <dougkwan@google.com>
12351
12352 * gold/arm.cc (namespace utils): New.
12353 (Target_arm::reloc_is_non_pic): Define new method.
12354 (class Arm_relocate_functions): New.
12355 (Target_arm::Relocate::relocate): Handle relocation types used by
12356 Android.
12357
12358 2009-06-03 Ian Lance Taylor <iant@google.com>
12359
12360 * arm.cc (Target_arm::scan::global): Use || instead of |.
12361
12362 2009-06-02 Doug Kwan <dougkwan@google.com>
12363
12364 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12365 issued_non_pic_error_.
12366 (class Target_arm::Scan): Declare new method check_non_pic.
12367 Define new method symbol_needs_plt_entry.
12368 Declare new data member issued_non_pic_error_.
12369 (class Target_arm::Relocate): Declare new method
12370 should_apply_static_reloc.
12371 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12372 (Target_arm::Scan::check_non_pic): Define new method.
12373 (Target_arm::Scan::local): Handle a small subset of reloc types used
12374 by Android.
12375 (Target_arm::Scan::local): Same.
12376 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12377
12378 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12379
12380 * incremental.cc (Incremental_inputs::report_command_line): Filter
12381 out --incremental-* options.
12382
12383 2009-05-29 Doug Kwan <dougkwan@google.com>
12384
12385 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12386 template class.
12387 (class Target_arm): Update comment.
12388 (Target_arm::Target_arm): Initialize new data members GOT_,
12389 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12390 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12391 and Target_arm::rel_dyn_section.
12392 Declare new_enum Target_arm::Got_type.
12393 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12394 and DYNBSS_.
12395 Update commments for member do_dynsym_value.
12396 (Target_arm::got_size, Target_arm::plt_section,
12397 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12398 new methods inside class defintion.
12399 (Target_arm::got_section): Define new method.
12400 (Target_arm::rel_dyn_section): Same.
12401 (Output_data_plt_arm): New template class.
12402 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12403 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12404 (Output_data_plt_arm::add_entry): Same.
12405 (Output_data_plt_arm::first_plt_entry): Define new
12406 static data member for PLT instruction template.
12407 (Output_data_plt_arm::plt_entry): Same.
12408 (Output_data_plt_arm::do_write): Define new method.
12409 (Target_arm::make_plt_entry): Same.
12410 (Target_arm::do_finalize_sections): Same.
12411 (Target_arm::do_dynsym_value): Same.
12412
12413 2009-05-28 Doug Kwan <dougkwan@google.com>
12414
12415 * Makefile.am (TARGETSOURCES): Add arm.cc.
12416 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12417 * Makefile.in: Regenerate.
12418 * arm.cc: New file.
12419 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12420
12421 2009-05-26 Doug Kwan <dougkwan@google.com>
12422
12423 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12424 (General_options::check_excluded_libs): Strip off directories in
12425 archive name before matching like GNU ld does.
12426 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12427 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12428 (exclude_libs_test_LDFLAGS): Add linker option
12429 -Wl,--exclude-libs,libexclude_libs_test_3
12430 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12431 an explicit archive without using -l.
12432 (alt/libexclude_libs_test_3.a): New make rule.
12433 * testsuite/Makefile.in: Regenerate.
12434 * testsuite/exclude_libs_test.c : Declare lib3_default().
12435 (main): Call it.
12436 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12437 * exclude_libs_test_3.c: New file.
12438
12439 2009-05-26 Nick Clifton <nickc@redhat.com>
12440
12441 * po/id.po: New Indonesian translation.
12442 * po/gold.pot: Updated template file.
12443
12444 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12445
12446 * testsuite/Makefile.am: Add -ffunction-sections to compile
12447 gc_comdat_test files. Add -Wl,--gc-sections to build
12448 gc_comdat_test.
12449 * testsuite/Makefile.in: Regenerate.
12450 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12451
12452 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12453
12454 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12455 kept comdat section was garbage collected.
12456 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12457 * testsuite/Makefile.in: Regenerate.
12458 * testsuite/gc_comdat_test.sh: New file.
12459 * testsuite/gc_comdat_test_1.cc: New file.
12460 * testsuite/gc_comdat_test_2.cc: New file.
12461
12462 2009-05-19 Doug Kwan <dougkwan@google.com>
12463
12464 * archive.cc (Archive::Archive): Move constructor from archive.h
12465 to here. Initialize no_export_.
12466 (Archive::get_elf_object_for_member): Set no_export flag of object.
12467 * archive.h (Archive::Archive): Move constructor body to
12468 archive.cc.
12469 (Archive::no_export): New method.
12470 (Archive::no_export_): New field.
12471 * object.h (Object::Object): Initialize no_export_ to false.
12472 (Object::no_export, Object::set_no_export): New methods.
12473 (Object::no_export_): New field.
12474 * options.cc (General_options::parse_exclude_libs): New method.
12475 (General_options::check_excluded_libs) Same.
12476 * options.h (exclude_libs): New option.
12477 (General_options::check_excluded_libs): New method declaration.
12478 (General_options::excluded_libs_): New field.
12479 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12480 default or protected visibility if an object has no-export flag set.
12481 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12482 (check_SCRIPTS): Add exclude_libs_test.sh.
12483 (check_DATA): Add exclude_libs_test.syms.
12484 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12485 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12486 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12487 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12488 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12489 libexclude_libs_test_2.a): New rules.
12490 * testsuite/Makefile.in: Regenerate.
12491 * testsuite/exclude_libs_test.c: New file.
12492 * testsuite/exclude_libs_test.sh: Ditto.
12493 * testsuite/exclude_libs_test_1.c: Ditto.
12494 * testsuite/exclude_libs_test_2.c: Ditto.
12495
12496 2009-05-15 Ian Lance Taylor <iant@google.com>
12497
12498 * configure.ac: Check for declarations for cases where libiberty.h
12499 checks HAVE_DECL_xxx.
12500 * configure, config.in: Rebuild.
12501
12502 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12503
12504 * gold.h (Incremental_argument_list): Remove (invalid) forward
12505 declaration.
12506 * incremental.cc (Incremental_inputs::report_achive): New method.
12507 (Incremental_inputs::report_object): New method.
12508 (Incremental_inputs::report_script): New method.
12509 (Incremental_inputs::finalize_inputs): New method.
12510 (Incremental_inputs::finalize): Call finalize_inputs().
12511 (Incremental_inputs::sized_create_incremental_inputs_section_data):
12512 Create inputs entries.
12513 * incremental.h (Incremental_input_type): New enum.
12514 (Incremental_inputs::Incremental_input): Initialize new fields.
12515 (Incremental_inputs::report_inputs): New method.
12516 (Incremental_inputs::report_achive): New method.
12517 (Incremental_inputs::report_object): New method.
12518 (Incremental_inputs::report_script): New method.
12519 (Incremental_inputs::finalize_inputs): New method.
12520 (Incremental_inputs::Input_info): New struct.
12521 (Incremental_inputs::Input_info_map): New typedef.
12522 (Incremental_inputs::lock_): New field.
12523 (Incremental_inputs::Inputs_): New field.
12524 (Incremental_inputs::Inputs_map): New field.
12525 * main.cc (main): Call Incremental_input::report_inputs.
12526 * options.h (Input_argument_list): Typedef moved from
12527 Input_arguments.
12528 (Input_file_group::Files): Remove, use ::Input_argument_list.
12529 (Input_file_group::Input_argument_list): Remove, use
12530 ::Input_argument_list.
12531 * plugin.cc (Plugin_manager::add_input_file): Add error in
12532 incremental build.
12533 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12534 functions.
12535 * script.cc (read_input_script): Call
12536 Incremental_input::report_script.
12537 * script.h (Script_info): New class.
12538
12539 2009-04-27 Ian Lance Taylor <iant@google.com>
12540
12541 * x86_64.cc (do_adjust_output_section): Set entsize to
12542 plt_entry_size.
12543
12544 2009-04-23 Elliott Hughes <enh@google.com>
12545
12546 * output.cc (Output_file::close): After short writes, continue
12547 writing from the correct offset in the buffer being written.
12548
12549 2009-04-23 Chris Demetriou <cgd@google.com>
12550
12551 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12552 * configure: Regenerate.
12553 * config.in: Regenerate.
12554 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12555 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12556
12557 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12558
12559 * incremental.cc (Incremental_inputs_header_data): Renamed from
12560 Incremental_input_header_data.
12561 (Incremental_inputs_header_data::data_size): New field.
12562 (Incremental_inputs_header_data::put_input_file_count): Renamed
12563 from input_file_count.
12564 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12565 from command_line_offset.
12566 (Incremental_inputs_header_data::put_reserved): Renamed from
12567 put_reserved.
12568 (Incremental_inputs_entry_data): Renamed from
12569 Incremental_input_entry_data.
12570 (Incremental_inputs_entry_data::data_size): New field.
12571 (Incremental_inputs::report_command_line): New method.
12572 (Incremental_inputs::finalize): New method.
12573 (Incremental_inputs::create_incremental_inputs_data): New method.
12574 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12575 * incremental.h: New file.
12576 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12577 (Layout::finalize): Create incremental inputs section in
12578 incremental builds.
12579 (Layout::create_incremental_info_sections): New method.
12580 * layout.h (Layout::incremental_inputs): New method.
12581 (Layout::create_incremental_info_sections): New method.
12582 (Layout::incremental_inputs_): New field.
12583 * main.cc (main): Notify Incremental_input of the command line.
12584
12585 2009-04-01 Ian Lance Taylor <iant@google.com>
12586 Mikolaj Zalewski <mikolajz@google.com>
12587
12588 * gold.h (reserve_unordered_map): Define, three versions, one for
12589 each version of Unordered_map.
12590 * layout.cc (Layout::Layout): Remove options parameter. Add
12591 number_of_input_files parameter. Don't initialize options_.
12592 Initialize number_of_input_files_ and resized_signatures_. Move
12593 sections_are_attached_.
12594 (Layout::layout_group): Reserve space for group_signatures_.
12595 (Layout::find_or_add_kept_section): Change name parameter to be a
12596 reference. Resize signatures_ map when it gets large enough.
12597 (Layout::layout_eh_frame): Use parameters->options() instead of
12598 this->options_.
12599 (Layout::make_output_section): Likewise.
12600 (Layout::attach_allocated_section_to_segment): Likewise.
12601 (Layout::finalize, Layout::create_executable_stack): Likewise.
12602 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12603 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12604 * layout.h (class Layout): Update declarations. Remove options_
12605 field. Add number_of_input_files_ and resized_signatures_
12606 fields. Move sections_are_attached_ field.
12607 * main.cc (main): Pass number of input files to Layout
12608 constructor. Don't pass options.
12609
12610 2009-03-30 Ian Lance Taylor <iant@google.com>
12611
12612 * ffsll.c (ffsll): Correct implementation.
12613
12614 2009-03-27 Ian Lance Taylor <iant@google.com>
12615
12616 * ffsll.c: New file.
12617 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12618 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12619 * ftruncate.c (ftruncate): Declare before definition.
12620 * mremap.c (mremap): Likewise.
12621 * pread.c (pread): Likewise.
12622 * configure, Makefile.in, config.in: Rebuild.
12623
12624 * mremap.c: New file.
12625 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12626 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12627 (mremap): Declare if HAVE_MREMAP is not defined.
12628 * configure, Makefile.in, config.in: Rebuild.
12629
12630 2009-03-27 Cary Coutant <ccoutant@google.com>
12631
12632 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12633 position independent.
12634 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12635 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12636
12637 2009-03-24 Cary Coutant <ccoutant@google.com>
12638
12639 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12640 an executable.
12641 (needs_dynamic_reloc): Likewise.
12642
12643 2009-03-24 Ian Lance Taylor <iant@google.com>
12644
12645 * yyscript.y (file_cmd): Recognize EXTERN.
12646 (extern_name_list, extern_name_list_body): New nonterminals.
12647 * script.cc (script_add_extern): Define.
12648 * script-c.h (script_add_extern): Declare.
12649
12650 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12651
12652 * object.cc (is_elf_object): Define.
12653 * object.h (is_elf_object): Declare.
12654 * archive.cc (Archive::get_elf_object_for_member): Call
12655 is_elf_object.
12656 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12657
12658 2009-03-24 Elliott Hughes <enh@google.com>
12659
12660 * output.cc (Output_file::map_anonymous): Define.
12661 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12662 try an anonymous one. Report the size if the mmap fails.
12663 * output.h (class Output_file): Declare map_anonymous.
12664
12665 2009-03-24 Ian Lance Taylor <iant@google.com>
12666
12667 * target-select.cc (instantiate_target): Don't acquire the lock if
12668 the instantiated_target_ field has already been set.
12669
12670 2009-03-23 Ian Lance Taylor <iant@google.com>
12671
12672 * gold-threads.h (class Initialize_lock): Define.
12673 * gold-threads.cc (class Initialize_lock_once): Define.
12674 (initialize_lock_control): New static variable.
12675 (initialize_lock_pointer): New static variable.
12676 (initialize_lock_once): New static function.
12677 (Initialize_lock::Initialize_lock): Define.
12678 (Initialize_lock::initialize): Define.
12679 * target-select.h: Include "gold-threads.h".
12680 (class Target_selector): Add lock_ and initialize_lock_ fields.
12681 Don't define instantiate_target, just declare it.
12682 * target-select.cc (Target_selector::Target_selector): Initialize
12683 new fields.
12684 (Target_selector::instantiate_target): Define.
12685 * descriptors.h: Include "gold-threads.h".
12686 (class Descriptors): Add initialize_lock_ field.
12687 * descriptors.cc (Descriptors::Descriptors): Initialize new
12688 field.
12689 (Descriptors::open): Use initialize_lock_ field
12690 * errors.h (class Errors): Add initialize_lock_ field.
12691 * errors.cc (Errors::Errors): Initialize new field.
12692 (Errors::initialize_lock): Use initialize_lock_ field.
12693 * powerpc.cc (class Target_selector_powerpc): Remove
12694 instantiated_target_ field. In do_recognize call
12695 instantiate_target rather than do_instantiate_target. In
12696 do_instantiate_target just allocate a new target.
12697 * sparc.cc (class Target_selector_sparc): Likewise.
12698
12699 * freebsd.h: New file.
12700 * i386.cc: Include "freebsd.h".
12701 (Target_i386): Derive from Target_freebsd rather than
12702 Sized_target.
12703 (Target_selector_i386): Derive from Target_selector_freebsd rather
12704 than Target_selector.
12705 * x86_64.cc: Include "freebsd.h".
12706 (Target_x86_64): Derive from Target_freebsd rather than
12707 Sized_target.
12708 (Target_selector_x86_64): Derive from Target_selector_freebsd
12709 rather than Target_selector.
12710 * target.h (class Target): Add adjust_elf_header and
12711 do_adjust_elf_header.
12712 * output.cc (Output_file_header:: do_sized_write): Call target
12713 adjust_elf_header routine.
12714 * configure.tgt: Set targ_osabi.
12715 * configure.ac: Define GOLD_DEFAULT_OSABI.
12716 * parameters.cc (Parameters::default_target): Pass
12717 GOLD_DEFAULT_OSABI to select_target.
12718 * target-select.h (class Target_selector): Make instantiate_target
12719 protected rather than private.
12720 * Makefile.am (HFILES): Add freebsd.h.
12721 * configure, Makefile.in, config.in: Rebuild.
12722
12723 * merge.cc (do_add_input_section): Correct pend value. Change
12724 message about last entry not being null terminated from error to
12725 warning.
12726
12727 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12728
12729 * incremental.cc: New file.
12730 * Makefile.am (CCFILES): Add incremental.cc.
12731 * Makefile.in: Rebuild.
12732
12733 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12734
12735 * layout.cc (Layout::output_section_name): Preserve names
12736 of '.note.' sections.
12737
12738 2009-03-19 Ian Lance Taylor <iant@google.com>
12739
12740 * descriptors.cc (Descriptors::open): Check that the options are
12741 valid before using them.
12742
12743 2009-03-18 Ian Lance Taylor <iant@google.com>
12744
12745 * script-sections.h: Include <list>.
12746 (class Script_sections): Change Sections_elements from std::vector
12747 to std::list. Typedef public Elements_iterator. Add
12748 orphan_section_placement_, data_segment_align_start_, and
12749 saw_data_segment_align_ fields. Remove data_segment_align_index_
12750 field.
12751 * script-sections.cc (class Orphan_section_placement): New class.
12752 (class Sections_element): Add virtual functions is_relro and
12753 orphan_section_init. Remove virtual function place_orphan_here.
12754 (class Output_section_definition): Add is_relro and
12755 orphan_section_init. Remove place_orphan_here.
12756 (class Orphan_output_section): Likewise.
12757 (Script_sections::Script_sections): Update for field changes.
12758 (Script_sections::data_segment_align): Set saw_data_segment_align_
12759 and data_segment_align_start_, not data_segment_align_index.
12760 (Script_sections::data_segment_relro_end): Check
12761 saw_data_segment_align_. Use data_segment_align_start_ rather
12762 than data_segment_align_index_.
12763 (Script_sections::place_orphan): Rewrite to use
12764 Orphan_section_placement.
12765
12766 2009-03-17 Ian Lance Taylor <iant@google.com>
12767
12768 * archive.cc (Archive::add_symbols): Check for a version attached
12769 to the symbol name in the archive map.
12770 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12771 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12772 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12773 (ver_test_11.a): New target.
12774 * testsuite/Makefile.in: Rebuild.
12775
12776 * configure.ac: Check for chsize and posix_fallocate. Replace
12777 ftruncate.
12778 * ftruncate.c: New file, from gnulib.
12779 * output.cc (posix_fallocate): Define dummy version if not
12780 HAVE_POSIX_FALLOCATE.
12781 (Output_file::map): Call posix_fallocate rather than lseek and
12782 write.
12783 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12784 * configure, Makefile.in, config.in: Rebuild.
12785
12786 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12787
12788 * layout.h (Layout::create_note): Add section_name parameter.
12789 * layout.cc (Layout::create_note): Likewise.
12790 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12791
12792 2009-03-17 Ian Lance Taylor <iant@google.com>
12793
12794 * descriptors.cc: Include "options.h".
12795 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12796 (Descriptors::open): Always use O_CLOEXEC when opening a new
12797 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12798 then set FD_CLOEXEC.
12799
12800 * sparc.cc (class Target_sparc): Add has_got_section.
12801 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12802 make sure we have a GOT section.
12803
12804 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12805 (Target_sparc::Scan::local): Likewise.
12806 (Target_sparc::Scan::global): Likewise.
12807 (Target_sparc::Relocate::relocate): Likewise.
12808 (Target_sparc::Relocate::relocate_tls): Likewise.
12809
12810 * symtab.cc (Symbol_table::define_default_version): New function,
12811 broken out of add_from_object.
12812 (Symbol_table::add_from_object): Call define_default_version.
12813 (Symbol_table::define_special_symbol): Add resolve_oldsym
12814 parameter. Change all callers. If the version for a symbol comes
12815 from a version script, resolve it with the symbol with the same
12816 name with no version. Also add the symbol without a version if
12817 appropriate.
12818 (do_define_in_output_data): If resolving with oldsym, don't delete
12819 sym.
12820 (do_define_in_output_segment): Likewise.
12821 (do_define_as_constant): Likewise.
12822 * symtab.h (class Symbol_table): Update declarations.
12823
12824 2009-03-13 Ian Lance Taylor <iant@google.com>
12825
12826 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12827 (Read_symbols::requeue): New function.
12828 (Read_symbols::do_read_symbols): If make_elf_object fails because
12829 the target type is not configured, and the file was searched for,
12830 issue a warning and retry with the next directory.
12831 (Add_symbols::run): If the file has an incompatible format, and
12832 it was searched for, requeue the Read_symbols task. On error,
12833 release the object.
12834 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12835 dirindex parameter to constructor. Change all callers. Declare
12836 incompatible_warning and requeue.
12837 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12838 input_argument_ and input_group_ fields. Add them to
12839 constructor. Change all callers.
12840 (class Read_script): Add dirindex_ field. Add it to constructor.
12841 Change all callers.
12842 * archive.cc (Archive::setup): Remove input_objects parameter.
12843 Change all callers.
12844 (Archive::get_file_and_offset): Likewise.
12845 (Archive::read_all_symbols): Likewise.
12846 (Archive::read_symbols): Likewise.
12847 (Archive::get_elf_object_for_member): Remove input_objects
12848 parameter. Add punconfigured parameter. Change all callers.
12849 (Archive::add_symbols): Change return type to bool. Check return
12850 value of include_member.
12851 (Archive::include_all_members): Likewise.
12852 (Archive::include_member): Change return type to bool. Return
12853 false if first included object has incompatible target. Set
12854 included_member_ field.
12855 (Add_archive_symbols::run): If add_symbols returns false, requeue
12856 Read_symbols task.
12857 * archive.h (class Archive): Add included_member_ field.
12858 Initialize it in constructor. Add input_file and searched_for
12859 methods. Update declarations.
12860 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12861 input_argument_ fields. Add them to constructor. Change all
12862 callers.
12863 * script.cc: Include "target-select.h".
12864 (class Parser_closure): Add skip_on_incompatible_target_ and
12865 found_incompatible_target_ fields. Add
12866 skip_on_incompatible_target parameter to constructor. Change all
12867 callers. Add methods skip_on_incompatible_target,
12868 clear_skip_on_incompatible_target, found_incompatible_target, and
12869 set_found_incompatible_target.
12870 (read_input_script): Add dirindex parameter. Change all callers.
12871 If parser finds an incompatible target, requeue Read_symbols
12872 task.
12873 (script_set_symbol): Clear skip_on_incompatible_target in
12874 closure.
12875 (script_add_assertion, script_parse_option): Likewise.
12876 (script_start_sections, script_add_phdr): Likewise.
12877 (script_check_output_format): New function.
12878 * script.h (read_input_script): Update declaration.
12879 * script-c.h (script_check_output_format): Declare.
12880 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12881 (ignore_cmd): Remove OUTPUT_FORMAT.
12882 * fileread.cc (Input_file::Input_file): Add explicit this.
12883 (Input_file::will_search_for): New function.
12884 (Input_file::open): Add pindex parameter. Change all callers.
12885 * fileread.h (class Input_file): Add input_file_argument method.
12886 Declare will_search_for. Update declarations.
12887 * object.cc (make_elf_object): Add punconfigured parameter.
12888 Change all callers.
12889 * object.h (class Object): Make input_file public. Add
12890 searched_for method.
12891 (make_elf_object): Update declaration.
12892 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12893 restart search.
12894 * dirsearch.h (class Dirsearch): Update declaration.
12895 * options.h (class General_options): Add --warn-search-mismatch.
12896 * parameters.cc (Parameters::is_compatible_target): New function.
12897 * parameters.h (class Parameters): Declare is_compatible_target.
12898 * workqueue.cc (Workqueue::add_blocker): New function.
12899 * workqueue.h (class Workqueue): Declare add_blocker.
12900
12901 * fileread.cc (Input_file::open): Remove options parameter.
12902 Change all callers.
12903 (Input_file::open_binary): Likewise.
12904 * script.cc (read_input_script): Likewise.
12905 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12906 options parameter from constructor. Change all callers.
12907 (class Read_script): Likewise.
12908 * fileread.h (class Input_file): Update declarations.
12909 * script.h (read_input_script): Update declaration.
12910
12911 2009-03-10 Nick Clifton <nickc@redhat.com>
12912
12913 * po/es.po: New Spanish translation.
12914
12915 2009-03-06 Cary Coutant <ccoutant@google.com>
12916
12917 * options.cc (parse_short_option): Keep dash_z from registering itself.
12918
12919 2009-03-03 Ian Lance Taylor <iant@google.com>
12920
12921 PR 9918
12922 * target-reloc.h (relocate_section): Pass output_section to
12923 relocate.
12924 * i386.cc (Target_i386::should_apply_static_reloc): Add
12925 output_section parameter. Change all callers.
12926 (Target_i386::Relocate::relocate): Add output_section parameter.
12927 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12928 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12929 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12930 * testsuite/two_file_shared.sh: New script.
12931 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12932 (check_DATA): Add two_file_shared.dbg.
12933 (two_file_shared.dbg): New target.
12934 * testsuite/Makefile.in: Rebuild.
12935
12936 2009-03-01 Ian Lance Taylor <iant@google.com>
12937
12938 * configure.ac: Check for byteswap.h.
12939 * configure: Rebuild.
12940 * config.in: Rebuild.
12941
12942 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12943
12944 * layout.cc (Layout::find_or_add_kept_section): New function.
12945 (Layout::add_comdat): Removed.
12946 * layout.h (struct Kept_section): Move out of class Layout.
12947 Remove trailing underscores from field names. Add group_sections
12948 field. Rename group_ field to is_group. Change all uses.
12949 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12950 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12951 comdat_groups_ field.
12952 (Sized_relobj::include_section_group): Use
12953 find_or_add_kept_section and Kept_section::group_sections.
12954 (Sized_relobj::include_linkonce_section): Likewise.
12955 * object.cc (class Sized_relobj): Don't define Comdat_group or
12956 Comdat_group_table. Remove find_comdat_group and
12957 add_comdat_group. Remove comdat_groups_ field.
12958 * plugin.cc (include_comdat_group): Use
12959 Layout::find_or_add_kept_section.
12960
12961 2009-02-28 Ian Lance Taylor <iant@google.com>
12962
12963 * README: --gc-sections and map files are now supported. Document
12964 some build requirements.
12965
12966 PR 6992
12967 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12968 relocatable link set the value of the section symbol to zero.
12969 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12970 relocatable link don't include the section address in the local
12971 symbol value.
12972
12973 2009-02-27 Ian Lance Taylor <iant@google.com>
12974
12975 PR 6811
12976 * options.h (class Search_directory): Add is_system_directory.
12977 (class General_options): Declare is_in_system_directory.
12978 * options.cc (get_relative_sysroot): Make static.
12979 (get_default_sysroot): Make static.
12980 (General_optoins::is_in_system_directory): New function.
12981 * fileread.cc (Input_file::is_in_system_directory): New function.
12982 * fileread.h (class Input_file): Declare is_in_system_directory.
12983 * object.h (class Object): Add is_in_system_directory.
12984 (class Input_objects): Remove system_library_directory_ field.
12985 * object.cc (Input_objects::add_object): Don't set
12986 system_library_directory_.
12987 (input_objects::found_in_system_library_directory): Remove.
12988 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12989 parameter. Change all callers.
12990 (Symbol_table::sized_write_globals): Likewise.
12991 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12992 Call Object::is_in_system_directory.
12993 * symtab.h (class Symbol_table): Update declarations.
12994
12995 PR 5990
12996 * descriptors.h (Open_descriptor): Add is_on_stack field.
12997 * descriptors.cc (Descriptors::open): If the descriptor is on the
12998 top of the stack, remove it. Initialize is_on_stack field.
12999 (Descriptors::release): Only add pod to stack if it is not on the
13000 stack already.
13001 (Descriptors::close_some_descriptor): Clear stack_next and
13002 is_on_stack fields.
13003
13004 PR 7091
13005 * output.cc (Output_section::find_starting_output_address): Rename
13006 from starting_output_address; add PADDR parameter; change return
13007 type.
13008 * output.h (class Output_section): Declare
13009 find_starting_output_address instead of starting_output_address.
13010 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13011 section symbol for which we can't find a merge section.
13012
13013 PR 9836
13014 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13015 hidden or internal, force the symbol to be local.
13016 * resolve.cc (Symbol::override_visibility): Define.
13017 (Symbol::override_base): Use override_visibility.
13018 (Symbol_table::resolve): Likewise.
13019 (Symbol::override_base_with_special): Likewise.
13020 (Symbol_table::override_with_special): If the visibility is hidden
13021 or internal, force the symbol to be local.
13022 * symtab.h (class Symbol): Add set_visibility and
13023 override_visibility.
13024 * testsuite/ver_test_1.sh: New file.
13025 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13026 (check_DATA): Add ver_test_1.syms.
13027 (ver_test_1.syms): New target.
13028 * testsuite/Makefile.in: Rebuild.
13029
13030 2009-02-25 Cary Coutant <ccoutant@google.com>
13031
13032 * layout.cc (Layout::choose_output_section): Don't rename sections
13033 when using a linker script that has a SECTIONS clause.
13034 * Makefile.in: Regenerate.
13035
13036 * testsuite/Makefile.am (script_test_5.sh): New test case.
13037 * testsuite/Makefile.in: Regenerate.
13038 * testsuite/script_test_5.cc: New file.
13039 * testsuite/script_test_5.sh: New file.
13040 * testsuite/script_test_5.t: New file.
13041
13042 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13043
13044 * archive.cc (Archive::include_member): Update calls to add_symbols.
13045 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13046 the Layout argument.
13047 * dynobj.h (do_add_symbols): Add the Layout argument.
13048 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13049 Layout argument.
13050 * object.h (Object::add_symbols): Add the Layout argument.
13051 (Object::do_add_symbols): Add the Layout argument.
13052 (Sized_relobj::do_add_symbols): Add the Layout argument.
13053 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13054 Unify the two versions.
13055 (Add_plugin_symbols): Remove.
13056 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13057 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13058 (Add_plugin_symbols): Remove.
13059 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13060 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13061 (Add_symbols::run): Make it work with Pulginobj.
13062
13063 2009-02-06 Ian Lance Taylor <iant@google.com>
13064
13065 * object.cc (Sized_relobj::do_layout): Make info message start
13066 with lower case letter.
13067
13068 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13069
13070 * binary.cc: Fix file comment.
13071
13072 * options.h (enum Incremental_disposition): Define.
13073 (class General_options): Add new options: --incremental,
13074 --incremental_changed, --incremental_unchanged,
13075 --incremental_unknown. Add incremental_disposition_ and
13076 implicit_incremental_ fields.
13077 (General_options::incremental_disposition): New function.
13078 (class Position_dependent_options): Add incremental_disposition
13079 option.
13080 (Position_dependent_options::copy_from_options): Set incremental
13081 dispositions.
13082 * options.cc (General_options::parse_incremental_changed): New
13083 function.
13084 (General_options::parse_incremental_unchanged): New function.
13085 (General_options::parse_incremental_unknown): New function.
13086 (General_options::General_options): Initialize new fields
13087 incremental_disposition_ and implicit_incremental_.
13088 (General_options::finalize): Check for uasge of --incremental-*
13089 without --incremental.
13090
13091 2009-02-06 Chris Demetriou <cgd@google.com>
13092
13093 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13094 pointer and to report location as the file name associated with
13095 the symbol.
13096 (gold_undefined_symbol_at_location): New function to replace the
13097 old gold_undefined_symbol functionality.
13098 * target-reloc.h (relocate_section): Update to use
13099 gold_undefined_symbol_at_location.
13100 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13101 Call gold_undefined_symbol function rather than gold_error.
13102 * errors.h (Errors::undefined_symbol): Take location as a
13103 string, rather than calculating it from a relocation.
13104 * errors.cc (Errors::fatal): Print "fatal error:" before the
13105 formatted message.
13106 (Errors::error, Errors::error_at_location): Print "error: "
13107 before the formatted message.
13108 (Errors::undefined_symbol): Take location as a string, rather
13109 than calculating it from a relocation.
13110 (gold_undefined_symbol_at_location): New function akin to
13111 old gold_undefined_symbol, calculates location from relocation.
13112 (gold_undefined_symbol): Change to take only a Symbol pointer
13113 and to report location as the file name associated with the symbol.
13114 * testsuite/debug_msg.sh: Update for changed error messages.
13115 * testsuite/undef_symbol.sh: Likewise.
13116
13117 2009-02-04 Duncan Sands <baldrick@free.fr>
13118
13119 PR 9812
13120 * reduced_debug_output.h
13121 (Output_reduced_debug_abbrev_section::failed): Use format for
13122 gold_warning.
13123 (Output_reduced_debug_info_section::faild): Likewise.
13124
13125 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13126
13127 * script.cc (Lazy_demangler): New class.
13128 (Version_script_info::get_symbol_version_helper): Demangle a
13129 symbol only once.
13130
13131 2009-01-29 Cary Coutant <ccoutant@google.com>
13132
13133 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13134 to __tls_get_addr.
13135 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13136
13137 2009-01-28 Ian Lance Taylor <iant@google.com>
13138
13139 * version.cc (version_string): Bump to 1.9.
13140
13141 * gold.h: Include <cstring> and <stdint.h>.
13142 * version.cc: Include <cstdio>.
13143 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13144 warning.
13145 * reduced_debug_output.cc (insert_into_vector): Rename from
13146 Insert_into_vector; change all callers. Use Swap_unaligned to
13147 avoid aliasing issue; remove union since it is unnecessary.
13148
13149 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13150
13151 * Makefile.am (CCFILES): Add gc.cc.
13152 (HFILES): Add gc.h.
13153 * Makefile.in: Regenerate.
13154 * gold.cc (Gc_runner): New class.
13155 (queue_initial_tasks): Call garbage collection related tasks
13156 when corresponding options are invoked.
13157 (queue_middle_gc_tasks): New function.
13158 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13159 processed early before laying out sections during garbage collection.
13160 * gold.h (queue_middle_gc_tasks): New function.
13161 (is_prefix_of): Move from "layout.cc".
13162 * i386.cc (Target_i386::gc_process_relocs): New function.
13163 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13164 * main.cc (main): Create object of class "Garbage_collection".
13165 * object.cc (Relobj::copy_symbols_data): New function.
13166 (Relobj::is_section_name_included): New function.
13167 (Sized_relobj::do_layout): Allow this function to be called twice
13168 during garbage collection and defer layout of section during the
13169 first call.
13170 * object.h (Relobj::get_symbols_data): New function.
13171 (Relobj::is_section_name_included): New function.
13172 (Relobj::copy_symbols_data): New function.
13173 (Relobj::set_symbols_data): New function.
13174 (Relobj::get_relocs_data): New function.
13175 (Relobj::set_relocs_data): New function.
13176 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13177 (Relobj::gc_process_relocs): New function.
13178 (Relobj::do_gc_process_relocs): New pure virtual function.
13179 (Relobj::sd_): New data member.
13180 (Sized_relobj::is_output_section_offset_invalid): New function.
13181 (Sized_relobj::do_gc_process_relocs): New function.
13182 * options.h (General_options::gc_sections): Modify to not be a no-op.
13183 (General_options::print_gc_sections): New option.
13184 * plugin.cc (Plugin_finish::run): Remove function call to
13185 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13186 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13187 * reloc.cc (Read_relocs::run): Add task to process relocs and
13188 determine unreferenced sections when doing garbage collection.
13189 (Gc_process_relocs): New class.
13190 (Sized_relobj::do_gc_process_relocs): New function.
13191 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13192 sections that are garbage collected.
13193 * reloc.h (Gc_process_relocs): New class.
13194 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13195 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13196 symbols whose corresponding sections are garbage collected.
13197 (Symbol_table::Symbol_table): Add new parameter for the garbage
13198 collection object.
13199 (Symbol_table::gc_mark_undef_symbols): New function.
13200 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13201 (Symbol_table::gc_mark_dyn_syms): New function.
13202 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13203 as garbage.
13204 (Symbol_table::add_from_object): Likewise.
13205 (Symbol_table::add_from_relobj): When building shared objects, do not
13206 treat externally visible symbols as garbage.
13207 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13208 table information for static and relocatable links.
13209 * symtab.h (Symbol_table::set_gc): New function.
13210 (Symbol_table::gc): New function.
13211 (Symbol_table::gc_mark_undef_symbols): New function.
13212 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13213 (Symbol_table::gc_mark_dyn_syms): New function.
13214 (Symbol_table::gc_): New data member.
13215 * target.h (Sized_target::gc_process_relocs): New pure virtual
13216 function.
13217 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13218 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13219
13220 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13221
13222 * options.h (General_options::gc_sections): Define as a no-op for now.
13223 (General_options::no_keep_memory): Ditto.
13224 (General_options::Bshareable): Define.
13225 * options.cc (General_options::finalize): Honor -Bshareable.
13226
13227 2009-01-20 Andreas Schwab <schwab@suse.de>
13228
13229 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13230 read the value in the contents, since we don't use it. Use the
13231 template endianness when writing.
13232 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13233
13234 2009-01-19 Andreas Schwab <schwab@suse.de>
13235
13236 * configure.tgt (powerpc64-*): Fix targ_obj.
13237
13238 2009-01-15 Ian Lance Taylor <iant@google.com>
13239
13240 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13241 local symbols when stripping all symbols.
13242
13243 2009-01-14 Cary Coutant <ccoutant@google.com>
13244
13245 * output.cc (Output_reloc): Add explicit instantiations.
13246
13247 2009-01-14 Cary Coutant <ccoutant@google.com>
13248
13249 * archive.cc (Archive::get_elf_object_for_member): Remove call
13250 to File_read::claim_for_plugin.
13251 * descriptors.cc (Descriptors::open): Remove reference to
13252 is_claimed.
13253 (Descriptors::claim_for_plugin): Remove.
13254 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13255 (Descriptors::is_claimed): Remove.
13256 (claim_descriptor_for_plugin): Remove.
13257 * fileread.cc (File_read::claim_for_plugin): Remove.
13258 * fileread.h (File_read::claim_for_plugin): Remove.
13259 (File_read::descriptor): Reopen descriptor if necessary.
13260 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13261 (Plugin_manager::all_symbols_read): Add task parameter. Change
13262 all callers.
13263 (Plugin_manager::get_input_file): New function.
13264 (Plugin_manager::release_input_file): New function.
13265 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13266 corresponding data member.
13267 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13268 and pass to base constructor. Change all callers.
13269 (get_input_file, release_input_file): New functions.
13270 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13271 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13272 (Plugin_manager::all_symbols_read): Add task parameter.
13273 (Plugin_manager::get_input_file): New function.
13274 (Plugin_manager::release_input_file): New function.
13275 (Plugin_manager::task_): New data member.
13276 (Pluginobj::Pluginobj): Add filesize parameter.
13277 (Pluginobj::filename): New function.
13278 (Pluginobj::descriptor): New function.
13279 (Pluginobj::filesize): New function.
13280 (Pluginobj::filesize_): New data member.
13281 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13282 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13283 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13284
13285 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13286 with archive libraries.
13287 * testsuite/Makefile.in: Regenerate.
13288 * testsuite/plugin_test.c (struct sym_info): New type.
13289 (get_input_file, release_input_file): New static variables.
13290 (onload): Capture new transfer vector entries.
13291 (claim_file_hook): Stop reading at end of file according to filesize.
13292 Factor out parsing of readelf output into separate function.
13293 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13294 APIs and get the source file name from the symbol table. Convert
13295 source file name to corresponding object file name. Print info
13296 message when adding new input files.
13297 (parse_readelf_line): New function.
13298 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13299 * testsuite/plugin_test_2.sh: Likewise.
13300 * testsuite/plugin_test_3.sh: Likewise.
13301 * testsuite/plugin_test_4.sh: New test case.
13302
13303 2009-01-07 Ian Lance Taylor <iant@google.com>
13304
13305 * version.cc (version_string): Bump to 1.8.
13306
13307 2008-12-23 Cary Coutant <ccoutant@google.com>
13308
13309 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13310 * plugin.cc (Plugin_manager::finish): Rename as
13311 layout_deferred_objects. Move cleanup to separate function.
13312 (Plugin_manager::cleanup): New function.
13313 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13314 separately.
13315 * plugin.h (Plugin_manager::finish): Rename as
13316 layout_deferred_objects.
13317 (Plugin_manager::cleanup): New function.
13318 (Plugin_manager::cleanup_done): New field.
13319
13320 2008-12-23 Cary Coutant <ccoutant@google.com>
13321
13322 * plugin.cc (is_visible_from_outside): New function.
13323 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13324 so we don't return "IR only" status for exported symbols or -r links.
13325
13326 * testsuite/Makefile.am (plugin_test_3): New test case.
13327 * testsuite/Makefile.in: Regenerate.
13328 * testsuite/plugin_test_3.sh: New file.
13329
13330 2008-12-22 Cary Coutant <ccoutant@google.com>
13331
13332 * object.cc (Sized_relobj::layout_section): New function.
13333 (Sized_relobj::do_layout): Defer layout of input sections until after
13334 plugin has provided replacement files.
13335 (Sized_relobj::do_layout_deferred_sections): New function.
13336 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13337 (Relobj::layout_deferred_sections): New function.
13338 (Relobj::do_layout_deferred_sections): New function.
13339 (Sized_relobj::do_layout_deferred_sections): New function.
13340 (Sized_relobj::layout_section): New function.
13341 (Sized_relobj::Deferred_layout): New structure.
13342 (Sized_relobj::deferred_layout_): New field.
13343 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13344 Change all callers. Layout deferred sections.
13345 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13346 references.
13347 (Plugin_hook::run): Move code from do_plugin_hook inline.
13348 (Plugin_hook::do_plugin_hook): Remove.
13349 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13350 (Plugin_manager::finish): Renamed, was cleanup.
13351 (Plugin_manager::should_defer_layout): New function.
13352 (Plugin_manager::add_deferred_layout_object): New function.
13353 (Plugin_manager::Deferred_layout_list): New type.
13354 (Plugin_manager::deferred_layout_objects_): New field.
13355 (Plugin_hook::do_plugin_hook): Remove.
13356
13357 2008-12-17 Ian Lance Taylor <iant@google.com>
13358
13359 * options.h (class General_options): Add --no case for
13360 --export-dynamic.
13361
13362 2008-12-16 Cary Coutant <ccoutant@google.com>
13363
13364 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13365 vector.
13366 (Plugin_manager::claim_file): Create plugin object even if
13367 plugin did not call the add_symbols callback.
13368 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13369 asking for more symbols than were added.
13370 * testsuite/Makefile.am (plugin_test_1): Add test case with
13371 no global symbols.
13372 (empty.syms): New target.
13373 * testsuite/Makefile.in: Regenerate.
13374 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13375 message. Don't call add_symbols if no globals.
13376 (all_symbols_read_hook): Don't provide replacement for empty
13377 claimed file.
13378
13379 2008-12-12 Ian Lance Taylor <iant@google.com>
13380
13381 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13382 r_type == 0 for a local symbol with r_sym == 0.
13383 (scan_relocatable_relocs): Pass r_sym to
13384 local_non_section_strategy.
13385 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13386 r_sym parameter.
13387
13388 * configure.ac: Update test for TLS descriptors: they are
13389 supported as of glibc 2.9.
13390 * configure: Rebuild.
13391
13392 2008-12-11 Ian Lance Taylor <iant@google.com>
13393
13394 PR 7091
13395 * target-reloc.h (Default_scan_relocatable_relocs): For each
13396 function, map r_type == 0 to RELOC_DISCARD.
13397
13398 2008-12-10 Cary Coutant <ccoutant@google.com>
13399
13400 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13401 object to override a kept COMDAT group from a plugin object.
13402
13403 2008-12-09 Ian Lance Taylor <iant@google.com>
13404
13405 PR 7088
13406 * yyscript.y (file_cmd): Handle INPUT.
13407
13408 * testsuite/initpri1.c: Change all declarations to be full
13409 prototypes by adding void, to avoid compiler warnings.
13410
13411 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13412
13413 * options.cc (General_options::parse_plugin_opt): New.
13414 (General_options::add_plugin): The argument now is just the filename.
13415 (General_options::add_plugin_option): New.
13416 * options.h (plugin_opt): New.
13417 (add_plugin): Change argument name.
13418 (add_plugin_option): New.
13419 * plugin.cc (Plugin::load): Don't parse the plugin option.
13420 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13421 (Plugin::add_option): New.
13422 (Plugin::args_): Change type.
13423 (Plugin::filename_): New.
13424 (Plugin_manager::add_plugin_option): New.
13425 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13426 * testsuite/Makefile.in: Regenerate.
13427
13428 2008-12-05 Cary Coutant <ccoutant@google.com>
13429
13430 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13431 Handle --strip-lto-sections option.
13432 * options.h (strip_lto_sections): New option.
13433
13434 2008-12-01 Cary Coutant <ccoutant@google.com>
13435
13436 * plugin.cc (ld_plugin_message): Change format parameter to const.
13437 Fix mismatch between new[] and delete.
13438
13439 2008-11-14 Cary Coutant <ccoutant@google.com>
13440
13441 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13442 instead of -1U.
13443
13444 2008-11-05 Craig Silverstein <csilvers@google.com>
13445
13446 * options.cc (General_options::parse_dynamic_list): New function.
13447 * options.h (General_options): New flags dynamic_list,
13448 dynamic_list_data, dynamic_list_cpp_new, and
13449 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13450 (General_options::in_dynamic_list): New function.
13451 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13452 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13453 (Lex::can_continue_name): Likewise.
13454 (yylex): Likewise.
13455 (read_script_file): New parameter script_options.
13456 (read_dynamic_list): New function.
13457 (Script_options::define_dynamic_list): New function.
13458 (dynamic_list_keyword_parsecodes): New variable.
13459 (dynamic_list_keywords): New variable.
13460 * script.h (Script_options::define_dynamic_list): New function
13461 prototype.
13462 (read_dynamic_list): New function prototype.
13463 * symtab.cc (strprefix): New macro.
13464 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13465 dynamic_list_data, dynamic_list_cpp_new, and
13466 dynamic_list_cpp_typeinfo.
13467 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13468 (dynamic_list_expr): New rule.
13469 (dynamic_list_nodes): Likewise.
13470 (dynamic_list_node): Likewise.
13471 * testsuite/Makefile.am (dynamic_list): New test.
13472 * testsuite/Makefile.in: Regenerated.
13473 * testsuite/dynamic_list.t: New file.
13474 * testsuite/dynamic_list.sh: New file.
13475
13476 2008-11-05 Craig Silverstein <csilvers@google.com>
13477
13478 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13479 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13480 (t11_last): Likewise.
13481 * testsuite/ver_test_6.c (main): Likewise.
13482
13483 2008-10-07 Cary Coutant <ccoutant@google.com>
13484
13485 * options.c (General_options::finalize): Add check for -static and
13486 -shared.
13487 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13488 is not empty.
13489
13490 2008-10-02 Cary Coutant <ccoutant@google.com>
13491
13492 * plugin.cc (make_sized_plugin_object): Fix conditional
13493 compilation to work when not all targets are enabled.
13494
13495 2008-09-29 Cary Coutant <ccoutant@google.com>
13496
13497 * archive.cc (Archive::get_file_and_offset): Use filename instead
13498 of name to get library path.
13499 (Archive::include_member): Unlock external member of a thin archive.
13500
13501 * testsuite/Makefile.am (TEST_AR): New variable.
13502 (thin_archive_test_1): New test.
13503 (thin_archive_test_2): New test.
13504 * testsuite/Makefile.in: Regenerate.
13505 * testsuite/thin_archive_main.cc: New file.
13506 * testsuite/thin_archive_test_1.cc: New file.
13507 * testsuite/thin_archive_test_2.cc: New file.
13508 * testsuite/thin_archive_test_3.cc: New file.
13509 * testsuite/thin_archive_test_4.cc: New file.
13510
13511 2008-09-29 Cary Coutant <ccoutant@google.com>
13512
13513 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13514 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13515 instead of -1U.
13516 (Sized_relobj::do_finalize_local_symbols): Likewise.
13517 (Sized_relobj::map_to_kept_section): Likewise.
13518 * object.h (Sized_relobj::invalid_address): New constant.
13519 (Sized_relobj::do_output_section_offset): Check for invalid_address
13520 and return -1ULL.
13521 * output.cc (Output_reloc::local_section_offset): Use constant
13522 invalid_address instead of -1U.
13523 (Output_reloc::get_address): Likewise.
13524 (Output_section::output_address): Change -1U to -1ULL.
13525 * output.h (Output_reloc::invalid_address): New constant.
13526 * reloc.cc (Sized_relobj::write_sections): Use constant
13527 invalid_address instead of -1U.
13528 (Sized_relobj::relocate_sections): Likewise.
13529 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13530 values for merge sections.
13531 * target-reloc.h (relocate_for_relocatable): Use constant
13532 invalid_address instead of -1U.
13533
13534 2008-09-19 Cary Coutant <ccoutant@google.com>
13535
13536 Add plugin functionality for link-time optimization (LTO).
13537 * configure.ac (plugins): Add --enable-plugins option.
13538 * configure: Regenerate.
13539 * config.in: Regenerate.
13540 * Makefile.am (LIBDL): New variable.
13541 (CCFILES): Add plugin.cc.
13542 (HFILES): Add plugin.h.
13543 (ldadd_var): Add LIBDL.
13544 * Makefile.in: Regenerate.
13545
13546 * archive.cc: Include "plugin.h".
13547 (Archive::setup): Don't preread archive symbols when using a plugin.
13548 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13549 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13550 files.
13551 (Archive::include_member): Add symbols from plugin objects.
13552 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13553 * descriptors.cc (Descriptors::open): Check for file descriptors
13554 abandoned by plugins.
13555 (Descriptors::claim_for_plugin): New function.
13556 * descriptors.h (Descriptors::claim_for_plugin): New function.
13557 (Open_descriptor::is_claimed): New field.
13558 (claim_descriptor_for_plugin): New function.
13559 * fileread.cc (File_read::claim_for_plugin): New function.
13560 * fileread.h (File_read::claim_for_plugin): New function.
13561 (File_read::descriptor): New function.
13562 * gold.cc: Include "plugin.h".
13563 (queue_initial_tasks): Add task to call plugin hooks for generating
13564 new object files.
13565 * main.cc: Include "plugin.h".
13566 (main): Load plugin libraries.
13567 * object.h (Pluginobj): Declare.
13568 (Object::pluginobj): New function.
13569 (Object::do_pluginobj): New function.
13570 (Object::set_target): New function.
13571 * options.cc: Include "plugin.h".
13572 (General_options::parse_plugin): New function.
13573 (General_options::General_options): Initialize plugins_ field.
13574 (General_options::add_plugin): New function.
13575 * options.h (Plugin_manager): Declare.
13576 (General_options): Add --plugin option.
13577 (General_options::has_plugins): New function.
13578 (General_options::plugins): New function.
13579 (General_options::add_plugin): New function.
13580 (General_options::plugins_): New field.
13581 * plugin.cc: New file.
13582 * plugin.h: New file.
13583 * readsyms.cc: Include "plugin.h".
13584 (Read_symbols::do_read_symbols): Check for archive before checking
13585 for ELF file. Call plugin hooks to claim files.
13586 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13587 from a real object file; force override when processing replacement
13588 files.
13589 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13590 (Symbol::init_base_object): Likewise.
13591 (Symbol::init_base_output_data): Likewise.
13592 (Symbol::init_base_output_segment): Likewise.
13593 (Symbol::init_base_constant): Likewise.
13594 (Symbol::init_base_undefined): Likewise.
13595 (Symbol::output_section): Assert that object is not a plugin.
13596 (Symbol_table::add_from_pluginobj): New function.
13597 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13598 undefined.
13599 (Symbol_table::sized_write_globals): Likewise.
13600 (Symbol_table::add_from_pluginobj): Instantiate template.
13601 * symtab.h (Sized_pluginobj): Declare.
13602 (Symbol::in_real_elf): New function.
13603 (Symbol::set_in_real_elf): New function.
13604 (Symbol::in_real_elf_): New field.
13605 (Symbol_table::add_from_pluginobj): New function.
13606
13607 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13608 (LIBDL): New variable.
13609 (LDADD): Add LIBDL.
13610 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13611 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13612 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13613 (MOSTLYCLEANFILES): Likewise.
13614 * testsuite/Makefile.in: Regenerate.
13615 * testsuite/plugin_test.c: New file.
13616 * testsuite/plugin_test_1.sh: New file.
13617 * testsuite/plugin_test_2.sh: New file.
13618
13619 2008-09-16 Ian Lance Taylor <iant@google.com>
13620
13621 * target-reloc.h (relocate_section): Check whether a symbol is
13622 defined by the ABI before reporting an undefined symbol error.
13623 * target.h (Target::is_defined_by_abi): Make parameter const.
13624 (Target::do_is_defined_by_abi): Likewise.
13625 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13626 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13627 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13628 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13629 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13630 * testsuite/Makefile.in: Rebuild.
13631
13632 * fileread.cc (make_view): Add casts to avoid warning.
13633
13634 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13635
13636 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13637 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13638
13639 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13640
13641 * options.h (General_options::output_is_executable): New.
13642 (General_options::output_is_pie): New.
13643 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13644 for shared libraries.
13645 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13646
13647 2008-09-11 Chris Demetriou <cgd@google.com>
13648
13649 * options.h (origin): New -z option.
13650 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13651 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13652 in DT_FLAGS_1.
13653
13654 2008-09-05 Cary Coutant <ccoutant@google.com>
13655
13656 * fileread.cc (File_read::make_view): Add check for attempt to map
13657 beyond end of file.
13658
13659 2008-09-05 Cary Coutant <ccoutant@google.com>
13660
13661 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13662 explicit instantiations.
13663
13664 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13665
13666 PR gold/6858
13667 * options.cc (General_options::finalize): Allow undefined symbols
13668 in shlibs if linking -shared.
13669
13670 PR gold/6859
13671 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13672 symbols as not needing a dynsym entry.
13673
13674 2008-08-20 Craig Silverstein <csilvers@google.com>
13675
13676 * fileread.cc (File_read::open): Do not lock the file unless it
13677 was successfully opened.
13678
13679 2008-08-14 Cary Coutant <ccoutant@google.com>
13680
13681 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13682 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13683 * testsuite/tls_test.cc (struct int128): 128-bit struct
13684 for testing TLS relocs with non-zero addend.
13685 (v12): New TLS variable.
13686 (t12): New test.
13687 (t_last): Add check for v12.
13688 * testsuite/tls_test.h (t12): New function.
13689 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13690
13691 2008-08-13 Ian Lance Taylor <iant@google.com>
13692
13693 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13694 set tls_segment_ or relro_segment_.
13695 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13696 when appropriate.
13697 * output.h (Output_section::clear_is_relro): New function.
13698 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13699 sections specially even when output_data_ is empty.
13700 (Output_segment::maximum_alignment): When first section is relro,
13701 only force alignment for PT_LOAD segments.
13702 * script.cc (script_data_segment_align): New function.
13703 (script_data_segment_relro_end): New function.
13704 * script-c.h (script_data_segment_align): Declare.
13705 (script_data_segment_relro_end): Declare.
13706 * script-sections.h (class Script_sections): Declare
13707 data_segment_align and data_segment_relro_end. Add fields
13708 segment_align_index_ and saw_relro_end_.
13709 * script-sections.cc (class Sections_element): Add set_is_relro
13710 virtual function. Add new bool* parameter to place_orphan_here.
13711 Add get_output_section virtual function.
13712 (class Output_section_definition): Add set_is_relro. Add new
13713 bool* parameter to place_orphan_here. Add get_output_section.
13714 Add is_relro_ field.
13715 (Output_section_definition::Output_section_definition): Initialize
13716 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13717 and is_relro_ fields.
13718 (Output_section_definition::place_orphan_here): Add is_relro
13719 parameter.
13720 (Output_section_definition::set_section_addresses): Set relro for
13721 output section.
13722 (Output_section_definition::alternate_constraint): Likewise.
13723 (class Orphan_output_section): Add new bool* parameter to
13724 place_orphan_here. Add get_output_section.
13725 (Orphan_output_section::place_orphan_here): Add is_relro
13726 parameter.
13727 (Script_sections::Script_sections): Initialize
13728 data_segment_align_index_ and saw_relro_end_.
13729 (Script_sections::data_segment_align): New function.
13730 (Script_sections::data_segment_relro_end): New function.
13731 (Script_sections::place_orphan): Set or clear is_relro.
13732 (Script_sections::set_section_addresses): Force alignment of first
13733 TLS section.
13734 * yyscript.y (exp): Call script_data_segment_align and
13735 script_data_segment_relro_end.
13736 * testsuite/relro_script_test.t: New file.
13737 * testsuite/relro_test.cc (using_script): Declare.
13738 (t1, t2): Test using_script.
13739 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13740 (relro_script_test_SOURCES): Define.
13741 (relro_script_test_DEPENDENCIES): Define.
13742 (relro_script_test_LDFLAGS): Define.
13743 (relro_script_test_LDADD): Define.
13744 (relro_script_test.so): New target.
13745 * testsuite/Makefile.in: Rebuild.
13746
13747 2008-08-06 Cary Coutant <ccoutant@google.com>
13748
13749 * archive.cc (Archive::total_archives, Archive::total_members)
13750 (Archive::total_members_loaded): New variables.
13751 (Archive::setup): Add parameter. Add option to preread
13752 archive symbols.
13753 (Archive::read_armap): Add counter.
13754 (Archive::get_file_and_offset): New function.
13755 (Archive::get_elf_object_for_member): New function.
13756 (Archive::read_all_symbols): New function.
13757 (Archive::read_symbols): New function.
13758 (Archive::add_symbols): Add counters.
13759 (Archive::include_all_members): Use armap to find members if it's
13760 already built.
13761 (Archive::include_member): Skip reading symbols if already read.
13762 Factored code into Archive::get_file_and_offset and
13763 Archive::get_elf_object_for_member. Changed call to
13764 Mapfile::report_include_archive_member.
13765 (Archive::print_stats): New function.
13766 * archive.h: Declare Object and Read_symbols_data classes.
13767 (Archive::Archive): Add initializers for new members.
13768 (Archive::setup): Add parameter.
13769 (Archive::print_stats): New function.
13770 (Archive::total_archives, Archive::total_members)
13771 (Archive::total_members_loaded): New variables.
13772 (Archive::get_file_and_offset): New function.
13773 (Archive::get_elf_object_for_member): New function.
13774 (Archive::read_all_symbols): New function.
13775 (Archive::read_symbols): New function.
13776 (Archive::Archive_member): New class.
13777 (Archive::members_): New member.
13778 (Archive::num_members_): New member.
13779 * main.cc: Include archive.h.
13780 (main): Call Archive::print_stats.
13781 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13782 archive parameter; member_name is now the fully-decorated name.
13783 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13784 * options.h: (General_options): Add --preread-archive-symbols option.
13785 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13786 Archive::setup.
13787
13788 2008-08-04 Ian Lance Taylor <iant@google.com>
13789
13790 * symtab.h (Symbol::use_plt_offset): New function.
13791 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13792 * powerpc.cc (Relocate::relocate): Likewise.
13793 * sparc.cc (Relocate::relocate): Likewise.
13794 * x86_64.cc (Relocate::relocate): Likewise.
13795 * testsuite/weak_plt.sh: New test.
13796 * testsuite/weak_plt_main.cc: New test.
13797 * testsuite/weak_plt_shared.cc: New test.
13798 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13799 (check_PROGRAMS): Add weak_plt.
13800 (check_DATA): Add weak_plt_shared.so.
13801 (weak_plt_main_pic.o, weak_plt): New targets.
13802 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13803 * testsuite/Makefile.in: Rebuild.
13804
13805 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13806 gcctestdir/ld.
13807 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13808 * testsuite/Makefile.in: Rebuild.
13809
13810 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13811
13812 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13813 * Makefile.in: Regenerate.
13814 * po/POTFILES.in: Regenerate.
13815
13816 2008-07-29 Ian Lance Taylor <iant@google.com>
13817
13818 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13819 symbols before other symbols.
13820 * testsuite/script_test_2.cc (test_addr): Declare.
13821 (test_addr_alias): Declare.
13822 (main): Check that test_addr and test_addr_alias have the right
13823 values.
13824 * testsuite/script_test_2.t: Define test_addr_alias and
13825 test_addr.
13826
13827 2008-07-24 Ian Lance Taylor <iant@google.com>
13828
13829 PR 5990
13830 * descriptors.cc: New file.
13831 * descriptors.h: New file.
13832 * gold-threads.h (class Hold_optional_lock): New class.
13833 * fileread.cc: Include "descriptors.h".
13834 (File_read::~File_read): Release descriptor rather than closing
13835 it.
13836 (File_read::open) [file]: Call open_descriptor rather than open.
13837 Set is_descriptor_opened_.
13838 (File_read::open) [memory]: Assert that descriptor is not open.
13839 (File_read::reopen_descriptor): New function.
13840 (File_read::release): Release descriptor.
13841 (File_read::do_read): Make non-const. Reopen descriptor.
13842 (File_read::read): Make non-const.
13843 (File_read::make_view): Reopen descriptor.
13844 (File_read::do_readv): Likewise.
13845 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13846 Update declarations.
13847 * layout.cc: Include "descriptors.h".
13848 (Layout::create_build_id): Use open_descriptor rather than open.
13849 * output.cc: Include "descriptors.h".
13850 (Output_file::open): Use open_descriptor rather than open.
13851 * archive.cc (Archive::const_iterator): Change Archive to be
13852 non-const.
13853 (Archive::begin, Archive::end): Make non-const.
13854 (Archive::count_members): Likewise.
13855 * archive.h (class Archive): Update declarations.
13856 * object.h (Object::read): Make non-const.
13857 * Makefile.am (CCFILES): Add descriptors.cc.
13858 (HFILES): Add descriptors.h.
13859 * Makefile.in: Rebuild.
13860
13861 PR 6716
13862 * gold.h: Always include <clocale>. Add Solaris workarounds
13863 following code in binutils/sysdep.h.
13864
13865 PR 6048
13866 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13867 this->eh_frame_hdr_ is NULL before using it.
13868
13869 * dynobj.cc (Versions::Versions): Update comment.
13870
13871 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13872 the base version name.
13873
13874 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13875 array size plus one.
13876 (Stringpool_template::set_string_offsets): Subtract one from key
13877 before using it as an array index.
13878 (Stringpool_template::get_offset_with_length): Likewise.
13879 (Stringpool_template::write_to_buffer): Likewise.
13880 * stringpool.h (Stringpool_template::get_offset_from_key):
13881 Likewise.
13882
13883 2008-07-23 Ian Lance Taylor <iant@google.com>
13884
13885 PR 6658
13886 * object.h (Merged_symbol_value::value): Do our best to handle a
13887 negative addend.
13888
13889 PR 6647
13890 * script.cc (Version_script_info::get_versions): Don't add empty
13891 version tag to return value.
13892 (Version_script_info::get_symbol_version_helper): Change return
13893 type to bool. Add pversion parameter. Change all callers.
13894 (script_register_vers_node): Don't require a non-NULL tag.
13895 * script.h (class Version_script_info): Update declarations.
13896 (Version_script_info::get_symbol_version): Change return type to
13897 bool. Add version parameter. Change all callers.
13898 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13899 handling. Handle an empty version from a version script.
13900 (Symbol_table::define_special_symbol): Likewise.
13901 * testsuite/ver_test_10.script: New file.
13902 * testsuite/ver_test_10.sh: New file.
13903 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13904 (check_DATA): Add ver_test_10.syms.
13905 (ver_test_10.syms, ver_test_10.so): New target.
13906 * testsuite/Makefile.in: Rebuild.
13907
13908 2008-07-23 Simon Baldwin <simonb@google.com>
13909
13910 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13911 to zero for undefined symbols from dynamic libraries.
13912
13913 2008-07-23 Ian Lance Taylor <iant@google.com>
13914
13915 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13916 Change all callers.
13917 * symtab.h (class Symbol_table): Update declaration.
13918 * testsuite/ver_test_9.cc: New file.
13919 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13920 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13921 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13922 (ver_test_9.so, ver_test_9.o): New targets.
13923 * testsuite/Makefile.in: Rebuild.
13924
13925 2008-07-22 Ian Lance Taylor <iant@google.com>
13926
13927 * options.h (class General_options): Define --check-sections.
13928 * layout.cc (Layout::set_segment_offsets): Handle
13929 --check-sections.
13930
13931 * options.h (class General_options): Define -n/--nmagic and
13932 -N/--omagic.
13933 * options.cc (General_options::finalize): For -n/--nmagic or
13934 -N/--omagic, set -static.
13935 * layout.cc (Layout::attach_allocated_section_to_segment): If
13936 -N/--omagic, don't put read-only and read-write sections in
13937 different segments.
13938 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13939 finding a read-only segment.
13940 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13941 don't set the minimum segment alignment to the common page size,
13942 and don't set the file offset to the address modulo the page size.
13943 * script-sections.cc (Script_sections::create_segments): If
13944 -n/--omagic, don't put read-only and read-write sections in
13945 different segments.
13946
13947 * cref.cc: New file.
13948 * cref.h: New file.
13949 * options.h (class General_options): Add --print-symbol-counts.
13950 * main.cc (main): Issue defined symbol report if requested.
13951 * archive.cc (Archive::interpret_header): Make into a const member
13952 function.
13953 (Archive::add_symbols): Call Input_objects::archive_start and
13954 archive_stop.
13955 (Archive::const_iterator): Define new class.
13956 (Archive::begin, Archive::end): New functions.
13957 (Archive::include_all_members): Rewrite to use iterator.
13958 (Archive::count_members): New function.
13959 * archive.h (class Archive): Update declarations.
13960 (Archive::filename): New function.
13961 * object.cc: Include "cref.h".
13962 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13963 (Sized_relobj::do_get_global_symbol_counts): New function.
13964 (Input_objects::add_object): Add object to cross-referencer.
13965 (Input_objects::archive_start): New function.
13966 (Input_objects::archive_stop): New function.
13967 (Input_objects::print_symbol_counts): New function.
13968 * object.h: Declare Cref and Archive.
13969 (Object::get_global_symbol_counts): New function.
13970 (Object::do_get_global_symbol_counts): New pure virtual function.
13971 (class Sized_relobj): Add defined_count_ field. Update
13972 declarations.
13973 (class Input_objects): Add cref_ field. Update constructor.
13974 Update declarations.
13975 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13976 defined_count_.
13977 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13978 symbol counts.
13979 (Sized_dynobj::do_get_global_symbol_counts): New function.
13980 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13981 defined_count_. Update declarations. Define Symbols typedef.
13982 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13983 parameter. Change all callers.
13984 (Symbol_table::add_from_dynobj): Add sympointers and defined
13985 parameters. Change all callers.
13986 * symtab.h (class Symbol_table): Update declarations.
13987 * Makefile.am (CCFILES): Add cref.cc.
13988 (HFILES): Add cref.h.
13989 * Makefile.in: Rebuild.
13990
13991 2008-07-22 Simon Baldwin <simonb@google.com>
13992
13993 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13994 to zero when writing undefined symbols.
13995
13996 2008-07-22 Ian Lance Taylor <iant@google.com>
13997
13998 * output.cc (Output_section::add_input_section): Don't try to
13999 merge empty merge sections.
14000
14001 2008-07-21 Craig Silverstein <csilvers@google.com>
14002
14003 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14004 Include symbol version in error message.
14005
14006 2008-07-20 Chris Demetriou <cgd@google.com>
14007
14008 * configure.ac (gold_cv_c_random_seed): New configured variable.
14009 (RANDOM_SEED_CFLAGS): New substituted variable.
14010 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14011 * configure: Rebuild.
14012 * Makefile.in: Likewise.
14013 * testsuite/Makefile.in: Likewise.
14014
14015 2008-07-18 Ian Lance Taylor <iant@google.com>
14016
14017 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14018 where we see NAME/NULL and NAME/VERSION as separate symbols.
14019 * testsuite/ver_test_main.cc (main): Call t4.
14020 (t4, t4_2a): Define.
14021 * testsuite/ver_test_2.cc (t4_2): Define.
14022 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14023 * testsuite/ver_test_4.cc (t4_2a): Define.
14024 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14025 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14026
14027 2008-07-17 Ian Lance Taylor <iant@google.com>
14028
14029 * dynobj.cc (Versions::add_def): If we give an error about a
14030 missing version, go ahead and create the version anyhow.
14031
14032 2008-07-10 Ian Lance Taylor <iant@google.com>
14033
14034 Handle output sections with more than 0x7fffffff bytes.
14035 * object.h (class Relobj): Change map_to_output_ to
14036 output_sections_, and just keep a section pointer. Change all
14037 uses. Move comdat group support to Sized_relobj.
14038 (Relobj::is_section_specially_mapped): Remove.
14039 (Relobj::output_section): Remove poff parameter. Change all
14040 callers.
14041 (Relobj::output_section_offset): New function.
14042 (Relobj::set_section_offset): Rewrite.
14043 (Relobj::map_to_output): Remove.
14044 (Relobj::output_sections): New function.
14045 (Relobj::do_output_section_offset): New pure virtual function.
14046 (Relobj::do_set_section_offset): Likewise.
14047 (class Sized_relobj): Add section_offsets_ field. Add comdat
14048 group support from Relobj. Update declarations.
14049 (Sized_relobj::get_output_section_offset): New function.
14050 (Sized_relobj::do_output_section_offset): New function.
14051 (Sized_relobj::do_set_section_offset): New function.
14052 * object.cc (Relobj::output_section_address): Remove.
14053 (Sized_relobj::Sized_relobj): Initialize new fields.
14054 (Sized_relobj::include_section_group): Cast find_kept_object to
14055 Sized_relobj.
14056 (Sized_relobj::include_linkonce_section): Likewise.
14057 (Sized_relobj::do_layout): Use separate arrays for output section
14058 and output offset.
14059 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14060 output_sections.
14061 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14062 output_sections and section_offsets.
14063 (Sized_relobj::write_local_symbols): Likewise.
14064 (map_to_kept_section): Compute output address directly.
14065 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14066 output_sections and section_offsets.
14067 (Sized_relobj::write_sections): Likewise.
14068 (Sized_relobj::relocate_sections): Likewise.
14069 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14070 * output.h (class Output_reloc): Update declarations. Change
14071 u2_.relobj to Sized_relobj*.
14072 (class Output_data_reloc): Change add functions to use
14073 Sized_relobj*.
14074 * output.cc (Output_reloc::Output_reloc): Change relobj to
14075 Sized_relobj*.
14076 (Output_reloc::local_section_offset): Change return type to
14077 Elf_Addr. Use get_output_section_offset.
14078 (Output_reloc::get_address): Likewise.
14079 (Output_section::is_input_address_mapped): Don't call
14080 is_section_specially_mapped.
14081 (Output_section::output_offset): Likewise.
14082 (Output_section::output_address): Likewise.
14083 (Output_section::starting_output_address): Likewise.
14084 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14085 parameter to Sized_relobj*.
14086 (Copy_relocs::need_copy_reloc): Likewise.
14087 (Copy_relocs::save): Likewise.
14088 * copy-relocs.h (class Copy_relocs): Update declarations.
14089 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14090 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14091 * target-reloc.h (relocate_for_relocatable): Change
14092 offset_in_output_section type to Elf_Addr. Change code that uses
14093 it as well.
14094 * layout.cc (Layout::layout): Always set *off.
14095 * mapfile.cc (Mapfile::print_input_section): Use
14096 output_section_offset.
14097 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14098 Sized_relobj*.
14099 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14100 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14101 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14102
14103 2008-07-03 Ian Lance Taylor <iant@google.com>
14104
14105 * layout.cc (Layout::include_section): Do not discard unrecognized
14106 SHT_STRTAB sections.
14107
14108 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14109
14110 * script.cc (Lex::can_continue_name): Make '?' allowable in
14111 version-script names.
14112 * testsuite/version_script.map: Change glob pattern to use '?'
14113
14114 2008-06-30 Manish Singh <yosh@gimp.org>
14115
14116 PR 6585
14117 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14118 Correct typo.
14119
14120 2008-06-30 Ian Lance Taylor <iant@google.com>
14121
14122 PR 6660
14123 PR 6682
14124 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14125 versions]: Don't try to read the value in the contents, since we
14126 don't use it. Use the template endianness when writing.
14127
14128 2008-06-25 Cary Coutant <ccoutant@google.com>
14129
14130 * fileread.cc (File_read::make_view): Assert on zero-length view.
14131 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14132 symbol table when there are no symbols to read.
14133
14134 2008-06-23 Craig Silverstein <csilvers@google.com>
14135
14136 * version.cc (version_string): Bump to 1.7
14137
14138 2008-06-18 Craig Silverstein <csilvers@google.com>
14139
14140 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14141 constant 0xFFFF to type Valtype.
14142 (Powerpc_relocate_functions::rel16_ha): Likewise.
14143
14144 2008-06-17 Ian Lance Taylor <iant@google.com>
14145
14146 * output.h (Output_section::Input_section): Initialize p2align_ to
14147 zero for Output_section_data constructors.
14148 (Output_section::Input_section::addralign): If not an input
14149 section, return the alignment of the Output_section_data.
14150 * testsuite/copy_test.cc: New file.
14151 * testsuite/copy_test_1.cc: New file.
14152 * testsuite/copy_test_2.cc: New file.
14153 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14154 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14155 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14156 (copy_test_1_pic.o, copy_test_1.so): New targets.
14157 (copy_test_2_pic.o, copy_test_2.so): New targets.
14158 * testsuite/Makefile.in: Rebuild.
14159
14160 * script-sections.cc (Script_sections::place_orphan): Initialize
14161 local variable exact.
14162
14163 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14164
14165 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14166
14167 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14168 David S. Miller <davem@davemloft.net>
14169
14170 * powerpc.cc: New file.
14171 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14172 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14173 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14174 * Makefile.in: Rebuild.
14175
14176 2008-06-09 Ian Lance Taylor <iant@google.com>
14177
14178 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14179 <exception>.
14180 (throwing, orig_terminate): New static variables.
14181 (terminate_handler): New static function.
14182 (t2): Set terminate handler.
14183
14184 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14185
14186 PR 6584
14187 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14188 alignment.
14189
14190 2008-05-30 Cary Coutant <ccoutant@google.com>
14191
14192 * archive.cc (Archive::include_all_members) Correct to step
14193 over symbol table and extended name table in thin archives.
14194
14195 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14196
14197 PR 6407
14198 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14199 calculation.
14200
14201 2008-05-28 Caleb Howe <cshowe@google.com>
14202
14203 * reduced_debug_output.cc: New file.
14204 * reduced_debug_output.h: New file.
14205 * options.h (class General_options): Add --strip-debug-non-line.
14206 * options.cc (General_options::finalize): Add strip_debug_non_line
14207 to the strip heirarchy.
14208 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14209 fields.
14210 * layout.cc: Include "reduced_debug_output.h".
14211 (Layout::Layout): Initialize new fields.
14212 (line_only_debug_sections): New static array.
14213 (is_lines_only_debug_sections): New static inline function.
14214 (Layout::include_section): Handle --strip-debug-non-line.
14215 (Layout::make_output_section): If --strip-debug-non-line, build
14216 new output sections for .debug_abbrev and .debug_info.
14217 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14218 gold. Warn about possible overflow.
14219 (read_signed_LEB_128): Likewise.
14220 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14221 (read_signed_LEB_128): Declare.
14222 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14223 (HFILES): Add reduced_debug_output.h.
14224 * Makefile.in: Rebuild.
14225
14226 2008-05-21 Ian Lance Taylor <iant@google.com>
14227
14228 * mapfile.cc: New file.
14229 * mapfile.h: New file.
14230 * options.h (class General_options): Add -M/--print-map and -Map.
14231 * options.cc (General_options::finalize): Make -M equivalent to
14232 -Map -.
14233 * main.cc: Include <cstdio> and "mapfile.h".
14234 (main): Open mapfile if requested.
14235 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14236 constructor. Change caller.
14237 (queue_initial_tasks): Add mapfile parameter. Change caller.
14238 (queue_middle_tasks): Likewise.
14239 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14240 declarations.
14241 * archive.cc: Include "mapfile.h".
14242 (Archive::add_symbols): Add mapfile parameter. Change all
14243 callers. Pass mapfile, symbol, and reason to include_member.
14244 (Archive::include_all_members): Add mapfile parameter. Change all
14245 callers.
14246 (Archive::include_member): Add mapfile, sym, and why parameters.
14247 Change all callers. Report inclusion to map file.
14248 * archive.h: Include "fileread.h".
14249 (class Archive): Update declarations.
14250 (Archive::file): New const method.
14251 (class Add_archive_symbols): Add mapfile_ field. Update
14252 constructor. Change all callers.
14253 * readsyms.h (class Read_symbols): Likewise.
14254 (class Finish_group): Likewise.
14255 (class Read_script): Likewise.
14256 * common.cc: Include "mapfile.h".
14257 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14258 all callers.
14259 (Symbol_table::do_allocate_commons): Likewise.
14260 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14261 symbol allocation to mapfile.
14262 * common.h (class Allocate_commons_task): Add mapfile_ field.
14263 Update constructor. Change all callers.
14264 * symtab.h (class Symbol_table): Update declarations.
14265 * layout.cc: Include "mapfile.h".
14266 (Layout_task_runner::run): Print information to mapfile.
14267 (Layout::create_gold_note): Change Output_data_fixed_space to
14268 Output_data_zero_fill.
14269 (Layout::create_build_id): Likewise.
14270 (Layout::print_to_mapfile): New function.
14271 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14272 constructor. Change caller.
14273 (class Layout): Declare print_to_mapfile.
14274 * output.cc (Output_section::Input_section::print_to_mapfile): New
14275 function.
14276 (Output_section::add_input_section): If producing a map, always
14277 add to input_sections_ list.
14278 (Output_section::do_print_to_mapfile): New function.
14279 (Output_segment::print_sections_to_mapfile): New function.
14280 (Output_segment::print_section_list_to_mapfile): New function.
14281 * output.h: Include "mapfile.h".
14282 (Output_data::print_to_mapfile): New function.
14283 (Output_data::do_print_to_mapfile): New virtual function.
14284 (Output_segment_headers::do_print_to_mapfile): New function.
14285 (Output_file_header::do_print_to_mapfile): New function.
14286 (Output_data_const::do_print_to_mapfile): New function.
14287 (class Output_data_const_buffer): Add map_name_ field. Update
14288 constructor. Change all callers. Add do_print_to_mapfile
14289 function.
14290 (class Output_data_fixed_space): Likewise.
14291 (class Output_data_space): Likewise.
14292 (class Output_data_zero_fill): New class.
14293 (Output_data_strtab::do_print_to_mapfile): New function.
14294 (Output_data_reloc_base::do_print_to_mapfile): New function.
14295 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14296 (Output_data_group::do_print_to_mapfile): New function.
14297 (Output_data_got::do_print_to_mapfile): New function.
14298 (Output_data_dynamic::do_print_to_mapfile): New function.
14299 (Output_symtab_xindex::do_print_to_mapfile): New function.
14300 (class Output_section): Declare do_print_to_mapflie. Declare
14301 print_to_mapfile in Input_section.
14302 (class Output_segment): Declare new functions.
14303 * object.h (Sized_relobj::symbol_count): New function.
14304 * script-sections.cc
14305 (Output_section_element_dot_assignment::set_section_addresses):
14306 Change Output_data_fixed_space to Output_data_zero_fill.
14307 (Output_data_expression::do_print_to_mapfile): New function.
14308 * script.cc (read_input_script): Add mapfile parameter. Change
14309 all callers.
14310 * script.h (read_input_script): Update declaration.
14311 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14312 (Eh_frame::do_print_to_mapfile): New function.
14313 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14314 (Output_merge_string::do_print_to_mapfile): New function.
14315 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14316 function.
14317 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14318 function.
14319 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14320 function.
14321 * Makefile.am (CCFILES): Add mapfile.cc.
14322 (HFILES): Add mapfile.h.
14323 * Makefile.in: Rebuild.
14324
14325 2008-05-19 Ian Lance Taylor <iant@google.com>
14326
14327 * options.h (class General_options): Add -z relro.
14328 * layout.cc (Layout::Layout): Initialize relro_segment_.
14329 (Layout::add_output_section_data): Return the output section.
14330 (Layout::make_output_section): Rcognize relro sections and mark
14331 them appropriately.
14332 (Layout::attach_allocated_section_to_segment): Put relro sections
14333 in a PT_GNU_RELRO segment.
14334 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14335 section as relro.
14336 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14337 PT_TLS segments.
14338 (Layout::linkonce_mapping): Map d.rel.ro.local to
14339 .data.rel.ro.local.
14340 (Layout::output_section_name): Us .data.rel.ro.local for any
14341 section which begins with that.
14342 * layout.h (class Layout): Update add_output_section_data
14343 declaration. Add relro_segment_ field.
14344 * output.cc (Output_section::Output_section): Initialize is_relro_
14345 and is_relro_local_ fields.
14346 (Output_segment::add_output_section): Group relro sections.
14347 (Output_segment::is_first_section_relro): New function.
14348 (Output_segment::maximum_alignment): If there is a relro section,
14349 align the segment to the common page size.
14350 (Output_segment::set_section_addresses): Track whether we are
14351 looking at relro sections. If the last section is a relro
14352 section, align to the common page size.
14353 (Output_segment::set_section_list_addresses): Add in_relro
14354 parameter. Change all callers. Align to the page size when
14355 moving from relro to non-relro section.
14356 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14357 segment.
14358 * output.h (class Output_section): Add is_relro_ and
14359 is_relro_local_ fields.
14360 (Output_section::is_relro): New function.
14361 (Output_section::set_is_relro): New function.
14362 (Output_section::is_relro_local): New function.
14363 (Output_section::set_is_relro_local): New function.
14364 (class Output_segment): Update declarations.
14365 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14366 * sparc.cc (Target_sparc::got_section): Likewise.
14367 * x86_64.cc (Target_x86_64::got_section): Likewise.
14368 * testsuite/relro_test_main.cc: New file.
14369 * testsuite/relro_test.cc: New file.
14370 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14371 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14372 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14373 (relro_test.so, relro_test_pic.o): New targets.
14374 * testsuite/Makefile.in: Rebuild.
14375
14376 2008-05-16 Ian Lance Taylor <iant@google.com>
14377
14378 * output.cc (Output_segment::add_output_section): Remove front
14379 parameter.
14380 * output.h (class Output_segment): Remove
14381 add_initial_output_section and overloaded add_output_section.
14382 Update declaration of remaining add_output_section.
14383 * layout.cc (Layout::create_interp): Call add_output_section
14384 rather than add_initial_output_section.
14385 (Layout::finish_dynamic_section): Likewise.
14386
14387 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14388 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14389 know the dynamic type.
14390 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14391 field. Initialize it in constructor.
14392 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14393 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14394 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14395 reloc.
14396
14397 * output.cc (Output_reloc::get_address): Change return type to
14398 Elf_Addr.
14399 * output.h (class Output_reloc): Update get_address declaration.
14400 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14401 for section addresses.
14402
14403 2008-05-09 Ian Lance Taylor <iant@google.com>
14404
14405 PR 6493
14406 * gold.cc (gold_nomem): Use return value of write.
14407
14408 2008-05-08 Ian Lance Taylor <iant@google.com>
14409
14410 * symtab.c (Symbol::init_base_output_data): Add version
14411 parameter. Change all callers.
14412 (Symbol::init_base_output_segment): Likewise.
14413 (Symbol::init_base_constant): Likewise.
14414 (Symbol::init_base_undefined): Likewise.
14415 (Sized_symbol::init_output_data): Likewise.
14416 (Sized_symbol::init_output_segment): Likewise.
14417 (Sized_symbol::init_constant): Likewise.
14418 (Sized_symbol::init_undefined): Likewise.
14419 (Symbol_table::do_define_in_output_data): If the new symbol has a
14420 version, mark it as the default.
14421 (Symbol_table::do_define_in_output_segment): Likewise.
14422 (Symbol_table::do_define_as_constant): Likewise.
14423 * symtab.h (class Symbol): Update declarations.
14424 (class Sized_symbol): Likewise.
14425 * resolve.cc (Symbol::override_version): New function.
14426 (Symbol::override_base): Call override_version.
14427 (Symbol::override_base_with_special): Likewise.
14428 * testsuite/ver_script_8.script: New file.
14429 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14430 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14431 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14432 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14433
14434 2008-05-06 Ian Lance Taylor <iant@google.com>
14435
14436 PR 6049
14437 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14438 functions.
14439 (class General_options): Remove existing --undefined, and add
14440 --no-undefined instead. Add new --undefined as synonym for -u.
14441 * archive.cc (Archive::add_symbols): Check whether symbol was
14442 named with -u.
14443 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14444 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14445 all uses. Add IS_UNDEFINED. Update declarations to split
14446 different versions of init_base. Declare init_base_undefined.
14447 (Symbol::is_defined): Handle IS_UNDEFINED.
14448 (Symbol::is_undefined): Likewise.
14449 (Symbol::is_weak_undefined): Call is_undefined.
14450 (Symbol::is_absolute): Handle IS_CONSTANT.
14451 (class Sized_symbol): Update declarations to split different
14452 versions of init. Declare init_undefined.
14453 (class Symbol_table): Declare new functions.
14454 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14455 Change all callers.
14456 (Symbol::init_base_output_data): Likewise.
14457 (Symbol::init_base_output_segment): Likewise.
14458 (Symbol::init_base_constant): Likewise.
14459 (Symbol::init_base_undefined): New function.
14460 (Sized_symbol::init_object): Rename from init. Change all
14461 callers.
14462 (Sized_symbol::init_output_data): Likewise.
14463 (Sized_symbol::init_output_segment): Likewise.
14464 (Sized_symbol::init_constant): Likewise.
14465 (Sized_symbol::init_undefined): New function.
14466 (Symbol_table::add_undefined_symbols_from_command_line): New
14467 function.
14468 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14469 function.
14470 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14471 (Symbol::output_section): Likewise.
14472 (Symbol::set_output_section): Likewise.
14473 (Symbol_table::sized_finalize_symbol): Likewise.
14474 (Symbol_table::sized_write_globals): Likewise.
14475 * resolve.cc (Symbol_table::should_override): Likewise.
14476 (Symbol::override_base_with_special): Likewise.
14477
14478 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14479 symbol, change it to have default visibility.
14480 * testsuite/protected_1.cc: New file.
14481 * testsuite/protected_2.cc: New file.
14482 * testsuite/protected_3.cc: New file.
14483 * testsuite/protected_main_1.cc: New file.
14484 * testsuite/protected_main_2.cc: New file.
14485 * testsuite/protected_main_3.cc: New file.
14486 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14487 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14488 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14489 (protected_1.so): New target.
14490 (protected_1_pic.o, protected_2_pic.o): New targets.
14491 (protected_3_pic.o): New target.
14492 (check_PROGRAMS): Add protected_2.
14493 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14494 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14495 * testsuite/Makefile.in: Rebuild.
14496
14497 * options.h (DEFINE_var): Add set_user_set_##varname__.
14498 (DEFINE_bool_alias): New macro.
14499 (class General_options): Define -Bstatic using DEFINE_bool_alias
14500 rather than DEFINE_special. Add --undefined as an alias for -z
14501 defs.
14502 * options.cc (General_options::parse_Bstatic): Remove.
14503
14504 * options.h (class General_options): Add --fatal-warnings.
14505 * main.cc (main): Implement --fatal-warnings.
14506 * errors.h (Errors::warning_count): New function.
14507
14508 * options.h (class General_options): Add -Bsymbolic-functions.
14509 * symtab.h (Symbol::is_preemptible): Check for
14510 -Bsymbolic-functions.
14511
14512 2008-05-05 Ian Lance Taylor <iant@google.com>
14513
14514 * options.h (DEFINE_bool): For DASH_Z, create the negative option
14515 as noVARNAME rather than no-VARNAME.
14516 (class General_options): Add option -z combreloc.
14517 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14518 get_address.
14519 (Output_reloc::sort_before) [SHT_REL]: New function.
14520 (Output_reloc::sort_before) [SHT_RELA]: New function.
14521 (class Output_data_reloc_base): Add sort_relocs_ field. Define
14522 Sort_relocs_comparison.
14523 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14524 parameter. Change all callers.
14525 (Output_data_reloc::Output_data_reloc) [both versions]: Add
14526 sort_relocs parameter. Change all callers.
14527 * output.cc (Output_reloc::get_address): New function, broken out
14528 of write_rel.
14529 (Output_reloc::write_rel): Call it.
14530 (Output_reloc::compare): New function.
14531 (Output_data_reloc_base::do_write): Optionally sort relocs.
14532
14533 * configure.ac: If targ_extra_obj is set, link it in.
14534 * configure.tgt: Initialize all variables.
14535 (x86_64*): Set targ_extra_obj and targ_extra_size.
14536 * configure: Rebuild.
14537
14538 * object.cc (Sized_relobj::include_section_group): Adjust section
14539 indexes read from group data. Build vector to pass to
14540 layout_group.
14541 * layout.cc (Layout::layout_group): Add flags and shndxes
14542 parameters. Remove contents parameter. Change caller. Update
14543 explicit instantiations.
14544 * layout.h (class Layout): Update layout_group declaration.
14545 * output.cc (Output_data_group::Output_data_group): Add flags and
14546 input_shndxes parameters. Remove contents parameter. Change
14547 caller.
14548 (Output_data_group::do_write): Change input_sections_ to
14549 input_shndxes_.
14550 * output.h (class Output_data_group): Update constructor
14551 declaration. Rename input_sections_ to input_shndxes_.
14552 * testsuite/many_sections_test.cc: Add template.
14553
14554 2008-04-30 Cary Coutant <ccoutant@google.com>
14555
14556 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14557
14558 * layout.cc (Layout::include_section): Refactored check for debug
14559 info section.
14560 (Layout::add_comdat): Add new parameters. Change type
14561 of signature parameter. Add object and shndx to signatures table.
14562 (Layout::find_kept_object): New function.
14563 * layout.h: Include <cstring>.
14564 (Layout::is_debug_info_section): New function.
14565 (Layout::add_comdat): Add new parameters.
14566 (Layout::find_kept_object): New function.
14567 (Layout::Kept_section): New struct.
14568 (Layout::Signatures): Change type of map range.
14569 * object.cc (Relobj::output_section_address): New function.
14570 (Sized_relobj::include_section_group): Add new parameters. Change
14571 calls to Layout::add_comdat. Change to build table of kept comdat
14572 groups and table mapping discarded sections to kept sections.
14573 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14574 (Sized_relobj::do_layout): Change calls to include_section_group and
14575 include_linkonce_section.
14576 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14577 value to zero when section is discarded.
14578 (Sized_relobj::map_to_kept_section): New function.
14579 * object.h (Relobj::output_section_address): New function.
14580 (Relobj::Comdat_group): New type.
14581 (Relobj::find_comdat_group): New function.
14582 (Relobj::Comdat_group_table): New type.
14583 (Relobj::Kept_comdat_section): New type.
14584 (Relobj::Kept_comdat_section_table): New type.
14585 (Relobj::add_comdat_group): New function.
14586 (Relobj::set_kept_comdat_section): New function.
14587 (Relobj::get_kept_comdat_section): New function.
14588 (Relobj::comdat_groups_): New field.
14589 (Relobj::kept_comdat_sections_): New field.
14590 (Symbol_value::input_value): Update comment.
14591 (Sized_relobj::map_to_kept_section) New function.
14592 (Sized_relobj::include_linkonce_section): Add new parameter.
14593 * target-reloc.h (Comdat_behavior): New type.
14594 (get_comdat_behavior): New function.
14595 (relocate_section): Add code to map a discarded section to the
14596 corresponding kept section when applying a relocation.
14597
14598 2008-04-30 Craig Silverstein <csilvers@google.com>
14599
14600 * dwarf_reader.cc (next_generation_count): New static var.
14601 (Addr2line_cache_entry): New struct.
14602 (addr2line_cache): New static var.
14603 (Dwarf_line_info::one_addr2line): Added caching.
14604 (Dwarf_line_info::clear_addr2line_cache): New function.
14605 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14606 cache-size parameter.
14607 (Dwarf_line_info::one_addr2line_cache): New function.
14608 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14609 new cache-size argument to one_addr2line(), and clear cache.
14610
14611 2008-04-28 Cary Coutant <ccoutant@google.com>
14612
14613 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14614 R_386_PC8 relocations.
14615
14616 2008-04-23 Ian Lance Taylor <iant@google.com>
14617
14618 * object.cc (Sized_relobj::include_section_group): Check for
14619 invalid section group.
14620
14621 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14622 header size.
14623
14624 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14625 than read for file header.
14626 * archive.cc (Archive::include_member): Likewise.
14627
14628 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14629
14630 * aclocal.m4: Regenerate.
14631 * configure: Regenerate.
14632
14633 2008-04-19 Ian Lance Taylor <iant@google.com>
14634
14635 * version.cc (version_string): Bump to 1.6.
14636
14637 * testsuite/Makefile.am (many_sections_r_test): New target.
14638 (many_sections_r_test_SOURCES): Remove.
14639 (many_sections_r_test_DEPENDENCIES): Remove.
14640 (many_sections_r_test_LDFLAGS): Remove.
14641 (many_sections_r_test_LDADD): Remove.
14642
14643 * object.cc (Sized_relobj::do_add_symbols): Always pass
14644 local_symbol_count_ to add_from_relobj.
14645
14646 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14647 every thousand variables.
14648 * testsuite/Makefile.in: Rebuild.
14649
14650 * object.cc (Xindex::initialize_symtab_xindex): New function.
14651 (Xindex::read_symtab_xindex): New function.
14652 (Xindex::sym_xindex_to_shndx): New function.
14653 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14654 available.
14655 (Sized_relobj::do_initialize_xindex): New function.
14656 (Sized_relobj::do_read_symbols): Adjust section links.
14657 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14658 parameter. Change all callers.
14659 (Sized_relobj::include_section_group): Adjust section links and
14660 symbol section indexes.
14661 (Sized_relobj::do_layout): Adjust section links.
14662 (Sized_relobj::do_count_local_symbols): Adjust section links and
14663 symbol section indexes.
14664 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14665 ordinary and special symbols.
14666 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14667 dynsym_xindex parameters. Change all callers. Adjust section
14668 links. Use SHN_XINDEX when needed.
14669 (Sized_relobj::get_symbol_location_info): Adjust section links.
14670 Don't get fooled by special symbols.
14671 * object.h (class Xindex): Define.
14672 (class Object): Add xindex_ parameter. Declare virtual functoin
14673 do_initialize_xindex.
14674 (Object::adjust_sym_shndx): New function.
14675 (Object::set_xindex): New protected function.
14676 (class Symbol_value): Add is_ordinary_shndx_ field.
14677 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14678 (Symbol_value::value): Assert ordinary section.
14679 (Symbol_value::initialize_input_to_output_map): Likewise.
14680 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14681 Change all callers.
14682 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14683 all callers.
14684 (class Sized_relobj): Update declarations.
14685 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14686 parameter. Change all callers.
14687 (Sized_relobj::adjust_shndx): New function.
14688 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14689 field.
14690 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14691 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14692 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14693 (Sized_dynobj::read_dynsym_section): Adjust section links.
14694 (Sized_dynobj::read_dynamic): Likewise.
14695 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14696 section links.
14697 (Sized_dynobj::do_initialize_xindex): New function.
14698 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14699 do_initialize_xindex.
14700 (Sized_dynobj::adjust_shndx): New function.
14701 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14702 dynsym_xindex_ fields.
14703 (Layout::finalize): Add a call to set_section_indexes before
14704 creating the symtab sections.
14705 (Layout::set_section_indexes): Don't do anything if the section
14706 already has a section index.
14707 (Layout::create_symtab_sections): Add shnum parameter. Change
14708 caller. Create .symtab_shndx section if needed.
14709 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14710 caller.
14711 (Layout::allocated_output_section_count): New function.
14712 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14713 needed.
14714 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14715 fields. Update declarations.
14716 (Layout::symtab_xindex): New function.
14717 (Layout::dynsym_xindex): New function.
14718 (class Write_symbols_task): Add layout_ field.
14719 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14720 Change caller.
14721 * output.cc (Output_section_headers::Output_section_headers): Add
14722 shstrtab_section parameter. Change all callers.
14723 (Output_section_headers::do_sized_write): Store overflow values
14724 for section count and section string table section index in
14725 section header zero.
14726 (Output_file_header::do_sized_write): Check for overflow of
14727 section count and section string table section index.
14728 (Output_symtab_xindex::do_write): New function.
14729 (Output_symtab_xindex::endian_do_write): New function.
14730 * output.h (class Output_section_headers): Add shstrtab_section_.
14731 Update declarations.
14732 (class Output_symtab_xindex): Define.
14733 (Output_section::has_out_shndx): New function.
14734 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14735 field.
14736 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14737 Change all callers.
14738 (Sized_symbol::init): Likewise.
14739 (Symbol::output_section): Check for ordinary symbol.
14740 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14741 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14742 callers.
14743 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14744 Change all callers. Simplify handling of symbols from sections
14745 not included in the link.
14746 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14747 distinction.
14748 (Weak_alias_sorter::operator()): Assert that symbols are
14749 ordinary.
14750 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14751 distinction.
14752 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14753 parameters. Change all callers.
14754 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14755 symbol distinction. Use SHN_XINDEX when needed.
14756 (Symbol_table::write_section_symbol): Add symtab_xindex
14757 parameter. Change all callers.
14758 (Symbol_table::sized_write_section_symbol): Likewise. Use
14759 SHN_XINDEX when needed.
14760 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14761 declarations.
14762 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14763 (Symbol::is_defined): Check is_ordinary.
14764 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14765 (Symbol::is_absolute, Symbol::is_common): Likewise.
14766 (class Sized_symbol): Update declarations.
14767 (class Symbol_table): Update declarations.
14768 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14769 parameters. Change all callers.
14770 (Sized_symbol::override): Likewise.
14771 (Symbol_table::override): Likewise.
14772 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14773 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14774 is_ordinary, and orig_st_shndx parameters. Change all callers.
14775 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14776 to be in an ordinary section.
14777 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14778 object and is_ordinary parameters. Change all callers.
14779 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14780 Change all callers. Don't add undefined or non-ordinary symbols
14781 to reloc_map_.
14782 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14783 Change all callers.
14784 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14785 declarations.
14786 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14787 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14788 (Sized_relobj::relocate_sections): Likewise.
14789 * target-reloc.h (scan_relocs): Adjust section symbol index.
14790 (scan_relocatable_relocs): Likewise.
14791 * i386.cc (Scan::local): Check for ordinary symbols.
14792 * sparc.cc (Scan::local): Likewise.
14793 * x86_64.cc (Scan::local): Likewise.
14794 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14795 to symbol_section_and_value.
14796 * testsuite/many_sections_test.cc: New file.
14797 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14798 (check_PROGRAMS): Add many_sections_test.
14799 (many_sections_test_SOURCES): Define.
14800 (many_sections_test_DEPENDENCIES): Define.
14801 (many_sections_test_LDFLAGS): Define.
14802 (BUILT_SOURCES): Add many_sections_define.h.
14803 (many_sections_define.h): New target.
14804 (BUILT_SOURCES): Add many_sections_check.h.
14805 (many_sections_check.h): New target.
14806 (check_PROGRAMS): Add many_sections_r_test.
14807 (many_sections_r_test_SOURCES): Define.
14808 (many_sections_r_test_DEPENDENCIES): Define.
14809 (many_sections_r_test_LDFLAGS): Define.
14810 (many_sections_r_test_LDADD): Define.
14811 (many_sections_r_test.o): New target.
14812 * testsuite/Makefile.in: Rebuild.
14813
14814 2008-04-17 Cary Coutant <ccoutant@google.com>
14815
14816 * errors.cc (Errors::info): New function.
14817 (gold_info): New function.
14818 * errors.h (Errors::info): New function.
14819 * gold.h (gold_info): New function.
14820 * object.cc (Input_objects::add_object): Print trace output.
14821 * options.cc (options::parse_set): New function.
14822 (General_options::parse_wrap): Deleted.
14823 (General_options::General_options): Deleted initializer.
14824 * options.h (options::String_set): New typedef.
14825 (options::parse_set): New function.
14826 (DEFINE_set): New macro.
14827 (General_options::wrap): Changed to use DEFINE_set. Changed
14828 callers of any_wrap_symbols and is_wrap_symbol.
14829 (General_options::trace, General_options::trace_symbol):
14830 New options.
14831 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14832 (General_options::wrap_symbols_): Deleted.
14833 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14834
14835 2008-04-17 David S. Miller <davem@davemloft.net>
14836
14837 * options.cc (General_options::parse_V): New function.
14838 * options.h: Add entries for -V and -Qy.
14839
14840 2008-04-17 Ian Lance Taylor <iant@google.com>
14841
14842 * common.cc (Symbol_table::allocate_commons): Remove options
14843 parameter. Change caller.
14844 (Symbol_table::do_allocate_commons): Remove options parameter.
14845 Change caller. Just call do_allocate_commons_list twice.
14846 (Symbol_table::do_allocate_commons_list): New function, broken out
14847 of do_allocate_commons.
14848 * common.h (class Allocate_commons_task): Remove options_ field.
14849 Update constructor.
14850 * symtab.cc (Symbol_table::Symbol_table): Initialize
14851 tls_commons_.
14852 (Symbol_table::add_from_object): Put TLS common symbols on
14853 tls_commons_ list.
14854 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14855 which are IN_OUTPUT_DATA.
14856 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14857 allocate_commons and do_allocate_commons declarations. Declare
14858 do_allocate_commons_list.
14859 * gold.cc (queue_middle_tasks): Update creation of
14860 Allocate_commons_task to not pass options.
14861 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14862 (TLS_TEST_C_FLAGS): New variable.
14863 (tls_test_c_pic.o): New target.
14864 (tls_test_shared.so): Link in tls_test_c_pic.o.
14865 (tls_test_c_pic_ie.o): New target.
14866 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14867 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14868 (tls_test_c.o): New target.
14869 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14870 (tls_pic_test_LDADD): Likewise.
14871 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14872 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14873 (tls_test_c_gnu2.o): New target.
14874 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14875 tls_test_c_gnu2.o.
14876 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14877 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14878 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14879 * testsuite/tls_test.cc: Include "config.h".
14880 (t_last): Call t11_last.
14881 * testsuite/tls_test.h (t11, t11_last): Declare.
14882 * testsuite/tls_test_c.c: New file.
14883 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14884 * configure.ac: Check for OpenMP support.
14885 * configure, config.in, Makefile.in: Rebuild.
14886 * testsuite/Makefile.in: Rebuild.
14887
14888 2008-04-16 Cary Coutant <ccoutant@google.com>
14889
14890 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14891 (Target_i386::tls_base_symbol_defined_): New field.
14892 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14893 (Target_i386::Scan::global): Likewise.
14894 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14895 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14896 (Target_x86_64::tls_base_symbol_defined_): New field.
14897 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14898 (Target_x86_64::Scan::global): Likewise.
14899
14900 2008-04-16 Cary Coutant <ccoutant@google.com>
14901
14902 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14903 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14904 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14905 building shared libraries.
14906 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14907 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14908 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14909 * testsuite/Makefile.in: Rebuild.
14910 * testsuite/weak_undef.h: New file.
14911 * testsuite/weak_undef_file1.cc: Add extra test cases.
14912 * testsuite/weak_undef_file2.cc: Likewise.
14913 * testsuite/weak_undef_test.cc: Likewise.
14914
14915 2008-04-16 David S. Miller <davem@davemloft.net>
14916
14917 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14918 Add issued_non_pic_error_ field. Declare check_non_pic.
14919 (Target_sparc::Scan::check_non_pic): New function.
14920 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14921 (Target_sparc::Scan::global): Likewise.
14922
14923 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14924 * configure: Rebuild.
14925
14926 * options.h (DEFINE_enable): New macro.
14927 (new_dtags): New enable option.
14928 (initfirst, interpose, loadfltr, nodefaultlib,
14929 nodelete, nodlopen, nodump): New -z options.
14930 * layout.cc (Layout:finish_dynamic_section): If new
14931 dtags enabled, emit DT_RUNPATH. Also, emit a
14932 DT_FLAGS_1 containing any specified -z flags.
14933
14934 2008-04-16 Ian Lance Taylor <iant@google.com>
14935
14936 * copy-relocs.cc: New file.
14937 * copy-relocs.h: New file.
14938 * reloc.cc: Remove Copy_relocs code.
14939 * reloc.h: Likewise.
14940 * reloc-types.h (struct Reloc_types) [both versions]: Add
14941 get_reloc_addend_noerror.
14942 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14943 variants of add_global which take an addend which must be zero.
14944 * i386.cc: Include "copy-relocs.h".
14945 (class Target_i386): Change type of copy_relocs_ to variable,
14946 update initializer.
14947 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14948 Change all callers.
14949 (Target_i386::do_finalize_sections): Change handling of
14950 copy_relocs_.
14951 * sparc.cc: Include "copy-relocs.h".
14952 (class Target_sparc): Change type of copy_relocs_ to variable,
14953 update initializer.
14954 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14955 Change all callers.
14956 (Target_sparc::do_finalize_sections): Change handling of
14957 copy_relocs_.
14958 * x86_64.cc: Include "copy-relocs.h".
14959 (class Target_x86_64): Change type of copy_relocs_ to variable,
14960 update initializer.
14961 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14962 class. Change all callers.
14963 (Target_x86_64::do_finalize_sections): Change handling of
14964 copy_relocs_.
14965 * Makefile.am (CCFILES): Add copy-relocs.cc.
14966 (HFILES): Add copy-relocs.h.
14967
14968 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14969
14970 * testsuite/script_test_4.sh: Permit leading zeroes.
14971
14972 2008-04-15 Ian Lance Taylor <iant@google.com>
14973
14974 * script-sections.cc (Script_sections::create_segments): Use
14975 header_size_adjustment even when there is enough room for the
14976 headers.
14977 * testsuite/script_test_4.sh: New file.
14978 * testsuite/script_test_4.t: New file.
14979 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14980 (check_DATA): Add script_test_4.stdout.
14981 (MOSTLYCLEANFILES): Likewise.
14982 (script_test_4): New target.
14983 (script_test_4.stdout): New target.
14984 * testsuite/Makefile.in: Rebuild.
14985
14986 * sparc.cc: Add definitions for Output_data_plt_sparc class
14987 constants.
14988
14989 2008-04-14 David S. Miller <davem@davemloft.net>
14990
14991 * sparc.cc: New file.
14992 * Makefile.am (TARGETSOURCES): Add sparc.cc
14993 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14994 * configure.tgt: Document targ_extra_size and
14995 targ_extra_big_endian. Add entries for sparc-* and
14996 sparc64-*.
14997 * configure.ac: Handle targ_extra_size and
14998 targ_extra_big_endian.
14999 * Makefile.in: Rebuild.
15000 * configure: Likewise.
15001 * po/POTFILES.in: Likewise.
15002 * po/gold.pot: Likewise.
15003
15004 2008-04-14 Ian Lance Taylor <iant@google.com>
15005
15006 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15007 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15008 in the name/type/flags to section mapping. Don't call
15009 allocate_output_section.
15010 (Layout::choose_output_section): Change parameter from adjust_name
15011 to is_input_section. Don't permit input sections after sections
15012 are attached to segments. Don't call allocate_output_section.
15013 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15014 not write_enable_output_section.
15015 (Layout::make_output_section): Don't push to
15016 unattached_section_list_ nor call attach_to_segment. Call
15017 attach_section_to_segment if sections are attached.
15018 (Layout::attach_sections_to_segments): New function.
15019 (Layout::attach_section_to_segment): New function.
15020 (Layout::attach_allocated_section_to_segment): Rename from
15021 attach_to_segment. Remove flags parameter.
15022 (Layout::allocate_output_section): Remove function.
15023 (Layout::write_enable_output_section): Remove function.
15024 * layout.h (class Layout): Update for above changes. Add new
15025 field sections_are_attached_.
15026 * output.h (Output_section::update_flags_for_input_section): New
15027 function.
15028 * output.cc (Output_section::add_input_section): Call
15029 update_flags_for_input_section.
15030 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15031
15032 2008-04-11 Cary Coutant <ccoutant@google.com>
15033
15034 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15035 thought unnecessary.
15036 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15037
15038 2008-04-11 Ian Lance Taylor <iant@google.com>
15039
15040 * output.h (class Output_section_data): Remove inline definition
15041 of set_addralign.
15042 * output.cc (Output_section_data::set_addralign): New function.
15043
15044 2008-04-11 Cary Coutant <ccoutant@google.com>
15045
15046 Add support for TLS descriptors for i386 and x86_64.
15047 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15048 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15049 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15050 GOT_TYPE_TLS_DESC.
15051 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15052 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15053 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15054 relocations.
15055 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15056 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15057 Fix problem with initial-exec relocations.
15058 (Target_i386::Relocate::relocate_tls): Likewise.
15059 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15060 relaxation.
15061 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15062 support for section-plus-offset dynamic table entries.
15063 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15064 (Output_data_dynamic::Dynamic_entry): Add support for
15065 section-plus-offset dynamic table entries.
15066 (Output_data_dynamic::Classification): Likewise.
15067 (Output_data_dynamic::classification_): Renamed offset_.
15068 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15069 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15070 (Target_x86_64::make_plt_section): New function.
15071 (Target_x86_64::reserve_tlsdesc_entries): New function.
15072 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15073 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15074 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15075 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15076 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15077 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15078 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15079 add extra PLT entry for TLS descriptors.
15080 (Output_data_plt_x86_64::got_): New field.
15081 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15082 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15083 fields.
15084 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15085 descriptors.
15086 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15087 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15088 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15089 R_386_TLS_DESC_CALL relocations.
15090 (Target_x86_64::Scan::global): Likewise.
15091 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15092 for TLS descriptors.
15093 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15094 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15095 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15096 GD-to-IE relaxation.
15097 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15098 and TLS_DESCRIPTORS.
15099 * Makefile.in: Rebuild.
15100 * configure: Rebuild.
15101 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15102 (tls_test_shared2.so): New target.
15103 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15104 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15105 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15106 (tls_shared_gd_to_ie_test_LDADD): New variable.
15107 (tls_shared_gnu2_gd_to_ie_test): New target.
15108 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15109 New targets.
15110 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15111 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15112 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15113 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15114 (tls_shared_gnu2_test): New target.
15115 (tls_test_gnu2_shared.so): New target.
15116 (tls_shared_gnu2_test_SOURCES): New variable.
15117 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15118 (tls_shared_gnu2_test_LDFLAGS): New variable.
15119 (tls_shared_gnu2_test_LDADD): New variable.
15120 * testsuite/Makefile.in: Rebuild.
15121 * testsuite/Makefile.
15122
15123 2008-04-11 Ian Lance Taylor <iant@google.com>
15124
15125 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15126 justsyms.t.
15127 * testsuite/Makefile.in: Rebuild.
15128
15129 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15130 long.
15131 * testsuite/script_test_2.cc (main): Adjust test.
15132
15133 2008-04-11 David S. Miller <davem@davemloft.net>
15134 Ian Lance Taylor <iant@google.com>
15135
15136 * options.h (General_options): Add entries for '-Y' and
15137 '-relax'.
15138 * options.cc (General_options:finalize): If -Y was used, add those
15139 entries to the library path instead of the default "/lib" and
15140 "/usr/lib".
15141
15142 2008-04-11 David S. Miller <davem@davemloft.net>
15143
15144 * testsuite/justsyms.t: Start at 0x100.
15145 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15146 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15147 long.
15148 * testsuite/script_test_2.cc: Adjust string and section length
15149 checks.
15150
15151 2008-04-09 Ian Lance Taylor <iant@google.com>
15152
15153 PR gold/5996
15154 * script-sections.cc (Sections_element::allocate_to_segment): Add
15155 orphan parameter.
15156 (Output_section_definition::allocate_to_segment): Likewise.
15157 (Orphan_output_section::allocate_to_segment): Likewise.
15158 (Script_sections::attach_sections_using_phdrs_clause): Don't
15159 propagate non-PT_LOAD segments to orphan sections.
15160 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15161 readelf rather than objdump.
15162 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15163 .interp section and PT_INTERP segment are the same size.
15164 * testsuite/Makefile.in: Rebuild.
15165
15166 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15167 aliases for symbols defined in the same object.
15168 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15169 (weak_alias_test_SOURCES): New variable.
15170 (weak_alias_test_DEPENDENCIES): New variable.
15171 (weak_alias_test_LDFLAGS): New variable.
15172 (weak_alias_test_LDADD): New variable.
15173 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15174 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15175 (weak_alias_test_3.o): New target.
15176 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15177 * testsuite/weak_alias_test_main.cc: New file.
15178 * testsuite/weak_alias_test_1.cc: New file.
15179 * testsuite/weak_alias_test_2.cc: New file.
15180 * testsuite/weak_alias_test_3.cc: New file.
15181
15182 2008-04-08 Ian Lance Taylor <iant@google.com>
15183
15184 * options.h (class General_options): Add --noinhibit-exec option.
15185 * main.cc (main): Check --noinhibit-exec.
15186
15187 * options.h (class General_options): Define --wrap as a special
15188 option. Add wrap_symbols_ field.
15189 (General_options::any_wrap_symbols): New function.
15190 (General_options::is_wrap_symbol): New function.
15191 * options.cc (General_options::parse_wrap): New function.
15192 (General_options::General_options): Initialize wrap_symbols_.
15193 * symtab.cc (Symbol_table::wrap_symbol): New function.
15194 (Symbol_table::add_from_object): Handle --wrap.
15195 * symtab.h (class Symbol_table): Declare wrap_symbol.
15196 * target.h (Target::wrap_char): New function.
15197 (Target::Target_info): Add wrap_char field.
15198 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15199 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15200 * testsuite/testfile.cc (Target_test::test_target_info):
15201 Likewise.
15202
15203 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15204 there is one.
15205
15206 * layout.h (class Layout): Add added_eh_frame_data_ field.
15207 * layout.cc (Layout::Layout): Initialize new field.
15208 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15209 output section until we find a section we merged successfully.
15210 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15211 that the size be non-zero.
15212
15213 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15214 qualifier.
15215
15216 2008-04-08 Craig Silverstein <csilvers@google.com>
15217
15218 * configure.ac: Export new conditional variable HAVE_ZLIB.
15219 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15220 on HAVE_ZLIB.
15221 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15222 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15223
15224 2008-04-07 Ian Lance Taylor <iant@google.com>
15225
15226 * version.cc (version_string): Set to "1.5".
15227
15228 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15229 Add issued_non_pic_error_ field. Declare check_non_pic.
15230 (Target_x86_64::Scan::check_non_pic): New function.
15231 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15232 (Target_x86_64::Scan::global): Likewise.
15233
15234 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15235 addend parameter. Change caller. Handle merge sections.
15236 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15237 Address to Addend. Don't add in the result of
15238 local_section_offset, pass down the addend and use the returned
15239 value.
15240 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15241 Update declarations of local_section_offset and symbol_value.
15242 * testsuite/two_file_test_1.cc (t18): New function.
15243 * testsuite/two_file_test_2.cc (f18): New function.
15244 * testsuite/two_file_test_main.cc (main): Call t18.
15245 * testsuite/two_file_test.h (t18, f18): Declare.
15246
15247 * configure.ac: Don't test for objdump, c++filt, or readelf.
15248 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15249 conditionals.
15250 (TEST_READELF): New variable.
15251 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15252 (check_PROGRAMS): Add two_file_strip_test.
15253 (two_file_strip_test): New target.
15254 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15255 (two_file_same_shared_strip_test_SOURCES): New variable.
15256 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15257 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15258 (two_file_same_shared_strip_test_LDADD): New variable.
15259 (two_file_shared_strip.so): New target.
15260 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15261 (ver_test_5.syms, ver_test_7.syms): Likewise.
15262 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15263 (strip_test_3.stdout): Use TEST_OBJDUMP.
15264 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15265
15266 2008-04-04 Cary Coutant <ccoutant@google.com>
15267
15268 * symtab.h (Symbol::is_weak_undefined): New function.
15269 (Symbol::is_strong_undefined): New function.
15270 (Symbol::is_absolute): New function.
15271 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15272 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15273 absolute symbols.
15274 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15275 (weak_undef_test): New target.
15276 * testsuite/Makefile.in: Rebuild.
15277 * testsuite/weak_undef_file1.cc: New file.
15278 * testsuite/weak_undef_file2.cc: New file.
15279 * testsuite/weak_undef_test.cc: New file.
15280
15281 2008-04-03 Craig Silverstein <csilvers@google.com>
15282
15283 * compressed_output.h (class Output_compressed_section): Use
15284 unsigned buffer.
15285 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15286 add zlib header.
15287 (zlib_compressed_suffix): Removed.
15288 (Output_compressed_section::set_final_data_size): Use unsigned
15289 buffers.
15290 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15291 Fix linker invocation.
15292 (flagstest_o_specialfile_and_compress_debug_sections):
15293 Likewise.
15294 * testsuite/Makefile.in: Regenerated.
15295
15296 2008-04-02 David S. Miller <davem@davemloft.net>
15297
15298 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15299 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15300
15301 2008-04-02 Craig Silverstein <csilvers@google.com>
15302
15303 * TODO: New file.
15304
15305 2008-04-02 Ian Lance Taylor <iant@google.com>
15306
15307 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15308 parameters. Update for new key type to views_. Change all
15309 callers.
15310 (File_read::read): Adjust for byteshift in returned view.
15311 (File_read::add_view): New function, broken out of
15312 find_and_make_view.
15313 (File_read::make_view): New function, broken out of
15314 find_and_make_view.
15315 (File_read::find_or_make_view): Add offset and aligned
15316 parameters. Rewrite accordingly. Change all callers.
15317 (File_read::get_view): Add offset and aligned parameters. Adjust
15318 for byteshift in return value.
15319 (File_read::get_lasting_view): Likewise.
15320 * fileread.h (class File_read): Update declarations.
15321 (class File_read::View): Add byteshift_ field. Add byteshift to
15322 constructor. Add byteshift method.
15323 * archive.h (Archive::clear_uncached_views): New function.
15324 (Archive::get_view): Add aligned parameter. Change all callers.
15325 * object.h (Object::get_view): Add aligned parameter. Change all
15326 callers.
15327 (Object::get_lasting_view): Likewise.
15328
15329 * fileread.cc (File_read::release): Don't call clear_views if
15330 there are multiple objects.
15331 * fileread.h (File_read::clear_uncached_views): New function.
15332 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15333 on the archive.
15334
15335 2008-03-31 Cary Coutant <ccoutant@google.com>
15336
15337 Add thin archive support.
15338 * archive.cc (Archive::armagt): New const.
15339 (Archive::setup): Remove task parameter and calls to unlock.
15340 (Archive::unlock_nested_archives): New function.
15341 (Archive::read_header): Add nested_off parameter. Change
15342 all callers.
15343 (Archive::interpret_header): Likewise.
15344 (Archive::include_all_members): Change to handle thin
15345 archives.
15346 (Archive::include_member): Likewise.
15347 * archive.h (Archive::Archive): Add new parameters and
15348 initializers.
15349 (Archive::armagt): New const.
15350 (Archive::setup): Remove task parameter.
15351 (Archive::unlock_nested_archives): New function.
15352 (Archive::read_header): Add nested_off parameter.
15353 (Archive::interpret_header): Likewise.
15354 (Archive::Nested_archive_table): New typedef.
15355 (Archive::is_thin_archive_): New field.
15356 (Archive::nested_archives_): New field.
15357 (Archive::options_): New field.
15358 (Archive::dirpath_): New field.
15359 (Archive::task_): New field.
15360 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15361 for thin archives. Pass additional parameters to
15362 Archive::Archive. Unlock the archive file after calling
15363 Archive::setup.
15364
15365 2008-03-29 Ian Lance Taylor <iant@google.com>
15366
15367 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15368 version symbol to be local.
15369 * testsuite/ver_test_4.sh: New file.
15370 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15371 (check_DATA): Add ver_test_4.syms.
15372 (ver_test_4.syms): New target.
15373 * testsuite/Makefile.in: Rebuild.
15374
15375 * output.cc
15376 (Output_section::Input_section_sort_entry::has_priority): New
15377 function.
15378 (Output_section::Input_section_sort_entry::match_file_name): New
15379 function.
15380 (Output_section::Input_section_sort_entry::match_section_name):
15381 Remove.
15382 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15383 Remove.
15384 (Output_section::Input_section_sort_entry::match_section_file):
15385 Remove.
15386 (Output_section::Input_section_sort_compare::operator()): Rewrite
15387 using new Input_section_sort_entry functions. Sort crtbegin and
15388 crtend first. Sort sections with no priority before sections with
15389 a priority.
15390 * testsuite/initpri1.c (d3): Check j != 4.
15391 (cd5): New constructor/destructor function.
15392 (main): Check j != 2.
15393
15394 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15395 new symbol when resolving, don't call set_is_default.
15396 * testsuite/ver_test_7.cc: New file.
15397 * testsuite/ver_test_7.sh: New file.
15398 * testsuite/Makefile.am (ver_test_7.so): New target.
15399 (ver_test_7.o): New target.
15400 (check_SCRIPTS): Add ver_test_7.sh.
15401 (check_DATA): Add ver_test_7.syms.
15402 (ver_test_7.syms): New target.
15403
15404 2008-03-28 Ian Lance Taylor <iant@google.com>
15405
15406 * layout.cc (Layout::layout): If we see an input section with a
15407 name that needs sorting, set the must_sort flag for the output
15408 section.
15409 (Layout::make_output_section): If the name of the output section
15410 indicates that it might require sorting, set the may_sort flag.
15411 * output.h (Output_section::may_sort_attached_input_sections): New
15412 function.
15413 (Output_section::set_may_sort_attached_input_sections): New
15414 function.
15415 (Output_section::must_sort_attached_input_sections): New
15416 function.
15417 (Output_section::set_must_sort_attached_input_sections): New
15418 function.
15419 (class Output_section): Declare Input_section_sort_entry. Define
15420 Input_section_sort_compare. Declare
15421 sort_attached_input_sections. Add new fields:
15422 may_sort_attached_input_sections_,
15423 must_sort_attached_input_sections_,
15424 attached_input_sections_are_sorted_.
15425 * output.cc (Output_section::Output_section): Initialize new
15426 fields.
15427 (Output_section::add_input_section): Add an entry to
15428 input_sections_ if may_sort or must_sort are true.
15429 (Output_section::set_final_data_size): Call
15430 sort_attached_input_sections if necessary.
15431 (Output_section::Input_section_sort_entry): Define new class.
15432 (Output_section::Input_section_sort_compare::operator()): New
15433 function.
15434 (Output_section::sort_attached_input_sections): New function.
15435 * configure.ac: Check whether the compiler supports constructor
15436 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15437 * testsuite/initpri1.c: New file.
15438 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15439 CONSTRUCTOR_PRIORITY.
15440 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15441 (initpri1_LDFLAGS): New variable.
15442 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15443
15444 2008-03-27 Ian Lance Taylor <iant@google.com>
15445
15446 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15447 * testsuite/common_test_1.c: New file.
15448 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15449 (common_test_1_SOURCES): New variable.
15450 (common_test_1_DEPENDENCIES): New variable.
15451 (common_test_1_LDFLAGS): New variable.
15452
15453 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15454 and commons_ correctly when NAME/VERSION does not override
15455 NAME/NULL.
15456 * testsuite/ver_test_6.c: New file.
15457 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15458 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15459 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15460
15461 2008-03-26 Ian Lance Taylor <iant@google.com>
15462
15463 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15464 of an undefined symbol from a version script.
15465 * testsuite/Makefile.am (ver_test_5.so): New target.
15466 (ver_test_5.o): New target.
15467 (check_SCRIPTS): Add ver_test_5.sh.
15468 (check_DATA): Add ver_test_5.syms.
15469 (ver_test_5.syms): New target.
15470 * testsuite/ver_test_5.cc: New file.
15471 * testsuite/ver_test_5.script: New file.
15472 * testsuite/ver_test_5.sh: New file.
15473 * Makefile.in, testsuite/Makefile.in: Rebuild.
15474
15475 PR gold/5986
15476 Fix problems building gold with gcc 4.3.0.
15477 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15478 (gold_error_at_location, gold_warning_at_location): Use it.
15479 * configure.ac: Check whether we can compile and use a template
15480 function with a printf attribute.
15481 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15482 when jumping over bytes.
15483 * object.cc: Instantiate Object::read_section_data.
15484 * debug.h: Include <cstring>
15485 * dwarf_reader.cc: Include <algorithm>
15486 * main.cc: Include <cstring>.
15487 * options.cc: Include <cstring>.
15488 * output.cc: Include <cstring>.
15489 * script.cc: Include <cstring>.
15490 * script.h: Include <string>.
15491 * symtab.cc: Include <cstring> and <algorithm>.
15492 * target-select.cc: Include <cstring>.
15493 * version.cc: Include <string>.
15494 * testsuite/testmain.cc: Include <cstdlib>.
15495 * configure, config.in: Rebuild.
15496
15497 2008-03-25 Ian Lance Taylor <iant@google.com>
15498
15499 * options.cc: Include "../bfd/bfdver.h".
15500 (options::help): Print bug reporting address.
15501
15502 * version.cc (print_version): Adjust output for current value of
15503 BFD_VERSION_STRING.
15504
15505 * NEWS: New file.
15506
15507 * options.cc (options::help): Print list of supported targets.
15508 * target-select.h: Include <vector>.
15509 (class Target_selector): Make machine_, size_, and is_big_endian_
15510 fields const. Add bfd_name_ and instantiated_target_ fields.
15511 (Target_selector::Target_selector): Add bfd_name parameter.
15512 (Target_selector::recognize): Make non-virtual, call
15513 do_recognize.
15514 (Target_selector::recognize_by_name): Make non-virtual, call
15515 do_recognize_by_name.
15516 (Target_selector::supported_names): New function.
15517 (Target_selector::bfd_name): New function.
15518 (Target_selector::do_instantiate_target): New pure virtual
15519 function.
15520 (Target_selector::do_recognize): New virtual function.
15521 (Target_selector::do_recognize_by_name): New virtual function.
15522 (Target_selector::instantiate_target): New private function.
15523 (supported_target_names): Declare.
15524 * target-select.cc (Target_selector::Target_selector): Update for
15525 new parameter and fields.
15526 (select_target_by_name): Check that the name matches before
15527 calling recognize_by_name.
15528 (supported_target_names): New function.
15529 * i386.cc (class Target_selector_i386): Update Target_selector
15530 constructor call. Remove recognize and recognize_by_name. Add
15531 do_instantiate_target.
15532 * x86_64.cc (class Target_selector_x86_64): Likewise.
15533 * testsuite/testfile.cc (class Target_selector_test): Update for
15534 changes to Target_selector.
15535
15536 * README: Rewrite, with some notes on unsupported features.
15537
15538 2008-03-24 Cary Coutant <ccoutant@google.com>
15539
15540 * i386.cc (Target_i386::Got_type): New enum declaration.
15541 (Target_i386::Scan::local): Updated callers of Output_data_got
15542 member functions.
15543 (Target_i386::Scan::global): Likewise.
15544 (Target_i386::Relocate::relocate): Likewise.
15545 (Target_i386::Relocate::relocate_tls): Likewise.
15546 * object.h (Got_offset_list): New class.
15547 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15548 (Sized_relobj::local_got_offset): Likewise.
15549 (Sized_relobj::set_local_got_offset): Likewise.
15550 (Sized_relobj::local_has_tls_got_offset): Removed.
15551 (Sized_relobj::local_tls_got_offset): Removed.
15552 (Sized_relobj::set_local_tls_got_offset): Removed.
15553 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15554 * output.cc (Output_data_got::add_global): Added got_type parameter.
15555 (Output_data_got::add_global_with_rel): Likewise.
15556 (Output_data_got::add_global_with_rela): Likewise.
15557 (Output_data_got::add_global_pair_with_rel): New function.
15558 (Output_data_got::add_global_pair_with_rela): New function.
15559 (Output_data_got::add_local): Added got_type parameter.
15560 (Output_data_got::add_local_with_rel): Likewise.
15561 (Output_data_got::add_local_with_rela): Likewise.
15562 (Output_data_got::add_local_pair_with_rel): New function.
15563 (Output_data_got::add_local_pair_with_rela): New function.
15564 (Output_data_got::add_global_tls): Removed.
15565 (Output_data_got::add_global_tls_with_rel): Removed.
15566 (Output_data_got::add_global_tls_with_rela): Removed.
15567 (Output_data_got::add_local_tls): Removed.
15568 (Output_data_got::add_local_tls_with_rel): Removed.
15569 (Output_data_got::add_local_tls_with_rela): Removed.
15570 * output.h (Output_data_got::add_global): Added got_type parameter.
15571 (Output_data_got::add_global_with_rel): Likewise.
15572 (Output_data_got::add_global_with_rela): Likewise.
15573 (Output_data_got::add_global_pair_with_rel): New function.
15574 (Output_data_got::add_global_pair_with_rela): New function.
15575 (Output_data_got::add_local): Added got_type parameter.
15576 (Output_data_got::add_local_with_rel): Likewise.
15577 (Output_data_got::add_local_with_rela): Likewise.
15578 (Output_data_got::add_local_pair_with_rel): New function.
15579 (Output_data_got::add_local_pair_with_rela): New function.
15580 (Output_data_got::add_global_tls): Removed.
15581 (Output_data_got::add_global_tls_with_rel): Removed.
15582 (Output_data_got::add_global_tls_with_rela): Removed.
15583 (Output_data_got::add_local_tls): Removed.
15584 (Output_data_got::add_local_tls_with_rel): Removed.
15585 (Output_data_got::add_local_tls_with_rela): Removed.
15586 * resolve.cc (Symbol::override_base_with_special): Removed
15587 reference to has_got_offset_ field.
15588 * symtab.cc (Symbol::init_fields): Replaced initialization
15589 of got_offset_ with got_offsets_. Removed initialization
15590 of has_got_offset_
15591 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15592 (Symbol::got_offset): Likewise.
15593 (Symbol::set_got_offset): Likewise.
15594 (Symbol::has_tls_got_offset): Removed.
15595 (Symbol::tls_got_offset): Removed.
15596 (Symbol::set_tls_got_offset): Removed.
15597 (Symbol::got_offset_): Removed.
15598 (Symbol::tls_mod_got_offset_): Removed.
15599 (Symbol::tls_pair_got_offset_): Removed.
15600 (Symbol::got_offsets_): New field.
15601 (Symbol::has_got_offset): Removed.
15602 (Symbol::has_tls_mod_got_offset): Removed.
15603 (Symbol::has_tls_pair_got_offset): Removed.
15604 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15605 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15606 member functions.
15607 (Target_x86_64::Scan::global): Likewise.
15608 (Target_x86_64::Relocate::relocate): Likewise.
15609 (Target_x86_64::Relocate::relocate_tls): Likewise.
15610
15611 2008-03-25 Ben Elliston <bje@au.ibm.com>
15612
15613 * yyscript.y: Fix spelling error in comment.
15614
15615 2008-03-24 Ian Lance Taylor <iant@google.com>
15616
15617 * options.h (class General_options): Define build_id option.
15618 * layout.h (class Layout): Declare write_build_id, create_note,
15619 create_build_id. Add build_id_note_ member.
15620 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15621 "libiberty.h", "md5.h", "sha1.h".
15622 (Layout::Layout): Initialize eh_frame_data_,
15623 eh_frame_hdr_section_, and build_id_note_.
15624 (Layout::finalize): Call create_build_id.
15625 (Layout::create_note): New function, broken out of
15626 Layout::create_gold_note.
15627 (Layout::create_gold_note): Call create_note.
15628 (Layout::create_build_id): New function.
15629 (Layout::write_build_id): New function.
15630 (Close_task_runner::run): Call write_build_id.
15631
15632 * x86_64.cc: Correct license to GPLv3.
15633
15634 2008-03-23 Ian Lance Taylor <iant@google.com>
15635
15636 * options.cc: Include "demangle.h".
15637 (parse_optional_string): New function.
15638 (parse_long_option): Handle takes_optional_argument.
15639 (parse_short_option): Update dash_z initializer. Handle
15640 takes_optional_argument.
15641 (General_options::General_options): Initialize do_demangle_.
15642 (General_options::finalize): Set do_demangle_. Handle demangling
15643 style.
15644 * options.h (parse_optional_string): Declare.
15645 (struct One_option): Add optional_arg field. Update constructor.
15646 Update call constructor calls. Add takes_optional_argument
15647 function.
15648 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15649 (DEFINE_optional_string): Define.
15650 (General_options::demangle): Change from DEFINE_bool to
15651 DEFINE_optional_string.
15652 (General_options::no_demangle): New function.
15653 (General_options::do_demangle): New function.
15654 (General_options::set_do_demangle): New function.
15655 (General_options::execstack_status_): Move definition to end of
15656 class definition.
15657 (General_options::static_): Likewise.
15658 (General_options::do_demangle_): New field.
15659 * object.cc (big_endian>::get_symbol_location_info): Call
15660 Options::do_demangle, not Options::demangle.
15661 * symtab.cc (demangle): Likewise.
15662
15663 2008-03-22 Ian Lance Taylor <iant@google.com>
15664
15665 * gold.h: Include <cstddef> and <sys/types.h>
15666 * options.h: Include <cstring>.
15667
15668 2008-03-21 Ian Lance Taylor <iant@google.com>
15669
15670 * Added source code to GNU binutils.
15671 \f
15672 Copyright (C) 2008-2014 Free Software Foundation, Inc.
15673
15674 Copying and distribution of this file, with or without modification,
15675 are permitted in any medium without royalty provided the copyright
15676 notice and this notice are preserved.
15677
15678 Local Variables:
15679 mode: change-log
15680 left-margin: 8
15681 fill-column: 74
15682 version-control: never
15683 End: