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