* elflink.c (_bfd_elf_dynamic_symbol_p): Rename param. Make
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2010-08-27 Ian Lance Taylor <iant@google.com>
2
3 * incremental.h (class Incremental_input_entry): Add virtual
4 destructor.
5
6 2010-08-27 Ian Lance Taylor <iant@google.com>
7
8 * testsuite/start_lib_test_3.c: Mark t3 as used.
9
10 2010-08-27 Nick Clifton <nickc@redhat.com>
11
12 * options.cc (version_script): Fix small typo in previous
13 whitespace tidyup.
14
15 2010-08-25 Nick Clifton <nickc@redhat.com>
16
17 * archive.cc: Formatting fixes: Remove whitespace between
18 typename and following asterisk. Remove whitespace between
19 function name and opening parenthesis.
20 * archive.h: Likewise.
21 * arm.cc: Likewise.
22 * attributes.cc: Likewise.
23 * attributes.h: Likewise.
24 * common.cc: Likewise.
25 * copy-relocs.cc: Likewise.
26 * dirsearch.h: Likewise.
27 * dynobj.cc: Likewise.
28 * ehframe.cc: Likewise.
29 * ehframe.h: Likewise.
30 * expression.cc: Likewise.
31 * fileread.cc: Likewise.
32 * fileread.h: Likewise.
33 * gc.h: Likewise.
34 * gold-threads.cc: Likewise.
35 * gold.cc: Likewise.
36 * i386.cc: Likewise.
37 * icf.h: Likewise.
38 * incremental-dump.cc: Likewise.
39 * incremental.cc: Likewise.
40 * layout.cc: Likewise.
41 * layout.h: Likewise.
42 * main.cc: Likewise.
43 * merge.cc: Likewise.
44 * merge.h: Likewise.
45 * object.cc: Likewise.
46 * object.h: Likewise.
47 * options.cc: Likewise.
48 * options.h: Likewise.
49 * output.cc: Likewise.
50 * output.h: Likewise.
51 * plugin.cc: Likewise.
52 * plugin.h: Likewise.
53 * powerpc.cc: Likewise.
54 * reloc.cc: Likewise.
55 * script-c.h: Likewise.
56 * script-sections.cc: Likewise.
57 * script.cc: Likewise.
58 * stringpool.cc: Likewise.
59 * symtab.cc: Likewise.
60 * symtab.h: Likewise.
61 * target.cc: Likewise.
62 * timer.cc: Likewise.
63 * timer.h: Likewise.
64 * version.cc: Likewise.
65 * x86_64.cc: Likewise.
66
67 2010-08-24 Nick Clifton <nickc@redhat.com>
68
69 PR 11899
70 * layout.cc (segment_precedes): Sort segments by their physical
71 addresses, if they have been set.
72
73 2010-08-23 Cary Coutant <ccoutant@google.com>
74
75 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
76 symbols data.
77 (Lib_group::include_member): Unlock object after deleting its
78 symbols data.
79 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
80 the bug fixed here.
81
82 2010-08-19 Neil Vachharajani <nvachhar@google.com>
83 Cary Coutant <ccoutant@google.com>
84
85 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
86 constructor, and set_blocker.
87 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
88 readsyms_blocker_.
89 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
90 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
91 * testsuite/Makefile.am (start_lib_test): New test case.
92 * testsuite/Makefile.in: Regenerate.
93 * testsuite/start_lib_test_main.c: New file.
94 * testsuite/start_lib_test_1.c: New file.
95 * testsuite/start_lib_test_2.c: New file.
96 * testsuite/start_lib_test_3.c: New file.
97
98 2010-08-19 Ian Lance Taylor <iant@google.com>
99
100 * Makefile.in: Rebuild with automake 1.11.1.
101 * aclocal.m4: Likewise.
102 * testsuite/Makefile.in: Likewise.
103
104 2010-08-19 Ian Lance Taylor <iant@google.com>
105
106 PR 10893
107 * i386.cc (class Output_data_plt_i386): Update declarations.
108 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
109 local_ifuncs_ fields.
110 (Target_i386::do_plt_section_for_global): New function.
111 (Target_i386::do_plt_section_for_local): New function.
112 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
113 parameter; change all callers. Initialize global_ifuncs_ and
114 local_ifuncs_. If doing a static link define __rel_iplt_start and
115 __rel_iplt_end.
116 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
117 (Output_data_plt_i386::add_local_ifunc_entry): New function.
118 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
119 symbols.
120 (Target_i386::make_plt_section): New function, broken out of
121 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
122 (Target_i386::make_plt_entry): Call make_plt_section.
123 (Target_i386::make_local_ifunc_plt_entry): New function.
124 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
125 (Target_i386::Scan::local): Handle IFUNC symbols. Add
126 R_386_IRELATIVE to switch.
127 (Target_i386::Scan::global): Likewise.
128 (Target_i386::Relocate::relocate): Likewise.
129 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
130 switch.
131 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
132 (Target_x86_64::do_plt_section_for_global): New function.
133 (Target_x86_64::do_plt_section_for_local): New function.
134 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
135 parameter; change all callers. If doing a static link define
136 __rela_iplt_start and __rela_iplt_end.
137 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
138 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
139 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
140 to point to .plt.
141 (Target_x86_64::make_local_ifunc_plt_entry): New function.
142 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
143 switch.
144 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
145 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
146 R_X86_64_IRELATIVE to switch.
147 (Target_x86_64::Scan::global): Likewise.
148 (Target_x86_64::Relocate::relocate): Likewise.
149 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
150 switch.
151 * target.h (class Target): Add plt_section_for_global and
152 plt_section_for_local functions. Add do_plt_section_for_global
153 and do_plt_section_for_local virtual functions.
154 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
155 clarifying comments.
156 (Symbol::use_plt_offset): Handle IFUNC symbol.
157 * object.cc (Sized_relobj::Sized_relobj): Initialize
158 local_plt_offsets_.
159 (Sized_relobj::local_has_plt_offset): New function.
160 (Sized_relobj::local_plt_offset): New function.
161 (Sized_relobj::set_local_plt_offset): New function.
162 (Sized_relobj::do_count): Handle IFUNC symbol.
163 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
164 a bit away from input_shndx_ field. Add set_is_func_symbol and
165 is_ifunc_symbol functions.
166 (class Sized_relobj): Update declarations. Remove Tls_got_entry
167 and Local_tls_got_offsets. Define Local_plt_offsets. Add
168 local_plt_offsets_ field.
169 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
170 * output.h (class Output_section_data): Add non-const
171 output_section function.
172 (class Output_data_got): Update declarations.
173 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
174 Add use_plt_offset parameter to global and local constructors.
175 Change all callers. Change local_sym_index_ field to 31 bits.
176 Change GSYM_CODE and CONSTANT_CODE accordingly.
177 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
178 doing a static link don't set sh_link field.
179 (Output_data_got::Got_entry::write): Use PLT offset if
180 appropriate.
181 (Output_data_got::add_global_plt): New function.
182 (Output_data_got::add_local_plt): New function.
183 * target-reloc.h (relocate_section): Handle IFUNC symbol.
184 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
185 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
186 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
187 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
188 IFUNC conditional.
189 * testsuite/ifunc-sel.h: New file.
190 * testsuite/ifuncmain1.c: New file.
191 * testsuite/ifuncmain1vis.c: New file.
192 * testsuite/ifuncmod1.c: New file.
193 * testsuite/ifuncdep2.c: New file.
194 * testsuite/ifuncmain2.c: New file.
195 * testsuite/ifuncmain3.c: New file.
196 * testsuite/ifuncmod3.c: New file.
197 * testsuite/ifuncmain4.c: New file.
198 * testsuite/ifuncmain5.c: New file.
199 * testsuite/ifuncmod5.c: New file.
200 * testsuite/ifuncmain6pie.c: New file.
201 * testsuite/ifuncmod6.c: New file.
202 * testsuite/ifuncmain7.c: New file.
203 * configure, testsuite/Makefile.in: Rebuild.
204
205 2010-08-18 Ian Lance Taylor <iant@google.com>
206
207 * incremental.cc
208 (Output_section_incremental_inputs::write_input_files): Add cast
209 to avoid signed/unsigned comparison warning.
210 (Output_section_incremental_inputs::write_info_blocks): Likewise.
211
212 2010-08-12 Cary Coutant <ccoutant@google.com>
213
214 * common.cc (Sort_commons::operator()): Remove unnecessary code.
215
216 2010-08-13 Ian Lance Taylor <iant@google.com>
217
218 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
219
220 2010-08-12 Cary Coutant <ccoutant@google.com>
221 Doug Kwan <dougkwan@google.com>
222
223 * resolve.cc (Symbol_table::should_override): When a weak dynamic
224 defintion overrides non-weak undef, remember that the original undef
225 is not weak.
226 * symtab.cc (Symbol_table::sized_write_global): For undef without
227 an original weak binding, set binding to global in output.
228 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
229 * testsuite/Makefile.in: Regenerate.
230 * testsuite/strong_ref_weak_def.sh: New file.
231 * testsuite/strong_ref_weak_def_1.c: Ditto.
232 * testsuite/strong_ref_weak_def_2.c: Ditto.
233
234 2010-08-12 Cary Coutant <ccoutant@google.com>
235
236 * testsuite/incremental_test.sh: Rewrite.
237 * testsuite/incremental_test_1.c: Rewrite.
238 * testsuite/incremental_test_2.c: Rewrite.
239
240 2010-08-12 Cary Coutant <ccoutant@google.com>
241
242 * arm.cc (Target_arm::got_size): Add const.
243 (Target_arm::got_entry_count): New function.
244 (Target_arm::plt_entry_count): New function.
245 (Target_arm::first_plt_entry_offset): New function.
246 (Target_arm::plt_entry_size): New function.
247 (Output_data_plt_arm::entry_count): New function.
248 (Output_data_plt_arm::first_plt_entry_offset): New function.
249 (Output_data_plt_arm::get_plt_entry_size): New function.
250 * i386.cc (Target_i386::got_size): Add const.
251 (Target_i386::got_entry_count): New function.
252 (Target_i386::plt_entry_count): New function.
253 (Target_i386::first_plt_entry_offset): New function.
254 (Target_i386::plt_entry_size): New function.
255 (Output_data_plt_i386::entry_count): New function.
256 (Output_data_plt_i386::first_plt_entry_offset): New function.
257 (Output_data_plt_i386::get_plt_entry_size): New function.
258 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
259 find_incremental_inputs_sections. Dump incremental_got_plt section.
260 * incremental.cc: Include target.h.
261 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
262 parameter. Adjust all callers. Find incremental_got_plt section.
263 (Incremental_inputs::create_data_sections): Create incremental_got_plt
264 section.
265 (Output_section_incremental_inputs::set_final_data_size): Calculate
266 size of incremental_got_plt section.
267 (Output_section_incremental_inputs::do_write): Write the
268 incremental_got_plt section.
269 (Got_plt_view_info): New struct.
270 (Local_got_offset_visitor): New class.
271 (Global_got_offset_visitor): New class.
272 (Global_symbol_visitor_got_plt): New class.
273 (Output_section_incremental_inputs::write_got_plt): New function.
274 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
275 Add parameter. Adjust all callers.
276 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
277 (Incremental_inputs::got_plt_section): New function.
278 (Incremental_inputs::got_plt_section_): New data member.
279 (Incremental_got_plt_reader): New class.
280 * layout.cc (Layout::create_incremental_info_sections): Add the
281 incremental_got_plt section.
282 * object.h (Got_offset_list::get_list): New function.
283 (Got offset_list::for_all_got_offsets): New function.
284 (Sized_relobj::local_got_offset_list): New function.
285 * powerpc.cc (Target_powerpc::got_size): Add const.
286 (Target_powerpc::got_entry_count): New function.
287 (Target_powerpc::plt_entry_count): New function.
288 (Target_powerpc::first_plt_entry_offset): New function.
289 (Target_powerpc::plt_entry_size): New function.
290 (Output_data_plt_powerpc::entry_count): New function.
291 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
292 (Output_data_plt_powerpc::get_plt_entry_size): New function.
293 * sparc.cc (Target_sparc::got_size): Add const.
294 (Target_sparc::got_entry_count): New function.
295 (Target_sparc::plt_entry_count): New function.
296 (Target_sparc::first_plt_entry_offset): New function.
297 (Target_sparc::plt_entry_size): New function.
298 (Output_data_plt_sparc::entry_count): New function.
299 (Output_data_plt_sparc::first_plt_entry_offset): New function.
300 (Output_data_plt_sparc::get_plt_entry_size): New function.
301 * symtab.h (Symbol::got_offset_list): New function.
302 (Symbol_table::for_all_symbols): New function.
303 * target.h (Sized_target::got_entry_count): New function.
304 (Sized_target::plt_entry_count): New function.
305 (Sized_target::plt_entry_size): New function.
306 * x86_64.cc (Target_x86_64::got_size): Add const.
307 (Target_x86_64::got_entry_count): New function.
308 (Target_x86_64::plt_entry_count): New function.
309 (Target_x86_64::first_plt_entry_offset): New function.
310 (Target_x86_64::plt_entry_size): New function.
311 (Output_data_plt_x86_64::entry_count): New function.
312 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
313 (Output_data_plt_x86_64::get_plt_entry_size): New function.
314
315 2010-08-12 Cary Coutant <ccoutant@google.com>
316
317 * archive.cc: Include incremental.h.
318 (Archive::Archive): Initialize incremental_info_.
319 (Archive::include_member): Record archive members in incremental info.
320 (Add_archive_symbols::run): Record begin and end of an archive in
321 incremental info.
322 (Lib_group::include_member): Record objects in incremental info.
323 * archive.h (Incremental_archive_entry): Forward declaration.
324 (Archive::set_incremental_info): New member function.
325 (Archive::incremental_info): New member function.
326 (Archive::Unused_symbol_iterator): New class.
327 (Archive::unused_symbols_begin): New member function.
328 (Archive::unused_symbols_end): New member function.
329 (Archive::incremental_info_): New data member.
330 * incremental-dump.cc (find_input_containing_global): New function.
331 (dump_incremental_inputs): Dump new incremental info sections.
332 * incremental.cc: Include symtab.h.
333 (Output_section_incremental_inputs): New class.
334 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
335 new incremental info sections.
336 (Sized_incremental_binary::do_check_inputs): Likewise.
337 (Incremental_inputs::report_archive): Remove.
338 (Incremental_inputs::report_archive_begin): New function.
339 (Incremental_inputs::report_archive_end): New function.
340 (Incremental_inputs::report_object): New function.
341 (Incremental_inputs::finalize_inputs): Remove.
342 (Incremental_inputs::report_input_section): New function.
343 (Incremental_inputs::report_script): Rewrite.
344 (Incremental_inputs::finalize): Do nothing but finalize string table.
345 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
346 (Incremental_inputs::sized_create_inputs_section_data): Remove.
347 (Incremental_inputs::create_data_sections): New function.
348 (Incremental_inputs::relocs_entsize): New function.
349 (Output_section_incremental_inputs::set_final_data_size): New function.
350 (Output_section_incremental_inputs::do_write): New function.
351 (Output_section_incremental_inputs::write_header): New function.
352 (Output_section_incremental_inputs::write_input_files): New function.
353 (Output_section_incremental_inputs::write_info_blocks): New function.
354 (Output_section_incremental_inputs::write_symtab): New function.
355 * incremental.h (Incremental_script_entry): Forward declaration.
356 (Incremental_object_entry): Forward declaration.
357 (Incremental_archive_entry): Forward declaration.
358 (Incremental_inputs): Forward declaration.
359 (Incremental_inputs_header_data): Remove.
360 (Incremental_inputs_header): Remove.
361 (Incremental_inputs_header_write): Remove.
362 (Incremental_inputs_entry_data): Remove.
363 (Incremental_inputs_entry): Remove.
364 (Incremental_inputs_entry_write): Remove.
365 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
366 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
367 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
368 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
369 Likewise.
370 (Incremental_input_entry): New class.
371 (Incremental_script_entry): New class.
372 (Incremental_object_entry): New class.
373 (Incremental_archive_entry): New class.
374 (Incremental_inputs::Incremental_inputs): Initialize new data members.
375 (Incremental_inputs::report_inputs): Remove.
376 (Incremental_inputs::report_archive): Remove.
377 (Incremental_inputs::report_archive_begin): New function.
378 (Incremental_inputs::report_archive_end): New function.
379 (Incremental_inputs::report_object): Change prototype.
380 (Incremental_inputs::report_input_section): New function.
381 (Incremental_inputs::report_script): Change prototype.
382 (Incremental_inputs::get_reloc_count): New function.
383 (Incremental_inputs::set_reloc_count): New function.
384 (Incremental_inputs::create_data_sections): New function.
385 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
386 (Incremental_inputs::inputs_section): New function.
387 (Incremental_inputs::symtab_section): New function.
388 (Incremental_inputs::relocs_section): New function.
389 (Incremental_inputs::get_stringpool): Add const.
390 (Incremental_inputs::command_line): Add const.
391 (Incremental_inputs::inputs): Remove.
392 (Incremental_inputs::command_line_key): New function.
393 (Incremental_inputs::input_file_count): New function.
394 (Incremental_inputs::input_files): New function.
395 (Incremental_inputs::relocs_entsize): New function.
396 (Incremental_inputs::sized_create_inputs_section_data): Remove.
397 (Incremental_inputs::finalize_inputs): Remove.
398 (Incremental_inputs::Input_info): Remove.
399 (Incremental_inputs::lock_): Remove.
400 (Incremental_inputs::inputs_): Change type.
401 (Incremental_inputs::inputs_map_): Remove.
402 (Incremental_inputs::current_object_entry_): New data member.
403 (Incremental_inputs::inputs_section_): New data member.
404 (Incremental_inputs::symtab_section_): New data member.
405 (Incremental_inputs::relocs_section_): New data member.
406 (Incremental_inputs::reloc_count_): New data member.
407 (Incremental_inputs_reader): New class.
408 (Incremental_symtab_reader): New class.
409 (Incremental_relocs_reader): New class.
410 * layout.cc (Layout::finalize): Move finalization of incremental info
411 and creation of incremental info sections to follow finalization of
412 symbol table. Set offsets for postprocessing sections.
413 (Layout::create_incremental_info_sections): Call
414 Incremental_inputs::create_data_sections. Add incremental symtab
415 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
416 sections to layout after input sections.
417 * layout.h (struct Timespec): Forward declaration.
418 (Layout::incremental_inputs): Add const.
419 (Layout::create_incremental_info_sections): Add parameter.
420 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
421 * object.cc: Include incremental.h.
422 (Relobj::finalize_incremental_relocs): New function.
423 (Sized_relobj::do_layout): Record input sections in incremental info.
424 * object.h (Object::output_section): New function.
425 (Object::output_section_offset): Moved from Relobj.
426 (Object::get_incremental_reloc_base): New function.
427 (Object::get_incremental_reloc_count): New function.
428 (Object::do_output_section): New function.
429 (Object::do_output_section_offset): Moved from Relobj.
430 (Object::do_get_incremental_reloc_base): New function.
431 (Object::do_get_incremental_reloc_count): New function.
432 (Object::Object): Initialize new data members.
433 (Relobj::output_section): Renamed do_output_section and moved to
434 protected.
435 (Relobj::output_section_offset): Moved to Object.
436 (Relobj::do_get_incremental_reloc_base): New function.
437 (Relobj::do_get_incremental_reloc_count): New function.
438 (Relobj::allocate_incremental_reloc_counts): New function.
439 (Relobj::count_incremental_reloc): New function.
440 (Relobj::finalize_incremental_relocs): New function.
441 (Relobj::next_incremental_reloc_index): New function.
442 (Relobj::reloc_counts_): New data member.
443 (Relobj::reloc_bases_): New data member.
444 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
445 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
446 (Sized_relobj::incremental_relocs_scan): New function.
447 (Sized_relobj::incremental_relocs_scan_reltype): New function.
448 (Sized_relobj::incremental_relocs_write): New function.
449 (Sized_relobj::incremental_relocs_write_reltype): New function.
450 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
451 incremental link.
452 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
453 archives and object files elsewhere.
454 (Add_symbols::run): Report object files here.
455 (Finish_group::run): Report end of archive at end of group.
456 * reloc.cc: Include layout.h, incremental.h.
457 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
458 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
459 (Sized_relobj::incremental_relocs_scan): New function.
460 (Sized_relobj::incremental_relocs_scan_reltype): New function.
461 (Sized_relobj::do_relocate_sections): Write incremental relocations.
462 (Sized_relobj::incremental_relocs_write): New function.
463 (Sized_relobj::incremental_relocs_write_reltype): New function.
464 * script.cc (read_input_script): Rewrite test for incremental link.
465 Change call to Incremental_inputs::report_script.
466 * symtab.h (Symbol_table::first_global_index): New function.
467 (Symbol_table::output_count): New function.
468
469 2010-08-12 Doug Kwan <dougkwan@google.com>
470
471 * arm.cc (Target_arm::merge_object_attributes): Check command line
472 options --no-wchar-size-warning and --no-enum-size-warning.
473 * options.h (General_options): Add ld-compatible options
474 --no-enum-size-warning and --no-wchar-size-warning.
475
476 2010-08-04 Ian Lance Taylor <iant@google.com>
477
478 * x86_64.cc (Target_x86_64::Scan::local): Use
479 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
480 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
481 (Target_x86_64::Scan::global): Likewise.
482 (Target_x86_64::Relocate::relocate): Likewise.
483 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
484 Likewise.
485
486 2010-08-03 Cary Coutant <ccoutant@google.com>
487
488 * merge.cc (Output_merge_string::do_add_input_section): Count strings
489 to reserve space in merged_strings vector. Keep total input size
490 for stats.
491 (Output_merge_string::do_print_merge_stats): Print total input size.
492 * merge.h (Output_merge_string): Add input_size_ field.
493 * stringpool.cc (Stringpool_template::string_length): Move
494 implementations out of Stringpool_template class and place in
495 stringpool.h.
496 * stringpool.h (string_length): Move out of Stringpool_template.
497
498 2010-08-03 Ian Lance Taylor <iant@google.com>
499
500 PR 11712
501 * layout.cc (relaxation_loop_body): If address of load segment is
502 set, adjust address to include headers if possible.
503
504 2010-08-03 Ian Lance Taylor <iant@google.com>
505
506 * version.cc (version_string): Bump to 1.10.
507
508 2010-08-03 Ian Lance Taylor <iant@google.com>
509
510 PR 11805
511 * layout.h (enum Output_section_order): Define.
512 (class Layout): Update declarations.
513 * layout.cc (Layout::get_output_section): Add order parameter.
514 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
515 is_first_non_relro parameters. Change all callers.
516 (Layout::choose_output_section): Likewise.
517 (Layout::add_output_section_data): Likewise.
518 (Layout::make_output_section): Likewise. Set order.
519 (Layout::default_section_order): New function.
520 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
521 * output.cc (Output_section::Output_section): Initialize order_.
522 Don't initialize deleted fields.
523 (Output_segment::Output_segment): Don't initialize deleted
524 fields.
525 (Output_segment::add_output_section_to_load): New function
526 replacing add_output_section. Change all callers to call this or
527 add_output_section_to_nonload.
528 (Output_segment::add_output_section_to_nonload): New function.
529 (Output_segment::remove_output_section): Rewrite.
530 (Output_segment::add_initial_output_data): Likewise.
531 (Output_segment::has_any_data_sections): Likewise.
532 (Output_segment::is_first_section_relro): Likewise.
533 (Output_segment::maximum_alignment): Likewise.
534 (Output_segment::has_dynamic_reloc): New function replacing
535 dynamic_reloc_count. Change all callers.
536 (Output_segment::has_dynamic_reloc_list): New function replacing
537 dynamic_reloc_count_list. Change all callers.
538 (Output_segment::set_section_addresses): Rewrite.
539 (Output_segment::set_offset): Rewrite.
540 (Output_segment::find_first_and_last_list): Remove.
541 (Output_segment::set_tls_offsets): Rewrite.
542 (Output_segment::first_section_load_address): Likewise.
543 (Output_segment::output_section_count): Likewise.
544 (Output_segment::section_with_lowest_load_address): Likewise.
545 (Output_segment::write_section_headers): Likewise.
546 (Output_segment::print_sections_to_map): Likewise.
547 * output.h (class Output_data): Remove dynamic_reloc_count_
548 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
549 (Output_data::add_dynamic_reloc): Rewrite.
550 (Output_data::has_dynamic_reloc): New function.
551 (Output_data::dynamic_reloc_count): Remove.
552 (class Output_section): Add order_ field. Remvoe is_relro_local_,
553 is_last_relro_, is_first_non_relro_, is_interp_,
554 is_dynamic_linker_section_ fields. Add order and set_order
555 functions. Remove is_relro_local, set_is_relro_local,
556 is_last_relro, set_is_last_relro, is_first_non_relro,
557 set_is_first_non_relro functions, is_interp, set_is_interp,
558 is_dynamic_linker_section, and set_is_dynamic_linker_section
559 functions.
560 (class Output_segment): Change Output_data_list from std::list to
561 std:;vector. Add output_lists_ field. Remove output_data_ and
562 output_bss_ fields. Update declarations.
563
564 2010-08-02 Ian Lance Taylor <iant@google.com>
565
566 * arm.cc (Target_arm::gc_process_relocs): Use typename.
567 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
568 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
569
570 2010-08-02 Ian Lance Taylor <iant@google.com>
571
572 PR 11855
573 * script.cc (Script_options::Script_options): Initialize
574 symbol_definitions_ and symbol_references_.
575 (Script_options::add_symbol_assignment): Update
576 symbol_definitions_ and symbol_references_.
577 (Script_options::add_symbol_reference): New function.
578 (script_symbol): New function.
579 * script.h (class Script_options): Add symbol_definitions_ and
580 symbol_references_ fields.
581 (Script_options::referenced_const_iterator): New type.
582 (Script_options::referenced_begin): New function.
583 (Script_options::referenced_end): New function.
584 (Script_options::is_referenced): New function.
585 (Script_options::any_unreferenced): New function.
586 * script-c.h (script_symbol): Declare.
587 * yyscript.y (exp): Call script_symbol.
588 * symtab.cc: Include "script.h".
589 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
590 Change all callers. Check symbols referenced by scripts.
591 (Symbol_table::add_undefined_symbols_from_command_line): Add
592 layout parameter. Change all callers.
593 (Symbol_table::do_add_undefined_symbols_from_command_line):
594 Likewise. Break out loop body. Check symbols referenced by
595 scripts.
596 (Symbol_table::add_undefined_symbol_from_command_line): New
597 function broken out of
598 do_add_undefined_symbols_from_command_line.
599 * symtab.h (class Symbol_table): Update declarations.
600 * archive.cc: Include "layout.h".
601 (Archive::should_include_member): Add layout parameter. Change
602 all callers. Check for symbol mentioned in expression.
603 * archive.h (class Archive): Update declaration.
604 * object.cc (Sized_relobj::do_should_include_member): Add layout
605 parameter.
606 * object.h (Object::should_include_member): Add layout parameter.
607 Change all callers.
608 (Object::do_should_include_member): Add layout parameter.
609 (class Sized_relobj): Update declaration.
610 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
611 parameter.
612 * dynobj.h (class Sized_dynobj): Update declaration.
613 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
614 layout parameter.
615 * plugin.h (class Sized_pluginobj): Update declaration.
616
617 2010-08-02 Ian Lance Taylor <iant@google.com>
618
619 PR 11866
620 * output.cc (Output_segment::set_offset): Search for the first and
621 last sections rather than assuming that the list is in order.
622 (Output_segment::find_first_and_last_list): New function.
623 * output.h (class Output_segment): Update declarations.
624 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
625 (relro_strip_test_SOURCES): New variable.
626 (relro_strip_test_DEPENDENCIES): New variable.
627 (relro_strip_test_LDFLAGS): New variable.
628 (relro_strip_test_LDADD): New variable.
629 (relro_strip_test.so): New target.
630
631 2010-08-02 Ian Lance Taylor <iant@google.com>
632
633 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
634 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
635 (Target_i386::got_tlsdesc_section): New function.
636 (Target_i386::got_section): Create space for GOT entries for
637 TLSDESC relocations.
638 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
639 R_386_TLS_GOTDESC.
640 (Target_i386::Scan::global): Likewise.
641 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
642 using TLSDESC GOT.
643 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
644 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
645 (Target_x86_64::got_tlsdesc_section): New function.
646 (Target_x86_64::got_section): Create space for GOT entries for
647 TLSDESC relocations.
648 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
649 R_386_TLS_GOTDESC.
650 (Target_x86_64::Scan::global): Likewise.
651 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
652 using TLSDESC GOT.
653
654 2010-08-02 Ian Lance Taylor <iant@google.com>
655
656 * testsuite/final_layout.sh: Use dc to convert from hex to
657 decimal.
658
659 2010-07-29 Sriraman Tallam <tmsriram@google.com>
660
661 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
662 paramter to the call to gold::gc_process_relocs.
663 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
664 paramter to the call to gold::gc_process_relocs.
665 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
666 parameter to the call to gold::gc_process_relocs.
667 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
668 template parameter to the call to gold::gc_process_relocs.
669 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
670 paramter to the call to gold::gc_process_relocs.
671 * gc.h (get_embedded_addend_size): New function.
672 (gc_process_relocs): Save the size of the reloc for use by ICF.
673 * icf.cc (get_section_contents): Get the addend from the text section
674 for SHT_REL relocation sections.
675 * icf.h (Icf::Reloc_addend_size_info): New typedef.
676 (Icf::Reloc_info): Add new member reloc_addend_size_info.
677 * int_encoding.h (read_from_pointer): New overloaded function.
678 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
679 * testsuite/icf_sht_rel_addend_test.sh: New file.
680 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
681 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
682
683 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
684
685 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
686 * Makefile.in: Regenerate.
687 * testsuite/Makefile.in: Regenerate.
688
689 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
690
691 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
692 * gold/testsuite/debug_msg.cc: Likewise.
693 * gold/testsuite/odr_violation1.cc
694 * gold/testsuite/odr_violation2.cc
695
696 2010-07-21 Cary Coutant <ccoutant@google.com>
697
698 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
699 string, and length fields.
700 (Output_merge_string::Merged_strings_list): New type.
701 (Output_merge_string::Merged_strings_lists): New typedef.
702 (Output_merge_string): Replace merged_strings_ with
703 merged_strings_lists_.
704 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
705 Merged_strings_list per input object and section. Don't store pointer
706 to the string. Don't store length with each merged string entry.
707 (Output_merge_string::finalize_merged_data): Loop over list of merged
708 strings lists. Recompute length of each merged string.
709
710 2010-07-15 Cary Coutant <ccoutant@google.com>
711
712 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
713 here.
714
715 2010-07-14 Ian Lance Taylor <iant@google.com>
716
717 * descriptors.cc (Descriptors::open): Report correct name in error
718 message.
719
720 2010-07-13 Doug Kwan <dougkwan@google.com>
721
722 * arm.cc (Arm_input_section::Arm_input_section): For a
723 SHT_ARM_EXIDX section, always keeps the input sections.
724 (Arm_input_section::set_exidx_section_link): New method.
725 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
726 has_errors_ to false.
727 (Arm_exidx_input_section::has_errors,
728 Arm_exidx_input_section::set_has_errors): New methods.
729 (Arm_exidx_input_section::has_errors_): New data member.
730 (Arm_relobj::get_exidx_shndx_list): New method.
731 (Arm_output_section::append_text_sections_to_list): Do not skip
732 section without SHF_EXECINSTR.
733 (Arm_output_section::fix_exidx_coverage): Skip input sections with
734 errors.
735 (Arm_relobj::make_exidx_input_section): Add new parameter for text
736 section header. Make error messages more verbose. Check for
737 a non-executable section linked to an EXIDX section.
738 (Arm_relobj::do_read_symbols): Remove error checking, which has been
739 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
740 check that there is no deferred EXIDX section if we exit early.
741 Instead of not making an EXIDX section in case of an error, make one
742 and set the has_errors flag of it.
743 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
744 in a relocatable link.
745 (Target_arm::do_relax): Look for the EXIDX output section instead of
746 assuming that it is called .ARM.exidx.
747 (Target_arm::fix_exidx_coverage): Add a new parameter for input
748 section list. Do not check for SHF_EXECINSTR section flags but
749 skip any input section with errors.
750 * output.cc (Output_section::Output_section): Initialize
751 always_keeps_input_sections_ to false.
752 (Output_section::add_input_section): Check for
753 always_keeps_input_sections_.
754 * output.h (Output_section::always_keeps_input_sections,
755 Output_section::set_always_keeps_input_sections): New methods.
756 (Output_section::always_keeps_input_sections): New data member.
757
758 2010-07-13 Rafael Espindola <espindola@google.com>
759
760 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
761 * fileread.h (Input_file): Add try_extra_search_path and find_file.
762
763 2010-07-13 Philip Herron <herron.philip@googlemail.com>
764 Ian Lance Taylor <iant@google.com>
765
766 * output.h (Output_section_lookup_maps::add_merge_section):
767 Correct check of whether value was inserted.
768 (Output_section_lookup_maps::add_merge_input_section): Likewise.
769 (Output_section_lookup_maps::add_relaxed_input_section):
770 Likewise.
771 * arm.cc (Target_arm::got_section): Remove used local os.
772 * i386.cc (Target_i386::got_section): Likewise.
773 * x86_64.cc (Target_x86_64::got_section): Likewise.
774 * sparc.cc (Target_sparc::got_section): Likewise.
775 (Target_sparc::relocate): Remove unused local have_got_offset.
776 * powerpc.cc (Target_powerpc::relocate): Likewise.
777
778 2010-07-13 Ian Lance Taylor <iant@google.com>
779
780 * compressed_output.cc (zlib_decompress): Fix signature in
781 !HAVE_ZLIB_H case.
782
783 * archive.cc (Archive::include_member): Unlock an external member
784 of a thin archive. Don't bother to delete an object we know is
785 NULL.
786
787 2010-07-12 Cary Coutant <ccoutant@google.com>
788
789 * compressed_output.cc (zlib_decompress): New function.
790 (get_uncompressed_size): New function.
791 (decompress_input_section): New function.
792 * compressed_output.h (get_uncompressed_size): New function.
793 (decompress_input_section): New function.
794 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
795 Handle compressed debug sections.
796 * layout.cc (is_compressed_debug_section): New function.
797 (Layout::output_section_name): Map compressed section names to
798 canonical names.
799 * layout.h (is_compressed_debug_section): New function.
800 (is_debug_info_section): Recognize compressed debug sections.
801 * merge.cc: Include compressed_output.h.
802 (Output_merge_data::do_add_input_section): Handle compressed
803 debug sections.
804 (Output_merge_string::do_add_input_section): Handle compressed
805 debug sections.
806 * object.cc: Include compressed_output.h.
807 (Sized_relobj::Sized_relobj): Initialize new data members.
808 (build_compressed_section_map): New function.
809 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
810 * object.h (Object::section_is_compressed): New method.
811 (Object::do_section_is_compressed): New method.
812 (Sized_relobj::Compressed_section_map): New type.
813 (Sized_relobj::do_section_is_compressed): New method.
814 (Sized_relobj::compressed_sections_): New data member.
815 * output.cc (Output_section::add_input_section): Handle compressed
816 debug sections.
817 * reloc.cc: Include compressed_output.h.
818 (Sized_relobj::write_sections): Handle compressed debug sections.
819
820 2010-07-08 Cary Coutant <ccoutant@google.com>
821
822 * resolve.cc (Symbol_table::resolve): Remember whether undef was
823 weak when resolving to a dynamic def.
824 (Symbol_table::should_override): Add adjust_dyndef flag; set it
825 for weak undef/dynamic def cases. Adjust callers.
826 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
827 undef_binding_weak_.
828 (Symbol_table::sized_write_globals): Adjust symbol binding.
829 (Symbol_table::sized_write_symbol): Add binding parameter.
830 * symtab.h (Symbol::set_undef_binding): New method.
831 (Symbol::is_undef_binding_weak): New method.
832 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
833 (Symbol_table::should_override): Add new parameter.
834 (Symbol_table::sized_write_symbol): Add new parameter.
835
836 * testsuite/weak_undef_file1.cc: Add new test case.
837 * testsuite/weak_undef_file2.cc: Fix header comment.
838 * testsuite/weak_undef_test.cc: Add new test case.
839
840 2010-06-29 Doug Kwan <dougkwan@google.com>
841
842 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
843 Initialize USE_SYMBOL_.
844 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
845 definition.
846 (Arm_reloc_property::uses_symbol_): New data member declaration.
847 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
848 uses symbol value and symbol is undefined but not weakly undefined.
849
850 2010-06-28 Rafael Espindola <espindola@google.com>
851
852 * plugin.cc (Plugin::load): Use dlerror.
853
854 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
855
856 * symtab.cc (detect_odr_violations): When reporting an ODR
857 violation, report an object where the symbol is defined.
858
859 2010-06-25 Doug Kwan <dougkwan@google.com>
860
861 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
862 (Target_arm::section_may_have_icf_unsafe_pointers): New method
863 definition.
864 (Target_arm::Scan::local_reloc_may_be_function_pointer,
865 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
866 target hook to detect function points.
867 (Target_arm::Scan::possible_function_pointer_reloc): New method.
868 * icf.h (Icf::check_section_for_function_pointers): Change type of
869 parameter SECTION_NAME to const reference to std::string. Use
870 target hook to determine if section may have unsafe pointers.
871 * target.h (Target::section_may_have_icf_unsafe_pointers): New
872 method definition.
873
874 2010-06-21 Rafael Espindola <espindola@google.com>
875
876 * fileread.cc (Input_file::find_fie): New
877 (Input_file::open): Use Input_file::find_fie.
878 * fileread.h (Input_file::find_fie): New
879 * plugin.cc (set_extra_library_path): New.
880 (Plugin::load): Add set_extra_library_path to the transfer vector.
881 (Plugin_manager::set_extra_library_path): New.
882 (Plugin_manager::add_input_file): Use the extra search path if set.
883 (set_extra_library_path(): New.
884 * plugin.h (Plugin_manager): Add set_extra_library_path and
885 extra_search_path_.
886
887 2010-06-19 Cary Coutant <ccoutant@google.com>
888
889 * layout.cc (gdb_sections): Add .debug_types.
890 (lines_only_debug_sections): Likewise.
891
892 2010-06-18 Rafael Espindola <espindola@google.com>
893
894 * plugin.cc (add_input_file,add_input_library)
895 (Plugin_manager::add_input_file): Make filename arguments const.
896 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
897 const.
898
899 2010-06-16 Doug Kwan <dougkwan@google.com>
900
901 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
902 .ARM.attributes section if we have not merged any input
903 attributes sections.
904
905 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
906
907 * arm.cc: Allow combining objects with no EABI version
908 information.
909
910 2010-06-15 Rafael Espindola <espindola@google.com>
911
912 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
913
914 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
915
916 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
917 (struct iovec): Correct !HAVE_READV definition.
918
919 2010-06-10 Cary Coutant <ccoutant@google.com>
920
921 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
922 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
923 reloc sections.
924 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
925
926 PR 11683
927 * symtab.h (Symbol::is_placeholder): New member function.
928 * target-reloc.h (relocate_section): Check for placeholder symbols.
929
930 * testsuite/Makefile.am (plugin_test_8): New test.
931 (plugin_test_9): New test.
932 * testsuite/Makefile.in: Regenerate.
933
934 2010-06-09 Nick Clifton <nickc@redhat.com>
935
936 * yyscript.y (input_list_element): Allow strings prefixed with
937 the '-' character. Treat these as libraries.
938 * script.cc (script_add_library): New function. Adds a library
939 specified by "-l<name>" found in an input script.
940 * script-c.h: Add prototype for script_add_library.
941
942 2010-06-07 Doug Kwan <dougkwan@google.com>
943
944 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
945 Restrict stub-group size to be within long conditional branch
946 range when working around cortex-A8 erratum.
947
948 2010-06-07 Damien Diederen <dd@crosstwine.com>
949
950 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
951 #ifdef typo.
952
953 2010-06-03 Sriraman Tallam <tmsriram@google.com>
954
955 PR gold/11658
956 * output.cc
957 (Output_section::Input_section_sort_entry::compare_section_ordering):
958 Change to return non-zero correctly.
959 (Output_section::Input_section_sort_section_order_index_compare
960 ::operator()): Change to fix ambiguity in comparisons.
961
962 2010-06-01 Sriraman Tallam <tmsriram@google.com>
963
964 * gold.h (is_wildcard_string): New function.
965 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
966 (Layout::layout_eh_frame): Ditto.
967 (Layout::find_section_order_index): New method.
968 (Layout::read_layout_from_file): New method.
969 * layout.h (Layout::find_section_order_index): New method.
970 (Layout::read_layout_from_file): New method.
971 (Layout::input_section_position_): New private member.
972 (Layout::input_section_glob_): New private member.
973 * main.cc (main): Call read_layout_from_file here.
974 * options.h (--section-ordering-file): New option.
975 * output.cc (Output_section::input_section_order_specified_): New
976 member.
977 (Output_section::Output_section): Initialize new member.
978 (Output_section::add_input_section): Add new parameter.
979 Keep input sections when --section-ordering-file is used.
980 (Output_section::set_final_data_size): Sort input sections when
981 section ordering file is specified.
982 (Output_section::Input_section_sort_entry): Add new parameter.
983 Check sorting type.
984 (Output_section::Input_section_sort_entry::compare_section_ordering):
985 New method.
986 (Output_section::Input_section_sort_compare::operator()): Change to
987 consider section_order_index.
988 (Output_section::Input_section_sort_init_fini_compare::operator()):
989 Change to consider section_order_index.
990 (Output_section::Input_section_sort_section_order_index_compare
991 ::operator()): New method.
992 (Output_section::sort_attached_input_sections): Change to sort
993 according to section order when specified.
994 (Output_section::add_input_section<32, true>): Add new parameter.
995 (Output_section::add_input_section<64, true>): Add new parameter.
996 (Output_section::add_input_section<32, false>): Add new parameter.
997 (Output_section::add_input_section<64, false>): Add new parameter.
998 * output.h (Output_section::add_input_section): Add new parameter.
999 (Output_section::input_section_order_specified): New
1000 method.
1001 (Output_section::set_input_section_order_specified): New method.
1002 (Input_section::Input_section): Initialize section_order_index_.
1003 (Input_section::section_order_index): New method.
1004 (Input_section::set_section_order_index): New method.
1005 (Input_section::section_order_index_): New member.
1006 (Input_section::Input_section_sort_section_order_index_compare): New
1007 struct.
1008 (Output_section::input_section_order_specified_): New member.
1009 * script-sections.cc (is_wildcard_string): Delete and move modified
1010 method to gold.h.
1011 (Output_section_element_input::Output_section_element_input): Modify
1012 call to is_wildcard_string.
1013 (Output_section_element_input::Input_section_pattern
1014 ::Input_section_pattern): Ditto.
1015 (Output_section_element_input::Output_section_element_input): Ditto.
1016 * testsuite/Makefile.am (final_layout): New test case.
1017 * testsuite/Makefile.in: Regenerate.
1018 * testsuite/final_layout.cc: New file.
1019 * testsuite/final_layout.sh: New file.
1020
1021 2010-06-01 Rafael Espindola <espindola@google.com>
1022
1023 * plugin.cc (Plugin::load): Pass the output name to the plugin.
1024
1025 2010-06-01 Rafael Espindola <espindola@google.com>
1026
1027 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
1028 visibility of symbols.
1029
1030 2010-05-27 Doug Kwan <dougkwan@google.com>
1031
1032 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
1033 from start of output section instead of address for a local symbol
1034 in a merged or relaxed section when doing a relocatable link.
1035
1036 2010-05-26 Rafael Espindola <espindola@google.com>
1037
1038 PR 11604
1039 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
1040 adding sections the garbage collector removed.
1041 * gold/testsuite/Makefile.am: Add test.
1042 * gold/testsuite/Makefile.in: Regenerate.
1043 * gold/testsuite/plugin_test_7.sh: New.
1044 * gold/testsuite/plugin_test_7_1.c: New.
1045 * gold/testsuite/plugin_test_7_2.c: New.
1046
1047 2010-05-26 Rafael Espindola <espindola@google.com>
1048
1049 * script-sections.cc (Output_section_definition::set_section_addresses):
1050 Check for --section-start.
1051
1052 2010-05-26 Doug Kwan <dougkwan@google.com>
1053
1054 * arm.cc (Arm_scan_relocatable_relocs): New class.
1055 (Target_arm::relocate_special_relocatable): New method.
1056 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
1057 (Arm_relocate_functions::thumb_branch_common): Same.
1058 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
1059 instead of Default_scan_relocatable_relocs.
1060 * target-reloc.h (relocate_for_relocatable): Let target handle
1061 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
1062 * target.h (Sized_target::relocate_special_relocatable): New method.
1063
1064 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1065
1066 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
1067
1068 2010-05-23 Doug Kwan <dougkwan@google.com>
1069
1070 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
1071 instead of a cast.
1072 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
1073 with a direct branch, not a conditional branch, to a stub.
1074 * merge.cc (Output_merge_base::record_input_section): New method
1075 defintion.
1076 (Output_merge_data::do_add_input_section): Record input section if
1077 keeps-input-sections flag is set.
1078 (Output_merge_string::do_add_input_section): Ditto.
1079 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
1080 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
1081 INPUT_SECTIONS_.
1082 (Output_merge_base::keeps_input_sections,
1083 Output_merge_base::set_keeps_input_sections,
1084 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
1085 method definitions.
1086 (Output_merge_base::Input_sections): New type declaration.
1087 (Output_merge_base::input_sections_begin,
1088 Output_merge_base::input_sections_end,
1089 Output_merge_base::do_set_keeps_input_sections): New method definitions.
1090 (Output_merge_base::bool keeps_input_sections_,
1091 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
1092 Output_merge_base::input_sections_): New data members.
1093 (Output_merge_data::do_set_keeps_input_sections): New method
1094 defintion.
1095 (Output_merge_string::do_set_keeps_input_sections): Ditto.
1096 * output.cc (Output_section::Input_section::relobj): Move method
1097 defintion from class declaration to here and handle merge sections.
1098 (Output_section::Input_section::shndx): Ditto.
1099 (Output_section::Output_section): Remove initializations of removed
1100 data members and initialize new data member LOOKUP_MAPS_.
1101 (Output_section::add_input_section): Set keeps-input-sections flag
1102 for a newly created merge output section as appropriate. Adjust code
1103 to use Output_section_lookup_maps class.
1104 (Output_section::add_relaxed_input_section): Adjst code for lookup
1105 maps code refactoring.
1106 (Output_section::add_merge_input_section): Add a new parameter
1107 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
1108 class. If adding input section to a newly created merge output
1109 section fails, remove the new merge section.
1110 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
1111 Adjust code for use of the Output_section_lookup_maps class.
1112 (Output_section::find_merge_section): Ditto.
1113 (Output_section::build_lookup_maps): New method defintion.
1114 (Output_section::find_relaxed_input_section): Adjust code to use
1115 Output_section_lookup_maps class.
1116 (Output_section::get_input_sections): Export merge sections. Adjust
1117 code to use Output_section_lookup_maps class.
1118 (Output_section:::add_script_input_section): Adjust code to use
1119 Output_section_lookup_maps class. Update lookup maps for merge
1120 sections also.
1121 (Output_section::discard_states): Use Output_section_lookup_maps.
1122 (Output_section::restore_states): Same.
1123 * output.h (Merge_section_properties): Move class defintion out of
1124 Output_section.
1125 (Output_section_lookup_maps): New class.
1126 (Output_section::Input_section::is_merge_section): New method
1127 defintion.
1128 (Output_section::Input_section::relobj): Move defintion out of class
1129 defintion. Declare method only.
1130 (Output_section::Input_section::shndx): Ditto.
1131 (Output_section::Input_section::output_merge_base): New method defintion.
1132 (Output_section::Input_section::u2_.pomb): New union field.
1133 (Output_section::Merge_section_by_properties_map,
1134 Output_section::Output_section_data_by_input_section_map,
1135 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
1136 Remove types.
1137 (Output_section::add_merge_input_section): Add new parameter
1138 KEEPS_INPUT_SECTIONS.
1139 (Output_section::build_lookup_maps): New method declaration.
1140 (Output_section::merge_section_map_,
1141 Output_section::merge_section_by_properties_map_,
1142 Output_section::relaxed_input_section_map_,
1143 Output_section::is_relaxed_input_section_map_valid_): Remove data
1144 members.
1145 (Output_section::lookup_maps_): New data member.
1146
1147 2010-05-21 Doug Kwan <dougkwan@google.com>
1148
1149 PR gold/11619
1150 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
1151 avoid a compilation error.
1152
1153 2010-05-19 Rafael Espindola <espindola@google.com>
1154
1155 * script-sections.cc (Output_section_definition::allocate_to_segment):
1156 Update the phdrs_list even when the output section is NULL.
1157 * testsuite/Makefile.am: Add test.
1158 * testsuite/Makefile.in: Regenerate.
1159 * testsuite/script_test_9.cc: New.
1160 * testsuite/script_test_9.sh: New.
1161 * testsuite/script_test_9.t: New.
1162
1163 2010-05-19 Doug Kwan <dougkwan@google.com>
1164
1165 * arm.cc (Arm_input_section::original_size): New method.
1166 (Arm_input_section::do_addralign): Add a cast.
1167 (Arm_input_section::do_output_offset): Remove static cast.
1168 (Arm_input_section::original_addralign,
1169 Arm_input_section::original_size_): Change type to uint32_t.
1170 (Arm_input_section::init): Add safe casts for section alignment
1171 and size.
1172 (Arm_input_section::set_final_data_size): Do not set address and
1173 offset of stub table.
1174 (Arm_output_section::fix_exidx_coverage): Change use of of
1175 Output_section::Simple_input_section to that of
1176 Output_section::Input_section.
1177 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
1178 except for the first pass.
1179 * output.cc (Output_section::get_input_sections): Change type of
1180 input_sections to std::list<Input_section>.
1181 (Output_section::add_script_input_section): Rename from
1182 Output_section::add_simple_input_section. Change type of SIS
1183 parameter from Simple_input_section to Input_section.
1184 * output.h (Output_section::Simple_input_section): Remove class.
1185 (Output_section::Input_section): Change class visibility to public.
1186 (Output_section::Input_section::addralign): Use stored alignments
1187 for special input sections if set.
1188 (Output_section::Input_section::set_addralign): New method.
1189 (Output_section::get_input_sections): Change parameter type from
1190 list of Simple_input_section to list of Input_section.
1191 (Output_section::add_script_input_section): Rename from
1192 Output_section::add_simple_input_section. Change first parameter's
1193 type from Simple_input_section to Input_section and remove the
1194 second and third parameters.
1195 * script-sections.cc (Input_section::Input_section_list): Change
1196 type to list of Output_section::Input_section/
1197 (Input_section_info::Input_section_info): Change parameter type of
1198 INPUT_SECTION to Output_section::Input_section.
1199 (Input_section_info::input_section): Change return type.
1200 (Input_section_info::input_section_): Change type to
1201 Output_section::Input_section.
1202 (Output_section_element_input::set_section_addresses): Adjust code
1203 to use Output_section::Input_section instead of
1204 Output_section::Simple_input_section. Adjust code for renaming
1205 of Output_section::add_simple_input_section.
1206 (Orphan_output_section::set_section_addresses): Ditto.
1207
1208 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1209
1210 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
1211 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
1212
1213 2010-05-18 Rafael Espindola <espindola@google.com>
1214
1215 * options.cc (General_options::finalize): Handle -nostdlib.
1216 * options.h (nostdlib): New option.
1217 * script.cc (script_add_search_dir): Handle -nostdlib.
1218
1219 2010-05-12 Doug Kwan <dougkwan@google.com>
1220
1221 * arm.cc (Target_arm::do_finalize_sections): Create an empty
1222 attributes section only if there no attributes section after merging.
1223 (Target_arm::merge_object_attributes): Move value of
1224 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
1225 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
1226 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
1227 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
1228 and arm_attr_merge_7.stdout.
1229 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
1230 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
1231 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
1232 arm_attr_merge_7b.o): New rules.
1233 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
1234 arm_attr_merge_7
1235 * testsuite/Makefile.in: Regenerate.
1236 * testsuite/arm_attr_merge.sh: New file.
1237 * testsuite/arm_attr_merge_[67][ab].s: Same.
1238
1239 2010-05-05 Nick Clifton <nickc@redhat.com>
1240
1241 * po/es.po: Updated Spanish translation.
1242
1243 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1244
1245 * Makefile.am (install-exec-local): Properly install gold as
1246 default cross linker.
1247 * Makefile.in: Regenerated.
1248
1249 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
1250 Nick Clifton <nickc@redhat.com>
1251
1252 * configure.ac (install_as_default): Define and set to false
1253 unless --enable-gold or --enable-gold=both/gold has been
1254 specified.
1255 * configure: Regenerate.
1256
1257 * Makefile.am (install-exec-local): Install the executable as
1258 'ld.gold'. If install_as_default is true then also install it as
1259 'ld'.
1260 * Makefile.in: Regenerated.
1261
1262 2010-04-24 Ian Lance Taylor <iant@google.com>
1263
1264 * layout.cc (Layout::layout_reloc): In relocatable link don't
1265 combine reloc sections for grouped sections.
1266
1267 2010-04-23 Sriraman Tallam <tmsriram@google.com>
1268
1269 * gc.h (gc_process_relocs): Pass information on relocs pointing to
1270 sections that are not ordinary to icf.
1271 * icf.cc (get_section_contents): Handle relocation pointing to section
1272 with no object or shndx information.
1273 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
1274 * testsuite/Makefile.in: Regenerate.
1275 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
1276 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
1277
1278 2010-04-22 Ian Lance Taylor <iant@google.com>
1279
1280 * expression.cc (Expression::Expression_eval_info): Add
1281 result_alignment_pointer field.
1282 (Expression::eval_with_dot): Add result_alignment_pointer
1283 parameter. Change all callers.
1284 (Expression::eval_maybe_dot): Likewise.
1285 (class Binary_expression): Add alignment_pointer parameter to
1286 left_value and right_value. Change all callers.
1287 (BINARY_EXPRESSION): Set result alignment.
1288 (class Trinary_expression): Add alignment_pointer parameter to
1289 arg2_value and arg3_value. Change all callers.
1290 (Trinary_cond::value): Set result alignment.
1291 (Max_expression::value, Min_expression::value): Likewise.
1292 (Align_expression::value): Likewise.
1293 * script-sections.cc (class Sections_element): Add dot_alignment
1294 parameter to set_section_addresses virtual function. Update
1295 instantiations.
1296 (class Output_section_element): Likewise.
1297 (Script_sections::create_segments): Add dot_alignment parameter.
1298 Change all callers.
1299 (Script_sections::create_segments_from_phdrs_clause): Likewise.
1300 (Script_sections::set_phdrs_clause_addresses): Likewise.
1301 * script-sections.h: Update declarations.
1302 * script.h: Update declarations.
1303 * output.h (Output_segment::set_minimum_p_align): Don't decrease
1304 min_p_align.
1305 * testsuite/script_test_3.t: Set large alignment.
1306 * testsuite/script_test_3.sh: Make sure that at least one LOAD
1307 segment has expected alignment.
1308
1309 2010-04-22 Nick Clifton <nickc@redhat.com>
1310
1311 * po/gold.pot: Updated by the Translation project.
1312 * po/vi.po: Updated Vietnamese translation.
1313
1314 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
1315
1316 * testsuite/Makefile.am (check_PROGRAMS): Add
1317 icf_virtual_function_folding_test.
1318 * testsuite/Makefile.in: Regenerated.
1319
1320 2010-04-15 Andrew Haley <aph@redhat.com>
1321
1322 * options.h (merge_exidx_entries): New option.
1323 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
1324 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
1325 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
1326 (Target_arm::merge_exidx_entries): New function.
1327 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
1328 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
1329 to Arm_exidx_fixup constructor.
1330 Add new arg, merge_exidx_entries.
1331 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
1332 Arm_output_section::fix_exidx_coverage.
1333
1334 2010-04-18 Sriraman Tallam <tmsriram@google.com>
1335
1336 * icf.cc (get_section_contents): Check for preemptible functions.
1337 Ignore addend when appropriate.
1338 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
1339 section folded.
1340 (add_from_relobj): Check for section folded.
1341 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
1342 * symtab.h (should_add_dynsym_entry): Add new parameter.
1343 * target-reloc.h (scan_relocs): Check for section folded.
1344 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
1345 Check reloc types for function pointers in shared objects.
1346 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
1347 case.
1348 (icf_preemptible_functions_test): New test case.
1349 (icf_string_merge_test): New test case.
1350 * testsuite.Makefile.in: Regenerate.
1351 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
1352 bar_glob. Refactor code.
1353 * testsuite/icf_preemptible_functions_test.cc: New file.
1354 * testsuite/icf_preemptible_functions_test.sh: New file.
1355 * testsuite/icf_string_merge_test.cc: New file.
1356 * testsuite/icf_string_merge_test.sh: New file.
1357 * testsuite/icf_virtual_function_folding_test.cc: New file.
1358 * testsuite/icf_virtual_function_folding_test.sh: New file.
1359
1360 2010-04-14 Doug Kwan <dougkwan@google.com>
1361
1362 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
1363 for local symbol recounting if we remove a section due to ICF.
1364 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
1365 there are no regular objects in input.
1366
1367 2010-04-13 Doug Kwan <dougkwan@google.com>
1368
1369 * arm.cc (Arm_input_section::set_final_data_size): Compute
1370 accurate final data size instead of using current data size.
1371
1372 2010-04-09 Doug Kwan <dougkwan@google.com>
1373
1374 * layout.cc (Layout::choose_output_section): Handle script section
1375 types.
1376 (Layout::make_output_section_for_script): Add section type parameter.
1377 Handle script section types.
1378 * layout.h (Layout::make_output_section_for_script): Add section
1379 type parameter.
1380 * output.cc (Output_section::Output_section): Initialize data member
1381 is_noload_.
1382 (Output_section::do_reset_address_and_file_offset): Do not set address
1383 to 0 if section is a NOLOAD section.
1384 * output.h (Output_section::is_noload): New method.
1385 (Output_section::set_is_noload): Ditto.
1386 (Output_section::is_noload_): New data member.
1387 * script-c.h (Script_section_type): New enum type.
1388 (struct Parser_output_section_header): Add new file section_type.
1389 * script-sections.cc (Sections_element::output_section_name): Add
1390 parameter for returning script section type.
1391 (Output_section_definition::output_section_name): Ditto.
1392 (Output_section_definition::section_type)P; New method.
1393 (Output_section_definiton::script_section_type_name): Ditto.
1394 (Output_section_definition::script_section_type_): New data member.
1395 (Output_section_definition::Output_section_definition): Initialize
1396 data member Output_section_definition::script_section_type_.
1397 (Output_section_definition::create_sections): Pass script section type
1398 to Layout::make_output_section_for_script.
1399 (Output_section_definition::output_section_name): Return script
1400 section type to caller.
1401 (Output_section_definition::set_section_address): Do not advance
1402 dot value and load address if section type is NOLOAD. Set address
1403 of NOLOAD sections regardless of section flags.
1404 (Output_section_definition::print): Print section type if it is
1405 not SCRIPT_SECTION_TYPE_NONE.
1406 (Output_section_definition::section_type): New method.
1407 (Output_section_definition::script_section_type_name): Ditto.
1408 (Script_sections::output_section_name): Add new parameter
1409 PSECTION_TYPE for returning script section type. Pass it to
1410 section elements. Handle discard sections.
1411 (Sort_output_sections::operator()): Handle NOLOAD sections.
1412 * script-sections.h (Script_sections::Section_type): New enum type.
1413 (Script_sections::output_section_name): Add a new parameter for
1414 returning script section type.
1415 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
1416 INFO and NOLOAD.
1417 * yyscript.y (union): Add new field SECTION_TYPE.
1418 (COPY, DSECT, INFO, NOLOAD): New tokens.
1419 (opt_address_and_section_type): Change type to output_section_header.
1420 (section_type): New non-terminal
1421 (section_header): Handle section type.
1422 (opt_address_and_section_type): Return section type value.
1423
1424 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
1425
1426 * testsuite/plugin_common_test_1.c (foo): Add prototype.
1427 * testsuite/plugin_common_test_2.c (foo): Likewise.
1428
1429 2010-04-08 Doug Kwan <dougkwan@google.com>
1430
1431 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
1432 Output_merge_data.
1433 * output.cc (Output_section::add_merge_input_section): Simplify
1434 code and return status of Output_merge_base::add_input_section.
1435 Update merge section map only if Output_merge_base::add_input_section
1436 returns true.
1437
1438 2010-04-07 Doug Kwan <dougkwan@google.com>
1439
1440 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
1441 if section is marked as containing instructions but has no mapping
1442 symbols.
1443 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
1444 correct section index.
1445 (Arm_relobj::find_linked_text_section): Ditto.
1446
1447 2010-04-07 Cary Coutant <ccoutant@google.com>
1448
1449 * archive.cc (include_member): Destroy Read_symbols_data object before
1450 releasing file.
1451 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
1452 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
1453 (Read_symbols_data::~Read_symbols_data) New destructor.
1454 (Section_relocs::Section_relocs) New constructor.
1455 (Section_relocs::~Section_relocs) New destructor.
1456 (Read_relocs_data::Read_relocs_data) New constructor.
1457 (Read_relocs_data::~Read_relocs_data) New destructor.
1458 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
1459 pointers to NULL after deleting.
1460
1461 2010-04-07 Doug Kwan <dougkwan@google.com>
1462
1463 * arm.cc: Replace "endianity" with "endianness" in comments.
1464 (Arm_exidx_cantunwind): Ditto.
1465 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
1466 (Arm_relobj::merge_flags_and_attributes): New method.
1467 (Arm_relobj::merge_flags_and_attributes_): New data member.
1468 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
1469 (Arm_relobj::scan_sections_for_stubs): Ditto.
1470 (Arm_relobj::do_read_symbols): Check to see if we really want to
1471 merge processor-specific flags and attributes. Exit early if
1472 an object is empty except for section names and the undefined symbol.
1473 (Target_arm::do_finalize_sections): Move check for ELF format to
1474 Arm_relobj::do_read_symbols. Merge processor specific flags and
1475 attributes from a regular object only when we have determined that
1476 it is aapropriate. Do not create an .ARM.attributes section in
1477 output if there is no regular input object.
1478 (Target_arm::merge_processor_specific_flags): Check
1479 --warn-mismatch before printing any error.
1480 (Target_arm::merge_object_attributes): Ditto.
1481 * gold.cc (queue_middle_tasks): Handle the case in which there is
1482 no regular object in input.
1483 * options.cc (General_options::parse_EB): New method.
1484 (General_options::parse_EL): Same.
1485 (General_options::General_options): Initialize endianness_.
1486 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
1487 New options.
1488 (General_options::Endianness): New enum.
1489 (General_options::endianness): New method.
1490 (General_options::endianness_): New data member.
1491 * parameters.cc (Parameters::set_options): Check target endianness.
1492 (Parameters::set_target_once): Ditto.
1493 (Parameters::check_target_endianness): New method.
1494 (parameters_force_valid_target): If either -EL or -EB is specified,
1495 use it to define endianness of default target.
1496 * parameters.h (Parameters::check_target_endianness): New method
1497 declaration.
1498 * target.h (class Target): Change "endianity" to "endianness"
1499 in comments.
1500
1501 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1502
1503 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
1504 * configure: Regenerate.
1505 * Makefile.in: Regenerate.
1506 * testsuite/Makefile.in: Regenerate.
1507
1508 2010-04-06 Cary Coutant <ccoutant@google.com>
1509
1510 gcc PR lto/42757
1511 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
1512 prevailing definitions of common symbols.
1513 * testsuite/plugin_test_6.sh: New test case.
1514 * testsuite/plugin_common_test_1.c: New test case.
1515 * testsuite/plugin_common_test_2.c: New test case.
1516 * testsuite/Makefile.am (plugin_test_6): New test case.
1517 * testsuite/Makefile.in: Regenerate.
1518
1519 2010-04-06 Nick Clifton <nickc@redhat.com>
1520
1521 * po/vi.po: New Vietnamese translation.
1522
1523 2010-03-30 Doug Kwan <dougkwan@google.com>
1524
1525 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
1526
1527 2010-03-25 Doug Kwan <dougkwan@google.com>
1528
1529 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
1530 to avoid a conversion warning on a 32-bit host.
1531
1532 2010-03-24 Ian Lance Taylor <iant@google.com>
1533
1534 * testsuite/script_test_3.t: Add a TLS segment.
1535 * testsuite/Makefile.am (check_PROGRAMS): Add
1536 tls_phdrs_script_test.
1537 (tls_phdrs_script_test_SOURCES): Define.
1538 (tls_phdrs_script_test_DEPENDENCIES): Define.
1539 (tls_phdrs_script_test_LDFLAGS): Define.
1540 (tls_phdrs_script_test_LDADD): Define.
1541 * testsuite/Makefile.in: Rebuild.
1542
1543 2010-03-23 Cary Coutant <ccoutant@google.com>
1544
1545 * fileread.cc (find_or_make_view): Fix comment.
1546
1547 2010-03-23 Ian Lance Taylor <iant@google.com>
1548
1549 * script-sections.cc (class Orphan_section_placement): Define
1550 PLACE_TLS and PLACE_TLS_BSS.
1551 (Orphan_section_placement::Orphan_section_placement): Initialize
1552 new places.
1553 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
1554 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
1555 (tls_script_test_SOURCES): Define.
1556 (tls_script_test_DEPENDENCIES): Define.
1557 (tls_script_test_LDFLAGS): Define.
1558 (tls_script_test_LDADD): Define.
1559 * testsuite/Makefile.in: Rebuild.
1560
1561 2010-03-22 Doug Kwan <dougkwan@google.com>
1562
1563 * arm.cc (Arm_relocate_functions::abs8,
1564 Arm_relocate_functions::abs16): Use correct check for overflow
1565 specified in the ARM ELF specs.
1566 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
1567 target of a BLX instruction specially.
1568 (Reloc_stub::stub_type_for_reloc): Ditto.
1569 (Relocate::relocate): Use symbolic names instead of numeric relocation
1570 codes to report error.
1571 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
1572 workaround.
1573 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
1574 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
1575 thumb2_blx_out_of_range.stdout
1576 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
1577 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
1578 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
1579 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
1580 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
1581 thumb2_blx_in_range, thumb2_blx_in_range.o,
1582 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
1583 thumb2_blx_out_of_range.o): New rules.
1584 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
1585 thumb2_blx_in_range and thumb2_blx_out_of_range.
1586 * testsuite/Makefile.in: Regenerate.
1587 * arm_branch_in_range.sh: Add tests for THUMB BLX.
1588 * testsuite/thumb_blx_in_range.s: New file.
1589 * testsuite/thumb_blx_out_of_range.s: New file.
1590
1591 2010-03-22 Rafael Espindola <espindola@google.com>
1592
1593 * archive.cc (Should_include): Move to archive.h.
1594 (should_include_member): Make it a member of Archive.
1595 (Lib_group): New.
1596 (Add_lib_group_symbols): New.
1597 * archive.h: Include options.h.
1598 (Archive_member): Moved from Archive.
1599 (Should_include): Moved from archive.cc.
1600 (Lib_group): New.
1601 (Add_lib_group_symbols): New.
1602 * dynobj.cc (do_should_include_member): New.
1603 * dynobj.h (do_should_include_member): New.
1604 * gold.cc (queue_initial_tasks): Update call to queue.
1605 * main.cc (main): Print lib group stats.
1606 * object.cc (do_should_include_member): New.
1607 * object.h: Include archive.h.
1608 (Object::should_include_member): New.
1609 (Object::do_should_include_member): New.
1610 (Sized_relobj::do_should_include_member): New.
1611 * options.cc (General_options::parse_start_lib): New.
1612 (General_options::parse_end_lib): New.
1613 (Input_arguments::add_file): Handle lib groups.
1614 (Input_arguments::start_group): Check we are not in a lib.
1615 (Input_arguments::start_lib): New.
1616 (Input_arguments::end_lib): New.
1617 * options.h (General_options): Add start_lib and end_lib.
1618 (Input_argument::lib_): New.
1619 (Input_argument::lib): New.
1620 (Input_argument::is_lib): New.
1621 (Input_file_lib): New.
1622 (Input_arguments::in_lib_): New.
1623 (Input_arguments::in_lib): New.
1624 (Input_arguments::start_lib): New.
1625 (Input_arguments::end_lib_): New.
1626 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
1627 in unused members as preempted.
1628 (Sized_pluginobj::do_should_include_member): New.
1629 * plugin.h (Sized_pluginobj::do_should_include_member): New.
1630 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
1631 return the blocker.
1632 (Read_symbols::do_whole_lib_group): New.
1633 (Read_symbols::do_lib_group): New.
1634 (Read_symbols::do_read_symbols): Handle lib groups.
1635 (Read_symbols::get_name): Handle lib groups.
1636 * readsyms.h (Read_symbols): Add an archive member pointer.
1637 (Read_symbols::do_whole_lib_group): New.
1638 (Read_symbols::do_lib_group): New.
1639 (Read_symbols::member_): New.
1640 * script.cc (read_input_script): Update call to queue_soon.
1641
1642 2010-03-19 Doug Kwan <dougkwan@google.com>
1643
1644 * arm.cc (Stub_table::Stub_table): Initialize new data members
1645 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1646 (Stub_table::add_reloc_stub): Assign stub offset and update
1647 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1648 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
1649 New data members.
1650 (Stub_table::update_data_size_and_addralign): Use
1651 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
1652 instead of going over all reloc stubs.
1653 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
1654 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1655 Stringpool_template::offset_ to size of Stringpool_char.
1656 (Stringpool_template::new_key_offset): Remove code to initialize
1657 Stringpool_template::offset_.
1658 * stringpool.h (Stringpool_template::set_no_zero_null): Set
1659 Stringpool_template::offset_ to zero.
1660
1661 2010-03-15 Doug Kwan <dougkwan@google.com>
1662
1663 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1664 offset_.
1665 (Stringpool_template::new_key_offset): New method.
1666 (Stringpool_template::add_string): Assign offsets when adding new
1667 strings.
1668 (Stringpool_template::set_string_offsets): Do not set string offsets
1669 when not optimizing.
1670 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
1671 member size_.
1672 (Chunked_vector::clear): Clear size_.
1673 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
1674 (Chunked_vector::size): Return size_.
1675 (Chunked_vector::push_back): Use size_ to find insert position.
1676 (Chunked_vector::size_): New data member.
1677 (Stringpool_template::set_no_zero_null): Assert string set is empty.
1678 (Stringpool_template::new_key_offset): New method declaration.
1679 (Stringpool_template::offset_): New data member.
1680
1681 2010-03-15 Rafael Espindola <espindola@google.com>
1682
1683 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
1684 Add_symbols' constructor.
1685 * readsyms.h (Add_symbols): Remove the input_group member.
1686
1687 2010-03-10 Ian Lance Taylor <iant@google.com>
1688
1689 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
1690 target to ask whether a reference to a symbol requires a stack
1691 split.
1692 * target.h (Target::is_call_to_non_split): New function.
1693 (Target::do_is_call_to_non_split): Declare virtual function.
1694 * target.cc: Include "symtab.h".
1695 (Target::do_is_call_to_non_split): New function.
1696 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
1697
1698 2010-03-10 Cary Coutant <ccoutant@google.com>
1699
1700 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
1701 (File_read::open[1]): Remove initial mapping of whole_file_view_.
1702 (File_read::open[2]): Add whole_file_view_ to list of views.
1703 (File_read::make_view): Remove test of whole_file_view_.
1704 (File_read::find_or_make_view): Create whole_file_view_ if
1705 necessary.
1706 (File_read::clear_views): Replace bool parameter with enum;
1707 adjust all callers. Don't delete views with permanent data;
1708 do delete cached views and views from archives if
1709 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
1710 if clearing the corresponding view.
1711 * fileread.h (File_read::Clear_views_mode): New enum.
1712 (File_read::View::is_permanent_view): New method.
1713 (File_read::clear_views): Replace bool parameter
1714 with enum; adjust all callers.
1715 * options.h (General_options): Change keep_files_mapped option;
1716 add map_whole_files.
1717 * readsyms.cc (Add_symbols::run): Delete sd_ object before
1718 releasing the file.
1719 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
1720 the file.
1721
1722 2010-03-10 David S. Miller <davem@davemloft.net>
1723
1724 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
1725
1726 2010-03-09 Sriraman Tallam <tmsriram@google.com>
1727
1728 * icf.cc (get_section_contents): Add '@' marker after processing the
1729 merge reloc.
1730
1731 2010-03-08 Doug Kwan <dougkwan@google.com>
1732
1733 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
1734 due to a conversion warning.
1735 (Arm_relobj::update_output_local_symbol_count): Check for local
1736 symbol with unset output index.
1737
1738 2010-03-05 Ian Lance Taylor <iant@google.com>
1739
1740 * options.h (class General_options): Add --spare-dynamic-tags.
1741 * output.cc (Output_data_dynamic::set_final_data_size): Implement
1742 --spare-dynamic-tags.
1743
1744 2010-03-05 Ian Lance Taylor <iant@google.com>
1745
1746 * incremental.cc: Include "libiberty.h".
1747
1748 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
1749
1750 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
1751 function, is_info_ member.
1752 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
1753 (Versions::Versions): Update caller.
1754 (Versions::define_base_version): Likewise.
1755 (Versions::add_def): Likewise.
1756
1757 2010-03-03 Sriraman Tallam <tmsriram@google.com>
1758
1759 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
1760 (Scan::possible_function_pointer_reloc): New function.
1761 (Scan::local_reloc_may_be_function_pointer): Change to call
1762 possible_function_pointer_reloc.
1763 (Scan::global_reloc_may_be_function_pointer): Ditto.
1764 * icf.h (Icf::check_section_for_function_pointers): Change to reject
1765 relocations in ".data.rel.ro._ZTV" section.
1766 * testsuite/icf_safe_so_test.sh: Change to pass i386.
1767 * testsuite/icf_safe_so_test.cc: Ditto.
1768 * testsuite/icf_safe_test.cc: Ditto.
1769 * testsuite/icf_safe_test.sh: Ditto.
1770
1771 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1772 Ian Lance Taylor <iant@google.com>
1773
1774 * target-reloc.h (relocate_section): Check the symbol table index
1775 for -1U before setting the local symbol index.
1776 (scan_relocatable_relocs): If copying the relocation, record that
1777 the local symbol is required.
1778 * object.h (Symbol_value::is_output_symtab_index_set): New
1779 function.
1780 (Symbol_value::may_be_discarded_from_output_symtab): New
1781 function.
1782 (Symbol_value::has_output_symtab_entry): New function.
1783 (Symbol_value::needs_output_symtab_entry): Remove.
1784 (Symbol_value::output_symtab_index): Make sure the symbol index is
1785 set.
1786 (Symbol_value::set_output_symtab_index): Make sure the symbol
1787 index is not set. Make sure the new index is valid.
1788 (Symbol_value::set_must_have_output_symtab_entry): New function.
1789 (Symbol_value::has_output_dynsym_entry): New function.
1790 (Symbol_value::set_output_dynsym_index): Make sure the new index
1791 is valid.
1792 (Sized_relobj::set_must_have_output_symtab_entry): New function.
1793 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
1794 local symbol if permitted.
1795 (Sized_relobj::do_finalize_local_symbols): Call
1796 is_output_symtab_index_set rather than needs_output_symtab_entry.
1797 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
1798 rather than needs_output_symtab_entry. Call
1799 has_output_dynsym_entry rather than needs_output_dynsym_entry.
1800 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
1801 is_output_symtab_index_set rather than needs_output_symtab_entry.
1802 * testsuite/discard_locals_relocatable_test.c: New file.
1803 * testsuite/discard_locals_test.sh: Test -r.
1804 * testsuite/Makefile.am (check_DATA): Add
1805 discard_locals_relocatable_test1.syms,
1806 discard_local_relocatable_test2.syms.
1807 (MOSTLYCLEANFILES): Likewise. Also add
1808 discard_locals_relocatable_test1.lout and
1809 discard_locals_relocatable_test2.out.
1810 (discard_locals_relocatable_test1.syms): New target.
1811 (discard_locals_relocatable_test.o): New target.
1812 (discard_locals_relocatable_test1.out): New target.
1813 (discard_locals_relocatable_test2.syms): New target.
1814 (discard_locals_relocatable_test2.out): New target.
1815 (various): Add missing ../ld-new dependencies.
1816 * testsuite/Makefile.in: Rebuild.
1817
1818 2010-03-03 Nick Clifton <nickc@redhat.com>
1819
1820 * po/fi.po: New Finnish translation.
1821
1822 2010-03-01 Doug Kwan <dougkwan@google.com>
1823
1824 * layout.cc (Layout::Layout): Force section types of .init_array*,
1825 .preinit_array* and .fini_array* sections.
1826 * output.cc (Output_section::Input_section_sort_entry::has_priority):
1827 Fix check of return value of std::string::find.().
1828 (Output_section::Input_section_sort_compare::operator()): Remove
1829 comment about .init_array.
1830 (Output_section::Input_section_sort_init_fini_compare::operator()):
1831 New method.
1832 (Output_section::sort_attached_input_sections): Handle .init_array
1833 and .fini_array specially.
1834 * output.h (Output_section::Inut_section_sort_compare): Update
1835 comment.
1836 (Output_section::Input_section_sort_init_fini_compare): New struct.
1837
1838 2010-02-26 Doug Kwan <dougkwan@google.com>
1839
1840 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
1841 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
1842 * testsuite/debug_msg.sh: Avoid matching source line number for
1843 use of global variable undef_int.
1844
1845 2010-02-26 Doug Kwan <dougkwan@google.com>
1846
1847 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
1848 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
1849 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
1850 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
1851 * options.cc (General_options::General_options): Initialize member
1852 fix_v4bx_.
1853 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
1854 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
1855 and rm_no_fix_v4bx.stdout
1856 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
1857 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
1858 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
1859 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
1860 and arm_no_fix_v4bx.
1861 * Makefile.in: Regenerate.
1862 * testsuite/arm_fix_v4bx.s: New file.
1863 * testsuite/arm_fix_v4bx.sh: Ditto.
1864
1865 2010-02-24 Doug Kwan <dougkwan@google.com>
1866
1867 * arm.cc (Target_arm::got_section): Make the .got section the first
1868 non RELRO section in the data segment.
1869 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
1870 suffixes of section names.
1871
1872 2010-02-24 Doug Kwan <dougkwan@google.com>
1873
1874 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
1875 flags and attributes merging if an input file is a binary file.
1876 * fileread.cc (Input_file::open): Record format of original file.
1877 * fileread.h (Input_file::Format): New enum type.
1878 (Input_file::Input_file): Initialize data member format_.
1879 (Input_file::format): New method definition.
1880 (Input_file::format_):: New data member.
1881
1882 2010-02-24 Doug Kwan <dougkwan@google.com>
1883
1884 * arm.cc (Arm_output_data_got): New class.
1885 (ARM_TCB_SIZE): New constant
1886 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
1887 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
1888 If user uses a script with a SECTIONS clause, issue only a warning
1889 for a misplaced EXIDX input section. Otherwise, issue an error.
1890 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
1891 garbage collection.
1892 (Target_arm::got_mode_index_entry): Handle static linking.
1893 (Target_arm::Scan::local): Ditto.
1894 (Target_arm::Scan::global): Ditto.
1895 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
1896 all incorrectly implemented relocations.
1897 (Target_arm::fix_exidx_coverage): Pass layout to
1898 Arm_output_section::fix_exidx_coverage.
1899 * layout.cc (Layout::section_name_mapping): Remove trailing dots
1900 from ".ARM.exidx." and ".ARM.extab.".
1901
1902 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1903
1904 * arm.cc (Target_arm::do_finalize_sections): Create attribute
1905 section if it does not already exist.
1906 * attributes.cc (Attributes_section_data::Attributes_section_data):
1907 Don't crash if size is zero.
1908
1909 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1910 Ian Lance Taylor <iant@google.com>
1911
1912 * gold.cc (queue_middle_tasks): If no input files were opened,
1913 exit.
1914 * workqueue.h (Task_function::Task_function): Assert that there is
1915 a blocker.
1916
1917 2010-02-22 Doug Kwan <dougkwan@google.com>
1918
1919 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
1920 * icf.cc (get_section_contents): Cast snprintf arguments to long long
1921 types to avoid warnings due to different uint64_t implementations
1922 on different hosts.
1923
1924 2010-02-21 Doug Kwan <dougkwan@google.com>
1925
1926 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
1927 handling of the maximum backward branch offset.
1928 (Arm_relocate_functions::thumb_branch_common): Ditto.
1929 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
1930 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
1931 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
1932 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
1933 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
1934 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
1935 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
1936 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
1937 thumb_bl_out_of_range thumb_bl_out_of_range.o,
1938 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
1939 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
1940 thumb2_bl_out_of_range.o): New rules.
1941 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
1942 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
1943 thumb2_bl_out_of_range
1944 * testsuite/Makefile.in: Regenerate.
1945 * testsuite/arm_bl_in_range.s: New file.
1946 * testsuite/arm_bl_out_of_range.s: Ditto.
1947 * testsuite/arm_branch_in_range.sh: Ditto.
1948 * testsuite/arm_branch_range.t: Ditto.
1949 * testsuite/thumb2_branch_range.t: Ditto.
1950 * testsuite/thumb_bl_in_range.s: Ditto.
1951 * testsuite/thumb_bl_out_of_range.s: Ditto.
1952 * testsuite/thumb_branch_range.t: Ditto.
1953
1954 2010-02-20 Sriraman Tallam <tmsriram@google.com>
1955
1956 * gc.h (gc_process_relocs): Change vectors to point to the new list.
1957 Add reloc offset information.
1958 * icf.cc (get_section_contents): Change iterators to point to the new
1959 vectors. Add reloc offset information to the contents.
1960 * icf.h (Icf::Sections_reachable_info): New typedef.
1961 (Icf::Sections_reachable_list): New typedef.
1962 (Icf::Offset_info): New typedef.
1963 (Icf::Reloc_info): New struct typedef.
1964 (Icf::Reloc_info_list): New typedef.
1965 (Icf::symbol_reloc_list): Delete method.
1966 (Icf::addend_reloc_list): Delete method.
1967 (Icf::section_reloc_list): Delete method.
1968 (Icf::reloc_info_list): New method.
1969 (Icf::reloc_info_list_): New member.
1970
1971 2010-02-19 Doug Kwan <dougkwan@google.com>
1972
1973 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
1974 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
1975 * arm.cc (Arm_relocation_functions): New forward declaration.
1976 (Target_arm::Target_arm): Initialize new data members
1977 got_mod_index_offset_ and tls_base_symbol_defined_.
1978 (Target_arm::Relocate::relocate_tls): New method.
1979 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
1980 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
1981 New methods.
1982 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
1983 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
1984 (Target_arm::got_mod_index_offset_,
1985 Target_arm::tls_base_symbol_defined_): New data members.
1986 (Target_arm::Scan::local, Target::Scan::global,
1987 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
1988 relocations.
1989
1990 2010-02-18 Doug Kwan <dougkwan@google.com>
1991
1992 * arm.cc (Arm_relobj::find_linked_text_section): New method.
1993 (Arm_relobj::make_exidx_input_section): Pass section index of linked
1994 text section as a parameter becuase some broken tools may not set
1995 the link in section header.
1996 (Target_arm::has_got_section): New method.
1997 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
1998 without any mapping symbol as data only. Remove warning.
1999 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
2000 link in its section header, try to discover the link by inspecting the
2001 REL31 relocation at the beginning of the section.
2002 (Target_arm::Scan::check_non_pic): Report name of offending relocation
2003 in error message.
2004 (Target_arm::Scan::global): Treat any reference to the symbol
2005 _GLOBAL_OFFSET_TABLE_ as a GOT access.
2006
2007 2010-02-12 Sriraman Tallam <tmsriram@google.com>
2008
2009 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
2010 (Scan::global_reloc_may_be_function_pointer): New function.
2011 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2012 (Scan::global_reloc_may_be_function_pointer): New function.
2013 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
2014 (Scan::global_reloc_may_be_function_pointer): New function.
2015 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
2016 (Scan::global_reloc_may_be_function_pointer): New function.
2017 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
2018 (Scan::global_reloc_may_be_function_pointer): New function.
2019 (Scan::possible_function_pointer_reloc): New function.
2020 (Target_x86_64::can_check_for_function_pointers): New function.
2021 * gc.h (gc_process_relocs): Scan relocation types to determine if
2022 function pointers were taken for targets that support it.
2023 * icf.cc (Icf::find_identical_sections): Include functions for
2024 folding in safe ICF whose pointer is not taken.
2025 * icf.h (Secn_fptr_taken_set): New typedef.
2026 (fptr_section_id_): New member.
2027 (section_has_function_pointers): New function.
2028 (set_section_has_function_pointers): New function.
2029 (check_section_for_function_pointers): New function.
2030 * options.h: Fix comment for safe ICF option.
2031 * target.h (can_check_for_function_pointers): New function.
2032 * testsuite/Makefile.am: Add icf_safe_so_test test case.
2033 Modify icf_safe_test for X86-64.
2034 * testsuite/Makefile.in: Regenerate.
2035 * testsuite/icf_safe_so_test.cc: New file.
2036 * testsuite/icf_safe_so_test.sh: New file.
2037 * testsuite/icf_safe_test.cc (kept_func_3): New function.
2038 (main): Change to take pointer to function kept_func_3.
2039 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
2040 folding is done correctly for X86-64.
2041
2042 2010-02-12 David S. Miller <davem@davemloft.net>
2043
2044 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
2045 is_symbolless parameter.
2046 (Output_reloc<SHT_REL>::is_symbolless): New.
2047 (Output_reloc<SHT_REL>::is_symbolless_): New.
2048 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
2049 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
2050 (Output_reloc<SHT_RELA>::is_symbolless): New.
2051 (Output_data_reloc::add_global): Handle is_symbolless.
2052 (Output_data_reloc::add_global_relative): Likewise.
2053 (Output_data_reloc::add_local): Likewise.
2054 (Output_data_reloc::add_local_relative): Likewise.
2055 (Output_data_reloc::add_symbolless_global_addend): New.
2056 (Output_data_reloc::add_symbolless_local_addend): New.
2057 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
2058 is_symbolless.
2059 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
2060 instead of ->is_relative_
2061 (Output_reloc::write): Likewise.
2062 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
2063 (Output_reloc::write_rel): Simplify.
2064
2065 * sparc.cc (Target_sparc::Scan::local): Use
2066 ->add_symbolless_local_addend as needed.
2067 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
2068 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
2069 based upon relocation offset.
2070
2071 2010-02-11 Doug Kwan <dougkwan@google.com>
2072
2073 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
2074 (Target_arm::Scan::global): Ditto. Also remove a comment before the
2075 beginning of function.
2076 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
2077 and MOVT_ABS relocations. Those are non issued in scanning. Fix
2078 parameter is_32bit in calls to should_apply_static_reloc.
2079 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
2080 (check_DATA): Add arm_abs_global.stdout.
2081 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
2082 arm_abs_global.stdout): New rules.
2083 (MOSTLLYCLEANFILES): Add arm_abs_global
2084 * Makefile.in: Regenerate.
2085 * testsuite/arm_abs_global.s: New file.
2086 * testsuite/arm_abs_global.sh: Ditto.
2087 * testsuite/arm_abs_lib.s: Ditto.
2088
2089 2010-02-11 Ian Lance Taylor <iant@google.com>
2090
2091 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
2092 Read_relocs task.
2093 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
2094 Allocate_commons_task first.
2095 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
2096 task, rather than symtab_lock_.
2097 (Gc_process_relocs::~Gc_process_relocs): New function.
2098 (Gc_process_relocs::is_runnable): Check this_blocker_.
2099 (Gc_process_relocs::locks): Use next_blocker_ rather than
2100 blocker_.
2101 (Scan_relocs::~Scan_relocs): New function.
2102 (Scan_relocs::is_runnable): Check this_blocker_ rather than
2103 symtab_lock_.
2104 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
2105 next_blocker_.
2106 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
2107 fields. Add this_blocker_ and next_blocker_ fields. Adjust
2108 constructor accordingly.
2109 (class Gc_process_relocs): Likewise.
2110 (class Scan_relocs): Likewise.
2111 * common.h (class Allocate_commons_task): Remove symtab_lock_
2112 field, and corresponding constructor parameter.
2113 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
2114 symtab_lock_.
2115 (Allocate_commons_task::locks): Likewise.
2116
2117 2010-02-11 Ian Lance Taylor <iant@google.com>
2118
2119 * gold-threads.h (class Once): Define.
2120 (class Initialize_lock): Rewrite as child of Once.
2121 * gold-threads.cc (class Once_initialize): Define.
2122 (once_pointer_control): New static variable.
2123 (once_pointer, once_arg): New static variables.
2124 (c_run_once): New static function.
2125 (Once::Once, Once::run_once, Once::internal_run): New functions.
2126 (class Initialize_lock_once): Remove.
2127 (initialize_lock_control): Remove.
2128 (initialize_lock_pointer): Remove.
2129 (initialize_lock_once): Remove.
2130 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
2131 (Initialize_lock::initialize): Rewrite.
2132 (Initialize_lock::do_run_once): New function.
2133 * archive.cc (Archive::interpret_header): Only clear name if it is
2134 not already empty.
2135 * fileread.cc: Include "gold-threads.h"
2136 (file_counts_lock): New static variable.
2137 (file_counts_initialize_lock): Likewise.
2138 (File_read::release): Only increment counts when using --stats.
2139 Use a lock around the increment.
2140 * parameters.cc (class Set_parameters_target_once): Define.
2141 (set_parameters_target_once): New static variable.
2142 (Parameters::Parameters): Move here from parameters.h.
2143 (Parameters::set_target): Rewrite.
2144 (Parameters::set_target_once): New function.
2145 (Parameters::clear_target): Move here and rewrite.
2146 * parameters.h (class Parameters): Update declarations. Add
2147 set_parameters_target_once_ field.
2148 (Parameters::Parameters): Move to parameters.cc.
2149 (Parameters::clear_target): Likewise.
2150 * readsyms.cc (Read_symbols::do_group): Create a Start_group
2151 task.
2152 (Start_group::~Start_group): New function.
2153 (Start_group::is_runnable): New function.
2154 (Start_group::locks, Start_group::run): New functions.
2155 (Finish_group::run): Change saw_undefined to size_t.
2156 * readsyms.h (class Start_group): Define.
2157 (class Finish_group): Change saw_undefined_ field to size_t.
2158 (Finish_group::Finish_group): Remove saw_undefined and
2159 this_blocker parameters. Change all callers.
2160 (Finish_group::set_saw_undefined): New function.
2161 (Finish_group::set_blocker): New function.
2162 * symtab.h (class Symbol_table): Change saw_undefined to return
2163 size_t. Change saw_undefined_ field to size_t.
2164 * target-select.cc (Set_target_once::do_run_once): New function.
2165 (Target_selector::Target_selector): Initialize set_target_once_
2166 field. Don't initialize lock_ and initialize_lock_ fields.
2167 (Target_selector::instantiate_target): Rewrite.
2168 (Target_selector::set_target): New function.
2169 * target-select.h (class Set_target_once): Define.
2170 (class Target_selector): Update declarations. Make
2171 Set_target_once a friend. Remove lock_ and initialize_lock_
2172 fields. Add set_target_once_ field.
2173
2174 2010-02-10 Ian Lance Taylor <iant@google.com>
2175
2176 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
2177 queueing any tasks.
2178 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
2179 (queue_middle_tasks): Add all blockers before queueing any tasks.
2180 (queue_final_tasks): Likewise.
2181 * token.h (Task_token::add_blockers): New function.
2182 * object.h (Input_objects::number_of_relobjs): New function.
2183
2184 2010-02-10 Ian Lance Taylor <iant@google.com>
2185
2186 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
2187 shared, not if not position independent.
2188 * x86_64.cc (Relocate::relocate_tls): Likewise.
2189 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
2190 (tls_pie_pic_test): New target.
2191 * testsuite/Makefile.in: Rebuild.
2192
2193 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
2194 (tls_test_main_pie.o, tls_test_pie.o): New targets.
2195 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
2196 * testsuite/Makefile.in: Rebuild.
2197
2198 2010-02-09 David S. Miller <davem@davemloft.net>
2199
2200 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
2201 R_SPARC_RELATIVE using ->add_local_relative().
2202 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
2203
2204 * output.h (Output_data_dynamic::add_section_size): New method
2205 that takes two Output_data objects.
2206 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
2207 entry param. Handle it in initializers.
2208 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
2209 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
2210 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
2211 arg.
2212 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
2213 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
2214 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
2215 for dynrel_includes_plt.
2216 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2217 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2218 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
2219 before .rela.plt
2220 (Target_sparc::do_finalize_sections): Update to pass true for
2221 dynrel_includes_plt.
2222 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
2223 output before .rela.plt
2224 (Target_powerpc::do_finalize_sections): Update to pass true for
2225 dynrel_includes_plt when 32-bit.
2226
2227 2010-02-08 Doug Kwan <dougkwan@google.com>
2228
2229 * arm.cc (Arm_relobj::simple_input_section_output_address): New
2230 method.
2231 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
2232 Arm_relobj::scan_section_for_cortex_a8_stubs,
2233 Arm_relobj::do_relocation_section): Instead of calling
2234 Output_section::output_address, use faster
2235 Arm_relobj::simple_input_section_output_address.
2236
2237 2010-02-08 David S. Miller <davem@davemloft.net>
2238
2239 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
2240 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
2241 relocation helper function.
2242
2243 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
2244 just like R_SPARC_GOT{10,13,22}.
2245 (Target_sparc::Scan::local): Likewise.
2246 (Target_sparc::Relocate:relocate): Likewise.
2247
2248 2010-02-06 Ian Lance Taylor <iant@google.com>
2249
2250 * configure.ac: Rewrite targetobjs duplicate removal code to use
2251 only shell constructs.
2252 * configure: Rebuild.
2253
2254 2010-02-05 Doug Kwan <dougkwan@google.com>
2255
2256 PR 11247
2257 * arm.cc (Arm_relobj::section_is_scannable): New method.
2258 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
2259 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2260
2261 2010-02-04 Doug Kwan <dougkwan@google.com>
2262
2263 PR 11247
2264 * arm-reloc-property.cc (cstdio): Include.
2265 * configure.ac (targetobjs): Remove duplicates.
2266 * configure: Regenerate.
2267 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
2268 big and little endian version for a given address size.
2269
2270 2010-02-03 Doug Kwan <dougkwan@google.com>
2271
2272 * arm-reloc-property.cc
2273 (Arm_reloc_property_table::reloc_name_in_error_message): New method
2274 definition.
2275 * arm-reloc-property.h
2276 (Arm_reloc_property_table::get_implemented_static_reloc_property):
2277 New method definition.
2278 (Arm_reloc_property_table::reloc_name_in_error_message): New method
2279 declaration.
2280 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
2281 overflow to N.
2282 (GOT_PREL): Change implemented to Y.
2283 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
2284 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
2285 (Arm_relocate_functions::movw_abs_nc): Remove method.
2286 (Arm_relocate_functions::movt_abs): Ditto.
2287 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
2288 (Arm_relocate_functions::thm_movt_abs): Ditto.
2289 (Arm_relocate_functions::movw_rel_nc): Ditto.
2290 (Arm_relocate_functions::movw_rel): Ditto.
2291 (Arm_relocate_functions::movt_rel): Ditto.
2292 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
2293 (Arm_relocate_functions:thm_movw_rel): Ditto.
2294 (Arm_relocate_functions:thm_movt_rel): Ditto.
2295 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
2296 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
2297 New method definitions.
2298 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
2299 (Arm_relocation_functions::arm_grp_ldr): Ditto.
2300 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
2301 (Arm_relocation_functions::arm_grp_ldc): Ditto.
2302 (Target_arm::Relocate::relocate): Check for non-static or
2303 unimplemented relocation code and exit early. Change calls to
2304 Target_arm::reloc_uses_thumb_bit and
2305 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
2306 instead. Refactor code to handle similar relocations to increase
2307 code sharing. Remove check for unsupported relocation code in switch
2308 statement.
2309 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
2310 relocation property table to find out size. Change error message to
2311 print out the name of a relocation code instead of the numeric value.
2312 (Target_arm::scan_reloc_for_stub): Use relocation property table
2313 instead of calling Target_arm::reloc_uses_thumb_bit().
2314
2315 2010-02-02 Doug Kwan <dougkwan@google.com>
2316
2317 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
2318 types of relaxed input section.
2319
2320 2010-02-02 Doug Kwan <dougkwan@google.com>
2321
2322 * Makefile.am (HFILES): Add arm-reloc-property.h.
2323 (DEFFILES): New.
2324 (TARGETSOURCES): Add arm-reloc-property.cc
2325 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
2326 (libgold_a_SOURCES): $(DEFFILES)
2327 * Makefile.in: Regenerate.
2328 * arm-reloc-property.cc: New file.
2329 * arm-reloc-property.h: New file.
2330 * arm-reloc.def: New file.
2331 * arm.cc: Update comments.
2332 (arm-reloc-property.h): New included header.
2333 (arm_reloc_property_table): New global variable.
2334 (Target_arm::do_select_as_default_target): New method definition.
2335 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
2336 arm-reloc-property to targ_extra_obj.
2337 * parameters.cc (set_parameters_target): Call
2338 Target::select_as_default_target().
2339 * target.h (Target::select_as_default_target): New method definition.
2340 (Target::do_select_as_default_target): Same.
2341
2342 2010-02-01 Doug Kwan <dougkwan@google.com>
2343
2344 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
2345 first_output_text_section_.
2346 (Arm_exidx_fixup::first_output_text_section): New method definition.
2347 (Arm_exidx_fixup::first_output_text_section_): New data member.
2348 (Arm_exidx_fixup::process_exidx_section): Record the first text
2349 output section seen.
2350 (Arm_output_section::fix_exidx_coverage): Set correct linked section
2351 and entsize in output section header.
2352
2353 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2354
2355 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
2356 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
2357 (Arm_relocate_functions::thm_alu11): New Method.
2358 (Arm_relocate_functions::thm_pc8): New Method.
2359 (Arm_relocate_functions::thm_pc12): New Method.
2360 (Target_arm::Scan::local): Handle the relocations.
2361 (Target_arm::Scan::global): Likewise.
2362 (Target_arm::Relocate::relocate): Likewise.
2363 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2364
2365 2010-01-29 Doug Kwan <dougkwan@google.com>
2366
2367 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
2368 of relocation types as ld.
2369
2370 2010-01-29 Doug Kwan <dougkwan@google.com>
2371
2372 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
2373 to public.
2374 (Arm_relocate_functions::thumb_branch_common): Ditto.
2375 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
2376 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
2377 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
2378 Arm_relocate_functions::jump24): Remove.
2379 (Target_arm::Relocate::relocate): Adjust code to call
2380 Arm_relocation_functions::arm_branch_common and
2381 Arm_relocation_functions::thumb_branch_common instead of their removed
2382 wrappers. Merge switch-cases together to reduce source code size.
2383
2384 2010-01-29 Doug Kwan <dougkwan@google.com>
2385
2386 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
2387 output_local_symbol_count_needs_update_.
2388 (Arm_relobj::output_local_symbol_count_needs_update,
2389 Arm_relobj::set_output_local_symbol_count_needs_update,
2390 Arm_relobj::update_output_local_symbol_count): New methods.
2391 (Arm_relobj::output_local_symbol_count_needs_update_): New data
2392 member.
2393 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
2394 of pointed function as in a R_ARM_PREL31 relocation.
2395 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
2396 for output local symbol count updating.
2397 (Target_arm::do_relax): Update output local symbol counts in objects
2398 if necessary.
2399 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
2400
2401 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2402
2403 * arm.cc: Added support for the ARM relocations:
2404 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
2405 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
2406 (Arm_relocate_functions::movw_rel_nc): Renamed (was
2407 movw_prel_nc).
2408 (Arm_relocate_functions::movw_rel): New method.
2409 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
2410 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
2411 thm_movw_prel_nc).
2412 (Arm_relocate_functions::thm_movw_rel): New method.
2413 (Arm_relocate_functions::thm_movt_rel): Renamed (was
2414 thm_movt_prel).
2415 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
2416 relocations.
2417 (Target_arm::Scan::global): Likewise.
2418 (Target_arm::Relocate::relocate): Likewise.
2419 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2420 Likewise.
2421
2422 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2423
2424 * arm.cc: Added support for ARM group relocations.
2425 (Target_arm::reloc_needs_sym_origin): New method.
2426 (Arm_relocate_functions::calc_grp_kn): New method.
2427 (Arm_relocate_functions::calc_grp_residual): New method.
2428 (Arm_relocate_functions::calc_grp_gn): New method.
2429 (Arm_relocate_functions::arm_grp_alu): New Method.
2430 (Arm_relocate_functions::arm_grp_ldr): New Method.
2431 (Arm_relocate_functions::arm_grp_ldrs): New Method.
2432 (Arm_relocate_functions::arm_grp_ldc): New Method.
2433 (Target_arm::Scan::local): Handle the ARM group relocations.
2434 (Target_arm::Scan::global): Likewise.
2435 (Target_arm::Relocate::relocate): Likewise.
2436 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2437 Likewise.
2438
2439 2010-01-26 Doug Kwan <dougkwan@google.com>
2440
2441 * arm.cc (set): Include.
2442 (class Arm_exidx_fixup): Change type of last_input_section_ to const
2443 pointer type.
2444 (Arm_output_section::Text_section_list): New type.
2445 (Arm_output_section::append_text_sections_to_list): New method.
2446 (Arm_output_section::fix_exidx_coverage): Ditto.
2447 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2448 (Arm_relobj::convert_input_section_to_relaxed_section): Use
2449 Relobj::set_section_offset() instead of
2450 Sized_relobj::invalidate_section_offset().
2451 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2452 parameter for section headers. Ignore relocation sections for
2453 unallocated sections and EXIDX sections.
2454 (Target_arm::fix_exidx_coverage): New method.
2455 (Target_arm::output_section_address_less_than): New type.
2456 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
2457 linked text section instead of the EXIDX section.
2458 (Arm_output_section::create_stub_group): Add an assertion to check
2459 that this is not an EXIDX output section.
2460 (Arm_output_section::append_text_sections_to_list): New method.
2461 (Arm_output_section::fix_exidx_coverage): Ditto.
2462 (Arm_relobj::scan_sections_for_stubs): Adjust call to
2463 Arm_relobj::section_needs_reloc_stub_scanning.
2464 (Target_arm::do_relax): Fix EXIDX output section coverage in the
2465 first pass.
2466 (Target_arm::fix_exidx_coverage): New method.
2467 * object.h (Relobj::set_output_section): New method.
2468 (Sized_relobj::invalidate_section_offset): Remove method.
2469 (Sized_relobj::do_invalidate_section_offset): Remove method.
2470 (Sized_relobj::do_set_section_offset): Handle offset value -1.
2471
2472 2010-01-25 Doug Kwan <dougkwan@google.com>
2473
2474 * arm.cc (Arm_exidx_merged_section::do_output_offset):
2475 Fix warning due to signed and unsigned comparison on a 32-bit host.
2476
2477 2010-01-22 Doug Kwan <dougkwan@google.com>
2478
2479 * arm.cc (Target_arm::do_relax): Record an output section for section
2480 offset adjustment it contains any stub table that has changed.
2481 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
2482 offsets in an output section if necessary.
2483 * output.cc (Output_section::Output_section): Initialize
2484 section_offsets_need_adjustments_.
2485 (Output_section::add_input_section_for_script): Renamed to
2486 Output_section::add_simple_input_section.
2487 (Output_section::save_states): Add a comment.
2488 (Output_section::discard_states): New method defintion.
2489 (Output_section::adjust_section_offsets): Same.
2490 * output.h (Output_section::add_input_section_for_script): Renamed to
2491 Output_section::add_simple_input_section.
2492 (Output_section::discard_states): New method declaration.
2493 (Output_section::adjust_section_offsets): Same.
2494 (Output_section::section_offsets_need_adjustment,
2495 Output_section::set_section_offsets_need_adjustment): New method
2496 definitions.
2497 (Output_section::section_offsets_need_adjustment_): New data member.
2498 * script-sections.cc
2499 (Output_section_element_input::set_section_address): Adjust code for
2500 renaming of Output_section::add_input_section_for_script.
2501 (Orphan_output_section::set_section_address): Same.
2502
2503 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2504
2505 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
2506 Fix_v4bx enum values .
2507 * gold/options.h (General_options): New option definitions.
2508 (General_options::fix_v4bx): New method.
2509 (General_options::Fix_v4bx): New enum.
2510 * gold/options.cc (General_options::parse_fix_v4bx): New method.
2511 (General_options::parse_fix_v4bx_interworking): New method.
2512
2513 2010-01-22 Doug Kwan <dougkwan@google.com>
2514
2515 * arm.cc (Arm_exidx_fixup): New class.
2516
2517 2010-01-21 Doug Kwan <dougkwan@google.com>
2518
2519 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
2520 classes.
2521 (Arm_exidx_section_offset_map): New type.
2522
2523 2010-01-21 Doug Kwan <dougkwan@google.com>
2524
2525 * arm.cc (Arm_exidx_input_section): New class.
2526 (Arm_relobj::exidx_input_section_by_link,
2527 Arm_relobj::exidx_input_section_by_shndx,
2528 Arm_relobj::make_exidx_input_section): New methods.
2529 (read_arm_attributes_section): Remove.
2530 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
2531 information about them.
2532 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
2533 to here.
2534
2535 2010-01-20 Doug Kwan <dougkwan@google.com>
2536
2537 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
2538 Input_section_specifier to Section_id.
2539 (Target_arm::new_arm_input_section: Adjust code for change of key
2540 type.
2541 (Target_arm::find_arm_input_section): Ditto.
2542 * gc.h (object.h): Include for Section_id nand Section_id_hash.
2543 (Section_id): Remove.
2544 (Garbage_collection::Section_id_hash): Remove.
2545 * icf.h (object.h): Include for Section_id nand Section_id_hash.
2546 (Section_id): Remove.
2547 (Icf::Section_id_hash): Remove.
2548 * object.h (Section_id, Const_section_id, Section_id_hash,
2549 Const_section_id_hash): New type definitions.
2550 * output.cc (Output_section::add_relaxed_input_section): Change to
2551 use Const_section_id instead of Input_section_specifier as key type.
2552 (Output_section::add_merge_input_section): Ditto.
2553 (Output_section::build_relaxation_map): Change to use Section_id
2554 instead of Input_section_specifier as key type.
2555 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2556 Ditto.
2557 (Output_section::convert_input_sections_to_relaxed_sections): Change
2558 to use Const_section_id instead of Input_section_specifier as key type.
2559 (Output_section::find_merge_section): Ditto.
2560 (Output_section::find_relaxed_input_section): Ditto.
2561 * output.h (Input_section_specifier): Remove class.
2562 (Output_section::Output_section_data_by_input_section_map): Change
2563 key type to Const_section_id.
2564 (Output_section::Output_relaxed_input_section_by_input_section_map):
2565 Ditto.
2566 (Output_section::Relaxation_map): Change key type to Section_id.
2567
2568 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2569
2570 * gold/arm.cc: Added support for R_ARM_V4BX relocation
2571 (class Arm_v4bx_stub): New class.
2572 (DEF_STUBS): Updated definition to support v4_veneer_bx.
2573 (Stub_factory::make_arm_v4bx_stub): New method.
2574 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
2575 (Stub_table::empty): Handle v4bx stubs.
2576 (Stub_table::add_arm_v4bx_stub): New method.
2577 (Stub_table::find_arm_v4bx_stub): New method.
2578 (Arm_relocate_functions::v4bx): New method.
2579 (Target_arm::fix_v4bx): New method.
2580 (Target_arm::Target_arm): Handle R_ARM_V4BX.
2581 (Stub_table::relocate_stubs): Likewise.
2582 (Stub_table::do_write): Likewise.
2583 (Stub_table::update_data_size_and_addralign): Likewise.
2584 (Stub_table::finalize_stubs): Likewise.
2585 (Target_arm::Scan::local): Likewise.
2586 (Target_arm::Scan::global): Likewise.
2587 (Target_arm::do_finalize_sections): Likewise.
2588 (Target_arm::Relocate::relocate): Likewise.
2589 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2590 Likewise.
2591 (Target_arm::scan_reloc_for_stub): Likewise.
2592 (Target_arm::scan_reloc_section_for_stubs): Likewise.
2593
2594 2010-01-19 Ian Lance Taylor <iant@google.com>
2595
2596 * output.cc (Output_section_headers::do_sized_write): Write large
2597 segment count to sh_info field.
2598 (Output_file_header::do_sized_write): For large segment count,
2599 write PN_XNUM to e_phnum field.
2600
2601 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2602
2603 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
2604 (Arm_relocate_functions::thm_jump8): New function.
2605 (Arm_relocate_functions::thm_jump11): New function.
2606 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
2607 R_ARM_THM_JUMP11.
2608 (Target_arm::Scan::global): Likewise.
2609 (Target_arm::Relocate::relocate): Likewise.
2610 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2611 Likewise.
2612
2613 2010-01-14 Doug Kwan <dougkwan@google.com>
2614
2615 * arm.cc (map, utility): Include headers.
2616 (Target_arm::apply_cortex_a8_workaround): New method.
2617 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
2618 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
2619 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
2620 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
2621 the --[no-]fix-cortex-a8 command line options.
2622 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
2623 (Target_arm::relocate_stub): Use addend in instruction template.
2624 * options.h (DEFINE_bool): Set the user-set flag.
2625 (General_options): Add --[no-]-fix-cortex options.
2626 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
2627 : Update fast look-up map after conversion.
2628
2629 2010-01-14 Sriraman Tallam <tmsriram@google.com>
2630
2631 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
2632 in the first pass of do_layout.
2633
2634 2010-01-13 Doug Kwan <dougkwan@google.com>
2635
2636 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2637 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
2638 apparent compiler problem of not folding static constant integral
2639 data members of elfcpp::Elf_sizes<32>.
2640
2641 2010-01-13 Doug Kwan <dougkwan@google.com>
2642
2643 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2644 Arm_relobj::section_needs_cortex_a8_stub_scanning,
2645 Arm_relobj::scan_section_for_cortex_a8_erratum,
2646 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
2647 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
2648 sections to scan for relocation stubs into a new method
2649 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
2650 relocation and Cortex-A8 stub scanning.
2651 (Target_arm::do_relax): Force stubs to be after stubbed sections
2652 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
2653 the beginning of a new relaxation pass. Update a comment.
2654 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
2655
2656 2010-01-12 Ian Lance Taylor <iant@google.com>
2657
2658 * target-reloc.h (visibility_error): New inline function.
2659 (relocate_section): Call visibility_error.
2660 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
2661 (MOSTLYCLEANFILES): Likewise.
2662 (protected_4_pic.o, protected_3.err): New targets.
2663 * testsuite/protected_4.cc: New file.
2664
2665 2010-01-12 Doug Kwan <dougkwan@google.com>
2666
2667 * arm.cc (Cortex_a8_reloc): New class.
2668 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
2669 and cortex_a8_relocs_info_.
2670 (Target_arm::fix_cortex_a8): New method definition.
2671 (Target_arm::Cortex_a8_relocs_info): New type.
2672 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
2673 New data member declarations.
2674 (Target_arm::scan_reloc_for_stub): Record information about
2675 relocations for THUMB branches that might be exempted from the
2676 Cortex-A8 workaround.
2677 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
2678 at the beginning of a relaxation pass.
2679
2680 2010-01-12 Doug Kwan <dougkwan@google.com>
2681
2682 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
2683 (Arm_relobj::Mapping_symbol_position,
2684 Arm_reloj::Mapping_symbol_position_less,
2685 Arm_relobj::Mapping_symbols_info): New types.
2686 (Target_arm::is_mapping_symbol_name): New method definition.
2687 (Arm_relobj::do_count_local_symbols): Save information about mapping
2688 symbols.
2689
2690 2010-01-11 Doug Kwan <dougkwan@google.com>
2691
2692 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
2693 Arm_relocate_functions::thumb32_branch_upper,
2694 Arm_relocate_functions::thumb32_branch_lower,
2695 Arm_relocate_functions::thumb32_cond_branch_offset,
2696 Arm_relocate_functions::thumb32_cond_branch_upper,
2697 Arm_relocate_functions::thumb32_cond_branch_lower,
2698 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
2699 branch offset encoding.
2700 (Arm_relocate_functions::thumb_branch_common): Use new branch
2701 offset encoding methods to avoid code duplication.
2702 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
2703 (Stub_addend_reader::operator()): Use new branch encoding method
2704 to avoid code duplication.
2705
2706 2010-01-11 Doug Kwan <dougkwan@google.com>
2707
2708 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
2709 (Target_arm::do_finalize_sections): Define special EXIDX section
2710 symbols only if referenced.
2711 * gc.h (Garbage_collection::add_reference): New method.
2712 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
2713 code duplication.
2714
2715 2010-01-11 Ian Lance Taylor <iant@google.com>
2716
2717 * script.cc (Version_script_info::build_expression_list_lookup):
2718 Change complaing about duplicate wildcard match from error to
2719 warning.
2720
2721 * script.cc (class Lazy_demangler): Recreate--revert part of patch
2722 of 2009-12-30.
2723 (Version_script_info::Version_script_info): Initialize globs_,
2724 default_version_, default_is_global_, and exact_. Don't
2725 initialize globals_ or locals_.
2726 (Version_script_info::build_lookup_tables): Build local symbols
2727 first.
2728 (Version_script_info::unquote): New function.
2729 (Version_script_info::add_exact_match): New function.
2730 (Version_script_info::build_expression_list_lookup): Remove lookup
2731 parameter. Add is_global parameter. Change all callers. Handle
2732 wildcard pattern specially. Unquote pattern. Call
2733 add_exact_match.
2734 (Version_script_info::get_name_to_match): New function.
2735 (Version_script_info::get_symbol_version): New function.
2736 (Version_script_info::get_symbol_version_helper): Remove.
2737 (Version_script_info::check_unmatched_names): Call unquote.
2738 * script.h (class Version_script_info): Change get_symbol_version
2739 to be non-inline and add is_global parameter; change all callers.
2740 Rewrite symbol_is_local. Update declarations. Define struct
2741 Version_tree_match, Exact, Globs. Don't define struct Lookup.
2742 Remove globals_ and locals_ members. Add exact_, globs_,
2743 default_version_, is_global_.
2744 (Version_script_info::Glob): Remove pattern, add expression and
2745 is_global. Update constructor. Change all callers.
2746 * dynobj.cc (Versions::finalize): Mark the version symbol as the
2747 default version.
2748 (Versions::symbol_section_contents): If a symbol is undefined, or
2749 defined in a dynamic object, set the version index to
2750 VER_NDX_LOCAL.
2751 * symtab.cc (Symbol_table::add_from_relobj): Don't call
2752 symbol_is_local.
2753 (Symbol_table::add_from_pluginobj): Likewise.
2754 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
2755
2756 2010-01-11 Doug Kwan <dougkwan@google.com>
2757
2758 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
2759 (incremental_dump_LDADD): Add linking option for libintl.
2760 * Makefile.in: Regenerate.
2761
2762 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
2763
2764 PR gold/11144
2765 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
2766 instead of -Ds.
2767 * testsuite/Makefile.in: Regenerated.
2768
2769 2010-01-10 Doug Kwan <dougkwan@google.com>
2770
2771 * options.h (DEFINE_var): Use parentheses around argument varname__
2772 in macro body to avoid any unintended subsequent substitutions.
2773
2774 2010-01-10 Ian Lance Taylor <iant@google.com>
2775
2776 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
2777 candidates before doing symbol resolution.
2778
2779 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
2780 ODR candidates if only one is weak.
2781
2782 2010-01-08 Ian Lance Taylor <iant@google.com>
2783
2784 * script.cc (Version_script_info::build_expression_list_lookup):
2785 Don't warn about ambiguous version, just record the ambiguity.
2786 (Version_script_info::get_symbol_version_helper): Give error if
2787 version is ambiguous.
2788
2789 2010-01-08 Doug Kwan <dougkwan@google.com>
2790
2791 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
2792 prev_data_size_ and prev_addralign_. Remove initializer for
2793 deleted data member has_been_changed_.
2794 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
2795 to determine if the table is empty.
2796 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
2797 Remove.
2798 (Stub_table::add_reloc_stub): Define method in class definition
2799 instead of just declaring it there.
2800 (Stub_table::add_cortex_a8_stub): New method definition.
2801 (Stub_table::update_data_size_and_addralign): Ditto.
2802 (Stub_table::finalize_stubs): Ditto.
2803 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
2804 (Stub_table::do_addralign_): Return address alignment in the
2805 (Stub_table::do_reset_address_and_file_offset): Define method in
2806 class definition instead of declaring it there. Set current data
2807 size to be the data size of the previous pass.
2808 (Stub_table::set_final_data_size): Use current data size as the
2809 final data size.
2810 (Stub_table::relocate_stub): Change parameter type of stub from
2811 Reloc_stub pointer to Stub pointer.
2812 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
2813 (Stub_table::Cortex_a8_stub_list): New typedef.
2814 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
2815 Stub_table::prev_addralign_): New data member.
2816 (Arm_relobj::Arm_relobj): Initialize data member
2817 section_has_cortex_a8_workaround_.
2818 (Arm_relobj::section_has_cortex_a8_workaround,
2819 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
2820 definitions.
2821 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
2822 declarations.
2823 (Target_arm::relocate_stub): Change parameter type of stub from
2824 Reloc_stub pointer to Stub pointer.
2825 (Insn_template::size, Insn_template::alignment): Handle
2826 THUMB16_SPECIAL_TYPE.
2827 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
2828 Stub_table::update_data_size_and_addralign,
2829 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
2830 definitions.
2831 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
2832 (Stub_table::do_write): Ditto.
2833 (Target_arm::do_relax): Adjust code for changes in Stub_table.
2834
2835 2010-01-08 Ian Lance Taylor <iant@google.com>
2836
2837 PR 11108
2838 * symtab.h (class Symbol): Remove fields is_target_special_ and
2839 has_plt_offset_. Add field is_defined_in_discarded_section_.
2840 (Symbol::is_defined_in_discarded_section): New function.
2841 (Symbol::set_is_defined_in_discarded_section): New function.
2842 (Symbol::has_plt_offset): Rewrite.
2843 (Symbol::set_plt_offset): Verify that new offset is not -1U.
2844 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
2845 Don't initialize is_target_special_ or has_plt_offset_.
2846 Initialize is_defined_in_discarded_section_.
2847 (Symbol_table::add_from_relobj): If appropriate, set
2848 is_defined_in_discarded_section.
2849 * resolve.cc (Symbol::override_base_with_special): Don't test
2850 is_target_special_. Change has_plt_offset_ to has_plt_offset().
2851 * target-reloc.h (relocate_section): Do special handling for
2852 symbols defined in discarded sections for global symbols as well
2853 as local symbols.
2854
2855 2010-01-08 Ian Lance Taylor <iant@google.com>
2856
2857 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
2858 the SHT_SYMTAB case.
2859
2860 2010-01-08 Ian Lance Taylor <iant@google.com>
2861
2862 * object.cc (Sized_relobj::do_layout): Don't get confused if
2863 layout_eh_frame returns NULL.
2864
2865 2010-01-08 Ian Lance Taylor <iant@google.com>
2866
2867 PR 11084
2868 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
2869 dynamic symbol table, use the normal symbol table.
2870 (Sized_dynobj::do_read_symbols): Remove assertion about type of
2871 symbol table.
2872
2873 2010-01-08 Ian Lance Taylor <iant@google.com>
2874
2875 PR 11072
2876 * layout.cc (Layout::include_section): Remove .gnu_debuglink
2877 sections.
2878
2879 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
2880
2881 * version.cc (print_version): Change to "Copyright 2010".
2882
2883 2010-01-08 Ian Lance Taylor <iant@google.com>
2884
2885 PR 10287
2886 PR 11063
2887 * i386.cc (class Target_i386): Change return type of plt_section
2888 to be non-const.
2889 (class Output_data_plt_i386): Add tls_desc_rel_ field.
2890 (Output_data_plt_i386::Output_data_plt_i386): Initialize
2891 tls_desc_rel_ field.
2892 (Output_data_plt_i386::rel_tls_desc): New function.
2893 (Target_i386::rel_tls_desc_section): New function.
2894 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
2895 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
2896 R_386_TLS_DESC reloc in rel_tls_desc_section.
2897 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
2898 Define struct Tlsdesc_info.
2899 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
2900 (Target_x86_64::do_reloc_symbol_index): New function.
2901 (Target_x86_64::add_tlsdesc_info): New function.
2902 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
2903 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
2904 tlsdesc_rel_ field.
2905 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
2906 all callers.
2907 (Output_data_plt_x86_64::rela_tlsdesc): New function.
2908 (Target_x86_64::rela_tlsdesc_section): New function.
2909 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
2910 handling.
2911 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
2912 (Target_x86_64::do_reloc_addend): New function.
2913 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
2914 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
2915 declarations. Define TARGET_CODE. Add arg field to u1_ union.
2916 (Output_reloc::type): New function.
2917 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
2918 (Output_reloc::is_target_specific): New function.
2919 (Output_reloc::target_arg): New function.
2920 (class Output_reloc) [SHT_RELA]: Add four new constructors for
2921 absolute relocs and target specific relocs.
2922 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
2923 add_target_specific.
2924 (class Output_data_reloc) [SHT_RELA]: Likewise.
2925 * output.cc (Output_reloc::Output_reloc): Add four new versions
2926 for absolute relocs and target specific relocs.
2927 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
2928 (Output_reloc::get_symbol_index): Likewise.
2929 (Output_reloc::local_section_offset): Check that local_sym_index_
2930 is not TARGET_CODE or 0.
2931 (Output_reloc::symbol_value): Likewise.
2932 (Output_reloc::write) [SHT_RELA]: Call target for target specific
2933 reloc.
2934 * target.h (class Target): Add reloc_symbol_index and reloc_addend
2935 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
2936 functions.
2937 * layout.cc (add_target_dynamic_tags): Use output section for
2938 DT_PLTRELSZ and DT_JMPREL.
2939
2940 2010-01-07 Ian Lance Taylor <iant@google.com>
2941
2942 PR 11061
2943 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
2944 function.
2945 (class Output_data_reloc_generic): Define.
2946 (class Output_data_reloc_base): Change base class to
2947 Output_data_reloc_generic. Change add() method to call
2948 bump_relative_reloc_count for a relative reloc. Remove
2949 sort_relocs_ field.
2950 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
2951 to sort_relocs().
2952 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
2953 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
2954 appropriate.
2955 * layout.h (class Layout): Update declaration.
2956
2957 2010-01-07 Ian Lance Taylor <iant@google.com>
2958
2959 * output.h (class Output_data): Add const version of
2960 output_section and do_output_section.
2961 (class Output_section_data): Add const version of
2962 do_output_section.
2963 (class Output_section): Likewise.
2964 * layout.cc (Layout::add_target_dynamic_tags): New function.
2965 * layout.h (class Layout): Update declarations.
2966 * arm.cc (Target_arm::do_finalize_sections): Use
2967 add_target_dynamic_tags.
2968 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2969 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2970 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2971 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2972
2973 2010-01-07 Ian Lance Taylor <iant@google.com>
2974
2975 PR 11042
2976 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
2977 object as needed.
2978
2979 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
2980 Ian Lance Taylor <iant@google.com>
2981
2982 PR 11019
2983 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
2984 Xindex::read_symtab_xindex.
2985
2986 2010-01-07 Doug Kwan <dougkwan@google.com>
2987
2988 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
2989 (Insn_template::thumb16_bcond_insn): New method declaration.
2990 (Insn_template): Fix spelling.
2991 (Stub::thumb16_special): New method declaration.
2992 (Stub::do_write): Define virtual method which was previously pure
2993 virtual.
2994 (Stub::do_thumb16_special): New method declaration.
2995 (Stub::do_fixed_endian_write): New template member.
2996 (Reloc_stub::do_write): Remove.
2997 (Reloc_stub::do_fixed_endian_write): Remove.
2998 (Cortex_a8_stub): New class definition.
2999 (Stub_factory::make_cortex_a8_stub): New method definition.
3000 (Stub_factory::Stub_factory): Add missing static storage class
3001 qualifier for elf32_arm_stub_a8_veneer_blx.
3002
3003 2010-01-07 Ian Lance Taylor <iant@google.com>
3004
3005 PR 10980
3006 * options.h (class General_options): Add --warn-unresolved-symbols
3007 and --error-unresolved-symbols.
3008 * errors.cc (Errors::undefined_symbol): Implement
3009 --warn-unresolved-symbols.
3010
3011 * options.h (class General_options): Add -z text and -z textoff.
3012 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
3013
3014 2010-01-06 Sriraman Tallam <tmsriram@google.com>
3015
3016 * gc.h (Garbage_collection::Cident_section_map): New typedef.
3017 (Garbage_collection::cident_sections): New function.
3018 (Garbage_collection::add_cident_section): New function.
3019 (Garbage_collection::cident_sections_): New member.
3020 (gc_process_relocs): Add references to sections whose names are C
3021 identifiers.
3022 * gold.h (cident_section_start_prefix): New constant.
3023 (cident_section_stop_prefix): New constant.
3024 (is_cident): New function.
3025 * layout.cc (Layout::define_section_symbols): Replace string constants
3026 with the newly defined constants.
3027 * object.cc (Sized_relobj::do_layout): Track sections whose names are
3028 C identifiers.
3029 * testsuite/Makefile.am: Add gc_orphan_section_test.
3030 * testsuite/Makefile.in: Regenerate.
3031 * testsuite/gc_orphan_section_test.cc: New file.
3032 * testsuite/gc_orphan_section_test.sh: New file.
3033
3034 2010-01-06 Ian Lance Taylor <iant@google.com>
3035
3036 PR 10980
3037 * options.h (class General_options): Add --warn-shared-textrel.
3038 * layout.cc (Layout::finish_dynamic_section): Implement
3039 --warn-shared-textrel.
3040
3041 PR 10980
3042 * options.h (class General_options): Add --warn-multiple-gp.
3043
3044 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3045
3046 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
3047 $(THREADSLIB) and $(LIBDL).
3048 * Makefile.in: Rebuild.
3049
3050 2010-01-06 Ian Lance Taylor <iant@google.com>
3051
3052 PR 10980
3053 * options.cc (General_options::parse_section_start): New function.
3054 (General_options::section_start): New function.
3055 (General_options::General_options): Initialize all members.
3056 * options.h: Include <map>
3057 (class General_options): Add --section-start. Add section_starts_
3058 member.
3059 * layout.cc (Layout::attach_allocated_section_to_segment): If
3060 --section-start was used, set the address of the segment. Remove
3061 local sort_sections.
3062 (Layout::relaxation_loop_body): If the address of the load segment
3063 has been set by --section-start, don't use it.
3064 * output.h (Output_segment::update_flags_for_output_section): New
3065 function.
3066 * output.cc (Output_segment::add_output_section): Call
3067 update_flags_for_output_section.
3068
3069 2010-01-05 Ian Lance Taylor <iant@google.com>
3070
3071 PR 10980
3072 * options.h (class General_options): Add --undefined-version.
3073 * script.cc (struct Version_expression): Add was_matched_by_symbol
3074 field.
3075 (Version_script_info::matched_symbol): New function.
3076 (Version_script_info::get_symbol_version_helper): Call
3077 matched_symbol.
3078 (Version_script_info::check_unmatched_names): New function.
3079 * script.h (class Version_script_info): Update declarations.
3080 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
3081
3082 * options.h (class General_options): Use DEFINE_bool_alias for
3083 allow_multiple_definition.
3084 * resolve.cc (Symbol_table::should_override): Don't test
3085 allow_multiple_definition.
3086
3087 PR 10980
3088 * options.h (class General_options): Add --cref.
3089 * main.cc (main): Print cref table if --cref. Don't close mapfile
3090 until after printing cref table.
3091 * cref.cc: Include "symtab.h".
3092 (class Cref_inputs): Define Cref_table_compare and Cref_table.
3093 (Cref_table_compare::operator()): New function.
3094 (Cref_inputs::gather_cref): New function.
3095 (filecol): New static const.
3096 (Cref_inputs::print_cref): New function.
3097 (Cref::print_cref): New function.
3098 * cref.h: Include <cstdio>.
3099 (class Cref): Update declarations.
3100 * mapfile.h (Mapfile::file): New function.
3101 * object.h (class Object): Define Symbols. Declare virtual
3102 do_get_global_symbols.
3103 (Object::get_global_symbols): New function.
3104 * object.cc (Input_objects::add_object): Pass object to cref_ if
3105 --cref.
3106 (Input_objects::archive_start): Likewise.
3107 (Input_objects::archive_stop): Likewise.
3108 (Input_objects::print_cref): New function.
3109 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
3110 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
3111 --cref.
3112 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
3113 function.
3114 * plugin.h (class Sized_pluginobj): Update declarations.
3115
3116 2010-01-05 Ian Lance Taylor <iant@google.com>
3117
3118 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
3119 to is_default_version. Rename insdef to insdefault.
3120 (Symbol_table::add_from_relobj): Rename def to is_default_version
3121 and local to is_forced_local.
3122 (Symbol_table::add_from_pluginobj): Likewise.
3123 (Symbol_table::add_from_dynobj): Likewise.
3124 (Symbol_table::define_special_symbol): Rename insdef to
3125 insdefault.
3126
3127 2010-01-04 Ian Lance Taylor <iant@google.com>
3128
3129 PR 10980
3130 * options.h (class General_options): Add
3131 --allow-multiple-definition and -z muldefs.
3132 * resolve.cc (Symbol_table::should_override): Don't warn about a
3133 multiple symbol definition if --allow-multiple-definition or -z
3134 muldefs.
3135
3136 PR 10980
3137 * options.h (class General_options): Add --add-needed and
3138 --copy-dt-needed-entries. Tweak --as-needed help entry.
3139 * object.cc (Input_objects::check_dynamic_dependencies): Give an
3140 error if --copy-dt-needed-entries aka --add-needed is used and
3141 would cause a change in behaviour.
3142
3143 PR 10980
3144 * options.h (class General_options): Add -G as a short version of
3145 --shared. Add no-op options -assert, -g, and -i.
3146
3147 2010-01-04 Sriraman Tallam <tmsriram@google.com>
3148
3149 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
3150 check for .text or .gnu.linkonce.t sections.
3151 * icf.cc (Icf::find_identical_sections): Ditto.
3152 Change the detection for mangled function name within the section
3153 name.
3154 * icf.h (is_section_foldable_candidate): New function.
3155
3156 2009-12-30 Ian Lance Taylor <iant@google.com>
3157
3158 PR 10980
3159 * options.h (class General_options): Permit two dashes with
3160 --retain-symbols-file.
3161
3162 2009-12-30 Ian Lance Taylor <iant@google.com>
3163
3164 PR 10979
3165 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
3166 don't put the file header and segment headers in the text
3167 segment.
3168
3169 PR 10979
3170 * common.cc (Sort_commons::operator()): Stabilize sort when both
3171 entries are NULL.
3172 (Symbol_table::do_allocate_commons_list): When allocating common
3173 symbols, skip a symbol which is no longer common.
3174 * symtab.h (Symbol::is_common): Test whether the symbol comes from
3175 an object before checking its type.
3176 * testsuite/common_test_2.c: New file.
3177 * testsuite/common_test_3.c: New file.
3178 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
3179 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
3180 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
3181 (common_test_2_pic.o, common_test_2.so): New targets.
3182 (common_test_3_pic.o, common_test_3.so): New targets.
3183 * testsuite/Makefile.in: Rebuild.
3184
3185 PR 10979
3186 * script.cc (read_input_script): If we see a new SECTIONS clause,
3187 and we have added an input section, give an error.
3188 * layout.h (class Layout): Add have_added_input_section function.
3189 Add have_added_input_section_ field.
3190 * layout.cc (Layout::Layout): Initialize
3191 have_added_input_section_.
3192 (Layout::layout): Set have_added_input_section_.
3193 (Layout::layout_eh_frame): Likewise.
3194
3195 2009-12-30 Ian Lance Taylor <iant@google.com>
3196
3197 PR 10931
3198 * options.h (class General_options): Add --sort-common option.
3199 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
3200 * common.cc (Sort_common): Add sort_order parameter to
3201 constructor. Add sort_order_ field.
3202 (Sort_commons::operator): Check sort_order_.
3203 (Symbol_table::allocate_commons): Determine the sort order.
3204 (Symbol_table::do_allocate_commons): Add sort_order parameter.
3205 Change all callers.
3206 (Symbol_table::do_allocate_commons_list): Likewise.
3207
3208 2009-12-30 Ian Lance Taylor <iant@google.com>
3209
3210 PR 10916
3211 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
3212 symbols from this object, don't change the visibility of an
3213 undefined symbol.
3214 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
3215
3216 2009-12-30 Ian Lance Taylor <iant@google.com>
3217
3218 PR 10861
3219 * script.h (class Version_script_info): Define Language enum.
3220 Update declarations. Define Glob, Exact, and Lookup types. Add
3221 new fields globals_, locals_, and is_finalized_.
3222 * script.cc: Various formatting fixes.
3223 (class Parser_closure): Change language_stack_ from a vector of
3224 std::string to one of Version_script_info::Language. Adjust all
3225 uses accordingly.
3226 (class Lazy_demangler): Remove.
3227 (struct Version_expression): Change language from std::string to
3228 Version_script_info::Language.
3229 (Version_script_info::Version_script_info): New function.
3230 (Version_script_info::~Version_script_info): Don't call clear.
3231 (Version_script_info::finalize): New function.
3232 (Version_script_info::build_lookup_tables): New function.
3233 (Version_script_info::build_expression_list_lookup): New
3234 function.
3235 (Version_script_info::get_symbol_version_helper): Rewrite to use
3236 lookup tables.
3237 (Version_script_info::print_expression_list): Adjust to use
3238 Version_script_info::Language.
3239 (script_push_lex_into_version_mode): Check that the version script
3240 has not been finalized.
3241 (version_script_push_lang): Change language string to
3242 Version_script_info::Language.
3243 * options.cc (Command_line::version_script): New function.
3244 * options.h (class General_options): Add finalize_dynamic_list
3245 function. Change version_script from declaration to definition.
3246 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
3247 * testsuite/version_script.map: Remove duplicate def of foo.
3248 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
3249 version_script.map.
3250 * testsuite/Makefile.in: Rebuild.
3251
3252 2009-12-30 Ian Lance Taylor <iant@google.com>
3253
3254 PR 10843
3255 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
3256 if the input symbol index is 0, make the output symbol index 0.
3257
3258 2009-12-30 Ian Lance Taylor <iant@google.com>
3259
3260 PR 10670
3261 * options.h (class General_options): Add -x/--discard-all.
3262 * object.cc (Sized_relobj::do_count_local_symbols): Handle
3263 --discard-all. If the local symbol needs a dynamic entry, check
3264 that before handling --discard-locals.
3265
3266 2009-12-30 Ian Lance Taylor <iant@google.com>
3267
3268 PR 10450
3269 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
3270 flags to PF_R.
3271 (Output_segment::add_output_section): Don't change the flags if
3272 the type is PT_TLS.
3273
3274 PR 10450
3275 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
3276 GNU hash table if they need a dynamic value. Otherwise, don't add
3277 them if they are defined in a dynamic object or are forced local.
3278
3279 2009-12-29 Ian Lance Taylor <iant@google.com>
3280
3281 PR 10450
3282 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
3283 .gnu.hash table for a 32-bit target.
3284
3285 PR 10450
3286 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
3287 regular and a dynamic object only needs a dynamic symbol table
3288 entry if it is externally visible.
3289
3290 PR 10450
3291 * i386.cc (class Target_i386): Initialize global_offset_table_ in
3292 constructor. Add global_offset_table_ field.
3293 (Target_i386::got_section): Set global_offset_table_.
3294 (Target_i386::do_finalize_sections): Set global_offset_table_
3295 size.
3296 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
3297 in constructor. Add global_offset_table_ field.
3298 (Target_x86_64::got_section): Set global_offset_table_.
3299 (Target_x86_64::do_finalize_sections): Set global_offset_table_
3300 size.
3301
3302 * layout.cc (Layout::Layout): Initialize increase_relro_.
3303 (Layout::get_output_section): Add is_relro, is_last_relro, and
3304 is_first_non_relro parameters. Change all callers.
3305 (Layout::choose_output_section): Likewise.
3306 (Layout::add_output_section_data): Likewise.
3307 (Layout::make_output_section): Likewise.
3308 (Layout::set_segment_offsets): Clear increase_relro when using a
3309 linker script.
3310 * layout.h (class Layout): Add increase_relro method. Add
3311 increase_relro_ field. Update declarations.
3312 * output.cc (Output_section::Output_section): Initialize
3313 is_last_relro_ and is_first_non_relro_.
3314 (Output_segment::add_output_section): Group relro sections is
3315 do_sort is true. Handle is_last_relro and is_first_non_relro.
3316 (Output_segment::maximum_alignment): Remove relro handling.
3317 (Output_segment::set_section_addresses): Add increase_relro
3318 parameter. Change all callers. Add initial alignment to align
3319 relro sections on separate page. Remove old relro handling.
3320 (Output_segment::set_section_list_addresses): Remove in_relro
3321 parameter. Change all callers.
3322 (Output_segment::set_offset): Add increase parameter. Change all
3323 callers. Remove old relro handling.
3324 * output.h (class Output_section): Add new methods: is_last_relro,
3325 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
3326 Add is_last_relro_ and is_first_non_relro_ fields.
3327 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
3328 Create separate .got.plt section. Call increase_relro.
3329 * x86_64.cc (Target_x86_64::got_section): Likewise.
3330 * testsuite/relro_script_test.t: Add .got.plt.
3331
3332 PR 10450
3333 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
3334 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
3335 (Layout::finalize): Call set_dynamic_symbol_size.
3336 (Layout::set_dynamic_symbol_size): New function.
3337 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
3338 set_dynamic_symbol_size.
3339
3340 PR 10450
3341 * output.h (class Output_section): Add is_entsize_zero_ field.
3342 * output.cc (Output_section::Output_section): Initialize
3343 is_entsize_zero_.
3344 (Output_section::set_entsize): If two different entsizes are
3345 requested, force it to zero.
3346 (Output_section::add_input_section): Set flags for .debug_str
3347 before updating section flags. Set entsize.
3348 (Output_section::update_flags_for_input_section): Set SHF_MERGE
3349 and SHF_STRING if all input sections have those flags.
3350
3351 2009-12-29 Rafael Espindola <espindola@google.com>
3352
3353 * main.cc (main): Fix the sys time reporting.
3354 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
3355 reporting.
3356
3357 2009-12-29 Sriraman Tallam <tmsriram@google.com>
3358
3359 * options.cc (General_options::parse_version): Allow -v to exit
3360 without an error if there is nothing to link.
3361
3362 2009-12-29 Ian Lance Taylor <iant@google.com>
3363
3364 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
3365 using a version of gcc before 4.1.
3366 * configure: Rebuild.
3367
3368 2009-12-28 Chris Demetriou <cgd@google.com>
3369
3370 * attributes.cc (Output_attributes_section_data::do_write): Use
3371 std::vector::front rather than std::vector::data.
3372
3373 2009-12-28 Ian Lance Taylor <iant@google.com>
3374
3375 * symtab.h (class Symbol_table): Add enum Defined.
3376 * resolve.cc (Symbol_table::should_override): Add defined
3377 parameter. Change all callers. Test whether object is NULL
3378 before calling a method on it.
3379 (Symbol_table::report_resolve_problem): Add defined parameter.
3380 Change all callers.
3381 (Symbol_table::should_override_with_special): Likewise.
3382 * symtab.cc (Symbol_table::define_in_output_data): Add defined
3383 parameter. Change all callers.
3384 (Symbol_table::do_define_in_output_data): Likewise.
3385 (Symbol_table::define_in_output_segment): Likewise.
3386 (Symbol_table::do_define_in_output_segment): Likewise.
3387 (Symbol_table::define_as_constant): Likewise.
3388 (Symbol_table::do_define_as_constant): Likewise.
3389 * script.h (class Symbol_assignment): Add is_defsym parameter to
3390 constructor; change all callers.
3391 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
3392 parameter. Change all callers. Add is_defsym_ field.
3393 (class Parser_closure): Add parsing_defsym parameter to
3394 constructor; change all callers. Add parsing_defsym accessor
3395 function. Add parsing_defsym_ field.
3396
3397 2009-12-28 Ian Lance Taylor <iant@google.com>
3398
3399 * gold.cc (queue_middle_tasks): Fix formatting.
3400 * object.cc (Relobj::is_section_name_included): Likewise.
3401
3402 2009-12-23 Ian Lance Taylor <iant@google.com>
3403
3404 * i386.cc (Target_i386::do_calls_non_split): Recognize
3405 -fsplit-stack prologue for a function with a static chain.
3406 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
3407 -fsplit-stack prologue when using %r11.
3408
3409 2009-12-21 Sriraman Tallam <tmsriram@google.com>
3410
3411 * options.cc (General_options::parse_version): Make -v continue and do
3412 the link like GNU ld does.
3413
3414 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
3415
3416 * Makefile.am (CCFILES): Add timer.cc.
3417 (HFILES): Add timer.h.
3418 * configure.ac: Check for sysconf and times.
3419 * main.cc: include timer.h.
3420 (main): Use Timer instead of get_run_time.
3421 * timer.cc: New.
3422 * timer.h: New.
3423 * workqueue.cc: include timer.h.
3424 (Workqueue::find_and_run_task):
3425 Report user, sys and wall time.
3426 * Makefile.in: Regenerate.
3427 * config.in: Regenerate.
3428 * configure: Regenerate.
3429
3430 2009-12-16 Doug Kwan <dougkwan@google.com>
3431
3432 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
3433 sections.
3434 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
3435 relaxed input sections.
3436 * output.cc (Output_section::find_relaxed_input_section): Change
3437 return type to Output_relaxed_input_section pointer. Adjust code
3438 for new type of relaxed_input_section_map_.
3439 * output.h (Output_section::find_relaxed_input_section): Change
3440 return type to Output_relaxed_input_section pointer.
3441 (Output_section::Output_relaxed_input_section_by_input_section_map):
3442 New type.
3443 (Output_section::relaxed_input_section_map_): Change type to
3444 Output_section::Output_relaxed_input_section_by_input_section_map.
3445 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
3446 input section.
3447
3448 2009-12-15 Ian Lance Taylor <iant@google.com>
3449
3450 * layout.cc (Layout::create_shstrtab): Only write out after input
3451 sections if we are compressing debug sections.
3452
3453 2009-12-15 Ian Lance Taylor <iant@google.com>
3454
3455 * archive.cc (Archive::add_symbols): Only look up a symbol without
3456 a version if there is, in fact, a version.
3457
3458 2009-12-14 Ian Lance Taylor <iant@google.com>
3459
3460 Revert -Wshadow changes, all changes from:
3461 2009-12-11 Doug Kwan <dougkwan@google.com>
3462 2009-12-11 Nick Clifton <nickc@redhat.com>
3463 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
3464
3465 2009-12-11 Doug Kwan <dougkwan@google.com>
3466
3467 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
3468 due to -Wshadow.
3469 * attributes.cc (Object_attribute::size): Ditto.
3470 (Attributes_section_data::size): Ditto.
3471 (Attributes_section_data::Attributes_section_data): Ditto.
3472 (Output_attributes_section_data::do_write): Ditto.
3473 * attributes.h (Object_attribute::set_type): Ditto.
3474 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
3475
3476 2009-12-11 Nick Clifton <nickc@redhat.com>
3477
3478 * archive.cc: Fix shadowed variable warnings.
3479 * arm.cc: Likewise.
3480 * compressed_output.cc: Likewise.
3481 * compressed_output.h: Likewise.
3482 * configure: Likewise.
3483 * dwarf_reader.cc: Likewise.
3484 * dynobj.cc: Likewise.
3485 * dynobj.h: Likewise.
3486 * ehframe.cc: Likewise.
3487 * ehframe.h: Likewise.
3488 * errors.cc: Likewise.
3489 * expression.cc: Likewise.
3490 * fileread.cc: Likewise.
3491 * fileread.h: Likewise.
3492 * freebsd.h: Likewise.
3493 * i386.cc: Likewise.
3494 * icf.cc: Likewise.
3495 * incremental.h: Likewise.
3496 * layout.cc: Likewise.
3497 * layout.h: Likewise.
3498 * mapfile.cc: Likewise.
3499 * merge.cc: Likewise.
3500 * merge.h: Likewise.
3501 * object.cc: Likewise.
3502 * object.h: Likewise.
3503 * options.h: Likewise.
3504 * output.cc: Likewise.
3505 * output.h: Likewise.
3506 * parameters.cc: Likewise.
3507 * plugin.cc: Likewise.
3508 * powerpc.cc: Likewise.
3509 * reduced_debug_output.cc: Likewise.
3510 * reduced_debug_output.h: Likewise.
3511 * reloc.cc: Likewise.
3512 * reloc.h: Likewise.
3513 * resolve.cc: Likewise.
3514 * script-sections.cc: Likewise.
3515 * script.cc: Likewise.
3516 * script.h: Likewise.
3517 * sparc.cc: Likewise.
3518 * symtab.cc: Likewise.
3519 * symtab.h: Likewise.
3520 * target-select.cc: Likewise.
3521 * target-select.h: Likewise.
3522 * token.h: Likewise.
3523 * workqueue.cc: Likewise.
3524 * workqueue.h: Likewise.
3525 * x86_64.cc: Likewise.
3526
3527 2009-12-10 Doug Kwan <dougkwan@google.com>
3528
3529 * arm.cc (attributes.h): New include.
3530 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
3531 (Arm_relobj::~Arm_relobj): Delete object pointed by
3532 attributes_section_data_.
3533 (Arm_relobj::attributes_section_data): New method definition.
3534 (Arm_relobj::attributes_section_data_): New data member declaration.
3535 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
3536 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
3537 attributes_section_data_.
3538 (Arm_dynobj::attributes_section_data): New method definition.
3539 (Arm_dynobj::attributes_section_data_): New data member declaration.
3540 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
3541 initialization value of may_use_blx_ to false.
3542 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
3543 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
3544 object attributes to compute results instead of hard-coding.
3545 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
3546 Target_arm::get_secondary_compatible_arch,
3547 Target_arm::set_secondary_compatible_arch
3548 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
3549 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
3550 New method declarations.
3551 (Target_arm::get_aeabi_object_attribute): New method definition.
3552 (Target_arm::attributes_section_data_): New data member declaration.
3553 (read_arm_attributes_section): New template definition.
3554 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
3555 (Arm_dynobj::do_read_symbols): Ditto.
3556 (Target_arm::do_finalize_sections): Merge attributes sections from
3557 input. Check for BLX use after attributes section merging.
3558 Fix __exidx_start and __exidx_end visibility. Create an
3559 .ARM.attributes section if necessary.
3560 (Target_arm::get_secondary_compatible_arch,
3561 Target_arm::set_secondary_compatible_arch,
3562 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
3563 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
3564 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
3565 New method definitions.
3566
3567 2009-12-09 Ian Lance Taylor <iant@google.com>
3568
3569 * plugin.cc (Plugin::load): Don't cast from void* to a function
3570 pointer.
3571
3572 2009-12-09 Ian Lance Taylor <iant@google.com>
3573
3574 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
3575 information fields.
3576
3577 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
3578
3579 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
3580 Replace two_file_shared_1.so with two_file_shared_2.so.
3581 * testsuite/Makefile.in: Regenerated.
3582
3583 2009-12-08 Doug Kwan <dougkwan@google.com>
3584
3585 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
3586 (HFILES): Add attributes.h and int_encoding.h.
3587 * Makefile.in: Regenerate.
3588 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
3589 function definitions to int_encoding.cc
3590 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
3591 prototypes to int_encoding.h
3592 * reduced_debug_output.cc (int_encoding.h): New include.
3593 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
3594 function definitions to int_encoding.cc
3595 (insert_into_vector, read_from_pointer): Move template definitions to
3596 int_encoding.h
3597 * attributes.cc: New file.
3598 * attributes.h: New file.
3599 * int_encoding.cc: New file.
3600 * int_encoding.h: New file.
3601
3602 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
3603
3604 PR gold/11055
3605 * incremental-dump.cc (dump_incremental_inputs): New.
3606 (main): Use dump_incremental_inputs.
3607
3608 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
3609
3610 PR gold/10893
3611 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
3612 checking elfcpp::STT_FUNC.
3613 (Target_i386::Relocate::relocate): Likewise.
3614 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3615
3616 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
3617 symbols from shared libraries into normal FUNC symbols.
3618
3619 * symtab.h (Symbol): Add is_func and use it.
3620
3621 2009-12-05 Doug Kwan <dougkwan@google.com>
3622
3623 * arm.cc (Target_arm::arm_info): Initialize new fields
3624 attributes_section and attributes_vendor.
3625 * i386.cc (Target_i386::i386_info): Same.
3626 * object.cc (Sized_relobj::do_layout): Skip attribute section.
3627 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
3628 fields attributes_section and attributes_vendor.
3629 * sparc.cc (Target_sparc::sparc_info): Same.
3630 * target.h (Target::attributes_section, Target::attributes_vendor,
3631 Target::is_attributes_section, Target::attribute_arg_type,
3632 Target::attributes_order): New method definitions.
3633 (Target::Target_info::attributes_section,
3634 Target::Target_info::attributes_vendor): New fields.
3635 (Target::do_attribute_arg_type, Target::do_attributes_order): New
3636 virtual method definitions.
3637 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
3638 attributes_section and attributes_vendor.
3639 * testsuite/testfile.cc (Target_test::test_target_info): Same.
3640
3641 2009-12-05 Doug Kwan <dougkwan@google.com>
3642
3643 * arm.cc: Update comments about interworking and stub generation.
3644 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
3645 considered as non-PIC.
3646 (Arm_relocate_functions::base_abs): Fix formatting.
3647 (Arm_relocate_functions::got_prel): Fix comment. Change interface
3648 of function to use GOT entry address instead of offset.
3649 (Target_arm::Scan::global): Issue an error if a symbol would need a
3650 PLT does not get one because it is untyped. Remove code to create
3651 dynamic symbols for relative branches.
3652 (Target_arm::Relocate::relocate: Use 0 instead of false since function
3653 takes unsigned integer instead of boolean.
3654
3655 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
3656
3657 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
3658 (two_file_test_LDADD): Likewise.
3659 (common_test_1_LDADD): Likewise.
3660 (exception_test_LDADD) Likewise.
3661 (weak_test_LDADD): Likewise.
3662 (many_sections_test_LDADD): Likewise.
3663 (initpri1_LDADD): Likewise.
3664 (script_test_1_LDADD): Likewise.
3665 (script_test_2_LDADD): Likewise.
3666 (justsyms_LDADD): Likewise.
3667 (binary_test_LDADD): Likewise.
3668 (large_LDADD): Likewise.
3669 * testsuite/Makefile.in: Regenerated.
3670
3671 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
3672
3673 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
3674 (Symbol_table::override_with_special): Likewise.
3675 (Symbol_table::add_from_object): Likewise.
3676
3677 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
3678
3679 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3680 Don't set the data_offset twice.
3681
3682 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
3683
3684 * testsuite/Makefile.in: Regenerate.
3685
3686 2009-12-03 Doug Kwan <dougkwan@google.com>
3687
3688 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
3689 (Target_arm::do_finalize_sections): Add parameter for symbol table
3690 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
3691 * i386.cc (Target_i386::do_finalize_sections): Add an additional
3692 parameter for symbol table pointer.
3693 * layout.cc (Layout::finalize): Call Target::finalize_sections with
3694 an additional parameter for a pointer to symbol table.
3695 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
3696 parameter for a symbol table pointer.
3697 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
3698 * target.h (Target::finalize_sections, Target::do_finalize_sections):
3699 Ditto.
3700 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
3701 parameter for a symbol table pointer.
3702
3703 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
3704
3705 * incremental.cc (Incremental_inputs_header)
3706 (Incremental_inputs_header_write, Incremental_inputs_entry)
3707 (Incremental_inputs_entry_write): Move ...
3708 * incremental.h (Incremental_inputs_header)
3709 (Incremental_inputs_header_write, Incremental_inputs_entry)
3710 (Incremental_inputs_entry_write): here.
3711
3712 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
3713
3714 * incremental.cc (make_sized_incremental_binary): Set the target.
3715 Error if it is incompatible.
3716 * output.h (Output_file): Add filename method.
3717
3718 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
3719
3720 * incremental.cc (Incremental_inputs_entry): Remove unused argument
3721 from the get_* methods.
3722
3723 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
3724
3725 * incremental-dump.cc (main): Check that the offeset of a script is 0.
3726 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3727 Write 0 for the data_offset of scripts.
3728
3729 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
3730
3731 * testsuite/Makefile.am: Add the incremental_test.sh test.
3732 * testsuite/incremental_test.sh: New.
3733 * testsuite/incremental_test_1.c: New.
3734 * testsuite/incremental_test_2.c: New.
3735
3736 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
3737
3738 * incremental-dump.cc (main): Fix typos.
3739
3740 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
3741
3742 PR gold/11025
3743 * incremental-dump.cc (main): Use llu to print 64 bit values.
3744
3745 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
3746 H.J. Lu <hongjiu.lu@intel.com>
3747
3748 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
3749 $(LIBDL).
3750 (incremental_dump_LDADD): Likewise.
3751 * Makefile.in: Regenerated.
3752
3753 2009-11-25 Doug Kwan <dougkwan@google.com>
3754
3755 Revert:
3756
3757 2009-11-25 Doug Kwan <dougkwan@google.com>
3758
3759 * arm.cc (Target_arm::Target_arm): Move method definition
3760 outside of class definition. Add code to handle
3761 --target1-rel, --target1-abs and --target2= options.
3762 (Target_arm::get_reloc_reloc_type): Change method to be
3763 non-static and const.
3764 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
3765 New data member declaration.
3766 (Target_arm::Scan::local, Target_arm::Scan::global,
3767 Target_arm::Relocate::relocate,
3768 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3769 Adjust call to Target_arm::get_real_reloc_type.
3770 (Target_arm::get_real_reloc_type): Use command line options
3771 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3772 * options.h (--target1-rel, --target1-abs, --target2): New
3773 ARM-only options.
3774
3775 2009-11-25 Doug Kwan <dougkwan@google.com>
3776
3777 * arm.cc (Target_arm::Target_arm): Move method definition outside of
3778 class definition. Add code to handle --target1-rel, --target1-abs
3779 and --target2= options.
3780 (Target_arm::get_reloc_reloc_type): Change method to be non-static
3781 and const.
3782 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
3783 member declaration.
3784 (Target_arm::Scan::local, Target_arm::Scan::global,
3785 Target_arm::Relocate::relocate,
3786 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
3787 call to Target_arm::get_real_reloc_type.
3788 (Target_arm::get_real_reloc_type): Use command line options to
3789 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3790 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
3791 options.
3792
3793 2009-11-25 Doug Kwan <dougkwan@google.com>
3794
3795 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
3796 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
3797 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
3798 formatting.
3799 (Arm_relocate_functions::thm_call): Replace body with a call to
3800 Arm_relocate_functions::thumb_branch_common.
3801 (Arm_relocate_functions::thm_jump24,
3802 Arm_relocate_functions::thm_xpc22): New method definitions.
3803 (Arm_relocate_functions::thumb_branch_common): New method definition.
3804 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
3805 operator.
3806 (Target_arm::Relocate::relocate): Adjust call to thm_call.
3807 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
3808
3809 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
3810
3811 * Makefile.am: Build incremental-dump
3812 * Makefile.in: Regenerate.
3813 * incremental-dump.cc: New.
3814 * incremental.cc (Incremental_inputs_header_data,
3815 Incremental_inputs_entry_data): Move to incremental.h
3816 * incremental.h: (Incremental_inputs_header_data,
3817 Incremental_inputs_entry_data): Move from incremental.cc
3818
3819 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
3820
3821 * incremental.cc (Incremental_inputs_header,
3822 Incremental_inputs_header_write, Incremental_inputs_entry,
3823 Incremental_inputs_entry_write): Add a typedef with the data type.
3824
3825 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
3826
3827 * incremental.cc (Incremental_inputs_header,
3828 Incremental_inputs_header_write, Incremental_inputs_entry,
3829 Incremental_inputs_entry_write): Update comment about which
3830 type has the filed descriptions.
3831
3832 2009-11-15 Doug Kwan <dougkwan@google.com>
3833
3834 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
3835 (Arm_relocate_functions::arm_branch_common): Change method defintion
3836 in class definition to a method declaration and update list of formal
3837 parameters.
3838 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
3839 Arm_relocation_functions::jump24): Adjust call to
3840 Arm_relocate_functions::arm_branch_common. Update list of formal
3841 parameters.
3842 (Arm_relocate_functions::xpc25): New method definition.
3843 (Arm_relocate_functions::arm_branch_common): Move method defintion
3844 out from class definition. Use stubs for mode-switching and extending
3845 branch ranges.
3846 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
3847 specially. Change code to enable use of stubs in ARM branches.
3848
3849 2009-11-10 Doug Kwan <dougkwan@google.com>
3850
3851 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
3852 in method declaration.
3853 (Target_arm::relocate_stub): New method declaration.
3854 (Target_arm::default_target): Change to return a pointer instead of
3855 a const reference.
3856 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
3857 Target_arm::default_target.
3858 (Arm_Relobj::do_relocate_sections): Remove options paramater in
3859 method definition.
3860 (Target_arm::relocate_section): Adjust view.
3861 (Target_arm::relocate_stub): New method definition.
3862
3863 2009-11-10 Doug Kwan <dougkwan@google.com>
3864
3865 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
3866 a format warning.
3867 * incremental.cc (open_incremental_binary): Initialized local
3868 variables to avoid warnings.
3869 * object.cc (make_elf_object): Ditto.
3870 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
3871 a format warning.
3872
3873 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
3874
3875 PR gold/10930
3876 * testsuite/plugin_test.c: Include "config.h".
3877
3878 2009-11-09 Doug Kwan <dougkwan@google.com>
3879
3880 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
3881 (arm_symbol_value): Remove.
3882 (Arm_relocate_functions::arm_branch_common,
3883 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
3884 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
3885 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
3886 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
3887 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
3888 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
3889 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
3890 Arm_relocate_functions::thm_mobw_abs_nc,
3891 Arm_relocate_functions::thm_mov_abs,
3892 Arm_relocate_functions::movw_prel_nc,
3893 Arm_relocate_functions::thm_movt_abs,
3894 Arm_relocate_functions::movt_prel,
3895 Arm_relocate_functions::thm_movw_prel_nc,
3896 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
3897 (Target_arm::Relocate::relocate): Only decompose address into two
3898 parts if relocation type uses the thumb-bit and pass the actual
3899 bit instead of a flag indicating that the thumb-bit is used. Adjust
3900 calls to methods in Arm_relocate_functions for this change.
3901
3902 2009-11-08 Ian Lance Taylor <iant@google.com>
3903
3904 PR 10925
3905 * reloc.cc: Instantiate
3906 Sized_relobj::initialize_input_to_output_maps and
3907 Sized_relobj:free_input_to_output_maps.
3908
3909 2009-11-06 Ian Lance Taylor <iant@google.com>
3910
3911 PR 10876
3912 * defstd.cc (in_segment): Set only_if_ref true for "end".
3913
3914 2009-11-06 Doug Kwan <dougkwan@google.com>
3915
3916 * arm.cc (class Reloc_stub): Correct a comment.
3917 (Target_arm::Target_arm): Initialize arm_input_section_map_.
3918 (Target_arm::scan_section_for_stubs): New method declaration.
3919 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
3920 Change methods from private to protected.
3921 (Target_arm::do_may_relax): New method definition.
3922 (Target_arm::do_relax, Target_arm::group_sections,
3923 Target_arm::scan_reloc_for_stub,
3924 Target_arm::scan_reloc_section_for_stubs): New method declarations.
3925 (Target_arm::arm_input_section_map_): New data member declaration.
3926 (Target_arm::scan_reloc_for_stub,
3927 Target_arm::scan_reloc_section_for_stubs,
3928 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
3929 Target_arm::do_relax): New method definitions.
3930
3931 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
3932
3933 * configure.ac: Check for (struct stat)::st_mtim
3934 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
3935 * config.in: Regenerate.
3936 * configure: Regenerate.
3937
3938 2009-11-05 Ian Lance Taylor <iant@google.com>
3939
3940 PR 10910
3941 * output.cc (Output_segment::add_output_section): Add missing
3942 return statement.
3943
3944 2009-11-04 Ian Lance Taylor <iant@google.com>
3945
3946 PR 10880
3947 * object.h (class Object): Add is_needed and set_is_needed
3948 methods. Add is_needed_ field. Make bool fields into bitfields.
3949 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
3950 defined in a dynamic object and referenced by a regular object,
3951 set is_needed for the dynamic object.
3952 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
3953 if the file is marked with as_needed and it is not needed.
3954
3955 2009-11-04 Ian Lance Taylor <iant@google.com>
3956
3957 PR 10887
3958 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
3959 tags if data is discarded by linker script.
3960 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3961 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3962 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3963 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3964
3965 2009-11-04 Ian Lance Taylor <iant@google.com>
3966
3967 * layout.cc (Layout::get_output_section): Add is_interp and
3968 is_dynamic_linker_section parameters. Change all callers.
3969 (Layout::choose_output_section): Likewise.
3970 (Layout::make_output_section): Likewise.
3971 (Layout::add_output_section_data): Add is_dynamic_linker_section
3972 parameter. Change all callers.
3973 * layout.h (class Layout): Update declarations.
3974 * output.h (class Output_section): Add is_interp, set_is_interp,
3975 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
3976 Add is_interp_, is_dynamic_linker_section_ fields. Change
3977 generate_code_fills_at_write_ to a bitfield.
3978 * output.cc (Output_section::Output_sections): Initialize new
3979 fields.
3980 (Output_segment::add_output_section): Add do_sort parameter.
3981 Change all callers.
3982
3983 2009-11-03 Ian Lance Taylor <iant@google.com>
3984
3985 PR 10860
3986 * options.h (class General_options): Add --warn-common.
3987 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
3988 merging two common symbols.
3989 (Symbol_table::should_override): Handle --warn-common when merging
3990 a common symbol with a defined symbol. Use report_resolve_problem
3991 for multiple definitions.
3992 (Symbol_table::report_resolve_problem): New function.
3993 * symtab.h (class Symbol_table): Declare report_resolve_problem.
3994
3995 2009-11-03 Doug Kwan <dougkwan@google.com>
3996
3997 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
3998 stub_factory_.
3999 (Target_arm::stub_factory): New method definition.
4000 (Target_arm::new_arm_input_section,
4001 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
4002 Target_arm::reloc_uses_thumb_bit): New method declarations.
4003 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
4004 New type definitions.
4005 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
4006 member declarations.
4007 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
4008 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
4009 New method definitions.
4010
4011 2009-11-03 Ian Lance Taylor <iant@google.com>
4012
4013 * options.h (class General_options): Add --warn_constructors.
4014
4015 2009-11-03 Ian Lance Taylor <iant@google.com>
4016
4017 PR 10893
4018 * defstd.cc (in_section): Add entries for __rel_iplt_start,
4019 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
4020
4021 2009-11-03 Ian Lance Taylor <iant@google.com>
4022
4023 PR 10895
4024 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
4025 --msgid-bugs-address.
4026 (install-pdf): New target.
4027 (install-data_yes): Look up one directory to find mkinstalldirs.
4028
4029 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
4030
4031 * po/Make-in (.po.gmo): Don't generate .gmo files in source
4032 tree.
4033
4034 2009-10-30 Doug Kwan <dougkwan@google.com>
4035
4036 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
4037
4038 2009-10-30 Doug Kwan <dougkwan@google.com>
4039
4040 * arm.cc (Stub_addend_reader): New struct template definition
4041 and partial specializations.
4042 (Stub_addend_reader::operator()): New method definition for a
4043 partially specialized template.
4044
4045 2009-10-30 Doug Kwan <dougkwan@google.com>
4046
4047 * arm.cc (Arm_relobj::processor_specific_flags): New method
4048 definition.
4049 (Arm_relobj::do_read_symbols): New method declaration.
4050 (Arm_relobj::processor_specific_flags_): New data member declaration.
4051 (Arm_dynobj): New class definition.
4052 (Target_arm::do_finalize_sections): Add input_objects parameter.
4053 (Target_arm::do_adjust_elf_header): New method declaration.
4054 (Target_arm::are_eabi_versions_compatible,
4055 (Target_arm::merge_processor_specific_flags): New method declaration.
4056 (Target_arm::do_make_elf_object): New overloaded method definitions
4057 and declaration.
4058 (Arm_relobj::do_read_symbols): New method definition.
4059 (Arm_dynobj::do_read_symbols): Ditto.
4060 (Target_arm::do_finalize_sections): Add input_objects parameters.
4061 Merge processor-specific flags from all input objects.
4062 (Target_arm::are_eabi_versions_compatible,
4063 Target_arm::merge_processor_specific_flags,
4064 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
4065 New method definitions.
4066 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
4067 Input_objects pointer type parameter.
4068 * layout.cc (Layout::finalize): Pass input objects to target's.
4069 finalize_sections function.
4070 * output.cc (Output_file_header::do_sized_write): Set ELF file
4071 header's processor-specific flags.
4072 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
4073 Input_objects pointer type parameter.
4074 * sparc.cc (Target_sparc::do_finalize_sections): Same.
4075 * target.h (Input_objects): New forward class declaration.
4076 (Target::processor_specific_flags,
4077 Target::are_processor_specific_flags_sect): New method definitions.
4078 (Target::finalize_sections): Add input_objects parameter.
4079 (Target::Target): Initialize processor_specific_flags_ and
4080 are_processor_specific_flags_set_.
4081 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
4082 parameter.
4083 (Target::set_processor_specific_flags): New method definition.
4084 (Target::processor_specific_flags_,
4085 Target::are_processor_specific_flags_set_): New data member
4086 declarations.
4087 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
4088 Input_objects pointer type parameter.
4089
4090 2009-10-30 Doug Kwan <dougkwan@google.com>
4091
4092 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
4093
4094 2009-10-28 Ian Lance Taylor <iant@google.com>
4095
4096 * object.h (class Relobj): Drop options parameter from
4097 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
4098 do_scan_relocs, do_relocate. Change all callers.
4099 (class Sized_relobj): Drop options parameters from
4100 do_gc_process_relocs, do_scan_relocs, do_relocate,
4101 do_relocate_sections, relocate_sections, emit_relocs_scan,
4102 emit_relocs_scan_reltype. Change all callers.
4103 (struct Relocate_info): Remove options field and all references to
4104 it.
4105 * reloc.h (class Read_relocs): Remove options constructor
4106 parameter and options_ field. Change all callers.
4107 (class Gc_process_relocs, class Scan_relocs): Likewise.
4108 (class Relocate_task): Likewise.
4109 * target-reloc.h (scan_relocs): Remove options parameter. Change
4110 all callers.
4111 (scan_relocatable_relocs): Likewise.
4112 * target.h (class Sized_target): Remove options parameter from
4113 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
4114 all callers.
4115 * gc.h (gc_process_relocs): Remove options parameter. Change all
4116 callers.
4117 * arm.cc: Update functions to remove options parameters.
4118 * i386.cc: Likewise.
4119 * powerpc.cc: Likewise.
4120 * sparc.cc: Likewise.
4121 * x86_64.cc: Likewise.
4122 * testsuite/testfile.cc: Likewise.
4123
4124 2009-10-28 Doug Kwan <dougkwan@google.com>
4125
4126 * arm.cc (Arm_relobj): New class definition.
4127 (Arm_relobj::scan_sections_for_stubs,
4128 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
4129 New method definitions.
4130
4131 2009-10-28 Cary Coutant <ccoutant@google.com>
4132
4133 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
4134 (Plugin::cleanup_done_): New member.
4135 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
4136 (Plugin_manager::cleanup_done_): Remove.
4137 (Plugin_manager::add_input_file): Edit error message.
4138 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
4139 (Plugin_manager::cleanup): Remove use of cleanup_done_.
4140
4141 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
4142
4143 * fileread.cc: (File_read::View::~View): Use the new
4144 data_ownership_ filed.
4145 (File_read::~File_read): Dispose the new whole_file_view_.
4146 (File_read::open): Mmap the whole file if needed.
4147 (File_read::open): Use whole_file_view_ instead of contents_.
4148 (File_read::find_view): Use whole_file_view_ if applicable.
4149 (File_read::do_read): Use whole_file_view_ instead of contents_.
4150 (File_read::make_view): Use whole_file_view_ instead of contents_,
4151 update File_read::View::View call.
4152 (File_read::find_or_make_view): Update File_read::View::View
4153 call.
4154 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
4155 remove contents_
4156 (File_read::View::Data_ownership): New enum.
4157 (File_read::View::View): Replace bool mapped_ with Data_ownership
4158 argument.
4159 (File_read::View::mapped_): Remove (replaced by data_ownership_).
4160 (File_read::View::data_ownership_): New field.
4161 (File_read::contents_): Remove (replaced by whole_file_view_).
4162 (File_read::whole_file_view_): New field.
4163 * options.h (class General_options): Add --keep-files-mapped.
4164
4165 2009-10-27 Cary Coutant <ccoutant@google.com>
4166
4167 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
4168 * testsuite/Makefile.am (plugin_test_5): New test case.
4169 * testsuite/Makefile.in: Regenerate.
4170
4171 2009-10-25 Doug Kwan <dougkwan@google.com>
4172
4173 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
4174 from private to protected to allow access by child class.
4175 (Sized_relobj::do_relocate_sections): New method declaration.
4176 (Sized_relobj::relocate_sections): Virtualize.
4177 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
4178 Sized_relobj::relocate_sections. Instantiate template explicitly
4179 for different target sizes and endianity.
4180
4181 2009-10-24 Doug Kwan <dougkwan@google.com>
4182
4183 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
4184 (Arm_input_section::as_arm_input_section): New method.
4185 (Arm_output_section): New class definition.
4186 (Arm_output_section::create_stub_group,
4187 Arm_output_section::group_sections): New method definitions.
4188
4189 2009-10-22 Doug Kwan <dougkwan@google.com>
4190
4191 * arm.cc (Arm_input_section): New class definition.
4192 (Arm_input_section::init, Arm_input_section:do_write,
4193 Arm_input_section::set_final_data_size,
4194 Arm_input_section::do_reset_address_and_file_offset): New method
4195 definitions.
4196
4197 2009-10-21 Doug Kwan <dougkwan@google.com>
4198
4199 * arm.cc (Stub_table, Arm_input_section): New forward class
4200 declarations.
4201 (Stub_table): New class defintion.
4202 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
4203 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
4204 New method definition.
4205
4206 2009-10-21 Doug Kwan <dougkwan@google.com>
4207
4208 * arm.cc: Update copyright comments.
4209 (Target_arm): New forward class template declaration.
4210 (Arm_address): New type.
4211 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
4212 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
4213 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
4214 constants.
4215 (Insn_template): Same.
4216 (DEF_STUBS): New macro.
4217 (Stub_type): New enum type.
4218 (Stub_template): New class definition.
4219 (Stub): Same.
4220 (Reloc_stub): Same.
4221 (Stub_factory): Same.
4222 (Target_arm::Target_arm): Initialize may_use_blx_ and
4223 should_force_pic_veneer_.
4224 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
4225 Target_arm::should_force_pic_veneer,
4226 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
4227 Target_arm::using_thumb_only, Target_arm:;default_target): New
4228 method defintions.
4229 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
4230 New data member declarations.
4231 (Insn_template::size, Insn_template::alignment): New method defintions.
4232 (Stub_template::Stub_template): New method definition.
4233 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
4234 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
4235 (Stub_factory::Stub_factory): New method definition.
4236 * gold.h (string_hash): New template.
4237 * output.h (Input_section_specifier::hash_value): Use
4238 gold::string_hash.
4239 (Input_section_specifier::string_hash): Remove.
4240 * stringpool.cc (Stringpool_template::string_hash): Use
4241 gold::string_hash.
4242
4243 2009-10-20 Doug Kwan <dougkwan@google.com>
4244
4245 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
4246 symbols of relaxed input sections.
4247 * output.h (Output_section::find_relaxed_input_section): Make
4248 method public.
4249
4250 2009-10-16 Doug Kwan <dougkwan@google.com>
4251
4252 * dynobj.cc (Versions::Versions): Initialize version_script_.
4253 Only insert base version symbol definition for a shared object
4254 if version script defines any version versions.
4255 (Versions::define_base_version): New method definition.
4256 (Versions::add_def): Check that base version is not needed.
4257 (Versions::add_need): Define base version lazily.
4258 * dynobj.h (Versions::define_base_version): New method declaration.
4259 (Versions::needs_base_version_): New data member declaration.
4260 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
4261 (check_DATA): Add no_version_test.stdout.
4262 (libno_version_test.so, no_version_test.o no_version_test.stdout):
4263 New make rules.
4264 * testsuite/Makefile.in: Regenerate.
4265 * testsuite/no_version_test.c: New file.
4266 * testsuite/no_version_test.sh: Ditto.
4267
4268 2009-10-16 Doug Kwan <dougkwan@google.com>
4269
4270 * expression.cc (class Segment_start_expression): New class definition.
4271 (Segment_start_expression::value): New method definition.
4272 (script_exp_function_segment_start): Return a new
4273 Segment_start_expression.
4274 * gold/script-c.h (script_saw_segment_start_expression): New function
4275 prototype.
4276 * script-sections.cc (Script_sections::Script_sections): Initialize
4277 SAW_SEGMENT_START_EXPRESSION_ to false.
4278 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
4279 and -Tbbs options to specify section addresses if given in
4280 command line and no SEGMENT_START expression is seen in a script.
4281 * script-sections.h (Script_sections::saw_segment_start_expression,
4282 Script_sections::set_saw_segment_start_expression): New method
4283 definition.
4284 (Script_sections::saw_segment_start_expression_): New data member
4285 declaration.
4286 * script.cc (script_saw_segment_start_expression): New function.
4287 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
4288 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
4289 script_test_7.sh and script_test_8.sh.
4290 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
4291 script_test_8.stdout.
4292 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
4293 (script_test_6, script_test_6.stdout, script_test_7,
4294 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
4295 * Makefile.in: Regenerate.
4296 * testsuite/script_test_6.sh: New file.
4297 * testsuite/script_test_6.t: Same.
4298 * testsuite/script_test_7.sh: Same.
4299 * testsuite/script_test_7.t: Same.
4300 * testsuite/script_test_8.sh: Same.
4301
4302 2009-10-16 Doug Kwan <dougkwan@google.com>
4303
4304 * output.cc (Output_segment::set_section_list_address): Cast
4305 expressions to unsigned long long type to avoid format warnings.
4306
4307 2009-10-15 Ian Lance Taylor <iant@google.com>
4308
4309 * script.cc (Script_options::add_symbol_assignment): Always add a
4310 dot assignment to script_sections_.
4311 * script-sections.cc (Script_sections::add_dot_assignment):
4312 Initialize if necessary.
4313
4314 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
4315 program headers with no load segment if there is a linker script.
4316
4317 * layout.cc (Layout::set_segment_offsets): Align the file offset
4318 to the segment aligment for -N or -n with no load segment.
4319 * output.cc (Output_segment::add_output_section): Don't crash if
4320 the first section is a TLS section.
4321 (Output_segment::set_section_list_addresses): Print an error
4322 message if the address moves backward in a linker script.
4323 * script-sections.cc
4324 (Output_section_element_input::set_section_addresses): Don't
4325 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
4326 (Orphan_output_section::set_section_addresses): Likewise.
4327
4328 2009-10-15 Doug Kwan <dougkwan@google.com>
4329
4330 * layout.cc (Layout::finish_dynamic_section): Generate tags
4331 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
4332 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
4333 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
4334
4335 2009-10-14 Ian Lance Taylor <iant@google.com>
4336
4337 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
4338 fields.
4339 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
4340 data_shdr fields of relinfo.
4341 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
4342 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
4343 R_386_TLS_LDO_32, adjust based on section flags.
4344 (Target_i386::Relocate::fix_up_ldo): Remove.
4345
4346 2009-10-13 Ian Lance Taylor <iant@google.com>
4347
4348 Add support for -pie.
4349 * options.h (class General_options): Add -pie and
4350 --pic-executable.
4351 (General_options::output_is_position_independent): Test -pie.
4352 (General_options::output_is_executable): Return true if not shared
4353 and not relocatable.
4354 (General_options::output_is_pie): Remove.
4355 * options.cc (General_options::finalize): Reject incompatible uses
4356 of -pie.
4357 * gold.cc (queue_middle_tasks): A -pie link is not static.
4358 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
4359 * symtab.cc (Symbol::final_value_is_known): Return false if
4360 output_is_position_independent.
4361 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
4362 output_is_position_independent.
4363 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
4364 output_is_position_independent.
4365 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
4366 output_is_position_independent.
4367 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
4368 two_file_pie_test.
4369 (basic_pie_test.o, basic_pie_test): New targets.
4370 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
4371 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
4372 (two_file_pie_test): New target.
4373 * testsuite/Makefile.in: Rebuild.
4374 * README: Remove note saying that -pie is not supported.
4375
4376 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
4377
4378 * options.h (class General_options): Add -init and -fini.
4379 * layout.cc (Layout::finish_dynamic_section): Emit
4380 given init and fini functions.
4381
4382 2009-10-13 Sriraman Tallam <tmsriram@google.com>
4383
4384 * gc.h (gc_process_relocs): Check if icf is enabled using new
4385 function.
4386 * gold.cc (queue_initial_tasks): Likewise.
4387 (queue_middle_tasks): Likewise.
4388 * object.cc (do_layout): Likewise.
4389 * symtab.cc (is_section_folded): Likewise.
4390 * main.cc (main): Likewise.
4391 * reloc.cc (Read_relocs::run): Likewise.
4392 (Sized_relobj::do_scan_relocs): Likewise.
4393 * icf.cc (is_function_ctor_or_dtor): New function.
4394 (Icf::find_identical_sections): Check if function is ctor or dtor when
4395 safe icf is chosen.
4396 * options.h (General_options::icf): Change option to be an enum.
4397 (Icf_status): New enum.
4398 (icf_enabled): New method.
4399 (icf_safe_folding): New method.
4400 (set_icf_status): New method.
4401 (icf_status_): New variable.
4402 * (options.cc) (General_options::finalize): Set icf_status_.
4403 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
4404 icf_test and icf_keep_unique_test to use the --icf enum flag.
4405 * testsuite/icf_safe_test.sh: New file.
4406 * testsuite/icf_safe_test.cc: New file.
4407
4408 2009-10-12 Sriraman Tallam <tmsriram@google.com>
4409
4410 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
4411 includes to gc.h and icf.h.
4412 * arm.cc: Include gc.h.
4413 * gold.cc: Likewise.
4414 * i386.cc: Likewise.
4415 * powerpc.cc: Likewise.
4416 * sparc.cc: Likewise.
4417 * x86_64.cc: Likewise.
4418 * gc.h: Include icf.h.
4419
4420 2009-10-11 Ian Lance Taylor <iant@google.com>
4421
4422 * plugin.cc: Include "gold.h" before other header files.
4423
4424 2009-10-10 Chris Demetriou <cgd@google.com>
4425
4426 * options.h (Input_file_argument::Input_file_type): New enum.
4427 (Input_file_argument::is_lib_): Replace with...
4428 (Input_file_argument::type_): New member.
4429 (Input_file_argument::Input_file_argument): Take Input_file_type
4430 'type' rather than boolean 'is_lib' as second argument.
4431 (Input_file_argument::is_lib): Use type_.
4432 (Input_file_argument::is_searched_file): New function.
4433 (Input_file_argument::may_need_search): Handle is_searched_file.
4434 * options.cc (General_options::parse_library): Support -l:filename.
4435 (General_options::parse_just_symbols): Update for Input_file_argument
4436 changes.
4437 (Command_line::process): Likewise.
4438 * archive.cc (Archive::get_file_and_offset): Likewise.
4439 * plugin.cc (Plugin_manager::release_input_file): Likewise.
4440 * script.cc (read_script_file, script_add_file): Likewise.
4441 * fileread.cc (Input_file::Input_file): Likewise.
4442 (Input_file::will_search_for): Handle is_searched_file.
4443 (Input_file::open): Likewise.
4444 * readsyms.cc (Read_symbols::get_name): Likewise.
4445 * testsuite/Makefile.am (searched_file_test): New test.
4446 * testsuite/Makefile.in: Regenerate.
4447 * testsuite/searched_file_test.cc: New file.
4448 * testsuite/searched_file_test_lib.cc: New file.
4449
4450 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4451 Ian Lance Taylor <iant@google.com>
4452
4453 * descriptor.cc: Include <cstdio> and "binary-io.h".
4454 (Descriptors::open): Open the files in binary mode always.
4455 * script.cc (Lex::get_token): Treat \r as whitespace.
4456
4457 2009-10-09 Ian Lance Taylor <iant@google.com>
4458
4459 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
4460
4461 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4462 Ian Lance Taylor <iant@google.com>
4463
4464 * configure.ac: Check for readv function also.
4465 * fileread.cc (readv): Define if not HAVE_READV.
4466 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
4467 does not exist.
4468 * config.in: Regenerate.
4469 * configure: Regenerate.
4470
4471 2009-10-09 Doug Kwan <dougkwan@google.com>
4472
4473 * layout.cc (Layout::make_output_section): Call target hook to make
4474 ordinary output section.
4475 (Layout::finalize): Adjust parameter list of call the
4476 Target::may_relax().
4477 * layout.h (class Layout::section_list): New method.
4478 * merge.h (Output_merge_base::entsize): Change visibility to public.
4479 (Output_merge_base::is_string, Output_merge_base::do_is_string):
4480 New methods.
4481 (Output_merge_string::do_is_string): New method.
4482 * object.cc (Sized_relobj::do_setup): renamed from
4483 Sized_relobj::set_up.
4484 * object.h (Sized_relobj::adjust_shndx,
4485 Sized_relobj::initializ_input_to_output_maps,
4486 Sized_relobj::free_input_to_output_maps): Change visibilities to
4487 protected.
4488 (Sized_relobj::setup): Virtualize.
4489 (Sized_relobj::do_setup): New method declaration.
4490 (Sized_relobj::invalidate_section_offset,
4491 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
4492 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
4493 * options.cc (parse_int): New function.
4494 * options.h (parse_int): New declaration.
4495 (DEFINE_int): New macro.
4496 (stub_group_size): New option.
4497 * output.cc (Output_section::Output_section): Initialize memebers
4498 merge_section_map_, merge_section_by_properties_map_,
4499 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
4500 (Output_section::add_input_section): Handled deferred code-fill
4501 generation and remove an old comment.
4502 (Output_section::add_relaxed_input_section): New method definition.
4503 (Output_section::add_merge_input_section): Use merge section by
4504 properties map to speed to search. Update merge section maps
4505 as appropriate.
4506 (Output_section::build_relaxation_map): New method definition.
4507 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4508 Same.
4509 (Output_section::relax_input_section): Renamed to
4510 Output_section::convert_input_sections_to_relaxed_sections and change
4511 interface to take a vector of pointers to relaxed sections.
4512 (Output_section::find_merge_section,
4513 Output_section::find_relaxed_input_section): New method definitions.
4514 (Output_section::is_input_address_mapped,
4515 Output_section::output_offset, Output_section::output_address):
4516 Use output section data maps to speed up searching.
4517 (Output_section::find_starting_output_address): Add comments.
4518 (Output_section::do_write,
4519 Output_section::write_to_postprocessing_buffer): Do code-fill
4520 generation as appropriate.
4521 (Output_section::get_input_sections): Invalidate relaxed input section
4522 map.
4523 (Output_section::restore_states): Adjust type of checkpoint .
4524 Invalidate relaxed input section map.
4525 * output.h (Output_merge_base): New class declaration.
4526 (Input_section_specifier): New class defintion.
4527 (class Output_relaxed_input_section) Change base class to
4528 Output_section_data_build.
4529 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
4530 base class initializer.
4531 (Output_section::add_relaxed_input_section): New method declaration.
4532 (Output_section::Input_section): Change visibility to protected.
4533 (Output_section::Input_section::relobj,
4534 Output_section::Input_section::shndx): Handle relaxed input sections.
4535 Output_section::input_sections) Change visibility to protected. Also
4536 define overload to return a non-const pointer.
4537 (Output_section::Merge_section_properties): New class defintion.
4538 (Output_section::Merge_section_by_properties_map,
4539 Output_section::Output_section_data_by_input_section_map,
4540 Output_section::Relaxation_map): New types.
4541 (Output_section::relax_input_section): Rename method to
4542 Output_section::convert_input_sections_to_relaxed_sections and change
4543 interface to take a vector of relaxed section pointers.
4544 (Output_section::find_merge_section,
4545 Output_section::find_relaxed_input_section,
4546 Output_section::build_relaxation_map,
4547 Output_section::convert_input_sections_in_list_to_relaxed_sections):
4548 New method declarations.
4549 (Output_section::merge_section_map_
4550 Output_section::merge_section_by_properties_map_,
4551 Output_section::relaxed_input_section_map_,
4552 Output_section::is_relaxed_input_section_map_valid_,
4553 Output_section::generate_code_fills_at_write_): New data members.
4554 * script-sections.cc
4555 (Output_section_element_input::set_section_addresses): Call
4556 current_data_size and addralign methods of relaxed input sections.
4557 (Orphan_output_section::set_section_addresses): Call current_data_size
4558 and addralign methods of relaxed input sections.
4559 * symtab.cc (Symbol_table::compute_final_value): Extract template
4560 from the body of Symbol_table::sized_finalize_symbol.
4561 (Symbol_table::sized_finalized_symbol): Call
4562 Symbol_table::compute_final_value.
4563 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
4564 (Symbol_table::compute_final_value): New templated method declaration.
4565 * target.cc (Target::do_make_output_section): New method defintion.
4566 * target.h (Target::make_output_section): New method declaration.
4567 (Target::relax): Add more parameters for input objects, symbol table
4568 and layout. Adjust call to do_relax.
4569 (Target::do_make_output_section): New method declaration.
4570 (Target::do_relax): Add parameters for input objects, symbol table
4571 and layout.
4572
4573 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4574
4575 * pread.c: Include stdio.h.
4576
4577 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4578
4579 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
4580 defined.
4581
4582 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4583
4584 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4585 Change read_shndx type to unsigned int.
4586 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4587 int.
4588 (Sized_dwarf_line_info::read_line_mappings): Likewise.
4589 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
4590 Change read_shndx type to unsigned int.
4591 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4592 int.
4593 (Sized_dwarf_line_info::read_line_mappings): Likewise.
4594 * layout.cc (Layout::create_symtab_sections): Cast the result of
4595 local_symcount * symsize to off_t in the gold_assert.
4596
4597 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4598
4599 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
4600 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
4601 R_ARM_BASE_ABS.
4602 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
4603 (Arm_relocate_functions::thm_abs5): New function.
4604 (Arm_relocate_functions::abs12): New function.
4605 (Arm_relocate_functions::abs16): New function.
4606 (Arm_relocate_functions::base_abs): New function.
4607 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
4608 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
4609 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
4610 R_ARM_BASE_ABS.
4611 (Scan::global): Likewise.
4612 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
4613 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
4614 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
4615 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
4616 R_ARM_BASE_ABS.
4617
4618 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4619
4620 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
4621 (Arm_relocate_functions::movt_prel): New function.
4622 (Arm_relocate_functions::thm_movw_prel_nc): New function.
4623 (Arm_relocate_functions::thm_movt_prel): New function.
4624 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
4625 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
4626 (Scan::global, Relocate::relocate): Likewise.
4627 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4628
4629 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
4630
4631 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
4632 Incremental_checker.
4633 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
4634 unsigned int.
4635 (class Incremental_inputs_header): New class.
4636 (Incremental_inputs_header_writer): Edit comment.
4637 (Incremental_inputs_entry): New class.
4638 (Incremental_inputs_entry_writer): Edit comment.
4639 (Sized_incremental_binary::do_find_incremental_inputs_section):
4640 Add *strtab_shndx parameter, fill it.
4641 (Sized_incremental_binary::do_check_inputs): New method.
4642 (Incremental_checker::can_incrementally_link_output_file): Use
4643 Sized_incremental_binary::check_inputs.
4644 (Incremental_inputs::report_command_line): Save command line in
4645 command_line_.
4646 * incremental.h:
4647 (Incremental_binary::find_incremental_inputs_section): New
4648 method.
4649 (Incremental_binary::do_find_incremental_inputs_section): Add
4650 strtab_shndx parameter.
4651 (Incremental_binary::do_check_inputs): New pure virtual method.
4652 (Sized_incremental_binary::do_check_inputs): Declare.
4653 (Incremental_checker::Incremental_checker): Add incremental_inputs
4654 parameter, use it to initialize incremental_inputs_.
4655 (Incremental_checker::incremental_inputs_): New field.
4656 (Incremental_checker::command_line): New method.
4657 (Incremental_checker::inputs): New method.
4658 (Incremental_checker::command_line_): New field.
4659
4660 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
4661
4662 * incremental.cc: Include <cstdarg> and "target-select.h".
4663 (vexplain_no_incremental): New function.
4664 (explain_no_incremental): New function.
4665 (Incremental_binary::error): New method.
4666 (Sized_incremental_binary::do_find_incremental_inputs_section): New
4667 method.
4668 (make_sized_incremental_binary): New function.
4669 (open_incremental_binary): New function.
4670 (can_incrementally_link_file): Add checks if output is ELF and has
4671 inputs section.
4672 * incremental.h: Include "elfcpp_file.h" and "output.h".
4673 (Incremental_binary): New class.
4674 (Sized_incremental_binary): New class.
4675 (open_incremental_binary): Declare.
4676 * object.cc (is_elf_object): Use
4677 elfcpp::Elf_recognizer::is_elf_file.
4678 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
4679 * output.h (Output_file::filesize): New method.
4680
4681 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4682
4683 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
4684 New function.
4685 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
4686 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
4687 function.
4688 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
4689 function.
4690 (Arm_relocate_functions::movw_abs_nc): New function.
4691 (Arm_relocate_functions::movt_abs): New function.
4692 (Arm_relocate_functions::thm_movw_abs_nc): New function.
4693 (Arm_relocate_functions::thm_movt_abs): New function.
4694 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
4695 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
4696 (Scan::global): Likewise.
4697 (Relocate::relocate): Likewise.
4698 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4699
4700 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4701
4702 * arm.cc (Arm_relocate_functions::got_prel) New function.
4703 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
4704 (Relocate::relocate): Likewise.
4705 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4706
4707 2009-10-06 Ian Lance Taylor <iant@google.com>
4708
4709 * options.h (class General_options): Define
4710 split_stack_adjust_size parameter.
4711 * object.h (class Object): Add uses_split_stack_ and
4712 has_no_split_stack_ fields. Add uses_split_stack and
4713 has_no_split_stack accessor functions. Declare
4714 handle_split_stack_section.
4715 (class Reloc_symbol_changes): Define.
4716 (class Sized_relobj): Define Function_offsets. Declare
4717 split_stack_adjust, split_stack_adjust_reltype, and
4718 find_functions.
4719 * object.cc (Object::handle_split_stack_section): New function.
4720 (Sized_relobj::do_layout): Call handle_split_stack_section.
4721 * dynobj.cc (Sized_dynobj::do_layout): Call
4722 handle_split_stack_section.
4723 * reloc.cc (Sized_relobj::relocate_sections): Call
4724 split_stack_adjust for executable sections in split_stack
4725 objects. Pass reloc_map to relocate_section.
4726 (Sized_relobj::split_stack_adjust): New function.
4727 (Sized_relobj::split_stack_adjust_reltype): New function.
4728 (Sized_relobj::find_functions): New function.
4729 * target-reloc.h: Include "object.h".
4730 (relocate_section): Add reloc_symbol_changes parameter. Change
4731 all callers.
4732 * target.h (class Target): Add calls_non_split method. Declare
4733 do_calls_non_split virtual method. Declare match_view and
4734 set_view_to_nop.
4735 * target.cc: Include "elfcpp.h".
4736 (Target::do_calls_non_split): New function.
4737 (Target::match_view): New function.
4738 (Target::set_view_to_nop): New function.
4739 * gold.cc (queue_middle_tasks): Give an error if mixing
4740 split-stack and non-split-stack objects with -r.
4741 * i386.cc (Target_i386::relocate_section): Add
4742 reloc_symbol_changes parameter.
4743 (Target_i386::do_calls_non_split): New function.
4744 * x86_64.cc (Target_x86_64::relocate_section): Add
4745 reloc_symbol_changes parameter.
4746 (Target_x86_64::do_calls_non_split): New function.
4747 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
4748 parameter.
4749 * powerpc.cc (Target_powerpc::relocate_section): Add
4750 reloc_symbol_changes parameter.
4751 * sparc.cc (Target_sparc::relocate_section): Add
4752 reloc_symbol_changes parameter.
4753 * configure.ac: Call AM_CONDITIONAL for the default target.
4754 * configure: Rebuild.
4755 * testsuite/Makefile.am (TEST_AS): New variable.
4756 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
4757 (check_DATA): Add split_i386 and split_x86_64 files.
4758 (SPLIT_DEFSYMS): Define.
4759 (split_i386_[1234n].o): New targets.
4760 (split_i386_[124]): New targets.
4761 (split_i386_[1234r].stdout): New targets.
4762 (split_x86_64_[1234n].o): New targets.
4763 (split_x86_64_[124]): New targets.
4764 (split_x86_64_[1234r].stdout): New targets.
4765 (MOSTLYCLEANFILES): Add new executables.
4766 * testsuite/split_i386.sh: New file.
4767 * testsuite/split_x86_64.sh: New file.
4768 * testsuite/split_i386_1.s: New file.
4769 * testsuite/split_i386_2.s: New file.
4770 * testsuite/split_i386_3.s: New file.
4771 * testsuite/split_i386_4.s: New file.
4772 * testsuite/split_i386_n.s: New file.
4773 * testsuite/split_x86_64_1.s: New file.
4774 * testsuite/split_x86_64_2.s: New file.
4775 * testsuite/split_x86_64_3.s: New file.
4776 * testsuite/split_x86_64_4.s: New file.
4777 * testsuite/split_x86_64_n.s: New file.
4778 * testsuite/testfile.cc (Target_test): Update relocation_section
4779 function.
4780 * testsuite/Makefile.in: Rebuild.
4781
4782 2009-10-06 Ian Lance Taylor <iant@google.com>
4783
4784 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
4785 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
4786 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
4787 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
4788 the address on ldo_addrs_.
4789 (Target_i386::Relocate::fix_up_ldo): New function.
4790
4791 2009-10-06 Rafael Espindola <espindola@google.com>
4792
4793 * plugin.cc (add_input_library): New.
4794 (Plugin::load): Add add_input_library to tv.
4795 (Plugin_manager::add_input_file): Add the is_lib argument.
4796 (add_input_file): Update call to Plugin_manager::add_input_file.
4797 (add_input_library): New.
4798 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
4799
4800 2009-09-30 Doug Kwan <dougkwan@google.com>
4801
4802 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
4803 symbol and call Symbol::may_need_copy_reloc to determine if
4804 a copy reloc is needed.
4805 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
4806 nocopyreloc is given in command line.
4807 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
4808 given in command line.
4809 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
4810 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
4811 of the removed Target_i386::may_need_copy_reloc.
4812 * options.h (copyreloc): New option with default value false.
4813 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4814 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
4815 instead of the removed Target_powerpc::may_need_copy_reloc.
4816 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4817 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
4818 instead of the removed Target_sparc::may_need_copy_reloc.
4819 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
4820 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
4821 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
4822 instead of the removed Target_x86_64::may_need_copy_reloc.
4823
4824 2009-09-30 Ian Lance Taylor <iant@google.com>
4825
4826 * object.h (class Object): Remove target_ field, and target,
4827 sized_target, and set_target methods.
4828 (Object::sized_target): Remove.
4829 (class Sized_relobj): Update declarations. Remove sized_target.
4830 * object.cc (Sized_relobj::setup): Remove target parameter.
4831 Change all callers.
4832 (Input_objects::add_object): Don't do anything with the target.
4833 (make_elf_sized_object): Add punconfigured parameter. Change all
4834 callers. Set or test parameter target.
4835 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
4836 Change all callers.
4837 * parameters.cc (Parameters::set_target): Change parameter type to
4838 be non-const.
4839 (Parameters::default_target): Remove.
4840 (set_parameters_target): Change parameter type to be non-const.
4841 (parameters_force_valid_target): New function.
4842 (parameters_clear_target): New function.
4843 * parameters.h (class Parameters): Update declarations. Remove
4844 default_target method. Add sized_target and clear_target
4845 methods. Change target_ to be non-const.
4846 (set_parameters_target): Update declaration.
4847 (parameters_force_valid_target): Declare.
4848 (parameters_clear_target): Declare.
4849 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
4850 as NULL if we aren't searching.
4851 (Add_symbols::run): Don't check for compatible target.
4852 * fileread.cc (Input_file::open_binary): Call
4853 parameters_force_valid_target.
4854 * gold.cc (queue_middle_tasks): Likewise.
4855 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
4856 set_target on object.
4857 * dynobj.h (class Sized_dynobj): Update declarations.
4858 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
4859 make_elf_object returns NULL.
4860 (Archive::include_member): Don't check whether object target is
4861 compatible.
4862 * output.cc (Output_section::add_input_section): Get target from
4863 parameters.
4864 (Output_section::relax_input_section): Likewise.
4865 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
4866 parameters.
4867 (Sized_relobj::do_scan_relocs): Likewise.
4868 (Sized_relobj::relocate_sections): Likewise.
4869 * resolve.cc (Symbol_table::resolve): Likewise.
4870 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
4871 parameter. Change all callers.
4872 (Symbol_table::add_from_object): Get target from parameters.
4873 (Symbol_table::add_from_relobj): Don't check object target.
4874 (Symbol_table::add_from_dynobj): Likewise.
4875 (Symbol_table::define_special_symbol): Get target from
4876 parameters.
4877 * symtab.h (class Symbol_table): Update declaration.
4878 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
4879 parameter. Change all callers. Clear parameter target.
4880 (Binary_test): Test target here.
4881 * testsuite/object_unittest.cc (gold_testsuite): Remove
4882 target_test_pointer parameter. Change all callers.
4883 (Object_test): Test target here.
4884
4885 2009-09-26 Ian Lance Taylor <iant@google.com>
4886
4887 * testsuite/initpri1.c: Don't try to use constructor priorities if
4888 compiling with gcc before 4.3.
4889
4890 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
4891
4892 * testsuite/retain_symbols_file_test.sh (check_present): Change
4893 output file name to retain_symbols_file_test.stdout.
4894 (check_absent): Likewise.
4895
4896 2009-09-18 Craig Silverstein <csilvers@google.com>
4897
4898 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
4899 * options.cc: Include <cerrno> and <fstream>.
4900 (General_options::finalize): Parse -retain-symbols-file tag.
4901 * options.h: New flag.
4902 (General_options): New method should_retain_symbol, new
4903 variable symbols_to_retain.
4904 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
4905 should_retain_symbol map.
4906 * testsuite/Makefile.am (retain_symbols_file_test): New test.
4907 * testsuite/Makefile.in: Regenerate.
4908 * testsuite/retain_symbols_file_test.sh: New file.
4909
4910 2009-09-18 Nick Clifton <nickc@redhat.com>
4911
4912 * po/es.po: Updated Spanish translation.
4913
4914 2009-09-17 Doug Kwan <dougkwan@google.com>
4915
4916 * debug.h (DEBUG_RELAXATION): New constant.
4917 (DEBUG_ALL): Add DEBUG_RELAXATION.
4918 (debug_string_to_enum): Add relaxation debug option.
4919 * layout.cc
4920 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
4921 Layout::Relaxation_debug_check::read_sections,
4922 Layout::Relaxation_debug_check::read_sections): New method definitions.
4923 (Layout::Layout): Initialize data members
4924 record_output_section_data_from_scrips_,
4925 script_output_section_data_list_ and relaxation_debug_check_.
4926 (Layout::save_segments, Layout::restore_segments,
4927 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4928 Layout::relaxation_loop_body): New method definitions.
4929 (Layout::finalize): Support relaxation. Move section layout code to
4930 Layout::relaxation_loop_body.
4931 (Layout::set_asection_address_from_script): Move code for orphan
4932 section placement out.
4933 (Layout::place_orphan_sections_in_script): New method definition.
4934 * layout.h (Output_segment_headers, Output_file_header):
4935 New forward class declarations.
4936 (Layout::~Layout): Define.
4937 (Layout::new_output_section_data_from_script): New method definition.
4938 (Layout::place_orphan_sections_in_script): New method declaration.
4939 (Layout::Segment_states): New type declaration.
4940 (Layout::save_segments, Layout::restore_segments,
4941 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4942 Layout::relaxation_loop_body): New method declarations.
4943 (Layout::Output_section_data_list): New type declaration.
4944 (Layout::Relaxation_debug_check): New class definition.
4945 (Layout::record_output_section_data_from_script_,
4946 Layout::script_output_section_data_list_, Layout::segment_states_,
4947 Layout::relaxation_debug_check_): New data members.
4948 * output.cc: (Output_section_headers::do_size): New method definition.
4949 (Output_section_headers::Output_section_headers): Move size
4950 computation to Output_section_headers::do_size.
4951 (Output_segment_headers::do_size): New method definition.
4952 (Output_file_header::Output_file_header): Move size computation to
4953 Output_file_header::do_size and call it.
4954 (Output_file_header::do_size): New method definition.
4955 (Output_data_group::Output_data_group): Adjust call to
4956 Output_section_data.
4957 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
4958 (Output_symtab_xindex::do_write): Add array bound check.
4959 (Output_section::Input_section::print_to_mapfile): Handle
4960 RELAXED_INPUT_SECTION_CODE.
4961 (Output_section::Output_section): Initialize data member checkpoint_.
4962 (Output_section::~Output_section): Delete checkpoint object pointed
4963 by checkpoint_.
4964 (Output_section::add_input_section): Always add an Input_section if
4965 relaxing.
4966 (Output_section::add_merge_input_section): Add assert.
4967 (Output_section::relax_input_section): New method definition.
4968 (Output_section::set_final_data_size): Set load address to zero for
4969 an unallocated section.
4970 (Output_section::do_address_and_file_offset_have_reset_values):
4971 New method definition.
4972 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
4973 Handle relaxed input section.
4974 (Output_section::sort_attached_input_sections): Checkpoint input
4975 section list lazily.
4976 (Output_section::get_input_sections): Change type of input_sections to
4977 list of Simple_input_section pointers. Checkpoint input section list
4978 lazily. Also handle relaxed input sections.
4979 (Output_section::add_input_section_for_script): Take a reference to
4980 a Simple_input_section object instead of Relobj pointer and section
4981 index as parameter. Handle relaxed input sections.
4982 (Output_section::save_states, Output_section::restore_states): New
4983 method definitions.
4984 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
4985 (Output_data::is_data_size_fixed): New method definition.
4986 (Output_data::reset_addresss_and_file_offset): Do not reset data size
4987 if it is fixed.
4988 (Output_data::address_and_file_offset_have_reset_values): New method
4989 definition.
4990 (Output_data::do_address_and_file_offset_have_reset_values): New method
4991 definition.
4992 (Output_data::set_data_size): Check that data size is not fixed.
4993 (Output_data::fix_data_size): New method definition.
4994 (Output_data::is_data_size_fixed_): New data member.
4995 (Output_section_headers::set_final_data_size): New method definition.
4996 (Output_section_headers::do_size): New method declaration.
4997 (Output_segment_headers::set_final_data_size): New method definition.
4998 (Output_segment_headers::do_size): New method declaration.
4999 (Output_file_header::set_final_data_size)::New method definition.
5000 (Output_file_header::do_size)::New method declaration.
5001 (Output_section_data::Output_section_data): Add new parameter
5002 is_data_size_fixed and use it to fix data size.
5003 (Output_data_const::Output_data_const): Adjust call to base class
5004 constructor and fix data size.
5005 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
5006 base class constructor and fix data size.
5007 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
5008 base class constructor and fix data size.
5009 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
5010 class constructor and fix data size.
5011 (Output_data_group::set_final_data_size): New method definition.
5012 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
5013 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
5014 class constructor and fix data size.
5015 (Output_relaxed_input_section): New class definition.
5016 (Output_section::Simple_input_section): New class definition.
5017 (Output_section::get_input_sections): Adjust parameter list.
5018 (Output_section::add_input_section_for_script): Same.
5019 (Output_section::save_states, Output_section::restore_states,
5020 Output_section::do_address_and_file_offset_have_reset_values,
5021 (Output_section::Input_section::Input_section): Handle
5022 RELAXED_INPUT_SECTION_CODE. Add new overload for
5023 Output_relaxed_input_section.
5024 (Output_section::Input_section::is_input_section,
5025 Output_section::Input_section::set_output_section): Handle relaxed
5026 input section.
5027 (Output_section::Input_section::is_relaxed_input_section,
5028 Output_section::Input_section::output_section_data,
5029 Output_section::Input_section::relaxed_input_section): New method
5030 definitions.
5031 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
5032 value.
5033 (Output_section::Input_section::u1_): Update comments.
5034 (Output_section::Input_section::u2_): Add new union member poris.
5035 (Output_section::Checkpoint_output_section): New classs definition.
5036 (Output_section::relax_input_section): New method declaration.
5037 (Output_section::checkpoint_): New data member.
5038 (Output_segment): Update comments.
5039 (Output_segment::Output_segment): Un-privatize copy constructor.
5040 (Output_segment::operator=): Un-privatize.
5041 * script-sections.cc (Output_section_element::Input_section_list):
5042 Change element type to Output_section::Simple_input_section.
5043 (Output_section_element_dot_assignment::set_section_addresses):
5044 Register output section data for relaxation clean up.
5045 (Output_data_exression::Output_data_expression): Adjust call to base
5046 constructor to fix data size.
5047 (Output_section_element_data::set_section_addresses): Register
5048 Output_data_expression object for relaxation clean up.
5049 (struct Input_section_info): Replace Relobj pointer and section index
5050 pair with Output_section::Simple_input_section and Convert struct to a
5051 class.
5052 (Input_section_sorter::operator()): Adjust access to
5053 Input_section_info data member to use accessors.
5054 (Output_section_element_input::set_section_addresses): Use layout
5055 parameter. Adjust code to use Output_section::Simple_input_section
5056 and Input_secction_info classes. Register filler for relaxation
5057 clean up.
5058 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
5059 and section index pair with Output_section::Simple_input_section
5060 class. Adjust code accordingly.
5061 (Phdrs_element::release_segment): New method definition.
5062 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
5063 segment list.
5064 (Script_sections::release_segments): New method definition.
5065 * gold/script-sections.h (Script_sections::release_segments): New
5066 method declaration.
5067 * gold/target.h (Target::may_relax, Target::relax,
5068 Target::do_may_relax, Target::do_relax): New method definitions.
5069
5070 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5071
5072 * arm.cc (has_signed_unsigned_overflow): New function.
5073 (Arm_relocate_functions::abs8): New function.
5074 (Target_arm::Scan::local): Handle R_ARM_ABS8.
5075 (Target_arm::Scan::global): Likewise.
5076 (Target_arm::relocate::relocate): Likewise.
5077 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5078 Likewise.
5079
5080 2009-09-16 Cary Coutant <ccoutant@google.com>
5081
5082 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
5083 * testsuite/Makefile.in: Regenerate.
5084
5085 2009-09-11 Nick Clifton <nickc@redhat.com>
5086
5087 * po/gold.pot: Updated by the Translation project.
5088
5089 2009-09-08 Cary Coutant <ccoutant@google.com>
5090
5091 * output.cc (Output_file::open): Add execute permission to empty file.
5092 * testsuite/Makefile.am (permission_test): New test.
5093 * testsuite/Makefile.in: Regenerate.
5094
5095 2009-09-02 Ian Lance Taylor <iant@google.com>
5096
5097 * output.cc (Output_file::resize): Call map_no_anonymous rather
5098 than map.
5099
5100 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
5101
5102 * gold.cc: Include "incremental.h".
5103 (queue_initial_tasks): Call Incremental_checker methods.
5104 * incremental.cc: Include "output.h".
5105 (Incremental_checker::can_incrementally_link_output_file): New
5106 method.
5107 * incremental.h (Incremental_checker): New class.
5108
5109 * output.cc (Output_file::open_for_modification): New method.
5110 (Output_file::map_anonymous): Changed return type to bool. Record
5111 map in base_ field.
5112 (Output_file::map_no_anonymous): New method, broken out of map.
5113 (Output_file::map): Use map_no_anonymous and map_anonymous.
5114 * output.h (class Output_file): Update declarations.
5115
5116 2009-08-24 Cary Coutant <ccoutant@google.com>
5117
5118 * options.h (Command_line::Pre_options): New class.
5119 (Command_line::pre_options): New member.
5120 * options.cc (gold::options::ready_to_register): New variable.
5121 (One_option::register_option): Do nothing if not registering options.
5122 Assert if same short option registered twice.
5123 (General_options::General_options): Turn off option registration when
5124 done constructing.
5125 (Command_line::Pre_options::Pre_options): New constructor.
5126
5127 2009-08-24 Cary Coutant <ccoutant@google.com>
5128
5129 * options.h (General_options::no_keep_memory): Remove incorrect
5130 short option.
5131
5132 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5133
5134 * Makefile.am (am__skiplex, am__skipyacc): New.
5135 * Makefile.in: Regenerate.
5136
5137 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5138
5139 * Makefile.am (AM_CPPFLAGS): Renamed from ...
5140 (INCLUDES): ... this.
5141 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
5142 (AM_CPPFLAGS): Renamed from ...
5143 (INCLUDE): ... this.
5144 * Makefile.in, testsuite/Makefile.in: Regenerate.
5145
5146 * Makefile.in: Regenerate.
5147 * aclocal.m4: Likewise.
5148 * config.in: Likewise.
5149 * configure: Likewise.
5150 * testsuite/Makefile.in: Likewise.
5151
5152 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5153 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
5154 * Makefile.in: Regenerate.
5155 * testsuite/Makefile.in: Regenerate.
5156
5157 2009-08-19 Cary Coutant <ccoutant@google.com>
5158
5159 * resolve.cc (Symbol_table::resolve): Don't complain about defined
5160 symbols in shared libraries overridden by hidden or internal symbols
5161 in the main program.
5162
5163 2009-08-19 Chris Demetriou <cgd@google.com>
5164
5165 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
5166 checking source file names in error messages.
5167
5168 2009-08-18 Doug Kwan <dougkwan@google.com>
5169
5170 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
5171 an elcpp::Ehdr as parameter. Adjust call to set_target.
5172 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
5173 an elfcpp::Ehdr as parameter.
5174 * object.cc (Object::set_target): Remove the version that looks up
5175 a target and sets it.
5176 (Sized_relobj::setup): Take a Target object instead of
5177 an elfcpp::Ehdr as parameter. Adjust call to set_target.
5178 (make_elf_sized_object): Find target and ask target to
5179 make an ELF object.
5180 * object.h: (Object::set_target): Remove the version that looks up
5181 a target and sets it.
5182 (Sized_relobj::setup): Take a Target object instead of
5183 an elfcpp:Ehdr as parameter.
5184 * target.cc: Include dynobj.h.
5185 (Target::do_make_elf_object_implementation): New.
5186 (Target::do_make_elf_object): New.
5187 * target.h (Target::make_elf_object): New template declaration.
5188 (Target::do_make_elf_object): New method declarations.
5189 (Target::do_make_elf_object_implementation): New template declaration.
5190
5191 2009-08-14 Ian Lance Taylor <iant@google.com>
5192
5193 * gold.h (FUNCTION_NAME): Define.
5194 (gold_unreachable): Use FUNCTION_NAME.
5195
5196 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5197
5198 * icf.cc (Icf::find_identical_sections): Issue a warning when a
5199 symbol in the --keep-unique list is not found.
5200
5201 2009-08-12 Sriraman Tallam <tmsriram@google.com>
5202
5203 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
5204 been maked as --keep-unique.
5205 (Icf::unfold_section): New function.
5206 * icf.h (Icf::unfold_section): New function.
5207 * options.h (General_options::keep_unique): New option.
5208 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
5209 * testsuite/Makefile.in: Regenerate.
5210 * testsuite/icf_keep_unique_test.sh: New file.
5211 * testsuite/icf_keep_unique_test.cc: New file.
5212
5213 2009-08-12 Cary Coutant <ccoutant@google.com>
5214
5215 PR 10471
5216 * resolve.cc (Symbol_table::resolve): Check for references from
5217 dynamic objects to hidden and internal symbols.
5218 * testsuite/Makefile.am (hidden_test.sh): New test.
5219 * testsuite/Makefile.in: Regenerate.
5220 * testsuite/hidden_test.sh: New script.
5221 * testsuite/hidden_test_1.c: New test source.
5222 * testsuite/hidden_test_main.c: New test source.
5223
5224 2009-08-11 Doug Kwan <dougkwan@google.com>
5225
5226 * arm.cc: Update comments.
5227 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
5228 segment to locate the .ARM.exidx section if present.
5229
5230 2009-08-09 Doug Kwan <dougkwan@google.com>
5231
5232 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
5233 patch.
5234
5235 2009-08-07 Sriraman Tallam <tmsriram@google.com>
5236 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
5237 compiler warnings.
5238
5239 2009-08-06 Sriraman Tallam <tmsriram@google.com>
5240
5241 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
5242 valid tls_segment only for non-debug-section relocations.
5243 * testsuite/Makefile.am: Add gc_tls_test.
5244 * testsuite/Makefile.in: Regenerate.
5245 * testsuite/gc_tls_test.cc: New file.
5246 * testsuite/gc_tls_test.sh: New file.
5247
5248 2009-08-05 Sriraman Tallam <tmsriram@google.com>
5249
5250 * icf.cc: New file.
5251 * icf.h: New file.
5252 * Makefile.am (CCFILES): Add icf.cc.
5253 (HFILES): Add icf.h
5254 * Makefile.in: Regenerate.
5255 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
5256 * gc.h (gc_process_relocs): Populate lists used by icf to contain
5257 section, symbol and addend information for the relocs.
5258 * gold.cc (queue_middle_tasks): Call identical code folding.
5259 * gold.h: Add defines for multimap.
5260 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
5261 to the call of finalize_local_symbols.
5262 * main.cc (main): Create object of class Icf.
5263 * object.cc (Sized_relobj::do_layout): Allow this function to be
5264 called twice during icf.
5265 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
5266 to sections marked as identical by icf.
5267 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
5268 when available.
5269 (Sized_relobj::do_section_entsize): New function.
5270 * object.h (Object::section_entsize): New function.
5271 (Object::do_section_entsize): New pure virtual function.
5272 (Relobj::finalize_local_symbols): Add new parameter.
5273 (Relobj::do_section_entsize): New function.
5274 * options.h (General_options::icf): New option.
5275 (General_options::icf_iterations): New option.
5276 (General_options::print_icf_sections): New option.
5277 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
5278 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
5279 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
5280 icf.
5281 * symtab.cc (Symbol_table::is_section_folded): New function.
5282 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
5283 to sections marked as identical by icf.
5284 * symtab.h (Symbol_table::set_icf): New function.
5285 (Symbol_table::icf): New function.
5286 (Symbol_table::is_section_folded): New function.
5287 (Symbol_table::icf_): New data member.
5288 * target-reloc.h (relocate_section): Ignore sections folded by icf.
5289 * testsuite/Makefile.am: Add commands to build icf_test.
5290 * testsuite/Makefile.in: Regenerate.
5291 * testsuite/icf_test.sh: New file.
5292 * testsuite/icf_test.cc: New file.
5293
5294 2009-07-24 Chris Demetriou <cgd@google.com>
5295
5296 * layout.cc (is_compressible_debug_section): Fix incorrect
5297 comment about compressed section names.
5298
5299 2009-07-20 Ian Lance Taylor <ian@airs.com>
5300
5301 PR 10419
5302 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
5303
5304 2009-07-16 Ian Lance Taylor <iant@google.com>
5305
5306 PR 10400
5307 * layout.h: #include <map>.
5308 (class Kept_section): Change from struct to class. Add accessors
5309 and setters. Add section size to Comdat_group mapping. Change
5310 Comdat_group to std::map. Add is_comdat_ field. Add
5311 linkonce_size field in union.
5312 (class Layout): Update declaration of find_or_add_kept_section.
5313 Don't declare find_kept_object.
5314 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
5315 parameter. Add object, shndx, is_comdat, and is_group_name
5316 parameters. Change all callers. Adjust for new Kept_section.
5317 (Layout::find_kept_object): Remove.
5318 * object.cc (Sized_relobj::include_section_group): Update use of
5319 Kept_section. Rename secnum to shndx. Only record
5320 Kept_comdat_section if sections are the same size.
5321 (Sized_relobj::include_linkonce_section): Update use of
5322 Kept_section. Only record Kept_comdat_section if sections are the
5323 same size. Set size of linkonce section.
5324 (Sized_relobj::map_to_kept_section): Update call to
5325 get_kept_comdat_section.
5326 * object.h (class Sized_relobj): Rename fields in
5327 Kept_comdat_section to drop trailing underscores; change object
5328 field to Relobj*. Change Kept_comdat_section_table to store
5329 struct rather than pointer.
5330 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
5331 Add kept_object and kept_shndx parameters. Change all callers.
5332 (Sized_relobj::get_kept_comdat_section): Change return type to
5333 bool. Add kept_object and kept_shndx parameters. Change all
5334 callers.
5335 * plugin.cc (Pluginobj::include_comdat_group): Update call to
5336 Layout::find_or_add_kept_section.
5337
5338 2009-07-09 Ian Lance Taylor <iant@google.com>
5339
5340 * merge.cc (Object_merge_map::initialize_input_to_output_map):
5341 Reserve space in the hash table.
5342
5343 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
5344
5345 * fileread.cc (File_read::get_mtime): New method.
5346 * fileread.h (Timespec): New structure.
5347 (File_read::get_mtime): New method.
5348 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
5349 Renamed from timestamp_nsec.
5350 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
5351 Elf_Xword.
5352 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
5353 timestamp_nsec.
5354 (Incremental_inputs::report_archive): Save mtime; style fix.
5355 (Incremental_inputs::report_obejct): Save mtime; style fix.
5356 (Incremental_inputs::report_script): Save mtime; style fix.
5357 (Incremental_inputs::finalize_inputs): Style fix.
5358 (Incremental_inputs::finalize): Style fix.
5359 (Incremental_inputs::create_input_section_data): Store inputs
5360 mtime.
5361 * incremental.h (Incremental_inputs::report_script): Add mtime
5362 argument.
5363 (Incremental_inputs::Input_info::Input_info): Intialize only one
5364 union member.
5365 (Incremental_inputs::Input_info::archive): Move to nameless
5366 union.
5367 (Incremental_inputs::Input_info::obejct): Move to nameless union.
5368 (Incremental_inputs::Input_info::script): Move to nameless union.
5369 (Incremental_inputs::mtime): New field.
5370 * script.cc (read_input_script): Pass file mtime to
5371 Incremental_input.
5372 * script.h (Script_info::inputs): Style fix.
5373
5374 2009-07-01 Ian Lance Taylor <ian@airs.com>
5375
5376 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
5377 instead of 32.
5378
5379 2009-06-24 Ian Lance Taylor <iant@google.com>
5380
5381 PR 10156
5382 * layout.cc (Layout::choose_output_section): If we find an
5383 existing section, update the flags.
5384 (Layout::create_notes): New function, broken out of
5385 Layout::finalize.
5386 (Layout::finalize): Don't create note sections.
5387 (Layout::create_note): Don't crash if linker script discards
5388 section.
5389 (Layout::create_gold_note): Likewise.
5390 (Layout::create_build_id): Likewise. Don't set
5391 after_input_sections on the section.
5392 (Layout::create_executable_stack_info): Remove target parameter.
5393 Change caller.
5394 * layout.h (class Layout): Declare create_notes. Update
5395 declaration of create_executable_stack_info.
5396 * gold.cc (queue_middle_tasks): Call create_notes.
5397 * output.cc (Output_section::update_flags_for_input_section): Move
5398 here from output.h. If SHF_ALLOC flag is newly set, mark address
5399 invalid.
5400 * output.h (Output_data::mark_address_invalid): New function.
5401 (class Output_section): Only declare, not define,
5402 update_flags_for_input_section. Remove set_flags.
5403
5404 2009-06-24 Ian Lance Taylor <iant@google.com>
5405
5406 * script-sections.cc (Output_section_definition::
5407 set_section_addresses): Rename shadowing local load_address to
5408 laddr.
5409
5410 2009-06-24 Ian Lance Taylor <iant@google.com>
5411
5412 PR 10244
5413 * reloc.cc (relocate_sections): Skip empty relocation sections.
5414
5415 2009-06-23 Ian Lance Taylor <iant@google.com>
5416
5417 PR 10156
5418 * layout.cc (Layout::create_note): Use choose_output_section
5419 rather than make_output_section.
5420
5421 2009-06-23 Ian Lance Taylor <iant@google.com>
5422
5423 PR 10237
5424 * options.cc (General_options::parse_V): Set printed_version_.
5425 (General_options::General_options): Initialize printed_version_.
5426 * options.h (class General_options): Add printed_version_ field.
5427 * gold.cc (queue_initial_tasks): If there are no input files,
5428 don't give a fatal error if we printed the version information.
5429 (queue_middle_tasks): If using -r with a shared object, give a
5430 fatal error rather than an ordinary error.
5431
5432 2009-06-23 Ian Lance Taylor <iant@google.com>
5433
5434 PR 10219
5435 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
5436 (Layout::make_output_section): Set have_stabstr_section_ if we see
5437 a .stab*str section.
5438 (Layout::finalize): Call link_stabs_sections.
5439 (Layout::link_stabs_sections): New file.
5440 * layout.h (class Layout): Add have_stabstr_section_ field.
5441 Declare link_stabs_sections.
5442
5443 2009-06-23 Doug Kwan <dougkwan@google.com>
5444
5445 * Makefile.am (libgold_a_LIBADD): New.
5446 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
5447 * Makefile.in: Regenerate.
5448 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
5449 * configure: Regenerate.
5450 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
5451 * fileread.cc: Include sys/state.h
5452 * gold.h: Declare memmem and strndup if found missing.
5453 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
5454
5455 2009-06-23 Ian Lance Taylor <iant@google.com>
5456
5457 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
5458 * configure: Rebuild.
5459
5460 2009-06-23 Ian Lance Taylor <iant@google.com>
5461
5462 PR 10147
5463 * object.cc (Object::section_contents): Don't try to get a view if
5464 the section has length zero.
5465 (Object::handle_gnu_warning_section): If the section is empty, use
5466 the name of the section as the warning.
5467
5468 2009-06-23 Ian Lance Taylor <iant@google.com>
5469
5470 PR 10133
5471 * stringpool.h (class Stringpool_template): Add optimize_ field.
5472 (Stringpool_template::set_optimize): New function.
5473 * stringpool.cc (Stringpool_template::Stringpool_template):
5474 Initialize optimize_ field.
5475 (Stringpool_template::set_string_offsets): Test local optimize
5476 fild rather than parameter.
5477 * layout.cc (Layout::Layout): Call set_optimize on the section
5478 name stringpool.
5479
5480 2009-06-22 Ian Lance Taylor <iant@google.com>
5481
5482 PR 10030
5483 * yyscript.y: Parse TARGET.
5484 * script.cc (script_set_target): New function.
5485 * script-c.h (script_set_target): Declare.
5486 * options.cc (General_options::string_to_object_format): Rename
5487 from string_to_object_format in anonymous namespace. Change
5488 callers.
5489 * options.h (class General_options): Declare
5490 string_to_object_format.
5491
5492 2009-06-22 Ian Lance Taylor <iant@google.com>
5493
5494 * script-sections.cc (Script_sections::create_segments): Don't put
5495 program headers in a PT_LOAD segment if -n or -N.
5496
5497 2009-06-22 Ian Lance Taylor <iant@google.com>
5498
5499 PR 10141
5500 * options.h (class General_options): Add -z lazy and -z now. Sort
5501 -z options into alphabetical order.
5502 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
5503
5504 2009-06-21 Ian Lance Taylor <iant@google.com>
5505
5506 * layout.cc (Layout::make_output_section): Call
5507 Target::new_output_section.
5508 (Layout::attach_allocated_section_to_segment): Put large section
5509 sections in a separate load segment with the large segment flag
5510 set.
5511 (Layout::segment_precedes): Sort large data segments after other
5512 load segments.
5513 (align_file_offset): New static function.
5514 (Layout::set_segment_offsets): Use align_file_offset.
5515 * output.h (class Output_section): Add is_small_section_ and
5516 is_large_section_ fields.
5517 (Output_section::is_small_section): New function.
5518 (Output_section::set_is_small_section): New function.
5519 (Output_section::is_large_section): New function.
5520 (Output_section::set_is_large_section): New function.
5521 (Output_section::is_large_data_section): New function.
5522 (class Output_segment): Add is_large_data_segment_ field.
5523 (Output_segment::is_large_data_segment): New function.
5524 (Output_segment::set_is_large_data_segment): New function.
5525 * output.cc (Output_section::Output_section): Initialize new
5526 fields.
5527 (Output_segment::Output_segment): Likewise.
5528 (Output_segment::add_output_section): Add assertion that large
5529 data sections always go in large data segments. Force small data
5530 sections to the end of the list of data sections. Force small BSS
5531 sections to the start of the list of BSS sections. For large BSS
5532 sections to the end of the list of BSS sections.
5533 * symtab.h (class Symbol): Declare is_common_shndx.
5534 (Symbol::is_defined): Check Symbol::is_common_shndx.
5535 (Symbol::is_common): Likewise.
5536 (class Symbol_table): Define enum Commons_section_type. Update
5537 declarations. Add small_commons_ and large_commons_ fields.
5538 * symtab.cc (Symbol::is_common_shndx): New function.
5539 (Symbol_table::Symbol_table): Initialize new fields.
5540 (Symbol_table::add_from_object): Put small and large common
5541 symbols in the right list.
5542 (Symbol_table::sized_finalized_symbol): Check
5543 Symbol::is_common_shndx.
5544 (Symbol_table::sized_write_globals): Likewise.
5545 * common.cc (Symbol_table::do_allocate_commons): Allocate new
5546 common symbol lists. Don't call do_allocate_commons_list if the
5547 list is empty.
5548 (Symbol_table::do_allocate_commons_list): Remove is_tls
5549 parameter. Add comons_section_type parameter. Change all
5550 callers. Handle small and large common symbols.
5551 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
5552 Symbol::is_common_shndx.
5553 * resolve.cc (symbol_to_bits): Likewise.
5554 * target.h (Target::small_common_shndx): New function.
5555 (Target::small_common_section_flags): New function.
5556 (Target::large_common_shndx): New function.
5557 (Target::large_common_section_flags): New function.
5558 (Target::new_output_section): New function.
5559 (Target::Target_info): Add small_common_shndx, large_common_shndx,
5560 small_common_section_flags, and large_common_section_flags
5561 fields.
5562 (Target::do_new_output_section): New virtual function.
5563 * arm.cc (Target_arm::arm_info): Initialize new fields.
5564 * i386.cc (Target_i386::i386_info): Likewise.
5565 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5566 Likewise.
5567 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
5568 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5569 (Target_x86_64::do_new_output_section): New function.
5570 * configure.ac: Define conditional MCMODEL_MEDIUM.
5571 * testsuite/Makefile.am (check_PROGRAMS): Add large.
5572 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
5573 (large_LDFLAGS): Define.
5574 * testsuite/large.c: New file.
5575 * testsuite/testfile.cc (Target_test::test_target_info):
5576 Initialize new fields.
5577 * configure, testsuite/Makefile.in: Rebuild.
5578
5579 2009-06-05 Doug Kwan <dougkwan@google.com>
5580
5581 * Makefile.am (CCFILES): Add target.cc.
5582 * Makefile.in: Regenerate.
5583 * i386.cc (class Target_i386): Define new virtual method to
5584 override do_is_local_label_name in parent.
5585 * object.cc (Sized_relobj::do_count_local_symbols): Discard
5586 local symbols if --discard-locals or -X is given.
5587 * options.h (class General_options): Declare new options
5588 '--discard-locals' and '-X' for discarding locals.
5589 * target.h (class Target): Define new methods is_local_label_name.
5590 Declare new virtual method do_is_local_label_name.
5591 * target.cc: New file.
5592 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
5593 (check_SCRIPTS): Add discard_locals_test.sh.
5594 (check_DATA): Add discard_local_tests.syms.
5595 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
5596 (discard_local_tests.syms, discard_locals_test.o): New make rules.
5597 * testsuite/Makefile.in: Regenerate.
5598 * testsuite/discard_locals_test.c: New file.
5599 * testsuite/discard_locals_test.sh: Same.
5600
5601 2009-06-05 Doug Kwan <dougkwan@google.com>
5602
5603 * object.cc (Sized_relobj::Sized_relobj): Initialize
5604 discarded_eh_frame_shndx_ to -1U.
5605 (Sized_relobj::do_layout): Record index of a discard .eh_frame
5606 section.
5607 (Sized_relobj::do_count_local_symbols): Skip local symbols in
5608 a discarded .eh_frame section.
5609 (Sized_relobj::do_finalize_local_symbols): Ditto.
5610 * object.h (class Sized_relobj): Declare new member
5611 discarded_eh_frame_shndx_.
5612 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
5613 (local_labels_test.o, local_labels_test): New rules.
5614 * testsuite/Makefile.in: Regenerate.
5615
5616 2009-06-04 Doug Kwan <dougkwan@google.com>
5617
5618 * layout.cc (Layout::section_name_mapping): Add mapping for
5619 special ARM sections.
5620
5621 2009-06-03 Doug Kwan <dougkwan@google.com>
5622
5623 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
5624 (utils::has_overflow): Same.
5625
5626 2009-06-03 Ian Lance Taylor <iant@google.com>
5627
5628 * layout.cc (Layout::section_name_mapping): New array, replacing
5629 Layout::linkonce_mapping.
5630 (Layout::section_name_mapping_count): New variable, replacing
5631 Layout::linkonce_mapping_count.
5632 (Layout::linkonce_output_name): Remove.
5633 (Layout::output_section_name): Rewrite.
5634 * layout.h (class Layout): Rename Linkonce_mapping to
5635 Section_name_mapping, linkonce_mapping to section_name_mapping,
5636 linkonce_mapping_count to section_name_mapping_count. Don't
5637 declare linkonce_output_name.
5638
5639 2009-06-03 Doug Kwan <dougkwan@google.com>
5640
5641 * gold/arm.cc (namespace utils): New.
5642 (Target_arm::reloc_is_non_pic): Define new method.
5643 (class Arm_relocate_functions): New.
5644 (Target_arm::Relocate::relocate): Handle relocation types used by
5645 Android.
5646
5647 2009-06-03 Ian Lance Taylor <iant@google.com>
5648
5649 * arm.cc (Target_arm::scan::global): Use || instead of |.
5650
5651 2009-06-02 Doug Kwan <dougkwan@google.com>
5652
5653 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
5654 issued_non_pic_error_.
5655 (class Target_arm::Scan): Declare new method check_non_pic.
5656 Define new method symbol_needs_plt_entry.
5657 Declare new data member issued_non_pic_error_.
5658 (class Target_arm::Relocate): Declare new method
5659 should_apply_static_reloc.
5660 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
5661 (Target_arm::Scan::check_non_pic): Define new method.
5662 (Target_arm::Scan::local): Handle a small subset of reloc types used
5663 by Android.
5664 (Target_arm::Scan::local): Same.
5665 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
5666
5667 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
5668
5669 * incremental.cc (Incremental_inputs::report_command_line): Filter
5670 out --incremental-* options.
5671
5672 2009-05-29 Doug Kwan <dougkwan@google.com>
5673
5674 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
5675 template class.
5676 (class Target_arm): Update comment.
5677 (Target_arm::Target_arm): Initialize new data members GOT_,
5678 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
5679 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
5680 and Target_arm::rel_dyn_section.
5681 Declare new_enum Target_arm::Got_type.
5682 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
5683 and DYNBSS_.
5684 Update commments for member do_dynsym_value.
5685 (Target_arm::got_size, Target_arm::plt_section,
5686 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
5687 new methods inside class defintion.
5688 (Target_arm::got_section): Define new method.
5689 (Target_arm::rel_dyn_section): Same.
5690 (Output_data_plt_arm): New template class.
5691 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
5692 (Output_data_plt_arm:do_adjust_output_section): Define new method.
5693 (Output_data_plt_arm::add_entry): Same.
5694 (Output_data_plt_arm::first_plt_entry): Define new
5695 static data member for PLT instruction template.
5696 (Output_data_plt_arm::plt_entry): Same.
5697 (Output_data_plt_arm::do_write): Define new method.
5698 (Target_arm::make_plt_entry): Same.
5699 (Target_arm::do_finalize_sections): Same.
5700 (Target_arm::do_dynsym_value): Same.
5701
5702 2009-05-28 Doug Kwan <dougkwan@google.com>
5703
5704 * Makefile.am (TARGETSOURCES): Add arm.cc.
5705 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
5706 * Makefile.in: Regenerate.
5707 * arm.cc: New file.
5708 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
5709
5710 2009-05-26 Doug Kwan <dougkwan@google.com>
5711
5712 * options.cc (General_options::parse_exclude_libs). Fix a comment.
5713 (General_options::check_excluded_libs): Strip off directories in
5714 archive name before matching like GNU ld does.
5715 * testsuite/Makefile.am (MOSTLYCLEANFILES,
5716 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
5717 (exclude_libs_test_LDFLAGS): Add linker option
5718 -Wl,--exclude-libs,libexclude_libs_test_3
5719 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
5720 an explicit archive without using -l.
5721 (alt/libexclude_libs_test_3.a): New make rule.
5722 * testsuite/Makefile.in: Regenerate.
5723 * testsuite/exclude_libs_test.c : Declare lib3_default().
5724 (main): Call it.
5725 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
5726 * exclude_libs_test_3.c: New file.
5727
5728 2009-05-26 Nick Clifton <nickc@redhat.com>
5729
5730 * po/id.po: New Indonesian translation.
5731 * po/gold.pot: Updated template file.
5732
5733 2009-05-22 Sriraman Tallam <tmsriram@google.com>
5734
5735 * testsuite/Makefile.am: Add -ffunction-sections to compile
5736 gc_comdat_test files. Add -Wl,--gc-sections to build
5737 gc_comdat_test.
5738 * testsuite/Makefile.in: Regenerate.
5739 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
5740
5741 2009-05-21 Sriraman Tallam <tmsriram@google.com>
5742
5743 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
5744 kept comdat section was garbage collected.
5745 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
5746 * testsuite/Makefile.in: Regenerate.
5747 * testsuite/gc_comdat_test.sh: New file.
5748 * testsuite/gc_comdat_test_1.cc: New file.
5749 * testsuite/gc_comdat_test_2.cc: New file.
5750
5751 2009-05-19 Doug Kwan <dougkwan@google.com>
5752
5753 * archive.cc (Archive::Archive): Move constructor from archive.h
5754 to here. Initialize no_export_.
5755 (Archive::get_elf_object_for_member): Set no_export flag of object.
5756 * archive.h (Archive::Archive): Move constructor body to
5757 archive.cc.
5758 (Archive::no_export): New method.
5759 (Archive::no_export_): New field.
5760 * object.h (Object::Object): Initialize no_export_ to false.
5761 (Object::no_export, Object::set_no_export): New methods.
5762 (Object::no_export_): New field.
5763 * options.cc (General_options::parse_exclude_libs): New method.
5764 (General_options::check_excluded_libs) Same.
5765 * options.h (exclude_libs): New option.
5766 (General_options::check_excluded_libs): New method declaration.
5767 (General_options::excluded_libs_): New field.
5768 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
5769 default or protected visibility if an object has no-export flag set.
5770 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
5771 (check_SCRIPTS): Add exclude_libs_test.sh.
5772 (check_DATA): Add exclude_libs_test.syms.
5773 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
5774 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
5775 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
5776 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
5777 (exclude_libs_test.syms, libexclude_libs_test_1.a,
5778 libexclude_libs_test_2.a): New rules.
5779 * testsuite/Makefile.in: Regenerate.
5780 * testsuite/exclude_libs_test.c: New file.
5781 * testsuite/exclude_libs_test.sh: Ditto.
5782 * testsuite/exclude_libs_test_1.c: Ditto.
5783 * testsuite/exclude_libs_test_2.c: Ditto.
5784
5785 2009-05-15 Ian Lance Taylor <iant@google.com>
5786
5787 * configure.ac: Check for declarations for cases where libiberty.h
5788 checks HAVE_DECL_xxx.
5789 * configure, config.in: Rebuild.
5790
5791 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
5792
5793 * gold.h (Incremental_argument_list): Remove (invalid) forward
5794 declaration.
5795 * incremental.cc (Incremental_inputs::report_achive): New method.
5796 (Incremental_inputs::report_object): New method.
5797 (Incremental_inputs::report_script): New method.
5798 (Incremental_inputs::finalize_inputs): New method.
5799 (Incremental_inputs::finalize): Call finalize_inputs().
5800 (Incremental_inputs::sized_create_incremental_inputs_section_data):
5801 Create inputs entries.
5802 * incremental.h (Incremental_input_type): New enum.
5803 (Incremental_inputs::Incremental_input): Initialize new fields.
5804 (Incremental_inputs::report_inputs): New method.
5805 (Incremental_inputs::report_achive): New method.
5806 (Incremental_inputs::report_object): New method.
5807 (Incremental_inputs::report_script): New method.
5808 (Incremental_inputs::finalize_inputs): New method.
5809 (Incremental_inputs::Input_info): New struct.
5810 (Incremental_inputs::Input_info_map): New typedef.
5811 (Incremental_inputs::lock_): New field.
5812 (Incremental_inputs::Inputs_): New field.
5813 (Incremental_inputs::Inputs_map): New field.
5814 * main.cc (main): Call Incremental_input::report_inputs.
5815 * options.h (Input_argument_list): Typedef moved from
5816 Input_arguments.
5817 (Input_file_group::Files): Remove, use ::Input_argument_list.
5818 (Input_file_group::Input_argument_list): Remove, use
5819 ::Input_argument_list.
5820 * plugin.cc (Plugin_manager::add_input_file): Add error in
5821 incremental build.
5822 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
5823 functions.
5824 * script.cc (read_input_script): Call
5825 Incremental_input::report_script.
5826 * script.h (Script_info): New class.
5827
5828 2009-04-27 Ian Lance Taylor <iant@google.com>
5829
5830 * x86_64.cc (do_adjust_output_section): Set entsize to
5831 plt_entry_size.
5832
5833 2009-04-23 Elliott Hughes <enh@google.com>
5834
5835 * output.cc (Output_file::close): After short writes, continue
5836 writing from the correct offset in the buffer being written.
5837
5838 2009-04-23 Chris Demetriou <cgd@google.com>
5839
5840 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
5841 * configure: Regenerate.
5842 * config.in: Regenerate.
5843 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
5844 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
5845
5846 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
5847
5848 * incremental.cc (Incremental_inputs_header_data): Renamed from
5849 Incremental_input_header_data.
5850 (Incremental_inputs_header_data::data_size): New field.
5851 (Incremental_inputs_header_data::put_input_file_count): Renamed
5852 from input_file_count.
5853 (Incremental_inputs_header_data::put_command_line_offset): Renamed
5854 from command_line_offset.
5855 (Incremental_inputs_header_data::put_reserved): Renamed from
5856 put_reserved.
5857 (Incremental_inputs_entry_data): Renamed from
5858 Incremental_input_entry_data.
5859 (Incremental_inputs_entry_data::data_size): New field.
5860 (Incremental_inputs::report_command_line): New method.
5861 (Incremental_inputs::finalize): New method.
5862 (Incremental_inputs::create_incremental_inputs_data): New method.
5863 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
5864 * incremental.h: New file.
5865 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
5866 (Layout::finalize): Create incremental inputs section in
5867 incremental builds.
5868 (Layout::create_incremental_info_sections): New method.
5869 * layout.h (Layout::incremental_inputs): New method.
5870 (Layout::create_incremental_info_sections): New method.
5871 (Layout::incremental_inputs_): New field.
5872 * main.cc (main): Notify Incremental_input of the command line.
5873
5874 2009-04-01 Ian Lance Taylor <iant@google.com>
5875 Mikolaj Zalewski <mikolajz@google.com>
5876
5877 * gold.h (reserve_unordered_map): Define, three versions, one for
5878 each version of Unordered_map.
5879 * layout.cc (Layout::Layout): Remove options parameter. Add
5880 number_of_input_files parameter. Don't initialize options_.
5881 Initialize number_of_input_files_ and resized_signatures_. Move
5882 sections_are_attached_.
5883 (Layout::layout_group): Reserve space for group_signatures_.
5884 (Layout::find_or_add_kept_section): Change name parameter to be a
5885 reference. Resize signatures_ map when it gets large enough.
5886 (Layout::layout_eh_frame): Use parameters->options() instead of
5887 this->options_.
5888 (Layout::make_output_section): Likewise.
5889 (Layout::attach_allocated_section_to_segment): Likewise.
5890 (Layout::finalize, Layout::create_executable_stack): Likewise.
5891 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
5892 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
5893 * layout.h (class Layout): Update declarations. Remove options_
5894 field. Add number_of_input_files_ and resized_signatures_
5895 fields. Move sections_are_attached_ field.
5896 * main.cc (main): Pass number of input files to Layout
5897 constructor. Don't pass options.
5898
5899 2009-03-30 Ian Lance Taylor <iant@google.com>
5900
5901 * ffsll.c (ffsll): Correct implementation.
5902
5903 2009-03-27 Ian Lance Taylor <iant@google.com>
5904
5905 * ffsll.c: New file.
5906 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
5907 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
5908 * ftruncate.c (ftruncate): Declare before definition.
5909 * mremap.c (mremap): Likewise.
5910 * pread.c (pread): Likewise.
5911 * configure, Makefile.in, config.in: Rebuild.
5912
5913 * mremap.c: New file.
5914 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
5915 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
5916 (mremap): Declare if HAVE_MREMAP is not defined.
5917 * configure, Makefile.in, config.in: Rebuild.
5918
5919 2009-03-27 Cary Coutant <ccoutant@google.com>
5920
5921 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
5922 position independent.
5923 * sparc.cc (Target_sparc::check_non_pic): Likewise.
5924 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
5925
5926 2009-03-24 Cary Coutant <ccoutant@google.com>
5927
5928 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
5929 an executable.
5930 (needs_dynamic_reloc): Likewise.
5931
5932 2009-03-24 Ian Lance Taylor <iant@google.com>
5933
5934 * yyscript.y (file_cmd): Recognize EXTERN.
5935 (extern_name_list, extern_name_list_body): New nonterminals.
5936 * script.cc (script_add_extern): Define.
5937 * script-c.h (script_add_extern): Declare.
5938
5939 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
5940
5941 * object.cc (is_elf_object): Define.
5942 * object.h (is_elf_object): Declare.
5943 * archive.cc (Archive::get_elf_object_for_member): Call
5944 is_elf_object.
5945 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
5946
5947 2009-03-24 Elliott Hughes <enh@google.com>
5948
5949 * output.cc (Output_file::map_anonymous): Define.
5950 (Output_file::map): Use map_anonymous. If the regular mmap fails,
5951 try an anonymous one. Report the size if the mmap fails.
5952 * output.h (class Output_file): Declare map_anonymous.
5953
5954 2009-03-24 Ian Lance Taylor <iant@google.com>
5955
5956 * target-select.cc (instantiate_target): Don't acquire the lock if
5957 the instantiated_target_ field has already been set.
5958
5959 2009-03-23 Ian Lance Taylor <iant@google.com>
5960
5961 * gold-threads.h (class Initialize_lock): Define.
5962 * gold-threads.cc (class Initialize_lock_once): Define.
5963 (initialize_lock_control): New static variable.
5964 (initialize_lock_pointer): New static variable.
5965 (initialize_lock_once): New static function.
5966 (Initialize_lock::Initialize_lock): Define.
5967 (Initialize_lock::initialize): Define.
5968 * target-select.h: Include "gold-threads.h".
5969 (class Target_selector): Add lock_ and initialize_lock_ fields.
5970 Don't define instantiate_target, just declare it.
5971 * target-select.cc (Target_selector::Target_selector): Initialize
5972 new fields.
5973 (Target_selector::instantiate_target): Define.
5974 * descriptors.h: Include "gold-threads.h".
5975 (class Descriptors): Add initialize_lock_ field.
5976 * descriptors.cc (Descriptors::Descriptors): Initialize new
5977 field.
5978 (Descriptors::open): Use initialize_lock_ field
5979 * errors.h (class Errors): Add initialize_lock_ field.
5980 * errors.cc (Errors::Errors): Initialize new field.
5981 (Errors::initialize_lock): Use initialize_lock_ field.
5982 * powerpc.cc (class Target_selector_powerpc): Remove
5983 instantiated_target_ field. In do_recognize call
5984 instantiate_target rather than do_instantiate_target. In
5985 do_instantiate_target just allocate a new target.
5986 * sparc.cc (class Target_selector_sparc): Likewise.
5987
5988 * freebsd.h: New file.
5989 * i386.cc: Include "freebsd.h".
5990 (Target_i386): Derive from Target_freebsd rather than
5991 Sized_target.
5992 (Target_selector_i386): Derive from Target_selector_freebsd rather
5993 than Target_selector.
5994 * x86_64.cc: Include "freebsd.h".
5995 (Target_x86_64): Derive from Target_freebsd rather than
5996 Sized_target.
5997 (Target_selector_x86_64): Derive from Target_selector_freebsd
5998 rather than Target_selector.
5999 * target.h (class Target): Add adjust_elf_header and
6000 do_adjust_elf_header.
6001 * output.cc (Output_file_header:: do_sized_write): Call target
6002 adjust_elf_header routine.
6003 * configure.tgt: Set targ_osabi.
6004 * configure.ac: Define GOLD_DEFAULT_OSABI.
6005 * parameters.cc (Parameters::default_target): Pass
6006 GOLD_DEFAULT_OSABI to select_target.
6007 * target-select.h (class Target_selector): Make instantiate_target
6008 protected rather than private.
6009 * Makefile.am (HFILES): Add freebsd.h.
6010 * configure, Makefile.in, config.in: Rebuild.
6011
6012 * merge.cc (do_add_input_section): Correct pend value. Change
6013 message about last entry not being null terminated from error to
6014 warning.
6015
6016 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
6017
6018 * incremental.cc: New file.
6019 * Makefile.am (CCFILES): Add incremental.cc.
6020 * Makefile.in: Rebuild.
6021
6022 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
6023
6024 * layout.cc (Layout::output_section_name): Preserve names
6025 of '.note.' sections.
6026
6027 2009-03-19 Ian Lance Taylor <iant@google.com>
6028
6029 * descriptors.cc (Descriptors::open): Check that the options are
6030 valid before using them.
6031
6032 2009-03-18 Ian Lance Taylor <iant@google.com>
6033
6034 * script-sections.h: Include <list>.
6035 (class Script_sections): Change Sections_elements from std::vector
6036 to std::list. Typedef public Elements_iterator. Add
6037 orphan_section_placement_, data_segment_align_start_, and
6038 saw_data_segment_align_ fields. Remove data_segment_align_index_
6039 field.
6040 * script-sections.cc (class Orphan_section_placement): New class.
6041 (class Sections_element): Add virtual functions is_relro and
6042 orphan_section_init. Remove virtual function place_orphan_here.
6043 (class Output_section_definition): Add is_relro and
6044 orphan_section_init. Remove place_orphan_here.
6045 (class Orphan_output_section): Likewise.
6046 (Script_sections::Script_sections): Update for field changes.
6047 (Script_sections::data_segment_align): Set saw_data_segment_align_
6048 and data_segment_align_start_, not data_segment_align_index.
6049 (Script_sections::data_segment_relro_end): Check
6050 saw_data_segment_align_. Use data_segment_align_start_ rather
6051 than data_segment_align_index_.
6052 (Script_sections::place_orphan): Rewrite to use
6053 Orphan_section_placement.
6054
6055 2009-03-17 Ian Lance Taylor <iant@google.com>
6056
6057 * archive.cc (Archive::add_symbols): Check for a version attached
6058 to the symbol name in the archive map.
6059 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
6060 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
6061 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
6062 (ver_test_11.a): New target.
6063 * testsuite/Makefile.in: Rebuild.
6064
6065 * configure.ac: Check for chsize and posix_fallocate. Replace
6066 ftruncate.
6067 * ftruncate.c: New file, from gnulib.
6068 * output.cc (posix_fallocate): Define dummy version if not
6069 HAVE_POSIX_FALLOCATE.
6070 (Output_file::map): Call posix_fallocate rather than lseek and
6071 write.
6072 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
6073 * configure, Makefile.in, config.in: Rebuild.
6074
6075 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
6076
6077 * layout.h (Layout::create_note): Add section_name parameter.
6078 * layout.cc (Layout::create_note): Likewise.
6079 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
6080
6081 2009-03-17 Ian Lance Taylor <iant@google.com>
6082
6083 * descriptors.cc: Include "options.h".
6084 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
6085 (Descriptors::open): Always use O_CLOEXEC when opening a new
6086 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
6087 then set FD_CLOEXEC.
6088
6089 * sparc.cc (class Target_sparc): Add has_got_section.
6090 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
6091 make sure we have a GOT section.
6092
6093 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
6094 (Target_sparc::Scan::local): Likewise.
6095 (Target_sparc::Scan::global): Likewise.
6096 (Target_sparc::Relocate::relocate): Likewise.
6097 (Target_sparc::Relocate::relocate_tls): Likewise.
6098
6099 * symtab.cc (Symbol_table::define_default_version): New function,
6100 broken out of add_from_object.
6101 (Symbol_table::add_from_object): Call define_default_version.
6102 (Symbol_table::define_special_symbol): Add resolve_oldsym
6103 parameter. Change all callers. If the version for a symbol comes
6104 from a version script, resolve it with the symbol with the same
6105 name with no version. Also add the symbol without a version if
6106 appropriate.
6107 (do_define_in_output_data): If resolving with oldsym, don't delete
6108 sym.
6109 (do_define_in_output_segment): Likewise.
6110 (do_define_as_constant): Likewise.
6111 * symtab.h (class Symbol_table): Update declarations.
6112
6113 2009-03-13 Ian Lance Taylor <iant@google.com>
6114
6115 * readsyms.cc (Read_symbols::incompatible_warning): New function.
6116 (Read_symbols::requeue): New function.
6117 (Read_symbols::do_read_symbols): If make_elf_object fails because
6118 the target type is not configured, and the file was searched for,
6119 issue a warning and retry with the next directory.
6120 (Add_symbols::run): If the file has an incompatible format, and
6121 it was searched for, requeue the Read_symbols task. On error,
6122 release the object.
6123 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
6124 dirindex parameter to constructor. Change all callers. Declare
6125 incompatible_warning and requeue.
6126 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
6127 input_argument_ and input_group_ fields. Add them to
6128 constructor. Change all callers.
6129 (class Read_script): Add dirindex_ field. Add it to constructor.
6130 Change all callers.
6131 * archive.cc (Archive::setup): Remove input_objects parameter.
6132 Change all callers.
6133 (Archive::get_file_and_offset): Likewise.
6134 (Archive::read_all_symbols): Likewise.
6135 (Archive::read_symbols): Likewise.
6136 (Archive::get_elf_object_for_member): Remove input_objects
6137 parameter. Add punconfigured parameter. Change all callers.
6138 (Archive::add_symbols): Change return type to bool. Check return
6139 value of include_member.
6140 (Archive::include_all_members): Likewise.
6141 (Archive::include_member): Change return type to bool. Return
6142 false if first included object has incompatible target. Set
6143 included_member_ field.
6144 (Add_archive_symbols::run): If add_symbols returns false, requeue
6145 Read_symbols task.
6146 * archive.h (class Archive): Add included_member_ field.
6147 Initialize it in constructor. Add input_file and searched_for
6148 methods. Update declarations.
6149 (class Add_archive_symbols): Add dirpath_, dirindex_, and
6150 input_argument_ fields. Add them to constructor. Change all
6151 callers.
6152 * script.cc: Include "target-select.h".
6153 (class Parser_closure): Add skip_on_incompatible_target_ and
6154 found_incompatible_target_ fields. Add
6155 skip_on_incompatible_target parameter to constructor. Change all
6156 callers. Add methods skip_on_incompatible_target,
6157 clear_skip_on_incompatible_target, found_incompatible_target, and
6158 set_found_incompatible_target.
6159 (read_input_script): Add dirindex parameter. Change all callers.
6160 If parser finds an incompatible target, requeue Read_symbols
6161 task.
6162 (script_set_symbol): Clear skip_on_incompatible_target in
6163 closure.
6164 (script_add_assertion, script_parse_option): Likewise.
6165 (script_start_sections, script_add_phdr): Likewise.
6166 (script_check_output_format): New function.
6167 * script.h (read_input_script): Update declaration.
6168 * script-c.h (script_check_output_format): Declare.
6169 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
6170 (ignore_cmd): Remove OUTPUT_FORMAT.
6171 * fileread.cc (Input_file::Input_file): Add explicit this.
6172 (Input_file::will_search_for): New function.
6173 (Input_file::open): Add pindex parameter. Change all callers.
6174 * fileread.h (class Input_file): Add input_file_argument method.
6175 Declare will_search_for. Update declarations.
6176 * object.cc (make_elf_object): Add punconfigured parameter.
6177 Change all callers.
6178 * object.h (class Object): Make input_file public. Add
6179 searched_for method.
6180 (make_elf_object): Update declaration.
6181 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
6182 restart search.
6183 * dirsearch.h (class Dirsearch): Update declaration.
6184 * options.h (class General_options): Add --warn-search-mismatch.
6185 * parameters.cc (Parameters::is_compatible_target): New function.
6186 * parameters.h (class Parameters): Declare is_compatible_target.
6187 * workqueue.cc (Workqueue::add_blocker): New function.
6188 * workqueue.h (class Workqueue): Declare add_blocker.
6189
6190 * fileread.cc (Input_file::open): Remove options parameter.
6191 Change all callers.
6192 (Input_file::open_binary): Likewise.
6193 * script.cc (read_input_script): Likewise.
6194 * readsyms.h (class Read_symbols): Remove options_ field. Remove
6195 options parameter from constructor. Change all callers.
6196 (class Read_script): Likewise.
6197 * fileread.h (class Input_file): Update declarations.
6198 * script.h (read_input_script): Update declaration.
6199
6200 2009-03-10 Nick Clifton <nickc@redhat.com>
6201
6202 * po/es.po: New Spanish translation.
6203
6204 2009-03-06 Cary Coutant <ccoutant@google.com>
6205
6206 * options.cc (parse_short_option): Keep dash_z from registering itself.
6207
6208 2009-03-03 Ian Lance Taylor <iant@google.com>
6209
6210 PR 9918
6211 * target-reloc.h (relocate_section): Pass output_section to
6212 relocate.
6213 * i386.cc (Target_i386::should_apply_static_reloc): Add
6214 output_section parameter. Change all callers.
6215 (Target_i386::Relocate::relocate): Add output_section parameter.
6216 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6217 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
6218 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
6219 * testsuite/two_file_shared.sh: New script.
6220 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
6221 (check_DATA): Add two_file_shared.dbg.
6222 (two_file_shared.dbg): New target.
6223 * testsuite/Makefile.in: Rebuild.
6224
6225 2009-03-01 Ian Lance Taylor <iant@google.com>
6226
6227 * configure.ac: Check for byteswap.h.
6228 * configure: Rebuild.
6229 * config.in: Rebuild.
6230
6231 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
6232
6233 * layout.cc (Layout::find_or_add_kept_section): New function.
6234 (Layout::add_comdat): Removed.
6235 * layout.h (struct Kept_section): Move out of class Layout.
6236 Remove trailing underscores from field names. Add group_sections
6237 field. Rename group_ field to is_group. Change all uses.
6238 (class Layout): Declare find_or_add_kept_section, not add_comdat.
6239 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
6240 comdat_groups_ field.
6241 (Sized_relobj::include_section_group): Use
6242 find_or_add_kept_section and Kept_section::group_sections.
6243 (Sized_relobj::include_linkonce_section): Likewise.
6244 * object.cc (class Sized_relobj): Don't define Comdat_group or
6245 Comdat_group_table. Remove find_comdat_group and
6246 add_comdat_group. Remove comdat_groups_ field.
6247 * plugin.cc (include_comdat_group): Use
6248 Layout::find_or_add_kept_section.
6249
6250 2009-02-28 Ian Lance Taylor <iant@google.com>
6251
6252 * README: --gc-sections and map files are now supported. Document
6253 some build requirements.
6254
6255 PR 6992
6256 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
6257 relocatable link set the value of the section symbol to zero.
6258 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
6259 relocatable link don't include the section address in the local
6260 symbol value.
6261
6262 2009-02-27 Ian Lance Taylor <iant@google.com>
6263
6264 PR 6811
6265 * options.h (class Search_directory): Add is_system_directory.
6266 (class General_options): Declare is_in_system_directory.
6267 * options.cc (get_relative_sysroot): Make static.
6268 (get_default_sysroot): Make static.
6269 (General_optoins::is_in_system_directory): New function.
6270 * fileread.cc (Input_file::is_in_system_directory): New function.
6271 * fileread.h (class Input_file): Declare is_in_system_directory.
6272 * object.h (class Object): Add is_in_system_directory.
6273 (class Input_objects): Remove system_library_directory_ field.
6274 * object.cc (Input_objects::add_object): Don't set
6275 system_library_directory_.
6276 (input_objects::found_in_system_library_directory): Remove.
6277 * symtab.cc (Symbol_table::write_globals): Remove input_objects
6278 parameter. Change all callers.
6279 (Symbol_table::sized_write_globals): Likewise.
6280 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
6281 Call Object::is_in_system_directory.
6282 * symtab.h (class Symbol_table): Update declarations.
6283
6284 PR 5990
6285 * descriptors.h (Open_descriptor): Add is_on_stack field.
6286 * descriptors.cc (Descriptors::open): If the descriptor is on the
6287 top of the stack, remove it. Initialize is_on_stack field.
6288 (Descriptors::release): Only add pod to stack if it is not on the
6289 stack already.
6290 (Descriptors::close_some_descriptor): Clear stack_next and
6291 is_on_stack fields.
6292
6293 PR 7091
6294 * output.cc (Output_section::find_starting_output_address): Rename
6295 from starting_output_address; add PADDR parameter; change return
6296 type.
6297 * output.h (class Output_section): Declare
6298 find_starting_output_address instead of starting_output_address.
6299 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
6300 section symbol for which we can't find a merge section.
6301
6302 PR 9836
6303 * symtab.cc (Symbol_table::add_from_object): If the visibility is
6304 hidden or internal, force the symbol to be local.
6305 * resolve.cc (Symbol::override_visibility): Define.
6306 (Symbol::override_base): Use override_visibility.
6307 (Symbol_table::resolve): Likewise.
6308 (Symbol::override_base_with_special): Likewise.
6309 (Symbol_table::override_with_special): If the visibility is hidden
6310 or internal, force the symbol to be local.
6311 * symtab.h (class Symbol): Add set_visibility and
6312 override_visibility.
6313 * testsuite/ver_test_1.sh: New file.
6314 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
6315 (check_DATA): Add ver_test_1.syms.
6316 (ver_test_1.syms): New target.
6317 * testsuite/Makefile.in: Rebuild.
6318
6319 2009-02-25 Cary Coutant <ccoutant@google.com>
6320
6321 * layout.cc (Layout::choose_output_section): Don't rename sections
6322 when using a linker script that has a SECTIONS clause.
6323 * Makefile.in: Regenerate.
6324
6325 * testsuite/Makefile.am (script_test_5.sh): New test case.
6326 * testsuite/Makefile.in: Regenerate.
6327 * testsuite/script_test_5.cc: New file.
6328 * testsuite/script_test_5.sh: New file.
6329 * testsuite/script_test_5.t: New file.
6330
6331 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
6332
6333 * archive.cc (Archive::include_member): Update calls to add_symbols.
6334 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
6335 the Layout argument.
6336 * dynobj.h (do_add_symbols): Add the Layout argument.
6337 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
6338 Layout argument.
6339 * object.h (Object::add_symbols): Add the Layout argument.
6340 (Object::do_add_symbols): Add the Layout argument.
6341 (Sized_relobj::do_add_symbols): Add the Layout argument.
6342 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
6343 Unify the two versions.
6344 (Add_plugin_symbols): Remove.
6345 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
6346 (Sized_pluginobj::do_add_symbols): Unify the two versions.
6347 (Add_plugin_symbols): Remove.
6348 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
6349 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
6350 (Add_symbols::run): Make it work with Pulginobj.
6351
6352 2009-02-06 Ian Lance Taylor <iant@google.com>
6353
6354 * object.cc (Sized_relobj::do_layout): Make info message start
6355 with lower case letter.
6356
6357 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
6358
6359 * binary.cc: Fix file comment.
6360
6361 * options.h (enum Incremental_disposition): Define.
6362 (class General_options): Add new options: --incremental,
6363 --incremental_changed, --incremental_unchanged,
6364 --incremental_unknown. Add incremental_disposition_ and
6365 implicit_incremental_ fields.
6366 (General_options::incremental_disposition): New function.
6367 (class Position_dependent_options): Add incremental_disposition
6368 option.
6369 (Position_dependent_options::copy_from_options): Set incremental
6370 dispositions.
6371 * options.cc (General_options::parse_incremental_changed): New
6372 function.
6373 (General_options::parse_incremental_unchanged): New function.
6374 (General_options::parse_incremental_unknown): New function.
6375 (General_options::General_options): Initialize new fields
6376 incremental_disposition_ and implicit_incremental_.
6377 (General_options::finalize): Check for uasge of --incremental-*
6378 without --incremental.
6379
6380 2009-02-06 Chris Demetriou <cgd@google.com>
6381
6382 * gold.h (gold_undefined_symbol): Change to take only a Symbol
6383 pointer and to report location as the file name associated with
6384 the symbol.
6385 (gold_undefined_symbol_at_location): New function to replace the
6386 old gold_undefined_symbol functionality.
6387 * target-reloc.h (relocate_section): Update to use
6388 gold_undefined_symbol_at_location.
6389 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6390 Call gold_undefined_symbol function rather than gold_error.
6391 * errors.h (Errors::undefined_symbol): Take location as a
6392 string, rather than calculating it from a relocation.
6393 * errors.cc (Errors::fatal): Print "fatal error:" before the
6394 formatted message.
6395 (Errors::error, Errors::error_at_location): Print "error: "
6396 before the formatted message.
6397 (Errors::undefined_symbol): Take location as a string, rather
6398 than calculating it from a relocation.
6399 (gold_undefined_symbol_at_location): New function akin to
6400 old gold_undefined_symbol, calculates location from relocation.
6401 (gold_undefined_symbol): Change to take only a Symbol pointer
6402 and to report location as the file name associated with the symbol.
6403 * testsuite/debug_msg.sh: Update for changed error messages.
6404 * testsuite/undef_symbol.sh: Likewise.
6405
6406 2009-02-04 Duncan Sands <baldrick@free.fr>
6407
6408 PR 9812
6409 * reduced_debug_output.h
6410 (Output_reduced_debug_abbrev_section::failed): Use format for
6411 gold_warning.
6412 (Output_reduced_debug_info_section::faild): Likewise.
6413
6414 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
6415
6416 * script.cc (Lazy_demangler): New class.
6417 (Version_script_info::get_symbol_version_helper): Demangle a
6418 symbol only once.
6419
6420 2009-01-29 Cary Coutant <ccoutant@google.com>
6421
6422 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
6423 to __tls_get_addr.
6424 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6425
6426 2009-01-28 Ian Lance Taylor <iant@google.com>
6427
6428 * version.cc (version_string): Bump to 1.9.
6429
6430 * gold.h: Include <cstring> and <stdint.h>.
6431 * version.cc: Include <cstdio>.
6432 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
6433 warning.
6434 * reduced_debug_output.cc (insert_into_vector): Rename from
6435 Insert_into_vector; change all callers. Use Swap_unaligned to
6436 avoid aliasing issue; remove union since it is unnecessary.
6437
6438 2009-01-27 Sriraman Tallam <tmsriram@google.com>
6439
6440 * Makefile.am (CCFILES): Add gc.cc.
6441 (HFILES): Add gc.h.
6442 * Makefile.in: Regenerate.
6443 * gold.cc (Gc_runner): New class.
6444 (queue_initial_tasks): Call garbage collection related tasks
6445 when corresponding options are invoked.
6446 (queue_middle_gc_tasks): New function.
6447 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
6448 processed early before laying out sections during garbage collection.
6449 * gold.h (queue_middle_gc_tasks): New function.
6450 (is_prefix_of): Move from "layout.cc".
6451 * i386.cc (Target_i386::gc_process_relocs): New function.
6452 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
6453 * main.cc (main): Create object of class "Garbage_collection".
6454 * object.cc (Relobj::copy_symbols_data): New function.
6455 (Relobj::is_section_name_included): New function.
6456 (Sized_relobj::do_layout): Allow this function to be called twice
6457 during garbage collection and defer layout of section during the
6458 first call.
6459 * object.h (Relobj::get_symbols_data): New function.
6460 (Relobj::is_section_name_included): New function.
6461 (Relobj::copy_symbols_data): New function.
6462 (Relobj::set_symbols_data): New function.
6463 (Relobj::get_relocs_data): New function.
6464 (Relobj::set_relocs_data): New function.
6465 (Relobj::is_output_section_offset_invalid): New pure virtual function.
6466 (Relobj::gc_process_relocs): New function.
6467 (Relobj::do_gc_process_relocs): New pure virtual function.
6468 (Relobj::sd_): New data member.
6469 (Sized_relobj::is_output_section_offset_invalid): New function.
6470 (Sized_relobj::do_gc_process_relocs): New function.
6471 * options.h (General_options::gc_sections): Modify to not be a no-op.
6472 (General_options::print_gc_sections): New option.
6473 * plugin.cc (Plugin_finish::run): Remove function call to
6474 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
6475 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
6476 * reloc.cc (Read_relocs::run): Add task to process relocs and
6477 determine unreferenced sections when doing garbage collection.
6478 (Gc_process_relocs): New class.
6479 (Sized_relobj::do_gc_process_relocs): New function.
6480 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
6481 sections that are garbage collected.
6482 * reloc.h (Gc_process_relocs): New class.
6483 * sparc.cc (Target_sparc::gc_process_relocs): New function.
6484 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
6485 symbols whose corresponding sections are garbage collected.
6486 (Symbol_table::Symbol_table): Add new parameter for the garbage
6487 collection object.
6488 (Symbol_table::gc_mark_undef_symbols): New function.
6489 (Symbol_table::gc_mark_symbol_for_shlib): New function.
6490 (Symbol_table::gc_mark_dyn_syms): New function.
6491 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
6492 as garbage.
6493 (Symbol_table::add_from_object): Likewise.
6494 (Symbol_table::add_from_relobj): When building shared objects, do not
6495 treat externally visible symbols as garbage.
6496 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
6497 table information for static and relocatable links.
6498 * symtab.h (Symbol_table::set_gc): New function.
6499 (Symbol_table::gc): New function.
6500 (Symbol_table::gc_mark_undef_symbols): New function.
6501 (Symbol_table::gc_mark_symbol_for_shlib): New function.
6502 (Symbol_table::gc_mark_dyn_syms): New function.
6503 (Symbol_table::gc_): New data member.
6504 * target.h (Sized_target::gc_process_relocs): New pure virtual
6505 function.
6506 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
6507 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
6508
6509 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
6510
6511 * options.h (General_options::gc_sections): Define as a no-op for now.
6512 (General_options::no_keep_memory): Ditto.
6513 (General_options::Bshareable): Define.
6514 * options.cc (General_options::finalize): Honor -Bshareable.
6515
6516 2009-01-20 Andreas Schwab <schwab@suse.de>
6517
6518 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
6519 read the value in the contents, since we don't use it. Use the
6520 template endianness when writing.
6521 (Relocate::relocate): Use it for R_PPC_REL16_HA.
6522
6523 2009-01-19 Andreas Schwab <schwab@suse.de>
6524
6525 * configure.tgt (powerpc64-*): Fix targ_obj.
6526
6527 2009-01-15 Ian Lance Taylor <iant@google.com>
6528
6529 * object.cc (Sized_relobj::write_local_symbols): Don't write out
6530 local symbols when stripping all symbols.
6531
6532 2009-01-14 Cary Coutant <ccoutant@google.com>
6533
6534 * output.cc (Output_reloc): Add explicit instantiations.
6535
6536 2009-01-14 Cary Coutant <ccoutant@google.com>
6537
6538 * archive.cc (Archive::get_elf_object_for_member): Remove call
6539 to File_read::claim_for_plugin.
6540 * descriptors.cc (Descriptors::open): Remove reference to
6541 is_claimed.
6542 (Descriptors::claim_for_plugin): Remove.
6543 * descriptors.h (Descriptors::claim_for_plugin): Remove.
6544 (Descriptors::is_claimed): Remove.
6545 (claim_descriptor_for_plugin): Remove.
6546 * fileread.cc (File_read::claim_for_plugin): Remove.
6547 * fileread.h (File_read::claim_for_plugin): Remove.
6548 (File_read::descriptor): Reopen descriptor if necessary.
6549 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
6550 (Plugin_manager::all_symbols_read): Add task parameter. Change
6551 all callers.
6552 (Plugin_manager::get_input_file): New function.
6553 (Plugin_manager::release_input_file): New function.
6554 (Pluginobj::Pluginobj): Add filesize parameter and initialize
6555 corresponding data member.
6556 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
6557 and pass to base constructor. Change all callers.
6558 (get_input_file, release_input_file): New functions.
6559 (make_sized_plugin_object): Add filesize parameter. Change all callers.
6560 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
6561 (Plugin_manager::all_symbols_read): Add task parameter.
6562 (Plugin_manager::get_input_file): New function.
6563 (Plugin_manager::release_input_file): New function.
6564 (Plugin_manager::task_): New data member.
6565 (Pluginobj::Pluginobj): Add filesize parameter.
6566 (Pluginobj::filename): New function.
6567 (Pluginobj::descriptor): New function.
6568 (Pluginobj::filesize): New function.
6569 (Pluginobj::filesize_): New data member.
6570 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
6571 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
6572 File_read::claim_for_plugin; use Object::unlock to unlock the file.
6573
6574 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
6575 with archive libraries.
6576 * testsuite/Makefile.in: Regenerate.
6577 * testsuite/plugin_test.c (struct sym_info): New type.
6578 (get_input_file, release_input_file): New static variables.
6579 (onload): Capture new transfer vector entries.
6580 (claim_file_hook): Stop reading at end of file according to filesize.
6581 Factor out parsing of readelf output into separate function.
6582 (all_symbols_read_hook): Exercise get_input_file and release_input_file
6583 APIs and get the source file name from the symbol table. Convert
6584 source file name to corresponding object file name. Print info
6585 message when adding new input files.
6586 (parse_readelf_line): New function.
6587 * testsuite/plugin_test_1.sh: Add checks for new info messages.
6588 * testsuite/plugin_test_2.sh: Likewise.
6589 * testsuite/plugin_test_3.sh: Likewise.
6590 * testsuite/plugin_test_4.sh: New test case.
6591
6592 2009-01-07 Ian Lance Taylor <iant@google.com>
6593
6594 * version.cc (version_string): Bump to 1.8.
6595
6596 2008-12-23 Cary Coutant <ccoutant@google.com>
6597
6598 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
6599 * plugin.cc (Plugin_manager::finish): Rename as
6600 layout_deferred_objects. Move cleanup to separate function.
6601 (Plugin_manager::cleanup): New function.
6602 (Plugin_finish::run): Call layout_deferred_objects and cleanup
6603 separately.
6604 * plugin.h (Plugin_manager::finish): Rename as
6605 layout_deferred_objects.
6606 (Plugin_manager::cleanup): New function.
6607 (Plugin_manager::cleanup_done): New field.
6608
6609 2008-12-23 Cary Coutant <ccoutant@google.com>
6610
6611 * plugin.cc (is_visible_from_outside): New function.
6612 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
6613 so we don't return "IR only" status for exported symbols or -r links.
6614
6615 * testsuite/Makefile.am (plugin_test_3): New test case.
6616 * testsuite/Makefile.in: Regenerate.
6617 * testsuite/plugin_test_3.sh: New file.
6618
6619 2008-12-22 Cary Coutant <ccoutant@google.com>
6620
6621 * object.cc (Sized_relobj::layout_section): New function.
6622 (Sized_relobj::do_layout): Defer layout of input sections until after
6623 plugin has provided replacement files.
6624 (Sized_relobj::do_layout_deferred_sections): New function.
6625 * object.h (Relobj::set_section_offset): Remove virtual keyword.
6626 (Relobj::layout_deferred_sections): New function.
6627 (Relobj::do_layout_deferred_sections): New function.
6628 (Sized_relobj::do_layout_deferred_sections): New function.
6629 (Sized_relobj::layout_section): New function.
6630 (Sized_relobj::Deferred_layout): New structure.
6631 (Sized_relobj::deferred_layout_): New field.
6632 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
6633 Change all callers. Layout deferred sections.
6634 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
6635 references.
6636 (Plugin_hook::run): Move code from do_plugin_hook inline.
6637 (Plugin_hook::do_plugin_hook): Remove.
6638 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
6639 (Plugin_manager::finish): Renamed, was cleanup.
6640 (Plugin_manager::should_defer_layout): New function.
6641 (Plugin_manager::add_deferred_layout_object): New function.
6642 (Plugin_manager::Deferred_layout_list): New type.
6643 (Plugin_manager::deferred_layout_objects_): New field.
6644 (Plugin_hook::do_plugin_hook): Remove.
6645
6646 2008-12-17 Ian Lance Taylor <iant@google.com>
6647
6648 * options.h (class General_options): Add --no case for
6649 --export-dynamic.
6650
6651 2008-12-16 Cary Coutant <ccoutant@google.com>
6652
6653 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
6654 vector.
6655 (Plugin_manager::claim_file): Create plugin object even if
6656 plugin did not call the add_symbols callback.
6657 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
6658 asking for more symbols than were added.
6659 * testsuite/Makefile.am (plugin_test_1): Add test case with
6660 no global symbols.
6661 (empty.syms): New target.
6662 * testsuite/Makefile.in: Regenerate.
6663 * testsuite/plugin_test.c (claim_file_hook): Add new debug
6664 message. Don't call add_symbols if no globals.
6665 (all_symbols_read_hook): Don't provide replacement for empty
6666 claimed file.
6667
6668 2008-12-12 Ian Lance Taylor <iant@google.com>
6669
6670 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
6671 r_type == 0 for a local symbol with r_sym == 0.
6672 (scan_relocatable_relocs): Pass r_sym to
6673 local_non_section_strategy.
6674 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
6675 r_sym parameter.
6676
6677 * configure.ac: Update test for TLS descriptors: they are
6678 supported as of glibc 2.9.
6679 * configure: Rebuild.
6680
6681 2008-12-11 Ian Lance Taylor <iant@google.com>
6682
6683 PR 7091
6684 * target-reloc.h (Default_scan_relocatable_relocs): For each
6685 function, map r_type == 0 to RELOC_DISCARD.
6686
6687 2008-12-10 Cary Coutant <ccoutant@google.com>
6688
6689 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
6690 object to override a kept COMDAT group from a plugin object.
6691
6692 2008-12-09 Ian Lance Taylor <iant@google.com>
6693
6694 PR 7088
6695 * yyscript.y (file_cmd): Handle INPUT.
6696
6697 * testsuite/initpri1.c: Change all declarations to be full
6698 prototypes by adding void, to avoid compiler warnings.
6699
6700 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
6701
6702 * options.cc (General_options::parse_plugin_opt): New.
6703 (General_options::add_plugin): The argument now is just the filename.
6704 (General_options::add_plugin_option): New.
6705 * options.h (plugin_opt): New.
6706 (add_plugin): Change argument name.
6707 (add_plugin_option): New.
6708 * plugin.cc (Plugin::load): Don't parse the plugin option.
6709 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
6710 (Plugin::add_option): New.
6711 (Plugin::args_): Change type.
6712 (Plugin::filename_): New.
6713 (Plugin_manager::add_plugin_option): New.
6714 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
6715 * testsuite/Makefile.in: Regenerate.
6716
6717 2008-12-05 Cary Coutant <ccoutant@google.com>
6718
6719 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
6720 Handle --strip-lto-sections option.
6721 * options.h (strip_lto_sections): New option.
6722
6723 2008-12-01 Cary Coutant <ccoutant@google.com>
6724
6725 * plugin.cc (ld_plugin_message): Change format parameter to const.
6726 Fix mismatch between new[] and delete.
6727
6728 2008-11-14 Cary Coutant <ccoutant@google.com>
6729
6730 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
6731 instead of -1U.
6732
6733 2008-11-05 Craig Silverstein <csilvers@google.com>
6734
6735 * options.cc (General_options::parse_dynamic_list): New function.
6736 * options.h (General_options): New flags dynamic_list,
6737 dynamic_list_data, dynamic_list_cpp_new, and
6738 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
6739 (General_options::in_dynamic_list): New function.
6740 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
6741 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
6742 (Lex::can_continue_name): Likewise.
6743 (yylex): Likewise.
6744 (read_script_file): New parameter script_options.
6745 (read_dynamic_list): New function.
6746 (Script_options::define_dynamic_list): New function.
6747 (dynamic_list_keyword_parsecodes): New variable.
6748 (dynamic_list_keywords): New variable.
6749 * script.h (Script_options::define_dynamic_list): New function
6750 prototype.
6751 (read_dynamic_list): New function prototype.
6752 * symtab.cc (strprefix): New macro.
6753 (Symbol::should_add_dynsym_entry): Support dynamic_list,
6754 dynamic_list_data, dynamic_list_cpp_new, and
6755 dynamic_list_cpp_typeinfo.
6756 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
6757 (dynamic_list_expr): New rule.
6758 (dynamic_list_nodes): Likewise.
6759 (dynamic_list_node): Likewise.
6760 * testsuite/Makefile.am (dynamic_list): New test.
6761 * testsuite/Makefile.in: Regenerated.
6762 * testsuite/dynamic_list.t: New file.
6763 * testsuite/dynamic_list.sh: New file.
6764
6765 2008-11-05 Craig Silverstein <csilvers@google.com>
6766
6767 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
6768 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
6769 (t11_last): Likewise.
6770 * testsuite/ver_test_6.c (main): Likewise.
6771
6772 2008-10-07 Cary Coutant <ccoutant@google.com>
6773
6774 * options.c (General_options::finalize): Add check for -static and
6775 -shared.
6776 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
6777 is not empty.
6778
6779 2008-10-02 Cary Coutant <ccoutant@google.com>
6780
6781 * plugin.cc (make_sized_plugin_object): Fix conditional
6782 compilation to work when not all targets are enabled.
6783
6784 2008-09-29 Cary Coutant <ccoutant@google.com>
6785
6786 * archive.cc (Archive::get_file_and_offset): Use filename instead
6787 of name to get library path.
6788 (Archive::include_member): Unlock external member of a thin archive.
6789
6790 * testsuite/Makefile.am (TEST_AR): New variable.
6791 (thin_archive_test_1): New test.
6792 (thin_archive_test_2): New test.
6793 * testsuite/Makefile.in: Regenerate.
6794 * testsuite/thin_archive_main.cc: New file.
6795 * testsuite/thin_archive_test_1.cc: New file.
6796 * testsuite/thin_archive_test_2.cc: New file.
6797 * testsuite/thin_archive_test_3.cc: New file.
6798 * testsuite/thin_archive_test_4.cc: New file.
6799
6800 2008-09-29 Cary Coutant <ccoutant@google.com>
6801
6802 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
6803 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
6804 instead of -1U.
6805 (Sized_relobj::do_finalize_local_symbols): Likewise.
6806 (Sized_relobj::map_to_kept_section): Likewise.
6807 * object.h (Sized_relobj::invalid_address): New constant.
6808 (Sized_relobj::do_output_section_offset): Check for invalid_address
6809 and return -1ULL.
6810 * output.cc (Output_reloc::local_section_offset): Use constant
6811 invalid_address instead of -1U.
6812 (Output_reloc::get_address): Likewise.
6813 (Output_section::output_address): Change -1U to -1ULL.
6814 * output.h (Output_reloc::invalid_address): New constant.
6815 * reloc.cc (Sized_relobj::write_sections): Use constant
6816 invalid_address instead of -1U.
6817 (Sized_relobj::relocate_sections): Likewise.
6818 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
6819 values for merge sections.
6820 * target-reloc.h (relocate_for_relocatable): Use constant
6821 invalid_address instead of -1U.
6822
6823 2008-09-19 Cary Coutant <ccoutant@google.com>
6824
6825 Add plugin functionality for link-time optimization (LTO).
6826 * configure.ac (plugins): Add --enable-plugins option.
6827 * configure: Regenerate.
6828 * config.in: Regenerate.
6829 * Makefile.am (LIBDL): New variable.
6830 (CCFILES): Add plugin.cc.
6831 (HFILES): Add plugin.h.
6832 (ldadd_var): Add LIBDL.
6833 * Makefile.in: Regenerate.
6834
6835 * archive.cc: Include "plugin.h".
6836 (Archive::setup): Don't preread archive symbols when using a plugin.
6837 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
6838 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
6839 files.
6840 (Archive::include_member): Add symbols from plugin objects.
6841 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
6842 * descriptors.cc (Descriptors::open): Check for file descriptors
6843 abandoned by plugins.
6844 (Descriptors::claim_for_plugin): New function.
6845 * descriptors.h (Descriptors::claim_for_plugin): New function.
6846 (Open_descriptor::is_claimed): New field.
6847 (claim_descriptor_for_plugin): New function.
6848 * fileread.cc (File_read::claim_for_plugin): New function.
6849 * fileread.h (File_read::claim_for_plugin): New function.
6850 (File_read::descriptor): New function.
6851 * gold.cc: Include "plugin.h".
6852 (queue_initial_tasks): Add task to call plugin hooks for generating
6853 new object files.
6854 * main.cc: Include "plugin.h".
6855 (main): Load plugin libraries.
6856 * object.h (Pluginobj): Declare.
6857 (Object::pluginobj): New function.
6858 (Object::do_pluginobj): New function.
6859 (Object::set_target): New function.
6860 * options.cc: Include "plugin.h".
6861 (General_options::parse_plugin): New function.
6862 (General_options::General_options): Initialize plugins_ field.
6863 (General_options::add_plugin): New function.
6864 * options.h (Plugin_manager): Declare.
6865 (General_options): Add --plugin option.
6866 (General_options::has_plugins): New function.
6867 (General_options::plugins): New function.
6868 (General_options::add_plugin): New function.
6869 (General_options::plugins_): New field.
6870 * plugin.cc: New file.
6871 * plugin.h: New file.
6872 * readsyms.cc: Include "plugin.h".
6873 (Read_symbols::do_read_symbols): Check for archive before checking
6874 for ELF file. Call plugin hooks to claim files.
6875 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
6876 from a real object file; force override when processing replacement
6877 files.
6878 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
6879 (Symbol::init_base_object): Likewise.
6880 (Symbol::init_base_output_data): Likewise.
6881 (Symbol::init_base_output_segment): Likewise.
6882 (Symbol::init_base_constant): Likewise.
6883 (Symbol::init_base_undefined): Likewise.
6884 (Symbol::output_section): Assert that object is not a plugin.
6885 (Symbol_table::add_from_pluginobj): New function.
6886 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
6887 undefined.
6888 (Symbol_table::sized_write_globals): Likewise.
6889 (Symbol_table::add_from_pluginobj): Instantiate template.
6890 * symtab.h (Sized_pluginobj): Declare.
6891 (Symbol::in_real_elf): New function.
6892 (Symbol::set_in_real_elf): New function.
6893 (Symbol::in_real_elf_): New field.
6894 (Symbol_table::add_from_pluginobj): New function.
6895
6896 * testsuite/Makefile.am (AM_CFLAGS): New variable.
6897 (LIBDL): New variable.
6898 (LDADD): Add LIBDL.
6899 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
6900 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
6901 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
6902 (MOSTLYCLEANFILES): Likewise.
6903 * testsuite/Makefile.in: Regenerate.
6904 * testsuite/plugin_test.c: New file.
6905 * testsuite/plugin_test_1.sh: New file.
6906 * testsuite/plugin_test_2.sh: New file.
6907
6908 2008-09-16 Ian Lance Taylor <iant@google.com>
6909
6910 * target-reloc.h (relocate_section): Check whether a symbol is
6911 defined by the ABI before reporting an undefined symbol error.
6912 * target.h (Target::is_defined_by_abi): Make parameter const.
6913 (Target::do_is_defined_by_abi): Likewise.
6914 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
6915 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
6916 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
6917 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
6918 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
6919 * testsuite/Makefile.in: Rebuild.
6920
6921 * fileread.cc (make_view): Add casts to avoid warning.
6922
6923 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
6924
6925 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
6926 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6927
6928 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
6929
6930 * options.h (General_options::output_is_executable): New.
6931 (General_options::output_is_pie): New.
6932 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
6933 for shared libraries.
6934 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6935
6936 2008-09-11 Chris Demetriou <cgd@google.com>
6937
6938 * options.h (origin): New -z option.
6939 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
6940 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
6941 in DT_FLAGS_1.
6942
6943 2008-09-05 Cary Coutant <ccoutant@google.com>
6944
6945 * fileread.cc (File_read::make_view): Add check for attempt to map
6946 beyond end of file.
6947
6948 2008-09-05 Cary Coutant <ccoutant@google.com>
6949
6950 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
6951 explicit instantiations.
6952
6953 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
6954
6955 PR gold/6858
6956 * options.cc (General_options::finalize): Allow undefined symbols
6957 in shlibs if linking -shared.
6958
6959 PR gold/6859
6960 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
6961 symbols as not needing a dynsym entry.
6962
6963 2008-08-20 Craig Silverstein <csilvers@google.com>
6964
6965 * fileread.cc (File_read::open): Do not lock the file unless it
6966 was successfully opened.
6967
6968 2008-08-14 Cary Coutant <ccoutant@google.com>
6969
6970 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
6971 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
6972 * testsuite/tls_test.cc (struct int128): 128-bit struct
6973 for testing TLS relocs with non-zero addend.
6974 (v12): New TLS variable.
6975 (t12): New test.
6976 (t_last): Add check for v12.
6977 * testsuite/tls_test.h (t12): New function.
6978 * testsuite/tls_test_main.cc (thread_routine): Call new test.
6979
6980 2008-08-13 Ian Lance Taylor <iant@google.com>
6981
6982 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
6983 set tls_segment_ or relro_segment_.
6984 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
6985 when appropriate.
6986 * output.h (Output_section::clear_is_relro): New function.
6987 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
6988 sections specially even when output_data_ is empty.
6989 (Output_segment::maximum_alignment): When first section is relro,
6990 only force alignment for PT_LOAD segments.
6991 * script.cc (script_data_segment_align): New function.
6992 (script_data_segment_relro_end): New function.
6993 * script-c.h (script_data_segment_align): Declare.
6994 (script_data_segment_relro_end): Declare.
6995 * script-sections.h (class Script_sections): Declare
6996 data_segment_align and data_segment_relro_end. Add fields
6997 segment_align_index_ and saw_relro_end_.
6998 * script-sections.cc (class Sections_element): Add set_is_relro
6999 virtual function. Add new bool* parameter to place_orphan_here.
7000 Add get_output_section virtual function.
7001 (class Output_section_definition): Add set_is_relro. Add new
7002 bool* parameter to place_orphan_here. Add get_output_section.
7003 Add is_relro_ field.
7004 (Output_section_definition::Output_section_definition): Initialize
7005 evaluated_address_, evaluated_load_address, evaluated_addralign_,
7006 and is_relro_ fields.
7007 (Output_section_definition::place_orphan_here): Add is_relro
7008 parameter.
7009 (Output_section_definition::set_section_addresses): Set relro for
7010 output section.
7011 (Output_section_definition::alternate_constraint): Likewise.
7012 (class Orphan_output_section): Add new bool* parameter to
7013 place_orphan_here. Add get_output_section.
7014 (Orphan_output_section::place_orphan_here): Add is_relro
7015 parameter.
7016 (Script_sections::Script_sections): Initialize
7017 data_segment_align_index_ and saw_relro_end_.
7018 (Script_sections::data_segment_align): New function.
7019 (Script_sections::data_segment_relro_end): New function.
7020 (Script_sections::place_orphan): Set or clear is_relro.
7021 (Script_sections::set_section_addresses): Force alignment of first
7022 TLS section.
7023 * yyscript.y (exp): Call script_data_segment_align and
7024 script_data_segment_relro_end.
7025 * testsuite/relro_script_test.t: New file.
7026 * testsuite/relro_test.cc (using_script): Declare.
7027 (t1, t2): Test using_script.
7028 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
7029 (relro_script_test_SOURCES): Define.
7030 (relro_script_test_DEPENDENCIES): Define.
7031 (relro_script_test_LDFLAGS): Define.
7032 (relro_script_test_LDADD): Define.
7033 (relro_script_test.so): New target.
7034 * testsuite/Makefile.in: Rebuild.
7035
7036 2008-08-06 Cary Coutant <ccoutant@google.com>
7037
7038 * archive.cc (Archive::total_archives, Archive::total_members)
7039 (Archive::total_members_loaded): New variables.
7040 (Archive::setup): Add parameter. Add option to preread
7041 archive symbols.
7042 (Archive::read_armap): Add counter.
7043 (Archive::get_file_and_offset): New function.
7044 (Archive::get_elf_object_for_member): New function.
7045 (Archive::read_all_symbols): New function.
7046 (Archive::read_symbols): New function.
7047 (Archive::add_symbols): Add counters.
7048 (Archive::include_all_members): Use armap to find members if it's
7049 already built.
7050 (Archive::include_member): Skip reading symbols if already read.
7051 Factored code into Archive::get_file_and_offset and
7052 Archive::get_elf_object_for_member. Changed call to
7053 Mapfile::report_include_archive_member.
7054 (Archive::print_stats): New function.
7055 * archive.h: Declare Object and Read_symbols_data classes.
7056 (Archive::Archive): Add initializers for new members.
7057 (Archive::setup): Add parameter.
7058 (Archive::print_stats): New function.
7059 (Archive::total_archives, Archive::total_members)
7060 (Archive::total_members_loaded): New variables.
7061 (Archive::get_file_and_offset): New function.
7062 (Archive::get_elf_object_for_member): New function.
7063 (Archive::read_all_symbols): New function.
7064 (Archive::read_symbols): New function.
7065 (Archive::Archive_member): New class.
7066 (Archive::members_): New member.
7067 (Archive::num_members_): New member.
7068 * main.cc: Include archive.h.
7069 (main): Call Archive::print_stats.
7070 * mapfile.cc (Mapfile::report_include_archive_member): Delete
7071 archive parameter; member_name is now the fully-decorated name.
7072 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
7073 * options.h: (General_options): Add --preread-archive-symbols option.
7074 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
7075 Archive::setup.
7076
7077 2008-08-04 Ian Lance Taylor <iant@google.com>
7078
7079 * symtab.h (Symbol::use_plt_offset): New function.
7080 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
7081 * powerpc.cc (Relocate::relocate): Likewise.
7082 * sparc.cc (Relocate::relocate): Likewise.
7083 * x86_64.cc (Relocate::relocate): Likewise.
7084 * testsuite/weak_plt.sh: New test.
7085 * testsuite/weak_plt_main.cc: New test.
7086 * testsuite/weak_plt_shared.cc: New test.
7087 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
7088 (check_PROGRAMS): Add weak_plt.
7089 (check_DATA): Add weak_plt_shared.so.
7090 (weak_plt_main_pic.o, weak_plt): New targets.
7091 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
7092 * testsuite/Makefile.in: Rebuild.
7093
7094 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
7095 gcctestdir/ld.
7096 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
7097 * testsuite/Makefile.in: Rebuild.
7098
7099 2008-08-04 Alan Modra <amodra@bigpond.net.au>
7100
7101 * Makefile.am (POTFILES.in): Set LC_ALL=C.
7102 * Makefile.in: Regenerate.
7103 * po/POTFILES.in: Regenerate.
7104
7105 2008-07-29 Ian Lance Taylor <iant@google.com>
7106
7107 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
7108 symbols before other symbols.
7109 * testsuite/script_test_2.cc (test_addr): Declare.
7110 (test_addr_alias): Declare.
7111 (main): Check that test_addr and test_addr_alias have the right
7112 values.
7113 * testsuite/script_test_2.t: Define test_addr_alias and
7114 test_addr.
7115
7116 2008-07-24 Ian Lance Taylor <iant@google.com>
7117
7118 PR 5990
7119 * descriptors.cc: New file.
7120 * descriptors.h: New file.
7121 * gold-threads.h (class Hold_optional_lock): New class.
7122 * fileread.cc: Include "descriptors.h".
7123 (File_read::~File_read): Release descriptor rather than closing
7124 it.
7125 (File_read::open) [file]: Call open_descriptor rather than open.
7126 Set is_descriptor_opened_.
7127 (File_read::open) [memory]: Assert that descriptor is not open.
7128 (File_read::reopen_descriptor): New function.
7129 (File_read::release): Release descriptor.
7130 (File_read::do_read): Make non-const. Reopen descriptor.
7131 (File_read::read): Make non-const.
7132 (File_read::make_view): Reopen descriptor.
7133 (File_read::do_readv): Likewise.
7134 * fileread.h (class File_read): Add is_descriptor_opened_ field.
7135 Update declarations.
7136 * layout.cc: Include "descriptors.h".
7137 (Layout::create_build_id): Use open_descriptor rather than open.
7138 * output.cc: Include "descriptors.h".
7139 (Output_file::open): Use open_descriptor rather than open.
7140 * archive.cc (Archive::const_iterator): Change Archive to be
7141 non-const.
7142 (Archive::begin, Archive::end): Make non-const.
7143 (Archive::count_members): Likewise.
7144 * archive.h (class Archive): Update declarations.
7145 * object.h (Object::read): Make non-const.
7146 * Makefile.am (CCFILES): Add descriptors.cc.
7147 (HFILES): Add descriptors.h.
7148 * Makefile.in: Rebuild.
7149
7150 PR 6716
7151 * gold.h: Always include <clocale>. Add Solaris workarounds
7152 following code in binutils/sysdep.h.
7153
7154 PR 6048
7155 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
7156 this->eh_frame_hdr_ is NULL before using it.
7157
7158 * dynobj.cc (Versions::Versions): Update comment.
7159
7160 * dynobj.cc (Versions::Versions): If there is an soname, use it as
7161 the base version name.
7162
7163 * stringpool.cc (Stringpool_template::add_with_length): Set key to
7164 array size plus one.
7165 (Stringpool_template::set_string_offsets): Subtract one from key
7166 before using it as an array index.
7167 (Stringpool_template::get_offset_with_length): Likewise.
7168 (Stringpool_template::write_to_buffer): Likewise.
7169 * stringpool.h (Stringpool_template::get_offset_from_key):
7170 Likewise.
7171
7172 2008-07-23 Ian Lance Taylor <iant@google.com>
7173
7174 PR 6658
7175 * object.h (Merged_symbol_value::value): Do our best to handle a
7176 negative addend.
7177
7178 PR 6647
7179 * script.cc (Version_script_info::get_versions): Don't add empty
7180 version tag to return value.
7181 (Version_script_info::get_symbol_version_helper): Change return
7182 type to bool. Add pversion parameter. Change all callers.
7183 (script_register_vers_node): Don't require a non-NULL tag.
7184 * script.h (class Version_script_info): Update declarations.
7185 (Version_script_info::get_symbol_version): Change return type to
7186 bool. Add version parameter. Change all callers.
7187 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
7188 handling. Handle an empty version from a version script.
7189 (Symbol_table::define_special_symbol): Likewise.
7190 * testsuite/ver_test_10.script: New file.
7191 * testsuite/ver_test_10.sh: New file.
7192 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
7193 (check_DATA): Add ver_test_10.syms.
7194 (ver_test_10.syms, ver_test_10.so): New target.
7195 * testsuite/Makefile.in: Rebuild.
7196
7197 2008-07-23 Simon Baldwin <simonb@google.com>
7198
7199 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
7200 to zero for undefined symbols from dynamic libraries.
7201
7202 2008-07-23 Ian Lance Taylor <iant@google.com>
7203
7204 * symtab.cc (Symbol_table::resolve): Remove version parameter.
7205 Change all callers.
7206 * symtab.h (class Symbol_table): Update declaration.
7207 * testsuite/ver_test_9.cc: New file.
7208 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
7209 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
7210 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
7211 (ver_test_9.so, ver_test_9.o): New targets.
7212 * testsuite/Makefile.in: Rebuild.
7213
7214 2008-07-22 Ian Lance Taylor <iant@google.com>
7215
7216 * options.h (class General_options): Define --check-sections.
7217 * layout.cc (Layout::set_segment_offsets): Handle
7218 --check-sections.
7219
7220 * options.h (class General_options): Define -n/--nmagic and
7221 -N/--omagic.
7222 * options.cc (General_options::finalize): For -n/--nmagic or
7223 -N/--omagic, set -static.
7224 * layout.cc (Layout::attach_allocated_section_to_segment): If
7225 -N/--omagic, don't put read-only and read-write sections in
7226 different segments.
7227 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
7228 finding a read-only segment.
7229 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
7230 don't set the minimum segment alignment to the common page size,
7231 and don't set the file offset to the address modulo the page size.
7232 * script-sections.cc (Script_sections::create_segments): If
7233 -n/--omagic, don't put read-only and read-write sections in
7234 different segments.
7235
7236 * cref.cc: New file.
7237 * cref.h: New file.
7238 * options.h (class General_options): Add --print-symbol-counts.
7239 * main.cc (main): Issue defined symbol report if requested.
7240 * archive.cc (Archive::interpret_header): Make into a const member
7241 function.
7242 (Archive::add_symbols): Call Input_objects::archive_start and
7243 archive_stop.
7244 (Archive::const_iterator): Define new class.
7245 (Archive::begin, Archive::end): New functions.
7246 (Archive::include_all_members): Rewrite to use iterator.
7247 (Archive::count_members): New function.
7248 * archive.h (class Archive): Update declarations.
7249 (Archive::filename): New function.
7250 * object.cc: Include "cref.h".
7251 (Sized_relobj::Sized_relobj): Initialize defined_count_.
7252 (Sized_relobj::do_get_global_symbol_counts): New function.
7253 (Input_objects::add_object): Add object to cross-referencer.
7254 (Input_objects::archive_start): New function.
7255 (Input_objects::archive_stop): New function.
7256 (Input_objects::print_symbol_counts): New function.
7257 * object.h: Declare Cref and Archive.
7258 (Object::get_global_symbol_counts): New function.
7259 (Object::do_get_global_symbol_counts): New pure virtual function.
7260 (class Sized_relobj): Add defined_count_ field. Update
7261 declarations.
7262 (class Input_objects): Add cref_ field. Update constructor.
7263 Update declarations.
7264 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
7265 defined_count_.
7266 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
7267 symbol counts.
7268 (Sized_dynobj::do_get_global_symbol_counts): New function.
7269 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
7270 defined_count_. Update declarations. Define Symbols typedef.
7271 * symtab.cc (Symbol_table::add_from_relobj): Add defined
7272 parameter. Change all callers.
7273 (Symbol_table::add_from_dynobj): Add sympointers and defined
7274 parameters. Change all callers.
7275 * symtab.h (class Symbol_table): Update declarations.
7276 * Makefile.am (CCFILES): Add cref.cc.
7277 (HFILES): Add cref.h.
7278 * Makefile.in: Rebuild.
7279
7280 2008-07-22 Simon Baldwin <simonb@google.com>
7281
7282 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
7283 to zero when writing undefined symbols.
7284
7285 2008-07-22 Ian Lance Taylor <iant@google.com>
7286
7287 * output.cc (Output_section::add_input_section): Don't try to
7288 merge empty merge sections.
7289
7290 2008-07-21 Craig Silverstein <csilvers@google.com>
7291
7292 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7293 Include symbol version in error message.
7294
7295 2008-07-20 Chris Demetriou <cgd@google.com>
7296
7297 * configure.ac (gold_cv_c_random_seed): New configured variable.
7298 (RANDOM_SEED_CFLAGS): New substituted variable.
7299 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
7300 * configure: Rebuild.
7301 * Makefile.in: Likewise.
7302 * testsuite/Makefile.in: Likewise.
7303
7304 2008-07-18 Ian Lance Taylor <iant@google.com>
7305
7306 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
7307 where we see NAME/NULL and NAME/VERSION as separate symbols.
7308 * testsuite/ver_test_main.cc (main): Call t4.
7309 (t4, t4_2a): Define.
7310 * testsuite/ver_test_2.cc (t4_2): Define.
7311 * testsuite/ver_test_2.script: Put t4_2a in VER2.
7312 * testsuite/ver_test_4.cc (t4_2a): Define.
7313 * testsuite/ver_test_4.script: Put t4_2a in VER2.
7314 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
7315
7316 2008-07-17 Ian Lance Taylor <iant@google.com>
7317
7318 * dynobj.cc (Versions::add_def): If we give an error about a
7319 missing version, go ahead and create the version anyhow.
7320
7321 2008-07-10 Ian Lance Taylor <iant@google.com>
7322
7323 Handle output sections with more than 0x7fffffff bytes.
7324 * object.h (class Relobj): Change map_to_output_ to
7325 output_sections_, and just keep a section pointer. Change all
7326 uses. Move comdat group support to Sized_relobj.
7327 (Relobj::is_section_specially_mapped): Remove.
7328 (Relobj::output_section): Remove poff parameter. Change all
7329 callers.
7330 (Relobj::output_section_offset): New function.
7331 (Relobj::set_section_offset): Rewrite.
7332 (Relobj::map_to_output): Remove.
7333 (Relobj::output_sections): New function.
7334 (Relobj::do_output_section_offset): New pure virtual function.
7335 (Relobj::do_set_section_offset): Likewise.
7336 (class Sized_relobj): Add section_offsets_ field. Add comdat
7337 group support from Relobj. Update declarations.
7338 (Sized_relobj::get_output_section_offset): New function.
7339 (Sized_relobj::do_output_section_offset): New function.
7340 (Sized_relobj::do_set_section_offset): New function.
7341 * object.cc (Relobj::output_section_address): Remove.
7342 (Sized_relobj::Sized_relobj): Initialize new fields.
7343 (Sized_relobj::include_section_group): Cast find_kept_object to
7344 Sized_relobj.
7345 (Sized_relobj::include_linkonce_section): Likewise.
7346 (Sized_relobj::do_layout): Use separate arrays for output section
7347 and output offset.
7348 (Sized_relobj::do_count_local_symbols): Change map_to_output to
7349 output_sections.
7350 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
7351 output_sections and section_offsets.
7352 (Sized_relobj::write_local_symbols): Likewise.
7353 (map_to_kept_section): Compute output address directly.
7354 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
7355 output_sections and section_offsets.
7356 (Sized_relobj::write_sections): Likewise.
7357 (Sized_relobj::relocate_sections): Likewise.
7358 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
7359 * output.h (class Output_reloc): Update declarations. Change
7360 u2_.relobj to Sized_relobj*.
7361 (class Output_data_reloc): Change add functions to use
7362 Sized_relobj*.
7363 * output.cc (Output_reloc::Output_reloc): Change relobj to
7364 Sized_relobj*.
7365 (Output_reloc::local_section_offset): Change return type to
7366 Elf_Addr. Use get_output_section_offset.
7367 (Output_reloc::get_address): Likewise.
7368 (Output_section::is_input_address_mapped): Don't call
7369 is_section_specially_mapped.
7370 (Output_section::output_offset): Likewise.
7371 (Output_section::output_address): Likewise.
7372 (Output_section::starting_output_address): Likewise.
7373 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
7374 parameter to Sized_relobj*.
7375 (Copy_relocs::need_copy_reloc): Likewise.
7376 (Copy_relocs::save): Likewise.
7377 * copy-relocs.h (class Copy_relocs): Update declarations.
7378 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
7379 Sized_relobj*. Change relobj_ field to Sized_relobj*.
7380 * target-reloc.h (relocate_for_relocatable): Change
7381 offset_in_output_section type to Elf_Addr. Change code that uses
7382 it as well.
7383 * layout.cc (Layout::layout): Always set *off.
7384 * mapfile.cc (Mapfile::print_input_section): Use
7385 output_section_offset.
7386 * i386.cc (Target_i386::copy_reloc): Change object parameter to
7387 Sized_relobj*.
7388 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
7389 * sparc.cc (Target_sparc::copy_reloc): Likewise.
7390 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
7391
7392 2008-07-03 Ian Lance Taylor <iant@google.com>
7393
7394 * layout.cc (Layout::include_section): Do not discard unrecognized
7395 SHT_STRTAB sections.
7396
7397 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
7398
7399 * script.cc (Lex::can_continue_name): Make '?' allowable in
7400 version-script names.
7401 * testsuite/version_script.map: Change glob pattern to use '?'
7402
7403 2008-06-30 Manish Singh <yosh@gimp.org>
7404
7405 PR 6585
7406 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
7407 Correct typo.
7408
7409 2008-06-30 Ian Lance Taylor <iant@google.com>
7410
7411 PR 6660
7412 PR 6682
7413 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
7414 versions]: Don't try to read the value in the contents, since we
7415 don't use it. Use the template endianness when writing.
7416
7417 2008-06-25 Cary Coutant <ccoutant@google.com>
7418
7419 * fileread.cc (File_read::make_view): Assert on zero-length view.
7420 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
7421 symbol table when there are no symbols to read.
7422
7423 2008-06-23 Craig Silverstein <csilvers@google.com>
7424
7425 * version.cc (version_string): Bump to 1.7
7426
7427 2008-06-18 Craig Silverstein <csilvers@google.com>
7428
7429 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
7430 constant 0xFFFF to type Valtype.
7431 (Powerpc_relocate_functions::rel16_ha): Likewise.
7432
7433 2008-06-17 Ian Lance Taylor <iant@google.com>
7434
7435 * output.h (Output_section::Input_section): Initialize p2align_ to
7436 zero for Output_section_data constructors.
7437 (Output_section::Input_section::addralign): If not an input
7438 section, return the alignment of the Output_section_data.
7439 * testsuite/copy_test.cc: New file.
7440 * testsuite/copy_test_1.cc: New file.
7441 * testsuite/copy_test_2.cc: New file.
7442 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
7443 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
7444 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
7445 (copy_test_1_pic.o, copy_test_1.so): New targets.
7446 (copy_test_2_pic.o, copy_test_2.so): New targets.
7447 * testsuite/Makefile.in: Rebuild.
7448
7449 * script-sections.cc (Script_sections::place_orphan): Initialize
7450 local variable exact.
7451
7452 2008-06-13 David Edelsohn <edelsohn@gnu.org>
7453
7454 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
7455
7456 2008-06-12 David Edelsohn <edelsohn@gnu.org>
7457 David S. Miller <davem@davemloft.net>
7458
7459 * powerpc.cc: New file.
7460 * Makefile.am (TARGETSOURCES): Add powerpc.cc
7461 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
7462 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
7463 * Makefile.in: Rebuild.
7464
7465 2008-06-09 Ian Lance Taylor <iant@google.com>
7466
7467 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
7468 <exception>.
7469 (throwing, orig_terminate): New static variables.
7470 (terminate_handler): New static function.
7471 (t2): Set terminate handler.
7472
7473 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
7474
7475 PR 6584
7476 * binary.cc (Binary_to_elf::sized_convert): Fix .data
7477 alignment.
7478
7479 2008-05-30 Cary Coutant <ccoutant@google.com>
7480
7481 * archive.cc (Archive::include_all_members) Correct to step
7482 over symbol table and extended name table in thin archives.
7483
7484 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
7485
7486 PR 6407
7487 * target-reloc.h (relocate_for_relocatable): Fix new_offset
7488 calculation.
7489
7490 2008-05-28 Caleb Howe <cshowe@google.com>
7491
7492 * reduced_debug_output.cc: New file.
7493 * reduced_debug_output.h: New file.
7494 * options.h (class General_options): Add --strip-debug-non-line.
7495 * options.cc (General_options::finalize): Add strip_debug_non_line
7496 to the strip heirarchy.
7497 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
7498 fields.
7499 * layout.cc: Include "reduced_debug_output.h".
7500 (Layout::Layout): Initialize new fields.
7501 (line_only_debug_sections): New static array.
7502 (is_lines_only_debug_sections): New static inline function.
7503 (Layout::include_section): Handle --strip-debug-non-line.
7504 (Layout::make_output_section): If --strip-debug-non-line, build
7505 new output sections for .debug_abbrev and .debug_info.
7506 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
7507 gold. Warn about possible overflow.
7508 (read_signed_LEB_128): Likewise.
7509 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
7510 (read_signed_LEB_128): Declare.
7511 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
7512 (HFILES): Add reduced_debug_output.h.
7513 * Makefile.in: Rebuild.
7514
7515 2008-05-21 Ian Lance Taylor <iant@google.com>
7516
7517 * mapfile.cc: New file.
7518 * mapfile.h: New file.
7519 * options.h (class General_options): Add -M/--print-map and -Map.
7520 * options.cc (General_options::finalize): Make -M equivalent to
7521 -Map -.
7522 * main.cc: Include <cstdio> and "mapfile.h".
7523 (main): Open mapfile if requested.
7524 * gold.cc (class Middle_runner): Add mapfile_ field. Update
7525 constructor. Change caller.
7526 (queue_initial_tasks): Add mapfile parameter. Change caller.
7527 (queue_middle_tasks): Likewise.
7528 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
7529 declarations.
7530 * archive.cc: Include "mapfile.h".
7531 (Archive::add_symbols): Add mapfile parameter. Change all
7532 callers. Pass mapfile, symbol, and reason to include_member.
7533 (Archive::include_all_members): Add mapfile parameter. Change all
7534 callers.
7535 (Archive::include_member): Add mapfile, sym, and why parameters.
7536 Change all callers. Report inclusion to map file.
7537 * archive.h: Include "fileread.h".
7538 (class Archive): Update declarations.
7539 (Archive::file): New const method.
7540 (class Add_archive_symbols): Add mapfile_ field. Update
7541 constructor. Change all callers.
7542 * readsyms.h (class Read_symbols): Likewise.
7543 (class Finish_group): Likewise.
7544 (class Read_script): Likewise.
7545 * common.cc: Include "mapfile.h".
7546 (Symbol_table::allocate_commons): Add mapfile parameter. Change
7547 all callers.
7548 (Symbol_table::do_allocate_commons): Likewise.
7549 (Symbol_table::do_allocate_commons_list): Likewise. Report common
7550 symbol allocation to mapfile.
7551 * common.h (class Allocate_commons_task): Add mapfile_ field.
7552 Update constructor. Change all callers.
7553 * symtab.h (class Symbol_table): Update declarations.
7554 * layout.cc: Include "mapfile.h".
7555 (Layout_task_runner::run): Print information to mapfile.
7556 (Layout::create_gold_note): Change Output_data_fixed_space to
7557 Output_data_zero_fill.
7558 (Layout::create_build_id): Likewise.
7559 (Layout::print_to_mapfile): New function.
7560 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
7561 constructor. Change caller.
7562 (class Layout): Declare print_to_mapfile.
7563 * output.cc (Output_section::Input_section::print_to_mapfile): New
7564 function.
7565 (Output_section::add_input_section): If producing a map, always
7566 add to input_sections_ list.
7567 (Output_section::do_print_to_mapfile): New function.
7568 (Output_segment::print_sections_to_mapfile): New function.
7569 (Output_segment::print_section_list_to_mapfile): New function.
7570 * output.h: Include "mapfile.h".
7571 (Output_data::print_to_mapfile): New function.
7572 (Output_data::do_print_to_mapfile): New virtual function.
7573 (Output_segment_headers::do_print_to_mapfile): New function.
7574 (Output_file_header::do_print_to_mapfile): New function.
7575 (Output_data_const::do_print_to_mapfile): New function.
7576 (class Output_data_const_buffer): Add map_name_ field. Update
7577 constructor. Change all callers. Add do_print_to_mapfile
7578 function.
7579 (class Output_data_fixed_space): Likewise.
7580 (class Output_data_space): Likewise.
7581 (class Output_data_zero_fill): New class.
7582 (Output_data_strtab::do_print_to_mapfile): New function.
7583 (Output_data_reloc_base::do_print_to_mapfile): New function.
7584 (Output_relocatable_relocs::do_print_to_mapfile): New function.
7585 (Output_data_group::do_print_to_mapfile): New function.
7586 (Output_data_got::do_print_to_mapfile): New function.
7587 (Output_data_dynamic::do_print_to_mapfile): New function.
7588 (Output_symtab_xindex::do_print_to_mapfile): New function.
7589 (class Output_section): Declare do_print_to_mapflie. Declare
7590 print_to_mapfile in Input_section.
7591 (class Output_segment): Declare new functions.
7592 * object.h (Sized_relobj::symbol_count): New function.
7593 * script-sections.cc
7594 (Output_section_element_dot_assignment::set_section_addresses):
7595 Change Output_data_fixed_space to Output_data_zero_fill.
7596 (Output_data_expression::do_print_to_mapfile): New function.
7597 * script.cc (read_input_script): Add mapfile parameter. Change
7598 all callers.
7599 * script.h (read_input_script): Update declaration.
7600 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
7601 (Eh_frame::do_print_to_mapfile): New function.
7602 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
7603 (Output_merge_string::do_print_to_mapfile): New function.
7604 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
7605 function.
7606 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
7607 function.
7608 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
7609 function.
7610 * Makefile.am (CCFILES): Add mapfile.cc.
7611 (HFILES): Add mapfile.h.
7612 * Makefile.in: Rebuild.
7613
7614 2008-05-19 Ian Lance Taylor <iant@google.com>
7615
7616 * options.h (class General_options): Add -z relro.
7617 * layout.cc (Layout::Layout): Initialize relro_segment_.
7618 (Layout::add_output_section_data): Return the output section.
7619 (Layout::make_output_section): Rcognize relro sections and mark
7620 them appropriately.
7621 (Layout::attach_allocated_section_to_segment): Put relro sections
7622 in a PT_GNU_RELRO segment.
7623 (Layout::create_initial_dynamic_sections): Mark the .dynamic
7624 section as relro.
7625 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
7626 PT_TLS segments.
7627 (Layout::linkonce_mapping): Map d.rel.ro.local to
7628 .data.rel.ro.local.
7629 (Layout::output_section_name): Us .data.rel.ro.local for any
7630 section which begins with that.
7631 * layout.h (class Layout): Update add_output_section_data
7632 declaration. Add relro_segment_ field.
7633 * output.cc (Output_section::Output_section): Initialize is_relro_
7634 and is_relro_local_ fields.
7635 (Output_segment::add_output_section): Group relro sections.
7636 (Output_segment::is_first_section_relro): New function.
7637 (Output_segment::maximum_alignment): If there is a relro section,
7638 align the segment to the common page size.
7639 (Output_segment::set_section_addresses): Track whether we are
7640 looking at relro sections. If the last section is a relro
7641 section, align to the common page size.
7642 (Output_segment::set_section_list_addresses): Add in_relro
7643 parameter. Change all callers. Align to the page size when
7644 moving from relro to non-relro section.
7645 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
7646 segment.
7647 * output.h (class Output_section): Add is_relro_ and
7648 is_relro_local_ fields.
7649 (Output_section::is_relro): New function.
7650 (Output_section::set_is_relro): New function.
7651 (Output_section::is_relro_local): New function.
7652 (Output_section::set_is_relro_local): New function.
7653 (class Output_segment): Update declarations.
7654 * i386.cc (Target_i386::got_section): Mark .got section as relro.
7655 * sparc.cc (Target_sparc::got_section): Likewise.
7656 * x86_64.cc (Target_x86_64::got_section): Likewise.
7657 * testsuite/relro_test_main.cc: New file.
7658 * testsuite/relro_test.cc: New file.
7659 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
7660 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
7661 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
7662 (relro_test.so, relro_test_pic.o): New targets.
7663 * testsuite/Makefile.in: Rebuild.
7664
7665 2008-05-16 Ian Lance Taylor <iant@google.com>
7666
7667 * output.cc (Output_segment::add_output_section): Remove front
7668 parameter.
7669 * output.h (class Output_segment): Remove
7670 add_initial_output_section and overloaded add_output_section.
7671 Update declaration of remaining add_output_section.
7672 * layout.cc (Layout::create_interp): Call add_output_section
7673 rather than add_initial_output_section.
7674 (Layout::finish_dynamic_section): Likewise.
7675
7676 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
7677 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
7678 know the dynamic type.
7679 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
7680 field. Initialize it in constructor.
7681 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
7682 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
7683 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
7684 reloc.
7685
7686 * output.cc (Output_reloc::get_address): Change return type to
7687 Elf_Addr.
7688 * output.h (class Output_reloc): Update get_address declaration.
7689 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
7690 for section addresses.
7691
7692 2008-05-09 Ian Lance Taylor <iant@google.com>
7693
7694 PR 6493
7695 * gold.cc (gold_nomem): Use return value of write.
7696
7697 2008-05-08 Ian Lance Taylor <iant@google.com>
7698
7699 * symtab.c (Symbol::init_base_output_data): Add version
7700 parameter. Change all callers.
7701 (Symbol::init_base_output_segment): Likewise.
7702 (Symbol::init_base_constant): Likewise.
7703 (Symbol::init_base_undefined): Likewise.
7704 (Sized_symbol::init_output_data): Likewise.
7705 (Sized_symbol::init_output_segment): Likewise.
7706 (Sized_symbol::init_constant): Likewise.
7707 (Sized_symbol::init_undefined): Likewise.
7708 (Symbol_table::do_define_in_output_data): If the new symbol has a
7709 version, mark it as the default.
7710 (Symbol_table::do_define_in_output_segment): Likewise.
7711 (Symbol_table::do_define_as_constant): Likewise.
7712 * symtab.h (class Symbol): Update declarations.
7713 (class Sized_symbol): Likewise.
7714 * resolve.cc (Symbol::override_version): New function.
7715 (Symbol::override_base): Call override_version.
7716 (Symbol::override_base_with_special): Likewise.
7717 * testsuite/ver_script_8.script: New file.
7718 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
7719 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
7720 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
7721 (ver_test_8_1.so, ver_test_8_2.so): New targets.
7722
7723 2008-05-06 Ian Lance Taylor <iant@google.com>
7724
7725 PR 6049
7726 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
7727 functions.
7728 (class General_options): Remove existing --undefined, and add
7729 --no-undefined instead. Add new --undefined as synonym for -u.
7730 * archive.cc (Archive::add_symbols): Check whether symbol was
7731 named with -u.
7732 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
7733 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
7734 all uses. Add IS_UNDEFINED. Update declarations to split
7735 different versions of init_base. Declare init_base_undefined.
7736 (Symbol::is_defined): Handle IS_UNDEFINED.
7737 (Symbol::is_undefined): Likewise.
7738 (Symbol::is_weak_undefined): Call is_undefined.
7739 (Symbol::is_absolute): Handle IS_CONSTANT.
7740 (class Sized_symbol): Update declarations to split different
7741 versions of init. Declare init_undefined.
7742 (class Symbol_table): Declare new functions.
7743 * symtab.cc (Symbol::init_base_object): Rename from init_base.
7744 Change all callers.
7745 (Symbol::init_base_output_data): Likewise.
7746 (Symbol::init_base_output_segment): Likewise.
7747 (Symbol::init_base_constant): Likewise.
7748 (Symbol::init_base_undefined): New function.
7749 (Sized_symbol::init_object): Rename from init. Change all
7750 callers.
7751 (Sized_symbol::init_output_data): Likewise.
7752 (Sized_symbol::init_output_segment): Likewise.
7753 (Sized_symbol::init_constant): Likewise.
7754 (Sized_symbol::init_undefined): New function.
7755 (Symbol_table::add_undefined_symbols_from_command_line): New
7756 function.
7757 (Symbol_table::do_add_undefined_symbols_from_command_line): New
7758 function.
7759 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
7760 (Symbol::output_section): Likewise.
7761 (Symbol::set_output_section): Likewise.
7762 (Symbol_table::sized_finalize_symbol): Likewise.
7763 (Symbol_table::sized_write_globals): Likewise.
7764 * resolve.cc (Symbol_table::should_override): Likewise.
7765 (Symbol::override_base_with_special): Likewise.
7766
7767 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
7768 symbol, change it to have default visibility.
7769 * testsuite/protected_1.cc: New file.
7770 * testsuite/protected_2.cc: New file.
7771 * testsuite/protected_3.cc: New file.
7772 * testsuite/protected_main_1.cc: New file.
7773 * testsuite/protected_main_2.cc: New file.
7774 * testsuite/protected_main_3.cc: New file.
7775 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
7776 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
7777 (protected_1_LDFLAGS, protected_1_LDADD): Define.
7778 (protected_1.so): New target.
7779 (protected_1_pic.o, protected_2_pic.o): New targets.
7780 (protected_3_pic.o): New target.
7781 (check_PROGRAMS): Add protected_2.
7782 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
7783 (protected_2_LDFLAGS, protected_2_LDADD): Define.
7784 * testsuite/Makefile.in: Rebuild.
7785
7786 * options.h (DEFINE_var): Add set_user_set_##varname__.
7787 (DEFINE_bool_alias): New macro.
7788 (class General_options): Define -Bstatic using DEFINE_bool_alias
7789 rather than DEFINE_special. Add --undefined as an alias for -z
7790 defs.
7791 * options.cc (General_options::parse_Bstatic): Remove.
7792
7793 * options.h (class General_options): Add --fatal-warnings.
7794 * main.cc (main): Implement --fatal-warnings.
7795 * errors.h (Errors::warning_count): New function.
7796
7797 * options.h (class General_options): Add -Bsymbolic-functions.
7798 * symtab.h (Symbol::is_preemptible): Check for
7799 -Bsymbolic-functions.
7800
7801 2008-05-05 Ian Lance Taylor <iant@google.com>
7802
7803 * options.h (DEFINE_bool): For DASH_Z, create the negative option
7804 as noVARNAME rather than no-VARNAME.
7805 (class General_options): Add option -z combreloc.
7806 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
7807 get_address.
7808 (Output_reloc::sort_before) [SHT_REL]: New function.
7809 (Output_reloc::sort_before) [SHT_RELA]: New function.
7810 (class Output_data_reloc_base): Add sort_relocs_ field. Define
7811 Sort_relocs_comparison.
7812 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
7813 parameter. Change all callers.
7814 (Output_data_reloc::Output_data_reloc) [both versions]: Add
7815 sort_relocs parameter. Change all callers.
7816 * output.cc (Output_reloc::get_address): New function, broken out
7817 of write_rel.
7818 (Output_reloc::write_rel): Call it.
7819 (Output_reloc::compare): New function.
7820 (Output_data_reloc_base::do_write): Optionally sort relocs.
7821
7822 * configure.ac: If targ_extra_obj is set, link it in.
7823 * configure.tgt: Initialize all variables.
7824 (x86_64*): Set targ_extra_obj and targ_extra_size.
7825 * configure: Rebuild.
7826
7827 * object.cc (Sized_relobj::include_section_group): Adjust section
7828 indexes read from group data. Build vector to pass to
7829 layout_group.
7830 * layout.cc (Layout::layout_group): Add flags and shndxes
7831 parameters. Remove contents parameter. Change caller. Update
7832 explicit instantiations.
7833 * layout.h (class Layout): Update layout_group declaration.
7834 * output.cc (Output_data_group::Output_data_group): Add flags and
7835 input_shndxes parameters. Remove contents parameter. Change
7836 caller.
7837 (Output_data_group::do_write): Change input_sections_ to
7838 input_shndxes_.
7839 * output.h (class Output_data_group): Update constructor
7840 declaration. Rename input_sections_ to input_shndxes_.
7841 * testsuite/many_sections_test.cc: Add template.
7842
7843 2008-04-30 Cary Coutant <ccoutant@google.com>
7844
7845 * target-reloc.h (relocate_section): Fix dead-pointer bug.
7846
7847 * layout.cc (Layout::include_section): Refactored check for debug
7848 info section.
7849 (Layout::add_comdat): Add new parameters. Change type
7850 of signature parameter. Add object and shndx to signatures table.
7851 (Layout::find_kept_object): New function.
7852 * layout.h: Include <cstring>.
7853 (Layout::is_debug_info_section): New function.
7854 (Layout::add_comdat): Add new parameters.
7855 (Layout::find_kept_object): New function.
7856 (Layout::Kept_section): New struct.
7857 (Layout::Signatures): Change type of map range.
7858 * object.cc (Relobj::output_section_address): New function.
7859 (Sized_relobj::include_section_group): Add new parameters. Change
7860 calls to Layout::add_comdat. Change to build table of kept comdat
7861 groups and table mapping discarded sections to kept sections.
7862 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
7863 (Sized_relobj::do_layout): Change calls to include_section_group and
7864 include_linkonce_section.
7865 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
7866 value to zero when section is discarded.
7867 (Sized_relobj::map_to_kept_section): New function.
7868 * object.h (Relobj::output_section_address): New function.
7869 (Relobj::Comdat_group): New type.
7870 (Relobj::find_comdat_group): New function.
7871 (Relobj::Comdat_group_table): New type.
7872 (Relobj::Kept_comdat_section): New type.
7873 (Relobj::Kept_comdat_section_table): New type.
7874 (Relobj::add_comdat_group): New function.
7875 (Relobj::set_kept_comdat_section): New function.
7876 (Relobj::get_kept_comdat_section): New function.
7877 (Relobj::comdat_groups_): New field.
7878 (Relobj::kept_comdat_sections_): New field.
7879 (Symbol_value::input_value): Update comment.
7880 (Sized_relobj::map_to_kept_section) New function.
7881 (Sized_relobj::include_linkonce_section): Add new parameter.
7882 * target-reloc.h (Comdat_behavior): New type.
7883 (get_comdat_behavior): New function.
7884 (relocate_section): Add code to map a discarded section to the
7885 corresponding kept section when applying a relocation.
7886
7887 2008-04-30 Craig Silverstein <csilvers@google.com>
7888
7889 * dwarf_reader.cc (next_generation_count): New static var.
7890 (Addr2line_cache_entry): New struct.
7891 (addr2line_cache): New static var.
7892 (Dwarf_line_info::one_addr2line): Added caching.
7893 (Dwarf_line_info::clear_addr2line_cache): New function.
7894 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
7895 cache-size parameter.
7896 (Dwarf_line_info::one_addr2line_cache): New function.
7897 * symtab.cc (Symbol_table::detect_odr_violations): Pass
7898 new cache-size argument to one_addr2line(), and clear cache.
7899
7900 2008-04-28 Cary Coutant <ccoutant@google.com>
7901
7902 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
7903 R_386_PC8 relocations.
7904
7905 2008-04-23 Ian Lance Taylor <iant@google.com>
7906
7907 * object.cc (Sized_relobj::include_section_group): Check for
7908 invalid section group.
7909
7910 * object.cc (make_elf_object): Correct test for 64-bit ELF file
7911 header size.
7912
7913 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
7914 than read for file header.
7915 * archive.cc (Archive::include_member): Likewise.
7916
7917 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
7918
7919 * aclocal.m4: Regenerate.
7920 * configure: Regenerate.
7921
7922 2008-04-19 Ian Lance Taylor <iant@google.com>
7923
7924 * version.cc (version_string): Bump to 1.6.
7925
7926 * testsuite/Makefile.am (many_sections_r_test): New target.
7927 (many_sections_r_test_SOURCES): Remove.
7928 (many_sections_r_test_DEPENDENCIES): Remove.
7929 (many_sections_r_test_LDFLAGS): Remove.
7930 (many_sections_r_test_LDADD): Remove.
7931
7932 * object.cc (Sized_relobj::do_add_symbols): Always pass
7933 local_symbol_count_ to add_from_relobj.
7934
7935 * testsuite/Makefile.am (many_sections_check.h): Only check one in
7936 every thousand variables.
7937 * testsuite/Makefile.in: Rebuild.
7938
7939 * object.cc (Xindex::initialize_symtab_xindex): New function.
7940 (Xindex::read_symtab_xindex): New function.
7941 (Xindex::sym_xindex_to_shndx): New function.
7942 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
7943 available.
7944 (Sized_relobj::do_initialize_xindex): New function.
7945 (Sized_relobj::do_read_symbols): Adjust section links.
7946 (Sized_relobj::symbol_section_and_value): Add is_ordinary
7947 parameter. Change all callers.
7948 (Sized_relobj::include_section_group): Adjust section links and
7949 symbol section indexes.
7950 (Sized_relobj::do_layout): Adjust section links.
7951 (Sized_relobj::do_count_local_symbols): Adjust section links and
7952 symbol section indexes.
7953 (Sized_relobj::do_finalize_local_symbols): Distinguish between
7954 ordinary and special symbols.
7955 (Sized_relobj::write_local_symbols): Add symtab_xindex and
7956 dynsym_xindex parameters. Change all callers. Adjust section
7957 links. Use SHN_XINDEX when needed.
7958 (Sized_relobj::get_symbol_location_info): Adjust section links.
7959 Don't get fooled by special symbols.
7960 * object.h (class Xindex): Define.
7961 (class Object): Add xindex_ parameter. Declare virtual functoin
7962 do_initialize_xindex.
7963 (Object::adjust_sym_shndx): New function.
7964 (Object::set_xindex): New protected function.
7965 (class Symbol_value): Add is_ordinary_shndx_ field.
7966 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
7967 (Symbol_value::value): Assert ordinary section.
7968 (Symbol_value::initialize_input_to_output_map): Likewise.
7969 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
7970 Change all callers.
7971 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
7972 all callers.
7973 (class Sized_relobj): Update declarations.
7974 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
7975 parameter. Change all callers.
7976 (Sized_relobj::adjust_shndx): New function.
7977 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
7978 field.
7979 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
7980 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
7981 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
7982 (Sized_dynobj::read_dynsym_section): Adjust section links.
7983 (Sized_dynobj::read_dynamic): Likewise.
7984 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
7985 section links.
7986 (Sized_dynobj::do_initialize_xindex): New function.
7987 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
7988 do_initialize_xindex.
7989 (Sized_dynobj::adjust_shndx): New function.
7990 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
7991 dynsym_xindex_ fields.
7992 (Layout::finalize): Add a call to set_section_indexes before
7993 creating the symtab sections.
7994 (Layout::set_section_indexes): Don't do anything if the section
7995 already has a section index.
7996 (Layout::create_symtab_sections): Add shnum parameter. Change
7997 caller. Create .symtab_shndx section if needed.
7998 (Layout::create_shdrs): Add shstrtab_section parameter. Change
7999 caller.
8000 (Layout::allocated_output_section_count): New function.
8001 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
8002 needed.
8003 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
8004 fields. Update declarations.
8005 (Layout::symtab_xindex): New function.
8006 (Layout::dynsym_xindex): New function.
8007 (class Write_symbols_task): Add layout_ field.
8008 (Write_symbols_task::Write_symbols_task): Add layout parameter.
8009 Change caller.
8010 * output.cc (Output_section_headers::Output_section_headers): Add
8011 shstrtab_section parameter. Change all callers.
8012 (Output_section_headers::do_sized_write): Store overflow values
8013 for section count and section string table section index in
8014 section header zero.
8015 (Output_file_header::do_sized_write): Check for overflow of
8016 section count and section string table section index.
8017 (Output_symtab_xindex::do_write): New function.
8018 (Output_symtab_xindex::endian_do_write): New function.
8019 * output.h (class Output_section_headers): Add shstrtab_section_.
8020 Update declarations.
8021 (class Output_symtab_xindex): Define.
8022 (Output_section::has_out_shndx): New function.
8023 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
8024 field.
8025 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
8026 Change all callers.
8027 (Sized_symbol::init): Likewise.
8028 (Symbol::output_section): Check for ordinary symbol.
8029 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
8030 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
8031 callers.
8032 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
8033 Change all callers. Simplify handling of symbols from sections
8034 not included in the link.
8035 (Symbol_table::add_from_dynobj): Handle ordinary symbol
8036 distinction.
8037 (Weak_alias_sorter::operator()): Assert that symbols are
8038 ordinary.
8039 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
8040 distinction.
8041 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
8042 parameters. Change all callers.
8043 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
8044 symbol distinction. Use SHN_XINDEX when needed.
8045 (Symbol_table::write_section_symbol): Add symtab_xindex
8046 parameter. Change all callers.
8047 (Symbol_table::sized_write_section_symbol): Likewise. Use
8048 SHN_XINDEX when needed.
8049 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
8050 declarations.
8051 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
8052 (Symbol::is_defined): Check is_ordinary.
8053 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
8054 (Symbol::is_absolute, Symbol::is_common): Likewise.
8055 (class Sized_symbol): Update declarations.
8056 (class Symbol_table): Update declarations.
8057 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
8058 parameters. Change all callers.
8059 (Sized_symbol::override): Likewise.
8060 (Symbol_table::override): Likewise.
8061 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
8062 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
8063 is_ordinary, and orig_st_shndx parameters. Change all callers.
8064 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
8065 to be in an ordinary section.
8066 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
8067 object and is_ordinary parameters. Change all callers.
8068 (Sized_dwarf_line_info::read_relocs): Add object parameter.
8069 Change all callers. Don't add undefined or non-ordinary symbols
8070 to reloc_map_.
8071 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
8072 Change all callers.
8073 * dwarf_reader.h (class Sized_dwarf_line_info): Update
8074 declarations.
8075 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
8076 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
8077 (Sized_relobj::relocate_sections): Likewise.
8078 * target-reloc.h (scan_relocs): Adjust section symbol index.
8079 (scan_relocatable_relocs): Likewise.
8080 * i386.cc (Scan::local): Check for ordinary symbols.
8081 * sparc.cc (Scan::local): Likewise.
8082 * x86_64.cc (Scan::local): Likewise.
8083 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
8084 to symbol_section_and_value.
8085 * testsuite/many_sections_test.cc: New file.
8086 * testsuite/Makefile.am (BUILT_SOURCES): Define.
8087 (check_PROGRAMS): Add many_sections_test.
8088 (many_sections_test_SOURCES): Define.
8089 (many_sections_test_DEPENDENCIES): Define.
8090 (many_sections_test_LDFLAGS): Define.
8091 (BUILT_SOURCES): Add many_sections_define.h.
8092 (many_sections_define.h): New target.
8093 (BUILT_SOURCES): Add many_sections_check.h.
8094 (many_sections_check.h): New target.
8095 (check_PROGRAMS): Add many_sections_r_test.
8096 (many_sections_r_test_SOURCES): Define.
8097 (many_sections_r_test_DEPENDENCIES): Define.
8098 (many_sections_r_test_LDFLAGS): Define.
8099 (many_sections_r_test_LDADD): Define.
8100 (many_sections_r_test.o): New target.
8101 * testsuite/Makefile.in: Rebuild.
8102
8103 2008-04-17 Cary Coutant <ccoutant@google.com>
8104
8105 * errors.cc (Errors::info): New function.
8106 (gold_info): New function.
8107 * errors.h (Errors::info): New function.
8108 * gold.h (gold_info): New function.
8109 * object.cc (Input_objects::add_object): Print trace output.
8110 * options.cc (options::parse_set): New function.
8111 (General_options::parse_wrap): Deleted.
8112 (General_options::General_options): Deleted initializer.
8113 * options.h (options::String_set): New typedef.
8114 (options::parse_set): New function.
8115 (DEFINE_set): New macro.
8116 (General_options::wrap): Changed to use DEFINE_set. Changed
8117 callers of any_wrap_symbols and is_wrap_symbol.
8118 (General_options::trace, General_options::trace_symbol):
8119 New options.
8120 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
8121 (General_options::wrap_symbols_): Deleted.
8122 * symtab.cc (Symbol_table::add_from_object): Print trace output.
8123
8124 2008-04-17 David S. Miller <davem@davemloft.net>
8125
8126 * options.cc (General_options::parse_V): New function.
8127 * options.h: Add entries for -V and -Qy.
8128
8129 2008-04-17 Ian Lance Taylor <iant@google.com>
8130
8131 * common.cc (Symbol_table::allocate_commons): Remove options
8132 parameter. Change caller.
8133 (Symbol_table::do_allocate_commons): Remove options parameter.
8134 Change caller. Just call do_allocate_commons_list twice.
8135 (Symbol_table::do_allocate_commons_list): New function, broken out
8136 of do_allocate_commons.
8137 * common.h (class Allocate_commons_task): Remove options_ field.
8138 Update constructor.
8139 * symtab.cc (Symbol_table::Symbol_table): Initialize
8140 tls_commons_.
8141 (Symbol_table::add_from_object): Put TLS common symbols on
8142 tls_commons_ list.
8143 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
8144 which are IN_OUTPUT_DATA.
8145 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
8146 allocate_commons and do_allocate_commons declarations. Declare
8147 do_allocate_commons_list.
8148 * gold.cc (queue_middle_tasks): Update creation of
8149 Allocate_commons_task to not pass options.
8150 * testsuite/Makefile.am (INCLUDES): Add -I.. .
8151 (TLS_TEST_C_FLAGS): New variable.
8152 (tls_test_c_pic.o): New target.
8153 (tls_test_shared.so): Link in tls_test_c_pic.o.
8154 (tls_test_c_pic_ie.o): New target.
8155 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
8156 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
8157 (tls_test_c.o): New target.
8158 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
8159 (tls_pic_test_LDADD): Likewise.
8160 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
8161 (tls_shared_gd_to_ie_test_LDADD): Likewise.
8162 (tls_test_c_gnu2.o): New target.
8163 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
8164 tls_test_c_gnu2.o.
8165 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
8166 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
8167 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
8168 * testsuite/tls_test.cc: Include "config.h".
8169 (t_last): Call t11_last.
8170 * testsuite/tls_test.h (t11, t11_last): Declare.
8171 * testsuite/tls_test_c.c: New file.
8172 * testsuite/tls_test_main.cc (thread_routine): Call t11.
8173 * configure.ac: Check for OpenMP support.
8174 * configure, config.in, Makefile.in: Rebuild.
8175 * testsuite/Makefile.in: Rebuild.
8176
8177 2008-04-16 Cary Coutant <ccoutant@google.com>
8178
8179 * i386.cc (Target_i386::define_tls_base_symbol): New function.
8180 (Target_i386::tls_base_symbol_defined_): New field.
8181 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8182 (Target_i386::Scan::global): Likewise.
8183 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
8184 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
8185 (Target_x86_64::tls_base_symbol_defined_): New field.
8186 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
8187 (Target_x86_64::Scan::global): Likewise.
8188
8189 2008-04-16 Cary Coutant <ccoutant@google.com>
8190
8191 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
8192 (Symbol::needs_plt_entry): Allow weak undefined symbols.
8193 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
8194 building shared libraries.
8195 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
8196 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
8197 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
8198 * testsuite/Makefile.in: Rebuild.
8199 * testsuite/weak_undef.h: New file.
8200 * testsuite/weak_undef_file1.cc: Add extra test cases.
8201 * testsuite/weak_undef_file2.cc: Likewise.
8202 * testsuite/weak_undef_test.cc: Likewise.
8203
8204 2008-04-16 David S. Miller <davem@davemloft.net>
8205
8206 * sparc.cc (Target_sparc::Scan): Change from struct to class.
8207 Add issued_non_pic_error_ field. Declare check_non_pic.
8208 (Target_sparc::Scan::check_non_pic): New function.
8209 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
8210 (Target_sparc::Scan::global): Likewise.
8211
8212 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
8213 * configure: Rebuild.
8214
8215 * options.h (DEFINE_enable): New macro.
8216 (new_dtags): New enable option.
8217 (initfirst, interpose, loadfltr, nodefaultlib,
8218 nodelete, nodlopen, nodump): New -z options.
8219 * layout.cc (Layout:finish_dynamic_section): If new
8220 dtags enabled, emit DT_RUNPATH. Also, emit a
8221 DT_FLAGS_1 containing any specified -z flags.
8222
8223 2008-04-16 Ian Lance Taylor <iant@google.com>
8224
8225 * copy-relocs.cc: New file.
8226 * copy-relocs.h: New file.
8227 * reloc.cc: Remove Copy_relocs code.
8228 * reloc.h: Likewise.
8229 * reloc-types.h (struct Reloc_types) [both versions]: Add
8230 get_reloc_addend_noerror.
8231 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
8232 variants of add_global which take an addend which must be zero.
8233 * i386.cc: Include "copy-relocs.h".
8234 (class Target_i386): Change type of copy_relocs_ to variable,
8235 update initializer.
8236 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
8237 Change all callers.
8238 (Target_i386::do_finalize_sections): Change handling of
8239 copy_relocs_.
8240 * sparc.cc: Include "copy-relocs.h".
8241 (class Target_sparc): Change type of copy_relocs_ to variable,
8242 update initializer.
8243 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
8244 Change all callers.
8245 (Target_sparc::do_finalize_sections): Change handling of
8246 copy_relocs_.
8247 * x86_64.cc: Include "copy-relocs.h".
8248 (class Target_x86_64): Change type of copy_relocs_ to variable,
8249 update initializer.
8250 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
8251 class. Change all callers.
8252 (Target_x86_64::do_finalize_sections): Change handling of
8253 copy_relocs_.
8254 * Makefile.am (CCFILES): Add copy-relocs.cc.
8255 (HFILES): Add copy-relocs.h.
8256
8257 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
8258
8259 * testsuite/script_test_4.sh: Permit leading zeroes.
8260
8261 2008-04-15 Ian Lance Taylor <iant@google.com>
8262
8263 * script-sections.cc (Script_sections::create_segments): Use
8264 header_size_adjustment even when there is enough room for the
8265 headers.
8266 * testsuite/script_test_4.sh: New file.
8267 * testsuite/script_test_4.t: New file.
8268 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
8269 (check_DATA): Add script_test_4.stdout.
8270 (MOSTLYCLEANFILES): Likewise.
8271 (script_test_4): New target.
8272 (script_test_4.stdout): New target.
8273 * testsuite/Makefile.in: Rebuild.
8274
8275 * sparc.cc: Add definitions for Output_data_plt_sparc class
8276 constants.
8277
8278 2008-04-14 David S. Miller <davem@davemloft.net>
8279
8280 * sparc.cc: New file.
8281 * Makefile.am (TARGETSOURCES): Add sparc.cc
8282 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
8283 * configure.tgt: Document targ_extra_size and
8284 targ_extra_big_endian. Add entries for sparc-* and
8285 sparc64-*.
8286 * configure.ac: Handle targ_extra_size and
8287 targ_extra_big_endian.
8288 * Makefile.in: Rebuild.
8289 * configure: Likewise.
8290 * po/POTFILES.in: Likewise.
8291 * po/gold.pot: Likewise.
8292
8293 2008-04-14 Ian Lance Taylor <iant@google.com>
8294
8295 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
8296 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
8297 in the name/type/flags to section mapping. Don't call
8298 allocate_output_section.
8299 (Layout::choose_output_section): Change parameter from adjust_name
8300 to is_input_section. Don't permit input sections after sections
8301 are attached to segments. Don't call allocate_output_section.
8302 (Layout::layout_eh_frame): Call update_flags_for_input_section,
8303 not write_enable_output_section.
8304 (Layout::make_output_section): Don't push to
8305 unattached_section_list_ nor call attach_to_segment. Call
8306 attach_section_to_segment if sections are attached.
8307 (Layout::attach_sections_to_segments): New function.
8308 (Layout::attach_section_to_segment): New function.
8309 (Layout::attach_allocated_section_to_segment): Rename from
8310 attach_to_segment. Remove flags parameter.
8311 (Layout::allocate_output_section): Remove function.
8312 (Layout::write_enable_output_section): Remove function.
8313 * layout.h (class Layout): Update for above changes. Add new
8314 field sections_are_attached_.
8315 * output.h (Output_section::update_flags_for_input_section): New
8316 function.
8317 * output.cc (Output_section::add_input_section): Call
8318 update_flags_for_input_section.
8319 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
8320
8321 2008-04-11 Cary Coutant <ccoutant@google.com>
8322
8323 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
8324 thought unnecessary.
8325 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
8326
8327 2008-04-11 Ian Lance Taylor <iant@google.com>
8328
8329 * output.h (class Output_section_data): Remove inline definition
8330 of set_addralign.
8331 * output.cc (Output_section_data::set_addralign): New function.
8332
8333 2008-04-11 Cary Coutant <ccoutant@google.com>
8334
8335 Add support for TLS descriptors for i386 and x86_64.
8336 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
8337 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
8338 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
8339 GOT_TYPE_TLS_DESC.
8340 (Target_i386::got_mod_index_entry): Remove unnecessary code.
8341 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
8342 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
8343 relocations.
8344 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
8345 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
8346 Fix problem with initial-exec relocations.
8347 (Target_i386::Relocate::relocate_tls): Likewise.
8348 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
8349 relaxation.
8350 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
8351 support for section-plus-offset dynamic table entries.
8352 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
8353 (Output_data_dynamic::Dynamic_entry): Add support for
8354 section-plus-offset dynamic table entries.
8355 (Output_data_dynamic::Classification): Likewise.
8356 (Output_data_dynamic::classification_): Renamed offset_.
8357 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
8358 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
8359 (Target_x86_64::make_plt_section): New function.
8360 (Target_x86_64::reserve_tlsdesc_entries): New function.
8361 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
8362 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
8363 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
8364 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
8365 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
8366 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
8367 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
8368 add extra PLT entry for TLS descriptors.
8369 (Output_data_plt_x86_64::got_): New field.
8370 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
8371 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
8372 fields.
8373 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
8374 descriptors.
8375 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
8376 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
8377 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
8378 R_386_TLS_DESC_CALL relocations.
8379 (Target_x86_64::Scan::global): Likewise.
8380 (Target_x86_64::do_finalize_sections): Add dynamic table entries
8381 for TLS descriptors.
8382 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
8383 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
8384 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
8385 GD-to-IE relaxation.
8386 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
8387 and TLS_DESCRIPTORS.
8388 * Makefile.in: Rebuild.
8389 * configure: Rebuild.
8390 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
8391 (tls_test_shared2.so): New target.
8392 (tls_shared_gd_to_ie_test_SOURCES): New variable.
8393 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
8394 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
8395 (tls_shared_gd_to_ie_test_LDADD): New variable.
8396 (tls_shared_gnu2_gd_to_ie_test): New target.
8397 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
8398 New targets.
8399 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
8400 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
8401 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
8402 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
8403 (tls_shared_gnu2_test): New target.
8404 (tls_test_gnu2_shared.so): New target.
8405 (tls_shared_gnu2_test_SOURCES): New variable.
8406 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
8407 (tls_shared_gnu2_test_LDFLAGS): New variable.
8408 (tls_shared_gnu2_test_LDADD): New variable.
8409 * testsuite/Makefile.in: Rebuild.
8410 * testsuite/Makefile.
8411
8412 2008-04-11 Ian Lance Taylor <iant@google.com>
8413
8414 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
8415 justsyms.t.
8416 * testsuite/Makefile.in: Rebuild.
8417
8418 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
8419 long.
8420 * testsuite/script_test_2.cc (main): Adjust test.
8421
8422 2008-04-11 David S. Miller <davem@davemloft.net>
8423 Ian Lance Taylor <iant@google.com>
8424
8425 * options.h (General_options): Add entries for '-Y' and
8426 '-relax'.
8427 * options.cc (General_options:finalize): If -Y was used, add those
8428 entries to the library path instead of the default "/lib" and
8429 "/usr/lib".
8430
8431 2008-04-11 David S. Miller <davem@davemloft.net>
8432
8433 * testsuite/justsyms.t: Start at 0x100.
8434 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
8435 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
8436 long.
8437 * testsuite/script_test_2.cc: Adjust string and section length
8438 checks.
8439
8440 2008-04-09 Ian Lance Taylor <iant@google.com>
8441
8442 PR gold/5996
8443 * script-sections.cc (Sections_element::allocate_to_segment): Add
8444 orphan parameter.
8445 (Output_section_definition::allocate_to_segment): Likewise.
8446 (Orphan_output_section::allocate_to_segment): Likewise.
8447 (Script_sections::attach_sections_using_phdrs_clause): Don't
8448 propagate non-PT_LOAD segments to orphan sections.
8449 * testsuite/Makefile.am (script_test_3.stdout): Generate using
8450 readelf rather than objdump.
8451 * testsuite/script_test_3.sh: Adjust accordingly. Test that
8452 .interp section and PT_INTERP segment are the same size.
8453 * testsuite/Makefile.in: Rebuild.
8454
8455 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
8456 aliases for symbols defined in the same object.
8457 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
8458 (weak_alias_test_SOURCES): New variable.
8459 (weak_alias_test_DEPENDENCIES): New variable.
8460 (weak_alias_test_LDFLAGS): New variable.
8461 (weak_alias_test_LDADD): New variable.
8462 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
8463 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
8464 (weak_alias_test_3.o): New target.
8465 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
8466 * testsuite/weak_alias_test_main.cc: New file.
8467 * testsuite/weak_alias_test_1.cc: New file.
8468 * testsuite/weak_alias_test_2.cc: New file.
8469 * testsuite/weak_alias_test_3.cc: New file.
8470
8471 2008-04-08 Ian Lance Taylor <iant@google.com>
8472
8473 * options.h (class General_options): Add --noinhibit-exec option.
8474 * main.cc (main): Check --noinhibit-exec.
8475
8476 * options.h (class General_options): Define --wrap as a special
8477 option. Add wrap_symbols_ field.
8478 (General_options::any_wrap_symbols): New function.
8479 (General_options::is_wrap_symbol): New function.
8480 * options.cc (General_options::parse_wrap): New function.
8481 (General_options::General_options): Initialize wrap_symbols_.
8482 * symtab.cc (Symbol_table::wrap_symbol): New function.
8483 (Symbol_table::add_from_object): Handle --wrap.
8484 * symtab.h (class Symbol_table): Declare wrap_symbol.
8485 * target.h (Target::wrap_char): New function.
8486 (Target::Target_info): Add wrap_char field.
8487 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
8488 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8489 * testsuite/testfile.cc (Target_test::test_target_info):
8490 Likewise.
8491
8492 * errors.cc (Errors::undefined_symbol): Mention symbol version if
8493 there is one.
8494
8495 * layout.h (class Layout): Add added_eh_frame_data_ field.
8496 * layout.cc (Layout::Layout): Initialize new field.
8497 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
8498 output section until we find a section we merged successfully.
8499 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
8500 that the size be non-zero.
8501
8502 * merge.cc (Object_merge_map::get_output_offset): Remove inline
8503 qualifier.
8504
8505 2008-04-08 Craig Silverstein <csilvers@google.com>
8506
8507 * configure.ac: Export new conditional variable HAVE_ZLIB.
8508 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
8509 on HAVE_ZLIB.
8510 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
8511 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8512
8513 2008-04-07 Ian Lance Taylor <iant@google.com>
8514
8515 * version.cc (version_string): Set to "1.5".
8516
8517 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
8518 Add issued_non_pic_error_ field. Declare check_non_pic.
8519 (Target_x86_64::Scan::check_non_pic): New function.
8520 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
8521 (Target_x86_64::Scan::global): Likewise.
8522
8523 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
8524 addend parameter. Change caller. Handle merge sections.
8525 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
8526 Address to Addend. Don't add in the result of
8527 local_section_offset, pass down the addend and use the returned
8528 value.
8529 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
8530 Update declarations of local_section_offset and symbol_value.
8531 * testsuite/two_file_test_1.cc (t18): New function.
8532 * testsuite/two_file_test_2.cc (f18): New function.
8533 * testsuite/two_file_test_main.cc (main): Call t18.
8534 * testsuite/two_file_test.h (t18, f18): Declare.
8535
8536 * configure.ac: Don't test for objdump, c++filt, or readelf.
8537 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
8538 conditionals.
8539 (TEST_READELF): New variable.
8540 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
8541 (check_PROGRAMS): Add two_file_strip_test.
8542 (two_file_strip_test): New target.
8543 (check_PROGRAMS): Add two_file_same_shared_strip_test.
8544 (two_file_same_shared_strip_test_SOURCES): New variable.
8545 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
8546 (two_file_same_shared_strip_test_LDFLAGS): New variable.
8547 (two_file_same_shared_strip_test_LDADD): New variable.
8548 (two_file_shared_strip.so): New target.
8549 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
8550 (ver_test_5.syms, ver_test_7.syms): Likewise.
8551 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
8552 (strip_test_3.stdout): Use TEST_OBJDUMP.
8553 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8554
8555 2008-04-04 Cary Coutant <ccoutant@google.com>
8556
8557 * symtab.h (Symbol::is_weak_undefined): New function.
8558 (Symbol::is_strong_undefined): New function.
8559 (Symbol::is_absolute): New function.
8560 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
8561 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
8562 absolute symbols.
8563 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
8564 (weak_undef_test): New target.
8565 * testsuite/Makefile.in: Rebuild.
8566 * testsuite/weak_undef_file1.cc: New file.
8567 * testsuite/weak_undef_file2.cc: New file.
8568 * testsuite/weak_undef_test.cc: New file.
8569
8570 2008-04-03 Craig Silverstein <csilvers@google.com>
8571
8572 * compressed_output.h (class Output_compressed_section): Use
8573 unsigned buffer.
8574 * compressed_output.cc (zlib_compress): Use unsigned buffers,
8575 add zlib header.
8576 (zlib_compressed_suffix): Removed.
8577 (Output_compressed_section::set_final_data_size): Use unsigned
8578 buffers.
8579 * testsuite/Makefile.am (flagstest_compress_debug_sections):
8580 Fix linker invocation.
8581 (flagstest_o_specialfile_and_compress_debug_sections):
8582 Likewise.
8583 * testsuite/Makefile.in: Regenerated.
8584
8585 2008-04-02 David S. Miller <davem@davemloft.net>
8586
8587 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
8588 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
8589
8590 2008-04-02 Craig Silverstein <csilvers@google.com>
8591
8592 * TODO: New file.
8593
8594 2008-04-02 Ian Lance Taylor <iant@google.com>
8595
8596 * fileread.cc (File_read::find_view): Add byteshift and vshifted
8597 parameters. Update for new key type to views_. Change all
8598 callers.
8599 (File_read::read): Adjust for byteshift in returned view.
8600 (File_read::add_view): New function, broken out of
8601 find_and_make_view.
8602 (File_read::make_view): New function, broken out of
8603 find_and_make_view.
8604 (File_read::find_or_make_view): Add offset and aligned
8605 parameters. Rewrite accordingly. Change all callers.
8606 (File_read::get_view): Add offset and aligned parameters. Adjust
8607 for byteshift in return value.
8608 (File_read::get_lasting_view): Likewise.
8609 * fileread.h (class File_read): Update declarations.
8610 (class File_read::View): Add byteshift_ field. Add byteshift to
8611 constructor. Add byteshift method.
8612 * archive.h (Archive::clear_uncached_views): New function.
8613 (Archive::get_view): Add aligned parameter. Change all callers.
8614 * object.h (Object::get_view): Add aligned parameter. Change all
8615 callers.
8616 (Object::get_lasting_view): Likewise.
8617
8618 * fileread.cc (File_read::release): Don't call clear_views if
8619 there are multiple objects.
8620 * fileread.h (File_read::clear_uncached_views): New function.
8621 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
8622 on the archive.
8623
8624 2008-03-31 Cary Coutant <ccoutant@google.com>
8625
8626 Add thin archive support.
8627 * archive.cc (Archive::armagt): New const.
8628 (Archive::setup): Remove task parameter and calls to unlock.
8629 (Archive::unlock_nested_archives): New function.
8630 (Archive::read_header): Add nested_off parameter. Change
8631 all callers.
8632 (Archive::interpret_header): Likewise.
8633 (Archive::include_all_members): Change to handle thin
8634 archives.
8635 (Archive::include_member): Likewise.
8636 * archive.h (Archive::Archive): Add new parameters and
8637 initializers.
8638 (Archive::armagt): New const.
8639 (Archive::setup): Remove task parameter.
8640 (Archive::unlock_nested_archives): New function.
8641 (Archive::read_header): Add nested_off parameter.
8642 (Archive::interpret_header): Likewise.
8643 (Archive::Nested_archive_table): New typedef.
8644 (Archive::is_thin_archive_): New field.
8645 (Archive::nested_archives_): New field.
8646 (Archive::options_): New field.
8647 (Archive::dirpath_): New field.
8648 (Archive::task_): New field.
8649 * readsyms.cc (Read_symbols::do_read_symbols): Add check
8650 for thin archives. Pass additional parameters to
8651 Archive::Archive. Unlock the archive file after calling
8652 Archive::setup.
8653
8654 2008-03-29 Ian Lance Taylor <iant@google.com>
8655
8656 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
8657 version symbol to be local.
8658 * testsuite/ver_test_4.sh: New file.
8659 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
8660 (check_DATA): Add ver_test_4.syms.
8661 (ver_test_4.syms): New target.
8662 * testsuite/Makefile.in: Rebuild.
8663
8664 * output.cc
8665 (Output_section::Input_section_sort_entry::has_priority): New
8666 function.
8667 (Output_section::Input_section_sort_entry::match_file_name): New
8668 function.
8669 (Output_section::Input_section_sort_entry::match_section_name):
8670 Remove.
8671 (Output_section::Input_section_sort_entry::match_section_name_prefix):
8672 Remove.
8673 (Output_section::Input_section_sort_entry::match_section_file):
8674 Remove.
8675 (Output_section::Input_section_sort_compare::operator()): Rewrite
8676 using new Input_section_sort_entry functions. Sort crtbegin and
8677 crtend first. Sort sections with no priority before sections with
8678 a priority.
8679 * testsuite/initpri1.c (d3): Check j != 4.
8680 (cd5): New constructor/destructor function.
8681 (main): Check j != 2.
8682
8683 * symtab.cc (Symbol_table::add_from_object): If we don't use the
8684 new symbol when resolving, don't call set_is_default.
8685 * testsuite/ver_test_7.cc: New file.
8686 * testsuite/ver_test_7.sh: New file.
8687 * testsuite/Makefile.am (ver_test_7.so): New target.
8688 (ver_test_7.o): New target.
8689 (check_SCRIPTS): Add ver_test_7.sh.
8690 (check_DATA): Add ver_test_7.syms.
8691 (ver_test_7.syms): New target.
8692
8693 2008-03-28 Ian Lance Taylor <iant@google.com>
8694
8695 * layout.cc (Layout::layout): If we see an input section with a
8696 name that needs sorting, set the must_sort flag for the output
8697 section.
8698 (Layout::make_output_section): If the name of the output section
8699 indicates that it might require sorting, set the may_sort flag.
8700 * output.h (Output_section::may_sort_attached_input_sections): New
8701 function.
8702 (Output_section::set_may_sort_attached_input_sections): New
8703 function.
8704 (Output_section::must_sort_attached_input_sections): New
8705 function.
8706 (Output_section::set_must_sort_attached_input_sections): New
8707 function.
8708 (class Output_section): Declare Input_section_sort_entry. Define
8709 Input_section_sort_compare. Declare
8710 sort_attached_input_sections. Add new fields:
8711 may_sort_attached_input_sections_,
8712 must_sort_attached_input_sections_,
8713 attached_input_sections_are_sorted_.
8714 * output.cc (Output_section::Output_section): Initialize new
8715 fields.
8716 (Output_section::add_input_section): Add an entry to
8717 input_sections_ if may_sort or must_sort are true.
8718 (Output_section::set_final_data_size): Call
8719 sort_attached_input_sections if necessary.
8720 (Output_section::Input_section_sort_entry): Define new class.
8721 (Output_section::Input_section_sort_compare::operator()): New
8722 function.
8723 (Output_section::sort_attached_input_sections): New function.
8724 * configure.ac: Check whether the compiler supports constructor
8725 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
8726 * testsuite/initpri1.c: New file.
8727 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
8728 CONSTRUCTOR_PRIORITY.
8729 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
8730 (initpri1_LDFLAGS): New variable.
8731 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8732
8733 2008-03-27 Ian Lance Taylor <iant@google.com>
8734
8735 * common.cc (Sort_commons::operator): Correct sorting algorithm.
8736 * testsuite/common_test_1.c: New file.
8737 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
8738 (common_test_1_SOURCES): New variable.
8739 (common_test_1_DEPENDENCIES): New variable.
8740 (common_test_1_LDFLAGS): New variable.
8741
8742 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
8743 and commons_ correctly when NAME/VERSION does not override
8744 NAME/NULL.
8745 * testsuite/ver_test_6.c: New file.
8746 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
8747 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
8748 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
8749
8750 2008-03-26 Ian Lance Taylor <iant@google.com>
8751
8752 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
8753 of an undefined symbol from a version script.
8754 * testsuite/Makefile.am (ver_test_5.so): New target.
8755 (ver_test_5.o): New target.
8756 (check_SCRIPTS): Add ver_test_5.sh.
8757 (check_DATA): Add ver_test_5.syms.
8758 (ver_test_5.syms): New target.
8759 * testsuite/ver_test_5.cc: New file.
8760 * testsuite/ver_test_5.script: New file.
8761 * testsuite/ver_test_5.sh: New file.
8762 * Makefile.in, testsuite/Makefile.in: Rebuild.
8763
8764 PR gold/5986
8765 Fix problems building gold with gcc 4.3.0.
8766 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
8767 (gold_error_at_location, gold_warning_at_location): Use it.
8768 * configure.ac: Check whether we can compile and use a template
8769 function with a printf attribute.
8770 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
8771 when jumping over bytes.
8772 * object.cc: Instantiate Object::read_section_data.
8773 * debug.h: Include <cstring>
8774 * dwarf_reader.cc: Include <algorithm>
8775 * main.cc: Include <cstring>.
8776 * options.cc: Include <cstring>.
8777 * output.cc: Include <cstring>.
8778 * script.cc: Include <cstring>.
8779 * script.h: Include <string>.
8780 * symtab.cc: Include <cstring> and <algorithm>.
8781 * target-select.cc: Include <cstring>.
8782 * version.cc: Include <string>.
8783 * testsuite/testmain.cc: Include <cstdlib>.
8784 * configure, config.in: Rebuild.
8785
8786 2008-03-25 Ian Lance Taylor <iant@google.com>
8787
8788 * options.cc: Include "../bfd/bfdver.h".
8789 (options::help): Print bug reporting address.
8790
8791 * version.cc (print_version): Adjust output for current value of
8792 BFD_VERSION_STRING.
8793
8794 * NEWS: New file.
8795
8796 * options.cc (options::help): Print list of supported targets.
8797 * target-select.h: Include <vector>.
8798 (class Target_selector): Make machine_, size_, and is_big_endian_
8799 fields const. Add bfd_name_ and instantiated_target_ fields.
8800 (Target_selector::Target_selector): Add bfd_name parameter.
8801 (Target_selector::recognize): Make non-virtual, call
8802 do_recognize.
8803 (Target_selector::recognize_by_name): Make non-virtual, call
8804 do_recognize_by_name.
8805 (Target_selector::supported_names): New function.
8806 (Target_selector::bfd_name): New function.
8807 (Target_selector::do_instantiate_target): New pure virtual
8808 function.
8809 (Target_selector::do_recognize): New virtual function.
8810 (Target_selector::do_recognize_by_name): New virtual function.
8811 (Target_selector::instantiate_target): New private function.
8812 (supported_target_names): Declare.
8813 * target-select.cc (Target_selector::Target_selector): Update for
8814 new parameter and fields.
8815 (select_target_by_name): Check that the name matches before
8816 calling recognize_by_name.
8817 (supported_target_names): New function.
8818 * i386.cc (class Target_selector_i386): Update Target_selector
8819 constructor call. Remove recognize and recognize_by_name. Add
8820 do_instantiate_target.
8821 * x86_64.cc (class Target_selector_x86_64): Likewise.
8822 * testsuite/testfile.cc (class Target_selector_test): Update for
8823 changes to Target_selector.
8824
8825 * README: Rewrite, with some notes on unsupported features.
8826
8827 2008-03-24 Cary Coutant <ccoutant@google.com>
8828
8829 * i386.cc (Target_i386::Got_type): New enum declaration.
8830 (Target_i386::Scan::local): Updated callers of Output_data_got
8831 member functions.
8832 (Target_i386::Scan::global): Likewise.
8833 (Target_i386::Relocate::relocate): Likewise.
8834 (Target_i386::Relocate::relocate_tls): Likewise.
8835 * object.h (Got_offset_list): New class.
8836 (Sized_relobj::local_has_got_offset): Added got_type parameter.
8837 (Sized_relobj::local_got_offset): Likewise.
8838 (Sized_relobj::set_local_got_offset): Likewise.
8839 (Sized_relobj::local_has_tls_got_offset): Removed.
8840 (Sized_relobj::local_tls_got_offset): Removed.
8841 (Sized_relobj::set_local_tls_got_offset): Removed.
8842 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
8843 * output.cc (Output_data_got::add_global): Added got_type parameter.
8844 (Output_data_got::add_global_with_rel): Likewise.
8845 (Output_data_got::add_global_with_rela): Likewise.
8846 (Output_data_got::add_global_pair_with_rel): New function.
8847 (Output_data_got::add_global_pair_with_rela): New function.
8848 (Output_data_got::add_local): Added got_type parameter.
8849 (Output_data_got::add_local_with_rel): Likewise.
8850 (Output_data_got::add_local_with_rela): Likewise.
8851 (Output_data_got::add_local_pair_with_rel): New function.
8852 (Output_data_got::add_local_pair_with_rela): New function.
8853 (Output_data_got::add_global_tls): Removed.
8854 (Output_data_got::add_global_tls_with_rel): Removed.
8855 (Output_data_got::add_global_tls_with_rela): Removed.
8856 (Output_data_got::add_local_tls): Removed.
8857 (Output_data_got::add_local_tls_with_rel): Removed.
8858 (Output_data_got::add_local_tls_with_rela): Removed.
8859 * output.h (Output_data_got::add_global): Added got_type parameter.
8860 (Output_data_got::add_global_with_rel): Likewise.
8861 (Output_data_got::add_global_with_rela): Likewise.
8862 (Output_data_got::add_global_pair_with_rel): New function.
8863 (Output_data_got::add_global_pair_with_rela): New function.
8864 (Output_data_got::add_local): Added got_type parameter.
8865 (Output_data_got::add_local_with_rel): Likewise.
8866 (Output_data_got::add_local_with_rela): Likewise.
8867 (Output_data_got::add_local_pair_with_rel): New function.
8868 (Output_data_got::add_local_pair_with_rela): New function.
8869 (Output_data_got::add_global_tls): Removed.
8870 (Output_data_got::add_global_tls_with_rel): Removed.
8871 (Output_data_got::add_global_tls_with_rela): Removed.
8872 (Output_data_got::add_local_tls): Removed.
8873 (Output_data_got::add_local_tls_with_rel): Removed.
8874 (Output_data_got::add_local_tls_with_rela): Removed.
8875 * resolve.cc (Symbol::override_base_with_special): Removed
8876 reference to has_got_offset_ field.
8877 * symtab.cc (Symbol::init_fields): Replaced initialization
8878 of got_offset_ with got_offsets_. Removed initialization
8879 of has_got_offset_
8880 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
8881 (Symbol::got_offset): Likewise.
8882 (Symbol::set_got_offset): Likewise.
8883 (Symbol::has_tls_got_offset): Removed.
8884 (Symbol::tls_got_offset): Removed.
8885 (Symbol::set_tls_got_offset): Removed.
8886 (Symbol::got_offset_): Removed.
8887 (Symbol::tls_mod_got_offset_): Removed.
8888 (Symbol::tls_pair_got_offset_): Removed.
8889 (Symbol::got_offsets_): New field.
8890 (Symbol::has_got_offset): Removed.
8891 (Symbol::has_tls_mod_got_offset): Removed.
8892 (Symbol::has_tls_pair_got_offset): Removed.
8893 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
8894 (Target_x86_64::Scan::local): Updated callers of Output_data_got
8895 member functions.
8896 (Target_x86_64::Scan::global): Likewise.
8897 (Target_x86_64::Relocate::relocate): Likewise.
8898 (Target_x86_64::Relocate::relocate_tls): Likewise.
8899
8900 2008-03-25 Ben Elliston <bje@au.ibm.com>
8901
8902 * yyscript.y: Fix spelling error in comment.
8903
8904 2008-03-24 Ian Lance Taylor <iant@google.com>
8905
8906 * options.h (class General_options): Define build_id option.
8907 * layout.h (class Layout): Declare write_build_id, create_note,
8908 create_build_id. Add build_id_note_ member.
8909 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
8910 "libiberty.h", "md5.h", "sha1.h".
8911 (Layout::Layout): Initialize eh_frame_data_,
8912 eh_frame_hdr_section_, and build_id_note_.
8913 (Layout::finalize): Call create_build_id.
8914 (Layout::create_note): New function, broken out of
8915 Layout::create_gold_note.
8916 (Layout::create_gold_note): Call create_note.
8917 (Layout::create_build_id): New function.
8918 (Layout::write_build_id): New function.
8919 (Close_task_runner::run): Call write_build_id.
8920
8921 * x86_64.cc: Correct license to GPLv3.
8922
8923 2008-03-23 Ian Lance Taylor <iant@google.com>
8924
8925 * options.cc: Include "demangle.h".
8926 (parse_optional_string): New function.
8927 (parse_long_option): Handle takes_optional_argument.
8928 (parse_short_option): Update dash_z initializer. Handle
8929 takes_optional_argument.
8930 (General_options::General_options): Initialize do_demangle_.
8931 (General_options::finalize): Set do_demangle_. Handle demangling
8932 style.
8933 * options.h (parse_optional_string): Declare.
8934 (struct One_option): Add optional_arg field. Update constructor.
8935 Update call constructor calls. Add takes_optional_argument
8936 function.
8937 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
8938 (DEFINE_optional_string): Define.
8939 (General_options::demangle): Change from DEFINE_bool to
8940 DEFINE_optional_string.
8941 (General_options::no_demangle): New function.
8942 (General_options::do_demangle): New function.
8943 (General_options::set_do_demangle): New function.
8944 (General_options::execstack_status_): Move definition to end of
8945 class definition.
8946 (General_options::static_): Likewise.
8947 (General_options::do_demangle_): New field.
8948 * object.cc (big_endian>::get_symbol_location_info): Call
8949 Options::do_demangle, not Options::demangle.
8950 * symtab.cc (demangle): Likewise.
8951
8952 2008-03-22 Ian Lance Taylor <iant@google.com>
8953
8954 * gold.h: Include <cstddef> and <sys/types.h>
8955 * options.h: Include <cstring>.
8956
8957 2008-03-21 Ian Lance Taylor <iant@google.com>
8958
8959 * Added source code to GNU binutils.
This page took 0.215219 seconds and 5 git commands to generate.