1 2011-09-13 Ian Lance Taylor <iant@google.com>
3 * object.cc (Sized_relobj_file::do_layout): Remove unused local
4 variable external_symbols_offset.
6 2011-09-12 Ian Lance Taylor <iant@google.com>
8 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
9 triggered if object has no symbols.
11 2011-09-09 David S. Miller <davem@davemloft.net>
13 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
14 (Output_fill_debug_line::do_write): Likewise.
16 2011-08-29 Cary Coutant <ccoutant@google.com>
18 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
19 casts to match formatting specs.
20 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
22 2011-08-26 Cary Coutant <ccoutant@google.com>
24 * layout.cc (Free_list::allocate): Provide guarantee of minimum
25 remaining hole size when allocating.
26 (Layout::make_output_section): Set fill methods for debug sections.
27 * layout.h (Free_list::Free_list_node): Move from private to
29 (Free_list::set_min_hole_size): New function.
30 (Free_list::begin, Free_list::end): New functions.
31 (Free_list::min_hole_): New data member.
32 * output.cc: Include dwarf.h.
33 (Output_fill_debug_info::do_minimum_hole_size): New function.
34 (Output_fill_debug_info::do_write): New function.
35 (Output_fill_debug_line::do_minimum_hole_size): New function.
36 (Output_fill_debug_line::do_write): New function.
37 (Output_section::Output_section): Initialize new data member.
38 (Output_section::set_final_data_size): Ensure patch space is larger
39 than minimum hole size.
40 (Output_section::do_write): Fill holes in debug sections.
41 * output.h (Output_fill): New class.
42 (Output_fill_debug_info): New class.
43 (Output_fill_debug_line): New class.
44 (Output_section::set_free_space_fill): New function.
45 (Output_section::free_space_fill_): New data member.
46 * testsuite/Makefile.am (incremental_test_3): Add
47 --incremental-patch option.
48 (incremental_test_4): Likewise.
49 (incremental_test_5): Likewise.
50 (incremental_test_6): Likewise.
51 (incremental_copy_test): Likewise.
52 (incremental_common_test_1): Likewise.
53 * testsuite/Makefile.in: Regenerate.
55 2011-08-26 Nick Clifton <nickc@redhat.com>
57 * po/es.po: Updated Spanish translation.
59 2011-08-01 Cary Coutant <ccoutant@google.com>
61 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
62 * gold/testsuite/Makefile.in: Regenerate.
63 * gold/testsuite/justsyms_exec.c: New source file.
64 * gold/testsuite/justsyms_lib.c: New source file.
66 2011-08-01 Cary Coutant <ccoutant@google.com>
68 * layout.cc (Layout::set_segment_offsets): Don't realign text
69 segment if -Ttext was specified.
70 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
72 * object.h (Sized_relobj_file::e_type): New function.
73 (Sized_relobj_file::e_type_): New data member.
74 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
75 base address for ET_EXEC files.
76 * target.cc (Target::do_make_elf_object_implementation): Allow
77 ET_EXEC files with --just-symbols option.
79 2011-07-28 Cary Coutant <ccoutant@google.com>
81 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
82 Add thread_number parameter.
83 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
84 * workqueue-threads.cc
85 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
86 current thread if its thread number is greater than desired thread
88 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
89 Add thread_number parameter.
90 (Workqueue::should_cancel_thread): Likewise.
91 (Workqueue::find_runnable_or_wait): Pass thread_number to
93 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
96 2011-07-22 Sriraman Tallam <tmsriram@google.com>
98 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
99 only after checking if it cannot be forced local.
100 * symtab.h (is_externally_visible): Check if the symbol is not forced
103 2011-07-15 Ian Lance Taylor <iant@google.com>
105 * options.h (class General_options): Add --print-output-format.
106 Move -EL next to -EB, for better --help output.
107 * target-select.cc: Include <cstdio>, "options.h", and
109 (Target_selector::do_target_bfd_name): New function.
110 (print_output_format): New function.
111 * target-select.h (class Target_selector): Update declarations.
112 (Target_selector::target_bfd_name): New function.
113 (print_output_format): Declare.
114 * main.cc: Include "target-select.h".
115 (main): Handle --print-output-format.
116 * gold.cc: Include "target-select.h".
117 (queue_initial_tasks): Handle --print-output-format when there are
119 * parameters.cc (parameters_force_valid_target): Give a better
120 error message if -EB/-EL does not match target.
121 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
124 2011-07-15 Ian Lance Taylor <iant@google.com>
126 * i386.cc (class Output_data_plt_i386): Add layout_ field.
127 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
128 (Output_data_plt_i386::do_write): Write address of .dynamic
129 section to first entry in .got.plt section.
130 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
131 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
133 (Output_data_plt_x86_64::do_write): Write address of .dynamic
134 section to first entry in .got.plt section.
135 * layout.h (Layout::dynamic_section): New function.
137 2011-07-13 Sriraman Tallam <tmsriram@google.com>
139 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
141 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
142 input_section_position_, and input_section_glob_.
143 (read_layout_from_file): Call function section_ordering_specified.
144 * layout.h (is_section_ordering_specified): New function.
145 (section_ordering_specified): New function.
146 (section_ordering_specified_): New boolean member.
147 * main.cc(main): Call load_plugins after layout object is defined.
148 * output.cc (Output_section::add_input_section): Use
149 function section_ordering_specified to check if section ordering is
151 * output.cc (Output_section::add_relaxed_input_section): Use
152 function section_ordering_specified to check if section ordering is
154 (Output_section::update_section_layout): New function.
155 (Output_section::sort_attached_input_sections): Check if input section
157 * output.h (Output_section::update_section_layout): New function.
158 * plugin.cc (get_section_count): New function.
159 (get_section_type): New function.
160 (get_section_name): New function.
161 (get_section_contents): New function.
162 (update_section_order): New function.
163 (allow_section_ordering): New function.
164 (Plugin::load): Add the new interfaces to the transfer vector.
165 (Plugin_manager::load_plugins): New parameter.
166 (Plugin_manager::all_symbols_read): New parameter.
167 (Plugin_manager::claim_file): New parameter. Save the elf object for
169 (Plugin_manager::get_elf_object): New function.
170 (Plugin_manager::get_view): Change to directly use the bool to check
171 if get_view is called from claim_file_hook.
172 * plugin.h (input_objects): New function
173 (Plugin__manager::load_plugins): New parameter.
174 (Plugin_manager::claim_file): New parameter.
175 (Plugin_manager::get_elf_object): New function.
176 (Plugin_manager::in_claim_file_handler): New function.
177 (Plugin_manager::in_claim_file_handler_): New member.
178 (layout): New function.
179 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
180 handler with an extra parameter. Make the elf object before calling
182 * testsuite/plugin_test.c (get_section_count): New function pointer.
183 (get_section_type): New function pointer.
184 (get_section_name): New function pointer.
185 (get_section_contents): New function pointer.
186 (update_section_order): New function pointer.
187 (allow_section_ordering): New function pointer.
188 (onload): Check if the new interfaces exist.
190 2011-07-13 Ian Lance Taylor <iant@google.com>
192 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
194 * x86_64.cc (Target_x86_64::got_section): Likewise.
195 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
196 (relro_now_test_SOURCES): New variable.
197 (relro_now_test_DEPENDENCIES): New variable.
198 (relro_now_test_LDFLAGS): New variable.
199 (relro_now_test_LDADD): New variable.
200 (relro_now_test.so): New target.
201 * testsuite/Makefile.in: Rebuild.
203 2011-07-12 Ian Lance Taylor <iant@google.com>
206 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
207 GLOB_DAT relocation rather than a RELATIVE relocation for a
208 protected symbol when creating a shared library.
209 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
210 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
211 * testsuite/protected_main_1.cc (main): Test that protected
212 function has same address.
214 2011-07-11 Ian Lance Taylor <iant@google.com>
217 * options.h (class General_options): Add -Bgroup.
218 * options.cc (General_options::finalize): If -Bgroup is set,
219 default to --unresolved-symbols=report-all.
220 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
221 * target-reloc.h (issue_undefined_symbol_error): Handle
222 --unresolved-symbols=report-all.
224 2011-07-08 Ian Lance Taylor <iant@google.com>
227 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
228 if linker script discards key sections.
229 (Layout::create_dynamic_symtab): Likewise.
230 (Layout::assign_local_dynsym_offsets): Likewise.
231 (Layout::sized_create_version_sections): Likewise.
232 (Layout::create_interp): Likewise.
233 (Layout::finish_dynamic_section): Likewise.
234 (Layout::set_dynamic_symbol_size): Likewise.
236 2011-07-08 Ian Lance Taylor <iant@google.com>
239 * options.h (class General_options): Add --unresolved-symbols.
240 * target-reloc.h (issue_undefined_symbol_error): Check
241 --unresolved-symbols. Add comments.
243 2011-07-08 Ian Lance Taylor <iant@google.com>
245 * testsuite/odr_violation2.cc (Ordering::operator()): Make
246 expression more complex.
248 2011-07-08 Ian Lance Taylor <iant@google.com>
251 * target-reloc.h (issue_undefined_symbol_error): New inline
252 function, broken out of relocate_section.
253 (relocate_section): Call issue_undefined_symbol_error.
254 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
255 there is no TLS segment if we are about to issue an undefined
257 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
259 2011-07-08 Ian Lance Taylor <iant@google.com>
262 * resolve.cc (Symbol_table::should_override): Add fromtype
263 parameter. Change all callers. Give error when linking together
264 TLS and non-TLS symbol.
265 (Symbol_table::should_override_with_special): Add fromtype
266 parameter. Change all callers.
267 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
268 there is no TLS segment if we have reported some errors.
269 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
271 2011-07-08 Ian Lance Taylor <iant@google.com>
274 * target.h (Target::plt_address_for_global): New function.
275 (Target::plt_address_for_local): New function.
276 (Target::plt_section_for_global): Remove.
277 (Target::plt_section_for_local): Remove.
278 (Target::do_plt_address_for_global): New virtual function.
279 (Target::do_plt_address_for_local): New virtual function.
280 (Target::do_plt_section_for_global): Remove.
281 (Target::do_plt_section_for_local): Remove.
282 (Target::register_global_plt_entry): Add Symbol_table and Layout
284 * output.cc (Output_data_got::Got_entry::write): Use
285 plt_address_for_global and plt_address_for_local.
286 * layout.cc (Layout::add_target_dynamic_tags): Use size and
287 address of output section.
288 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
289 got_irelative_, and irelative_count_ fields. Update
291 (Output_data_plt_i386::has_irelative_section): New function.
292 (Output_data_plt_i386::entry_count): Add irelative_count_.
293 (Output_data_plt_i386::set_final_data_size): Likewise.
294 (class Target_i386): Add got_irelative_ and rel_irelative_
295 fields. Update declarations.
296 (Target_i386::Target_i386): Initialize new fields.
297 (Target_i386::do_plt_address_for_global): New function replacing
298 do_plt_section_for_global.
299 (Target_i386::do_plt_address_for_local): New function replacing
300 do_plt_section_for_local.
301 (Target_i386::got_section): Create got_irelative_.
302 (Target_i386::rel_irelative_section): New function.
303 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
304 fields. Don't define __rel_iplt_{start,end}.
305 (Output_data_plt_i386::add_entry): Add symtab and layout
306 parameters. Change all callers. Use different PLT and GOT for
308 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
309 layout parameters. Change all callers. Use different PLT and
311 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
312 (Output_data_plt_i386::rel_irelative): New function.
313 (Output_data_plt_i386::address_for_global): New function.
314 (Output_data_plt_i386::address_for_local): New function.
315 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
316 IRELATIVE GOT when changing IFUNC GOT entries.
317 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
319 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
320 if we didn't create an IRELATIVE GOT.
321 (Target_i386::Relocate::relocate): Use plt_address_for_global and
322 plt_address_for_local.
323 (Target_i386::do_dynsym_value): Use plt_address_for_global.
324 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
325 got_irelative_, and irelative_count_ fields. Update
327 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
328 Initialize new fields. Remove symtab parameter. Change all
330 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
332 (Output_data_plt_x86_64::has_irelative_section): New function.
333 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
334 (class Target_x86_64): Add got_irelative_ and rel_irelative_
335 fields. Update declarations.
336 (Target_x86_64::Target_x86_64): Initialize new fields.
337 (Target_x86_64::do_plt_address_for_global): New function replacing
338 do_plt_section_for_global.
339 (Target_x86_64::do_plt_address_for_local): New function replacing
340 do_plt_section_for_local.
341 (Target_x86_64::got_section): Create got_irelative_.
342 (Target_x86_64::rela_irelative_section): New function.
343 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
344 all callers. Don't create __rel_iplt_{start,end}.
345 (Output_data_plt_x86_64::add_entry): Add symtab and layout
346 parameters. Change all callers. Use different PLT and GOT for
348 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
349 layout parameters. Change all callers. Use different PLT and
351 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
352 parameters. Change all callers. Use different PLT and GOT for
354 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
355 (Output_data_plt_x86_64::rela_irelative): New function.
356 (Output_data_plt_x86_64::address_for_global): New function.
357 (Output_data_plt_x86_64::address_for_local): New function.
358 (Output_data_plt_x86_64::set_final_data_size): Likewise.
359 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
360 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
361 (Target_x86_64::register_global_plt_entry): Add symtab and layout
363 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
365 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
366 symbols if we didn't create an IRELATIVE GOT.
367 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
368 plt_address_for_local.
369 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
370 * testsuite/ifuncvar1.c: New test file.
371 * testsuite/ifuncvar2.c: New test file.
372 * testsuite/ifuncvar3.c: New test file.
373 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
374 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
375 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
376 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
377 * testsuite/Makefile.in: Rebuild.
379 2011-07-07 Cary Coutant <ccoutant@google.com>
381 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
382 (two_file_test_1_ndebug.o): Likewise.
383 (two_file_test_1b_ndebug.o): Likewise.
384 (two_file_test_2_ndebug.o): Likewise.
385 (two_file_test_main_ndebug.o): Likewise.
386 (incremental_test_2): Link with no-debug versions.
388 2011-07-06 Cary Coutant <ccoutant@google.com>
390 * gold/incremental.cc
391 (Output_section_incremental_inputs::write_info_blocks): Check for
392 hidden and internal symbols.
394 2011-07-06 Cary Coutant <ccoutant@google.com>
396 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
397 Check disposition for startup file.
398 (Incremental_inputs::report_command_line): Ignore
399 --incremental-startup-unchanged option.
400 * options.cc (General_options::parse_incremental_startup_unchanged):
402 (General_options::General_options): Initialize new data member.
403 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
404 (General_options): Add --incremental-startup-unchanged option.
405 (General_options::incremental_startup_disposition): New function.
406 (General_options::incremental_startup_disposition_): New data member.
408 2011-07-06 Cary Coutant <ccoutant@google.com>
410 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
411 input file index to Script_info ctor.
412 (Sized_incremental_binary::do_file_has_changed): Find the
413 command-line argument for files named in scripts.
414 * incremental.h (Script_info::Script_info): New ctor
415 with input file index.
416 (Script_info::input_file_index): New function.
417 (Script_info::input_file_index_): New data member.
418 (Incremental_binary::get_library): Add const.
419 (Incremental_binary::get_script_info): Add const.
420 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
421 * testsuite/Makefile.am (incremental_test_5): New test case.
422 (incremental_test_6): New test case.
423 * testsuite/Makefile.in: Regenerate.
425 2011-07-06 Cary Coutant <ccoutant@google.com>
427 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
428 debug output when command lines differ.
430 2011-07-06 Cary Coutant <ccoutant@google.com>
432 * incremental.cc (Incremental_inputs::report_command_line): Ignore
433 --incremental-patch option.
434 * layout.cc (Free_list::allocate): Extend allocation beyond original
436 (Layout::make_output_section): Mark sections that should get
438 * options.cc (parse_percent): New function.
439 * options.h (parse_percent): New function.
440 (DEFINE_percent): New macro.
441 (General_options): Add --incremental-patch option.
442 * output.cc (Output_section::Output_section): Initialize new data
444 (Output_section::add_input_section): Print section name when out
446 (Output_section::add_output_section_data): Likewise.
447 (Output_section::set_final_data_size): Add patch space when
448 doing --incremental-full.
449 (Output_section::do_reset_address_and_file_offset): Remove patch
451 (Output_segment::set_section_list_addresses): Print debug output
452 only if --incremental-update.
453 * output.h (Output_section::set_is_patch_space_allowed): New function.
454 (Output_section::is_patch_space_allowed_): New data member.
455 (Output_section::patch_space_): New data member.
456 * parameters.cc (Parameters::incremental_full): New function.
457 * parameters.h (Parameters::incremental_full): New function
458 * testsuite/Makefile.am (incremental_test_2): Add test for
459 --incremental-patch option.
460 * testsuite/Makefile.in: Regenerate.
461 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
462 (t18): Remove function body.
464 2011-07-05 Doug Kwan <dougkwan@google.com>
467 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
468 Arm_Address type for relocation result.
469 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
471 (Arm_relocate_functions::abs32): Use unaligned access.
472 (Arm_relocate_functions::rel32): Ditto.
473 (Arm_relocate_functions::prel31): Ditto.
474 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
475 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
476 static data relocations.
477 * testsuite/Makefile.in: Regnerate.
478 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
480 2011-07-05 Ian Lance Taylor <iant@google.com>
483 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
484 symbols if necessary.
485 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
487 2011-07-05 Ian Lance Taylor <iant@google.com>
490 * resolve.cc (Symbol::override_base_with_special): Simply override
491 version with special symbol version, ignoring previous version.
493 2011-07-05 Ian Lance Taylor <iant@google.com>
495 * object.cc (Sized_relobj_file::include_section_group): Add
496 information to comment about signature location.
498 2011-07-02 Ian Lance Taylor <iant@google.com>
501 * options.h (class General_options): Add -f and -F.
502 * options.cc (General_options::finalize): Fatal error if -f/-F
503 are used without -shared.
504 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
506 2011-07-02 Ian Lance Taylor <iant@google.com>
508 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
510 2011-07-01 Ian Lance Taylor <iant@google.com>
514 * resolve.cc (Symbol::override_base_with_special): Don't override
515 the version if the overriding symbol has a different name.
516 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
517 all callers. If we give an error about an undefined version,
518 define the base version if necessary.
519 * dynobj.h (class Versions): Update declaration.
520 * testsuite/weak_alias_test_5.cc: New file.
521 * testsuite/weak_alias_test.script: New file.
522 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
523 and versioned_alias have the right value, and call t2.
524 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
525 weak_alias_test_5.so.
526 (weak_alias_test_LDADD): Likewise.
527 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
528 * testsuite/Makefile.in: Rebuild.
530 2011-07-01 Ian Lance Taylor <iant@google.com>
533 * options.h (class General_options): Support -z notext.
534 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
536 (two_file_shared_nonpic.so): Likewise.
537 (two_file_shared_mixed.so): Likewise.
538 (two_file_shared_mixed_1.so): Likewise.
539 (weak_undef_lib_nonpic.so): Likewise.
540 (alt/weak_undef_lib_nonpic.so): Likewise.
541 (tls_test_shared_nonpic.so): Likewise.
542 * testsuite/Makefile.in: Rebuild.
544 2011-07-01 Ian Lance Taylor <iant@google.com>
547 * configure.ac: Test whether static linking works, setting
548 the automake conditional HAVE_STATIC.
549 * testsuite/Makefile.am: Disable tests using -static if
550 HAVE_STATIC is not true.
551 * configure, testsuite/Makefile.in: Rebuild.
553 2011-07-01 Ian Lance Taylor <iant@google.com>
556 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
557 Assert if we see DW_EH_PE_indirect.
558 * target.h (Target::ehframe_datarel_base): New function.
559 (Target::do_ehframe_datarel_base): New target function.
560 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
561 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
564 2011-07-01 Ian Lance Taylor <iant@google.com>
567 * options.h (class General_options): Add
568 --ld-generated-unwind-info.
569 * ehframe.cc (Fde::write): Add address parameter. Change all
570 callers. If associated with PLT, fill in address and size.
571 (Cie::set_output_offset): Only add merge mapping if there is an
573 (Cie::write): Add address parameter. Change all callers.
574 (Eh_frame::add_ehframe_for_plt): New function.
575 * ehframe.h (class Fde): Update declarations. Move shndx_ and
576 input_offset_ fields into union u_, with new plt field.
577 (Fde::Fde): Adjust for new union field.
578 (Fde::Fde) [Output_data version]: New constructor.
579 (Fde::add_mapping): Only add merge mapping if there is an object.
580 (class Cie): Update declarations.
581 (class Eh_frame): Declare add_ehframe_for_plt.
582 * layout.cc (Layout::layout_eh_frame): Break out code into
583 make_eh_frame_section, and call it.
584 (Layout::make_eh_frame_section): New function.
585 (Layout::add_eh_frame_for_plt): New function.
586 * layout.h (class Layout): Update declarations.
587 * merge.cc (Merge_map::add_mapping): Add assertion.
588 * i386.cc: Include "dwarf.h".
589 (class Output_data_plt_i386): Make first_plt_entry,
590 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
591 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
592 and plt_eh_frame_fde.
593 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
594 boundary. Call add_eh_frame_for_plt if appropriate.
595 * x86_64.cc: Include "dwarf.h".
596 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
597 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
598 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
599 and plt_eh_frame_fde.
600 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
603 2011-06-29 Ian Lance Taylor <iant@google.com>
606 * object.cc (Sized_relobj_file::layout_section): Change shdr
607 parameter to be const.
608 (Sized_relobj_file::layout_eh_frame_section): New function, broken
610 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
611 appropriate. Call layout_eh_frame_section.
612 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
614 * object.h (class Sized_relobj_file): Update declarations.
616 2011-06-29 Ian Lance Taylor <iant@google.com>
619 * script.cc (Token::integer_value): Accept trailing M/m/K/k
621 (Lex::gather_token): Accept trailing M/m/K/k for integers.
623 2011-06-29 Ian Lance Taylor <iant@google.com>
626 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
628 * layout.cc (Layout::layout_eh_frame): Likewise.
630 2011-06-29 Ian Lance Taylor <iant@google.com>
633 * layout.cc (Layout::symtab_section_shndx): New function.
634 * layout.h (class Layout): Declare symtab_section_shndx.
635 * output.cc (Output_section::write_header): Call it.
637 2011-06-29 Ian Lance Taylor <iant@google.com>
640 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
641 symbols which are not used in a relocation.
643 2011-06-28 Ian Lance Taylor <iant@google.com>
646 * layout.cc (Layout::segment_precedes): Don't crash if a linker
647 script create indistinguishable segments.
648 (Layout::set_segment_offsets): Use stable_sort when sorting
649 segments. Pass this to Compare_segments constructor.
650 * layout.h (class Layout): Make segment_precedes non-static.
651 (class Compare_segments): Change from struct to class. Add
652 layout_ field. Add constructor.
654 (Script_sections::attach_sections_using_phdrs_clause): Rename
655 local orphan to is_orphan. Don't report failure to put empty
656 section in segment. On attachment failure, report name of
657 section, and attach to first PT_LOAD segment.
659 2011-06-28 Ian Lance Taylor <iant@google.com>
662 * target-select.cc (Target_selector::Target_selector): Add
663 emulation parameter. Change all callers.
664 (select_target_by_bfd_name): Rename from select_target_by_name.
666 (select_target_by_emulation): New function.
667 (supported_emulation_names): New function.
668 * target-select.h (class Target_selector): Add emulation_ field.
670 (Target_selector::recognize_by_bfd_name): Rename from
671 recognize_by_name. Change all callers.
672 (Target_selector::supported_bfd_names): Rename from
673 supported_names. Change all callers.
674 (Target_selector::recognize_by_emulation): New function.
675 (Target_selector::supported_emulations): New function.
676 (Target_selector::emulation): New function.
677 (Target_selector::do_recognize_by_bfd_name): Rename from
678 do_recognize_by_name. Change all callers.
679 (Target_selector::do_supported_bfd_names): Rename from
680 do_supported_names. Change all callers.
681 (Target_selector::do_recognize_by_emulation): New function.
682 (Target_selector::do_supported_emulations): New function.
683 (select_target_by_bfd_name): Change name in declaration.
684 (select_target_by_emulation): Declare.
685 (supported_emulation_names): Declare.
686 * parameters.cc (parameters_force_valid_target): Try to find
687 target based on emulation from -m option.
688 * options.h (class General_options): Change doc string for -m.
689 * options.cc (help): Print emulations.
690 (General_options::parse_V): Likewise.
691 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
692 Add emulation parameter. Change all callers.
694 2011-06-28 Ian Lance Taylor <iant@google.com>
696 * target.h (class Target): Add osabi_ field.
697 (Target::osabi): New function.
698 (Target::set_osabi): New function.
699 (Target::Target): Initialize osabi_.
700 (Target::do_adjust_elf_header): Make pure virtual.
701 (Sized_target::do_adjust_elf_header): Declare.
702 * target.cc (Sized_target::do_adjust_elf_header): New function.
703 (class Sized_target): Instantiate all versions.
704 * freebsd.h (class Target_freebsd): Remove.
705 (Target_selector_freebsd::do_recognize): Call set_osabi on
707 (Target_selector_freebsd::do_recognize_by_name): Likewise.
708 (Target_selector_freebsd::set_osabi): Remove.
709 * i386.cc (class Target_i386): Inherit from Sized_target rather
711 * x86_64.cc (class Target_x86_64): Likewise.
713 2011-06-28 Ian Lance Taylor <iant@google.com>
715 * target.h (Target::can_check_for_function_pointers): Rewrite.
717 (Target::can_icf_inline_merge_sections): Likewise.
718 (Target::section_may_have_icf_unsafe_poineters): Likewise.
719 (Target::Target_info): Add can_icf_inline_merge_sections field.
720 (Target::do_can_check_for_function_pointers): New virtual
722 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
723 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
724 from can_check_for_function_pointers, move in file.
725 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
726 section_may_have_icf_unsafe_poineters, move in file.
727 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
728 * i386.cc (Target_i386::do_can_check_for_function_pointers):
729 Rename from can_check_for_function_pointers, move in file.
730 (Target_i386::can_icf_inline_merge_sections): Remove.
731 (Target_i386::i386_info): Initialize
732 can_icf_inline_merge_sections.
733 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
734 Initialize can_icf_inline_merge_sections.
735 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
736 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
737 Rename from can_check_for_function_pointers, move in file.
738 (Target_x86_64::can_icf_inline_merge_sections): Remove.
739 (Target_x86_64::x86_64_info): Initialize
740 can_icf_inline_merge_sections.
741 * testsuite/testfile.cc (Target_test::test_target_info):
743 * icf.cc (get_section_contents): Correct formatting.
745 2011-06-27 Ian Lance Taylor <iant@google.com>
747 * symtab.cc (Symbol::versioned_name): New function.
748 (Symbol_table::add_to_final_symtab): Use versioned_name when
750 (Symbol_table::sized_write_symbol): Likewise.
751 * symtab.h (class Symbol): Declare versioned_name.
752 * stringpool.h (class Stringpool_template): Add variant of add
753 which takes a std::basic_string.
754 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
755 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
756 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
757 (ver_test_12.o): New target.
758 * testsuite/Makefile.in: Rebuild.
760 2011-06-27 Doug Kwan <dougkwan@google.com>
762 * arm.cc (Arm_relocate_functions::thm_jump8,
763 Arm_relocate_functions::thm_jump11): Use a wider signed
764 type to compute offset.
765 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
767 * testsuite/Makefile.in: Regenerate.
768 * testsuite/arm_branch_in_range.sh: Check test results of
769 arm_thm_jump11 and arm_thm_jump8.
770 * testsuite/arm_thm_jump11.s: New test source file.
771 * testsuite/arm_thm_jump11.t: New linker script.
772 * testsuite/arm_thm_jump8.s: New test source file.
773 * testsuite/arm_thm_jump8.t: New linker script.
775 2011-06-24 Ian Lance Taylor <iant@google.com>
777 * layout.cc: Include "object.h".
778 (ctors_sections_in_init_array): New static variable.
779 (Layout::is_ctors_in_init_array): New function.
780 (Layout::layout): Add entry to ctors_sections_in_init_array if
782 * layout.h (class Layout): Declare is_ctors_in_init_array.
783 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
784 is_ctors_reverse_view is set.
785 (Sized_relobj_file::write_sections): Add layout parameter. Change
786 all callers. Set is_ctors_reverse_view field of View_size.
787 (Sized_relobj_file::reverse_words): New function.
788 * object.h (Sized_relobj_file::View_size): Add
789 is_ctors_reverse_view field.
790 (class Sized_relobj_file): Update declarations.
791 * testsuite/initpri3.c: New test.
792 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
794 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
795 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
796 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
797 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
798 * testsuite/Makefile.in: Rebuild.
800 2011-06-24 Cary Coutant <ccoutant@google.com>
802 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
803 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
804 (debug_msg_cdebug.err): New targets.
805 * testsuite/Makefile.in: Regenerate.
806 * testsuite/debug_msg.sh: Check output of link with compressed debug.
807 Fix checks for link with shared library.
809 2011-06-24 Doug Kwan <dougkwan@google.com>
811 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
812 skip empty text sections.
813 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
815 2011-06-22 Ian Lance Taylor <iant@google.com>
818 * options.h (class General_options): Add --ctors-in-init-array.
819 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
820 friends as SHT_PROGBITS for merging sections.
821 (Layout::layout): Remove special handling of .init_array and
822 friends. Don't sort if doing relocatable link. Sort for .ctors
823 and .dtors if ctors_in_init_array.
824 (Layout::make_output_section): Force correct section types for
825 .init_array and friends. Don't sort if doing relocatable link,
826 Don't sort .ctors and .dtors if ctors_in_init_array.
827 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
828 (Layout::output_section_name): Add relobj parameter. Change all
829 callers. Handle .ctors. and .dtors. in code rather than table.
830 Handle .ctors and .dtors if ctors_in_init_array.
831 (Layout::match_file_name): New function, moved from output.cc.
832 * layout.h (class Layout): Update declarations.
833 * output.cc: Include "layout.h".
834 (Input_section_sort_entry::get_priority): New function.
835 (Input_section_sort_entry::match_file_name): Just call
836 Layout::match_file_name.
837 (Output_section::Input_section_sort_init_fini_compare::operator()):
838 Handle .ctors and .dtors. Sort by explicit priority rather than
840 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
841 * testsuite/initpri2.c: New test.
842 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
843 (check_PROGRAMS): Add initpri2.
844 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
845 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
846 * configure, testsuite/Makefile.in: Rebuild.
848 2011-06-19 Ian Lance Taylor <iant@google.com>
851 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
852 .interp section to a PT_INTERP segment even if we have seen a
853 --dynamic-linker option. Don't do it if we have seen a PHDRS
854 clause in a linker script.
855 (Layout::finalize): Don't create a .interp section if we've
856 already create a PT_INTERP segment.
857 (Layout::create_interp): Always call choose_output_section (revert
858 patch of 2011-06-17). Don't create PT_INTERP segment.
860 (Script_sections::create_note_and_tls_segments): Add a .interp
861 section to a PT_INTERP segment even if we have seen a
862 --dynamic-linker option.
864 2011-06-18 Ian Lance Taylor <iant@google.com>
866 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
867 merely because a non-PT_LOAD segment has a dynamic reloc.
869 2011-06-18 Ian Lance Taylor <iant@google.com>
871 * layout.cc (Layout::finish_dynamic_section): Don't create
872 DT_FLAGS entry if not needed.
874 2011-06-18 Ian Lance Taylor <iant@google.com>
877 * layout.cc (Layout::layout_eh_frame): Correct handling of
878 writable .eh_frame section.
880 2011-06-17 Ian Lance Taylor <iant@google.com>
883 * resolve.cc (Symbol_table::resolve): Don't give an error if a
884 symbol is redefined with the exact same object and value.
886 2011-06-17 Ian Lance Taylor <iant@google.com>
889 * layout.h (class Layout): Add interp_segment_ field.
890 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
891 (Layout::attach_allocated_section_to_segment): If making shared
892 library, put .interp section in PT_INTERP segment.
893 (Layout::finalize): Also call create_interp if -dynamic-linker
895 (Layout::create_interp): Assert that there is no PT_INTERP
896 segment. If not using a SECTIONS clause, use make_output_section.
897 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
899 (Script_sections::create_note_and_tls_segments): If making shared
900 library, put .interp section in PT_INTERP segment.
902 2011-06-17 Ian Lance Taylor <iant@google.com>
904 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
905 when making a shared library.
907 2011-06-17 Ian Lance Taylor <iant@google.com>
909 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
910 parameter. Change all callers. Don't issue warning about PC32
911 against locally defined symbol.
913 2011-06-16 Ian Lance Taylor <iant@google.com>
915 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
916 occurs in same object.
918 2011-06-14 Alan Modra <amodra@gmail.com>
920 * po/POTFILES.in: Regenerate.
922 2011-06-09 Ian Lance Taylor <iant@google.com>
925 (Orphan_output_section::set_section_addresses): For a relocatable
926 link set address to 0.
928 2011-06-09 Cary Coutant <ccoutant@google.com>
931 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
932 used with --compress-debug-sections.
933 * gold/object.cc (Sized_relobj_file::do_layout): Report
934 uncompressed size of compressed input sections.
936 2011-06-08 Cary Coutant <ccoutant@google.com>
939 * testsuite/two_file_test_2_v1.cc: Change initialization of
940 v2 to keep it in .data.
942 2011-06-07 Cary Coutant <ccoutant@google.com>
944 * common.cc (Symbol_table::do_allocate_commons_list): Call
946 * errors.cc (Errors::fatal): Adjust call to gold_exit.
947 (Errors::fallback): New function.
948 (gold_fallback): New function.
949 * errors.h (Errors::fallback): New function.
950 * gold.cc (gold_exit): Change status parameter to enum; adjust
952 (queue_initial_tasks): Call gold_fallback.
953 * gold.h: Include cstdlib.
954 (Exit_status): New enum type.
955 (gold_exit): Change status parameter to enum.
956 (gold_fallback): New function.
957 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
958 (Layout::create_symtab_sections): Likewise.
959 (Layout::create_shdrs): Likewise.
960 * main.cc (main): Adjust call to gold_exit.
961 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
962 (Output_data_got::add_got_entry_pair): Likewise.
963 (Output_section::add_input_section): Likewise.
964 (Output_section::add_output_section_data): Likewise.
965 (Output_segment::set_section_list_addresses): Likewise.
966 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
968 2011-06-07 Cary Coutant <ccoutant@google.com>
970 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
971 for incremental links.
972 * output.cc (Output_segment::set_section_list_addresses): Remove
973 FIXME and test for TLS or BSS.
975 2011-06-07 Cary Coutant <ccoutant@google.com>
977 * testsuite/Makefile.am: Add incremental_copy_test,
978 incremental_common_test_1.
979 * testsuite/Makefile.in: Regenerate.
980 * testsuite/common_test_1_v1.c: New source file.
981 * testsuite/common_test_1_v2.c: New source file.
982 * testsuite/copy_test_v1.cc: New source file.
984 2011-06-07 Cary Coutant <ccoutant@google.com>
986 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
987 update, allocate common from bss section's free list.
988 * incremental-dump.cc (dump_incremental_inputs): Print flag for
989 linker-defined symbols.
990 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
991 Skip GOT and PLT entries that are no longer referenced.
992 (Output_section_incremental_inputs::write_info_blocks): Mark
993 linker-defined symbols.
994 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
995 * output.cc (Output_section::allocate): New function.
996 * output.h (Output_section::allocate): New function.
997 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
998 linker-defined symbols.
999 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1000 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1001 (Symbol::init_base_output_data): Likewise.
1002 (Symbol::init_base_output_segment): Likewise.
1003 (Symbol::init_base_constant): Likewise.
1004 (Sized_symbol::init_output_data): Likewise.
1005 (Sized_symbol::init_output_segment): Likewise.
1006 (Sized_symbol::init_constant): Likewise.
1007 (Symbol_table::do_define_in_output_data): Likewise.
1008 (Symbol_table::do_define_in_output_segment): Likewise.
1009 (Symbol_table::do_define_as_constant): Likewise.
1010 * symtab.h (Symbol::is_predefined): New function.
1011 (Symbol::init_base_output_data): Add is_predefined parameter.
1012 (Symbol::init_base_output_segment): Likewise.
1013 (Symbol::init_base_constant): Likewise.
1014 (Symbol::is_predefined_): New data member.
1015 (Sized_symbol::init_output_data): Add is_predefined parameter.
1016 (Sized_symbol::init_output_segment): Likewise.
1017 (Sized_symbol::init_constant): Likewise.
1018 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1020 2011-06-07 Cary Coutant <ccoutant@google.com>
1022 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1023 instead of emit_copy_reloc.
1024 (Copy_relocs::emit_copy_reloc): Refactor.
1025 (Copy_relocs::make_copy_reloc): New function.
1026 (Copy_relocs::add_copy_reloc): Remove.
1027 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1029 (Copy_relocs::make_copy_reloc): New function.
1030 (Copy_relocs::add_copy_reloc): Remove.
1031 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1032 unchanged input files.
1033 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1034 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1035 Reserve BSS space for COPY relocations.
1036 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1037 (Output_section_incremental_inputs::write_info_blocks): Record
1038 whether a symbol is copied from a shared object.
1039 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1040 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1041 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1042 (Incremental_input_entry_reader::get_output_symbol_index): Add
1044 (Incremental_binary::emit_copy_relocs): New function.
1045 (Incremental_binary::do_emit_copy_relocs): New function.
1046 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1048 (Sized_incremental_binary::add_copy_reloc): New function.
1049 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1050 (Sized_incremental_binary::Copy_reloc): New struct.
1051 (Sized_incremental_binary::Copy_relocs): New typedef.
1052 (Sized_incremental_binary::copy_relocs_): New data member.
1053 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1054 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1055 * target.h (Sized_target::emit_copy_reloc): New function.
1056 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1058 2011-06-02 Cary Coutant <ccoutant@google.com>
1061 * gold/archive.cc (Archive::Archive): Initialize new data member.
1062 (Archive::include_all_members): Return if archive has already been
1064 * gold/archive.h (Archive::include_all_members_): New data member.
1066 2011-06-02 Nick Clifton <nickc@redhat.com>
1068 * dynobj.h: Fix spelling mistake in comment.
1069 * output.cc: Likewise.
1071 2011-05-31 Doug Kwan <dougkwan@google.com>
1075 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1076 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1077 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1078 redundant arm_exidx_test.so.
1079 * testsuite/Makefile.in: Regenerate.
1080 (check_SCRIPTS): Add pr12826.sh
1081 (check_DATA): Add pr12826.stdout
1082 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1083 * testsuite/pr12826.sh: New file.
1084 * testsuite/pr12826_1.s: Ditto.
1085 * testsuite/pr12826_1.s: Ditto.
1087 2011-05-30 Ian Lance Taylor <iant@google.com>
1089 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1092 2011-05-29 Ian Lance Taylor <iant@google.com>
1095 * testsuite/Makefile.am: Use different file name for two_file_test
1096 temporary file for each incremental test.
1097 * testsuite/Makefile.in: Rebuild.
1099 2011-05-29 Ian Lance Taylor <iant@google.com>
1101 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1102 binary input file is empty.
1104 2011-05-27 Ian Lance Taylor <iant@google.com>
1106 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1107 (ver_test_9.so): Likewise.
1108 * testsuite/Makefile.in: Rebuild.
1110 2011-05-26 Cary Coutant <ccoutant@google.com>
1112 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1113 * incremental.cc (Incremental_inputs::report_input_section): Fix
1114 comment, indentation.
1115 (Incremental_inputs::report_comdat_group): New function.
1116 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1117 of data for incremental input file entry.
1118 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1119 group count, COMDAT group signatures.
1120 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1121 an unchanged input file.
1122 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1123 Initialize new data member.
1124 (Incremental_object_entry::add_comdat_group): New function.
1125 (Incremental_object_entry::get_comdat_group_count): New function.
1126 (Incremental_object_entry::get_comdat_signature_key): New function.
1127 (Incremental_object_entry::groups_): New data member.
1128 (Incremental_inputs::report_comdat_group): New function.
1129 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1130 data for incremental input file entry.
1131 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1132 (Incremental_input_entry_reader::get_input_section): Adjust size of
1133 data for incremental input file entry.
1134 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1135 (Incremental_input_entry_reader::get_comdat_group_signature): New
1137 * object.cc (Sized_relobj::include_section_group): Report kept
1138 COMDAT groups for incremental links.
1140 2011-05-24 David Meyer <pdox@google.com>
1142 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1143 with name parameter. Add found_name parameter.
1144 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1145 * dirsearch.h (class Dirsearch): Update declaration.
1147 2011-05-24 Ian Lance Taylor <iant@google.com>
1149 * archive.cc (Library_base::should_include_member): Pull in object
1150 from archive if it defines the entry symbol.
1151 * parameters.cc (Parameters::entry): New function.
1152 * parameters.h (class Parameters): Declare entry.
1153 * output.h (class Output_file_header): Remove entry_ field.
1154 * output.cc (Output_file_header::Output_file_header): Remove entry
1155 parameter. Change all callers.
1156 (Output_file_header::entry): Use parameters->entry.
1157 * gold.cc (queue_middle_tasks): Likewise.
1158 * plugin.cc (Plugin_hook::run): Likewise.
1160 2011-05-24 Cary Coutant <ccoutant@google.com>
1162 * gold.cc (queue_initial_tasks): Pass incremental base filename
1163 to Output_file::open_base_file; don't print error message.
1164 * incremental-dump.cc (main): Adjust call to
1165 Output_file::open_for_modification.
1166 * incremental-dump.cc (main): Likewise.
1167 * incremental.cc (Incremental_inputs::report_command_line):
1168 Ignore --incremental-base option when comparing command lines.
1169 Ignore parameter when given as separate argument.
1170 * options.h (class General_options): Add --incremental-base.
1171 * output.cc (Output_file::Output_file):
1172 (Output_file::open_base_file): Add base_name and writable parameters;
1173 read base file into new file; print error message here.
1174 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1176 * output.h (Output_file::open_for_modification): Rename to...
1177 (Output_file::open_base_file): ...this; add base_name and
1178 writable parameters; adjust all callers.
1179 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1181 * testsuite/Makefile.am (incremental_test_4): Test
1183 * testsuite/Makefile.in: Regenerate.
1185 2011-05-24 Cary Coutant <ccoutant@google.com>
1187 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1189 * testsuite/Makefile.in: Regenerate.
1190 * testsuite/two_file_test_1_v1.cc: New test source file.
1191 * testsuite/two_file_test_1b_v1.cc: New test source file.
1192 * testsuite/two_file_test_2_v1.cc: New test source file.
1194 2011-05-24 Cary Coutant <ccoutant@google.com>
1196 * dynobj.h (Dynobj::do_dynobj): New function.
1197 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1198 flag and soname for shared objects.
1199 * incremental.cc (Incremental_inputs::report_object): Make
1200 either Incremental_object_entry or Incremental_dynobj_entry; add
1201 soname to string table.
1202 (Incremental_inputs::report_input_section): Add assertion.
1203 (Output_section_incremental_inputs::set_final_data_size): Adjust
1204 type of input file entry for shared libraries; adjust size of
1205 shared library info entry.
1206 (Output_section_incremental_inputs::write_input_files): Write
1207 as_needed flag for shared libraries.
1208 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1209 of input file entry for shared libraries; write soname.
1210 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1211 soname from incremental info.
1212 * incremental.h (enum Incremental_input_flags): Add
1213 INCREMENTAL_INPUT_AS_NEEDED.
1214 (Incremental_input_entry::Incremental_input_entry): Initialize new
1216 (Incremental_input_entry::set_as_needed): New function.
1217 (Incremental_input_entry::as_needed): New function.
1218 (Incremental_input_entry::do_dynobj_entry): New function.
1219 (Incremental_input_entry::as_needed_): New data member.
1220 (Incremental_object_entry::Incremental_object_entry): Don't check
1222 (Incremental_object_entry::do_type): Likewise.
1223 (class Incremental_dynobj_entry): New class.
1224 (Incremental_input_entry_reader::as_needed): New function.
1225 (Incremental_input_entry_reader::get_soname): New function.
1226 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1227 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1228 size of shared library info entry.
1229 * layout.cc (Layout::finish_dynamic_section): Don't test for
1230 incremental link when adding DT_NEEDED entries.
1231 * object.h (Object::Object): Initialize new data member.
1232 (Object::dynobj): New function.
1233 (Object::set_as_needed): New function.
1234 (Object::as_needed): New function.
1235 (Object::do_dynobj): New function.
1236 (Object::as_needed_): New data member.
1238 2011-05-24 Cary Coutant <ccoutant@google.com>
1240 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1241 info; adjust display of GOT entries.
1242 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1243 vector of input objects; remove file_status_.
1244 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1245 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1246 got_plt reader; call target hooks to reserve GOT entries.
1247 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1248 of input file info header and GOT info entry.
1249 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1251 (Got_plt_view_info::got_descriptor): Remove.
1252 (Got_plt_view_info::sym_index): New data member.
1253 (Got_plt_view_info::input_index): New data member.
1254 (Local_got_offset_visitor::visit): Write input file index.
1255 (Global_got_offset_visitor::visit): Write 0 for input file index.
1256 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1257 with sym_index and input_index.
1258 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1259 incremental info GOT entry; replace got_descriptor with input_index.
1260 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1261 map from input file index to object.
1262 (Sized_relobj_incr::do_layout): Replace direct data member reference
1263 with accessor function.
1264 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1265 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1266 Adjust size of input file info header.
1267 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1268 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1269 (Incremental_input_entry_reader::get_input_section): Adjust size of
1270 input file info header.
1271 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1272 of incremental info GOT entry.
1273 (Incremental_got_plt_reader::get_got_desc): Remove.
1274 (Incremental_got_plt_reader::get_got_symndx): New function.
1275 (Incremental_got_plt_reader::get_got_input_index): New function.
1276 (Sized_incremental_binary::Sized_incremental_binary): Remove
1277 file_status_; add input_objects_.
1278 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1279 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1280 (Sized_incremental_binary::file_is_unchanged): Remove.
1281 (Sized_incremental_binary::set_input_object): New function.
1282 (Sized_incremental_binary::input_object): New function.
1283 (Sized_incremental_binary::file_status_): Remove.
1284 (Sized_incremental_binary::input_objects_): New data member.
1285 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1287 (Sized_relobj_incr::invalid_address): Move to base class.
1288 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1290 (Sized_relobj_incr::do_output_section_offset): Likewise.
1291 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1292 (Sized_relobj_incr::section_offsets_): Likewise.
1293 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1295 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1296 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1297 with accessor function.
1298 (Sized_relobj_file::do_layout): Likewise.
1299 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1300 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1301 (Sized_relobj_file::compute_final_local_value): Replace refs to
1302 section_offsets_ with accessor function.
1303 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1304 * object.h (Relobj::Relobj): Initialize new data members.
1305 (Relobj::add_dyn_reloc): New function.
1306 (Relobj::first_dyn_reloc): New function.
1307 (Relobj::dyn_reloc_count): New function.
1308 (Relobj::first_dyn_reloc_): New data member.
1309 (Relobj::dyn_reloc_count_): New data member.
1310 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1312 (Sized_relobj::Address): New typedef.
1313 (Sized_relobj::invalid_address): Move here from child class.
1314 (Sized_relobj::Sized_relobj): Initialize new data members.
1315 (Sized_relobj::sized_relobj): New function.
1316 (Sized_relobj::is_output_section_offset_invalid): Move here from
1318 (Sized_relobj::get_output_section_offset): Likewise.
1319 (Sized_relobj::local_has_got_offset): Likewise.
1320 (Sized_relobj::local_got_offset): Likewise.
1321 (Sized_relobj::set_local_got_offset): Likewise.
1322 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1323 (Sized_relobj::clear_got_offsets): New function.
1324 (Sized_relobj::section_offsets): Move here from child class.
1325 (Sized_relobj::do_output_section_offset): Likewise.
1326 (Sized_relobj::do_set_section_offset): Likewise.
1327 (Sized_relobj::Local_got_offsets): Likewise.
1328 (Sized_relobj::local_got_offsets_): Likewise.
1329 (Sized_relobj::section_offsets_): Likewise.
1330 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1332 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1334 (Sized_relobj_file::sized_relobj): New function
1335 (Sized_relobj_file::local_has_got_offset): Move to base class.
1336 (Sized_relobj_file::local_got_offset): Likewise.
1337 (Sized_relobj_file::set_local_got_offset): Likewise.
1338 (Sized_relobj_file::get_output_section_offset): Likewise.
1339 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1340 (Sized_relobj_file::do_output_section_offset): Likewise.
1341 (Sized_relobj_file::do_set_section_offset): Likewise.
1342 (Sized_relobj_file::Local_got_offsets): Likewise.
1343 (Sized_relobj_file::local_got_offsets_): Likewise.
1344 (Sized_relobj_file::section_offsets_): Likewise.
1345 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1347 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1348 (Output_reloc::get_symbol_index): Likewise.
1349 (Output_reloc::local_section_offset): Likewise.
1350 (Output_reloc::get_address): Likewise.
1351 (Output_reloc::symbol_value): Likewise.
1352 (Output_data_got::reserve_slot): Move to class definition.
1353 (Output_data_got::reserve_local): New function.
1354 (Output_data_got::reserve_slot_for_global): Remove.
1355 (Output_data_got::reserve_global): New function.
1356 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1357 (all constructors, two instantiations).
1358 (Output_reloc::get_relobj): New function (two instantiations).
1359 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1360 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1361 (Output_data_reloc::add_global): Adjust type of relobj.
1362 (Output_data_reloc::add_global_relative): Likewise.
1363 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1364 (Output_data_reloc::add_local): Likewise.
1365 (Output_data_reloc::add_local_relative): Likewise.
1366 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1367 (Output_data_reloc::add_local_section): Likewise.
1368 (Output_data_reloc::add_output_section): Likewise.
1369 (Output_data_reloc::add_absolute): Likewise.
1370 (Output_data_reloc::add_target_specific): Likewise.
1371 (Output_data_got::reserve_slot): Move definition here.
1372 (Output_data_got::reserve_local): New function.
1373 (Output_data_got::reserve_global): New function.
1374 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1375 section_offsets_ with accessor function.
1376 (Sized_relobj_file::write_sections): Likewise.
1377 (Sized_relobj_file::do_relocate_sections): Likewise.
1378 * target.h (Sized_target::reserve_local_got_entry): New function.
1379 (Sized_target::reserve_global_got_entry): New function.
1380 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1381 (Target_x86_64::reserve_global_got_entry): New function.
1382 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1384 2011-05-23 Cary Coutant <ccoutant@google.com>
1386 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1387 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1388 bit when checking got_type.
1389 * incremental.cc (Sized_incremental_binary::setup_readers):
1390 Store symbol table and string table locations; initialize bit vector
1391 of file status flags.
1392 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1394 (Sized_incremental_binary::do_process_got_plt): New function.
1395 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1396 (Output_section_incremental_inputs::set_final_data_size): Record
1397 file index for each input file.
1398 (Output_section_incremental_inputs::write_got_plt): Store file index
1399 instead of input entry offset for each GOT entry.
1401 (Incremental_input_entry::Incremental_input_entry): Initialize new
1403 (Incremental_input_entry::set_offset): Store file index.
1404 (Incremental_input_entry::get_file_index): New function.
1405 (Incremental_input_entry::file_index_): New data member.
1406 (Incremental_binary::process_got_plt): New function.
1407 (Incremental_binary::do_process_got_plt): New function.
1408 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1410 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1411 (Sized_incremental_binary::set_file_is_unchanged): New function.
1412 (Sized_incremental_binary::file_is_unchanged): New function.
1413 (Sized_incremental_binary::do_process_got_plt): New function.
1414 (Sized_incremental_binary::file_status_): New data member.
1415 (Sized_incremental_binary::main_symtab_loc_): New data member.
1416 (Sized_incremental_binary::main_strtab_loc_): New data member.
1417 * output.cc (Output_data_got::Got_entry::write): Add case
1419 (Output_data_got::add_global): Call add_got_entry.
1420 (Output_data_got::add_global_plt): Likewise.
1421 (Output_data_got::add_global_with_rel): Likewise.
1422 (Output_data_got::add_global_with_rela): Likewise.
1423 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1424 (Output_data_got::add_global_pair_with_rela): Likewise.
1425 (Output_data_got::add_local): Call add_got_entry.
1426 (Output_data_got::add_local_plt): Likewise.
1427 (Output_data_got::add_local_with_rel): Likewise.
1428 (Output_data_got::add_local_with_rela): Likewise.
1429 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1430 (Output_data_got::add_local_pair_with_rela): Likewise.
1431 (Output_data_got::reserve_slot): New function.
1432 (Output_data_got::reserve_slot_for_global): New function.
1433 (Output_data_got::add_got_entry): New function.
1434 (Output_data_got::add_got_entry_pair): New function.
1435 (Output_section::add_output_section_data): Edit FIXME.
1437 (Output_section_data_build::Output_section_data_build): New
1438 constructor with size parameter.
1439 (Output_data_space::Output_data_space): Likewise.
1440 (Output_data_got::Output_data_got): Initialize new data member; new
1441 constructor with size parameter.
1442 (Output_data_got::add_constant): Call add_got_entry.
1443 (Output_data_got::reserve_slot): New function.
1444 (Output_data_got::reserve_slot_for_global): New function.
1445 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1446 (Output_data_got::add_got_entry): New function.
1447 (Output_data_got::add_got_entry_pair): New function.
1448 (Output_data_got::free_list_): New data member.
1449 * target.h (Sized_target::init_got_plt_for_update): New function.
1450 (Sized_target::register_global_plt_entry): New function.
1451 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1452 Initialize new data member; call init; add constructor with PLT count.
1453 (Output_data_plt_x86_64::init): New function.
1454 (Output_data_plt_x86_64::add_relocation): New function.
1455 (Output_data_plt_x86_64::reserve_slot): New function.
1456 (Output_data_plt_x86_64::free_list_): New data member.
1457 (Target_x86_64::init_got_plt_for_update): New function.
1458 (Target_x86_64::register_global_plt_entry): New function.
1459 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1460 incremental updates.
1461 (Output_data_plt_x86_64::add_relocation): New function.
1462 * testsuite/object_unittest.cc (Object_test): Set default options.
1464 2011-05-16 Ian Lance Taylor <iant@google.com>
1466 * options.h (class General_options): Make -i a synonym for -r.
1468 2011-05-16 Ian Lance Taylor <iant@google.com>
1470 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1472 2011-05-10 Cary Coutant <ccoutant@google.com>
1474 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1477 2011-05-06 Ian Lance Taylor <iant@google.com>
1479 * layout.cc (Layout::layout): If the output section flags change,
1480 update the ordering.
1482 2011-04-25 Cary Coutant <ccoutant@google.com>
1484 * incremental-dump.cc (dump_incremental_inputs): Print local
1485 symbol info for each input file.
1487 (Output_section_incremental_inputs::set_final_data_size): Add local
1488 symbol info to input file entries in incremental info.
1489 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1490 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1491 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1492 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1494 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1495 (Sized_incr_relobj::do_relocate): Write the local symbols.
1496 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1497 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1498 Adjust size of input file header.
1499 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1500 (Incremental_inputs_reader::get_local_symbol_count): New function.
1501 (Incremental_inputs_reader::get_input_section): Adjust size of input
1503 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1504 (Sized_incr_relobj::This): New typedef.
1505 (Sized_incr_relobj::sym_size): New const data member.
1506 (Sized_incr_relobj::Local_symbol): New struct.
1507 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1508 (Sized_incr_relobj::do_local_symbol_offset): New function.
1509 (Sized_incr_relobj::local_symbol_count_): New data member.
1510 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1511 (Sized_incr_relobj::local_symbol_index_): New data member.
1512 (Sized_incr_relobj::local_symbol_offset_): New data member.
1513 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1514 (Sized_incr_relobj::local_symbols_): New data member.
1515 * object.h (Relobj::output_local_symbol_count): New function.
1516 (Relobj::local_symbol_offset): New function.
1517 (Relobj::do_output_local_symbol_count): New function.
1518 (Relobj::do_local_symbol_offset): New function.
1519 (Sized_relobj::do_output_local_symbol_count): New function.
1520 (Sized_relobj::do_local_symbol_offset): New function.
1522 2011-04-22 Vladimir Simonov <sv@sw.ru>
1524 * descriptors.cc (set_close_on_exec): New function.
1525 (Descriptors::open): Use set_close_on_exec.
1526 * output.cc (S_ISLNK): Define if not defined.
1528 2011-04-22 Cary Coutant <ccoutant@google.com>
1530 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1532 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1533 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1534 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1536 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1537 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1538 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1540 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1542 (Incremental_binary::apply_incremental_relocs): New function.
1543 (Incremental_binary::do_apply_incremental_relocs): New function.
1544 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1546 (Sized_incremental_binary::add_global_symbol): New function.
1547 (Sized_incremental_binary::global_symbol): New function.
1548 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1549 (Sized_incremental_binary::symbol_map_): New data member.
1550 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1551 * target.h (Sized_target::apply_relocation): New function.
1552 * target-reloc.h (apply_relocation): New function.
1553 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1555 2011-04-22 Doug Kwan <dougkwan@google.com>
1557 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1558 flag of a SHT_ARM_EXIDX section.
1559 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1560 * testsuite/Makefile.in: Regenerate.
1561 * testsuite/arm_exidx_test.s: New file.
1562 * testsuite/arm_exidx_test.sh: Same.
1564 2011-04-20 Cary Coutant <ccoutant@google.com>
1567 * archive.h (Incremental_archive_entry::Archive_member):
1568 Initialize arg_serial_ (second constructor).
1570 2011-04-17 Ian Lance Taylor <iant@google.com>
1572 * object.cc (Relocate_info::location): Simplify location string.
1573 * errors.cc (Errors::error_at_location): Don't print program
1575 (Errors::warning_at_location): Likewise.
1576 (Errors::undefined_symbol): Likewise.
1577 * testsuite/debug_msg.sh: Update accordingly.
1579 2011-04-14 Cary Coutant <ccoutant@google.com>
1581 * gold/layout.cc (Layout::symtab_section_offset): New function.
1582 * gold/layout.h (Layout::symtab_section_offset): New function.
1583 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1585 2011-04-12 Ian Lance Taylor <iant@google.com>
1587 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1588 with MREMAP_MAYMOVE.
1589 * output.h (class Output_file): Add map_is_allocated_ field.
1590 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1591 not available, provide stubs. If mremap is not available, #define
1593 (MREMAP_MAYMOVE): Define if not defined.
1594 (Output_file::Output_file): Initialize map_is_allocated_.
1595 (Output_file::resize): Check map_is_allocated_.
1596 (Output_file::map_anonymous): If mmap fails, use malloc.
1597 (Output_file::unmap): Don't do anything for an anonymous map.
1598 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1599 is not available, provide stubs.
1600 (File_read::View::~View): Use free rather than delete[].
1601 (File_read::make_view): Use malloc rather than new[]. If mmap
1603 (File_read::find_or_make_view): Use malloc rather than new[].
1604 * gold.h: Remove HAVE_REMAP code.
1605 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1606 exists. Rename mremap to gold_mremap. If mmap is not available
1608 * configure, config.in: Rebuild.
1610 2011-04-11 Ian Lance Taylor <iant@google.com>
1612 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1613 initialize local variable v.
1615 2011-04-11 Cary Coutant <ccoutant@google.com>
1617 * archive.cc (Archive::include_member): Adjust call to
1619 (Add_archive_symbols::run): Track argument serial numbers.
1620 (Lib_group::include_member): Likewise.
1621 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1622 * archive.h (Incremental_archive_entry::Archive_member):
1623 Initialize arg_serial_.
1624 (Archive_member::arg_serial_): New data member.
1625 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1626 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1628 (Sized_dynobj::do_for_all_local_got_entries): New function.
1629 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1631 * fileread.cc (get_mtime): New function.
1632 * fileread.h (get_mtime): New function.
1633 * gold.cc (queue_initial_tasks): Check for incremental update.
1634 (process_incremental_input): New function.
1635 (queue_middle_tasks): Don't force valid target for incremental
1637 * incremental-dump.cc (find_input_containing_global): Adjust
1638 size of symbol info entry.
1639 (dump_incremental_inputs): Dump argument serial number and
1640 in_system_directory flag; bias shndx by 1; print symbol names
1641 when dumping per-file symbol lists; use new symbol info readers.
1643 (Output_section_incremental_inputs:update_data_size): New function.
1644 (Sized_incremental_binary::setup_readers): Setup input readers
1645 for each input file; build maps for files added from libraries
1647 (Sized_incremental_binary::check_input_args): New function.
1648 (Sized_incremental_binary::do_check_inputs): Build map of argument
1649 serial numbers to input arguments.
1650 (Sized_incremental_binary::do_file_has_changed): Rename
1651 do_file_is_unchanged to this; compare file modification times.
1652 (Sized_incremental_binary::do_init_layout): New function.
1653 (Sized_incremental_binary::do_reserve_layout): New function.
1654 (Sized_incremental_binary::do_get_input_reader): Remove.
1655 (Sized_incremental_binary::get_symtab_view): New function.
1656 (Incremental_checker::can_incrementally_link_output_file): Remove.
1657 (Incremental_inputs::report_command_line): Exclude --debug options.
1658 (Incremental_inputs::report_archive_begin): Add parameter; track
1659 argument serial numbers; don't put input file entry for archive
1660 before archive members.
1661 (Incremental_inputs::report_archive_end): Put input file entry
1662 for archive after archive members.
1663 (Incremental_inputs::report_object): Add parameter; track argument
1664 serial numbers and in_system_directory flag.
1665 (Incremental_inputs::report_script): Add parameter; track argument
1667 (Output_section_incremental_inputs::set_final_data_size): Adjust
1668 size of symbol info entry; check for forwarding symbols.
1669 (Output_section_incremental_inputs::write_input_files): Write
1670 in_system_directory flag and argument serial number.
1671 (Output_section_incremental_inputs::write_info_blocks): Map section
1672 indices between incremental info and original input file; store
1673 input section index for each symbol.
1674 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1675 change operator() to visit().
1676 (class Global_got_offset_visitor): Likewise.
1677 (class Global_symbol_visitor_got_plt):
1678 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1680 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1681 (Sized_incr_relobj::do_read_symbols): New function.
1682 (Sized_incr_relobj::do_layout): New function.
1683 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1684 (Sized_incr_relobj::do_add_symbols): New function.
1685 (Sized_incr_relobj::do_should_include_member): New function.
1686 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1687 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1688 (Sized_incr_relobj::do_section_size): New function.
1689 (Sized_incr_relobj::do_section_name): New function.
1690 (Sized_incr_relobj::do_section_contents): New function.
1691 (Sized_incr_relobj::do_section_flags): New function.
1692 (Sized_incr_relobj::do_section_entsize): New function.
1693 (Sized_incr_relobj::do_section_address): New function.
1694 (Sized_incr_relobj::do_section_type): New function.
1695 (Sized_incr_relobj::do_section_link): New function.
1696 (Sized_incr_relobj::do_section_info): New function.
1697 (Sized_incr_relobj::do_section_addralign): New function.
1698 (Sized_incr_relobj::do_initialize_xindex): New function.
1699 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1700 (Sized_incr_relobj::do_read_relocs): New function.
1701 (Sized_incr_relobj::do_gc_process_relocs): New function.
1702 (Sized_incr_relobj::do_scan_relocs): New function.
1703 (Sized_incr_relobj::do_count_local_symbols): New function.
1704 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1705 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1706 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1707 (Sized_incr_relobj::do_relocate): New function.
1708 (Sized_incr_relobj::do_set_section_offset): New function.
1709 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1710 (Sized_incr_dynobj::do_read_symbols): New function.
1711 (Sized_incr_dynobj::do_layout): New function.
1712 (Sized_incr_dynobj::do_add_symbols): New function.
1713 (Sized_incr_dynobj::do_should_include_member): New function.
1714 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1715 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1716 (Sized_incr_dynobj::do_section_size): New function.
1717 (Sized_incr_dynobj::do_section_name): New function.
1718 (Sized_incr_dynobj::do_section_contents): New function.
1719 (Sized_incr_dynobj::do_section_flags): New function.
1720 (Sized_incr_dynobj::do_section_entsize): New function.
1721 (Sized_incr_dynobj::do_section_address): New function.
1722 (Sized_incr_dynobj::do_section_type): New function.
1723 (Sized_incr_dynobj::do_section_link): New function.
1724 (Sized_incr_dynobj::do_section_info): New function.
1725 (Sized_incr_dynobj::do_section_addralign): New function.
1726 (Sized_incr_dynobj::do_initialize_xindex): New function.
1727 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1728 (make_sized_incremental_object): New function.
1729 (Incremental_library::copy_unused_symbols): New function.
1730 (Incremental_library::do_for_all_unused_symbols): New function.
1731 * incremental.h (enum Incremental_input_flags): New type.
1732 (class Incremental_checker): Remove.
1733 (Incremental_input_entry::Incremental_input_entry): Add argument
1735 (Incremental_input_entry::arg_serial): New function.
1736 (Incremental_input_entry::set_is_in_system_directory): New function.
1737 (Incremental_input_entry::is_in_system_directory): New function.
1738 (Incremental_input_entry::arg_serial_): New data member.
1739 (Incremental_input_entry::is_in_system_directory_): New data member.
1740 (class Script_info): Move here from script.h.
1741 (Script_info::Script_info): Add filename parameter.
1742 (Script_info::filename): New function.
1743 (Script_info::filename_): New data member.
1744 (Incremental_script_entry::Incremental_script_entry): Add argument
1746 (Incremental_object_entry::Incremental_object_entry): Likewise.
1747 (Incremental_object_entry::add_input_section): Build list of input
1748 sections with map to original shndx.
1749 (Incremental_object_entry::get_input_section_index): New function.
1750 (Incremental_object_entry::shndx_): New data member.
1751 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1752 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1753 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1755 (Incremental_inputs::report_archive_begin): Likewise.
1756 (Incremental_inputs::report_object): Likewise.
1757 (Incremental_inputs::report_script): Likewise.
1758 (class Incremental_global_symbol_reader): New class.
1759 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1760 and store flags and input file type.
1761 (Incremental_input_entry_reader::arg_serial): New function.
1762 (Incremental_input_entry_reader::type): Extract type from flags.
1763 (Incremental_input_entry_reader::is_in_system_directory): New function.
1764 (Incremental_input_entry_reader::get_input_section_count): Call
1765 accessor function for type.
1766 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1767 function for type; adjust size of global symbol entry.
1768 (Incremental_input_entry_reader::get_global_symbol_count): Call
1769 accessor function for type.
1770 (Incremental_input_entry_reader::get_object_count): Likewise.
1771 (Incremental_input_entry_reader::get_object_offset): Likewise.
1772 (Incremental_input_entry_reader::get_member_count): Likewise.
1773 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1774 (Incremental_input_entry_reader::get_member_offset): Likewise.
1775 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1776 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1777 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1778 (Incremental_input_entry_reader::get_global_symbol_reader): New
1780 (Incremental_input_entry_reader::get_output_symbol_index): New
1782 (Incremental_input_entry_reader::type_): Remove.
1783 (Incremental_input_entry_reader::flags_): New data member.
1784 (Incremental_inputs_reader::input_file_offset): New function.
1785 (Incremental_inputs_reader::input_file_index): New function.
1786 (Incremental_inputs_reader::input_file): Call input_file_offset.
1787 (Incremental_inputs_reader::input_file_at_offset): New function.
1788 (Incremental_relocs_reader::get_r_type): Reformat.
1789 (Incremental_relocs_reader::get_r_shndx): Reformat.
1790 (Incremental_relocs_reader::get_r_offset): Reformat.
1791 (Incremental_relocs_reader::data): New function.
1792 (Incremental_binary::Incremental_binary): Initialize new data members.
1793 (Incremental_binary::check_inputs): Add cmdline parameter.
1794 (Incremental_binary::file_is_unchanged): Remove.
1795 (Input_reader::arg_serial): New function.
1796 (Input_reader::get_unused_symbol_count): New function.
1797 (Input_reader::get_unused_symbol): New function.
1798 (Input_reader::do_arg_serial): New function.
1799 (Input_reader::do_get_unused_symbol_count): New function.
1800 (Input_reader::do_get_unused_symbol): New function.
1801 (Incremental_binary::input_file_count): New function.
1802 (Incremental_binary::get_input_reader): Change signature to use
1803 index instead of filename.
1804 (Incremental_binary::file_has_changed): New function.
1805 (Incremental_binary::get_input_argument): New function.
1806 (Incremental_binary::get_library): New function.
1807 (Incremental_binary::get_script_info): New function.
1808 (Incremental_binary::init_layout): New function.
1809 (Incremental_binary::reserve_layout): New function.
1810 (Incremental_binary::output_file): New function.
1811 (Incremental_binary::do_check_inputs): New function.
1812 (Incremental_binary::do_file_is_unchanged): Remove.
1813 (Incremental_binary::do_file_has_changed): New function.
1814 (Incremental_binary::do_init_layout): New function.
1815 (Incremental_binary::do_reserve_layout): New function.
1816 (Incremental_binary::do_input_file_count): New function.
1817 (Incremental_binary::do_get_input_reader): Change signature.
1818 (Incremental_binary::input_args_map_): New data member.
1819 (Incremental_binary::library_map_): New data member.
1820 (Incremental_binary::script_map_): New data member.
1821 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1823 (Sized_incremental_binary::output_section): New function.
1824 (Sized_incremental_binary::inputs_reader): Add const.
1825 (Sized_incremental_binary::symtab_reader): Add const.
1826 (Sized_incremental_binary::relocs_reader): Add const.
1827 (Sized_incremental_binary::got_plt_reader): Add const.
1828 (Sized_incremental_binary::get_symtab_view): New function.
1829 (Sized_incremental_binary::Inputs_reader): New typedef.
1830 (Sized_incremental_binary::Input_entry_reader): New typedef.
1831 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1832 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1833 (Sized_incremental_binary::do_file_has_changed): New function.
1834 (Sized_incremental_binary::do_init_layout): New function.
1835 (Sized_incremental_binary::do_reserve_layout): New function.
1836 (Sized_input_reader::Inputs_reader): Remove.
1837 (Sized_input_reader::Input_entry_reader): Remove.
1838 (Sized_input_reader::do_arg_serial): New function.
1839 (Sized_input_reader::do_get_unused_symbol_count): New function.
1840 (Sized_input_reader::do_get_unused_symbol): New function.
1841 (Sized_incremental_binary::do_input_file_count): New function.
1842 (Sized_incremental_binary::do_get_input_reader): Change signature;
1843 use index instead of filename.
1844 (Sized_incremental_binary::section_map_): New data member.
1845 (Sized_incremental_binary::input_entry_readers_): New data member.
1846 (class Sized_incr_relobj): New class.
1847 (class Sized_incr_dynobj): New class.
1848 (make_sized_incremental_object): New function.
1849 (class Incremental_library): New class.
1850 * layout.cc (Free_list::num_lists): New static data member.
1851 (Free_list::num_nodes): New static data member.
1852 (Free_list::num_removes): New static data member.
1853 (Free_list::num_remove_visits): New static data member.
1854 (Free_list::num_allocates): New static data member.
1855 (Free_list::num_allocate_visits): New static data member.
1856 (Free_list::init): New function.
1857 (Free_list::remove): New function.
1858 (Free_list::allocate): New function.
1859 (Free_list::dump): New function.
1860 (Free_list::print_stats): New function.
1861 (Layout_task_runner::run): Resize output file for incremental updates.
1862 (Layout::Layout): Initialize new data members.
1863 (Layout::set_incremental_base): New function.
1864 (Layout::init_fixed_output_section): New function.
1865 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1866 incremental updates.
1867 (Layout::create_gold_note): Do not create gold note section for
1868 incremental updates.
1869 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1870 for incremental updates.
1871 (Layout::set_section_offsets): For incremental updates, allocate space
1873 (Layout::create_symtab_sections): Layout with offsets relative to
1874 start of section; for incremental updates, allocate space from free
1876 (Layout::create_shdrs): For incremental updates, allocate space from
1878 (Layout::finish_dynamic_section): For incremental updates, do not
1879 check --as-needed (fixed in subsequent patch).
1880 * layout.h (class Free_list): New class.
1881 (Layout::set_incremental_base): New function.
1882 (Layout::incremental_base): New function.
1883 (Layout::init_fixed_output_section): New function.
1884 (Layout::allocate): New function.
1885 (Layout::incremental_base_): New data member.
1886 (Layout::free_list_): New data member.
1887 * main.cc (main): Print Free_list statistics.
1888 * object.cc (Relobj::finalize_incremental_relocs): Add
1889 clear_counts parameter; clear counts only when clear_counts is set.
1890 (Sized_relobj::Sized_relobj): Initialize new base class.
1891 (Sized_relobj::do_layout): Don't report special sections.
1892 (Sized_relobj::do_for_all_local_got_entries): New function.
1893 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1894 symtab_off to all symbol table offsets.
1895 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1896 * object.h (class Got_offset_list): Move to top of file.
1897 (Object::Object): Allow case where input_file == NULL.
1898 (Object::~Object): Likewise.
1899 (Object::input_file): Assert that input_file != NULL.
1900 (Object::lock): Allow case where input_file == NULL.
1901 (Object::unlock): Likewise.
1902 (Object::is_locked): Likewise.
1903 (Object::token): Likewise.
1904 (Object::release): Likewise.
1905 (Object::is_incremental): New function.
1906 (Object::get_mtime): New function.
1907 (Object::for_all_local_got_entries): New function.
1908 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1909 (Object::set_is_in_system_directory): New function.
1910 (Object::is_in_system_directory): New function.
1911 (Object::do_is_incremental): New function.
1912 (Object::do_get_mtime): New function.
1913 (Object::do_for_all_local_got_entries): New function.
1914 (Object::is_in_system_directory_): New data member.
1915 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1916 (class Sized_relobj_base): New class.
1917 (class Sized_relobj): Derive from Sized_relobj_base.
1918 (class Sized_relobj::Symbols): Redeclare from base class.
1919 (class Sized_relobj::local_got_offset_list): Remove.
1920 (class Sized_relobj::Output_sections): Redeclare from base class.
1921 (class Sized_relobj::do_for_all_local_got_entries): New function.
1922 (class Sized_relobj::write_local_symbols): Add offset parameter.
1923 (class Sized_relobj::local_symbol_offset_): Update comment.
1924 (class Sized_relobj::local_dynsym_offset_): Update comment.
1925 * options.cc (Input_arguments::add_file): Remove const.
1926 * options.h (Input_file_argument::Input_file_argument):
1927 Initialize arg_serial_ (all constructors).
1928 (Input_file_argument::set_arg_serial): New function.
1929 (Input_file_argument::arg_serial): New function.
1930 (Input_file_argument::arg_serial_): New data member.
1931 (Input_arguments::Input_arguments): Initialize file_count_.
1932 (Input_arguments::add_file): Remove const.
1933 (Input_arguments::number_of_input_files): New function.
1934 (Input_arguments::file_count_): New data member.
1935 (Command_line::number_of_input_files): Call
1936 Input_arguments::number_of_input_files.
1937 * output.cc (Output_segment_headers::Output_segment_headers):
1939 (Output_section::Input_section::current_data_size): New function.
1940 (Output_section::Output_section): Initialize new data members.
1941 (Output_section::add_input_section): Don't do merge sections for
1942 an incremental link; allocate space from free list for an
1944 (Output_section::add_output_section_data): Allocate space from
1945 free list for an incremental update.
1946 (Output_section::update_data_size): New function.
1947 (Output_section::set_fixed_layout): New function.
1948 (Output_section::reserve): New function.
1949 (Output_segment::set_section_addresses): Remove const.
1950 (Output_segment::set_section_list_addresses): Remove const; allocate
1951 space from free list for an incremental update.
1952 (Output_segment::set_offset): Adjust size of RELRO segment for an
1954 * output.h (Output_data::current_data_size): Move here from
1956 (Output_data::pre_finalize_data_size): New function.
1957 (Output_data::update_data_size): New function.
1958 (Output_section_headers::update_data_size): new function.
1959 (Output_section_data_build::current_data_size): Move to Output_data.
1960 (Output_data_strtab::update_data_size): New function.
1961 (Output_section::current_data_size): Move to Output_data.
1962 (Output_section::set_fixed_layout): New function.
1963 (Output_section::has_fixed_layout): New function.
1964 (Output_section::reserve): New function.
1965 (Output_section::update_data_size): New function.
1966 (Output_section::has_fixed_layout_): New data member.
1967 (Output_section::free_list_): New data member.
1968 (Output_segment::set_section_addresses): Remove const.
1969 (Output_segment::set_section_list_addresses): Remove const.
1970 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1972 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1974 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1975 parameter when calling Add_symbols constructor; store argument
1976 serial number for members of a lib group.
1977 (Add_symbols::locks): Allow case where token == NULL.
1978 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1979 (Read_member::~Read_member): New function.
1980 (Read_member::is_runnable): New function.
1981 (Read_member::locks): New function.
1982 (Read_member::run): New function.
1983 (Check_script::~Check_script): New function.
1984 (Check_script::is_runnable): New function.
1985 (Check_script::locks): New function.
1986 (Check_script::run): New function.
1987 (Check_library::~Check_library): New function.
1988 (Check_library::is_runnable): New function.
1989 (Check_library::locks): New function.
1990 (Check_library::run): New function.
1991 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1992 (Add_symbols::library_): New data member.
1993 (class Read_member): New class.
1994 (class Check_script): New class.
1995 (class Check_library): New class.
1996 * reloc.cc (Read_relocs::is_runnable): Allow case where
1998 (Read_relocs::locks): Likewise.
1999 (Scan_relocs::locks): Likewise.
2000 (Relocate_task::locks): Likewise.
2001 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2003 (Sized_relobj::incremental_relocs_scan): Fix comment.
2004 (Sized_relobj::do_relocate): Pass output file offset to
2005 write_local_symbols.
2006 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2007 from class declaration.
2008 * script.cc (read_input_script): Allocate Script_info; pass
2009 argument serial number to report_script.
2010 * script.h (class Script_info): Move to incremental.h.
2011 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2012 * symtab.h (Symbol_table::add_from_incrobj): New function.
2013 (Symbol_table::set_file_offset): New function.
2015 2011-04-05 Cary Coutant <ccoutant@google.com>
2017 * incremental-dump.cc (dump_incremental_inputs): Change signature
2018 to take a Sized_incremental_binary; change caller. Use readers
2019 in Sized_incremental_binary.
2021 (Sized_incremental_binary::find_incremental_inputs_sections):
2022 Rename do_find_incremental_inputs_sections to this.
2023 (Sized_incremental_binary::setup_readers): New function.
2024 (Sized_incremental_binary::do_check_inputs): Check
2025 has_incremental_info_ flag; move setup code to setup_readers;
2027 (Sized_incremental_binary::do_file_is_unchanged): New function.
2028 (Sized_incremental_binary::do_get_input_reader): New function.
2029 * incremental.h (class Incremental_binary): Move to end of file.
2030 (Incremental_binary::file_is_unchanged): New function.
2031 (Incremental_binary::do_file_is_unchanged): New function.
2032 (Incremental_binary::Input_reader): New class.
2033 (Incremental_binary::get_input_reader): New function.
2034 (class Sized_incremental_binary): Move to end of file.
2035 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2036 input section reader classes.
2037 (Sized_incremental_binary::has_incremental_info): New function.
2038 (Sized_incremental_binary::inputs_reader): New function.
2039 (Sized_incremental_binary::symtab_reader): New function.
2040 (Sized_incremental_binary::relocs_reader): New function.
2041 (Sized_incremental_binary::got_plt_reader): New function.
2042 (Sized_incremental_binary::do_file_is_unchanged): New function.
2043 (Sized_incremental_binary::Sized_input_reader): New class.
2044 (Sized_incremental_binary::get_input_reader): New function.
2045 (Sized_incremental_binary::find_incremental_inputs_sections):
2046 Rename do_find_incremental_inputs_sections to this.
2047 (Sized_incremental_binary::setup_readers): New function.
2048 (Sized_incremental_binary::has_incremental_info_): New data member.
2049 (Sized_incremental_binary::inputs_reader_): New data member.
2050 (Sized_incremental_binary::symtab_reader_): New data member.
2051 (Sized_incremental_binary::relocs_reader_): New data member.
2052 (Sized_incremental_binary::got_plt_reader_): New data member.
2053 (Sized_incremental_binary::current_input_file_): New data member.
2055 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2058 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2061 2011-03-30 Cary Coutant <ccoutant@google.com>
2063 * archive.cc (Archive::include_member): Adjust call to report_object.
2064 (Add_archive_symbols::run): Add script_info to call to
2065 report_archive_begin.
2066 (Lib_group::include_member): Adjust call to report_object.
2067 (Add_lib_group_symbols::run): Adjust call to report_object.
2068 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2069 blocks. Add object count for script input files.
2070 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2071 script_info parameter; change all callers.
2072 (Incremental_inputs::report_object): Add script_info parameter;
2074 (Incremental_inputs::report_script): Store backpointer to
2075 incremental info entry.
2076 (Output_section_incremental_inputs::set_final_data_size): Record
2077 additional information for scripts.
2078 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2079 * incremental.h (Incremental_script_entry::add_object): New function.
2080 (Incremental_script_entry::get_object_count): New function.
2081 (Incremental_script_entry::get_object): New function.
2082 (Incremental_script_entry::objects_): New data member; adjust
2084 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2085 (Incremental_inputs::report_object): Add script_info parameter.
2086 (Incremental_inputs_reader::get_object_count): New function.
2087 (Incremental_inputs_reader::get_object_offset): New function.
2088 * options.cc (Input_arguments::add_file): Return reference to
2090 * options.h (Input_argument::set_script_info): New function.
2091 (Input_argument::script_info): New function.
2092 (Input_argument::script_info_): New data member; adjust all
2094 (Input_file_group::add_file): Return reference to new input argument.
2095 (Input_file_lib::add_file): Likewise.
2096 (Input_arguments::add_file): Likewise.
2097 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2098 * script.cc (Parser_closure::Parser_closure): Add script_info
2099 parameter; adjust all callers.
2100 (Parser_closure::script_info): New function.
2101 (Parser_closure::script_info_): New data member.
2102 (read_input_script): Report scripts earlier to incremental info.
2103 (script_add_file): Set script_info in Input_argument.
2104 (script_add_library): Likewise.
2105 * script.h (Script_options::Script_info): Rewrite class.
2107 2011-03-29 Cary Coutant <ccoutant@google.com>
2109 * archive.cc (Library_base::should_include_member): Move
2110 method here from class Archive.
2111 (Archive::Archive): Initialize base class.
2112 (Archive::should_include_member): Move to base class.
2113 (Archive::do_for_all_unused_symbols): New function.
2114 (Add_archive_symbols::run): Remove redundant access to
2116 (Lib_group::Lib_group): Initialize base class.
2117 (Lib_group::do_filename): New function.
2118 (Lib_group::include_member): Pass pointer to Lib_group to
2120 (Lib_group::do_for_all_unused_symbols): New function.
2121 (Add_lib_group_symbols::run): Report archive information for
2123 * archive.h (class Library_base): New base class.
2124 (class Archive): Derive from Library_base.
2125 (Archive::filename): Move to base class.
2126 (Archive::set_incremental_info): Likewise.
2127 (Archive::incremental_info): Likewise.
2128 (Archive::Should_include): Likewise.
2129 (Archive::should_include_member): Likewise.
2130 (Archive::Armap_entry): Remove.
2131 (Archive::Unused_symbol_iterator): Remove.
2132 (Archive::unused_symbols_begin): Remove.
2133 (Archive::unused_symbols_end): Remove.
2134 (Archive::do_filename): New function.
2135 (Archive::do_get_mtime): New function.
2136 (Archive::do_for_all_unused_symbols): New function.
2137 (Archive::task_): Move to base class.
2138 (Archive::incremental_info_): Likewise.
2139 (class Lib_group): Derive from Library_base.
2140 (Lib_group::do_filename): New function.
2141 (Lib_group::do_get_mtime): New function.
2142 (Lib_group::do_for_all_unused_symbols): New function.
2143 (Lib_group::task_): Move to base class.
2144 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2146 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2148 * incremental.cc (Incremental_inputs::report_archive_begin):
2149 Use Library_base; call library's get_mtime; add incremental inputs
2150 entry before members.
2151 (class Unused_symbol_visitor): New class.
2152 (Incremental_inputs::report_archive_end): Use Library_base; use
2153 visitor class to record unused symbols; don't add incremental inputs
2154 entry after members.
2155 (Incremental_inputs::report_object): Use Library_base.
2157 (Incremental_archive_entry::Incremental_archive_entry): Remove
2158 unused Archive parameter.
2159 (Incremental_inputs::report_archive_begin): Use Library_base.
2160 (Incremental_inputs::report_archive_end): Likewise.
2161 (Incremental_inputs::report_object): Likewise.
2162 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2164 * object.h (Object::for_all_global_symbols): New function.
2165 (Object::do_for_all_global_symbols): New function.
2166 (Sized_relobj::do_for_all_global_symbols): New function.
2167 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2169 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2172 2011-03-27 Ian Lance Taylor <iant@google.com>
2174 * archive.cc (Archive::interpret_header): Return -1 if something
2175 goes wrong. Change callers accordingly.
2177 2011-03-25 Cary Coutant <ccoutant@google.com>
2179 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2180 * testsuite/Makefile.in: Regenerate.
2182 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2184 * plugin.cc (get_view): New.
2185 (Plugin::load): Pass get_view to the plugin.
2186 (Plugin_manager::get_view): New.
2188 2011-03-21 Ian Lance Taylor <iant@google.com>
2190 * testsuite/final_layout.sh: Rewrite to not use dc.
2191 * testsuite/relro_test.sh: Fail if dc is not present.
2193 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2195 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2197 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2198 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2200 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2201 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2203 2011-03-14 Ian Lance Taylor <iant@google.com>
2205 * script-sections.cc (Sort_output_sections::script_compare):
2206 Rename from is_before, change return type.
2207 (Sort_output_sections::operator()): Adjust accordingly.
2209 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2212 * testsuite/odr_violation2.cc: Add comment to make all error line
2213 numbers double digits.
2214 * testsuite/debug_msg.sh: Adjust expected errors.
2216 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2218 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2219 but mark earlier ones as non-canonical
2220 (offset_to_iterator): Update search target and example
2221 (do_addr2line): Return extra lines in a vector*
2222 (format_file_lineno): Extract from do_addr2line
2223 (one_addr2line): Add vector* out-param
2224 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2225 when a lineno entry appeared last for its instruction
2226 (Dwarf_line_info): Add vector* out-param
2227 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2228 * symtab.cc (Odr_violation_compare): Include the lineno in the
2230 (linenos_from_loc): New. Combine the canonical line for an
2231 address with its other lines.
2232 (True_if_intersect): New. Helper functor to make
2233 std::set_intersection a query.
2234 (detect_odr_violations): Compare sets of lines instead of just
2235 one line for each function. This became less deterministic, but
2236 has fewer false positives.
2237 * symtab.h: Declarations.
2238 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2239 mix an optimized and non-optimized object in the same binary
2240 (odr_violation2.so): Same.
2241 * testsuite/Makefile.in: Regenerate from Makefile.am.
2242 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2243 * testsuite/debug_msg.sh: Update line numbers and add
2245 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2246 non-optimized context.
2247 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2248 isn't inlined, and use OdrDerived in an optimized context.
2249 * testsuite/odr_header1.h: Defines OdrDerived, where
2250 optimization will change the
2251 first-instruction-in-the-destructor's file and line number.
2252 * testsuite/odr_header2.h: Defines OdrBase.
2254 2011-03-09 Ian Lance Taylor <iant@google.com>
2256 * fileread.cc (File_read::clear_views): Don't delete the whole
2259 2011-03-08 Ian Lance Taylor <iant@google.com>
2262 * fileread.cc: #include <climits>.
2263 (GOLD_IOV_MAX): Define.
2264 (File_read::read_multiple): Limit number of entries by iov_max.
2265 * fileread.h (class File_read): Always set max_readv_entries to
2268 2011-03-07 Ian Lance Taylor <iant@google.com>
2271 * options.h (class General_options): Add -dy and -dn.
2273 2011-03-02 Cary Coutant <ccoutant@google.com>
2275 * testsuite/script_test_9.t: Add TLS segment.
2277 2011-03-02 Simon Baldwin <simonb@google.com>
2279 * configure.ac: Add check for gnu_indirect_function support in
2280 the toolchain building binutils.
2281 * configure: Rebuild.
2283 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2285 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2286 plugin only symbols.
2287 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2288 in plugin files as not needed in the symbol table.
2290 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2292 * output.cc (Output_section::add_input_section): Delay fill
2293 generation for section ordering.
2295 2011-02-09 Ian Lance Taylor <iant@google.com>
2298 * object.h (class Sized_relobj): Remove clear_local_symbols.
2299 * reloc.cc (Sized_relobj::do_relocate): Don't call
2300 clear_local_symbols.
2302 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2304 * plugin.cc (is_visible_from_outside): Return true for symbols
2307 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2309 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2312 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2314 * icf.h (is_section_foldable_candidate): Change type of parameter
2316 * icf.cc (Icf::find_identical_sections): Change type of local variable
2317 section_name to be std::string.
2318 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2320 2011-01-25 Ian Lance Taylor <iant@google.com>
2322 * script.cc (script_add_extern): Rewrite to use
2323 add_symbol_reference.
2325 2011-01-25 Doug Kwan <dougkwan@google.com>
2327 * icf.cc (get_section_contents): Always lock section's object.
2329 2011-01-24 Ian Lance Taylor <iant@google.com>
2331 * options.h (class General_options): Accept
2332 --no-detect-odr-violations.
2334 2011-01-24 Ian Lance Taylor <iant@google.com>
2336 * version.cc (version_string): Bump to 1.11.
2338 2011-01-24 Ian Lance Taylor <iant@google.com>
2340 * plugin.cc (class Plugin_rescan): Define new class.
2341 (Plugin_manager::claim_file): Set any_claimed_.
2342 (Plugin_manager::save_archive): New function.
2343 (Plugin_manager::save_input_group): New function.
2344 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2346 (Plugin_manager::new_undefined_symbol): New function.
2347 (Plugin_manager::rescan): New function.
2348 (Plugin_manager::rescannable_defines): New function.
2349 (Plugin_manager::add_input_file): Set any_added_.
2350 * plugin.h (class Plugin_manager): define new fields rescannable_,
2351 undefined_symbols_, any_claimed_, and any_added_. Declare
2352 Plugin_rescan as friend. Declare new functions.
2353 (Plugin_manager::Rescannable): Define type.
2354 (Plugin_manager::Rescannable_list): Define type.
2355 (Plugin_manager::Undefined_symbol_list): Define type.
2356 (Plugin_manager::Plugin_manager): Initialize new fields.
2357 * archive.cc (Archive::defines_symbol): New function.
2358 (Add_archive_symbols::run): Pass archive to plugins if any.
2359 * archive.h (class Archive): Declare defines_symbol.
2360 * readsyms.cc (Input_group::~Input_group): New function.
2361 (Finish_group::run): Pass input_group to plugins if any.
2362 * readsyms.h (class Input_group): Declare destructor.
2363 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2366 2011-01-10 Ian Lance Taylor <iant@google.com>
2368 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2370 (Layout::set_segment_offsets): Reset increase_relro before calling
2371 set_section_addresses a second time.
2373 2011-01-04 Cary Coutant <ccoutant@google.com>
2375 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2376 sections before NOBITS sections.
2378 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2380 * version.cc (print_version): Update copyright to 2011.
2382 2010-12-23 Cary Coutant <ccoutant@google.com>
2384 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2385 of OS to this->add. Add OD parameter to second form of the function.
2387 2010-12-20 Ian Lance Taylor <iant@google.com>
2389 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2390 second of two consecutive entries with same offset.
2392 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2394 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2395 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2396 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2397 to avoid unneeded links against $(LDADD).
2398 * testsuite/Makefile.in: Regenerate.
2400 2010-12-15 Ian Lance Taylor <iant@google.com>
2403 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2404 for R_X86_64_32 and R_X86_64_PC32.
2405 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2406 ver_matching_def_pic.o.
2407 (ver_matching_def_pic.o): New target.
2409 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2411 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2412 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2413 Move definition before File_read::View member definitions.
2414 (File_read::View::~View): Initialize and hold lock before
2415 updating current_mapped_bytes.
2417 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2419 * dwarf_reader.cc: Remove outdated comment.
2420 * gold-threads.cc: Fix typo in error message.
2421 * archive.cc: Fix typos in comments.
2422 * archive.h: Likewise.
2423 * arm-reloc-property.cc: Likewise.
2424 * arm-reloc-property.h: Likewise.
2425 * arm-reloc.def: Likewise.
2427 * attributes.h: Likewise.
2428 * cref.cc: Likewise.
2429 * ehframe.cc: Likewise.
2430 * fileread.h: Likewise.
2432 * i386.cc: Likewise.
2434 * incremental.h: Likewise.
2435 * int_encoding.cc: Likewise.
2436 * layout.h: Likewise.
2437 * main.cc: Likewise.
2438 * merge.h: Likewise.
2439 * object.cc: Likewise.
2440 * object.h: Likewise.
2441 * options.cc: Likewise.
2442 * readsyms.cc: Likewise.
2443 * reduced_debug_output.cc: Likewise.
2444 * reloc.cc: Likewise.
2445 * script-sections.cc: Likewise.
2446 * sparc.cc: Likewise.
2447 * symtab.h: Likewise.
2448 * target-reloc.h: Likewise.
2449 * target.cc: Likewise.
2450 * target.h: Likewise.
2451 * timer.cc: Likewise.
2452 * timer.h: Likewise.
2453 * x86_64.cc: Likewise.
2455 2010-12-09 Cary Coutant <ccoutant@google.com>
2457 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2459 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2460 parameter; change all callers.
2461 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2462 * options.h (warn_execstack): New option.
2464 2010-12-07 Doug Kwan <dougkwan@google.com>
2466 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2467 like function call relocations.
2469 2010-12-07 Ian Lance Taylor <iant@google.com>
2471 * archive.cc (Archive::get_elf_object_for_member): Permit
2472 punconfigured to be NULL.
2473 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2474 (Archive::include_member): Pass NULL to get_elf_object_for_member
2475 if we searched for the archive and this is the first included
2478 2010-12-01 Ian Lance Taylor <iant@google.com>
2480 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2481 track_relocs_type_ field.
2482 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2483 Set track_relocs_type_.
2484 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2485 contents when using RELA relocs.
2486 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2488 * reloc.cc (Track_relocs::next_addend): New function.
2489 * reloc.h (class Track_relocs): Declare next_addend.
2491 2010-12-01 Ian Lance Taylor <iant@google.com>
2493 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2496 2010-12-01 Ian Lance Taylor <iant@google.com>
2498 * README: Update compilers known to work and fail.
2500 2010-11-23 Matthias Klose <doko@ubuntu.com>
2502 * configure.in: For --enable-gold, handle value `default' instead of
2503 `both*'. Always install ld as ld.bfd, install as ld if gold is
2505 * configure: Regenerate.
2507 2010-11-18 Doug Kwan <dougkwan@google.com>
2509 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2510 and right_alignment to be zero. Store result alignment only if it is
2511 greater than existing alignment.
2513 2010-11-16 Cary Coutant <ccoutant@google.com>
2516 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2517 Check for ".zdebug_line".
2519 2010-11-16 Doug Kwan <dougkwan@google.com>
2520 Cary Coutant <ccoutant@google.com>
2522 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2523 by reference; adjust all callers.
2524 * output.cc (Output_segment::set_section_addresses): Adjust references
2525 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2527 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2528 end at page boundary.
2530 2010-11-16 Cary Coutant <ccoutant@google.com>
2533 * layout.cc (Layout::choose_output_section): Transform names of
2534 compressed sections even when using a script with a SECTIONS clause.
2535 (Layout::output_section_name): Remove code to transform
2536 compressed debug section names.
2537 * output.cc (Output_section::add_input_section): Use uncompressed
2538 section size when tracking input sections.
2540 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2542 * symtab.h (Symbol::NON_PIC_REF): Remove.
2543 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2544 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2545 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2546 (Symbol::use_plt_offset): Take a flags argument and pass it
2547 directly to needs_dynamic_reloc. Restrict check for undefined
2548 weak symbols to function calls.
2549 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2550 (Target_arm::Scan::global): Use it.
2551 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2552 (Target_arm::Relocate::relocate): Likewise.
2553 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2554 parameter with an r_type parameter. Use get_reference_flags
2556 (Target_arm::Relocate::relocate): Update accordingly.
2557 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2558 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2559 (Target_i386::Scan::global): Likewise.
2560 (Target_i386::Relocate::relocate): Likewise.
2561 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2562 parameter with an r_type parameter. Use get_reference_flags
2564 (Target_i386::Relocate::relocate): Update accordingly.
2565 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2566 (Target_powerpc::Scan::global): Use it.
2567 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2568 (Target_powerpc::Relocate::relocate): Likewise.
2569 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2570 (Target_sparc::Scan::global): Use it.
2571 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2572 (Target_sparc::Relocate::relocate): Likewise.
2573 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2574 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2575 (Target_x86_64::Scan::global): Likewise.
2576 (Target_x86_64::Relocate::relocate): Likewise.
2578 2010-11-08 Doug Kwan <dougkwan@google.com>
2579 Cary Coutant <ccoutant@google.com>
2581 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2582 (Arm_exidx_merge_section::section_contents_): New data member.
2583 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2584 (Arm_input_section::~Arm_input_section): De-allocate memory.
2585 (Arm_input_section::original_contents_): New data member.
2586 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2587 in parameters instead of calling Object::section_contents without
2589 (Arm_output_section::group_section): New parameter TASK. Pass it
2590 to callees that need locking objects.
2591 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2592 to lock EXIDX input sections. Fix a formatting issue. Call
2593 Arm_exidx_merged_section::build_contents to create merged section
2595 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2596 to lock object of stub table owner.
2597 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2598 TEXT_SIZE to initialize data member TEXT_SIZE_.
2599 (Arm_exidx_input_section::addralign): Fix typo in comment.
2600 (Arm_exidx_input_section::text_size): New method.
2601 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2602 that require locking objects. Lock objects before scanning for stubs
2603 and updating local symbols.
2604 (Arm_input_section<big_endian>::init): Copy contents of original
2606 (Arm_input_section<big_endian>::do_write): Use saved contents of
2607 original input section instead of calling Object::section_contents
2609 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2610 size without calling Object::section_size().
2611 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2612 for size. Allocate a buffer for merged EXIDX entries.
2613 (Arm_exidx_merged_section::build_contents): New method.
2614 (Arm_exidx_merged_section::do_write): Move merge section contents
2615 building code to Arm_exidx_merged_section::build_contetns. Write
2616 out contetns in buffer instead of building it on the fly.
2617 (Arm_relobj::make_exidx_input_section): Also pass text section size
2618 to Arm_exidx_input_section constructor.
2619 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2620 (Arm_dynobj::do_read_symbols): Fix memory leak.
2621 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2622 * target.h: (class Task): Add forward declaration.
2623 (Target::relax): Add new parameter TASK and pass it to
2625 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2627 2010-11-05 Cary Coutant <ccoutant@google.com>
2630 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2631 object when reading from the file.
2632 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2634 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2635 when reading section contents.
2636 (get_section_contents): Likewise.
2637 (icf::find_identical_sections): Likewise.
2638 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2639 object when reading from the file.
2640 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2641 the object when doing deferred section layout.
2643 2010-11-03 Nick Clifton <nickc@redhat.com>
2646 * script.h (class Symbol_assignment: name): New member. Returns
2647 the name of the symbol.
2648 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2649 Returns true if the given symbol name is on the list of
2650 assignments wating to be processed.
2651 * archive.cc (should_incldue_member): If the symbol is undefined,
2652 check to see if it is on the list of symbols pending assignment.
2654 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2656 * script-sections.cc (Script_sections::find_memory_region): Check
2657 for a NULL output section pointer.
2659 2010-10-29 Doug Kwan <dougkwan@google.com>
2661 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2662 Output_section::add_relaxed_input_section.
2663 * output.cc (Output_section::add_relaxed_input_section): Add new
2664 arguments LAYOUT and NAME. Set section order index.
2665 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2666 Copy section order index.
2667 * output.h (Output_section::add_relaxed_input_section): Add new
2668 arguments LAYOUT and NAME.
2670 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2672 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2673 NATIVE_OR_CROSS_LINKER.
2674 * testsuite/Makefile.in: Regenerate.
2676 2010-10-20 Doug Kwan <dougkwan@google.com>
2678 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2679 without SHF_LINK_ORDER flags.
2680 * layout.cc (Layout::choose_output_section): Do not filter
2681 SHF_LINK_ORDER flag in a relocatable link.
2683 2010-10-17 Cary Coutant <ccoutant@google.com>
2685 * output.h (Output_segment::set_section_addresses): Change function
2686 signature. Update all callers.
2687 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2689 (Output_segment::set_section_addresses): Align after last TLS
2690 section. Add padding before last relro section instead of after.
2692 2010-10-17 Doug Kwan <dougkwan@google.com>
2694 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2695 GOT output section to be writable.
2697 2010-10-14 Cary Coutant <ccoutant@google.com>
2699 * debug.h (DEBUG_INCREMENTAL): New flag.
2700 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2701 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2703 * incremental.cc (report_command_line): Ignore all forms of
2705 * layout.cc (Layout::Layout): Check parameters for incremental link
2707 * options.cc (General_options::parse_incremental): New function.
2708 (General_options::parse_no_incremental): New function.
2709 (General_options::parse_incremental_full): New function.
2710 (General_options::parse_incremental_update): New function.
2711 (General_options::incremental_mode_): New data member.
2712 (General_options::finalize): Check incremental_mode_.
2713 * options.h (General_options): Update help text for --incremental.
2714 Add --no-incremental, --incremental-full, --incremental-update.
2715 (General_options::Incremental_mode): New enum type.
2716 (General_options::incremental_mode): New function.
2717 (General_options::incremental_mode_): New data member.
2718 * parameters.cc (Parameters::incremental_mode_): New data member.
2719 (Parameters::set_options): Set incremental_mode_.
2720 (Parameters::set_incremental_full): New function.
2721 (Parameters::incremental): New function.
2722 (Parameters::incremental_update): New function.
2723 (set_parameters_incremental_full): New function.
2724 * parameters.h (Parameters::set_incremental_full): New function.
2725 (Parameters::incremental): New function.
2726 (Parameters::incremental_update): New function.
2727 (Parameters::incremental_mode_): New data member.
2728 (set_parameters_incremental_full): New function.
2729 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2730 incremental link mode.
2731 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2732 (Sized_relobj::do_relocate_sections): Likewise.
2733 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2735 * testsuite/Makefile.in: Regenerate.
2736 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2738 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2740 * script-sections.h (class Script_sections): Make
2741 Sections_elements typedef public.
2742 * script-sections.cc (class Sort_output_sections): Add elements_
2743 field. Add constructor which sets it; change all callers.
2744 (Sort_output_sections::is_before): New function.
2745 (Sort_output_sections::operator()): Call is_before.
2746 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2748 * testsuite/script_test_10.sh: New test. Test script section
2750 * testsuite/script_test_10.t: Likewise.
2751 * testsuite/script_test_10.s: Likewise.
2752 * testsuite/Makefile.am: Wrap the cross linker tests and the
2753 common tests into NATIVE_OR_CROSS_LINKER.
2754 (check_SCRIPTS): Add script_test_10.sh.
2755 (check_DATA): Add script_test_10.stdout.
2756 (script_test_10.o, script_test_10): New targets.
2757 (script_test_10.stdout): New target.
2758 * configure, testsuite/Makefile.in: Regenerate.
2760 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2762 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2763 error for the deprecated relocations.
2764 (Target_arm::Scan::global): Likewise.
2765 (Target_arm::Relocate::relocate): Likewise.
2767 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2769 * fileread.cc (Input_file::find_file): Initialize *found_name
2770 and *namep when using the fallback search for case 4.
2772 2010-10-11 Cary Coutant <ccoutant@google.com>
2774 * options.h (class General_options): Redefine -z lazy as an alias for
2775 the negation of -z now.
2777 2010-10-11 Ian Lance Taylor <iant@google.com>
2779 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2782 2010-10-06 Nick Clifton <nickc@redhat.com>
2784 * script-sections.cc(class Memory_region): Remove
2785 current_lma_offset_ field. Rename current_vma_offset_ to
2786 current_offset_. Add last_section_ field.
2787 (Memory_region::get_current_vma_address): Rename to
2788 get_current_address.
2789 (Memory_region::get_current_lma_address): Delete.
2790 (Memory_region::increment_vma_offset): Rename to
2792 (Memory_region::increment_lma_offset): Delete.
2793 (Memory_region::attributes_compatible): New method. Returns
2794 true if the provided section is compatible with the region.
2795 (Memory_region::get_last_section): New method. Returns the last
2796 section to use the region.
2797 (Memory_region::set_last_section): New method. Stores the last
2798 section to use the region.
2799 (Script_sections::block_in_region): New method. Returns true if
2800 a block of memory is contained within a region.
2801 (Script_sections::find_memory_region): New method. Locates a
2802 memory region to be used to set a VMA or LMA address.
2803 (Output_section_definition::set_section_addresses): Add code to
2804 check for addresses set by memory regions.
2805 (Output_segment::set_section_addresses): Remove memory region
2807 (Script_sections::create_segment): Add a warning if a header
2808 segment is created outside of any region.
2809 * script-sections.h (class Script_sections): Add prototypes for
2810 find_memory_region and block_in_region methods.
2811 * testsuite/memory_test.s: Use .long instead of .word.
2812 * testsuite/memory_test.t: Add some more output sections.
2813 * testsuite/memory_test.sh: Update expected output.
2815 2010-10-02 Doug Kwan <dougkwan@google.com>
2817 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2818 defintion to symtab.h
2819 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2820 declaration to defintion.
2822 2010-10-01 Nick Clifton <nickc@redhat.com>
2824 * expression.cc (eval): Replace dummy argument with NULL.
2825 (eval_maybe_dot): Check for a NULL result section pointer.
2826 (Symbol_expression::value): Likewise.
2827 (Dot_expression::value): Likewise.
2828 (BINARY_EXPRESSION): Likewise.
2829 (Max_expression::value): Likewise.
2830 (Min_expression::value): Likewise.
2831 (Absolute_expression::value): Likewise.
2832 (Addr_expression::value_from_output_section): Likewise.
2833 (Loaddddr_expression::value_from_output_section): Likewise.
2834 (Segment_start_expression::value): Likewise.
2835 * script-sections.cc
2836 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2838 (Sections_elememt_dot_assignment::set_section_addresses):
2840 (Output_data_expression::do_write_to_buffer): Likewise.
2841 (Output_section_definition::finalize_symbols): Likewise.
2842 (Output_section_definition::set_section_addresses): Likewise.
2844 2010-09-30 Doug Kwan <dougkwan@google.com>
2846 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2848 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2850 * target.h (Target::can_icf_inline_merge_sections): New virtual
2852 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2854 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2856 * icf.cc (get_section_contents): Inline merge sections only when
2859 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2861 * configure: Regenerate.
2863 2010-09-17 Ian Lance Taylor <iant@google.com>
2865 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2866 * testsuite/Makefile.am (memory_test.o): New target.
2867 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2869 * testsuite/Makefile.in: Rebuild.
2871 2010-09-17 Doug Kwan <dougkwan@google.com>
2873 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2874 defintion if relocation uses GOT entries of the symbol.
2875 * testsuite/icf_safe_test.sh: Fix test.
2876 * testsuite/icf_safe_so_test.sh: Fix test.
2878 2010-09-16 Cary Coutant <ccoutant@google.com>
2880 * script_sections.cc (class Memory_region): Remove "NULL" from
2881 vector initializations.
2883 2010-09-15 Cary Coutant <ccoutant@google.com>
2885 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2886 Resolve forwarding symbols.
2888 2010-09-15 Doug Kwan <dougkwan@google.com>
2890 * gold/testsuite/script_test_3.t: Add ARM special sections.
2891 * gold/testsuite/script_test_4.t: Same.
2892 * gold/testsuite/script_test_5.t: Same.
2893 * gold/testsuite/script_test_6.t: Same.
2894 * gold/testsuite/script_test_7.t: Same.
2895 * gold/testsuite/script_test_7.t: Same.
2896 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2898 2010-09-14 Cary Coutant <ccoutant@google.com>
2900 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2901 (Target_x86_64::Relocate::relocate_tls): Replace check for
2902 saw_tls_block_reloc_ with test for executable section.
2904 2010-09-12 Cary Coutant <ccoutant@google.com>
2906 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2907 position-independent executables to shared libraries need dynamic
2909 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2910 position-independent executables.
2911 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2912 * testsuite/Makefile.in: Regenerate.
2914 2010-09-10 Nick Clifton <nickc@redhat.com>
2917 * testsuite/memory_test.t: Discard any sections that are not
2920 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2923 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2924 "This::" to work around a bug in gcc 4.2.
2926 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2928 2010-09-09 Rafael Espindola <espindola@google.com>
2930 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2931 sections with different PF_X flags in the same segment.
2932 (Layout::find_first_load_seg): Search all segments to find the first
2934 * options.h (rosegment): New.
2936 2010-09-08 Rafael Espindola <espindola@google.com>
2938 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2940 2010-09-08 Doug Kwan <dougkwan@google.com>
2942 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2943 (Arm_relobj::do_relocate_sections): Add new parameter for output
2944 file to match the parent.
2945 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2946 of local symbols instead of input values. Update code to track
2947 changes in gold::relocate_section.
2948 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2949 (Sized_relobj::compute_final_local_value_internal): New methods.
2950 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2951 body into private version of Sized_relobj::compute_final_local_value.
2952 Call the inline method.
2953 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2954 merged symbol value if there is one.
2955 (Symbol_value::has_output_value): New method defintiion.
2956 (Sized_relobj::Compute_final_local_value_status): New enum type.
2957 (Sized_relobj::compute_final_local_value): New methods.
2958 (Sized_relobj::compute_final_local_value_internal): New methods.
2959 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2960 and arm_cortex_a8.sh.
2961 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2962 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2964 * Makefile.in: Regenerate.
2965 * testsuite/arm_bl_out_of_range.s: Update test.
2966 * testsuite/thumb_bl_out_of_range.s: Ditto.
2967 * testsuite/thumb_blx_out_of_range.s: Ditto.
2968 * testsuite/arm_branch_out_of_range.sh: New file.
2969 * testsuite/arm_cortex_a8.sh: Ditto.
2970 * testsuite/arm_cortex_a8_b.s: Ditto.
2971 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2972 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2973 * testsuite/arm_cortex_a8_bl.s: Ditto.
2974 * testsuite/arm_cortex_a8_blx.s: Ditto.
2975 * testsuite/arm_cortex_a8_local.s: Ditto.
2976 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2977 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2979 2010-09-08 Rafael Espindola <espindola@google.com>
2981 * Makefile.am (memory_test.stdout): Run readelf with -W.
2982 * Makefile.in: Regenerate.
2983 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2986 2010-09-08 Rafael Espindola <espindola@google.com>
2988 * script-sections.cc (Script_sections::add_memory_region): Convert
2989 field precision to int.
2990 * script.cc (script_set_section_region, script_set_section_region):
2991 Convert field precision to int.
2993 2010-09-08 Rafael Espindola <espindola@google.com>
2995 * arm.cc (do_finalize_sections): Create the __exidx_start and
2996 __exdix_end symbols even when the section is missing.
2998 2010-09-08 Nick Clifton <nickc@redhat.com>
3000 * README: Remove claim that MEMORY is not supported.
3001 * expression.cc (script_exp_function_origin)
3002 (script_exp_function_length): Move from here to ...
3003 * script.cc: ... here.
3004 (script_set_section_region, script_add_memory)
3005 (script_parse_memory_attr, script_include_directive): New
3007 * script-sections.cc
3008 (class Memory_region): New class.
3009 (class Output_section_definition): Add set_memory_region,
3010 set_section_vma, set_section_lma and get_section_name methods.
3011 (class Script_Sections): Add add_memory_region,
3012 find_memory_region, find_memory_region_origin,
3013 find_memory_region_length and set_memory_region methods.
3014 Have set_section_addresses method walk the list of set memory
3016 Extend the print methos to display memory regions.
3017 * script-sections.h: Add prototypes for new methods.
3018 Add enum for MEMORY region attributes.
3019 * yyscript.y: Add support for parsing MEMORY regions.
3020 * script-c.h: Add prototypes for new functions.
3021 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3022 * testsuite/Makefile.in: Regenerate.
3023 * testsuite/memory_test.sh: New script.
3024 * testsuite/memory_test.s: New assembler source file.
3025 * testsuite/memory_test.t: New linker script.
3027 2010-08-27 Doug Kwan <dougkwan@google.com>
3029 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3030 reference override an existing dynamic weak reference.
3031 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3032 * testsuite/Makefile.in: Regenerate.
3033 * testsuite/dyn_weak_ref.sh: New file.
3034 * testsuite/dyn_weak_ref_1.c: Ditto.
3035 * testsuite/dyn_weak_ref_2.c: Ditto.
3037 2010-08-27 Ian Lance Taylor <iant@google.com>
3039 * incremental.h (class Incremental_input_entry): Add virtual
3042 2010-08-27 Ian Lance Taylor <iant@google.com>
3044 * testsuite/start_lib_test_3.c: Mark t3 as used.
3046 2010-08-27 Nick Clifton <nickc@redhat.com>
3048 * options.cc (version_script): Fix small typo in previous
3051 2010-08-25 Nick Clifton <nickc@redhat.com>
3053 * archive.cc: Formatting fixes: Remove whitespace between
3054 typename and following asterisk. Remove whitespace between
3055 function name and opening parenthesis.
3056 * archive.h: Likewise.
3058 * attributes.cc: Likewise.
3059 * attributes.h: Likewise.
3060 * common.cc: Likewise.
3061 * copy-relocs.cc: Likewise.
3062 * dirsearch.h: Likewise.
3063 * dynobj.cc: Likewise.
3064 * ehframe.cc: Likewise.
3065 * ehframe.h: Likewise.
3066 * expression.cc: Likewise.
3067 * fileread.cc: Likewise.
3068 * fileread.h: Likewise.
3070 * gold-threads.cc: Likewise.
3071 * gold.cc: Likewise.
3072 * i386.cc: Likewise.
3074 * incremental-dump.cc: Likewise.
3075 * incremental.cc: Likewise.
3076 * layout.cc: Likewise.
3077 * layout.h: Likewise.
3078 * main.cc: Likewise.
3079 * merge.cc: Likewise.
3080 * merge.h: Likewise.
3081 * object.cc: Likewise.
3082 * object.h: Likewise.
3083 * options.cc: Likewise.
3084 * options.h: Likewise.
3085 * output.cc: Likewise.
3086 * output.h: Likewise.
3087 * plugin.cc: Likewise.
3088 * plugin.h: Likewise.
3089 * powerpc.cc: Likewise.
3090 * reloc.cc: Likewise.
3091 * script-c.h: Likewise.
3092 * script-sections.cc: Likewise.
3093 * script.cc: Likewise.
3094 * stringpool.cc: Likewise.
3095 * symtab.cc: Likewise.
3096 * symtab.h: Likewise.
3097 * target.cc: Likewise.
3098 * timer.cc: Likewise.
3099 * timer.h: Likewise.
3100 * version.cc: Likewise.
3101 * x86_64.cc: Likewise.
3103 2010-08-24 Nick Clifton <nickc@redhat.com>
3106 * layout.cc (segment_precedes): Sort segments by their physical
3107 addresses, if they have been set.
3109 2010-08-23 Cary Coutant <ccoutant@google.com>
3111 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3113 (Lib_group::include_member): Unlock object after deleting its
3115 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3118 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3119 Cary Coutant <ccoutant@google.com>
3121 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3122 constructor, and set_blocker.
3123 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3125 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3126 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3127 * testsuite/Makefile.am (start_lib_test): New test case.
3128 * testsuite/Makefile.in: Regenerate.
3129 * testsuite/start_lib_test_main.c: New file.
3130 * testsuite/start_lib_test_1.c: New file.
3131 * testsuite/start_lib_test_2.c: New file.
3132 * testsuite/start_lib_test_3.c: New file.
3134 2010-08-19 Ian Lance Taylor <iant@google.com>
3136 * Makefile.in: Rebuild with automake 1.11.1.
3137 * aclocal.m4: Likewise.
3138 * testsuite/Makefile.in: Likewise.
3140 2010-08-19 Ian Lance Taylor <iant@google.com>
3143 * i386.cc (class Output_data_plt_i386): Update declarations.
3144 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3145 local_ifuncs_ fields.
3146 (Target_i386::do_plt_section_for_global): New function.
3147 (Target_i386::do_plt_section_for_local): New function.
3148 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3149 parameter; change all callers. Initialize global_ifuncs_ and
3150 local_ifuncs_. If doing a static link define __rel_iplt_start and
3152 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3153 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3154 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3156 (Target_i386::make_plt_section): New function, broken out of
3157 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3158 (Target_i386::make_plt_entry): Call make_plt_section.
3159 (Target_i386::make_local_ifunc_plt_entry): New function.
3160 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3161 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3162 R_386_IRELATIVE to switch.
3163 (Target_i386::Scan::global): Likewise.
3164 (Target_i386::Relocate::relocate): Likewise.
3165 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3167 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3168 (Target_x86_64::do_plt_section_for_global): New function.
3169 (Target_x86_64::do_plt_section_for_local): New function.
3170 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3171 parameter; change all callers. If doing a static link define
3172 __rela_iplt_start and __rela_iplt_end.
3173 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3174 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3175 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3177 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3178 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3180 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3181 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3182 R_X86_64_IRELATIVE to switch.
3183 (Target_x86_64::Scan::global): Likewise.
3184 (Target_x86_64::Relocate::relocate): Likewise.
3185 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3187 * target.h (class Target): Add plt_section_for_global and
3188 plt_section_for_local functions. Add do_plt_section_for_global
3189 and do_plt_section_for_local virtual functions.
3190 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3191 clarifying comments.
3192 (Symbol::use_plt_offset): Handle IFUNC symbol.
3193 * object.cc (Sized_relobj::Sized_relobj): Initialize
3195 (Sized_relobj::local_has_plt_offset): New function.
3196 (Sized_relobj::local_plt_offset): New function.
3197 (Sized_relobj::set_local_plt_offset): New function.
3198 (Sized_relobj::do_count): Handle IFUNC symbol.
3199 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3200 a bit away from input_shndx_ field. Add set_is_func_symbol and
3201 is_ifunc_symbol functions.
3202 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3203 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3204 local_plt_offsets_ field.
3205 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3206 * output.h (class Output_section_data): Add non-const
3207 output_section function.
3208 (class Output_data_got): Update declarations.
3209 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3210 Add use_plt_offset parameter to global and local constructors.
3211 Change all callers. Change local_sym_index_ field to 31 bits.
3212 Change GSYM_CODE and CONSTANT_CODE accordingly.
3213 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3214 doing a static link don't set sh_link field.
3215 (Output_data_got::Got_entry::write): Use PLT offset if
3217 (Output_data_got::add_global_plt): New function.
3218 (Output_data_got::add_local_plt): New function.
3219 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3220 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3221 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3222 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3223 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3225 * testsuite/ifunc-sel.h: New file.
3226 * testsuite/ifuncmain1.c: New file.
3227 * testsuite/ifuncmain1vis.c: New file.
3228 * testsuite/ifuncmod1.c: New file.
3229 * testsuite/ifuncdep2.c: New file.
3230 * testsuite/ifuncmain2.c: New file.
3231 * testsuite/ifuncmain3.c: New file.
3232 * testsuite/ifuncmod3.c: New file.
3233 * testsuite/ifuncmain4.c: New file.
3234 * testsuite/ifuncmain5.c: New file.
3235 * testsuite/ifuncmod5.c: New file.
3236 * testsuite/ifuncmain6pie.c: New file.
3237 * testsuite/ifuncmod6.c: New file.
3238 * testsuite/ifuncmain7.c: New file.
3239 * configure, testsuite/Makefile.in: Rebuild.
3241 2010-08-18 Ian Lance Taylor <iant@google.com>
3244 (Output_section_incremental_inputs::write_input_files): Add cast
3245 to avoid signed/unsigned comparison warning.
3246 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3248 2010-08-12 Cary Coutant <ccoutant@google.com>
3250 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3252 2010-08-13 Ian Lance Taylor <iant@google.com>
3254 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3256 2010-08-12 Cary Coutant <ccoutant@google.com>
3257 Doug Kwan <dougkwan@google.com>
3259 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3260 defintion overrides non-weak undef, remember that the original undef
3262 * symtab.cc (Symbol_table::sized_write_global): For undef without
3263 an original weak binding, set binding to global in output.
3264 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3265 * testsuite/Makefile.in: Regenerate.
3266 * testsuite/strong_ref_weak_def.sh: New file.
3267 * testsuite/strong_ref_weak_def_1.c: Ditto.
3268 * testsuite/strong_ref_weak_def_2.c: Ditto.
3270 2010-08-12 Cary Coutant <ccoutant@google.com>
3272 * testsuite/incremental_test.sh: Rewrite.
3273 * testsuite/incremental_test_1.c: Rewrite.
3274 * testsuite/incremental_test_2.c: Rewrite.
3276 2010-08-12 Cary Coutant <ccoutant@google.com>
3278 * arm.cc (Target_arm::got_size): Add const.
3279 (Target_arm::got_entry_count): New function.
3280 (Target_arm::plt_entry_count): New function.
3281 (Target_arm::first_plt_entry_offset): New function.
3282 (Target_arm::plt_entry_size): New function.
3283 (Output_data_plt_arm::entry_count): New function.
3284 (Output_data_plt_arm::first_plt_entry_offset): New function.
3285 (Output_data_plt_arm::get_plt_entry_size): New function.
3286 * i386.cc (Target_i386::got_size): Add const.
3287 (Target_i386::got_entry_count): New function.
3288 (Target_i386::plt_entry_count): New function.
3289 (Target_i386::first_plt_entry_offset): New function.
3290 (Target_i386::plt_entry_size): New function.
3291 (Output_data_plt_i386::entry_count): New function.
3292 (Output_data_plt_i386::first_plt_entry_offset): New function.
3293 (Output_data_plt_i386::get_plt_entry_size): New function.
3294 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3295 find_incremental_inputs_sections. Dump incremental_got_plt section.
3296 * incremental.cc: Include target.h.
3297 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3298 parameter. Adjust all callers. Find incremental_got_plt section.
3299 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3301 (Output_section_incremental_inputs::set_final_data_size): Calculate
3302 size of incremental_got_plt section.
3303 (Output_section_incremental_inputs::do_write): Write the
3304 incremental_got_plt section.
3305 (Got_plt_view_info): New struct.
3306 (Local_got_offset_visitor): New class.
3307 (Global_got_offset_visitor): New class.
3308 (Global_symbol_visitor_got_plt): New class.
3309 (Output_section_incremental_inputs::write_got_plt): New function.
3310 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3311 Add parameter. Adjust all callers.
3312 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3313 (Incremental_inputs::got_plt_section): New function.
3314 (Incremental_inputs::got_plt_section_): New data member.
3315 (Incremental_got_plt_reader): New class.
3316 * layout.cc (Layout::create_incremental_info_sections): Add the
3317 incremental_got_plt section.
3318 * object.h (Got_offset_list::get_list): New function.
3319 (Got offset_list::for_all_got_offsets): New function.
3320 (Sized_relobj::local_got_offset_list): New function.
3321 * powerpc.cc (Target_powerpc::got_size): Add const.
3322 (Target_powerpc::got_entry_count): New function.
3323 (Target_powerpc::plt_entry_count): New function.
3324 (Target_powerpc::first_plt_entry_offset): New function.
3325 (Target_powerpc::plt_entry_size): New function.
3326 (Output_data_plt_powerpc::entry_count): New function.
3327 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3328 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3329 * sparc.cc (Target_sparc::got_size): Add const.
3330 (Target_sparc::got_entry_count): New function.
3331 (Target_sparc::plt_entry_count): New function.
3332 (Target_sparc::first_plt_entry_offset): New function.
3333 (Target_sparc::plt_entry_size): New function.
3334 (Output_data_plt_sparc::entry_count): New function.
3335 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3336 (Output_data_plt_sparc::get_plt_entry_size): New function.
3337 * symtab.h (Symbol::got_offset_list): New function.
3338 (Symbol_table::for_all_symbols): New function.
3339 * target.h (Sized_target::got_entry_count): New function.
3340 (Sized_target::plt_entry_count): New function.
3341 (Sized_target::plt_entry_size): New function.
3342 * x86_64.cc (Target_x86_64::got_size): Add const.
3343 (Target_x86_64::got_entry_count): New function.
3344 (Target_x86_64::plt_entry_count): New function.
3345 (Target_x86_64::first_plt_entry_offset): New function.
3346 (Target_x86_64::plt_entry_size): New function.
3347 (Output_data_plt_x86_64::entry_count): New function.
3348 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3349 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3351 2010-08-12 Cary Coutant <ccoutant@google.com>
3353 * archive.cc: Include incremental.h.
3354 (Archive::Archive): Initialize incremental_info_.
3355 (Archive::include_member): Record archive members in incremental info.
3356 (Add_archive_symbols::run): Record begin and end of an archive in
3358 (Lib_group::include_member): Record objects in incremental info.
3359 * archive.h (Incremental_archive_entry): Forward declaration.
3360 (Archive::set_incremental_info): New member function.
3361 (Archive::incremental_info): New member function.
3362 (Archive::Unused_symbol_iterator): New class.
3363 (Archive::unused_symbols_begin): New member function.
3364 (Archive::unused_symbols_end): New member function.
3365 (Archive::incremental_info_): New data member.
3366 * incremental-dump.cc (find_input_containing_global): New function.
3367 (dump_incremental_inputs): Dump new incremental info sections.
3368 * incremental.cc: Include symtab.h.
3369 (Output_section_incremental_inputs): New class.
3370 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3371 new incremental info sections.
3372 (Sized_incremental_binary::do_check_inputs): Likewise.
3373 (Incremental_inputs::report_archive): Remove.
3374 (Incremental_inputs::report_archive_begin): New function.
3375 (Incremental_inputs::report_archive_end): New function.
3376 (Incremental_inputs::report_object): New function.
3377 (Incremental_inputs::finalize_inputs): Remove.
3378 (Incremental_inputs::report_input_section): New function.
3379 (Incremental_inputs::report_script): Rewrite.
3380 (Incremental_inputs::finalize): Do nothing but finalize string table.
3381 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3382 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3383 (Incremental_inputs::create_data_sections): New function.
3384 (Incremental_inputs::relocs_entsize): New function.
3385 (Output_section_incremental_inputs::set_final_data_size): New function.
3386 (Output_section_incremental_inputs::do_write): New function.
3387 (Output_section_incremental_inputs::write_header): New function.
3388 (Output_section_incremental_inputs::write_input_files): New function.
3389 (Output_section_incremental_inputs::write_info_blocks): New function.
3390 (Output_section_incremental_inputs::write_symtab): New function.
3391 * incremental.h (Incremental_script_entry): Forward declaration.
3392 (Incremental_object_entry): Forward declaration.
3393 (Incremental_archive_entry): Forward declaration.
3394 (Incremental_inputs): Forward declaration.
3395 (Incremental_inputs_header_data): Remove.
3396 (Incremental_inputs_header): Remove.
3397 (Incremental_inputs_header_write): Remove.
3398 (Incremental_inputs_entry_data): Remove.
3399 (Incremental_inputs_entry): Remove.
3400 (Incremental_inputs_entry_write): Remove.
3401 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3402 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3403 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3404 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3406 (Incremental_input_entry): New class.
3407 (Incremental_script_entry): New class.
3408 (Incremental_object_entry): New class.
3409 (Incremental_archive_entry): New class.
3410 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3411 (Incremental_inputs::report_inputs): Remove.
3412 (Incremental_inputs::report_archive): Remove.
3413 (Incremental_inputs::report_archive_begin): New function.
3414 (Incremental_inputs::report_archive_end): New function.
3415 (Incremental_inputs::report_object): Change prototype.
3416 (Incremental_inputs::report_input_section): New function.
3417 (Incremental_inputs::report_script): Change prototype.
3418 (Incremental_inputs::get_reloc_count): New function.
3419 (Incremental_inputs::set_reloc_count): New function.
3420 (Incremental_inputs::create_data_sections): New function.
3421 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3422 (Incremental_inputs::inputs_section): New function.
3423 (Incremental_inputs::symtab_section): New function.
3424 (Incremental_inputs::relocs_section): New function.
3425 (Incremental_inputs::get_stringpool): Add const.
3426 (Incremental_inputs::command_line): Add const.
3427 (Incremental_inputs::inputs): Remove.
3428 (Incremental_inputs::command_line_key): New function.
3429 (Incremental_inputs::input_file_count): New function.
3430 (Incremental_inputs::input_files): New function.
3431 (Incremental_inputs::relocs_entsize): New function.
3432 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3433 (Incremental_inputs::finalize_inputs): Remove.
3434 (Incremental_inputs::Input_info): Remove.
3435 (Incremental_inputs::lock_): Remove.
3436 (Incremental_inputs::inputs_): Change type.
3437 (Incremental_inputs::inputs_map_): Remove.
3438 (Incremental_inputs::current_object_entry_): New data member.
3439 (Incremental_inputs::inputs_section_): New data member.
3440 (Incremental_inputs::symtab_section_): New data member.
3441 (Incremental_inputs::relocs_section_): New data member.
3442 (Incremental_inputs::reloc_count_): New data member.
3443 (Incremental_inputs_reader): New class.
3444 (Incremental_symtab_reader): New class.
3445 (Incremental_relocs_reader): New class.
3446 * layout.cc (Layout::finalize): Move finalization of incremental info
3447 and creation of incremental info sections to follow finalization of
3448 symbol table. Set offsets for postprocessing sections.
3449 (Layout::create_incremental_info_sections): Call
3450 Incremental_inputs::create_data_sections. Add incremental symtab
3451 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3452 sections to layout after input sections.
3453 * layout.h (struct Timespec): Forward declaration.
3454 (Layout::incremental_inputs): Add const.
3455 (Layout::create_incremental_info_sections): Add parameter.
3456 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3457 * object.cc: Include incremental.h.
3458 (Relobj::finalize_incremental_relocs): New function.
3459 (Sized_relobj::do_layout): Record input sections in incremental info.
3460 * object.h (Object::output_section): New function.
3461 (Object::output_section_offset): Moved from Relobj.
3462 (Object::get_incremental_reloc_base): New function.
3463 (Object::get_incremental_reloc_count): New function.
3464 (Object::do_output_section): New function.
3465 (Object::do_output_section_offset): Moved from Relobj.
3466 (Object::do_get_incremental_reloc_base): New function.
3467 (Object::do_get_incremental_reloc_count): New function.
3468 (Object::Object): Initialize new data members.
3469 (Relobj::output_section): Renamed do_output_section and moved to
3471 (Relobj::output_section_offset): Moved to Object.
3472 (Relobj::do_get_incremental_reloc_base): New function.
3473 (Relobj::do_get_incremental_reloc_count): New function.
3474 (Relobj::allocate_incremental_reloc_counts): New function.
3475 (Relobj::count_incremental_reloc): New function.
3476 (Relobj::finalize_incremental_relocs): New function.
3477 (Relobj::next_incremental_reloc_index): New function.
3478 (Relobj::reloc_counts_): New data member.
3479 (Relobj::reloc_bases_): New data member.
3480 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3481 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3482 (Sized_relobj::incremental_relocs_scan): New function.
3483 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3484 (Sized_relobj::incremental_relocs_write): New function.
3485 (Sized_relobj::incremental_relocs_write_reltype): New function.
3486 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3488 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3489 archives and object files elsewhere.
3490 (Add_symbols::run): Report object files here.
3491 (Finish_group::run): Report end of archive at end of group.
3492 * reloc.cc: Include layout.h, incremental.h.
3493 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3494 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3495 (Sized_relobj::incremental_relocs_scan): New function.
3496 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3497 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3498 (Sized_relobj::incremental_relocs_write): New function.
3499 (Sized_relobj::incremental_relocs_write_reltype): New function.
3500 * script.cc (read_input_script): Rewrite test for incremental link.
3501 Change call to Incremental_inputs::report_script.
3502 * symtab.h (Symbol_table::first_global_index): New function.
3503 (Symbol_table::output_count): New function.
3505 2010-08-12 Doug Kwan <dougkwan@google.com>
3507 * arm.cc (Target_arm::merge_object_attributes): Check command line
3508 options --no-wchar-size-warning and --no-enum-size-warning.
3509 * options.h (General_options): Add ld-compatible options
3510 --no-enum-size-warning and --no-wchar-size-warning.
3512 2010-08-04 Ian Lance Taylor <iant@google.com>
3514 * x86_64.cc (Target_x86_64::Scan::local): Use
3515 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3516 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3517 (Target_x86_64::Scan::global): Likewise.
3518 (Target_x86_64::Relocate::relocate): Likewise.
3519 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3522 2010-08-03 Cary Coutant <ccoutant@google.com>
3524 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3525 to reserve space in merged_strings vector. Keep total input size
3527 (Output_merge_string::do_print_merge_stats): Print total input size.
3528 * merge.h (Output_merge_string): Add input_size_ field.
3529 * stringpool.cc (Stringpool_template::string_length): Move
3530 implementations out of Stringpool_template class and place in
3532 * stringpool.h (string_length): Move out of Stringpool_template.
3534 2010-08-03 Ian Lance Taylor <iant@google.com>
3537 * layout.cc (relaxation_loop_body): If address of load segment is
3538 set, adjust address to include headers if possible.
3540 2010-08-03 Ian Lance Taylor <iant@google.com>
3542 * version.cc (version_string): Bump to 1.10.
3544 2010-08-03 Ian Lance Taylor <iant@google.com>
3547 * layout.h (enum Output_section_order): Define.
3548 (class Layout): Update declarations.
3549 * layout.cc (Layout::get_output_section): Add order parameter.
3550 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3551 is_first_non_relro parameters. Change all callers.
3552 (Layout::choose_output_section): Likewise.
3553 (Layout::add_output_section_data): Likewise.
3554 (Layout::make_output_section): Likewise. Set order.
3555 (Layout::default_section_order): New function.
3556 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3557 * output.cc (Output_section::Output_section): Initialize order_.
3558 Don't initialize deleted fields.
3559 (Output_segment::Output_segment): Don't initialize deleted
3561 (Output_segment::add_output_section_to_load): New function
3562 replacing add_output_section. Change all callers to call this or
3563 add_output_section_to_nonload.
3564 (Output_segment::add_output_section_to_nonload): New function.
3565 (Output_segment::remove_output_section): Rewrite.
3566 (Output_segment::add_initial_output_data): Likewise.
3567 (Output_segment::has_any_data_sections): Likewise.
3568 (Output_segment::is_first_section_relro): Likewise.
3569 (Output_segment::maximum_alignment): Likewise.
3570 (Output_segment::has_dynamic_reloc): New function replacing
3571 dynamic_reloc_count. Change all callers.
3572 (Output_segment::has_dynamic_reloc_list): New function replacing
3573 dynamic_reloc_count_list. Change all callers.
3574 (Output_segment::set_section_addresses): Rewrite.
3575 (Output_segment::set_offset): Rewrite.
3576 (Output_segment::find_first_and_last_list): Remove.
3577 (Output_segment::set_tls_offsets): Rewrite.
3578 (Output_segment::first_section_load_address): Likewise.
3579 (Output_segment::output_section_count): Likewise.
3580 (Output_segment::section_with_lowest_load_address): Likewise.
3581 (Output_segment::write_section_headers): Likewise.
3582 (Output_segment::print_sections_to_map): Likewise.
3583 * output.h (class Output_data): Remove dynamic_reloc_count_
3584 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3585 (Output_data::add_dynamic_reloc): Rewrite.
3586 (Output_data::has_dynamic_reloc): New function.
3587 (Output_data::dynamic_reloc_count): Remove.
3588 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3589 is_last_relro_, is_first_non_relro_, is_interp_,
3590 is_dynamic_linker_section_ fields. Add order and set_order
3591 functions. Remove is_relro_local, set_is_relro_local,
3592 is_last_relro, set_is_last_relro, is_first_non_relro,
3593 set_is_first_non_relro functions, is_interp, set_is_interp,
3594 is_dynamic_linker_section, and set_is_dynamic_linker_section
3596 (class Output_segment): Change Output_data_list from std::list to
3597 std:;vector. Add output_lists_ field. Remove output_data_ and
3598 output_bss_ fields. Update declarations.
3600 2010-08-02 Ian Lance Taylor <iant@google.com>
3602 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3603 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3604 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3606 2010-08-02 Ian Lance Taylor <iant@google.com>
3609 * script.cc (Script_options::Script_options): Initialize
3610 symbol_definitions_ and symbol_references_.
3611 (Script_options::add_symbol_assignment): Update
3612 symbol_definitions_ and symbol_references_.
3613 (Script_options::add_symbol_reference): New function.
3614 (script_symbol): New function.
3615 * script.h (class Script_options): Add symbol_definitions_ and
3616 symbol_references_ fields.
3617 (Script_options::referenced_const_iterator): New type.
3618 (Script_options::referenced_begin): New function.
3619 (Script_options::referenced_end): New function.
3620 (Script_options::is_referenced): New function.
3621 (Script_options::any_unreferenced): New function.
3622 * script-c.h (script_symbol): Declare.
3623 * yyscript.y (exp): Call script_symbol.
3624 * symtab.cc: Include "script.h".
3625 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3626 Change all callers. Check symbols referenced by scripts.
3627 (Symbol_table::add_undefined_symbols_from_command_line): Add
3628 layout parameter. Change all callers.
3629 (Symbol_table::do_add_undefined_symbols_from_command_line):
3630 Likewise. Break out loop body. Check symbols referenced by
3632 (Symbol_table::add_undefined_symbol_from_command_line): New
3633 function broken out of
3634 do_add_undefined_symbols_from_command_line.
3635 * symtab.h (class Symbol_table): Update declarations.
3636 * archive.cc: Include "layout.h".
3637 (Archive::should_include_member): Add layout parameter. Change
3638 all callers. Check for symbol mentioned in expression.
3639 * archive.h (class Archive): Update declaration.
3640 * object.cc (Sized_relobj::do_should_include_member): Add layout
3642 * object.h (Object::should_include_member): Add layout parameter.
3644 (Object::do_should_include_member): Add layout parameter.
3645 (class Sized_relobj): Update declaration.
3646 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3648 * dynobj.h (class Sized_dynobj): Update declaration.
3649 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3651 * plugin.h (class Sized_pluginobj): Update declaration.
3653 2010-08-02 Ian Lance Taylor <iant@google.com>
3656 * output.cc (Output_segment::set_offset): Search for the first and
3657 last sections rather than assuming that the list is in order.
3658 (Output_segment::find_first_and_last_list): New function.
3659 * output.h (class Output_segment): Update declarations.
3660 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3661 (relro_strip_test_SOURCES): New variable.
3662 (relro_strip_test_DEPENDENCIES): New variable.
3663 (relro_strip_test_LDFLAGS): New variable.
3664 (relro_strip_test_LDADD): New variable.
3665 (relro_strip_test.so): New target.
3667 2010-08-02 Ian Lance Taylor <iant@google.com>
3669 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3670 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3671 (Target_i386::got_tlsdesc_section): New function.
3672 (Target_i386::got_section): Create space for GOT entries for
3673 TLSDESC relocations.
3674 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3676 (Target_i386::Scan::global): Likewise.
3677 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3679 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3680 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3681 (Target_x86_64::got_tlsdesc_section): New function.
3682 (Target_x86_64::got_section): Create space for GOT entries for
3683 TLSDESC relocations.
3684 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3686 (Target_x86_64::Scan::global): Likewise.
3687 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3690 2010-08-02 Ian Lance Taylor <iant@google.com>
3692 * testsuite/final_layout.sh: Use dc to convert from hex to
3695 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3697 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3698 paramter to the call to gold::gc_process_relocs.
3699 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3700 paramter to the call to gold::gc_process_relocs.
3701 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3702 parameter to the call to gold::gc_process_relocs.
3703 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3704 template parameter to the call to gold::gc_process_relocs.
3705 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3706 paramter to the call to gold::gc_process_relocs.
3707 * gc.h (get_embedded_addend_size): New function.
3708 (gc_process_relocs): Save the size of the reloc for use by ICF.
3709 * icf.cc (get_section_contents): Get the addend from the text section
3710 for SHT_REL relocation sections.
3711 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3712 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3713 * int_encoding.h (read_from_pointer): New overloaded function.
3714 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3715 * testsuite/icf_sht_rel_addend_test.sh: New file.
3716 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3717 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3719 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3721 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3722 * Makefile.in: Regenerate.
3723 * testsuite/Makefile.in: Regenerate.
3725 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3727 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3728 * gold/testsuite/debug_msg.cc: Likewise.
3729 * gold/testsuite/odr_violation1.cc
3730 * gold/testsuite/odr_violation2.cc
3732 2010-07-21 Cary Coutant <ccoutant@google.com>
3734 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3735 string, and length fields.
3736 (Output_merge_string::Merged_strings_list): New type.
3737 (Output_merge_string::Merged_strings_lists): New typedef.
3738 (Output_merge_string): Replace merged_strings_ with
3739 merged_strings_lists_.
3740 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3741 Merged_strings_list per input object and section. Don't store pointer
3742 to the string. Don't store length with each merged string entry.
3743 (Output_merge_string::finalize_merged_data): Loop over list of merged
3744 strings lists. Recompute length of each merged string.
3746 2010-07-15 Cary Coutant <ccoutant@google.com>
3748 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3751 2010-07-14 Ian Lance Taylor <iant@google.com>
3753 * descriptors.cc (Descriptors::open): Report correct name in error
3756 2010-07-13 Doug Kwan <dougkwan@google.com>
3758 * arm.cc (Arm_input_section::Arm_input_section): For a
3759 SHT_ARM_EXIDX section, always keeps the input sections.
3760 (Arm_input_section::set_exidx_section_link): New method.
3761 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3762 has_errors_ to false.
3763 (Arm_exidx_input_section::has_errors,
3764 Arm_exidx_input_section::set_has_errors): New methods.
3765 (Arm_exidx_input_section::has_errors_): New data member.
3766 (Arm_relobj::get_exidx_shndx_list): New method.
3767 (Arm_output_section::append_text_sections_to_list): Do not skip
3768 section without SHF_EXECINSTR.
3769 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3771 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3772 section header. Make error messages more verbose. Check for
3773 a non-executable section linked to an EXIDX section.
3774 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3775 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3776 check that there is no deferred EXIDX section if we exit early.
3777 Instead of not making an EXIDX section in case of an error, make one
3778 and set the has_errors flag of it.
3779 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3780 in a relocatable link.
3781 (Target_arm::do_relax): Look for the EXIDX output section instead of
3782 assuming that it is called .ARM.exidx.
3783 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3784 section list. Do not check for SHF_EXECINSTR section flags but
3785 skip any input section with errors.
3786 * output.cc (Output_section::Output_section): Initialize
3787 always_keeps_input_sections_ to false.
3788 (Output_section::add_input_section): Check for
3789 always_keeps_input_sections_.
3790 * output.h (Output_section::always_keeps_input_sections,
3791 Output_section::set_always_keeps_input_sections): New methods.
3792 (Output_section::always_keeps_input_sections): New data member.
3794 2010-07-13 Rafael Espindola <espindola@google.com>
3796 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3797 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3799 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3800 Ian Lance Taylor <iant@google.com>
3802 * output.h (Output_section_lookup_maps::add_merge_section):
3803 Correct check of whether value was inserted.
3804 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3805 (Output_section_lookup_maps::add_relaxed_input_section):
3807 * arm.cc (Target_arm::got_section): Remove used local os.
3808 * i386.cc (Target_i386::got_section): Likewise.
3809 * x86_64.cc (Target_x86_64::got_section): Likewise.
3810 * sparc.cc (Target_sparc::got_section): Likewise.
3811 (Target_sparc::relocate): Remove unused local have_got_offset.
3812 * powerpc.cc (Target_powerpc::relocate): Likewise.
3814 2010-07-13 Ian Lance Taylor <iant@google.com>
3816 * compressed_output.cc (zlib_decompress): Fix signature in
3819 * archive.cc (Archive::include_member): Unlock an external member
3820 of a thin archive. Don't bother to delete an object we know is
3823 2010-07-12 Cary Coutant <ccoutant@google.com>
3825 * compressed_output.cc (zlib_decompress): New function.
3826 (get_uncompressed_size): New function.
3827 (decompress_input_section): New function.
3828 * compressed_output.h (get_uncompressed_size): New function.
3829 (decompress_input_section): New function.
3830 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3831 Handle compressed debug sections.
3832 * layout.cc (is_compressed_debug_section): New function.
3833 (Layout::output_section_name): Map compressed section names to
3835 * layout.h (is_compressed_debug_section): New function.
3836 (is_debug_info_section): Recognize compressed debug sections.
3837 * merge.cc: Include compressed_output.h.
3838 (Output_merge_data::do_add_input_section): Handle compressed
3840 (Output_merge_string::do_add_input_section): Handle compressed
3842 * object.cc: Include compressed_output.h.
3843 (Sized_relobj::Sized_relobj): Initialize new data members.
3844 (build_compressed_section_map): New function.
3845 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3846 * object.h (Object::section_is_compressed): New method.
3847 (Object::do_section_is_compressed): New method.
3848 (Sized_relobj::Compressed_section_map): New type.
3849 (Sized_relobj::do_section_is_compressed): New method.
3850 (Sized_relobj::compressed_sections_): New data member.
3851 * output.cc (Output_section::add_input_section): Handle compressed
3853 * reloc.cc: Include compressed_output.h.
3854 (Sized_relobj::write_sections): Handle compressed debug sections.
3856 2010-07-08 Cary Coutant <ccoutant@google.com>
3858 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3859 weak when resolving to a dynamic def.
3860 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3861 for weak undef/dynamic def cases. Adjust callers.
3862 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3863 undef_binding_weak_.
3864 (Symbol_table::sized_write_globals): Adjust symbol binding.
3865 (Symbol_table::sized_write_symbol): Add binding parameter.
3866 * symtab.h (Symbol::set_undef_binding): New method.
3867 (Symbol::is_undef_binding_weak): New method.
3868 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3869 (Symbol_table::should_override): Add new parameter.
3870 (Symbol_table::sized_write_symbol): Add new parameter.
3872 * testsuite/weak_undef_file1.cc: Add new test case.
3873 * testsuite/weak_undef_file2.cc: Fix header comment.
3874 * testsuite/weak_undef_test.cc: Add new test case.
3876 2010-06-29 Doug Kwan <dougkwan@google.com>
3878 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3879 Initialize USE_SYMBOL_.
3880 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3882 (Arm_reloc_property::uses_symbol_): New data member declaration.
3883 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3884 uses symbol value and symbol is undefined but not weakly undefined.
3886 2010-06-28 Rafael Espindola <espindola@google.com>
3888 * plugin.cc (Plugin::load): Use dlerror.
3890 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3892 * symtab.cc (detect_odr_violations): When reporting an ODR
3893 violation, report an object where the symbol is defined.
3895 2010-06-25 Doug Kwan <dougkwan@google.com>
3897 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3898 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3900 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3901 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3902 target hook to detect function points.
3903 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3904 * icf.h (Icf::check_section_for_function_pointers): Change type of
3905 parameter SECTION_NAME to const reference to std::string. Use
3906 target hook to determine if section may have unsafe pointers.
3907 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3910 2010-06-21 Rafael Espindola <espindola@google.com>
3912 * fileread.cc (Input_file::find_fie): New
3913 (Input_file::open): Use Input_file::find_fie.
3914 * fileread.h (Input_file::find_fie): New
3915 * plugin.cc (set_extra_library_path): New.
3916 (Plugin::load): Add set_extra_library_path to the transfer vector.
3917 (Plugin_manager::set_extra_library_path): New.
3918 (Plugin_manager::add_input_file): Use the extra search path if set.
3919 (set_extra_library_path(): New.
3920 * plugin.h (Plugin_manager): Add set_extra_library_path and
3923 2010-06-19 Cary Coutant <ccoutant@google.com>
3925 * layout.cc (gdb_sections): Add .debug_types.
3926 (lines_only_debug_sections): Likewise.
3928 2010-06-18 Rafael Espindola <espindola@google.com>
3930 * plugin.cc (add_input_file,add_input_library)
3931 (Plugin_manager::add_input_file): Make filename arguments const.
3932 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3935 2010-06-16 Doug Kwan <dougkwan@google.com>
3937 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3938 .ARM.attributes section if we have not merged any input
3939 attributes sections.
3941 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3943 * arm.cc: Allow combining objects with no EABI version
3946 2010-06-15 Rafael Espindola <espindola@google.com>
3948 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3950 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3952 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3953 (struct iovec): Correct !HAVE_READV definition.
3955 2010-06-10 Cary Coutant <ccoutant@google.com>
3957 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3958 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3960 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3963 * symtab.h (Symbol::is_placeholder): New member function.
3964 * target-reloc.h (relocate_section): Check for placeholder symbols.
3966 * testsuite/Makefile.am (plugin_test_8): New test.
3967 (plugin_test_9): New test.
3968 * testsuite/Makefile.in: Regenerate.
3970 2010-06-09 Nick Clifton <nickc@redhat.com>
3972 * yyscript.y (input_list_element): Allow strings prefixed with
3973 the '-' character. Treat these as libraries.
3974 * script.cc (script_add_library): New function. Adds a library
3975 specified by "-l<name>" found in an input script.
3976 * script-c.h: Add prototype for script_add_library.
3978 2010-06-07 Doug Kwan <dougkwan@google.com>
3980 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3981 Restrict stub-group size to be within long conditional branch
3982 range when working around cortex-A8 erratum.
3984 2010-06-07 Damien Diederen <dd@crosstwine.com>
3986 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3989 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3993 (Output_section::Input_section_sort_entry::compare_section_ordering):
3994 Change to return non-zero correctly.
3995 (Output_section::Input_section_sort_section_order_index_compare
3996 ::operator()): Change to fix ambiguity in comparisons.
3998 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4000 * gold.h (is_wildcard_string): New function.
4001 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4002 (Layout::layout_eh_frame): Ditto.
4003 (Layout::find_section_order_index): New method.
4004 (Layout::read_layout_from_file): New method.
4005 * layout.h (Layout::find_section_order_index): New method.
4006 (Layout::read_layout_from_file): New method.
4007 (Layout::input_section_position_): New private member.
4008 (Layout::input_section_glob_): New private member.
4009 * main.cc (main): Call read_layout_from_file here.
4010 * options.h (--section-ordering-file): New option.
4011 * output.cc (Output_section::input_section_order_specified_): New
4013 (Output_section::Output_section): Initialize new member.
4014 (Output_section::add_input_section): Add new parameter.
4015 Keep input sections when --section-ordering-file is used.
4016 (Output_section::set_final_data_size): Sort input sections when
4017 section ordering file is specified.
4018 (Output_section::Input_section_sort_entry): Add new parameter.
4020 (Output_section::Input_section_sort_entry::compare_section_ordering):
4022 (Output_section::Input_section_sort_compare::operator()): Change to
4023 consider section_order_index.
4024 (Output_section::Input_section_sort_init_fini_compare::operator()):
4025 Change to consider section_order_index.
4026 (Output_section::Input_section_sort_section_order_index_compare
4027 ::operator()): New method.
4028 (Output_section::sort_attached_input_sections): Change to sort
4029 according to section order when specified.
4030 (Output_section::add_input_section<32, true>): Add new parameter.
4031 (Output_section::add_input_section<64, true>): Add new parameter.
4032 (Output_section::add_input_section<32, false>): Add new parameter.
4033 (Output_section::add_input_section<64, false>): Add new parameter.
4034 * output.h (Output_section::add_input_section): Add new parameter.
4035 (Output_section::input_section_order_specified): New
4037 (Output_section::set_input_section_order_specified): New method.
4038 (Input_section::Input_section): Initialize section_order_index_.
4039 (Input_section::section_order_index): New method.
4040 (Input_section::set_section_order_index): New method.
4041 (Input_section::section_order_index_): New member.
4042 (Input_section::Input_section_sort_section_order_index_compare): New
4044 (Output_section::input_section_order_specified_): New member.
4045 * script-sections.cc (is_wildcard_string): Delete and move modified
4047 (Output_section_element_input::Output_section_element_input): Modify
4048 call to is_wildcard_string.
4049 (Output_section_element_input::Input_section_pattern
4050 ::Input_section_pattern): Ditto.
4051 (Output_section_element_input::Output_section_element_input): Ditto.
4052 * testsuite/Makefile.am (final_layout): New test case.
4053 * testsuite/Makefile.in: Regenerate.
4054 * testsuite/final_layout.cc: New file.
4055 * testsuite/final_layout.sh: New file.
4057 2010-06-01 Rafael Espindola <espindola@google.com>
4059 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4061 2010-06-01 Rafael Espindola <espindola@google.com>
4063 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4064 visibility of symbols.
4066 2010-05-27 Doug Kwan <dougkwan@google.com>
4068 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4069 from start of output section instead of address for a local symbol
4070 in a merged or relaxed section when doing a relocatable link.
4072 2010-05-26 Rafael Espindola <espindola@google.com>
4075 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4076 adding sections the garbage collector removed.
4077 * gold/testsuite/Makefile.am: Add test.
4078 * gold/testsuite/Makefile.in: Regenerate.
4079 * gold/testsuite/plugin_test_7.sh: New.
4080 * gold/testsuite/plugin_test_7_1.c: New.
4081 * gold/testsuite/plugin_test_7_2.c: New.
4083 2010-05-26 Rafael Espindola <espindola@google.com>
4085 * script-sections.cc (Output_section_definition::set_section_addresses):
4086 Check for --section-start.
4088 2010-05-26 Doug Kwan <dougkwan@google.com>
4090 * arm.cc (Arm_scan_relocatable_relocs): New class.
4091 (Target_arm::relocate_special_relocatable): New method.
4092 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4093 (Arm_relocate_functions::thumb_branch_common): Same.
4094 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4095 instead of Default_scan_relocatable_relocs.
4096 * target-reloc.h (relocate_for_relocatable): Let target handle
4097 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4098 * target.h (Sized_target::relocate_special_relocatable): New method.
4100 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4102 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4104 2010-05-23 Doug Kwan <dougkwan@google.com>
4106 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4108 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4109 with a direct branch, not a conditional branch, to a stub.
4110 * merge.cc (Output_merge_base::record_input_section): New method
4112 (Output_merge_data::do_add_input_section): Record input section if
4113 keeps-input-sections flag is set.
4114 (Output_merge_string::do_add_input_section): Ditto.
4115 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4116 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4118 (Output_merge_base::keeps_input_sections,
4119 Output_merge_base::set_keeps_input_sections,
4120 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4122 (Output_merge_base::Input_sections): New type declaration.
4123 (Output_merge_base::input_sections_begin,
4124 Output_merge_base::input_sections_end,
4125 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4126 (Output_merge_base::bool keeps_input_sections_,
4127 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4128 Output_merge_base::input_sections_): New data members.
4129 (Output_merge_data::do_set_keeps_input_sections): New method
4131 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4132 * output.cc (Output_section::Input_section::relobj): Move method
4133 defintion from class declaration to here and handle merge sections.
4134 (Output_section::Input_section::shndx): Ditto.
4135 (Output_section::Output_section): Remove initializations of removed
4136 data members and initialize new data member LOOKUP_MAPS_.
4137 (Output_section::add_input_section): Set keeps-input-sections flag
4138 for a newly created merge output section as appropriate. Adjust code
4139 to use Output_section_lookup_maps class.
4140 (Output_section::add_relaxed_input_section): Adjst code for lookup
4141 maps code refactoring.
4142 (Output_section::add_merge_input_section): Add a new parameter
4143 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4144 class. If adding input section to a newly created merge output
4145 section fails, remove the new merge section.
4146 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4147 Adjust code for use of the Output_section_lookup_maps class.
4148 (Output_section::find_merge_section): Ditto.
4149 (Output_section::build_lookup_maps): New method defintion.
4150 (Output_section::find_relaxed_input_section): Adjust code to use
4151 Output_section_lookup_maps class.
4152 (Output_section::get_input_sections): Export merge sections. Adjust
4153 code to use Output_section_lookup_maps class.
4154 (Output_section:::add_script_input_section): Adjust code to use
4155 Output_section_lookup_maps class. Update lookup maps for merge
4157 (Output_section::discard_states): Use Output_section_lookup_maps.
4158 (Output_section::restore_states): Same.
4159 * output.h (Merge_section_properties): Move class defintion out of
4161 (Output_section_lookup_maps): New class.
4162 (Output_section::Input_section::is_merge_section): New method
4164 (Output_section::Input_section::relobj): Move defintion out of class
4165 defintion. Declare method only.
4166 (Output_section::Input_section::shndx): Ditto.
4167 (Output_section::Input_section::output_merge_base): New method defintion.
4168 (Output_section::Input_section::u2_.pomb): New union field.
4169 (Output_section::Merge_section_by_properties_map,
4170 Output_section::Output_section_data_by_input_section_map,
4171 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4173 (Output_section::add_merge_input_section): Add new parameter
4174 KEEPS_INPUT_SECTIONS.
4175 (Output_section::build_lookup_maps): New method declaration.
4176 (Output_section::merge_section_map_,
4177 Output_section::merge_section_by_properties_map_,
4178 Output_section::relaxed_input_section_map_,
4179 Output_section::is_relaxed_input_section_map_valid_): Remove data
4181 (Output_section::lookup_maps_): New data member.
4183 2010-05-21 Doug Kwan <dougkwan@google.com>
4186 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4187 avoid a compilation error.
4189 2010-05-19 Rafael Espindola <espindola@google.com>
4191 * script-sections.cc (Output_section_definition::allocate_to_segment):
4192 Update the phdrs_list even when the output section is NULL.
4193 * testsuite/Makefile.am: Add test.
4194 * testsuite/Makefile.in: Regenerate.
4195 * testsuite/script_test_9.cc: New.
4196 * testsuite/script_test_9.sh: New.
4197 * testsuite/script_test_9.t: New.
4199 2010-05-19 Doug Kwan <dougkwan@google.com>
4201 * arm.cc (Arm_input_section::original_size): New method.
4202 (Arm_input_section::do_addralign): Add a cast.
4203 (Arm_input_section::do_output_offset): Remove static cast.
4204 (Arm_input_section::original_addralign,
4205 Arm_input_section::original_size_): Change type to uint32_t.
4206 (Arm_input_section::init): Add safe casts for section alignment
4208 (Arm_input_section::set_final_data_size): Do not set address and
4209 offset of stub table.
4210 (Arm_output_section::fix_exidx_coverage): Change use of of
4211 Output_section::Simple_input_section to that of
4212 Output_section::Input_section.
4213 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4214 except for the first pass.
4215 * output.cc (Output_section::get_input_sections): Change type of
4216 input_sections to std::list<Input_section>.
4217 (Output_section::add_script_input_section): Rename from
4218 Output_section::add_simple_input_section. Change type of SIS
4219 parameter from Simple_input_section to Input_section.
4220 * output.h (Output_section::Simple_input_section): Remove class.
4221 (Output_section::Input_section): Change class visibility to public.
4222 (Output_section::Input_section::addralign): Use stored alignments
4223 for special input sections if set.
4224 (Output_section::Input_section::set_addralign): New method.
4225 (Output_section::get_input_sections): Change parameter type from
4226 list of Simple_input_section to list of Input_section.
4227 (Output_section::add_script_input_section): Rename from
4228 Output_section::add_simple_input_section. Change first parameter's
4229 type from Simple_input_section to Input_section and remove the
4230 second and third parameters.
4231 * script-sections.cc (Input_section::Input_section_list): Change
4232 type to list of Output_section::Input_section/
4233 (Input_section_info::Input_section_info): Change parameter type of
4234 INPUT_SECTION to Output_section::Input_section.
4235 (Input_section_info::input_section): Change return type.
4236 (Input_section_info::input_section_): Change type to
4237 Output_section::Input_section.
4238 (Output_section_element_input::set_section_addresses): Adjust code
4239 to use Output_section::Input_section instead of
4240 Output_section::Simple_input_section. Adjust code for renaming
4241 of Output_section::add_simple_input_section.
4242 (Orphan_output_section::set_section_addresses): Ditto.
4244 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4246 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4247 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4249 2010-05-18 Rafael Espindola <espindola@google.com>
4251 * options.cc (General_options::finalize): Handle -nostdlib.
4252 * options.h (nostdlib): New option.
4253 * script.cc (script_add_search_dir): Handle -nostdlib.
4255 2010-05-12 Doug Kwan <dougkwan@google.com>
4257 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4258 attributes section only if there no attributes section after merging.
4259 (Target_arm::merge_object_attributes): Move value of
4260 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4261 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4262 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4263 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4264 and arm_attr_merge_7.stdout.
4265 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4266 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4267 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4268 arm_attr_merge_7b.o): New rules.
4269 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4271 * testsuite/Makefile.in: Regenerate.
4272 * testsuite/arm_attr_merge.sh: New file.
4273 * testsuite/arm_attr_merge_[67][ab].s: Same.
4275 2010-05-05 Nick Clifton <nickc@redhat.com>
4277 * po/es.po: Updated Spanish translation.
4279 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4281 * Makefile.am (install-exec-local): Properly install gold as
4282 default cross linker.
4283 * Makefile.in: Regenerated.
4285 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4286 Nick Clifton <nickc@redhat.com>
4288 * configure.ac (install_as_default): Define and set to false
4289 unless --enable-gold or --enable-gold=both/gold has been
4291 * configure: Regenerate.
4293 * Makefile.am (install-exec-local): Install the executable as
4294 'ld.gold'. If install_as_default is true then also install it as
4296 * Makefile.in: Regenerated.
4298 2010-04-24 Ian Lance Taylor <iant@google.com>
4300 * layout.cc (Layout::layout_reloc): In relocatable link don't
4301 combine reloc sections for grouped sections.
4303 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4305 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4306 sections that are not ordinary to icf.
4307 * icf.cc (get_section_contents): Handle relocation pointing to section
4308 with no object or shndx information.
4309 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4310 * testsuite/Makefile.in: Regenerate.
4311 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4312 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4314 2010-04-22 Ian Lance Taylor <iant@google.com>
4316 * expression.cc (Expression::Expression_eval_info): Add
4317 result_alignment_pointer field.
4318 (Expression::eval_with_dot): Add result_alignment_pointer
4319 parameter. Change all callers.
4320 (Expression::eval_maybe_dot): Likewise.
4321 (class Binary_expression): Add alignment_pointer parameter to
4322 left_value and right_value. Change all callers.
4323 (BINARY_EXPRESSION): Set result alignment.
4324 (class Trinary_expression): Add alignment_pointer parameter to
4325 arg2_value and arg3_value. Change all callers.
4326 (Trinary_cond::value): Set result alignment.
4327 (Max_expression::value, Min_expression::value): Likewise.
4328 (Align_expression::value): Likewise.
4329 * script-sections.cc (class Sections_element): Add dot_alignment
4330 parameter to set_section_addresses virtual function. Update
4332 (class Output_section_element): Likewise.
4333 (Script_sections::create_segments): Add dot_alignment parameter.
4335 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4336 (Script_sections::set_phdrs_clause_addresses): Likewise.
4337 * script-sections.h: Update declarations.
4338 * script.h: Update declarations.
4339 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4341 * testsuite/script_test_3.t: Set large alignment.
4342 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4343 segment has expected alignment.
4345 2010-04-22 Nick Clifton <nickc@redhat.com>
4347 * po/gold.pot: Updated by the Translation project.
4348 * po/vi.po: Updated Vietnamese translation.
4350 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4352 * testsuite/Makefile.am (check_PROGRAMS): Add
4353 icf_virtual_function_folding_test.
4354 * testsuite/Makefile.in: Regenerated.
4356 2010-04-15 Andrew Haley <aph@redhat.com>
4358 * options.h (merge_exidx_entries): New option.
4359 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4360 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4361 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4362 (Target_arm::merge_exidx_entries): New function.
4363 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4364 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4365 to Arm_exidx_fixup constructor.
4366 Add new arg, merge_exidx_entries.
4367 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4368 Arm_output_section::fix_exidx_coverage.
4370 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4372 * icf.cc (get_section_contents): Check for preemptible functions.
4373 Ignore addend when appropriate.
4374 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4376 (add_from_relobj): Check for section folded.
4377 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4378 * symtab.h (should_add_dynsym_entry): Add new parameter.
4379 * target-reloc.h (scan_relocs): Check for section folded.
4380 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4381 Check reloc types for function pointers in shared objects.
4382 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4384 (icf_preemptible_functions_test): New test case.
4385 (icf_string_merge_test): New test case.
4386 * testsuite.Makefile.in: Regenerate.
4387 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4388 bar_glob. Refactor code.
4389 * testsuite/icf_preemptible_functions_test.cc: New file.
4390 * testsuite/icf_preemptible_functions_test.sh: New file.
4391 * testsuite/icf_string_merge_test.cc: New file.
4392 * testsuite/icf_string_merge_test.sh: New file.
4393 * testsuite/icf_virtual_function_folding_test.cc: New file.
4394 * testsuite/icf_virtual_function_folding_test.sh: New file.
4396 2010-04-14 Doug Kwan <dougkwan@google.com>
4398 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4399 for local symbol recounting if we remove a section due to ICF.
4400 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4401 there are no regular objects in input.
4403 2010-04-13 Doug Kwan <dougkwan@google.com>
4405 * arm.cc (Arm_input_section::set_final_data_size): Compute
4406 accurate final data size instead of using current data size.
4408 2010-04-09 Doug Kwan <dougkwan@google.com>
4410 * layout.cc (Layout::choose_output_section): Handle script section
4412 (Layout::make_output_section_for_script): Add section type parameter.
4413 Handle script section types.
4414 * layout.h (Layout::make_output_section_for_script): Add section
4416 * output.cc (Output_section::Output_section): Initialize data member
4418 (Output_section::do_reset_address_and_file_offset): Do not set address
4419 to 0 if section is a NOLOAD section.
4420 * output.h (Output_section::is_noload): New method.
4421 (Output_section::set_is_noload): Ditto.
4422 (Output_section::is_noload_): New data member.
4423 * script-c.h (Script_section_type): New enum type.
4424 (struct Parser_output_section_header): Add new file section_type.
4425 * script-sections.cc (Sections_element::output_section_name): Add
4426 parameter for returning script section type.
4427 (Output_section_definition::output_section_name): Ditto.
4428 (Output_section_definition::section_type)P; New method.
4429 (Output_section_definiton::script_section_type_name): Ditto.
4430 (Output_section_definition::script_section_type_): New data member.
4431 (Output_section_definition::Output_section_definition): Initialize
4432 data member Output_section_definition::script_section_type_.
4433 (Output_section_definition::create_sections): Pass script section type
4434 to Layout::make_output_section_for_script.
4435 (Output_section_definition::output_section_name): Return script
4436 section type to caller.
4437 (Output_section_definition::set_section_address): Do not advance
4438 dot value and load address if section type is NOLOAD. Set address
4439 of NOLOAD sections regardless of section flags.
4440 (Output_section_definition::print): Print section type if it is
4441 not SCRIPT_SECTION_TYPE_NONE.
4442 (Output_section_definition::section_type): New method.
4443 (Output_section_definition::script_section_type_name): Ditto.
4444 (Script_sections::output_section_name): Add new parameter
4445 PSECTION_TYPE for returning script section type. Pass it to
4446 section elements. Handle discard sections.
4447 (Sort_output_sections::operator()): Handle NOLOAD sections.
4448 * script-sections.h (Script_sections::Section_type): New enum type.
4449 (Script_sections::output_section_name): Add a new parameter for
4450 returning script section type.
4451 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4453 * yyscript.y (union): Add new field SECTION_TYPE.
4454 (COPY, DSECT, INFO, NOLOAD): New tokens.
4455 (opt_address_and_section_type): Change type to output_section_header.
4456 (section_type): New non-terminal
4457 (section_header): Handle section type.
4458 (opt_address_and_section_type): Return section type value.
4460 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4462 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4463 * testsuite/plugin_common_test_2.c (foo): Likewise.
4465 2010-04-08 Doug Kwan <dougkwan@google.com>
4467 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4469 * output.cc (Output_section::add_merge_input_section): Simplify
4470 code and return status of Output_merge_base::add_input_section.
4471 Update merge section map only if Output_merge_base::add_input_section
4474 2010-04-07 Doug Kwan <dougkwan@google.com>
4476 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4477 if section is marked as containing instructions but has no mapping
4479 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4480 correct section index.
4481 (Arm_relobj::find_linked_text_section): Ditto.
4483 2010-04-07 Cary Coutant <ccoutant@google.com>
4485 * archive.cc (include_member): Destroy Read_symbols_data object before
4487 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4488 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4489 (Read_symbols_data::~Read_symbols_data) New destructor.
4490 (Section_relocs::Section_relocs) New constructor.
4491 (Section_relocs::~Section_relocs) New destructor.
4492 (Read_relocs_data::Read_relocs_data) New constructor.
4493 (Read_relocs_data::~Read_relocs_data) New destructor.
4494 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4495 pointers to NULL after deleting.
4497 2010-04-07 Doug Kwan <dougkwan@google.com>
4499 * arm.cc: Replace "endianity" with "endianness" in comments.
4500 (Arm_exidx_cantunwind): Ditto.
4501 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4502 (Arm_relobj::merge_flags_and_attributes): New method.
4503 (Arm_relobj::merge_flags_and_attributes_): New data member.
4504 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4505 (Arm_relobj::scan_sections_for_stubs): Ditto.
4506 (Arm_relobj::do_read_symbols): Check to see if we really want to
4507 merge processor-specific flags and attributes. Exit early if
4508 an object is empty except for section names and the undefined symbol.
4509 (Target_arm::do_finalize_sections): Move check for ELF format to
4510 Arm_relobj::do_read_symbols. Merge processor specific flags and
4511 attributes from a regular object only when we have determined that
4512 it is aapropriate. Do not create an .ARM.attributes section in
4513 output if there is no regular input object.
4514 (Target_arm::merge_processor_specific_flags): Check
4515 --warn-mismatch before printing any error.
4516 (Target_arm::merge_object_attributes): Ditto.
4517 * gold.cc (queue_middle_tasks): Handle the case in which there is
4518 no regular object in input.
4519 * options.cc (General_options::parse_EB): New method.
4520 (General_options::parse_EL): Same.
4521 (General_options::General_options): Initialize endianness_.
4522 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4524 (General_options::Endianness): New enum.
4525 (General_options::endianness): New method.
4526 (General_options::endianness_): New data member.
4527 * parameters.cc (Parameters::set_options): Check target endianness.
4528 (Parameters::set_target_once): Ditto.
4529 (Parameters::check_target_endianness): New method.
4530 (parameters_force_valid_target): If either -EL or -EB is specified,
4531 use it to define endianness of default target.
4532 * parameters.h (Parameters::check_target_endianness): New method
4534 * target.h (class Target): Change "endianity" to "endianness"
4537 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4539 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4540 * configure: Regenerate.
4541 * Makefile.in: Regenerate.
4542 * testsuite/Makefile.in: Regenerate.
4544 2010-04-06 Cary Coutant <ccoutant@google.com>
4547 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4548 prevailing definitions of common symbols.
4549 * testsuite/plugin_test_6.sh: New test case.
4550 * testsuite/plugin_common_test_1.c: New test case.
4551 * testsuite/plugin_common_test_2.c: New test case.
4552 * testsuite/Makefile.am (plugin_test_6): New test case.
4553 * testsuite/Makefile.in: Regenerate.
4555 2010-04-06 Nick Clifton <nickc@redhat.com>
4557 * po/vi.po: New Vietnamese translation.
4559 2010-03-30 Doug Kwan <dougkwan@google.com>
4561 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4563 2010-03-25 Doug Kwan <dougkwan@google.com>
4565 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4566 to avoid a conversion warning on a 32-bit host.
4568 2010-03-24 Ian Lance Taylor <iant@google.com>
4570 * testsuite/script_test_3.t: Add a TLS segment.
4571 * testsuite/Makefile.am (check_PROGRAMS): Add
4572 tls_phdrs_script_test.
4573 (tls_phdrs_script_test_SOURCES): Define.
4574 (tls_phdrs_script_test_DEPENDENCIES): Define.
4575 (tls_phdrs_script_test_LDFLAGS): Define.
4576 (tls_phdrs_script_test_LDADD): Define.
4577 * testsuite/Makefile.in: Rebuild.
4579 2010-03-23 Cary Coutant <ccoutant@google.com>
4581 * fileread.cc (find_or_make_view): Fix comment.
4583 2010-03-23 Ian Lance Taylor <iant@google.com>
4585 * script-sections.cc (class Orphan_section_placement): Define
4586 PLACE_TLS and PLACE_TLS_BSS.
4587 (Orphan_section_placement::Orphan_section_placement): Initialize
4589 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4590 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4591 (tls_script_test_SOURCES): Define.
4592 (tls_script_test_DEPENDENCIES): Define.
4593 (tls_script_test_LDFLAGS): Define.
4594 (tls_script_test_LDADD): Define.
4595 * testsuite/Makefile.in: Rebuild.
4597 2010-03-22 Doug Kwan <dougkwan@google.com>
4599 * arm.cc (Arm_relocate_functions::abs8,
4600 Arm_relocate_functions::abs16): Use correct check for overflow
4601 specified in the ARM ELF specs.
4602 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4603 target of a BLX instruction specially.
4604 (Reloc_stub::stub_type_for_reloc): Ditto.
4605 (Relocate::relocate): Use symbolic names instead of numeric relocation
4606 codes to report error.
4607 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4609 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4610 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4611 thumb2_blx_out_of_range.stdout
4612 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4613 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4614 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4615 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4616 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4617 thumb2_blx_in_range, thumb2_blx_in_range.o,
4618 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4619 thumb2_blx_out_of_range.o): New rules.
4620 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4621 thumb2_blx_in_range and thumb2_blx_out_of_range.
4622 * testsuite/Makefile.in: Regenerate.
4623 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4624 * testsuite/thumb_blx_in_range.s: New file.
4625 * testsuite/thumb_blx_out_of_range.s: New file.
4627 2010-03-22 Rafael Espindola <espindola@google.com>
4629 * archive.cc (Should_include): Move to archive.h.
4630 (should_include_member): Make it a member of Archive.
4632 (Add_lib_group_symbols): New.
4633 * archive.h: Include options.h.
4634 (Archive_member): Moved from Archive.
4635 (Should_include): Moved from archive.cc.
4637 (Add_lib_group_symbols): New.
4638 * dynobj.cc (do_should_include_member): New.
4639 * dynobj.h (do_should_include_member): New.
4640 * gold.cc (queue_initial_tasks): Update call to queue.
4641 * main.cc (main): Print lib group stats.
4642 * object.cc (do_should_include_member): New.
4643 * object.h: Include archive.h.
4644 (Object::should_include_member): New.
4645 (Object::do_should_include_member): New.
4646 (Sized_relobj::do_should_include_member): New.
4647 * options.cc (General_options::parse_start_lib): New.
4648 (General_options::parse_end_lib): New.
4649 (Input_arguments::add_file): Handle lib groups.
4650 (Input_arguments::start_group): Check we are not in a lib.
4651 (Input_arguments::start_lib): New.
4652 (Input_arguments::end_lib): New.
4653 * options.h (General_options): Add start_lib and end_lib.
4654 (Input_argument::lib_): New.
4655 (Input_argument::lib): New.
4656 (Input_argument::is_lib): New.
4657 (Input_file_lib): New.
4658 (Input_arguments::in_lib_): New.
4659 (Input_arguments::in_lib): New.
4660 (Input_arguments::start_lib): New.
4661 (Input_arguments::end_lib_): New.
4662 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4663 in unused members as preempted.
4664 (Sized_pluginobj::do_should_include_member): New.
4665 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4666 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4668 (Read_symbols::do_whole_lib_group): New.
4669 (Read_symbols::do_lib_group): New.
4670 (Read_symbols::do_read_symbols): Handle lib groups.
4671 (Read_symbols::get_name): Handle lib groups.
4672 * readsyms.h (Read_symbols): Add an archive member pointer.
4673 (Read_symbols::do_whole_lib_group): New.
4674 (Read_symbols::do_lib_group): New.
4675 (Read_symbols::member_): New.
4676 * script.cc (read_input_script): Update call to queue_soon.
4678 2010-03-19 Doug Kwan <dougkwan@google.com>
4680 * arm.cc (Stub_table::Stub_table): Initialize new data members
4681 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4682 (Stub_table::add_reloc_stub): Assign stub offset and update
4683 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4684 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4686 (Stub_table::update_data_size_and_addralign): Use
4687 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4688 instead of going over all reloc stubs.
4689 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4690 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4691 Stringpool_template::offset_ to size of Stringpool_char.
4692 (Stringpool_template::new_key_offset): Remove code to initialize
4693 Stringpool_template::offset_.
4694 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4695 Stringpool_template::offset_ to zero.
4697 2010-03-15 Doug Kwan <dougkwan@google.com>
4699 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4701 (Stringpool_template::new_key_offset): New method.
4702 (Stringpool_template::add_string): Assign offsets when adding new
4704 (Stringpool_template::set_string_offsets): Do not set string offsets
4705 when not optimizing.
4706 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4708 (Chunked_vector::clear): Clear size_.
4709 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4710 (Chunked_vector::size): Return size_.
4711 (Chunked_vector::push_back): Use size_ to find insert position.
4712 (Chunked_vector::size_): New data member.
4713 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4714 (Stringpool_template::new_key_offset): New method declaration.
4715 (Stringpool_template::offset_): New data member.
4717 2010-03-15 Rafael Espindola <espindola@google.com>
4719 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4720 Add_symbols' constructor.
4721 * readsyms.h (Add_symbols): Remove the input_group member.
4723 2010-03-10 Ian Lance Taylor <iant@google.com>
4725 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4726 target to ask whether a reference to a symbol requires a stack
4728 * target.h (Target::is_call_to_non_split): New function.
4729 (Target::do_is_call_to_non_split): Declare virtual function.
4730 * target.cc: Include "symtab.h".
4731 (Target::do_is_call_to_non_split): New function.
4732 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4734 2010-03-10 Cary Coutant <ccoutant@google.com>
4736 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4737 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4738 (File_read::open[2]): Add whole_file_view_ to list of views.
4739 (File_read::make_view): Remove test of whole_file_view_.
4740 (File_read::find_or_make_view): Create whole_file_view_ if
4742 (File_read::clear_views): Replace bool parameter with enum;
4743 adjust all callers. Don't delete views with permanent data;
4744 do delete cached views and views from archives if
4745 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4746 if clearing the corresponding view.
4747 * fileread.h (File_read::Clear_views_mode): New enum.
4748 (File_read::View::is_permanent_view): New method.
4749 (File_read::clear_views): Replace bool parameter
4750 with enum; adjust all callers.
4751 * options.h (General_options): Change keep_files_mapped option;
4752 add map_whole_files.
4753 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4755 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4758 2010-03-10 David S. Miller <davem@davemloft.net>
4760 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4762 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4764 * icf.cc (get_section_contents): Add '@' marker after processing the
4767 2010-03-08 Doug Kwan <dougkwan@google.com>
4769 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4770 due to a conversion warning.
4771 (Arm_relobj::update_output_local_symbol_count): Check for local
4772 symbol with unset output index.
4774 2010-03-05 Ian Lance Taylor <iant@google.com>
4776 * options.h (class General_options): Add --spare-dynamic-tags.
4777 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4778 --spare-dynamic-tags.
4780 2010-03-05 Ian Lance Taylor <iant@google.com>
4782 * incremental.cc: Include "libiberty.h".
4784 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4786 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4787 function, is_info_ member.
4788 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4789 (Versions::Versions): Update caller.
4790 (Versions::define_base_version): Likewise.
4791 (Versions::add_def): Likewise.
4793 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4795 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4796 (Scan::possible_function_pointer_reloc): New function.
4797 (Scan::local_reloc_may_be_function_pointer): Change to call
4798 possible_function_pointer_reloc.
4799 (Scan::global_reloc_may_be_function_pointer): Ditto.
4800 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4801 relocations in ".data.rel.ro._ZTV" section.
4802 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4803 * testsuite/icf_safe_so_test.cc: Ditto.
4804 * testsuite/icf_safe_test.cc: Ditto.
4805 * testsuite/icf_safe_test.sh: Ditto.
4807 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4808 Ian Lance Taylor <iant@google.com>
4810 * target-reloc.h (relocate_section): Check the symbol table index
4811 for -1U before setting the local symbol index.
4812 (scan_relocatable_relocs): If copying the relocation, record that
4813 the local symbol is required.
4814 * object.h (Symbol_value::is_output_symtab_index_set): New
4816 (Symbol_value::may_be_discarded_from_output_symtab): New
4818 (Symbol_value::has_output_symtab_entry): New function.
4819 (Symbol_value::needs_output_symtab_entry): Remove.
4820 (Symbol_value::output_symtab_index): Make sure the symbol index is
4822 (Symbol_value::set_output_symtab_index): Make sure the symbol
4823 index is not set. Make sure the new index is valid.
4824 (Symbol_value::set_must_have_output_symtab_entry): New function.
4825 (Symbol_value::has_output_dynsym_entry): New function.
4826 (Symbol_value::set_output_dynsym_index): Make sure the new index
4828 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4829 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4830 local symbol if permitted.
4831 (Sized_relobj::do_finalize_local_symbols): Call
4832 is_output_symtab_index_set rather than needs_output_symtab_entry.
4833 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4834 rather than needs_output_symtab_entry. Call
4835 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4836 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4837 is_output_symtab_index_set rather than needs_output_symtab_entry.
4838 * testsuite/discard_locals_relocatable_test.c: New file.
4839 * testsuite/discard_locals_test.sh: Test -r.
4840 * testsuite/Makefile.am (check_DATA): Add
4841 discard_locals_relocatable_test1.syms,
4842 discard_local_relocatable_test2.syms.
4843 (MOSTLYCLEANFILES): Likewise. Also add
4844 discard_locals_relocatable_test1.lout and
4845 discard_locals_relocatable_test2.out.
4846 (discard_locals_relocatable_test1.syms): New target.
4847 (discard_locals_relocatable_test.o): New target.
4848 (discard_locals_relocatable_test1.out): New target.
4849 (discard_locals_relocatable_test2.syms): New target.
4850 (discard_locals_relocatable_test2.out): New target.
4851 (various): Add missing ../ld-new dependencies.
4852 * testsuite/Makefile.in: Rebuild.
4854 2010-03-03 Nick Clifton <nickc@redhat.com>
4856 * po/fi.po: New Finnish translation.
4858 2010-03-01 Doug Kwan <dougkwan@google.com>
4860 * layout.cc (Layout::Layout): Force section types of .init_array*,
4861 .preinit_array* and .fini_array* sections.
4862 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4863 Fix check of return value of std::string::find.().
4864 (Output_section::Input_section_sort_compare::operator()): Remove
4865 comment about .init_array.
4866 (Output_section::Input_section_sort_init_fini_compare::operator()):
4868 (Output_section::sort_attached_input_sections): Handle .init_array
4869 and .fini_array specially.
4870 * output.h (Output_section::Inut_section_sort_compare): Update
4872 (Output_section::Input_section_sort_init_fini_compare): New struct.
4874 2010-02-26 Doug Kwan <dougkwan@google.com>
4876 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4877 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4878 * testsuite/debug_msg.sh: Avoid matching source line number for
4879 use of global variable undef_int.
4881 2010-02-26 Doug Kwan <dougkwan@google.com>
4883 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4884 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4885 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4886 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4887 * options.cc (General_options::General_options): Initialize member
4889 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4890 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4891 and rm_no_fix_v4bx.stdout
4892 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4893 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4894 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4895 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4896 and arm_no_fix_v4bx.
4897 * Makefile.in: Regenerate.
4898 * testsuite/arm_fix_v4bx.s: New file.
4899 * testsuite/arm_fix_v4bx.sh: Ditto.
4901 2010-02-24 Doug Kwan <dougkwan@google.com>
4903 * arm.cc (Target_arm::got_section): Make the .got section the first
4904 non RELRO section in the data segment.
4905 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4906 suffixes of section names.
4908 2010-02-24 Doug Kwan <dougkwan@google.com>
4910 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4911 flags and attributes merging if an input file is a binary file.
4912 * fileread.cc (Input_file::open): Record format of original file.
4913 * fileread.h (Input_file::Format): New enum type.
4914 (Input_file::Input_file): Initialize data member format_.
4915 (Input_file::format): New method definition.
4916 (Input_file::format_):: New data member.
4918 2010-02-24 Doug Kwan <dougkwan@google.com>
4920 * arm.cc (Arm_output_data_got): New class.
4921 (ARM_TCB_SIZE): New constant
4922 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4923 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4924 If user uses a script with a SECTIONS clause, issue only a warning
4925 for a misplaced EXIDX input section. Otherwise, issue an error.
4926 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4928 (Target_arm::got_mode_index_entry): Handle static linking.
4929 (Target_arm::Scan::local): Ditto.
4930 (Target_arm::Scan::global): Ditto.
4931 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4932 all incorrectly implemented relocations.
4933 (Target_arm::fix_exidx_coverage): Pass layout to
4934 Arm_output_section::fix_exidx_coverage.
4935 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4936 from ".ARM.exidx." and ".ARM.extab.".
4938 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4940 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4941 section if it does not already exist.
4942 * attributes.cc (Attributes_section_data::Attributes_section_data):
4943 Don't crash if size is zero.
4945 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4946 Ian Lance Taylor <iant@google.com>
4948 * gold.cc (queue_middle_tasks): If no input files were opened,
4950 * workqueue.h (Task_function::Task_function): Assert that there is
4953 2010-02-22 Doug Kwan <dougkwan@google.com>
4955 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4956 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4957 types to avoid warnings due to different uint64_t implementations
4960 2010-02-21 Doug Kwan <dougkwan@google.com>
4962 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4963 handling of the maximum backward branch offset.
4964 (Arm_relocate_functions::thumb_branch_common): Ditto.
4965 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4966 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4967 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4968 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4969 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4970 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4971 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4972 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4973 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4974 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4975 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4976 thumb2_bl_out_of_range.o): New rules.
4977 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4978 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4979 thumb2_bl_out_of_range
4980 * testsuite/Makefile.in: Regenerate.
4981 * testsuite/arm_bl_in_range.s: New file.
4982 * testsuite/arm_bl_out_of_range.s: Ditto.
4983 * testsuite/arm_branch_in_range.sh: Ditto.
4984 * testsuite/arm_branch_range.t: Ditto.
4985 * testsuite/thumb2_branch_range.t: Ditto.
4986 * testsuite/thumb_bl_in_range.s: Ditto.
4987 * testsuite/thumb_bl_out_of_range.s: Ditto.
4988 * testsuite/thumb_branch_range.t: Ditto.
4990 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4992 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4993 Add reloc offset information.
4994 * icf.cc (get_section_contents): Change iterators to point to the new
4995 vectors. Add reloc offset information to the contents.
4996 * icf.h (Icf::Sections_reachable_info): New typedef.
4997 (Icf::Sections_reachable_list): New typedef.
4998 (Icf::Offset_info): New typedef.
4999 (Icf::Reloc_info): New struct typedef.
5000 (Icf::Reloc_info_list): New typedef.
5001 (Icf::symbol_reloc_list): Delete method.
5002 (Icf::addend_reloc_list): Delete method.
5003 (Icf::section_reloc_list): Delete method.
5004 (Icf::reloc_info_list): New method.
5005 (Icf::reloc_info_list_): New member.
5007 2010-02-19 Doug Kwan <dougkwan@google.com>
5009 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5010 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5011 * arm.cc (Arm_relocation_functions): New forward declaration.
5012 (Target_arm::Target_arm): Initialize new data members
5013 got_mod_index_offset_ and tls_base_symbol_defined_.
5014 (Target_arm::Relocate::relocate_tls): New method.
5015 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5016 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5018 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5019 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5020 (Target_arm::got_mod_index_offset_,
5021 Target_arm::tls_base_symbol_defined_): New data members.
5022 (Target_arm::Scan::local, Target::Scan::global,
5023 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5026 2010-02-18 Doug Kwan <dougkwan@google.com>
5028 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5029 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5030 text section as a parameter becuase some broken tools may not set
5031 the link in section header.
5032 (Target_arm::has_got_section): New method.
5033 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5034 without any mapping symbol as data only. Remove warning.
5035 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5036 link in its section header, try to discover the link by inspecting the
5037 REL31 relocation at the beginning of the section.
5038 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5040 (Target_arm::Scan::global): Treat any reference to the symbol
5041 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5043 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5045 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5046 (Scan::global_reloc_may_be_function_pointer): New function.
5047 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5048 (Scan::global_reloc_may_be_function_pointer): New function.
5049 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5050 (Scan::global_reloc_may_be_function_pointer): New function.
5051 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5052 (Scan::global_reloc_may_be_function_pointer): New function.
5053 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5054 (Scan::global_reloc_may_be_function_pointer): New function.
5055 (Scan::possible_function_pointer_reloc): New function.
5056 (Target_x86_64::can_check_for_function_pointers): New function.
5057 * gc.h (gc_process_relocs): Scan relocation types to determine if
5058 function pointers were taken for targets that support it.
5059 * icf.cc (Icf::find_identical_sections): Include functions for
5060 folding in safe ICF whose pointer is not taken.
5061 * icf.h (Secn_fptr_taken_set): New typedef.
5062 (fptr_section_id_): New member.
5063 (section_has_function_pointers): New function.
5064 (set_section_has_function_pointers): New function.
5065 (check_section_for_function_pointers): New function.
5066 * options.h: Fix comment for safe ICF option.
5067 * target.h (can_check_for_function_pointers): New function.
5068 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5069 Modify icf_safe_test for X86-64.
5070 * testsuite/Makefile.in: Regenerate.
5071 * testsuite/icf_safe_so_test.cc: New file.
5072 * testsuite/icf_safe_so_test.sh: New file.
5073 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5074 (main): Change to take pointer to function kept_func_3.
5075 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5076 folding is done correctly for X86-64.
5078 2010-02-12 David S. Miller <davem@davemloft.net>
5080 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5081 is_symbolless parameter.
5082 (Output_reloc<SHT_REL>::is_symbolless): New.
5083 (Output_reloc<SHT_REL>::is_symbolless_): New.
5084 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5085 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5086 (Output_reloc<SHT_RELA>::is_symbolless): New.
5087 (Output_data_reloc::add_global): Handle is_symbolless.
5088 (Output_data_reloc::add_global_relative): Likewise.
5089 (Output_data_reloc::add_local): Likewise.
5090 (Output_data_reloc::add_local_relative): Likewise.
5091 (Output_data_reloc::add_symbolless_global_addend): New.
5092 (Output_data_reloc::add_symbolless_local_addend): New.
5093 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5095 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5096 instead of ->is_relative_
5097 (Output_reloc::write): Likewise.
5098 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5099 (Output_reloc::write_rel): Simplify.
5101 * sparc.cc (Target_sparc::Scan::local): Use
5102 ->add_symbolless_local_addend as needed.
5103 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5104 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5105 based upon relocation offset.
5107 2010-02-11 Doug Kwan <dougkwan@google.com>
5109 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5110 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5111 beginning of function.
5112 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5113 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5114 parameter is_32bit in calls to should_apply_static_reloc.
5115 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5116 (check_DATA): Add arm_abs_global.stdout.
5117 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5118 arm_abs_global.stdout): New rules.
5119 (MOSTLLYCLEANFILES): Add arm_abs_global
5120 * Makefile.in: Regenerate.
5121 * testsuite/arm_abs_global.s: New file.
5122 * testsuite/arm_abs_global.sh: Ditto.
5123 * testsuite/arm_abs_lib.s: Ditto.
5125 2010-02-11 Ian Lance Taylor <iant@google.com>
5127 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5129 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5130 Allocate_commons_task first.
5131 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5132 task, rather than symtab_lock_.
5133 (Gc_process_relocs::~Gc_process_relocs): New function.
5134 (Gc_process_relocs::is_runnable): Check this_blocker_.
5135 (Gc_process_relocs::locks): Use next_blocker_ rather than
5137 (Scan_relocs::~Scan_relocs): New function.
5138 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5140 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5142 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5143 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5144 constructor accordingly.
5145 (class Gc_process_relocs): Likewise.
5146 (class Scan_relocs): Likewise.
5147 * common.h (class Allocate_commons_task): Remove symtab_lock_
5148 field, and corresponding constructor parameter.
5149 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5151 (Allocate_commons_task::locks): Likewise.
5153 2010-02-11 Ian Lance Taylor <iant@google.com>
5155 * gold-threads.h (class Once): Define.
5156 (class Initialize_lock): Rewrite as child of Once.
5157 * gold-threads.cc (class Once_initialize): Define.
5158 (once_pointer_control): New static variable.
5159 (once_pointer, once_arg): New static variables.
5160 (c_run_once): New static function.
5161 (Once::Once, Once::run_once, Once::internal_run): New functions.
5162 (class Initialize_lock_once): Remove.
5163 (initialize_lock_control): Remove.
5164 (initialize_lock_pointer): Remove.
5165 (initialize_lock_once): Remove.
5166 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5167 (Initialize_lock::initialize): Rewrite.
5168 (Initialize_lock::do_run_once): New function.
5169 * archive.cc (Archive::interpret_header): Only clear name if it is
5171 * fileread.cc: Include "gold-threads.h"
5172 (file_counts_lock): New static variable.
5173 (file_counts_initialize_lock): Likewise.
5174 (File_read::release): Only increment counts when using --stats.
5175 Use a lock around the increment.
5176 * parameters.cc (class Set_parameters_target_once): Define.
5177 (set_parameters_target_once): New static variable.
5178 (Parameters::Parameters): Move here from parameters.h.
5179 (Parameters::set_target): Rewrite.
5180 (Parameters::set_target_once): New function.
5181 (Parameters::clear_target): Move here and rewrite.
5182 * parameters.h (class Parameters): Update declarations. Add
5183 set_parameters_target_once_ field.
5184 (Parameters::Parameters): Move to parameters.cc.
5185 (Parameters::clear_target): Likewise.
5186 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5188 (Start_group::~Start_group): New function.
5189 (Start_group::is_runnable): New function.
5190 (Start_group::locks, Start_group::run): New functions.
5191 (Finish_group::run): Change saw_undefined to size_t.
5192 * readsyms.h (class Start_group): Define.
5193 (class Finish_group): Change saw_undefined_ field to size_t.
5194 (Finish_group::Finish_group): Remove saw_undefined and
5195 this_blocker parameters. Change all callers.
5196 (Finish_group::set_saw_undefined): New function.
5197 (Finish_group::set_blocker): New function.
5198 * symtab.h (class Symbol_table): Change saw_undefined to return
5199 size_t. Change saw_undefined_ field to size_t.
5200 * target-select.cc (Set_target_once::do_run_once): New function.
5201 (Target_selector::Target_selector): Initialize set_target_once_
5202 field. Don't initialize lock_ and initialize_lock_ fields.
5203 (Target_selector::instantiate_target): Rewrite.
5204 (Target_selector::set_target): New function.
5205 * target-select.h (class Set_target_once): Define.
5206 (class Target_selector): Update declarations. Make
5207 Set_target_once a friend. Remove lock_ and initialize_lock_
5208 fields. Add set_target_once_ field.
5210 2010-02-10 Ian Lance Taylor <iant@google.com>
5212 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5214 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5215 (queue_middle_tasks): Add all blockers before queueing any tasks.
5216 (queue_final_tasks): Likewise.
5217 * token.h (Task_token::add_blockers): New function.
5218 * object.h (Input_objects::number_of_relobjs): New function.
5220 2010-02-10 Ian Lance Taylor <iant@google.com>
5222 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5223 shared, not if not position independent.
5224 * x86_64.cc (Relocate::relocate_tls): Likewise.
5225 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5226 (tls_pie_pic_test): New target.
5227 * testsuite/Makefile.in: Rebuild.
5229 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5230 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5231 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5232 * testsuite/Makefile.in: Rebuild.
5234 2010-02-09 David S. Miller <davem@davemloft.net>
5236 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5237 R_SPARC_RELATIVE using ->add_local_relative().
5238 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5240 * output.h (Output_data_dynamic::add_section_size): New method
5241 that takes two Output_data objects.
5242 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5243 entry param. Handle it in initializers.
5244 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5245 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5246 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5248 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5249 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5250 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5251 for dynrel_includes_plt.
5252 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5253 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5254 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5256 (Target_sparc::do_finalize_sections): Update to pass true for
5257 dynrel_includes_plt.
5258 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5259 output before .rela.plt
5260 (Target_powerpc::do_finalize_sections): Update to pass true for
5261 dynrel_includes_plt when 32-bit.
5263 2010-02-08 Doug Kwan <dougkwan@google.com>
5265 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5267 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5268 Arm_relobj::scan_section_for_cortex_a8_stubs,
5269 Arm_relobj::do_relocation_section): Instead of calling
5270 Output_section::output_address, use faster
5271 Arm_relobj::simple_input_section_output_address.
5273 2010-02-08 David S. Miller <davem@davemloft.net>
5275 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5276 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5277 relocation helper function.
5279 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5280 just like R_SPARC_GOT{10,13,22}.
5281 (Target_sparc::Scan::local): Likewise.
5282 (Target_sparc::Relocate:relocate): Likewise.
5284 2010-02-06 Ian Lance Taylor <iant@google.com>
5286 * configure.ac: Rewrite targetobjs duplicate removal code to use
5287 only shell constructs.
5288 * configure: Rebuild.
5290 2010-02-05 Doug Kwan <dougkwan@google.com>
5293 * arm.cc (Arm_relobj::section_is_scannable): New method.
5294 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5295 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5297 2010-02-04 Doug Kwan <dougkwan@google.com>
5300 * arm-reloc-property.cc (cstdio): Include.
5301 * configure.ac (targetobjs): Remove duplicates.
5302 * configure: Regenerate.
5303 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5304 big and little endian version for a given address size.
5306 2010-02-03 Doug Kwan <dougkwan@google.com>
5308 * arm-reloc-property.cc
5309 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5311 * arm-reloc-property.h
5312 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5313 New method definition.
5314 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5316 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5318 (GOT_PREL): Change implemented to Y.
5319 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5320 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5321 (Arm_relocate_functions::movw_abs_nc): Remove method.
5322 (Arm_relocate_functions::movt_abs): Ditto.
5323 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5324 (Arm_relocate_functions::thm_movt_abs): Ditto.
5325 (Arm_relocate_functions::movw_rel_nc): Ditto.
5326 (Arm_relocate_functions::movw_rel): Ditto.
5327 (Arm_relocate_functions::movt_rel): Ditto.
5328 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5329 (Arm_relocate_functions:thm_movw_rel): Ditto.
5330 (Arm_relocate_functions:thm_movt_rel): Ditto.
5331 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5332 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5333 New method definitions.
5334 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5335 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5336 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5337 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5338 (Target_arm::Relocate::relocate): Check for non-static or
5339 unimplemented relocation code and exit early. Change calls to
5340 Target_arm::reloc_uses_thumb_bit and
5341 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5342 instead. Refactor code to handle similar relocations to increase
5343 code sharing. Remove check for unsupported relocation code in switch
5345 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5346 relocation property table to find out size. Change error message to
5347 print out the name of a relocation code instead of the numeric value.
5348 (Target_arm::scan_reloc_for_stub): Use relocation property table
5349 instead of calling Target_arm::reloc_uses_thumb_bit().
5351 2010-02-02 Doug Kwan <dougkwan@google.com>
5353 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5354 types of relaxed input section.
5356 2010-02-02 Doug Kwan <dougkwan@google.com>
5358 * Makefile.am (HFILES): Add arm-reloc-property.h.
5360 (TARGETSOURCES): Add arm-reloc-property.cc
5361 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5362 (libgold_a_SOURCES): $(DEFFILES)
5363 * Makefile.in: Regenerate.
5364 * arm-reloc-property.cc: New file.
5365 * arm-reloc-property.h: New file.
5366 * arm-reloc.def: New file.
5367 * arm.cc: Update comments.
5368 (arm-reloc-property.h): New included header.
5369 (arm_reloc_property_table): New global variable.
5370 (Target_arm::do_select_as_default_target): New method definition.
5371 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5372 arm-reloc-property to targ_extra_obj.
5373 * parameters.cc (set_parameters_target): Call
5374 Target::select_as_default_target().
5375 * target.h (Target::select_as_default_target): New method definition.
5376 (Target::do_select_as_default_target): Same.
5378 2010-02-01 Doug Kwan <dougkwan@google.com>
5380 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5381 first_output_text_section_.
5382 (Arm_exidx_fixup::first_output_text_section): New method definition.
5383 (Arm_exidx_fixup::first_output_text_section_): New data member.
5384 (Arm_exidx_fixup::process_exidx_section): Record the first text
5385 output section seen.
5386 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5387 and entsize in output section header.
5389 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5391 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5392 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5393 (Arm_relocate_functions::thm_alu11): New Method.
5394 (Arm_relocate_functions::thm_pc8): New Method.
5395 (Arm_relocate_functions::thm_pc12): New Method.
5396 (Target_arm::Scan::local): Handle the relocations.
5397 (Target_arm::Scan::global): Likewise.
5398 (Target_arm::Relocate::relocate): Likewise.
5399 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5401 2010-01-29 Doug Kwan <dougkwan@google.com>
5403 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5404 of relocation types as ld.
5406 2010-01-29 Doug Kwan <dougkwan@google.com>
5408 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5410 (Arm_relocate_functions::thumb_branch_common): Ditto.
5411 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5412 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5413 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5414 Arm_relocate_functions::jump24): Remove.
5415 (Target_arm::Relocate::relocate): Adjust code to call
5416 Arm_relocation_functions::arm_branch_common and
5417 Arm_relocation_functions::thumb_branch_common instead of their removed
5418 wrappers. Merge switch-cases together to reduce source code size.
5420 2010-01-29 Doug Kwan <dougkwan@google.com>
5422 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5423 output_local_symbol_count_needs_update_.
5424 (Arm_relobj::output_local_symbol_count_needs_update,
5425 Arm_relobj::set_output_local_symbol_count_needs_update,
5426 Arm_relobj::update_output_local_symbol_count): New methods.
5427 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5429 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5430 of pointed function as in a R_ARM_PREL31 relocation.
5431 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5432 for output local symbol count updating.
5433 (Target_arm::do_relax): Update output local symbol counts in objects
5435 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5437 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5439 * arm.cc: Added support for the ARM relocations:
5440 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5441 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5442 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5444 (Arm_relocate_functions::movw_rel): New method.
5445 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5446 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5448 (Arm_relocate_functions::thm_movw_rel): New method.
5449 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5451 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5453 (Target_arm::Scan::global): Likewise.
5454 (Target_arm::Relocate::relocate): Likewise.
5455 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5458 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5460 * arm.cc: Added support for ARM group relocations.
5461 (Target_arm::reloc_needs_sym_origin): New method.
5462 (Arm_relocate_functions::calc_grp_kn): New method.
5463 (Arm_relocate_functions::calc_grp_residual): New method.
5464 (Arm_relocate_functions::calc_grp_gn): New method.
5465 (Arm_relocate_functions::arm_grp_alu): New Method.
5466 (Arm_relocate_functions::arm_grp_ldr): New Method.
5467 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5468 (Arm_relocate_functions::arm_grp_ldc): New Method.
5469 (Target_arm::Scan::local): Handle the ARM group relocations.
5470 (Target_arm::Scan::global): Likewise.
5471 (Target_arm::Relocate::relocate): Likewise.
5472 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5475 2010-01-26 Doug Kwan <dougkwan@google.com>
5477 * arm.cc (set): Include.
5478 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5480 (Arm_output_section::Text_section_list): New type.
5481 (Arm_output_section::append_text_sections_to_list): New method.
5482 (Arm_output_section::fix_exidx_coverage): Ditto.
5483 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5484 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5485 Relobj::set_section_offset() instead of
5486 Sized_relobj::invalidate_section_offset().
5487 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5488 parameter for section headers. Ignore relocation sections for
5489 unallocated sections and EXIDX sections.
5490 (Target_arm::fix_exidx_coverage): New method.
5491 (Target_arm::output_section_address_less_than): New type.
5492 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5493 linked text section instead of the EXIDX section.
5494 (Arm_output_section::create_stub_group): Add an assertion to check
5495 that this is not an EXIDX output section.
5496 (Arm_output_section::append_text_sections_to_list): New method.
5497 (Arm_output_section::fix_exidx_coverage): Ditto.
5498 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5499 Arm_relobj::section_needs_reloc_stub_scanning.
5500 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5502 (Target_arm::fix_exidx_coverage): New method.
5503 * object.h (Relobj::set_output_section): New method.
5504 (Sized_relobj::invalidate_section_offset): Remove method.
5505 (Sized_relobj::do_invalidate_section_offset): Remove method.
5506 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5508 2010-01-25 Doug Kwan <dougkwan@google.com>
5510 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5511 Fix warning due to signed and unsigned comparison on a 32-bit host.
5513 2010-01-22 Doug Kwan <dougkwan@google.com>
5515 * arm.cc (Target_arm::do_relax): Record an output section for section
5516 offset adjustment it contains any stub table that has changed.
5517 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5518 offsets in an output section if necessary.
5519 * output.cc (Output_section::Output_section): Initialize
5520 section_offsets_need_adjustments_.
5521 (Output_section::add_input_section_for_script): Renamed to
5522 Output_section::add_simple_input_section.
5523 (Output_section::save_states): Add a comment.
5524 (Output_section::discard_states): New method defintion.
5525 (Output_section::adjust_section_offsets): Same.
5526 * output.h (Output_section::add_input_section_for_script): Renamed to
5527 Output_section::add_simple_input_section.
5528 (Output_section::discard_states): New method declaration.
5529 (Output_section::adjust_section_offsets): Same.
5530 (Output_section::section_offsets_need_adjustment,
5531 Output_section::set_section_offsets_need_adjustment): New method
5533 (Output_section::section_offsets_need_adjustment_): New data member.
5534 * script-sections.cc
5535 (Output_section_element_input::set_section_address): Adjust code for
5536 renaming of Output_section::add_input_section_for_script.
5537 (Orphan_output_section::set_section_address): Same.
5539 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5541 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5542 Fix_v4bx enum values .
5543 * gold/options.h (General_options): New option definitions.
5544 (General_options::fix_v4bx): New method.
5545 (General_options::Fix_v4bx): New enum.
5546 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5547 (General_options::parse_fix_v4bx_interworking): New method.
5549 2010-01-22 Doug Kwan <dougkwan@google.com>
5551 * arm.cc (Arm_exidx_fixup): New class.
5553 2010-01-21 Doug Kwan <dougkwan@google.com>
5555 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5557 (Arm_exidx_section_offset_map): New type.
5559 2010-01-21 Doug Kwan <dougkwan@google.com>
5561 * arm.cc (Arm_exidx_input_section): New class.
5562 (Arm_relobj::exidx_input_section_by_link,
5563 Arm_relobj::exidx_input_section_by_shndx,
5564 Arm_relobj::make_exidx_input_section): New methods.
5565 (read_arm_attributes_section): Remove.
5566 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5567 information about them.
5568 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5571 2010-01-20 Doug Kwan <dougkwan@google.com>
5573 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5574 Input_section_specifier to Section_id.
5575 (Target_arm::new_arm_input_section: Adjust code for change of key
5577 (Target_arm::find_arm_input_section): Ditto.
5578 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5579 (Section_id): Remove.
5580 (Garbage_collection::Section_id_hash): Remove.
5581 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5582 (Section_id): Remove.
5583 (Icf::Section_id_hash): Remove.
5584 * object.h (Section_id, Const_section_id, Section_id_hash,
5585 Const_section_id_hash): New type definitions.
5586 * output.cc (Output_section::add_relaxed_input_section): Change to
5587 use Const_section_id instead of Input_section_specifier as key type.
5588 (Output_section::add_merge_input_section): Ditto.
5589 (Output_section::build_relaxation_map): Change to use Section_id
5590 instead of Input_section_specifier as key type.
5591 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5593 (Output_section::convert_input_sections_to_relaxed_sections): Change
5594 to use Const_section_id instead of Input_section_specifier as key type.
5595 (Output_section::find_merge_section): Ditto.
5596 (Output_section::find_relaxed_input_section): Ditto.
5597 * output.h (Input_section_specifier): Remove class.
5598 (Output_section::Output_section_data_by_input_section_map): Change
5599 key type to Const_section_id.
5600 (Output_section::Output_relaxed_input_section_by_input_section_map):
5602 (Output_section::Relaxation_map): Change key type to Section_id.
5604 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5606 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5607 (class Arm_v4bx_stub): New class.
5608 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5609 (Stub_factory::make_arm_v4bx_stub): New method.
5610 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5611 (Stub_table::empty): Handle v4bx stubs.
5612 (Stub_table::add_arm_v4bx_stub): New method.
5613 (Stub_table::find_arm_v4bx_stub): New method.
5614 (Arm_relocate_functions::v4bx): New method.
5615 (Target_arm::fix_v4bx): New method.
5616 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5617 (Stub_table::relocate_stubs): Likewise.
5618 (Stub_table::do_write): Likewise.
5619 (Stub_table::update_data_size_and_addralign): Likewise.
5620 (Stub_table::finalize_stubs): Likewise.
5621 (Target_arm::Scan::local): Likewise.
5622 (Target_arm::Scan::global): Likewise.
5623 (Target_arm::do_finalize_sections): Likewise.
5624 (Target_arm::Relocate::relocate): Likewise.
5625 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5627 (Target_arm::scan_reloc_for_stub): Likewise.
5628 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5630 2010-01-19 Ian Lance Taylor <iant@google.com>
5632 * output.cc (Output_section_headers::do_sized_write): Write large
5633 segment count to sh_info field.
5634 (Output_file_header::do_sized_write): For large segment count,
5635 write PN_XNUM to e_phnum field.
5637 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5639 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5640 (Arm_relocate_functions::thm_jump8): New function.
5641 (Arm_relocate_functions::thm_jump11): New function.
5642 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5644 (Target_arm::Scan::global): Likewise.
5645 (Target_arm::Relocate::relocate): Likewise.
5646 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5649 2010-01-14 Doug Kwan <dougkwan@google.com>
5651 * arm.cc (map, utility): Include headers.
5652 (Target_arm::apply_cortex_a8_workaround): New method.
5653 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5654 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5655 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5656 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5657 the --[no-]fix-cortex-a8 command line options.
5658 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5659 (Target_arm::relocate_stub): Use addend in instruction template.
5660 * options.h (DEFINE_bool): Set the user-set flag.
5661 (General_options): Add --[no-]-fix-cortex options.
5662 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5663 : Update fast look-up map after conversion.
5665 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5667 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5668 in the first pass of do_layout.
5670 2010-01-13 Doug Kwan <dougkwan@google.com>
5672 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5673 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5674 apparent compiler problem of not folding static constant integral
5675 data members of elfcpp::Elf_sizes<32>.
5677 2010-01-13 Doug Kwan <dougkwan@google.com>
5679 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5680 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5681 Arm_relobj::scan_section_for_cortex_a8_erratum,
5682 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5683 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5684 sections to scan for relocation stubs into a new method
5685 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5686 relocation and Cortex-A8 stub scanning.
5687 (Target_arm::do_relax): Force stubs to be after stubbed sections
5688 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5689 the beginning of a new relaxation pass. Update a comment.
5690 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5692 2010-01-12 Ian Lance Taylor <iant@google.com>
5694 * target-reloc.h (visibility_error): New inline function.
5695 (relocate_section): Call visibility_error.
5696 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5697 (MOSTLYCLEANFILES): Likewise.
5698 (protected_4_pic.o, protected_3.err): New targets.
5699 * testsuite/protected_4.cc: New file.
5701 2010-01-12 Doug Kwan <dougkwan@google.com>
5703 * arm.cc (Cortex_a8_reloc): New class.
5704 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5705 and cortex_a8_relocs_info_.
5706 (Target_arm::fix_cortex_a8): New method definition.
5707 (Target_arm::Cortex_a8_relocs_info): New type.
5708 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5709 New data member declarations.
5710 (Target_arm::scan_reloc_for_stub): Record information about
5711 relocations for THUMB branches that might be exempted from the
5712 Cortex-A8 workaround.
5713 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5714 at the beginning of a relaxation pass.
5716 2010-01-12 Doug Kwan <dougkwan@google.com>
5718 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5719 (Arm_relobj::Mapping_symbol_position,
5720 Arm_reloj::Mapping_symbol_position_less,
5721 Arm_relobj::Mapping_symbols_info): New types.
5722 (Target_arm::is_mapping_symbol_name): New method definition.
5723 (Arm_relobj::do_count_local_symbols): Save information about mapping
5726 2010-01-11 Doug Kwan <dougkwan@google.com>
5728 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5729 Arm_relocate_functions::thumb32_branch_upper,
5730 Arm_relocate_functions::thumb32_branch_lower,
5731 Arm_relocate_functions::thumb32_cond_branch_offset,
5732 Arm_relocate_functions::thumb32_cond_branch_upper,
5733 Arm_relocate_functions::thumb32_cond_branch_lower,
5734 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5735 branch offset encoding.
5736 (Arm_relocate_functions::thumb_branch_common): Use new branch
5737 offset encoding methods to avoid code duplication.
5738 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5739 (Stub_addend_reader::operator()): Use new branch encoding method
5740 to avoid code duplication.
5742 2010-01-11 Doug Kwan <dougkwan@google.com>
5744 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5745 (Target_arm::do_finalize_sections): Define special EXIDX section
5746 symbols only if referenced.
5747 * gc.h (Garbage_collection::add_reference): New method.
5748 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5751 2010-01-11 Ian Lance Taylor <iant@google.com>
5753 * script.cc (Version_script_info::build_expression_list_lookup):
5754 Change complaing about duplicate wildcard match from error to
5757 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5759 (Version_script_info::Version_script_info): Initialize globs_,
5760 default_version_, default_is_global_, and exact_. Don't
5761 initialize globals_ or locals_.
5762 (Version_script_info::build_lookup_tables): Build local symbols
5764 (Version_script_info::unquote): New function.
5765 (Version_script_info::add_exact_match): New function.
5766 (Version_script_info::build_expression_list_lookup): Remove lookup
5767 parameter. Add is_global parameter. Change all callers. Handle
5768 wildcard pattern specially. Unquote pattern. Call
5770 (Version_script_info::get_name_to_match): New function.
5771 (Version_script_info::get_symbol_version): New function.
5772 (Version_script_info::get_symbol_version_helper): Remove.
5773 (Version_script_info::check_unmatched_names): Call unquote.
5774 * script.h (class Version_script_info): Change get_symbol_version
5775 to be non-inline and add is_global parameter; change all callers.
5776 Rewrite symbol_is_local. Update declarations. Define struct
5777 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5778 Remove globals_ and locals_ members. Add exact_, globs_,
5779 default_version_, is_global_.
5780 (Version_script_info::Glob): Remove pattern, add expression and
5781 is_global. Update constructor. Change all callers.
5782 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5784 (Versions::symbol_section_contents): If a symbol is undefined, or
5785 defined in a dynamic object, set the version index to
5787 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5789 (Symbol_table::add_from_pluginobj): Likewise.
5790 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5792 2010-01-11 Doug Kwan <dougkwan@google.com>
5794 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5795 (incremental_dump_LDADD): Add linking option for libintl.
5796 * Makefile.in: Regenerate.
5798 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5801 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5803 * testsuite/Makefile.in: Regenerated.
5805 2010-01-10 Doug Kwan <dougkwan@google.com>
5807 * options.h (DEFINE_var): Use parentheses around argument varname__
5808 in macro body to avoid any unintended subsequent substitutions.
5810 2010-01-10 Ian Lance Taylor <iant@google.com>
5812 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5813 candidates before doing symbol resolution.
5815 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5816 ODR candidates if only one is weak.
5818 2010-01-08 Ian Lance Taylor <iant@google.com>
5820 * script.cc (Version_script_info::build_expression_list_lookup):
5821 Don't warn about ambiguous version, just record the ambiguity.
5822 (Version_script_info::get_symbol_version_helper): Give error if
5823 version is ambiguous.
5825 2010-01-08 Doug Kwan <dougkwan@google.com>
5827 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5828 prev_data_size_ and prev_addralign_. Remove initializer for
5829 deleted data member has_been_changed_.
5830 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5831 to determine if the table is empty.
5832 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5834 (Stub_table::add_reloc_stub): Define method in class definition
5835 instead of just declaring it there.
5836 (Stub_table::add_cortex_a8_stub): New method definition.
5837 (Stub_table::update_data_size_and_addralign): Ditto.
5838 (Stub_table::finalize_stubs): Ditto.
5839 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5840 (Stub_table::do_addralign_): Return address alignment in the
5841 (Stub_table::do_reset_address_and_file_offset): Define method in
5842 class definition instead of declaring it there. Set current data
5843 size to be the data size of the previous pass.
5844 (Stub_table::set_final_data_size): Use current data size as the
5846 (Stub_table::relocate_stub): Change parameter type of stub from
5847 Reloc_stub pointer to Stub pointer.
5848 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5849 (Stub_table::Cortex_a8_stub_list): New typedef.
5850 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5851 Stub_table::prev_addralign_): New data member.
5852 (Arm_relobj::Arm_relobj): Initialize data member
5853 section_has_cortex_a8_workaround_.
5854 (Arm_relobj::section_has_cortex_a8_workaround,
5855 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5857 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5859 (Target_arm::relocate_stub): Change parameter type of stub from
5860 Reloc_stub pointer to Stub pointer.
5861 (Insn_template::size, Insn_template::alignment): Handle
5862 THUMB16_SPECIAL_TYPE.
5863 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5864 Stub_table::update_data_size_and_addralign,
5865 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5867 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5868 (Stub_table::do_write): Ditto.
5869 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5871 2010-01-08 Ian Lance Taylor <iant@google.com>
5874 * symtab.h (class Symbol): Remove fields is_target_special_ and
5875 has_plt_offset_. Add field is_defined_in_discarded_section_.
5876 (Symbol::is_defined_in_discarded_section): New function.
5877 (Symbol::set_is_defined_in_discarded_section): New function.
5878 (Symbol::has_plt_offset): Rewrite.
5879 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5880 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5881 Don't initialize is_target_special_ or has_plt_offset_.
5882 Initialize is_defined_in_discarded_section_.
5883 (Symbol_table::add_from_relobj): If appropriate, set
5884 is_defined_in_discarded_section.
5885 * resolve.cc (Symbol::override_base_with_special): Don't test
5886 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5887 * target-reloc.h (relocate_section): Do special handling for
5888 symbols defined in discarded sections for global symbols as well
5891 2010-01-08 Ian Lance Taylor <iant@google.com>
5893 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5894 the SHT_SYMTAB case.
5896 2010-01-08 Ian Lance Taylor <iant@google.com>
5898 * object.cc (Sized_relobj::do_layout): Don't get confused if
5899 layout_eh_frame returns NULL.
5901 2010-01-08 Ian Lance Taylor <iant@google.com>
5904 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5905 dynamic symbol table, use the normal symbol table.
5906 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5909 2010-01-08 Ian Lance Taylor <iant@google.com>
5912 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5915 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5917 * version.cc (print_version): Change to "Copyright 2010".
5919 2010-01-08 Ian Lance Taylor <iant@google.com>
5923 * i386.cc (class Target_i386): Change return type of plt_section
5925 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5926 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5927 tls_desc_rel_ field.
5928 (Output_data_plt_i386::rel_tls_desc): New function.
5929 (Target_i386::rel_tls_desc_section): New function.
5930 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5931 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5932 R_386_TLS_DESC reloc in rel_tls_desc_section.
5933 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5934 Define struct Tlsdesc_info.
5935 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5936 (Target_x86_64::do_reloc_symbol_index): New function.
5937 (Target_x86_64::add_tlsdesc_info): New function.
5938 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5939 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5941 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5943 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5944 (Target_x86_64::rela_tlsdesc_section): New function.
5945 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5947 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5948 (Target_x86_64::do_reloc_addend): New function.
5949 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5950 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5951 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5952 (Output_reloc::type): New function.
5953 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5954 (Output_reloc::is_target_specific): New function.
5955 (Output_reloc::target_arg): New function.
5956 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5957 absolute relocs and target specific relocs.
5958 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5959 add_target_specific.
5960 (class Output_data_reloc) [SHT_RELA]: Likewise.
5961 * output.cc (Output_reloc::Output_reloc): Add four new versions
5962 for absolute relocs and target specific relocs.
5963 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5964 (Output_reloc::get_symbol_index): Likewise.
5965 (Output_reloc::local_section_offset): Check that local_sym_index_
5966 is not TARGET_CODE or 0.
5967 (Output_reloc::symbol_value): Likewise.
5968 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5970 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5971 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5973 * layout.cc (add_target_dynamic_tags): Use output section for
5974 DT_PLTRELSZ and DT_JMPREL.
5976 2010-01-07 Ian Lance Taylor <iant@google.com>
5979 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5981 (class Output_data_reloc_generic): Define.
5982 (class Output_data_reloc_base): Change base class to
5983 Output_data_reloc_generic. Change add() method to call
5984 bump_relative_reloc_count for a relative reloc. Remove
5986 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5988 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5989 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5991 * layout.h (class Layout): Update declaration.
5993 2010-01-07 Ian Lance Taylor <iant@google.com>
5995 * output.h (class Output_data): Add const version of
5996 output_section and do_output_section.
5997 (class Output_section_data): Add const version of
5999 (class Output_section): Likewise.
6000 * layout.cc (Layout::add_target_dynamic_tags): New function.
6001 * layout.h (class Layout): Update declarations.
6002 * arm.cc (Target_arm::do_finalize_sections): Use
6003 add_target_dynamic_tags.
6004 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6005 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6006 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6007 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6009 2010-01-07 Ian Lance Taylor <iant@google.com>
6012 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6015 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6016 Ian Lance Taylor <iant@google.com>
6019 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6020 Xindex::read_symtab_xindex.
6022 2010-01-07 Doug Kwan <dougkwan@google.com>
6024 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6025 (Insn_template::thumb16_bcond_insn): New method declaration.
6026 (Insn_template): Fix spelling.
6027 (Stub::thumb16_special): New method declaration.
6028 (Stub::do_write): Define virtual method which was previously pure
6030 (Stub::do_thumb16_special): New method declaration.
6031 (Stub::do_fixed_endian_write): New template member.
6032 (Reloc_stub::do_write): Remove.
6033 (Reloc_stub::do_fixed_endian_write): Remove.
6034 (Cortex_a8_stub): New class definition.
6035 (Stub_factory::make_cortex_a8_stub): New method definition.
6036 (Stub_factory::Stub_factory): Add missing static storage class
6037 qualifier for elf32_arm_stub_a8_veneer_blx.
6039 2010-01-07 Ian Lance Taylor <iant@google.com>
6042 * options.h (class General_options): Add --warn-unresolved-symbols
6043 and --error-unresolved-symbols.
6044 * errors.cc (Errors::undefined_symbol): Implement
6045 --warn-unresolved-symbols.
6047 * options.h (class General_options): Add -z text and -z textoff.
6048 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6050 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6052 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6053 (Garbage_collection::cident_sections): New function.
6054 (Garbage_collection::add_cident_section): New function.
6055 (Garbage_collection::cident_sections_): New member.
6056 (gc_process_relocs): Add references to sections whose names are C
6058 * gold.h (cident_section_start_prefix): New constant.
6059 (cident_section_stop_prefix): New constant.
6060 (is_cident): New function.
6061 * layout.cc (Layout::define_section_symbols): Replace string constants
6062 with the newly defined constants.
6063 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6065 * testsuite/Makefile.am: Add gc_orphan_section_test.
6066 * testsuite/Makefile.in: Regenerate.
6067 * testsuite/gc_orphan_section_test.cc: New file.
6068 * testsuite/gc_orphan_section_test.sh: New file.
6070 2010-01-06 Ian Lance Taylor <iant@google.com>
6073 * options.h (class General_options): Add --warn-shared-textrel.
6074 * layout.cc (Layout::finish_dynamic_section): Implement
6075 --warn-shared-textrel.
6078 * options.h (class General_options): Add --warn-multiple-gp.
6080 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6082 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6083 $(THREADSLIB) and $(LIBDL).
6084 * Makefile.in: Rebuild.
6086 2010-01-06 Ian Lance Taylor <iant@google.com>
6089 * options.cc (General_options::parse_section_start): New function.
6090 (General_options::section_start): New function.
6091 (General_options::General_options): Initialize all members.
6092 * options.h: Include <map>
6093 (class General_options): Add --section-start. Add section_starts_
6095 * layout.cc (Layout::attach_allocated_section_to_segment): If
6096 --section-start was used, set the address of the segment. Remove
6097 local sort_sections.
6098 (Layout::relaxation_loop_body): If the address of the load segment
6099 has been set by --section-start, don't use it.
6100 * output.h (Output_segment::update_flags_for_output_section): New
6102 * output.cc (Output_segment::add_output_section): Call
6103 update_flags_for_output_section.
6105 2010-01-05 Ian Lance Taylor <iant@google.com>
6108 * options.h (class General_options): Add --undefined-version.
6109 * script.cc (struct Version_expression): Add was_matched_by_symbol
6111 (Version_script_info::matched_symbol): New function.
6112 (Version_script_info::get_symbol_version_helper): Call
6114 (Version_script_info::check_unmatched_names): New function.
6115 * script.h (class Version_script_info): Update declarations.
6116 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6118 * options.h (class General_options): Use DEFINE_bool_alias for
6119 allow_multiple_definition.
6120 * resolve.cc (Symbol_table::should_override): Don't test
6121 allow_multiple_definition.
6124 * options.h (class General_options): Add --cref.
6125 * main.cc (main): Print cref table if --cref. Don't close mapfile
6126 until after printing cref table.
6127 * cref.cc: Include "symtab.h".
6128 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6129 (Cref_table_compare::operator()): New function.
6130 (Cref_inputs::gather_cref): New function.
6131 (filecol): New static const.
6132 (Cref_inputs::print_cref): New function.
6133 (Cref::print_cref): New function.
6134 * cref.h: Include <cstdio>.
6135 (class Cref): Update declarations.
6136 * mapfile.h (Mapfile::file): New function.
6137 * object.h (class Object): Define Symbols. Declare virtual
6138 do_get_global_symbols.
6139 (Object::get_global_symbols): New function.
6140 * object.cc (Input_objects::add_object): Pass object to cref_ if
6142 (Input_objects::archive_start): Likewise.
6143 (Input_objects::archive_stop): Likewise.
6144 (Input_objects::print_cref): New function.
6145 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6146 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6148 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6150 * plugin.h (class Sized_pluginobj): Update declarations.
6152 2010-01-05 Ian Lance Taylor <iant@google.com>
6154 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6155 to is_default_version. Rename insdef to insdefault.
6156 (Symbol_table::add_from_relobj): Rename def to is_default_version
6157 and local to is_forced_local.
6158 (Symbol_table::add_from_pluginobj): Likewise.
6159 (Symbol_table::add_from_dynobj): Likewise.
6160 (Symbol_table::define_special_symbol): Rename insdef to
6163 2010-01-04 Ian Lance Taylor <iant@google.com>
6166 * options.h (class General_options): Add
6167 --allow-multiple-definition and -z muldefs.
6168 * resolve.cc (Symbol_table::should_override): Don't warn about a
6169 multiple symbol definition if --allow-multiple-definition or -z
6173 * options.h (class General_options): Add --add-needed and
6174 --copy-dt-needed-entries. Tweak --as-needed help entry.
6175 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6176 error if --copy-dt-needed-entries aka --add-needed is used and
6177 would cause a change in behaviour.
6180 * options.h (class General_options): Add -G as a short version of
6181 --shared. Add no-op options -assert, -g, and -i.
6183 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6185 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6186 check for .text or .gnu.linkonce.t sections.
6187 * icf.cc (Icf::find_identical_sections): Ditto.
6188 Change the detection for mangled function name within the section
6190 * icf.h (is_section_foldable_candidate): New function.
6192 2009-12-30 Ian Lance Taylor <iant@google.com>
6195 * options.h (class General_options): Permit two dashes with
6196 --retain-symbols-file.
6198 2009-12-30 Ian Lance Taylor <iant@google.com>
6201 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6202 don't put the file header and segment headers in the text
6206 * common.cc (Sort_commons::operator()): Stabilize sort when both
6208 (Symbol_table::do_allocate_commons_list): When allocating common
6209 symbols, skip a symbol which is no longer common.
6210 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6211 an object before checking its type.
6212 * testsuite/common_test_2.c: New file.
6213 * testsuite/common_test_3.c: New file.
6214 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6215 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6216 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6217 (common_test_2_pic.o, common_test_2.so): New targets.
6218 (common_test_3_pic.o, common_test_3.so): New targets.
6219 * testsuite/Makefile.in: Rebuild.
6222 * script.cc (read_input_script): If we see a new SECTIONS clause,
6223 and we have added an input section, give an error.
6224 * layout.h (class Layout): Add have_added_input_section function.
6225 Add have_added_input_section_ field.
6226 * layout.cc (Layout::Layout): Initialize
6227 have_added_input_section_.
6228 (Layout::layout): Set have_added_input_section_.
6229 (Layout::layout_eh_frame): Likewise.
6231 2009-12-30 Ian Lance Taylor <iant@google.com>
6234 * options.h (class General_options): Add --sort-common option.
6235 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6236 * common.cc (Sort_common): Add sort_order parameter to
6237 constructor. Add sort_order_ field.
6238 (Sort_commons::operator): Check sort_order_.
6239 (Symbol_table::allocate_commons): Determine the sort order.
6240 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6242 (Symbol_table::do_allocate_commons_list): Likewise.
6244 2009-12-30 Ian Lance Taylor <iant@google.com>
6247 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6248 symbols from this object, don't change the visibility of an
6250 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6252 2009-12-30 Ian Lance Taylor <iant@google.com>
6255 * script.h (class Version_script_info): Define Language enum.
6256 Update declarations. Define Glob, Exact, and Lookup types. Add
6257 new fields globals_, locals_, and is_finalized_.
6258 * script.cc: Various formatting fixes.
6259 (class Parser_closure): Change language_stack_ from a vector of
6260 std::string to one of Version_script_info::Language. Adjust all
6262 (class Lazy_demangler): Remove.
6263 (struct Version_expression): Change language from std::string to
6264 Version_script_info::Language.
6265 (Version_script_info::Version_script_info): New function.
6266 (Version_script_info::~Version_script_info): Don't call clear.
6267 (Version_script_info::finalize): New function.
6268 (Version_script_info::build_lookup_tables): New function.
6269 (Version_script_info::build_expression_list_lookup): New
6271 (Version_script_info::get_symbol_version_helper): Rewrite to use
6273 (Version_script_info::print_expression_list): Adjust to use
6274 Version_script_info::Language.
6275 (script_push_lex_into_version_mode): Check that the version script
6276 has not been finalized.
6277 (version_script_push_lang): Change language string to
6278 Version_script_info::Language.
6279 * options.cc (Command_line::version_script): New function.
6280 * options.h (class General_options): Add finalize_dynamic_list
6281 function. Change version_script from declaration to definition.
6282 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6283 * testsuite/version_script.map: Remove duplicate def of foo.
6284 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6286 * testsuite/Makefile.in: Rebuild.
6288 2009-12-30 Ian Lance Taylor <iant@google.com>
6291 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6292 if the input symbol index is 0, make the output symbol index 0.
6294 2009-12-30 Ian Lance Taylor <iant@google.com>
6297 * options.h (class General_options): Add -x/--discard-all.
6298 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6299 --discard-all. If the local symbol needs a dynamic entry, check
6300 that before handling --discard-locals.
6302 2009-12-30 Ian Lance Taylor <iant@google.com>
6305 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6307 (Output_segment::add_output_section): Don't change the flags if
6311 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6312 GNU hash table if they need a dynamic value. Otherwise, don't add
6313 them if they are defined in a dynamic object or are forced local.
6315 2009-12-29 Ian Lance Taylor <iant@google.com>
6318 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6319 .gnu.hash table for a 32-bit target.
6322 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6323 regular and a dynamic object only needs a dynamic symbol table
6324 entry if it is externally visible.
6327 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6328 constructor. Add global_offset_table_ field.
6329 (Target_i386::got_section): Set global_offset_table_.
6330 (Target_i386::do_finalize_sections): Set global_offset_table_
6332 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6333 in constructor. Add global_offset_table_ field.
6334 (Target_x86_64::got_section): Set global_offset_table_.
6335 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6338 * layout.cc (Layout::Layout): Initialize increase_relro_.
6339 (Layout::get_output_section): Add is_relro, is_last_relro, and
6340 is_first_non_relro parameters. Change all callers.
6341 (Layout::choose_output_section): Likewise.
6342 (Layout::add_output_section_data): Likewise.
6343 (Layout::make_output_section): Likewise.
6344 (Layout::set_segment_offsets): Clear increase_relro when using a
6346 * layout.h (class Layout): Add increase_relro method. Add
6347 increase_relro_ field. Update declarations.
6348 * output.cc (Output_section::Output_section): Initialize
6349 is_last_relro_ and is_first_non_relro_.
6350 (Output_segment::add_output_section): Group relro sections is
6351 do_sort is true. Handle is_last_relro and is_first_non_relro.
6352 (Output_segment::maximum_alignment): Remove relro handling.
6353 (Output_segment::set_section_addresses): Add increase_relro
6354 parameter. Change all callers. Add initial alignment to align
6355 relro sections on separate page. Remove old relro handling.
6356 (Output_segment::set_section_list_addresses): Remove in_relro
6357 parameter. Change all callers.
6358 (Output_segment::set_offset): Add increase parameter. Change all
6359 callers. Remove old relro handling.
6360 * output.h (class Output_section): Add new methods: is_last_relro,
6361 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6362 Add is_last_relro_ and is_first_non_relro_ fields.
6363 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6364 Create separate .got.plt section. Call increase_relro.
6365 * x86_64.cc (Target_x86_64::got_section): Likewise.
6366 * testsuite/relro_script_test.t: Add .got.plt.
6369 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6370 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6371 (Layout::finalize): Call set_dynamic_symbol_size.
6372 (Layout::set_dynamic_symbol_size): New function.
6373 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6374 set_dynamic_symbol_size.
6377 * output.h (class Output_section): Add is_entsize_zero_ field.
6378 * output.cc (Output_section::Output_section): Initialize
6380 (Output_section::set_entsize): If two different entsizes are
6381 requested, force it to zero.
6382 (Output_section::add_input_section): Set flags for .debug_str
6383 before updating section flags. Set entsize.
6384 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6385 and SHF_STRING if all input sections have those flags.
6387 2009-12-29 Rafael Espindola <espindola@google.com>
6389 * main.cc (main): Fix the sys time reporting.
6390 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6393 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6395 * options.cc (General_options::parse_version): Allow -v to exit
6396 without an error if there is nothing to link.
6398 2009-12-29 Ian Lance Taylor <iant@google.com>
6400 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6401 using a version of gcc before 4.1.
6402 * configure: Rebuild.
6404 2009-12-28 Chris Demetriou <cgd@google.com>
6406 * attributes.cc (Output_attributes_section_data::do_write): Use
6407 std::vector::front rather than std::vector::data.
6409 2009-12-28 Ian Lance Taylor <iant@google.com>
6411 * symtab.h (class Symbol_table): Add enum Defined.
6412 * resolve.cc (Symbol_table::should_override): Add defined
6413 parameter. Change all callers. Test whether object is NULL
6414 before calling a method on it.
6415 (Symbol_table::report_resolve_problem): Add defined parameter.
6417 (Symbol_table::should_override_with_special): Likewise.
6418 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6419 parameter. Change all callers.
6420 (Symbol_table::do_define_in_output_data): Likewise.
6421 (Symbol_table::define_in_output_segment): Likewise.
6422 (Symbol_table::do_define_in_output_segment): Likewise.
6423 (Symbol_table::define_as_constant): Likewise.
6424 (Symbol_table::do_define_as_constant): Likewise.
6425 * script.h (class Symbol_assignment): Add is_defsym parameter to
6426 constructor; change all callers.
6427 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6428 parameter. Change all callers. Add is_defsym_ field.
6429 (class Parser_closure): Add parsing_defsym parameter to
6430 constructor; change all callers. Add parsing_defsym accessor
6431 function. Add parsing_defsym_ field.
6433 2009-12-28 Ian Lance Taylor <iant@google.com>
6435 * gold.cc (queue_middle_tasks): Fix formatting.
6436 * object.cc (Relobj::is_section_name_included): Likewise.
6438 2009-12-23 Ian Lance Taylor <iant@google.com>
6440 * i386.cc (Target_i386::do_calls_non_split): Recognize
6441 -fsplit-stack prologue for a function with a static chain.
6442 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6443 -fsplit-stack prologue when using %r11.
6445 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6447 * options.cc (General_options::parse_version): Make -v continue and do
6448 the link like GNU ld does.
6450 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6452 * Makefile.am (CCFILES): Add timer.cc.
6453 (HFILES): Add timer.h.
6454 * configure.ac: Check for sysconf and times.
6455 * main.cc: include timer.h.
6456 (main): Use Timer instead of get_run_time.
6459 * workqueue.cc: include timer.h.
6460 (Workqueue::find_and_run_task):
6461 Report user, sys and wall time.
6462 * Makefile.in: Regenerate.
6463 * config.in: Regenerate.
6464 * configure: Regenerate.
6466 2009-12-16 Doug Kwan <dougkwan@google.com>
6468 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6470 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6471 relaxed input sections.
6472 * output.cc (Output_section::find_relaxed_input_section): Change
6473 return type to Output_relaxed_input_section pointer. Adjust code
6474 for new type of relaxed_input_section_map_.
6475 * output.h (Output_section::find_relaxed_input_section): Change
6476 return type to Output_relaxed_input_section pointer.
6477 (Output_section::Output_relaxed_input_section_by_input_section_map):
6479 (Output_section::relaxed_input_section_map_): Change type to
6480 Output_section::Output_relaxed_input_section_by_input_section_map.
6481 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6484 2009-12-15 Ian Lance Taylor <iant@google.com>
6486 * layout.cc (Layout::create_shstrtab): Only write out after input
6487 sections if we are compressing debug sections.
6489 2009-12-15 Ian Lance Taylor <iant@google.com>
6491 * archive.cc (Archive::add_symbols): Only look up a symbol without
6492 a version if there is, in fact, a version.
6494 2009-12-14 Ian Lance Taylor <iant@google.com>
6496 Revert -Wshadow changes, all changes from:
6497 2009-12-11 Doug Kwan <dougkwan@google.com>
6498 2009-12-11 Nick Clifton <nickc@redhat.com>
6499 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6501 2009-12-11 Doug Kwan <dougkwan@google.com>
6503 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6505 * attributes.cc (Object_attribute::size): Ditto.
6506 (Attributes_section_data::size): Ditto.
6507 (Attributes_section_data::Attributes_section_data): Ditto.
6508 (Output_attributes_section_data::do_write): Ditto.
6509 * attributes.h (Object_attribute::set_type): Ditto.
6510 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6512 2009-12-11 Nick Clifton <nickc@redhat.com>
6514 * archive.cc: Fix shadowed variable warnings.
6516 * compressed_output.cc: Likewise.
6517 * compressed_output.h: Likewise.
6518 * configure: Likewise.
6519 * dwarf_reader.cc: Likewise.
6520 * dynobj.cc: Likewise.
6521 * dynobj.h: Likewise.
6522 * ehframe.cc: Likewise.
6523 * ehframe.h: Likewise.
6524 * errors.cc: Likewise.
6525 * expression.cc: Likewise.
6526 * fileread.cc: Likewise.
6527 * fileread.h: Likewise.
6528 * freebsd.h: Likewise.
6529 * i386.cc: Likewise.
6531 * incremental.h: Likewise.
6532 * layout.cc: Likewise.
6533 * layout.h: Likewise.
6534 * mapfile.cc: Likewise.
6535 * merge.cc: Likewise.
6536 * merge.h: Likewise.
6537 * object.cc: Likewise.
6538 * object.h: Likewise.
6539 * options.h: Likewise.
6540 * output.cc: Likewise.
6541 * output.h: Likewise.
6542 * parameters.cc: Likewise.
6543 * plugin.cc: Likewise.
6544 * powerpc.cc: Likewise.
6545 * reduced_debug_output.cc: Likewise.
6546 * reduced_debug_output.h: Likewise.
6547 * reloc.cc: Likewise.
6548 * reloc.h: Likewise.
6549 * resolve.cc: Likewise.
6550 * script-sections.cc: Likewise.
6551 * script.cc: Likewise.
6552 * script.h: Likewise.
6553 * sparc.cc: Likewise.
6554 * symtab.cc: Likewise.
6555 * symtab.h: Likewise.
6556 * target-select.cc: Likewise.
6557 * target-select.h: Likewise.
6558 * token.h: Likewise.
6559 * workqueue.cc: Likewise.
6560 * workqueue.h: Likewise.
6561 * x86_64.cc: Likewise.
6563 2009-12-10 Doug Kwan <dougkwan@google.com>
6565 * arm.cc (attributes.h): New include.
6566 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6567 (Arm_relobj::~Arm_relobj): Delete object pointed by
6568 attributes_section_data_.
6569 (Arm_relobj::attributes_section_data): New method definition.
6570 (Arm_relobj::attributes_section_data_): New data member declaration.
6571 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6572 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6573 attributes_section_data_.
6574 (Arm_dynobj::attributes_section_data): New method definition.
6575 (Arm_dynobj::attributes_section_data_): New data member declaration.
6576 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6577 initialization value of may_use_blx_ to false.
6578 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6579 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6580 object attributes to compute results instead of hard-coding.
6581 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6582 Target_arm::get_secondary_compatible_arch,
6583 Target_arm::set_secondary_compatible_arch
6584 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6585 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6586 New method declarations.
6587 (Target_arm::get_aeabi_object_attribute): New method definition.
6588 (Target_arm::attributes_section_data_): New data member declaration.
6589 (read_arm_attributes_section): New template definition.
6590 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6591 (Arm_dynobj::do_read_symbols): Ditto.
6592 (Target_arm::do_finalize_sections): Merge attributes sections from
6593 input. Check for BLX use after attributes section merging.
6594 Fix __exidx_start and __exidx_end visibility. Create an
6595 .ARM.attributes section if necessary.
6596 (Target_arm::get_secondary_compatible_arch,
6597 Target_arm::set_secondary_compatible_arch,
6598 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6599 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6600 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6601 New method definitions.
6603 2009-12-09 Ian Lance Taylor <iant@google.com>
6605 * plugin.cc (Plugin::load): Don't cast from void* to a function
6608 2009-12-09 Ian Lance Taylor <iant@google.com>
6610 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6613 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6615 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6616 Replace two_file_shared_1.so with two_file_shared_2.so.
6617 * testsuite/Makefile.in: Regenerated.
6619 2009-12-08 Doug Kwan <dougkwan@google.com>
6621 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6622 (HFILES): Add attributes.h and int_encoding.h.
6623 * Makefile.in: Regenerate.
6624 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6625 function definitions to int_encoding.cc
6626 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6627 prototypes to int_encoding.h
6628 * reduced_debug_output.cc (int_encoding.h): New include.
6629 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6630 function definitions to int_encoding.cc
6631 (insert_into_vector, read_from_pointer): Move template definitions to
6633 * attributes.cc: New file.
6634 * attributes.h: New file.
6635 * int_encoding.cc: New file.
6636 * int_encoding.h: New file.
6638 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6641 * incremental-dump.cc (dump_incremental_inputs): New.
6642 (main): Use dump_incremental_inputs.
6644 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6647 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6648 checking elfcpp::STT_FUNC.
6649 (Target_i386::Relocate::relocate): Likewise.
6650 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6652 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6653 symbols from shared libraries into normal FUNC symbols.
6655 * symtab.h (Symbol): Add is_func and use it.
6657 2009-12-05 Doug Kwan <dougkwan@google.com>
6659 * arm.cc (Target_arm::arm_info): Initialize new fields
6660 attributes_section and attributes_vendor.
6661 * i386.cc (Target_i386::i386_info): Same.
6662 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6663 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6664 fields attributes_section and attributes_vendor.
6665 * sparc.cc (Target_sparc::sparc_info): Same.
6666 * target.h (Target::attributes_section, Target::attributes_vendor,
6667 Target::is_attributes_section, Target::attribute_arg_type,
6668 Target::attributes_order): New method definitions.
6669 (Target::Target_info::attributes_section,
6670 Target::Target_info::attributes_vendor): New fields.
6671 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6672 virtual method definitions.
6673 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6674 attributes_section and attributes_vendor.
6675 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6677 2009-12-05 Doug Kwan <dougkwan@google.com>
6679 * arm.cc: Update comments about interworking and stub generation.
6680 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6681 considered as non-PIC.
6682 (Arm_relocate_functions::base_abs): Fix formatting.
6683 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6684 of function to use GOT entry address instead of offset.
6685 (Target_arm::Scan::global): Issue an error if a symbol would need a
6686 PLT does not get one because it is untyped. Remove code to create
6687 dynamic symbols for relative branches.
6688 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6689 takes unsigned integer instead of boolean.
6691 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6693 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6694 (two_file_test_LDADD): Likewise.
6695 (common_test_1_LDADD): Likewise.
6696 (exception_test_LDADD) Likewise.
6697 (weak_test_LDADD): Likewise.
6698 (many_sections_test_LDADD): Likewise.
6699 (initpri1_LDADD): Likewise.
6700 (script_test_1_LDADD): Likewise.
6701 (script_test_2_LDADD): Likewise.
6702 (justsyms_LDADD): Likewise.
6703 (binary_test_LDADD): Likewise.
6704 (large_LDADD): Likewise.
6705 * testsuite/Makefile.in: Regenerated.
6707 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6709 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6710 (Symbol_table::override_with_special): Likewise.
6711 (Symbol_table::add_from_object): Likewise.
6713 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6715 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6716 Don't set the data_offset twice.
6718 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6720 * testsuite/Makefile.in: Regenerate.
6722 2009-12-03 Doug Kwan <dougkwan@google.com>
6724 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6725 (Target_arm::do_finalize_sections): Add parameter for symbol table
6726 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6727 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6728 parameter for symbol table pointer.
6729 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6730 an additional parameter for a pointer to symbol table.
6731 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6732 parameter for a symbol table pointer.
6733 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6734 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6736 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6737 parameter for a symbol table pointer.
6739 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6741 * incremental.cc (Incremental_inputs_header)
6742 (Incremental_inputs_header_write, Incremental_inputs_entry)
6743 (Incremental_inputs_entry_write): Move ...
6744 * incremental.h (Incremental_inputs_header)
6745 (Incremental_inputs_header_write, Incremental_inputs_entry)
6746 (Incremental_inputs_entry_write): here.
6748 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6750 * incremental.cc (make_sized_incremental_binary): Set the target.
6751 Error if it is incompatible.
6752 * output.h (Output_file): Add filename method.
6754 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6756 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6757 from the get_* methods.
6759 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6761 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6762 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6763 Write 0 for the data_offset of scripts.
6765 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6767 * testsuite/Makefile.am: Add the incremental_test.sh test.
6768 * testsuite/incremental_test.sh: New.
6769 * testsuite/incremental_test_1.c: New.
6770 * testsuite/incremental_test_2.c: New.
6772 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6774 * incremental-dump.cc (main): Fix typos.
6776 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6779 * incremental-dump.cc (main): Use llu to print 64 bit values.
6781 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6782 H.J. Lu <hongjiu.lu@intel.com>
6784 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6786 (incremental_dump_LDADD): Likewise.
6787 * Makefile.in: Regenerated.
6789 2009-11-25 Doug Kwan <dougkwan@google.com>
6793 2009-11-25 Doug Kwan <dougkwan@google.com>
6795 * arm.cc (Target_arm::Target_arm): Move method definition
6796 outside of class definition. Add code to handle
6797 --target1-rel, --target1-abs and --target2= options.
6798 (Target_arm::get_reloc_reloc_type): Change method to be
6799 non-static and const.
6800 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6801 New data member declaration.
6802 (Target_arm::Scan::local, Target_arm::Scan::global,
6803 Target_arm::Relocate::relocate,
6804 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6805 Adjust call to Target_arm::get_real_reloc_type.
6806 (Target_arm::get_real_reloc_type): Use command line options
6807 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6808 * options.h (--target1-rel, --target1-abs, --target2): New
6811 2009-11-25 Doug Kwan <dougkwan@google.com>
6813 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6814 class definition. Add code to handle --target1-rel, --target1-abs
6815 and --target2= options.
6816 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6818 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6820 (Target_arm::Scan::local, Target_arm::Scan::global,
6821 Target_arm::Relocate::relocate,
6822 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6823 call to Target_arm::get_real_reloc_type.
6824 (Target_arm::get_real_reloc_type): Use command line options to
6825 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6826 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6829 2009-11-25 Doug Kwan <dougkwan@google.com>
6831 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6832 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6833 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6835 (Arm_relocate_functions::thm_call): Replace body with a call to
6836 Arm_relocate_functions::thumb_branch_common.
6837 (Arm_relocate_functions::thm_jump24,
6838 Arm_relocate_functions::thm_xpc22): New method definitions.
6839 (Arm_relocate_functions::thumb_branch_common): New method definition.
6840 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6842 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6843 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6845 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6847 * Makefile.am: Build incremental-dump
6848 * Makefile.in: Regenerate.
6849 * incremental-dump.cc: New.
6850 * incremental.cc (Incremental_inputs_header_data,
6851 Incremental_inputs_entry_data): Move to incremental.h
6852 * incremental.h: (Incremental_inputs_header_data,
6853 Incremental_inputs_entry_data): Move from incremental.cc
6855 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6857 * incremental.cc (Incremental_inputs_header,
6858 Incremental_inputs_header_write, Incremental_inputs_entry,
6859 Incremental_inputs_entry_write): Add a typedef with the data type.
6861 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6863 * incremental.cc (Incremental_inputs_header,
6864 Incremental_inputs_header_write, Incremental_inputs_entry,
6865 Incremental_inputs_entry_write): Update comment about which
6866 type has the filed descriptions.
6868 2009-11-15 Doug Kwan <dougkwan@google.com>
6870 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6871 (Arm_relocate_functions::arm_branch_common): Change method defintion
6872 in class definition to a method declaration and update list of formal
6874 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6875 Arm_relocation_functions::jump24): Adjust call to
6876 Arm_relocate_functions::arm_branch_common. Update list of formal
6878 (Arm_relocate_functions::xpc25): New method definition.
6879 (Arm_relocate_functions::arm_branch_common): Move method defintion
6880 out from class definition. Use stubs for mode-switching and extending
6882 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6883 specially. Change code to enable use of stubs in ARM branches.
6885 2009-11-10 Doug Kwan <dougkwan@google.com>
6887 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6888 in method declaration.
6889 (Target_arm::relocate_stub): New method declaration.
6890 (Target_arm::default_target): Change to return a pointer instead of
6892 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6893 Target_arm::default_target.
6894 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6896 (Target_arm::relocate_section): Adjust view.
6897 (Target_arm::relocate_stub): New method definition.
6899 2009-11-10 Doug Kwan <dougkwan@google.com>
6901 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6903 * incremental.cc (open_incremental_binary): Initialized local
6904 variables to avoid warnings.
6905 * object.cc (make_elf_object): Ditto.
6906 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6909 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6912 * testsuite/plugin_test.c: Include "config.h".
6914 2009-11-09 Doug Kwan <dougkwan@google.com>
6916 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6917 (arm_symbol_value): Remove.
6918 (Arm_relocate_functions::arm_branch_common,
6919 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6920 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6921 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6922 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6923 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6924 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6925 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6926 Arm_relocate_functions::thm_mobw_abs_nc,
6927 Arm_relocate_functions::thm_mov_abs,
6928 Arm_relocate_functions::movw_prel_nc,
6929 Arm_relocate_functions::thm_movt_abs,
6930 Arm_relocate_functions::movt_prel,
6931 Arm_relocate_functions::thm_movw_prel_nc,
6932 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6933 (Target_arm::Relocate::relocate): Only decompose address into two
6934 parts if relocation type uses the thumb-bit and pass the actual
6935 bit instead of a flag indicating that the thumb-bit is used. Adjust
6936 calls to methods in Arm_relocate_functions for this change.
6938 2009-11-08 Ian Lance Taylor <iant@google.com>
6941 * reloc.cc: Instantiate
6942 Sized_relobj::initialize_input_to_output_maps and
6943 Sized_relobj:free_input_to_output_maps.
6945 2009-11-06 Ian Lance Taylor <iant@google.com>
6948 * defstd.cc (in_segment): Set only_if_ref true for "end".
6950 2009-11-06 Doug Kwan <dougkwan@google.com>
6952 * arm.cc (class Reloc_stub): Correct a comment.
6953 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6954 (Target_arm::scan_section_for_stubs): New method declaration.
6955 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6956 Change methods from private to protected.
6957 (Target_arm::do_may_relax): New method definition.
6958 (Target_arm::do_relax, Target_arm::group_sections,
6959 Target_arm::scan_reloc_for_stub,
6960 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6961 (Target_arm::arm_input_section_map_): New data member declaration.
6962 (Target_arm::scan_reloc_for_stub,
6963 Target_arm::scan_reloc_section_for_stubs,
6964 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6965 Target_arm::do_relax): New method definitions.
6967 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6969 * configure.ac: Check for (struct stat)::st_mtim
6970 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6971 * config.in: Regenerate.
6972 * configure: Regenerate.
6974 2009-11-05 Ian Lance Taylor <iant@google.com>
6977 * output.cc (Output_segment::add_output_section): Add missing
6980 2009-11-04 Ian Lance Taylor <iant@google.com>
6983 * object.h (class Object): Add is_needed and set_is_needed
6984 methods. Add is_needed_ field. Make bool fields into bitfields.
6985 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6986 defined in a dynamic object and referenced by a regular object,
6987 set is_needed for the dynamic object.
6988 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6989 if the file is marked with as_needed and it is not needed.
6991 2009-11-04 Ian Lance Taylor <iant@google.com>
6994 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6995 tags if data is discarded by linker script.
6996 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6997 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6998 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6999 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7001 2009-11-04 Ian Lance Taylor <iant@google.com>
7003 * layout.cc (Layout::get_output_section): Add is_interp and
7004 is_dynamic_linker_section parameters. Change all callers.
7005 (Layout::choose_output_section): Likewise.
7006 (Layout::make_output_section): Likewise.
7007 (Layout::add_output_section_data): Add is_dynamic_linker_section
7008 parameter. Change all callers.
7009 * layout.h (class Layout): Update declarations.
7010 * output.h (class Output_section): Add is_interp, set_is_interp,
7011 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7012 Add is_interp_, is_dynamic_linker_section_ fields. Change
7013 generate_code_fills_at_write_ to a bitfield.
7014 * output.cc (Output_section::Output_sections): Initialize new
7016 (Output_segment::add_output_section): Add do_sort parameter.
7019 2009-11-03 Ian Lance Taylor <iant@google.com>
7022 * options.h (class General_options): Add --warn-common.
7023 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7024 merging two common symbols.
7025 (Symbol_table::should_override): Handle --warn-common when merging
7026 a common symbol with a defined symbol. Use report_resolve_problem
7027 for multiple definitions.
7028 (Symbol_table::report_resolve_problem): New function.
7029 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7031 2009-11-03 Doug Kwan <dougkwan@google.com>
7033 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7035 (Target_arm::stub_factory): New method definition.
7036 (Target_arm::new_arm_input_section,
7037 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7038 Target_arm::reloc_uses_thumb_bit): New method declarations.
7039 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7040 New type definitions.
7041 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7042 member declarations.
7043 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7044 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7045 New method definitions.
7047 2009-11-03 Ian Lance Taylor <iant@google.com>
7049 * options.h (class General_options): Add --warn_constructors.
7051 2009-11-03 Ian Lance Taylor <iant@google.com>
7054 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7055 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7057 2009-11-03 Ian Lance Taylor <iant@google.com>
7060 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7061 --msgid-bugs-address.
7062 (install-pdf): New target.
7063 (install-data_yes): Look up one directory to find mkinstalldirs.
7065 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7067 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7070 2009-10-30 Doug Kwan <dougkwan@google.com>
7072 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7074 2009-10-30 Doug Kwan <dougkwan@google.com>
7076 * arm.cc (Stub_addend_reader): New struct template definition
7077 and partial specializations.
7078 (Stub_addend_reader::operator()): New method definition for a
7079 partially specialized template.
7081 2009-10-30 Doug Kwan <dougkwan@google.com>
7083 * arm.cc (Arm_relobj::processor_specific_flags): New method
7085 (Arm_relobj::do_read_symbols): New method declaration.
7086 (Arm_relobj::processor_specific_flags_): New data member declaration.
7087 (Arm_dynobj): New class definition.
7088 (Target_arm::do_finalize_sections): Add input_objects parameter.
7089 (Target_arm::do_adjust_elf_header): New method declaration.
7090 (Target_arm::are_eabi_versions_compatible,
7091 (Target_arm::merge_processor_specific_flags): New method declaration.
7092 (Target_arm::do_make_elf_object): New overloaded method definitions
7094 (Arm_relobj::do_read_symbols): New method definition.
7095 (Arm_dynobj::do_read_symbols): Ditto.
7096 (Target_arm::do_finalize_sections): Add input_objects parameters.
7097 Merge processor-specific flags from all input objects.
7098 (Target_arm::are_eabi_versions_compatible,
7099 Target_arm::merge_processor_specific_flags,
7100 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7101 New method definitions.
7102 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7103 Input_objects pointer type parameter.
7104 * layout.cc (Layout::finalize): Pass input objects to target's.
7105 finalize_sections function.
7106 * output.cc (Output_file_header::do_sized_write): Set ELF file
7107 header's processor-specific flags.
7108 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7109 Input_objects pointer type parameter.
7110 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7111 * target.h (Input_objects): New forward class declaration.
7112 (Target::processor_specific_flags,
7113 Target::are_processor_specific_flags_sect): New method definitions.
7114 (Target::finalize_sections): Add input_objects parameter.
7115 (Target::Target): Initialize processor_specific_flags_ and
7116 are_processor_specific_flags_set_.
7117 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7119 (Target::set_processor_specific_flags): New method definition.
7120 (Target::processor_specific_flags_,
7121 Target::are_processor_specific_flags_set_): New data member
7123 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7124 Input_objects pointer type parameter.
7126 2009-10-30 Doug Kwan <dougkwan@google.com>
7128 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7130 2009-10-28 Ian Lance Taylor <iant@google.com>
7132 * object.h (class Relobj): Drop options parameter from
7133 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7134 do_scan_relocs, do_relocate. Change all callers.
7135 (class Sized_relobj): Drop options parameters from
7136 do_gc_process_relocs, do_scan_relocs, do_relocate,
7137 do_relocate_sections, relocate_sections, emit_relocs_scan,
7138 emit_relocs_scan_reltype. Change all callers.
7139 (struct Relocate_info): Remove options field and all references to
7141 * reloc.h (class Read_relocs): Remove options constructor
7142 parameter and options_ field. Change all callers.
7143 (class Gc_process_relocs, class Scan_relocs): Likewise.
7144 (class Relocate_task): Likewise.
7145 * target-reloc.h (scan_relocs): Remove options parameter. Change
7147 (scan_relocatable_relocs): Likewise.
7148 * target.h (class Sized_target): Remove options parameter from
7149 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7151 * gc.h (gc_process_relocs): Remove options parameter. Change all
7153 * arm.cc: Update functions to remove options parameters.
7154 * i386.cc: Likewise.
7155 * powerpc.cc: Likewise.
7156 * sparc.cc: Likewise.
7157 * x86_64.cc: Likewise.
7158 * testsuite/testfile.cc: Likewise.
7160 2009-10-28 Doug Kwan <dougkwan@google.com>
7162 * arm.cc (Arm_relobj): New class definition.
7163 (Arm_relobj::scan_sections_for_stubs,
7164 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7165 New method definitions.
7167 2009-10-28 Cary Coutant <ccoutant@google.com>
7169 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7170 (Plugin::cleanup_done_): New member.
7171 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7172 (Plugin_manager::cleanup_done_): Remove.
7173 (Plugin_manager::add_input_file): Edit error message.
7174 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7175 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7177 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7179 * fileread.cc: (File_read::View::~View): Use the new
7180 data_ownership_ filed.
7181 (File_read::~File_read): Dispose the new whole_file_view_.
7182 (File_read::open): Mmap the whole file if needed.
7183 (File_read::open): Use whole_file_view_ instead of contents_.
7184 (File_read::find_view): Use whole_file_view_ if applicable.
7185 (File_read::do_read): Use whole_file_view_ instead of contents_.
7186 (File_read::make_view): Use whole_file_view_ instead of contents_,
7187 update File_read::View::View call.
7188 (File_read::find_or_make_view): Update File_read::View::View
7190 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7192 (File_read::View::Data_ownership): New enum.
7193 (File_read::View::View): Replace bool mapped_ with Data_ownership
7195 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7196 (File_read::View::data_ownership_): New field.
7197 (File_read::contents_): Remove (replaced by whole_file_view_).
7198 (File_read::whole_file_view_): New field.
7199 * options.h (class General_options): Add --keep-files-mapped.
7201 2009-10-27 Cary Coutant <ccoutant@google.com>
7203 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7204 * testsuite/Makefile.am (plugin_test_5): New test case.
7205 * testsuite/Makefile.in: Regenerate.
7207 2009-10-25 Doug Kwan <dougkwan@google.com>
7209 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7210 from private to protected to allow access by child class.
7211 (Sized_relobj::do_relocate_sections): New method declaration.
7212 (Sized_relobj::relocate_sections): Virtualize.
7213 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7214 Sized_relobj::relocate_sections. Instantiate template explicitly
7215 for different target sizes and endianity.
7217 2009-10-24 Doug Kwan <dougkwan@google.com>
7219 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7220 (Arm_input_section::as_arm_input_section): New method.
7221 (Arm_output_section): New class definition.
7222 (Arm_output_section::create_stub_group,
7223 Arm_output_section::group_sections): New method definitions.
7225 2009-10-22 Doug Kwan <dougkwan@google.com>
7227 * arm.cc (Arm_input_section): New class definition.
7228 (Arm_input_section::init, Arm_input_section:do_write,
7229 Arm_input_section::set_final_data_size,
7230 Arm_input_section::do_reset_address_and_file_offset): New method
7233 2009-10-21 Doug Kwan <dougkwan@google.com>
7235 * arm.cc (Stub_table, Arm_input_section): New forward class
7237 (Stub_table): New class defintion.
7238 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7239 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7240 New method definition.
7242 2009-10-21 Doug Kwan <dougkwan@google.com>
7244 * arm.cc: Update copyright comments.
7245 (Target_arm): New forward class template declaration.
7246 (Arm_address): New type.
7247 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7248 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7249 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7251 (Insn_template): Same.
7252 (DEF_STUBS): New macro.
7253 (Stub_type): New enum type.
7254 (Stub_template): New class definition.
7257 (Stub_factory): Same.
7258 (Target_arm::Target_arm): Initialize may_use_blx_ and
7259 should_force_pic_veneer_.
7260 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7261 Target_arm::should_force_pic_veneer,
7262 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7263 Target_arm::using_thumb_only, Target_arm:;default_target): New
7265 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7266 New data member declarations.
7267 (Insn_template::size, Insn_template::alignment): New method defintions.
7268 (Stub_template::Stub_template): New method definition.
7269 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7270 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7271 (Stub_factory::Stub_factory): New method definition.
7272 * gold.h (string_hash): New template.
7273 * output.h (Input_section_specifier::hash_value): Use
7275 (Input_section_specifier::string_hash): Remove.
7276 * stringpool.cc (Stringpool_template::string_hash): Use
7279 2009-10-20 Doug Kwan <dougkwan@google.com>
7281 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7282 symbols of relaxed input sections.
7283 * output.h (Output_section::find_relaxed_input_section): Make
7286 2009-10-16 Doug Kwan <dougkwan@google.com>
7288 * dynobj.cc (Versions::Versions): Initialize version_script_.
7289 Only insert base version symbol definition for a shared object
7290 if version script defines any version versions.
7291 (Versions::define_base_version): New method definition.
7292 (Versions::add_def): Check that base version is not needed.
7293 (Versions::add_need): Define base version lazily.
7294 * dynobj.h (Versions::define_base_version): New method declaration.
7295 (Versions::needs_base_version_): New data member declaration.
7296 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7297 (check_DATA): Add no_version_test.stdout.
7298 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7300 * testsuite/Makefile.in: Regenerate.
7301 * testsuite/no_version_test.c: New file.
7302 * testsuite/no_version_test.sh: Ditto.
7304 2009-10-16 Doug Kwan <dougkwan@google.com>
7306 * expression.cc (class Segment_start_expression): New class definition.
7307 (Segment_start_expression::value): New method definition.
7308 (script_exp_function_segment_start): Return a new
7309 Segment_start_expression.
7310 * gold/script-c.h (script_saw_segment_start_expression): New function
7312 * script-sections.cc (Script_sections::Script_sections): Initialize
7313 SAW_SEGMENT_START_EXPRESSION_ to false.
7314 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7315 and -Tbbs options to specify section addresses if given in
7316 command line and no SEGMENT_START expression is seen in a script.
7317 * script-sections.h (Script_sections::saw_segment_start_expression,
7318 Script_sections::set_saw_segment_start_expression): New method
7320 (Script_sections::saw_segment_start_expression_): New data member
7322 * script.cc (script_saw_segment_start_expression): New function.
7323 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7324 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7325 script_test_7.sh and script_test_8.sh.
7326 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7327 script_test_8.stdout.
7328 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7329 (script_test_6, script_test_6.stdout, script_test_7,
7330 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7331 * Makefile.in: Regenerate.
7332 * testsuite/script_test_6.sh: New file.
7333 * testsuite/script_test_6.t: Same.
7334 * testsuite/script_test_7.sh: Same.
7335 * testsuite/script_test_7.t: Same.
7336 * testsuite/script_test_8.sh: Same.
7338 2009-10-16 Doug Kwan <dougkwan@google.com>
7340 * output.cc (Output_segment::set_section_list_address): Cast
7341 expressions to unsigned long long type to avoid format warnings.
7343 2009-10-15 Ian Lance Taylor <iant@google.com>
7345 * script.cc (Script_options::add_symbol_assignment): Always add a
7346 dot assignment to script_sections_.
7347 * script-sections.cc (Script_sections::add_dot_assignment):
7348 Initialize if necessary.
7350 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7351 program headers with no load segment if there is a linker script.
7353 * layout.cc (Layout::set_segment_offsets): Align the file offset
7354 to the segment aligment for -N or -n with no load segment.
7355 * output.cc (Output_segment::add_output_section): Don't crash if
7356 the first section is a TLS section.
7357 (Output_segment::set_section_list_addresses): Print an error
7358 message if the address moves backward in a linker script.
7359 * script-sections.cc
7360 (Output_section_element_input::set_section_addresses): Don't
7361 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7362 (Orphan_output_section::set_section_addresses): Likewise.
7364 2009-10-15 Doug Kwan <dougkwan@google.com>
7366 * layout.cc (Layout::finish_dynamic_section): Generate tags
7367 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7368 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7369 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7371 2009-10-14 Ian Lance Taylor <iant@google.com>
7373 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7375 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7376 data_shdr fields of relinfo.
7377 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7378 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7379 R_386_TLS_LDO_32, adjust based on section flags.
7380 (Target_i386::Relocate::fix_up_ldo): Remove.
7382 2009-10-13 Ian Lance Taylor <iant@google.com>
7384 Add support for -pie.
7385 * options.h (class General_options): Add -pie and
7387 (General_options::output_is_position_independent): Test -pie.
7388 (General_options::output_is_executable): Return true if not shared
7389 and not relocatable.
7390 (General_options::output_is_pie): Remove.
7391 * options.cc (General_options::finalize): Reject incompatible uses
7393 * gold.cc (queue_middle_tasks): A -pie link is not static.
7394 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7395 * symtab.cc (Symbol::final_value_is_known): Return false if
7396 output_is_position_independent.
7397 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7398 output_is_position_independent.
7399 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7400 output_is_position_independent.
7401 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7402 output_is_position_independent.
7403 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7405 (basic_pie_test.o, basic_pie_test): New targets.
7406 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7407 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7408 (two_file_pie_test): New target.
7409 * testsuite/Makefile.in: Rebuild.
7410 * README: Remove note saying that -pie is not supported.
7412 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7414 * options.h (class General_options): Add -init and -fini.
7415 * layout.cc (Layout::finish_dynamic_section): Emit
7416 given init and fini functions.
7418 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7420 * gc.h (gc_process_relocs): Check if icf is enabled using new
7422 * gold.cc (queue_initial_tasks): Likewise.
7423 (queue_middle_tasks): Likewise.
7424 * object.cc (do_layout): Likewise.
7425 * symtab.cc (is_section_folded): Likewise.
7426 * main.cc (main): Likewise.
7427 * reloc.cc (Read_relocs::run): Likewise.
7428 (Sized_relobj::do_scan_relocs): Likewise.
7429 * icf.cc (is_function_ctor_or_dtor): New function.
7430 (Icf::find_identical_sections): Check if function is ctor or dtor when
7432 * options.h (General_options::icf): Change option to be an enum.
7433 (Icf_status): New enum.
7434 (icf_enabled): New method.
7435 (icf_safe_folding): New method.
7436 (set_icf_status): New method.
7437 (icf_status_): New variable.
7438 * (options.cc) (General_options::finalize): Set icf_status_.
7439 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7440 icf_test and icf_keep_unique_test to use the --icf enum flag.
7441 * testsuite/icf_safe_test.sh: New file.
7442 * testsuite/icf_safe_test.cc: New file.
7444 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7446 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7447 includes to gc.h and icf.h.
7448 * arm.cc: Include gc.h.
7449 * gold.cc: Likewise.
7450 * i386.cc: Likewise.
7451 * powerpc.cc: Likewise.
7452 * sparc.cc: Likewise.
7453 * x86_64.cc: Likewise.
7454 * gc.h: Include icf.h.
7456 2009-10-11 Ian Lance Taylor <iant@google.com>
7458 * plugin.cc: Include "gold.h" before other header files.
7460 2009-10-10 Chris Demetriou <cgd@google.com>
7462 * options.h (Input_file_argument::Input_file_type): New enum.
7463 (Input_file_argument::is_lib_): Replace with...
7464 (Input_file_argument::type_): New member.
7465 (Input_file_argument::Input_file_argument): Take Input_file_type
7466 'type' rather than boolean 'is_lib' as second argument.
7467 (Input_file_argument::is_lib): Use type_.
7468 (Input_file_argument::is_searched_file): New function.
7469 (Input_file_argument::may_need_search): Handle is_searched_file.
7470 * options.cc (General_options::parse_library): Support -l:filename.
7471 (General_options::parse_just_symbols): Update for Input_file_argument
7473 (Command_line::process): Likewise.
7474 * archive.cc (Archive::get_file_and_offset): Likewise.
7475 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7476 * script.cc (read_script_file, script_add_file): Likewise.
7477 * fileread.cc (Input_file::Input_file): Likewise.
7478 (Input_file::will_search_for): Handle is_searched_file.
7479 (Input_file::open): Likewise.
7480 * readsyms.cc (Read_symbols::get_name): Likewise.
7481 * testsuite/Makefile.am (searched_file_test): New test.
7482 * testsuite/Makefile.in: Regenerate.
7483 * testsuite/searched_file_test.cc: New file.
7484 * testsuite/searched_file_test_lib.cc: New file.
7486 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7487 Ian Lance Taylor <iant@google.com>
7489 * descriptor.cc: Include <cstdio> and "binary-io.h".
7490 (Descriptors::open): Open the files in binary mode always.
7491 * script.cc (Lex::get_token): Treat \r as whitespace.
7493 2009-10-09 Ian Lance Taylor <iant@google.com>
7495 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7497 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7498 Ian Lance Taylor <iant@google.com>
7500 * configure.ac: Check for readv function also.
7501 * fileread.cc (readv): Define if not HAVE_READV.
7502 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7504 * config.in: Regenerate.
7505 * configure: Regenerate.
7507 2009-10-09 Doug Kwan <dougkwan@google.com>
7509 * layout.cc (Layout::make_output_section): Call target hook to make
7510 ordinary output section.
7511 (Layout::finalize): Adjust parameter list of call the
7512 Target::may_relax().
7513 * layout.h (class Layout::section_list): New method.
7514 * merge.h (Output_merge_base::entsize): Change visibility to public.
7515 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7517 (Output_merge_string::do_is_string): New method.
7518 * object.cc (Sized_relobj::do_setup): renamed from
7519 Sized_relobj::set_up.
7520 * object.h (Sized_relobj::adjust_shndx,
7521 Sized_relobj::initializ_input_to_output_maps,
7522 Sized_relobj::free_input_to_output_maps): Change visibilities to
7524 (Sized_relobj::setup): Virtualize.
7525 (Sized_relobj::do_setup): New method declaration.
7526 (Sized_relobj::invalidate_section_offset,
7527 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7528 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7529 * options.cc (parse_int): New function.
7530 * options.h (parse_int): New declaration.
7531 (DEFINE_int): New macro.
7532 (stub_group_size): New option.
7533 * output.cc (Output_section::Output_section): Initialize memebers
7534 merge_section_map_, merge_section_by_properties_map_,
7535 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7536 (Output_section::add_input_section): Handled deferred code-fill
7537 generation and remove an old comment.
7538 (Output_section::add_relaxed_input_section): New method definition.
7539 (Output_section::add_merge_input_section): Use merge section by
7540 properties map to speed to search. Update merge section maps
7542 (Output_section::build_relaxation_map): New method definition.
7543 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7545 (Output_section::relax_input_section): Renamed to
7546 Output_section::convert_input_sections_to_relaxed_sections and change
7547 interface to take a vector of pointers to relaxed sections.
7548 (Output_section::find_merge_section,
7549 Output_section::find_relaxed_input_section): New method definitions.
7550 (Output_section::is_input_address_mapped,
7551 Output_section::output_offset, Output_section::output_address):
7552 Use output section data maps to speed up searching.
7553 (Output_section::find_starting_output_address): Add comments.
7554 (Output_section::do_write,
7555 Output_section::write_to_postprocessing_buffer): Do code-fill
7556 generation as appropriate.
7557 (Output_section::get_input_sections): Invalidate relaxed input section
7559 (Output_section::restore_states): Adjust type of checkpoint .
7560 Invalidate relaxed input section map.
7561 * output.h (Output_merge_base): New class declaration.
7562 (Input_section_specifier): New class defintion.
7563 (class Output_relaxed_input_section) Change base class to
7564 Output_section_data_build.
7565 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7566 base class initializer.
7567 (Output_section::add_relaxed_input_section): New method declaration.
7568 (Output_section::Input_section): Change visibility to protected.
7569 (Output_section::Input_section::relobj,
7570 Output_section::Input_section::shndx): Handle relaxed input sections.
7571 Output_section::input_sections) Change visibility to protected. Also
7572 define overload to return a non-const pointer.
7573 (Output_section::Merge_section_properties): New class defintion.
7574 (Output_section::Merge_section_by_properties_map,
7575 Output_section::Output_section_data_by_input_section_map,
7576 Output_section::Relaxation_map): New types.
7577 (Output_section::relax_input_section): Rename method to
7578 Output_section::convert_input_sections_to_relaxed_sections and change
7579 interface to take a vector of relaxed section pointers.
7580 (Output_section::find_merge_section,
7581 Output_section::find_relaxed_input_section,
7582 Output_section::build_relaxation_map,
7583 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7584 New method declarations.
7585 (Output_section::merge_section_map_
7586 Output_section::merge_section_by_properties_map_,
7587 Output_section::relaxed_input_section_map_,
7588 Output_section::is_relaxed_input_section_map_valid_,
7589 Output_section::generate_code_fills_at_write_): New data members.
7590 * script-sections.cc
7591 (Output_section_element_input::set_section_addresses): Call
7592 current_data_size and addralign methods of relaxed input sections.
7593 (Orphan_output_section::set_section_addresses): Call current_data_size
7594 and addralign methods of relaxed input sections.
7595 * symtab.cc (Symbol_table::compute_final_value): Extract template
7596 from the body of Symbol_table::sized_finalize_symbol.
7597 (Symbol_table::sized_finalized_symbol): Call
7598 Symbol_table::compute_final_value.
7599 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7600 (Symbol_table::compute_final_value): New templated method declaration.
7601 * target.cc (Target::do_make_output_section): New method defintion.
7602 * target.h (Target::make_output_section): New method declaration.
7603 (Target::relax): Add more parameters for input objects, symbol table
7604 and layout. Adjust call to do_relax.
7605 (Target::do_make_output_section): New method declaration.
7606 (Target::do_relax): Add parameters for input objects, symbol table
7609 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7611 * pread.c: Include stdio.h.
7613 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7615 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7618 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7620 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7621 Change read_shndx type to unsigned int.
7622 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7624 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7625 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7626 Change read_shndx type to unsigned int.
7627 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7629 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7630 * layout.cc (Layout::create_symtab_sections): Cast the result of
7631 local_symcount * symsize to off_t in the gold_assert.
7633 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7635 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7636 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7638 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7639 (Arm_relocate_functions::thm_abs5): New function.
7640 (Arm_relocate_functions::abs12): New function.
7641 (Arm_relocate_functions::abs16): New function.
7642 (Arm_relocate_functions::base_abs): New function.
7643 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7644 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7645 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7647 (Scan::global): Likewise.
7648 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7649 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7650 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7651 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7654 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7656 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7657 (Arm_relocate_functions::movt_prel): New function.
7658 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7659 (Arm_relocate_functions::thm_movt_prel): New function.
7660 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7661 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7662 (Scan::global, Relocate::relocate): Likewise.
7663 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7665 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7667 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7668 Incremental_checker.
7669 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7671 (class Incremental_inputs_header): New class.
7672 (Incremental_inputs_header_writer): Edit comment.
7673 (Incremental_inputs_entry): New class.
7674 (Incremental_inputs_entry_writer): Edit comment.
7675 (Sized_incremental_binary::do_find_incremental_inputs_section):
7676 Add *strtab_shndx parameter, fill it.
7677 (Sized_incremental_binary::do_check_inputs): New method.
7678 (Incremental_checker::can_incrementally_link_output_file): Use
7679 Sized_incremental_binary::check_inputs.
7680 (Incremental_inputs::report_command_line): Save command line in
7683 (Incremental_binary::find_incremental_inputs_section): New
7685 (Incremental_binary::do_find_incremental_inputs_section): Add
7686 strtab_shndx parameter.
7687 (Incremental_binary::do_check_inputs): New pure virtual method.
7688 (Sized_incremental_binary::do_check_inputs): Declare.
7689 (Incremental_checker::Incremental_checker): Add incremental_inputs
7690 parameter, use it to initialize incremental_inputs_.
7691 (Incremental_checker::incremental_inputs_): New field.
7692 (Incremental_checker::command_line): New method.
7693 (Incremental_checker::inputs): New method.
7694 (Incremental_checker::command_line_): New field.
7696 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7698 * incremental.cc: Include <cstdarg> and "target-select.h".
7699 (vexplain_no_incremental): New function.
7700 (explain_no_incremental): New function.
7701 (Incremental_binary::error): New method.
7702 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7704 (make_sized_incremental_binary): New function.
7705 (open_incremental_binary): New function.
7706 (can_incrementally_link_file): Add checks if output is ELF and has
7708 * incremental.h: Include "elfcpp_file.h" and "output.h".
7709 (Incremental_binary): New class.
7710 (Sized_incremental_binary): New class.
7711 (open_incremental_binary): Declare.
7712 * object.cc (is_elf_object): Use
7713 elfcpp::Elf_recognizer::is_elf_file.
7714 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7715 * output.h (Output_file::filesize): New method.
7717 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7719 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7721 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7722 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7724 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7726 (Arm_relocate_functions::movw_abs_nc): New function.
7727 (Arm_relocate_functions::movt_abs): New function.
7728 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7729 (Arm_relocate_functions::thm_movt_abs): New function.
7730 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7731 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7732 (Scan::global): Likewise.
7733 (Relocate::relocate): Likewise.
7734 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7736 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7738 * arm.cc (Arm_relocate_functions::got_prel) New function.
7739 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7740 (Relocate::relocate): Likewise.
7741 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7743 2009-10-06 Ian Lance Taylor <iant@google.com>
7745 * options.h (class General_options): Define
7746 split_stack_adjust_size parameter.
7747 * object.h (class Object): Add uses_split_stack_ and
7748 has_no_split_stack_ fields. Add uses_split_stack and
7749 has_no_split_stack accessor functions. Declare
7750 handle_split_stack_section.
7751 (class Reloc_symbol_changes): Define.
7752 (class Sized_relobj): Define Function_offsets. Declare
7753 split_stack_adjust, split_stack_adjust_reltype, and
7755 * object.cc (Object::handle_split_stack_section): New function.
7756 (Sized_relobj::do_layout): Call handle_split_stack_section.
7757 * dynobj.cc (Sized_dynobj::do_layout): Call
7758 handle_split_stack_section.
7759 * reloc.cc (Sized_relobj::relocate_sections): Call
7760 split_stack_adjust for executable sections in split_stack
7761 objects. Pass reloc_map to relocate_section.
7762 (Sized_relobj::split_stack_adjust): New function.
7763 (Sized_relobj::split_stack_adjust_reltype): New function.
7764 (Sized_relobj::find_functions): New function.
7765 * target-reloc.h: Include "object.h".
7766 (relocate_section): Add reloc_symbol_changes parameter. Change
7768 * target.h (class Target): Add calls_non_split method. Declare
7769 do_calls_non_split virtual method. Declare match_view and
7771 * target.cc: Include "elfcpp.h".
7772 (Target::do_calls_non_split): New function.
7773 (Target::match_view): New function.
7774 (Target::set_view_to_nop): New function.
7775 * gold.cc (queue_middle_tasks): Give an error if mixing
7776 split-stack and non-split-stack objects with -r.
7777 * i386.cc (Target_i386::relocate_section): Add
7778 reloc_symbol_changes parameter.
7779 (Target_i386::do_calls_non_split): New function.
7780 * x86_64.cc (Target_x86_64::relocate_section): Add
7781 reloc_symbol_changes parameter.
7782 (Target_x86_64::do_calls_non_split): New function.
7783 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7785 * powerpc.cc (Target_powerpc::relocate_section): Add
7786 reloc_symbol_changes parameter.
7787 * sparc.cc (Target_sparc::relocate_section): Add
7788 reloc_symbol_changes parameter.
7789 * configure.ac: Call AM_CONDITIONAL for the default target.
7790 * configure: Rebuild.
7791 * testsuite/Makefile.am (TEST_AS): New variable.
7792 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7793 (check_DATA): Add split_i386 and split_x86_64 files.
7794 (SPLIT_DEFSYMS): Define.
7795 (split_i386_[1234n].o): New targets.
7796 (split_i386_[124]): New targets.
7797 (split_i386_[1234r].stdout): New targets.
7798 (split_x86_64_[1234n].o): New targets.
7799 (split_x86_64_[124]): New targets.
7800 (split_x86_64_[1234r].stdout): New targets.
7801 (MOSTLYCLEANFILES): Add new executables.
7802 * testsuite/split_i386.sh: New file.
7803 * testsuite/split_x86_64.sh: New file.
7804 * testsuite/split_i386_1.s: New file.
7805 * testsuite/split_i386_2.s: New file.
7806 * testsuite/split_i386_3.s: New file.
7807 * testsuite/split_i386_4.s: New file.
7808 * testsuite/split_i386_n.s: New file.
7809 * testsuite/split_x86_64_1.s: New file.
7810 * testsuite/split_x86_64_2.s: New file.
7811 * testsuite/split_x86_64_3.s: New file.
7812 * testsuite/split_x86_64_4.s: New file.
7813 * testsuite/split_x86_64_n.s: New file.
7814 * testsuite/testfile.cc (Target_test): Update relocation_section
7816 * testsuite/Makefile.in: Rebuild.
7818 2009-10-06 Ian Lance Taylor <iant@google.com>
7820 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7821 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7822 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7823 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7824 the address on ldo_addrs_.
7825 (Target_i386::Relocate::fix_up_ldo): New function.
7827 2009-10-06 Rafael Espindola <espindola@google.com>
7829 * plugin.cc (add_input_library): New.
7830 (Plugin::load): Add add_input_library to tv.
7831 (Plugin_manager::add_input_file): Add the is_lib argument.
7832 (add_input_file): Update call to Plugin_manager::add_input_file.
7833 (add_input_library): New.
7834 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7836 2009-09-30 Doug Kwan <dougkwan@google.com>
7838 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7839 symbol and call Symbol::may_need_copy_reloc to determine if
7840 a copy reloc is needed.
7841 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7842 nocopyreloc is given in command line.
7843 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7844 given in command line.
7845 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7846 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7847 of the removed Target_i386::may_need_copy_reloc.
7848 * options.h (copyreloc): New option with default value false.
7849 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7850 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7851 instead of the removed Target_powerpc::may_need_copy_reloc.
7852 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7853 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7854 instead of the removed Target_sparc::may_need_copy_reloc.
7855 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7856 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7857 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7858 instead of the removed Target_x86_64::may_need_copy_reloc.
7860 2009-09-30 Ian Lance Taylor <iant@google.com>
7862 * object.h (class Object): Remove target_ field, and target,
7863 sized_target, and set_target methods.
7864 (Object::sized_target): Remove.
7865 (class Sized_relobj): Update declarations. Remove sized_target.
7866 * object.cc (Sized_relobj::setup): Remove target parameter.
7868 (Input_objects::add_object): Don't do anything with the target.
7869 (make_elf_sized_object): Add punconfigured parameter. Change all
7870 callers. Set or test parameter target.
7871 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7873 * parameters.cc (Parameters::set_target): Change parameter type to
7875 (Parameters::default_target): Remove.
7876 (set_parameters_target): Change parameter type to be non-const.
7877 (parameters_force_valid_target): New function.
7878 (parameters_clear_target): New function.
7879 * parameters.h (class Parameters): Update declarations. Remove
7880 default_target method. Add sized_target and clear_target
7881 methods. Change target_ to be non-const.
7882 (set_parameters_target): Update declaration.
7883 (parameters_force_valid_target): Declare.
7884 (parameters_clear_target): Declare.
7885 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7886 as NULL if we aren't searching.
7887 (Add_symbols::run): Don't check for compatible target.
7888 * fileread.cc (Input_file::open_binary): Call
7889 parameters_force_valid_target.
7890 * gold.cc (queue_middle_tasks): Likewise.
7891 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7892 set_target on object.
7893 * dynobj.h (class Sized_dynobj): Update declarations.
7894 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7895 make_elf_object returns NULL.
7896 (Archive::include_member): Don't check whether object target is
7898 * output.cc (Output_section::add_input_section): Get target from
7900 (Output_section::relax_input_section): Likewise.
7901 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7903 (Sized_relobj::do_scan_relocs): Likewise.
7904 (Sized_relobj::relocate_sections): Likewise.
7905 * resolve.cc (Symbol_table::resolve): Likewise.
7906 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7907 parameter. Change all callers.
7908 (Symbol_table::add_from_object): Get target from parameters.
7909 (Symbol_table::add_from_relobj): Don't check object target.
7910 (Symbol_table::add_from_dynobj): Likewise.
7911 (Symbol_table::define_special_symbol): Get target from
7913 * symtab.h (class Symbol_table): Update declaration.
7914 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7915 parameter. Change all callers. Clear parameter target.
7916 (Binary_test): Test target here.
7917 * testsuite/object_unittest.cc (gold_testsuite): Remove
7918 target_test_pointer parameter. Change all callers.
7919 (Object_test): Test target here.
7921 2009-09-26 Ian Lance Taylor <iant@google.com>
7923 * testsuite/initpri1.c: Don't try to use constructor priorities if
7924 compiling with gcc before 4.3.
7926 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7928 * testsuite/retain_symbols_file_test.sh (check_present): Change
7929 output file name to retain_symbols_file_test.stdout.
7930 (check_absent): Likewise.
7932 2009-09-18 Craig Silverstein <csilvers@google.com>
7934 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7935 * options.cc: Include <cerrno> and <fstream>.
7936 (General_options::finalize): Parse -retain-symbols-file tag.
7937 * options.h: New flag.
7938 (General_options): New method should_retain_symbol, new
7939 variable symbols_to_retain.
7940 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7941 should_retain_symbol map.
7942 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7943 * testsuite/Makefile.in: Regenerate.
7944 * testsuite/retain_symbols_file_test.sh: New file.
7946 2009-09-18 Nick Clifton <nickc@redhat.com>
7948 * po/es.po: Updated Spanish translation.
7950 2009-09-17 Doug Kwan <dougkwan@google.com>
7952 * debug.h (DEBUG_RELAXATION): New constant.
7953 (DEBUG_ALL): Add DEBUG_RELAXATION.
7954 (debug_string_to_enum): Add relaxation debug option.
7956 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7957 Layout::Relaxation_debug_check::read_sections,
7958 Layout::Relaxation_debug_check::read_sections): New method definitions.
7959 (Layout::Layout): Initialize data members
7960 record_output_section_data_from_scrips_,
7961 script_output_section_data_list_ and relaxation_debug_check_.
7962 (Layout::save_segments, Layout::restore_segments,
7963 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7964 Layout::relaxation_loop_body): New method definitions.
7965 (Layout::finalize): Support relaxation. Move section layout code to
7966 Layout::relaxation_loop_body.
7967 (Layout::set_asection_address_from_script): Move code for orphan
7968 section placement out.
7969 (Layout::place_orphan_sections_in_script): New method definition.
7970 * layout.h (Output_segment_headers, Output_file_header):
7971 New forward class declarations.
7972 (Layout::~Layout): Define.
7973 (Layout::new_output_section_data_from_script): New method definition.
7974 (Layout::place_orphan_sections_in_script): New method declaration.
7975 (Layout::Segment_states): New type declaration.
7976 (Layout::save_segments, Layout::restore_segments,
7977 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7978 Layout::relaxation_loop_body): New method declarations.
7979 (Layout::Output_section_data_list): New type declaration.
7980 (Layout::Relaxation_debug_check): New class definition.
7981 (Layout::record_output_section_data_from_script_,
7982 Layout::script_output_section_data_list_, Layout::segment_states_,
7983 Layout::relaxation_debug_check_): New data members.
7984 * output.cc: (Output_section_headers::do_size): New method definition.
7985 (Output_section_headers::Output_section_headers): Move size
7986 computation to Output_section_headers::do_size.
7987 (Output_segment_headers::do_size): New method definition.
7988 (Output_file_header::Output_file_header): Move size computation to
7989 Output_file_header::do_size and call it.
7990 (Output_file_header::do_size): New method definition.
7991 (Output_data_group::Output_data_group): Adjust call to
7992 Output_section_data.
7993 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7994 (Output_symtab_xindex::do_write): Add array bound check.
7995 (Output_section::Input_section::print_to_mapfile): Handle
7996 RELAXED_INPUT_SECTION_CODE.
7997 (Output_section::Output_section): Initialize data member checkpoint_.
7998 (Output_section::~Output_section): Delete checkpoint object pointed
8000 (Output_section::add_input_section): Always add an Input_section if
8002 (Output_section::add_merge_input_section): Add assert.
8003 (Output_section::relax_input_section): New method definition.
8004 (Output_section::set_final_data_size): Set load address to zero for
8005 an unallocated section.
8006 (Output_section::do_address_and_file_offset_have_reset_values):
8007 New method definition.
8008 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8009 Handle relaxed input section.
8010 (Output_section::sort_attached_input_sections): Checkpoint input
8011 section list lazily.
8012 (Output_section::get_input_sections): Change type of input_sections to
8013 list of Simple_input_section pointers. Checkpoint input section list
8014 lazily. Also handle relaxed input sections.
8015 (Output_section::add_input_section_for_script): Take a reference to
8016 a Simple_input_section object instead of Relobj pointer and section
8017 index as parameter. Handle relaxed input sections.
8018 (Output_section::save_states, Output_section::restore_states): New
8020 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8021 (Output_data::is_data_size_fixed): New method definition.
8022 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8024 (Output_data::address_and_file_offset_have_reset_values): New method
8026 (Output_data::do_address_and_file_offset_have_reset_values): New method
8028 (Output_data::set_data_size): Check that data size is not fixed.
8029 (Output_data::fix_data_size): New method definition.
8030 (Output_data::is_data_size_fixed_): New data member.
8031 (Output_section_headers::set_final_data_size): New method definition.
8032 (Output_section_headers::do_size): New method declaration.
8033 (Output_segment_headers::set_final_data_size): New method definition.
8034 (Output_segment_headers::do_size): New method declaration.
8035 (Output_file_header::set_final_data_size)::New method definition.
8036 (Output_file_header::do_size)::New method declaration.
8037 (Output_section_data::Output_section_data): Add new parameter
8038 is_data_size_fixed and use it to fix data size.
8039 (Output_data_const::Output_data_const): Adjust call to base class
8040 constructor and fix data size.
8041 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8042 base class constructor and fix data size.
8043 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8044 base class constructor and fix data size.
8045 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8046 class constructor and fix data size.
8047 (Output_data_group::set_final_data_size): New method definition.
8048 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8049 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8050 class constructor and fix data size.
8051 (Output_relaxed_input_section): New class definition.
8052 (Output_section::Simple_input_section): New class definition.
8053 (Output_section::get_input_sections): Adjust parameter list.
8054 (Output_section::add_input_section_for_script): Same.
8055 (Output_section::save_states, Output_section::restore_states,
8056 Output_section::do_address_and_file_offset_have_reset_values,
8057 (Output_section::Input_section::Input_section): Handle
8058 RELAXED_INPUT_SECTION_CODE. Add new overload for
8059 Output_relaxed_input_section.
8060 (Output_section::Input_section::is_input_section,
8061 Output_section::Input_section::set_output_section): Handle relaxed
8063 (Output_section::Input_section::is_relaxed_input_section,
8064 Output_section::Input_section::output_section_data,
8065 Output_section::Input_section::relaxed_input_section): New method
8067 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8069 (Output_section::Input_section::u1_): Update comments.
8070 (Output_section::Input_section::u2_): Add new union member poris.
8071 (Output_section::Checkpoint_output_section): New classs definition.
8072 (Output_section::relax_input_section): New method declaration.
8073 (Output_section::checkpoint_): New data member.
8074 (Output_segment): Update comments.
8075 (Output_segment::Output_segment): Un-privatize copy constructor.
8076 (Output_segment::operator=): Un-privatize.
8077 * script-sections.cc (Output_section_element::Input_section_list):
8078 Change element type to Output_section::Simple_input_section.
8079 (Output_section_element_dot_assignment::set_section_addresses):
8080 Register output section data for relaxation clean up.
8081 (Output_data_exression::Output_data_expression): Adjust call to base
8082 constructor to fix data size.
8083 (Output_section_element_data::set_section_addresses): Register
8084 Output_data_expression object for relaxation clean up.
8085 (struct Input_section_info): Replace Relobj pointer and section index
8086 pair with Output_section::Simple_input_section and Convert struct to a
8088 (Input_section_sorter::operator()): Adjust access to
8089 Input_section_info data member to use accessors.
8090 (Output_section_element_input::set_section_addresses): Use layout
8091 parameter. Adjust code to use Output_section::Simple_input_section
8092 and Input_secction_info classes. Register filler for relaxation
8094 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8095 and section index pair with Output_section::Simple_input_section
8096 class. Adjust code accordingly.
8097 (Phdrs_element::release_segment): New method definition.
8098 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8100 (Script_sections::release_segments): New method definition.
8101 * gold/script-sections.h (Script_sections::release_segments): New
8103 * gold/target.h (Target::may_relax, Target::relax,
8104 Target::do_may_relax, Target::do_relax): New method definitions.
8106 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8108 * arm.cc (has_signed_unsigned_overflow): New function.
8109 (Arm_relocate_functions::abs8): New function.
8110 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8111 (Target_arm::Scan::global): Likewise.
8112 (Target_arm::relocate::relocate): Likewise.
8113 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8116 2009-09-16 Cary Coutant <ccoutant@google.com>
8118 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8119 * testsuite/Makefile.in: Regenerate.
8121 2009-09-11 Nick Clifton <nickc@redhat.com>
8123 * po/gold.pot: Updated by the Translation project.
8125 2009-09-08 Cary Coutant <ccoutant@google.com>
8127 * output.cc (Output_file::open): Add execute permission to empty file.
8128 * testsuite/Makefile.am (permission_test): New test.
8129 * testsuite/Makefile.in: Regenerate.
8131 2009-09-02 Ian Lance Taylor <iant@google.com>
8133 * output.cc (Output_file::resize): Call map_no_anonymous rather
8136 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8138 * gold.cc: Include "incremental.h".
8139 (queue_initial_tasks): Call Incremental_checker methods.
8140 * incremental.cc: Include "output.h".
8141 (Incremental_checker::can_incrementally_link_output_file): New
8143 * incremental.h (Incremental_checker): New class.
8145 * output.cc (Output_file::open_for_modification): New method.
8146 (Output_file::map_anonymous): Changed return type to bool. Record
8148 (Output_file::map_no_anonymous): New method, broken out of map.
8149 (Output_file::map): Use map_no_anonymous and map_anonymous.
8150 * output.h (class Output_file): Update declarations.
8152 2009-08-24 Cary Coutant <ccoutant@google.com>
8154 * options.h (Command_line::Pre_options): New class.
8155 (Command_line::pre_options): New member.
8156 * options.cc (gold::options::ready_to_register): New variable.
8157 (One_option::register_option): Do nothing if not registering options.
8158 Assert if same short option registered twice.
8159 (General_options::General_options): Turn off option registration when
8161 (Command_line::Pre_options::Pre_options): New constructor.
8163 2009-08-24 Cary Coutant <ccoutant@google.com>
8165 * options.h (General_options::no_keep_memory): Remove incorrect
8168 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8170 * Makefile.am (am__skiplex, am__skipyacc): New.
8171 * Makefile.in: Regenerate.
8173 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8175 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8176 (INCLUDES): ... this.
8177 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8178 (AM_CPPFLAGS): Renamed from ...
8179 (INCLUDE): ... this.
8180 * Makefile.in, testsuite/Makefile.in: Regenerate.
8182 * Makefile.in: Regenerate.
8183 * aclocal.m4: Likewise.
8184 * config.in: Likewise.
8185 * configure: Likewise.
8186 * testsuite/Makefile.in: Likewise.
8188 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8189 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8190 * Makefile.in: Regenerate.
8191 * testsuite/Makefile.in: Regenerate.
8193 2009-08-19 Cary Coutant <ccoutant@google.com>
8195 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8196 symbols in shared libraries overridden by hidden or internal symbols
8197 in the main program.
8199 2009-08-19 Chris Demetriou <cgd@google.com>
8201 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8202 checking source file names in error messages.
8204 2009-08-18 Doug Kwan <dougkwan@google.com>
8206 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8207 an elcpp::Ehdr as parameter. Adjust call to set_target.
8208 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8209 an elfcpp::Ehdr as parameter.
8210 * object.cc (Object::set_target): Remove the version that looks up
8211 a target and sets it.
8212 (Sized_relobj::setup): Take a Target object instead of
8213 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8214 (make_elf_sized_object): Find target and ask target to
8216 * object.h: (Object::set_target): Remove the version that looks up
8217 a target and sets it.
8218 (Sized_relobj::setup): Take a Target object instead of
8219 an elfcpp:Ehdr as parameter.
8220 * target.cc: Include dynobj.h.
8221 (Target::do_make_elf_object_implementation): New.
8222 (Target::do_make_elf_object): New.
8223 * target.h (Target::make_elf_object): New template declaration.
8224 (Target::do_make_elf_object): New method declarations.
8225 (Target::do_make_elf_object_implementation): New template declaration.
8227 2009-08-14 Ian Lance Taylor <iant@google.com>
8229 * gold.h (FUNCTION_NAME): Define.
8230 (gold_unreachable): Use FUNCTION_NAME.
8232 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8234 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8235 symbol in the --keep-unique list is not found.
8237 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8239 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8240 been maked as --keep-unique.
8241 (Icf::unfold_section): New function.
8242 * icf.h (Icf::unfold_section): New function.
8243 * options.h (General_options::keep_unique): New option.
8244 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8245 * testsuite/Makefile.in: Regenerate.
8246 * testsuite/icf_keep_unique_test.sh: New file.
8247 * testsuite/icf_keep_unique_test.cc: New file.
8249 2009-08-12 Cary Coutant <ccoutant@google.com>
8252 * resolve.cc (Symbol_table::resolve): Check for references from
8253 dynamic objects to hidden and internal symbols.
8254 * testsuite/Makefile.am (hidden_test.sh): New test.
8255 * testsuite/Makefile.in: Regenerate.
8256 * testsuite/hidden_test.sh: New script.
8257 * testsuite/hidden_test_1.c: New test source.
8258 * testsuite/hidden_test_main.c: New test source.
8260 2009-08-11 Doug Kwan <dougkwan@google.com>
8262 * arm.cc: Update comments.
8263 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8264 segment to locate the .ARM.exidx section if present.
8266 2009-08-09 Doug Kwan <dougkwan@google.com>
8268 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8271 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8272 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8275 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8277 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8278 valid tls_segment only for non-debug-section relocations.
8279 * testsuite/Makefile.am: Add gc_tls_test.
8280 * testsuite/Makefile.in: Regenerate.
8281 * testsuite/gc_tls_test.cc: New file.
8282 * testsuite/gc_tls_test.sh: New file.
8284 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8288 * Makefile.am (CCFILES): Add icf.cc.
8290 * Makefile.in: Regenerate.
8291 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8292 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8293 section, symbol and addend information for the relocs.
8294 * gold.cc (queue_middle_tasks): Call identical code folding.
8295 * gold.h: Add defines for multimap.
8296 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8297 to the call of finalize_local_symbols.
8298 * main.cc (main): Create object of class Icf.
8299 * object.cc (Sized_relobj::do_layout): Allow this function to be
8300 called twice during icf.
8301 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8302 to sections marked as identical by icf.
8303 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8305 (Sized_relobj::do_section_entsize): New function.
8306 * object.h (Object::section_entsize): New function.
8307 (Object::do_section_entsize): New pure virtual function.
8308 (Relobj::finalize_local_symbols): Add new parameter.
8309 (Relobj::do_section_entsize): New function.
8310 * options.h (General_options::icf): New option.
8311 (General_options::icf_iterations): New option.
8312 (General_options::print_icf_sections): New option.
8313 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8314 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8315 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8317 * symtab.cc (Symbol_table::is_section_folded): New function.
8318 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8319 to sections marked as identical by icf.
8320 * symtab.h (Symbol_table::set_icf): New function.
8321 (Symbol_table::icf): New function.
8322 (Symbol_table::is_section_folded): New function.
8323 (Symbol_table::icf_): New data member.
8324 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8325 * testsuite/Makefile.am: Add commands to build icf_test.
8326 * testsuite/Makefile.in: Regenerate.
8327 * testsuite/icf_test.sh: New file.
8328 * testsuite/icf_test.cc: New file.
8330 2009-07-24 Chris Demetriou <cgd@google.com>
8332 * layout.cc (is_compressible_debug_section): Fix incorrect
8333 comment about compressed section names.
8335 2009-07-20 Ian Lance Taylor <ian@airs.com>
8338 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8340 2009-07-16 Ian Lance Taylor <iant@google.com>
8343 * layout.h: #include <map>.
8344 (class Kept_section): Change from struct to class. Add accessors
8345 and setters. Add section size to Comdat_group mapping. Change
8346 Comdat_group to std::map. Add is_comdat_ field. Add
8347 linkonce_size field in union.
8348 (class Layout): Update declaration of find_or_add_kept_section.
8349 Don't declare find_kept_object.
8350 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8351 parameter. Add object, shndx, is_comdat, and is_group_name
8352 parameters. Change all callers. Adjust for new Kept_section.
8353 (Layout::find_kept_object): Remove.
8354 * object.cc (Sized_relobj::include_section_group): Update use of
8355 Kept_section. Rename secnum to shndx. Only record
8356 Kept_comdat_section if sections are the same size.
8357 (Sized_relobj::include_linkonce_section): Update use of
8358 Kept_section. Only record Kept_comdat_section if sections are the
8359 same size. Set size of linkonce section.
8360 (Sized_relobj::map_to_kept_section): Update call to
8361 get_kept_comdat_section.
8362 * object.h (class Sized_relobj): Rename fields in
8363 Kept_comdat_section to drop trailing underscores; change object
8364 field to Relobj*. Change Kept_comdat_section_table to store
8365 struct rather than pointer.
8366 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8367 Add kept_object and kept_shndx parameters. Change all callers.
8368 (Sized_relobj::get_kept_comdat_section): Change return type to
8369 bool. Add kept_object and kept_shndx parameters. Change all
8371 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8372 Layout::find_or_add_kept_section.
8374 2009-07-09 Ian Lance Taylor <iant@google.com>
8376 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8377 Reserve space in the hash table.
8379 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8381 * fileread.cc (File_read::get_mtime): New method.
8382 * fileread.h (Timespec): New structure.
8383 (File_read::get_mtime): New method.
8384 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8385 Renamed from timestamp_nsec.
8386 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8388 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8390 (Incremental_inputs::report_archive): Save mtime; style fix.
8391 (Incremental_inputs::report_obejct): Save mtime; style fix.
8392 (Incremental_inputs::report_script): Save mtime; style fix.
8393 (Incremental_inputs::finalize_inputs): Style fix.
8394 (Incremental_inputs::finalize): Style fix.
8395 (Incremental_inputs::create_input_section_data): Store inputs
8397 * incremental.h (Incremental_inputs::report_script): Add mtime
8399 (Incremental_inputs::Input_info::Input_info): Intialize only one
8401 (Incremental_inputs::Input_info::archive): Move to nameless
8403 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8404 (Incremental_inputs::Input_info::script): Move to nameless union.
8405 (Incremental_inputs::mtime): New field.
8406 * script.cc (read_input_script): Pass file mtime to
8408 * script.h (Script_info::inputs): Style fix.
8410 2009-07-01 Ian Lance Taylor <ian@airs.com>
8412 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8415 2009-06-24 Ian Lance Taylor <iant@google.com>
8418 * layout.cc (Layout::choose_output_section): If we find an
8419 existing section, update the flags.
8420 (Layout::create_notes): New function, broken out of
8422 (Layout::finalize): Don't create note sections.
8423 (Layout::create_note): Don't crash if linker script discards
8425 (Layout::create_gold_note): Likewise.
8426 (Layout::create_build_id): Likewise. Don't set
8427 after_input_sections on the section.
8428 (Layout::create_executable_stack_info): Remove target parameter.
8430 * layout.h (class Layout): Declare create_notes. Update
8431 declaration of create_executable_stack_info.
8432 * gold.cc (queue_middle_tasks): Call create_notes.
8433 * output.cc (Output_section::update_flags_for_input_section): Move
8434 here from output.h. If SHF_ALLOC flag is newly set, mark address
8436 * output.h (Output_data::mark_address_invalid): New function.
8437 (class Output_section): Only declare, not define,
8438 update_flags_for_input_section. Remove set_flags.
8440 2009-06-24 Ian Lance Taylor <iant@google.com>
8442 * script-sections.cc (Output_section_definition::
8443 set_section_addresses): Rename shadowing local load_address to
8446 2009-06-24 Ian Lance Taylor <iant@google.com>
8449 * reloc.cc (relocate_sections): Skip empty relocation sections.
8451 2009-06-23 Ian Lance Taylor <iant@google.com>
8454 * layout.cc (Layout::create_note): Use choose_output_section
8455 rather than make_output_section.
8457 2009-06-23 Ian Lance Taylor <iant@google.com>
8460 * options.cc (General_options::parse_V): Set printed_version_.
8461 (General_options::General_options): Initialize printed_version_.
8462 * options.h (class General_options): Add printed_version_ field.
8463 * gold.cc (queue_initial_tasks): If there are no input files,
8464 don't give a fatal error if we printed the version information.
8465 (queue_middle_tasks): If using -r with a shared object, give a
8466 fatal error rather than an ordinary error.
8468 2009-06-23 Ian Lance Taylor <iant@google.com>
8471 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8472 (Layout::make_output_section): Set have_stabstr_section_ if we see
8473 a .stab*str section.
8474 (Layout::finalize): Call link_stabs_sections.
8475 (Layout::link_stabs_sections): New file.
8476 * layout.h (class Layout): Add have_stabstr_section_ field.
8477 Declare link_stabs_sections.
8479 2009-06-23 Doug Kwan <dougkwan@google.com>
8481 * Makefile.am (libgold_a_LIBADD): New.
8482 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8483 * Makefile.in: Regenerate.
8484 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8485 * configure: Regenerate.
8486 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8487 * fileread.cc: Include sys/state.h
8488 * gold.h: Declare memmem and strndup if found missing.
8489 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8491 2009-06-23 Ian Lance Taylor <iant@google.com>
8493 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8494 * configure: Rebuild.
8496 2009-06-23 Ian Lance Taylor <iant@google.com>
8499 * object.cc (Object::section_contents): Don't try to get a view if
8500 the section has length zero.
8501 (Object::handle_gnu_warning_section): If the section is empty, use
8502 the name of the section as the warning.
8504 2009-06-23 Ian Lance Taylor <iant@google.com>
8507 * stringpool.h (class Stringpool_template): Add optimize_ field.
8508 (Stringpool_template::set_optimize): New function.
8509 * stringpool.cc (Stringpool_template::Stringpool_template):
8510 Initialize optimize_ field.
8511 (Stringpool_template::set_string_offsets): Test local optimize
8512 fild rather than parameter.
8513 * layout.cc (Layout::Layout): Call set_optimize on the section
8516 2009-06-22 Ian Lance Taylor <iant@google.com>
8519 * yyscript.y: Parse TARGET.
8520 * script.cc (script_set_target): New function.
8521 * script-c.h (script_set_target): Declare.
8522 * options.cc (General_options::string_to_object_format): Rename
8523 from string_to_object_format in anonymous namespace. Change
8525 * options.h (class General_options): Declare
8526 string_to_object_format.
8528 2009-06-22 Ian Lance Taylor <iant@google.com>
8530 * script-sections.cc (Script_sections::create_segments): Don't put
8531 program headers in a PT_LOAD segment if -n or -N.
8533 2009-06-22 Ian Lance Taylor <iant@google.com>
8536 * options.h (class General_options): Add -z lazy and -z now. Sort
8537 -z options into alphabetical order.
8538 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8540 2009-06-21 Ian Lance Taylor <iant@google.com>
8542 * layout.cc (Layout::make_output_section): Call
8543 Target::new_output_section.
8544 (Layout::attach_allocated_section_to_segment): Put large section
8545 sections in a separate load segment with the large segment flag
8547 (Layout::segment_precedes): Sort large data segments after other
8549 (align_file_offset): New static function.
8550 (Layout::set_segment_offsets): Use align_file_offset.
8551 * output.h (class Output_section): Add is_small_section_ and
8552 is_large_section_ fields.
8553 (Output_section::is_small_section): New function.
8554 (Output_section::set_is_small_section): New function.
8555 (Output_section::is_large_section): New function.
8556 (Output_section::set_is_large_section): New function.
8557 (Output_section::is_large_data_section): New function.
8558 (class Output_segment): Add is_large_data_segment_ field.
8559 (Output_segment::is_large_data_segment): New function.
8560 (Output_segment::set_is_large_data_segment): New function.
8561 * output.cc (Output_section::Output_section): Initialize new
8563 (Output_segment::Output_segment): Likewise.
8564 (Output_segment::add_output_section): Add assertion that large
8565 data sections always go in large data segments. Force small data
8566 sections to the end of the list of data sections. Force small BSS
8567 sections to the start of the list of BSS sections. For large BSS
8568 sections to the end of the list of BSS sections.
8569 * symtab.h (class Symbol): Declare is_common_shndx.
8570 (Symbol::is_defined): Check Symbol::is_common_shndx.
8571 (Symbol::is_common): Likewise.
8572 (class Symbol_table): Define enum Commons_section_type. Update
8573 declarations. Add small_commons_ and large_commons_ fields.
8574 * symtab.cc (Symbol::is_common_shndx): New function.
8575 (Symbol_table::Symbol_table): Initialize new fields.
8576 (Symbol_table::add_from_object): Put small and large common
8577 symbols in the right list.
8578 (Symbol_table::sized_finalized_symbol): Check
8579 Symbol::is_common_shndx.
8580 (Symbol_table::sized_write_globals): Likewise.
8581 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8582 common symbol lists. Don't call do_allocate_commons_list if the
8584 (Symbol_table::do_allocate_commons_list): Remove is_tls
8585 parameter. Add comons_section_type parameter. Change all
8586 callers. Handle small and large common symbols.
8587 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8588 Symbol::is_common_shndx.
8589 * resolve.cc (symbol_to_bits): Likewise.
8590 * target.h (Target::small_common_shndx): New function.
8591 (Target::small_common_section_flags): New function.
8592 (Target::large_common_shndx): New function.
8593 (Target::large_common_section_flags): New function.
8594 (Target::new_output_section): New function.
8595 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8596 small_common_section_flags, and large_common_section_flags
8598 (Target::do_new_output_section): New virtual function.
8599 * arm.cc (Target_arm::arm_info): Initialize new fields.
8600 * i386.cc (Target_i386::i386_info): Likewise.
8601 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8603 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8604 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8605 (Target_x86_64::do_new_output_section): New function.
8606 * configure.ac: Define conditional MCMODEL_MEDIUM.
8607 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8608 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8609 (large_LDFLAGS): Define.
8610 * testsuite/large.c: New file.
8611 * testsuite/testfile.cc (Target_test::test_target_info):
8612 Initialize new fields.
8613 * configure, testsuite/Makefile.in: Rebuild.
8615 2009-06-05 Doug Kwan <dougkwan@google.com>
8617 * Makefile.am (CCFILES): Add target.cc.
8618 * Makefile.in: Regenerate.
8619 * i386.cc (class Target_i386): Define new virtual method to
8620 override do_is_local_label_name in parent.
8621 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8622 local symbols if --discard-locals or -X is given.
8623 * options.h (class General_options): Declare new options
8624 '--discard-locals' and '-X' for discarding locals.
8625 * target.h (class Target): Define new methods is_local_label_name.
8626 Declare new virtual method do_is_local_label_name.
8627 * target.cc: New file.
8628 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8629 (check_SCRIPTS): Add discard_locals_test.sh.
8630 (check_DATA): Add discard_local_tests.syms.
8631 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8632 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8633 * testsuite/Makefile.in: Regenerate.
8634 * testsuite/discard_locals_test.c: New file.
8635 * testsuite/discard_locals_test.sh: Same.
8637 2009-06-05 Doug Kwan <dougkwan@google.com>
8639 * object.cc (Sized_relobj::Sized_relobj): Initialize
8640 discarded_eh_frame_shndx_ to -1U.
8641 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8643 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8644 a discarded .eh_frame section.
8645 (Sized_relobj::do_finalize_local_symbols): Ditto.
8646 * object.h (class Sized_relobj): Declare new member
8647 discarded_eh_frame_shndx_.
8648 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8649 (local_labels_test.o, local_labels_test): New rules.
8650 * testsuite/Makefile.in: Regenerate.
8652 2009-06-04 Doug Kwan <dougkwan@google.com>
8654 * layout.cc (Layout::section_name_mapping): Add mapping for
8655 special ARM sections.
8657 2009-06-03 Doug Kwan <dougkwan@google.com>
8659 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8660 (utils::has_overflow): Same.
8662 2009-06-03 Ian Lance Taylor <iant@google.com>
8664 * layout.cc (Layout::section_name_mapping): New array, replacing
8665 Layout::linkonce_mapping.
8666 (Layout::section_name_mapping_count): New variable, replacing
8667 Layout::linkonce_mapping_count.
8668 (Layout::linkonce_output_name): Remove.
8669 (Layout::output_section_name): Rewrite.
8670 * layout.h (class Layout): Rename Linkonce_mapping to
8671 Section_name_mapping, linkonce_mapping to section_name_mapping,
8672 linkonce_mapping_count to section_name_mapping_count. Don't
8673 declare linkonce_output_name.
8675 2009-06-03 Doug Kwan <dougkwan@google.com>
8677 * gold/arm.cc (namespace utils): New.
8678 (Target_arm::reloc_is_non_pic): Define new method.
8679 (class Arm_relocate_functions): New.
8680 (Target_arm::Relocate::relocate): Handle relocation types used by
8683 2009-06-03 Ian Lance Taylor <iant@google.com>
8685 * arm.cc (Target_arm::scan::global): Use || instead of |.
8687 2009-06-02 Doug Kwan <dougkwan@google.com>
8689 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8690 issued_non_pic_error_.
8691 (class Target_arm::Scan): Declare new method check_non_pic.
8692 Define new method symbol_needs_plt_entry.
8693 Declare new data member issued_non_pic_error_.
8694 (class Target_arm::Relocate): Declare new method
8695 should_apply_static_reloc.
8696 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8697 (Target_arm::Scan::check_non_pic): Define new method.
8698 (Target_arm::Scan::local): Handle a small subset of reloc types used
8700 (Target_arm::Scan::local): Same.
8701 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8703 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8705 * incremental.cc (Incremental_inputs::report_command_line): Filter
8706 out --incremental-* options.
8708 2009-05-29 Doug Kwan <dougkwan@google.com>
8710 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8712 (class Target_arm): Update comment.
8713 (Target_arm::Target_arm): Initialize new data members GOT_,
8714 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8715 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8716 and Target_arm::rel_dyn_section.
8717 Declare new_enum Target_arm::Got_type.
8718 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8720 Update commments for member do_dynsym_value.
8721 (Target_arm::got_size, Target_arm::plt_section,
8722 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8723 new methods inside class defintion.
8724 (Target_arm::got_section): Define new method.
8725 (Target_arm::rel_dyn_section): Same.
8726 (Output_data_plt_arm): New template class.
8727 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8728 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8729 (Output_data_plt_arm::add_entry): Same.
8730 (Output_data_plt_arm::first_plt_entry): Define new
8731 static data member for PLT instruction template.
8732 (Output_data_plt_arm::plt_entry): Same.
8733 (Output_data_plt_arm::do_write): Define new method.
8734 (Target_arm::make_plt_entry): Same.
8735 (Target_arm::do_finalize_sections): Same.
8736 (Target_arm::do_dynsym_value): Same.
8738 2009-05-28 Doug Kwan <dougkwan@google.com>
8740 * Makefile.am (TARGETSOURCES): Add arm.cc.
8741 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8742 * Makefile.in: Regenerate.
8744 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8746 2009-05-26 Doug Kwan <dougkwan@google.com>
8748 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8749 (General_options::check_excluded_libs): Strip off directories in
8750 archive name before matching like GNU ld does.
8751 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8752 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8753 (exclude_libs_test_LDFLAGS): Add linker option
8754 -Wl,--exclude-libs,libexclude_libs_test_3
8755 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8756 an explicit archive without using -l.
8757 (alt/libexclude_libs_test_3.a): New make rule.
8758 * testsuite/Makefile.in: Regenerate.
8759 * testsuite/exclude_libs_test.c : Declare lib3_default().
8761 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8762 * exclude_libs_test_3.c: New file.
8764 2009-05-26 Nick Clifton <nickc@redhat.com>
8766 * po/id.po: New Indonesian translation.
8767 * po/gold.pot: Updated template file.
8769 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8771 * testsuite/Makefile.am: Add -ffunction-sections to compile
8772 gc_comdat_test files. Add -Wl,--gc-sections to build
8774 * testsuite/Makefile.in: Regenerate.
8775 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8777 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8779 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8780 kept comdat section was garbage collected.
8781 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8782 * testsuite/Makefile.in: Regenerate.
8783 * testsuite/gc_comdat_test.sh: New file.
8784 * testsuite/gc_comdat_test_1.cc: New file.
8785 * testsuite/gc_comdat_test_2.cc: New file.
8787 2009-05-19 Doug Kwan <dougkwan@google.com>
8789 * archive.cc (Archive::Archive): Move constructor from archive.h
8790 to here. Initialize no_export_.
8791 (Archive::get_elf_object_for_member): Set no_export flag of object.
8792 * archive.h (Archive::Archive): Move constructor body to
8794 (Archive::no_export): New method.
8795 (Archive::no_export_): New field.
8796 * object.h (Object::Object): Initialize no_export_ to false.
8797 (Object::no_export, Object::set_no_export): New methods.
8798 (Object::no_export_): New field.
8799 * options.cc (General_options::parse_exclude_libs): New method.
8800 (General_options::check_excluded_libs) Same.
8801 * options.h (exclude_libs): New option.
8802 (General_options::check_excluded_libs): New method declaration.
8803 (General_options::excluded_libs_): New field.
8804 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8805 default or protected visibility if an object has no-export flag set.
8806 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8807 (check_SCRIPTS): Add exclude_libs_test.sh.
8808 (check_DATA): Add exclude_libs_test.syms.
8809 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8810 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8811 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8812 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8813 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8814 libexclude_libs_test_2.a): New rules.
8815 * testsuite/Makefile.in: Regenerate.
8816 * testsuite/exclude_libs_test.c: New file.
8817 * testsuite/exclude_libs_test.sh: Ditto.
8818 * testsuite/exclude_libs_test_1.c: Ditto.
8819 * testsuite/exclude_libs_test_2.c: Ditto.
8821 2009-05-15 Ian Lance Taylor <iant@google.com>
8823 * configure.ac: Check for declarations for cases where libiberty.h
8824 checks HAVE_DECL_xxx.
8825 * configure, config.in: Rebuild.
8827 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8829 * gold.h (Incremental_argument_list): Remove (invalid) forward
8831 * incremental.cc (Incremental_inputs::report_achive): New method.
8832 (Incremental_inputs::report_object): New method.
8833 (Incremental_inputs::report_script): New method.
8834 (Incremental_inputs::finalize_inputs): New method.
8835 (Incremental_inputs::finalize): Call finalize_inputs().
8836 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8837 Create inputs entries.
8838 * incremental.h (Incremental_input_type): New enum.
8839 (Incremental_inputs::Incremental_input): Initialize new fields.
8840 (Incremental_inputs::report_inputs): New method.
8841 (Incremental_inputs::report_achive): New method.
8842 (Incremental_inputs::report_object): New method.
8843 (Incremental_inputs::report_script): New method.
8844 (Incremental_inputs::finalize_inputs): New method.
8845 (Incremental_inputs::Input_info): New struct.
8846 (Incremental_inputs::Input_info_map): New typedef.
8847 (Incremental_inputs::lock_): New field.
8848 (Incremental_inputs::Inputs_): New field.
8849 (Incremental_inputs::Inputs_map): New field.
8850 * main.cc (main): Call Incremental_input::report_inputs.
8851 * options.h (Input_argument_list): Typedef moved from
8853 (Input_file_group::Files): Remove, use ::Input_argument_list.
8854 (Input_file_group::Input_argument_list): Remove, use
8855 ::Input_argument_list.
8856 * plugin.cc (Plugin_manager::add_input_file): Add error in
8858 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8860 * script.cc (read_input_script): Call
8861 Incremental_input::report_script.
8862 * script.h (Script_info): New class.
8864 2009-04-27 Ian Lance Taylor <iant@google.com>
8866 * x86_64.cc (do_adjust_output_section): Set entsize to
8869 2009-04-23 Elliott Hughes <enh@google.com>
8871 * output.cc (Output_file::close): After short writes, continue
8872 writing from the correct offset in the buffer being written.
8874 2009-04-23 Chris Demetriou <cgd@google.com>
8876 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8877 * configure: Regenerate.
8878 * config.in: Regenerate.
8879 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8880 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8882 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8884 * incremental.cc (Incremental_inputs_header_data): Renamed from
8885 Incremental_input_header_data.
8886 (Incremental_inputs_header_data::data_size): New field.
8887 (Incremental_inputs_header_data::put_input_file_count): Renamed
8888 from input_file_count.
8889 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8890 from command_line_offset.
8891 (Incremental_inputs_header_data::put_reserved): Renamed from
8893 (Incremental_inputs_entry_data): Renamed from
8894 Incremental_input_entry_data.
8895 (Incremental_inputs_entry_data::data_size): New field.
8896 (Incremental_inputs::report_command_line): New method.
8897 (Incremental_inputs::finalize): New method.
8898 (Incremental_inputs::create_incremental_inputs_data): New method.
8899 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8900 * incremental.h: New file.
8901 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8902 (Layout::finalize): Create incremental inputs section in
8904 (Layout::create_incremental_info_sections): New method.
8905 * layout.h (Layout::incremental_inputs): New method.
8906 (Layout::create_incremental_info_sections): New method.
8907 (Layout::incremental_inputs_): New field.
8908 * main.cc (main): Notify Incremental_input of the command line.
8910 2009-04-01 Ian Lance Taylor <iant@google.com>
8911 Mikolaj Zalewski <mikolajz@google.com>
8913 * gold.h (reserve_unordered_map): Define, three versions, one for
8914 each version of Unordered_map.
8915 * layout.cc (Layout::Layout): Remove options parameter. Add
8916 number_of_input_files parameter. Don't initialize options_.
8917 Initialize number_of_input_files_ and resized_signatures_. Move
8918 sections_are_attached_.
8919 (Layout::layout_group): Reserve space for group_signatures_.
8920 (Layout::find_or_add_kept_section): Change name parameter to be a
8921 reference. Resize signatures_ map when it gets large enough.
8922 (Layout::layout_eh_frame): Use parameters->options() instead of
8924 (Layout::make_output_section): Likewise.
8925 (Layout::attach_allocated_section_to_segment): Likewise.
8926 (Layout::finalize, Layout::create_executable_stack): Likewise.
8927 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8928 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8929 * layout.h (class Layout): Update declarations. Remove options_
8930 field. Add number_of_input_files_ and resized_signatures_
8931 fields. Move sections_are_attached_ field.
8932 * main.cc (main): Pass number of input files to Layout
8933 constructor. Don't pass options.
8935 2009-03-30 Ian Lance Taylor <iant@google.com>
8937 * ffsll.c (ffsll): Correct implementation.
8939 2009-03-27 Ian Lance Taylor <iant@google.com>
8941 * ffsll.c: New file.
8942 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8943 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8944 * ftruncate.c (ftruncate): Declare before definition.
8945 * mremap.c (mremap): Likewise.
8946 * pread.c (pread): Likewise.
8947 * configure, Makefile.in, config.in: Rebuild.
8949 * mremap.c: New file.
8950 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8951 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8952 (mremap): Declare if HAVE_MREMAP is not defined.
8953 * configure, Makefile.in, config.in: Rebuild.
8955 2009-03-27 Cary Coutant <ccoutant@google.com>
8957 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8958 position independent.
8959 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8960 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8962 2009-03-24 Cary Coutant <ccoutant@google.com>
8964 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8966 (needs_dynamic_reloc): Likewise.
8968 2009-03-24 Ian Lance Taylor <iant@google.com>
8970 * yyscript.y (file_cmd): Recognize EXTERN.
8971 (extern_name_list, extern_name_list_body): New nonterminals.
8972 * script.cc (script_add_extern): Define.
8973 * script-c.h (script_add_extern): Declare.
8975 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8977 * object.cc (is_elf_object): Define.
8978 * object.h (is_elf_object): Declare.
8979 * archive.cc (Archive::get_elf_object_for_member): Call
8981 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8983 2009-03-24 Elliott Hughes <enh@google.com>
8985 * output.cc (Output_file::map_anonymous): Define.
8986 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8987 try an anonymous one. Report the size if the mmap fails.
8988 * output.h (class Output_file): Declare map_anonymous.
8990 2009-03-24 Ian Lance Taylor <iant@google.com>
8992 * target-select.cc (instantiate_target): Don't acquire the lock if
8993 the instantiated_target_ field has already been set.
8995 2009-03-23 Ian Lance Taylor <iant@google.com>
8997 * gold-threads.h (class Initialize_lock): Define.
8998 * gold-threads.cc (class Initialize_lock_once): Define.
8999 (initialize_lock_control): New static variable.
9000 (initialize_lock_pointer): New static variable.
9001 (initialize_lock_once): New static function.
9002 (Initialize_lock::Initialize_lock): Define.
9003 (Initialize_lock::initialize): Define.
9004 * target-select.h: Include "gold-threads.h".
9005 (class Target_selector): Add lock_ and initialize_lock_ fields.
9006 Don't define instantiate_target, just declare it.
9007 * target-select.cc (Target_selector::Target_selector): Initialize
9009 (Target_selector::instantiate_target): Define.
9010 * descriptors.h: Include "gold-threads.h".
9011 (class Descriptors): Add initialize_lock_ field.
9012 * descriptors.cc (Descriptors::Descriptors): Initialize new
9014 (Descriptors::open): Use initialize_lock_ field
9015 * errors.h (class Errors): Add initialize_lock_ field.
9016 * errors.cc (Errors::Errors): Initialize new field.
9017 (Errors::initialize_lock): Use initialize_lock_ field.
9018 * powerpc.cc (class Target_selector_powerpc): Remove
9019 instantiated_target_ field. In do_recognize call
9020 instantiate_target rather than do_instantiate_target. In
9021 do_instantiate_target just allocate a new target.
9022 * sparc.cc (class Target_selector_sparc): Likewise.
9024 * freebsd.h: New file.
9025 * i386.cc: Include "freebsd.h".
9026 (Target_i386): Derive from Target_freebsd rather than
9028 (Target_selector_i386): Derive from Target_selector_freebsd rather
9029 than Target_selector.
9030 * x86_64.cc: Include "freebsd.h".
9031 (Target_x86_64): Derive from Target_freebsd rather than
9033 (Target_selector_x86_64): Derive from Target_selector_freebsd
9034 rather than Target_selector.
9035 * target.h (class Target): Add adjust_elf_header and
9036 do_adjust_elf_header.
9037 * output.cc (Output_file_header:: do_sized_write): Call target
9038 adjust_elf_header routine.
9039 * configure.tgt: Set targ_osabi.
9040 * configure.ac: Define GOLD_DEFAULT_OSABI.
9041 * parameters.cc (Parameters::default_target): Pass
9042 GOLD_DEFAULT_OSABI to select_target.
9043 * target-select.h (class Target_selector): Make instantiate_target
9044 protected rather than private.
9045 * Makefile.am (HFILES): Add freebsd.h.
9046 * configure, Makefile.in, config.in: Rebuild.
9048 * merge.cc (do_add_input_section): Correct pend value. Change
9049 message about last entry not being null terminated from error to
9052 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9054 * incremental.cc: New file.
9055 * Makefile.am (CCFILES): Add incremental.cc.
9056 * Makefile.in: Rebuild.
9058 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9060 * layout.cc (Layout::output_section_name): Preserve names
9061 of '.note.' sections.
9063 2009-03-19 Ian Lance Taylor <iant@google.com>
9065 * descriptors.cc (Descriptors::open): Check that the options are
9066 valid before using them.
9068 2009-03-18 Ian Lance Taylor <iant@google.com>
9070 * script-sections.h: Include <list>.
9071 (class Script_sections): Change Sections_elements from std::vector
9072 to std::list. Typedef public Elements_iterator. Add
9073 orphan_section_placement_, data_segment_align_start_, and
9074 saw_data_segment_align_ fields. Remove data_segment_align_index_
9076 * script-sections.cc (class Orphan_section_placement): New class.
9077 (class Sections_element): Add virtual functions is_relro and
9078 orphan_section_init. Remove virtual function place_orphan_here.
9079 (class Output_section_definition): Add is_relro and
9080 orphan_section_init. Remove place_orphan_here.
9081 (class Orphan_output_section): Likewise.
9082 (Script_sections::Script_sections): Update for field changes.
9083 (Script_sections::data_segment_align): Set saw_data_segment_align_
9084 and data_segment_align_start_, not data_segment_align_index.
9085 (Script_sections::data_segment_relro_end): Check
9086 saw_data_segment_align_. Use data_segment_align_start_ rather
9087 than data_segment_align_index_.
9088 (Script_sections::place_orphan): Rewrite to use
9089 Orphan_section_placement.
9091 2009-03-17 Ian Lance Taylor <iant@google.com>
9093 * archive.cc (Archive::add_symbols): Check for a version attached
9094 to the symbol name in the archive map.
9095 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9096 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9097 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9098 (ver_test_11.a): New target.
9099 * testsuite/Makefile.in: Rebuild.
9101 * configure.ac: Check for chsize and posix_fallocate. Replace
9103 * ftruncate.c: New file, from gnulib.
9104 * output.cc (posix_fallocate): Define dummy version if not
9105 HAVE_POSIX_FALLOCATE.
9106 (Output_file::map): Call posix_fallocate rather than lseek and
9108 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9109 * configure, Makefile.in, config.in: Rebuild.
9111 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9113 * layout.h (Layout::create_note): Add section_name parameter.
9114 * layout.cc (Layout::create_note): Likewise.
9115 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9117 2009-03-17 Ian Lance Taylor <iant@google.com>
9119 * descriptors.cc: Include "options.h".
9120 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9121 (Descriptors::open): Always use O_CLOEXEC when opening a new
9122 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9123 then set FD_CLOEXEC.
9125 * sparc.cc (class Target_sparc): Add has_got_section.
9126 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9127 make sure we have a GOT section.
9129 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9130 (Target_sparc::Scan::local): Likewise.
9131 (Target_sparc::Scan::global): Likewise.
9132 (Target_sparc::Relocate::relocate): Likewise.
9133 (Target_sparc::Relocate::relocate_tls): Likewise.
9135 * symtab.cc (Symbol_table::define_default_version): New function,
9136 broken out of add_from_object.
9137 (Symbol_table::add_from_object): Call define_default_version.
9138 (Symbol_table::define_special_symbol): Add resolve_oldsym
9139 parameter. Change all callers. If the version for a symbol comes
9140 from a version script, resolve it with the symbol with the same
9141 name with no version. Also add the symbol without a version if
9143 (do_define_in_output_data): If resolving with oldsym, don't delete
9145 (do_define_in_output_segment): Likewise.
9146 (do_define_as_constant): Likewise.
9147 * symtab.h (class Symbol_table): Update declarations.
9149 2009-03-13 Ian Lance Taylor <iant@google.com>
9151 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9152 (Read_symbols::requeue): New function.
9153 (Read_symbols::do_read_symbols): If make_elf_object fails because
9154 the target type is not configured, and the file was searched for,
9155 issue a warning and retry with the next directory.
9156 (Add_symbols::run): If the file has an incompatible format, and
9157 it was searched for, requeue the Read_symbols task. On error,
9159 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9160 dirindex parameter to constructor. Change all callers. Declare
9161 incompatible_warning and requeue.
9162 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9163 input_argument_ and input_group_ fields. Add them to
9164 constructor. Change all callers.
9165 (class Read_script): Add dirindex_ field. Add it to constructor.
9167 * archive.cc (Archive::setup): Remove input_objects parameter.
9169 (Archive::get_file_and_offset): Likewise.
9170 (Archive::read_all_symbols): Likewise.
9171 (Archive::read_symbols): Likewise.
9172 (Archive::get_elf_object_for_member): Remove input_objects
9173 parameter. Add punconfigured parameter. Change all callers.
9174 (Archive::add_symbols): Change return type to bool. Check return
9175 value of include_member.
9176 (Archive::include_all_members): Likewise.
9177 (Archive::include_member): Change return type to bool. Return
9178 false if first included object has incompatible target. Set
9179 included_member_ field.
9180 (Add_archive_symbols::run): If add_symbols returns false, requeue
9182 * archive.h (class Archive): Add included_member_ field.
9183 Initialize it in constructor. Add input_file and searched_for
9184 methods. Update declarations.
9185 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9186 input_argument_ fields. Add them to constructor. Change all
9188 * script.cc: Include "target-select.h".
9189 (class Parser_closure): Add skip_on_incompatible_target_ and
9190 found_incompatible_target_ fields. Add
9191 skip_on_incompatible_target parameter to constructor. Change all
9192 callers. Add methods skip_on_incompatible_target,
9193 clear_skip_on_incompatible_target, found_incompatible_target, and
9194 set_found_incompatible_target.
9195 (read_input_script): Add dirindex parameter. Change all callers.
9196 If parser finds an incompatible target, requeue Read_symbols
9198 (script_set_symbol): Clear skip_on_incompatible_target in
9200 (script_add_assertion, script_parse_option): Likewise.
9201 (script_start_sections, script_add_phdr): Likewise.
9202 (script_check_output_format): New function.
9203 * script.h (read_input_script): Update declaration.
9204 * script-c.h (script_check_output_format): Declare.
9205 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9206 (ignore_cmd): Remove OUTPUT_FORMAT.
9207 * fileread.cc (Input_file::Input_file): Add explicit this.
9208 (Input_file::will_search_for): New function.
9209 (Input_file::open): Add pindex parameter. Change all callers.
9210 * fileread.h (class Input_file): Add input_file_argument method.
9211 Declare will_search_for. Update declarations.
9212 * object.cc (make_elf_object): Add punconfigured parameter.
9214 * object.h (class Object): Make input_file public. Add
9215 searched_for method.
9216 (make_elf_object): Update declaration.
9217 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9219 * dirsearch.h (class Dirsearch): Update declaration.
9220 * options.h (class General_options): Add --warn-search-mismatch.
9221 * parameters.cc (Parameters::is_compatible_target): New function.
9222 * parameters.h (class Parameters): Declare is_compatible_target.
9223 * workqueue.cc (Workqueue::add_blocker): New function.
9224 * workqueue.h (class Workqueue): Declare add_blocker.
9226 * fileread.cc (Input_file::open): Remove options parameter.
9228 (Input_file::open_binary): Likewise.
9229 * script.cc (read_input_script): Likewise.
9230 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9231 options parameter from constructor. Change all callers.
9232 (class Read_script): Likewise.
9233 * fileread.h (class Input_file): Update declarations.
9234 * script.h (read_input_script): Update declaration.
9236 2009-03-10 Nick Clifton <nickc@redhat.com>
9238 * po/es.po: New Spanish translation.
9240 2009-03-06 Cary Coutant <ccoutant@google.com>
9242 * options.cc (parse_short_option): Keep dash_z from registering itself.
9244 2009-03-03 Ian Lance Taylor <iant@google.com>
9247 * target-reloc.h (relocate_section): Pass output_section to
9249 * i386.cc (Target_i386::should_apply_static_reloc): Add
9250 output_section parameter. Change all callers.
9251 (Target_i386::Relocate::relocate): Add output_section parameter.
9252 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9253 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9254 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9255 * testsuite/two_file_shared.sh: New script.
9256 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9257 (check_DATA): Add two_file_shared.dbg.
9258 (two_file_shared.dbg): New target.
9259 * testsuite/Makefile.in: Rebuild.
9261 2009-03-01 Ian Lance Taylor <iant@google.com>
9263 * configure.ac: Check for byteswap.h.
9264 * configure: Rebuild.
9265 * config.in: Rebuild.
9267 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9269 * layout.cc (Layout::find_or_add_kept_section): New function.
9270 (Layout::add_comdat): Removed.
9271 * layout.h (struct Kept_section): Move out of class Layout.
9272 Remove trailing underscores from field names. Add group_sections
9273 field. Rename group_ field to is_group. Change all uses.
9274 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9275 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9276 comdat_groups_ field.
9277 (Sized_relobj::include_section_group): Use
9278 find_or_add_kept_section and Kept_section::group_sections.
9279 (Sized_relobj::include_linkonce_section): Likewise.
9280 * object.cc (class Sized_relobj): Don't define Comdat_group or
9281 Comdat_group_table. Remove find_comdat_group and
9282 add_comdat_group. Remove comdat_groups_ field.
9283 * plugin.cc (include_comdat_group): Use
9284 Layout::find_or_add_kept_section.
9286 2009-02-28 Ian Lance Taylor <iant@google.com>
9288 * README: --gc-sections and map files are now supported. Document
9289 some build requirements.
9292 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9293 relocatable link set the value of the section symbol to zero.
9294 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9295 relocatable link don't include the section address in the local
9298 2009-02-27 Ian Lance Taylor <iant@google.com>
9301 * options.h (class Search_directory): Add is_system_directory.
9302 (class General_options): Declare is_in_system_directory.
9303 * options.cc (get_relative_sysroot): Make static.
9304 (get_default_sysroot): Make static.
9305 (General_optoins::is_in_system_directory): New function.
9306 * fileread.cc (Input_file::is_in_system_directory): New function.
9307 * fileread.h (class Input_file): Declare is_in_system_directory.
9308 * object.h (class Object): Add is_in_system_directory.
9309 (class Input_objects): Remove system_library_directory_ field.
9310 * object.cc (Input_objects::add_object): Don't set
9311 system_library_directory_.
9312 (input_objects::found_in_system_library_directory): Remove.
9313 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9314 parameter. Change all callers.
9315 (Symbol_table::sized_write_globals): Likewise.
9316 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9317 Call Object::is_in_system_directory.
9318 * symtab.h (class Symbol_table): Update declarations.
9321 * descriptors.h (Open_descriptor): Add is_on_stack field.
9322 * descriptors.cc (Descriptors::open): If the descriptor is on the
9323 top of the stack, remove it. Initialize is_on_stack field.
9324 (Descriptors::release): Only add pod to stack if it is not on the
9326 (Descriptors::close_some_descriptor): Clear stack_next and
9330 * output.cc (Output_section::find_starting_output_address): Rename
9331 from starting_output_address; add PADDR parameter; change return
9333 * output.h (class Output_section): Declare
9334 find_starting_output_address instead of starting_output_address.
9335 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9336 section symbol for which we can't find a merge section.
9339 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9340 hidden or internal, force the symbol to be local.
9341 * resolve.cc (Symbol::override_visibility): Define.
9342 (Symbol::override_base): Use override_visibility.
9343 (Symbol_table::resolve): Likewise.
9344 (Symbol::override_base_with_special): Likewise.
9345 (Symbol_table::override_with_special): If the visibility is hidden
9346 or internal, force the symbol to be local.
9347 * symtab.h (class Symbol): Add set_visibility and
9348 override_visibility.
9349 * testsuite/ver_test_1.sh: New file.
9350 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9351 (check_DATA): Add ver_test_1.syms.
9352 (ver_test_1.syms): New target.
9353 * testsuite/Makefile.in: Rebuild.
9355 2009-02-25 Cary Coutant <ccoutant@google.com>
9357 * layout.cc (Layout::choose_output_section): Don't rename sections
9358 when using a linker script that has a SECTIONS clause.
9359 * Makefile.in: Regenerate.
9361 * testsuite/Makefile.am (script_test_5.sh): New test case.
9362 * testsuite/Makefile.in: Regenerate.
9363 * testsuite/script_test_5.cc: New file.
9364 * testsuite/script_test_5.sh: New file.
9365 * testsuite/script_test_5.t: New file.
9367 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9369 * archive.cc (Archive::include_member): Update calls to add_symbols.
9370 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9371 the Layout argument.
9372 * dynobj.h (do_add_symbols): Add the Layout argument.
9373 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9375 * object.h (Object::add_symbols): Add the Layout argument.
9376 (Object::do_add_symbols): Add the Layout argument.
9377 (Sized_relobj::do_add_symbols): Add the Layout argument.
9378 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9379 Unify the two versions.
9380 (Add_plugin_symbols): Remove.
9381 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9382 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9383 (Add_plugin_symbols): Remove.
9384 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9385 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9386 (Add_symbols::run): Make it work with Pulginobj.
9388 2009-02-06 Ian Lance Taylor <iant@google.com>
9390 * object.cc (Sized_relobj::do_layout): Make info message start
9391 with lower case letter.
9393 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9395 * binary.cc: Fix file comment.
9397 * options.h (enum Incremental_disposition): Define.
9398 (class General_options): Add new options: --incremental,
9399 --incremental_changed, --incremental_unchanged,
9400 --incremental_unknown. Add incremental_disposition_ and
9401 implicit_incremental_ fields.
9402 (General_options::incremental_disposition): New function.
9403 (class Position_dependent_options): Add incremental_disposition
9405 (Position_dependent_options::copy_from_options): Set incremental
9407 * options.cc (General_options::parse_incremental_changed): New
9409 (General_options::parse_incremental_unchanged): New function.
9410 (General_options::parse_incremental_unknown): New function.
9411 (General_options::General_options): Initialize new fields
9412 incremental_disposition_ and implicit_incremental_.
9413 (General_options::finalize): Check for uasge of --incremental-*
9414 without --incremental.
9416 2009-02-06 Chris Demetriou <cgd@google.com>
9418 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9419 pointer and to report location as the file name associated with
9421 (gold_undefined_symbol_at_location): New function to replace the
9422 old gold_undefined_symbol functionality.
9423 * target-reloc.h (relocate_section): Update to use
9424 gold_undefined_symbol_at_location.
9425 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9426 Call gold_undefined_symbol function rather than gold_error.
9427 * errors.h (Errors::undefined_symbol): Take location as a
9428 string, rather than calculating it from a relocation.
9429 * errors.cc (Errors::fatal): Print "fatal error:" before the
9431 (Errors::error, Errors::error_at_location): Print "error: "
9432 before the formatted message.
9433 (Errors::undefined_symbol): Take location as a string, rather
9434 than calculating it from a relocation.
9435 (gold_undefined_symbol_at_location): New function akin to
9436 old gold_undefined_symbol, calculates location from relocation.
9437 (gold_undefined_symbol): Change to take only a Symbol pointer
9438 and to report location as the file name associated with the symbol.
9439 * testsuite/debug_msg.sh: Update for changed error messages.
9440 * testsuite/undef_symbol.sh: Likewise.
9442 2009-02-04 Duncan Sands <baldrick@free.fr>
9445 * reduced_debug_output.h
9446 (Output_reduced_debug_abbrev_section::failed): Use format for
9448 (Output_reduced_debug_info_section::faild): Likewise.
9450 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9452 * script.cc (Lazy_demangler): New class.
9453 (Version_script_info::get_symbol_version_helper): Demangle a
9456 2009-01-29 Cary Coutant <ccoutant@google.com>
9458 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9460 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9462 2009-01-28 Ian Lance Taylor <iant@google.com>
9464 * version.cc (version_string): Bump to 1.9.
9466 * gold.h: Include <cstring> and <stdint.h>.
9467 * version.cc: Include <cstdio>.
9468 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9470 * reduced_debug_output.cc (insert_into_vector): Rename from
9471 Insert_into_vector; change all callers. Use Swap_unaligned to
9472 avoid aliasing issue; remove union since it is unnecessary.
9474 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9476 * Makefile.am (CCFILES): Add gc.cc.
9478 * Makefile.in: Regenerate.
9479 * gold.cc (Gc_runner): New class.
9480 (queue_initial_tasks): Call garbage collection related tasks
9481 when corresponding options are invoked.
9482 (queue_middle_gc_tasks): New function.
9483 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9484 processed early before laying out sections during garbage collection.
9485 * gold.h (queue_middle_gc_tasks): New function.
9486 (is_prefix_of): Move from "layout.cc".
9487 * i386.cc (Target_i386::gc_process_relocs): New function.
9488 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9489 * main.cc (main): Create object of class "Garbage_collection".
9490 * object.cc (Relobj::copy_symbols_data): New function.
9491 (Relobj::is_section_name_included): New function.
9492 (Sized_relobj::do_layout): Allow this function to be called twice
9493 during garbage collection and defer layout of section during the
9495 * object.h (Relobj::get_symbols_data): New function.
9496 (Relobj::is_section_name_included): New function.
9497 (Relobj::copy_symbols_data): New function.
9498 (Relobj::set_symbols_data): New function.
9499 (Relobj::get_relocs_data): New function.
9500 (Relobj::set_relocs_data): New function.
9501 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9502 (Relobj::gc_process_relocs): New function.
9503 (Relobj::do_gc_process_relocs): New pure virtual function.
9504 (Relobj::sd_): New data member.
9505 (Sized_relobj::is_output_section_offset_invalid): New function.
9506 (Sized_relobj::do_gc_process_relocs): New function.
9507 * options.h (General_options::gc_sections): Modify to not be a no-op.
9508 (General_options::print_gc_sections): New option.
9509 * plugin.cc (Plugin_finish::run): Remove function call to
9510 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9511 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9512 * reloc.cc (Read_relocs::run): Add task to process relocs and
9513 determine unreferenced sections when doing garbage collection.
9514 (Gc_process_relocs): New class.
9515 (Sized_relobj::do_gc_process_relocs): New function.
9516 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9517 sections that are garbage collected.
9518 * reloc.h (Gc_process_relocs): New class.
9519 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9520 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9521 symbols whose corresponding sections are garbage collected.
9522 (Symbol_table::Symbol_table): Add new parameter for the garbage
9524 (Symbol_table::gc_mark_undef_symbols): New function.
9525 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9526 (Symbol_table::gc_mark_dyn_syms): New function.
9527 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9529 (Symbol_table::add_from_object): Likewise.
9530 (Symbol_table::add_from_relobj): When building shared objects, do not
9531 treat externally visible symbols as garbage.
9532 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9533 table information for static and relocatable links.
9534 * symtab.h (Symbol_table::set_gc): New function.
9535 (Symbol_table::gc): New function.
9536 (Symbol_table::gc_mark_undef_symbols): New function.
9537 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9538 (Symbol_table::gc_mark_dyn_syms): New function.
9539 (Symbol_table::gc_): New data member.
9540 * target.h (Sized_target::gc_process_relocs): New pure virtual
9542 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9543 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9545 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9547 * options.h (General_options::gc_sections): Define as a no-op for now.
9548 (General_options::no_keep_memory): Ditto.
9549 (General_options::Bshareable): Define.
9550 * options.cc (General_options::finalize): Honor -Bshareable.
9552 2009-01-20 Andreas Schwab <schwab@suse.de>
9554 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9555 read the value in the contents, since we don't use it. Use the
9556 template endianness when writing.
9557 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9559 2009-01-19 Andreas Schwab <schwab@suse.de>
9561 * configure.tgt (powerpc64-*): Fix targ_obj.
9563 2009-01-15 Ian Lance Taylor <iant@google.com>
9565 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9566 local symbols when stripping all symbols.
9568 2009-01-14 Cary Coutant <ccoutant@google.com>
9570 * output.cc (Output_reloc): Add explicit instantiations.
9572 2009-01-14 Cary Coutant <ccoutant@google.com>
9574 * archive.cc (Archive::get_elf_object_for_member): Remove call
9575 to File_read::claim_for_plugin.
9576 * descriptors.cc (Descriptors::open): Remove reference to
9578 (Descriptors::claim_for_plugin): Remove.
9579 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9580 (Descriptors::is_claimed): Remove.
9581 (claim_descriptor_for_plugin): Remove.
9582 * fileread.cc (File_read::claim_for_plugin): Remove.
9583 * fileread.h (File_read::claim_for_plugin): Remove.
9584 (File_read::descriptor): Reopen descriptor if necessary.
9585 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9586 (Plugin_manager::all_symbols_read): Add task parameter. Change
9588 (Plugin_manager::get_input_file): New function.
9589 (Plugin_manager::release_input_file): New function.
9590 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9591 corresponding data member.
9592 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9593 and pass to base constructor. Change all callers.
9594 (get_input_file, release_input_file): New functions.
9595 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9596 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9597 (Plugin_manager::all_symbols_read): Add task parameter.
9598 (Plugin_manager::get_input_file): New function.
9599 (Plugin_manager::release_input_file): New function.
9600 (Plugin_manager::task_): New data member.
9601 (Pluginobj::Pluginobj): Add filesize parameter.
9602 (Pluginobj::filename): New function.
9603 (Pluginobj::descriptor): New function.
9604 (Pluginobj::filesize): New function.
9605 (Pluginobj::filesize_): New data member.
9606 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9607 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9608 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9610 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9611 with archive libraries.
9612 * testsuite/Makefile.in: Regenerate.
9613 * testsuite/plugin_test.c (struct sym_info): New type.
9614 (get_input_file, release_input_file): New static variables.
9615 (onload): Capture new transfer vector entries.
9616 (claim_file_hook): Stop reading at end of file according to filesize.
9617 Factor out parsing of readelf output into separate function.
9618 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9619 APIs and get the source file name from the symbol table. Convert
9620 source file name to corresponding object file name. Print info
9621 message when adding new input files.
9622 (parse_readelf_line): New function.
9623 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9624 * testsuite/plugin_test_2.sh: Likewise.
9625 * testsuite/plugin_test_3.sh: Likewise.
9626 * testsuite/plugin_test_4.sh: New test case.
9628 2009-01-07 Ian Lance Taylor <iant@google.com>
9630 * version.cc (version_string): Bump to 1.8.
9632 2008-12-23 Cary Coutant <ccoutant@google.com>
9634 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9635 * plugin.cc (Plugin_manager::finish): Rename as
9636 layout_deferred_objects. Move cleanup to separate function.
9637 (Plugin_manager::cleanup): New function.
9638 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9640 * plugin.h (Plugin_manager::finish): Rename as
9641 layout_deferred_objects.
9642 (Plugin_manager::cleanup): New function.
9643 (Plugin_manager::cleanup_done): New field.
9645 2008-12-23 Cary Coutant <ccoutant@google.com>
9647 * plugin.cc (is_visible_from_outside): New function.
9648 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9649 so we don't return "IR only" status for exported symbols or -r links.
9651 * testsuite/Makefile.am (plugin_test_3): New test case.
9652 * testsuite/Makefile.in: Regenerate.
9653 * testsuite/plugin_test_3.sh: New file.
9655 2008-12-22 Cary Coutant <ccoutant@google.com>
9657 * object.cc (Sized_relobj::layout_section): New function.
9658 (Sized_relobj::do_layout): Defer layout of input sections until after
9659 plugin has provided replacement files.
9660 (Sized_relobj::do_layout_deferred_sections): New function.
9661 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9662 (Relobj::layout_deferred_sections): New function.
9663 (Relobj::do_layout_deferred_sections): New function.
9664 (Sized_relobj::do_layout_deferred_sections): New function.
9665 (Sized_relobj::layout_section): New function.
9666 (Sized_relobj::Deferred_layout): New structure.
9667 (Sized_relobj::deferred_layout_): New field.
9668 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9669 Change all callers. Layout deferred sections.
9670 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9672 (Plugin_hook::run): Move code from do_plugin_hook inline.
9673 (Plugin_hook::do_plugin_hook): Remove.
9674 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9675 (Plugin_manager::finish): Renamed, was cleanup.
9676 (Plugin_manager::should_defer_layout): New function.
9677 (Plugin_manager::add_deferred_layout_object): New function.
9678 (Plugin_manager::Deferred_layout_list): New type.
9679 (Plugin_manager::deferred_layout_objects_): New field.
9680 (Plugin_hook::do_plugin_hook): Remove.
9682 2008-12-17 Ian Lance Taylor <iant@google.com>
9684 * options.h (class General_options): Add --no case for
9687 2008-12-16 Cary Coutant <ccoutant@google.com>
9689 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9691 (Plugin_manager::claim_file): Create plugin object even if
9692 plugin did not call the add_symbols callback.
9693 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9694 asking for more symbols than were added.
9695 * testsuite/Makefile.am (plugin_test_1): Add test case with
9697 (empty.syms): New target.
9698 * testsuite/Makefile.in: Regenerate.
9699 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9700 message. Don't call add_symbols if no globals.
9701 (all_symbols_read_hook): Don't provide replacement for empty
9704 2008-12-12 Ian Lance Taylor <iant@google.com>
9706 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9707 r_type == 0 for a local symbol with r_sym == 0.
9708 (scan_relocatable_relocs): Pass r_sym to
9709 local_non_section_strategy.
9710 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9713 * configure.ac: Update test for TLS descriptors: they are
9714 supported as of glibc 2.9.
9715 * configure: Rebuild.
9717 2008-12-11 Ian Lance Taylor <iant@google.com>
9720 * target-reloc.h (Default_scan_relocatable_relocs): For each
9721 function, map r_type == 0 to RELOC_DISCARD.
9723 2008-12-10 Cary Coutant <ccoutant@google.com>
9725 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9726 object to override a kept COMDAT group from a plugin object.
9728 2008-12-09 Ian Lance Taylor <iant@google.com>
9731 * yyscript.y (file_cmd): Handle INPUT.
9733 * testsuite/initpri1.c: Change all declarations to be full
9734 prototypes by adding void, to avoid compiler warnings.
9736 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9738 * options.cc (General_options::parse_plugin_opt): New.
9739 (General_options::add_plugin): The argument now is just the filename.
9740 (General_options::add_plugin_option): New.
9741 * options.h (plugin_opt): New.
9742 (add_plugin): Change argument name.
9743 (add_plugin_option): New.
9744 * plugin.cc (Plugin::load): Don't parse the plugin option.
9745 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9746 (Plugin::add_option): New.
9747 (Plugin::args_): Change type.
9748 (Plugin::filename_): New.
9749 (Plugin_manager::add_plugin_option): New.
9750 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9751 * testsuite/Makefile.in: Regenerate.
9753 2008-12-05 Cary Coutant <ccoutant@google.com>
9755 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9756 Handle --strip-lto-sections option.
9757 * options.h (strip_lto_sections): New option.
9759 2008-12-01 Cary Coutant <ccoutant@google.com>
9761 * plugin.cc (ld_plugin_message): Change format parameter to const.
9762 Fix mismatch between new[] and delete.
9764 2008-11-14 Cary Coutant <ccoutant@google.com>
9766 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9769 2008-11-05 Craig Silverstein <csilvers@google.com>
9771 * options.cc (General_options::parse_dynamic_list): New function.
9772 * options.h (General_options): New flags dynamic_list,
9773 dynamic_list_data, dynamic_list_cpp_new, and
9774 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9775 (General_options::in_dynamic_list): New function.
9776 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9777 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9778 (Lex::can_continue_name): Likewise.
9780 (read_script_file): New parameter script_options.
9781 (read_dynamic_list): New function.
9782 (Script_options::define_dynamic_list): New function.
9783 (dynamic_list_keyword_parsecodes): New variable.
9784 (dynamic_list_keywords): New variable.
9785 * script.h (Script_options::define_dynamic_list): New function
9787 (read_dynamic_list): New function prototype.
9788 * symtab.cc (strprefix): New macro.
9789 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9790 dynamic_list_data, dynamic_list_cpp_new, and
9791 dynamic_list_cpp_typeinfo.
9792 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9793 (dynamic_list_expr): New rule.
9794 (dynamic_list_nodes): Likewise.
9795 (dynamic_list_node): Likewise.
9796 * testsuite/Makefile.am (dynamic_list): New test.
9797 * testsuite/Makefile.in: Regenerated.
9798 * testsuite/dynamic_list.t: New file.
9799 * testsuite/dynamic_list.sh: New file.
9801 2008-11-05 Craig Silverstein <csilvers@google.com>
9803 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9804 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9805 (t11_last): Likewise.
9806 * testsuite/ver_test_6.c (main): Likewise.
9808 2008-10-07 Cary Coutant <ccoutant@google.com>
9810 * options.c (General_options::finalize): Add check for -static and
9812 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9815 2008-10-02 Cary Coutant <ccoutant@google.com>
9817 * plugin.cc (make_sized_plugin_object): Fix conditional
9818 compilation to work when not all targets are enabled.
9820 2008-09-29 Cary Coutant <ccoutant@google.com>
9822 * archive.cc (Archive::get_file_and_offset): Use filename instead
9823 of name to get library path.
9824 (Archive::include_member): Unlock external member of a thin archive.
9826 * testsuite/Makefile.am (TEST_AR): New variable.
9827 (thin_archive_test_1): New test.
9828 (thin_archive_test_2): New test.
9829 * testsuite/Makefile.in: Regenerate.
9830 * testsuite/thin_archive_main.cc: New file.
9831 * testsuite/thin_archive_test_1.cc: New file.
9832 * testsuite/thin_archive_test_2.cc: New file.
9833 * testsuite/thin_archive_test_3.cc: New file.
9834 * testsuite/thin_archive_test_4.cc: New file.
9836 2008-09-29 Cary Coutant <ccoutant@google.com>
9838 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9839 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9841 (Sized_relobj::do_finalize_local_symbols): Likewise.
9842 (Sized_relobj::map_to_kept_section): Likewise.
9843 * object.h (Sized_relobj::invalid_address): New constant.
9844 (Sized_relobj::do_output_section_offset): Check for invalid_address
9846 * output.cc (Output_reloc::local_section_offset): Use constant
9847 invalid_address instead of -1U.
9848 (Output_reloc::get_address): Likewise.
9849 (Output_section::output_address): Change -1U to -1ULL.
9850 * output.h (Output_reloc::invalid_address): New constant.
9851 * reloc.cc (Sized_relobj::write_sections): Use constant
9852 invalid_address instead of -1U.
9853 (Sized_relobj::relocate_sections): Likewise.
9854 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9855 values for merge sections.
9856 * target-reloc.h (relocate_for_relocatable): Use constant
9857 invalid_address instead of -1U.
9859 2008-09-19 Cary Coutant <ccoutant@google.com>
9861 Add plugin functionality for link-time optimization (LTO).
9862 * configure.ac (plugins): Add --enable-plugins option.
9863 * configure: Regenerate.
9864 * config.in: Regenerate.
9865 * Makefile.am (LIBDL): New variable.
9866 (CCFILES): Add plugin.cc.
9867 (HFILES): Add plugin.h.
9868 (ldadd_var): Add LIBDL.
9869 * Makefile.in: Regenerate.
9871 * archive.cc: Include "plugin.h".
9872 (Archive::setup): Don't preread archive symbols when using a plugin.
9873 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9874 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9876 (Archive::include_member): Add symbols from plugin objects.
9877 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9878 * descriptors.cc (Descriptors::open): Check for file descriptors
9879 abandoned by plugins.
9880 (Descriptors::claim_for_plugin): New function.
9881 * descriptors.h (Descriptors::claim_for_plugin): New function.
9882 (Open_descriptor::is_claimed): New field.
9883 (claim_descriptor_for_plugin): New function.
9884 * fileread.cc (File_read::claim_for_plugin): New function.
9885 * fileread.h (File_read::claim_for_plugin): New function.
9886 (File_read::descriptor): New function.
9887 * gold.cc: Include "plugin.h".
9888 (queue_initial_tasks): Add task to call plugin hooks for generating
9890 * main.cc: Include "plugin.h".
9891 (main): Load plugin libraries.
9892 * object.h (Pluginobj): Declare.
9893 (Object::pluginobj): New function.
9894 (Object::do_pluginobj): New function.
9895 (Object::set_target): New function.
9896 * options.cc: Include "plugin.h".
9897 (General_options::parse_plugin): New function.
9898 (General_options::General_options): Initialize plugins_ field.
9899 (General_options::add_plugin): New function.
9900 * options.h (Plugin_manager): Declare.
9901 (General_options): Add --plugin option.
9902 (General_options::has_plugins): New function.
9903 (General_options::plugins): New function.
9904 (General_options::add_plugin): New function.
9905 (General_options::plugins_): New field.
9906 * plugin.cc: New file.
9907 * plugin.h: New file.
9908 * readsyms.cc: Include "plugin.h".
9909 (Read_symbols::do_read_symbols): Check for archive before checking
9910 for ELF file. Call plugin hooks to claim files.
9911 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9912 from a real object file; force override when processing replacement
9914 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9915 (Symbol::init_base_object): Likewise.
9916 (Symbol::init_base_output_data): Likewise.
9917 (Symbol::init_base_output_segment): Likewise.
9918 (Symbol::init_base_constant): Likewise.
9919 (Symbol::init_base_undefined): Likewise.
9920 (Symbol::output_section): Assert that object is not a plugin.
9921 (Symbol_table::add_from_pluginobj): New function.
9922 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9924 (Symbol_table::sized_write_globals): Likewise.
9925 (Symbol_table::add_from_pluginobj): Instantiate template.
9926 * symtab.h (Sized_pluginobj): Declare.
9927 (Symbol::in_real_elf): New function.
9928 (Symbol::set_in_real_elf): New function.
9929 (Symbol::in_real_elf_): New field.
9930 (Symbol_table::add_from_pluginobj): New function.
9932 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9933 (LIBDL): New variable.
9935 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9936 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9937 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9938 (MOSTLYCLEANFILES): Likewise.
9939 * testsuite/Makefile.in: Regenerate.
9940 * testsuite/plugin_test.c: New file.
9941 * testsuite/plugin_test_1.sh: New file.
9942 * testsuite/plugin_test_2.sh: New file.
9944 2008-09-16 Ian Lance Taylor <iant@google.com>
9946 * target-reloc.h (relocate_section): Check whether a symbol is
9947 defined by the ABI before reporting an undefined symbol error.
9948 * target.h (Target::is_defined_by_abi): Make parameter const.
9949 (Target::do_is_defined_by_abi): Likewise.
9950 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9951 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9952 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9953 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9954 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9955 * testsuite/Makefile.in: Rebuild.
9957 * fileread.cc (make_view): Add casts to avoid warning.
9959 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9961 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9962 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9964 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9966 * options.h (General_options::output_is_executable): New.
9967 (General_options::output_is_pie): New.
9968 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9969 for shared libraries.
9970 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9972 2008-09-11 Chris Demetriou <cgd@google.com>
9974 * options.h (origin): New -z option.
9975 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9976 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9979 2008-09-05 Cary Coutant <ccoutant@google.com>
9981 * fileread.cc (File_read::make_view): Add check for attempt to map
9984 2008-09-05 Cary Coutant <ccoutant@google.com>
9986 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9987 explicit instantiations.
9989 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9992 * options.cc (General_options::finalize): Allow undefined symbols
9993 in shlibs if linking -shared.
9996 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9997 symbols as not needing a dynsym entry.
9999 2008-08-20 Craig Silverstein <csilvers@google.com>
10001 * fileread.cc (File_read::open): Do not lock the file unless it
10002 was successfully opened.
10004 2008-08-14 Cary Coutant <ccoutant@google.com>
10006 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10007 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10008 * testsuite/tls_test.cc (struct int128): 128-bit struct
10009 for testing TLS relocs with non-zero addend.
10010 (v12): New TLS variable.
10012 (t_last): Add check for v12.
10013 * testsuite/tls_test.h (t12): New function.
10014 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10016 2008-08-13 Ian Lance Taylor <iant@google.com>
10018 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10019 set tls_segment_ or relro_segment_.
10020 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10022 * output.h (Output_section::clear_is_relro): New function.
10023 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10024 sections specially even when output_data_ is empty.
10025 (Output_segment::maximum_alignment): When first section is relro,
10026 only force alignment for PT_LOAD segments.
10027 * script.cc (script_data_segment_align): New function.
10028 (script_data_segment_relro_end): New function.
10029 * script-c.h (script_data_segment_align): Declare.
10030 (script_data_segment_relro_end): Declare.
10031 * script-sections.h (class Script_sections): Declare
10032 data_segment_align and data_segment_relro_end. Add fields
10033 segment_align_index_ and saw_relro_end_.
10034 * script-sections.cc (class Sections_element): Add set_is_relro
10035 virtual function. Add new bool* parameter to place_orphan_here.
10036 Add get_output_section virtual function.
10037 (class Output_section_definition): Add set_is_relro. Add new
10038 bool* parameter to place_orphan_here. Add get_output_section.
10039 Add is_relro_ field.
10040 (Output_section_definition::Output_section_definition): Initialize
10041 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10042 and is_relro_ fields.
10043 (Output_section_definition::place_orphan_here): Add is_relro
10045 (Output_section_definition::set_section_addresses): Set relro for
10047 (Output_section_definition::alternate_constraint): Likewise.
10048 (class Orphan_output_section): Add new bool* parameter to
10049 place_orphan_here. Add get_output_section.
10050 (Orphan_output_section::place_orphan_here): Add is_relro
10052 (Script_sections::Script_sections): Initialize
10053 data_segment_align_index_ and saw_relro_end_.
10054 (Script_sections::data_segment_align): New function.
10055 (Script_sections::data_segment_relro_end): New function.
10056 (Script_sections::place_orphan): Set or clear is_relro.
10057 (Script_sections::set_section_addresses): Force alignment of first
10059 * yyscript.y (exp): Call script_data_segment_align and
10060 script_data_segment_relro_end.
10061 * testsuite/relro_script_test.t: New file.
10062 * testsuite/relro_test.cc (using_script): Declare.
10063 (t1, t2): Test using_script.
10064 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10065 (relro_script_test_SOURCES): Define.
10066 (relro_script_test_DEPENDENCIES): Define.
10067 (relro_script_test_LDFLAGS): Define.
10068 (relro_script_test_LDADD): Define.
10069 (relro_script_test.so): New target.
10070 * testsuite/Makefile.in: Rebuild.
10072 2008-08-06 Cary Coutant <ccoutant@google.com>
10074 * archive.cc (Archive::total_archives, Archive::total_members)
10075 (Archive::total_members_loaded): New variables.
10076 (Archive::setup): Add parameter. Add option to preread
10078 (Archive::read_armap): Add counter.
10079 (Archive::get_file_and_offset): New function.
10080 (Archive::get_elf_object_for_member): New function.
10081 (Archive::read_all_symbols): New function.
10082 (Archive::read_symbols): New function.
10083 (Archive::add_symbols): Add counters.
10084 (Archive::include_all_members): Use armap to find members if it's
10086 (Archive::include_member): Skip reading symbols if already read.
10087 Factored code into Archive::get_file_and_offset and
10088 Archive::get_elf_object_for_member. Changed call to
10089 Mapfile::report_include_archive_member.
10090 (Archive::print_stats): New function.
10091 * archive.h: Declare Object and Read_symbols_data classes.
10092 (Archive::Archive): Add initializers for new members.
10093 (Archive::setup): Add parameter.
10094 (Archive::print_stats): New function.
10095 (Archive::total_archives, Archive::total_members)
10096 (Archive::total_members_loaded): New variables.
10097 (Archive::get_file_and_offset): New function.
10098 (Archive::get_elf_object_for_member): New function.
10099 (Archive::read_all_symbols): New function.
10100 (Archive::read_symbols): New function.
10101 (Archive::Archive_member): New class.
10102 (Archive::members_): New member.
10103 (Archive::num_members_): New member.
10104 * main.cc: Include archive.h.
10105 (main): Call Archive::print_stats.
10106 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10107 archive parameter; member_name is now the fully-decorated name.
10108 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10109 * options.h: (General_options): Add --preread-archive-symbols option.
10110 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10113 2008-08-04 Ian Lance Taylor <iant@google.com>
10115 * symtab.h (Symbol::use_plt_offset): New function.
10116 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10117 * powerpc.cc (Relocate::relocate): Likewise.
10118 * sparc.cc (Relocate::relocate): Likewise.
10119 * x86_64.cc (Relocate::relocate): Likewise.
10120 * testsuite/weak_plt.sh: New test.
10121 * testsuite/weak_plt_main.cc: New test.
10122 * testsuite/weak_plt_shared.cc: New test.
10123 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10124 (check_PROGRAMS): Add weak_plt.
10125 (check_DATA): Add weak_plt_shared.so.
10126 (weak_plt_main_pic.o, weak_plt): New targets.
10127 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10128 * testsuite/Makefile.in: Rebuild.
10130 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10132 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10133 * testsuite/Makefile.in: Rebuild.
10135 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10137 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10138 * Makefile.in: Regenerate.
10139 * po/POTFILES.in: Regenerate.
10141 2008-07-29 Ian Lance Taylor <iant@google.com>
10143 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10144 symbols before other symbols.
10145 * testsuite/script_test_2.cc (test_addr): Declare.
10146 (test_addr_alias): Declare.
10147 (main): Check that test_addr and test_addr_alias have the right
10149 * testsuite/script_test_2.t: Define test_addr_alias and
10152 2008-07-24 Ian Lance Taylor <iant@google.com>
10155 * descriptors.cc: New file.
10156 * descriptors.h: New file.
10157 * gold-threads.h (class Hold_optional_lock): New class.
10158 * fileread.cc: Include "descriptors.h".
10159 (File_read::~File_read): Release descriptor rather than closing
10161 (File_read::open) [file]: Call open_descriptor rather than open.
10162 Set is_descriptor_opened_.
10163 (File_read::open) [memory]: Assert that descriptor is not open.
10164 (File_read::reopen_descriptor): New function.
10165 (File_read::release): Release descriptor.
10166 (File_read::do_read): Make non-const. Reopen descriptor.
10167 (File_read::read): Make non-const.
10168 (File_read::make_view): Reopen descriptor.
10169 (File_read::do_readv): Likewise.
10170 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10171 Update declarations.
10172 * layout.cc: Include "descriptors.h".
10173 (Layout::create_build_id): Use open_descriptor rather than open.
10174 * output.cc: Include "descriptors.h".
10175 (Output_file::open): Use open_descriptor rather than open.
10176 * archive.cc (Archive::const_iterator): Change Archive to be
10178 (Archive::begin, Archive::end): Make non-const.
10179 (Archive::count_members): Likewise.
10180 * archive.h (class Archive): Update declarations.
10181 * object.h (Object::read): Make non-const.
10182 * Makefile.am (CCFILES): Add descriptors.cc.
10183 (HFILES): Add descriptors.h.
10184 * Makefile.in: Rebuild.
10187 * gold.h: Always include <clocale>. Add Solaris workarounds
10188 following code in binutils/sysdep.h.
10191 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10192 this->eh_frame_hdr_ is NULL before using it.
10194 * dynobj.cc (Versions::Versions): Update comment.
10196 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10197 the base version name.
10199 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10200 array size plus one.
10201 (Stringpool_template::set_string_offsets): Subtract one from key
10202 before using it as an array index.
10203 (Stringpool_template::get_offset_with_length): Likewise.
10204 (Stringpool_template::write_to_buffer): Likewise.
10205 * stringpool.h (Stringpool_template::get_offset_from_key):
10208 2008-07-23 Ian Lance Taylor <iant@google.com>
10211 * object.h (Merged_symbol_value::value): Do our best to handle a
10215 * script.cc (Version_script_info::get_versions): Don't add empty
10216 version tag to return value.
10217 (Version_script_info::get_symbol_version_helper): Change return
10218 type to bool. Add pversion parameter. Change all callers.
10219 (script_register_vers_node): Don't require a non-NULL tag.
10220 * script.h (class Version_script_info): Update declarations.
10221 (Version_script_info::get_symbol_version): Change return type to
10222 bool. Add version parameter. Change all callers.
10223 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10224 handling. Handle an empty version from a version script.
10225 (Symbol_table::define_special_symbol): Likewise.
10226 * testsuite/ver_test_10.script: New file.
10227 * testsuite/ver_test_10.sh: New file.
10228 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10229 (check_DATA): Add ver_test_10.syms.
10230 (ver_test_10.syms, ver_test_10.so): New target.
10231 * testsuite/Makefile.in: Rebuild.
10233 2008-07-23 Simon Baldwin <simonb@google.com>
10235 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10236 to zero for undefined symbols from dynamic libraries.
10238 2008-07-23 Ian Lance Taylor <iant@google.com>
10240 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10241 Change all callers.
10242 * symtab.h (class Symbol_table): Update declaration.
10243 * testsuite/ver_test_9.cc: New file.
10244 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10245 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10246 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10247 (ver_test_9.so, ver_test_9.o): New targets.
10248 * testsuite/Makefile.in: Rebuild.
10250 2008-07-22 Ian Lance Taylor <iant@google.com>
10252 * options.h (class General_options): Define --check-sections.
10253 * layout.cc (Layout::set_segment_offsets): Handle
10256 * options.h (class General_options): Define -n/--nmagic and
10258 * options.cc (General_options::finalize): For -n/--nmagic or
10259 -N/--omagic, set -static.
10260 * layout.cc (Layout::attach_allocated_section_to_segment): If
10261 -N/--omagic, don't put read-only and read-write sections in
10262 different segments.
10263 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10264 finding a read-only segment.
10265 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10266 don't set the minimum segment alignment to the common page size,
10267 and don't set the file offset to the address modulo the page size.
10268 * script-sections.cc (Script_sections::create_segments): If
10269 -n/--omagic, don't put read-only and read-write sections in
10270 different segments.
10272 * cref.cc: New file.
10273 * cref.h: New file.
10274 * options.h (class General_options): Add --print-symbol-counts.
10275 * main.cc (main): Issue defined symbol report if requested.
10276 * archive.cc (Archive::interpret_header): Make into a const member
10278 (Archive::add_symbols): Call Input_objects::archive_start and
10280 (Archive::const_iterator): Define new class.
10281 (Archive::begin, Archive::end): New functions.
10282 (Archive::include_all_members): Rewrite to use iterator.
10283 (Archive::count_members): New function.
10284 * archive.h (class Archive): Update declarations.
10285 (Archive::filename): New function.
10286 * object.cc: Include "cref.h".
10287 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10288 (Sized_relobj::do_get_global_symbol_counts): New function.
10289 (Input_objects::add_object): Add object to cross-referencer.
10290 (Input_objects::archive_start): New function.
10291 (Input_objects::archive_stop): New function.
10292 (Input_objects::print_symbol_counts): New function.
10293 * object.h: Declare Cref and Archive.
10294 (Object::get_global_symbol_counts): New function.
10295 (Object::do_get_global_symbol_counts): New pure virtual function.
10296 (class Sized_relobj): Add defined_count_ field. Update
10298 (class Input_objects): Add cref_ field. Update constructor.
10299 Update declarations.
10300 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10302 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10304 (Sized_dynobj::do_get_global_symbol_counts): New function.
10305 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10306 defined_count_. Update declarations. Define Symbols typedef.
10307 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10308 parameter. Change all callers.
10309 (Symbol_table::add_from_dynobj): Add sympointers and defined
10310 parameters. Change all callers.
10311 * symtab.h (class Symbol_table): Update declarations.
10312 * Makefile.am (CCFILES): Add cref.cc.
10313 (HFILES): Add cref.h.
10314 * Makefile.in: Rebuild.
10316 2008-07-22 Simon Baldwin <simonb@google.com>
10318 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10319 to zero when writing undefined symbols.
10321 2008-07-22 Ian Lance Taylor <iant@google.com>
10323 * output.cc (Output_section::add_input_section): Don't try to
10324 merge empty merge sections.
10326 2008-07-21 Craig Silverstein <csilvers@google.com>
10328 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10329 Include symbol version in error message.
10331 2008-07-20 Chris Demetriou <cgd@google.com>
10333 * configure.ac (gold_cv_c_random_seed): New configured variable.
10334 (RANDOM_SEED_CFLAGS): New substituted variable.
10335 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10336 * configure: Rebuild.
10337 * Makefile.in: Likewise.
10338 * testsuite/Makefile.in: Likewise.
10340 2008-07-18 Ian Lance Taylor <iant@google.com>
10342 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10343 where we see NAME/NULL and NAME/VERSION as separate symbols.
10344 * testsuite/ver_test_main.cc (main): Call t4.
10345 (t4, t4_2a): Define.
10346 * testsuite/ver_test_2.cc (t4_2): Define.
10347 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10348 * testsuite/ver_test_4.cc (t4_2a): Define.
10349 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10350 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10352 2008-07-17 Ian Lance Taylor <iant@google.com>
10354 * dynobj.cc (Versions::add_def): If we give an error about a
10355 missing version, go ahead and create the version anyhow.
10357 2008-07-10 Ian Lance Taylor <iant@google.com>
10359 Handle output sections with more than 0x7fffffff bytes.
10360 * object.h (class Relobj): Change map_to_output_ to
10361 output_sections_, and just keep a section pointer. Change all
10362 uses. Move comdat group support to Sized_relobj.
10363 (Relobj::is_section_specially_mapped): Remove.
10364 (Relobj::output_section): Remove poff parameter. Change all
10366 (Relobj::output_section_offset): New function.
10367 (Relobj::set_section_offset): Rewrite.
10368 (Relobj::map_to_output): Remove.
10369 (Relobj::output_sections): New function.
10370 (Relobj::do_output_section_offset): New pure virtual function.
10371 (Relobj::do_set_section_offset): Likewise.
10372 (class Sized_relobj): Add section_offsets_ field. Add comdat
10373 group support from Relobj. Update declarations.
10374 (Sized_relobj::get_output_section_offset): New function.
10375 (Sized_relobj::do_output_section_offset): New function.
10376 (Sized_relobj::do_set_section_offset): New function.
10377 * object.cc (Relobj::output_section_address): Remove.
10378 (Sized_relobj::Sized_relobj): Initialize new fields.
10379 (Sized_relobj::include_section_group): Cast find_kept_object to
10381 (Sized_relobj::include_linkonce_section): Likewise.
10382 (Sized_relobj::do_layout): Use separate arrays for output section
10384 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10386 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10387 output_sections and section_offsets.
10388 (Sized_relobj::write_local_symbols): Likewise.
10389 (map_to_kept_section): Compute output address directly.
10390 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10391 output_sections and section_offsets.
10392 (Sized_relobj::write_sections): Likewise.
10393 (Sized_relobj::relocate_sections): Likewise.
10394 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10395 * output.h (class Output_reloc): Update declarations. Change
10396 u2_.relobj to Sized_relobj*.
10397 (class Output_data_reloc): Change add functions to use
10399 * output.cc (Output_reloc::Output_reloc): Change relobj to
10401 (Output_reloc::local_section_offset): Change return type to
10402 Elf_Addr. Use get_output_section_offset.
10403 (Output_reloc::get_address): Likewise.
10404 (Output_section::is_input_address_mapped): Don't call
10405 is_section_specially_mapped.
10406 (Output_section::output_offset): Likewise.
10407 (Output_section::output_address): Likewise.
10408 (Output_section::starting_output_address): Likewise.
10409 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10410 parameter to Sized_relobj*.
10411 (Copy_relocs::need_copy_reloc): Likewise.
10412 (Copy_relocs::save): Likewise.
10413 * copy-relocs.h (class Copy_relocs): Update declarations.
10414 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10415 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10416 * target-reloc.h (relocate_for_relocatable): Change
10417 offset_in_output_section type to Elf_Addr. Change code that uses
10419 * layout.cc (Layout::layout): Always set *off.
10420 * mapfile.cc (Mapfile::print_input_section): Use
10421 output_section_offset.
10422 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10424 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10425 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10426 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10428 2008-07-03 Ian Lance Taylor <iant@google.com>
10430 * layout.cc (Layout::include_section): Do not discard unrecognized
10431 SHT_STRTAB sections.
10433 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10435 * script.cc (Lex::can_continue_name): Make '?' allowable in
10436 version-script names.
10437 * testsuite/version_script.map: Change glob pattern to use '?'
10439 2008-06-30 Manish Singh <yosh@gimp.org>
10442 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10445 2008-06-30 Ian Lance Taylor <iant@google.com>
10449 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10450 versions]: Don't try to read the value in the contents, since we
10451 don't use it. Use the template endianness when writing.
10453 2008-06-25 Cary Coutant <ccoutant@google.com>
10455 * fileread.cc (File_read::make_view): Assert on zero-length view.
10456 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10457 symbol table when there are no symbols to read.
10459 2008-06-23 Craig Silverstein <csilvers@google.com>
10461 * version.cc (version_string): Bump to 1.7
10463 2008-06-18 Craig Silverstein <csilvers@google.com>
10465 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10466 constant 0xFFFF to type Valtype.
10467 (Powerpc_relocate_functions::rel16_ha): Likewise.
10469 2008-06-17 Ian Lance Taylor <iant@google.com>
10471 * output.h (Output_section::Input_section): Initialize p2align_ to
10472 zero for Output_section_data constructors.
10473 (Output_section::Input_section::addralign): If not an input
10474 section, return the alignment of the Output_section_data.
10475 * testsuite/copy_test.cc: New file.
10476 * testsuite/copy_test_1.cc: New file.
10477 * testsuite/copy_test_2.cc: New file.
10478 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10479 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10480 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10481 (copy_test_1_pic.o, copy_test_1.so): New targets.
10482 (copy_test_2_pic.o, copy_test_2.so): New targets.
10483 * testsuite/Makefile.in: Rebuild.
10485 * script-sections.cc (Script_sections::place_orphan): Initialize
10486 local variable exact.
10488 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10490 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10492 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10493 David S. Miller <davem@davemloft.net>
10495 * powerpc.cc: New file.
10496 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10497 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10498 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10499 * Makefile.in: Rebuild.
10501 2008-06-09 Ian Lance Taylor <iant@google.com>
10503 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10505 (throwing, orig_terminate): New static variables.
10506 (terminate_handler): New static function.
10507 (t2): Set terminate handler.
10509 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10512 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10515 2008-05-30 Cary Coutant <ccoutant@google.com>
10517 * archive.cc (Archive::include_all_members) Correct to step
10518 over symbol table and extended name table in thin archives.
10520 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10523 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10526 2008-05-28 Caleb Howe <cshowe@google.com>
10528 * reduced_debug_output.cc: New file.
10529 * reduced_debug_output.h: New file.
10530 * options.h (class General_options): Add --strip-debug-non-line.
10531 * options.cc (General_options::finalize): Add strip_debug_non_line
10532 to the strip heirarchy.
10533 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10535 * layout.cc: Include "reduced_debug_output.h".
10536 (Layout::Layout): Initialize new fields.
10537 (line_only_debug_sections): New static array.
10538 (is_lines_only_debug_sections): New static inline function.
10539 (Layout::include_section): Handle --strip-debug-non-line.
10540 (Layout::make_output_section): If --strip-debug-non-line, build
10541 new output sections for .debug_abbrev and .debug_info.
10542 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10543 gold. Warn about possible overflow.
10544 (read_signed_LEB_128): Likewise.
10545 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10546 (read_signed_LEB_128): Declare.
10547 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10548 (HFILES): Add reduced_debug_output.h.
10549 * Makefile.in: Rebuild.
10551 2008-05-21 Ian Lance Taylor <iant@google.com>
10553 * mapfile.cc: New file.
10554 * mapfile.h: New file.
10555 * options.h (class General_options): Add -M/--print-map and -Map.
10556 * options.cc (General_options::finalize): Make -M equivalent to
10558 * main.cc: Include <cstdio> and "mapfile.h".
10559 (main): Open mapfile if requested.
10560 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10561 constructor. Change caller.
10562 (queue_initial_tasks): Add mapfile parameter. Change caller.
10563 (queue_middle_tasks): Likewise.
10564 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10566 * archive.cc: Include "mapfile.h".
10567 (Archive::add_symbols): Add mapfile parameter. Change all
10568 callers. Pass mapfile, symbol, and reason to include_member.
10569 (Archive::include_all_members): Add mapfile parameter. Change all
10571 (Archive::include_member): Add mapfile, sym, and why parameters.
10572 Change all callers. Report inclusion to map file.
10573 * archive.h: Include "fileread.h".
10574 (class Archive): Update declarations.
10575 (Archive::file): New const method.
10576 (class Add_archive_symbols): Add mapfile_ field. Update
10577 constructor. Change all callers.
10578 * readsyms.h (class Read_symbols): Likewise.
10579 (class Finish_group): Likewise.
10580 (class Read_script): Likewise.
10581 * common.cc: Include "mapfile.h".
10582 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10584 (Symbol_table::do_allocate_commons): Likewise.
10585 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10586 symbol allocation to mapfile.
10587 * common.h (class Allocate_commons_task): Add mapfile_ field.
10588 Update constructor. Change all callers.
10589 * symtab.h (class Symbol_table): Update declarations.
10590 * layout.cc: Include "mapfile.h".
10591 (Layout_task_runner::run): Print information to mapfile.
10592 (Layout::create_gold_note): Change Output_data_fixed_space to
10593 Output_data_zero_fill.
10594 (Layout::create_build_id): Likewise.
10595 (Layout::print_to_mapfile): New function.
10596 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10597 constructor. Change caller.
10598 (class Layout): Declare print_to_mapfile.
10599 * output.cc (Output_section::Input_section::print_to_mapfile): New
10601 (Output_section::add_input_section): If producing a map, always
10602 add to input_sections_ list.
10603 (Output_section::do_print_to_mapfile): New function.
10604 (Output_segment::print_sections_to_mapfile): New function.
10605 (Output_segment::print_section_list_to_mapfile): New function.
10606 * output.h: Include "mapfile.h".
10607 (Output_data::print_to_mapfile): New function.
10608 (Output_data::do_print_to_mapfile): New virtual function.
10609 (Output_segment_headers::do_print_to_mapfile): New function.
10610 (Output_file_header::do_print_to_mapfile): New function.
10611 (Output_data_const::do_print_to_mapfile): New function.
10612 (class Output_data_const_buffer): Add map_name_ field. Update
10613 constructor. Change all callers. Add do_print_to_mapfile
10615 (class Output_data_fixed_space): Likewise.
10616 (class Output_data_space): Likewise.
10617 (class Output_data_zero_fill): New class.
10618 (Output_data_strtab::do_print_to_mapfile): New function.
10619 (Output_data_reloc_base::do_print_to_mapfile): New function.
10620 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10621 (Output_data_group::do_print_to_mapfile): New function.
10622 (Output_data_got::do_print_to_mapfile): New function.
10623 (Output_data_dynamic::do_print_to_mapfile): New function.
10624 (Output_symtab_xindex::do_print_to_mapfile): New function.
10625 (class Output_section): Declare do_print_to_mapflie. Declare
10626 print_to_mapfile in Input_section.
10627 (class Output_segment): Declare new functions.
10628 * object.h (Sized_relobj::symbol_count): New function.
10629 * script-sections.cc
10630 (Output_section_element_dot_assignment::set_section_addresses):
10631 Change Output_data_fixed_space to Output_data_zero_fill.
10632 (Output_data_expression::do_print_to_mapfile): New function.
10633 * script.cc (read_input_script): Add mapfile parameter. Change
10635 * script.h (read_input_script): Update declaration.
10636 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10637 (Eh_frame::do_print_to_mapfile): New function.
10638 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10639 (Output_merge_string::do_print_to_mapfile): New function.
10640 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10642 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10644 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10646 * Makefile.am (CCFILES): Add mapfile.cc.
10647 (HFILES): Add mapfile.h.
10648 * Makefile.in: Rebuild.
10650 2008-05-19 Ian Lance Taylor <iant@google.com>
10652 * options.h (class General_options): Add -z relro.
10653 * layout.cc (Layout::Layout): Initialize relro_segment_.
10654 (Layout::add_output_section_data): Return the output section.
10655 (Layout::make_output_section): Rcognize relro sections and mark
10656 them appropriately.
10657 (Layout::attach_allocated_section_to_segment): Put relro sections
10658 in a PT_GNU_RELRO segment.
10659 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10661 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10663 (Layout::linkonce_mapping): Map d.rel.ro.local to
10664 .data.rel.ro.local.
10665 (Layout::output_section_name): Us .data.rel.ro.local for any
10666 section which begins with that.
10667 * layout.h (class Layout): Update add_output_section_data
10668 declaration. Add relro_segment_ field.
10669 * output.cc (Output_section::Output_section): Initialize is_relro_
10670 and is_relro_local_ fields.
10671 (Output_segment::add_output_section): Group relro sections.
10672 (Output_segment::is_first_section_relro): New function.
10673 (Output_segment::maximum_alignment): If there is a relro section,
10674 align the segment to the common page size.
10675 (Output_segment::set_section_addresses): Track whether we are
10676 looking at relro sections. If the last section is a relro
10677 section, align to the common page size.
10678 (Output_segment::set_section_list_addresses): Add in_relro
10679 parameter. Change all callers. Align to the page size when
10680 moving from relro to non-relro section.
10681 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10683 * output.h (class Output_section): Add is_relro_ and
10684 is_relro_local_ fields.
10685 (Output_section::is_relro): New function.
10686 (Output_section::set_is_relro): New function.
10687 (Output_section::is_relro_local): New function.
10688 (Output_section::set_is_relro_local): New function.
10689 (class Output_segment): Update declarations.
10690 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10691 * sparc.cc (Target_sparc::got_section): Likewise.
10692 * x86_64.cc (Target_x86_64::got_section): Likewise.
10693 * testsuite/relro_test_main.cc: New file.
10694 * testsuite/relro_test.cc: New file.
10695 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10696 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10697 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10698 (relro_test.so, relro_test_pic.o): New targets.
10699 * testsuite/Makefile.in: Rebuild.
10701 2008-05-16 Ian Lance Taylor <iant@google.com>
10703 * output.cc (Output_segment::add_output_section): Remove front
10705 * output.h (class Output_segment): Remove
10706 add_initial_output_section and overloaded add_output_section.
10707 Update declaration of remaining add_output_section.
10708 * layout.cc (Layout::create_interp): Call add_output_section
10709 rather than add_initial_output_section.
10710 (Layout::finish_dynamic_section): Likewise.
10712 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10713 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10714 know the dynamic type.
10715 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10716 field. Initialize it in constructor.
10717 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10718 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10719 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10722 * output.cc (Output_reloc::get_address): Change return type to
10724 * output.h (class Output_reloc): Update get_address declaration.
10725 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10726 for section addresses.
10728 2008-05-09 Ian Lance Taylor <iant@google.com>
10731 * gold.cc (gold_nomem): Use return value of write.
10733 2008-05-08 Ian Lance Taylor <iant@google.com>
10735 * symtab.c (Symbol::init_base_output_data): Add version
10736 parameter. Change all callers.
10737 (Symbol::init_base_output_segment): Likewise.
10738 (Symbol::init_base_constant): Likewise.
10739 (Symbol::init_base_undefined): Likewise.
10740 (Sized_symbol::init_output_data): Likewise.
10741 (Sized_symbol::init_output_segment): Likewise.
10742 (Sized_symbol::init_constant): Likewise.
10743 (Sized_symbol::init_undefined): Likewise.
10744 (Symbol_table::do_define_in_output_data): If the new symbol has a
10745 version, mark it as the default.
10746 (Symbol_table::do_define_in_output_segment): Likewise.
10747 (Symbol_table::do_define_as_constant): Likewise.
10748 * symtab.h (class Symbol): Update declarations.
10749 (class Sized_symbol): Likewise.
10750 * resolve.cc (Symbol::override_version): New function.
10751 (Symbol::override_base): Call override_version.
10752 (Symbol::override_base_with_special): Likewise.
10753 * testsuite/ver_script_8.script: New file.
10754 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10755 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10756 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10757 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10759 2008-05-06 Ian Lance Taylor <iant@google.com>
10762 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10764 (class General_options): Remove existing --undefined, and add
10765 --no-undefined instead. Add new --undefined as synonym for -u.
10766 * archive.cc (Archive::add_symbols): Check whether symbol was
10768 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10769 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10770 all uses. Add IS_UNDEFINED. Update declarations to split
10771 different versions of init_base. Declare init_base_undefined.
10772 (Symbol::is_defined): Handle IS_UNDEFINED.
10773 (Symbol::is_undefined): Likewise.
10774 (Symbol::is_weak_undefined): Call is_undefined.
10775 (Symbol::is_absolute): Handle IS_CONSTANT.
10776 (class Sized_symbol): Update declarations to split different
10777 versions of init. Declare init_undefined.
10778 (class Symbol_table): Declare new functions.
10779 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10780 Change all callers.
10781 (Symbol::init_base_output_data): Likewise.
10782 (Symbol::init_base_output_segment): Likewise.
10783 (Symbol::init_base_constant): Likewise.
10784 (Symbol::init_base_undefined): New function.
10785 (Sized_symbol::init_object): Rename from init. Change all
10787 (Sized_symbol::init_output_data): Likewise.
10788 (Sized_symbol::init_output_segment): Likewise.
10789 (Sized_symbol::init_constant): Likewise.
10790 (Sized_symbol::init_undefined): New function.
10791 (Symbol_table::add_undefined_symbols_from_command_line): New
10793 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10795 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10796 (Symbol::output_section): Likewise.
10797 (Symbol::set_output_section): Likewise.
10798 (Symbol_table::sized_finalize_symbol): Likewise.
10799 (Symbol_table::sized_write_globals): Likewise.
10800 * resolve.cc (Symbol_table::should_override): Likewise.
10801 (Symbol::override_base_with_special): Likewise.
10803 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10804 symbol, change it to have default visibility.
10805 * testsuite/protected_1.cc: New file.
10806 * testsuite/protected_2.cc: New file.
10807 * testsuite/protected_3.cc: New file.
10808 * testsuite/protected_main_1.cc: New file.
10809 * testsuite/protected_main_2.cc: New file.
10810 * testsuite/protected_main_3.cc: New file.
10811 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10812 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10813 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10814 (protected_1.so): New target.
10815 (protected_1_pic.o, protected_2_pic.o): New targets.
10816 (protected_3_pic.o): New target.
10817 (check_PROGRAMS): Add protected_2.
10818 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10819 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10820 * testsuite/Makefile.in: Rebuild.
10822 * options.h (DEFINE_var): Add set_user_set_##varname__.
10823 (DEFINE_bool_alias): New macro.
10824 (class General_options): Define -Bstatic using DEFINE_bool_alias
10825 rather than DEFINE_special. Add --undefined as an alias for -z
10827 * options.cc (General_options::parse_Bstatic): Remove.
10829 * options.h (class General_options): Add --fatal-warnings.
10830 * main.cc (main): Implement --fatal-warnings.
10831 * errors.h (Errors::warning_count): New function.
10833 * options.h (class General_options): Add -Bsymbolic-functions.
10834 * symtab.h (Symbol::is_preemptible): Check for
10835 -Bsymbolic-functions.
10837 2008-05-05 Ian Lance Taylor <iant@google.com>
10839 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10840 as noVARNAME rather than no-VARNAME.
10841 (class General_options): Add option -z combreloc.
10842 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10844 (Output_reloc::sort_before) [SHT_REL]: New function.
10845 (Output_reloc::sort_before) [SHT_RELA]: New function.
10846 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10847 Sort_relocs_comparison.
10848 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10849 parameter. Change all callers.
10850 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10851 sort_relocs parameter. Change all callers.
10852 * output.cc (Output_reloc::get_address): New function, broken out
10854 (Output_reloc::write_rel): Call it.
10855 (Output_reloc::compare): New function.
10856 (Output_data_reloc_base::do_write): Optionally sort relocs.
10858 * configure.ac: If targ_extra_obj is set, link it in.
10859 * configure.tgt: Initialize all variables.
10860 (x86_64*): Set targ_extra_obj and targ_extra_size.
10861 * configure: Rebuild.
10863 * object.cc (Sized_relobj::include_section_group): Adjust section
10864 indexes read from group data. Build vector to pass to
10866 * layout.cc (Layout::layout_group): Add flags and shndxes
10867 parameters. Remove contents parameter. Change caller. Update
10868 explicit instantiations.
10869 * layout.h (class Layout): Update layout_group declaration.
10870 * output.cc (Output_data_group::Output_data_group): Add flags and
10871 input_shndxes parameters. Remove contents parameter. Change
10873 (Output_data_group::do_write): Change input_sections_ to
10875 * output.h (class Output_data_group): Update constructor
10876 declaration. Rename input_sections_ to input_shndxes_.
10877 * testsuite/many_sections_test.cc: Add template.
10879 2008-04-30 Cary Coutant <ccoutant@google.com>
10881 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10883 * layout.cc (Layout::include_section): Refactored check for debug
10885 (Layout::add_comdat): Add new parameters. Change type
10886 of signature parameter. Add object and shndx to signatures table.
10887 (Layout::find_kept_object): New function.
10888 * layout.h: Include <cstring>.
10889 (Layout::is_debug_info_section): New function.
10890 (Layout::add_comdat): Add new parameters.
10891 (Layout::find_kept_object): New function.
10892 (Layout::Kept_section): New struct.
10893 (Layout::Signatures): Change type of map range.
10894 * object.cc (Relobj::output_section_address): New function.
10895 (Sized_relobj::include_section_group): Add new parameters. Change
10896 calls to Layout::add_comdat. Change to build table of kept comdat
10897 groups and table mapping discarded sections to kept sections.
10898 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10899 (Sized_relobj::do_layout): Change calls to include_section_group and
10900 include_linkonce_section.
10901 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10902 value to zero when section is discarded.
10903 (Sized_relobj::map_to_kept_section): New function.
10904 * object.h (Relobj::output_section_address): New function.
10905 (Relobj::Comdat_group): New type.
10906 (Relobj::find_comdat_group): New function.
10907 (Relobj::Comdat_group_table): New type.
10908 (Relobj::Kept_comdat_section): New type.
10909 (Relobj::Kept_comdat_section_table): New type.
10910 (Relobj::add_comdat_group): New function.
10911 (Relobj::set_kept_comdat_section): New function.
10912 (Relobj::get_kept_comdat_section): New function.
10913 (Relobj::comdat_groups_): New field.
10914 (Relobj::kept_comdat_sections_): New field.
10915 (Symbol_value::input_value): Update comment.
10916 (Sized_relobj::map_to_kept_section) New function.
10917 (Sized_relobj::include_linkonce_section): Add new parameter.
10918 * target-reloc.h (Comdat_behavior): New type.
10919 (get_comdat_behavior): New function.
10920 (relocate_section): Add code to map a discarded section to the
10921 corresponding kept section when applying a relocation.
10923 2008-04-30 Craig Silverstein <csilvers@google.com>
10925 * dwarf_reader.cc (next_generation_count): New static var.
10926 (Addr2line_cache_entry): New struct.
10927 (addr2line_cache): New static var.
10928 (Dwarf_line_info::one_addr2line): Added caching.
10929 (Dwarf_line_info::clear_addr2line_cache): New function.
10930 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10931 cache-size parameter.
10932 (Dwarf_line_info::one_addr2line_cache): New function.
10933 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10934 new cache-size argument to one_addr2line(), and clear cache.
10936 2008-04-28 Cary Coutant <ccoutant@google.com>
10938 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10939 R_386_PC8 relocations.
10941 2008-04-23 Ian Lance Taylor <iant@google.com>
10943 * object.cc (Sized_relobj::include_section_group): Check for
10944 invalid section group.
10946 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10949 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10950 than read for file header.
10951 * archive.cc (Archive::include_member): Likewise.
10953 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10955 * aclocal.m4: Regenerate.
10956 * configure: Regenerate.
10958 2008-04-19 Ian Lance Taylor <iant@google.com>
10960 * version.cc (version_string): Bump to 1.6.
10962 * testsuite/Makefile.am (many_sections_r_test): New target.
10963 (many_sections_r_test_SOURCES): Remove.
10964 (many_sections_r_test_DEPENDENCIES): Remove.
10965 (many_sections_r_test_LDFLAGS): Remove.
10966 (many_sections_r_test_LDADD): Remove.
10968 * object.cc (Sized_relobj::do_add_symbols): Always pass
10969 local_symbol_count_ to add_from_relobj.
10971 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10972 every thousand variables.
10973 * testsuite/Makefile.in: Rebuild.
10975 * object.cc (Xindex::initialize_symtab_xindex): New function.
10976 (Xindex::read_symtab_xindex): New function.
10977 (Xindex::sym_xindex_to_shndx): New function.
10978 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10980 (Sized_relobj::do_initialize_xindex): New function.
10981 (Sized_relobj::do_read_symbols): Adjust section links.
10982 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10983 parameter. Change all callers.
10984 (Sized_relobj::include_section_group): Adjust section links and
10985 symbol section indexes.
10986 (Sized_relobj::do_layout): Adjust section links.
10987 (Sized_relobj::do_count_local_symbols): Adjust section links and
10988 symbol section indexes.
10989 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10990 ordinary and special symbols.
10991 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10992 dynsym_xindex parameters. Change all callers. Adjust section
10993 links. Use SHN_XINDEX when needed.
10994 (Sized_relobj::get_symbol_location_info): Adjust section links.
10995 Don't get fooled by special symbols.
10996 * object.h (class Xindex): Define.
10997 (class Object): Add xindex_ parameter. Declare virtual functoin
10998 do_initialize_xindex.
10999 (Object::adjust_sym_shndx): New function.
11000 (Object::set_xindex): New protected function.
11001 (class Symbol_value): Add is_ordinary_shndx_ field.
11002 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11003 (Symbol_value::value): Assert ordinary section.
11004 (Symbol_value::initialize_input_to_output_map): Likewise.
11005 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11006 Change all callers.
11007 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11009 (class Sized_relobj): Update declarations.
11010 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11011 parameter. Change all callers.
11012 (Sized_relobj::adjust_shndx): New function.
11013 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11015 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11016 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11017 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11018 (Sized_dynobj::read_dynsym_section): Adjust section links.
11019 (Sized_dynobj::read_dynamic): Likewise.
11020 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11022 (Sized_dynobj::do_initialize_xindex): New function.
11023 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11024 do_initialize_xindex.
11025 (Sized_dynobj::adjust_shndx): New function.
11026 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11027 dynsym_xindex_ fields.
11028 (Layout::finalize): Add a call to set_section_indexes before
11029 creating the symtab sections.
11030 (Layout::set_section_indexes): Don't do anything if the section
11031 already has a section index.
11032 (Layout::create_symtab_sections): Add shnum parameter. Change
11033 caller. Create .symtab_shndx section if needed.
11034 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11036 (Layout::allocated_output_section_count): New function.
11037 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11039 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11040 fields. Update declarations.
11041 (Layout::symtab_xindex): New function.
11042 (Layout::dynsym_xindex): New function.
11043 (class Write_symbols_task): Add layout_ field.
11044 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11046 * output.cc (Output_section_headers::Output_section_headers): Add
11047 shstrtab_section parameter. Change all callers.
11048 (Output_section_headers::do_sized_write): Store overflow values
11049 for section count and section string table section index in
11050 section header zero.
11051 (Output_file_header::do_sized_write): Check for overflow of
11052 section count and section string table section index.
11053 (Output_symtab_xindex::do_write): New function.
11054 (Output_symtab_xindex::endian_do_write): New function.
11055 * output.h (class Output_section_headers): Add shstrtab_section_.
11056 Update declarations.
11057 (class Output_symtab_xindex): Define.
11058 (Output_section::has_out_shndx): New function.
11059 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11061 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11062 Change all callers.
11063 (Sized_symbol::init): Likewise.
11064 (Symbol::output_section): Check for ordinary symbol.
11065 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11066 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11068 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11069 Change all callers. Simplify handling of symbols from sections
11070 not included in the link.
11071 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11073 (Weak_alias_sorter::operator()): Assert that symbols are
11075 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11077 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11078 parameters. Change all callers.
11079 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11080 symbol distinction. Use SHN_XINDEX when needed.
11081 (Symbol_table::write_section_symbol): Add symtab_xindex
11082 parameter. Change all callers.
11083 (Symbol_table::sized_write_section_symbol): Likewise. Use
11084 SHN_XINDEX when needed.
11085 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11087 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11088 (Symbol::is_defined): Check is_ordinary.
11089 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11090 (Symbol::is_absolute, Symbol::is_common): Likewise.
11091 (class Sized_symbol): Update declarations.
11092 (class Symbol_table): Update declarations.
11093 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11094 parameters. Change all callers.
11095 (Sized_symbol::override): Likewise.
11096 (Symbol_table::override): Likewise.
11097 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11098 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11099 is_ordinary, and orig_st_shndx parameters. Change all callers.
11100 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11101 to be in an ordinary section.
11102 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11103 object and is_ordinary parameters. Change all callers.
11104 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11105 Change all callers. Don't add undefined or non-ordinary symbols
11107 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11108 Change all callers.
11109 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11111 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11112 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11113 (Sized_relobj::relocate_sections): Likewise.
11114 * target-reloc.h (scan_relocs): Adjust section symbol index.
11115 (scan_relocatable_relocs): Likewise.
11116 * i386.cc (Scan::local): Check for ordinary symbols.
11117 * sparc.cc (Scan::local): Likewise.
11118 * x86_64.cc (Scan::local): Likewise.
11119 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11120 to symbol_section_and_value.
11121 * testsuite/many_sections_test.cc: New file.
11122 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11123 (check_PROGRAMS): Add many_sections_test.
11124 (many_sections_test_SOURCES): Define.
11125 (many_sections_test_DEPENDENCIES): Define.
11126 (many_sections_test_LDFLAGS): Define.
11127 (BUILT_SOURCES): Add many_sections_define.h.
11128 (many_sections_define.h): New target.
11129 (BUILT_SOURCES): Add many_sections_check.h.
11130 (many_sections_check.h): New target.
11131 (check_PROGRAMS): Add many_sections_r_test.
11132 (many_sections_r_test_SOURCES): Define.
11133 (many_sections_r_test_DEPENDENCIES): Define.
11134 (many_sections_r_test_LDFLAGS): Define.
11135 (many_sections_r_test_LDADD): Define.
11136 (many_sections_r_test.o): New target.
11137 * testsuite/Makefile.in: Rebuild.
11139 2008-04-17 Cary Coutant <ccoutant@google.com>
11141 * errors.cc (Errors::info): New function.
11142 (gold_info): New function.
11143 * errors.h (Errors::info): New function.
11144 * gold.h (gold_info): New function.
11145 * object.cc (Input_objects::add_object): Print trace output.
11146 * options.cc (options::parse_set): New function.
11147 (General_options::parse_wrap): Deleted.
11148 (General_options::General_options): Deleted initializer.
11149 * options.h (options::String_set): New typedef.
11150 (options::parse_set): New function.
11151 (DEFINE_set): New macro.
11152 (General_options::wrap): Changed to use DEFINE_set. Changed
11153 callers of any_wrap_symbols and is_wrap_symbol.
11154 (General_options::trace, General_options::trace_symbol):
11156 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11157 (General_options::wrap_symbols_): Deleted.
11158 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11160 2008-04-17 David S. Miller <davem@davemloft.net>
11162 * options.cc (General_options::parse_V): New function.
11163 * options.h: Add entries for -V and -Qy.
11165 2008-04-17 Ian Lance Taylor <iant@google.com>
11167 * common.cc (Symbol_table::allocate_commons): Remove options
11168 parameter. Change caller.
11169 (Symbol_table::do_allocate_commons): Remove options parameter.
11170 Change caller. Just call do_allocate_commons_list twice.
11171 (Symbol_table::do_allocate_commons_list): New function, broken out
11172 of do_allocate_commons.
11173 * common.h (class Allocate_commons_task): Remove options_ field.
11174 Update constructor.
11175 * symtab.cc (Symbol_table::Symbol_table): Initialize
11177 (Symbol_table::add_from_object): Put TLS common symbols on
11179 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11180 which are IN_OUTPUT_DATA.
11181 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11182 allocate_commons and do_allocate_commons declarations. Declare
11183 do_allocate_commons_list.
11184 * gold.cc (queue_middle_tasks): Update creation of
11185 Allocate_commons_task to not pass options.
11186 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11187 (TLS_TEST_C_FLAGS): New variable.
11188 (tls_test_c_pic.o): New target.
11189 (tls_test_shared.so): Link in tls_test_c_pic.o.
11190 (tls_test_c_pic_ie.o): New target.
11191 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11192 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11193 (tls_test_c.o): New target.
11194 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11195 (tls_pic_test_LDADD): Likewise.
11196 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11197 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11198 (tls_test_c_gnu2.o): New target.
11199 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11201 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11202 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11203 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11204 * testsuite/tls_test.cc: Include "config.h".
11205 (t_last): Call t11_last.
11206 * testsuite/tls_test.h (t11, t11_last): Declare.
11207 * testsuite/tls_test_c.c: New file.
11208 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11209 * configure.ac: Check for OpenMP support.
11210 * configure, config.in, Makefile.in: Rebuild.
11211 * testsuite/Makefile.in: Rebuild.
11213 2008-04-16 Cary Coutant <ccoutant@google.com>
11215 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11216 (Target_i386::tls_base_symbol_defined_): New field.
11217 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11218 (Target_i386::Scan::global): Likewise.
11219 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11220 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11221 (Target_x86_64::tls_base_symbol_defined_): New field.
11222 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11223 (Target_x86_64::Scan::global): Likewise.
11225 2008-04-16 Cary Coutant <ccoutant@google.com>
11227 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11228 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11229 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11230 building shared libraries.
11231 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11232 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11233 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11234 * testsuite/Makefile.in: Rebuild.
11235 * testsuite/weak_undef.h: New file.
11236 * testsuite/weak_undef_file1.cc: Add extra test cases.
11237 * testsuite/weak_undef_file2.cc: Likewise.
11238 * testsuite/weak_undef_test.cc: Likewise.
11240 2008-04-16 David S. Miller <davem@davemloft.net>
11242 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11243 Add issued_non_pic_error_ field. Declare check_non_pic.
11244 (Target_sparc::Scan::check_non_pic): New function.
11245 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11246 (Target_sparc::Scan::global): Likewise.
11248 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11249 * configure: Rebuild.
11251 * options.h (DEFINE_enable): New macro.
11252 (new_dtags): New enable option.
11253 (initfirst, interpose, loadfltr, nodefaultlib,
11254 nodelete, nodlopen, nodump): New -z options.
11255 * layout.cc (Layout:finish_dynamic_section): If new
11256 dtags enabled, emit DT_RUNPATH. Also, emit a
11257 DT_FLAGS_1 containing any specified -z flags.
11259 2008-04-16 Ian Lance Taylor <iant@google.com>
11261 * copy-relocs.cc: New file.
11262 * copy-relocs.h: New file.
11263 * reloc.cc: Remove Copy_relocs code.
11264 * reloc.h: Likewise.
11265 * reloc-types.h (struct Reloc_types) [both versions]: Add
11266 get_reloc_addend_noerror.
11267 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11268 variants of add_global which take an addend which must be zero.
11269 * i386.cc: Include "copy-relocs.h".
11270 (class Target_i386): Change type of copy_relocs_ to variable,
11271 update initializer.
11272 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11273 Change all callers.
11274 (Target_i386::do_finalize_sections): Change handling of
11276 * sparc.cc: Include "copy-relocs.h".
11277 (class Target_sparc): Change type of copy_relocs_ to variable,
11278 update initializer.
11279 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11280 Change all callers.
11281 (Target_sparc::do_finalize_sections): Change handling of
11283 * x86_64.cc: Include "copy-relocs.h".
11284 (class Target_x86_64): Change type of copy_relocs_ to variable,
11285 update initializer.
11286 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11287 class. Change all callers.
11288 (Target_x86_64::do_finalize_sections): Change handling of
11290 * Makefile.am (CCFILES): Add copy-relocs.cc.
11291 (HFILES): Add copy-relocs.h.
11293 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11295 * testsuite/script_test_4.sh: Permit leading zeroes.
11297 2008-04-15 Ian Lance Taylor <iant@google.com>
11299 * script-sections.cc (Script_sections::create_segments): Use
11300 header_size_adjustment even when there is enough room for the
11302 * testsuite/script_test_4.sh: New file.
11303 * testsuite/script_test_4.t: New file.
11304 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11305 (check_DATA): Add script_test_4.stdout.
11306 (MOSTLYCLEANFILES): Likewise.
11307 (script_test_4): New target.
11308 (script_test_4.stdout): New target.
11309 * testsuite/Makefile.in: Rebuild.
11311 * sparc.cc: Add definitions for Output_data_plt_sparc class
11314 2008-04-14 David S. Miller <davem@davemloft.net>
11316 * sparc.cc: New file.
11317 * Makefile.am (TARGETSOURCES): Add sparc.cc
11318 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11319 * configure.tgt: Document targ_extra_size and
11320 targ_extra_big_endian. Add entries for sparc-* and
11322 * configure.ac: Handle targ_extra_size and
11323 targ_extra_big_endian.
11324 * Makefile.in: Rebuild.
11325 * configure: Likewise.
11326 * po/POTFILES.in: Likewise.
11327 * po/gold.pot: Likewise.
11329 2008-04-14 Ian Lance Taylor <iant@google.com>
11331 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11332 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11333 in the name/type/flags to section mapping. Don't call
11334 allocate_output_section.
11335 (Layout::choose_output_section): Change parameter from adjust_name
11336 to is_input_section. Don't permit input sections after sections
11337 are attached to segments. Don't call allocate_output_section.
11338 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11339 not write_enable_output_section.
11340 (Layout::make_output_section): Don't push to
11341 unattached_section_list_ nor call attach_to_segment. Call
11342 attach_section_to_segment if sections are attached.
11343 (Layout::attach_sections_to_segments): New function.
11344 (Layout::attach_section_to_segment): New function.
11345 (Layout::attach_allocated_section_to_segment): Rename from
11346 attach_to_segment. Remove flags parameter.
11347 (Layout::allocate_output_section): Remove function.
11348 (Layout::write_enable_output_section): Remove function.
11349 * layout.h (class Layout): Update for above changes. Add new
11350 field sections_are_attached_.
11351 * output.h (Output_section::update_flags_for_input_section): New
11353 * output.cc (Output_section::add_input_section): Call
11354 update_flags_for_input_section.
11355 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11357 2008-04-11 Cary Coutant <ccoutant@google.com>
11359 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11360 thought unnecessary.
11361 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11363 2008-04-11 Ian Lance Taylor <iant@google.com>
11365 * output.h (class Output_section_data): Remove inline definition
11367 * output.cc (Output_section_data::set_addralign): New function.
11369 2008-04-11 Cary Coutant <ccoutant@google.com>
11371 Add support for TLS descriptors for i386 and x86_64.
11372 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11373 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11374 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11376 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11377 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11378 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11380 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11381 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11382 Fix problem with initial-exec relocations.
11383 (Target_i386::Relocate::relocate_tls): Likewise.
11384 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11386 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11387 support for section-plus-offset dynamic table entries.
11388 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11389 (Output_data_dynamic::Dynamic_entry): Add support for
11390 section-plus-offset dynamic table entries.
11391 (Output_data_dynamic::Classification): Likewise.
11392 (Output_data_dynamic::classification_): Renamed offset_.
11393 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11394 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11395 (Target_x86_64::make_plt_section): New function.
11396 (Target_x86_64::reserve_tlsdesc_entries): New function.
11397 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11398 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11399 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11400 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11401 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11402 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11403 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11404 add extra PLT entry for TLS descriptors.
11405 (Output_data_plt_x86_64::got_): New field.
11406 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11407 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11409 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11411 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11412 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11413 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11414 R_386_TLS_DESC_CALL relocations.
11415 (Target_x86_64::Scan::global): Likewise.
11416 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11417 for TLS descriptors.
11418 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11419 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11420 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11421 GD-to-IE relaxation.
11422 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11423 and TLS_DESCRIPTORS.
11424 * Makefile.in: Rebuild.
11425 * configure: Rebuild.
11426 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11427 (tls_test_shared2.so): New target.
11428 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11429 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11430 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11431 (tls_shared_gd_to_ie_test_LDADD): New variable.
11432 (tls_shared_gnu2_gd_to_ie_test): New target.
11433 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11435 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11436 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11437 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11438 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11439 (tls_shared_gnu2_test): New target.
11440 (tls_test_gnu2_shared.so): New target.
11441 (tls_shared_gnu2_test_SOURCES): New variable.
11442 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11443 (tls_shared_gnu2_test_LDFLAGS): New variable.
11444 (tls_shared_gnu2_test_LDADD): New variable.
11445 * testsuite/Makefile.in: Rebuild.
11446 * testsuite/Makefile.
11448 2008-04-11 Ian Lance Taylor <iant@google.com>
11450 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11452 * testsuite/Makefile.in: Rebuild.
11454 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11456 * testsuite/script_test_2.cc (main): Adjust test.
11458 2008-04-11 David S. Miller <davem@davemloft.net>
11459 Ian Lance Taylor <iant@google.com>
11461 * options.h (General_options): Add entries for '-Y' and
11463 * options.cc (General_options:finalize): If -Y was used, add those
11464 entries to the library path instead of the default "/lib" and
11467 2008-04-11 David S. Miller <davem@davemloft.net>
11469 * testsuite/justsyms.t: Start at 0x100.
11470 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11471 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11473 * testsuite/script_test_2.cc: Adjust string and section length
11476 2008-04-09 Ian Lance Taylor <iant@google.com>
11479 * script-sections.cc (Sections_element::allocate_to_segment): Add
11481 (Output_section_definition::allocate_to_segment): Likewise.
11482 (Orphan_output_section::allocate_to_segment): Likewise.
11483 (Script_sections::attach_sections_using_phdrs_clause): Don't
11484 propagate non-PT_LOAD segments to orphan sections.
11485 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11486 readelf rather than objdump.
11487 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11488 .interp section and PT_INTERP segment are the same size.
11489 * testsuite/Makefile.in: Rebuild.
11491 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11492 aliases for symbols defined in the same object.
11493 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11494 (weak_alias_test_SOURCES): New variable.
11495 (weak_alias_test_DEPENDENCIES): New variable.
11496 (weak_alias_test_LDFLAGS): New variable.
11497 (weak_alias_test_LDADD): New variable.
11498 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11499 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11500 (weak_alias_test_3.o): New target.
11501 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11502 * testsuite/weak_alias_test_main.cc: New file.
11503 * testsuite/weak_alias_test_1.cc: New file.
11504 * testsuite/weak_alias_test_2.cc: New file.
11505 * testsuite/weak_alias_test_3.cc: New file.
11507 2008-04-08 Ian Lance Taylor <iant@google.com>
11509 * options.h (class General_options): Add --noinhibit-exec option.
11510 * main.cc (main): Check --noinhibit-exec.
11512 * options.h (class General_options): Define --wrap as a special
11513 option. Add wrap_symbols_ field.
11514 (General_options::any_wrap_symbols): New function.
11515 (General_options::is_wrap_symbol): New function.
11516 * options.cc (General_options::parse_wrap): New function.
11517 (General_options::General_options): Initialize wrap_symbols_.
11518 * symtab.cc (Symbol_table::wrap_symbol): New function.
11519 (Symbol_table::add_from_object): Handle --wrap.
11520 * symtab.h (class Symbol_table): Declare wrap_symbol.
11521 * target.h (Target::wrap_char): New function.
11522 (Target::Target_info): Add wrap_char field.
11523 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11524 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11525 * testsuite/testfile.cc (Target_test::test_target_info):
11528 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11531 * layout.h (class Layout): Add added_eh_frame_data_ field.
11532 * layout.cc (Layout::Layout): Initialize new field.
11533 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11534 output section until we find a section we merged successfully.
11535 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11536 that the size be non-zero.
11538 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11541 2008-04-08 Craig Silverstein <csilvers@google.com>
11543 * configure.ac: Export new conditional variable HAVE_ZLIB.
11544 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11546 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11547 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11549 2008-04-07 Ian Lance Taylor <iant@google.com>
11551 * version.cc (version_string): Set to "1.5".
11553 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11554 Add issued_non_pic_error_ field. Declare check_non_pic.
11555 (Target_x86_64::Scan::check_non_pic): New function.
11556 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11557 (Target_x86_64::Scan::global): Likewise.
11559 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11560 addend parameter. Change caller. Handle merge sections.
11561 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11562 Address to Addend. Don't add in the result of
11563 local_section_offset, pass down the addend and use the returned
11565 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11566 Update declarations of local_section_offset and symbol_value.
11567 * testsuite/two_file_test_1.cc (t18): New function.
11568 * testsuite/two_file_test_2.cc (f18): New function.
11569 * testsuite/two_file_test_main.cc (main): Call t18.
11570 * testsuite/two_file_test.h (t18, f18): Declare.
11572 * configure.ac: Don't test for objdump, c++filt, or readelf.
11573 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11575 (TEST_READELF): New variable.
11576 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11577 (check_PROGRAMS): Add two_file_strip_test.
11578 (two_file_strip_test): New target.
11579 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11580 (two_file_same_shared_strip_test_SOURCES): New variable.
11581 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11582 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11583 (two_file_same_shared_strip_test_LDADD): New variable.
11584 (two_file_shared_strip.so): New target.
11585 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11586 (ver_test_5.syms, ver_test_7.syms): Likewise.
11587 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11588 (strip_test_3.stdout): Use TEST_OBJDUMP.
11589 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11591 2008-04-04 Cary Coutant <ccoutant@google.com>
11593 * symtab.h (Symbol::is_weak_undefined): New function.
11594 (Symbol::is_strong_undefined): New function.
11595 (Symbol::is_absolute): New function.
11596 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11597 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11599 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11600 (weak_undef_test): New target.
11601 * testsuite/Makefile.in: Rebuild.
11602 * testsuite/weak_undef_file1.cc: New file.
11603 * testsuite/weak_undef_file2.cc: New file.
11604 * testsuite/weak_undef_test.cc: New file.
11606 2008-04-03 Craig Silverstein <csilvers@google.com>
11608 * compressed_output.h (class Output_compressed_section): Use
11610 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11612 (zlib_compressed_suffix): Removed.
11613 (Output_compressed_section::set_final_data_size): Use unsigned
11615 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11616 Fix linker invocation.
11617 (flagstest_o_specialfile_and_compress_debug_sections):
11619 * testsuite/Makefile.in: Regenerated.
11621 2008-04-02 David S. Miller <davem@davemloft.net>
11623 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11624 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11626 2008-04-02 Craig Silverstein <csilvers@google.com>
11630 2008-04-02 Ian Lance Taylor <iant@google.com>
11632 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11633 parameters. Update for new key type to views_. Change all
11635 (File_read::read): Adjust for byteshift in returned view.
11636 (File_read::add_view): New function, broken out of
11637 find_and_make_view.
11638 (File_read::make_view): New function, broken out of
11639 find_and_make_view.
11640 (File_read::find_or_make_view): Add offset and aligned
11641 parameters. Rewrite accordingly. Change all callers.
11642 (File_read::get_view): Add offset and aligned parameters. Adjust
11643 for byteshift in return value.
11644 (File_read::get_lasting_view): Likewise.
11645 * fileread.h (class File_read): Update declarations.
11646 (class File_read::View): Add byteshift_ field. Add byteshift to
11647 constructor. Add byteshift method.
11648 * archive.h (Archive::clear_uncached_views): New function.
11649 (Archive::get_view): Add aligned parameter. Change all callers.
11650 * object.h (Object::get_view): Add aligned parameter. Change all
11652 (Object::get_lasting_view): Likewise.
11654 * fileread.cc (File_read::release): Don't call clear_views if
11655 there are multiple objects.
11656 * fileread.h (File_read::clear_uncached_views): New function.
11657 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11660 2008-03-31 Cary Coutant <ccoutant@google.com>
11662 Add thin archive support.
11663 * archive.cc (Archive::armagt): New const.
11664 (Archive::setup): Remove task parameter and calls to unlock.
11665 (Archive::unlock_nested_archives): New function.
11666 (Archive::read_header): Add nested_off parameter. Change
11668 (Archive::interpret_header): Likewise.
11669 (Archive::include_all_members): Change to handle thin
11671 (Archive::include_member): Likewise.
11672 * archive.h (Archive::Archive): Add new parameters and
11674 (Archive::armagt): New const.
11675 (Archive::setup): Remove task parameter.
11676 (Archive::unlock_nested_archives): New function.
11677 (Archive::read_header): Add nested_off parameter.
11678 (Archive::interpret_header): Likewise.
11679 (Archive::Nested_archive_table): New typedef.
11680 (Archive::is_thin_archive_): New field.
11681 (Archive::nested_archives_): New field.
11682 (Archive::options_): New field.
11683 (Archive::dirpath_): New field.
11684 (Archive::task_): New field.
11685 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11686 for thin archives. Pass additional parameters to
11687 Archive::Archive. Unlock the archive file after calling
11690 2008-03-29 Ian Lance Taylor <iant@google.com>
11692 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11693 version symbol to be local.
11694 * testsuite/ver_test_4.sh: New file.
11695 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11696 (check_DATA): Add ver_test_4.syms.
11697 (ver_test_4.syms): New target.
11698 * testsuite/Makefile.in: Rebuild.
11701 (Output_section::Input_section_sort_entry::has_priority): New
11703 (Output_section::Input_section_sort_entry::match_file_name): New
11705 (Output_section::Input_section_sort_entry::match_section_name):
11707 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11709 (Output_section::Input_section_sort_entry::match_section_file):
11711 (Output_section::Input_section_sort_compare::operator()): Rewrite
11712 using new Input_section_sort_entry functions. Sort crtbegin and
11713 crtend first. Sort sections with no priority before sections with
11715 * testsuite/initpri1.c (d3): Check j != 4.
11716 (cd5): New constructor/destructor function.
11717 (main): Check j != 2.
11719 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11720 new symbol when resolving, don't call set_is_default.
11721 * testsuite/ver_test_7.cc: New file.
11722 * testsuite/ver_test_7.sh: New file.
11723 * testsuite/Makefile.am (ver_test_7.so): New target.
11724 (ver_test_7.o): New target.
11725 (check_SCRIPTS): Add ver_test_7.sh.
11726 (check_DATA): Add ver_test_7.syms.
11727 (ver_test_7.syms): New target.
11729 2008-03-28 Ian Lance Taylor <iant@google.com>
11731 * layout.cc (Layout::layout): If we see an input section with a
11732 name that needs sorting, set the must_sort flag for the output
11734 (Layout::make_output_section): If the name of the output section
11735 indicates that it might require sorting, set the may_sort flag.
11736 * output.h (Output_section::may_sort_attached_input_sections): New
11738 (Output_section::set_may_sort_attached_input_sections): New
11740 (Output_section::must_sort_attached_input_sections): New
11742 (Output_section::set_must_sort_attached_input_sections): New
11744 (class Output_section): Declare Input_section_sort_entry. Define
11745 Input_section_sort_compare. Declare
11746 sort_attached_input_sections. Add new fields:
11747 may_sort_attached_input_sections_,
11748 must_sort_attached_input_sections_,
11749 attached_input_sections_are_sorted_.
11750 * output.cc (Output_section::Output_section): Initialize new
11752 (Output_section::add_input_section): Add an entry to
11753 input_sections_ if may_sort or must_sort are true.
11754 (Output_section::set_final_data_size): Call
11755 sort_attached_input_sections if necessary.
11756 (Output_section::Input_section_sort_entry): Define new class.
11757 (Output_section::Input_section_sort_compare::operator()): New
11759 (Output_section::sort_attached_input_sections): New function.
11760 * configure.ac: Check whether the compiler supports constructor
11761 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11762 * testsuite/initpri1.c: New file.
11763 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11764 CONSTRUCTOR_PRIORITY.
11765 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11766 (initpri1_LDFLAGS): New variable.
11767 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11769 2008-03-27 Ian Lance Taylor <iant@google.com>
11771 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11772 * testsuite/common_test_1.c: New file.
11773 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11774 (common_test_1_SOURCES): New variable.
11775 (common_test_1_DEPENDENCIES): New variable.
11776 (common_test_1_LDFLAGS): New variable.
11778 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11779 and commons_ correctly when NAME/VERSION does not override
11781 * testsuite/ver_test_6.c: New file.
11782 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11783 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11784 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11786 2008-03-26 Ian Lance Taylor <iant@google.com>
11788 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11789 of an undefined symbol from a version script.
11790 * testsuite/Makefile.am (ver_test_5.so): New target.
11791 (ver_test_5.o): New target.
11792 (check_SCRIPTS): Add ver_test_5.sh.
11793 (check_DATA): Add ver_test_5.syms.
11794 (ver_test_5.syms): New target.
11795 * testsuite/ver_test_5.cc: New file.
11796 * testsuite/ver_test_5.script: New file.
11797 * testsuite/ver_test_5.sh: New file.
11798 * Makefile.in, testsuite/Makefile.in: Rebuild.
11801 Fix problems building gold with gcc 4.3.0.
11802 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11803 (gold_error_at_location, gold_warning_at_location): Use it.
11804 * configure.ac: Check whether we can compile and use a template
11805 function with a printf attribute.
11806 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11807 when jumping over bytes.
11808 * object.cc: Instantiate Object::read_section_data.
11809 * debug.h: Include <cstring>
11810 * dwarf_reader.cc: Include <algorithm>
11811 * main.cc: Include <cstring>.
11812 * options.cc: Include <cstring>.
11813 * output.cc: Include <cstring>.
11814 * script.cc: Include <cstring>.
11815 * script.h: Include <string>.
11816 * symtab.cc: Include <cstring> and <algorithm>.
11817 * target-select.cc: Include <cstring>.
11818 * version.cc: Include <string>.
11819 * testsuite/testmain.cc: Include <cstdlib>.
11820 * configure, config.in: Rebuild.
11822 2008-03-25 Ian Lance Taylor <iant@google.com>
11824 * options.cc: Include "../bfd/bfdver.h".
11825 (options::help): Print bug reporting address.
11827 * version.cc (print_version): Adjust output for current value of
11828 BFD_VERSION_STRING.
11832 * options.cc (options::help): Print list of supported targets.
11833 * target-select.h: Include <vector>.
11834 (class Target_selector): Make machine_, size_, and is_big_endian_
11835 fields const. Add bfd_name_ and instantiated_target_ fields.
11836 (Target_selector::Target_selector): Add bfd_name parameter.
11837 (Target_selector::recognize): Make non-virtual, call
11839 (Target_selector::recognize_by_name): Make non-virtual, call
11840 do_recognize_by_name.
11841 (Target_selector::supported_names): New function.
11842 (Target_selector::bfd_name): New function.
11843 (Target_selector::do_instantiate_target): New pure virtual
11845 (Target_selector::do_recognize): New virtual function.
11846 (Target_selector::do_recognize_by_name): New virtual function.
11847 (Target_selector::instantiate_target): New private function.
11848 (supported_target_names): Declare.
11849 * target-select.cc (Target_selector::Target_selector): Update for
11850 new parameter and fields.
11851 (select_target_by_name): Check that the name matches before
11852 calling recognize_by_name.
11853 (supported_target_names): New function.
11854 * i386.cc (class Target_selector_i386): Update Target_selector
11855 constructor call. Remove recognize and recognize_by_name. Add
11856 do_instantiate_target.
11857 * x86_64.cc (class Target_selector_x86_64): Likewise.
11858 * testsuite/testfile.cc (class Target_selector_test): Update for
11859 changes to Target_selector.
11861 * README: Rewrite, with some notes on unsupported features.
11863 2008-03-24 Cary Coutant <ccoutant@google.com>
11865 * i386.cc (Target_i386::Got_type): New enum declaration.
11866 (Target_i386::Scan::local): Updated callers of Output_data_got
11868 (Target_i386::Scan::global): Likewise.
11869 (Target_i386::Relocate::relocate): Likewise.
11870 (Target_i386::Relocate::relocate_tls): Likewise.
11871 * object.h (Got_offset_list): New class.
11872 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11873 (Sized_relobj::local_got_offset): Likewise.
11874 (Sized_relobj::set_local_got_offset): Likewise.
11875 (Sized_relobj::local_has_tls_got_offset): Removed.
11876 (Sized_relobj::local_tls_got_offset): Removed.
11877 (Sized_relobj::set_local_tls_got_offset): Removed.
11878 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11879 * output.cc (Output_data_got::add_global): Added got_type parameter.
11880 (Output_data_got::add_global_with_rel): Likewise.
11881 (Output_data_got::add_global_with_rela): Likewise.
11882 (Output_data_got::add_global_pair_with_rel): New function.
11883 (Output_data_got::add_global_pair_with_rela): New function.
11884 (Output_data_got::add_local): Added got_type parameter.
11885 (Output_data_got::add_local_with_rel): Likewise.
11886 (Output_data_got::add_local_with_rela): Likewise.
11887 (Output_data_got::add_local_pair_with_rel): New function.
11888 (Output_data_got::add_local_pair_with_rela): New function.
11889 (Output_data_got::add_global_tls): Removed.
11890 (Output_data_got::add_global_tls_with_rel): Removed.
11891 (Output_data_got::add_global_tls_with_rela): Removed.
11892 (Output_data_got::add_local_tls): Removed.
11893 (Output_data_got::add_local_tls_with_rel): Removed.
11894 (Output_data_got::add_local_tls_with_rela): Removed.
11895 * output.h (Output_data_got::add_global): Added got_type parameter.
11896 (Output_data_got::add_global_with_rel): Likewise.
11897 (Output_data_got::add_global_with_rela): Likewise.
11898 (Output_data_got::add_global_pair_with_rel): New function.
11899 (Output_data_got::add_global_pair_with_rela): New function.
11900 (Output_data_got::add_local): Added got_type parameter.
11901 (Output_data_got::add_local_with_rel): Likewise.
11902 (Output_data_got::add_local_with_rela): Likewise.
11903 (Output_data_got::add_local_pair_with_rel): New function.
11904 (Output_data_got::add_local_pair_with_rela): New function.
11905 (Output_data_got::add_global_tls): Removed.
11906 (Output_data_got::add_global_tls_with_rel): Removed.
11907 (Output_data_got::add_global_tls_with_rela): Removed.
11908 (Output_data_got::add_local_tls): Removed.
11909 (Output_data_got::add_local_tls_with_rel): Removed.
11910 (Output_data_got::add_local_tls_with_rela): Removed.
11911 * resolve.cc (Symbol::override_base_with_special): Removed
11912 reference to has_got_offset_ field.
11913 * symtab.cc (Symbol::init_fields): Replaced initialization
11914 of got_offset_ with got_offsets_. Removed initialization
11916 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11917 (Symbol::got_offset): Likewise.
11918 (Symbol::set_got_offset): Likewise.
11919 (Symbol::has_tls_got_offset): Removed.
11920 (Symbol::tls_got_offset): Removed.
11921 (Symbol::set_tls_got_offset): Removed.
11922 (Symbol::got_offset_): Removed.
11923 (Symbol::tls_mod_got_offset_): Removed.
11924 (Symbol::tls_pair_got_offset_): Removed.
11925 (Symbol::got_offsets_): New field.
11926 (Symbol::has_got_offset): Removed.
11927 (Symbol::has_tls_mod_got_offset): Removed.
11928 (Symbol::has_tls_pair_got_offset): Removed.
11929 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11930 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11932 (Target_x86_64::Scan::global): Likewise.
11933 (Target_x86_64::Relocate::relocate): Likewise.
11934 (Target_x86_64::Relocate::relocate_tls): Likewise.
11936 2008-03-25 Ben Elliston <bje@au.ibm.com>
11938 * yyscript.y: Fix spelling error in comment.
11940 2008-03-24 Ian Lance Taylor <iant@google.com>
11942 * options.h (class General_options): Define build_id option.
11943 * layout.h (class Layout): Declare write_build_id, create_note,
11944 create_build_id. Add build_id_note_ member.
11945 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11946 "libiberty.h", "md5.h", "sha1.h".
11947 (Layout::Layout): Initialize eh_frame_data_,
11948 eh_frame_hdr_section_, and build_id_note_.
11949 (Layout::finalize): Call create_build_id.
11950 (Layout::create_note): New function, broken out of
11951 Layout::create_gold_note.
11952 (Layout::create_gold_note): Call create_note.
11953 (Layout::create_build_id): New function.
11954 (Layout::write_build_id): New function.
11955 (Close_task_runner::run): Call write_build_id.
11957 * x86_64.cc: Correct license to GPLv3.
11959 2008-03-23 Ian Lance Taylor <iant@google.com>
11961 * options.cc: Include "demangle.h".
11962 (parse_optional_string): New function.
11963 (parse_long_option): Handle takes_optional_argument.
11964 (parse_short_option): Update dash_z initializer. Handle
11965 takes_optional_argument.
11966 (General_options::General_options): Initialize do_demangle_.
11967 (General_options::finalize): Set do_demangle_. Handle demangling
11969 * options.h (parse_optional_string): Declare.
11970 (struct One_option): Add optional_arg field. Update constructor.
11971 Update call constructor calls. Add takes_optional_argument
11973 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11974 (DEFINE_optional_string): Define.
11975 (General_options::demangle): Change from DEFINE_bool to
11976 DEFINE_optional_string.
11977 (General_options::no_demangle): New function.
11978 (General_options::do_demangle): New function.
11979 (General_options::set_do_demangle): New function.
11980 (General_options::execstack_status_): Move definition to end of
11982 (General_options::static_): Likewise.
11983 (General_options::do_demangle_): New field.
11984 * object.cc (big_endian>::get_symbol_location_info): Call
11985 Options::do_demangle, not Options::demangle.
11986 * symtab.cc (demangle): Likewise.
11988 2008-03-22 Ian Lance Taylor <iant@google.com>
11990 * gold.h: Include <cstddef> and <sys/types.h>
11991 * options.h: Include <cstring>.
11993 2008-03-21 Ian Lance Taylor <iant@google.com>
11995 * Added source code to GNU binutils.