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