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