1 2011-09-23 Simon Baldwin <simonb@google.com>
3 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5 * configure: Regenerate.
6 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
7 * Makefile.in: Regenerate.
8 * testsuite/Makefile.in: Regenerate.
10 2011-09-19 Sriraman Tallam <tmsriram@google.com>
12 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
14 2011-09-19 Cary Coutant <ccoutant@google.com>
16 * incremental.cc (can_incremental_update): Fix typo in comment.
17 * incremental.h (can_incremental_update): Likewise.
19 2011-09-18 Cary Coutant <ccoutant@google.com>
21 * incremental.cc (can_incremental_update): New function.
22 * incremental.h (can_incremental_update): New function.
23 * layout.cc (Layout::init_fixed_output_section): Call it.
24 (Layout::make_output_section): Don't allow patch space in .eh_frame.
25 * object.cc (Sized_relobj_file::do_layout): Call
26 can_incremental_update.
28 2011-09-13 Cary Coutant <ccoutant@google.com>
30 * configure.ac: Check for glibc support for gnu_indirect_function
31 support with static linking, setting automake conditional
33 * Makefile.in: Regenerate.
34 * configure: Regenerate.
36 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
37 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
39 * testsuite/Makefile.in: Regenerate.
41 2011-09-13 Cary Coutant <ccoutant@google.com>
43 * incremental.cc (Sized_relobj_incr::do_layout): Call
44 report_comdat_group for kept comdat sections.
45 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
46 * testsuite/Makefile.in: Regenerate.
47 * testsuite/incr_comdat_test_1.cc: New source file.
48 * testsuite/incr_comdat_test_2_v1.cc: New source file.
49 * testsuite/incr_comdat_test_2_v2.cc: New source file.
50 * testsuite/incr_comdat_test_2_v3.cc: New source file.
52 2011-09-13 Ian Lance Taylor <iant@google.com>
54 * object.cc (Sized_relobj_file::do_layout): Remove unused local
55 variable external_symbols_offset.
57 2011-09-12 Ian Lance Taylor <iant@google.com>
59 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
60 triggered if object has no symbols.
62 2011-09-09 David S. Miller <davem@davemloft.net>
64 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
65 (Output_fill_debug_line::do_write): Likewise.
67 2011-08-29 Cary Coutant <ccoutant@google.com>
69 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
70 casts to match formatting specs.
71 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
73 2011-08-26 Cary Coutant <ccoutant@google.com>
75 * layout.cc (Free_list::allocate): Provide guarantee of minimum
76 remaining hole size when allocating.
77 (Layout::make_output_section): Set fill methods for debug sections.
78 * layout.h (Free_list::Free_list_node): Move from private to
80 (Free_list::set_min_hole_size): New function.
81 (Free_list::begin, Free_list::end): New functions.
82 (Free_list::min_hole_): New data member.
83 * output.cc: Include dwarf.h.
84 (Output_fill_debug_info::do_minimum_hole_size): New function.
85 (Output_fill_debug_info::do_write): New function.
86 (Output_fill_debug_line::do_minimum_hole_size): New function.
87 (Output_fill_debug_line::do_write): New function.
88 (Output_section::Output_section): Initialize new data member.
89 (Output_section::set_final_data_size): Ensure patch space is larger
90 than minimum hole size.
91 (Output_section::do_write): Fill holes in debug sections.
92 * output.h (Output_fill): New class.
93 (Output_fill_debug_info): New class.
94 (Output_fill_debug_line): New class.
95 (Output_section::set_free_space_fill): New function.
96 (Output_section::free_space_fill_): New data member.
97 * testsuite/Makefile.am (incremental_test_3): Add
98 --incremental-patch option.
99 (incremental_test_4): Likewise.
100 (incremental_test_5): Likewise.
101 (incremental_test_6): Likewise.
102 (incremental_copy_test): Likewise.
103 (incremental_common_test_1): Likewise.
104 * testsuite/Makefile.in: Regenerate.
106 2011-08-26 Nick Clifton <nickc@redhat.com>
108 * po/es.po: Updated Spanish translation.
110 2011-08-01 Cary Coutant <ccoutant@google.com>
112 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
113 * gold/testsuite/Makefile.in: Regenerate.
114 * gold/testsuite/justsyms_exec.c: New source file.
115 * gold/testsuite/justsyms_lib.c: New source file.
117 2011-08-01 Cary Coutant <ccoutant@google.com>
119 * layout.cc (Layout::set_segment_offsets): Don't realign text
120 segment if -Ttext was specified.
121 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
123 * object.h (Sized_relobj_file::e_type): New function.
124 (Sized_relobj_file::e_type_): New data member.
125 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
126 base address for ET_EXEC files.
127 * target.cc (Target::do_make_elf_object_implementation): Allow
128 ET_EXEC files with --just-symbols option.
130 2011-07-28 Cary Coutant <ccoutant@google.com>
132 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
133 Add thread_number parameter.
134 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
135 * workqueue-threads.cc
136 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
137 current thread if its thread number is greater than desired thread
139 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
140 Add thread_number parameter.
141 (Workqueue::should_cancel_thread): Likewise.
142 (Workqueue::find_runnable_or_wait): Pass thread_number to
143 should_cancel_thread.
144 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
147 2011-07-22 Sriraman Tallam <tmsriram@google.com>
149 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
150 only after checking if it cannot be forced local.
151 * symtab.h (is_externally_visible): Check if the symbol is not forced
154 2011-07-15 Ian Lance Taylor <iant@google.com>
156 * options.h (class General_options): Add --print-output-format.
157 Move -EL next to -EB, for better --help output.
158 * target-select.cc: Include <cstdio>, "options.h", and
160 (Target_selector::do_target_bfd_name): New function.
161 (print_output_format): New function.
162 * target-select.h (class Target_selector): Update declarations.
163 (Target_selector::target_bfd_name): New function.
164 (print_output_format): Declare.
165 * main.cc: Include "target-select.h".
166 (main): Handle --print-output-format.
167 * gold.cc: Include "target-select.h".
168 (queue_initial_tasks): Handle --print-output-format when there are
170 * parameters.cc (parameters_force_valid_target): Give a better
171 error message if -EB/-EL does not match target.
172 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
175 2011-07-15 Ian Lance Taylor <iant@google.com>
177 * i386.cc (class Output_data_plt_i386): Add layout_ field.
178 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
179 (Output_data_plt_i386::do_write): Write address of .dynamic
180 section to first entry in .got.plt section.
181 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
182 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
184 (Output_data_plt_x86_64::do_write): Write address of .dynamic
185 section to first entry in .got.plt section.
186 * layout.h (Layout::dynamic_section): New function.
188 2011-07-13 Sriraman Tallam <tmsriram@google.com>
190 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
192 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
193 input_section_position_, and input_section_glob_.
194 (read_layout_from_file): Call function section_ordering_specified.
195 * layout.h (is_section_ordering_specified): New function.
196 (section_ordering_specified): New function.
197 (section_ordering_specified_): New boolean member.
198 * main.cc(main): Call load_plugins after layout object is defined.
199 * output.cc (Output_section::add_input_section): Use
200 function section_ordering_specified to check if section ordering is
202 * output.cc (Output_section::add_relaxed_input_section): Use
203 function section_ordering_specified to check if section ordering is
205 (Output_section::update_section_layout): New function.
206 (Output_section::sort_attached_input_sections): Check if input section
208 * output.h (Output_section::update_section_layout): New function.
209 * plugin.cc (get_section_count): New function.
210 (get_section_type): New function.
211 (get_section_name): New function.
212 (get_section_contents): New function.
213 (update_section_order): New function.
214 (allow_section_ordering): New function.
215 (Plugin::load): Add the new interfaces to the transfer vector.
216 (Plugin_manager::load_plugins): New parameter.
217 (Plugin_manager::all_symbols_read): New parameter.
218 (Plugin_manager::claim_file): New parameter. Save the elf object for
220 (Plugin_manager::get_elf_object): New function.
221 (Plugin_manager::get_view): Change to directly use the bool to check
222 if get_view is called from claim_file_hook.
223 * plugin.h (input_objects): New function
224 (Plugin__manager::load_plugins): New parameter.
225 (Plugin_manager::claim_file): New parameter.
226 (Plugin_manager::get_elf_object): New function.
227 (Plugin_manager::in_claim_file_handler): New function.
228 (Plugin_manager::in_claim_file_handler_): New member.
229 (layout): New function.
230 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
231 handler with an extra parameter. Make the elf object before calling
233 * testsuite/plugin_test.c (get_section_count): New function pointer.
234 (get_section_type): New function pointer.
235 (get_section_name): New function pointer.
236 (get_section_contents): New function pointer.
237 (update_section_order): New function pointer.
238 (allow_section_ordering): New function pointer.
239 (onload): Check if the new interfaces exist.
241 2011-07-13 Ian Lance Taylor <iant@google.com>
243 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
245 * x86_64.cc (Target_x86_64::got_section): Likewise.
246 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
247 (relro_now_test_SOURCES): New variable.
248 (relro_now_test_DEPENDENCIES): New variable.
249 (relro_now_test_LDFLAGS): New variable.
250 (relro_now_test_LDADD): New variable.
251 (relro_now_test.so): New target.
252 * testsuite/Makefile.in: Rebuild.
254 2011-07-12 Ian Lance Taylor <iant@google.com>
257 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
258 GLOB_DAT relocation rather than a RELATIVE relocation for a
259 protected symbol when creating a shared library.
260 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
261 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
262 * testsuite/protected_main_1.cc (main): Test that protected
263 function has same address.
265 2011-07-11 Ian Lance Taylor <iant@google.com>
268 * options.h (class General_options): Add -Bgroup.
269 * options.cc (General_options::finalize): If -Bgroup is set,
270 default to --unresolved-symbols=report-all.
271 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
272 * target-reloc.h (issue_undefined_symbol_error): Handle
273 --unresolved-symbols=report-all.
275 2011-07-08 Ian Lance Taylor <iant@google.com>
278 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
279 if linker script discards key sections.
280 (Layout::create_dynamic_symtab): Likewise.
281 (Layout::assign_local_dynsym_offsets): Likewise.
282 (Layout::sized_create_version_sections): Likewise.
283 (Layout::create_interp): Likewise.
284 (Layout::finish_dynamic_section): Likewise.
285 (Layout::set_dynamic_symbol_size): Likewise.
287 2011-07-08 Ian Lance Taylor <iant@google.com>
290 * options.h (class General_options): Add --unresolved-symbols.
291 * target-reloc.h (issue_undefined_symbol_error): Check
292 --unresolved-symbols. Add comments.
294 2011-07-08 Ian Lance Taylor <iant@google.com>
296 * testsuite/odr_violation2.cc (Ordering::operator()): Make
297 expression more complex.
299 2011-07-08 Ian Lance Taylor <iant@google.com>
302 * target-reloc.h (issue_undefined_symbol_error): New inline
303 function, broken out of relocate_section.
304 (relocate_section): Call issue_undefined_symbol_error.
305 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
306 there is no TLS segment if we are about to issue an undefined
308 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
310 2011-07-08 Ian Lance Taylor <iant@google.com>
313 * resolve.cc (Symbol_table::should_override): Add fromtype
314 parameter. Change all callers. Give error when linking together
315 TLS and non-TLS symbol.
316 (Symbol_table::should_override_with_special): Add fromtype
317 parameter. Change all callers.
318 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
319 there is no TLS segment if we have reported some errors.
320 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
322 2011-07-08 Ian Lance Taylor <iant@google.com>
325 * target.h (Target::plt_address_for_global): New function.
326 (Target::plt_address_for_local): New function.
327 (Target::plt_section_for_global): Remove.
328 (Target::plt_section_for_local): Remove.
329 (Target::do_plt_address_for_global): New virtual function.
330 (Target::do_plt_address_for_local): New virtual function.
331 (Target::do_plt_section_for_global): Remove.
332 (Target::do_plt_section_for_local): Remove.
333 (Target::register_global_plt_entry): Add Symbol_table and Layout
335 * output.cc (Output_data_got::Got_entry::write): Use
336 plt_address_for_global and plt_address_for_local.
337 * layout.cc (Layout::add_target_dynamic_tags): Use size and
338 address of output section.
339 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
340 got_irelative_, and irelative_count_ fields. Update
342 (Output_data_plt_i386::has_irelative_section): New function.
343 (Output_data_plt_i386::entry_count): Add irelative_count_.
344 (Output_data_plt_i386::set_final_data_size): Likewise.
345 (class Target_i386): Add got_irelative_ and rel_irelative_
346 fields. Update declarations.
347 (Target_i386::Target_i386): Initialize new fields.
348 (Target_i386::do_plt_address_for_global): New function replacing
349 do_plt_section_for_global.
350 (Target_i386::do_plt_address_for_local): New function replacing
351 do_plt_section_for_local.
352 (Target_i386::got_section): Create got_irelative_.
353 (Target_i386::rel_irelative_section): New function.
354 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
355 fields. Don't define __rel_iplt_{start,end}.
356 (Output_data_plt_i386::add_entry): Add symtab and layout
357 parameters. Change all callers. Use different PLT and GOT for
359 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
360 layout parameters. Change all callers. Use different PLT and
362 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
363 (Output_data_plt_i386::rel_irelative): New function.
364 (Output_data_plt_i386::address_for_global): New function.
365 (Output_data_plt_i386::address_for_local): New function.
366 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
367 IRELATIVE GOT when changing IFUNC GOT entries.
368 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
370 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
371 if we didn't create an IRELATIVE GOT.
372 (Target_i386::Relocate::relocate): Use plt_address_for_global and
373 plt_address_for_local.
374 (Target_i386::do_dynsym_value): Use plt_address_for_global.
375 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
376 got_irelative_, and irelative_count_ fields. Update
378 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
379 Initialize new fields. Remove symtab parameter. Change all
381 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
383 (Output_data_plt_x86_64::has_irelative_section): New function.
384 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
385 (class Target_x86_64): Add got_irelative_ and rel_irelative_
386 fields. Update declarations.
387 (Target_x86_64::Target_x86_64): Initialize new fields.
388 (Target_x86_64::do_plt_address_for_global): New function replacing
389 do_plt_section_for_global.
390 (Target_x86_64::do_plt_address_for_local): New function replacing
391 do_plt_section_for_local.
392 (Target_x86_64::got_section): Create got_irelative_.
393 (Target_x86_64::rela_irelative_section): New function.
394 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
395 all callers. Don't create __rel_iplt_{start,end}.
396 (Output_data_plt_x86_64::add_entry): Add symtab and layout
397 parameters. Change all callers. Use different PLT and GOT for
399 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
400 layout parameters. Change all callers. Use different PLT and
402 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
403 parameters. Change all callers. Use different PLT and GOT for
405 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
406 (Output_data_plt_x86_64::rela_irelative): New function.
407 (Output_data_plt_x86_64::address_for_global): New function.
408 (Output_data_plt_x86_64::address_for_local): New function.
409 (Output_data_plt_x86_64::set_final_data_size): Likewise.
410 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
411 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
412 (Target_x86_64::register_global_plt_entry): Add symtab and layout
414 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
416 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
417 symbols if we didn't create an IRELATIVE GOT.
418 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
419 plt_address_for_local.
420 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
421 * testsuite/ifuncvar1.c: New test file.
422 * testsuite/ifuncvar2.c: New test file.
423 * testsuite/ifuncvar3.c: New test file.
424 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
425 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
426 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
427 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
428 * testsuite/Makefile.in: Rebuild.
430 2011-07-07 Cary Coutant <ccoutant@google.com>
432 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
433 (two_file_test_1_ndebug.o): Likewise.
434 (two_file_test_1b_ndebug.o): Likewise.
435 (two_file_test_2_ndebug.o): Likewise.
436 (two_file_test_main_ndebug.o): Likewise.
437 (incremental_test_2): Link with no-debug versions.
439 2011-07-06 Cary Coutant <ccoutant@google.com>
441 * gold/incremental.cc
442 (Output_section_incremental_inputs::write_info_blocks): Check for
443 hidden and internal symbols.
445 2011-07-06 Cary Coutant <ccoutant@google.com>
447 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
448 Check disposition for startup file.
449 (Incremental_inputs::report_command_line): Ignore
450 --incremental-startup-unchanged option.
451 * options.cc (General_options::parse_incremental_startup_unchanged):
453 (General_options::General_options): Initialize new data member.
454 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
455 (General_options): Add --incremental-startup-unchanged option.
456 (General_options::incremental_startup_disposition): New function.
457 (General_options::incremental_startup_disposition_): New data member.
459 2011-07-06 Cary Coutant <ccoutant@google.com>
461 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
462 input file index to Script_info ctor.
463 (Sized_incremental_binary::do_file_has_changed): Find the
464 command-line argument for files named in scripts.
465 * incremental.h (Script_info::Script_info): New ctor
466 with input file index.
467 (Script_info::input_file_index): New function.
468 (Script_info::input_file_index_): New data member.
469 (Incremental_binary::get_library): Add const.
470 (Incremental_binary::get_script_info): Add const.
471 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
472 * testsuite/Makefile.am (incremental_test_5): New test case.
473 (incremental_test_6): New test case.
474 * testsuite/Makefile.in: Regenerate.
476 2011-07-06 Cary Coutant <ccoutant@google.com>
478 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
479 debug output when command lines differ.
481 2011-07-06 Cary Coutant <ccoutant@google.com>
483 * incremental.cc (Incremental_inputs::report_command_line): Ignore
484 --incremental-patch option.
485 * layout.cc (Free_list::allocate): Extend allocation beyond original
487 (Layout::make_output_section): Mark sections that should get
489 * options.cc (parse_percent): New function.
490 * options.h (parse_percent): New function.
491 (DEFINE_percent): New macro.
492 (General_options): Add --incremental-patch option.
493 * output.cc (Output_section::Output_section): Initialize new data
495 (Output_section::add_input_section): Print section name when out
497 (Output_section::add_output_section_data): Likewise.
498 (Output_section::set_final_data_size): Add patch space when
499 doing --incremental-full.
500 (Output_section::do_reset_address_and_file_offset): Remove patch
502 (Output_segment::set_section_list_addresses): Print debug output
503 only if --incremental-update.
504 * output.h (Output_section::set_is_patch_space_allowed): New function.
505 (Output_section::is_patch_space_allowed_): New data member.
506 (Output_section::patch_space_): New data member.
507 * parameters.cc (Parameters::incremental_full): New function.
508 * parameters.h (Parameters::incremental_full): New function
509 * testsuite/Makefile.am (incremental_test_2): Add test for
510 --incremental-patch option.
511 * testsuite/Makefile.in: Regenerate.
512 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
513 (t18): Remove function body.
515 2011-07-05 Doug Kwan <dougkwan@google.com>
518 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
519 Arm_Address type for relocation result.
520 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
522 (Arm_relocate_functions::abs32): Use unaligned access.
523 (Arm_relocate_functions::rel32): Ditto.
524 (Arm_relocate_functions::prel31): Ditto.
525 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
526 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
527 static data relocations.
528 * testsuite/Makefile.in: Regnerate.
529 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
531 2011-07-05 Ian Lance Taylor <iant@google.com>
534 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
535 symbols if necessary.
536 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
538 2011-07-05 Ian Lance Taylor <iant@google.com>
541 * resolve.cc (Symbol::override_base_with_special): Simply override
542 version with special symbol version, ignoring previous version.
544 2011-07-05 Ian Lance Taylor <iant@google.com>
546 * object.cc (Sized_relobj_file::include_section_group): Add
547 information to comment about signature location.
549 2011-07-02 Ian Lance Taylor <iant@google.com>
552 * options.h (class General_options): Add -f and -F.
553 * options.cc (General_options::finalize): Fatal error if -f/-F
554 are used without -shared.
555 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
557 2011-07-02 Ian Lance Taylor <iant@google.com>
559 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
561 2011-07-01 Ian Lance Taylor <iant@google.com>
565 * resolve.cc (Symbol::override_base_with_special): Don't override
566 the version if the overriding symbol has a different name.
567 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
568 all callers. If we give an error about an undefined version,
569 define the base version if necessary.
570 * dynobj.h (class Versions): Update declaration.
571 * testsuite/weak_alias_test_5.cc: New file.
572 * testsuite/weak_alias_test.script: New file.
573 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
574 and versioned_alias have the right value, and call t2.
575 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
576 weak_alias_test_5.so.
577 (weak_alias_test_LDADD): Likewise.
578 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
579 * testsuite/Makefile.in: Rebuild.
581 2011-07-01 Ian Lance Taylor <iant@google.com>
584 * options.h (class General_options): Support -z notext.
585 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
587 (two_file_shared_nonpic.so): Likewise.
588 (two_file_shared_mixed.so): Likewise.
589 (two_file_shared_mixed_1.so): Likewise.
590 (weak_undef_lib_nonpic.so): Likewise.
591 (alt/weak_undef_lib_nonpic.so): Likewise.
592 (tls_test_shared_nonpic.so): Likewise.
593 * testsuite/Makefile.in: Rebuild.
595 2011-07-01 Ian Lance Taylor <iant@google.com>
598 * configure.ac: Test whether static linking works, setting
599 the automake conditional HAVE_STATIC.
600 * testsuite/Makefile.am: Disable tests using -static if
601 HAVE_STATIC is not true.
602 * configure, testsuite/Makefile.in: Rebuild.
604 2011-07-01 Ian Lance Taylor <iant@google.com>
607 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
608 Assert if we see DW_EH_PE_indirect.
609 * target.h (Target::ehframe_datarel_base): New function.
610 (Target::do_ehframe_datarel_base): New target function.
611 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
612 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
615 2011-07-01 Ian Lance Taylor <iant@google.com>
618 * options.h (class General_options): Add
619 --ld-generated-unwind-info.
620 * ehframe.cc (Fde::write): Add address parameter. Change all
621 callers. If associated with PLT, fill in address and size.
622 (Cie::set_output_offset): Only add merge mapping if there is an
624 (Cie::write): Add address parameter. Change all callers.
625 (Eh_frame::add_ehframe_for_plt): New function.
626 * ehframe.h (class Fde): Update declarations. Move shndx_ and
627 input_offset_ fields into union u_, with new plt field.
628 (Fde::Fde): Adjust for new union field.
629 (Fde::Fde) [Output_data version]: New constructor.
630 (Fde::add_mapping): Only add merge mapping if there is an object.
631 (class Cie): Update declarations.
632 (class Eh_frame): Declare add_ehframe_for_plt.
633 * layout.cc (Layout::layout_eh_frame): Break out code into
634 make_eh_frame_section, and call it.
635 (Layout::make_eh_frame_section): New function.
636 (Layout::add_eh_frame_for_plt): New function.
637 * layout.h (class Layout): Update declarations.
638 * merge.cc (Merge_map::add_mapping): Add assertion.
639 * i386.cc: Include "dwarf.h".
640 (class Output_data_plt_i386): Make first_plt_entry,
641 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
642 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
643 and plt_eh_frame_fde.
644 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
645 boundary. Call add_eh_frame_for_plt if appropriate.
646 * x86_64.cc: Include "dwarf.h".
647 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
648 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
649 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
650 and plt_eh_frame_fde.
651 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
654 2011-06-29 Ian Lance Taylor <iant@google.com>
657 * object.cc (Sized_relobj_file::layout_section): Change shdr
658 parameter to be const.
659 (Sized_relobj_file::layout_eh_frame_section): New function, broken
661 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
662 appropriate. Call layout_eh_frame_section.
663 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
665 * object.h (class Sized_relobj_file): Update declarations.
667 2011-06-29 Ian Lance Taylor <iant@google.com>
670 * script.cc (Token::integer_value): Accept trailing M/m/K/k
672 (Lex::gather_token): Accept trailing M/m/K/k for integers.
674 2011-06-29 Ian Lance Taylor <iant@google.com>
677 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
679 * layout.cc (Layout::layout_eh_frame): Likewise.
681 2011-06-29 Ian Lance Taylor <iant@google.com>
684 * layout.cc (Layout::symtab_section_shndx): New function.
685 * layout.h (class Layout): Declare symtab_section_shndx.
686 * output.cc (Output_section::write_header): Call it.
688 2011-06-29 Ian Lance Taylor <iant@google.com>
691 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
692 symbols which are not used in a relocation.
694 2011-06-28 Ian Lance Taylor <iant@google.com>
697 * layout.cc (Layout::segment_precedes): Don't crash if a linker
698 script create indistinguishable segments.
699 (Layout::set_segment_offsets): Use stable_sort when sorting
700 segments. Pass this to Compare_segments constructor.
701 * layout.h (class Layout): Make segment_precedes non-static.
702 (class Compare_segments): Change from struct to class. Add
703 layout_ field. Add constructor.
705 (Script_sections::attach_sections_using_phdrs_clause): Rename
706 local orphan to is_orphan. Don't report failure to put empty
707 section in segment. On attachment failure, report name of
708 section, and attach to first PT_LOAD segment.
710 2011-06-28 Ian Lance Taylor <iant@google.com>
713 * target-select.cc (Target_selector::Target_selector): Add
714 emulation parameter. Change all callers.
715 (select_target_by_bfd_name): Rename from select_target_by_name.
717 (select_target_by_emulation): New function.
718 (supported_emulation_names): New function.
719 * target-select.h (class Target_selector): Add emulation_ field.
721 (Target_selector::recognize_by_bfd_name): Rename from
722 recognize_by_name. Change all callers.
723 (Target_selector::supported_bfd_names): Rename from
724 supported_names. Change all callers.
725 (Target_selector::recognize_by_emulation): New function.
726 (Target_selector::supported_emulations): New function.
727 (Target_selector::emulation): New function.
728 (Target_selector::do_recognize_by_bfd_name): Rename from
729 do_recognize_by_name. Change all callers.
730 (Target_selector::do_supported_bfd_names): Rename from
731 do_supported_names. Change all callers.
732 (Target_selector::do_recognize_by_emulation): New function.
733 (Target_selector::do_supported_emulations): New function.
734 (select_target_by_bfd_name): Change name in declaration.
735 (select_target_by_emulation): Declare.
736 (supported_emulation_names): Declare.
737 * parameters.cc (parameters_force_valid_target): Try to find
738 target based on emulation from -m option.
739 * options.h (class General_options): Change doc string for -m.
740 * options.cc (help): Print emulations.
741 (General_options::parse_V): Likewise.
742 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
743 Add emulation parameter. Change all callers.
745 2011-06-28 Ian Lance Taylor <iant@google.com>
747 * target.h (class Target): Add osabi_ field.
748 (Target::osabi): New function.
749 (Target::set_osabi): New function.
750 (Target::Target): Initialize osabi_.
751 (Target::do_adjust_elf_header): Make pure virtual.
752 (Sized_target::do_adjust_elf_header): Declare.
753 * target.cc (Sized_target::do_adjust_elf_header): New function.
754 (class Sized_target): Instantiate all versions.
755 * freebsd.h (class Target_freebsd): Remove.
756 (Target_selector_freebsd::do_recognize): Call set_osabi on
758 (Target_selector_freebsd::do_recognize_by_name): Likewise.
759 (Target_selector_freebsd::set_osabi): Remove.
760 * i386.cc (class Target_i386): Inherit from Sized_target rather
762 * x86_64.cc (class Target_x86_64): Likewise.
764 2011-06-28 Ian Lance Taylor <iant@google.com>
766 * target.h (Target::can_check_for_function_pointers): Rewrite.
768 (Target::can_icf_inline_merge_sections): Likewise.
769 (Target::section_may_have_icf_unsafe_poineters): Likewise.
770 (Target::Target_info): Add can_icf_inline_merge_sections field.
771 (Target::do_can_check_for_function_pointers): New virtual
773 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
774 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
775 from can_check_for_function_pointers, move in file.
776 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
777 section_may_have_icf_unsafe_poineters, move in file.
778 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
779 * i386.cc (Target_i386::do_can_check_for_function_pointers):
780 Rename from can_check_for_function_pointers, move in file.
781 (Target_i386::can_icf_inline_merge_sections): Remove.
782 (Target_i386::i386_info): Initialize
783 can_icf_inline_merge_sections.
784 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
785 Initialize can_icf_inline_merge_sections.
786 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
787 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
788 Rename from can_check_for_function_pointers, move in file.
789 (Target_x86_64::can_icf_inline_merge_sections): Remove.
790 (Target_x86_64::x86_64_info): Initialize
791 can_icf_inline_merge_sections.
792 * testsuite/testfile.cc (Target_test::test_target_info):
794 * icf.cc (get_section_contents): Correct formatting.
796 2011-06-27 Ian Lance Taylor <iant@google.com>
798 * symtab.cc (Symbol::versioned_name): New function.
799 (Symbol_table::add_to_final_symtab): Use versioned_name when
801 (Symbol_table::sized_write_symbol): Likewise.
802 * symtab.h (class Symbol): Declare versioned_name.
803 * stringpool.h (class Stringpool_template): Add variant of add
804 which takes a std::basic_string.
805 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
806 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
807 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
808 (ver_test_12.o): New target.
809 * testsuite/Makefile.in: Rebuild.
811 2011-06-27 Doug Kwan <dougkwan@google.com>
813 * arm.cc (Arm_relocate_functions::thm_jump8,
814 Arm_relocate_functions::thm_jump11): Use a wider signed
815 type to compute offset.
816 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
818 * testsuite/Makefile.in: Regenerate.
819 * testsuite/arm_branch_in_range.sh: Check test results of
820 arm_thm_jump11 and arm_thm_jump8.
821 * testsuite/arm_thm_jump11.s: New test source file.
822 * testsuite/arm_thm_jump11.t: New linker script.
823 * testsuite/arm_thm_jump8.s: New test source file.
824 * testsuite/arm_thm_jump8.t: New linker script.
826 2011-06-24 Ian Lance Taylor <iant@google.com>
828 * layout.cc: Include "object.h".
829 (ctors_sections_in_init_array): New static variable.
830 (Layout::is_ctors_in_init_array): New function.
831 (Layout::layout): Add entry to ctors_sections_in_init_array if
833 * layout.h (class Layout): Declare is_ctors_in_init_array.
834 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
835 is_ctors_reverse_view is set.
836 (Sized_relobj_file::write_sections): Add layout parameter. Change
837 all callers. Set is_ctors_reverse_view field of View_size.
838 (Sized_relobj_file::reverse_words): New function.
839 * object.h (Sized_relobj_file::View_size): Add
840 is_ctors_reverse_view field.
841 (class Sized_relobj_file): Update declarations.
842 * testsuite/initpri3.c: New test.
843 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
845 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
846 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
847 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
848 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
849 * testsuite/Makefile.in: Rebuild.
851 2011-06-24 Cary Coutant <ccoutant@google.com>
853 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
854 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
855 (debug_msg_cdebug.err): New targets.
856 * testsuite/Makefile.in: Regenerate.
857 * testsuite/debug_msg.sh: Check output of link with compressed debug.
858 Fix checks for link with shared library.
860 2011-06-24 Doug Kwan <dougkwan@google.com>
862 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
863 skip empty text sections.
864 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
866 2011-06-22 Ian Lance Taylor <iant@google.com>
869 * options.h (class General_options): Add --ctors-in-init-array.
870 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
871 friends as SHT_PROGBITS for merging sections.
872 (Layout::layout): Remove special handling of .init_array and
873 friends. Don't sort if doing relocatable link. Sort for .ctors
874 and .dtors if ctors_in_init_array.
875 (Layout::make_output_section): Force correct section types for
876 .init_array and friends. Don't sort if doing relocatable link,
877 Don't sort .ctors and .dtors if ctors_in_init_array.
878 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
879 (Layout::output_section_name): Add relobj parameter. Change all
880 callers. Handle .ctors. and .dtors. in code rather than table.
881 Handle .ctors and .dtors if ctors_in_init_array.
882 (Layout::match_file_name): New function, moved from output.cc.
883 * layout.h (class Layout): Update declarations.
884 * output.cc: Include "layout.h".
885 (Input_section_sort_entry::get_priority): New function.
886 (Input_section_sort_entry::match_file_name): Just call
887 Layout::match_file_name.
888 (Output_section::Input_section_sort_init_fini_compare::operator()):
889 Handle .ctors and .dtors. Sort by explicit priority rather than
891 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
892 * testsuite/initpri2.c: New test.
893 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
894 (check_PROGRAMS): Add initpri2.
895 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
896 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
897 * configure, testsuite/Makefile.in: Rebuild.
899 2011-06-19 Ian Lance Taylor <iant@google.com>
902 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
903 .interp section to a PT_INTERP segment even if we have seen a
904 --dynamic-linker option. Don't do it if we have seen a PHDRS
905 clause in a linker script.
906 (Layout::finalize): Don't create a .interp section if we've
907 already create a PT_INTERP segment.
908 (Layout::create_interp): Always call choose_output_section (revert
909 patch of 2011-06-17). Don't create PT_INTERP segment.
911 (Script_sections::create_note_and_tls_segments): Add a .interp
912 section to a PT_INTERP segment even if we have seen a
913 --dynamic-linker option.
915 2011-06-18 Ian Lance Taylor <iant@google.com>
917 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
918 merely because a non-PT_LOAD segment has a dynamic reloc.
920 2011-06-18 Ian Lance Taylor <iant@google.com>
922 * layout.cc (Layout::finish_dynamic_section): Don't create
923 DT_FLAGS entry if not needed.
925 2011-06-18 Ian Lance Taylor <iant@google.com>
928 * layout.cc (Layout::layout_eh_frame): Correct handling of
929 writable .eh_frame section.
931 2011-06-17 Ian Lance Taylor <iant@google.com>
934 * resolve.cc (Symbol_table::resolve): Don't give an error if a
935 symbol is redefined with the exact same object and value.
937 2011-06-17 Ian Lance Taylor <iant@google.com>
940 * layout.h (class Layout): Add interp_segment_ field.
941 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
942 (Layout::attach_allocated_section_to_segment): If making shared
943 library, put .interp section in PT_INTERP segment.
944 (Layout::finalize): Also call create_interp if -dynamic-linker
946 (Layout::create_interp): Assert that there is no PT_INTERP
947 segment. If not using a SECTIONS clause, use make_output_section.
948 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
950 (Script_sections::create_note_and_tls_segments): If making shared
951 library, put .interp section in PT_INTERP segment.
953 2011-06-17 Ian Lance Taylor <iant@google.com>
955 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
956 when making a shared library.
958 2011-06-17 Ian Lance Taylor <iant@google.com>
960 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
961 parameter. Change all callers. Don't issue warning about PC32
962 against locally defined symbol.
964 2011-06-16 Ian Lance Taylor <iant@google.com>
966 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
967 occurs in same object.
969 2011-06-14 Alan Modra <amodra@gmail.com>
971 * po/POTFILES.in: Regenerate.
973 2011-06-09 Ian Lance Taylor <iant@google.com>
976 (Orphan_output_section::set_section_addresses): For a relocatable
977 link set address to 0.
979 2011-06-09 Cary Coutant <ccoutant@google.com>
982 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
983 used with --compress-debug-sections.
984 * gold/object.cc (Sized_relobj_file::do_layout): Report
985 uncompressed size of compressed input sections.
987 2011-06-08 Cary Coutant <ccoutant@google.com>
990 * testsuite/two_file_test_2_v1.cc: Change initialization of
991 v2 to keep it in .data.
993 2011-06-07 Cary Coutant <ccoutant@google.com>
995 * common.cc (Symbol_table::do_allocate_commons_list): Call
997 * errors.cc (Errors::fatal): Adjust call to gold_exit.
998 (Errors::fallback): New function.
999 (gold_fallback): New function.
1000 * errors.h (Errors::fallback): New function.
1001 * gold.cc (gold_exit): Change status parameter to enum; adjust
1003 (queue_initial_tasks): Call gold_fallback.
1004 * gold.h: Include cstdlib.
1005 (Exit_status): New enum type.
1006 (gold_exit): Change status parameter to enum.
1007 (gold_fallback): New function.
1008 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1009 (Layout::create_symtab_sections): Likewise.
1010 (Layout::create_shdrs): Likewise.
1011 * main.cc (main): Adjust call to gold_exit.
1012 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1013 (Output_data_got::add_got_entry_pair): Likewise.
1014 (Output_section::add_input_section): Likewise.
1015 (Output_section::add_output_section_data): Likewise.
1016 (Output_segment::set_section_list_addresses): Likewise.
1017 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1019 2011-06-07 Cary Coutant <ccoutant@google.com>
1021 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1022 for incremental links.
1023 * output.cc (Output_segment::set_section_list_addresses): Remove
1024 FIXME and test for TLS or BSS.
1026 2011-06-07 Cary Coutant <ccoutant@google.com>
1028 * testsuite/Makefile.am: Add incremental_copy_test,
1029 incremental_common_test_1.
1030 * testsuite/Makefile.in: Regenerate.
1031 * testsuite/common_test_1_v1.c: New source file.
1032 * testsuite/common_test_1_v2.c: New source file.
1033 * testsuite/copy_test_v1.cc: New source file.
1035 2011-06-07 Cary Coutant <ccoutant@google.com>
1037 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1038 update, allocate common from bss section's free list.
1039 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1040 linker-defined symbols.
1041 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1042 Skip GOT and PLT entries that are no longer referenced.
1043 (Output_section_incremental_inputs::write_info_blocks): Mark
1044 linker-defined symbols.
1045 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1046 * output.cc (Output_section::allocate): New function.
1047 * output.h (Output_section::allocate): New function.
1048 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1049 linker-defined symbols.
1050 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1051 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1052 (Symbol::init_base_output_data): Likewise.
1053 (Symbol::init_base_output_segment): Likewise.
1054 (Symbol::init_base_constant): Likewise.
1055 (Sized_symbol::init_output_data): Likewise.
1056 (Sized_symbol::init_output_segment): Likewise.
1057 (Sized_symbol::init_constant): Likewise.
1058 (Symbol_table::do_define_in_output_data): Likewise.
1059 (Symbol_table::do_define_in_output_segment): Likewise.
1060 (Symbol_table::do_define_as_constant): Likewise.
1061 * symtab.h (Symbol::is_predefined): New function.
1062 (Symbol::init_base_output_data): Add is_predefined parameter.
1063 (Symbol::init_base_output_segment): Likewise.
1064 (Symbol::init_base_constant): Likewise.
1065 (Symbol::is_predefined_): New data member.
1066 (Sized_symbol::init_output_data): Add is_predefined parameter.
1067 (Sized_symbol::init_output_segment): Likewise.
1068 (Sized_symbol::init_constant): Likewise.
1069 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1071 2011-06-07 Cary Coutant <ccoutant@google.com>
1073 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1074 instead of emit_copy_reloc.
1075 (Copy_relocs::emit_copy_reloc): Refactor.
1076 (Copy_relocs::make_copy_reloc): New function.
1077 (Copy_relocs::add_copy_reloc): Remove.
1078 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1080 (Copy_relocs::make_copy_reloc): New function.
1081 (Copy_relocs::add_copy_reloc): Remove.
1082 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1083 unchanged input files.
1084 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1085 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1086 Reserve BSS space for COPY relocations.
1087 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1088 (Output_section_incremental_inputs::write_info_blocks): Record
1089 whether a symbol is copied from a shared object.
1090 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1091 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1092 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1093 (Incremental_input_entry_reader::get_output_symbol_index): Add
1095 (Incremental_binary::emit_copy_relocs): New function.
1096 (Incremental_binary::do_emit_copy_relocs): New function.
1097 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1099 (Sized_incremental_binary::add_copy_reloc): New function.
1100 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1101 (Sized_incremental_binary::Copy_reloc): New struct.
1102 (Sized_incremental_binary::Copy_relocs): New typedef.
1103 (Sized_incremental_binary::copy_relocs_): New data member.
1104 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1105 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1106 * target.h (Sized_target::emit_copy_reloc): New function.
1107 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1109 2011-06-02 Cary Coutant <ccoutant@google.com>
1112 * gold/archive.cc (Archive::Archive): Initialize new data member.
1113 (Archive::include_all_members): Return if archive has already been
1115 * gold/archive.h (Archive::include_all_members_): New data member.
1117 2011-06-02 Nick Clifton <nickc@redhat.com>
1119 * dynobj.h: Fix spelling mistake in comment.
1120 * output.cc: Likewise.
1122 2011-05-31 Doug Kwan <dougkwan@google.com>
1126 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1127 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1128 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1129 redundant arm_exidx_test.so.
1130 * testsuite/Makefile.in: Regenerate.
1131 (check_SCRIPTS): Add pr12826.sh
1132 (check_DATA): Add pr12826.stdout
1133 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1134 * testsuite/pr12826.sh: New file.
1135 * testsuite/pr12826_1.s: Ditto.
1136 * testsuite/pr12826_1.s: Ditto.
1138 2011-05-30 Ian Lance Taylor <iant@google.com>
1140 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1143 2011-05-29 Ian Lance Taylor <iant@google.com>
1146 * testsuite/Makefile.am: Use different file name for two_file_test
1147 temporary file for each incremental test.
1148 * testsuite/Makefile.in: Rebuild.
1150 2011-05-29 Ian Lance Taylor <iant@google.com>
1152 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1153 binary input file is empty.
1155 2011-05-27 Ian Lance Taylor <iant@google.com>
1157 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1158 (ver_test_9.so): Likewise.
1159 * testsuite/Makefile.in: Rebuild.
1161 2011-05-26 Cary Coutant <ccoutant@google.com>
1163 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1164 * incremental.cc (Incremental_inputs::report_input_section): Fix
1165 comment, indentation.
1166 (Incremental_inputs::report_comdat_group): New function.
1167 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1168 of data for incremental input file entry.
1169 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1170 group count, COMDAT group signatures.
1171 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1172 an unchanged input file.
1173 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1174 Initialize new data member.
1175 (Incremental_object_entry::add_comdat_group): New function.
1176 (Incremental_object_entry::get_comdat_group_count): New function.
1177 (Incremental_object_entry::get_comdat_signature_key): New function.
1178 (Incremental_object_entry::groups_): New data member.
1179 (Incremental_inputs::report_comdat_group): New function.
1180 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1181 data for incremental input file entry.
1182 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1183 (Incremental_input_entry_reader::get_input_section): Adjust size of
1184 data for incremental input file entry.
1185 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1186 (Incremental_input_entry_reader::get_comdat_group_signature): New
1188 * object.cc (Sized_relobj::include_section_group): Report kept
1189 COMDAT groups for incremental links.
1191 2011-05-24 David Meyer <pdox@google.com>
1193 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1194 with name parameter. Add found_name parameter.
1195 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1196 * dirsearch.h (class Dirsearch): Update declaration.
1198 2011-05-24 Ian Lance Taylor <iant@google.com>
1200 * archive.cc (Library_base::should_include_member): Pull in object
1201 from archive if it defines the entry symbol.
1202 * parameters.cc (Parameters::entry): New function.
1203 * parameters.h (class Parameters): Declare entry.
1204 * output.h (class Output_file_header): Remove entry_ field.
1205 * output.cc (Output_file_header::Output_file_header): Remove entry
1206 parameter. Change all callers.
1207 (Output_file_header::entry): Use parameters->entry.
1208 * gold.cc (queue_middle_tasks): Likewise.
1209 * plugin.cc (Plugin_hook::run): Likewise.
1211 2011-05-24 Cary Coutant <ccoutant@google.com>
1213 * gold.cc (queue_initial_tasks): Pass incremental base filename
1214 to Output_file::open_base_file; don't print error message.
1215 * incremental-dump.cc (main): Adjust call to
1216 Output_file::open_for_modification.
1217 * incremental-dump.cc (main): Likewise.
1218 * incremental.cc (Incremental_inputs::report_command_line):
1219 Ignore --incremental-base option when comparing command lines.
1220 Ignore parameter when given as separate argument.
1221 * options.h (class General_options): Add --incremental-base.
1222 * output.cc (Output_file::Output_file):
1223 (Output_file::open_base_file): Add base_name and writable parameters;
1224 read base file into new file; print error message here.
1225 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1227 * output.h (Output_file::open_for_modification): Rename to...
1228 (Output_file::open_base_file): ...this; add base_name and
1229 writable parameters; adjust all callers.
1230 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1232 * testsuite/Makefile.am (incremental_test_4): Test
1234 * testsuite/Makefile.in: Regenerate.
1236 2011-05-24 Cary Coutant <ccoutant@google.com>
1238 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1240 * testsuite/Makefile.in: Regenerate.
1241 * testsuite/two_file_test_1_v1.cc: New test source file.
1242 * testsuite/two_file_test_1b_v1.cc: New test source file.
1243 * testsuite/two_file_test_2_v1.cc: New test source file.
1245 2011-05-24 Cary Coutant <ccoutant@google.com>
1247 * dynobj.h (Dynobj::do_dynobj): New function.
1248 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1249 flag and soname for shared objects.
1250 * incremental.cc (Incremental_inputs::report_object): Make
1251 either Incremental_object_entry or Incremental_dynobj_entry; add
1252 soname to string table.
1253 (Incremental_inputs::report_input_section): Add assertion.
1254 (Output_section_incremental_inputs::set_final_data_size): Adjust
1255 type of input file entry for shared libraries; adjust size of
1256 shared library info entry.
1257 (Output_section_incremental_inputs::write_input_files): Write
1258 as_needed flag for shared libraries.
1259 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1260 of input file entry for shared libraries; write soname.
1261 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1262 soname from incremental info.
1263 * incremental.h (enum Incremental_input_flags): Add
1264 INCREMENTAL_INPUT_AS_NEEDED.
1265 (Incremental_input_entry::Incremental_input_entry): Initialize new
1267 (Incremental_input_entry::set_as_needed): New function.
1268 (Incremental_input_entry::as_needed): New function.
1269 (Incremental_input_entry::do_dynobj_entry): New function.
1270 (Incremental_input_entry::as_needed_): New data member.
1271 (Incremental_object_entry::Incremental_object_entry): Don't check
1273 (Incremental_object_entry::do_type): Likewise.
1274 (class Incremental_dynobj_entry): New class.
1275 (Incremental_input_entry_reader::as_needed): New function.
1276 (Incremental_input_entry_reader::get_soname): New function.
1277 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1278 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1279 size of shared library info entry.
1280 * layout.cc (Layout::finish_dynamic_section): Don't test for
1281 incremental link when adding DT_NEEDED entries.
1282 * object.h (Object::Object): Initialize new data member.
1283 (Object::dynobj): New function.
1284 (Object::set_as_needed): New function.
1285 (Object::as_needed): New function.
1286 (Object::do_dynobj): New function.
1287 (Object::as_needed_): New data member.
1289 2011-05-24 Cary Coutant <ccoutant@google.com>
1291 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1292 info; adjust display of GOT entries.
1293 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1294 vector of input objects; remove file_status_.
1295 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1296 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1297 got_plt reader; call target hooks to reserve GOT entries.
1298 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1299 of input file info header and GOT info entry.
1300 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1302 (Got_plt_view_info::got_descriptor): Remove.
1303 (Got_plt_view_info::sym_index): New data member.
1304 (Got_plt_view_info::input_index): New data member.
1305 (Local_got_offset_visitor::visit): Write input file index.
1306 (Global_got_offset_visitor::visit): Write 0 for input file index.
1307 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1308 with sym_index and input_index.
1309 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1310 incremental info GOT entry; replace got_descriptor with input_index.
1311 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1312 map from input file index to object.
1313 (Sized_relobj_incr::do_layout): Replace direct data member reference
1314 with accessor function.
1315 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1316 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1317 Adjust size of input file info header.
1318 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1319 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1320 (Incremental_input_entry_reader::get_input_section): Adjust size of
1321 input file info header.
1322 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1323 of incremental info GOT entry.
1324 (Incremental_got_plt_reader::get_got_desc): Remove.
1325 (Incremental_got_plt_reader::get_got_symndx): New function.
1326 (Incremental_got_plt_reader::get_got_input_index): New function.
1327 (Sized_incremental_binary::Sized_incremental_binary): Remove
1328 file_status_; add input_objects_.
1329 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1330 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1331 (Sized_incremental_binary::file_is_unchanged): Remove.
1332 (Sized_incremental_binary::set_input_object): New function.
1333 (Sized_incremental_binary::input_object): New function.
1334 (Sized_incremental_binary::file_status_): Remove.
1335 (Sized_incremental_binary::input_objects_): New data member.
1336 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1338 (Sized_relobj_incr::invalid_address): Move to base class.
1339 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1341 (Sized_relobj_incr::do_output_section_offset): Likewise.
1342 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1343 (Sized_relobj_incr::section_offsets_): Likewise.
1344 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1346 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1347 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1348 with accessor function.
1349 (Sized_relobj_file::do_layout): Likewise.
1350 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1351 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1352 (Sized_relobj_file::compute_final_local_value): Replace refs to
1353 section_offsets_ with accessor function.
1354 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1355 * object.h (Relobj::Relobj): Initialize new data members.
1356 (Relobj::add_dyn_reloc): New function.
1357 (Relobj::first_dyn_reloc): New function.
1358 (Relobj::dyn_reloc_count): New function.
1359 (Relobj::first_dyn_reloc_): New data member.
1360 (Relobj::dyn_reloc_count_): New data member.
1361 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1363 (Sized_relobj::Address): New typedef.
1364 (Sized_relobj::invalid_address): Move here from child class.
1365 (Sized_relobj::Sized_relobj): Initialize new data members.
1366 (Sized_relobj::sized_relobj): New function.
1367 (Sized_relobj::is_output_section_offset_invalid): Move here from
1369 (Sized_relobj::get_output_section_offset): Likewise.
1370 (Sized_relobj::local_has_got_offset): Likewise.
1371 (Sized_relobj::local_got_offset): Likewise.
1372 (Sized_relobj::set_local_got_offset): Likewise.
1373 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1374 (Sized_relobj::clear_got_offsets): New function.
1375 (Sized_relobj::section_offsets): Move here from child class.
1376 (Sized_relobj::do_output_section_offset): Likewise.
1377 (Sized_relobj::do_set_section_offset): Likewise.
1378 (Sized_relobj::Local_got_offsets): Likewise.
1379 (Sized_relobj::local_got_offsets_): Likewise.
1380 (Sized_relobj::section_offsets_): Likewise.
1381 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1383 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1385 (Sized_relobj_file::sized_relobj): New function
1386 (Sized_relobj_file::local_has_got_offset): Move to base class.
1387 (Sized_relobj_file::local_got_offset): Likewise.
1388 (Sized_relobj_file::set_local_got_offset): Likewise.
1389 (Sized_relobj_file::get_output_section_offset): Likewise.
1390 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1391 (Sized_relobj_file::do_output_section_offset): Likewise.
1392 (Sized_relobj_file::do_set_section_offset): Likewise.
1393 (Sized_relobj_file::Local_got_offsets): Likewise.
1394 (Sized_relobj_file::local_got_offsets_): Likewise.
1395 (Sized_relobj_file::section_offsets_): Likewise.
1396 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1398 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1399 (Output_reloc::get_symbol_index): Likewise.
1400 (Output_reloc::local_section_offset): Likewise.
1401 (Output_reloc::get_address): Likewise.
1402 (Output_reloc::symbol_value): Likewise.
1403 (Output_data_got::reserve_slot): Move to class definition.
1404 (Output_data_got::reserve_local): New function.
1405 (Output_data_got::reserve_slot_for_global): Remove.
1406 (Output_data_got::reserve_global): New function.
1407 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1408 (all constructors, two instantiations).
1409 (Output_reloc::get_relobj): New function (two instantiations).
1410 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1411 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1412 (Output_data_reloc::add_global): Adjust type of relobj.
1413 (Output_data_reloc::add_global_relative): Likewise.
1414 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1415 (Output_data_reloc::add_local): Likewise.
1416 (Output_data_reloc::add_local_relative): Likewise.
1417 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1418 (Output_data_reloc::add_local_section): Likewise.
1419 (Output_data_reloc::add_output_section): Likewise.
1420 (Output_data_reloc::add_absolute): Likewise.
1421 (Output_data_reloc::add_target_specific): Likewise.
1422 (Output_data_got::reserve_slot): Move definition here.
1423 (Output_data_got::reserve_local): New function.
1424 (Output_data_got::reserve_global): New function.
1425 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1426 section_offsets_ with accessor function.
1427 (Sized_relobj_file::write_sections): Likewise.
1428 (Sized_relobj_file::do_relocate_sections): Likewise.
1429 * target.h (Sized_target::reserve_local_got_entry): New function.
1430 (Sized_target::reserve_global_got_entry): New function.
1431 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1432 (Target_x86_64::reserve_global_got_entry): New function.
1433 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1435 2011-05-23 Cary Coutant <ccoutant@google.com>
1437 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1438 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1439 bit when checking got_type.
1440 * incremental.cc (Sized_incremental_binary::setup_readers):
1441 Store symbol table and string table locations; initialize bit vector
1442 of file status flags.
1443 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1445 (Sized_incremental_binary::do_process_got_plt): New function.
1446 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1447 (Output_section_incremental_inputs::set_final_data_size): Record
1448 file index for each input file.
1449 (Output_section_incremental_inputs::write_got_plt): Store file index
1450 instead of input entry offset for each GOT entry.
1452 (Incremental_input_entry::Incremental_input_entry): Initialize new
1454 (Incremental_input_entry::set_offset): Store file index.
1455 (Incremental_input_entry::get_file_index): New function.
1456 (Incremental_input_entry::file_index_): New data member.
1457 (Incremental_binary::process_got_plt): New function.
1458 (Incremental_binary::do_process_got_plt): New function.
1459 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1461 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1462 (Sized_incremental_binary::set_file_is_unchanged): New function.
1463 (Sized_incremental_binary::file_is_unchanged): New function.
1464 (Sized_incremental_binary::do_process_got_plt): New function.
1465 (Sized_incremental_binary::file_status_): New data member.
1466 (Sized_incremental_binary::main_symtab_loc_): New data member.
1467 (Sized_incremental_binary::main_strtab_loc_): New data member.
1468 * output.cc (Output_data_got::Got_entry::write): Add case
1470 (Output_data_got::add_global): Call add_got_entry.
1471 (Output_data_got::add_global_plt): Likewise.
1472 (Output_data_got::add_global_with_rel): Likewise.
1473 (Output_data_got::add_global_with_rela): Likewise.
1474 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1475 (Output_data_got::add_global_pair_with_rela): Likewise.
1476 (Output_data_got::add_local): Call add_got_entry.
1477 (Output_data_got::add_local_plt): Likewise.
1478 (Output_data_got::add_local_with_rel): Likewise.
1479 (Output_data_got::add_local_with_rela): Likewise.
1480 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1481 (Output_data_got::add_local_pair_with_rela): Likewise.
1482 (Output_data_got::reserve_slot): New function.
1483 (Output_data_got::reserve_slot_for_global): New function.
1484 (Output_data_got::add_got_entry): New function.
1485 (Output_data_got::add_got_entry_pair): New function.
1486 (Output_section::add_output_section_data): Edit FIXME.
1488 (Output_section_data_build::Output_section_data_build): New
1489 constructor with size parameter.
1490 (Output_data_space::Output_data_space): Likewise.
1491 (Output_data_got::Output_data_got): Initialize new data member; new
1492 constructor with size parameter.
1493 (Output_data_got::add_constant): Call add_got_entry.
1494 (Output_data_got::reserve_slot): New function.
1495 (Output_data_got::reserve_slot_for_global): New function.
1496 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1497 (Output_data_got::add_got_entry): New function.
1498 (Output_data_got::add_got_entry_pair): New function.
1499 (Output_data_got::free_list_): New data member.
1500 * target.h (Sized_target::init_got_plt_for_update): New function.
1501 (Sized_target::register_global_plt_entry): New function.
1502 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1503 Initialize new data member; call init; add constructor with PLT count.
1504 (Output_data_plt_x86_64::init): New function.
1505 (Output_data_plt_x86_64::add_relocation): New function.
1506 (Output_data_plt_x86_64::reserve_slot): New function.
1507 (Output_data_plt_x86_64::free_list_): New data member.
1508 (Target_x86_64::init_got_plt_for_update): New function.
1509 (Target_x86_64::register_global_plt_entry): New function.
1510 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1511 incremental updates.
1512 (Output_data_plt_x86_64::add_relocation): New function.
1513 * testsuite/object_unittest.cc (Object_test): Set default options.
1515 2011-05-16 Ian Lance Taylor <iant@google.com>
1517 * options.h (class General_options): Make -i a synonym for -r.
1519 2011-05-16 Ian Lance Taylor <iant@google.com>
1521 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1523 2011-05-10 Cary Coutant <ccoutant@google.com>
1525 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1528 2011-05-06 Ian Lance Taylor <iant@google.com>
1530 * layout.cc (Layout::layout): If the output section flags change,
1531 update the ordering.
1533 2011-04-25 Cary Coutant <ccoutant@google.com>
1535 * incremental-dump.cc (dump_incremental_inputs): Print local
1536 symbol info for each input file.
1538 (Output_section_incremental_inputs::set_final_data_size): Add local
1539 symbol info to input file entries in incremental info.
1540 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1541 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1542 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1543 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1545 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1546 (Sized_incr_relobj::do_relocate): Write the local symbols.
1547 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1548 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1549 Adjust size of input file header.
1550 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1551 (Incremental_inputs_reader::get_local_symbol_count): New function.
1552 (Incremental_inputs_reader::get_input_section): Adjust size of input
1554 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1555 (Sized_incr_relobj::This): New typedef.
1556 (Sized_incr_relobj::sym_size): New const data member.
1557 (Sized_incr_relobj::Local_symbol): New struct.
1558 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1559 (Sized_incr_relobj::do_local_symbol_offset): New function.
1560 (Sized_incr_relobj::local_symbol_count_): New data member.
1561 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1562 (Sized_incr_relobj::local_symbol_index_): New data member.
1563 (Sized_incr_relobj::local_symbol_offset_): New data member.
1564 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1565 (Sized_incr_relobj::local_symbols_): New data member.
1566 * object.h (Relobj::output_local_symbol_count): New function.
1567 (Relobj::local_symbol_offset): New function.
1568 (Relobj::do_output_local_symbol_count): New function.
1569 (Relobj::do_local_symbol_offset): New function.
1570 (Sized_relobj::do_output_local_symbol_count): New function.
1571 (Sized_relobj::do_local_symbol_offset): New function.
1573 2011-04-22 Vladimir Simonov <sv@sw.ru>
1575 * descriptors.cc (set_close_on_exec): New function.
1576 (Descriptors::open): Use set_close_on_exec.
1577 * output.cc (S_ISLNK): Define if not defined.
1579 2011-04-22 Cary Coutant <ccoutant@google.com>
1581 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1583 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1584 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1585 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1587 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1588 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1589 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1591 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1593 (Incremental_binary::apply_incremental_relocs): New function.
1594 (Incremental_binary::do_apply_incremental_relocs): New function.
1595 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1597 (Sized_incremental_binary::add_global_symbol): New function.
1598 (Sized_incremental_binary::global_symbol): New function.
1599 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1600 (Sized_incremental_binary::symbol_map_): New data member.
1601 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1602 * target.h (Sized_target::apply_relocation): New function.
1603 * target-reloc.h (apply_relocation): New function.
1604 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1606 2011-04-22 Doug Kwan <dougkwan@google.com>
1608 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1609 flag of a SHT_ARM_EXIDX section.
1610 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1611 * testsuite/Makefile.in: Regenerate.
1612 * testsuite/arm_exidx_test.s: New file.
1613 * testsuite/arm_exidx_test.sh: Same.
1615 2011-04-20 Cary Coutant <ccoutant@google.com>
1618 * archive.h (Incremental_archive_entry::Archive_member):
1619 Initialize arg_serial_ (second constructor).
1621 2011-04-17 Ian Lance Taylor <iant@google.com>
1623 * object.cc (Relocate_info::location): Simplify location string.
1624 * errors.cc (Errors::error_at_location): Don't print program
1626 (Errors::warning_at_location): Likewise.
1627 (Errors::undefined_symbol): Likewise.
1628 * testsuite/debug_msg.sh: Update accordingly.
1630 2011-04-14 Cary Coutant <ccoutant@google.com>
1632 * gold/layout.cc (Layout::symtab_section_offset): New function.
1633 * gold/layout.h (Layout::symtab_section_offset): New function.
1634 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1636 2011-04-12 Ian Lance Taylor <iant@google.com>
1638 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1639 with MREMAP_MAYMOVE.
1640 * output.h (class Output_file): Add map_is_allocated_ field.
1641 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1642 not available, provide stubs. If mremap is not available, #define
1644 (MREMAP_MAYMOVE): Define if not defined.
1645 (Output_file::Output_file): Initialize map_is_allocated_.
1646 (Output_file::resize): Check map_is_allocated_.
1647 (Output_file::map_anonymous): If mmap fails, use malloc.
1648 (Output_file::unmap): Don't do anything for an anonymous map.
1649 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1650 is not available, provide stubs.
1651 (File_read::View::~View): Use free rather than delete[].
1652 (File_read::make_view): Use malloc rather than new[]. If mmap
1654 (File_read::find_or_make_view): Use malloc rather than new[].
1655 * gold.h: Remove HAVE_REMAP code.
1656 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1657 exists. Rename mremap to gold_mremap. If mmap is not available
1659 * configure, config.in: Rebuild.
1661 2011-04-11 Ian Lance Taylor <iant@google.com>
1663 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1664 initialize local variable v.
1666 2011-04-11 Cary Coutant <ccoutant@google.com>
1668 * archive.cc (Archive::include_member): Adjust call to
1670 (Add_archive_symbols::run): Track argument serial numbers.
1671 (Lib_group::include_member): Likewise.
1672 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1673 * archive.h (Incremental_archive_entry::Archive_member):
1674 Initialize arg_serial_.
1675 (Archive_member::arg_serial_): New data member.
1676 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1677 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1679 (Sized_dynobj::do_for_all_local_got_entries): New function.
1680 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1682 * fileread.cc (get_mtime): New function.
1683 * fileread.h (get_mtime): New function.
1684 * gold.cc (queue_initial_tasks): Check for incremental update.
1685 (process_incremental_input): New function.
1686 (queue_middle_tasks): Don't force valid target for incremental
1688 * incremental-dump.cc (find_input_containing_global): Adjust
1689 size of symbol info entry.
1690 (dump_incremental_inputs): Dump argument serial number and
1691 in_system_directory flag; bias shndx by 1; print symbol names
1692 when dumping per-file symbol lists; use new symbol info readers.
1694 (Output_section_incremental_inputs:update_data_size): New function.
1695 (Sized_incremental_binary::setup_readers): Setup input readers
1696 for each input file; build maps for files added from libraries
1698 (Sized_incremental_binary::check_input_args): New function.
1699 (Sized_incremental_binary::do_check_inputs): Build map of argument
1700 serial numbers to input arguments.
1701 (Sized_incremental_binary::do_file_has_changed): Rename
1702 do_file_is_unchanged to this; compare file modification times.
1703 (Sized_incremental_binary::do_init_layout): New function.
1704 (Sized_incremental_binary::do_reserve_layout): New function.
1705 (Sized_incremental_binary::do_get_input_reader): Remove.
1706 (Sized_incremental_binary::get_symtab_view): New function.
1707 (Incremental_checker::can_incrementally_link_output_file): Remove.
1708 (Incremental_inputs::report_command_line): Exclude --debug options.
1709 (Incremental_inputs::report_archive_begin): Add parameter; track
1710 argument serial numbers; don't put input file entry for archive
1711 before archive members.
1712 (Incremental_inputs::report_archive_end): Put input file entry
1713 for archive after archive members.
1714 (Incremental_inputs::report_object): Add parameter; track argument
1715 serial numbers and in_system_directory flag.
1716 (Incremental_inputs::report_script): Add parameter; track argument
1718 (Output_section_incremental_inputs::set_final_data_size): Adjust
1719 size of symbol info entry; check for forwarding symbols.
1720 (Output_section_incremental_inputs::write_input_files): Write
1721 in_system_directory flag and argument serial number.
1722 (Output_section_incremental_inputs::write_info_blocks): Map section
1723 indices between incremental info and original input file; store
1724 input section index for each symbol.
1725 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1726 change operator() to visit().
1727 (class Global_got_offset_visitor): Likewise.
1728 (class Global_symbol_visitor_got_plt):
1729 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1731 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1732 (Sized_incr_relobj::do_read_symbols): New function.
1733 (Sized_incr_relobj::do_layout): New function.
1734 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1735 (Sized_incr_relobj::do_add_symbols): New function.
1736 (Sized_incr_relobj::do_should_include_member): New function.
1737 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1738 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1739 (Sized_incr_relobj::do_section_size): New function.
1740 (Sized_incr_relobj::do_section_name): New function.
1741 (Sized_incr_relobj::do_section_contents): New function.
1742 (Sized_incr_relobj::do_section_flags): New function.
1743 (Sized_incr_relobj::do_section_entsize): New function.
1744 (Sized_incr_relobj::do_section_address): New function.
1745 (Sized_incr_relobj::do_section_type): New function.
1746 (Sized_incr_relobj::do_section_link): New function.
1747 (Sized_incr_relobj::do_section_info): New function.
1748 (Sized_incr_relobj::do_section_addralign): New function.
1749 (Sized_incr_relobj::do_initialize_xindex): New function.
1750 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1751 (Sized_incr_relobj::do_read_relocs): New function.
1752 (Sized_incr_relobj::do_gc_process_relocs): New function.
1753 (Sized_incr_relobj::do_scan_relocs): New function.
1754 (Sized_incr_relobj::do_count_local_symbols): New function.
1755 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1756 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1757 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1758 (Sized_incr_relobj::do_relocate): New function.
1759 (Sized_incr_relobj::do_set_section_offset): New function.
1760 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1761 (Sized_incr_dynobj::do_read_symbols): New function.
1762 (Sized_incr_dynobj::do_layout): New function.
1763 (Sized_incr_dynobj::do_add_symbols): New function.
1764 (Sized_incr_dynobj::do_should_include_member): New function.
1765 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1766 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1767 (Sized_incr_dynobj::do_section_size): New function.
1768 (Sized_incr_dynobj::do_section_name): New function.
1769 (Sized_incr_dynobj::do_section_contents): New function.
1770 (Sized_incr_dynobj::do_section_flags): New function.
1771 (Sized_incr_dynobj::do_section_entsize): New function.
1772 (Sized_incr_dynobj::do_section_address): New function.
1773 (Sized_incr_dynobj::do_section_type): New function.
1774 (Sized_incr_dynobj::do_section_link): New function.
1775 (Sized_incr_dynobj::do_section_info): New function.
1776 (Sized_incr_dynobj::do_section_addralign): New function.
1777 (Sized_incr_dynobj::do_initialize_xindex): New function.
1778 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1779 (make_sized_incremental_object): New function.
1780 (Incremental_library::copy_unused_symbols): New function.
1781 (Incremental_library::do_for_all_unused_symbols): New function.
1782 * incremental.h (enum Incremental_input_flags): New type.
1783 (class Incremental_checker): Remove.
1784 (Incremental_input_entry::Incremental_input_entry): Add argument
1786 (Incremental_input_entry::arg_serial): New function.
1787 (Incremental_input_entry::set_is_in_system_directory): New function.
1788 (Incremental_input_entry::is_in_system_directory): New function.
1789 (Incremental_input_entry::arg_serial_): New data member.
1790 (Incremental_input_entry::is_in_system_directory_): New data member.
1791 (class Script_info): Move here from script.h.
1792 (Script_info::Script_info): Add filename parameter.
1793 (Script_info::filename): New function.
1794 (Script_info::filename_): New data member.
1795 (Incremental_script_entry::Incremental_script_entry): Add argument
1797 (Incremental_object_entry::Incremental_object_entry): Likewise.
1798 (Incremental_object_entry::add_input_section): Build list of input
1799 sections with map to original shndx.
1800 (Incremental_object_entry::get_input_section_index): New function.
1801 (Incremental_object_entry::shndx_): New data member.
1802 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1803 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1804 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1806 (Incremental_inputs::report_archive_begin): Likewise.
1807 (Incremental_inputs::report_object): Likewise.
1808 (Incremental_inputs::report_script): Likewise.
1809 (class Incremental_global_symbol_reader): New class.
1810 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1811 and store flags and input file type.
1812 (Incremental_input_entry_reader::arg_serial): New function.
1813 (Incremental_input_entry_reader::type): Extract type from flags.
1814 (Incremental_input_entry_reader::is_in_system_directory): New function.
1815 (Incremental_input_entry_reader::get_input_section_count): Call
1816 accessor function for type.
1817 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1818 function for type; adjust size of global symbol entry.
1819 (Incremental_input_entry_reader::get_global_symbol_count): Call
1820 accessor function for type.
1821 (Incremental_input_entry_reader::get_object_count): Likewise.
1822 (Incremental_input_entry_reader::get_object_offset): Likewise.
1823 (Incremental_input_entry_reader::get_member_count): Likewise.
1824 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1825 (Incremental_input_entry_reader::get_member_offset): Likewise.
1826 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1827 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1828 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1829 (Incremental_input_entry_reader::get_global_symbol_reader): New
1831 (Incremental_input_entry_reader::get_output_symbol_index): New
1833 (Incremental_input_entry_reader::type_): Remove.
1834 (Incremental_input_entry_reader::flags_): New data member.
1835 (Incremental_inputs_reader::input_file_offset): New function.
1836 (Incremental_inputs_reader::input_file_index): New function.
1837 (Incremental_inputs_reader::input_file): Call input_file_offset.
1838 (Incremental_inputs_reader::input_file_at_offset): New function.
1839 (Incremental_relocs_reader::get_r_type): Reformat.
1840 (Incremental_relocs_reader::get_r_shndx): Reformat.
1841 (Incremental_relocs_reader::get_r_offset): Reformat.
1842 (Incremental_relocs_reader::data): New function.
1843 (Incremental_binary::Incremental_binary): Initialize new data members.
1844 (Incremental_binary::check_inputs): Add cmdline parameter.
1845 (Incremental_binary::file_is_unchanged): Remove.
1846 (Input_reader::arg_serial): New function.
1847 (Input_reader::get_unused_symbol_count): New function.
1848 (Input_reader::get_unused_symbol): New function.
1849 (Input_reader::do_arg_serial): New function.
1850 (Input_reader::do_get_unused_symbol_count): New function.
1851 (Input_reader::do_get_unused_symbol): New function.
1852 (Incremental_binary::input_file_count): New function.
1853 (Incremental_binary::get_input_reader): Change signature to use
1854 index instead of filename.
1855 (Incremental_binary::file_has_changed): New function.
1856 (Incremental_binary::get_input_argument): New function.
1857 (Incremental_binary::get_library): New function.
1858 (Incremental_binary::get_script_info): New function.
1859 (Incremental_binary::init_layout): New function.
1860 (Incremental_binary::reserve_layout): New function.
1861 (Incremental_binary::output_file): New function.
1862 (Incremental_binary::do_check_inputs): New function.
1863 (Incremental_binary::do_file_is_unchanged): Remove.
1864 (Incremental_binary::do_file_has_changed): New function.
1865 (Incremental_binary::do_init_layout): New function.
1866 (Incremental_binary::do_reserve_layout): New function.
1867 (Incremental_binary::do_input_file_count): New function.
1868 (Incremental_binary::do_get_input_reader): Change signature.
1869 (Incremental_binary::input_args_map_): New data member.
1870 (Incremental_binary::library_map_): New data member.
1871 (Incremental_binary::script_map_): New data member.
1872 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1874 (Sized_incremental_binary::output_section): New function.
1875 (Sized_incremental_binary::inputs_reader): Add const.
1876 (Sized_incremental_binary::symtab_reader): Add const.
1877 (Sized_incremental_binary::relocs_reader): Add const.
1878 (Sized_incremental_binary::got_plt_reader): Add const.
1879 (Sized_incremental_binary::get_symtab_view): New function.
1880 (Sized_incremental_binary::Inputs_reader): New typedef.
1881 (Sized_incremental_binary::Input_entry_reader): New typedef.
1882 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1883 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1884 (Sized_incremental_binary::do_file_has_changed): New function.
1885 (Sized_incremental_binary::do_init_layout): New function.
1886 (Sized_incremental_binary::do_reserve_layout): New function.
1887 (Sized_input_reader::Inputs_reader): Remove.
1888 (Sized_input_reader::Input_entry_reader): Remove.
1889 (Sized_input_reader::do_arg_serial): New function.
1890 (Sized_input_reader::do_get_unused_symbol_count): New function.
1891 (Sized_input_reader::do_get_unused_symbol): New function.
1892 (Sized_incremental_binary::do_input_file_count): New function.
1893 (Sized_incremental_binary::do_get_input_reader): Change signature;
1894 use index instead of filename.
1895 (Sized_incremental_binary::section_map_): New data member.
1896 (Sized_incremental_binary::input_entry_readers_): New data member.
1897 (class Sized_incr_relobj): New class.
1898 (class Sized_incr_dynobj): New class.
1899 (make_sized_incremental_object): New function.
1900 (class Incremental_library): New class.
1901 * layout.cc (Free_list::num_lists): New static data member.
1902 (Free_list::num_nodes): New static data member.
1903 (Free_list::num_removes): New static data member.
1904 (Free_list::num_remove_visits): New static data member.
1905 (Free_list::num_allocates): New static data member.
1906 (Free_list::num_allocate_visits): New static data member.
1907 (Free_list::init): New function.
1908 (Free_list::remove): New function.
1909 (Free_list::allocate): New function.
1910 (Free_list::dump): New function.
1911 (Free_list::print_stats): New function.
1912 (Layout_task_runner::run): Resize output file for incremental updates.
1913 (Layout::Layout): Initialize new data members.
1914 (Layout::set_incremental_base): New function.
1915 (Layout::init_fixed_output_section): New function.
1916 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1917 incremental updates.
1918 (Layout::create_gold_note): Do not create gold note section for
1919 incremental updates.
1920 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1921 for incremental updates.
1922 (Layout::set_section_offsets): For incremental updates, allocate space
1924 (Layout::create_symtab_sections): Layout with offsets relative to
1925 start of section; for incremental updates, allocate space from free
1927 (Layout::create_shdrs): For incremental updates, allocate space from
1929 (Layout::finish_dynamic_section): For incremental updates, do not
1930 check --as-needed (fixed in subsequent patch).
1931 * layout.h (class Free_list): New class.
1932 (Layout::set_incremental_base): New function.
1933 (Layout::incremental_base): New function.
1934 (Layout::init_fixed_output_section): New function.
1935 (Layout::allocate): New function.
1936 (Layout::incremental_base_): New data member.
1937 (Layout::free_list_): New data member.
1938 * main.cc (main): Print Free_list statistics.
1939 * object.cc (Relobj::finalize_incremental_relocs): Add
1940 clear_counts parameter; clear counts only when clear_counts is set.
1941 (Sized_relobj::Sized_relobj): Initialize new base class.
1942 (Sized_relobj::do_layout): Don't report special sections.
1943 (Sized_relobj::do_for_all_local_got_entries): New function.
1944 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1945 symtab_off to all symbol table offsets.
1946 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1947 * object.h (class Got_offset_list): Move to top of file.
1948 (Object::Object): Allow case where input_file == NULL.
1949 (Object::~Object): Likewise.
1950 (Object::input_file): Assert that input_file != NULL.
1951 (Object::lock): Allow case where input_file == NULL.
1952 (Object::unlock): Likewise.
1953 (Object::is_locked): Likewise.
1954 (Object::token): Likewise.
1955 (Object::release): Likewise.
1956 (Object::is_incremental): New function.
1957 (Object::get_mtime): New function.
1958 (Object::for_all_local_got_entries): New function.
1959 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1960 (Object::set_is_in_system_directory): New function.
1961 (Object::is_in_system_directory): New function.
1962 (Object::do_is_incremental): New function.
1963 (Object::do_get_mtime): New function.
1964 (Object::do_for_all_local_got_entries): New function.
1965 (Object::is_in_system_directory_): New data member.
1966 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1967 (class Sized_relobj_base): New class.
1968 (class Sized_relobj): Derive from Sized_relobj_base.
1969 (class Sized_relobj::Symbols): Redeclare from base class.
1970 (class Sized_relobj::local_got_offset_list): Remove.
1971 (class Sized_relobj::Output_sections): Redeclare from base class.
1972 (class Sized_relobj::do_for_all_local_got_entries): New function.
1973 (class Sized_relobj::write_local_symbols): Add offset parameter.
1974 (class Sized_relobj::local_symbol_offset_): Update comment.
1975 (class Sized_relobj::local_dynsym_offset_): Update comment.
1976 * options.cc (Input_arguments::add_file): Remove const.
1977 * options.h (Input_file_argument::Input_file_argument):
1978 Initialize arg_serial_ (all constructors).
1979 (Input_file_argument::set_arg_serial): New function.
1980 (Input_file_argument::arg_serial): New function.
1981 (Input_file_argument::arg_serial_): New data member.
1982 (Input_arguments::Input_arguments): Initialize file_count_.
1983 (Input_arguments::add_file): Remove const.
1984 (Input_arguments::number_of_input_files): New function.
1985 (Input_arguments::file_count_): New data member.
1986 (Command_line::number_of_input_files): Call
1987 Input_arguments::number_of_input_files.
1988 * output.cc (Output_segment_headers::Output_segment_headers):
1990 (Output_section::Input_section::current_data_size): New function.
1991 (Output_section::Output_section): Initialize new data members.
1992 (Output_section::add_input_section): Don't do merge sections for
1993 an incremental link; allocate space from free list for an
1995 (Output_section::add_output_section_data): Allocate space from
1996 free list for an incremental update.
1997 (Output_section::update_data_size): New function.
1998 (Output_section::set_fixed_layout): New function.
1999 (Output_section::reserve): New function.
2000 (Output_segment::set_section_addresses): Remove const.
2001 (Output_segment::set_section_list_addresses): Remove const; allocate
2002 space from free list for an incremental update.
2003 (Output_segment::set_offset): Adjust size of RELRO segment for an
2005 * output.h (Output_data::current_data_size): Move here from
2007 (Output_data::pre_finalize_data_size): New function.
2008 (Output_data::update_data_size): New function.
2009 (Output_section_headers::update_data_size): new function.
2010 (Output_section_data_build::current_data_size): Move to Output_data.
2011 (Output_data_strtab::update_data_size): New function.
2012 (Output_section::current_data_size): Move to Output_data.
2013 (Output_section::set_fixed_layout): New function.
2014 (Output_section::has_fixed_layout): New function.
2015 (Output_section::reserve): New function.
2016 (Output_section::update_data_size): New function.
2017 (Output_section::has_fixed_layout_): New data member.
2018 (Output_section::free_list_): New data member.
2019 (Output_segment::set_section_addresses): Remove const.
2020 (Output_segment::set_section_list_addresses): Remove const.
2021 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2023 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2025 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2026 parameter when calling Add_symbols constructor; store argument
2027 serial number for members of a lib group.
2028 (Add_symbols::locks): Allow case where token == NULL.
2029 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2030 (Read_member::~Read_member): New function.
2031 (Read_member::is_runnable): New function.
2032 (Read_member::locks): New function.
2033 (Read_member::run): New function.
2034 (Check_script::~Check_script): New function.
2035 (Check_script::is_runnable): New function.
2036 (Check_script::locks): New function.
2037 (Check_script::run): New function.
2038 (Check_library::~Check_library): New function.
2039 (Check_library::is_runnable): New function.
2040 (Check_library::locks): New function.
2041 (Check_library::run): New function.
2042 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2043 (Add_symbols::library_): New data member.
2044 (class Read_member): New class.
2045 (class Check_script): New class.
2046 (class Check_library): New class.
2047 * reloc.cc (Read_relocs::is_runnable): Allow case where
2049 (Read_relocs::locks): Likewise.
2050 (Scan_relocs::locks): Likewise.
2051 (Relocate_task::locks): Likewise.
2052 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2054 (Sized_relobj::incremental_relocs_scan): Fix comment.
2055 (Sized_relobj::do_relocate): Pass output file offset to
2056 write_local_symbols.
2057 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2058 from class declaration.
2059 * script.cc (read_input_script): Allocate Script_info; pass
2060 argument serial number to report_script.
2061 * script.h (class Script_info): Move to incremental.h.
2062 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2063 * symtab.h (Symbol_table::add_from_incrobj): New function.
2064 (Symbol_table::set_file_offset): New function.
2066 2011-04-05 Cary Coutant <ccoutant@google.com>
2068 * incremental-dump.cc (dump_incremental_inputs): Change signature
2069 to take a Sized_incremental_binary; change caller. Use readers
2070 in Sized_incremental_binary.
2072 (Sized_incremental_binary::find_incremental_inputs_sections):
2073 Rename do_find_incremental_inputs_sections to this.
2074 (Sized_incremental_binary::setup_readers): New function.
2075 (Sized_incremental_binary::do_check_inputs): Check
2076 has_incremental_info_ flag; move setup code to setup_readers;
2078 (Sized_incremental_binary::do_file_is_unchanged): New function.
2079 (Sized_incremental_binary::do_get_input_reader): New function.
2080 * incremental.h (class Incremental_binary): Move to end of file.
2081 (Incremental_binary::file_is_unchanged): New function.
2082 (Incremental_binary::do_file_is_unchanged): New function.
2083 (Incremental_binary::Input_reader): New class.
2084 (Incremental_binary::get_input_reader): New function.
2085 (class Sized_incremental_binary): Move to end of file.
2086 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2087 input section reader classes.
2088 (Sized_incremental_binary::has_incremental_info): New function.
2089 (Sized_incremental_binary::inputs_reader): New function.
2090 (Sized_incremental_binary::symtab_reader): New function.
2091 (Sized_incremental_binary::relocs_reader): New function.
2092 (Sized_incremental_binary::got_plt_reader): New function.
2093 (Sized_incremental_binary::do_file_is_unchanged): New function.
2094 (Sized_incremental_binary::Sized_input_reader): New class.
2095 (Sized_incremental_binary::get_input_reader): New function.
2096 (Sized_incremental_binary::find_incremental_inputs_sections):
2097 Rename do_find_incremental_inputs_sections to this.
2098 (Sized_incremental_binary::setup_readers): New function.
2099 (Sized_incremental_binary::has_incremental_info_): New data member.
2100 (Sized_incremental_binary::inputs_reader_): New data member.
2101 (Sized_incremental_binary::symtab_reader_): New data member.
2102 (Sized_incremental_binary::relocs_reader_): New data member.
2103 (Sized_incremental_binary::got_plt_reader_): New data member.
2104 (Sized_incremental_binary::current_input_file_): New data member.
2106 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2109 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2112 2011-03-30 Cary Coutant <ccoutant@google.com>
2114 * archive.cc (Archive::include_member): Adjust call to report_object.
2115 (Add_archive_symbols::run): Add script_info to call to
2116 report_archive_begin.
2117 (Lib_group::include_member): Adjust call to report_object.
2118 (Add_lib_group_symbols::run): Adjust call to report_object.
2119 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2120 blocks. Add object count for script input files.
2121 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2122 script_info parameter; change all callers.
2123 (Incremental_inputs::report_object): Add script_info parameter;
2125 (Incremental_inputs::report_script): Store backpointer to
2126 incremental info entry.
2127 (Output_section_incremental_inputs::set_final_data_size): Record
2128 additional information for scripts.
2129 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2130 * incremental.h (Incremental_script_entry::add_object): New function.
2131 (Incremental_script_entry::get_object_count): New function.
2132 (Incremental_script_entry::get_object): New function.
2133 (Incremental_script_entry::objects_): New data member; adjust
2135 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2136 (Incremental_inputs::report_object): Add script_info parameter.
2137 (Incremental_inputs_reader::get_object_count): New function.
2138 (Incremental_inputs_reader::get_object_offset): New function.
2139 * options.cc (Input_arguments::add_file): Return reference to
2141 * options.h (Input_argument::set_script_info): New function.
2142 (Input_argument::script_info): New function.
2143 (Input_argument::script_info_): New data member; adjust all
2145 (Input_file_group::add_file): Return reference to new input argument.
2146 (Input_file_lib::add_file): Likewise.
2147 (Input_arguments::add_file): Likewise.
2148 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2149 * script.cc (Parser_closure::Parser_closure): Add script_info
2150 parameter; adjust all callers.
2151 (Parser_closure::script_info): New function.
2152 (Parser_closure::script_info_): New data member.
2153 (read_input_script): Report scripts earlier to incremental info.
2154 (script_add_file): Set script_info in Input_argument.
2155 (script_add_library): Likewise.
2156 * script.h (Script_options::Script_info): Rewrite class.
2158 2011-03-29 Cary Coutant <ccoutant@google.com>
2160 * archive.cc (Library_base::should_include_member): Move
2161 method here from class Archive.
2162 (Archive::Archive): Initialize base class.
2163 (Archive::should_include_member): Move to base class.
2164 (Archive::do_for_all_unused_symbols): New function.
2165 (Add_archive_symbols::run): Remove redundant access to
2167 (Lib_group::Lib_group): Initialize base class.
2168 (Lib_group::do_filename): New function.
2169 (Lib_group::include_member): Pass pointer to Lib_group to
2171 (Lib_group::do_for_all_unused_symbols): New function.
2172 (Add_lib_group_symbols::run): Report archive information for
2174 * archive.h (class Library_base): New base class.
2175 (class Archive): Derive from Library_base.
2176 (Archive::filename): Move to base class.
2177 (Archive::set_incremental_info): Likewise.
2178 (Archive::incremental_info): Likewise.
2179 (Archive::Should_include): Likewise.
2180 (Archive::should_include_member): Likewise.
2181 (Archive::Armap_entry): Remove.
2182 (Archive::Unused_symbol_iterator): Remove.
2183 (Archive::unused_symbols_begin): Remove.
2184 (Archive::unused_symbols_end): Remove.
2185 (Archive::do_filename): New function.
2186 (Archive::do_get_mtime): New function.
2187 (Archive::do_for_all_unused_symbols): New function.
2188 (Archive::task_): Move to base class.
2189 (Archive::incremental_info_): Likewise.
2190 (class Lib_group): Derive from Library_base.
2191 (Lib_group::do_filename): New function.
2192 (Lib_group::do_get_mtime): New function.
2193 (Lib_group::do_for_all_unused_symbols): New function.
2194 (Lib_group::task_): Move to base class.
2195 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2197 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2199 * incremental.cc (Incremental_inputs::report_archive_begin):
2200 Use Library_base; call library's get_mtime; add incremental inputs
2201 entry before members.
2202 (class Unused_symbol_visitor): New class.
2203 (Incremental_inputs::report_archive_end): Use Library_base; use
2204 visitor class to record unused symbols; don't add incremental inputs
2205 entry after members.
2206 (Incremental_inputs::report_object): Use Library_base.
2208 (Incremental_archive_entry::Incremental_archive_entry): Remove
2209 unused Archive parameter.
2210 (Incremental_inputs::report_archive_begin): Use Library_base.
2211 (Incremental_inputs::report_archive_end): Likewise.
2212 (Incremental_inputs::report_object): Likewise.
2213 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2215 * object.h (Object::for_all_global_symbols): New function.
2216 (Object::do_for_all_global_symbols): New function.
2217 (Sized_relobj::do_for_all_global_symbols): New function.
2218 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2220 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2223 2011-03-27 Ian Lance Taylor <iant@google.com>
2225 * archive.cc (Archive::interpret_header): Return -1 if something
2226 goes wrong. Change callers accordingly.
2228 2011-03-25 Cary Coutant <ccoutant@google.com>
2230 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2231 * testsuite/Makefile.in: Regenerate.
2233 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2235 * plugin.cc (get_view): New.
2236 (Plugin::load): Pass get_view to the plugin.
2237 (Plugin_manager::get_view): New.
2239 2011-03-21 Ian Lance Taylor <iant@google.com>
2241 * testsuite/final_layout.sh: Rewrite to not use dc.
2242 * testsuite/relro_test.sh: Fail if dc is not present.
2244 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2246 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2248 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2249 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2251 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2252 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2254 2011-03-14 Ian Lance Taylor <iant@google.com>
2256 * script-sections.cc (Sort_output_sections::script_compare):
2257 Rename from is_before, change return type.
2258 (Sort_output_sections::operator()): Adjust accordingly.
2260 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2263 * testsuite/odr_violation2.cc: Add comment to make all error line
2264 numbers double digits.
2265 * testsuite/debug_msg.sh: Adjust expected errors.
2267 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2269 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2270 but mark earlier ones as non-canonical
2271 (offset_to_iterator): Update search target and example
2272 (do_addr2line): Return extra lines in a vector*
2273 (format_file_lineno): Extract from do_addr2line
2274 (one_addr2line): Add vector* out-param
2275 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2276 when a lineno entry appeared last for its instruction
2277 (Dwarf_line_info): Add vector* out-param
2278 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2279 * symtab.cc (Odr_violation_compare): Include the lineno in the
2281 (linenos_from_loc): New. Combine the canonical line for an
2282 address with its other lines.
2283 (True_if_intersect): New. Helper functor to make
2284 std::set_intersection a query.
2285 (detect_odr_violations): Compare sets of lines instead of just
2286 one line for each function. This became less deterministic, but
2287 has fewer false positives.
2288 * symtab.h: Declarations.
2289 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2290 mix an optimized and non-optimized object in the same binary
2291 (odr_violation2.so): Same.
2292 * testsuite/Makefile.in: Regenerate from Makefile.am.
2293 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2294 * testsuite/debug_msg.sh: Update line numbers and add
2296 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2297 non-optimized context.
2298 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2299 isn't inlined, and use OdrDerived in an optimized context.
2300 * testsuite/odr_header1.h: Defines OdrDerived, where
2301 optimization will change the
2302 first-instruction-in-the-destructor's file and line number.
2303 * testsuite/odr_header2.h: Defines OdrBase.
2305 2011-03-09 Ian Lance Taylor <iant@google.com>
2307 * fileread.cc (File_read::clear_views): Don't delete the whole
2310 2011-03-08 Ian Lance Taylor <iant@google.com>
2313 * fileread.cc: #include <climits>.
2314 (GOLD_IOV_MAX): Define.
2315 (File_read::read_multiple): Limit number of entries by iov_max.
2316 * fileread.h (class File_read): Always set max_readv_entries to
2319 2011-03-07 Ian Lance Taylor <iant@google.com>
2322 * options.h (class General_options): Add -dy and -dn.
2324 2011-03-02 Cary Coutant <ccoutant@google.com>
2326 * testsuite/script_test_9.t: Add TLS segment.
2328 2011-03-02 Simon Baldwin <simonb@google.com>
2330 * configure.ac: Add check for gnu_indirect_function support in
2331 the toolchain building binutils.
2332 * configure: Rebuild.
2334 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2336 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2337 plugin only symbols.
2338 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2339 in plugin files as not needed in the symbol table.
2341 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2343 * output.cc (Output_section::add_input_section): Delay fill
2344 generation for section ordering.
2346 2011-02-09 Ian Lance Taylor <iant@google.com>
2349 * object.h (class Sized_relobj): Remove clear_local_symbols.
2350 * reloc.cc (Sized_relobj::do_relocate): Don't call
2351 clear_local_symbols.
2353 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2355 * plugin.cc (is_visible_from_outside): Return true for symbols
2358 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2360 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2363 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2365 * icf.h (is_section_foldable_candidate): Change type of parameter
2367 * icf.cc (Icf::find_identical_sections): Change type of local variable
2368 section_name to be std::string.
2369 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2371 2011-01-25 Ian Lance Taylor <iant@google.com>
2373 * script.cc (script_add_extern): Rewrite to use
2374 add_symbol_reference.
2376 2011-01-25 Doug Kwan <dougkwan@google.com>
2378 * icf.cc (get_section_contents): Always lock section's object.
2380 2011-01-24 Ian Lance Taylor <iant@google.com>
2382 * options.h (class General_options): Accept
2383 --no-detect-odr-violations.
2385 2011-01-24 Ian Lance Taylor <iant@google.com>
2387 * version.cc (version_string): Bump to 1.11.
2389 2011-01-24 Ian Lance Taylor <iant@google.com>
2391 * plugin.cc (class Plugin_rescan): Define new class.
2392 (Plugin_manager::claim_file): Set any_claimed_.
2393 (Plugin_manager::save_archive): New function.
2394 (Plugin_manager::save_input_group): New function.
2395 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2397 (Plugin_manager::new_undefined_symbol): New function.
2398 (Plugin_manager::rescan): New function.
2399 (Plugin_manager::rescannable_defines): New function.
2400 (Plugin_manager::add_input_file): Set any_added_.
2401 * plugin.h (class Plugin_manager): define new fields rescannable_,
2402 undefined_symbols_, any_claimed_, and any_added_. Declare
2403 Plugin_rescan as friend. Declare new functions.
2404 (Plugin_manager::Rescannable): Define type.
2405 (Plugin_manager::Rescannable_list): Define type.
2406 (Plugin_manager::Undefined_symbol_list): Define type.
2407 (Plugin_manager::Plugin_manager): Initialize new fields.
2408 * archive.cc (Archive::defines_symbol): New function.
2409 (Add_archive_symbols::run): Pass archive to plugins if any.
2410 * archive.h (class Archive): Declare defines_symbol.
2411 * readsyms.cc (Input_group::~Input_group): New function.
2412 (Finish_group::run): Pass input_group to plugins if any.
2413 * readsyms.h (class Input_group): Declare destructor.
2414 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2417 2011-01-10 Ian Lance Taylor <iant@google.com>
2419 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2421 (Layout::set_segment_offsets): Reset increase_relro before calling
2422 set_section_addresses a second time.
2424 2011-01-04 Cary Coutant <ccoutant@google.com>
2426 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2427 sections before NOBITS sections.
2429 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2431 * version.cc (print_version): Update copyright to 2011.
2433 2010-12-23 Cary Coutant <ccoutant@google.com>
2435 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2436 of OS to this->add. Add OD parameter to second form of the function.
2438 2010-12-20 Ian Lance Taylor <iant@google.com>
2440 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2441 second of two consecutive entries with same offset.
2443 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2445 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2446 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2447 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2448 to avoid unneeded links against $(LDADD).
2449 * testsuite/Makefile.in: Regenerate.
2451 2010-12-15 Ian Lance Taylor <iant@google.com>
2454 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2455 for R_X86_64_32 and R_X86_64_PC32.
2456 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2457 ver_matching_def_pic.o.
2458 (ver_matching_def_pic.o): New target.
2460 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2462 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2463 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2464 Move definition before File_read::View member definitions.
2465 (File_read::View::~View): Initialize and hold lock before
2466 updating current_mapped_bytes.
2468 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2470 * dwarf_reader.cc: Remove outdated comment.
2471 * gold-threads.cc: Fix typo in error message.
2472 * archive.cc: Fix typos in comments.
2473 * archive.h: Likewise.
2474 * arm-reloc-property.cc: Likewise.
2475 * arm-reloc-property.h: Likewise.
2476 * arm-reloc.def: Likewise.
2478 * attributes.h: Likewise.
2479 * cref.cc: Likewise.
2480 * ehframe.cc: Likewise.
2481 * fileread.h: Likewise.
2483 * i386.cc: Likewise.
2485 * incremental.h: Likewise.
2486 * int_encoding.cc: Likewise.
2487 * layout.h: Likewise.
2488 * main.cc: Likewise.
2489 * merge.h: Likewise.
2490 * object.cc: Likewise.
2491 * object.h: Likewise.
2492 * options.cc: Likewise.
2493 * readsyms.cc: Likewise.
2494 * reduced_debug_output.cc: Likewise.
2495 * reloc.cc: Likewise.
2496 * script-sections.cc: Likewise.
2497 * sparc.cc: Likewise.
2498 * symtab.h: Likewise.
2499 * target-reloc.h: Likewise.
2500 * target.cc: Likewise.
2501 * target.h: Likewise.
2502 * timer.cc: Likewise.
2503 * timer.h: Likewise.
2504 * x86_64.cc: Likewise.
2506 2010-12-09 Cary Coutant <ccoutant@google.com>
2508 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2510 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2511 parameter; change all callers.
2512 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2513 * options.h (warn_execstack): New option.
2515 2010-12-07 Doug Kwan <dougkwan@google.com>
2517 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2518 like function call relocations.
2520 2010-12-07 Ian Lance Taylor <iant@google.com>
2522 * archive.cc (Archive::get_elf_object_for_member): Permit
2523 punconfigured to be NULL.
2524 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2525 (Archive::include_member): Pass NULL to get_elf_object_for_member
2526 if we searched for the archive and this is the first included
2529 2010-12-01 Ian Lance Taylor <iant@google.com>
2531 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2532 track_relocs_type_ field.
2533 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2534 Set track_relocs_type_.
2535 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2536 contents when using RELA relocs.
2537 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2539 * reloc.cc (Track_relocs::next_addend): New function.
2540 * reloc.h (class Track_relocs): Declare next_addend.
2542 2010-12-01 Ian Lance Taylor <iant@google.com>
2544 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2547 2010-12-01 Ian Lance Taylor <iant@google.com>
2549 * README: Update compilers known to work and fail.
2551 2010-11-23 Matthias Klose <doko@ubuntu.com>
2553 * configure.in: For --enable-gold, handle value `default' instead of
2554 `both*'. Always install ld as ld.bfd, install as ld if gold is
2556 * configure: Regenerate.
2558 2010-11-18 Doug Kwan <dougkwan@google.com>
2560 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2561 and right_alignment to be zero. Store result alignment only if it is
2562 greater than existing alignment.
2564 2010-11-16 Cary Coutant <ccoutant@google.com>
2567 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2568 Check for ".zdebug_line".
2570 2010-11-16 Doug Kwan <dougkwan@google.com>
2571 Cary Coutant <ccoutant@google.com>
2573 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2574 by reference; adjust all callers.
2575 * output.cc (Output_segment::set_section_addresses): Adjust references
2576 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2578 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2579 end at page boundary.
2581 2010-11-16 Cary Coutant <ccoutant@google.com>
2584 * layout.cc (Layout::choose_output_section): Transform names of
2585 compressed sections even when using a script with a SECTIONS clause.
2586 (Layout::output_section_name): Remove code to transform
2587 compressed debug section names.
2588 * output.cc (Output_section::add_input_section): Use uncompressed
2589 section size when tracking input sections.
2591 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2593 * symtab.h (Symbol::NON_PIC_REF): Remove.
2594 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2595 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2596 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2597 (Symbol::use_plt_offset): Take a flags argument and pass it
2598 directly to needs_dynamic_reloc. Restrict check for undefined
2599 weak symbols to function calls.
2600 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2601 (Target_arm::Scan::global): Use it.
2602 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2603 (Target_arm::Relocate::relocate): Likewise.
2604 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2605 parameter with an r_type parameter. Use get_reference_flags
2607 (Target_arm::Relocate::relocate): Update accordingly.
2608 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2609 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2610 (Target_i386::Scan::global): Likewise.
2611 (Target_i386::Relocate::relocate): Likewise.
2612 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2613 parameter with an r_type parameter. Use get_reference_flags
2615 (Target_i386::Relocate::relocate): Update accordingly.
2616 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2617 (Target_powerpc::Scan::global): Use it.
2618 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2619 (Target_powerpc::Relocate::relocate): Likewise.
2620 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2621 (Target_sparc::Scan::global): Use it.
2622 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2623 (Target_sparc::Relocate::relocate): Likewise.
2624 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2625 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2626 (Target_x86_64::Scan::global): Likewise.
2627 (Target_x86_64::Relocate::relocate): Likewise.
2629 2010-11-08 Doug Kwan <dougkwan@google.com>
2630 Cary Coutant <ccoutant@google.com>
2632 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2633 (Arm_exidx_merge_section::section_contents_): New data member.
2634 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2635 (Arm_input_section::~Arm_input_section): De-allocate memory.
2636 (Arm_input_section::original_contents_): New data member.
2637 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2638 in parameters instead of calling Object::section_contents without
2640 (Arm_output_section::group_section): New parameter TASK. Pass it
2641 to callees that need locking objects.
2642 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2643 to lock EXIDX input sections. Fix a formatting issue. Call
2644 Arm_exidx_merged_section::build_contents to create merged section
2646 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2647 to lock object of stub table owner.
2648 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2649 TEXT_SIZE to initialize data member TEXT_SIZE_.
2650 (Arm_exidx_input_section::addralign): Fix typo in comment.
2651 (Arm_exidx_input_section::text_size): New method.
2652 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2653 that require locking objects. Lock objects before scanning for stubs
2654 and updating local symbols.
2655 (Arm_input_section<big_endian>::init): Copy contents of original
2657 (Arm_input_section<big_endian>::do_write): Use saved contents of
2658 original input section instead of calling Object::section_contents
2660 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2661 size without calling Object::section_size().
2662 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2663 for size. Allocate a buffer for merged EXIDX entries.
2664 (Arm_exidx_merged_section::build_contents): New method.
2665 (Arm_exidx_merged_section::do_write): Move merge section contents
2666 building code to Arm_exidx_merged_section::build_contetns. Write
2667 out contetns in buffer instead of building it on the fly.
2668 (Arm_relobj::make_exidx_input_section): Also pass text section size
2669 to Arm_exidx_input_section constructor.
2670 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2671 (Arm_dynobj::do_read_symbols): Fix memory leak.
2672 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2673 * target.h: (class Task): Add forward declaration.
2674 (Target::relax): Add new parameter TASK and pass it to
2676 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2678 2010-11-05 Cary Coutant <ccoutant@google.com>
2681 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2682 object when reading from the file.
2683 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2685 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2686 when reading section contents.
2687 (get_section_contents): Likewise.
2688 (icf::find_identical_sections): Likewise.
2689 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2690 object when reading from the file.
2691 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2692 the object when doing deferred section layout.
2694 2010-11-03 Nick Clifton <nickc@redhat.com>
2697 * script.h (class Symbol_assignment: name): New member. Returns
2698 the name of the symbol.
2699 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2700 Returns true if the given symbol name is on the list of
2701 assignments wating to be processed.
2702 * archive.cc (should_incldue_member): If the symbol is undefined,
2703 check to see if it is on the list of symbols pending assignment.
2705 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2707 * script-sections.cc (Script_sections::find_memory_region): Check
2708 for a NULL output section pointer.
2710 2010-10-29 Doug Kwan <dougkwan@google.com>
2712 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2713 Output_section::add_relaxed_input_section.
2714 * output.cc (Output_section::add_relaxed_input_section): Add new
2715 arguments LAYOUT and NAME. Set section order index.
2716 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2717 Copy section order index.
2718 * output.h (Output_section::add_relaxed_input_section): Add new
2719 arguments LAYOUT and NAME.
2721 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2723 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2724 NATIVE_OR_CROSS_LINKER.
2725 * testsuite/Makefile.in: Regenerate.
2727 2010-10-20 Doug Kwan <dougkwan@google.com>
2729 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2730 without SHF_LINK_ORDER flags.
2731 * layout.cc (Layout::choose_output_section): Do not filter
2732 SHF_LINK_ORDER flag in a relocatable link.
2734 2010-10-17 Cary Coutant <ccoutant@google.com>
2736 * output.h (Output_segment::set_section_addresses): Change function
2737 signature. Update all callers.
2738 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2740 (Output_segment::set_section_addresses): Align after last TLS
2741 section. Add padding before last relro section instead of after.
2743 2010-10-17 Doug Kwan <dougkwan@google.com>
2745 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2746 GOT output section to be writable.
2748 2010-10-14 Cary Coutant <ccoutant@google.com>
2750 * debug.h (DEBUG_INCREMENTAL): New flag.
2751 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2752 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2754 * incremental.cc (report_command_line): Ignore all forms of
2756 * layout.cc (Layout::Layout): Check parameters for incremental link
2758 * options.cc (General_options::parse_incremental): New function.
2759 (General_options::parse_no_incremental): New function.
2760 (General_options::parse_incremental_full): New function.
2761 (General_options::parse_incremental_update): New function.
2762 (General_options::incremental_mode_): New data member.
2763 (General_options::finalize): Check incremental_mode_.
2764 * options.h (General_options): Update help text for --incremental.
2765 Add --no-incremental, --incremental-full, --incremental-update.
2766 (General_options::Incremental_mode): New enum type.
2767 (General_options::incremental_mode): New function.
2768 (General_options::incremental_mode_): New data member.
2769 * parameters.cc (Parameters::incremental_mode_): New data member.
2770 (Parameters::set_options): Set incremental_mode_.
2771 (Parameters::set_incremental_full): New function.
2772 (Parameters::incremental): New function.
2773 (Parameters::incremental_update): New function.
2774 (set_parameters_incremental_full): New function.
2775 * parameters.h (Parameters::set_incremental_full): New function.
2776 (Parameters::incremental): New function.
2777 (Parameters::incremental_update): New function.
2778 (Parameters::incremental_mode_): New data member.
2779 (set_parameters_incremental_full): New function.
2780 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2781 incremental link mode.
2782 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2783 (Sized_relobj::do_relocate_sections): Likewise.
2784 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2786 * testsuite/Makefile.in: Regenerate.
2787 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2789 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2791 * script-sections.h (class Script_sections): Make
2792 Sections_elements typedef public.
2793 * script-sections.cc (class Sort_output_sections): Add elements_
2794 field. Add constructor which sets it; change all callers.
2795 (Sort_output_sections::is_before): New function.
2796 (Sort_output_sections::operator()): Call is_before.
2797 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2799 * testsuite/script_test_10.sh: New test. Test script section
2801 * testsuite/script_test_10.t: Likewise.
2802 * testsuite/script_test_10.s: Likewise.
2803 * testsuite/Makefile.am: Wrap the cross linker tests and the
2804 common tests into NATIVE_OR_CROSS_LINKER.
2805 (check_SCRIPTS): Add script_test_10.sh.
2806 (check_DATA): Add script_test_10.stdout.
2807 (script_test_10.o, script_test_10): New targets.
2808 (script_test_10.stdout): New target.
2809 * configure, testsuite/Makefile.in: Regenerate.
2811 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2813 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2814 error for the deprecated relocations.
2815 (Target_arm::Scan::global): Likewise.
2816 (Target_arm::Relocate::relocate): Likewise.
2818 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2820 * fileread.cc (Input_file::find_file): Initialize *found_name
2821 and *namep when using the fallback search for case 4.
2823 2010-10-11 Cary Coutant <ccoutant@google.com>
2825 * options.h (class General_options): Redefine -z lazy as an alias for
2826 the negation of -z now.
2828 2010-10-11 Ian Lance Taylor <iant@google.com>
2830 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2833 2010-10-06 Nick Clifton <nickc@redhat.com>
2835 * script-sections.cc(class Memory_region): Remove
2836 current_lma_offset_ field. Rename current_vma_offset_ to
2837 current_offset_. Add last_section_ field.
2838 (Memory_region::get_current_vma_address): Rename to
2839 get_current_address.
2840 (Memory_region::get_current_lma_address): Delete.
2841 (Memory_region::increment_vma_offset): Rename to
2843 (Memory_region::increment_lma_offset): Delete.
2844 (Memory_region::attributes_compatible): New method. Returns
2845 true if the provided section is compatible with the region.
2846 (Memory_region::get_last_section): New method. Returns the last
2847 section to use the region.
2848 (Memory_region::set_last_section): New method. Stores the last
2849 section to use the region.
2850 (Script_sections::block_in_region): New method. Returns true if
2851 a block of memory is contained within a region.
2852 (Script_sections::find_memory_region): New method. Locates a
2853 memory region to be used to set a VMA or LMA address.
2854 (Output_section_definition::set_section_addresses): Add code to
2855 check for addresses set by memory regions.
2856 (Output_segment::set_section_addresses): Remove memory region
2858 (Script_sections::create_segment): Add a warning if a header
2859 segment is created outside of any region.
2860 * script-sections.h (class Script_sections): Add prototypes for
2861 find_memory_region and block_in_region methods.
2862 * testsuite/memory_test.s: Use .long instead of .word.
2863 * testsuite/memory_test.t: Add some more output sections.
2864 * testsuite/memory_test.sh: Update expected output.
2866 2010-10-02 Doug Kwan <dougkwan@google.com>
2868 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2869 defintion to symtab.h
2870 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2871 declaration to defintion.
2873 2010-10-01 Nick Clifton <nickc@redhat.com>
2875 * expression.cc (eval): Replace dummy argument with NULL.
2876 (eval_maybe_dot): Check for a NULL result section pointer.
2877 (Symbol_expression::value): Likewise.
2878 (Dot_expression::value): Likewise.
2879 (BINARY_EXPRESSION): Likewise.
2880 (Max_expression::value): Likewise.
2881 (Min_expression::value): Likewise.
2882 (Absolute_expression::value): Likewise.
2883 (Addr_expression::value_from_output_section): Likewise.
2884 (Loaddddr_expression::value_from_output_section): Likewise.
2885 (Segment_start_expression::value): Likewise.
2886 * script-sections.cc
2887 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2889 (Sections_elememt_dot_assignment::set_section_addresses):
2891 (Output_data_expression::do_write_to_buffer): Likewise.
2892 (Output_section_definition::finalize_symbols): Likewise.
2893 (Output_section_definition::set_section_addresses): Likewise.
2895 2010-09-30 Doug Kwan <dougkwan@google.com>
2897 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2899 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2901 * target.h (Target::can_icf_inline_merge_sections): New virtual
2903 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2905 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2907 * icf.cc (get_section_contents): Inline merge sections only when
2910 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2912 * configure: Regenerate.
2914 2010-09-17 Ian Lance Taylor <iant@google.com>
2916 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2917 * testsuite/Makefile.am (memory_test.o): New target.
2918 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2920 * testsuite/Makefile.in: Rebuild.
2922 2010-09-17 Doug Kwan <dougkwan@google.com>
2924 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2925 defintion if relocation uses GOT entries of the symbol.
2926 * testsuite/icf_safe_test.sh: Fix test.
2927 * testsuite/icf_safe_so_test.sh: Fix test.
2929 2010-09-16 Cary Coutant <ccoutant@google.com>
2931 * script_sections.cc (class Memory_region): Remove "NULL" from
2932 vector initializations.
2934 2010-09-15 Cary Coutant <ccoutant@google.com>
2936 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2937 Resolve forwarding symbols.
2939 2010-09-15 Doug Kwan <dougkwan@google.com>
2941 * gold/testsuite/script_test_3.t: Add ARM special sections.
2942 * gold/testsuite/script_test_4.t: Same.
2943 * gold/testsuite/script_test_5.t: Same.
2944 * gold/testsuite/script_test_6.t: Same.
2945 * gold/testsuite/script_test_7.t: Same.
2946 * gold/testsuite/script_test_7.t: Same.
2947 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2949 2010-09-14 Cary Coutant <ccoutant@google.com>
2951 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2952 (Target_x86_64::Relocate::relocate_tls): Replace check for
2953 saw_tls_block_reloc_ with test for executable section.
2955 2010-09-12 Cary Coutant <ccoutant@google.com>
2957 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2958 position-independent executables to shared libraries need dynamic
2960 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2961 position-independent executables.
2962 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2963 * testsuite/Makefile.in: Regenerate.
2965 2010-09-10 Nick Clifton <nickc@redhat.com>
2968 * testsuite/memory_test.t: Discard any sections that are not
2971 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2974 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2975 "This::" to work around a bug in gcc 4.2.
2977 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2979 2010-09-09 Rafael Espindola <espindola@google.com>
2981 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2982 sections with different PF_X flags in the same segment.
2983 (Layout::find_first_load_seg): Search all segments to find the first
2985 * options.h (rosegment): New.
2987 2010-09-08 Rafael Espindola <espindola@google.com>
2989 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2991 2010-09-08 Doug Kwan <dougkwan@google.com>
2993 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2994 (Arm_relobj::do_relocate_sections): Add new parameter for output
2995 file to match the parent.
2996 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2997 of local symbols instead of input values. Update code to track
2998 changes in gold::relocate_section.
2999 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3000 (Sized_relobj::compute_final_local_value_internal): New methods.
3001 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3002 body into private version of Sized_relobj::compute_final_local_value.
3003 Call the inline method.
3004 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3005 merged symbol value if there is one.
3006 (Symbol_value::has_output_value): New method defintiion.
3007 (Sized_relobj::Compute_final_local_value_status): New enum type.
3008 (Sized_relobj::compute_final_local_value): New methods.
3009 (Sized_relobj::compute_final_local_value_internal): New methods.
3010 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3011 and arm_cortex_a8.sh.
3012 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3013 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3015 * Makefile.in: Regenerate.
3016 * testsuite/arm_bl_out_of_range.s: Update test.
3017 * testsuite/thumb_bl_out_of_range.s: Ditto.
3018 * testsuite/thumb_blx_out_of_range.s: Ditto.
3019 * testsuite/arm_branch_out_of_range.sh: New file.
3020 * testsuite/arm_cortex_a8.sh: Ditto.
3021 * testsuite/arm_cortex_a8_b.s: Ditto.
3022 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3023 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3024 * testsuite/arm_cortex_a8_bl.s: Ditto.
3025 * testsuite/arm_cortex_a8_blx.s: Ditto.
3026 * testsuite/arm_cortex_a8_local.s: Ditto.
3027 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3028 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3030 2010-09-08 Rafael Espindola <espindola@google.com>
3032 * Makefile.am (memory_test.stdout): Run readelf with -W.
3033 * Makefile.in: Regenerate.
3034 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3037 2010-09-08 Rafael Espindola <espindola@google.com>
3039 * script-sections.cc (Script_sections::add_memory_region): Convert
3040 field precision to int.
3041 * script.cc (script_set_section_region, script_set_section_region):
3042 Convert field precision to int.
3044 2010-09-08 Rafael Espindola <espindola@google.com>
3046 * arm.cc (do_finalize_sections): Create the __exidx_start and
3047 __exdix_end symbols even when the section is missing.
3049 2010-09-08 Nick Clifton <nickc@redhat.com>
3051 * README: Remove claim that MEMORY is not supported.
3052 * expression.cc (script_exp_function_origin)
3053 (script_exp_function_length): Move from here to ...
3054 * script.cc: ... here.
3055 (script_set_section_region, script_add_memory)
3056 (script_parse_memory_attr, script_include_directive): New
3058 * script-sections.cc
3059 (class Memory_region): New class.
3060 (class Output_section_definition): Add set_memory_region,
3061 set_section_vma, set_section_lma and get_section_name methods.
3062 (class Script_Sections): Add add_memory_region,
3063 find_memory_region, find_memory_region_origin,
3064 find_memory_region_length and set_memory_region methods.
3065 Have set_section_addresses method walk the list of set memory
3067 Extend the print methos to display memory regions.
3068 * script-sections.h: Add prototypes for new methods.
3069 Add enum for MEMORY region attributes.
3070 * yyscript.y: Add support for parsing MEMORY regions.
3071 * script-c.h: Add prototypes for new functions.
3072 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3073 * testsuite/Makefile.in: Regenerate.
3074 * testsuite/memory_test.sh: New script.
3075 * testsuite/memory_test.s: New assembler source file.
3076 * testsuite/memory_test.t: New linker script.
3078 2010-08-27 Doug Kwan <dougkwan@google.com>
3080 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3081 reference override an existing dynamic weak reference.
3082 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3083 * testsuite/Makefile.in: Regenerate.
3084 * testsuite/dyn_weak_ref.sh: New file.
3085 * testsuite/dyn_weak_ref_1.c: Ditto.
3086 * testsuite/dyn_weak_ref_2.c: Ditto.
3088 2010-08-27 Ian Lance Taylor <iant@google.com>
3090 * incremental.h (class Incremental_input_entry): Add virtual
3093 2010-08-27 Ian Lance Taylor <iant@google.com>
3095 * testsuite/start_lib_test_3.c: Mark t3 as used.
3097 2010-08-27 Nick Clifton <nickc@redhat.com>
3099 * options.cc (version_script): Fix small typo in previous
3102 2010-08-25 Nick Clifton <nickc@redhat.com>
3104 * archive.cc: Formatting fixes: Remove whitespace between
3105 typename and following asterisk. Remove whitespace between
3106 function name and opening parenthesis.
3107 * archive.h: Likewise.
3109 * attributes.cc: Likewise.
3110 * attributes.h: Likewise.
3111 * common.cc: Likewise.
3112 * copy-relocs.cc: Likewise.
3113 * dirsearch.h: Likewise.
3114 * dynobj.cc: Likewise.
3115 * ehframe.cc: Likewise.
3116 * ehframe.h: Likewise.
3117 * expression.cc: Likewise.
3118 * fileread.cc: Likewise.
3119 * fileread.h: Likewise.
3121 * gold-threads.cc: Likewise.
3122 * gold.cc: Likewise.
3123 * i386.cc: Likewise.
3125 * incremental-dump.cc: Likewise.
3126 * incremental.cc: Likewise.
3127 * layout.cc: Likewise.
3128 * layout.h: Likewise.
3129 * main.cc: Likewise.
3130 * merge.cc: Likewise.
3131 * merge.h: Likewise.
3132 * object.cc: Likewise.
3133 * object.h: Likewise.
3134 * options.cc: Likewise.
3135 * options.h: Likewise.
3136 * output.cc: Likewise.
3137 * output.h: Likewise.
3138 * plugin.cc: Likewise.
3139 * plugin.h: Likewise.
3140 * powerpc.cc: Likewise.
3141 * reloc.cc: Likewise.
3142 * script-c.h: Likewise.
3143 * script-sections.cc: Likewise.
3144 * script.cc: Likewise.
3145 * stringpool.cc: Likewise.
3146 * symtab.cc: Likewise.
3147 * symtab.h: Likewise.
3148 * target.cc: Likewise.
3149 * timer.cc: Likewise.
3150 * timer.h: Likewise.
3151 * version.cc: Likewise.
3152 * x86_64.cc: Likewise.
3154 2010-08-24 Nick Clifton <nickc@redhat.com>
3157 * layout.cc (segment_precedes): Sort segments by their physical
3158 addresses, if they have been set.
3160 2010-08-23 Cary Coutant <ccoutant@google.com>
3162 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3164 (Lib_group::include_member): Unlock object after deleting its
3166 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3169 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3170 Cary Coutant <ccoutant@google.com>
3172 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3173 constructor, and set_blocker.
3174 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3176 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3177 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3178 * testsuite/Makefile.am (start_lib_test): New test case.
3179 * testsuite/Makefile.in: Regenerate.
3180 * testsuite/start_lib_test_main.c: New file.
3181 * testsuite/start_lib_test_1.c: New file.
3182 * testsuite/start_lib_test_2.c: New file.
3183 * testsuite/start_lib_test_3.c: New file.
3185 2010-08-19 Ian Lance Taylor <iant@google.com>
3187 * Makefile.in: Rebuild with automake 1.11.1.
3188 * aclocal.m4: Likewise.
3189 * testsuite/Makefile.in: Likewise.
3191 2010-08-19 Ian Lance Taylor <iant@google.com>
3194 * i386.cc (class Output_data_plt_i386): Update declarations.
3195 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3196 local_ifuncs_ fields.
3197 (Target_i386::do_plt_section_for_global): New function.
3198 (Target_i386::do_plt_section_for_local): New function.
3199 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3200 parameter; change all callers. Initialize global_ifuncs_ and
3201 local_ifuncs_. If doing a static link define __rel_iplt_start and
3203 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3204 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3205 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3207 (Target_i386::make_plt_section): New function, broken out of
3208 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3209 (Target_i386::make_plt_entry): Call make_plt_section.
3210 (Target_i386::make_local_ifunc_plt_entry): New function.
3211 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3212 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3213 R_386_IRELATIVE to switch.
3214 (Target_i386::Scan::global): Likewise.
3215 (Target_i386::Relocate::relocate): Likewise.
3216 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3218 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3219 (Target_x86_64::do_plt_section_for_global): New function.
3220 (Target_x86_64::do_plt_section_for_local): New function.
3221 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3222 parameter; change all callers. If doing a static link define
3223 __rela_iplt_start and __rela_iplt_end.
3224 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3225 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3226 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3228 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3229 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3231 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3232 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3233 R_X86_64_IRELATIVE to switch.
3234 (Target_x86_64::Scan::global): Likewise.
3235 (Target_x86_64::Relocate::relocate): Likewise.
3236 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3238 * target.h (class Target): Add plt_section_for_global and
3239 plt_section_for_local functions. Add do_plt_section_for_global
3240 and do_plt_section_for_local virtual functions.
3241 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3242 clarifying comments.
3243 (Symbol::use_plt_offset): Handle IFUNC symbol.
3244 * object.cc (Sized_relobj::Sized_relobj): Initialize
3246 (Sized_relobj::local_has_plt_offset): New function.
3247 (Sized_relobj::local_plt_offset): New function.
3248 (Sized_relobj::set_local_plt_offset): New function.
3249 (Sized_relobj::do_count): Handle IFUNC symbol.
3250 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3251 a bit away from input_shndx_ field. Add set_is_func_symbol and
3252 is_ifunc_symbol functions.
3253 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3254 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3255 local_plt_offsets_ field.
3256 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3257 * output.h (class Output_section_data): Add non-const
3258 output_section function.
3259 (class Output_data_got): Update declarations.
3260 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3261 Add use_plt_offset parameter to global and local constructors.
3262 Change all callers. Change local_sym_index_ field to 31 bits.
3263 Change GSYM_CODE and CONSTANT_CODE accordingly.
3264 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3265 doing a static link don't set sh_link field.
3266 (Output_data_got::Got_entry::write): Use PLT offset if
3268 (Output_data_got::add_global_plt): New function.
3269 (Output_data_got::add_local_plt): New function.
3270 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3271 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3272 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3273 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3274 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3276 * testsuite/ifunc-sel.h: New file.
3277 * testsuite/ifuncmain1.c: New file.
3278 * testsuite/ifuncmain1vis.c: New file.
3279 * testsuite/ifuncmod1.c: New file.
3280 * testsuite/ifuncdep2.c: New file.
3281 * testsuite/ifuncmain2.c: New file.
3282 * testsuite/ifuncmain3.c: New file.
3283 * testsuite/ifuncmod3.c: New file.
3284 * testsuite/ifuncmain4.c: New file.
3285 * testsuite/ifuncmain5.c: New file.
3286 * testsuite/ifuncmod5.c: New file.
3287 * testsuite/ifuncmain6pie.c: New file.
3288 * testsuite/ifuncmod6.c: New file.
3289 * testsuite/ifuncmain7.c: New file.
3290 * configure, testsuite/Makefile.in: Rebuild.
3292 2010-08-18 Ian Lance Taylor <iant@google.com>
3295 (Output_section_incremental_inputs::write_input_files): Add cast
3296 to avoid signed/unsigned comparison warning.
3297 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3299 2010-08-12 Cary Coutant <ccoutant@google.com>
3301 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3303 2010-08-13 Ian Lance Taylor <iant@google.com>
3305 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3307 2010-08-12 Cary Coutant <ccoutant@google.com>
3308 Doug Kwan <dougkwan@google.com>
3310 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3311 defintion overrides non-weak undef, remember that the original undef
3313 * symtab.cc (Symbol_table::sized_write_global): For undef without
3314 an original weak binding, set binding to global in output.
3315 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3316 * testsuite/Makefile.in: Regenerate.
3317 * testsuite/strong_ref_weak_def.sh: New file.
3318 * testsuite/strong_ref_weak_def_1.c: Ditto.
3319 * testsuite/strong_ref_weak_def_2.c: Ditto.
3321 2010-08-12 Cary Coutant <ccoutant@google.com>
3323 * testsuite/incremental_test.sh: Rewrite.
3324 * testsuite/incremental_test_1.c: Rewrite.
3325 * testsuite/incremental_test_2.c: Rewrite.
3327 2010-08-12 Cary Coutant <ccoutant@google.com>
3329 * arm.cc (Target_arm::got_size): Add const.
3330 (Target_arm::got_entry_count): New function.
3331 (Target_arm::plt_entry_count): New function.
3332 (Target_arm::first_plt_entry_offset): New function.
3333 (Target_arm::plt_entry_size): New function.
3334 (Output_data_plt_arm::entry_count): New function.
3335 (Output_data_plt_arm::first_plt_entry_offset): New function.
3336 (Output_data_plt_arm::get_plt_entry_size): New function.
3337 * i386.cc (Target_i386::got_size): Add const.
3338 (Target_i386::got_entry_count): New function.
3339 (Target_i386::plt_entry_count): New function.
3340 (Target_i386::first_plt_entry_offset): New function.
3341 (Target_i386::plt_entry_size): New function.
3342 (Output_data_plt_i386::entry_count): New function.
3343 (Output_data_plt_i386::first_plt_entry_offset): New function.
3344 (Output_data_plt_i386::get_plt_entry_size): New function.
3345 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3346 find_incremental_inputs_sections. Dump incremental_got_plt section.
3347 * incremental.cc: Include target.h.
3348 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3349 parameter. Adjust all callers. Find incremental_got_plt section.
3350 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3352 (Output_section_incremental_inputs::set_final_data_size): Calculate
3353 size of incremental_got_plt section.
3354 (Output_section_incremental_inputs::do_write): Write the
3355 incremental_got_plt section.
3356 (Got_plt_view_info): New struct.
3357 (Local_got_offset_visitor): New class.
3358 (Global_got_offset_visitor): New class.
3359 (Global_symbol_visitor_got_plt): New class.
3360 (Output_section_incremental_inputs::write_got_plt): New function.
3361 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3362 Add parameter. Adjust all callers.
3363 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3364 (Incremental_inputs::got_plt_section): New function.
3365 (Incremental_inputs::got_plt_section_): New data member.
3366 (Incremental_got_plt_reader): New class.
3367 * layout.cc (Layout::create_incremental_info_sections): Add the
3368 incremental_got_plt section.
3369 * object.h (Got_offset_list::get_list): New function.
3370 (Got offset_list::for_all_got_offsets): New function.
3371 (Sized_relobj::local_got_offset_list): New function.
3372 * powerpc.cc (Target_powerpc::got_size): Add const.
3373 (Target_powerpc::got_entry_count): New function.
3374 (Target_powerpc::plt_entry_count): New function.
3375 (Target_powerpc::first_plt_entry_offset): New function.
3376 (Target_powerpc::plt_entry_size): New function.
3377 (Output_data_plt_powerpc::entry_count): New function.
3378 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3379 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3380 * sparc.cc (Target_sparc::got_size): Add const.
3381 (Target_sparc::got_entry_count): New function.
3382 (Target_sparc::plt_entry_count): New function.
3383 (Target_sparc::first_plt_entry_offset): New function.
3384 (Target_sparc::plt_entry_size): New function.
3385 (Output_data_plt_sparc::entry_count): New function.
3386 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3387 (Output_data_plt_sparc::get_plt_entry_size): New function.
3388 * symtab.h (Symbol::got_offset_list): New function.
3389 (Symbol_table::for_all_symbols): New function.
3390 * target.h (Sized_target::got_entry_count): New function.
3391 (Sized_target::plt_entry_count): New function.
3392 (Sized_target::plt_entry_size): New function.
3393 * x86_64.cc (Target_x86_64::got_size): Add const.
3394 (Target_x86_64::got_entry_count): New function.
3395 (Target_x86_64::plt_entry_count): New function.
3396 (Target_x86_64::first_plt_entry_offset): New function.
3397 (Target_x86_64::plt_entry_size): New function.
3398 (Output_data_plt_x86_64::entry_count): New function.
3399 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3400 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3402 2010-08-12 Cary Coutant <ccoutant@google.com>
3404 * archive.cc: Include incremental.h.
3405 (Archive::Archive): Initialize incremental_info_.
3406 (Archive::include_member): Record archive members in incremental info.
3407 (Add_archive_symbols::run): Record begin and end of an archive in
3409 (Lib_group::include_member): Record objects in incremental info.
3410 * archive.h (Incremental_archive_entry): Forward declaration.
3411 (Archive::set_incremental_info): New member function.
3412 (Archive::incremental_info): New member function.
3413 (Archive::Unused_symbol_iterator): New class.
3414 (Archive::unused_symbols_begin): New member function.
3415 (Archive::unused_symbols_end): New member function.
3416 (Archive::incremental_info_): New data member.
3417 * incremental-dump.cc (find_input_containing_global): New function.
3418 (dump_incremental_inputs): Dump new incremental info sections.
3419 * incremental.cc: Include symtab.h.
3420 (Output_section_incremental_inputs): New class.
3421 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3422 new incremental info sections.
3423 (Sized_incremental_binary::do_check_inputs): Likewise.
3424 (Incremental_inputs::report_archive): Remove.
3425 (Incremental_inputs::report_archive_begin): New function.
3426 (Incremental_inputs::report_archive_end): New function.
3427 (Incremental_inputs::report_object): New function.
3428 (Incremental_inputs::finalize_inputs): Remove.
3429 (Incremental_inputs::report_input_section): New function.
3430 (Incremental_inputs::report_script): Rewrite.
3431 (Incremental_inputs::finalize): Do nothing but finalize string table.
3432 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3433 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3434 (Incremental_inputs::create_data_sections): New function.
3435 (Incremental_inputs::relocs_entsize): New function.
3436 (Output_section_incremental_inputs::set_final_data_size): New function.
3437 (Output_section_incremental_inputs::do_write): New function.
3438 (Output_section_incremental_inputs::write_header): New function.
3439 (Output_section_incremental_inputs::write_input_files): New function.
3440 (Output_section_incremental_inputs::write_info_blocks): New function.
3441 (Output_section_incremental_inputs::write_symtab): New function.
3442 * incremental.h (Incremental_script_entry): Forward declaration.
3443 (Incremental_object_entry): Forward declaration.
3444 (Incremental_archive_entry): Forward declaration.
3445 (Incremental_inputs): Forward declaration.
3446 (Incremental_inputs_header_data): Remove.
3447 (Incremental_inputs_header): Remove.
3448 (Incremental_inputs_header_write): Remove.
3449 (Incremental_inputs_entry_data): Remove.
3450 (Incremental_inputs_entry): Remove.
3451 (Incremental_inputs_entry_write): Remove.
3452 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3453 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3454 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3455 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3457 (Incremental_input_entry): New class.
3458 (Incremental_script_entry): New class.
3459 (Incremental_object_entry): New class.
3460 (Incremental_archive_entry): New class.
3461 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3462 (Incremental_inputs::report_inputs): Remove.
3463 (Incremental_inputs::report_archive): Remove.
3464 (Incremental_inputs::report_archive_begin): New function.
3465 (Incremental_inputs::report_archive_end): New function.
3466 (Incremental_inputs::report_object): Change prototype.
3467 (Incremental_inputs::report_input_section): New function.
3468 (Incremental_inputs::report_script): Change prototype.
3469 (Incremental_inputs::get_reloc_count): New function.
3470 (Incremental_inputs::set_reloc_count): New function.
3471 (Incremental_inputs::create_data_sections): New function.
3472 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3473 (Incremental_inputs::inputs_section): New function.
3474 (Incremental_inputs::symtab_section): New function.
3475 (Incremental_inputs::relocs_section): New function.
3476 (Incremental_inputs::get_stringpool): Add const.
3477 (Incremental_inputs::command_line): Add const.
3478 (Incremental_inputs::inputs): Remove.
3479 (Incremental_inputs::command_line_key): New function.
3480 (Incremental_inputs::input_file_count): New function.
3481 (Incremental_inputs::input_files): New function.
3482 (Incremental_inputs::relocs_entsize): New function.
3483 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3484 (Incremental_inputs::finalize_inputs): Remove.
3485 (Incremental_inputs::Input_info): Remove.
3486 (Incremental_inputs::lock_): Remove.
3487 (Incremental_inputs::inputs_): Change type.
3488 (Incremental_inputs::inputs_map_): Remove.
3489 (Incremental_inputs::current_object_entry_): New data member.
3490 (Incremental_inputs::inputs_section_): New data member.
3491 (Incremental_inputs::symtab_section_): New data member.
3492 (Incremental_inputs::relocs_section_): New data member.
3493 (Incremental_inputs::reloc_count_): New data member.
3494 (Incremental_inputs_reader): New class.
3495 (Incremental_symtab_reader): New class.
3496 (Incremental_relocs_reader): New class.
3497 * layout.cc (Layout::finalize): Move finalization of incremental info
3498 and creation of incremental info sections to follow finalization of
3499 symbol table. Set offsets for postprocessing sections.
3500 (Layout::create_incremental_info_sections): Call
3501 Incremental_inputs::create_data_sections. Add incremental symtab
3502 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3503 sections to layout after input sections.
3504 * layout.h (struct Timespec): Forward declaration.
3505 (Layout::incremental_inputs): Add const.
3506 (Layout::create_incremental_info_sections): Add parameter.
3507 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3508 * object.cc: Include incremental.h.
3509 (Relobj::finalize_incremental_relocs): New function.
3510 (Sized_relobj::do_layout): Record input sections in incremental info.
3511 * object.h (Object::output_section): New function.
3512 (Object::output_section_offset): Moved from Relobj.
3513 (Object::get_incremental_reloc_base): New function.
3514 (Object::get_incremental_reloc_count): New function.
3515 (Object::do_output_section): New function.
3516 (Object::do_output_section_offset): Moved from Relobj.
3517 (Object::do_get_incremental_reloc_base): New function.
3518 (Object::do_get_incremental_reloc_count): New function.
3519 (Object::Object): Initialize new data members.
3520 (Relobj::output_section): Renamed do_output_section and moved to
3522 (Relobj::output_section_offset): Moved to Object.
3523 (Relobj::do_get_incremental_reloc_base): New function.
3524 (Relobj::do_get_incremental_reloc_count): New function.
3525 (Relobj::allocate_incremental_reloc_counts): New function.
3526 (Relobj::count_incremental_reloc): New function.
3527 (Relobj::finalize_incremental_relocs): New function.
3528 (Relobj::next_incremental_reloc_index): New function.
3529 (Relobj::reloc_counts_): New data member.
3530 (Relobj::reloc_bases_): New data member.
3531 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3532 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3533 (Sized_relobj::incremental_relocs_scan): New function.
3534 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3535 (Sized_relobj::incremental_relocs_write): New function.
3536 (Sized_relobj::incremental_relocs_write_reltype): New function.
3537 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3539 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3540 archives and object files elsewhere.
3541 (Add_symbols::run): Report object files here.
3542 (Finish_group::run): Report end of archive at end of group.
3543 * reloc.cc: Include layout.h, incremental.h.
3544 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3545 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3546 (Sized_relobj::incremental_relocs_scan): New function.
3547 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3548 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3549 (Sized_relobj::incremental_relocs_write): New function.
3550 (Sized_relobj::incremental_relocs_write_reltype): New function.
3551 * script.cc (read_input_script): Rewrite test for incremental link.
3552 Change call to Incremental_inputs::report_script.
3553 * symtab.h (Symbol_table::first_global_index): New function.
3554 (Symbol_table::output_count): New function.
3556 2010-08-12 Doug Kwan <dougkwan@google.com>
3558 * arm.cc (Target_arm::merge_object_attributes): Check command line
3559 options --no-wchar-size-warning and --no-enum-size-warning.
3560 * options.h (General_options): Add ld-compatible options
3561 --no-enum-size-warning and --no-wchar-size-warning.
3563 2010-08-04 Ian Lance Taylor <iant@google.com>
3565 * x86_64.cc (Target_x86_64::Scan::local): Use
3566 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3567 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3568 (Target_x86_64::Scan::global): Likewise.
3569 (Target_x86_64::Relocate::relocate): Likewise.
3570 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3573 2010-08-03 Cary Coutant <ccoutant@google.com>
3575 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3576 to reserve space in merged_strings vector. Keep total input size
3578 (Output_merge_string::do_print_merge_stats): Print total input size.
3579 * merge.h (Output_merge_string): Add input_size_ field.
3580 * stringpool.cc (Stringpool_template::string_length): Move
3581 implementations out of Stringpool_template class and place in
3583 * stringpool.h (string_length): Move out of Stringpool_template.
3585 2010-08-03 Ian Lance Taylor <iant@google.com>
3588 * layout.cc (relaxation_loop_body): If address of load segment is
3589 set, adjust address to include headers if possible.
3591 2010-08-03 Ian Lance Taylor <iant@google.com>
3593 * version.cc (version_string): Bump to 1.10.
3595 2010-08-03 Ian Lance Taylor <iant@google.com>
3598 * layout.h (enum Output_section_order): Define.
3599 (class Layout): Update declarations.
3600 * layout.cc (Layout::get_output_section): Add order parameter.
3601 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3602 is_first_non_relro parameters. Change all callers.
3603 (Layout::choose_output_section): Likewise.
3604 (Layout::add_output_section_data): Likewise.
3605 (Layout::make_output_section): Likewise. Set order.
3606 (Layout::default_section_order): New function.
3607 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3608 * output.cc (Output_section::Output_section): Initialize order_.
3609 Don't initialize deleted fields.
3610 (Output_segment::Output_segment): Don't initialize deleted
3612 (Output_segment::add_output_section_to_load): New function
3613 replacing add_output_section. Change all callers to call this or
3614 add_output_section_to_nonload.
3615 (Output_segment::add_output_section_to_nonload): New function.
3616 (Output_segment::remove_output_section): Rewrite.
3617 (Output_segment::add_initial_output_data): Likewise.
3618 (Output_segment::has_any_data_sections): Likewise.
3619 (Output_segment::is_first_section_relro): Likewise.
3620 (Output_segment::maximum_alignment): Likewise.
3621 (Output_segment::has_dynamic_reloc): New function replacing
3622 dynamic_reloc_count. Change all callers.
3623 (Output_segment::has_dynamic_reloc_list): New function replacing
3624 dynamic_reloc_count_list. Change all callers.
3625 (Output_segment::set_section_addresses): Rewrite.
3626 (Output_segment::set_offset): Rewrite.
3627 (Output_segment::find_first_and_last_list): Remove.
3628 (Output_segment::set_tls_offsets): Rewrite.
3629 (Output_segment::first_section_load_address): Likewise.
3630 (Output_segment::output_section_count): Likewise.
3631 (Output_segment::section_with_lowest_load_address): Likewise.
3632 (Output_segment::write_section_headers): Likewise.
3633 (Output_segment::print_sections_to_map): Likewise.
3634 * output.h (class Output_data): Remove dynamic_reloc_count_
3635 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3636 (Output_data::add_dynamic_reloc): Rewrite.
3637 (Output_data::has_dynamic_reloc): New function.
3638 (Output_data::dynamic_reloc_count): Remove.
3639 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3640 is_last_relro_, is_first_non_relro_, is_interp_,
3641 is_dynamic_linker_section_ fields. Add order and set_order
3642 functions. Remove is_relro_local, set_is_relro_local,
3643 is_last_relro, set_is_last_relro, is_first_non_relro,
3644 set_is_first_non_relro functions, is_interp, set_is_interp,
3645 is_dynamic_linker_section, and set_is_dynamic_linker_section
3647 (class Output_segment): Change Output_data_list from std::list to
3648 std:;vector. Add output_lists_ field. Remove output_data_ and
3649 output_bss_ fields. Update declarations.
3651 2010-08-02 Ian Lance Taylor <iant@google.com>
3653 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3654 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3655 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3657 2010-08-02 Ian Lance Taylor <iant@google.com>
3660 * script.cc (Script_options::Script_options): Initialize
3661 symbol_definitions_ and symbol_references_.
3662 (Script_options::add_symbol_assignment): Update
3663 symbol_definitions_ and symbol_references_.
3664 (Script_options::add_symbol_reference): New function.
3665 (script_symbol): New function.
3666 * script.h (class Script_options): Add symbol_definitions_ and
3667 symbol_references_ fields.
3668 (Script_options::referenced_const_iterator): New type.
3669 (Script_options::referenced_begin): New function.
3670 (Script_options::referenced_end): New function.
3671 (Script_options::is_referenced): New function.
3672 (Script_options::any_unreferenced): New function.
3673 * script-c.h (script_symbol): Declare.
3674 * yyscript.y (exp): Call script_symbol.
3675 * symtab.cc: Include "script.h".
3676 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3677 Change all callers. Check symbols referenced by scripts.
3678 (Symbol_table::add_undefined_symbols_from_command_line): Add
3679 layout parameter. Change all callers.
3680 (Symbol_table::do_add_undefined_symbols_from_command_line):
3681 Likewise. Break out loop body. Check symbols referenced by
3683 (Symbol_table::add_undefined_symbol_from_command_line): New
3684 function broken out of
3685 do_add_undefined_symbols_from_command_line.
3686 * symtab.h (class Symbol_table): Update declarations.
3687 * archive.cc: Include "layout.h".
3688 (Archive::should_include_member): Add layout parameter. Change
3689 all callers. Check for symbol mentioned in expression.
3690 * archive.h (class Archive): Update declaration.
3691 * object.cc (Sized_relobj::do_should_include_member): Add layout
3693 * object.h (Object::should_include_member): Add layout parameter.
3695 (Object::do_should_include_member): Add layout parameter.
3696 (class Sized_relobj): Update declaration.
3697 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3699 * dynobj.h (class Sized_dynobj): Update declaration.
3700 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3702 * plugin.h (class Sized_pluginobj): Update declaration.
3704 2010-08-02 Ian Lance Taylor <iant@google.com>
3707 * output.cc (Output_segment::set_offset): Search for the first and
3708 last sections rather than assuming that the list is in order.
3709 (Output_segment::find_first_and_last_list): New function.
3710 * output.h (class Output_segment): Update declarations.
3711 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3712 (relro_strip_test_SOURCES): New variable.
3713 (relro_strip_test_DEPENDENCIES): New variable.
3714 (relro_strip_test_LDFLAGS): New variable.
3715 (relro_strip_test_LDADD): New variable.
3716 (relro_strip_test.so): New target.
3718 2010-08-02 Ian Lance Taylor <iant@google.com>
3720 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3721 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3722 (Target_i386::got_tlsdesc_section): New function.
3723 (Target_i386::got_section): Create space for GOT entries for
3724 TLSDESC relocations.
3725 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3727 (Target_i386::Scan::global): Likewise.
3728 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3730 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3731 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3732 (Target_x86_64::got_tlsdesc_section): New function.
3733 (Target_x86_64::got_section): Create space for GOT entries for
3734 TLSDESC relocations.
3735 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3737 (Target_x86_64::Scan::global): Likewise.
3738 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3741 2010-08-02 Ian Lance Taylor <iant@google.com>
3743 * testsuite/final_layout.sh: Use dc to convert from hex to
3746 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3748 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3749 paramter to the call to gold::gc_process_relocs.
3750 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3751 paramter to the call to gold::gc_process_relocs.
3752 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3753 parameter to the call to gold::gc_process_relocs.
3754 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3755 template parameter to the call to gold::gc_process_relocs.
3756 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3757 paramter to the call to gold::gc_process_relocs.
3758 * gc.h (get_embedded_addend_size): New function.
3759 (gc_process_relocs): Save the size of the reloc for use by ICF.
3760 * icf.cc (get_section_contents): Get the addend from the text section
3761 for SHT_REL relocation sections.
3762 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3763 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3764 * int_encoding.h (read_from_pointer): New overloaded function.
3765 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3766 * testsuite/icf_sht_rel_addend_test.sh: New file.
3767 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3768 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3770 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3772 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3773 * Makefile.in: Regenerate.
3774 * testsuite/Makefile.in: Regenerate.
3776 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3778 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3779 * gold/testsuite/debug_msg.cc: Likewise.
3780 * gold/testsuite/odr_violation1.cc
3781 * gold/testsuite/odr_violation2.cc
3783 2010-07-21 Cary Coutant <ccoutant@google.com>
3785 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3786 string, and length fields.
3787 (Output_merge_string::Merged_strings_list): New type.
3788 (Output_merge_string::Merged_strings_lists): New typedef.
3789 (Output_merge_string): Replace merged_strings_ with
3790 merged_strings_lists_.
3791 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3792 Merged_strings_list per input object and section. Don't store pointer
3793 to the string. Don't store length with each merged string entry.
3794 (Output_merge_string::finalize_merged_data): Loop over list of merged
3795 strings lists. Recompute length of each merged string.
3797 2010-07-15 Cary Coutant <ccoutant@google.com>
3799 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3802 2010-07-14 Ian Lance Taylor <iant@google.com>
3804 * descriptors.cc (Descriptors::open): Report correct name in error
3807 2010-07-13 Doug Kwan <dougkwan@google.com>
3809 * arm.cc (Arm_input_section::Arm_input_section): For a
3810 SHT_ARM_EXIDX section, always keeps the input sections.
3811 (Arm_input_section::set_exidx_section_link): New method.
3812 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3813 has_errors_ to false.
3814 (Arm_exidx_input_section::has_errors,
3815 Arm_exidx_input_section::set_has_errors): New methods.
3816 (Arm_exidx_input_section::has_errors_): New data member.
3817 (Arm_relobj::get_exidx_shndx_list): New method.
3818 (Arm_output_section::append_text_sections_to_list): Do not skip
3819 section without SHF_EXECINSTR.
3820 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3822 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3823 section header. Make error messages more verbose. Check for
3824 a non-executable section linked to an EXIDX section.
3825 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3826 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3827 check that there is no deferred EXIDX section if we exit early.
3828 Instead of not making an EXIDX section in case of an error, make one
3829 and set the has_errors flag of it.
3830 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3831 in a relocatable link.
3832 (Target_arm::do_relax): Look for the EXIDX output section instead of
3833 assuming that it is called .ARM.exidx.
3834 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3835 section list. Do not check for SHF_EXECINSTR section flags but
3836 skip any input section with errors.
3837 * output.cc (Output_section::Output_section): Initialize
3838 always_keeps_input_sections_ to false.
3839 (Output_section::add_input_section): Check for
3840 always_keeps_input_sections_.
3841 * output.h (Output_section::always_keeps_input_sections,
3842 Output_section::set_always_keeps_input_sections): New methods.
3843 (Output_section::always_keeps_input_sections): New data member.
3845 2010-07-13 Rafael Espindola <espindola@google.com>
3847 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3848 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3850 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3851 Ian Lance Taylor <iant@google.com>
3853 * output.h (Output_section_lookup_maps::add_merge_section):
3854 Correct check of whether value was inserted.
3855 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3856 (Output_section_lookup_maps::add_relaxed_input_section):
3858 * arm.cc (Target_arm::got_section): Remove used local os.
3859 * i386.cc (Target_i386::got_section): Likewise.
3860 * x86_64.cc (Target_x86_64::got_section): Likewise.
3861 * sparc.cc (Target_sparc::got_section): Likewise.
3862 (Target_sparc::relocate): Remove unused local have_got_offset.
3863 * powerpc.cc (Target_powerpc::relocate): Likewise.
3865 2010-07-13 Ian Lance Taylor <iant@google.com>
3867 * compressed_output.cc (zlib_decompress): Fix signature in
3870 * archive.cc (Archive::include_member): Unlock an external member
3871 of a thin archive. Don't bother to delete an object we know is
3874 2010-07-12 Cary Coutant <ccoutant@google.com>
3876 * compressed_output.cc (zlib_decompress): New function.
3877 (get_uncompressed_size): New function.
3878 (decompress_input_section): New function.
3879 * compressed_output.h (get_uncompressed_size): New function.
3880 (decompress_input_section): New function.
3881 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3882 Handle compressed debug sections.
3883 * layout.cc (is_compressed_debug_section): New function.
3884 (Layout::output_section_name): Map compressed section names to
3886 * layout.h (is_compressed_debug_section): New function.
3887 (is_debug_info_section): Recognize compressed debug sections.
3888 * merge.cc: Include compressed_output.h.
3889 (Output_merge_data::do_add_input_section): Handle compressed
3891 (Output_merge_string::do_add_input_section): Handle compressed
3893 * object.cc: Include compressed_output.h.
3894 (Sized_relobj::Sized_relobj): Initialize new data members.
3895 (build_compressed_section_map): New function.
3896 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3897 * object.h (Object::section_is_compressed): New method.
3898 (Object::do_section_is_compressed): New method.
3899 (Sized_relobj::Compressed_section_map): New type.
3900 (Sized_relobj::do_section_is_compressed): New method.
3901 (Sized_relobj::compressed_sections_): New data member.
3902 * output.cc (Output_section::add_input_section): Handle compressed
3904 * reloc.cc: Include compressed_output.h.
3905 (Sized_relobj::write_sections): Handle compressed debug sections.
3907 2010-07-08 Cary Coutant <ccoutant@google.com>
3909 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3910 weak when resolving to a dynamic def.
3911 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3912 for weak undef/dynamic def cases. Adjust callers.
3913 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3914 undef_binding_weak_.
3915 (Symbol_table::sized_write_globals): Adjust symbol binding.
3916 (Symbol_table::sized_write_symbol): Add binding parameter.
3917 * symtab.h (Symbol::set_undef_binding): New method.
3918 (Symbol::is_undef_binding_weak): New method.
3919 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3920 (Symbol_table::should_override): Add new parameter.
3921 (Symbol_table::sized_write_symbol): Add new parameter.
3923 * testsuite/weak_undef_file1.cc: Add new test case.
3924 * testsuite/weak_undef_file2.cc: Fix header comment.
3925 * testsuite/weak_undef_test.cc: Add new test case.
3927 2010-06-29 Doug Kwan <dougkwan@google.com>
3929 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3930 Initialize USE_SYMBOL_.
3931 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3933 (Arm_reloc_property::uses_symbol_): New data member declaration.
3934 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3935 uses symbol value and symbol is undefined but not weakly undefined.
3937 2010-06-28 Rafael Espindola <espindola@google.com>
3939 * plugin.cc (Plugin::load): Use dlerror.
3941 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3943 * symtab.cc (detect_odr_violations): When reporting an ODR
3944 violation, report an object where the symbol is defined.
3946 2010-06-25 Doug Kwan <dougkwan@google.com>
3948 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3949 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3951 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3952 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3953 target hook to detect function points.
3954 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3955 * icf.h (Icf::check_section_for_function_pointers): Change type of
3956 parameter SECTION_NAME to const reference to std::string. Use
3957 target hook to determine if section may have unsafe pointers.
3958 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3961 2010-06-21 Rafael Espindola <espindola@google.com>
3963 * fileread.cc (Input_file::find_fie): New
3964 (Input_file::open): Use Input_file::find_fie.
3965 * fileread.h (Input_file::find_fie): New
3966 * plugin.cc (set_extra_library_path): New.
3967 (Plugin::load): Add set_extra_library_path to the transfer vector.
3968 (Plugin_manager::set_extra_library_path): New.
3969 (Plugin_manager::add_input_file): Use the extra search path if set.
3970 (set_extra_library_path(): New.
3971 * plugin.h (Plugin_manager): Add set_extra_library_path and
3974 2010-06-19 Cary Coutant <ccoutant@google.com>
3976 * layout.cc (gdb_sections): Add .debug_types.
3977 (lines_only_debug_sections): Likewise.
3979 2010-06-18 Rafael Espindola <espindola@google.com>
3981 * plugin.cc (add_input_file,add_input_library)
3982 (Plugin_manager::add_input_file): Make filename arguments const.
3983 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3986 2010-06-16 Doug Kwan <dougkwan@google.com>
3988 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3989 .ARM.attributes section if we have not merged any input
3990 attributes sections.
3992 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3994 * arm.cc: Allow combining objects with no EABI version
3997 2010-06-15 Rafael Espindola <espindola@google.com>
3999 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4001 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4003 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4004 (struct iovec): Correct !HAVE_READV definition.
4006 2010-06-10 Cary Coutant <ccoutant@google.com>
4008 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4009 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4011 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4014 * symtab.h (Symbol::is_placeholder): New member function.
4015 * target-reloc.h (relocate_section): Check for placeholder symbols.
4017 * testsuite/Makefile.am (plugin_test_8): New test.
4018 (plugin_test_9): New test.
4019 * testsuite/Makefile.in: Regenerate.
4021 2010-06-09 Nick Clifton <nickc@redhat.com>
4023 * yyscript.y (input_list_element): Allow strings prefixed with
4024 the '-' character. Treat these as libraries.
4025 * script.cc (script_add_library): New function. Adds a library
4026 specified by "-l<name>" found in an input script.
4027 * script-c.h: Add prototype for script_add_library.
4029 2010-06-07 Doug Kwan <dougkwan@google.com>
4031 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4032 Restrict stub-group size to be within long conditional branch
4033 range when working around cortex-A8 erratum.
4035 2010-06-07 Damien Diederen <dd@crosstwine.com>
4037 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4040 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4044 (Output_section::Input_section_sort_entry::compare_section_ordering):
4045 Change to return non-zero correctly.
4046 (Output_section::Input_section_sort_section_order_index_compare
4047 ::operator()): Change to fix ambiguity in comparisons.
4049 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4051 * gold.h (is_wildcard_string): New function.
4052 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4053 (Layout::layout_eh_frame): Ditto.
4054 (Layout::find_section_order_index): New method.
4055 (Layout::read_layout_from_file): New method.
4056 * layout.h (Layout::find_section_order_index): New method.
4057 (Layout::read_layout_from_file): New method.
4058 (Layout::input_section_position_): New private member.
4059 (Layout::input_section_glob_): New private member.
4060 * main.cc (main): Call read_layout_from_file here.
4061 * options.h (--section-ordering-file): New option.
4062 * output.cc (Output_section::input_section_order_specified_): New
4064 (Output_section::Output_section): Initialize new member.
4065 (Output_section::add_input_section): Add new parameter.
4066 Keep input sections when --section-ordering-file is used.
4067 (Output_section::set_final_data_size): Sort input sections when
4068 section ordering file is specified.
4069 (Output_section::Input_section_sort_entry): Add new parameter.
4071 (Output_section::Input_section_sort_entry::compare_section_ordering):
4073 (Output_section::Input_section_sort_compare::operator()): Change to
4074 consider section_order_index.
4075 (Output_section::Input_section_sort_init_fini_compare::operator()):
4076 Change to consider section_order_index.
4077 (Output_section::Input_section_sort_section_order_index_compare
4078 ::operator()): New method.
4079 (Output_section::sort_attached_input_sections): Change to sort
4080 according to section order when specified.
4081 (Output_section::add_input_section<32, true>): Add new parameter.
4082 (Output_section::add_input_section<64, true>): Add new parameter.
4083 (Output_section::add_input_section<32, false>): Add new parameter.
4084 (Output_section::add_input_section<64, false>): Add new parameter.
4085 * output.h (Output_section::add_input_section): Add new parameter.
4086 (Output_section::input_section_order_specified): New
4088 (Output_section::set_input_section_order_specified): New method.
4089 (Input_section::Input_section): Initialize section_order_index_.
4090 (Input_section::section_order_index): New method.
4091 (Input_section::set_section_order_index): New method.
4092 (Input_section::section_order_index_): New member.
4093 (Input_section::Input_section_sort_section_order_index_compare): New
4095 (Output_section::input_section_order_specified_): New member.
4096 * script-sections.cc (is_wildcard_string): Delete and move modified
4098 (Output_section_element_input::Output_section_element_input): Modify
4099 call to is_wildcard_string.
4100 (Output_section_element_input::Input_section_pattern
4101 ::Input_section_pattern): Ditto.
4102 (Output_section_element_input::Output_section_element_input): Ditto.
4103 * testsuite/Makefile.am (final_layout): New test case.
4104 * testsuite/Makefile.in: Regenerate.
4105 * testsuite/final_layout.cc: New file.
4106 * testsuite/final_layout.sh: New file.
4108 2010-06-01 Rafael Espindola <espindola@google.com>
4110 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4112 2010-06-01 Rafael Espindola <espindola@google.com>
4114 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4115 visibility of symbols.
4117 2010-05-27 Doug Kwan <dougkwan@google.com>
4119 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4120 from start of output section instead of address for a local symbol
4121 in a merged or relaxed section when doing a relocatable link.
4123 2010-05-26 Rafael Espindola <espindola@google.com>
4126 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4127 adding sections the garbage collector removed.
4128 * gold/testsuite/Makefile.am: Add test.
4129 * gold/testsuite/Makefile.in: Regenerate.
4130 * gold/testsuite/plugin_test_7.sh: New.
4131 * gold/testsuite/plugin_test_7_1.c: New.
4132 * gold/testsuite/plugin_test_7_2.c: New.
4134 2010-05-26 Rafael Espindola <espindola@google.com>
4136 * script-sections.cc (Output_section_definition::set_section_addresses):
4137 Check for --section-start.
4139 2010-05-26 Doug Kwan <dougkwan@google.com>
4141 * arm.cc (Arm_scan_relocatable_relocs): New class.
4142 (Target_arm::relocate_special_relocatable): New method.
4143 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4144 (Arm_relocate_functions::thumb_branch_common): Same.
4145 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4146 instead of Default_scan_relocatable_relocs.
4147 * target-reloc.h (relocate_for_relocatable): Let target handle
4148 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4149 * target.h (Sized_target::relocate_special_relocatable): New method.
4151 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4153 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4155 2010-05-23 Doug Kwan <dougkwan@google.com>
4157 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4159 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4160 with a direct branch, not a conditional branch, to a stub.
4161 * merge.cc (Output_merge_base::record_input_section): New method
4163 (Output_merge_data::do_add_input_section): Record input section if
4164 keeps-input-sections flag is set.
4165 (Output_merge_string::do_add_input_section): Ditto.
4166 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4167 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4169 (Output_merge_base::keeps_input_sections,
4170 Output_merge_base::set_keeps_input_sections,
4171 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4173 (Output_merge_base::Input_sections): New type declaration.
4174 (Output_merge_base::input_sections_begin,
4175 Output_merge_base::input_sections_end,
4176 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4177 (Output_merge_base::bool keeps_input_sections_,
4178 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4179 Output_merge_base::input_sections_): New data members.
4180 (Output_merge_data::do_set_keeps_input_sections): New method
4182 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4183 * output.cc (Output_section::Input_section::relobj): Move method
4184 defintion from class declaration to here and handle merge sections.
4185 (Output_section::Input_section::shndx): Ditto.
4186 (Output_section::Output_section): Remove initializations of removed
4187 data members and initialize new data member LOOKUP_MAPS_.
4188 (Output_section::add_input_section): Set keeps-input-sections flag
4189 for a newly created merge output section as appropriate. Adjust code
4190 to use Output_section_lookup_maps class.
4191 (Output_section::add_relaxed_input_section): Adjst code for lookup
4192 maps code refactoring.
4193 (Output_section::add_merge_input_section): Add a new parameter
4194 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4195 class. If adding input section to a newly created merge output
4196 section fails, remove the new merge section.
4197 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4198 Adjust code for use of the Output_section_lookup_maps class.
4199 (Output_section::find_merge_section): Ditto.
4200 (Output_section::build_lookup_maps): New method defintion.
4201 (Output_section::find_relaxed_input_section): Adjust code to use
4202 Output_section_lookup_maps class.
4203 (Output_section::get_input_sections): Export merge sections. Adjust
4204 code to use Output_section_lookup_maps class.
4205 (Output_section:::add_script_input_section): Adjust code to use
4206 Output_section_lookup_maps class. Update lookup maps for merge
4208 (Output_section::discard_states): Use Output_section_lookup_maps.
4209 (Output_section::restore_states): Same.
4210 * output.h (Merge_section_properties): Move class defintion out of
4212 (Output_section_lookup_maps): New class.
4213 (Output_section::Input_section::is_merge_section): New method
4215 (Output_section::Input_section::relobj): Move defintion out of class
4216 defintion. Declare method only.
4217 (Output_section::Input_section::shndx): Ditto.
4218 (Output_section::Input_section::output_merge_base): New method defintion.
4219 (Output_section::Input_section::u2_.pomb): New union field.
4220 (Output_section::Merge_section_by_properties_map,
4221 Output_section::Output_section_data_by_input_section_map,
4222 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4224 (Output_section::add_merge_input_section): Add new parameter
4225 KEEPS_INPUT_SECTIONS.
4226 (Output_section::build_lookup_maps): New method declaration.
4227 (Output_section::merge_section_map_,
4228 Output_section::merge_section_by_properties_map_,
4229 Output_section::relaxed_input_section_map_,
4230 Output_section::is_relaxed_input_section_map_valid_): Remove data
4232 (Output_section::lookup_maps_): New data member.
4234 2010-05-21 Doug Kwan <dougkwan@google.com>
4237 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4238 avoid a compilation error.
4240 2010-05-19 Rafael Espindola <espindola@google.com>
4242 * script-sections.cc (Output_section_definition::allocate_to_segment):
4243 Update the phdrs_list even when the output section is NULL.
4244 * testsuite/Makefile.am: Add test.
4245 * testsuite/Makefile.in: Regenerate.
4246 * testsuite/script_test_9.cc: New.
4247 * testsuite/script_test_9.sh: New.
4248 * testsuite/script_test_9.t: New.
4250 2010-05-19 Doug Kwan <dougkwan@google.com>
4252 * arm.cc (Arm_input_section::original_size): New method.
4253 (Arm_input_section::do_addralign): Add a cast.
4254 (Arm_input_section::do_output_offset): Remove static cast.
4255 (Arm_input_section::original_addralign,
4256 Arm_input_section::original_size_): Change type to uint32_t.
4257 (Arm_input_section::init): Add safe casts for section alignment
4259 (Arm_input_section::set_final_data_size): Do not set address and
4260 offset of stub table.
4261 (Arm_output_section::fix_exidx_coverage): Change use of of
4262 Output_section::Simple_input_section to that of
4263 Output_section::Input_section.
4264 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4265 except for the first pass.
4266 * output.cc (Output_section::get_input_sections): Change type of
4267 input_sections to std::list<Input_section>.
4268 (Output_section::add_script_input_section): Rename from
4269 Output_section::add_simple_input_section. Change type of SIS
4270 parameter from Simple_input_section to Input_section.
4271 * output.h (Output_section::Simple_input_section): Remove class.
4272 (Output_section::Input_section): Change class visibility to public.
4273 (Output_section::Input_section::addralign): Use stored alignments
4274 for special input sections if set.
4275 (Output_section::Input_section::set_addralign): New method.
4276 (Output_section::get_input_sections): Change parameter type from
4277 list of Simple_input_section to list of Input_section.
4278 (Output_section::add_script_input_section): Rename from
4279 Output_section::add_simple_input_section. Change first parameter's
4280 type from Simple_input_section to Input_section and remove the
4281 second and third parameters.
4282 * script-sections.cc (Input_section::Input_section_list): Change
4283 type to list of Output_section::Input_section/
4284 (Input_section_info::Input_section_info): Change parameter type of
4285 INPUT_SECTION to Output_section::Input_section.
4286 (Input_section_info::input_section): Change return type.
4287 (Input_section_info::input_section_): Change type to
4288 Output_section::Input_section.
4289 (Output_section_element_input::set_section_addresses): Adjust code
4290 to use Output_section::Input_section instead of
4291 Output_section::Simple_input_section. Adjust code for renaming
4292 of Output_section::add_simple_input_section.
4293 (Orphan_output_section::set_section_addresses): Ditto.
4295 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4297 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4298 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4300 2010-05-18 Rafael Espindola <espindola@google.com>
4302 * options.cc (General_options::finalize): Handle -nostdlib.
4303 * options.h (nostdlib): New option.
4304 * script.cc (script_add_search_dir): Handle -nostdlib.
4306 2010-05-12 Doug Kwan <dougkwan@google.com>
4308 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4309 attributes section only if there no attributes section after merging.
4310 (Target_arm::merge_object_attributes): Move value of
4311 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4312 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4313 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4314 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4315 and arm_attr_merge_7.stdout.
4316 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4317 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4318 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4319 arm_attr_merge_7b.o): New rules.
4320 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4322 * testsuite/Makefile.in: Regenerate.
4323 * testsuite/arm_attr_merge.sh: New file.
4324 * testsuite/arm_attr_merge_[67][ab].s: Same.
4326 2010-05-05 Nick Clifton <nickc@redhat.com>
4328 * po/es.po: Updated Spanish translation.
4330 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4332 * Makefile.am (install-exec-local): Properly install gold as
4333 default cross linker.
4334 * Makefile.in: Regenerated.
4336 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4337 Nick Clifton <nickc@redhat.com>
4339 * configure.ac (install_as_default): Define and set to false
4340 unless --enable-gold or --enable-gold=both/gold has been
4342 * configure: Regenerate.
4344 * Makefile.am (install-exec-local): Install the executable as
4345 'ld.gold'. If install_as_default is true then also install it as
4347 * Makefile.in: Regenerated.
4349 2010-04-24 Ian Lance Taylor <iant@google.com>
4351 * layout.cc (Layout::layout_reloc): In relocatable link don't
4352 combine reloc sections for grouped sections.
4354 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4356 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4357 sections that are not ordinary to icf.
4358 * icf.cc (get_section_contents): Handle relocation pointing to section
4359 with no object or shndx information.
4360 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4361 * testsuite/Makefile.in: Regenerate.
4362 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4363 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4365 2010-04-22 Ian Lance Taylor <iant@google.com>
4367 * expression.cc (Expression::Expression_eval_info): Add
4368 result_alignment_pointer field.
4369 (Expression::eval_with_dot): Add result_alignment_pointer
4370 parameter. Change all callers.
4371 (Expression::eval_maybe_dot): Likewise.
4372 (class Binary_expression): Add alignment_pointer parameter to
4373 left_value and right_value. Change all callers.
4374 (BINARY_EXPRESSION): Set result alignment.
4375 (class Trinary_expression): Add alignment_pointer parameter to
4376 arg2_value and arg3_value. Change all callers.
4377 (Trinary_cond::value): Set result alignment.
4378 (Max_expression::value, Min_expression::value): Likewise.
4379 (Align_expression::value): Likewise.
4380 * script-sections.cc (class Sections_element): Add dot_alignment
4381 parameter to set_section_addresses virtual function. Update
4383 (class Output_section_element): Likewise.
4384 (Script_sections::create_segments): Add dot_alignment parameter.
4386 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4387 (Script_sections::set_phdrs_clause_addresses): Likewise.
4388 * script-sections.h: Update declarations.
4389 * script.h: Update declarations.
4390 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4392 * testsuite/script_test_3.t: Set large alignment.
4393 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4394 segment has expected alignment.
4396 2010-04-22 Nick Clifton <nickc@redhat.com>
4398 * po/gold.pot: Updated by the Translation project.
4399 * po/vi.po: Updated Vietnamese translation.
4401 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4403 * testsuite/Makefile.am (check_PROGRAMS): Add
4404 icf_virtual_function_folding_test.
4405 * testsuite/Makefile.in: Regenerated.
4407 2010-04-15 Andrew Haley <aph@redhat.com>
4409 * options.h (merge_exidx_entries): New option.
4410 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4411 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4412 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4413 (Target_arm::merge_exidx_entries): New function.
4414 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4415 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4416 to Arm_exidx_fixup constructor.
4417 Add new arg, merge_exidx_entries.
4418 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4419 Arm_output_section::fix_exidx_coverage.
4421 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4423 * icf.cc (get_section_contents): Check for preemptible functions.
4424 Ignore addend when appropriate.
4425 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4427 (add_from_relobj): Check for section folded.
4428 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4429 * symtab.h (should_add_dynsym_entry): Add new parameter.
4430 * target-reloc.h (scan_relocs): Check for section folded.
4431 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4432 Check reloc types for function pointers in shared objects.
4433 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4435 (icf_preemptible_functions_test): New test case.
4436 (icf_string_merge_test): New test case.
4437 * testsuite.Makefile.in: Regenerate.
4438 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4439 bar_glob. Refactor code.
4440 * testsuite/icf_preemptible_functions_test.cc: New file.
4441 * testsuite/icf_preemptible_functions_test.sh: New file.
4442 * testsuite/icf_string_merge_test.cc: New file.
4443 * testsuite/icf_string_merge_test.sh: New file.
4444 * testsuite/icf_virtual_function_folding_test.cc: New file.
4445 * testsuite/icf_virtual_function_folding_test.sh: New file.
4447 2010-04-14 Doug Kwan <dougkwan@google.com>
4449 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4450 for local symbol recounting if we remove a section due to ICF.
4451 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4452 there are no regular objects in input.
4454 2010-04-13 Doug Kwan <dougkwan@google.com>
4456 * arm.cc (Arm_input_section::set_final_data_size): Compute
4457 accurate final data size instead of using current data size.
4459 2010-04-09 Doug Kwan <dougkwan@google.com>
4461 * layout.cc (Layout::choose_output_section): Handle script section
4463 (Layout::make_output_section_for_script): Add section type parameter.
4464 Handle script section types.
4465 * layout.h (Layout::make_output_section_for_script): Add section
4467 * output.cc (Output_section::Output_section): Initialize data member
4469 (Output_section::do_reset_address_and_file_offset): Do not set address
4470 to 0 if section is a NOLOAD section.
4471 * output.h (Output_section::is_noload): New method.
4472 (Output_section::set_is_noload): Ditto.
4473 (Output_section::is_noload_): New data member.
4474 * script-c.h (Script_section_type): New enum type.
4475 (struct Parser_output_section_header): Add new file section_type.
4476 * script-sections.cc (Sections_element::output_section_name): Add
4477 parameter for returning script section type.
4478 (Output_section_definition::output_section_name): Ditto.
4479 (Output_section_definition::section_type)P; New method.
4480 (Output_section_definiton::script_section_type_name): Ditto.
4481 (Output_section_definition::script_section_type_): New data member.
4482 (Output_section_definition::Output_section_definition): Initialize
4483 data member Output_section_definition::script_section_type_.
4484 (Output_section_definition::create_sections): Pass script section type
4485 to Layout::make_output_section_for_script.
4486 (Output_section_definition::output_section_name): Return script
4487 section type to caller.
4488 (Output_section_definition::set_section_address): Do not advance
4489 dot value and load address if section type is NOLOAD. Set address
4490 of NOLOAD sections regardless of section flags.
4491 (Output_section_definition::print): Print section type if it is
4492 not SCRIPT_SECTION_TYPE_NONE.
4493 (Output_section_definition::section_type): New method.
4494 (Output_section_definition::script_section_type_name): Ditto.
4495 (Script_sections::output_section_name): Add new parameter
4496 PSECTION_TYPE for returning script section type. Pass it to
4497 section elements. Handle discard sections.
4498 (Sort_output_sections::operator()): Handle NOLOAD sections.
4499 * script-sections.h (Script_sections::Section_type): New enum type.
4500 (Script_sections::output_section_name): Add a new parameter for
4501 returning script section type.
4502 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4504 * yyscript.y (union): Add new field SECTION_TYPE.
4505 (COPY, DSECT, INFO, NOLOAD): New tokens.
4506 (opt_address_and_section_type): Change type to output_section_header.
4507 (section_type): New non-terminal
4508 (section_header): Handle section type.
4509 (opt_address_and_section_type): Return section type value.
4511 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4513 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4514 * testsuite/plugin_common_test_2.c (foo): Likewise.
4516 2010-04-08 Doug Kwan <dougkwan@google.com>
4518 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4520 * output.cc (Output_section::add_merge_input_section): Simplify
4521 code and return status of Output_merge_base::add_input_section.
4522 Update merge section map only if Output_merge_base::add_input_section
4525 2010-04-07 Doug Kwan <dougkwan@google.com>
4527 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4528 if section is marked as containing instructions but has no mapping
4530 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4531 correct section index.
4532 (Arm_relobj::find_linked_text_section): Ditto.
4534 2010-04-07 Cary Coutant <ccoutant@google.com>
4536 * archive.cc (include_member): Destroy Read_symbols_data object before
4538 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4539 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4540 (Read_symbols_data::~Read_symbols_data) New destructor.
4541 (Section_relocs::Section_relocs) New constructor.
4542 (Section_relocs::~Section_relocs) New destructor.
4543 (Read_relocs_data::Read_relocs_data) New constructor.
4544 (Read_relocs_data::~Read_relocs_data) New destructor.
4545 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4546 pointers to NULL after deleting.
4548 2010-04-07 Doug Kwan <dougkwan@google.com>
4550 * arm.cc: Replace "endianity" with "endianness" in comments.
4551 (Arm_exidx_cantunwind): Ditto.
4552 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4553 (Arm_relobj::merge_flags_and_attributes): New method.
4554 (Arm_relobj::merge_flags_and_attributes_): New data member.
4555 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4556 (Arm_relobj::scan_sections_for_stubs): Ditto.
4557 (Arm_relobj::do_read_symbols): Check to see if we really want to
4558 merge processor-specific flags and attributes. Exit early if
4559 an object is empty except for section names and the undefined symbol.
4560 (Target_arm::do_finalize_sections): Move check for ELF format to
4561 Arm_relobj::do_read_symbols. Merge processor specific flags and
4562 attributes from a regular object only when we have determined that
4563 it is aapropriate. Do not create an .ARM.attributes section in
4564 output if there is no regular input object.
4565 (Target_arm::merge_processor_specific_flags): Check
4566 --warn-mismatch before printing any error.
4567 (Target_arm::merge_object_attributes): Ditto.
4568 * gold.cc (queue_middle_tasks): Handle the case in which there is
4569 no regular object in input.
4570 * options.cc (General_options::parse_EB): New method.
4571 (General_options::parse_EL): Same.
4572 (General_options::General_options): Initialize endianness_.
4573 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4575 (General_options::Endianness): New enum.
4576 (General_options::endianness): New method.
4577 (General_options::endianness_): New data member.
4578 * parameters.cc (Parameters::set_options): Check target endianness.
4579 (Parameters::set_target_once): Ditto.
4580 (Parameters::check_target_endianness): New method.
4581 (parameters_force_valid_target): If either -EL or -EB is specified,
4582 use it to define endianness of default target.
4583 * parameters.h (Parameters::check_target_endianness): New method
4585 * target.h (class Target): Change "endianity" to "endianness"
4588 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4590 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4591 * configure: Regenerate.
4592 * Makefile.in: Regenerate.
4593 * testsuite/Makefile.in: Regenerate.
4595 2010-04-06 Cary Coutant <ccoutant@google.com>
4598 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4599 prevailing definitions of common symbols.
4600 * testsuite/plugin_test_6.sh: New test case.
4601 * testsuite/plugin_common_test_1.c: New test case.
4602 * testsuite/plugin_common_test_2.c: New test case.
4603 * testsuite/Makefile.am (plugin_test_6): New test case.
4604 * testsuite/Makefile.in: Regenerate.
4606 2010-04-06 Nick Clifton <nickc@redhat.com>
4608 * po/vi.po: New Vietnamese translation.
4610 2010-03-30 Doug Kwan <dougkwan@google.com>
4612 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4614 2010-03-25 Doug Kwan <dougkwan@google.com>
4616 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4617 to avoid a conversion warning on a 32-bit host.
4619 2010-03-24 Ian Lance Taylor <iant@google.com>
4621 * testsuite/script_test_3.t: Add a TLS segment.
4622 * testsuite/Makefile.am (check_PROGRAMS): Add
4623 tls_phdrs_script_test.
4624 (tls_phdrs_script_test_SOURCES): Define.
4625 (tls_phdrs_script_test_DEPENDENCIES): Define.
4626 (tls_phdrs_script_test_LDFLAGS): Define.
4627 (tls_phdrs_script_test_LDADD): Define.
4628 * testsuite/Makefile.in: Rebuild.
4630 2010-03-23 Cary Coutant <ccoutant@google.com>
4632 * fileread.cc (find_or_make_view): Fix comment.
4634 2010-03-23 Ian Lance Taylor <iant@google.com>
4636 * script-sections.cc (class Orphan_section_placement): Define
4637 PLACE_TLS and PLACE_TLS_BSS.
4638 (Orphan_section_placement::Orphan_section_placement): Initialize
4640 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4641 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4642 (tls_script_test_SOURCES): Define.
4643 (tls_script_test_DEPENDENCIES): Define.
4644 (tls_script_test_LDFLAGS): Define.
4645 (tls_script_test_LDADD): Define.
4646 * testsuite/Makefile.in: Rebuild.
4648 2010-03-22 Doug Kwan <dougkwan@google.com>
4650 * arm.cc (Arm_relocate_functions::abs8,
4651 Arm_relocate_functions::abs16): Use correct check for overflow
4652 specified in the ARM ELF specs.
4653 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4654 target of a BLX instruction specially.
4655 (Reloc_stub::stub_type_for_reloc): Ditto.
4656 (Relocate::relocate): Use symbolic names instead of numeric relocation
4657 codes to report error.
4658 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4660 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4661 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4662 thumb2_blx_out_of_range.stdout
4663 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4664 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4665 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4666 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4667 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4668 thumb2_blx_in_range, thumb2_blx_in_range.o,
4669 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4670 thumb2_blx_out_of_range.o): New rules.
4671 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4672 thumb2_blx_in_range and thumb2_blx_out_of_range.
4673 * testsuite/Makefile.in: Regenerate.
4674 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4675 * testsuite/thumb_blx_in_range.s: New file.
4676 * testsuite/thumb_blx_out_of_range.s: New file.
4678 2010-03-22 Rafael Espindola <espindola@google.com>
4680 * archive.cc (Should_include): Move to archive.h.
4681 (should_include_member): Make it a member of Archive.
4683 (Add_lib_group_symbols): New.
4684 * archive.h: Include options.h.
4685 (Archive_member): Moved from Archive.
4686 (Should_include): Moved from archive.cc.
4688 (Add_lib_group_symbols): New.
4689 * dynobj.cc (do_should_include_member): New.
4690 * dynobj.h (do_should_include_member): New.
4691 * gold.cc (queue_initial_tasks): Update call to queue.
4692 * main.cc (main): Print lib group stats.
4693 * object.cc (do_should_include_member): New.
4694 * object.h: Include archive.h.
4695 (Object::should_include_member): New.
4696 (Object::do_should_include_member): New.
4697 (Sized_relobj::do_should_include_member): New.
4698 * options.cc (General_options::parse_start_lib): New.
4699 (General_options::parse_end_lib): New.
4700 (Input_arguments::add_file): Handle lib groups.
4701 (Input_arguments::start_group): Check we are not in a lib.
4702 (Input_arguments::start_lib): New.
4703 (Input_arguments::end_lib): New.
4704 * options.h (General_options): Add start_lib and end_lib.
4705 (Input_argument::lib_): New.
4706 (Input_argument::lib): New.
4707 (Input_argument::is_lib): New.
4708 (Input_file_lib): New.
4709 (Input_arguments::in_lib_): New.
4710 (Input_arguments::in_lib): New.
4711 (Input_arguments::start_lib): New.
4712 (Input_arguments::end_lib_): New.
4713 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4714 in unused members as preempted.
4715 (Sized_pluginobj::do_should_include_member): New.
4716 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4717 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4719 (Read_symbols::do_whole_lib_group): New.
4720 (Read_symbols::do_lib_group): New.
4721 (Read_symbols::do_read_symbols): Handle lib groups.
4722 (Read_symbols::get_name): Handle lib groups.
4723 * readsyms.h (Read_symbols): Add an archive member pointer.
4724 (Read_symbols::do_whole_lib_group): New.
4725 (Read_symbols::do_lib_group): New.
4726 (Read_symbols::member_): New.
4727 * script.cc (read_input_script): Update call to queue_soon.
4729 2010-03-19 Doug Kwan <dougkwan@google.com>
4731 * arm.cc (Stub_table::Stub_table): Initialize new data members
4732 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4733 (Stub_table::add_reloc_stub): Assign stub offset and update
4734 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4735 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4737 (Stub_table::update_data_size_and_addralign): Use
4738 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4739 instead of going over all reloc stubs.
4740 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4741 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4742 Stringpool_template::offset_ to size of Stringpool_char.
4743 (Stringpool_template::new_key_offset): Remove code to initialize
4744 Stringpool_template::offset_.
4745 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4746 Stringpool_template::offset_ to zero.
4748 2010-03-15 Doug Kwan <dougkwan@google.com>
4750 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4752 (Stringpool_template::new_key_offset): New method.
4753 (Stringpool_template::add_string): Assign offsets when adding new
4755 (Stringpool_template::set_string_offsets): Do not set string offsets
4756 when not optimizing.
4757 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4759 (Chunked_vector::clear): Clear size_.
4760 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4761 (Chunked_vector::size): Return size_.
4762 (Chunked_vector::push_back): Use size_ to find insert position.
4763 (Chunked_vector::size_): New data member.
4764 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4765 (Stringpool_template::new_key_offset): New method declaration.
4766 (Stringpool_template::offset_): New data member.
4768 2010-03-15 Rafael Espindola <espindola@google.com>
4770 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4771 Add_symbols' constructor.
4772 * readsyms.h (Add_symbols): Remove the input_group member.
4774 2010-03-10 Ian Lance Taylor <iant@google.com>
4776 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4777 target to ask whether a reference to a symbol requires a stack
4779 * target.h (Target::is_call_to_non_split): New function.
4780 (Target::do_is_call_to_non_split): Declare virtual function.
4781 * target.cc: Include "symtab.h".
4782 (Target::do_is_call_to_non_split): New function.
4783 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4785 2010-03-10 Cary Coutant <ccoutant@google.com>
4787 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4788 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4789 (File_read::open[2]): Add whole_file_view_ to list of views.
4790 (File_read::make_view): Remove test of whole_file_view_.
4791 (File_read::find_or_make_view): Create whole_file_view_ if
4793 (File_read::clear_views): Replace bool parameter with enum;
4794 adjust all callers. Don't delete views with permanent data;
4795 do delete cached views and views from archives if
4796 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4797 if clearing the corresponding view.
4798 * fileread.h (File_read::Clear_views_mode): New enum.
4799 (File_read::View::is_permanent_view): New method.
4800 (File_read::clear_views): Replace bool parameter
4801 with enum; adjust all callers.
4802 * options.h (General_options): Change keep_files_mapped option;
4803 add map_whole_files.
4804 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4806 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4809 2010-03-10 David S. Miller <davem@davemloft.net>
4811 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4813 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4815 * icf.cc (get_section_contents): Add '@' marker after processing the
4818 2010-03-08 Doug Kwan <dougkwan@google.com>
4820 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4821 due to a conversion warning.
4822 (Arm_relobj::update_output_local_symbol_count): Check for local
4823 symbol with unset output index.
4825 2010-03-05 Ian Lance Taylor <iant@google.com>
4827 * options.h (class General_options): Add --spare-dynamic-tags.
4828 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4829 --spare-dynamic-tags.
4831 2010-03-05 Ian Lance Taylor <iant@google.com>
4833 * incremental.cc: Include "libiberty.h".
4835 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4837 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4838 function, is_info_ member.
4839 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4840 (Versions::Versions): Update caller.
4841 (Versions::define_base_version): Likewise.
4842 (Versions::add_def): Likewise.
4844 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4846 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4847 (Scan::possible_function_pointer_reloc): New function.
4848 (Scan::local_reloc_may_be_function_pointer): Change to call
4849 possible_function_pointer_reloc.
4850 (Scan::global_reloc_may_be_function_pointer): Ditto.
4851 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4852 relocations in ".data.rel.ro._ZTV" section.
4853 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4854 * testsuite/icf_safe_so_test.cc: Ditto.
4855 * testsuite/icf_safe_test.cc: Ditto.
4856 * testsuite/icf_safe_test.sh: Ditto.
4858 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4859 Ian Lance Taylor <iant@google.com>
4861 * target-reloc.h (relocate_section): Check the symbol table index
4862 for -1U before setting the local symbol index.
4863 (scan_relocatable_relocs): If copying the relocation, record that
4864 the local symbol is required.
4865 * object.h (Symbol_value::is_output_symtab_index_set): New
4867 (Symbol_value::may_be_discarded_from_output_symtab): New
4869 (Symbol_value::has_output_symtab_entry): New function.
4870 (Symbol_value::needs_output_symtab_entry): Remove.
4871 (Symbol_value::output_symtab_index): Make sure the symbol index is
4873 (Symbol_value::set_output_symtab_index): Make sure the symbol
4874 index is not set. Make sure the new index is valid.
4875 (Symbol_value::set_must_have_output_symtab_entry): New function.
4876 (Symbol_value::has_output_dynsym_entry): New function.
4877 (Symbol_value::set_output_dynsym_index): Make sure the new index
4879 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4880 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4881 local symbol if permitted.
4882 (Sized_relobj::do_finalize_local_symbols): Call
4883 is_output_symtab_index_set rather than needs_output_symtab_entry.
4884 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4885 rather than needs_output_symtab_entry. Call
4886 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4887 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4888 is_output_symtab_index_set rather than needs_output_symtab_entry.
4889 * testsuite/discard_locals_relocatable_test.c: New file.
4890 * testsuite/discard_locals_test.sh: Test -r.
4891 * testsuite/Makefile.am (check_DATA): Add
4892 discard_locals_relocatable_test1.syms,
4893 discard_local_relocatable_test2.syms.
4894 (MOSTLYCLEANFILES): Likewise. Also add
4895 discard_locals_relocatable_test1.lout and
4896 discard_locals_relocatable_test2.out.
4897 (discard_locals_relocatable_test1.syms): New target.
4898 (discard_locals_relocatable_test.o): New target.
4899 (discard_locals_relocatable_test1.out): New target.
4900 (discard_locals_relocatable_test2.syms): New target.
4901 (discard_locals_relocatable_test2.out): New target.
4902 (various): Add missing ../ld-new dependencies.
4903 * testsuite/Makefile.in: Rebuild.
4905 2010-03-03 Nick Clifton <nickc@redhat.com>
4907 * po/fi.po: New Finnish translation.
4909 2010-03-01 Doug Kwan <dougkwan@google.com>
4911 * layout.cc (Layout::Layout): Force section types of .init_array*,
4912 .preinit_array* and .fini_array* sections.
4913 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4914 Fix check of return value of std::string::find.().
4915 (Output_section::Input_section_sort_compare::operator()): Remove
4916 comment about .init_array.
4917 (Output_section::Input_section_sort_init_fini_compare::operator()):
4919 (Output_section::sort_attached_input_sections): Handle .init_array
4920 and .fini_array specially.
4921 * output.h (Output_section::Inut_section_sort_compare): Update
4923 (Output_section::Input_section_sort_init_fini_compare): New struct.
4925 2010-02-26 Doug Kwan <dougkwan@google.com>
4927 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4928 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4929 * testsuite/debug_msg.sh: Avoid matching source line number for
4930 use of global variable undef_int.
4932 2010-02-26 Doug Kwan <dougkwan@google.com>
4934 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4935 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4936 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4937 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4938 * options.cc (General_options::General_options): Initialize member
4940 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4941 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4942 and rm_no_fix_v4bx.stdout
4943 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4944 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4945 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4946 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4947 and arm_no_fix_v4bx.
4948 * Makefile.in: Regenerate.
4949 * testsuite/arm_fix_v4bx.s: New file.
4950 * testsuite/arm_fix_v4bx.sh: Ditto.
4952 2010-02-24 Doug Kwan <dougkwan@google.com>
4954 * arm.cc (Target_arm::got_section): Make the .got section the first
4955 non RELRO section in the data segment.
4956 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4957 suffixes of section names.
4959 2010-02-24 Doug Kwan <dougkwan@google.com>
4961 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4962 flags and attributes merging if an input file is a binary file.
4963 * fileread.cc (Input_file::open): Record format of original file.
4964 * fileread.h (Input_file::Format): New enum type.
4965 (Input_file::Input_file): Initialize data member format_.
4966 (Input_file::format): New method definition.
4967 (Input_file::format_):: New data member.
4969 2010-02-24 Doug Kwan <dougkwan@google.com>
4971 * arm.cc (Arm_output_data_got): New class.
4972 (ARM_TCB_SIZE): New constant
4973 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4974 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4975 If user uses a script with a SECTIONS clause, issue only a warning
4976 for a misplaced EXIDX input section. Otherwise, issue an error.
4977 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4979 (Target_arm::got_mode_index_entry): Handle static linking.
4980 (Target_arm::Scan::local): Ditto.
4981 (Target_arm::Scan::global): Ditto.
4982 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4983 all incorrectly implemented relocations.
4984 (Target_arm::fix_exidx_coverage): Pass layout to
4985 Arm_output_section::fix_exidx_coverage.
4986 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4987 from ".ARM.exidx." and ".ARM.extab.".
4989 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4991 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4992 section if it does not already exist.
4993 * attributes.cc (Attributes_section_data::Attributes_section_data):
4994 Don't crash if size is zero.
4996 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4997 Ian Lance Taylor <iant@google.com>
4999 * gold.cc (queue_middle_tasks): If no input files were opened,
5001 * workqueue.h (Task_function::Task_function): Assert that there is
5004 2010-02-22 Doug Kwan <dougkwan@google.com>
5006 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5007 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5008 types to avoid warnings due to different uint64_t implementations
5011 2010-02-21 Doug Kwan <dougkwan@google.com>
5013 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5014 handling of the maximum backward branch offset.
5015 (Arm_relocate_functions::thumb_branch_common): Ditto.
5016 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5017 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5018 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5019 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5020 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5021 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5022 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5023 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5024 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5025 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5026 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5027 thumb2_bl_out_of_range.o): New rules.
5028 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5029 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5030 thumb2_bl_out_of_range
5031 * testsuite/Makefile.in: Regenerate.
5032 * testsuite/arm_bl_in_range.s: New file.
5033 * testsuite/arm_bl_out_of_range.s: Ditto.
5034 * testsuite/arm_branch_in_range.sh: Ditto.
5035 * testsuite/arm_branch_range.t: Ditto.
5036 * testsuite/thumb2_branch_range.t: Ditto.
5037 * testsuite/thumb_bl_in_range.s: Ditto.
5038 * testsuite/thumb_bl_out_of_range.s: Ditto.
5039 * testsuite/thumb_branch_range.t: Ditto.
5041 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5043 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5044 Add reloc offset information.
5045 * icf.cc (get_section_contents): Change iterators to point to the new
5046 vectors. Add reloc offset information to the contents.
5047 * icf.h (Icf::Sections_reachable_info): New typedef.
5048 (Icf::Sections_reachable_list): New typedef.
5049 (Icf::Offset_info): New typedef.
5050 (Icf::Reloc_info): New struct typedef.
5051 (Icf::Reloc_info_list): New typedef.
5052 (Icf::symbol_reloc_list): Delete method.
5053 (Icf::addend_reloc_list): Delete method.
5054 (Icf::section_reloc_list): Delete method.
5055 (Icf::reloc_info_list): New method.
5056 (Icf::reloc_info_list_): New member.
5058 2010-02-19 Doug Kwan <dougkwan@google.com>
5060 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5061 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5062 * arm.cc (Arm_relocation_functions): New forward declaration.
5063 (Target_arm::Target_arm): Initialize new data members
5064 got_mod_index_offset_ and tls_base_symbol_defined_.
5065 (Target_arm::Relocate::relocate_tls): New method.
5066 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5067 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5069 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5070 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5071 (Target_arm::got_mod_index_offset_,
5072 Target_arm::tls_base_symbol_defined_): New data members.
5073 (Target_arm::Scan::local, Target::Scan::global,
5074 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5077 2010-02-18 Doug Kwan <dougkwan@google.com>
5079 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5080 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5081 text section as a parameter becuase some broken tools may not set
5082 the link in section header.
5083 (Target_arm::has_got_section): New method.
5084 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5085 without any mapping symbol as data only. Remove warning.
5086 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5087 link in its section header, try to discover the link by inspecting the
5088 REL31 relocation at the beginning of the section.
5089 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5091 (Target_arm::Scan::global): Treat any reference to the symbol
5092 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5094 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5096 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5097 (Scan::global_reloc_may_be_function_pointer): New function.
5098 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5099 (Scan::global_reloc_may_be_function_pointer): New function.
5100 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5101 (Scan::global_reloc_may_be_function_pointer): New function.
5102 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5103 (Scan::global_reloc_may_be_function_pointer): New function.
5104 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5105 (Scan::global_reloc_may_be_function_pointer): New function.
5106 (Scan::possible_function_pointer_reloc): New function.
5107 (Target_x86_64::can_check_for_function_pointers): New function.
5108 * gc.h (gc_process_relocs): Scan relocation types to determine if
5109 function pointers were taken for targets that support it.
5110 * icf.cc (Icf::find_identical_sections): Include functions for
5111 folding in safe ICF whose pointer is not taken.
5112 * icf.h (Secn_fptr_taken_set): New typedef.
5113 (fptr_section_id_): New member.
5114 (section_has_function_pointers): New function.
5115 (set_section_has_function_pointers): New function.
5116 (check_section_for_function_pointers): New function.
5117 * options.h: Fix comment for safe ICF option.
5118 * target.h (can_check_for_function_pointers): New function.
5119 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5120 Modify icf_safe_test for X86-64.
5121 * testsuite/Makefile.in: Regenerate.
5122 * testsuite/icf_safe_so_test.cc: New file.
5123 * testsuite/icf_safe_so_test.sh: New file.
5124 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5125 (main): Change to take pointer to function kept_func_3.
5126 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5127 folding is done correctly for X86-64.
5129 2010-02-12 David S. Miller <davem@davemloft.net>
5131 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5132 is_symbolless parameter.
5133 (Output_reloc<SHT_REL>::is_symbolless): New.
5134 (Output_reloc<SHT_REL>::is_symbolless_): New.
5135 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5136 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5137 (Output_reloc<SHT_RELA>::is_symbolless): New.
5138 (Output_data_reloc::add_global): Handle is_symbolless.
5139 (Output_data_reloc::add_global_relative): Likewise.
5140 (Output_data_reloc::add_local): Likewise.
5141 (Output_data_reloc::add_local_relative): Likewise.
5142 (Output_data_reloc::add_symbolless_global_addend): New.
5143 (Output_data_reloc::add_symbolless_local_addend): New.
5144 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5146 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5147 instead of ->is_relative_
5148 (Output_reloc::write): Likewise.
5149 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5150 (Output_reloc::write_rel): Simplify.
5152 * sparc.cc (Target_sparc::Scan::local): Use
5153 ->add_symbolless_local_addend as needed.
5154 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5155 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5156 based upon relocation offset.
5158 2010-02-11 Doug Kwan <dougkwan@google.com>
5160 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5161 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5162 beginning of function.
5163 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5164 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5165 parameter is_32bit in calls to should_apply_static_reloc.
5166 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5167 (check_DATA): Add arm_abs_global.stdout.
5168 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5169 arm_abs_global.stdout): New rules.
5170 (MOSTLLYCLEANFILES): Add arm_abs_global
5171 * Makefile.in: Regenerate.
5172 * testsuite/arm_abs_global.s: New file.
5173 * testsuite/arm_abs_global.sh: Ditto.
5174 * testsuite/arm_abs_lib.s: Ditto.
5176 2010-02-11 Ian Lance Taylor <iant@google.com>
5178 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5180 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5181 Allocate_commons_task first.
5182 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5183 task, rather than symtab_lock_.
5184 (Gc_process_relocs::~Gc_process_relocs): New function.
5185 (Gc_process_relocs::is_runnable): Check this_blocker_.
5186 (Gc_process_relocs::locks): Use next_blocker_ rather than
5188 (Scan_relocs::~Scan_relocs): New function.
5189 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5191 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5193 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5194 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5195 constructor accordingly.
5196 (class Gc_process_relocs): Likewise.
5197 (class Scan_relocs): Likewise.
5198 * common.h (class Allocate_commons_task): Remove symtab_lock_
5199 field, and corresponding constructor parameter.
5200 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5202 (Allocate_commons_task::locks): Likewise.
5204 2010-02-11 Ian Lance Taylor <iant@google.com>
5206 * gold-threads.h (class Once): Define.
5207 (class Initialize_lock): Rewrite as child of Once.
5208 * gold-threads.cc (class Once_initialize): Define.
5209 (once_pointer_control): New static variable.
5210 (once_pointer, once_arg): New static variables.
5211 (c_run_once): New static function.
5212 (Once::Once, Once::run_once, Once::internal_run): New functions.
5213 (class Initialize_lock_once): Remove.
5214 (initialize_lock_control): Remove.
5215 (initialize_lock_pointer): Remove.
5216 (initialize_lock_once): Remove.
5217 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5218 (Initialize_lock::initialize): Rewrite.
5219 (Initialize_lock::do_run_once): New function.
5220 * archive.cc (Archive::interpret_header): Only clear name if it is
5222 * fileread.cc: Include "gold-threads.h"
5223 (file_counts_lock): New static variable.
5224 (file_counts_initialize_lock): Likewise.
5225 (File_read::release): Only increment counts when using --stats.
5226 Use a lock around the increment.
5227 * parameters.cc (class Set_parameters_target_once): Define.
5228 (set_parameters_target_once): New static variable.
5229 (Parameters::Parameters): Move here from parameters.h.
5230 (Parameters::set_target): Rewrite.
5231 (Parameters::set_target_once): New function.
5232 (Parameters::clear_target): Move here and rewrite.
5233 * parameters.h (class Parameters): Update declarations. Add
5234 set_parameters_target_once_ field.
5235 (Parameters::Parameters): Move to parameters.cc.
5236 (Parameters::clear_target): Likewise.
5237 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5239 (Start_group::~Start_group): New function.
5240 (Start_group::is_runnable): New function.
5241 (Start_group::locks, Start_group::run): New functions.
5242 (Finish_group::run): Change saw_undefined to size_t.
5243 * readsyms.h (class Start_group): Define.
5244 (class Finish_group): Change saw_undefined_ field to size_t.
5245 (Finish_group::Finish_group): Remove saw_undefined and
5246 this_blocker parameters. Change all callers.
5247 (Finish_group::set_saw_undefined): New function.
5248 (Finish_group::set_blocker): New function.
5249 * symtab.h (class Symbol_table): Change saw_undefined to return
5250 size_t. Change saw_undefined_ field to size_t.
5251 * target-select.cc (Set_target_once::do_run_once): New function.
5252 (Target_selector::Target_selector): Initialize set_target_once_
5253 field. Don't initialize lock_ and initialize_lock_ fields.
5254 (Target_selector::instantiate_target): Rewrite.
5255 (Target_selector::set_target): New function.
5256 * target-select.h (class Set_target_once): Define.
5257 (class Target_selector): Update declarations. Make
5258 Set_target_once a friend. Remove lock_ and initialize_lock_
5259 fields. Add set_target_once_ field.
5261 2010-02-10 Ian Lance Taylor <iant@google.com>
5263 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5265 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5266 (queue_middle_tasks): Add all blockers before queueing any tasks.
5267 (queue_final_tasks): Likewise.
5268 * token.h (Task_token::add_blockers): New function.
5269 * object.h (Input_objects::number_of_relobjs): New function.
5271 2010-02-10 Ian Lance Taylor <iant@google.com>
5273 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5274 shared, not if not position independent.
5275 * x86_64.cc (Relocate::relocate_tls): Likewise.
5276 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5277 (tls_pie_pic_test): New target.
5278 * testsuite/Makefile.in: Rebuild.
5280 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5281 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5282 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5283 * testsuite/Makefile.in: Rebuild.
5285 2010-02-09 David S. Miller <davem@davemloft.net>
5287 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5288 R_SPARC_RELATIVE using ->add_local_relative().
5289 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5291 * output.h (Output_data_dynamic::add_section_size): New method
5292 that takes two Output_data objects.
5293 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5294 entry param. Handle it in initializers.
5295 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5296 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5297 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5299 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5300 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5301 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5302 for dynrel_includes_plt.
5303 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5304 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5305 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5307 (Target_sparc::do_finalize_sections): Update to pass true for
5308 dynrel_includes_plt.
5309 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5310 output before .rela.plt
5311 (Target_powerpc::do_finalize_sections): Update to pass true for
5312 dynrel_includes_plt when 32-bit.
5314 2010-02-08 Doug Kwan <dougkwan@google.com>
5316 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5318 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5319 Arm_relobj::scan_section_for_cortex_a8_stubs,
5320 Arm_relobj::do_relocation_section): Instead of calling
5321 Output_section::output_address, use faster
5322 Arm_relobj::simple_input_section_output_address.
5324 2010-02-08 David S. Miller <davem@davemloft.net>
5326 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5327 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5328 relocation helper function.
5330 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5331 just like R_SPARC_GOT{10,13,22}.
5332 (Target_sparc::Scan::local): Likewise.
5333 (Target_sparc::Relocate:relocate): Likewise.
5335 2010-02-06 Ian Lance Taylor <iant@google.com>
5337 * configure.ac: Rewrite targetobjs duplicate removal code to use
5338 only shell constructs.
5339 * configure: Rebuild.
5341 2010-02-05 Doug Kwan <dougkwan@google.com>
5344 * arm.cc (Arm_relobj::section_is_scannable): New method.
5345 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5346 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5348 2010-02-04 Doug Kwan <dougkwan@google.com>
5351 * arm-reloc-property.cc (cstdio): Include.
5352 * configure.ac (targetobjs): Remove duplicates.
5353 * configure: Regenerate.
5354 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5355 big and little endian version for a given address size.
5357 2010-02-03 Doug Kwan <dougkwan@google.com>
5359 * arm-reloc-property.cc
5360 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5362 * arm-reloc-property.h
5363 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5364 New method definition.
5365 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5367 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5369 (GOT_PREL): Change implemented to Y.
5370 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5371 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5372 (Arm_relocate_functions::movw_abs_nc): Remove method.
5373 (Arm_relocate_functions::movt_abs): Ditto.
5374 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5375 (Arm_relocate_functions::thm_movt_abs): Ditto.
5376 (Arm_relocate_functions::movw_rel_nc): Ditto.
5377 (Arm_relocate_functions::movw_rel): Ditto.
5378 (Arm_relocate_functions::movt_rel): Ditto.
5379 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5380 (Arm_relocate_functions:thm_movw_rel): Ditto.
5381 (Arm_relocate_functions:thm_movt_rel): Ditto.
5382 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5383 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5384 New method definitions.
5385 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5386 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5387 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5388 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5389 (Target_arm::Relocate::relocate): Check for non-static or
5390 unimplemented relocation code and exit early. Change calls to
5391 Target_arm::reloc_uses_thumb_bit and
5392 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5393 instead. Refactor code to handle similar relocations to increase
5394 code sharing. Remove check for unsupported relocation code in switch
5396 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5397 relocation property table to find out size. Change error message to
5398 print out the name of a relocation code instead of the numeric value.
5399 (Target_arm::scan_reloc_for_stub): Use relocation property table
5400 instead of calling Target_arm::reloc_uses_thumb_bit().
5402 2010-02-02 Doug Kwan <dougkwan@google.com>
5404 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5405 types of relaxed input section.
5407 2010-02-02 Doug Kwan <dougkwan@google.com>
5409 * Makefile.am (HFILES): Add arm-reloc-property.h.
5411 (TARGETSOURCES): Add arm-reloc-property.cc
5412 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5413 (libgold_a_SOURCES): $(DEFFILES)
5414 * Makefile.in: Regenerate.
5415 * arm-reloc-property.cc: New file.
5416 * arm-reloc-property.h: New file.
5417 * arm-reloc.def: New file.
5418 * arm.cc: Update comments.
5419 (arm-reloc-property.h): New included header.
5420 (arm_reloc_property_table): New global variable.
5421 (Target_arm::do_select_as_default_target): New method definition.
5422 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5423 arm-reloc-property to targ_extra_obj.
5424 * parameters.cc (set_parameters_target): Call
5425 Target::select_as_default_target().
5426 * target.h (Target::select_as_default_target): New method definition.
5427 (Target::do_select_as_default_target): Same.
5429 2010-02-01 Doug Kwan <dougkwan@google.com>
5431 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5432 first_output_text_section_.
5433 (Arm_exidx_fixup::first_output_text_section): New method definition.
5434 (Arm_exidx_fixup::first_output_text_section_): New data member.
5435 (Arm_exidx_fixup::process_exidx_section): Record the first text
5436 output section seen.
5437 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5438 and entsize in output section header.
5440 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5442 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5443 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5444 (Arm_relocate_functions::thm_alu11): New Method.
5445 (Arm_relocate_functions::thm_pc8): New Method.
5446 (Arm_relocate_functions::thm_pc12): New Method.
5447 (Target_arm::Scan::local): Handle the relocations.
5448 (Target_arm::Scan::global): Likewise.
5449 (Target_arm::Relocate::relocate): Likewise.
5450 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5452 2010-01-29 Doug Kwan <dougkwan@google.com>
5454 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5455 of relocation types as ld.
5457 2010-01-29 Doug Kwan <dougkwan@google.com>
5459 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5461 (Arm_relocate_functions::thumb_branch_common): Ditto.
5462 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5463 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5464 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5465 Arm_relocate_functions::jump24): Remove.
5466 (Target_arm::Relocate::relocate): Adjust code to call
5467 Arm_relocation_functions::arm_branch_common and
5468 Arm_relocation_functions::thumb_branch_common instead of their removed
5469 wrappers. Merge switch-cases together to reduce source code size.
5471 2010-01-29 Doug Kwan <dougkwan@google.com>
5473 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5474 output_local_symbol_count_needs_update_.
5475 (Arm_relobj::output_local_symbol_count_needs_update,
5476 Arm_relobj::set_output_local_symbol_count_needs_update,
5477 Arm_relobj::update_output_local_symbol_count): New methods.
5478 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5480 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5481 of pointed function as in a R_ARM_PREL31 relocation.
5482 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5483 for output local symbol count updating.
5484 (Target_arm::do_relax): Update output local symbol counts in objects
5486 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5488 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5490 * arm.cc: Added support for the ARM relocations:
5491 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5492 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5493 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5495 (Arm_relocate_functions::movw_rel): New method.
5496 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5497 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5499 (Arm_relocate_functions::thm_movw_rel): New method.
5500 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5502 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5504 (Target_arm::Scan::global): Likewise.
5505 (Target_arm::Relocate::relocate): Likewise.
5506 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5509 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5511 * arm.cc: Added support for ARM group relocations.
5512 (Target_arm::reloc_needs_sym_origin): New method.
5513 (Arm_relocate_functions::calc_grp_kn): New method.
5514 (Arm_relocate_functions::calc_grp_residual): New method.
5515 (Arm_relocate_functions::calc_grp_gn): New method.
5516 (Arm_relocate_functions::arm_grp_alu): New Method.
5517 (Arm_relocate_functions::arm_grp_ldr): New Method.
5518 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5519 (Arm_relocate_functions::arm_grp_ldc): New Method.
5520 (Target_arm::Scan::local): Handle the ARM group relocations.
5521 (Target_arm::Scan::global): Likewise.
5522 (Target_arm::Relocate::relocate): Likewise.
5523 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5526 2010-01-26 Doug Kwan <dougkwan@google.com>
5528 * arm.cc (set): Include.
5529 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5531 (Arm_output_section::Text_section_list): New type.
5532 (Arm_output_section::append_text_sections_to_list): New method.
5533 (Arm_output_section::fix_exidx_coverage): Ditto.
5534 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5535 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5536 Relobj::set_section_offset() instead of
5537 Sized_relobj::invalidate_section_offset().
5538 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5539 parameter for section headers. Ignore relocation sections for
5540 unallocated sections and EXIDX sections.
5541 (Target_arm::fix_exidx_coverage): New method.
5542 (Target_arm::output_section_address_less_than): New type.
5543 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5544 linked text section instead of the EXIDX section.
5545 (Arm_output_section::create_stub_group): Add an assertion to check
5546 that this is not an EXIDX output section.
5547 (Arm_output_section::append_text_sections_to_list): New method.
5548 (Arm_output_section::fix_exidx_coverage): Ditto.
5549 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5550 Arm_relobj::section_needs_reloc_stub_scanning.
5551 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5553 (Target_arm::fix_exidx_coverage): New method.
5554 * object.h (Relobj::set_output_section): New method.
5555 (Sized_relobj::invalidate_section_offset): Remove method.
5556 (Sized_relobj::do_invalidate_section_offset): Remove method.
5557 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5559 2010-01-25 Doug Kwan <dougkwan@google.com>
5561 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5562 Fix warning due to signed and unsigned comparison on a 32-bit host.
5564 2010-01-22 Doug Kwan <dougkwan@google.com>
5566 * arm.cc (Target_arm::do_relax): Record an output section for section
5567 offset adjustment it contains any stub table that has changed.
5568 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5569 offsets in an output section if necessary.
5570 * output.cc (Output_section::Output_section): Initialize
5571 section_offsets_need_adjustments_.
5572 (Output_section::add_input_section_for_script): Renamed to
5573 Output_section::add_simple_input_section.
5574 (Output_section::save_states): Add a comment.
5575 (Output_section::discard_states): New method defintion.
5576 (Output_section::adjust_section_offsets): Same.
5577 * output.h (Output_section::add_input_section_for_script): Renamed to
5578 Output_section::add_simple_input_section.
5579 (Output_section::discard_states): New method declaration.
5580 (Output_section::adjust_section_offsets): Same.
5581 (Output_section::section_offsets_need_adjustment,
5582 Output_section::set_section_offsets_need_adjustment): New method
5584 (Output_section::section_offsets_need_adjustment_): New data member.
5585 * script-sections.cc
5586 (Output_section_element_input::set_section_address): Adjust code for
5587 renaming of Output_section::add_input_section_for_script.
5588 (Orphan_output_section::set_section_address): Same.
5590 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5592 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5593 Fix_v4bx enum values .
5594 * gold/options.h (General_options): New option definitions.
5595 (General_options::fix_v4bx): New method.
5596 (General_options::Fix_v4bx): New enum.
5597 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5598 (General_options::parse_fix_v4bx_interworking): New method.
5600 2010-01-22 Doug Kwan <dougkwan@google.com>
5602 * arm.cc (Arm_exidx_fixup): New class.
5604 2010-01-21 Doug Kwan <dougkwan@google.com>
5606 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5608 (Arm_exidx_section_offset_map): New type.
5610 2010-01-21 Doug Kwan <dougkwan@google.com>
5612 * arm.cc (Arm_exidx_input_section): New class.
5613 (Arm_relobj::exidx_input_section_by_link,
5614 Arm_relobj::exidx_input_section_by_shndx,
5615 Arm_relobj::make_exidx_input_section): New methods.
5616 (read_arm_attributes_section): Remove.
5617 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5618 information about them.
5619 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5622 2010-01-20 Doug Kwan <dougkwan@google.com>
5624 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5625 Input_section_specifier to Section_id.
5626 (Target_arm::new_arm_input_section: Adjust code for change of key
5628 (Target_arm::find_arm_input_section): Ditto.
5629 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5630 (Section_id): Remove.
5631 (Garbage_collection::Section_id_hash): Remove.
5632 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5633 (Section_id): Remove.
5634 (Icf::Section_id_hash): Remove.
5635 * object.h (Section_id, Const_section_id, Section_id_hash,
5636 Const_section_id_hash): New type definitions.
5637 * output.cc (Output_section::add_relaxed_input_section): Change to
5638 use Const_section_id instead of Input_section_specifier as key type.
5639 (Output_section::add_merge_input_section): Ditto.
5640 (Output_section::build_relaxation_map): Change to use Section_id
5641 instead of Input_section_specifier as key type.
5642 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5644 (Output_section::convert_input_sections_to_relaxed_sections): Change
5645 to use Const_section_id instead of Input_section_specifier as key type.
5646 (Output_section::find_merge_section): Ditto.
5647 (Output_section::find_relaxed_input_section): Ditto.
5648 * output.h (Input_section_specifier): Remove class.
5649 (Output_section::Output_section_data_by_input_section_map): Change
5650 key type to Const_section_id.
5651 (Output_section::Output_relaxed_input_section_by_input_section_map):
5653 (Output_section::Relaxation_map): Change key type to Section_id.
5655 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5657 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5658 (class Arm_v4bx_stub): New class.
5659 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5660 (Stub_factory::make_arm_v4bx_stub): New method.
5661 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5662 (Stub_table::empty): Handle v4bx stubs.
5663 (Stub_table::add_arm_v4bx_stub): New method.
5664 (Stub_table::find_arm_v4bx_stub): New method.
5665 (Arm_relocate_functions::v4bx): New method.
5666 (Target_arm::fix_v4bx): New method.
5667 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5668 (Stub_table::relocate_stubs): Likewise.
5669 (Stub_table::do_write): Likewise.
5670 (Stub_table::update_data_size_and_addralign): Likewise.
5671 (Stub_table::finalize_stubs): Likewise.
5672 (Target_arm::Scan::local): Likewise.
5673 (Target_arm::Scan::global): Likewise.
5674 (Target_arm::do_finalize_sections): Likewise.
5675 (Target_arm::Relocate::relocate): Likewise.
5676 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5678 (Target_arm::scan_reloc_for_stub): Likewise.
5679 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5681 2010-01-19 Ian Lance Taylor <iant@google.com>
5683 * output.cc (Output_section_headers::do_sized_write): Write large
5684 segment count to sh_info field.
5685 (Output_file_header::do_sized_write): For large segment count,
5686 write PN_XNUM to e_phnum field.
5688 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5690 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5691 (Arm_relocate_functions::thm_jump8): New function.
5692 (Arm_relocate_functions::thm_jump11): New function.
5693 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5695 (Target_arm::Scan::global): Likewise.
5696 (Target_arm::Relocate::relocate): Likewise.
5697 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5700 2010-01-14 Doug Kwan <dougkwan@google.com>
5702 * arm.cc (map, utility): Include headers.
5703 (Target_arm::apply_cortex_a8_workaround): New method.
5704 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5705 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5706 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5707 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5708 the --[no-]fix-cortex-a8 command line options.
5709 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5710 (Target_arm::relocate_stub): Use addend in instruction template.
5711 * options.h (DEFINE_bool): Set the user-set flag.
5712 (General_options): Add --[no-]-fix-cortex options.
5713 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5714 : Update fast look-up map after conversion.
5716 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5718 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5719 in the first pass of do_layout.
5721 2010-01-13 Doug Kwan <dougkwan@google.com>
5723 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5724 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5725 apparent compiler problem of not folding static constant integral
5726 data members of elfcpp::Elf_sizes<32>.
5728 2010-01-13 Doug Kwan <dougkwan@google.com>
5730 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5731 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5732 Arm_relobj::scan_section_for_cortex_a8_erratum,
5733 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5734 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5735 sections to scan for relocation stubs into a new method
5736 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5737 relocation and Cortex-A8 stub scanning.
5738 (Target_arm::do_relax): Force stubs to be after stubbed sections
5739 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5740 the beginning of a new relaxation pass. Update a comment.
5741 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5743 2010-01-12 Ian Lance Taylor <iant@google.com>
5745 * target-reloc.h (visibility_error): New inline function.
5746 (relocate_section): Call visibility_error.
5747 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5748 (MOSTLYCLEANFILES): Likewise.
5749 (protected_4_pic.o, protected_3.err): New targets.
5750 * testsuite/protected_4.cc: New file.
5752 2010-01-12 Doug Kwan <dougkwan@google.com>
5754 * arm.cc (Cortex_a8_reloc): New class.
5755 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5756 and cortex_a8_relocs_info_.
5757 (Target_arm::fix_cortex_a8): New method definition.
5758 (Target_arm::Cortex_a8_relocs_info): New type.
5759 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5760 New data member declarations.
5761 (Target_arm::scan_reloc_for_stub): Record information about
5762 relocations for THUMB branches that might be exempted from the
5763 Cortex-A8 workaround.
5764 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5765 at the beginning of a relaxation pass.
5767 2010-01-12 Doug Kwan <dougkwan@google.com>
5769 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5770 (Arm_relobj::Mapping_symbol_position,
5771 Arm_reloj::Mapping_symbol_position_less,
5772 Arm_relobj::Mapping_symbols_info): New types.
5773 (Target_arm::is_mapping_symbol_name): New method definition.
5774 (Arm_relobj::do_count_local_symbols): Save information about mapping
5777 2010-01-11 Doug Kwan <dougkwan@google.com>
5779 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5780 Arm_relocate_functions::thumb32_branch_upper,
5781 Arm_relocate_functions::thumb32_branch_lower,
5782 Arm_relocate_functions::thumb32_cond_branch_offset,
5783 Arm_relocate_functions::thumb32_cond_branch_upper,
5784 Arm_relocate_functions::thumb32_cond_branch_lower,
5785 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5786 branch offset encoding.
5787 (Arm_relocate_functions::thumb_branch_common): Use new branch
5788 offset encoding methods to avoid code duplication.
5789 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5790 (Stub_addend_reader::operator()): Use new branch encoding method
5791 to avoid code duplication.
5793 2010-01-11 Doug Kwan <dougkwan@google.com>
5795 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5796 (Target_arm::do_finalize_sections): Define special EXIDX section
5797 symbols only if referenced.
5798 * gc.h (Garbage_collection::add_reference): New method.
5799 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5802 2010-01-11 Ian Lance Taylor <iant@google.com>
5804 * script.cc (Version_script_info::build_expression_list_lookup):
5805 Change complaing about duplicate wildcard match from error to
5808 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5810 (Version_script_info::Version_script_info): Initialize globs_,
5811 default_version_, default_is_global_, and exact_. Don't
5812 initialize globals_ or locals_.
5813 (Version_script_info::build_lookup_tables): Build local symbols
5815 (Version_script_info::unquote): New function.
5816 (Version_script_info::add_exact_match): New function.
5817 (Version_script_info::build_expression_list_lookup): Remove lookup
5818 parameter. Add is_global parameter. Change all callers. Handle
5819 wildcard pattern specially. Unquote pattern. Call
5821 (Version_script_info::get_name_to_match): New function.
5822 (Version_script_info::get_symbol_version): New function.
5823 (Version_script_info::get_symbol_version_helper): Remove.
5824 (Version_script_info::check_unmatched_names): Call unquote.
5825 * script.h (class Version_script_info): Change get_symbol_version
5826 to be non-inline and add is_global parameter; change all callers.
5827 Rewrite symbol_is_local. Update declarations. Define struct
5828 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5829 Remove globals_ and locals_ members. Add exact_, globs_,
5830 default_version_, is_global_.
5831 (Version_script_info::Glob): Remove pattern, add expression and
5832 is_global. Update constructor. Change all callers.
5833 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5835 (Versions::symbol_section_contents): If a symbol is undefined, or
5836 defined in a dynamic object, set the version index to
5838 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5840 (Symbol_table::add_from_pluginobj): Likewise.
5841 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5843 2010-01-11 Doug Kwan <dougkwan@google.com>
5845 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5846 (incremental_dump_LDADD): Add linking option for libintl.
5847 * Makefile.in: Regenerate.
5849 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5852 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5854 * testsuite/Makefile.in: Regenerated.
5856 2010-01-10 Doug Kwan <dougkwan@google.com>
5858 * options.h (DEFINE_var): Use parentheses around argument varname__
5859 in macro body to avoid any unintended subsequent substitutions.
5861 2010-01-10 Ian Lance Taylor <iant@google.com>
5863 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5864 candidates before doing symbol resolution.
5866 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5867 ODR candidates if only one is weak.
5869 2010-01-08 Ian Lance Taylor <iant@google.com>
5871 * script.cc (Version_script_info::build_expression_list_lookup):
5872 Don't warn about ambiguous version, just record the ambiguity.
5873 (Version_script_info::get_symbol_version_helper): Give error if
5874 version is ambiguous.
5876 2010-01-08 Doug Kwan <dougkwan@google.com>
5878 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5879 prev_data_size_ and prev_addralign_. Remove initializer for
5880 deleted data member has_been_changed_.
5881 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5882 to determine if the table is empty.
5883 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5885 (Stub_table::add_reloc_stub): Define method in class definition
5886 instead of just declaring it there.
5887 (Stub_table::add_cortex_a8_stub): New method definition.
5888 (Stub_table::update_data_size_and_addralign): Ditto.
5889 (Stub_table::finalize_stubs): Ditto.
5890 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5891 (Stub_table::do_addralign_): Return address alignment in the
5892 (Stub_table::do_reset_address_and_file_offset): Define method in
5893 class definition instead of declaring it there. Set current data
5894 size to be the data size of the previous pass.
5895 (Stub_table::set_final_data_size): Use current data size as the
5897 (Stub_table::relocate_stub): Change parameter type of stub from
5898 Reloc_stub pointer to Stub pointer.
5899 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5900 (Stub_table::Cortex_a8_stub_list): New typedef.
5901 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5902 Stub_table::prev_addralign_): New data member.
5903 (Arm_relobj::Arm_relobj): Initialize data member
5904 section_has_cortex_a8_workaround_.
5905 (Arm_relobj::section_has_cortex_a8_workaround,
5906 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5908 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5910 (Target_arm::relocate_stub): Change parameter type of stub from
5911 Reloc_stub pointer to Stub pointer.
5912 (Insn_template::size, Insn_template::alignment): Handle
5913 THUMB16_SPECIAL_TYPE.
5914 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5915 Stub_table::update_data_size_and_addralign,
5916 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5918 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5919 (Stub_table::do_write): Ditto.
5920 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5922 2010-01-08 Ian Lance Taylor <iant@google.com>
5925 * symtab.h (class Symbol): Remove fields is_target_special_ and
5926 has_plt_offset_. Add field is_defined_in_discarded_section_.
5927 (Symbol::is_defined_in_discarded_section): New function.
5928 (Symbol::set_is_defined_in_discarded_section): New function.
5929 (Symbol::has_plt_offset): Rewrite.
5930 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5931 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5932 Don't initialize is_target_special_ or has_plt_offset_.
5933 Initialize is_defined_in_discarded_section_.
5934 (Symbol_table::add_from_relobj): If appropriate, set
5935 is_defined_in_discarded_section.
5936 * resolve.cc (Symbol::override_base_with_special): Don't test
5937 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5938 * target-reloc.h (relocate_section): Do special handling for
5939 symbols defined in discarded sections for global symbols as well
5942 2010-01-08 Ian Lance Taylor <iant@google.com>
5944 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5945 the SHT_SYMTAB case.
5947 2010-01-08 Ian Lance Taylor <iant@google.com>
5949 * object.cc (Sized_relobj::do_layout): Don't get confused if
5950 layout_eh_frame returns NULL.
5952 2010-01-08 Ian Lance Taylor <iant@google.com>
5955 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5956 dynamic symbol table, use the normal symbol table.
5957 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5960 2010-01-08 Ian Lance Taylor <iant@google.com>
5963 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5966 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5968 * version.cc (print_version): Change to "Copyright 2010".
5970 2010-01-08 Ian Lance Taylor <iant@google.com>
5974 * i386.cc (class Target_i386): Change return type of plt_section
5976 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5977 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5978 tls_desc_rel_ field.
5979 (Output_data_plt_i386::rel_tls_desc): New function.
5980 (Target_i386::rel_tls_desc_section): New function.
5981 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5982 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5983 R_386_TLS_DESC reloc in rel_tls_desc_section.
5984 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5985 Define struct Tlsdesc_info.
5986 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5987 (Target_x86_64::do_reloc_symbol_index): New function.
5988 (Target_x86_64::add_tlsdesc_info): New function.
5989 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5990 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5992 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5994 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5995 (Target_x86_64::rela_tlsdesc_section): New function.
5996 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5998 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5999 (Target_x86_64::do_reloc_addend): New function.
6000 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6001 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6002 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6003 (Output_reloc::type): New function.
6004 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6005 (Output_reloc::is_target_specific): New function.
6006 (Output_reloc::target_arg): New function.
6007 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6008 absolute relocs and target specific relocs.
6009 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6010 add_target_specific.
6011 (class Output_data_reloc) [SHT_RELA]: Likewise.
6012 * output.cc (Output_reloc::Output_reloc): Add four new versions
6013 for absolute relocs and target specific relocs.
6014 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6015 (Output_reloc::get_symbol_index): Likewise.
6016 (Output_reloc::local_section_offset): Check that local_sym_index_
6017 is not TARGET_CODE or 0.
6018 (Output_reloc::symbol_value): Likewise.
6019 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6021 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6022 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6024 * layout.cc (add_target_dynamic_tags): Use output section for
6025 DT_PLTRELSZ and DT_JMPREL.
6027 2010-01-07 Ian Lance Taylor <iant@google.com>
6030 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6032 (class Output_data_reloc_generic): Define.
6033 (class Output_data_reloc_base): Change base class to
6034 Output_data_reloc_generic. Change add() method to call
6035 bump_relative_reloc_count for a relative reloc. Remove
6037 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6039 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6040 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6042 * layout.h (class Layout): Update declaration.
6044 2010-01-07 Ian Lance Taylor <iant@google.com>
6046 * output.h (class Output_data): Add const version of
6047 output_section and do_output_section.
6048 (class Output_section_data): Add const version of
6050 (class Output_section): Likewise.
6051 * layout.cc (Layout::add_target_dynamic_tags): New function.
6052 * layout.h (class Layout): Update declarations.
6053 * arm.cc (Target_arm::do_finalize_sections): Use
6054 add_target_dynamic_tags.
6055 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6056 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6057 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6058 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6060 2010-01-07 Ian Lance Taylor <iant@google.com>
6063 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6066 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6067 Ian Lance Taylor <iant@google.com>
6070 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6071 Xindex::read_symtab_xindex.
6073 2010-01-07 Doug Kwan <dougkwan@google.com>
6075 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6076 (Insn_template::thumb16_bcond_insn): New method declaration.
6077 (Insn_template): Fix spelling.
6078 (Stub::thumb16_special): New method declaration.
6079 (Stub::do_write): Define virtual method which was previously pure
6081 (Stub::do_thumb16_special): New method declaration.
6082 (Stub::do_fixed_endian_write): New template member.
6083 (Reloc_stub::do_write): Remove.
6084 (Reloc_stub::do_fixed_endian_write): Remove.
6085 (Cortex_a8_stub): New class definition.
6086 (Stub_factory::make_cortex_a8_stub): New method definition.
6087 (Stub_factory::Stub_factory): Add missing static storage class
6088 qualifier for elf32_arm_stub_a8_veneer_blx.
6090 2010-01-07 Ian Lance Taylor <iant@google.com>
6093 * options.h (class General_options): Add --warn-unresolved-symbols
6094 and --error-unresolved-symbols.
6095 * errors.cc (Errors::undefined_symbol): Implement
6096 --warn-unresolved-symbols.
6098 * options.h (class General_options): Add -z text and -z textoff.
6099 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6101 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6103 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6104 (Garbage_collection::cident_sections): New function.
6105 (Garbage_collection::add_cident_section): New function.
6106 (Garbage_collection::cident_sections_): New member.
6107 (gc_process_relocs): Add references to sections whose names are C
6109 * gold.h (cident_section_start_prefix): New constant.
6110 (cident_section_stop_prefix): New constant.
6111 (is_cident): New function.
6112 * layout.cc (Layout::define_section_symbols): Replace string constants
6113 with the newly defined constants.
6114 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6116 * testsuite/Makefile.am: Add gc_orphan_section_test.
6117 * testsuite/Makefile.in: Regenerate.
6118 * testsuite/gc_orphan_section_test.cc: New file.
6119 * testsuite/gc_orphan_section_test.sh: New file.
6121 2010-01-06 Ian Lance Taylor <iant@google.com>
6124 * options.h (class General_options): Add --warn-shared-textrel.
6125 * layout.cc (Layout::finish_dynamic_section): Implement
6126 --warn-shared-textrel.
6129 * options.h (class General_options): Add --warn-multiple-gp.
6131 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6133 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6134 $(THREADSLIB) and $(LIBDL).
6135 * Makefile.in: Rebuild.
6137 2010-01-06 Ian Lance Taylor <iant@google.com>
6140 * options.cc (General_options::parse_section_start): New function.
6141 (General_options::section_start): New function.
6142 (General_options::General_options): Initialize all members.
6143 * options.h: Include <map>
6144 (class General_options): Add --section-start. Add section_starts_
6146 * layout.cc (Layout::attach_allocated_section_to_segment): If
6147 --section-start was used, set the address of the segment. Remove
6148 local sort_sections.
6149 (Layout::relaxation_loop_body): If the address of the load segment
6150 has been set by --section-start, don't use it.
6151 * output.h (Output_segment::update_flags_for_output_section): New
6153 * output.cc (Output_segment::add_output_section): Call
6154 update_flags_for_output_section.
6156 2010-01-05 Ian Lance Taylor <iant@google.com>
6159 * options.h (class General_options): Add --undefined-version.
6160 * script.cc (struct Version_expression): Add was_matched_by_symbol
6162 (Version_script_info::matched_symbol): New function.
6163 (Version_script_info::get_symbol_version_helper): Call
6165 (Version_script_info::check_unmatched_names): New function.
6166 * script.h (class Version_script_info): Update declarations.
6167 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6169 * options.h (class General_options): Use DEFINE_bool_alias for
6170 allow_multiple_definition.
6171 * resolve.cc (Symbol_table::should_override): Don't test
6172 allow_multiple_definition.
6175 * options.h (class General_options): Add --cref.
6176 * main.cc (main): Print cref table if --cref. Don't close mapfile
6177 until after printing cref table.
6178 * cref.cc: Include "symtab.h".
6179 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6180 (Cref_table_compare::operator()): New function.
6181 (Cref_inputs::gather_cref): New function.
6182 (filecol): New static const.
6183 (Cref_inputs::print_cref): New function.
6184 (Cref::print_cref): New function.
6185 * cref.h: Include <cstdio>.
6186 (class Cref): Update declarations.
6187 * mapfile.h (Mapfile::file): New function.
6188 * object.h (class Object): Define Symbols. Declare virtual
6189 do_get_global_symbols.
6190 (Object::get_global_symbols): New function.
6191 * object.cc (Input_objects::add_object): Pass object to cref_ if
6193 (Input_objects::archive_start): Likewise.
6194 (Input_objects::archive_stop): Likewise.
6195 (Input_objects::print_cref): New function.
6196 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6197 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6199 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6201 * plugin.h (class Sized_pluginobj): Update declarations.
6203 2010-01-05 Ian Lance Taylor <iant@google.com>
6205 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6206 to is_default_version. Rename insdef to insdefault.
6207 (Symbol_table::add_from_relobj): Rename def to is_default_version
6208 and local to is_forced_local.
6209 (Symbol_table::add_from_pluginobj): Likewise.
6210 (Symbol_table::add_from_dynobj): Likewise.
6211 (Symbol_table::define_special_symbol): Rename insdef to
6214 2010-01-04 Ian Lance Taylor <iant@google.com>
6217 * options.h (class General_options): Add
6218 --allow-multiple-definition and -z muldefs.
6219 * resolve.cc (Symbol_table::should_override): Don't warn about a
6220 multiple symbol definition if --allow-multiple-definition or -z
6224 * options.h (class General_options): Add --add-needed and
6225 --copy-dt-needed-entries. Tweak --as-needed help entry.
6226 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6227 error if --copy-dt-needed-entries aka --add-needed is used and
6228 would cause a change in behaviour.
6231 * options.h (class General_options): Add -G as a short version of
6232 --shared. Add no-op options -assert, -g, and -i.
6234 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6236 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6237 check for .text or .gnu.linkonce.t sections.
6238 * icf.cc (Icf::find_identical_sections): Ditto.
6239 Change the detection for mangled function name within the section
6241 * icf.h (is_section_foldable_candidate): New function.
6243 2009-12-30 Ian Lance Taylor <iant@google.com>
6246 * options.h (class General_options): Permit two dashes with
6247 --retain-symbols-file.
6249 2009-12-30 Ian Lance Taylor <iant@google.com>
6252 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6253 don't put the file header and segment headers in the text
6257 * common.cc (Sort_commons::operator()): Stabilize sort when both
6259 (Symbol_table::do_allocate_commons_list): When allocating common
6260 symbols, skip a symbol which is no longer common.
6261 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6262 an object before checking its type.
6263 * testsuite/common_test_2.c: New file.
6264 * testsuite/common_test_3.c: New file.
6265 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6266 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6267 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6268 (common_test_2_pic.o, common_test_2.so): New targets.
6269 (common_test_3_pic.o, common_test_3.so): New targets.
6270 * testsuite/Makefile.in: Rebuild.
6273 * script.cc (read_input_script): If we see a new SECTIONS clause,
6274 and we have added an input section, give an error.
6275 * layout.h (class Layout): Add have_added_input_section function.
6276 Add have_added_input_section_ field.
6277 * layout.cc (Layout::Layout): Initialize
6278 have_added_input_section_.
6279 (Layout::layout): Set have_added_input_section_.
6280 (Layout::layout_eh_frame): Likewise.
6282 2009-12-30 Ian Lance Taylor <iant@google.com>
6285 * options.h (class General_options): Add --sort-common option.
6286 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6287 * common.cc (Sort_common): Add sort_order parameter to
6288 constructor. Add sort_order_ field.
6289 (Sort_commons::operator): Check sort_order_.
6290 (Symbol_table::allocate_commons): Determine the sort order.
6291 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6293 (Symbol_table::do_allocate_commons_list): Likewise.
6295 2009-12-30 Ian Lance Taylor <iant@google.com>
6298 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6299 symbols from this object, don't change the visibility of an
6301 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6303 2009-12-30 Ian Lance Taylor <iant@google.com>
6306 * script.h (class Version_script_info): Define Language enum.
6307 Update declarations. Define Glob, Exact, and Lookup types. Add
6308 new fields globals_, locals_, and is_finalized_.
6309 * script.cc: Various formatting fixes.
6310 (class Parser_closure): Change language_stack_ from a vector of
6311 std::string to one of Version_script_info::Language. Adjust all
6313 (class Lazy_demangler): Remove.
6314 (struct Version_expression): Change language from std::string to
6315 Version_script_info::Language.
6316 (Version_script_info::Version_script_info): New function.
6317 (Version_script_info::~Version_script_info): Don't call clear.
6318 (Version_script_info::finalize): New function.
6319 (Version_script_info::build_lookup_tables): New function.
6320 (Version_script_info::build_expression_list_lookup): New
6322 (Version_script_info::get_symbol_version_helper): Rewrite to use
6324 (Version_script_info::print_expression_list): Adjust to use
6325 Version_script_info::Language.
6326 (script_push_lex_into_version_mode): Check that the version script
6327 has not been finalized.
6328 (version_script_push_lang): Change language string to
6329 Version_script_info::Language.
6330 * options.cc (Command_line::version_script): New function.
6331 * options.h (class General_options): Add finalize_dynamic_list
6332 function. Change version_script from declaration to definition.
6333 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6334 * testsuite/version_script.map: Remove duplicate def of foo.
6335 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6337 * testsuite/Makefile.in: Rebuild.
6339 2009-12-30 Ian Lance Taylor <iant@google.com>
6342 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6343 if the input symbol index is 0, make the output symbol index 0.
6345 2009-12-30 Ian Lance Taylor <iant@google.com>
6348 * options.h (class General_options): Add -x/--discard-all.
6349 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6350 --discard-all. If the local symbol needs a dynamic entry, check
6351 that before handling --discard-locals.
6353 2009-12-30 Ian Lance Taylor <iant@google.com>
6356 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6358 (Output_segment::add_output_section): Don't change the flags if
6362 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6363 GNU hash table if they need a dynamic value. Otherwise, don't add
6364 them if they are defined in a dynamic object or are forced local.
6366 2009-12-29 Ian Lance Taylor <iant@google.com>
6369 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6370 .gnu.hash table for a 32-bit target.
6373 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6374 regular and a dynamic object only needs a dynamic symbol table
6375 entry if it is externally visible.
6378 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6379 constructor. Add global_offset_table_ field.
6380 (Target_i386::got_section): Set global_offset_table_.
6381 (Target_i386::do_finalize_sections): Set global_offset_table_
6383 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6384 in constructor. Add global_offset_table_ field.
6385 (Target_x86_64::got_section): Set global_offset_table_.
6386 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6389 * layout.cc (Layout::Layout): Initialize increase_relro_.
6390 (Layout::get_output_section): Add is_relro, is_last_relro, and
6391 is_first_non_relro parameters. Change all callers.
6392 (Layout::choose_output_section): Likewise.
6393 (Layout::add_output_section_data): Likewise.
6394 (Layout::make_output_section): Likewise.
6395 (Layout::set_segment_offsets): Clear increase_relro when using a
6397 * layout.h (class Layout): Add increase_relro method. Add
6398 increase_relro_ field. Update declarations.
6399 * output.cc (Output_section::Output_section): Initialize
6400 is_last_relro_ and is_first_non_relro_.
6401 (Output_segment::add_output_section): Group relro sections is
6402 do_sort is true. Handle is_last_relro and is_first_non_relro.
6403 (Output_segment::maximum_alignment): Remove relro handling.
6404 (Output_segment::set_section_addresses): Add increase_relro
6405 parameter. Change all callers. Add initial alignment to align
6406 relro sections on separate page. Remove old relro handling.
6407 (Output_segment::set_section_list_addresses): Remove in_relro
6408 parameter. Change all callers.
6409 (Output_segment::set_offset): Add increase parameter. Change all
6410 callers. Remove old relro handling.
6411 * output.h (class Output_section): Add new methods: is_last_relro,
6412 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6413 Add is_last_relro_ and is_first_non_relro_ fields.
6414 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6415 Create separate .got.plt section. Call increase_relro.
6416 * x86_64.cc (Target_x86_64::got_section): Likewise.
6417 * testsuite/relro_script_test.t: Add .got.plt.
6420 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6421 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6422 (Layout::finalize): Call set_dynamic_symbol_size.
6423 (Layout::set_dynamic_symbol_size): New function.
6424 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6425 set_dynamic_symbol_size.
6428 * output.h (class Output_section): Add is_entsize_zero_ field.
6429 * output.cc (Output_section::Output_section): Initialize
6431 (Output_section::set_entsize): If two different entsizes are
6432 requested, force it to zero.
6433 (Output_section::add_input_section): Set flags for .debug_str
6434 before updating section flags. Set entsize.
6435 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6436 and SHF_STRING if all input sections have those flags.
6438 2009-12-29 Rafael Espindola <espindola@google.com>
6440 * main.cc (main): Fix the sys time reporting.
6441 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6444 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6446 * options.cc (General_options::parse_version): Allow -v to exit
6447 without an error if there is nothing to link.
6449 2009-12-29 Ian Lance Taylor <iant@google.com>
6451 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6452 using a version of gcc before 4.1.
6453 * configure: Rebuild.
6455 2009-12-28 Chris Demetriou <cgd@google.com>
6457 * attributes.cc (Output_attributes_section_data::do_write): Use
6458 std::vector::front rather than std::vector::data.
6460 2009-12-28 Ian Lance Taylor <iant@google.com>
6462 * symtab.h (class Symbol_table): Add enum Defined.
6463 * resolve.cc (Symbol_table::should_override): Add defined
6464 parameter. Change all callers. Test whether object is NULL
6465 before calling a method on it.
6466 (Symbol_table::report_resolve_problem): Add defined parameter.
6468 (Symbol_table::should_override_with_special): Likewise.
6469 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6470 parameter. Change all callers.
6471 (Symbol_table::do_define_in_output_data): Likewise.
6472 (Symbol_table::define_in_output_segment): Likewise.
6473 (Symbol_table::do_define_in_output_segment): Likewise.
6474 (Symbol_table::define_as_constant): Likewise.
6475 (Symbol_table::do_define_as_constant): Likewise.
6476 * script.h (class Symbol_assignment): Add is_defsym parameter to
6477 constructor; change all callers.
6478 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6479 parameter. Change all callers. Add is_defsym_ field.
6480 (class Parser_closure): Add parsing_defsym parameter to
6481 constructor; change all callers. Add parsing_defsym accessor
6482 function. Add parsing_defsym_ field.
6484 2009-12-28 Ian Lance Taylor <iant@google.com>
6486 * gold.cc (queue_middle_tasks): Fix formatting.
6487 * object.cc (Relobj::is_section_name_included): Likewise.
6489 2009-12-23 Ian Lance Taylor <iant@google.com>
6491 * i386.cc (Target_i386::do_calls_non_split): Recognize
6492 -fsplit-stack prologue for a function with a static chain.
6493 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6494 -fsplit-stack prologue when using %r11.
6496 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6498 * options.cc (General_options::parse_version): Make -v continue and do
6499 the link like GNU ld does.
6501 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6503 * Makefile.am (CCFILES): Add timer.cc.
6504 (HFILES): Add timer.h.
6505 * configure.ac: Check for sysconf and times.
6506 * main.cc: include timer.h.
6507 (main): Use Timer instead of get_run_time.
6510 * workqueue.cc: include timer.h.
6511 (Workqueue::find_and_run_task):
6512 Report user, sys and wall time.
6513 * Makefile.in: Regenerate.
6514 * config.in: Regenerate.
6515 * configure: Regenerate.
6517 2009-12-16 Doug Kwan <dougkwan@google.com>
6519 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6521 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6522 relaxed input sections.
6523 * output.cc (Output_section::find_relaxed_input_section): Change
6524 return type to Output_relaxed_input_section pointer. Adjust code
6525 for new type of relaxed_input_section_map_.
6526 * output.h (Output_section::find_relaxed_input_section): Change
6527 return type to Output_relaxed_input_section pointer.
6528 (Output_section::Output_relaxed_input_section_by_input_section_map):
6530 (Output_section::relaxed_input_section_map_): Change type to
6531 Output_section::Output_relaxed_input_section_by_input_section_map.
6532 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6535 2009-12-15 Ian Lance Taylor <iant@google.com>
6537 * layout.cc (Layout::create_shstrtab): Only write out after input
6538 sections if we are compressing debug sections.
6540 2009-12-15 Ian Lance Taylor <iant@google.com>
6542 * archive.cc (Archive::add_symbols): Only look up a symbol without
6543 a version if there is, in fact, a version.
6545 2009-12-14 Ian Lance Taylor <iant@google.com>
6547 Revert -Wshadow changes, all changes from:
6548 2009-12-11 Doug Kwan <dougkwan@google.com>
6549 2009-12-11 Nick Clifton <nickc@redhat.com>
6550 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6552 2009-12-11 Doug Kwan <dougkwan@google.com>
6554 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6556 * attributes.cc (Object_attribute::size): Ditto.
6557 (Attributes_section_data::size): Ditto.
6558 (Attributes_section_data::Attributes_section_data): Ditto.
6559 (Output_attributes_section_data::do_write): Ditto.
6560 * attributes.h (Object_attribute::set_type): Ditto.
6561 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6563 2009-12-11 Nick Clifton <nickc@redhat.com>
6565 * archive.cc: Fix shadowed variable warnings.
6567 * compressed_output.cc: Likewise.
6568 * compressed_output.h: Likewise.
6569 * configure: Likewise.
6570 * dwarf_reader.cc: Likewise.
6571 * dynobj.cc: Likewise.
6572 * dynobj.h: Likewise.
6573 * ehframe.cc: Likewise.
6574 * ehframe.h: Likewise.
6575 * errors.cc: Likewise.
6576 * expression.cc: Likewise.
6577 * fileread.cc: Likewise.
6578 * fileread.h: Likewise.
6579 * freebsd.h: Likewise.
6580 * i386.cc: Likewise.
6582 * incremental.h: Likewise.
6583 * layout.cc: Likewise.
6584 * layout.h: Likewise.
6585 * mapfile.cc: Likewise.
6586 * merge.cc: Likewise.
6587 * merge.h: Likewise.
6588 * object.cc: Likewise.
6589 * object.h: Likewise.
6590 * options.h: Likewise.
6591 * output.cc: Likewise.
6592 * output.h: Likewise.
6593 * parameters.cc: Likewise.
6594 * plugin.cc: Likewise.
6595 * powerpc.cc: Likewise.
6596 * reduced_debug_output.cc: Likewise.
6597 * reduced_debug_output.h: Likewise.
6598 * reloc.cc: Likewise.
6599 * reloc.h: Likewise.
6600 * resolve.cc: Likewise.
6601 * script-sections.cc: Likewise.
6602 * script.cc: Likewise.
6603 * script.h: Likewise.
6604 * sparc.cc: Likewise.
6605 * symtab.cc: Likewise.
6606 * symtab.h: Likewise.
6607 * target-select.cc: Likewise.
6608 * target-select.h: Likewise.
6609 * token.h: Likewise.
6610 * workqueue.cc: Likewise.
6611 * workqueue.h: Likewise.
6612 * x86_64.cc: Likewise.
6614 2009-12-10 Doug Kwan <dougkwan@google.com>
6616 * arm.cc (attributes.h): New include.
6617 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6618 (Arm_relobj::~Arm_relobj): Delete object pointed by
6619 attributes_section_data_.
6620 (Arm_relobj::attributes_section_data): New method definition.
6621 (Arm_relobj::attributes_section_data_): New data member declaration.
6622 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6623 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6624 attributes_section_data_.
6625 (Arm_dynobj::attributes_section_data): New method definition.
6626 (Arm_dynobj::attributes_section_data_): New data member declaration.
6627 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6628 initialization value of may_use_blx_ to false.
6629 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6630 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6631 object attributes to compute results instead of hard-coding.
6632 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6633 Target_arm::get_secondary_compatible_arch,
6634 Target_arm::set_secondary_compatible_arch
6635 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6636 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6637 New method declarations.
6638 (Target_arm::get_aeabi_object_attribute): New method definition.
6639 (Target_arm::attributes_section_data_): New data member declaration.
6640 (read_arm_attributes_section): New template definition.
6641 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6642 (Arm_dynobj::do_read_symbols): Ditto.
6643 (Target_arm::do_finalize_sections): Merge attributes sections from
6644 input. Check for BLX use after attributes section merging.
6645 Fix __exidx_start and __exidx_end visibility. Create an
6646 .ARM.attributes section if necessary.
6647 (Target_arm::get_secondary_compatible_arch,
6648 Target_arm::set_secondary_compatible_arch,
6649 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6650 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6651 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6652 New method definitions.
6654 2009-12-09 Ian Lance Taylor <iant@google.com>
6656 * plugin.cc (Plugin::load): Don't cast from void* to a function
6659 2009-12-09 Ian Lance Taylor <iant@google.com>
6661 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6664 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6666 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6667 Replace two_file_shared_1.so with two_file_shared_2.so.
6668 * testsuite/Makefile.in: Regenerated.
6670 2009-12-08 Doug Kwan <dougkwan@google.com>
6672 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6673 (HFILES): Add attributes.h and int_encoding.h.
6674 * Makefile.in: Regenerate.
6675 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6676 function definitions to int_encoding.cc
6677 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6678 prototypes to int_encoding.h
6679 * reduced_debug_output.cc (int_encoding.h): New include.
6680 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6681 function definitions to int_encoding.cc
6682 (insert_into_vector, read_from_pointer): Move template definitions to
6684 * attributes.cc: New file.
6685 * attributes.h: New file.
6686 * int_encoding.cc: New file.
6687 * int_encoding.h: New file.
6689 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6692 * incremental-dump.cc (dump_incremental_inputs): New.
6693 (main): Use dump_incremental_inputs.
6695 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6698 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6699 checking elfcpp::STT_FUNC.
6700 (Target_i386::Relocate::relocate): Likewise.
6701 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6703 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6704 symbols from shared libraries into normal FUNC symbols.
6706 * symtab.h (Symbol): Add is_func and use it.
6708 2009-12-05 Doug Kwan <dougkwan@google.com>
6710 * arm.cc (Target_arm::arm_info): Initialize new fields
6711 attributes_section and attributes_vendor.
6712 * i386.cc (Target_i386::i386_info): Same.
6713 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6714 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6715 fields attributes_section and attributes_vendor.
6716 * sparc.cc (Target_sparc::sparc_info): Same.
6717 * target.h (Target::attributes_section, Target::attributes_vendor,
6718 Target::is_attributes_section, Target::attribute_arg_type,
6719 Target::attributes_order): New method definitions.
6720 (Target::Target_info::attributes_section,
6721 Target::Target_info::attributes_vendor): New fields.
6722 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6723 virtual method definitions.
6724 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6725 attributes_section and attributes_vendor.
6726 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6728 2009-12-05 Doug Kwan <dougkwan@google.com>
6730 * arm.cc: Update comments about interworking and stub generation.
6731 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6732 considered as non-PIC.
6733 (Arm_relocate_functions::base_abs): Fix formatting.
6734 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6735 of function to use GOT entry address instead of offset.
6736 (Target_arm::Scan::global): Issue an error if a symbol would need a
6737 PLT does not get one because it is untyped. Remove code to create
6738 dynamic symbols for relative branches.
6739 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6740 takes unsigned integer instead of boolean.
6742 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6744 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6745 (two_file_test_LDADD): Likewise.
6746 (common_test_1_LDADD): Likewise.
6747 (exception_test_LDADD) Likewise.
6748 (weak_test_LDADD): Likewise.
6749 (many_sections_test_LDADD): Likewise.
6750 (initpri1_LDADD): Likewise.
6751 (script_test_1_LDADD): Likewise.
6752 (script_test_2_LDADD): Likewise.
6753 (justsyms_LDADD): Likewise.
6754 (binary_test_LDADD): Likewise.
6755 (large_LDADD): Likewise.
6756 * testsuite/Makefile.in: Regenerated.
6758 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6760 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6761 (Symbol_table::override_with_special): Likewise.
6762 (Symbol_table::add_from_object): Likewise.
6764 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6766 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6767 Don't set the data_offset twice.
6769 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6771 * testsuite/Makefile.in: Regenerate.
6773 2009-12-03 Doug Kwan <dougkwan@google.com>
6775 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6776 (Target_arm::do_finalize_sections): Add parameter for symbol table
6777 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6778 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6779 parameter for symbol table pointer.
6780 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6781 an additional parameter for a pointer to symbol table.
6782 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6783 parameter for a symbol table pointer.
6784 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6785 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6787 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6788 parameter for a symbol table pointer.
6790 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6792 * incremental.cc (Incremental_inputs_header)
6793 (Incremental_inputs_header_write, Incremental_inputs_entry)
6794 (Incremental_inputs_entry_write): Move ...
6795 * incremental.h (Incremental_inputs_header)
6796 (Incremental_inputs_header_write, Incremental_inputs_entry)
6797 (Incremental_inputs_entry_write): here.
6799 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6801 * incremental.cc (make_sized_incremental_binary): Set the target.
6802 Error if it is incompatible.
6803 * output.h (Output_file): Add filename method.
6805 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6807 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6808 from the get_* methods.
6810 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6812 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6813 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6814 Write 0 for the data_offset of scripts.
6816 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6818 * testsuite/Makefile.am: Add the incremental_test.sh test.
6819 * testsuite/incremental_test.sh: New.
6820 * testsuite/incremental_test_1.c: New.
6821 * testsuite/incremental_test_2.c: New.
6823 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6825 * incremental-dump.cc (main): Fix typos.
6827 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6830 * incremental-dump.cc (main): Use llu to print 64 bit values.
6832 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6833 H.J. Lu <hongjiu.lu@intel.com>
6835 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6837 (incremental_dump_LDADD): Likewise.
6838 * Makefile.in: Regenerated.
6840 2009-11-25 Doug Kwan <dougkwan@google.com>
6844 2009-11-25 Doug Kwan <dougkwan@google.com>
6846 * arm.cc (Target_arm::Target_arm): Move method definition
6847 outside of class definition. Add code to handle
6848 --target1-rel, --target1-abs and --target2= options.
6849 (Target_arm::get_reloc_reloc_type): Change method to be
6850 non-static and const.
6851 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6852 New data member declaration.
6853 (Target_arm::Scan::local, Target_arm::Scan::global,
6854 Target_arm::Relocate::relocate,
6855 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6856 Adjust call to Target_arm::get_real_reloc_type.
6857 (Target_arm::get_real_reloc_type): Use command line options
6858 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6859 * options.h (--target1-rel, --target1-abs, --target2): New
6862 2009-11-25 Doug Kwan <dougkwan@google.com>
6864 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6865 class definition. Add code to handle --target1-rel, --target1-abs
6866 and --target2= options.
6867 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6869 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6871 (Target_arm::Scan::local, Target_arm::Scan::global,
6872 Target_arm::Relocate::relocate,
6873 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6874 call to Target_arm::get_real_reloc_type.
6875 (Target_arm::get_real_reloc_type): Use command line options to
6876 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6877 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6880 2009-11-25 Doug Kwan <dougkwan@google.com>
6882 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6883 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6884 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6886 (Arm_relocate_functions::thm_call): Replace body with a call to
6887 Arm_relocate_functions::thumb_branch_common.
6888 (Arm_relocate_functions::thm_jump24,
6889 Arm_relocate_functions::thm_xpc22): New method definitions.
6890 (Arm_relocate_functions::thumb_branch_common): New method definition.
6891 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6893 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6894 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6896 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6898 * Makefile.am: Build incremental-dump
6899 * Makefile.in: Regenerate.
6900 * incremental-dump.cc: New.
6901 * incremental.cc (Incremental_inputs_header_data,
6902 Incremental_inputs_entry_data): Move to incremental.h
6903 * incremental.h: (Incremental_inputs_header_data,
6904 Incremental_inputs_entry_data): Move from incremental.cc
6906 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6908 * incremental.cc (Incremental_inputs_header,
6909 Incremental_inputs_header_write, Incremental_inputs_entry,
6910 Incremental_inputs_entry_write): Add a typedef with the data type.
6912 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6914 * incremental.cc (Incremental_inputs_header,
6915 Incremental_inputs_header_write, Incremental_inputs_entry,
6916 Incremental_inputs_entry_write): Update comment about which
6917 type has the filed descriptions.
6919 2009-11-15 Doug Kwan <dougkwan@google.com>
6921 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6922 (Arm_relocate_functions::arm_branch_common): Change method defintion
6923 in class definition to a method declaration and update list of formal
6925 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6926 Arm_relocation_functions::jump24): Adjust call to
6927 Arm_relocate_functions::arm_branch_common. Update list of formal
6929 (Arm_relocate_functions::xpc25): New method definition.
6930 (Arm_relocate_functions::arm_branch_common): Move method defintion
6931 out from class definition. Use stubs for mode-switching and extending
6933 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6934 specially. Change code to enable use of stubs in ARM branches.
6936 2009-11-10 Doug Kwan <dougkwan@google.com>
6938 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6939 in method declaration.
6940 (Target_arm::relocate_stub): New method declaration.
6941 (Target_arm::default_target): Change to return a pointer instead of
6943 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6944 Target_arm::default_target.
6945 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6947 (Target_arm::relocate_section): Adjust view.
6948 (Target_arm::relocate_stub): New method definition.
6950 2009-11-10 Doug Kwan <dougkwan@google.com>
6952 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6954 * incremental.cc (open_incremental_binary): Initialized local
6955 variables to avoid warnings.
6956 * object.cc (make_elf_object): Ditto.
6957 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6960 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6963 * testsuite/plugin_test.c: Include "config.h".
6965 2009-11-09 Doug Kwan <dougkwan@google.com>
6967 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6968 (arm_symbol_value): Remove.
6969 (Arm_relocate_functions::arm_branch_common,
6970 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6971 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6972 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6973 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6974 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6975 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6976 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6977 Arm_relocate_functions::thm_mobw_abs_nc,
6978 Arm_relocate_functions::thm_mov_abs,
6979 Arm_relocate_functions::movw_prel_nc,
6980 Arm_relocate_functions::thm_movt_abs,
6981 Arm_relocate_functions::movt_prel,
6982 Arm_relocate_functions::thm_movw_prel_nc,
6983 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6984 (Target_arm::Relocate::relocate): Only decompose address into two
6985 parts if relocation type uses the thumb-bit and pass the actual
6986 bit instead of a flag indicating that the thumb-bit is used. Adjust
6987 calls to methods in Arm_relocate_functions for this change.
6989 2009-11-08 Ian Lance Taylor <iant@google.com>
6992 * reloc.cc: Instantiate
6993 Sized_relobj::initialize_input_to_output_maps and
6994 Sized_relobj:free_input_to_output_maps.
6996 2009-11-06 Ian Lance Taylor <iant@google.com>
6999 * defstd.cc (in_segment): Set only_if_ref true for "end".
7001 2009-11-06 Doug Kwan <dougkwan@google.com>
7003 * arm.cc (class Reloc_stub): Correct a comment.
7004 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7005 (Target_arm::scan_section_for_stubs): New method declaration.
7006 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7007 Change methods from private to protected.
7008 (Target_arm::do_may_relax): New method definition.
7009 (Target_arm::do_relax, Target_arm::group_sections,
7010 Target_arm::scan_reloc_for_stub,
7011 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7012 (Target_arm::arm_input_section_map_): New data member declaration.
7013 (Target_arm::scan_reloc_for_stub,
7014 Target_arm::scan_reloc_section_for_stubs,
7015 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7016 Target_arm::do_relax): New method definitions.
7018 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7020 * configure.ac: Check for (struct stat)::st_mtim
7021 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7022 * config.in: Regenerate.
7023 * configure: Regenerate.
7025 2009-11-05 Ian Lance Taylor <iant@google.com>
7028 * output.cc (Output_segment::add_output_section): Add missing
7031 2009-11-04 Ian Lance Taylor <iant@google.com>
7034 * object.h (class Object): Add is_needed and set_is_needed
7035 methods. Add is_needed_ field. Make bool fields into bitfields.
7036 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7037 defined in a dynamic object and referenced by a regular object,
7038 set is_needed for the dynamic object.
7039 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7040 if the file is marked with as_needed and it is not needed.
7042 2009-11-04 Ian Lance Taylor <iant@google.com>
7045 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7046 tags if data is discarded by linker script.
7047 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7048 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7049 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7050 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7052 2009-11-04 Ian Lance Taylor <iant@google.com>
7054 * layout.cc (Layout::get_output_section): Add is_interp and
7055 is_dynamic_linker_section parameters. Change all callers.
7056 (Layout::choose_output_section): Likewise.
7057 (Layout::make_output_section): Likewise.
7058 (Layout::add_output_section_data): Add is_dynamic_linker_section
7059 parameter. Change all callers.
7060 * layout.h (class Layout): Update declarations.
7061 * output.h (class Output_section): Add is_interp, set_is_interp,
7062 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7063 Add is_interp_, is_dynamic_linker_section_ fields. Change
7064 generate_code_fills_at_write_ to a bitfield.
7065 * output.cc (Output_section::Output_sections): Initialize new
7067 (Output_segment::add_output_section): Add do_sort parameter.
7070 2009-11-03 Ian Lance Taylor <iant@google.com>
7073 * options.h (class General_options): Add --warn-common.
7074 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7075 merging two common symbols.
7076 (Symbol_table::should_override): Handle --warn-common when merging
7077 a common symbol with a defined symbol. Use report_resolve_problem
7078 for multiple definitions.
7079 (Symbol_table::report_resolve_problem): New function.
7080 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7082 2009-11-03 Doug Kwan <dougkwan@google.com>
7084 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7086 (Target_arm::stub_factory): New method definition.
7087 (Target_arm::new_arm_input_section,
7088 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7089 Target_arm::reloc_uses_thumb_bit): New method declarations.
7090 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7091 New type definitions.
7092 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7093 member declarations.
7094 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7095 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7096 New method definitions.
7098 2009-11-03 Ian Lance Taylor <iant@google.com>
7100 * options.h (class General_options): Add --warn_constructors.
7102 2009-11-03 Ian Lance Taylor <iant@google.com>
7105 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7106 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7108 2009-11-03 Ian Lance Taylor <iant@google.com>
7111 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7112 --msgid-bugs-address.
7113 (install-pdf): New target.
7114 (install-data_yes): Look up one directory to find mkinstalldirs.
7116 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7118 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7121 2009-10-30 Doug Kwan <dougkwan@google.com>
7123 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7125 2009-10-30 Doug Kwan <dougkwan@google.com>
7127 * arm.cc (Stub_addend_reader): New struct template definition
7128 and partial specializations.
7129 (Stub_addend_reader::operator()): New method definition for a
7130 partially specialized template.
7132 2009-10-30 Doug Kwan <dougkwan@google.com>
7134 * arm.cc (Arm_relobj::processor_specific_flags): New method
7136 (Arm_relobj::do_read_symbols): New method declaration.
7137 (Arm_relobj::processor_specific_flags_): New data member declaration.
7138 (Arm_dynobj): New class definition.
7139 (Target_arm::do_finalize_sections): Add input_objects parameter.
7140 (Target_arm::do_adjust_elf_header): New method declaration.
7141 (Target_arm::are_eabi_versions_compatible,
7142 (Target_arm::merge_processor_specific_flags): New method declaration.
7143 (Target_arm::do_make_elf_object): New overloaded method definitions
7145 (Arm_relobj::do_read_symbols): New method definition.
7146 (Arm_dynobj::do_read_symbols): Ditto.
7147 (Target_arm::do_finalize_sections): Add input_objects parameters.
7148 Merge processor-specific flags from all input objects.
7149 (Target_arm::are_eabi_versions_compatible,
7150 Target_arm::merge_processor_specific_flags,
7151 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7152 New method definitions.
7153 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7154 Input_objects pointer type parameter.
7155 * layout.cc (Layout::finalize): Pass input objects to target's.
7156 finalize_sections function.
7157 * output.cc (Output_file_header::do_sized_write): Set ELF file
7158 header's processor-specific flags.
7159 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7160 Input_objects pointer type parameter.
7161 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7162 * target.h (Input_objects): New forward class declaration.
7163 (Target::processor_specific_flags,
7164 Target::are_processor_specific_flags_sect): New method definitions.
7165 (Target::finalize_sections): Add input_objects parameter.
7166 (Target::Target): Initialize processor_specific_flags_ and
7167 are_processor_specific_flags_set_.
7168 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7170 (Target::set_processor_specific_flags): New method definition.
7171 (Target::processor_specific_flags_,
7172 Target::are_processor_specific_flags_set_): New data member
7174 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7175 Input_objects pointer type parameter.
7177 2009-10-30 Doug Kwan <dougkwan@google.com>
7179 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7181 2009-10-28 Ian Lance Taylor <iant@google.com>
7183 * object.h (class Relobj): Drop options parameter from
7184 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7185 do_scan_relocs, do_relocate. Change all callers.
7186 (class Sized_relobj): Drop options parameters from
7187 do_gc_process_relocs, do_scan_relocs, do_relocate,
7188 do_relocate_sections, relocate_sections, emit_relocs_scan,
7189 emit_relocs_scan_reltype. Change all callers.
7190 (struct Relocate_info): Remove options field and all references to
7192 * reloc.h (class Read_relocs): Remove options constructor
7193 parameter and options_ field. Change all callers.
7194 (class Gc_process_relocs, class Scan_relocs): Likewise.
7195 (class Relocate_task): Likewise.
7196 * target-reloc.h (scan_relocs): Remove options parameter. Change
7198 (scan_relocatable_relocs): Likewise.
7199 * target.h (class Sized_target): Remove options parameter from
7200 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7202 * gc.h (gc_process_relocs): Remove options parameter. Change all
7204 * arm.cc: Update functions to remove options parameters.
7205 * i386.cc: Likewise.
7206 * powerpc.cc: Likewise.
7207 * sparc.cc: Likewise.
7208 * x86_64.cc: Likewise.
7209 * testsuite/testfile.cc: Likewise.
7211 2009-10-28 Doug Kwan <dougkwan@google.com>
7213 * arm.cc (Arm_relobj): New class definition.
7214 (Arm_relobj::scan_sections_for_stubs,
7215 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7216 New method definitions.
7218 2009-10-28 Cary Coutant <ccoutant@google.com>
7220 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7221 (Plugin::cleanup_done_): New member.
7222 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7223 (Plugin_manager::cleanup_done_): Remove.
7224 (Plugin_manager::add_input_file): Edit error message.
7225 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7226 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7228 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7230 * fileread.cc: (File_read::View::~View): Use the new
7231 data_ownership_ filed.
7232 (File_read::~File_read): Dispose the new whole_file_view_.
7233 (File_read::open): Mmap the whole file if needed.
7234 (File_read::open): Use whole_file_view_ instead of contents_.
7235 (File_read::find_view): Use whole_file_view_ if applicable.
7236 (File_read::do_read): Use whole_file_view_ instead of contents_.
7237 (File_read::make_view): Use whole_file_view_ instead of contents_,
7238 update File_read::View::View call.
7239 (File_read::find_or_make_view): Update File_read::View::View
7241 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7243 (File_read::View::Data_ownership): New enum.
7244 (File_read::View::View): Replace bool mapped_ with Data_ownership
7246 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7247 (File_read::View::data_ownership_): New field.
7248 (File_read::contents_): Remove (replaced by whole_file_view_).
7249 (File_read::whole_file_view_): New field.
7250 * options.h (class General_options): Add --keep-files-mapped.
7252 2009-10-27 Cary Coutant <ccoutant@google.com>
7254 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7255 * testsuite/Makefile.am (plugin_test_5): New test case.
7256 * testsuite/Makefile.in: Regenerate.
7258 2009-10-25 Doug Kwan <dougkwan@google.com>
7260 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7261 from private to protected to allow access by child class.
7262 (Sized_relobj::do_relocate_sections): New method declaration.
7263 (Sized_relobj::relocate_sections): Virtualize.
7264 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7265 Sized_relobj::relocate_sections. Instantiate template explicitly
7266 for different target sizes and endianity.
7268 2009-10-24 Doug Kwan <dougkwan@google.com>
7270 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7271 (Arm_input_section::as_arm_input_section): New method.
7272 (Arm_output_section): New class definition.
7273 (Arm_output_section::create_stub_group,
7274 Arm_output_section::group_sections): New method definitions.
7276 2009-10-22 Doug Kwan <dougkwan@google.com>
7278 * arm.cc (Arm_input_section): New class definition.
7279 (Arm_input_section::init, Arm_input_section:do_write,
7280 Arm_input_section::set_final_data_size,
7281 Arm_input_section::do_reset_address_and_file_offset): New method
7284 2009-10-21 Doug Kwan <dougkwan@google.com>
7286 * arm.cc (Stub_table, Arm_input_section): New forward class
7288 (Stub_table): New class defintion.
7289 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7290 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7291 New method definition.
7293 2009-10-21 Doug Kwan <dougkwan@google.com>
7295 * arm.cc: Update copyright comments.
7296 (Target_arm): New forward class template declaration.
7297 (Arm_address): New type.
7298 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7299 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7300 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7302 (Insn_template): Same.
7303 (DEF_STUBS): New macro.
7304 (Stub_type): New enum type.
7305 (Stub_template): New class definition.
7308 (Stub_factory): Same.
7309 (Target_arm::Target_arm): Initialize may_use_blx_ and
7310 should_force_pic_veneer_.
7311 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7312 Target_arm::should_force_pic_veneer,
7313 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7314 Target_arm::using_thumb_only, Target_arm:;default_target): New
7316 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7317 New data member declarations.
7318 (Insn_template::size, Insn_template::alignment): New method defintions.
7319 (Stub_template::Stub_template): New method definition.
7320 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7321 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7322 (Stub_factory::Stub_factory): New method definition.
7323 * gold.h (string_hash): New template.
7324 * output.h (Input_section_specifier::hash_value): Use
7326 (Input_section_specifier::string_hash): Remove.
7327 * stringpool.cc (Stringpool_template::string_hash): Use
7330 2009-10-20 Doug Kwan <dougkwan@google.com>
7332 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7333 symbols of relaxed input sections.
7334 * output.h (Output_section::find_relaxed_input_section): Make
7337 2009-10-16 Doug Kwan <dougkwan@google.com>
7339 * dynobj.cc (Versions::Versions): Initialize version_script_.
7340 Only insert base version symbol definition for a shared object
7341 if version script defines any version versions.
7342 (Versions::define_base_version): New method definition.
7343 (Versions::add_def): Check that base version is not needed.
7344 (Versions::add_need): Define base version lazily.
7345 * dynobj.h (Versions::define_base_version): New method declaration.
7346 (Versions::needs_base_version_): New data member declaration.
7347 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7348 (check_DATA): Add no_version_test.stdout.
7349 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7351 * testsuite/Makefile.in: Regenerate.
7352 * testsuite/no_version_test.c: New file.
7353 * testsuite/no_version_test.sh: Ditto.
7355 2009-10-16 Doug Kwan <dougkwan@google.com>
7357 * expression.cc (class Segment_start_expression): New class definition.
7358 (Segment_start_expression::value): New method definition.
7359 (script_exp_function_segment_start): Return a new
7360 Segment_start_expression.
7361 * gold/script-c.h (script_saw_segment_start_expression): New function
7363 * script-sections.cc (Script_sections::Script_sections): Initialize
7364 SAW_SEGMENT_START_EXPRESSION_ to false.
7365 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7366 and -Tbbs options to specify section addresses if given in
7367 command line and no SEGMENT_START expression is seen in a script.
7368 * script-sections.h (Script_sections::saw_segment_start_expression,
7369 Script_sections::set_saw_segment_start_expression): New method
7371 (Script_sections::saw_segment_start_expression_): New data member
7373 * script.cc (script_saw_segment_start_expression): New function.
7374 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7375 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7376 script_test_7.sh and script_test_8.sh.
7377 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7378 script_test_8.stdout.
7379 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7380 (script_test_6, script_test_6.stdout, script_test_7,
7381 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7382 * Makefile.in: Regenerate.
7383 * testsuite/script_test_6.sh: New file.
7384 * testsuite/script_test_6.t: Same.
7385 * testsuite/script_test_7.sh: Same.
7386 * testsuite/script_test_7.t: Same.
7387 * testsuite/script_test_8.sh: Same.
7389 2009-10-16 Doug Kwan <dougkwan@google.com>
7391 * output.cc (Output_segment::set_section_list_address): Cast
7392 expressions to unsigned long long type to avoid format warnings.
7394 2009-10-15 Ian Lance Taylor <iant@google.com>
7396 * script.cc (Script_options::add_symbol_assignment): Always add a
7397 dot assignment to script_sections_.
7398 * script-sections.cc (Script_sections::add_dot_assignment):
7399 Initialize if necessary.
7401 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7402 program headers with no load segment if there is a linker script.
7404 * layout.cc (Layout::set_segment_offsets): Align the file offset
7405 to the segment aligment for -N or -n with no load segment.
7406 * output.cc (Output_segment::add_output_section): Don't crash if
7407 the first section is a TLS section.
7408 (Output_segment::set_section_list_addresses): Print an error
7409 message if the address moves backward in a linker script.
7410 * script-sections.cc
7411 (Output_section_element_input::set_section_addresses): Don't
7412 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7413 (Orphan_output_section::set_section_addresses): Likewise.
7415 2009-10-15 Doug Kwan <dougkwan@google.com>
7417 * layout.cc (Layout::finish_dynamic_section): Generate tags
7418 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7419 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7420 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7422 2009-10-14 Ian Lance Taylor <iant@google.com>
7424 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7426 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7427 data_shdr fields of relinfo.
7428 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7429 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7430 R_386_TLS_LDO_32, adjust based on section flags.
7431 (Target_i386::Relocate::fix_up_ldo): Remove.
7433 2009-10-13 Ian Lance Taylor <iant@google.com>
7435 Add support for -pie.
7436 * options.h (class General_options): Add -pie and
7438 (General_options::output_is_position_independent): Test -pie.
7439 (General_options::output_is_executable): Return true if not shared
7440 and not relocatable.
7441 (General_options::output_is_pie): Remove.
7442 * options.cc (General_options::finalize): Reject incompatible uses
7444 * gold.cc (queue_middle_tasks): A -pie link is not static.
7445 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7446 * symtab.cc (Symbol::final_value_is_known): Return false if
7447 output_is_position_independent.
7448 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7449 output_is_position_independent.
7450 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7451 output_is_position_independent.
7452 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7453 output_is_position_independent.
7454 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7456 (basic_pie_test.o, basic_pie_test): New targets.
7457 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7458 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7459 (two_file_pie_test): New target.
7460 * testsuite/Makefile.in: Rebuild.
7461 * README: Remove note saying that -pie is not supported.
7463 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7465 * options.h (class General_options): Add -init and -fini.
7466 * layout.cc (Layout::finish_dynamic_section): Emit
7467 given init and fini functions.
7469 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7471 * gc.h (gc_process_relocs): Check if icf is enabled using new
7473 * gold.cc (queue_initial_tasks): Likewise.
7474 (queue_middle_tasks): Likewise.
7475 * object.cc (do_layout): Likewise.
7476 * symtab.cc (is_section_folded): Likewise.
7477 * main.cc (main): Likewise.
7478 * reloc.cc (Read_relocs::run): Likewise.
7479 (Sized_relobj::do_scan_relocs): Likewise.
7480 * icf.cc (is_function_ctor_or_dtor): New function.
7481 (Icf::find_identical_sections): Check if function is ctor or dtor when
7483 * options.h (General_options::icf): Change option to be an enum.
7484 (Icf_status): New enum.
7485 (icf_enabled): New method.
7486 (icf_safe_folding): New method.
7487 (set_icf_status): New method.
7488 (icf_status_): New variable.
7489 * (options.cc) (General_options::finalize): Set icf_status_.
7490 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7491 icf_test and icf_keep_unique_test to use the --icf enum flag.
7492 * testsuite/icf_safe_test.sh: New file.
7493 * testsuite/icf_safe_test.cc: New file.
7495 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7497 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7498 includes to gc.h and icf.h.
7499 * arm.cc: Include gc.h.
7500 * gold.cc: Likewise.
7501 * i386.cc: Likewise.
7502 * powerpc.cc: Likewise.
7503 * sparc.cc: Likewise.
7504 * x86_64.cc: Likewise.
7505 * gc.h: Include icf.h.
7507 2009-10-11 Ian Lance Taylor <iant@google.com>
7509 * plugin.cc: Include "gold.h" before other header files.
7511 2009-10-10 Chris Demetriou <cgd@google.com>
7513 * options.h (Input_file_argument::Input_file_type): New enum.
7514 (Input_file_argument::is_lib_): Replace with...
7515 (Input_file_argument::type_): New member.
7516 (Input_file_argument::Input_file_argument): Take Input_file_type
7517 'type' rather than boolean 'is_lib' as second argument.
7518 (Input_file_argument::is_lib): Use type_.
7519 (Input_file_argument::is_searched_file): New function.
7520 (Input_file_argument::may_need_search): Handle is_searched_file.
7521 * options.cc (General_options::parse_library): Support -l:filename.
7522 (General_options::parse_just_symbols): Update for Input_file_argument
7524 (Command_line::process): Likewise.
7525 * archive.cc (Archive::get_file_and_offset): Likewise.
7526 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7527 * script.cc (read_script_file, script_add_file): Likewise.
7528 * fileread.cc (Input_file::Input_file): Likewise.
7529 (Input_file::will_search_for): Handle is_searched_file.
7530 (Input_file::open): Likewise.
7531 * readsyms.cc (Read_symbols::get_name): Likewise.
7532 * testsuite/Makefile.am (searched_file_test): New test.
7533 * testsuite/Makefile.in: Regenerate.
7534 * testsuite/searched_file_test.cc: New file.
7535 * testsuite/searched_file_test_lib.cc: New file.
7537 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7538 Ian Lance Taylor <iant@google.com>
7540 * descriptor.cc: Include <cstdio> and "binary-io.h".
7541 (Descriptors::open): Open the files in binary mode always.
7542 * script.cc (Lex::get_token): Treat \r as whitespace.
7544 2009-10-09 Ian Lance Taylor <iant@google.com>
7546 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7548 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7549 Ian Lance Taylor <iant@google.com>
7551 * configure.ac: Check for readv function also.
7552 * fileread.cc (readv): Define if not HAVE_READV.
7553 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7555 * config.in: Regenerate.
7556 * configure: Regenerate.
7558 2009-10-09 Doug Kwan <dougkwan@google.com>
7560 * layout.cc (Layout::make_output_section): Call target hook to make
7561 ordinary output section.
7562 (Layout::finalize): Adjust parameter list of call the
7563 Target::may_relax().
7564 * layout.h (class Layout::section_list): New method.
7565 * merge.h (Output_merge_base::entsize): Change visibility to public.
7566 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7568 (Output_merge_string::do_is_string): New method.
7569 * object.cc (Sized_relobj::do_setup): renamed from
7570 Sized_relobj::set_up.
7571 * object.h (Sized_relobj::adjust_shndx,
7572 Sized_relobj::initializ_input_to_output_maps,
7573 Sized_relobj::free_input_to_output_maps): Change visibilities to
7575 (Sized_relobj::setup): Virtualize.
7576 (Sized_relobj::do_setup): New method declaration.
7577 (Sized_relobj::invalidate_section_offset,
7578 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7579 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7580 * options.cc (parse_int): New function.
7581 * options.h (parse_int): New declaration.
7582 (DEFINE_int): New macro.
7583 (stub_group_size): New option.
7584 * output.cc (Output_section::Output_section): Initialize memebers
7585 merge_section_map_, merge_section_by_properties_map_,
7586 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7587 (Output_section::add_input_section): Handled deferred code-fill
7588 generation and remove an old comment.
7589 (Output_section::add_relaxed_input_section): New method definition.
7590 (Output_section::add_merge_input_section): Use merge section by
7591 properties map to speed to search. Update merge section maps
7593 (Output_section::build_relaxation_map): New method definition.
7594 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7596 (Output_section::relax_input_section): Renamed to
7597 Output_section::convert_input_sections_to_relaxed_sections and change
7598 interface to take a vector of pointers to relaxed sections.
7599 (Output_section::find_merge_section,
7600 Output_section::find_relaxed_input_section): New method definitions.
7601 (Output_section::is_input_address_mapped,
7602 Output_section::output_offset, Output_section::output_address):
7603 Use output section data maps to speed up searching.
7604 (Output_section::find_starting_output_address): Add comments.
7605 (Output_section::do_write,
7606 Output_section::write_to_postprocessing_buffer): Do code-fill
7607 generation as appropriate.
7608 (Output_section::get_input_sections): Invalidate relaxed input section
7610 (Output_section::restore_states): Adjust type of checkpoint .
7611 Invalidate relaxed input section map.
7612 * output.h (Output_merge_base): New class declaration.
7613 (Input_section_specifier): New class defintion.
7614 (class Output_relaxed_input_section) Change base class to
7615 Output_section_data_build.
7616 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7617 base class initializer.
7618 (Output_section::add_relaxed_input_section): New method declaration.
7619 (Output_section::Input_section): Change visibility to protected.
7620 (Output_section::Input_section::relobj,
7621 Output_section::Input_section::shndx): Handle relaxed input sections.
7622 Output_section::input_sections) Change visibility to protected. Also
7623 define overload to return a non-const pointer.
7624 (Output_section::Merge_section_properties): New class defintion.
7625 (Output_section::Merge_section_by_properties_map,
7626 Output_section::Output_section_data_by_input_section_map,
7627 Output_section::Relaxation_map): New types.
7628 (Output_section::relax_input_section): Rename method to
7629 Output_section::convert_input_sections_to_relaxed_sections and change
7630 interface to take a vector of relaxed section pointers.
7631 (Output_section::find_merge_section,
7632 Output_section::find_relaxed_input_section,
7633 Output_section::build_relaxation_map,
7634 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7635 New method declarations.
7636 (Output_section::merge_section_map_
7637 Output_section::merge_section_by_properties_map_,
7638 Output_section::relaxed_input_section_map_,
7639 Output_section::is_relaxed_input_section_map_valid_,
7640 Output_section::generate_code_fills_at_write_): New data members.
7641 * script-sections.cc
7642 (Output_section_element_input::set_section_addresses): Call
7643 current_data_size and addralign methods of relaxed input sections.
7644 (Orphan_output_section::set_section_addresses): Call current_data_size
7645 and addralign methods of relaxed input sections.
7646 * symtab.cc (Symbol_table::compute_final_value): Extract template
7647 from the body of Symbol_table::sized_finalize_symbol.
7648 (Symbol_table::sized_finalized_symbol): Call
7649 Symbol_table::compute_final_value.
7650 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7651 (Symbol_table::compute_final_value): New templated method declaration.
7652 * target.cc (Target::do_make_output_section): New method defintion.
7653 * target.h (Target::make_output_section): New method declaration.
7654 (Target::relax): Add more parameters for input objects, symbol table
7655 and layout. Adjust call to do_relax.
7656 (Target::do_make_output_section): New method declaration.
7657 (Target::do_relax): Add parameters for input objects, symbol table
7660 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7662 * pread.c: Include stdio.h.
7664 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7666 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7669 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7671 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7672 Change read_shndx type to unsigned int.
7673 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7675 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7676 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7677 Change read_shndx type to unsigned int.
7678 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7680 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7681 * layout.cc (Layout::create_symtab_sections): Cast the result of
7682 local_symcount * symsize to off_t in the gold_assert.
7684 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7686 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7687 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7689 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7690 (Arm_relocate_functions::thm_abs5): New function.
7691 (Arm_relocate_functions::abs12): New function.
7692 (Arm_relocate_functions::abs16): New function.
7693 (Arm_relocate_functions::base_abs): New function.
7694 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7695 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7696 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7698 (Scan::global): Likewise.
7699 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7700 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7701 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7702 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7705 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7707 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7708 (Arm_relocate_functions::movt_prel): New function.
7709 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7710 (Arm_relocate_functions::thm_movt_prel): New function.
7711 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7712 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7713 (Scan::global, Relocate::relocate): Likewise.
7714 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7716 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7718 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7719 Incremental_checker.
7720 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7722 (class Incremental_inputs_header): New class.
7723 (Incremental_inputs_header_writer): Edit comment.
7724 (Incremental_inputs_entry): New class.
7725 (Incremental_inputs_entry_writer): Edit comment.
7726 (Sized_incremental_binary::do_find_incremental_inputs_section):
7727 Add *strtab_shndx parameter, fill it.
7728 (Sized_incremental_binary::do_check_inputs): New method.
7729 (Incremental_checker::can_incrementally_link_output_file): Use
7730 Sized_incremental_binary::check_inputs.
7731 (Incremental_inputs::report_command_line): Save command line in
7734 (Incremental_binary::find_incremental_inputs_section): New
7736 (Incremental_binary::do_find_incremental_inputs_section): Add
7737 strtab_shndx parameter.
7738 (Incremental_binary::do_check_inputs): New pure virtual method.
7739 (Sized_incremental_binary::do_check_inputs): Declare.
7740 (Incremental_checker::Incremental_checker): Add incremental_inputs
7741 parameter, use it to initialize incremental_inputs_.
7742 (Incremental_checker::incremental_inputs_): New field.
7743 (Incremental_checker::command_line): New method.
7744 (Incremental_checker::inputs): New method.
7745 (Incremental_checker::command_line_): New field.
7747 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7749 * incremental.cc: Include <cstdarg> and "target-select.h".
7750 (vexplain_no_incremental): New function.
7751 (explain_no_incremental): New function.
7752 (Incremental_binary::error): New method.
7753 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7755 (make_sized_incremental_binary): New function.
7756 (open_incremental_binary): New function.
7757 (can_incrementally_link_file): Add checks if output is ELF and has
7759 * incremental.h: Include "elfcpp_file.h" and "output.h".
7760 (Incremental_binary): New class.
7761 (Sized_incremental_binary): New class.
7762 (open_incremental_binary): Declare.
7763 * object.cc (is_elf_object): Use
7764 elfcpp::Elf_recognizer::is_elf_file.
7765 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7766 * output.h (Output_file::filesize): New method.
7768 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7770 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7772 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7773 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7775 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7777 (Arm_relocate_functions::movw_abs_nc): New function.
7778 (Arm_relocate_functions::movt_abs): New function.
7779 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7780 (Arm_relocate_functions::thm_movt_abs): New function.
7781 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7782 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7783 (Scan::global): Likewise.
7784 (Relocate::relocate): Likewise.
7785 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7787 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7789 * arm.cc (Arm_relocate_functions::got_prel) New function.
7790 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7791 (Relocate::relocate): Likewise.
7792 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7794 2009-10-06 Ian Lance Taylor <iant@google.com>
7796 * options.h (class General_options): Define
7797 split_stack_adjust_size parameter.
7798 * object.h (class Object): Add uses_split_stack_ and
7799 has_no_split_stack_ fields. Add uses_split_stack and
7800 has_no_split_stack accessor functions. Declare
7801 handle_split_stack_section.
7802 (class Reloc_symbol_changes): Define.
7803 (class Sized_relobj): Define Function_offsets. Declare
7804 split_stack_adjust, split_stack_adjust_reltype, and
7806 * object.cc (Object::handle_split_stack_section): New function.
7807 (Sized_relobj::do_layout): Call handle_split_stack_section.
7808 * dynobj.cc (Sized_dynobj::do_layout): Call
7809 handle_split_stack_section.
7810 * reloc.cc (Sized_relobj::relocate_sections): Call
7811 split_stack_adjust for executable sections in split_stack
7812 objects. Pass reloc_map to relocate_section.
7813 (Sized_relobj::split_stack_adjust): New function.
7814 (Sized_relobj::split_stack_adjust_reltype): New function.
7815 (Sized_relobj::find_functions): New function.
7816 * target-reloc.h: Include "object.h".
7817 (relocate_section): Add reloc_symbol_changes parameter. Change
7819 * target.h (class Target): Add calls_non_split method. Declare
7820 do_calls_non_split virtual method. Declare match_view and
7822 * target.cc: Include "elfcpp.h".
7823 (Target::do_calls_non_split): New function.
7824 (Target::match_view): New function.
7825 (Target::set_view_to_nop): New function.
7826 * gold.cc (queue_middle_tasks): Give an error if mixing
7827 split-stack and non-split-stack objects with -r.
7828 * i386.cc (Target_i386::relocate_section): Add
7829 reloc_symbol_changes parameter.
7830 (Target_i386::do_calls_non_split): New function.
7831 * x86_64.cc (Target_x86_64::relocate_section): Add
7832 reloc_symbol_changes parameter.
7833 (Target_x86_64::do_calls_non_split): New function.
7834 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7836 * powerpc.cc (Target_powerpc::relocate_section): Add
7837 reloc_symbol_changes parameter.
7838 * sparc.cc (Target_sparc::relocate_section): Add
7839 reloc_symbol_changes parameter.
7840 * configure.ac: Call AM_CONDITIONAL for the default target.
7841 * configure: Rebuild.
7842 * testsuite/Makefile.am (TEST_AS): New variable.
7843 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7844 (check_DATA): Add split_i386 and split_x86_64 files.
7845 (SPLIT_DEFSYMS): Define.
7846 (split_i386_[1234n].o): New targets.
7847 (split_i386_[124]): New targets.
7848 (split_i386_[1234r].stdout): New targets.
7849 (split_x86_64_[1234n].o): New targets.
7850 (split_x86_64_[124]): New targets.
7851 (split_x86_64_[1234r].stdout): New targets.
7852 (MOSTLYCLEANFILES): Add new executables.
7853 * testsuite/split_i386.sh: New file.
7854 * testsuite/split_x86_64.sh: New file.
7855 * testsuite/split_i386_1.s: New file.
7856 * testsuite/split_i386_2.s: New file.
7857 * testsuite/split_i386_3.s: New file.
7858 * testsuite/split_i386_4.s: New file.
7859 * testsuite/split_i386_n.s: New file.
7860 * testsuite/split_x86_64_1.s: New file.
7861 * testsuite/split_x86_64_2.s: New file.
7862 * testsuite/split_x86_64_3.s: New file.
7863 * testsuite/split_x86_64_4.s: New file.
7864 * testsuite/split_x86_64_n.s: New file.
7865 * testsuite/testfile.cc (Target_test): Update relocation_section
7867 * testsuite/Makefile.in: Rebuild.
7869 2009-10-06 Ian Lance Taylor <iant@google.com>
7871 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7872 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7873 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7874 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7875 the address on ldo_addrs_.
7876 (Target_i386::Relocate::fix_up_ldo): New function.
7878 2009-10-06 Rafael Espindola <espindola@google.com>
7880 * plugin.cc (add_input_library): New.
7881 (Plugin::load): Add add_input_library to tv.
7882 (Plugin_manager::add_input_file): Add the is_lib argument.
7883 (add_input_file): Update call to Plugin_manager::add_input_file.
7884 (add_input_library): New.
7885 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7887 2009-09-30 Doug Kwan <dougkwan@google.com>
7889 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7890 symbol and call Symbol::may_need_copy_reloc to determine if
7891 a copy reloc is needed.
7892 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7893 nocopyreloc is given in command line.
7894 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7895 given in command line.
7896 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7897 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7898 of the removed Target_i386::may_need_copy_reloc.
7899 * options.h (copyreloc): New option with default value false.
7900 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7901 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7902 instead of the removed Target_powerpc::may_need_copy_reloc.
7903 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7904 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7905 instead of the removed Target_sparc::may_need_copy_reloc.
7906 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7907 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7908 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7909 instead of the removed Target_x86_64::may_need_copy_reloc.
7911 2009-09-30 Ian Lance Taylor <iant@google.com>
7913 * object.h (class Object): Remove target_ field, and target,
7914 sized_target, and set_target methods.
7915 (Object::sized_target): Remove.
7916 (class Sized_relobj): Update declarations. Remove sized_target.
7917 * object.cc (Sized_relobj::setup): Remove target parameter.
7919 (Input_objects::add_object): Don't do anything with the target.
7920 (make_elf_sized_object): Add punconfigured parameter. Change all
7921 callers. Set or test parameter target.
7922 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7924 * parameters.cc (Parameters::set_target): Change parameter type to
7926 (Parameters::default_target): Remove.
7927 (set_parameters_target): Change parameter type to be non-const.
7928 (parameters_force_valid_target): New function.
7929 (parameters_clear_target): New function.
7930 * parameters.h (class Parameters): Update declarations. Remove
7931 default_target method. Add sized_target and clear_target
7932 methods. Change target_ to be non-const.
7933 (set_parameters_target): Update declaration.
7934 (parameters_force_valid_target): Declare.
7935 (parameters_clear_target): Declare.
7936 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7937 as NULL if we aren't searching.
7938 (Add_symbols::run): Don't check for compatible target.
7939 * fileread.cc (Input_file::open_binary): Call
7940 parameters_force_valid_target.
7941 * gold.cc (queue_middle_tasks): Likewise.
7942 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7943 set_target on object.
7944 * dynobj.h (class Sized_dynobj): Update declarations.
7945 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7946 make_elf_object returns NULL.
7947 (Archive::include_member): Don't check whether object target is
7949 * output.cc (Output_section::add_input_section): Get target from
7951 (Output_section::relax_input_section): Likewise.
7952 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7954 (Sized_relobj::do_scan_relocs): Likewise.
7955 (Sized_relobj::relocate_sections): Likewise.
7956 * resolve.cc (Symbol_table::resolve): Likewise.
7957 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7958 parameter. Change all callers.
7959 (Symbol_table::add_from_object): Get target from parameters.
7960 (Symbol_table::add_from_relobj): Don't check object target.
7961 (Symbol_table::add_from_dynobj): Likewise.
7962 (Symbol_table::define_special_symbol): Get target from
7964 * symtab.h (class Symbol_table): Update declaration.
7965 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7966 parameter. Change all callers. Clear parameter target.
7967 (Binary_test): Test target here.
7968 * testsuite/object_unittest.cc (gold_testsuite): Remove
7969 target_test_pointer parameter. Change all callers.
7970 (Object_test): Test target here.
7972 2009-09-26 Ian Lance Taylor <iant@google.com>
7974 * testsuite/initpri1.c: Don't try to use constructor priorities if
7975 compiling with gcc before 4.3.
7977 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7979 * testsuite/retain_symbols_file_test.sh (check_present): Change
7980 output file name to retain_symbols_file_test.stdout.
7981 (check_absent): Likewise.
7983 2009-09-18 Craig Silverstein <csilvers@google.com>
7985 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7986 * options.cc: Include <cerrno> and <fstream>.
7987 (General_options::finalize): Parse -retain-symbols-file tag.
7988 * options.h: New flag.
7989 (General_options): New method should_retain_symbol, new
7990 variable symbols_to_retain.
7991 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7992 should_retain_symbol map.
7993 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7994 * testsuite/Makefile.in: Regenerate.
7995 * testsuite/retain_symbols_file_test.sh: New file.
7997 2009-09-18 Nick Clifton <nickc@redhat.com>
7999 * po/es.po: Updated Spanish translation.
8001 2009-09-17 Doug Kwan <dougkwan@google.com>
8003 * debug.h (DEBUG_RELAXATION): New constant.
8004 (DEBUG_ALL): Add DEBUG_RELAXATION.
8005 (debug_string_to_enum): Add relaxation debug option.
8007 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8008 Layout::Relaxation_debug_check::read_sections,
8009 Layout::Relaxation_debug_check::read_sections): New method definitions.
8010 (Layout::Layout): Initialize data members
8011 record_output_section_data_from_scrips_,
8012 script_output_section_data_list_ and relaxation_debug_check_.
8013 (Layout::save_segments, Layout::restore_segments,
8014 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8015 Layout::relaxation_loop_body): New method definitions.
8016 (Layout::finalize): Support relaxation. Move section layout code to
8017 Layout::relaxation_loop_body.
8018 (Layout::set_asection_address_from_script): Move code for orphan
8019 section placement out.
8020 (Layout::place_orphan_sections_in_script): New method definition.
8021 * layout.h (Output_segment_headers, Output_file_header):
8022 New forward class declarations.
8023 (Layout::~Layout): Define.
8024 (Layout::new_output_section_data_from_script): New method definition.
8025 (Layout::place_orphan_sections_in_script): New method declaration.
8026 (Layout::Segment_states): New type declaration.
8027 (Layout::save_segments, Layout::restore_segments,
8028 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8029 Layout::relaxation_loop_body): New method declarations.
8030 (Layout::Output_section_data_list): New type declaration.
8031 (Layout::Relaxation_debug_check): New class definition.
8032 (Layout::record_output_section_data_from_script_,
8033 Layout::script_output_section_data_list_, Layout::segment_states_,
8034 Layout::relaxation_debug_check_): New data members.
8035 * output.cc: (Output_section_headers::do_size): New method definition.
8036 (Output_section_headers::Output_section_headers): Move size
8037 computation to Output_section_headers::do_size.
8038 (Output_segment_headers::do_size): New method definition.
8039 (Output_file_header::Output_file_header): Move size computation to
8040 Output_file_header::do_size and call it.
8041 (Output_file_header::do_size): New method definition.
8042 (Output_data_group::Output_data_group): Adjust call to
8043 Output_section_data.
8044 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8045 (Output_symtab_xindex::do_write): Add array bound check.
8046 (Output_section::Input_section::print_to_mapfile): Handle
8047 RELAXED_INPUT_SECTION_CODE.
8048 (Output_section::Output_section): Initialize data member checkpoint_.
8049 (Output_section::~Output_section): Delete checkpoint object pointed
8051 (Output_section::add_input_section): Always add an Input_section if
8053 (Output_section::add_merge_input_section): Add assert.
8054 (Output_section::relax_input_section): New method definition.
8055 (Output_section::set_final_data_size): Set load address to zero for
8056 an unallocated section.
8057 (Output_section::do_address_and_file_offset_have_reset_values):
8058 New method definition.
8059 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8060 Handle relaxed input section.
8061 (Output_section::sort_attached_input_sections): Checkpoint input
8062 section list lazily.
8063 (Output_section::get_input_sections): Change type of input_sections to
8064 list of Simple_input_section pointers. Checkpoint input section list
8065 lazily. Also handle relaxed input sections.
8066 (Output_section::add_input_section_for_script): Take a reference to
8067 a Simple_input_section object instead of Relobj pointer and section
8068 index as parameter. Handle relaxed input sections.
8069 (Output_section::save_states, Output_section::restore_states): New
8071 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8072 (Output_data::is_data_size_fixed): New method definition.
8073 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8075 (Output_data::address_and_file_offset_have_reset_values): New method
8077 (Output_data::do_address_and_file_offset_have_reset_values): New method
8079 (Output_data::set_data_size): Check that data size is not fixed.
8080 (Output_data::fix_data_size): New method definition.
8081 (Output_data::is_data_size_fixed_): New data member.
8082 (Output_section_headers::set_final_data_size): New method definition.
8083 (Output_section_headers::do_size): New method declaration.
8084 (Output_segment_headers::set_final_data_size): New method definition.
8085 (Output_segment_headers::do_size): New method declaration.
8086 (Output_file_header::set_final_data_size)::New method definition.
8087 (Output_file_header::do_size)::New method declaration.
8088 (Output_section_data::Output_section_data): Add new parameter
8089 is_data_size_fixed and use it to fix data size.
8090 (Output_data_const::Output_data_const): Adjust call to base class
8091 constructor and fix data size.
8092 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8093 base class constructor and fix data size.
8094 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8095 base class constructor and fix data size.
8096 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8097 class constructor and fix data size.
8098 (Output_data_group::set_final_data_size): New method definition.
8099 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8100 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8101 class constructor and fix data size.
8102 (Output_relaxed_input_section): New class definition.
8103 (Output_section::Simple_input_section): New class definition.
8104 (Output_section::get_input_sections): Adjust parameter list.
8105 (Output_section::add_input_section_for_script): Same.
8106 (Output_section::save_states, Output_section::restore_states,
8107 Output_section::do_address_and_file_offset_have_reset_values,
8108 (Output_section::Input_section::Input_section): Handle
8109 RELAXED_INPUT_SECTION_CODE. Add new overload for
8110 Output_relaxed_input_section.
8111 (Output_section::Input_section::is_input_section,
8112 Output_section::Input_section::set_output_section): Handle relaxed
8114 (Output_section::Input_section::is_relaxed_input_section,
8115 Output_section::Input_section::output_section_data,
8116 Output_section::Input_section::relaxed_input_section): New method
8118 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8120 (Output_section::Input_section::u1_): Update comments.
8121 (Output_section::Input_section::u2_): Add new union member poris.
8122 (Output_section::Checkpoint_output_section): New classs definition.
8123 (Output_section::relax_input_section): New method declaration.
8124 (Output_section::checkpoint_): New data member.
8125 (Output_segment): Update comments.
8126 (Output_segment::Output_segment): Un-privatize copy constructor.
8127 (Output_segment::operator=): Un-privatize.
8128 * script-sections.cc (Output_section_element::Input_section_list):
8129 Change element type to Output_section::Simple_input_section.
8130 (Output_section_element_dot_assignment::set_section_addresses):
8131 Register output section data for relaxation clean up.
8132 (Output_data_exression::Output_data_expression): Adjust call to base
8133 constructor to fix data size.
8134 (Output_section_element_data::set_section_addresses): Register
8135 Output_data_expression object for relaxation clean up.
8136 (struct Input_section_info): Replace Relobj pointer and section index
8137 pair with Output_section::Simple_input_section and Convert struct to a
8139 (Input_section_sorter::operator()): Adjust access to
8140 Input_section_info data member to use accessors.
8141 (Output_section_element_input::set_section_addresses): Use layout
8142 parameter. Adjust code to use Output_section::Simple_input_section
8143 and Input_secction_info classes. Register filler for relaxation
8145 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8146 and section index pair with Output_section::Simple_input_section
8147 class. Adjust code accordingly.
8148 (Phdrs_element::release_segment): New method definition.
8149 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8151 (Script_sections::release_segments): New method definition.
8152 * gold/script-sections.h (Script_sections::release_segments): New
8154 * gold/target.h (Target::may_relax, Target::relax,
8155 Target::do_may_relax, Target::do_relax): New method definitions.
8157 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8159 * arm.cc (has_signed_unsigned_overflow): New function.
8160 (Arm_relocate_functions::abs8): New function.
8161 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8162 (Target_arm::Scan::global): Likewise.
8163 (Target_arm::relocate::relocate): Likewise.
8164 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8167 2009-09-16 Cary Coutant <ccoutant@google.com>
8169 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8170 * testsuite/Makefile.in: Regenerate.
8172 2009-09-11 Nick Clifton <nickc@redhat.com>
8174 * po/gold.pot: Updated by the Translation project.
8176 2009-09-08 Cary Coutant <ccoutant@google.com>
8178 * output.cc (Output_file::open): Add execute permission to empty file.
8179 * testsuite/Makefile.am (permission_test): New test.
8180 * testsuite/Makefile.in: Regenerate.
8182 2009-09-02 Ian Lance Taylor <iant@google.com>
8184 * output.cc (Output_file::resize): Call map_no_anonymous rather
8187 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8189 * gold.cc: Include "incremental.h".
8190 (queue_initial_tasks): Call Incremental_checker methods.
8191 * incremental.cc: Include "output.h".
8192 (Incremental_checker::can_incrementally_link_output_file): New
8194 * incremental.h (Incremental_checker): New class.
8196 * output.cc (Output_file::open_for_modification): New method.
8197 (Output_file::map_anonymous): Changed return type to bool. Record
8199 (Output_file::map_no_anonymous): New method, broken out of map.
8200 (Output_file::map): Use map_no_anonymous and map_anonymous.
8201 * output.h (class Output_file): Update declarations.
8203 2009-08-24 Cary Coutant <ccoutant@google.com>
8205 * options.h (Command_line::Pre_options): New class.
8206 (Command_line::pre_options): New member.
8207 * options.cc (gold::options::ready_to_register): New variable.
8208 (One_option::register_option): Do nothing if not registering options.
8209 Assert if same short option registered twice.
8210 (General_options::General_options): Turn off option registration when
8212 (Command_line::Pre_options::Pre_options): New constructor.
8214 2009-08-24 Cary Coutant <ccoutant@google.com>
8216 * options.h (General_options::no_keep_memory): Remove incorrect
8219 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8221 * Makefile.am (am__skiplex, am__skipyacc): New.
8222 * Makefile.in: Regenerate.
8224 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8226 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8227 (INCLUDES): ... this.
8228 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8229 (AM_CPPFLAGS): Renamed from ...
8230 (INCLUDE): ... this.
8231 * Makefile.in, testsuite/Makefile.in: Regenerate.
8233 * Makefile.in: Regenerate.
8234 * aclocal.m4: Likewise.
8235 * config.in: Likewise.
8236 * configure: Likewise.
8237 * testsuite/Makefile.in: Likewise.
8239 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8240 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8241 * Makefile.in: Regenerate.
8242 * testsuite/Makefile.in: Regenerate.
8244 2009-08-19 Cary Coutant <ccoutant@google.com>
8246 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8247 symbols in shared libraries overridden by hidden or internal symbols
8248 in the main program.
8250 2009-08-19 Chris Demetriou <cgd@google.com>
8252 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8253 checking source file names in error messages.
8255 2009-08-18 Doug Kwan <dougkwan@google.com>
8257 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8258 an elcpp::Ehdr as parameter. Adjust call to set_target.
8259 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8260 an elfcpp::Ehdr as parameter.
8261 * object.cc (Object::set_target): Remove the version that looks up
8262 a target and sets it.
8263 (Sized_relobj::setup): Take a Target object instead of
8264 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8265 (make_elf_sized_object): Find target and ask target to
8267 * object.h: (Object::set_target): Remove the version that looks up
8268 a target and sets it.
8269 (Sized_relobj::setup): Take a Target object instead of
8270 an elfcpp:Ehdr as parameter.
8271 * target.cc: Include dynobj.h.
8272 (Target::do_make_elf_object_implementation): New.
8273 (Target::do_make_elf_object): New.
8274 * target.h (Target::make_elf_object): New template declaration.
8275 (Target::do_make_elf_object): New method declarations.
8276 (Target::do_make_elf_object_implementation): New template declaration.
8278 2009-08-14 Ian Lance Taylor <iant@google.com>
8280 * gold.h (FUNCTION_NAME): Define.
8281 (gold_unreachable): Use FUNCTION_NAME.
8283 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8285 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8286 symbol in the --keep-unique list is not found.
8288 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8290 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8291 been maked as --keep-unique.
8292 (Icf::unfold_section): New function.
8293 * icf.h (Icf::unfold_section): New function.
8294 * options.h (General_options::keep_unique): New option.
8295 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8296 * testsuite/Makefile.in: Regenerate.
8297 * testsuite/icf_keep_unique_test.sh: New file.
8298 * testsuite/icf_keep_unique_test.cc: New file.
8300 2009-08-12 Cary Coutant <ccoutant@google.com>
8303 * resolve.cc (Symbol_table::resolve): Check for references from
8304 dynamic objects to hidden and internal symbols.
8305 * testsuite/Makefile.am (hidden_test.sh): New test.
8306 * testsuite/Makefile.in: Regenerate.
8307 * testsuite/hidden_test.sh: New script.
8308 * testsuite/hidden_test_1.c: New test source.
8309 * testsuite/hidden_test_main.c: New test source.
8311 2009-08-11 Doug Kwan <dougkwan@google.com>
8313 * arm.cc: Update comments.
8314 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8315 segment to locate the .ARM.exidx section if present.
8317 2009-08-09 Doug Kwan <dougkwan@google.com>
8319 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8322 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8323 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8326 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8328 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8329 valid tls_segment only for non-debug-section relocations.
8330 * testsuite/Makefile.am: Add gc_tls_test.
8331 * testsuite/Makefile.in: Regenerate.
8332 * testsuite/gc_tls_test.cc: New file.
8333 * testsuite/gc_tls_test.sh: New file.
8335 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8339 * Makefile.am (CCFILES): Add icf.cc.
8341 * Makefile.in: Regenerate.
8342 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8343 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8344 section, symbol and addend information for the relocs.
8345 * gold.cc (queue_middle_tasks): Call identical code folding.
8346 * gold.h: Add defines for multimap.
8347 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8348 to the call of finalize_local_symbols.
8349 * main.cc (main): Create object of class Icf.
8350 * object.cc (Sized_relobj::do_layout): Allow this function to be
8351 called twice during icf.
8352 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8353 to sections marked as identical by icf.
8354 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8356 (Sized_relobj::do_section_entsize): New function.
8357 * object.h (Object::section_entsize): New function.
8358 (Object::do_section_entsize): New pure virtual function.
8359 (Relobj::finalize_local_symbols): Add new parameter.
8360 (Relobj::do_section_entsize): New function.
8361 * options.h (General_options::icf): New option.
8362 (General_options::icf_iterations): New option.
8363 (General_options::print_icf_sections): New option.
8364 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8365 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8366 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8368 * symtab.cc (Symbol_table::is_section_folded): New function.
8369 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8370 to sections marked as identical by icf.
8371 * symtab.h (Symbol_table::set_icf): New function.
8372 (Symbol_table::icf): New function.
8373 (Symbol_table::is_section_folded): New function.
8374 (Symbol_table::icf_): New data member.
8375 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8376 * testsuite/Makefile.am: Add commands to build icf_test.
8377 * testsuite/Makefile.in: Regenerate.
8378 * testsuite/icf_test.sh: New file.
8379 * testsuite/icf_test.cc: New file.
8381 2009-07-24 Chris Demetriou <cgd@google.com>
8383 * layout.cc (is_compressible_debug_section): Fix incorrect
8384 comment about compressed section names.
8386 2009-07-20 Ian Lance Taylor <ian@airs.com>
8389 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8391 2009-07-16 Ian Lance Taylor <iant@google.com>
8394 * layout.h: #include <map>.
8395 (class Kept_section): Change from struct to class. Add accessors
8396 and setters. Add section size to Comdat_group mapping. Change
8397 Comdat_group to std::map. Add is_comdat_ field. Add
8398 linkonce_size field in union.
8399 (class Layout): Update declaration of find_or_add_kept_section.
8400 Don't declare find_kept_object.
8401 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8402 parameter. Add object, shndx, is_comdat, and is_group_name
8403 parameters. Change all callers. Adjust for new Kept_section.
8404 (Layout::find_kept_object): Remove.
8405 * object.cc (Sized_relobj::include_section_group): Update use of
8406 Kept_section. Rename secnum to shndx. Only record
8407 Kept_comdat_section if sections are the same size.
8408 (Sized_relobj::include_linkonce_section): Update use of
8409 Kept_section. Only record Kept_comdat_section if sections are the
8410 same size. Set size of linkonce section.
8411 (Sized_relobj::map_to_kept_section): Update call to
8412 get_kept_comdat_section.
8413 * object.h (class Sized_relobj): Rename fields in
8414 Kept_comdat_section to drop trailing underscores; change object
8415 field to Relobj*. Change Kept_comdat_section_table to store
8416 struct rather than pointer.
8417 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8418 Add kept_object and kept_shndx parameters. Change all callers.
8419 (Sized_relobj::get_kept_comdat_section): Change return type to
8420 bool. Add kept_object and kept_shndx parameters. Change all
8422 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8423 Layout::find_or_add_kept_section.
8425 2009-07-09 Ian Lance Taylor <iant@google.com>
8427 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8428 Reserve space in the hash table.
8430 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8432 * fileread.cc (File_read::get_mtime): New method.
8433 * fileread.h (Timespec): New structure.
8434 (File_read::get_mtime): New method.
8435 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8436 Renamed from timestamp_nsec.
8437 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8439 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8441 (Incremental_inputs::report_archive): Save mtime; style fix.
8442 (Incremental_inputs::report_obejct): Save mtime; style fix.
8443 (Incremental_inputs::report_script): Save mtime; style fix.
8444 (Incremental_inputs::finalize_inputs): Style fix.
8445 (Incremental_inputs::finalize): Style fix.
8446 (Incremental_inputs::create_input_section_data): Store inputs
8448 * incremental.h (Incremental_inputs::report_script): Add mtime
8450 (Incremental_inputs::Input_info::Input_info): Intialize only one
8452 (Incremental_inputs::Input_info::archive): Move to nameless
8454 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8455 (Incremental_inputs::Input_info::script): Move to nameless union.
8456 (Incremental_inputs::mtime): New field.
8457 * script.cc (read_input_script): Pass file mtime to
8459 * script.h (Script_info::inputs): Style fix.
8461 2009-07-01 Ian Lance Taylor <ian@airs.com>
8463 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8466 2009-06-24 Ian Lance Taylor <iant@google.com>
8469 * layout.cc (Layout::choose_output_section): If we find an
8470 existing section, update the flags.
8471 (Layout::create_notes): New function, broken out of
8473 (Layout::finalize): Don't create note sections.
8474 (Layout::create_note): Don't crash if linker script discards
8476 (Layout::create_gold_note): Likewise.
8477 (Layout::create_build_id): Likewise. Don't set
8478 after_input_sections on the section.
8479 (Layout::create_executable_stack_info): Remove target parameter.
8481 * layout.h (class Layout): Declare create_notes. Update
8482 declaration of create_executable_stack_info.
8483 * gold.cc (queue_middle_tasks): Call create_notes.
8484 * output.cc (Output_section::update_flags_for_input_section): Move
8485 here from output.h. If SHF_ALLOC flag is newly set, mark address
8487 * output.h (Output_data::mark_address_invalid): New function.
8488 (class Output_section): Only declare, not define,
8489 update_flags_for_input_section. Remove set_flags.
8491 2009-06-24 Ian Lance Taylor <iant@google.com>
8493 * script-sections.cc (Output_section_definition::
8494 set_section_addresses): Rename shadowing local load_address to
8497 2009-06-24 Ian Lance Taylor <iant@google.com>
8500 * reloc.cc (relocate_sections): Skip empty relocation sections.
8502 2009-06-23 Ian Lance Taylor <iant@google.com>
8505 * layout.cc (Layout::create_note): Use choose_output_section
8506 rather than make_output_section.
8508 2009-06-23 Ian Lance Taylor <iant@google.com>
8511 * options.cc (General_options::parse_V): Set printed_version_.
8512 (General_options::General_options): Initialize printed_version_.
8513 * options.h (class General_options): Add printed_version_ field.
8514 * gold.cc (queue_initial_tasks): If there are no input files,
8515 don't give a fatal error if we printed the version information.
8516 (queue_middle_tasks): If using -r with a shared object, give a
8517 fatal error rather than an ordinary error.
8519 2009-06-23 Ian Lance Taylor <iant@google.com>
8522 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8523 (Layout::make_output_section): Set have_stabstr_section_ if we see
8524 a .stab*str section.
8525 (Layout::finalize): Call link_stabs_sections.
8526 (Layout::link_stabs_sections): New file.
8527 * layout.h (class Layout): Add have_stabstr_section_ field.
8528 Declare link_stabs_sections.
8530 2009-06-23 Doug Kwan <dougkwan@google.com>
8532 * Makefile.am (libgold_a_LIBADD): New.
8533 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8534 * Makefile.in: Regenerate.
8535 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8536 * configure: Regenerate.
8537 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8538 * fileread.cc: Include sys/state.h
8539 * gold.h: Declare memmem and strndup if found missing.
8540 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8542 2009-06-23 Ian Lance Taylor <iant@google.com>
8544 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8545 * configure: Rebuild.
8547 2009-06-23 Ian Lance Taylor <iant@google.com>
8550 * object.cc (Object::section_contents): Don't try to get a view if
8551 the section has length zero.
8552 (Object::handle_gnu_warning_section): If the section is empty, use
8553 the name of the section as the warning.
8555 2009-06-23 Ian Lance Taylor <iant@google.com>
8558 * stringpool.h (class Stringpool_template): Add optimize_ field.
8559 (Stringpool_template::set_optimize): New function.
8560 * stringpool.cc (Stringpool_template::Stringpool_template):
8561 Initialize optimize_ field.
8562 (Stringpool_template::set_string_offsets): Test local optimize
8563 fild rather than parameter.
8564 * layout.cc (Layout::Layout): Call set_optimize on the section
8567 2009-06-22 Ian Lance Taylor <iant@google.com>
8570 * yyscript.y: Parse TARGET.
8571 * script.cc (script_set_target): New function.
8572 * script-c.h (script_set_target): Declare.
8573 * options.cc (General_options::string_to_object_format): Rename
8574 from string_to_object_format in anonymous namespace. Change
8576 * options.h (class General_options): Declare
8577 string_to_object_format.
8579 2009-06-22 Ian Lance Taylor <iant@google.com>
8581 * script-sections.cc (Script_sections::create_segments): Don't put
8582 program headers in a PT_LOAD segment if -n or -N.
8584 2009-06-22 Ian Lance Taylor <iant@google.com>
8587 * options.h (class General_options): Add -z lazy and -z now. Sort
8588 -z options into alphabetical order.
8589 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8591 2009-06-21 Ian Lance Taylor <iant@google.com>
8593 * layout.cc (Layout::make_output_section): Call
8594 Target::new_output_section.
8595 (Layout::attach_allocated_section_to_segment): Put large section
8596 sections in a separate load segment with the large segment flag
8598 (Layout::segment_precedes): Sort large data segments after other
8600 (align_file_offset): New static function.
8601 (Layout::set_segment_offsets): Use align_file_offset.
8602 * output.h (class Output_section): Add is_small_section_ and
8603 is_large_section_ fields.
8604 (Output_section::is_small_section): New function.
8605 (Output_section::set_is_small_section): New function.
8606 (Output_section::is_large_section): New function.
8607 (Output_section::set_is_large_section): New function.
8608 (Output_section::is_large_data_section): New function.
8609 (class Output_segment): Add is_large_data_segment_ field.
8610 (Output_segment::is_large_data_segment): New function.
8611 (Output_segment::set_is_large_data_segment): New function.
8612 * output.cc (Output_section::Output_section): Initialize new
8614 (Output_segment::Output_segment): Likewise.
8615 (Output_segment::add_output_section): Add assertion that large
8616 data sections always go in large data segments. Force small data
8617 sections to the end of the list of data sections. Force small BSS
8618 sections to the start of the list of BSS sections. For large BSS
8619 sections to the end of the list of BSS sections.
8620 * symtab.h (class Symbol): Declare is_common_shndx.
8621 (Symbol::is_defined): Check Symbol::is_common_shndx.
8622 (Symbol::is_common): Likewise.
8623 (class Symbol_table): Define enum Commons_section_type. Update
8624 declarations. Add small_commons_ and large_commons_ fields.
8625 * symtab.cc (Symbol::is_common_shndx): New function.
8626 (Symbol_table::Symbol_table): Initialize new fields.
8627 (Symbol_table::add_from_object): Put small and large common
8628 symbols in the right list.
8629 (Symbol_table::sized_finalized_symbol): Check
8630 Symbol::is_common_shndx.
8631 (Symbol_table::sized_write_globals): Likewise.
8632 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8633 common symbol lists. Don't call do_allocate_commons_list if the
8635 (Symbol_table::do_allocate_commons_list): Remove is_tls
8636 parameter. Add comons_section_type parameter. Change all
8637 callers. Handle small and large common symbols.
8638 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8639 Symbol::is_common_shndx.
8640 * resolve.cc (symbol_to_bits): Likewise.
8641 * target.h (Target::small_common_shndx): New function.
8642 (Target::small_common_section_flags): New function.
8643 (Target::large_common_shndx): New function.
8644 (Target::large_common_section_flags): New function.
8645 (Target::new_output_section): New function.
8646 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8647 small_common_section_flags, and large_common_section_flags
8649 (Target::do_new_output_section): New virtual function.
8650 * arm.cc (Target_arm::arm_info): Initialize new fields.
8651 * i386.cc (Target_i386::i386_info): Likewise.
8652 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8654 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8655 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8656 (Target_x86_64::do_new_output_section): New function.
8657 * configure.ac: Define conditional MCMODEL_MEDIUM.
8658 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8659 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8660 (large_LDFLAGS): Define.
8661 * testsuite/large.c: New file.
8662 * testsuite/testfile.cc (Target_test::test_target_info):
8663 Initialize new fields.
8664 * configure, testsuite/Makefile.in: Rebuild.
8666 2009-06-05 Doug Kwan <dougkwan@google.com>
8668 * Makefile.am (CCFILES): Add target.cc.
8669 * Makefile.in: Regenerate.
8670 * i386.cc (class Target_i386): Define new virtual method to
8671 override do_is_local_label_name in parent.
8672 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8673 local symbols if --discard-locals or -X is given.
8674 * options.h (class General_options): Declare new options
8675 '--discard-locals' and '-X' for discarding locals.
8676 * target.h (class Target): Define new methods is_local_label_name.
8677 Declare new virtual method do_is_local_label_name.
8678 * target.cc: New file.
8679 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8680 (check_SCRIPTS): Add discard_locals_test.sh.
8681 (check_DATA): Add discard_local_tests.syms.
8682 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8683 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8684 * testsuite/Makefile.in: Regenerate.
8685 * testsuite/discard_locals_test.c: New file.
8686 * testsuite/discard_locals_test.sh: Same.
8688 2009-06-05 Doug Kwan <dougkwan@google.com>
8690 * object.cc (Sized_relobj::Sized_relobj): Initialize
8691 discarded_eh_frame_shndx_ to -1U.
8692 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8694 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8695 a discarded .eh_frame section.
8696 (Sized_relobj::do_finalize_local_symbols): Ditto.
8697 * object.h (class Sized_relobj): Declare new member
8698 discarded_eh_frame_shndx_.
8699 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8700 (local_labels_test.o, local_labels_test): New rules.
8701 * testsuite/Makefile.in: Regenerate.
8703 2009-06-04 Doug Kwan <dougkwan@google.com>
8705 * layout.cc (Layout::section_name_mapping): Add mapping for
8706 special ARM sections.
8708 2009-06-03 Doug Kwan <dougkwan@google.com>
8710 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8711 (utils::has_overflow): Same.
8713 2009-06-03 Ian Lance Taylor <iant@google.com>
8715 * layout.cc (Layout::section_name_mapping): New array, replacing
8716 Layout::linkonce_mapping.
8717 (Layout::section_name_mapping_count): New variable, replacing
8718 Layout::linkonce_mapping_count.
8719 (Layout::linkonce_output_name): Remove.
8720 (Layout::output_section_name): Rewrite.
8721 * layout.h (class Layout): Rename Linkonce_mapping to
8722 Section_name_mapping, linkonce_mapping to section_name_mapping,
8723 linkonce_mapping_count to section_name_mapping_count. Don't
8724 declare linkonce_output_name.
8726 2009-06-03 Doug Kwan <dougkwan@google.com>
8728 * gold/arm.cc (namespace utils): New.
8729 (Target_arm::reloc_is_non_pic): Define new method.
8730 (class Arm_relocate_functions): New.
8731 (Target_arm::Relocate::relocate): Handle relocation types used by
8734 2009-06-03 Ian Lance Taylor <iant@google.com>
8736 * arm.cc (Target_arm::scan::global): Use || instead of |.
8738 2009-06-02 Doug Kwan <dougkwan@google.com>
8740 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8741 issued_non_pic_error_.
8742 (class Target_arm::Scan): Declare new method check_non_pic.
8743 Define new method symbol_needs_plt_entry.
8744 Declare new data member issued_non_pic_error_.
8745 (class Target_arm::Relocate): Declare new method
8746 should_apply_static_reloc.
8747 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8748 (Target_arm::Scan::check_non_pic): Define new method.
8749 (Target_arm::Scan::local): Handle a small subset of reloc types used
8751 (Target_arm::Scan::local): Same.
8752 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8754 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8756 * incremental.cc (Incremental_inputs::report_command_line): Filter
8757 out --incremental-* options.
8759 2009-05-29 Doug Kwan <dougkwan@google.com>
8761 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8763 (class Target_arm): Update comment.
8764 (Target_arm::Target_arm): Initialize new data members GOT_,
8765 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8766 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8767 and Target_arm::rel_dyn_section.
8768 Declare new_enum Target_arm::Got_type.
8769 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8771 Update commments for member do_dynsym_value.
8772 (Target_arm::got_size, Target_arm::plt_section,
8773 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8774 new methods inside class defintion.
8775 (Target_arm::got_section): Define new method.
8776 (Target_arm::rel_dyn_section): Same.
8777 (Output_data_plt_arm): New template class.
8778 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8779 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8780 (Output_data_plt_arm::add_entry): Same.
8781 (Output_data_plt_arm::first_plt_entry): Define new
8782 static data member for PLT instruction template.
8783 (Output_data_plt_arm::plt_entry): Same.
8784 (Output_data_plt_arm::do_write): Define new method.
8785 (Target_arm::make_plt_entry): Same.
8786 (Target_arm::do_finalize_sections): Same.
8787 (Target_arm::do_dynsym_value): Same.
8789 2009-05-28 Doug Kwan <dougkwan@google.com>
8791 * Makefile.am (TARGETSOURCES): Add arm.cc.
8792 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8793 * Makefile.in: Regenerate.
8795 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8797 2009-05-26 Doug Kwan <dougkwan@google.com>
8799 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8800 (General_options::check_excluded_libs): Strip off directories in
8801 archive name before matching like GNU ld does.
8802 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8803 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8804 (exclude_libs_test_LDFLAGS): Add linker option
8805 -Wl,--exclude-libs,libexclude_libs_test_3
8806 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8807 an explicit archive without using -l.
8808 (alt/libexclude_libs_test_3.a): New make rule.
8809 * testsuite/Makefile.in: Regenerate.
8810 * testsuite/exclude_libs_test.c : Declare lib3_default().
8812 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8813 * exclude_libs_test_3.c: New file.
8815 2009-05-26 Nick Clifton <nickc@redhat.com>
8817 * po/id.po: New Indonesian translation.
8818 * po/gold.pot: Updated template file.
8820 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8822 * testsuite/Makefile.am: Add -ffunction-sections to compile
8823 gc_comdat_test files. Add -Wl,--gc-sections to build
8825 * testsuite/Makefile.in: Regenerate.
8826 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8828 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8830 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8831 kept comdat section was garbage collected.
8832 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8833 * testsuite/Makefile.in: Regenerate.
8834 * testsuite/gc_comdat_test.sh: New file.
8835 * testsuite/gc_comdat_test_1.cc: New file.
8836 * testsuite/gc_comdat_test_2.cc: New file.
8838 2009-05-19 Doug Kwan <dougkwan@google.com>
8840 * archive.cc (Archive::Archive): Move constructor from archive.h
8841 to here. Initialize no_export_.
8842 (Archive::get_elf_object_for_member): Set no_export flag of object.
8843 * archive.h (Archive::Archive): Move constructor body to
8845 (Archive::no_export): New method.
8846 (Archive::no_export_): New field.
8847 * object.h (Object::Object): Initialize no_export_ to false.
8848 (Object::no_export, Object::set_no_export): New methods.
8849 (Object::no_export_): New field.
8850 * options.cc (General_options::parse_exclude_libs): New method.
8851 (General_options::check_excluded_libs) Same.
8852 * options.h (exclude_libs): New option.
8853 (General_options::check_excluded_libs): New method declaration.
8854 (General_options::excluded_libs_): New field.
8855 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8856 default or protected visibility if an object has no-export flag set.
8857 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8858 (check_SCRIPTS): Add exclude_libs_test.sh.
8859 (check_DATA): Add exclude_libs_test.syms.
8860 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8861 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8862 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8863 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8864 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8865 libexclude_libs_test_2.a): New rules.
8866 * testsuite/Makefile.in: Regenerate.
8867 * testsuite/exclude_libs_test.c: New file.
8868 * testsuite/exclude_libs_test.sh: Ditto.
8869 * testsuite/exclude_libs_test_1.c: Ditto.
8870 * testsuite/exclude_libs_test_2.c: Ditto.
8872 2009-05-15 Ian Lance Taylor <iant@google.com>
8874 * configure.ac: Check for declarations for cases where libiberty.h
8875 checks HAVE_DECL_xxx.
8876 * configure, config.in: Rebuild.
8878 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8880 * gold.h (Incremental_argument_list): Remove (invalid) forward
8882 * incremental.cc (Incremental_inputs::report_achive): New method.
8883 (Incremental_inputs::report_object): New method.
8884 (Incremental_inputs::report_script): New method.
8885 (Incremental_inputs::finalize_inputs): New method.
8886 (Incremental_inputs::finalize): Call finalize_inputs().
8887 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8888 Create inputs entries.
8889 * incremental.h (Incremental_input_type): New enum.
8890 (Incremental_inputs::Incremental_input): Initialize new fields.
8891 (Incremental_inputs::report_inputs): New method.
8892 (Incremental_inputs::report_achive): New method.
8893 (Incremental_inputs::report_object): New method.
8894 (Incremental_inputs::report_script): New method.
8895 (Incremental_inputs::finalize_inputs): New method.
8896 (Incremental_inputs::Input_info): New struct.
8897 (Incremental_inputs::Input_info_map): New typedef.
8898 (Incremental_inputs::lock_): New field.
8899 (Incremental_inputs::Inputs_): New field.
8900 (Incremental_inputs::Inputs_map): New field.
8901 * main.cc (main): Call Incremental_input::report_inputs.
8902 * options.h (Input_argument_list): Typedef moved from
8904 (Input_file_group::Files): Remove, use ::Input_argument_list.
8905 (Input_file_group::Input_argument_list): Remove, use
8906 ::Input_argument_list.
8907 * plugin.cc (Plugin_manager::add_input_file): Add error in
8909 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8911 * script.cc (read_input_script): Call
8912 Incremental_input::report_script.
8913 * script.h (Script_info): New class.
8915 2009-04-27 Ian Lance Taylor <iant@google.com>
8917 * x86_64.cc (do_adjust_output_section): Set entsize to
8920 2009-04-23 Elliott Hughes <enh@google.com>
8922 * output.cc (Output_file::close): After short writes, continue
8923 writing from the correct offset in the buffer being written.
8925 2009-04-23 Chris Demetriou <cgd@google.com>
8927 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8928 * configure: Regenerate.
8929 * config.in: Regenerate.
8930 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8931 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8933 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8935 * incremental.cc (Incremental_inputs_header_data): Renamed from
8936 Incremental_input_header_data.
8937 (Incremental_inputs_header_data::data_size): New field.
8938 (Incremental_inputs_header_data::put_input_file_count): Renamed
8939 from input_file_count.
8940 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8941 from command_line_offset.
8942 (Incremental_inputs_header_data::put_reserved): Renamed from
8944 (Incremental_inputs_entry_data): Renamed from
8945 Incremental_input_entry_data.
8946 (Incremental_inputs_entry_data::data_size): New field.
8947 (Incremental_inputs::report_command_line): New method.
8948 (Incremental_inputs::finalize): New method.
8949 (Incremental_inputs::create_incremental_inputs_data): New method.
8950 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8951 * incremental.h: New file.
8952 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8953 (Layout::finalize): Create incremental inputs section in
8955 (Layout::create_incremental_info_sections): New method.
8956 * layout.h (Layout::incremental_inputs): New method.
8957 (Layout::create_incremental_info_sections): New method.
8958 (Layout::incremental_inputs_): New field.
8959 * main.cc (main): Notify Incremental_input of the command line.
8961 2009-04-01 Ian Lance Taylor <iant@google.com>
8962 Mikolaj Zalewski <mikolajz@google.com>
8964 * gold.h (reserve_unordered_map): Define, three versions, one for
8965 each version of Unordered_map.
8966 * layout.cc (Layout::Layout): Remove options parameter. Add
8967 number_of_input_files parameter. Don't initialize options_.
8968 Initialize number_of_input_files_ and resized_signatures_. Move
8969 sections_are_attached_.
8970 (Layout::layout_group): Reserve space for group_signatures_.
8971 (Layout::find_or_add_kept_section): Change name parameter to be a
8972 reference. Resize signatures_ map when it gets large enough.
8973 (Layout::layout_eh_frame): Use parameters->options() instead of
8975 (Layout::make_output_section): Likewise.
8976 (Layout::attach_allocated_section_to_segment): Likewise.
8977 (Layout::finalize, Layout::create_executable_stack): Likewise.
8978 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8979 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8980 * layout.h (class Layout): Update declarations. Remove options_
8981 field. Add number_of_input_files_ and resized_signatures_
8982 fields. Move sections_are_attached_ field.
8983 * main.cc (main): Pass number of input files to Layout
8984 constructor. Don't pass options.
8986 2009-03-30 Ian Lance Taylor <iant@google.com>
8988 * ffsll.c (ffsll): Correct implementation.
8990 2009-03-27 Ian Lance Taylor <iant@google.com>
8992 * ffsll.c: New file.
8993 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8994 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8995 * ftruncate.c (ftruncate): Declare before definition.
8996 * mremap.c (mremap): Likewise.
8997 * pread.c (pread): Likewise.
8998 * configure, Makefile.in, config.in: Rebuild.
9000 * mremap.c: New file.
9001 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9002 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9003 (mremap): Declare if HAVE_MREMAP is not defined.
9004 * configure, Makefile.in, config.in: Rebuild.
9006 2009-03-27 Cary Coutant <ccoutant@google.com>
9008 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9009 position independent.
9010 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9011 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9013 2009-03-24 Cary Coutant <ccoutant@google.com>
9015 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9017 (needs_dynamic_reloc): Likewise.
9019 2009-03-24 Ian Lance Taylor <iant@google.com>
9021 * yyscript.y (file_cmd): Recognize EXTERN.
9022 (extern_name_list, extern_name_list_body): New nonterminals.
9023 * script.cc (script_add_extern): Define.
9024 * script-c.h (script_add_extern): Declare.
9026 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9028 * object.cc (is_elf_object): Define.
9029 * object.h (is_elf_object): Declare.
9030 * archive.cc (Archive::get_elf_object_for_member): Call
9032 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9034 2009-03-24 Elliott Hughes <enh@google.com>
9036 * output.cc (Output_file::map_anonymous): Define.
9037 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9038 try an anonymous one. Report the size if the mmap fails.
9039 * output.h (class Output_file): Declare map_anonymous.
9041 2009-03-24 Ian Lance Taylor <iant@google.com>
9043 * target-select.cc (instantiate_target): Don't acquire the lock if
9044 the instantiated_target_ field has already been set.
9046 2009-03-23 Ian Lance Taylor <iant@google.com>
9048 * gold-threads.h (class Initialize_lock): Define.
9049 * gold-threads.cc (class Initialize_lock_once): Define.
9050 (initialize_lock_control): New static variable.
9051 (initialize_lock_pointer): New static variable.
9052 (initialize_lock_once): New static function.
9053 (Initialize_lock::Initialize_lock): Define.
9054 (Initialize_lock::initialize): Define.
9055 * target-select.h: Include "gold-threads.h".
9056 (class Target_selector): Add lock_ and initialize_lock_ fields.
9057 Don't define instantiate_target, just declare it.
9058 * target-select.cc (Target_selector::Target_selector): Initialize
9060 (Target_selector::instantiate_target): Define.
9061 * descriptors.h: Include "gold-threads.h".
9062 (class Descriptors): Add initialize_lock_ field.
9063 * descriptors.cc (Descriptors::Descriptors): Initialize new
9065 (Descriptors::open): Use initialize_lock_ field
9066 * errors.h (class Errors): Add initialize_lock_ field.
9067 * errors.cc (Errors::Errors): Initialize new field.
9068 (Errors::initialize_lock): Use initialize_lock_ field.
9069 * powerpc.cc (class Target_selector_powerpc): Remove
9070 instantiated_target_ field. In do_recognize call
9071 instantiate_target rather than do_instantiate_target. In
9072 do_instantiate_target just allocate a new target.
9073 * sparc.cc (class Target_selector_sparc): Likewise.
9075 * freebsd.h: New file.
9076 * i386.cc: Include "freebsd.h".
9077 (Target_i386): Derive from Target_freebsd rather than
9079 (Target_selector_i386): Derive from Target_selector_freebsd rather
9080 than Target_selector.
9081 * x86_64.cc: Include "freebsd.h".
9082 (Target_x86_64): Derive from Target_freebsd rather than
9084 (Target_selector_x86_64): Derive from Target_selector_freebsd
9085 rather than Target_selector.
9086 * target.h (class Target): Add adjust_elf_header and
9087 do_adjust_elf_header.
9088 * output.cc (Output_file_header:: do_sized_write): Call target
9089 adjust_elf_header routine.
9090 * configure.tgt: Set targ_osabi.
9091 * configure.ac: Define GOLD_DEFAULT_OSABI.
9092 * parameters.cc (Parameters::default_target): Pass
9093 GOLD_DEFAULT_OSABI to select_target.
9094 * target-select.h (class Target_selector): Make instantiate_target
9095 protected rather than private.
9096 * Makefile.am (HFILES): Add freebsd.h.
9097 * configure, Makefile.in, config.in: Rebuild.
9099 * merge.cc (do_add_input_section): Correct pend value. Change
9100 message about last entry not being null terminated from error to
9103 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9105 * incremental.cc: New file.
9106 * Makefile.am (CCFILES): Add incremental.cc.
9107 * Makefile.in: Rebuild.
9109 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9111 * layout.cc (Layout::output_section_name): Preserve names
9112 of '.note.' sections.
9114 2009-03-19 Ian Lance Taylor <iant@google.com>
9116 * descriptors.cc (Descriptors::open): Check that the options are
9117 valid before using them.
9119 2009-03-18 Ian Lance Taylor <iant@google.com>
9121 * script-sections.h: Include <list>.
9122 (class Script_sections): Change Sections_elements from std::vector
9123 to std::list. Typedef public Elements_iterator. Add
9124 orphan_section_placement_, data_segment_align_start_, and
9125 saw_data_segment_align_ fields. Remove data_segment_align_index_
9127 * script-sections.cc (class Orphan_section_placement): New class.
9128 (class Sections_element): Add virtual functions is_relro and
9129 orphan_section_init. Remove virtual function place_orphan_here.
9130 (class Output_section_definition): Add is_relro and
9131 orphan_section_init. Remove place_orphan_here.
9132 (class Orphan_output_section): Likewise.
9133 (Script_sections::Script_sections): Update for field changes.
9134 (Script_sections::data_segment_align): Set saw_data_segment_align_
9135 and data_segment_align_start_, not data_segment_align_index.
9136 (Script_sections::data_segment_relro_end): Check
9137 saw_data_segment_align_. Use data_segment_align_start_ rather
9138 than data_segment_align_index_.
9139 (Script_sections::place_orphan): Rewrite to use
9140 Orphan_section_placement.
9142 2009-03-17 Ian Lance Taylor <iant@google.com>
9144 * archive.cc (Archive::add_symbols): Check for a version attached
9145 to the symbol name in the archive map.
9146 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9147 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9148 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9149 (ver_test_11.a): New target.
9150 * testsuite/Makefile.in: Rebuild.
9152 * configure.ac: Check for chsize and posix_fallocate. Replace
9154 * ftruncate.c: New file, from gnulib.
9155 * output.cc (posix_fallocate): Define dummy version if not
9156 HAVE_POSIX_FALLOCATE.
9157 (Output_file::map): Call posix_fallocate rather than lseek and
9159 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9160 * configure, Makefile.in, config.in: Rebuild.
9162 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9164 * layout.h (Layout::create_note): Add section_name parameter.
9165 * layout.cc (Layout::create_note): Likewise.
9166 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9168 2009-03-17 Ian Lance Taylor <iant@google.com>
9170 * descriptors.cc: Include "options.h".
9171 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9172 (Descriptors::open): Always use O_CLOEXEC when opening a new
9173 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9174 then set FD_CLOEXEC.
9176 * sparc.cc (class Target_sparc): Add has_got_section.
9177 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9178 make sure we have a GOT section.
9180 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9181 (Target_sparc::Scan::local): Likewise.
9182 (Target_sparc::Scan::global): Likewise.
9183 (Target_sparc::Relocate::relocate): Likewise.
9184 (Target_sparc::Relocate::relocate_tls): Likewise.
9186 * symtab.cc (Symbol_table::define_default_version): New function,
9187 broken out of add_from_object.
9188 (Symbol_table::add_from_object): Call define_default_version.
9189 (Symbol_table::define_special_symbol): Add resolve_oldsym
9190 parameter. Change all callers. If the version for a symbol comes
9191 from a version script, resolve it with the symbol with the same
9192 name with no version. Also add the symbol without a version if
9194 (do_define_in_output_data): If resolving with oldsym, don't delete
9196 (do_define_in_output_segment): Likewise.
9197 (do_define_as_constant): Likewise.
9198 * symtab.h (class Symbol_table): Update declarations.
9200 2009-03-13 Ian Lance Taylor <iant@google.com>
9202 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9203 (Read_symbols::requeue): New function.
9204 (Read_symbols::do_read_symbols): If make_elf_object fails because
9205 the target type is not configured, and the file was searched for,
9206 issue a warning and retry with the next directory.
9207 (Add_symbols::run): If the file has an incompatible format, and
9208 it was searched for, requeue the Read_symbols task. On error,
9210 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9211 dirindex parameter to constructor. Change all callers. Declare
9212 incompatible_warning and requeue.
9213 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9214 input_argument_ and input_group_ fields. Add them to
9215 constructor. Change all callers.
9216 (class Read_script): Add dirindex_ field. Add it to constructor.
9218 * archive.cc (Archive::setup): Remove input_objects parameter.
9220 (Archive::get_file_and_offset): Likewise.
9221 (Archive::read_all_symbols): Likewise.
9222 (Archive::read_symbols): Likewise.
9223 (Archive::get_elf_object_for_member): Remove input_objects
9224 parameter. Add punconfigured parameter. Change all callers.
9225 (Archive::add_symbols): Change return type to bool. Check return
9226 value of include_member.
9227 (Archive::include_all_members): Likewise.
9228 (Archive::include_member): Change return type to bool. Return
9229 false if first included object has incompatible target. Set
9230 included_member_ field.
9231 (Add_archive_symbols::run): If add_symbols returns false, requeue
9233 * archive.h (class Archive): Add included_member_ field.
9234 Initialize it in constructor. Add input_file and searched_for
9235 methods. Update declarations.
9236 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9237 input_argument_ fields. Add them to constructor. Change all
9239 * script.cc: Include "target-select.h".
9240 (class Parser_closure): Add skip_on_incompatible_target_ and
9241 found_incompatible_target_ fields. Add
9242 skip_on_incompatible_target parameter to constructor. Change all
9243 callers. Add methods skip_on_incompatible_target,
9244 clear_skip_on_incompatible_target, found_incompatible_target, and
9245 set_found_incompatible_target.
9246 (read_input_script): Add dirindex parameter. Change all callers.
9247 If parser finds an incompatible target, requeue Read_symbols
9249 (script_set_symbol): Clear skip_on_incompatible_target in
9251 (script_add_assertion, script_parse_option): Likewise.
9252 (script_start_sections, script_add_phdr): Likewise.
9253 (script_check_output_format): New function.
9254 * script.h (read_input_script): Update declaration.
9255 * script-c.h (script_check_output_format): Declare.
9256 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9257 (ignore_cmd): Remove OUTPUT_FORMAT.
9258 * fileread.cc (Input_file::Input_file): Add explicit this.
9259 (Input_file::will_search_for): New function.
9260 (Input_file::open): Add pindex parameter. Change all callers.
9261 * fileread.h (class Input_file): Add input_file_argument method.
9262 Declare will_search_for. Update declarations.
9263 * object.cc (make_elf_object): Add punconfigured parameter.
9265 * object.h (class Object): Make input_file public. Add
9266 searched_for method.
9267 (make_elf_object): Update declaration.
9268 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9270 * dirsearch.h (class Dirsearch): Update declaration.
9271 * options.h (class General_options): Add --warn-search-mismatch.
9272 * parameters.cc (Parameters::is_compatible_target): New function.
9273 * parameters.h (class Parameters): Declare is_compatible_target.
9274 * workqueue.cc (Workqueue::add_blocker): New function.
9275 * workqueue.h (class Workqueue): Declare add_blocker.
9277 * fileread.cc (Input_file::open): Remove options parameter.
9279 (Input_file::open_binary): Likewise.
9280 * script.cc (read_input_script): Likewise.
9281 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9282 options parameter from constructor. Change all callers.
9283 (class Read_script): Likewise.
9284 * fileread.h (class Input_file): Update declarations.
9285 * script.h (read_input_script): Update declaration.
9287 2009-03-10 Nick Clifton <nickc@redhat.com>
9289 * po/es.po: New Spanish translation.
9291 2009-03-06 Cary Coutant <ccoutant@google.com>
9293 * options.cc (parse_short_option): Keep dash_z from registering itself.
9295 2009-03-03 Ian Lance Taylor <iant@google.com>
9298 * target-reloc.h (relocate_section): Pass output_section to
9300 * i386.cc (Target_i386::should_apply_static_reloc): Add
9301 output_section parameter. Change all callers.
9302 (Target_i386::Relocate::relocate): Add output_section parameter.
9303 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9304 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9305 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9306 * testsuite/two_file_shared.sh: New script.
9307 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9308 (check_DATA): Add two_file_shared.dbg.
9309 (two_file_shared.dbg): New target.
9310 * testsuite/Makefile.in: Rebuild.
9312 2009-03-01 Ian Lance Taylor <iant@google.com>
9314 * configure.ac: Check for byteswap.h.
9315 * configure: Rebuild.
9316 * config.in: Rebuild.
9318 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9320 * layout.cc (Layout::find_or_add_kept_section): New function.
9321 (Layout::add_comdat): Removed.
9322 * layout.h (struct Kept_section): Move out of class Layout.
9323 Remove trailing underscores from field names. Add group_sections
9324 field. Rename group_ field to is_group. Change all uses.
9325 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9326 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9327 comdat_groups_ field.
9328 (Sized_relobj::include_section_group): Use
9329 find_or_add_kept_section and Kept_section::group_sections.
9330 (Sized_relobj::include_linkonce_section): Likewise.
9331 * object.cc (class Sized_relobj): Don't define Comdat_group or
9332 Comdat_group_table. Remove find_comdat_group and
9333 add_comdat_group. Remove comdat_groups_ field.
9334 * plugin.cc (include_comdat_group): Use
9335 Layout::find_or_add_kept_section.
9337 2009-02-28 Ian Lance Taylor <iant@google.com>
9339 * README: --gc-sections and map files are now supported. Document
9340 some build requirements.
9343 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9344 relocatable link set the value of the section symbol to zero.
9345 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9346 relocatable link don't include the section address in the local
9349 2009-02-27 Ian Lance Taylor <iant@google.com>
9352 * options.h (class Search_directory): Add is_system_directory.
9353 (class General_options): Declare is_in_system_directory.
9354 * options.cc (get_relative_sysroot): Make static.
9355 (get_default_sysroot): Make static.
9356 (General_optoins::is_in_system_directory): New function.
9357 * fileread.cc (Input_file::is_in_system_directory): New function.
9358 * fileread.h (class Input_file): Declare is_in_system_directory.
9359 * object.h (class Object): Add is_in_system_directory.
9360 (class Input_objects): Remove system_library_directory_ field.
9361 * object.cc (Input_objects::add_object): Don't set
9362 system_library_directory_.
9363 (input_objects::found_in_system_library_directory): Remove.
9364 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9365 parameter. Change all callers.
9366 (Symbol_table::sized_write_globals): Likewise.
9367 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9368 Call Object::is_in_system_directory.
9369 * symtab.h (class Symbol_table): Update declarations.
9372 * descriptors.h (Open_descriptor): Add is_on_stack field.
9373 * descriptors.cc (Descriptors::open): If the descriptor is on the
9374 top of the stack, remove it. Initialize is_on_stack field.
9375 (Descriptors::release): Only add pod to stack if it is not on the
9377 (Descriptors::close_some_descriptor): Clear stack_next and
9381 * output.cc (Output_section::find_starting_output_address): Rename
9382 from starting_output_address; add PADDR parameter; change return
9384 * output.h (class Output_section): Declare
9385 find_starting_output_address instead of starting_output_address.
9386 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9387 section symbol for which we can't find a merge section.
9390 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9391 hidden or internal, force the symbol to be local.
9392 * resolve.cc (Symbol::override_visibility): Define.
9393 (Symbol::override_base): Use override_visibility.
9394 (Symbol_table::resolve): Likewise.
9395 (Symbol::override_base_with_special): Likewise.
9396 (Symbol_table::override_with_special): If the visibility is hidden
9397 or internal, force the symbol to be local.
9398 * symtab.h (class Symbol): Add set_visibility and
9399 override_visibility.
9400 * testsuite/ver_test_1.sh: New file.
9401 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9402 (check_DATA): Add ver_test_1.syms.
9403 (ver_test_1.syms): New target.
9404 * testsuite/Makefile.in: Rebuild.
9406 2009-02-25 Cary Coutant <ccoutant@google.com>
9408 * layout.cc (Layout::choose_output_section): Don't rename sections
9409 when using a linker script that has a SECTIONS clause.
9410 * Makefile.in: Regenerate.
9412 * testsuite/Makefile.am (script_test_5.sh): New test case.
9413 * testsuite/Makefile.in: Regenerate.
9414 * testsuite/script_test_5.cc: New file.
9415 * testsuite/script_test_5.sh: New file.
9416 * testsuite/script_test_5.t: New file.
9418 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9420 * archive.cc (Archive::include_member): Update calls to add_symbols.
9421 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9422 the Layout argument.
9423 * dynobj.h (do_add_symbols): Add the Layout argument.
9424 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9426 * object.h (Object::add_symbols): Add the Layout argument.
9427 (Object::do_add_symbols): Add the Layout argument.
9428 (Sized_relobj::do_add_symbols): Add the Layout argument.
9429 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9430 Unify the two versions.
9431 (Add_plugin_symbols): Remove.
9432 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9433 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9434 (Add_plugin_symbols): Remove.
9435 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9436 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9437 (Add_symbols::run): Make it work with Pulginobj.
9439 2009-02-06 Ian Lance Taylor <iant@google.com>
9441 * object.cc (Sized_relobj::do_layout): Make info message start
9442 with lower case letter.
9444 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9446 * binary.cc: Fix file comment.
9448 * options.h (enum Incremental_disposition): Define.
9449 (class General_options): Add new options: --incremental,
9450 --incremental_changed, --incremental_unchanged,
9451 --incremental_unknown. Add incremental_disposition_ and
9452 implicit_incremental_ fields.
9453 (General_options::incremental_disposition): New function.
9454 (class Position_dependent_options): Add incremental_disposition
9456 (Position_dependent_options::copy_from_options): Set incremental
9458 * options.cc (General_options::parse_incremental_changed): New
9460 (General_options::parse_incremental_unchanged): New function.
9461 (General_options::parse_incremental_unknown): New function.
9462 (General_options::General_options): Initialize new fields
9463 incremental_disposition_ and implicit_incremental_.
9464 (General_options::finalize): Check for uasge of --incremental-*
9465 without --incremental.
9467 2009-02-06 Chris Demetriou <cgd@google.com>
9469 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9470 pointer and to report location as the file name associated with
9472 (gold_undefined_symbol_at_location): New function to replace the
9473 old gold_undefined_symbol functionality.
9474 * target-reloc.h (relocate_section): Update to use
9475 gold_undefined_symbol_at_location.
9476 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9477 Call gold_undefined_symbol function rather than gold_error.
9478 * errors.h (Errors::undefined_symbol): Take location as a
9479 string, rather than calculating it from a relocation.
9480 * errors.cc (Errors::fatal): Print "fatal error:" before the
9482 (Errors::error, Errors::error_at_location): Print "error: "
9483 before the formatted message.
9484 (Errors::undefined_symbol): Take location as a string, rather
9485 than calculating it from a relocation.
9486 (gold_undefined_symbol_at_location): New function akin to
9487 old gold_undefined_symbol, calculates location from relocation.
9488 (gold_undefined_symbol): Change to take only a Symbol pointer
9489 and to report location as the file name associated with the symbol.
9490 * testsuite/debug_msg.sh: Update for changed error messages.
9491 * testsuite/undef_symbol.sh: Likewise.
9493 2009-02-04 Duncan Sands <baldrick@free.fr>
9496 * reduced_debug_output.h
9497 (Output_reduced_debug_abbrev_section::failed): Use format for
9499 (Output_reduced_debug_info_section::faild): Likewise.
9501 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9503 * script.cc (Lazy_demangler): New class.
9504 (Version_script_info::get_symbol_version_helper): Demangle a
9507 2009-01-29 Cary Coutant <ccoutant@google.com>
9509 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9511 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9513 2009-01-28 Ian Lance Taylor <iant@google.com>
9515 * version.cc (version_string): Bump to 1.9.
9517 * gold.h: Include <cstring> and <stdint.h>.
9518 * version.cc: Include <cstdio>.
9519 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9521 * reduced_debug_output.cc (insert_into_vector): Rename from
9522 Insert_into_vector; change all callers. Use Swap_unaligned to
9523 avoid aliasing issue; remove union since it is unnecessary.
9525 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9527 * Makefile.am (CCFILES): Add gc.cc.
9529 * Makefile.in: Regenerate.
9530 * gold.cc (Gc_runner): New class.
9531 (queue_initial_tasks): Call garbage collection related tasks
9532 when corresponding options are invoked.
9533 (queue_middle_gc_tasks): New function.
9534 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9535 processed early before laying out sections during garbage collection.
9536 * gold.h (queue_middle_gc_tasks): New function.
9537 (is_prefix_of): Move from "layout.cc".
9538 * i386.cc (Target_i386::gc_process_relocs): New function.
9539 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9540 * main.cc (main): Create object of class "Garbage_collection".
9541 * object.cc (Relobj::copy_symbols_data): New function.
9542 (Relobj::is_section_name_included): New function.
9543 (Sized_relobj::do_layout): Allow this function to be called twice
9544 during garbage collection and defer layout of section during the
9546 * object.h (Relobj::get_symbols_data): New function.
9547 (Relobj::is_section_name_included): New function.
9548 (Relobj::copy_symbols_data): New function.
9549 (Relobj::set_symbols_data): New function.
9550 (Relobj::get_relocs_data): New function.
9551 (Relobj::set_relocs_data): New function.
9552 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9553 (Relobj::gc_process_relocs): New function.
9554 (Relobj::do_gc_process_relocs): New pure virtual function.
9555 (Relobj::sd_): New data member.
9556 (Sized_relobj::is_output_section_offset_invalid): New function.
9557 (Sized_relobj::do_gc_process_relocs): New function.
9558 * options.h (General_options::gc_sections): Modify to not be a no-op.
9559 (General_options::print_gc_sections): New option.
9560 * plugin.cc (Plugin_finish::run): Remove function call to
9561 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9562 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9563 * reloc.cc (Read_relocs::run): Add task to process relocs and
9564 determine unreferenced sections when doing garbage collection.
9565 (Gc_process_relocs): New class.
9566 (Sized_relobj::do_gc_process_relocs): New function.
9567 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9568 sections that are garbage collected.
9569 * reloc.h (Gc_process_relocs): New class.
9570 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9571 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9572 symbols whose corresponding sections are garbage collected.
9573 (Symbol_table::Symbol_table): Add new parameter for the garbage
9575 (Symbol_table::gc_mark_undef_symbols): New function.
9576 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9577 (Symbol_table::gc_mark_dyn_syms): New function.
9578 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9580 (Symbol_table::add_from_object): Likewise.
9581 (Symbol_table::add_from_relobj): When building shared objects, do not
9582 treat externally visible symbols as garbage.
9583 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9584 table information for static and relocatable links.
9585 * symtab.h (Symbol_table::set_gc): New function.
9586 (Symbol_table::gc): New function.
9587 (Symbol_table::gc_mark_undef_symbols): New function.
9588 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9589 (Symbol_table::gc_mark_dyn_syms): New function.
9590 (Symbol_table::gc_): New data member.
9591 * target.h (Sized_target::gc_process_relocs): New pure virtual
9593 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9594 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9596 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9598 * options.h (General_options::gc_sections): Define as a no-op for now.
9599 (General_options::no_keep_memory): Ditto.
9600 (General_options::Bshareable): Define.
9601 * options.cc (General_options::finalize): Honor -Bshareable.
9603 2009-01-20 Andreas Schwab <schwab@suse.de>
9605 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9606 read the value in the contents, since we don't use it. Use the
9607 template endianness when writing.
9608 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9610 2009-01-19 Andreas Schwab <schwab@suse.de>
9612 * configure.tgt (powerpc64-*): Fix targ_obj.
9614 2009-01-15 Ian Lance Taylor <iant@google.com>
9616 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9617 local symbols when stripping all symbols.
9619 2009-01-14 Cary Coutant <ccoutant@google.com>
9621 * output.cc (Output_reloc): Add explicit instantiations.
9623 2009-01-14 Cary Coutant <ccoutant@google.com>
9625 * archive.cc (Archive::get_elf_object_for_member): Remove call
9626 to File_read::claim_for_plugin.
9627 * descriptors.cc (Descriptors::open): Remove reference to
9629 (Descriptors::claim_for_plugin): Remove.
9630 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9631 (Descriptors::is_claimed): Remove.
9632 (claim_descriptor_for_plugin): Remove.
9633 * fileread.cc (File_read::claim_for_plugin): Remove.
9634 * fileread.h (File_read::claim_for_plugin): Remove.
9635 (File_read::descriptor): Reopen descriptor if necessary.
9636 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9637 (Plugin_manager::all_symbols_read): Add task parameter. Change
9639 (Plugin_manager::get_input_file): New function.
9640 (Plugin_manager::release_input_file): New function.
9641 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9642 corresponding data member.
9643 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9644 and pass to base constructor. Change all callers.
9645 (get_input_file, release_input_file): New functions.
9646 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9647 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9648 (Plugin_manager::all_symbols_read): Add task parameter.
9649 (Plugin_manager::get_input_file): New function.
9650 (Plugin_manager::release_input_file): New function.
9651 (Plugin_manager::task_): New data member.
9652 (Pluginobj::Pluginobj): Add filesize parameter.
9653 (Pluginobj::filename): New function.
9654 (Pluginobj::descriptor): New function.
9655 (Pluginobj::filesize): New function.
9656 (Pluginobj::filesize_): New data member.
9657 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9658 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9659 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9661 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9662 with archive libraries.
9663 * testsuite/Makefile.in: Regenerate.
9664 * testsuite/plugin_test.c (struct sym_info): New type.
9665 (get_input_file, release_input_file): New static variables.
9666 (onload): Capture new transfer vector entries.
9667 (claim_file_hook): Stop reading at end of file according to filesize.
9668 Factor out parsing of readelf output into separate function.
9669 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9670 APIs and get the source file name from the symbol table. Convert
9671 source file name to corresponding object file name. Print info
9672 message when adding new input files.
9673 (parse_readelf_line): New function.
9674 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9675 * testsuite/plugin_test_2.sh: Likewise.
9676 * testsuite/plugin_test_3.sh: Likewise.
9677 * testsuite/plugin_test_4.sh: New test case.
9679 2009-01-07 Ian Lance Taylor <iant@google.com>
9681 * version.cc (version_string): Bump to 1.8.
9683 2008-12-23 Cary Coutant <ccoutant@google.com>
9685 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9686 * plugin.cc (Plugin_manager::finish): Rename as
9687 layout_deferred_objects. Move cleanup to separate function.
9688 (Plugin_manager::cleanup): New function.
9689 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9691 * plugin.h (Plugin_manager::finish): Rename as
9692 layout_deferred_objects.
9693 (Plugin_manager::cleanup): New function.
9694 (Plugin_manager::cleanup_done): New field.
9696 2008-12-23 Cary Coutant <ccoutant@google.com>
9698 * plugin.cc (is_visible_from_outside): New function.
9699 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9700 so we don't return "IR only" status for exported symbols or -r links.
9702 * testsuite/Makefile.am (plugin_test_3): New test case.
9703 * testsuite/Makefile.in: Regenerate.
9704 * testsuite/plugin_test_3.sh: New file.
9706 2008-12-22 Cary Coutant <ccoutant@google.com>
9708 * object.cc (Sized_relobj::layout_section): New function.
9709 (Sized_relobj::do_layout): Defer layout of input sections until after
9710 plugin has provided replacement files.
9711 (Sized_relobj::do_layout_deferred_sections): New function.
9712 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9713 (Relobj::layout_deferred_sections): New function.
9714 (Relobj::do_layout_deferred_sections): New function.
9715 (Sized_relobj::do_layout_deferred_sections): New function.
9716 (Sized_relobj::layout_section): New function.
9717 (Sized_relobj::Deferred_layout): New structure.
9718 (Sized_relobj::deferred_layout_): New field.
9719 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9720 Change all callers. Layout deferred sections.
9721 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9723 (Plugin_hook::run): Move code from do_plugin_hook inline.
9724 (Plugin_hook::do_plugin_hook): Remove.
9725 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9726 (Plugin_manager::finish): Renamed, was cleanup.
9727 (Plugin_manager::should_defer_layout): New function.
9728 (Plugin_manager::add_deferred_layout_object): New function.
9729 (Plugin_manager::Deferred_layout_list): New type.
9730 (Plugin_manager::deferred_layout_objects_): New field.
9731 (Plugin_hook::do_plugin_hook): Remove.
9733 2008-12-17 Ian Lance Taylor <iant@google.com>
9735 * options.h (class General_options): Add --no case for
9738 2008-12-16 Cary Coutant <ccoutant@google.com>
9740 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9742 (Plugin_manager::claim_file): Create plugin object even if
9743 plugin did not call the add_symbols callback.
9744 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9745 asking for more symbols than were added.
9746 * testsuite/Makefile.am (plugin_test_1): Add test case with
9748 (empty.syms): New target.
9749 * testsuite/Makefile.in: Regenerate.
9750 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9751 message. Don't call add_symbols if no globals.
9752 (all_symbols_read_hook): Don't provide replacement for empty
9755 2008-12-12 Ian Lance Taylor <iant@google.com>
9757 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9758 r_type == 0 for a local symbol with r_sym == 0.
9759 (scan_relocatable_relocs): Pass r_sym to
9760 local_non_section_strategy.
9761 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9764 * configure.ac: Update test for TLS descriptors: they are
9765 supported as of glibc 2.9.
9766 * configure: Rebuild.
9768 2008-12-11 Ian Lance Taylor <iant@google.com>
9771 * target-reloc.h (Default_scan_relocatable_relocs): For each
9772 function, map r_type == 0 to RELOC_DISCARD.
9774 2008-12-10 Cary Coutant <ccoutant@google.com>
9776 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9777 object to override a kept COMDAT group from a plugin object.
9779 2008-12-09 Ian Lance Taylor <iant@google.com>
9782 * yyscript.y (file_cmd): Handle INPUT.
9784 * testsuite/initpri1.c: Change all declarations to be full
9785 prototypes by adding void, to avoid compiler warnings.
9787 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9789 * options.cc (General_options::parse_plugin_opt): New.
9790 (General_options::add_plugin): The argument now is just the filename.
9791 (General_options::add_plugin_option): New.
9792 * options.h (plugin_opt): New.
9793 (add_plugin): Change argument name.
9794 (add_plugin_option): New.
9795 * plugin.cc (Plugin::load): Don't parse the plugin option.
9796 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9797 (Plugin::add_option): New.
9798 (Plugin::args_): Change type.
9799 (Plugin::filename_): New.
9800 (Plugin_manager::add_plugin_option): New.
9801 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9802 * testsuite/Makefile.in: Regenerate.
9804 2008-12-05 Cary Coutant <ccoutant@google.com>
9806 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9807 Handle --strip-lto-sections option.
9808 * options.h (strip_lto_sections): New option.
9810 2008-12-01 Cary Coutant <ccoutant@google.com>
9812 * plugin.cc (ld_plugin_message): Change format parameter to const.
9813 Fix mismatch between new[] and delete.
9815 2008-11-14 Cary Coutant <ccoutant@google.com>
9817 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9820 2008-11-05 Craig Silverstein <csilvers@google.com>
9822 * options.cc (General_options::parse_dynamic_list): New function.
9823 * options.h (General_options): New flags dynamic_list,
9824 dynamic_list_data, dynamic_list_cpp_new, and
9825 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9826 (General_options::in_dynamic_list): New function.
9827 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9828 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9829 (Lex::can_continue_name): Likewise.
9831 (read_script_file): New parameter script_options.
9832 (read_dynamic_list): New function.
9833 (Script_options::define_dynamic_list): New function.
9834 (dynamic_list_keyword_parsecodes): New variable.
9835 (dynamic_list_keywords): New variable.
9836 * script.h (Script_options::define_dynamic_list): New function
9838 (read_dynamic_list): New function prototype.
9839 * symtab.cc (strprefix): New macro.
9840 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9841 dynamic_list_data, dynamic_list_cpp_new, and
9842 dynamic_list_cpp_typeinfo.
9843 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9844 (dynamic_list_expr): New rule.
9845 (dynamic_list_nodes): Likewise.
9846 (dynamic_list_node): Likewise.
9847 * testsuite/Makefile.am (dynamic_list): New test.
9848 * testsuite/Makefile.in: Regenerated.
9849 * testsuite/dynamic_list.t: New file.
9850 * testsuite/dynamic_list.sh: New file.
9852 2008-11-05 Craig Silverstein <csilvers@google.com>
9854 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9855 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9856 (t11_last): Likewise.
9857 * testsuite/ver_test_6.c (main): Likewise.
9859 2008-10-07 Cary Coutant <ccoutant@google.com>
9861 * options.c (General_options::finalize): Add check for -static and
9863 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9866 2008-10-02 Cary Coutant <ccoutant@google.com>
9868 * plugin.cc (make_sized_plugin_object): Fix conditional
9869 compilation to work when not all targets are enabled.
9871 2008-09-29 Cary Coutant <ccoutant@google.com>
9873 * archive.cc (Archive::get_file_and_offset): Use filename instead
9874 of name to get library path.
9875 (Archive::include_member): Unlock external member of a thin archive.
9877 * testsuite/Makefile.am (TEST_AR): New variable.
9878 (thin_archive_test_1): New test.
9879 (thin_archive_test_2): New test.
9880 * testsuite/Makefile.in: Regenerate.
9881 * testsuite/thin_archive_main.cc: New file.
9882 * testsuite/thin_archive_test_1.cc: New file.
9883 * testsuite/thin_archive_test_2.cc: New file.
9884 * testsuite/thin_archive_test_3.cc: New file.
9885 * testsuite/thin_archive_test_4.cc: New file.
9887 2008-09-29 Cary Coutant <ccoutant@google.com>
9889 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9890 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9892 (Sized_relobj::do_finalize_local_symbols): Likewise.
9893 (Sized_relobj::map_to_kept_section): Likewise.
9894 * object.h (Sized_relobj::invalid_address): New constant.
9895 (Sized_relobj::do_output_section_offset): Check for invalid_address
9897 * output.cc (Output_reloc::local_section_offset): Use constant
9898 invalid_address instead of -1U.
9899 (Output_reloc::get_address): Likewise.
9900 (Output_section::output_address): Change -1U to -1ULL.
9901 * output.h (Output_reloc::invalid_address): New constant.
9902 * reloc.cc (Sized_relobj::write_sections): Use constant
9903 invalid_address instead of -1U.
9904 (Sized_relobj::relocate_sections): Likewise.
9905 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9906 values for merge sections.
9907 * target-reloc.h (relocate_for_relocatable): Use constant
9908 invalid_address instead of -1U.
9910 2008-09-19 Cary Coutant <ccoutant@google.com>
9912 Add plugin functionality for link-time optimization (LTO).
9913 * configure.ac (plugins): Add --enable-plugins option.
9914 * configure: Regenerate.
9915 * config.in: Regenerate.
9916 * Makefile.am (LIBDL): New variable.
9917 (CCFILES): Add plugin.cc.
9918 (HFILES): Add plugin.h.
9919 (ldadd_var): Add LIBDL.
9920 * Makefile.in: Regenerate.
9922 * archive.cc: Include "plugin.h".
9923 (Archive::setup): Don't preread archive symbols when using a plugin.
9924 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9925 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9927 (Archive::include_member): Add symbols from plugin objects.
9928 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9929 * descriptors.cc (Descriptors::open): Check for file descriptors
9930 abandoned by plugins.
9931 (Descriptors::claim_for_plugin): New function.
9932 * descriptors.h (Descriptors::claim_for_plugin): New function.
9933 (Open_descriptor::is_claimed): New field.
9934 (claim_descriptor_for_plugin): New function.
9935 * fileread.cc (File_read::claim_for_plugin): New function.
9936 * fileread.h (File_read::claim_for_plugin): New function.
9937 (File_read::descriptor): New function.
9938 * gold.cc: Include "plugin.h".
9939 (queue_initial_tasks): Add task to call plugin hooks for generating
9941 * main.cc: Include "plugin.h".
9942 (main): Load plugin libraries.
9943 * object.h (Pluginobj): Declare.
9944 (Object::pluginobj): New function.
9945 (Object::do_pluginobj): New function.
9946 (Object::set_target): New function.
9947 * options.cc: Include "plugin.h".
9948 (General_options::parse_plugin): New function.
9949 (General_options::General_options): Initialize plugins_ field.
9950 (General_options::add_plugin): New function.
9951 * options.h (Plugin_manager): Declare.
9952 (General_options): Add --plugin option.
9953 (General_options::has_plugins): New function.
9954 (General_options::plugins): New function.
9955 (General_options::add_plugin): New function.
9956 (General_options::plugins_): New field.
9957 * plugin.cc: New file.
9958 * plugin.h: New file.
9959 * readsyms.cc: Include "plugin.h".
9960 (Read_symbols::do_read_symbols): Check for archive before checking
9961 for ELF file. Call plugin hooks to claim files.
9962 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9963 from a real object file; force override when processing replacement
9965 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9966 (Symbol::init_base_object): Likewise.
9967 (Symbol::init_base_output_data): Likewise.
9968 (Symbol::init_base_output_segment): Likewise.
9969 (Symbol::init_base_constant): Likewise.
9970 (Symbol::init_base_undefined): Likewise.
9971 (Symbol::output_section): Assert that object is not a plugin.
9972 (Symbol_table::add_from_pluginobj): New function.
9973 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9975 (Symbol_table::sized_write_globals): Likewise.
9976 (Symbol_table::add_from_pluginobj): Instantiate template.
9977 * symtab.h (Sized_pluginobj): Declare.
9978 (Symbol::in_real_elf): New function.
9979 (Symbol::set_in_real_elf): New function.
9980 (Symbol::in_real_elf_): New field.
9981 (Symbol_table::add_from_pluginobj): New function.
9983 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9984 (LIBDL): New variable.
9986 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9987 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9988 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9989 (MOSTLYCLEANFILES): Likewise.
9990 * testsuite/Makefile.in: Regenerate.
9991 * testsuite/plugin_test.c: New file.
9992 * testsuite/plugin_test_1.sh: New file.
9993 * testsuite/plugin_test_2.sh: New file.
9995 2008-09-16 Ian Lance Taylor <iant@google.com>
9997 * target-reloc.h (relocate_section): Check whether a symbol is
9998 defined by the ABI before reporting an undefined symbol error.
9999 * target.h (Target::is_defined_by_abi): Make parameter const.
10000 (Target::do_is_defined_by_abi): Likewise.
10001 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10002 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10003 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10004 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10005 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10006 * testsuite/Makefile.in: Rebuild.
10008 * fileread.cc (make_view): Add casts to avoid warning.
10010 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10012 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10013 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10015 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10017 * options.h (General_options::output_is_executable): New.
10018 (General_options::output_is_pie): New.
10019 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10020 for shared libraries.
10021 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10023 2008-09-11 Chris Demetriou <cgd@google.com>
10025 * options.h (origin): New -z option.
10026 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10027 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10030 2008-09-05 Cary Coutant <ccoutant@google.com>
10032 * fileread.cc (File_read::make_view): Add check for attempt to map
10033 beyond end of file.
10035 2008-09-05 Cary Coutant <ccoutant@google.com>
10037 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10038 explicit instantiations.
10040 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10043 * options.cc (General_options::finalize): Allow undefined symbols
10044 in shlibs if linking -shared.
10047 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10048 symbols as not needing a dynsym entry.
10050 2008-08-20 Craig Silverstein <csilvers@google.com>
10052 * fileread.cc (File_read::open): Do not lock the file unless it
10053 was successfully opened.
10055 2008-08-14 Cary Coutant <ccoutant@google.com>
10057 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10058 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10059 * testsuite/tls_test.cc (struct int128): 128-bit struct
10060 for testing TLS relocs with non-zero addend.
10061 (v12): New TLS variable.
10063 (t_last): Add check for v12.
10064 * testsuite/tls_test.h (t12): New function.
10065 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10067 2008-08-13 Ian Lance Taylor <iant@google.com>
10069 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10070 set tls_segment_ or relro_segment_.
10071 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10073 * output.h (Output_section::clear_is_relro): New function.
10074 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10075 sections specially even when output_data_ is empty.
10076 (Output_segment::maximum_alignment): When first section is relro,
10077 only force alignment for PT_LOAD segments.
10078 * script.cc (script_data_segment_align): New function.
10079 (script_data_segment_relro_end): New function.
10080 * script-c.h (script_data_segment_align): Declare.
10081 (script_data_segment_relro_end): Declare.
10082 * script-sections.h (class Script_sections): Declare
10083 data_segment_align and data_segment_relro_end. Add fields
10084 segment_align_index_ and saw_relro_end_.
10085 * script-sections.cc (class Sections_element): Add set_is_relro
10086 virtual function. Add new bool* parameter to place_orphan_here.
10087 Add get_output_section virtual function.
10088 (class Output_section_definition): Add set_is_relro. Add new
10089 bool* parameter to place_orphan_here. Add get_output_section.
10090 Add is_relro_ field.
10091 (Output_section_definition::Output_section_definition): Initialize
10092 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10093 and is_relro_ fields.
10094 (Output_section_definition::place_orphan_here): Add is_relro
10096 (Output_section_definition::set_section_addresses): Set relro for
10098 (Output_section_definition::alternate_constraint): Likewise.
10099 (class Orphan_output_section): Add new bool* parameter to
10100 place_orphan_here. Add get_output_section.
10101 (Orphan_output_section::place_orphan_here): Add is_relro
10103 (Script_sections::Script_sections): Initialize
10104 data_segment_align_index_ and saw_relro_end_.
10105 (Script_sections::data_segment_align): New function.
10106 (Script_sections::data_segment_relro_end): New function.
10107 (Script_sections::place_orphan): Set or clear is_relro.
10108 (Script_sections::set_section_addresses): Force alignment of first
10110 * yyscript.y (exp): Call script_data_segment_align and
10111 script_data_segment_relro_end.
10112 * testsuite/relro_script_test.t: New file.
10113 * testsuite/relro_test.cc (using_script): Declare.
10114 (t1, t2): Test using_script.
10115 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10116 (relro_script_test_SOURCES): Define.
10117 (relro_script_test_DEPENDENCIES): Define.
10118 (relro_script_test_LDFLAGS): Define.
10119 (relro_script_test_LDADD): Define.
10120 (relro_script_test.so): New target.
10121 * testsuite/Makefile.in: Rebuild.
10123 2008-08-06 Cary Coutant <ccoutant@google.com>
10125 * archive.cc (Archive::total_archives, Archive::total_members)
10126 (Archive::total_members_loaded): New variables.
10127 (Archive::setup): Add parameter. Add option to preread
10129 (Archive::read_armap): Add counter.
10130 (Archive::get_file_and_offset): New function.
10131 (Archive::get_elf_object_for_member): New function.
10132 (Archive::read_all_symbols): New function.
10133 (Archive::read_symbols): New function.
10134 (Archive::add_symbols): Add counters.
10135 (Archive::include_all_members): Use armap to find members if it's
10137 (Archive::include_member): Skip reading symbols if already read.
10138 Factored code into Archive::get_file_and_offset and
10139 Archive::get_elf_object_for_member. Changed call to
10140 Mapfile::report_include_archive_member.
10141 (Archive::print_stats): New function.
10142 * archive.h: Declare Object and Read_symbols_data classes.
10143 (Archive::Archive): Add initializers for new members.
10144 (Archive::setup): Add parameter.
10145 (Archive::print_stats): New function.
10146 (Archive::total_archives, Archive::total_members)
10147 (Archive::total_members_loaded): New variables.
10148 (Archive::get_file_and_offset): New function.
10149 (Archive::get_elf_object_for_member): New function.
10150 (Archive::read_all_symbols): New function.
10151 (Archive::read_symbols): New function.
10152 (Archive::Archive_member): New class.
10153 (Archive::members_): New member.
10154 (Archive::num_members_): New member.
10155 * main.cc: Include archive.h.
10156 (main): Call Archive::print_stats.
10157 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10158 archive parameter; member_name is now the fully-decorated name.
10159 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10160 * options.h: (General_options): Add --preread-archive-symbols option.
10161 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10164 2008-08-04 Ian Lance Taylor <iant@google.com>
10166 * symtab.h (Symbol::use_plt_offset): New function.
10167 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10168 * powerpc.cc (Relocate::relocate): Likewise.
10169 * sparc.cc (Relocate::relocate): Likewise.
10170 * x86_64.cc (Relocate::relocate): Likewise.
10171 * testsuite/weak_plt.sh: New test.
10172 * testsuite/weak_plt_main.cc: New test.
10173 * testsuite/weak_plt_shared.cc: New test.
10174 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10175 (check_PROGRAMS): Add weak_plt.
10176 (check_DATA): Add weak_plt_shared.so.
10177 (weak_plt_main_pic.o, weak_plt): New targets.
10178 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10179 * testsuite/Makefile.in: Rebuild.
10181 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10183 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10184 * testsuite/Makefile.in: Rebuild.
10186 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10188 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10189 * Makefile.in: Regenerate.
10190 * po/POTFILES.in: Regenerate.
10192 2008-07-29 Ian Lance Taylor <iant@google.com>
10194 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10195 symbols before other symbols.
10196 * testsuite/script_test_2.cc (test_addr): Declare.
10197 (test_addr_alias): Declare.
10198 (main): Check that test_addr and test_addr_alias have the right
10200 * testsuite/script_test_2.t: Define test_addr_alias and
10203 2008-07-24 Ian Lance Taylor <iant@google.com>
10206 * descriptors.cc: New file.
10207 * descriptors.h: New file.
10208 * gold-threads.h (class Hold_optional_lock): New class.
10209 * fileread.cc: Include "descriptors.h".
10210 (File_read::~File_read): Release descriptor rather than closing
10212 (File_read::open) [file]: Call open_descriptor rather than open.
10213 Set is_descriptor_opened_.
10214 (File_read::open) [memory]: Assert that descriptor is not open.
10215 (File_read::reopen_descriptor): New function.
10216 (File_read::release): Release descriptor.
10217 (File_read::do_read): Make non-const. Reopen descriptor.
10218 (File_read::read): Make non-const.
10219 (File_read::make_view): Reopen descriptor.
10220 (File_read::do_readv): Likewise.
10221 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10222 Update declarations.
10223 * layout.cc: Include "descriptors.h".
10224 (Layout::create_build_id): Use open_descriptor rather than open.
10225 * output.cc: Include "descriptors.h".
10226 (Output_file::open): Use open_descriptor rather than open.
10227 * archive.cc (Archive::const_iterator): Change Archive to be
10229 (Archive::begin, Archive::end): Make non-const.
10230 (Archive::count_members): Likewise.
10231 * archive.h (class Archive): Update declarations.
10232 * object.h (Object::read): Make non-const.
10233 * Makefile.am (CCFILES): Add descriptors.cc.
10234 (HFILES): Add descriptors.h.
10235 * Makefile.in: Rebuild.
10238 * gold.h: Always include <clocale>. Add Solaris workarounds
10239 following code in binutils/sysdep.h.
10242 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10243 this->eh_frame_hdr_ is NULL before using it.
10245 * dynobj.cc (Versions::Versions): Update comment.
10247 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10248 the base version name.
10250 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10251 array size plus one.
10252 (Stringpool_template::set_string_offsets): Subtract one from key
10253 before using it as an array index.
10254 (Stringpool_template::get_offset_with_length): Likewise.
10255 (Stringpool_template::write_to_buffer): Likewise.
10256 * stringpool.h (Stringpool_template::get_offset_from_key):
10259 2008-07-23 Ian Lance Taylor <iant@google.com>
10262 * object.h (Merged_symbol_value::value): Do our best to handle a
10266 * script.cc (Version_script_info::get_versions): Don't add empty
10267 version tag to return value.
10268 (Version_script_info::get_symbol_version_helper): Change return
10269 type to bool. Add pversion parameter. Change all callers.
10270 (script_register_vers_node): Don't require a non-NULL tag.
10271 * script.h (class Version_script_info): Update declarations.
10272 (Version_script_info::get_symbol_version): Change return type to
10273 bool. Add version parameter. Change all callers.
10274 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10275 handling. Handle an empty version from a version script.
10276 (Symbol_table::define_special_symbol): Likewise.
10277 * testsuite/ver_test_10.script: New file.
10278 * testsuite/ver_test_10.sh: New file.
10279 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10280 (check_DATA): Add ver_test_10.syms.
10281 (ver_test_10.syms, ver_test_10.so): New target.
10282 * testsuite/Makefile.in: Rebuild.
10284 2008-07-23 Simon Baldwin <simonb@google.com>
10286 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10287 to zero for undefined symbols from dynamic libraries.
10289 2008-07-23 Ian Lance Taylor <iant@google.com>
10291 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10292 Change all callers.
10293 * symtab.h (class Symbol_table): Update declaration.
10294 * testsuite/ver_test_9.cc: New file.
10295 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10296 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10297 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10298 (ver_test_9.so, ver_test_9.o): New targets.
10299 * testsuite/Makefile.in: Rebuild.
10301 2008-07-22 Ian Lance Taylor <iant@google.com>
10303 * options.h (class General_options): Define --check-sections.
10304 * layout.cc (Layout::set_segment_offsets): Handle
10307 * options.h (class General_options): Define -n/--nmagic and
10309 * options.cc (General_options::finalize): For -n/--nmagic or
10310 -N/--omagic, set -static.
10311 * layout.cc (Layout::attach_allocated_section_to_segment): If
10312 -N/--omagic, don't put read-only and read-write sections in
10313 different segments.
10314 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10315 finding a read-only segment.
10316 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10317 don't set the minimum segment alignment to the common page size,
10318 and don't set the file offset to the address modulo the page size.
10319 * script-sections.cc (Script_sections::create_segments): If
10320 -n/--omagic, don't put read-only and read-write sections in
10321 different segments.
10323 * cref.cc: New file.
10324 * cref.h: New file.
10325 * options.h (class General_options): Add --print-symbol-counts.
10326 * main.cc (main): Issue defined symbol report if requested.
10327 * archive.cc (Archive::interpret_header): Make into a const member
10329 (Archive::add_symbols): Call Input_objects::archive_start and
10331 (Archive::const_iterator): Define new class.
10332 (Archive::begin, Archive::end): New functions.
10333 (Archive::include_all_members): Rewrite to use iterator.
10334 (Archive::count_members): New function.
10335 * archive.h (class Archive): Update declarations.
10336 (Archive::filename): New function.
10337 * object.cc: Include "cref.h".
10338 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10339 (Sized_relobj::do_get_global_symbol_counts): New function.
10340 (Input_objects::add_object): Add object to cross-referencer.
10341 (Input_objects::archive_start): New function.
10342 (Input_objects::archive_stop): New function.
10343 (Input_objects::print_symbol_counts): New function.
10344 * object.h: Declare Cref and Archive.
10345 (Object::get_global_symbol_counts): New function.
10346 (Object::do_get_global_symbol_counts): New pure virtual function.
10347 (class Sized_relobj): Add defined_count_ field. Update
10349 (class Input_objects): Add cref_ field. Update constructor.
10350 Update declarations.
10351 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10353 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10355 (Sized_dynobj::do_get_global_symbol_counts): New function.
10356 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10357 defined_count_. Update declarations. Define Symbols typedef.
10358 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10359 parameter. Change all callers.
10360 (Symbol_table::add_from_dynobj): Add sympointers and defined
10361 parameters. Change all callers.
10362 * symtab.h (class Symbol_table): Update declarations.
10363 * Makefile.am (CCFILES): Add cref.cc.
10364 (HFILES): Add cref.h.
10365 * Makefile.in: Rebuild.
10367 2008-07-22 Simon Baldwin <simonb@google.com>
10369 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10370 to zero when writing undefined symbols.
10372 2008-07-22 Ian Lance Taylor <iant@google.com>
10374 * output.cc (Output_section::add_input_section): Don't try to
10375 merge empty merge sections.
10377 2008-07-21 Craig Silverstein <csilvers@google.com>
10379 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10380 Include symbol version in error message.
10382 2008-07-20 Chris Demetriou <cgd@google.com>
10384 * configure.ac (gold_cv_c_random_seed): New configured variable.
10385 (RANDOM_SEED_CFLAGS): New substituted variable.
10386 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10387 * configure: Rebuild.
10388 * Makefile.in: Likewise.
10389 * testsuite/Makefile.in: Likewise.
10391 2008-07-18 Ian Lance Taylor <iant@google.com>
10393 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10394 where we see NAME/NULL and NAME/VERSION as separate symbols.
10395 * testsuite/ver_test_main.cc (main): Call t4.
10396 (t4, t4_2a): Define.
10397 * testsuite/ver_test_2.cc (t4_2): Define.
10398 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10399 * testsuite/ver_test_4.cc (t4_2a): Define.
10400 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10401 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10403 2008-07-17 Ian Lance Taylor <iant@google.com>
10405 * dynobj.cc (Versions::add_def): If we give an error about a
10406 missing version, go ahead and create the version anyhow.
10408 2008-07-10 Ian Lance Taylor <iant@google.com>
10410 Handle output sections with more than 0x7fffffff bytes.
10411 * object.h (class Relobj): Change map_to_output_ to
10412 output_sections_, and just keep a section pointer. Change all
10413 uses. Move comdat group support to Sized_relobj.
10414 (Relobj::is_section_specially_mapped): Remove.
10415 (Relobj::output_section): Remove poff parameter. Change all
10417 (Relobj::output_section_offset): New function.
10418 (Relobj::set_section_offset): Rewrite.
10419 (Relobj::map_to_output): Remove.
10420 (Relobj::output_sections): New function.
10421 (Relobj::do_output_section_offset): New pure virtual function.
10422 (Relobj::do_set_section_offset): Likewise.
10423 (class Sized_relobj): Add section_offsets_ field. Add comdat
10424 group support from Relobj. Update declarations.
10425 (Sized_relobj::get_output_section_offset): New function.
10426 (Sized_relobj::do_output_section_offset): New function.
10427 (Sized_relobj::do_set_section_offset): New function.
10428 * object.cc (Relobj::output_section_address): Remove.
10429 (Sized_relobj::Sized_relobj): Initialize new fields.
10430 (Sized_relobj::include_section_group): Cast find_kept_object to
10432 (Sized_relobj::include_linkonce_section): Likewise.
10433 (Sized_relobj::do_layout): Use separate arrays for output section
10435 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10437 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10438 output_sections and section_offsets.
10439 (Sized_relobj::write_local_symbols): Likewise.
10440 (map_to_kept_section): Compute output address directly.
10441 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10442 output_sections and section_offsets.
10443 (Sized_relobj::write_sections): Likewise.
10444 (Sized_relobj::relocate_sections): Likewise.
10445 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10446 * output.h (class Output_reloc): Update declarations. Change
10447 u2_.relobj to Sized_relobj*.
10448 (class Output_data_reloc): Change add functions to use
10450 * output.cc (Output_reloc::Output_reloc): Change relobj to
10452 (Output_reloc::local_section_offset): Change return type to
10453 Elf_Addr. Use get_output_section_offset.
10454 (Output_reloc::get_address): Likewise.
10455 (Output_section::is_input_address_mapped): Don't call
10456 is_section_specially_mapped.
10457 (Output_section::output_offset): Likewise.
10458 (Output_section::output_address): Likewise.
10459 (Output_section::starting_output_address): Likewise.
10460 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10461 parameter to Sized_relobj*.
10462 (Copy_relocs::need_copy_reloc): Likewise.
10463 (Copy_relocs::save): Likewise.
10464 * copy-relocs.h (class Copy_relocs): Update declarations.
10465 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10466 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10467 * target-reloc.h (relocate_for_relocatable): Change
10468 offset_in_output_section type to Elf_Addr. Change code that uses
10470 * layout.cc (Layout::layout): Always set *off.
10471 * mapfile.cc (Mapfile::print_input_section): Use
10472 output_section_offset.
10473 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10475 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10476 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10477 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10479 2008-07-03 Ian Lance Taylor <iant@google.com>
10481 * layout.cc (Layout::include_section): Do not discard unrecognized
10482 SHT_STRTAB sections.
10484 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10486 * script.cc (Lex::can_continue_name): Make '?' allowable in
10487 version-script names.
10488 * testsuite/version_script.map: Change glob pattern to use '?'
10490 2008-06-30 Manish Singh <yosh@gimp.org>
10493 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10496 2008-06-30 Ian Lance Taylor <iant@google.com>
10500 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10501 versions]: Don't try to read the value in the contents, since we
10502 don't use it. Use the template endianness when writing.
10504 2008-06-25 Cary Coutant <ccoutant@google.com>
10506 * fileread.cc (File_read::make_view): Assert on zero-length view.
10507 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10508 symbol table when there are no symbols to read.
10510 2008-06-23 Craig Silverstein <csilvers@google.com>
10512 * version.cc (version_string): Bump to 1.7
10514 2008-06-18 Craig Silverstein <csilvers@google.com>
10516 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10517 constant 0xFFFF to type Valtype.
10518 (Powerpc_relocate_functions::rel16_ha): Likewise.
10520 2008-06-17 Ian Lance Taylor <iant@google.com>
10522 * output.h (Output_section::Input_section): Initialize p2align_ to
10523 zero for Output_section_data constructors.
10524 (Output_section::Input_section::addralign): If not an input
10525 section, return the alignment of the Output_section_data.
10526 * testsuite/copy_test.cc: New file.
10527 * testsuite/copy_test_1.cc: New file.
10528 * testsuite/copy_test_2.cc: New file.
10529 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10530 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10531 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10532 (copy_test_1_pic.o, copy_test_1.so): New targets.
10533 (copy_test_2_pic.o, copy_test_2.so): New targets.
10534 * testsuite/Makefile.in: Rebuild.
10536 * script-sections.cc (Script_sections::place_orphan): Initialize
10537 local variable exact.
10539 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10541 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10543 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10544 David S. Miller <davem@davemloft.net>
10546 * powerpc.cc: New file.
10547 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10548 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10549 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10550 * Makefile.in: Rebuild.
10552 2008-06-09 Ian Lance Taylor <iant@google.com>
10554 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10556 (throwing, orig_terminate): New static variables.
10557 (terminate_handler): New static function.
10558 (t2): Set terminate handler.
10560 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10563 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10566 2008-05-30 Cary Coutant <ccoutant@google.com>
10568 * archive.cc (Archive::include_all_members) Correct to step
10569 over symbol table and extended name table in thin archives.
10571 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10574 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10577 2008-05-28 Caleb Howe <cshowe@google.com>
10579 * reduced_debug_output.cc: New file.
10580 * reduced_debug_output.h: New file.
10581 * options.h (class General_options): Add --strip-debug-non-line.
10582 * options.cc (General_options::finalize): Add strip_debug_non_line
10583 to the strip heirarchy.
10584 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10586 * layout.cc: Include "reduced_debug_output.h".
10587 (Layout::Layout): Initialize new fields.
10588 (line_only_debug_sections): New static array.
10589 (is_lines_only_debug_sections): New static inline function.
10590 (Layout::include_section): Handle --strip-debug-non-line.
10591 (Layout::make_output_section): If --strip-debug-non-line, build
10592 new output sections for .debug_abbrev and .debug_info.
10593 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10594 gold. Warn about possible overflow.
10595 (read_signed_LEB_128): Likewise.
10596 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10597 (read_signed_LEB_128): Declare.
10598 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10599 (HFILES): Add reduced_debug_output.h.
10600 * Makefile.in: Rebuild.
10602 2008-05-21 Ian Lance Taylor <iant@google.com>
10604 * mapfile.cc: New file.
10605 * mapfile.h: New file.
10606 * options.h (class General_options): Add -M/--print-map and -Map.
10607 * options.cc (General_options::finalize): Make -M equivalent to
10609 * main.cc: Include <cstdio> and "mapfile.h".
10610 (main): Open mapfile if requested.
10611 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10612 constructor. Change caller.
10613 (queue_initial_tasks): Add mapfile parameter. Change caller.
10614 (queue_middle_tasks): Likewise.
10615 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10617 * archive.cc: Include "mapfile.h".
10618 (Archive::add_symbols): Add mapfile parameter. Change all
10619 callers. Pass mapfile, symbol, and reason to include_member.
10620 (Archive::include_all_members): Add mapfile parameter. Change all
10622 (Archive::include_member): Add mapfile, sym, and why parameters.
10623 Change all callers. Report inclusion to map file.
10624 * archive.h: Include "fileread.h".
10625 (class Archive): Update declarations.
10626 (Archive::file): New const method.
10627 (class Add_archive_symbols): Add mapfile_ field. Update
10628 constructor. Change all callers.
10629 * readsyms.h (class Read_symbols): Likewise.
10630 (class Finish_group): Likewise.
10631 (class Read_script): Likewise.
10632 * common.cc: Include "mapfile.h".
10633 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10635 (Symbol_table::do_allocate_commons): Likewise.
10636 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10637 symbol allocation to mapfile.
10638 * common.h (class Allocate_commons_task): Add mapfile_ field.
10639 Update constructor. Change all callers.
10640 * symtab.h (class Symbol_table): Update declarations.
10641 * layout.cc: Include "mapfile.h".
10642 (Layout_task_runner::run): Print information to mapfile.
10643 (Layout::create_gold_note): Change Output_data_fixed_space to
10644 Output_data_zero_fill.
10645 (Layout::create_build_id): Likewise.
10646 (Layout::print_to_mapfile): New function.
10647 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10648 constructor. Change caller.
10649 (class Layout): Declare print_to_mapfile.
10650 * output.cc (Output_section::Input_section::print_to_mapfile): New
10652 (Output_section::add_input_section): If producing a map, always
10653 add to input_sections_ list.
10654 (Output_section::do_print_to_mapfile): New function.
10655 (Output_segment::print_sections_to_mapfile): New function.
10656 (Output_segment::print_section_list_to_mapfile): New function.
10657 * output.h: Include "mapfile.h".
10658 (Output_data::print_to_mapfile): New function.
10659 (Output_data::do_print_to_mapfile): New virtual function.
10660 (Output_segment_headers::do_print_to_mapfile): New function.
10661 (Output_file_header::do_print_to_mapfile): New function.
10662 (Output_data_const::do_print_to_mapfile): New function.
10663 (class Output_data_const_buffer): Add map_name_ field. Update
10664 constructor. Change all callers. Add do_print_to_mapfile
10666 (class Output_data_fixed_space): Likewise.
10667 (class Output_data_space): Likewise.
10668 (class Output_data_zero_fill): New class.
10669 (Output_data_strtab::do_print_to_mapfile): New function.
10670 (Output_data_reloc_base::do_print_to_mapfile): New function.
10671 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10672 (Output_data_group::do_print_to_mapfile): New function.
10673 (Output_data_got::do_print_to_mapfile): New function.
10674 (Output_data_dynamic::do_print_to_mapfile): New function.
10675 (Output_symtab_xindex::do_print_to_mapfile): New function.
10676 (class Output_section): Declare do_print_to_mapflie. Declare
10677 print_to_mapfile in Input_section.
10678 (class Output_segment): Declare new functions.
10679 * object.h (Sized_relobj::symbol_count): New function.
10680 * script-sections.cc
10681 (Output_section_element_dot_assignment::set_section_addresses):
10682 Change Output_data_fixed_space to Output_data_zero_fill.
10683 (Output_data_expression::do_print_to_mapfile): New function.
10684 * script.cc (read_input_script): Add mapfile parameter. Change
10686 * script.h (read_input_script): Update declaration.
10687 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10688 (Eh_frame::do_print_to_mapfile): New function.
10689 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10690 (Output_merge_string::do_print_to_mapfile): New function.
10691 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10693 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10695 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10697 * Makefile.am (CCFILES): Add mapfile.cc.
10698 (HFILES): Add mapfile.h.
10699 * Makefile.in: Rebuild.
10701 2008-05-19 Ian Lance Taylor <iant@google.com>
10703 * options.h (class General_options): Add -z relro.
10704 * layout.cc (Layout::Layout): Initialize relro_segment_.
10705 (Layout::add_output_section_data): Return the output section.
10706 (Layout::make_output_section): Rcognize relro sections and mark
10707 them appropriately.
10708 (Layout::attach_allocated_section_to_segment): Put relro sections
10709 in a PT_GNU_RELRO segment.
10710 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10712 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10714 (Layout::linkonce_mapping): Map d.rel.ro.local to
10715 .data.rel.ro.local.
10716 (Layout::output_section_name): Us .data.rel.ro.local for any
10717 section which begins with that.
10718 * layout.h (class Layout): Update add_output_section_data
10719 declaration. Add relro_segment_ field.
10720 * output.cc (Output_section::Output_section): Initialize is_relro_
10721 and is_relro_local_ fields.
10722 (Output_segment::add_output_section): Group relro sections.
10723 (Output_segment::is_first_section_relro): New function.
10724 (Output_segment::maximum_alignment): If there is a relro section,
10725 align the segment to the common page size.
10726 (Output_segment::set_section_addresses): Track whether we are
10727 looking at relro sections. If the last section is a relro
10728 section, align to the common page size.
10729 (Output_segment::set_section_list_addresses): Add in_relro
10730 parameter. Change all callers. Align to the page size when
10731 moving from relro to non-relro section.
10732 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10734 * output.h (class Output_section): Add is_relro_ and
10735 is_relro_local_ fields.
10736 (Output_section::is_relro): New function.
10737 (Output_section::set_is_relro): New function.
10738 (Output_section::is_relro_local): New function.
10739 (Output_section::set_is_relro_local): New function.
10740 (class Output_segment): Update declarations.
10741 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10742 * sparc.cc (Target_sparc::got_section): Likewise.
10743 * x86_64.cc (Target_x86_64::got_section): Likewise.
10744 * testsuite/relro_test_main.cc: New file.
10745 * testsuite/relro_test.cc: New file.
10746 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10747 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10748 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10749 (relro_test.so, relro_test_pic.o): New targets.
10750 * testsuite/Makefile.in: Rebuild.
10752 2008-05-16 Ian Lance Taylor <iant@google.com>
10754 * output.cc (Output_segment::add_output_section): Remove front
10756 * output.h (class Output_segment): Remove
10757 add_initial_output_section and overloaded add_output_section.
10758 Update declaration of remaining add_output_section.
10759 * layout.cc (Layout::create_interp): Call add_output_section
10760 rather than add_initial_output_section.
10761 (Layout::finish_dynamic_section): Likewise.
10763 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10764 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10765 know the dynamic type.
10766 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10767 field. Initialize it in constructor.
10768 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10769 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10770 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10773 * output.cc (Output_reloc::get_address): Change return type to
10775 * output.h (class Output_reloc): Update get_address declaration.
10776 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10777 for section addresses.
10779 2008-05-09 Ian Lance Taylor <iant@google.com>
10782 * gold.cc (gold_nomem): Use return value of write.
10784 2008-05-08 Ian Lance Taylor <iant@google.com>
10786 * symtab.c (Symbol::init_base_output_data): Add version
10787 parameter. Change all callers.
10788 (Symbol::init_base_output_segment): Likewise.
10789 (Symbol::init_base_constant): Likewise.
10790 (Symbol::init_base_undefined): Likewise.
10791 (Sized_symbol::init_output_data): Likewise.
10792 (Sized_symbol::init_output_segment): Likewise.
10793 (Sized_symbol::init_constant): Likewise.
10794 (Sized_symbol::init_undefined): Likewise.
10795 (Symbol_table::do_define_in_output_data): If the new symbol has a
10796 version, mark it as the default.
10797 (Symbol_table::do_define_in_output_segment): Likewise.
10798 (Symbol_table::do_define_as_constant): Likewise.
10799 * symtab.h (class Symbol): Update declarations.
10800 (class Sized_symbol): Likewise.
10801 * resolve.cc (Symbol::override_version): New function.
10802 (Symbol::override_base): Call override_version.
10803 (Symbol::override_base_with_special): Likewise.
10804 * testsuite/ver_script_8.script: New file.
10805 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10806 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10807 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10808 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10810 2008-05-06 Ian Lance Taylor <iant@google.com>
10813 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10815 (class General_options): Remove existing --undefined, and add
10816 --no-undefined instead. Add new --undefined as synonym for -u.
10817 * archive.cc (Archive::add_symbols): Check whether symbol was
10819 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10820 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10821 all uses. Add IS_UNDEFINED. Update declarations to split
10822 different versions of init_base. Declare init_base_undefined.
10823 (Symbol::is_defined): Handle IS_UNDEFINED.
10824 (Symbol::is_undefined): Likewise.
10825 (Symbol::is_weak_undefined): Call is_undefined.
10826 (Symbol::is_absolute): Handle IS_CONSTANT.
10827 (class Sized_symbol): Update declarations to split different
10828 versions of init. Declare init_undefined.
10829 (class Symbol_table): Declare new functions.
10830 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10831 Change all callers.
10832 (Symbol::init_base_output_data): Likewise.
10833 (Symbol::init_base_output_segment): Likewise.
10834 (Symbol::init_base_constant): Likewise.
10835 (Symbol::init_base_undefined): New function.
10836 (Sized_symbol::init_object): Rename from init. Change all
10838 (Sized_symbol::init_output_data): Likewise.
10839 (Sized_symbol::init_output_segment): Likewise.
10840 (Sized_symbol::init_constant): Likewise.
10841 (Sized_symbol::init_undefined): New function.
10842 (Symbol_table::add_undefined_symbols_from_command_line): New
10844 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10846 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10847 (Symbol::output_section): Likewise.
10848 (Symbol::set_output_section): Likewise.
10849 (Symbol_table::sized_finalize_symbol): Likewise.
10850 (Symbol_table::sized_write_globals): Likewise.
10851 * resolve.cc (Symbol_table::should_override): Likewise.
10852 (Symbol::override_base_with_special): Likewise.
10854 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10855 symbol, change it to have default visibility.
10856 * testsuite/protected_1.cc: New file.
10857 * testsuite/protected_2.cc: New file.
10858 * testsuite/protected_3.cc: New file.
10859 * testsuite/protected_main_1.cc: New file.
10860 * testsuite/protected_main_2.cc: New file.
10861 * testsuite/protected_main_3.cc: New file.
10862 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10863 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10864 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10865 (protected_1.so): New target.
10866 (protected_1_pic.o, protected_2_pic.o): New targets.
10867 (protected_3_pic.o): New target.
10868 (check_PROGRAMS): Add protected_2.
10869 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10870 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10871 * testsuite/Makefile.in: Rebuild.
10873 * options.h (DEFINE_var): Add set_user_set_##varname__.
10874 (DEFINE_bool_alias): New macro.
10875 (class General_options): Define -Bstatic using DEFINE_bool_alias
10876 rather than DEFINE_special. Add --undefined as an alias for -z
10878 * options.cc (General_options::parse_Bstatic): Remove.
10880 * options.h (class General_options): Add --fatal-warnings.
10881 * main.cc (main): Implement --fatal-warnings.
10882 * errors.h (Errors::warning_count): New function.
10884 * options.h (class General_options): Add -Bsymbolic-functions.
10885 * symtab.h (Symbol::is_preemptible): Check for
10886 -Bsymbolic-functions.
10888 2008-05-05 Ian Lance Taylor <iant@google.com>
10890 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10891 as noVARNAME rather than no-VARNAME.
10892 (class General_options): Add option -z combreloc.
10893 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10895 (Output_reloc::sort_before) [SHT_REL]: New function.
10896 (Output_reloc::sort_before) [SHT_RELA]: New function.
10897 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10898 Sort_relocs_comparison.
10899 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10900 parameter. Change all callers.
10901 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10902 sort_relocs parameter. Change all callers.
10903 * output.cc (Output_reloc::get_address): New function, broken out
10905 (Output_reloc::write_rel): Call it.
10906 (Output_reloc::compare): New function.
10907 (Output_data_reloc_base::do_write): Optionally sort relocs.
10909 * configure.ac: If targ_extra_obj is set, link it in.
10910 * configure.tgt: Initialize all variables.
10911 (x86_64*): Set targ_extra_obj and targ_extra_size.
10912 * configure: Rebuild.
10914 * object.cc (Sized_relobj::include_section_group): Adjust section
10915 indexes read from group data. Build vector to pass to
10917 * layout.cc (Layout::layout_group): Add flags and shndxes
10918 parameters. Remove contents parameter. Change caller. Update
10919 explicit instantiations.
10920 * layout.h (class Layout): Update layout_group declaration.
10921 * output.cc (Output_data_group::Output_data_group): Add flags and
10922 input_shndxes parameters. Remove contents parameter. Change
10924 (Output_data_group::do_write): Change input_sections_ to
10926 * output.h (class Output_data_group): Update constructor
10927 declaration. Rename input_sections_ to input_shndxes_.
10928 * testsuite/many_sections_test.cc: Add template.
10930 2008-04-30 Cary Coutant <ccoutant@google.com>
10932 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10934 * layout.cc (Layout::include_section): Refactored check for debug
10936 (Layout::add_comdat): Add new parameters. Change type
10937 of signature parameter. Add object and shndx to signatures table.
10938 (Layout::find_kept_object): New function.
10939 * layout.h: Include <cstring>.
10940 (Layout::is_debug_info_section): New function.
10941 (Layout::add_comdat): Add new parameters.
10942 (Layout::find_kept_object): New function.
10943 (Layout::Kept_section): New struct.
10944 (Layout::Signatures): Change type of map range.
10945 * object.cc (Relobj::output_section_address): New function.
10946 (Sized_relobj::include_section_group): Add new parameters. Change
10947 calls to Layout::add_comdat. Change to build table of kept comdat
10948 groups and table mapping discarded sections to kept sections.
10949 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10950 (Sized_relobj::do_layout): Change calls to include_section_group and
10951 include_linkonce_section.
10952 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10953 value to zero when section is discarded.
10954 (Sized_relobj::map_to_kept_section): New function.
10955 * object.h (Relobj::output_section_address): New function.
10956 (Relobj::Comdat_group): New type.
10957 (Relobj::find_comdat_group): New function.
10958 (Relobj::Comdat_group_table): New type.
10959 (Relobj::Kept_comdat_section): New type.
10960 (Relobj::Kept_comdat_section_table): New type.
10961 (Relobj::add_comdat_group): New function.
10962 (Relobj::set_kept_comdat_section): New function.
10963 (Relobj::get_kept_comdat_section): New function.
10964 (Relobj::comdat_groups_): New field.
10965 (Relobj::kept_comdat_sections_): New field.
10966 (Symbol_value::input_value): Update comment.
10967 (Sized_relobj::map_to_kept_section) New function.
10968 (Sized_relobj::include_linkonce_section): Add new parameter.
10969 * target-reloc.h (Comdat_behavior): New type.
10970 (get_comdat_behavior): New function.
10971 (relocate_section): Add code to map a discarded section to the
10972 corresponding kept section when applying a relocation.
10974 2008-04-30 Craig Silverstein <csilvers@google.com>
10976 * dwarf_reader.cc (next_generation_count): New static var.
10977 (Addr2line_cache_entry): New struct.
10978 (addr2line_cache): New static var.
10979 (Dwarf_line_info::one_addr2line): Added caching.
10980 (Dwarf_line_info::clear_addr2line_cache): New function.
10981 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10982 cache-size parameter.
10983 (Dwarf_line_info::one_addr2line_cache): New function.
10984 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10985 new cache-size argument to one_addr2line(), and clear cache.
10987 2008-04-28 Cary Coutant <ccoutant@google.com>
10989 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10990 R_386_PC8 relocations.
10992 2008-04-23 Ian Lance Taylor <iant@google.com>
10994 * object.cc (Sized_relobj::include_section_group): Check for
10995 invalid section group.
10997 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11000 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11001 than read for file header.
11002 * archive.cc (Archive::include_member): Likewise.
11004 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11006 * aclocal.m4: Regenerate.
11007 * configure: Regenerate.
11009 2008-04-19 Ian Lance Taylor <iant@google.com>
11011 * version.cc (version_string): Bump to 1.6.
11013 * testsuite/Makefile.am (many_sections_r_test): New target.
11014 (many_sections_r_test_SOURCES): Remove.
11015 (many_sections_r_test_DEPENDENCIES): Remove.
11016 (many_sections_r_test_LDFLAGS): Remove.
11017 (many_sections_r_test_LDADD): Remove.
11019 * object.cc (Sized_relobj::do_add_symbols): Always pass
11020 local_symbol_count_ to add_from_relobj.
11022 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11023 every thousand variables.
11024 * testsuite/Makefile.in: Rebuild.
11026 * object.cc (Xindex::initialize_symtab_xindex): New function.
11027 (Xindex::read_symtab_xindex): New function.
11028 (Xindex::sym_xindex_to_shndx): New function.
11029 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11031 (Sized_relobj::do_initialize_xindex): New function.
11032 (Sized_relobj::do_read_symbols): Adjust section links.
11033 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11034 parameter. Change all callers.
11035 (Sized_relobj::include_section_group): Adjust section links and
11036 symbol section indexes.
11037 (Sized_relobj::do_layout): Adjust section links.
11038 (Sized_relobj::do_count_local_symbols): Adjust section links and
11039 symbol section indexes.
11040 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11041 ordinary and special symbols.
11042 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11043 dynsym_xindex parameters. Change all callers. Adjust section
11044 links. Use SHN_XINDEX when needed.
11045 (Sized_relobj::get_symbol_location_info): Adjust section links.
11046 Don't get fooled by special symbols.
11047 * object.h (class Xindex): Define.
11048 (class Object): Add xindex_ parameter. Declare virtual functoin
11049 do_initialize_xindex.
11050 (Object::adjust_sym_shndx): New function.
11051 (Object::set_xindex): New protected function.
11052 (class Symbol_value): Add is_ordinary_shndx_ field.
11053 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11054 (Symbol_value::value): Assert ordinary section.
11055 (Symbol_value::initialize_input_to_output_map): Likewise.
11056 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11057 Change all callers.
11058 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11060 (class Sized_relobj): Update declarations.
11061 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11062 parameter. Change all callers.
11063 (Sized_relobj::adjust_shndx): New function.
11064 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11066 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11067 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11068 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11069 (Sized_dynobj::read_dynsym_section): Adjust section links.
11070 (Sized_dynobj::read_dynamic): Likewise.
11071 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11073 (Sized_dynobj::do_initialize_xindex): New function.
11074 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11075 do_initialize_xindex.
11076 (Sized_dynobj::adjust_shndx): New function.
11077 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11078 dynsym_xindex_ fields.
11079 (Layout::finalize): Add a call to set_section_indexes before
11080 creating the symtab sections.
11081 (Layout::set_section_indexes): Don't do anything if the section
11082 already has a section index.
11083 (Layout::create_symtab_sections): Add shnum parameter. Change
11084 caller. Create .symtab_shndx section if needed.
11085 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11087 (Layout::allocated_output_section_count): New function.
11088 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11090 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11091 fields. Update declarations.
11092 (Layout::symtab_xindex): New function.
11093 (Layout::dynsym_xindex): New function.
11094 (class Write_symbols_task): Add layout_ field.
11095 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11097 * output.cc (Output_section_headers::Output_section_headers): Add
11098 shstrtab_section parameter. Change all callers.
11099 (Output_section_headers::do_sized_write): Store overflow values
11100 for section count and section string table section index in
11101 section header zero.
11102 (Output_file_header::do_sized_write): Check for overflow of
11103 section count and section string table section index.
11104 (Output_symtab_xindex::do_write): New function.
11105 (Output_symtab_xindex::endian_do_write): New function.
11106 * output.h (class Output_section_headers): Add shstrtab_section_.
11107 Update declarations.
11108 (class Output_symtab_xindex): Define.
11109 (Output_section::has_out_shndx): New function.
11110 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11112 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11113 Change all callers.
11114 (Sized_symbol::init): Likewise.
11115 (Symbol::output_section): Check for ordinary symbol.
11116 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11117 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11119 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11120 Change all callers. Simplify handling of symbols from sections
11121 not included in the link.
11122 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11124 (Weak_alias_sorter::operator()): Assert that symbols are
11126 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11128 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11129 parameters. Change all callers.
11130 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11131 symbol distinction. Use SHN_XINDEX when needed.
11132 (Symbol_table::write_section_symbol): Add symtab_xindex
11133 parameter. Change all callers.
11134 (Symbol_table::sized_write_section_symbol): Likewise. Use
11135 SHN_XINDEX when needed.
11136 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11138 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11139 (Symbol::is_defined): Check is_ordinary.
11140 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11141 (Symbol::is_absolute, Symbol::is_common): Likewise.
11142 (class Sized_symbol): Update declarations.
11143 (class Symbol_table): Update declarations.
11144 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11145 parameters. Change all callers.
11146 (Sized_symbol::override): Likewise.
11147 (Symbol_table::override): Likewise.
11148 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11149 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11150 is_ordinary, and orig_st_shndx parameters. Change all callers.
11151 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11152 to be in an ordinary section.
11153 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11154 object and is_ordinary parameters. Change all callers.
11155 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11156 Change all callers. Don't add undefined or non-ordinary symbols
11158 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11159 Change all callers.
11160 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11162 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11163 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11164 (Sized_relobj::relocate_sections): Likewise.
11165 * target-reloc.h (scan_relocs): Adjust section symbol index.
11166 (scan_relocatable_relocs): Likewise.
11167 * i386.cc (Scan::local): Check for ordinary symbols.
11168 * sparc.cc (Scan::local): Likewise.
11169 * x86_64.cc (Scan::local): Likewise.
11170 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11171 to symbol_section_and_value.
11172 * testsuite/many_sections_test.cc: New file.
11173 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11174 (check_PROGRAMS): Add many_sections_test.
11175 (many_sections_test_SOURCES): Define.
11176 (many_sections_test_DEPENDENCIES): Define.
11177 (many_sections_test_LDFLAGS): Define.
11178 (BUILT_SOURCES): Add many_sections_define.h.
11179 (many_sections_define.h): New target.
11180 (BUILT_SOURCES): Add many_sections_check.h.
11181 (many_sections_check.h): New target.
11182 (check_PROGRAMS): Add many_sections_r_test.
11183 (many_sections_r_test_SOURCES): Define.
11184 (many_sections_r_test_DEPENDENCIES): Define.
11185 (many_sections_r_test_LDFLAGS): Define.
11186 (many_sections_r_test_LDADD): Define.
11187 (many_sections_r_test.o): New target.
11188 * testsuite/Makefile.in: Rebuild.
11190 2008-04-17 Cary Coutant <ccoutant@google.com>
11192 * errors.cc (Errors::info): New function.
11193 (gold_info): New function.
11194 * errors.h (Errors::info): New function.
11195 * gold.h (gold_info): New function.
11196 * object.cc (Input_objects::add_object): Print trace output.
11197 * options.cc (options::parse_set): New function.
11198 (General_options::parse_wrap): Deleted.
11199 (General_options::General_options): Deleted initializer.
11200 * options.h (options::String_set): New typedef.
11201 (options::parse_set): New function.
11202 (DEFINE_set): New macro.
11203 (General_options::wrap): Changed to use DEFINE_set. Changed
11204 callers of any_wrap_symbols and is_wrap_symbol.
11205 (General_options::trace, General_options::trace_symbol):
11207 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11208 (General_options::wrap_symbols_): Deleted.
11209 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11211 2008-04-17 David S. Miller <davem@davemloft.net>
11213 * options.cc (General_options::parse_V): New function.
11214 * options.h: Add entries for -V and -Qy.
11216 2008-04-17 Ian Lance Taylor <iant@google.com>
11218 * common.cc (Symbol_table::allocate_commons): Remove options
11219 parameter. Change caller.
11220 (Symbol_table::do_allocate_commons): Remove options parameter.
11221 Change caller. Just call do_allocate_commons_list twice.
11222 (Symbol_table::do_allocate_commons_list): New function, broken out
11223 of do_allocate_commons.
11224 * common.h (class Allocate_commons_task): Remove options_ field.
11225 Update constructor.
11226 * symtab.cc (Symbol_table::Symbol_table): Initialize
11228 (Symbol_table::add_from_object): Put TLS common symbols on
11230 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11231 which are IN_OUTPUT_DATA.
11232 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11233 allocate_commons and do_allocate_commons declarations. Declare
11234 do_allocate_commons_list.
11235 * gold.cc (queue_middle_tasks): Update creation of
11236 Allocate_commons_task to not pass options.
11237 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11238 (TLS_TEST_C_FLAGS): New variable.
11239 (tls_test_c_pic.o): New target.
11240 (tls_test_shared.so): Link in tls_test_c_pic.o.
11241 (tls_test_c_pic_ie.o): New target.
11242 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11243 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11244 (tls_test_c.o): New target.
11245 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11246 (tls_pic_test_LDADD): Likewise.
11247 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11248 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11249 (tls_test_c_gnu2.o): New target.
11250 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11252 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11253 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11254 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11255 * testsuite/tls_test.cc: Include "config.h".
11256 (t_last): Call t11_last.
11257 * testsuite/tls_test.h (t11, t11_last): Declare.
11258 * testsuite/tls_test_c.c: New file.
11259 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11260 * configure.ac: Check for OpenMP support.
11261 * configure, config.in, Makefile.in: Rebuild.
11262 * testsuite/Makefile.in: Rebuild.
11264 2008-04-16 Cary Coutant <ccoutant@google.com>
11266 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11267 (Target_i386::tls_base_symbol_defined_): New field.
11268 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11269 (Target_i386::Scan::global): Likewise.
11270 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11271 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11272 (Target_x86_64::tls_base_symbol_defined_): New field.
11273 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11274 (Target_x86_64::Scan::global): Likewise.
11276 2008-04-16 Cary Coutant <ccoutant@google.com>
11278 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11279 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11280 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11281 building shared libraries.
11282 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11283 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11284 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11285 * testsuite/Makefile.in: Rebuild.
11286 * testsuite/weak_undef.h: New file.
11287 * testsuite/weak_undef_file1.cc: Add extra test cases.
11288 * testsuite/weak_undef_file2.cc: Likewise.
11289 * testsuite/weak_undef_test.cc: Likewise.
11291 2008-04-16 David S. Miller <davem@davemloft.net>
11293 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11294 Add issued_non_pic_error_ field. Declare check_non_pic.
11295 (Target_sparc::Scan::check_non_pic): New function.
11296 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11297 (Target_sparc::Scan::global): Likewise.
11299 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11300 * configure: Rebuild.
11302 * options.h (DEFINE_enable): New macro.
11303 (new_dtags): New enable option.
11304 (initfirst, interpose, loadfltr, nodefaultlib,
11305 nodelete, nodlopen, nodump): New -z options.
11306 * layout.cc (Layout:finish_dynamic_section): If new
11307 dtags enabled, emit DT_RUNPATH. Also, emit a
11308 DT_FLAGS_1 containing any specified -z flags.
11310 2008-04-16 Ian Lance Taylor <iant@google.com>
11312 * copy-relocs.cc: New file.
11313 * copy-relocs.h: New file.
11314 * reloc.cc: Remove Copy_relocs code.
11315 * reloc.h: Likewise.
11316 * reloc-types.h (struct Reloc_types) [both versions]: Add
11317 get_reloc_addend_noerror.
11318 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11319 variants of add_global which take an addend which must be zero.
11320 * i386.cc: Include "copy-relocs.h".
11321 (class Target_i386): Change type of copy_relocs_ to variable,
11322 update initializer.
11323 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11324 Change all callers.
11325 (Target_i386::do_finalize_sections): Change handling of
11327 * sparc.cc: Include "copy-relocs.h".
11328 (class Target_sparc): Change type of copy_relocs_ to variable,
11329 update initializer.
11330 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11331 Change all callers.
11332 (Target_sparc::do_finalize_sections): Change handling of
11334 * x86_64.cc: Include "copy-relocs.h".
11335 (class Target_x86_64): Change type of copy_relocs_ to variable,
11336 update initializer.
11337 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11338 class. Change all callers.
11339 (Target_x86_64::do_finalize_sections): Change handling of
11341 * Makefile.am (CCFILES): Add copy-relocs.cc.
11342 (HFILES): Add copy-relocs.h.
11344 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11346 * testsuite/script_test_4.sh: Permit leading zeroes.
11348 2008-04-15 Ian Lance Taylor <iant@google.com>
11350 * script-sections.cc (Script_sections::create_segments): Use
11351 header_size_adjustment even when there is enough room for the
11353 * testsuite/script_test_4.sh: New file.
11354 * testsuite/script_test_4.t: New file.
11355 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11356 (check_DATA): Add script_test_4.stdout.
11357 (MOSTLYCLEANFILES): Likewise.
11358 (script_test_4): New target.
11359 (script_test_4.stdout): New target.
11360 * testsuite/Makefile.in: Rebuild.
11362 * sparc.cc: Add definitions for Output_data_plt_sparc class
11365 2008-04-14 David S. Miller <davem@davemloft.net>
11367 * sparc.cc: New file.
11368 * Makefile.am (TARGETSOURCES): Add sparc.cc
11369 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11370 * configure.tgt: Document targ_extra_size and
11371 targ_extra_big_endian. Add entries for sparc-* and
11373 * configure.ac: Handle targ_extra_size and
11374 targ_extra_big_endian.
11375 * Makefile.in: Rebuild.
11376 * configure: Likewise.
11377 * po/POTFILES.in: Likewise.
11378 * po/gold.pot: Likewise.
11380 2008-04-14 Ian Lance Taylor <iant@google.com>
11382 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11383 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11384 in the name/type/flags to section mapping. Don't call
11385 allocate_output_section.
11386 (Layout::choose_output_section): Change parameter from adjust_name
11387 to is_input_section. Don't permit input sections after sections
11388 are attached to segments. Don't call allocate_output_section.
11389 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11390 not write_enable_output_section.
11391 (Layout::make_output_section): Don't push to
11392 unattached_section_list_ nor call attach_to_segment. Call
11393 attach_section_to_segment if sections are attached.
11394 (Layout::attach_sections_to_segments): New function.
11395 (Layout::attach_section_to_segment): New function.
11396 (Layout::attach_allocated_section_to_segment): Rename from
11397 attach_to_segment. Remove flags parameter.
11398 (Layout::allocate_output_section): Remove function.
11399 (Layout::write_enable_output_section): Remove function.
11400 * layout.h (class Layout): Update for above changes. Add new
11401 field sections_are_attached_.
11402 * output.h (Output_section::update_flags_for_input_section): New
11404 * output.cc (Output_section::add_input_section): Call
11405 update_flags_for_input_section.
11406 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11408 2008-04-11 Cary Coutant <ccoutant@google.com>
11410 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11411 thought unnecessary.
11412 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11414 2008-04-11 Ian Lance Taylor <iant@google.com>
11416 * output.h (class Output_section_data): Remove inline definition
11418 * output.cc (Output_section_data::set_addralign): New function.
11420 2008-04-11 Cary Coutant <ccoutant@google.com>
11422 Add support for TLS descriptors for i386 and x86_64.
11423 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11424 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11425 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11427 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11428 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11429 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11431 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11432 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11433 Fix problem with initial-exec relocations.
11434 (Target_i386::Relocate::relocate_tls): Likewise.
11435 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11437 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11438 support for section-plus-offset dynamic table entries.
11439 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11440 (Output_data_dynamic::Dynamic_entry): Add support for
11441 section-plus-offset dynamic table entries.
11442 (Output_data_dynamic::Classification): Likewise.
11443 (Output_data_dynamic::classification_): Renamed offset_.
11444 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11445 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11446 (Target_x86_64::make_plt_section): New function.
11447 (Target_x86_64::reserve_tlsdesc_entries): New function.
11448 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11449 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11450 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11451 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11452 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11453 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11454 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11455 add extra PLT entry for TLS descriptors.
11456 (Output_data_plt_x86_64::got_): New field.
11457 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11458 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11460 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11462 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11463 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11464 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11465 R_386_TLS_DESC_CALL relocations.
11466 (Target_x86_64::Scan::global): Likewise.
11467 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11468 for TLS descriptors.
11469 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11470 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11471 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11472 GD-to-IE relaxation.
11473 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11474 and TLS_DESCRIPTORS.
11475 * Makefile.in: Rebuild.
11476 * configure: Rebuild.
11477 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11478 (tls_test_shared2.so): New target.
11479 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11480 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11481 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11482 (tls_shared_gd_to_ie_test_LDADD): New variable.
11483 (tls_shared_gnu2_gd_to_ie_test): New target.
11484 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11486 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11487 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11488 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11489 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11490 (tls_shared_gnu2_test): New target.
11491 (tls_test_gnu2_shared.so): New target.
11492 (tls_shared_gnu2_test_SOURCES): New variable.
11493 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11494 (tls_shared_gnu2_test_LDFLAGS): New variable.
11495 (tls_shared_gnu2_test_LDADD): New variable.
11496 * testsuite/Makefile.in: Rebuild.
11497 * testsuite/Makefile.
11499 2008-04-11 Ian Lance Taylor <iant@google.com>
11501 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11503 * testsuite/Makefile.in: Rebuild.
11505 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11507 * testsuite/script_test_2.cc (main): Adjust test.
11509 2008-04-11 David S. Miller <davem@davemloft.net>
11510 Ian Lance Taylor <iant@google.com>
11512 * options.h (General_options): Add entries for '-Y' and
11514 * options.cc (General_options:finalize): If -Y was used, add those
11515 entries to the library path instead of the default "/lib" and
11518 2008-04-11 David S. Miller <davem@davemloft.net>
11520 * testsuite/justsyms.t: Start at 0x100.
11521 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11522 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11524 * testsuite/script_test_2.cc: Adjust string and section length
11527 2008-04-09 Ian Lance Taylor <iant@google.com>
11530 * script-sections.cc (Sections_element::allocate_to_segment): Add
11532 (Output_section_definition::allocate_to_segment): Likewise.
11533 (Orphan_output_section::allocate_to_segment): Likewise.
11534 (Script_sections::attach_sections_using_phdrs_clause): Don't
11535 propagate non-PT_LOAD segments to orphan sections.
11536 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11537 readelf rather than objdump.
11538 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11539 .interp section and PT_INTERP segment are the same size.
11540 * testsuite/Makefile.in: Rebuild.
11542 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11543 aliases for symbols defined in the same object.
11544 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11545 (weak_alias_test_SOURCES): New variable.
11546 (weak_alias_test_DEPENDENCIES): New variable.
11547 (weak_alias_test_LDFLAGS): New variable.
11548 (weak_alias_test_LDADD): New variable.
11549 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11550 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11551 (weak_alias_test_3.o): New target.
11552 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11553 * testsuite/weak_alias_test_main.cc: New file.
11554 * testsuite/weak_alias_test_1.cc: New file.
11555 * testsuite/weak_alias_test_2.cc: New file.
11556 * testsuite/weak_alias_test_3.cc: New file.
11558 2008-04-08 Ian Lance Taylor <iant@google.com>
11560 * options.h (class General_options): Add --noinhibit-exec option.
11561 * main.cc (main): Check --noinhibit-exec.
11563 * options.h (class General_options): Define --wrap as a special
11564 option. Add wrap_symbols_ field.
11565 (General_options::any_wrap_symbols): New function.
11566 (General_options::is_wrap_symbol): New function.
11567 * options.cc (General_options::parse_wrap): New function.
11568 (General_options::General_options): Initialize wrap_symbols_.
11569 * symtab.cc (Symbol_table::wrap_symbol): New function.
11570 (Symbol_table::add_from_object): Handle --wrap.
11571 * symtab.h (class Symbol_table): Declare wrap_symbol.
11572 * target.h (Target::wrap_char): New function.
11573 (Target::Target_info): Add wrap_char field.
11574 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11575 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11576 * testsuite/testfile.cc (Target_test::test_target_info):
11579 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11582 * layout.h (class Layout): Add added_eh_frame_data_ field.
11583 * layout.cc (Layout::Layout): Initialize new field.
11584 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11585 output section until we find a section we merged successfully.
11586 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11587 that the size be non-zero.
11589 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11592 2008-04-08 Craig Silverstein <csilvers@google.com>
11594 * configure.ac: Export new conditional variable HAVE_ZLIB.
11595 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11597 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11598 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11600 2008-04-07 Ian Lance Taylor <iant@google.com>
11602 * version.cc (version_string): Set to "1.5".
11604 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11605 Add issued_non_pic_error_ field. Declare check_non_pic.
11606 (Target_x86_64::Scan::check_non_pic): New function.
11607 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11608 (Target_x86_64::Scan::global): Likewise.
11610 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11611 addend parameter. Change caller. Handle merge sections.
11612 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11613 Address to Addend. Don't add in the result of
11614 local_section_offset, pass down the addend and use the returned
11616 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11617 Update declarations of local_section_offset and symbol_value.
11618 * testsuite/two_file_test_1.cc (t18): New function.
11619 * testsuite/two_file_test_2.cc (f18): New function.
11620 * testsuite/two_file_test_main.cc (main): Call t18.
11621 * testsuite/two_file_test.h (t18, f18): Declare.
11623 * configure.ac: Don't test for objdump, c++filt, or readelf.
11624 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11626 (TEST_READELF): New variable.
11627 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11628 (check_PROGRAMS): Add two_file_strip_test.
11629 (two_file_strip_test): New target.
11630 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11631 (two_file_same_shared_strip_test_SOURCES): New variable.
11632 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11633 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11634 (two_file_same_shared_strip_test_LDADD): New variable.
11635 (two_file_shared_strip.so): New target.
11636 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11637 (ver_test_5.syms, ver_test_7.syms): Likewise.
11638 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11639 (strip_test_3.stdout): Use TEST_OBJDUMP.
11640 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11642 2008-04-04 Cary Coutant <ccoutant@google.com>
11644 * symtab.h (Symbol::is_weak_undefined): New function.
11645 (Symbol::is_strong_undefined): New function.
11646 (Symbol::is_absolute): New function.
11647 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11648 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11650 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11651 (weak_undef_test): New target.
11652 * testsuite/Makefile.in: Rebuild.
11653 * testsuite/weak_undef_file1.cc: New file.
11654 * testsuite/weak_undef_file2.cc: New file.
11655 * testsuite/weak_undef_test.cc: New file.
11657 2008-04-03 Craig Silverstein <csilvers@google.com>
11659 * compressed_output.h (class Output_compressed_section): Use
11661 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11663 (zlib_compressed_suffix): Removed.
11664 (Output_compressed_section::set_final_data_size): Use unsigned
11666 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11667 Fix linker invocation.
11668 (flagstest_o_specialfile_and_compress_debug_sections):
11670 * testsuite/Makefile.in: Regenerated.
11672 2008-04-02 David S. Miller <davem@davemloft.net>
11674 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11675 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11677 2008-04-02 Craig Silverstein <csilvers@google.com>
11681 2008-04-02 Ian Lance Taylor <iant@google.com>
11683 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11684 parameters. Update for new key type to views_. Change all
11686 (File_read::read): Adjust for byteshift in returned view.
11687 (File_read::add_view): New function, broken out of
11688 find_and_make_view.
11689 (File_read::make_view): New function, broken out of
11690 find_and_make_view.
11691 (File_read::find_or_make_view): Add offset and aligned
11692 parameters. Rewrite accordingly. Change all callers.
11693 (File_read::get_view): Add offset and aligned parameters. Adjust
11694 for byteshift in return value.
11695 (File_read::get_lasting_view): Likewise.
11696 * fileread.h (class File_read): Update declarations.
11697 (class File_read::View): Add byteshift_ field. Add byteshift to
11698 constructor. Add byteshift method.
11699 * archive.h (Archive::clear_uncached_views): New function.
11700 (Archive::get_view): Add aligned parameter. Change all callers.
11701 * object.h (Object::get_view): Add aligned parameter. Change all
11703 (Object::get_lasting_view): Likewise.
11705 * fileread.cc (File_read::release): Don't call clear_views if
11706 there are multiple objects.
11707 * fileread.h (File_read::clear_uncached_views): New function.
11708 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11711 2008-03-31 Cary Coutant <ccoutant@google.com>
11713 Add thin archive support.
11714 * archive.cc (Archive::armagt): New const.
11715 (Archive::setup): Remove task parameter and calls to unlock.
11716 (Archive::unlock_nested_archives): New function.
11717 (Archive::read_header): Add nested_off parameter. Change
11719 (Archive::interpret_header): Likewise.
11720 (Archive::include_all_members): Change to handle thin
11722 (Archive::include_member): Likewise.
11723 * archive.h (Archive::Archive): Add new parameters and
11725 (Archive::armagt): New const.
11726 (Archive::setup): Remove task parameter.
11727 (Archive::unlock_nested_archives): New function.
11728 (Archive::read_header): Add nested_off parameter.
11729 (Archive::interpret_header): Likewise.
11730 (Archive::Nested_archive_table): New typedef.
11731 (Archive::is_thin_archive_): New field.
11732 (Archive::nested_archives_): New field.
11733 (Archive::options_): New field.
11734 (Archive::dirpath_): New field.
11735 (Archive::task_): New field.
11736 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11737 for thin archives. Pass additional parameters to
11738 Archive::Archive. Unlock the archive file after calling
11741 2008-03-29 Ian Lance Taylor <iant@google.com>
11743 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11744 version symbol to be local.
11745 * testsuite/ver_test_4.sh: New file.
11746 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11747 (check_DATA): Add ver_test_4.syms.
11748 (ver_test_4.syms): New target.
11749 * testsuite/Makefile.in: Rebuild.
11752 (Output_section::Input_section_sort_entry::has_priority): New
11754 (Output_section::Input_section_sort_entry::match_file_name): New
11756 (Output_section::Input_section_sort_entry::match_section_name):
11758 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11760 (Output_section::Input_section_sort_entry::match_section_file):
11762 (Output_section::Input_section_sort_compare::operator()): Rewrite
11763 using new Input_section_sort_entry functions. Sort crtbegin and
11764 crtend first. Sort sections with no priority before sections with
11766 * testsuite/initpri1.c (d3): Check j != 4.
11767 (cd5): New constructor/destructor function.
11768 (main): Check j != 2.
11770 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11771 new symbol when resolving, don't call set_is_default.
11772 * testsuite/ver_test_7.cc: New file.
11773 * testsuite/ver_test_7.sh: New file.
11774 * testsuite/Makefile.am (ver_test_7.so): New target.
11775 (ver_test_7.o): New target.
11776 (check_SCRIPTS): Add ver_test_7.sh.
11777 (check_DATA): Add ver_test_7.syms.
11778 (ver_test_7.syms): New target.
11780 2008-03-28 Ian Lance Taylor <iant@google.com>
11782 * layout.cc (Layout::layout): If we see an input section with a
11783 name that needs sorting, set the must_sort flag for the output
11785 (Layout::make_output_section): If the name of the output section
11786 indicates that it might require sorting, set the may_sort flag.
11787 * output.h (Output_section::may_sort_attached_input_sections): New
11789 (Output_section::set_may_sort_attached_input_sections): New
11791 (Output_section::must_sort_attached_input_sections): New
11793 (Output_section::set_must_sort_attached_input_sections): New
11795 (class Output_section): Declare Input_section_sort_entry. Define
11796 Input_section_sort_compare. Declare
11797 sort_attached_input_sections. Add new fields:
11798 may_sort_attached_input_sections_,
11799 must_sort_attached_input_sections_,
11800 attached_input_sections_are_sorted_.
11801 * output.cc (Output_section::Output_section): Initialize new
11803 (Output_section::add_input_section): Add an entry to
11804 input_sections_ if may_sort or must_sort are true.
11805 (Output_section::set_final_data_size): Call
11806 sort_attached_input_sections if necessary.
11807 (Output_section::Input_section_sort_entry): Define new class.
11808 (Output_section::Input_section_sort_compare::operator()): New
11810 (Output_section::sort_attached_input_sections): New function.
11811 * configure.ac: Check whether the compiler supports constructor
11812 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11813 * testsuite/initpri1.c: New file.
11814 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11815 CONSTRUCTOR_PRIORITY.
11816 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11817 (initpri1_LDFLAGS): New variable.
11818 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11820 2008-03-27 Ian Lance Taylor <iant@google.com>
11822 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11823 * testsuite/common_test_1.c: New file.
11824 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11825 (common_test_1_SOURCES): New variable.
11826 (common_test_1_DEPENDENCIES): New variable.
11827 (common_test_1_LDFLAGS): New variable.
11829 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11830 and commons_ correctly when NAME/VERSION does not override
11832 * testsuite/ver_test_6.c: New file.
11833 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11834 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11835 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11837 2008-03-26 Ian Lance Taylor <iant@google.com>
11839 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11840 of an undefined symbol from a version script.
11841 * testsuite/Makefile.am (ver_test_5.so): New target.
11842 (ver_test_5.o): New target.
11843 (check_SCRIPTS): Add ver_test_5.sh.
11844 (check_DATA): Add ver_test_5.syms.
11845 (ver_test_5.syms): New target.
11846 * testsuite/ver_test_5.cc: New file.
11847 * testsuite/ver_test_5.script: New file.
11848 * testsuite/ver_test_5.sh: New file.
11849 * Makefile.in, testsuite/Makefile.in: Rebuild.
11852 Fix problems building gold with gcc 4.3.0.
11853 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11854 (gold_error_at_location, gold_warning_at_location): Use it.
11855 * configure.ac: Check whether we can compile and use a template
11856 function with a printf attribute.
11857 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11858 when jumping over bytes.
11859 * object.cc: Instantiate Object::read_section_data.
11860 * debug.h: Include <cstring>
11861 * dwarf_reader.cc: Include <algorithm>
11862 * main.cc: Include <cstring>.
11863 * options.cc: Include <cstring>.
11864 * output.cc: Include <cstring>.
11865 * script.cc: Include <cstring>.
11866 * script.h: Include <string>.
11867 * symtab.cc: Include <cstring> and <algorithm>.
11868 * target-select.cc: Include <cstring>.
11869 * version.cc: Include <string>.
11870 * testsuite/testmain.cc: Include <cstdlib>.
11871 * configure, config.in: Rebuild.
11873 2008-03-25 Ian Lance Taylor <iant@google.com>
11875 * options.cc: Include "../bfd/bfdver.h".
11876 (options::help): Print bug reporting address.
11878 * version.cc (print_version): Adjust output for current value of
11879 BFD_VERSION_STRING.
11883 * options.cc (options::help): Print list of supported targets.
11884 * target-select.h: Include <vector>.
11885 (class Target_selector): Make machine_, size_, and is_big_endian_
11886 fields const. Add bfd_name_ and instantiated_target_ fields.
11887 (Target_selector::Target_selector): Add bfd_name parameter.
11888 (Target_selector::recognize): Make non-virtual, call
11890 (Target_selector::recognize_by_name): Make non-virtual, call
11891 do_recognize_by_name.
11892 (Target_selector::supported_names): New function.
11893 (Target_selector::bfd_name): New function.
11894 (Target_selector::do_instantiate_target): New pure virtual
11896 (Target_selector::do_recognize): New virtual function.
11897 (Target_selector::do_recognize_by_name): New virtual function.
11898 (Target_selector::instantiate_target): New private function.
11899 (supported_target_names): Declare.
11900 * target-select.cc (Target_selector::Target_selector): Update for
11901 new parameter and fields.
11902 (select_target_by_name): Check that the name matches before
11903 calling recognize_by_name.
11904 (supported_target_names): New function.
11905 * i386.cc (class Target_selector_i386): Update Target_selector
11906 constructor call. Remove recognize and recognize_by_name. Add
11907 do_instantiate_target.
11908 * x86_64.cc (class Target_selector_x86_64): Likewise.
11909 * testsuite/testfile.cc (class Target_selector_test): Update for
11910 changes to Target_selector.
11912 * README: Rewrite, with some notes on unsupported features.
11914 2008-03-24 Cary Coutant <ccoutant@google.com>
11916 * i386.cc (Target_i386::Got_type): New enum declaration.
11917 (Target_i386::Scan::local): Updated callers of Output_data_got
11919 (Target_i386::Scan::global): Likewise.
11920 (Target_i386::Relocate::relocate): Likewise.
11921 (Target_i386::Relocate::relocate_tls): Likewise.
11922 * object.h (Got_offset_list): New class.
11923 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11924 (Sized_relobj::local_got_offset): Likewise.
11925 (Sized_relobj::set_local_got_offset): Likewise.
11926 (Sized_relobj::local_has_tls_got_offset): Removed.
11927 (Sized_relobj::local_tls_got_offset): Removed.
11928 (Sized_relobj::set_local_tls_got_offset): Removed.
11929 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11930 * output.cc (Output_data_got::add_global): Added got_type parameter.
11931 (Output_data_got::add_global_with_rel): Likewise.
11932 (Output_data_got::add_global_with_rela): Likewise.
11933 (Output_data_got::add_global_pair_with_rel): New function.
11934 (Output_data_got::add_global_pair_with_rela): New function.
11935 (Output_data_got::add_local): Added got_type parameter.
11936 (Output_data_got::add_local_with_rel): Likewise.
11937 (Output_data_got::add_local_with_rela): Likewise.
11938 (Output_data_got::add_local_pair_with_rel): New function.
11939 (Output_data_got::add_local_pair_with_rela): New function.
11940 (Output_data_got::add_global_tls): Removed.
11941 (Output_data_got::add_global_tls_with_rel): Removed.
11942 (Output_data_got::add_global_tls_with_rela): Removed.
11943 (Output_data_got::add_local_tls): Removed.
11944 (Output_data_got::add_local_tls_with_rel): Removed.
11945 (Output_data_got::add_local_tls_with_rela): Removed.
11946 * output.h (Output_data_got::add_global): Added got_type parameter.
11947 (Output_data_got::add_global_with_rel): Likewise.
11948 (Output_data_got::add_global_with_rela): Likewise.
11949 (Output_data_got::add_global_pair_with_rel): New function.
11950 (Output_data_got::add_global_pair_with_rela): New function.
11951 (Output_data_got::add_local): Added got_type parameter.
11952 (Output_data_got::add_local_with_rel): Likewise.
11953 (Output_data_got::add_local_with_rela): Likewise.
11954 (Output_data_got::add_local_pair_with_rel): New function.
11955 (Output_data_got::add_local_pair_with_rela): New function.
11956 (Output_data_got::add_global_tls): Removed.
11957 (Output_data_got::add_global_tls_with_rel): Removed.
11958 (Output_data_got::add_global_tls_with_rela): Removed.
11959 (Output_data_got::add_local_tls): Removed.
11960 (Output_data_got::add_local_tls_with_rel): Removed.
11961 (Output_data_got::add_local_tls_with_rela): Removed.
11962 * resolve.cc (Symbol::override_base_with_special): Removed
11963 reference to has_got_offset_ field.
11964 * symtab.cc (Symbol::init_fields): Replaced initialization
11965 of got_offset_ with got_offsets_. Removed initialization
11967 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11968 (Symbol::got_offset): Likewise.
11969 (Symbol::set_got_offset): Likewise.
11970 (Symbol::has_tls_got_offset): Removed.
11971 (Symbol::tls_got_offset): Removed.
11972 (Symbol::set_tls_got_offset): Removed.
11973 (Symbol::got_offset_): Removed.
11974 (Symbol::tls_mod_got_offset_): Removed.
11975 (Symbol::tls_pair_got_offset_): Removed.
11976 (Symbol::got_offsets_): New field.
11977 (Symbol::has_got_offset): Removed.
11978 (Symbol::has_tls_mod_got_offset): Removed.
11979 (Symbol::has_tls_pair_got_offset): Removed.
11980 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11981 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11983 (Target_x86_64::Scan::global): Likewise.
11984 (Target_x86_64::Relocate::relocate): Likewise.
11985 (Target_x86_64::Relocate::relocate_tls): Likewise.
11987 2008-03-25 Ben Elliston <bje@au.ibm.com>
11989 * yyscript.y: Fix spelling error in comment.
11991 2008-03-24 Ian Lance Taylor <iant@google.com>
11993 * options.h (class General_options): Define build_id option.
11994 * layout.h (class Layout): Declare write_build_id, create_note,
11995 create_build_id. Add build_id_note_ member.
11996 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11997 "libiberty.h", "md5.h", "sha1.h".
11998 (Layout::Layout): Initialize eh_frame_data_,
11999 eh_frame_hdr_section_, and build_id_note_.
12000 (Layout::finalize): Call create_build_id.
12001 (Layout::create_note): New function, broken out of
12002 Layout::create_gold_note.
12003 (Layout::create_gold_note): Call create_note.
12004 (Layout::create_build_id): New function.
12005 (Layout::write_build_id): New function.
12006 (Close_task_runner::run): Call write_build_id.
12008 * x86_64.cc: Correct license to GPLv3.
12010 2008-03-23 Ian Lance Taylor <iant@google.com>
12012 * options.cc: Include "demangle.h".
12013 (parse_optional_string): New function.
12014 (parse_long_option): Handle takes_optional_argument.
12015 (parse_short_option): Update dash_z initializer. Handle
12016 takes_optional_argument.
12017 (General_options::General_options): Initialize do_demangle_.
12018 (General_options::finalize): Set do_demangle_. Handle demangling
12020 * options.h (parse_optional_string): Declare.
12021 (struct One_option): Add optional_arg field. Update constructor.
12022 Update call constructor calls. Add takes_optional_argument
12024 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12025 (DEFINE_optional_string): Define.
12026 (General_options::demangle): Change from DEFINE_bool to
12027 DEFINE_optional_string.
12028 (General_options::no_demangle): New function.
12029 (General_options::do_demangle): New function.
12030 (General_options::set_do_demangle): New function.
12031 (General_options::execstack_status_): Move definition to end of
12033 (General_options::static_): Likewise.
12034 (General_options::do_demangle_): New field.
12035 * object.cc (big_endian>::get_symbol_location_info): Call
12036 Options::do_demangle, not Options::demangle.
12037 * symtab.cc (demangle): Likewise.
12039 2008-03-22 Ian Lance Taylor <iant@google.com>
12041 * gold.h: Include <cstddef> and <sys/types.h>
12042 * options.h: Include <cstring>.
12044 2008-03-21 Ian Lance Taylor <iant@google.com>
12046 * Added source code to GNU binutils.