1 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3 * layout.h (section_order_map_): New member.
4 (get_section_order_map): New member function.
5 * output.cc (Output_section::add_input_section): Check for patterns
6 only when --section-ordering-file is specified.
7 * gold.cc (queue_middle_tasks): Delay updating order of sections till
8 output_sections have been formed.
9 * layout.cc (Layout_Layout): Initialize section_order_map_.
10 * plugin.cc (update_section_order): Store order in order_map. Do not
12 * testsuite/Makefile.am: Add test case for plugin_final_layout.
13 * testsuite/Makefile.in: Regenerate.
14 * testsuite/plugin_section_order.c: New file.
15 * testsuite/plugin_final_layout.cc: New file.
16 * testsuite/plugin_final_layout.sh: New file.
18 2011-09-29 Cary Coutant <ccoutant@google.com>
20 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
22 * gold/symtab.cc (Symbol_table::add_from_relobj): Ignore version
23 symbols during incremental update.
24 (Symbol_table::add_from_dynobj): Likewise.
26 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
27 Ian Lance Taylor <iant@google.com>
29 * symtab.cc (Symbol_table::define_special_symbol): Always
30 canonicalize version string.
32 2011-09-26 Cary Coutant <ccoutant@google.com>
34 * gold/gold.cc (queue_initial_tasks): Move option checks ...
35 * gold/options.cc (General_options::finalize): ... to here. Disable
36 some options; make others fatal.
38 2011-09-26 Cary Coutant <ccoutant@google.com>
41 * plugin.cc (get_symbols_v2): New function.
42 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
43 (is_referenced_from_outside): New function.
44 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
45 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
46 (get_symbols): Pass version parameter.
47 (get_symbols_v2): New function.
48 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
50 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
51 (onload): Add LDPT_GET_SYMBOLS_V2.
52 (all_symbols_read_hook): Use get_symbols_v2; check for
53 LDPR_PREVAILING_DEF_IRONLY_EXP.
54 * testsuite/plugin_test_3.sh: Update expected results.
56 2011-09-23 Simon Baldwin <simonb@google.com>
58 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
59 configuration options.
60 * configure: Regenerate.
61 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
62 * Makefile.in: Regenerate.
63 * testsuite/Makefile.in: Regenerate.
65 2011-09-19 Sriraman Tallam <tmsriram@google.com>
67 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
69 2011-09-19 Cary Coutant <ccoutant@google.com>
71 * incremental.cc (can_incremental_update): Fix typo in comment.
72 * incremental.h (can_incremental_update): Likewise.
74 2011-09-18 Cary Coutant <ccoutant@google.com>
76 * incremental.cc (can_incremental_update): New function.
77 * incremental.h (can_incremental_update): New function.
78 * layout.cc (Layout::init_fixed_output_section): Call it.
79 (Layout::make_output_section): Don't allow patch space in .eh_frame.
80 * object.cc (Sized_relobj_file::do_layout): Call
81 can_incremental_update.
83 2011-09-13 Cary Coutant <ccoutant@google.com>
85 * configure.ac: Check for glibc support for gnu_indirect_function
86 support with static linking, setting automake conditional
88 * Makefile.in: Regenerate.
89 * configure: Regenerate.
91 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
92 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
94 * testsuite/Makefile.in: Regenerate.
96 2011-09-13 Cary Coutant <ccoutant@google.com>
98 * incremental.cc (Sized_relobj_incr::do_layout): Call
99 report_comdat_group for kept comdat sections.
100 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
101 * testsuite/Makefile.in: Regenerate.
102 * testsuite/incr_comdat_test_1.cc: New source file.
103 * testsuite/incr_comdat_test_2_v1.cc: New source file.
104 * testsuite/incr_comdat_test_2_v2.cc: New source file.
105 * testsuite/incr_comdat_test_2_v3.cc: New source file.
107 2011-09-13 Ian Lance Taylor <iant@google.com>
109 * object.cc (Sized_relobj_file::do_layout): Remove unused local
110 variable external_symbols_offset.
112 2011-09-12 Ian Lance Taylor <iant@google.com>
114 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
115 triggered if object has no symbols.
117 2011-09-09 David S. Miller <davem@davemloft.net>
119 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
120 (Output_fill_debug_line::do_write): Likewise.
122 2011-08-29 Cary Coutant <ccoutant@google.com>
124 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
125 casts to match formatting specs.
126 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
128 2011-08-26 Cary Coutant <ccoutant@google.com>
130 * layout.cc (Free_list::allocate): Provide guarantee of minimum
131 remaining hole size when allocating.
132 (Layout::make_output_section): Set fill methods for debug sections.
133 * layout.h (Free_list::Free_list_node): Move from private to
135 (Free_list::set_min_hole_size): New function.
136 (Free_list::begin, Free_list::end): New functions.
137 (Free_list::min_hole_): New data member.
138 * output.cc: Include dwarf.h.
139 (Output_fill_debug_info::do_minimum_hole_size): New function.
140 (Output_fill_debug_info::do_write): New function.
141 (Output_fill_debug_line::do_minimum_hole_size): New function.
142 (Output_fill_debug_line::do_write): New function.
143 (Output_section::Output_section): Initialize new data member.
144 (Output_section::set_final_data_size): Ensure patch space is larger
145 than minimum hole size.
146 (Output_section::do_write): Fill holes in debug sections.
147 * output.h (Output_fill): New class.
148 (Output_fill_debug_info): New class.
149 (Output_fill_debug_line): New class.
150 (Output_section::set_free_space_fill): New function.
151 (Output_section::free_space_fill_): New data member.
152 * testsuite/Makefile.am (incremental_test_3): Add
153 --incremental-patch option.
154 (incremental_test_4): Likewise.
155 (incremental_test_5): Likewise.
156 (incremental_test_6): Likewise.
157 (incremental_copy_test): Likewise.
158 (incremental_common_test_1): Likewise.
159 * testsuite/Makefile.in: Regenerate.
161 2011-08-26 Nick Clifton <nickc@redhat.com>
163 * po/es.po: Updated Spanish translation.
165 2011-08-01 Cary Coutant <ccoutant@google.com>
167 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
168 * gold/testsuite/Makefile.in: Regenerate.
169 * gold/testsuite/justsyms_exec.c: New source file.
170 * gold/testsuite/justsyms_lib.c: New source file.
172 2011-08-01 Cary Coutant <ccoutant@google.com>
174 * layout.cc (Layout::set_segment_offsets): Don't realign text
175 segment if -Ttext was specified.
176 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
178 * object.h (Sized_relobj_file::e_type): New function.
179 (Sized_relobj_file::e_type_): New data member.
180 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
181 base address for ET_EXEC files.
182 * target.cc (Target::do_make_elf_object_implementation): Allow
183 ET_EXEC files with --just-symbols option.
185 2011-07-28 Cary Coutant <ccoutant@google.com>
187 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
188 Add thread_number parameter.
189 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
190 * workqueue-threads.cc
191 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
192 current thread if its thread number is greater than desired thread
194 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
195 Add thread_number parameter.
196 (Workqueue::should_cancel_thread): Likewise.
197 (Workqueue::find_runnable_or_wait): Pass thread_number to
198 should_cancel_thread.
199 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
202 2011-07-22 Sriraman Tallam <tmsriram@google.com>
204 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
205 only after checking if it cannot be forced local.
206 * symtab.h (is_externally_visible): Check if the symbol is not forced
209 2011-07-15 Ian Lance Taylor <iant@google.com>
211 * options.h (class General_options): Add --print-output-format.
212 Move -EL next to -EB, for better --help output.
213 * target-select.cc: Include <cstdio>, "options.h", and
215 (Target_selector::do_target_bfd_name): New function.
216 (print_output_format): New function.
217 * target-select.h (class Target_selector): Update declarations.
218 (Target_selector::target_bfd_name): New function.
219 (print_output_format): Declare.
220 * main.cc: Include "target-select.h".
221 (main): Handle --print-output-format.
222 * gold.cc: Include "target-select.h".
223 (queue_initial_tasks): Handle --print-output-format when there are
225 * parameters.cc (parameters_force_valid_target): Give a better
226 error message if -EB/-EL does not match target.
227 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
230 2011-07-15 Ian Lance Taylor <iant@google.com>
232 * i386.cc (class Output_data_plt_i386): Add layout_ field.
233 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
234 (Output_data_plt_i386::do_write): Write address of .dynamic
235 section to first entry in .got.plt section.
236 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
237 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
239 (Output_data_plt_x86_64::do_write): Write address of .dynamic
240 section to first entry in .got.plt section.
241 * layout.h (Layout::dynamic_section): New function.
243 2011-07-13 Sriraman Tallam <tmsriram@google.com>
245 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
247 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
248 input_section_position_, and input_section_glob_.
249 (read_layout_from_file): Call function section_ordering_specified.
250 * layout.h (is_section_ordering_specified): New function.
251 (section_ordering_specified): New function.
252 (section_ordering_specified_): New boolean member.
253 * main.cc(main): Call load_plugins after layout object is defined.
254 * output.cc (Output_section::add_input_section): Use
255 function section_ordering_specified to check if section ordering is
257 * output.cc (Output_section::add_relaxed_input_section): Use
258 function section_ordering_specified to check if section ordering is
260 (Output_section::update_section_layout): New function.
261 (Output_section::sort_attached_input_sections): Check if input section
263 * output.h (Output_section::update_section_layout): New function.
264 * plugin.cc (get_section_count): New function.
265 (get_section_type): New function.
266 (get_section_name): New function.
267 (get_section_contents): New function.
268 (update_section_order): New function.
269 (allow_section_ordering): New function.
270 (Plugin::load): Add the new interfaces to the transfer vector.
271 (Plugin_manager::load_plugins): New parameter.
272 (Plugin_manager::all_symbols_read): New parameter.
273 (Plugin_manager::claim_file): New parameter. Save the elf object for
275 (Plugin_manager::get_elf_object): New function.
276 (Plugin_manager::get_view): Change to directly use the bool to check
277 if get_view is called from claim_file_hook.
278 * plugin.h (input_objects): New function
279 (Plugin__manager::load_plugins): New parameter.
280 (Plugin_manager::claim_file): New parameter.
281 (Plugin_manager::get_elf_object): New function.
282 (Plugin_manager::in_claim_file_handler): New function.
283 (Plugin_manager::in_claim_file_handler_): New member.
284 (layout): New function.
285 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
286 handler with an extra parameter. Make the elf object before calling
288 * testsuite/plugin_test.c (get_section_count): New function pointer.
289 (get_section_type): New function pointer.
290 (get_section_name): New function pointer.
291 (get_section_contents): New function pointer.
292 (update_section_order): New function pointer.
293 (allow_section_ordering): New function pointer.
294 (onload): Check if the new interfaces exist.
296 2011-07-13 Ian Lance Taylor <iant@google.com>
298 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
300 * x86_64.cc (Target_x86_64::got_section): Likewise.
301 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
302 (relro_now_test_SOURCES): New variable.
303 (relro_now_test_DEPENDENCIES): New variable.
304 (relro_now_test_LDFLAGS): New variable.
305 (relro_now_test_LDADD): New variable.
306 (relro_now_test.so): New target.
307 * testsuite/Makefile.in: Rebuild.
309 2011-07-12 Ian Lance Taylor <iant@google.com>
312 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
313 GLOB_DAT relocation rather than a RELATIVE relocation for a
314 protected symbol when creating a shared library.
315 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
316 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
317 * testsuite/protected_main_1.cc (main): Test that protected
318 function has same address.
320 2011-07-11 Ian Lance Taylor <iant@google.com>
323 * options.h (class General_options): Add -Bgroup.
324 * options.cc (General_options::finalize): If -Bgroup is set,
325 default to --unresolved-symbols=report-all.
326 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
327 * target-reloc.h (issue_undefined_symbol_error): Handle
328 --unresolved-symbols=report-all.
330 2011-07-08 Ian Lance Taylor <iant@google.com>
333 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
334 if linker script discards key sections.
335 (Layout::create_dynamic_symtab): Likewise.
336 (Layout::assign_local_dynsym_offsets): Likewise.
337 (Layout::sized_create_version_sections): Likewise.
338 (Layout::create_interp): Likewise.
339 (Layout::finish_dynamic_section): Likewise.
340 (Layout::set_dynamic_symbol_size): Likewise.
342 2011-07-08 Ian Lance Taylor <iant@google.com>
345 * options.h (class General_options): Add --unresolved-symbols.
346 * target-reloc.h (issue_undefined_symbol_error): Check
347 --unresolved-symbols. Add comments.
349 2011-07-08 Ian Lance Taylor <iant@google.com>
351 * testsuite/odr_violation2.cc (Ordering::operator()): Make
352 expression more complex.
354 2011-07-08 Ian Lance Taylor <iant@google.com>
357 * target-reloc.h (issue_undefined_symbol_error): New inline
358 function, broken out of relocate_section.
359 (relocate_section): Call issue_undefined_symbol_error.
360 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
361 there is no TLS segment if we are about to issue an undefined
363 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
365 2011-07-08 Ian Lance Taylor <iant@google.com>
368 * resolve.cc (Symbol_table::should_override): Add fromtype
369 parameter. Change all callers. Give error when linking together
370 TLS and non-TLS symbol.
371 (Symbol_table::should_override_with_special): Add fromtype
372 parameter. Change all callers.
373 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
374 there is no TLS segment if we have reported some errors.
375 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
377 2011-07-08 Ian Lance Taylor <iant@google.com>
380 * target.h (Target::plt_address_for_global): New function.
381 (Target::plt_address_for_local): New function.
382 (Target::plt_section_for_global): Remove.
383 (Target::plt_section_for_local): Remove.
384 (Target::do_plt_address_for_global): New virtual function.
385 (Target::do_plt_address_for_local): New virtual function.
386 (Target::do_plt_section_for_global): Remove.
387 (Target::do_plt_section_for_local): Remove.
388 (Target::register_global_plt_entry): Add Symbol_table and Layout
390 * output.cc (Output_data_got::Got_entry::write): Use
391 plt_address_for_global and plt_address_for_local.
392 * layout.cc (Layout::add_target_dynamic_tags): Use size and
393 address of output section.
394 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
395 got_irelative_, and irelative_count_ fields. Update
397 (Output_data_plt_i386::has_irelative_section): New function.
398 (Output_data_plt_i386::entry_count): Add irelative_count_.
399 (Output_data_plt_i386::set_final_data_size): Likewise.
400 (class Target_i386): Add got_irelative_ and rel_irelative_
401 fields. Update declarations.
402 (Target_i386::Target_i386): Initialize new fields.
403 (Target_i386::do_plt_address_for_global): New function replacing
404 do_plt_section_for_global.
405 (Target_i386::do_plt_address_for_local): New function replacing
406 do_plt_section_for_local.
407 (Target_i386::got_section): Create got_irelative_.
408 (Target_i386::rel_irelative_section): New function.
409 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
410 fields. Don't define __rel_iplt_{start,end}.
411 (Output_data_plt_i386::add_entry): Add symtab and layout
412 parameters. Change all callers. Use different PLT and GOT for
414 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
415 layout parameters. Change all callers. Use different PLT and
417 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
418 (Output_data_plt_i386::rel_irelative): New function.
419 (Output_data_plt_i386::address_for_global): New function.
420 (Output_data_plt_i386::address_for_local): New function.
421 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
422 IRELATIVE GOT when changing IFUNC GOT entries.
423 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
425 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
426 if we didn't create an IRELATIVE GOT.
427 (Target_i386::Relocate::relocate): Use plt_address_for_global and
428 plt_address_for_local.
429 (Target_i386::do_dynsym_value): Use plt_address_for_global.
430 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
431 got_irelative_, and irelative_count_ fields. Update
433 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
434 Initialize new fields. Remove symtab parameter. Change all
436 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
438 (Output_data_plt_x86_64::has_irelative_section): New function.
439 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
440 (class Target_x86_64): Add got_irelative_ and rel_irelative_
441 fields. Update declarations.
442 (Target_x86_64::Target_x86_64): Initialize new fields.
443 (Target_x86_64::do_plt_address_for_global): New function replacing
444 do_plt_section_for_global.
445 (Target_x86_64::do_plt_address_for_local): New function replacing
446 do_plt_section_for_local.
447 (Target_x86_64::got_section): Create got_irelative_.
448 (Target_x86_64::rela_irelative_section): New function.
449 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
450 all callers. Don't create __rel_iplt_{start,end}.
451 (Output_data_plt_x86_64::add_entry): Add symtab and layout
452 parameters. Change all callers. Use different PLT and GOT for
454 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
455 layout parameters. Change all callers. Use different PLT and
457 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
458 parameters. Change all callers. Use different PLT and GOT for
460 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
461 (Output_data_plt_x86_64::rela_irelative): New function.
462 (Output_data_plt_x86_64::address_for_global): New function.
463 (Output_data_plt_x86_64::address_for_local): New function.
464 (Output_data_plt_x86_64::set_final_data_size): Likewise.
465 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
466 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
467 (Target_x86_64::register_global_plt_entry): Add symtab and layout
469 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
471 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
472 symbols if we didn't create an IRELATIVE GOT.
473 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
474 plt_address_for_local.
475 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
476 * testsuite/ifuncvar1.c: New test file.
477 * testsuite/ifuncvar2.c: New test file.
478 * testsuite/ifuncvar3.c: New test file.
479 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
480 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
481 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
482 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
483 * testsuite/Makefile.in: Rebuild.
485 2011-07-07 Cary Coutant <ccoutant@google.com>
487 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
488 (two_file_test_1_ndebug.o): Likewise.
489 (two_file_test_1b_ndebug.o): Likewise.
490 (two_file_test_2_ndebug.o): Likewise.
491 (two_file_test_main_ndebug.o): Likewise.
492 (incremental_test_2): Link with no-debug versions.
494 2011-07-06 Cary Coutant <ccoutant@google.com>
496 * gold/incremental.cc
497 (Output_section_incremental_inputs::write_info_blocks): Check for
498 hidden and internal symbols.
500 2011-07-06 Cary Coutant <ccoutant@google.com>
502 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
503 Check disposition for startup file.
504 (Incremental_inputs::report_command_line): Ignore
505 --incremental-startup-unchanged option.
506 * options.cc (General_options::parse_incremental_startup_unchanged):
508 (General_options::General_options): Initialize new data member.
509 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
510 (General_options): Add --incremental-startup-unchanged option.
511 (General_options::incremental_startup_disposition): New function.
512 (General_options::incremental_startup_disposition_): New data member.
514 2011-07-06 Cary Coutant <ccoutant@google.com>
516 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
517 input file index to Script_info ctor.
518 (Sized_incremental_binary::do_file_has_changed): Find the
519 command-line argument for files named in scripts.
520 * incremental.h (Script_info::Script_info): New ctor
521 with input file index.
522 (Script_info::input_file_index): New function.
523 (Script_info::input_file_index_): New data member.
524 (Incremental_binary::get_library): Add const.
525 (Incremental_binary::get_script_info): Add const.
526 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
527 * testsuite/Makefile.am (incremental_test_5): New test case.
528 (incremental_test_6): New test case.
529 * testsuite/Makefile.in: Regenerate.
531 2011-07-06 Cary Coutant <ccoutant@google.com>
533 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
534 debug output when command lines differ.
536 2011-07-06 Cary Coutant <ccoutant@google.com>
538 * incremental.cc (Incremental_inputs::report_command_line): Ignore
539 --incremental-patch option.
540 * layout.cc (Free_list::allocate): Extend allocation beyond original
542 (Layout::make_output_section): Mark sections that should get
544 * options.cc (parse_percent): New function.
545 * options.h (parse_percent): New function.
546 (DEFINE_percent): New macro.
547 (General_options): Add --incremental-patch option.
548 * output.cc (Output_section::Output_section): Initialize new data
550 (Output_section::add_input_section): Print section name when out
552 (Output_section::add_output_section_data): Likewise.
553 (Output_section::set_final_data_size): Add patch space when
554 doing --incremental-full.
555 (Output_section::do_reset_address_and_file_offset): Remove patch
557 (Output_segment::set_section_list_addresses): Print debug output
558 only if --incremental-update.
559 * output.h (Output_section::set_is_patch_space_allowed): New function.
560 (Output_section::is_patch_space_allowed_): New data member.
561 (Output_section::patch_space_): New data member.
562 * parameters.cc (Parameters::incremental_full): New function.
563 * parameters.h (Parameters::incremental_full): New function
564 * testsuite/Makefile.am (incremental_test_2): Add test for
565 --incremental-patch option.
566 * testsuite/Makefile.in: Regenerate.
567 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
568 (t18): Remove function body.
570 2011-07-05 Doug Kwan <dougkwan@google.com>
573 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
574 Arm_Address type for relocation result.
575 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
577 (Arm_relocate_functions::abs32): Use unaligned access.
578 (Arm_relocate_functions::rel32): Ditto.
579 (Arm_relocate_functions::prel31): Ditto.
580 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
581 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
582 static data relocations.
583 * testsuite/Makefile.in: Regnerate.
584 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
586 2011-07-05 Ian Lance Taylor <iant@google.com>
589 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
590 symbols if necessary.
591 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
593 2011-07-05 Ian Lance Taylor <iant@google.com>
596 * resolve.cc (Symbol::override_base_with_special): Simply override
597 version with special symbol version, ignoring previous version.
599 2011-07-05 Ian Lance Taylor <iant@google.com>
601 * object.cc (Sized_relobj_file::include_section_group): Add
602 information to comment about signature location.
604 2011-07-02 Ian Lance Taylor <iant@google.com>
607 * options.h (class General_options): Add -f and -F.
608 * options.cc (General_options::finalize): Fatal error if -f/-F
609 are used without -shared.
610 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
612 2011-07-02 Ian Lance Taylor <iant@google.com>
614 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
616 2011-07-01 Ian Lance Taylor <iant@google.com>
620 * resolve.cc (Symbol::override_base_with_special): Don't override
621 the version if the overriding symbol has a different name.
622 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
623 all callers. If we give an error about an undefined version,
624 define the base version if necessary.
625 * dynobj.h (class Versions): Update declaration.
626 * testsuite/weak_alias_test_5.cc: New file.
627 * testsuite/weak_alias_test.script: New file.
628 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
629 and versioned_alias have the right value, and call t2.
630 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
631 weak_alias_test_5.so.
632 (weak_alias_test_LDADD): Likewise.
633 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
634 * testsuite/Makefile.in: Rebuild.
636 2011-07-01 Ian Lance Taylor <iant@google.com>
639 * options.h (class General_options): Support -z notext.
640 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
642 (two_file_shared_nonpic.so): Likewise.
643 (two_file_shared_mixed.so): Likewise.
644 (two_file_shared_mixed_1.so): Likewise.
645 (weak_undef_lib_nonpic.so): Likewise.
646 (alt/weak_undef_lib_nonpic.so): Likewise.
647 (tls_test_shared_nonpic.so): Likewise.
648 * testsuite/Makefile.in: Rebuild.
650 2011-07-01 Ian Lance Taylor <iant@google.com>
653 * configure.ac: Test whether static linking works, setting
654 the automake conditional HAVE_STATIC.
655 * testsuite/Makefile.am: Disable tests using -static if
656 HAVE_STATIC is not true.
657 * configure, testsuite/Makefile.in: Rebuild.
659 2011-07-01 Ian Lance Taylor <iant@google.com>
662 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
663 Assert if we see DW_EH_PE_indirect.
664 * target.h (Target::ehframe_datarel_base): New function.
665 (Target::do_ehframe_datarel_base): New target function.
666 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
667 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
670 2011-07-01 Ian Lance Taylor <iant@google.com>
673 * options.h (class General_options): Add
674 --ld-generated-unwind-info.
675 * ehframe.cc (Fde::write): Add address parameter. Change all
676 callers. If associated with PLT, fill in address and size.
677 (Cie::set_output_offset): Only add merge mapping if there is an
679 (Cie::write): Add address parameter. Change all callers.
680 (Eh_frame::add_ehframe_for_plt): New function.
681 * ehframe.h (class Fde): Update declarations. Move shndx_ and
682 input_offset_ fields into union u_, with new plt field.
683 (Fde::Fde): Adjust for new union field.
684 (Fde::Fde) [Output_data version]: New constructor.
685 (Fde::add_mapping): Only add merge mapping if there is an object.
686 (class Cie): Update declarations.
687 (class Eh_frame): Declare add_ehframe_for_plt.
688 * layout.cc (Layout::layout_eh_frame): Break out code into
689 make_eh_frame_section, and call it.
690 (Layout::make_eh_frame_section): New function.
691 (Layout::add_eh_frame_for_plt): New function.
692 * layout.h (class Layout): Update declarations.
693 * merge.cc (Merge_map::add_mapping): Add assertion.
694 * i386.cc: Include "dwarf.h".
695 (class Output_data_plt_i386): Make first_plt_entry,
696 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
697 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
698 and plt_eh_frame_fde.
699 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
700 boundary. Call add_eh_frame_for_plt if appropriate.
701 * x86_64.cc: Include "dwarf.h".
702 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
703 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
704 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
705 and plt_eh_frame_fde.
706 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
709 2011-06-29 Ian Lance Taylor <iant@google.com>
712 * object.cc (Sized_relobj_file::layout_section): Change shdr
713 parameter to be const.
714 (Sized_relobj_file::layout_eh_frame_section): New function, broken
716 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
717 appropriate. Call layout_eh_frame_section.
718 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
720 * object.h (class Sized_relobj_file): Update declarations.
722 2011-06-29 Ian Lance Taylor <iant@google.com>
725 * script.cc (Token::integer_value): Accept trailing M/m/K/k
727 (Lex::gather_token): Accept trailing M/m/K/k for integers.
729 2011-06-29 Ian Lance Taylor <iant@google.com>
732 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
734 * layout.cc (Layout::layout_eh_frame): Likewise.
736 2011-06-29 Ian Lance Taylor <iant@google.com>
739 * layout.cc (Layout::symtab_section_shndx): New function.
740 * layout.h (class Layout): Declare symtab_section_shndx.
741 * output.cc (Output_section::write_header): Call it.
743 2011-06-29 Ian Lance Taylor <iant@google.com>
746 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
747 symbols which are not used in a relocation.
749 2011-06-28 Ian Lance Taylor <iant@google.com>
752 * layout.cc (Layout::segment_precedes): Don't crash if a linker
753 script create indistinguishable segments.
754 (Layout::set_segment_offsets): Use stable_sort when sorting
755 segments. Pass this to Compare_segments constructor.
756 * layout.h (class Layout): Make segment_precedes non-static.
757 (class Compare_segments): Change from struct to class. Add
758 layout_ field. Add constructor.
760 (Script_sections::attach_sections_using_phdrs_clause): Rename
761 local orphan to is_orphan. Don't report failure to put empty
762 section in segment. On attachment failure, report name of
763 section, and attach to first PT_LOAD segment.
765 2011-06-28 Ian Lance Taylor <iant@google.com>
768 * target-select.cc (Target_selector::Target_selector): Add
769 emulation parameter. Change all callers.
770 (select_target_by_bfd_name): Rename from select_target_by_name.
772 (select_target_by_emulation): New function.
773 (supported_emulation_names): New function.
774 * target-select.h (class Target_selector): Add emulation_ field.
776 (Target_selector::recognize_by_bfd_name): Rename from
777 recognize_by_name. Change all callers.
778 (Target_selector::supported_bfd_names): Rename from
779 supported_names. Change all callers.
780 (Target_selector::recognize_by_emulation): New function.
781 (Target_selector::supported_emulations): New function.
782 (Target_selector::emulation): New function.
783 (Target_selector::do_recognize_by_bfd_name): Rename from
784 do_recognize_by_name. Change all callers.
785 (Target_selector::do_supported_bfd_names): Rename from
786 do_supported_names. Change all callers.
787 (Target_selector::do_recognize_by_emulation): New function.
788 (Target_selector::do_supported_emulations): New function.
789 (select_target_by_bfd_name): Change name in declaration.
790 (select_target_by_emulation): Declare.
791 (supported_emulation_names): Declare.
792 * parameters.cc (parameters_force_valid_target): Try to find
793 target based on emulation from -m option.
794 * options.h (class General_options): Change doc string for -m.
795 * options.cc (help): Print emulations.
796 (General_options::parse_V): Likewise.
797 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
798 Add emulation parameter. Change all callers.
800 2011-06-28 Ian Lance Taylor <iant@google.com>
802 * target.h (class Target): Add osabi_ field.
803 (Target::osabi): New function.
804 (Target::set_osabi): New function.
805 (Target::Target): Initialize osabi_.
806 (Target::do_adjust_elf_header): Make pure virtual.
807 (Sized_target::do_adjust_elf_header): Declare.
808 * target.cc (Sized_target::do_adjust_elf_header): New function.
809 (class Sized_target): Instantiate all versions.
810 * freebsd.h (class Target_freebsd): Remove.
811 (Target_selector_freebsd::do_recognize): Call set_osabi on
813 (Target_selector_freebsd::do_recognize_by_name): Likewise.
814 (Target_selector_freebsd::set_osabi): Remove.
815 * i386.cc (class Target_i386): Inherit from Sized_target rather
817 * x86_64.cc (class Target_x86_64): Likewise.
819 2011-06-28 Ian Lance Taylor <iant@google.com>
821 * target.h (Target::can_check_for_function_pointers): Rewrite.
823 (Target::can_icf_inline_merge_sections): Likewise.
824 (Target::section_may_have_icf_unsafe_poineters): Likewise.
825 (Target::Target_info): Add can_icf_inline_merge_sections field.
826 (Target::do_can_check_for_function_pointers): New virtual
828 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
829 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
830 from can_check_for_function_pointers, move in file.
831 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
832 section_may_have_icf_unsafe_poineters, move in file.
833 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
834 * i386.cc (Target_i386::do_can_check_for_function_pointers):
835 Rename from can_check_for_function_pointers, move in file.
836 (Target_i386::can_icf_inline_merge_sections): Remove.
837 (Target_i386::i386_info): Initialize
838 can_icf_inline_merge_sections.
839 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
840 Initialize can_icf_inline_merge_sections.
841 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
842 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
843 Rename from can_check_for_function_pointers, move in file.
844 (Target_x86_64::can_icf_inline_merge_sections): Remove.
845 (Target_x86_64::x86_64_info): Initialize
846 can_icf_inline_merge_sections.
847 * testsuite/testfile.cc (Target_test::test_target_info):
849 * icf.cc (get_section_contents): Correct formatting.
851 2011-06-27 Ian Lance Taylor <iant@google.com>
853 * symtab.cc (Symbol::versioned_name): New function.
854 (Symbol_table::add_to_final_symtab): Use versioned_name when
856 (Symbol_table::sized_write_symbol): Likewise.
857 * symtab.h (class Symbol): Declare versioned_name.
858 * stringpool.h (class Stringpool_template): Add variant of add
859 which takes a std::basic_string.
860 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
861 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
862 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
863 (ver_test_12.o): New target.
864 * testsuite/Makefile.in: Rebuild.
866 2011-06-27 Doug Kwan <dougkwan@google.com>
868 * arm.cc (Arm_relocate_functions::thm_jump8,
869 Arm_relocate_functions::thm_jump11): Use a wider signed
870 type to compute offset.
871 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
873 * testsuite/Makefile.in: Regenerate.
874 * testsuite/arm_branch_in_range.sh: Check test results of
875 arm_thm_jump11 and arm_thm_jump8.
876 * testsuite/arm_thm_jump11.s: New test source file.
877 * testsuite/arm_thm_jump11.t: New linker script.
878 * testsuite/arm_thm_jump8.s: New test source file.
879 * testsuite/arm_thm_jump8.t: New linker script.
881 2011-06-24 Ian Lance Taylor <iant@google.com>
883 * layout.cc: Include "object.h".
884 (ctors_sections_in_init_array): New static variable.
885 (Layout::is_ctors_in_init_array): New function.
886 (Layout::layout): Add entry to ctors_sections_in_init_array if
888 * layout.h (class Layout): Declare is_ctors_in_init_array.
889 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
890 is_ctors_reverse_view is set.
891 (Sized_relobj_file::write_sections): Add layout parameter. Change
892 all callers. Set is_ctors_reverse_view field of View_size.
893 (Sized_relobj_file::reverse_words): New function.
894 * object.h (Sized_relobj_file::View_size): Add
895 is_ctors_reverse_view field.
896 (class Sized_relobj_file): Update declarations.
897 * testsuite/initpri3.c: New test.
898 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
900 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
901 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
902 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
903 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
904 * testsuite/Makefile.in: Rebuild.
906 2011-06-24 Cary Coutant <ccoutant@google.com>
908 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
909 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
910 (debug_msg_cdebug.err): New targets.
911 * testsuite/Makefile.in: Regenerate.
912 * testsuite/debug_msg.sh: Check output of link with compressed debug.
913 Fix checks for link with shared library.
915 2011-06-24 Doug Kwan <dougkwan@google.com>
917 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
918 skip empty text sections.
919 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
921 2011-06-22 Ian Lance Taylor <iant@google.com>
924 * options.h (class General_options): Add --ctors-in-init-array.
925 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
926 friends as SHT_PROGBITS for merging sections.
927 (Layout::layout): Remove special handling of .init_array and
928 friends. Don't sort if doing relocatable link. Sort for .ctors
929 and .dtors if ctors_in_init_array.
930 (Layout::make_output_section): Force correct section types for
931 .init_array and friends. Don't sort if doing relocatable link,
932 Don't sort .ctors and .dtors if ctors_in_init_array.
933 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
934 (Layout::output_section_name): Add relobj parameter. Change all
935 callers. Handle .ctors. and .dtors. in code rather than table.
936 Handle .ctors and .dtors if ctors_in_init_array.
937 (Layout::match_file_name): New function, moved from output.cc.
938 * layout.h (class Layout): Update declarations.
939 * output.cc: Include "layout.h".
940 (Input_section_sort_entry::get_priority): New function.
941 (Input_section_sort_entry::match_file_name): Just call
942 Layout::match_file_name.
943 (Output_section::Input_section_sort_init_fini_compare::operator()):
944 Handle .ctors and .dtors. Sort by explicit priority rather than
946 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
947 * testsuite/initpri2.c: New test.
948 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
949 (check_PROGRAMS): Add initpri2.
950 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
951 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
952 * configure, testsuite/Makefile.in: Rebuild.
954 2011-06-19 Ian Lance Taylor <iant@google.com>
957 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
958 .interp section to a PT_INTERP segment even if we have seen a
959 --dynamic-linker option. Don't do it if we have seen a PHDRS
960 clause in a linker script.
961 (Layout::finalize): Don't create a .interp section if we've
962 already create a PT_INTERP segment.
963 (Layout::create_interp): Always call choose_output_section (revert
964 patch of 2011-06-17). Don't create PT_INTERP segment.
966 (Script_sections::create_note_and_tls_segments): Add a .interp
967 section to a PT_INTERP segment even if we have seen a
968 --dynamic-linker option.
970 2011-06-18 Ian Lance Taylor <iant@google.com>
972 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
973 merely because a non-PT_LOAD segment has a dynamic reloc.
975 2011-06-18 Ian Lance Taylor <iant@google.com>
977 * layout.cc (Layout::finish_dynamic_section): Don't create
978 DT_FLAGS entry if not needed.
980 2011-06-18 Ian Lance Taylor <iant@google.com>
983 * layout.cc (Layout::layout_eh_frame): Correct handling of
984 writable .eh_frame section.
986 2011-06-17 Ian Lance Taylor <iant@google.com>
989 * resolve.cc (Symbol_table::resolve): Don't give an error if a
990 symbol is redefined with the exact same object and value.
992 2011-06-17 Ian Lance Taylor <iant@google.com>
995 * layout.h (class Layout): Add interp_segment_ field.
996 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
997 (Layout::attach_allocated_section_to_segment): If making shared
998 library, put .interp section in PT_INTERP segment.
999 (Layout::finalize): Also call create_interp if -dynamic-linker
1001 (Layout::create_interp): Assert that there is no PT_INTERP
1002 segment. If not using a SECTIONS clause, use make_output_section.
1003 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1004 * script-sections.cc
1005 (Script_sections::create_note_and_tls_segments): If making shared
1006 library, put .interp section in PT_INTERP segment.
1008 2011-06-17 Ian Lance Taylor <iant@google.com>
1010 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1011 when making a shared library.
1013 2011-06-17 Ian Lance Taylor <iant@google.com>
1015 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1016 parameter. Change all callers. Don't issue warning about PC32
1017 against locally defined symbol.
1019 2011-06-16 Ian Lance Taylor <iant@google.com>
1021 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1022 occurs in same object.
1024 2011-06-14 Alan Modra <amodra@gmail.com>
1026 * po/POTFILES.in: Regenerate.
1028 2011-06-09 Ian Lance Taylor <iant@google.com>
1030 * script-sections.cc
1031 (Orphan_output_section::set_section_addresses): For a relocatable
1032 link set address to 0.
1034 2011-06-09 Cary Coutant <ccoutant@google.com>
1037 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1038 used with --compress-debug-sections.
1039 * gold/object.cc (Sized_relobj_file::do_layout): Report
1040 uncompressed size of compressed input sections.
1042 2011-06-08 Cary Coutant <ccoutant@google.com>
1045 * testsuite/two_file_test_2_v1.cc: Change initialization of
1046 v2 to keep it in .data.
1048 2011-06-07 Cary Coutant <ccoutant@google.com>
1050 * common.cc (Symbol_table::do_allocate_commons_list): Call
1052 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1053 (Errors::fallback): New function.
1054 (gold_fallback): New function.
1055 * errors.h (Errors::fallback): New function.
1056 * gold.cc (gold_exit): Change status parameter to enum; adjust
1058 (queue_initial_tasks): Call gold_fallback.
1059 * gold.h: Include cstdlib.
1060 (Exit_status): New enum type.
1061 (gold_exit): Change status parameter to enum.
1062 (gold_fallback): New function.
1063 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1064 (Layout::create_symtab_sections): Likewise.
1065 (Layout::create_shdrs): Likewise.
1066 * main.cc (main): Adjust call to gold_exit.
1067 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1068 (Output_data_got::add_got_entry_pair): Likewise.
1069 (Output_section::add_input_section): Likewise.
1070 (Output_section::add_output_section_data): Likewise.
1071 (Output_segment::set_section_list_addresses): Likewise.
1072 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1074 2011-06-07 Cary Coutant <ccoutant@google.com>
1076 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1077 for incremental links.
1078 * output.cc (Output_segment::set_section_list_addresses): Remove
1079 FIXME and test for TLS or BSS.
1081 2011-06-07 Cary Coutant <ccoutant@google.com>
1083 * testsuite/Makefile.am: Add incremental_copy_test,
1084 incremental_common_test_1.
1085 * testsuite/Makefile.in: Regenerate.
1086 * testsuite/common_test_1_v1.c: New source file.
1087 * testsuite/common_test_1_v2.c: New source file.
1088 * testsuite/copy_test_v1.cc: New source file.
1090 2011-06-07 Cary Coutant <ccoutant@google.com>
1092 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1093 update, allocate common from bss section's free list.
1094 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1095 linker-defined symbols.
1096 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1097 Skip GOT and PLT entries that are no longer referenced.
1098 (Output_section_incremental_inputs::write_info_blocks): Mark
1099 linker-defined symbols.
1100 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1101 * output.cc (Output_section::allocate): New function.
1102 * output.h (Output_section::allocate): New function.
1103 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1104 linker-defined symbols.
1105 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1106 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1107 (Symbol::init_base_output_data): Likewise.
1108 (Symbol::init_base_output_segment): Likewise.
1109 (Symbol::init_base_constant): Likewise.
1110 (Sized_symbol::init_output_data): Likewise.
1111 (Sized_symbol::init_output_segment): Likewise.
1112 (Sized_symbol::init_constant): Likewise.
1113 (Symbol_table::do_define_in_output_data): Likewise.
1114 (Symbol_table::do_define_in_output_segment): Likewise.
1115 (Symbol_table::do_define_as_constant): Likewise.
1116 * symtab.h (Symbol::is_predefined): New function.
1117 (Symbol::init_base_output_data): Add is_predefined parameter.
1118 (Symbol::init_base_output_segment): Likewise.
1119 (Symbol::init_base_constant): Likewise.
1120 (Symbol::is_predefined_): New data member.
1121 (Sized_symbol::init_output_data): Add is_predefined parameter.
1122 (Sized_symbol::init_output_segment): Likewise.
1123 (Sized_symbol::init_constant): Likewise.
1124 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1126 2011-06-07 Cary Coutant <ccoutant@google.com>
1128 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1129 instead of emit_copy_reloc.
1130 (Copy_relocs::emit_copy_reloc): Refactor.
1131 (Copy_relocs::make_copy_reloc): New function.
1132 (Copy_relocs::add_copy_reloc): Remove.
1133 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1135 (Copy_relocs::make_copy_reloc): New function.
1136 (Copy_relocs::add_copy_reloc): Remove.
1137 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1138 unchanged input files.
1139 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1140 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1141 Reserve BSS space for COPY relocations.
1142 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1143 (Output_section_incremental_inputs::write_info_blocks): Record
1144 whether a symbol is copied from a shared object.
1145 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1146 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1147 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1148 (Incremental_input_entry_reader::get_output_symbol_index): Add
1150 (Incremental_binary::emit_copy_relocs): New function.
1151 (Incremental_binary::do_emit_copy_relocs): New function.
1152 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1154 (Sized_incremental_binary::add_copy_reloc): New function.
1155 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1156 (Sized_incremental_binary::Copy_reloc): New struct.
1157 (Sized_incremental_binary::Copy_relocs): New typedef.
1158 (Sized_incremental_binary::copy_relocs_): New data member.
1159 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1160 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1161 * target.h (Sized_target::emit_copy_reloc): New function.
1162 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1164 2011-06-02 Cary Coutant <ccoutant@google.com>
1167 * gold/archive.cc (Archive::Archive): Initialize new data member.
1168 (Archive::include_all_members): Return if archive has already been
1170 * gold/archive.h (Archive::include_all_members_): New data member.
1172 2011-06-02 Nick Clifton <nickc@redhat.com>
1174 * dynobj.h: Fix spelling mistake in comment.
1175 * output.cc: Likewise.
1177 2011-05-31 Doug Kwan <dougkwan@google.com>
1181 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1182 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1183 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1184 redundant arm_exidx_test.so.
1185 * testsuite/Makefile.in: Regenerate.
1186 (check_SCRIPTS): Add pr12826.sh
1187 (check_DATA): Add pr12826.stdout
1188 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1189 * testsuite/pr12826.sh: New file.
1190 * testsuite/pr12826_1.s: Ditto.
1191 * testsuite/pr12826_1.s: Ditto.
1193 2011-05-30 Ian Lance Taylor <iant@google.com>
1195 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1198 2011-05-29 Ian Lance Taylor <iant@google.com>
1201 * testsuite/Makefile.am: Use different file name for two_file_test
1202 temporary file for each incremental test.
1203 * testsuite/Makefile.in: Rebuild.
1205 2011-05-29 Ian Lance Taylor <iant@google.com>
1207 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1208 binary input file is empty.
1210 2011-05-27 Ian Lance Taylor <iant@google.com>
1212 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1213 (ver_test_9.so): Likewise.
1214 * testsuite/Makefile.in: Rebuild.
1216 2011-05-26 Cary Coutant <ccoutant@google.com>
1218 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1219 * incremental.cc (Incremental_inputs::report_input_section): Fix
1220 comment, indentation.
1221 (Incremental_inputs::report_comdat_group): New function.
1222 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1223 of data for incremental input file entry.
1224 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1225 group count, COMDAT group signatures.
1226 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1227 an unchanged input file.
1228 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1229 Initialize new data member.
1230 (Incremental_object_entry::add_comdat_group): New function.
1231 (Incremental_object_entry::get_comdat_group_count): New function.
1232 (Incremental_object_entry::get_comdat_signature_key): New function.
1233 (Incremental_object_entry::groups_): New data member.
1234 (Incremental_inputs::report_comdat_group): New function.
1235 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1236 data for incremental input file entry.
1237 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1238 (Incremental_input_entry_reader::get_input_section): Adjust size of
1239 data for incremental input file entry.
1240 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1241 (Incremental_input_entry_reader::get_comdat_group_signature): New
1243 * object.cc (Sized_relobj::include_section_group): Report kept
1244 COMDAT groups for incremental links.
1246 2011-05-24 David Meyer <pdox@google.com>
1248 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1249 with name parameter. Add found_name parameter.
1250 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1251 * dirsearch.h (class Dirsearch): Update declaration.
1253 2011-05-24 Ian Lance Taylor <iant@google.com>
1255 * archive.cc (Library_base::should_include_member): Pull in object
1256 from archive if it defines the entry symbol.
1257 * parameters.cc (Parameters::entry): New function.
1258 * parameters.h (class Parameters): Declare entry.
1259 * output.h (class Output_file_header): Remove entry_ field.
1260 * output.cc (Output_file_header::Output_file_header): Remove entry
1261 parameter. Change all callers.
1262 (Output_file_header::entry): Use parameters->entry.
1263 * gold.cc (queue_middle_tasks): Likewise.
1264 * plugin.cc (Plugin_hook::run): Likewise.
1266 2011-05-24 Cary Coutant <ccoutant@google.com>
1268 * gold.cc (queue_initial_tasks): Pass incremental base filename
1269 to Output_file::open_base_file; don't print error message.
1270 * incremental-dump.cc (main): Adjust call to
1271 Output_file::open_for_modification.
1272 * incremental-dump.cc (main): Likewise.
1273 * incremental.cc (Incremental_inputs::report_command_line):
1274 Ignore --incremental-base option when comparing command lines.
1275 Ignore parameter when given as separate argument.
1276 * options.h (class General_options): Add --incremental-base.
1277 * output.cc (Output_file::Output_file):
1278 (Output_file::open_base_file): Add base_name and writable parameters;
1279 read base file into new file; print error message here.
1280 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1282 * output.h (Output_file::open_for_modification): Rename to...
1283 (Output_file::open_base_file): ...this; add base_name and
1284 writable parameters; adjust all callers.
1285 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1287 * testsuite/Makefile.am (incremental_test_4): Test
1289 * testsuite/Makefile.in: Regenerate.
1291 2011-05-24 Cary Coutant <ccoutant@google.com>
1293 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1295 * testsuite/Makefile.in: Regenerate.
1296 * testsuite/two_file_test_1_v1.cc: New test source file.
1297 * testsuite/two_file_test_1b_v1.cc: New test source file.
1298 * testsuite/two_file_test_2_v1.cc: New test source file.
1300 2011-05-24 Cary Coutant <ccoutant@google.com>
1302 * dynobj.h (Dynobj::do_dynobj): New function.
1303 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1304 flag and soname for shared objects.
1305 * incremental.cc (Incremental_inputs::report_object): Make
1306 either Incremental_object_entry or Incremental_dynobj_entry; add
1307 soname to string table.
1308 (Incremental_inputs::report_input_section): Add assertion.
1309 (Output_section_incremental_inputs::set_final_data_size): Adjust
1310 type of input file entry for shared libraries; adjust size of
1311 shared library info entry.
1312 (Output_section_incremental_inputs::write_input_files): Write
1313 as_needed flag for shared libraries.
1314 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1315 of input file entry for shared libraries; write soname.
1316 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1317 soname from incremental info.
1318 * incremental.h (enum Incremental_input_flags): Add
1319 INCREMENTAL_INPUT_AS_NEEDED.
1320 (Incremental_input_entry::Incremental_input_entry): Initialize new
1322 (Incremental_input_entry::set_as_needed): New function.
1323 (Incremental_input_entry::as_needed): New function.
1324 (Incremental_input_entry::do_dynobj_entry): New function.
1325 (Incremental_input_entry::as_needed_): New data member.
1326 (Incremental_object_entry::Incremental_object_entry): Don't check
1328 (Incremental_object_entry::do_type): Likewise.
1329 (class Incremental_dynobj_entry): New class.
1330 (Incremental_input_entry_reader::as_needed): New function.
1331 (Incremental_input_entry_reader::get_soname): New function.
1332 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1333 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1334 size of shared library info entry.
1335 * layout.cc (Layout::finish_dynamic_section): Don't test for
1336 incremental link when adding DT_NEEDED entries.
1337 * object.h (Object::Object): Initialize new data member.
1338 (Object::dynobj): New function.
1339 (Object::set_as_needed): New function.
1340 (Object::as_needed): New function.
1341 (Object::do_dynobj): New function.
1342 (Object::as_needed_): New data member.
1344 2011-05-24 Cary Coutant <ccoutant@google.com>
1346 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1347 info; adjust display of GOT entries.
1348 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1349 vector of input objects; remove file_status_.
1350 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1351 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1352 got_plt reader; call target hooks to reserve GOT entries.
1353 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1354 of input file info header and GOT info entry.
1355 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1357 (Got_plt_view_info::got_descriptor): Remove.
1358 (Got_plt_view_info::sym_index): New data member.
1359 (Got_plt_view_info::input_index): New data member.
1360 (Local_got_offset_visitor::visit): Write input file index.
1361 (Global_got_offset_visitor::visit): Write 0 for input file index.
1362 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1363 with sym_index and input_index.
1364 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1365 incremental info GOT entry; replace got_descriptor with input_index.
1366 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1367 map from input file index to object.
1368 (Sized_relobj_incr::do_layout): Replace direct data member reference
1369 with accessor function.
1370 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1371 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1372 Adjust size of input file info header.
1373 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1374 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1375 (Incremental_input_entry_reader::get_input_section): Adjust size of
1376 input file info header.
1377 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1378 of incremental info GOT entry.
1379 (Incremental_got_plt_reader::get_got_desc): Remove.
1380 (Incremental_got_plt_reader::get_got_symndx): New function.
1381 (Incremental_got_plt_reader::get_got_input_index): New function.
1382 (Sized_incremental_binary::Sized_incremental_binary): Remove
1383 file_status_; add input_objects_.
1384 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1385 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1386 (Sized_incremental_binary::file_is_unchanged): Remove.
1387 (Sized_incremental_binary::set_input_object): New function.
1388 (Sized_incremental_binary::input_object): New function.
1389 (Sized_incremental_binary::file_status_): Remove.
1390 (Sized_incremental_binary::input_objects_): New data member.
1391 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1393 (Sized_relobj_incr::invalid_address): Move to base class.
1394 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1396 (Sized_relobj_incr::do_output_section_offset): Likewise.
1397 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1398 (Sized_relobj_incr::section_offsets_): Likewise.
1399 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1401 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1402 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1403 with accessor function.
1404 (Sized_relobj_file::do_layout): Likewise.
1405 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1406 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1407 (Sized_relobj_file::compute_final_local_value): Replace refs to
1408 section_offsets_ with accessor function.
1409 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1410 * object.h (Relobj::Relobj): Initialize new data members.
1411 (Relobj::add_dyn_reloc): New function.
1412 (Relobj::first_dyn_reloc): New function.
1413 (Relobj::dyn_reloc_count): New function.
1414 (Relobj::first_dyn_reloc_): New data member.
1415 (Relobj::dyn_reloc_count_): New data member.
1416 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1418 (Sized_relobj::Address): New typedef.
1419 (Sized_relobj::invalid_address): Move here from child class.
1420 (Sized_relobj::Sized_relobj): Initialize new data members.
1421 (Sized_relobj::sized_relobj): New function.
1422 (Sized_relobj::is_output_section_offset_invalid): Move here from
1424 (Sized_relobj::get_output_section_offset): Likewise.
1425 (Sized_relobj::local_has_got_offset): Likewise.
1426 (Sized_relobj::local_got_offset): Likewise.
1427 (Sized_relobj::set_local_got_offset): Likewise.
1428 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1429 (Sized_relobj::clear_got_offsets): New function.
1430 (Sized_relobj::section_offsets): Move here from child class.
1431 (Sized_relobj::do_output_section_offset): Likewise.
1432 (Sized_relobj::do_set_section_offset): Likewise.
1433 (Sized_relobj::Local_got_offsets): Likewise.
1434 (Sized_relobj::local_got_offsets_): Likewise.
1435 (Sized_relobj::section_offsets_): Likewise.
1436 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1438 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1440 (Sized_relobj_file::sized_relobj): New function
1441 (Sized_relobj_file::local_has_got_offset): Move to base class.
1442 (Sized_relobj_file::local_got_offset): Likewise.
1443 (Sized_relobj_file::set_local_got_offset): Likewise.
1444 (Sized_relobj_file::get_output_section_offset): Likewise.
1445 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1446 (Sized_relobj_file::do_output_section_offset): Likewise.
1447 (Sized_relobj_file::do_set_section_offset): Likewise.
1448 (Sized_relobj_file::Local_got_offsets): Likewise.
1449 (Sized_relobj_file::local_got_offsets_): Likewise.
1450 (Sized_relobj_file::section_offsets_): Likewise.
1451 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1453 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1454 (Output_reloc::get_symbol_index): Likewise.
1455 (Output_reloc::local_section_offset): Likewise.
1456 (Output_reloc::get_address): Likewise.
1457 (Output_reloc::symbol_value): Likewise.
1458 (Output_data_got::reserve_slot): Move to class definition.
1459 (Output_data_got::reserve_local): New function.
1460 (Output_data_got::reserve_slot_for_global): Remove.
1461 (Output_data_got::reserve_global): New function.
1462 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1463 (all constructors, two instantiations).
1464 (Output_reloc::get_relobj): New function (two instantiations).
1465 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1466 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1467 (Output_data_reloc::add_global): Adjust type of relobj.
1468 (Output_data_reloc::add_global_relative): Likewise.
1469 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1470 (Output_data_reloc::add_local): Likewise.
1471 (Output_data_reloc::add_local_relative): Likewise.
1472 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1473 (Output_data_reloc::add_local_section): Likewise.
1474 (Output_data_reloc::add_output_section): Likewise.
1475 (Output_data_reloc::add_absolute): Likewise.
1476 (Output_data_reloc::add_target_specific): Likewise.
1477 (Output_data_got::reserve_slot): Move definition here.
1478 (Output_data_got::reserve_local): New function.
1479 (Output_data_got::reserve_global): New function.
1480 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1481 section_offsets_ with accessor function.
1482 (Sized_relobj_file::write_sections): Likewise.
1483 (Sized_relobj_file::do_relocate_sections): Likewise.
1484 * target.h (Sized_target::reserve_local_got_entry): New function.
1485 (Sized_target::reserve_global_got_entry): New function.
1486 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1487 (Target_x86_64::reserve_global_got_entry): New function.
1488 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1490 2011-05-23 Cary Coutant <ccoutant@google.com>
1492 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1493 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1494 bit when checking got_type.
1495 * incremental.cc (Sized_incremental_binary::setup_readers):
1496 Store symbol table and string table locations; initialize bit vector
1497 of file status flags.
1498 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1500 (Sized_incremental_binary::do_process_got_plt): New function.
1501 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1502 (Output_section_incremental_inputs::set_final_data_size): Record
1503 file index for each input file.
1504 (Output_section_incremental_inputs::write_got_plt): Store file index
1505 instead of input entry offset for each GOT entry.
1507 (Incremental_input_entry::Incremental_input_entry): Initialize new
1509 (Incremental_input_entry::set_offset): Store file index.
1510 (Incremental_input_entry::get_file_index): New function.
1511 (Incremental_input_entry::file_index_): New data member.
1512 (Incremental_binary::process_got_plt): New function.
1513 (Incremental_binary::do_process_got_plt): New function.
1514 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1516 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1517 (Sized_incremental_binary::set_file_is_unchanged): New function.
1518 (Sized_incremental_binary::file_is_unchanged): New function.
1519 (Sized_incremental_binary::do_process_got_plt): New function.
1520 (Sized_incremental_binary::file_status_): New data member.
1521 (Sized_incremental_binary::main_symtab_loc_): New data member.
1522 (Sized_incremental_binary::main_strtab_loc_): New data member.
1523 * output.cc (Output_data_got::Got_entry::write): Add case
1525 (Output_data_got::add_global): Call add_got_entry.
1526 (Output_data_got::add_global_plt): Likewise.
1527 (Output_data_got::add_global_with_rel): Likewise.
1528 (Output_data_got::add_global_with_rela): Likewise.
1529 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1530 (Output_data_got::add_global_pair_with_rela): Likewise.
1531 (Output_data_got::add_local): Call add_got_entry.
1532 (Output_data_got::add_local_plt): Likewise.
1533 (Output_data_got::add_local_with_rel): Likewise.
1534 (Output_data_got::add_local_with_rela): Likewise.
1535 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1536 (Output_data_got::add_local_pair_with_rela): Likewise.
1537 (Output_data_got::reserve_slot): New function.
1538 (Output_data_got::reserve_slot_for_global): New function.
1539 (Output_data_got::add_got_entry): New function.
1540 (Output_data_got::add_got_entry_pair): New function.
1541 (Output_section::add_output_section_data): Edit FIXME.
1543 (Output_section_data_build::Output_section_data_build): New
1544 constructor with size parameter.
1545 (Output_data_space::Output_data_space): Likewise.
1546 (Output_data_got::Output_data_got): Initialize new data member; new
1547 constructor with size parameter.
1548 (Output_data_got::add_constant): Call add_got_entry.
1549 (Output_data_got::reserve_slot): New function.
1550 (Output_data_got::reserve_slot_for_global): New function.
1551 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1552 (Output_data_got::add_got_entry): New function.
1553 (Output_data_got::add_got_entry_pair): New function.
1554 (Output_data_got::free_list_): New data member.
1555 * target.h (Sized_target::init_got_plt_for_update): New function.
1556 (Sized_target::register_global_plt_entry): New function.
1557 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1558 Initialize new data member; call init; add constructor with PLT count.
1559 (Output_data_plt_x86_64::init): New function.
1560 (Output_data_plt_x86_64::add_relocation): New function.
1561 (Output_data_plt_x86_64::reserve_slot): New function.
1562 (Output_data_plt_x86_64::free_list_): New data member.
1563 (Target_x86_64::init_got_plt_for_update): New function.
1564 (Target_x86_64::register_global_plt_entry): New function.
1565 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1566 incremental updates.
1567 (Output_data_plt_x86_64::add_relocation): New function.
1568 * testsuite/object_unittest.cc (Object_test): Set default options.
1570 2011-05-16 Ian Lance Taylor <iant@google.com>
1572 * options.h (class General_options): Make -i a synonym for -r.
1574 2011-05-16 Ian Lance Taylor <iant@google.com>
1576 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1578 2011-05-10 Cary Coutant <ccoutant@google.com>
1580 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1583 2011-05-06 Ian Lance Taylor <iant@google.com>
1585 * layout.cc (Layout::layout): If the output section flags change,
1586 update the ordering.
1588 2011-04-25 Cary Coutant <ccoutant@google.com>
1590 * incremental-dump.cc (dump_incremental_inputs): Print local
1591 symbol info for each input file.
1593 (Output_section_incremental_inputs::set_final_data_size): Add local
1594 symbol info to input file entries in incremental info.
1595 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1596 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1597 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1598 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1600 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1601 (Sized_incr_relobj::do_relocate): Write the local symbols.
1602 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1603 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1604 Adjust size of input file header.
1605 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1606 (Incremental_inputs_reader::get_local_symbol_count): New function.
1607 (Incremental_inputs_reader::get_input_section): Adjust size of input
1609 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1610 (Sized_incr_relobj::This): New typedef.
1611 (Sized_incr_relobj::sym_size): New const data member.
1612 (Sized_incr_relobj::Local_symbol): New struct.
1613 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1614 (Sized_incr_relobj::do_local_symbol_offset): New function.
1615 (Sized_incr_relobj::local_symbol_count_): New data member.
1616 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1617 (Sized_incr_relobj::local_symbol_index_): New data member.
1618 (Sized_incr_relobj::local_symbol_offset_): New data member.
1619 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1620 (Sized_incr_relobj::local_symbols_): New data member.
1621 * object.h (Relobj::output_local_symbol_count): New function.
1622 (Relobj::local_symbol_offset): New function.
1623 (Relobj::do_output_local_symbol_count): New function.
1624 (Relobj::do_local_symbol_offset): New function.
1625 (Sized_relobj::do_output_local_symbol_count): New function.
1626 (Sized_relobj::do_local_symbol_offset): New function.
1628 2011-04-22 Vladimir Simonov <sv@sw.ru>
1630 * descriptors.cc (set_close_on_exec): New function.
1631 (Descriptors::open): Use set_close_on_exec.
1632 * output.cc (S_ISLNK): Define if not defined.
1634 2011-04-22 Cary Coutant <ccoutant@google.com>
1636 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1638 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1639 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1640 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1642 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1643 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1644 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1646 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1648 (Incremental_binary::apply_incremental_relocs): New function.
1649 (Incremental_binary::do_apply_incremental_relocs): New function.
1650 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1652 (Sized_incremental_binary::add_global_symbol): New function.
1653 (Sized_incremental_binary::global_symbol): New function.
1654 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1655 (Sized_incremental_binary::symbol_map_): New data member.
1656 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1657 * target.h (Sized_target::apply_relocation): New function.
1658 * target-reloc.h (apply_relocation): New function.
1659 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1661 2011-04-22 Doug Kwan <dougkwan@google.com>
1663 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1664 flag of a SHT_ARM_EXIDX section.
1665 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1666 * testsuite/Makefile.in: Regenerate.
1667 * testsuite/arm_exidx_test.s: New file.
1668 * testsuite/arm_exidx_test.sh: Same.
1670 2011-04-20 Cary Coutant <ccoutant@google.com>
1673 * archive.h (Incremental_archive_entry::Archive_member):
1674 Initialize arg_serial_ (second constructor).
1676 2011-04-17 Ian Lance Taylor <iant@google.com>
1678 * object.cc (Relocate_info::location): Simplify location string.
1679 * errors.cc (Errors::error_at_location): Don't print program
1681 (Errors::warning_at_location): Likewise.
1682 (Errors::undefined_symbol): Likewise.
1683 * testsuite/debug_msg.sh: Update accordingly.
1685 2011-04-14 Cary Coutant <ccoutant@google.com>
1687 * gold/layout.cc (Layout::symtab_section_offset): New function.
1688 * gold/layout.h (Layout::symtab_section_offset): New function.
1689 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1691 2011-04-12 Ian Lance Taylor <iant@google.com>
1693 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1694 with MREMAP_MAYMOVE.
1695 * output.h (class Output_file): Add map_is_allocated_ field.
1696 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1697 not available, provide stubs. If mremap is not available, #define
1699 (MREMAP_MAYMOVE): Define if not defined.
1700 (Output_file::Output_file): Initialize map_is_allocated_.
1701 (Output_file::resize): Check map_is_allocated_.
1702 (Output_file::map_anonymous): If mmap fails, use malloc.
1703 (Output_file::unmap): Don't do anything for an anonymous map.
1704 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1705 is not available, provide stubs.
1706 (File_read::View::~View): Use free rather than delete[].
1707 (File_read::make_view): Use malloc rather than new[]. If mmap
1709 (File_read::find_or_make_view): Use malloc rather than new[].
1710 * gold.h: Remove HAVE_REMAP code.
1711 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1712 exists. Rename mremap to gold_mremap. If mmap is not available
1714 * configure, config.in: Rebuild.
1716 2011-04-11 Ian Lance Taylor <iant@google.com>
1718 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1719 initialize local variable v.
1721 2011-04-11 Cary Coutant <ccoutant@google.com>
1723 * archive.cc (Archive::include_member): Adjust call to
1725 (Add_archive_symbols::run): Track argument serial numbers.
1726 (Lib_group::include_member): Likewise.
1727 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1728 * archive.h (Incremental_archive_entry::Archive_member):
1729 Initialize arg_serial_.
1730 (Archive_member::arg_serial_): New data member.
1731 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1732 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1734 (Sized_dynobj::do_for_all_local_got_entries): New function.
1735 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1737 * fileread.cc (get_mtime): New function.
1738 * fileread.h (get_mtime): New function.
1739 * gold.cc (queue_initial_tasks): Check for incremental update.
1740 (process_incremental_input): New function.
1741 (queue_middle_tasks): Don't force valid target for incremental
1743 * incremental-dump.cc (find_input_containing_global): Adjust
1744 size of symbol info entry.
1745 (dump_incremental_inputs): Dump argument serial number and
1746 in_system_directory flag; bias shndx by 1; print symbol names
1747 when dumping per-file symbol lists; use new symbol info readers.
1749 (Output_section_incremental_inputs:update_data_size): New function.
1750 (Sized_incremental_binary::setup_readers): Setup input readers
1751 for each input file; build maps for files added from libraries
1753 (Sized_incremental_binary::check_input_args): New function.
1754 (Sized_incremental_binary::do_check_inputs): Build map of argument
1755 serial numbers to input arguments.
1756 (Sized_incremental_binary::do_file_has_changed): Rename
1757 do_file_is_unchanged to this; compare file modification times.
1758 (Sized_incremental_binary::do_init_layout): New function.
1759 (Sized_incremental_binary::do_reserve_layout): New function.
1760 (Sized_incremental_binary::do_get_input_reader): Remove.
1761 (Sized_incremental_binary::get_symtab_view): New function.
1762 (Incremental_checker::can_incrementally_link_output_file): Remove.
1763 (Incremental_inputs::report_command_line): Exclude --debug options.
1764 (Incremental_inputs::report_archive_begin): Add parameter; track
1765 argument serial numbers; don't put input file entry for archive
1766 before archive members.
1767 (Incremental_inputs::report_archive_end): Put input file entry
1768 for archive after archive members.
1769 (Incremental_inputs::report_object): Add parameter; track argument
1770 serial numbers and in_system_directory flag.
1771 (Incremental_inputs::report_script): Add parameter; track argument
1773 (Output_section_incremental_inputs::set_final_data_size): Adjust
1774 size of symbol info entry; check for forwarding symbols.
1775 (Output_section_incremental_inputs::write_input_files): Write
1776 in_system_directory flag and argument serial number.
1777 (Output_section_incremental_inputs::write_info_blocks): Map section
1778 indices between incremental info and original input file; store
1779 input section index for each symbol.
1780 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1781 change operator() to visit().
1782 (class Global_got_offset_visitor): Likewise.
1783 (class Global_symbol_visitor_got_plt):
1784 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1786 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1787 (Sized_incr_relobj::do_read_symbols): New function.
1788 (Sized_incr_relobj::do_layout): New function.
1789 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1790 (Sized_incr_relobj::do_add_symbols): New function.
1791 (Sized_incr_relobj::do_should_include_member): New function.
1792 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1793 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1794 (Sized_incr_relobj::do_section_size): New function.
1795 (Sized_incr_relobj::do_section_name): New function.
1796 (Sized_incr_relobj::do_section_contents): New function.
1797 (Sized_incr_relobj::do_section_flags): New function.
1798 (Sized_incr_relobj::do_section_entsize): New function.
1799 (Sized_incr_relobj::do_section_address): New function.
1800 (Sized_incr_relobj::do_section_type): New function.
1801 (Sized_incr_relobj::do_section_link): New function.
1802 (Sized_incr_relobj::do_section_info): New function.
1803 (Sized_incr_relobj::do_section_addralign): New function.
1804 (Sized_incr_relobj::do_initialize_xindex): New function.
1805 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1806 (Sized_incr_relobj::do_read_relocs): New function.
1807 (Sized_incr_relobj::do_gc_process_relocs): New function.
1808 (Sized_incr_relobj::do_scan_relocs): New function.
1809 (Sized_incr_relobj::do_count_local_symbols): New function.
1810 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1811 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1812 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1813 (Sized_incr_relobj::do_relocate): New function.
1814 (Sized_incr_relobj::do_set_section_offset): New function.
1815 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1816 (Sized_incr_dynobj::do_read_symbols): New function.
1817 (Sized_incr_dynobj::do_layout): New function.
1818 (Sized_incr_dynobj::do_add_symbols): New function.
1819 (Sized_incr_dynobj::do_should_include_member): New function.
1820 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1821 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1822 (Sized_incr_dynobj::do_section_size): New function.
1823 (Sized_incr_dynobj::do_section_name): New function.
1824 (Sized_incr_dynobj::do_section_contents): New function.
1825 (Sized_incr_dynobj::do_section_flags): New function.
1826 (Sized_incr_dynobj::do_section_entsize): New function.
1827 (Sized_incr_dynobj::do_section_address): New function.
1828 (Sized_incr_dynobj::do_section_type): New function.
1829 (Sized_incr_dynobj::do_section_link): New function.
1830 (Sized_incr_dynobj::do_section_info): New function.
1831 (Sized_incr_dynobj::do_section_addralign): New function.
1832 (Sized_incr_dynobj::do_initialize_xindex): New function.
1833 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1834 (make_sized_incremental_object): New function.
1835 (Incremental_library::copy_unused_symbols): New function.
1836 (Incremental_library::do_for_all_unused_symbols): New function.
1837 * incremental.h (enum Incremental_input_flags): New type.
1838 (class Incremental_checker): Remove.
1839 (Incremental_input_entry::Incremental_input_entry): Add argument
1841 (Incremental_input_entry::arg_serial): New function.
1842 (Incremental_input_entry::set_is_in_system_directory): New function.
1843 (Incremental_input_entry::is_in_system_directory): New function.
1844 (Incremental_input_entry::arg_serial_): New data member.
1845 (Incremental_input_entry::is_in_system_directory_): New data member.
1846 (class Script_info): Move here from script.h.
1847 (Script_info::Script_info): Add filename parameter.
1848 (Script_info::filename): New function.
1849 (Script_info::filename_): New data member.
1850 (Incremental_script_entry::Incremental_script_entry): Add argument
1852 (Incremental_object_entry::Incremental_object_entry): Likewise.
1853 (Incremental_object_entry::add_input_section): Build list of input
1854 sections with map to original shndx.
1855 (Incremental_object_entry::get_input_section_index): New function.
1856 (Incremental_object_entry::shndx_): New data member.
1857 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1858 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1859 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1861 (Incremental_inputs::report_archive_begin): Likewise.
1862 (Incremental_inputs::report_object): Likewise.
1863 (Incremental_inputs::report_script): Likewise.
1864 (class Incremental_global_symbol_reader): New class.
1865 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1866 and store flags and input file type.
1867 (Incremental_input_entry_reader::arg_serial): New function.
1868 (Incremental_input_entry_reader::type): Extract type from flags.
1869 (Incremental_input_entry_reader::is_in_system_directory): New function.
1870 (Incremental_input_entry_reader::get_input_section_count): Call
1871 accessor function for type.
1872 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1873 function for type; adjust size of global symbol entry.
1874 (Incremental_input_entry_reader::get_global_symbol_count): Call
1875 accessor function for type.
1876 (Incremental_input_entry_reader::get_object_count): Likewise.
1877 (Incremental_input_entry_reader::get_object_offset): Likewise.
1878 (Incremental_input_entry_reader::get_member_count): Likewise.
1879 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1880 (Incremental_input_entry_reader::get_member_offset): Likewise.
1881 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1882 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1883 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1884 (Incremental_input_entry_reader::get_global_symbol_reader): New
1886 (Incremental_input_entry_reader::get_output_symbol_index): New
1888 (Incremental_input_entry_reader::type_): Remove.
1889 (Incremental_input_entry_reader::flags_): New data member.
1890 (Incremental_inputs_reader::input_file_offset): New function.
1891 (Incremental_inputs_reader::input_file_index): New function.
1892 (Incremental_inputs_reader::input_file): Call input_file_offset.
1893 (Incremental_inputs_reader::input_file_at_offset): New function.
1894 (Incremental_relocs_reader::get_r_type): Reformat.
1895 (Incremental_relocs_reader::get_r_shndx): Reformat.
1896 (Incremental_relocs_reader::get_r_offset): Reformat.
1897 (Incremental_relocs_reader::data): New function.
1898 (Incremental_binary::Incremental_binary): Initialize new data members.
1899 (Incremental_binary::check_inputs): Add cmdline parameter.
1900 (Incremental_binary::file_is_unchanged): Remove.
1901 (Input_reader::arg_serial): New function.
1902 (Input_reader::get_unused_symbol_count): New function.
1903 (Input_reader::get_unused_symbol): New function.
1904 (Input_reader::do_arg_serial): New function.
1905 (Input_reader::do_get_unused_symbol_count): New function.
1906 (Input_reader::do_get_unused_symbol): New function.
1907 (Incremental_binary::input_file_count): New function.
1908 (Incremental_binary::get_input_reader): Change signature to use
1909 index instead of filename.
1910 (Incremental_binary::file_has_changed): New function.
1911 (Incremental_binary::get_input_argument): New function.
1912 (Incremental_binary::get_library): New function.
1913 (Incremental_binary::get_script_info): New function.
1914 (Incremental_binary::init_layout): New function.
1915 (Incremental_binary::reserve_layout): New function.
1916 (Incremental_binary::output_file): New function.
1917 (Incremental_binary::do_check_inputs): New function.
1918 (Incremental_binary::do_file_is_unchanged): Remove.
1919 (Incremental_binary::do_file_has_changed): New function.
1920 (Incremental_binary::do_init_layout): New function.
1921 (Incremental_binary::do_reserve_layout): New function.
1922 (Incremental_binary::do_input_file_count): New function.
1923 (Incremental_binary::do_get_input_reader): Change signature.
1924 (Incremental_binary::input_args_map_): New data member.
1925 (Incremental_binary::library_map_): New data member.
1926 (Incremental_binary::script_map_): New data member.
1927 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1929 (Sized_incremental_binary::output_section): New function.
1930 (Sized_incremental_binary::inputs_reader): Add const.
1931 (Sized_incremental_binary::symtab_reader): Add const.
1932 (Sized_incremental_binary::relocs_reader): Add const.
1933 (Sized_incremental_binary::got_plt_reader): Add const.
1934 (Sized_incremental_binary::get_symtab_view): New function.
1935 (Sized_incremental_binary::Inputs_reader): New typedef.
1936 (Sized_incremental_binary::Input_entry_reader): New typedef.
1937 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1938 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1939 (Sized_incremental_binary::do_file_has_changed): New function.
1940 (Sized_incremental_binary::do_init_layout): New function.
1941 (Sized_incremental_binary::do_reserve_layout): New function.
1942 (Sized_input_reader::Inputs_reader): Remove.
1943 (Sized_input_reader::Input_entry_reader): Remove.
1944 (Sized_input_reader::do_arg_serial): New function.
1945 (Sized_input_reader::do_get_unused_symbol_count): New function.
1946 (Sized_input_reader::do_get_unused_symbol): New function.
1947 (Sized_incremental_binary::do_input_file_count): New function.
1948 (Sized_incremental_binary::do_get_input_reader): Change signature;
1949 use index instead of filename.
1950 (Sized_incremental_binary::section_map_): New data member.
1951 (Sized_incremental_binary::input_entry_readers_): New data member.
1952 (class Sized_incr_relobj): New class.
1953 (class Sized_incr_dynobj): New class.
1954 (make_sized_incremental_object): New function.
1955 (class Incremental_library): New class.
1956 * layout.cc (Free_list::num_lists): New static data member.
1957 (Free_list::num_nodes): New static data member.
1958 (Free_list::num_removes): New static data member.
1959 (Free_list::num_remove_visits): New static data member.
1960 (Free_list::num_allocates): New static data member.
1961 (Free_list::num_allocate_visits): New static data member.
1962 (Free_list::init): New function.
1963 (Free_list::remove): New function.
1964 (Free_list::allocate): New function.
1965 (Free_list::dump): New function.
1966 (Free_list::print_stats): New function.
1967 (Layout_task_runner::run): Resize output file for incremental updates.
1968 (Layout::Layout): Initialize new data members.
1969 (Layout::set_incremental_base): New function.
1970 (Layout::init_fixed_output_section): New function.
1971 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1972 incremental updates.
1973 (Layout::create_gold_note): Do not create gold note section for
1974 incremental updates.
1975 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1976 for incremental updates.
1977 (Layout::set_section_offsets): For incremental updates, allocate space
1979 (Layout::create_symtab_sections): Layout with offsets relative to
1980 start of section; for incremental updates, allocate space from free
1982 (Layout::create_shdrs): For incremental updates, allocate space from
1984 (Layout::finish_dynamic_section): For incremental updates, do not
1985 check --as-needed (fixed in subsequent patch).
1986 * layout.h (class Free_list): New class.
1987 (Layout::set_incremental_base): New function.
1988 (Layout::incremental_base): New function.
1989 (Layout::init_fixed_output_section): New function.
1990 (Layout::allocate): New function.
1991 (Layout::incremental_base_): New data member.
1992 (Layout::free_list_): New data member.
1993 * main.cc (main): Print Free_list statistics.
1994 * object.cc (Relobj::finalize_incremental_relocs): Add
1995 clear_counts parameter; clear counts only when clear_counts is set.
1996 (Sized_relobj::Sized_relobj): Initialize new base class.
1997 (Sized_relobj::do_layout): Don't report special sections.
1998 (Sized_relobj::do_for_all_local_got_entries): New function.
1999 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2000 symtab_off to all symbol table offsets.
2001 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2002 * object.h (class Got_offset_list): Move to top of file.
2003 (Object::Object): Allow case where input_file == NULL.
2004 (Object::~Object): Likewise.
2005 (Object::input_file): Assert that input_file != NULL.
2006 (Object::lock): Allow case where input_file == NULL.
2007 (Object::unlock): Likewise.
2008 (Object::is_locked): Likewise.
2009 (Object::token): Likewise.
2010 (Object::release): Likewise.
2011 (Object::is_incremental): New function.
2012 (Object::get_mtime): New function.
2013 (Object::for_all_local_got_entries): New function.
2014 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2015 (Object::set_is_in_system_directory): New function.
2016 (Object::is_in_system_directory): New function.
2017 (Object::do_is_incremental): New function.
2018 (Object::do_get_mtime): New function.
2019 (Object::do_for_all_local_got_entries): New function.
2020 (Object::is_in_system_directory_): New data member.
2021 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2022 (class Sized_relobj_base): New class.
2023 (class Sized_relobj): Derive from Sized_relobj_base.
2024 (class Sized_relobj::Symbols): Redeclare from base class.
2025 (class Sized_relobj::local_got_offset_list): Remove.
2026 (class Sized_relobj::Output_sections): Redeclare from base class.
2027 (class Sized_relobj::do_for_all_local_got_entries): New function.
2028 (class Sized_relobj::write_local_symbols): Add offset parameter.
2029 (class Sized_relobj::local_symbol_offset_): Update comment.
2030 (class Sized_relobj::local_dynsym_offset_): Update comment.
2031 * options.cc (Input_arguments::add_file): Remove const.
2032 * options.h (Input_file_argument::Input_file_argument):
2033 Initialize arg_serial_ (all constructors).
2034 (Input_file_argument::set_arg_serial): New function.
2035 (Input_file_argument::arg_serial): New function.
2036 (Input_file_argument::arg_serial_): New data member.
2037 (Input_arguments::Input_arguments): Initialize file_count_.
2038 (Input_arguments::add_file): Remove const.
2039 (Input_arguments::number_of_input_files): New function.
2040 (Input_arguments::file_count_): New data member.
2041 (Command_line::number_of_input_files): Call
2042 Input_arguments::number_of_input_files.
2043 * output.cc (Output_segment_headers::Output_segment_headers):
2045 (Output_section::Input_section::current_data_size): New function.
2046 (Output_section::Output_section): Initialize new data members.
2047 (Output_section::add_input_section): Don't do merge sections for
2048 an incremental link; allocate space from free list for an
2050 (Output_section::add_output_section_data): Allocate space from
2051 free list for an incremental update.
2052 (Output_section::update_data_size): New function.
2053 (Output_section::set_fixed_layout): New function.
2054 (Output_section::reserve): New function.
2055 (Output_segment::set_section_addresses): Remove const.
2056 (Output_segment::set_section_list_addresses): Remove const; allocate
2057 space from free list for an incremental update.
2058 (Output_segment::set_offset): Adjust size of RELRO segment for an
2060 * output.h (Output_data::current_data_size): Move here from
2062 (Output_data::pre_finalize_data_size): New function.
2063 (Output_data::update_data_size): New function.
2064 (Output_section_headers::update_data_size): new function.
2065 (Output_section_data_build::current_data_size): Move to Output_data.
2066 (Output_data_strtab::update_data_size): New function.
2067 (Output_section::current_data_size): Move to Output_data.
2068 (Output_section::set_fixed_layout): New function.
2069 (Output_section::has_fixed_layout): New function.
2070 (Output_section::reserve): New function.
2071 (Output_section::update_data_size): New function.
2072 (Output_section::has_fixed_layout_): New data member.
2073 (Output_section::free_list_): New data member.
2074 (Output_segment::set_section_addresses): Remove const.
2075 (Output_segment::set_section_list_addresses): Remove const.
2076 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2078 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2080 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2081 parameter when calling Add_symbols constructor; store argument
2082 serial number for members of a lib group.
2083 (Add_symbols::locks): Allow case where token == NULL.
2084 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2085 (Read_member::~Read_member): New function.
2086 (Read_member::is_runnable): New function.
2087 (Read_member::locks): New function.
2088 (Read_member::run): New function.
2089 (Check_script::~Check_script): New function.
2090 (Check_script::is_runnable): New function.
2091 (Check_script::locks): New function.
2092 (Check_script::run): New function.
2093 (Check_library::~Check_library): New function.
2094 (Check_library::is_runnable): New function.
2095 (Check_library::locks): New function.
2096 (Check_library::run): New function.
2097 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2098 (Add_symbols::library_): New data member.
2099 (class Read_member): New class.
2100 (class Check_script): New class.
2101 (class Check_library): New class.
2102 * reloc.cc (Read_relocs::is_runnable): Allow case where
2104 (Read_relocs::locks): Likewise.
2105 (Scan_relocs::locks): Likewise.
2106 (Relocate_task::locks): Likewise.
2107 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2109 (Sized_relobj::incremental_relocs_scan): Fix comment.
2110 (Sized_relobj::do_relocate): Pass output file offset to
2111 write_local_symbols.
2112 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2113 from class declaration.
2114 * script.cc (read_input_script): Allocate Script_info; pass
2115 argument serial number to report_script.
2116 * script.h (class Script_info): Move to incremental.h.
2117 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2118 * symtab.h (Symbol_table::add_from_incrobj): New function.
2119 (Symbol_table::set_file_offset): New function.
2121 2011-04-05 Cary Coutant <ccoutant@google.com>
2123 * incremental-dump.cc (dump_incremental_inputs): Change signature
2124 to take a Sized_incremental_binary; change caller. Use readers
2125 in Sized_incremental_binary.
2127 (Sized_incremental_binary::find_incremental_inputs_sections):
2128 Rename do_find_incremental_inputs_sections to this.
2129 (Sized_incremental_binary::setup_readers): New function.
2130 (Sized_incremental_binary::do_check_inputs): Check
2131 has_incremental_info_ flag; move setup code to setup_readers;
2133 (Sized_incremental_binary::do_file_is_unchanged): New function.
2134 (Sized_incremental_binary::do_get_input_reader): New function.
2135 * incremental.h (class Incremental_binary): Move to end of file.
2136 (Incremental_binary::file_is_unchanged): New function.
2137 (Incremental_binary::do_file_is_unchanged): New function.
2138 (Incremental_binary::Input_reader): New class.
2139 (Incremental_binary::get_input_reader): New function.
2140 (class Sized_incremental_binary): Move to end of file.
2141 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2142 input section reader classes.
2143 (Sized_incremental_binary::has_incremental_info): New function.
2144 (Sized_incremental_binary::inputs_reader): New function.
2145 (Sized_incremental_binary::symtab_reader): New function.
2146 (Sized_incremental_binary::relocs_reader): New function.
2147 (Sized_incremental_binary::got_plt_reader): New function.
2148 (Sized_incremental_binary::do_file_is_unchanged): New function.
2149 (Sized_incremental_binary::Sized_input_reader): New class.
2150 (Sized_incremental_binary::get_input_reader): New function.
2151 (Sized_incremental_binary::find_incremental_inputs_sections):
2152 Rename do_find_incremental_inputs_sections to this.
2153 (Sized_incremental_binary::setup_readers): New function.
2154 (Sized_incremental_binary::has_incremental_info_): New data member.
2155 (Sized_incremental_binary::inputs_reader_): New data member.
2156 (Sized_incremental_binary::symtab_reader_): New data member.
2157 (Sized_incremental_binary::relocs_reader_): New data member.
2158 (Sized_incremental_binary::got_plt_reader_): New data member.
2159 (Sized_incremental_binary::current_input_file_): New data member.
2161 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2164 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2167 2011-03-30 Cary Coutant <ccoutant@google.com>
2169 * archive.cc (Archive::include_member): Adjust call to report_object.
2170 (Add_archive_symbols::run): Add script_info to call to
2171 report_archive_begin.
2172 (Lib_group::include_member): Adjust call to report_object.
2173 (Add_lib_group_symbols::run): Adjust call to report_object.
2174 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2175 blocks. Add object count for script input files.
2176 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2177 script_info parameter; change all callers.
2178 (Incremental_inputs::report_object): Add script_info parameter;
2180 (Incremental_inputs::report_script): Store backpointer to
2181 incremental info entry.
2182 (Output_section_incremental_inputs::set_final_data_size): Record
2183 additional information for scripts.
2184 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2185 * incremental.h (Incremental_script_entry::add_object): New function.
2186 (Incremental_script_entry::get_object_count): New function.
2187 (Incremental_script_entry::get_object): New function.
2188 (Incremental_script_entry::objects_): New data member; adjust
2190 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2191 (Incremental_inputs::report_object): Add script_info parameter.
2192 (Incremental_inputs_reader::get_object_count): New function.
2193 (Incremental_inputs_reader::get_object_offset): New function.
2194 * options.cc (Input_arguments::add_file): Return reference to
2196 * options.h (Input_argument::set_script_info): New function.
2197 (Input_argument::script_info): New function.
2198 (Input_argument::script_info_): New data member; adjust all
2200 (Input_file_group::add_file): Return reference to new input argument.
2201 (Input_file_lib::add_file): Likewise.
2202 (Input_arguments::add_file): Likewise.
2203 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2204 * script.cc (Parser_closure::Parser_closure): Add script_info
2205 parameter; adjust all callers.
2206 (Parser_closure::script_info): New function.
2207 (Parser_closure::script_info_): New data member.
2208 (read_input_script): Report scripts earlier to incremental info.
2209 (script_add_file): Set script_info in Input_argument.
2210 (script_add_library): Likewise.
2211 * script.h (Script_options::Script_info): Rewrite class.
2213 2011-03-29 Cary Coutant <ccoutant@google.com>
2215 * archive.cc (Library_base::should_include_member): Move
2216 method here from class Archive.
2217 (Archive::Archive): Initialize base class.
2218 (Archive::should_include_member): Move to base class.
2219 (Archive::do_for_all_unused_symbols): New function.
2220 (Add_archive_symbols::run): Remove redundant access to
2222 (Lib_group::Lib_group): Initialize base class.
2223 (Lib_group::do_filename): New function.
2224 (Lib_group::include_member): Pass pointer to Lib_group to
2226 (Lib_group::do_for_all_unused_symbols): New function.
2227 (Add_lib_group_symbols::run): Report archive information for
2229 * archive.h (class Library_base): New base class.
2230 (class Archive): Derive from Library_base.
2231 (Archive::filename): Move to base class.
2232 (Archive::set_incremental_info): Likewise.
2233 (Archive::incremental_info): Likewise.
2234 (Archive::Should_include): Likewise.
2235 (Archive::should_include_member): Likewise.
2236 (Archive::Armap_entry): Remove.
2237 (Archive::Unused_symbol_iterator): Remove.
2238 (Archive::unused_symbols_begin): Remove.
2239 (Archive::unused_symbols_end): Remove.
2240 (Archive::do_filename): New function.
2241 (Archive::do_get_mtime): New function.
2242 (Archive::do_for_all_unused_symbols): New function.
2243 (Archive::task_): Move to base class.
2244 (Archive::incremental_info_): Likewise.
2245 (class Lib_group): Derive from Library_base.
2246 (Lib_group::do_filename): New function.
2247 (Lib_group::do_get_mtime): New function.
2248 (Lib_group::do_for_all_unused_symbols): New function.
2249 (Lib_group::task_): Move to base class.
2250 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2252 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2254 * incremental.cc (Incremental_inputs::report_archive_begin):
2255 Use Library_base; call library's get_mtime; add incremental inputs
2256 entry before members.
2257 (class Unused_symbol_visitor): New class.
2258 (Incremental_inputs::report_archive_end): Use Library_base; use
2259 visitor class to record unused symbols; don't add incremental inputs
2260 entry after members.
2261 (Incremental_inputs::report_object): Use Library_base.
2263 (Incremental_archive_entry::Incremental_archive_entry): Remove
2264 unused Archive parameter.
2265 (Incremental_inputs::report_archive_begin): Use Library_base.
2266 (Incremental_inputs::report_archive_end): Likewise.
2267 (Incremental_inputs::report_object): Likewise.
2268 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2270 * object.h (Object::for_all_global_symbols): New function.
2271 (Object::do_for_all_global_symbols): New function.
2272 (Sized_relobj::do_for_all_global_symbols): New function.
2273 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2275 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2278 2011-03-27 Ian Lance Taylor <iant@google.com>
2280 * archive.cc (Archive::interpret_header): Return -1 if something
2281 goes wrong. Change callers accordingly.
2283 2011-03-25 Cary Coutant <ccoutant@google.com>
2285 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2286 * testsuite/Makefile.in: Regenerate.
2288 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2290 * plugin.cc (get_view): New.
2291 (Plugin::load): Pass get_view to the plugin.
2292 (Plugin_manager::get_view): New.
2294 2011-03-21 Ian Lance Taylor <iant@google.com>
2296 * testsuite/final_layout.sh: Rewrite to not use dc.
2297 * testsuite/relro_test.sh: Fail if dc is not present.
2299 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2301 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2303 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2304 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2306 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2307 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2309 2011-03-14 Ian Lance Taylor <iant@google.com>
2311 * script-sections.cc (Sort_output_sections::script_compare):
2312 Rename from is_before, change return type.
2313 (Sort_output_sections::operator()): Adjust accordingly.
2315 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2318 * testsuite/odr_violation2.cc: Add comment to make all error line
2319 numbers double digits.
2320 * testsuite/debug_msg.sh: Adjust expected errors.
2322 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2324 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2325 but mark earlier ones as non-canonical
2326 (offset_to_iterator): Update search target and example
2327 (do_addr2line): Return extra lines in a vector*
2328 (format_file_lineno): Extract from do_addr2line
2329 (one_addr2line): Add vector* out-param
2330 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2331 when a lineno entry appeared last for its instruction
2332 (Dwarf_line_info): Add vector* out-param
2333 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2334 * symtab.cc (Odr_violation_compare): Include the lineno in the
2336 (linenos_from_loc): New. Combine the canonical line for an
2337 address with its other lines.
2338 (True_if_intersect): New. Helper functor to make
2339 std::set_intersection a query.
2340 (detect_odr_violations): Compare sets of lines instead of just
2341 one line for each function. This became less deterministic, but
2342 has fewer false positives.
2343 * symtab.h: Declarations.
2344 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2345 mix an optimized and non-optimized object in the same binary
2346 (odr_violation2.so): Same.
2347 * testsuite/Makefile.in: Regenerate from Makefile.am.
2348 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2349 * testsuite/debug_msg.sh: Update line numbers and add
2351 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2352 non-optimized context.
2353 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2354 isn't inlined, and use OdrDerived in an optimized context.
2355 * testsuite/odr_header1.h: Defines OdrDerived, where
2356 optimization will change the
2357 first-instruction-in-the-destructor's file and line number.
2358 * testsuite/odr_header2.h: Defines OdrBase.
2360 2011-03-09 Ian Lance Taylor <iant@google.com>
2362 * fileread.cc (File_read::clear_views): Don't delete the whole
2365 2011-03-08 Ian Lance Taylor <iant@google.com>
2368 * fileread.cc: #include <climits>.
2369 (GOLD_IOV_MAX): Define.
2370 (File_read::read_multiple): Limit number of entries by iov_max.
2371 * fileread.h (class File_read): Always set max_readv_entries to
2374 2011-03-07 Ian Lance Taylor <iant@google.com>
2377 * options.h (class General_options): Add -dy and -dn.
2379 2011-03-02 Cary Coutant <ccoutant@google.com>
2381 * testsuite/script_test_9.t: Add TLS segment.
2383 2011-03-02 Simon Baldwin <simonb@google.com>
2385 * configure.ac: Add check for gnu_indirect_function support in
2386 the toolchain building binutils.
2387 * configure: Rebuild.
2389 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2391 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2392 plugin only symbols.
2393 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2394 in plugin files as not needed in the symbol table.
2396 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2398 * output.cc (Output_section::add_input_section): Delay fill
2399 generation for section ordering.
2401 2011-02-09 Ian Lance Taylor <iant@google.com>
2404 * object.h (class Sized_relobj): Remove clear_local_symbols.
2405 * reloc.cc (Sized_relobj::do_relocate): Don't call
2406 clear_local_symbols.
2408 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2410 * plugin.cc (is_visible_from_outside): Return true for symbols
2413 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2415 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2418 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2420 * icf.h (is_section_foldable_candidate): Change type of parameter
2422 * icf.cc (Icf::find_identical_sections): Change type of local variable
2423 section_name to be std::string.
2424 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2426 2011-01-25 Ian Lance Taylor <iant@google.com>
2428 * script.cc (script_add_extern): Rewrite to use
2429 add_symbol_reference.
2431 2011-01-25 Doug Kwan <dougkwan@google.com>
2433 * icf.cc (get_section_contents): Always lock section's object.
2435 2011-01-24 Ian Lance Taylor <iant@google.com>
2437 * options.h (class General_options): Accept
2438 --no-detect-odr-violations.
2440 2011-01-24 Ian Lance Taylor <iant@google.com>
2442 * version.cc (version_string): Bump to 1.11.
2444 2011-01-24 Ian Lance Taylor <iant@google.com>
2446 * plugin.cc (class Plugin_rescan): Define new class.
2447 (Plugin_manager::claim_file): Set any_claimed_.
2448 (Plugin_manager::save_archive): New function.
2449 (Plugin_manager::save_input_group): New function.
2450 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2452 (Plugin_manager::new_undefined_symbol): New function.
2453 (Plugin_manager::rescan): New function.
2454 (Plugin_manager::rescannable_defines): New function.
2455 (Plugin_manager::add_input_file): Set any_added_.
2456 * plugin.h (class Plugin_manager): define new fields rescannable_,
2457 undefined_symbols_, any_claimed_, and any_added_. Declare
2458 Plugin_rescan as friend. Declare new functions.
2459 (Plugin_manager::Rescannable): Define type.
2460 (Plugin_manager::Rescannable_list): Define type.
2461 (Plugin_manager::Undefined_symbol_list): Define type.
2462 (Plugin_manager::Plugin_manager): Initialize new fields.
2463 * archive.cc (Archive::defines_symbol): New function.
2464 (Add_archive_symbols::run): Pass archive to plugins if any.
2465 * archive.h (class Archive): Declare defines_symbol.
2466 * readsyms.cc (Input_group::~Input_group): New function.
2467 (Finish_group::run): Pass input_group to plugins if any.
2468 * readsyms.h (class Input_group): Declare destructor.
2469 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2472 2011-01-10 Ian Lance Taylor <iant@google.com>
2474 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2476 (Layout::set_segment_offsets): Reset increase_relro before calling
2477 set_section_addresses a second time.
2479 2011-01-04 Cary Coutant <ccoutant@google.com>
2481 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2482 sections before NOBITS sections.
2484 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2486 * version.cc (print_version): Update copyright to 2011.
2488 2010-12-23 Cary Coutant <ccoutant@google.com>
2490 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2491 of OS to this->add. Add OD parameter to second form of the function.
2493 2010-12-20 Ian Lance Taylor <iant@google.com>
2495 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2496 second of two consecutive entries with same offset.
2498 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2500 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2501 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2502 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2503 to avoid unneeded links against $(LDADD).
2504 * testsuite/Makefile.in: Regenerate.
2506 2010-12-15 Ian Lance Taylor <iant@google.com>
2509 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2510 for R_X86_64_32 and R_X86_64_PC32.
2511 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2512 ver_matching_def_pic.o.
2513 (ver_matching_def_pic.o): New target.
2515 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2517 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2518 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2519 Move definition before File_read::View member definitions.
2520 (File_read::View::~View): Initialize and hold lock before
2521 updating current_mapped_bytes.
2523 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2525 * dwarf_reader.cc: Remove outdated comment.
2526 * gold-threads.cc: Fix typo in error message.
2527 * archive.cc: Fix typos in comments.
2528 * archive.h: Likewise.
2529 * arm-reloc-property.cc: Likewise.
2530 * arm-reloc-property.h: Likewise.
2531 * arm-reloc.def: Likewise.
2533 * attributes.h: Likewise.
2534 * cref.cc: Likewise.
2535 * ehframe.cc: Likewise.
2536 * fileread.h: Likewise.
2538 * i386.cc: Likewise.
2540 * incremental.h: Likewise.
2541 * int_encoding.cc: Likewise.
2542 * layout.h: Likewise.
2543 * main.cc: Likewise.
2544 * merge.h: Likewise.
2545 * object.cc: Likewise.
2546 * object.h: Likewise.
2547 * options.cc: Likewise.
2548 * readsyms.cc: Likewise.
2549 * reduced_debug_output.cc: Likewise.
2550 * reloc.cc: Likewise.
2551 * script-sections.cc: Likewise.
2552 * sparc.cc: Likewise.
2553 * symtab.h: Likewise.
2554 * target-reloc.h: Likewise.
2555 * target.cc: Likewise.
2556 * target.h: Likewise.
2557 * timer.cc: Likewise.
2558 * timer.h: Likewise.
2559 * x86_64.cc: Likewise.
2561 2010-12-09 Cary Coutant <ccoutant@google.com>
2563 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2565 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2566 parameter; change all callers.
2567 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2568 * options.h (warn_execstack): New option.
2570 2010-12-07 Doug Kwan <dougkwan@google.com>
2572 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2573 like function call relocations.
2575 2010-12-07 Ian Lance Taylor <iant@google.com>
2577 * archive.cc (Archive::get_elf_object_for_member): Permit
2578 punconfigured to be NULL.
2579 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2580 (Archive::include_member): Pass NULL to get_elf_object_for_member
2581 if we searched for the archive and this is the first included
2584 2010-12-01 Ian Lance Taylor <iant@google.com>
2586 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2587 track_relocs_type_ field.
2588 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2589 Set track_relocs_type_.
2590 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2591 contents when using RELA relocs.
2592 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2594 * reloc.cc (Track_relocs::next_addend): New function.
2595 * reloc.h (class Track_relocs): Declare next_addend.
2597 2010-12-01 Ian Lance Taylor <iant@google.com>
2599 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2602 2010-12-01 Ian Lance Taylor <iant@google.com>
2604 * README: Update compilers known to work and fail.
2606 2010-11-23 Matthias Klose <doko@ubuntu.com>
2608 * configure.in: For --enable-gold, handle value `default' instead of
2609 `both*'. Always install ld as ld.bfd, install as ld if gold is
2611 * configure: Regenerate.
2613 2010-11-18 Doug Kwan <dougkwan@google.com>
2615 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2616 and right_alignment to be zero. Store result alignment only if it is
2617 greater than existing alignment.
2619 2010-11-16 Cary Coutant <ccoutant@google.com>
2622 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2623 Check for ".zdebug_line".
2625 2010-11-16 Doug Kwan <dougkwan@google.com>
2626 Cary Coutant <ccoutant@google.com>
2628 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2629 by reference; adjust all callers.
2630 * output.cc (Output_segment::set_section_addresses): Adjust references
2631 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2633 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2634 end at page boundary.
2636 2010-11-16 Cary Coutant <ccoutant@google.com>
2639 * layout.cc (Layout::choose_output_section): Transform names of
2640 compressed sections even when using a script with a SECTIONS clause.
2641 (Layout::output_section_name): Remove code to transform
2642 compressed debug section names.
2643 * output.cc (Output_section::add_input_section): Use uncompressed
2644 section size when tracking input sections.
2646 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2648 * symtab.h (Symbol::NON_PIC_REF): Remove.
2649 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2650 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2651 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2652 (Symbol::use_plt_offset): Take a flags argument and pass it
2653 directly to needs_dynamic_reloc. Restrict check for undefined
2654 weak symbols to function calls.
2655 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2656 (Target_arm::Scan::global): Use it.
2657 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2658 (Target_arm::Relocate::relocate): Likewise.
2659 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2660 parameter with an r_type parameter. Use get_reference_flags
2662 (Target_arm::Relocate::relocate): Update accordingly.
2663 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2664 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2665 (Target_i386::Scan::global): Likewise.
2666 (Target_i386::Relocate::relocate): Likewise.
2667 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2668 parameter with an r_type parameter. Use get_reference_flags
2670 (Target_i386::Relocate::relocate): Update accordingly.
2671 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2672 (Target_powerpc::Scan::global): Use it.
2673 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2674 (Target_powerpc::Relocate::relocate): Likewise.
2675 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2676 (Target_sparc::Scan::global): Use it.
2677 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2678 (Target_sparc::Relocate::relocate): Likewise.
2679 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2680 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2681 (Target_x86_64::Scan::global): Likewise.
2682 (Target_x86_64::Relocate::relocate): Likewise.
2684 2010-11-08 Doug Kwan <dougkwan@google.com>
2685 Cary Coutant <ccoutant@google.com>
2687 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2688 (Arm_exidx_merge_section::section_contents_): New data member.
2689 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2690 (Arm_input_section::~Arm_input_section): De-allocate memory.
2691 (Arm_input_section::original_contents_): New data member.
2692 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2693 in parameters instead of calling Object::section_contents without
2695 (Arm_output_section::group_section): New parameter TASK. Pass it
2696 to callees that need locking objects.
2697 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2698 to lock EXIDX input sections. Fix a formatting issue. Call
2699 Arm_exidx_merged_section::build_contents to create merged section
2701 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2702 to lock object of stub table owner.
2703 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2704 TEXT_SIZE to initialize data member TEXT_SIZE_.
2705 (Arm_exidx_input_section::addralign): Fix typo in comment.
2706 (Arm_exidx_input_section::text_size): New method.
2707 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2708 that require locking objects. Lock objects before scanning for stubs
2709 and updating local symbols.
2710 (Arm_input_section<big_endian>::init): Copy contents of original
2712 (Arm_input_section<big_endian>::do_write): Use saved contents of
2713 original input section instead of calling Object::section_contents
2715 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2716 size without calling Object::section_size().
2717 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2718 for size. Allocate a buffer for merged EXIDX entries.
2719 (Arm_exidx_merged_section::build_contents): New method.
2720 (Arm_exidx_merged_section::do_write): Move merge section contents
2721 building code to Arm_exidx_merged_section::build_contetns. Write
2722 out contetns in buffer instead of building it on the fly.
2723 (Arm_relobj::make_exidx_input_section): Also pass text section size
2724 to Arm_exidx_input_section constructor.
2725 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2726 (Arm_dynobj::do_read_symbols): Fix memory leak.
2727 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2728 * target.h: (class Task): Add forward declaration.
2729 (Target::relax): Add new parameter TASK and pass it to
2731 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2733 2010-11-05 Cary Coutant <ccoutant@google.com>
2736 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2737 object when reading from the file.
2738 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2740 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2741 when reading section contents.
2742 (get_section_contents): Likewise.
2743 (icf::find_identical_sections): Likewise.
2744 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2745 object when reading from the file.
2746 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2747 the object when doing deferred section layout.
2749 2010-11-03 Nick Clifton <nickc@redhat.com>
2752 * script.h (class Symbol_assignment: name): New member. Returns
2753 the name of the symbol.
2754 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2755 Returns true if the given symbol name is on the list of
2756 assignments wating to be processed.
2757 * archive.cc (should_incldue_member): If the symbol is undefined,
2758 check to see if it is on the list of symbols pending assignment.
2760 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2762 * script-sections.cc (Script_sections::find_memory_region): Check
2763 for a NULL output section pointer.
2765 2010-10-29 Doug Kwan <dougkwan@google.com>
2767 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2768 Output_section::add_relaxed_input_section.
2769 * output.cc (Output_section::add_relaxed_input_section): Add new
2770 arguments LAYOUT and NAME. Set section order index.
2771 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2772 Copy section order index.
2773 * output.h (Output_section::add_relaxed_input_section): Add new
2774 arguments LAYOUT and NAME.
2776 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2778 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2779 NATIVE_OR_CROSS_LINKER.
2780 * testsuite/Makefile.in: Regenerate.
2782 2010-10-20 Doug Kwan <dougkwan@google.com>
2784 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2785 without SHF_LINK_ORDER flags.
2786 * layout.cc (Layout::choose_output_section): Do not filter
2787 SHF_LINK_ORDER flag in a relocatable link.
2789 2010-10-17 Cary Coutant <ccoutant@google.com>
2791 * output.h (Output_segment::set_section_addresses): Change function
2792 signature. Update all callers.
2793 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2795 (Output_segment::set_section_addresses): Align after last TLS
2796 section. Add padding before last relro section instead of after.
2798 2010-10-17 Doug Kwan <dougkwan@google.com>
2800 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2801 GOT output section to be writable.
2803 2010-10-14 Cary Coutant <ccoutant@google.com>
2805 * debug.h (DEBUG_INCREMENTAL): New flag.
2806 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2807 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2809 * incremental.cc (report_command_line): Ignore all forms of
2811 * layout.cc (Layout::Layout): Check parameters for incremental link
2813 * options.cc (General_options::parse_incremental): New function.
2814 (General_options::parse_no_incremental): New function.
2815 (General_options::parse_incremental_full): New function.
2816 (General_options::parse_incremental_update): New function.
2817 (General_options::incremental_mode_): New data member.
2818 (General_options::finalize): Check incremental_mode_.
2819 * options.h (General_options): Update help text for --incremental.
2820 Add --no-incremental, --incremental-full, --incremental-update.
2821 (General_options::Incremental_mode): New enum type.
2822 (General_options::incremental_mode): New function.
2823 (General_options::incremental_mode_): New data member.
2824 * parameters.cc (Parameters::incremental_mode_): New data member.
2825 (Parameters::set_options): Set incremental_mode_.
2826 (Parameters::set_incremental_full): New function.
2827 (Parameters::incremental): New function.
2828 (Parameters::incremental_update): New function.
2829 (set_parameters_incremental_full): New function.
2830 * parameters.h (Parameters::set_incremental_full): New function.
2831 (Parameters::incremental): New function.
2832 (Parameters::incremental_update): New function.
2833 (Parameters::incremental_mode_): New data member.
2834 (set_parameters_incremental_full): New function.
2835 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2836 incremental link mode.
2837 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2838 (Sized_relobj::do_relocate_sections): Likewise.
2839 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2841 * testsuite/Makefile.in: Regenerate.
2842 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2844 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2846 * script-sections.h (class Script_sections): Make
2847 Sections_elements typedef public.
2848 * script-sections.cc (class Sort_output_sections): Add elements_
2849 field. Add constructor which sets it; change all callers.
2850 (Sort_output_sections::is_before): New function.
2851 (Sort_output_sections::operator()): Call is_before.
2852 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2854 * testsuite/script_test_10.sh: New test. Test script section
2856 * testsuite/script_test_10.t: Likewise.
2857 * testsuite/script_test_10.s: Likewise.
2858 * testsuite/Makefile.am: Wrap the cross linker tests and the
2859 common tests into NATIVE_OR_CROSS_LINKER.
2860 (check_SCRIPTS): Add script_test_10.sh.
2861 (check_DATA): Add script_test_10.stdout.
2862 (script_test_10.o, script_test_10): New targets.
2863 (script_test_10.stdout): New target.
2864 * configure, testsuite/Makefile.in: Regenerate.
2866 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2868 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2869 error for the deprecated relocations.
2870 (Target_arm::Scan::global): Likewise.
2871 (Target_arm::Relocate::relocate): Likewise.
2873 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2875 * fileread.cc (Input_file::find_file): Initialize *found_name
2876 and *namep when using the fallback search for case 4.
2878 2010-10-11 Cary Coutant <ccoutant@google.com>
2880 * options.h (class General_options): Redefine -z lazy as an alias for
2881 the negation of -z now.
2883 2010-10-11 Ian Lance Taylor <iant@google.com>
2885 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2888 2010-10-06 Nick Clifton <nickc@redhat.com>
2890 * script-sections.cc(class Memory_region): Remove
2891 current_lma_offset_ field. Rename current_vma_offset_ to
2892 current_offset_. Add last_section_ field.
2893 (Memory_region::get_current_vma_address): Rename to
2894 get_current_address.
2895 (Memory_region::get_current_lma_address): Delete.
2896 (Memory_region::increment_vma_offset): Rename to
2898 (Memory_region::increment_lma_offset): Delete.
2899 (Memory_region::attributes_compatible): New method. Returns
2900 true if the provided section is compatible with the region.
2901 (Memory_region::get_last_section): New method. Returns the last
2902 section to use the region.
2903 (Memory_region::set_last_section): New method. Stores the last
2904 section to use the region.
2905 (Script_sections::block_in_region): New method. Returns true if
2906 a block of memory is contained within a region.
2907 (Script_sections::find_memory_region): New method. Locates a
2908 memory region to be used to set a VMA or LMA address.
2909 (Output_section_definition::set_section_addresses): Add code to
2910 check for addresses set by memory regions.
2911 (Output_segment::set_section_addresses): Remove memory region
2913 (Script_sections::create_segment): Add a warning if a header
2914 segment is created outside of any region.
2915 * script-sections.h (class Script_sections): Add prototypes for
2916 find_memory_region and block_in_region methods.
2917 * testsuite/memory_test.s: Use .long instead of .word.
2918 * testsuite/memory_test.t: Add some more output sections.
2919 * testsuite/memory_test.sh: Update expected output.
2921 2010-10-02 Doug Kwan <dougkwan@google.com>
2923 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2924 defintion to symtab.h
2925 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2926 declaration to defintion.
2928 2010-10-01 Nick Clifton <nickc@redhat.com>
2930 * expression.cc (eval): Replace dummy argument with NULL.
2931 (eval_maybe_dot): Check for a NULL result section pointer.
2932 (Symbol_expression::value): Likewise.
2933 (Dot_expression::value): Likewise.
2934 (BINARY_EXPRESSION): Likewise.
2935 (Max_expression::value): Likewise.
2936 (Min_expression::value): Likewise.
2937 (Absolute_expression::value): Likewise.
2938 (Addr_expression::value_from_output_section): Likewise.
2939 (Loaddddr_expression::value_from_output_section): Likewise.
2940 (Segment_start_expression::value): Likewise.
2941 * script-sections.cc
2942 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2944 (Sections_elememt_dot_assignment::set_section_addresses):
2946 (Output_data_expression::do_write_to_buffer): Likewise.
2947 (Output_section_definition::finalize_symbols): Likewise.
2948 (Output_section_definition::set_section_addresses): Likewise.
2950 2010-09-30 Doug Kwan <dougkwan@google.com>
2952 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2954 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2956 * target.h (Target::can_icf_inline_merge_sections): New virtual
2958 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2960 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2962 * icf.cc (get_section_contents): Inline merge sections only when
2965 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2967 * configure: Regenerate.
2969 2010-09-17 Ian Lance Taylor <iant@google.com>
2971 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2972 * testsuite/Makefile.am (memory_test.o): New target.
2973 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2975 * testsuite/Makefile.in: Rebuild.
2977 2010-09-17 Doug Kwan <dougkwan@google.com>
2979 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2980 defintion if relocation uses GOT entries of the symbol.
2981 * testsuite/icf_safe_test.sh: Fix test.
2982 * testsuite/icf_safe_so_test.sh: Fix test.
2984 2010-09-16 Cary Coutant <ccoutant@google.com>
2986 * script_sections.cc (class Memory_region): Remove "NULL" from
2987 vector initializations.
2989 2010-09-15 Cary Coutant <ccoutant@google.com>
2991 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2992 Resolve forwarding symbols.
2994 2010-09-15 Doug Kwan <dougkwan@google.com>
2996 * gold/testsuite/script_test_3.t: Add ARM special sections.
2997 * gold/testsuite/script_test_4.t: Same.
2998 * gold/testsuite/script_test_5.t: Same.
2999 * gold/testsuite/script_test_6.t: Same.
3000 * gold/testsuite/script_test_7.t: Same.
3001 * gold/testsuite/script_test_7.t: Same.
3002 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3004 2010-09-14 Cary Coutant <ccoutant@google.com>
3006 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3007 (Target_x86_64::Relocate::relocate_tls): Replace check for
3008 saw_tls_block_reloc_ with test for executable section.
3010 2010-09-12 Cary Coutant <ccoutant@google.com>
3012 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3013 position-independent executables to shared libraries need dynamic
3015 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3016 position-independent executables.
3017 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3018 * testsuite/Makefile.in: Regenerate.
3020 2010-09-10 Nick Clifton <nickc@redhat.com>
3023 * testsuite/memory_test.t: Discard any sections that are not
3026 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3029 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3030 "This::" to work around a bug in gcc 4.2.
3032 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3034 2010-09-09 Rafael Espindola <espindola@google.com>
3036 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3037 sections with different PF_X flags in the same segment.
3038 (Layout::find_first_load_seg): Search all segments to find the first
3040 * options.h (rosegment): New.
3042 2010-09-08 Rafael Espindola <espindola@google.com>
3044 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3046 2010-09-08 Doug Kwan <dougkwan@google.com>
3048 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3049 (Arm_relobj::do_relocate_sections): Add new parameter for output
3050 file to match the parent.
3051 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3052 of local symbols instead of input values. Update code to track
3053 changes in gold::relocate_section.
3054 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3055 (Sized_relobj::compute_final_local_value_internal): New methods.
3056 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3057 body into private version of Sized_relobj::compute_final_local_value.
3058 Call the inline method.
3059 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3060 merged symbol value if there is one.
3061 (Symbol_value::has_output_value): New method defintiion.
3062 (Sized_relobj::Compute_final_local_value_status): New enum type.
3063 (Sized_relobj::compute_final_local_value): New methods.
3064 (Sized_relobj::compute_final_local_value_internal): New methods.
3065 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3066 and arm_cortex_a8.sh.
3067 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3068 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3070 * Makefile.in: Regenerate.
3071 * testsuite/arm_bl_out_of_range.s: Update test.
3072 * testsuite/thumb_bl_out_of_range.s: Ditto.
3073 * testsuite/thumb_blx_out_of_range.s: Ditto.
3074 * testsuite/arm_branch_out_of_range.sh: New file.
3075 * testsuite/arm_cortex_a8.sh: Ditto.
3076 * testsuite/arm_cortex_a8_b.s: Ditto.
3077 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3078 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3079 * testsuite/arm_cortex_a8_bl.s: Ditto.
3080 * testsuite/arm_cortex_a8_blx.s: Ditto.
3081 * testsuite/arm_cortex_a8_local.s: Ditto.
3082 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3083 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3085 2010-09-08 Rafael Espindola <espindola@google.com>
3087 * Makefile.am (memory_test.stdout): Run readelf with -W.
3088 * Makefile.in: Regenerate.
3089 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3092 2010-09-08 Rafael Espindola <espindola@google.com>
3094 * script-sections.cc (Script_sections::add_memory_region): Convert
3095 field precision to int.
3096 * script.cc (script_set_section_region, script_set_section_region):
3097 Convert field precision to int.
3099 2010-09-08 Rafael Espindola <espindola@google.com>
3101 * arm.cc (do_finalize_sections): Create the __exidx_start and
3102 __exdix_end symbols even when the section is missing.
3104 2010-09-08 Nick Clifton <nickc@redhat.com>
3106 * README: Remove claim that MEMORY is not supported.
3107 * expression.cc (script_exp_function_origin)
3108 (script_exp_function_length): Move from here to ...
3109 * script.cc: ... here.
3110 (script_set_section_region, script_add_memory)
3111 (script_parse_memory_attr, script_include_directive): New
3113 * script-sections.cc
3114 (class Memory_region): New class.
3115 (class Output_section_definition): Add set_memory_region,
3116 set_section_vma, set_section_lma and get_section_name methods.
3117 (class Script_Sections): Add add_memory_region,
3118 find_memory_region, find_memory_region_origin,
3119 find_memory_region_length and set_memory_region methods.
3120 Have set_section_addresses method walk the list of set memory
3122 Extend the print methos to display memory regions.
3123 * script-sections.h: Add prototypes for new methods.
3124 Add enum for MEMORY region attributes.
3125 * yyscript.y: Add support for parsing MEMORY regions.
3126 * script-c.h: Add prototypes for new functions.
3127 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3128 * testsuite/Makefile.in: Regenerate.
3129 * testsuite/memory_test.sh: New script.
3130 * testsuite/memory_test.s: New assembler source file.
3131 * testsuite/memory_test.t: New linker script.
3133 2010-08-27 Doug Kwan <dougkwan@google.com>
3135 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3136 reference override an existing dynamic weak reference.
3137 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3138 * testsuite/Makefile.in: Regenerate.
3139 * testsuite/dyn_weak_ref.sh: New file.
3140 * testsuite/dyn_weak_ref_1.c: Ditto.
3141 * testsuite/dyn_weak_ref_2.c: Ditto.
3143 2010-08-27 Ian Lance Taylor <iant@google.com>
3145 * incremental.h (class Incremental_input_entry): Add virtual
3148 2010-08-27 Ian Lance Taylor <iant@google.com>
3150 * testsuite/start_lib_test_3.c: Mark t3 as used.
3152 2010-08-27 Nick Clifton <nickc@redhat.com>
3154 * options.cc (version_script): Fix small typo in previous
3157 2010-08-25 Nick Clifton <nickc@redhat.com>
3159 * archive.cc: Formatting fixes: Remove whitespace between
3160 typename and following asterisk. Remove whitespace between
3161 function name and opening parenthesis.
3162 * archive.h: Likewise.
3164 * attributes.cc: Likewise.
3165 * attributes.h: Likewise.
3166 * common.cc: Likewise.
3167 * copy-relocs.cc: Likewise.
3168 * dirsearch.h: Likewise.
3169 * dynobj.cc: Likewise.
3170 * ehframe.cc: Likewise.
3171 * ehframe.h: Likewise.
3172 * expression.cc: Likewise.
3173 * fileread.cc: Likewise.
3174 * fileread.h: Likewise.
3176 * gold-threads.cc: Likewise.
3177 * gold.cc: Likewise.
3178 * i386.cc: Likewise.
3180 * incremental-dump.cc: Likewise.
3181 * incremental.cc: Likewise.
3182 * layout.cc: Likewise.
3183 * layout.h: Likewise.
3184 * main.cc: Likewise.
3185 * merge.cc: Likewise.
3186 * merge.h: Likewise.
3187 * object.cc: Likewise.
3188 * object.h: Likewise.
3189 * options.cc: Likewise.
3190 * options.h: Likewise.
3191 * output.cc: Likewise.
3192 * output.h: Likewise.
3193 * plugin.cc: Likewise.
3194 * plugin.h: Likewise.
3195 * powerpc.cc: Likewise.
3196 * reloc.cc: Likewise.
3197 * script-c.h: Likewise.
3198 * script-sections.cc: Likewise.
3199 * script.cc: Likewise.
3200 * stringpool.cc: Likewise.
3201 * symtab.cc: Likewise.
3202 * symtab.h: Likewise.
3203 * target.cc: Likewise.
3204 * timer.cc: Likewise.
3205 * timer.h: Likewise.
3206 * version.cc: Likewise.
3207 * x86_64.cc: Likewise.
3209 2010-08-24 Nick Clifton <nickc@redhat.com>
3212 * layout.cc (segment_precedes): Sort segments by their physical
3213 addresses, if they have been set.
3215 2010-08-23 Cary Coutant <ccoutant@google.com>
3217 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3219 (Lib_group::include_member): Unlock object after deleting its
3221 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3224 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3225 Cary Coutant <ccoutant@google.com>
3227 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3228 constructor, and set_blocker.
3229 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3231 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3232 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3233 * testsuite/Makefile.am (start_lib_test): New test case.
3234 * testsuite/Makefile.in: Regenerate.
3235 * testsuite/start_lib_test_main.c: New file.
3236 * testsuite/start_lib_test_1.c: New file.
3237 * testsuite/start_lib_test_2.c: New file.
3238 * testsuite/start_lib_test_3.c: New file.
3240 2010-08-19 Ian Lance Taylor <iant@google.com>
3242 * Makefile.in: Rebuild with automake 1.11.1.
3243 * aclocal.m4: Likewise.
3244 * testsuite/Makefile.in: Likewise.
3246 2010-08-19 Ian Lance Taylor <iant@google.com>
3249 * i386.cc (class Output_data_plt_i386): Update declarations.
3250 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3251 local_ifuncs_ fields.
3252 (Target_i386::do_plt_section_for_global): New function.
3253 (Target_i386::do_plt_section_for_local): New function.
3254 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3255 parameter; change all callers. Initialize global_ifuncs_ and
3256 local_ifuncs_. If doing a static link define __rel_iplt_start and
3258 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3259 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3260 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3262 (Target_i386::make_plt_section): New function, broken out of
3263 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3264 (Target_i386::make_plt_entry): Call make_plt_section.
3265 (Target_i386::make_local_ifunc_plt_entry): New function.
3266 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3267 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3268 R_386_IRELATIVE to switch.
3269 (Target_i386::Scan::global): Likewise.
3270 (Target_i386::Relocate::relocate): Likewise.
3271 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3273 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3274 (Target_x86_64::do_plt_section_for_global): New function.
3275 (Target_x86_64::do_plt_section_for_local): New function.
3276 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3277 parameter; change all callers. If doing a static link define
3278 __rela_iplt_start and __rela_iplt_end.
3279 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3280 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3281 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3283 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3284 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3286 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3287 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3288 R_X86_64_IRELATIVE to switch.
3289 (Target_x86_64::Scan::global): Likewise.
3290 (Target_x86_64::Relocate::relocate): Likewise.
3291 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3293 * target.h (class Target): Add plt_section_for_global and
3294 plt_section_for_local functions. Add do_plt_section_for_global
3295 and do_plt_section_for_local virtual functions.
3296 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3297 clarifying comments.
3298 (Symbol::use_plt_offset): Handle IFUNC symbol.
3299 * object.cc (Sized_relobj::Sized_relobj): Initialize
3301 (Sized_relobj::local_has_plt_offset): New function.
3302 (Sized_relobj::local_plt_offset): New function.
3303 (Sized_relobj::set_local_plt_offset): New function.
3304 (Sized_relobj::do_count): Handle IFUNC symbol.
3305 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3306 a bit away from input_shndx_ field. Add set_is_func_symbol and
3307 is_ifunc_symbol functions.
3308 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3309 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3310 local_plt_offsets_ field.
3311 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3312 * output.h (class Output_section_data): Add non-const
3313 output_section function.
3314 (class Output_data_got): Update declarations.
3315 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3316 Add use_plt_offset parameter to global and local constructors.
3317 Change all callers. Change local_sym_index_ field to 31 bits.
3318 Change GSYM_CODE and CONSTANT_CODE accordingly.
3319 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3320 doing a static link don't set sh_link field.
3321 (Output_data_got::Got_entry::write): Use PLT offset if
3323 (Output_data_got::add_global_plt): New function.
3324 (Output_data_got::add_local_plt): New function.
3325 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3326 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3327 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3328 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3329 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3331 * testsuite/ifunc-sel.h: New file.
3332 * testsuite/ifuncmain1.c: New file.
3333 * testsuite/ifuncmain1vis.c: New file.
3334 * testsuite/ifuncmod1.c: New file.
3335 * testsuite/ifuncdep2.c: New file.
3336 * testsuite/ifuncmain2.c: New file.
3337 * testsuite/ifuncmain3.c: New file.
3338 * testsuite/ifuncmod3.c: New file.
3339 * testsuite/ifuncmain4.c: New file.
3340 * testsuite/ifuncmain5.c: New file.
3341 * testsuite/ifuncmod5.c: New file.
3342 * testsuite/ifuncmain6pie.c: New file.
3343 * testsuite/ifuncmod6.c: New file.
3344 * testsuite/ifuncmain7.c: New file.
3345 * configure, testsuite/Makefile.in: Rebuild.
3347 2010-08-18 Ian Lance Taylor <iant@google.com>
3350 (Output_section_incremental_inputs::write_input_files): Add cast
3351 to avoid signed/unsigned comparison warning.
3352 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3354 2010-08-12 Cary Coutant <ccoutant@google.com>
3356 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3358 2010-08-13 Ian Lance Taylor <iant@google.com>
3360 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3362 2010-08-12 Cary Coutant <ccoutant@google.com>
3363 Doug Kwan <dougkwan@google.com>
3365 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3366 defintion overrides non-weak undef, remember that the original undef
3368 * symtab.cc (Symbol_table::sized_write_global): For undef without
3369 an original weak binding, set binding to global in output.
3370 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3371 * testsuite/Makefile.in: Regenerate.
3372 * testsuite/strong_ref_weak_def.sh: New file.
3373 * testsuite/strong_ref_weak_def_1.c: Ditto.
3374 * testsuite/strong_ref_weak_def_2.c: Ditto.
3376 2010-08-12 Cary Coutant <ccoutant@google.com>
3378 * testsuite/incremental_test.sh: Rewrite.
3379 * testsuite/incremental_test_1.c: Rewrite.
3380 * testsuite/incremental_test_2.c: Rewrite.
3382 2010-08-12 Cary Coutant <ccoutant@google.com>
3384 * arm.cc (Target_arm::got_size): Add const.
3385 (Target_arm::got_entry_count): New function.
3386 (Target_arm::plt_entry_count): New function.
3387 (Target_arm::first_plt_entry_offset): New function.
3388 (Target_arm::plt_entry_size): New function.
3389 (Output_data_plt_arm::entry_count): New function.
3390 (Output_data_plt_arm::first_plt_entry_offset): New function.
3391 (Output_data_plt_arm::get_plt_entry_size): New function.
3392 * i386.cc (Target_i386::got_size): Add const.
3393 (Target_i386::got_entry_count): New function.
3394 (Target_i386::plt_entry_count): New function.
3395 (Target_i386::first_plt_entry_offset): New function.
3396 (Target_i386::plt_entry_size): New function.
3397 (Output_data_plt_i386::entry_count): New function.
3398 (Output_data_plt_i386::first_plt_entry_offset): New function.
3399 (Output_data_plt_i386::get_plt_entry_size): New function.
3400 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3401 find_incremental_inputs_sections. Dump incremental_got_plt section.
3402 * incremental.cc: Include target.h.
3403 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3404 parameter. Adjust all callers. Find incremental_got_plt section.
3405 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3407 (Output_section_incremental_inputs::set_final_data_size): Calculate
3408 size of incremental_got_plt section.
3409 (Output_section_incremental_inputs::do_write): Write the
3410 incremental_got_plt section.
3411 (Got_plt_view_info): New struct.
3412 (Local_got_offset_visitor): New class.
3413 (Global_got_offset_visitor): New class.
3414 (Global_symbol_visitor_got_plt): New class.
3415 (Output_section_incremental_inputs::write_got_plt): New function.
3416 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3417 Add parameter. Adjust all callers.
3418 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3419 (Incremental_inputs::got_plt_section): New function.
3420 (Incremental_inputs::got_plt_section_): New data member.
3421 (Incremental_got_plt_reader): New class.
3422 * layout.cc (Layout::create_incremental_info_sections): Add the
3423 incremental_got_plt section.
3424 * object.h (Got_offset_list::get_list): New function.
3425 (Got offset_list::for_all_got_offsets): New function.
3426 (Sized_relobj::local_got_offset_list): New function.
3427 * powerpc.cc (Target_powerpc::got_size): Add const.
3428 (Target_powerpc::got_entry_count): New function.
3429 (Target_powerpc::plt_entry_count): New function.
3430 (Target_powerpc::first_plt_entry_offset): New function.
3431 (Target_powerpc::plt_entry_size): New function.
3432 (Output_data_plt_powerpc::entry_count): New function.
3433 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3434 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3435 * sparc.cc (Target_sparc::got_size): Add const.
3436 (Target_sparc::got_entry_count): New function.
3437 (Target_sparc::plt_entry_count): New function.
3438 (Target_sparc::first_plt_entry_offset): New function.
3439 (Target_sparc::plt_entry_size): New function.
3440 (Output_data_plt_sparc::entry_count): New function.
3441 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3442 (Output_data_plt_sparc::get_plt_entry_size): New function.
3443 * symtab.h (Symbol::got_offset_list): New function.
3444 (Symbol_table::for_all_symbols): New function.
3445 * target.h (Sized_target::got_entry_count): New function.
3446 (Sized_target::plt_entry_count): New function.
3447 (Sized_target::plt_entry_size): New function.
3448 * x86_64.cc (Target_x86_64::got_size): Add const.
3449 (Target_x86_64::got_entry_count): New function.
3450 (Target_x86_64::plt_entry_count): New function.
3451 (Target_x86_64::first_plt_entry_offset): New function.
3452 (Target_x86_64::plt_entry_size): New function.
3453 (Output_data_plt_x86_64::entry_count): New function.
3454 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3455 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3457 2010-08-12 Cary Coutant <ccoutant@google.com>
3459 * archive.cc: Include incremental.h.
3460 (Archive::Archive): Initialize incremental_info_.
3461 (Archive::include_member): Record archive members in incremental info.
3462 (Add_archive_symbols::run): Record begin and end of an archive in
3464 (Lib_group::include_member): Record objects in incremental info.
3465 * archive.h (Incremental_archive_entry): Forward declaration.
3466 (Archive::set_incremental_info): New member function.
3467 (Archive::incremental_info): New member function.
3468 (Archive::Unused_symbol_iterator): New class.
3469 (Archive::unused_symbols_begin): New member function.
3470 (Archive::unused_symbols_end): New member function.
3471 (Archive::incremental_info_): New data member.
3472 * incremental-dump.cc (find_input_containing_global): New function.
3473 (dump_incremental_inputs): Dump new incremental info sections.
3474 * incremental.cc: Include symtab.h.
3475 (Output_section_incremental_inputs): New class.
3476 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3477 new incremental info sections.
3478 (Sized_incremental_binary::do_check_inputs): Likewise.
3479 (Incremental_inputs::report_archive): Remove.
3480 (Incremental_inputs::report_archive_begin): New function.
3481 (Incremental_inputs::report_archive_end): New function.
3482 (Incremental_inputs::report_object): New function.
3483 (Incremental_inputs::finalize_inputs): Remove.
3484 (Incremental_inputs::report_input_section): New function.
3485 (Incremental_inputs::report_script): Rewrite.
3486 (Incremental_inputs::finalize): Do nothing but finalize string table.
3487 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3488 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3489 (Incremental_inputs::create_data_sections): New function.
3490 (Incremental_inputs::relocs_entsize): New function.
3491 (Output_section_incremental_inputs::set_final_data_size): New function.
3492 (Output_section_incremental_inputs::do_write): New function.
3493 (Output_section_incremental_inputs::write_header): New function.
3494 (Output_section_incremental_inputs::write_input_files): New function.
3495 (Output_section_incremental_inputs::write_info_blocks): New function.
3496 (Output_section_incremental_inputs::write_symtab): New function.
3497 * incremental.h (Incremental_script_entry): Forward declaration.
3498 (Incremental_object_entry): Forward declaration.
3499 (Incremental_archive_entry): Forward declaration.
3500 (Incremental_inputs): Forward declaration.
3501 (Incremental_inputs_header_data): Remove.
3502 (Incremental_inputs_header): Remove.
3503 (Incremental_inputs_header_write): Remove.
3504 (Incremental_inputs_entry_data): Remove.
3505 (Incremental_inputs_entry): Remove.
3506 (Incremental_inputs_entry_write): Remove.
3507 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3508 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3509 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3510 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3512 (Incremental_input_entry): New class.
3513 (Incremental_script_entry): New class.
3514 (Incremental_object_entry): New class.
3515 (Incremental_archive_entry): New class.
3516 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3517 (Incremental_inputs::report_inputs): Remove.
3518 (Incremental_inputs::report_archive): Remove.
3519 (Incremental_inputs::report_archive_begin): New function.
3520 (Incremental_inputs::report_archive_end): New function.
3521 (Incremental_inputs::report_object): Change prototype.
3522 (Incremental_inputs::report_input_section): New function.
3523 (Incremental_inputs::report_script): Change prototype.
3524 (Incremental_inputs::get_reloc_count): New function.
3525 (Incremental_inputs::set_reloc_count): New function.
3526 (Incremental_inputs::create_data_sections): New function.
3527 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3528 (Incremental_inputs::inputs_section): New function.
3529 (Incremental_inputs::symtab_section): New function.
3530 (Incremental_inputs::relocs_section): New function.
3531 (Incremental_inputs::get_stringpool): Add const.
3532 (Incremental_inputs::command_line): Add const.
3533 (Incremental_inputs::inputs): Remove.
3534 (Incremental_inputs::command_line_key): New function.
3535 (Incremental_inputs::input_file_count): New function.
3536 (Incremental_inputs::input_files): New function.
3537 (Incremental_inputs::relocs_entsize): New function.
3538 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3539 (Incremental_inputs::finalize_inputs): Remove.
3540 (Incremental_inputs::Input_info): Remove.
3541 (Incremental_inputs::lock_): Remove.
3542 (Incremental_inputs::inputs_): Change type.
3543 (Incremental_inputs::inputs_map_): Remove.
3544 (Incremental_inputs::current_object_entry_): New data member.
3545 (Incremental_inputs::inputs_section_): New data member.
3546 (Incremental_inputs::symtab_section_): New data member.
3547 (Incremental_inputs::relocs_section_): New data member.
3548 (Incremental_inputs::reloc_count_): New data member.
3549 (Incremental_inputs_reader): New class.
3550 (Incremental_symtab_reader): New class.
3551 (Incremental_relocs_reader): New class.
3552 * layout.cc (Layout::finalize): Move finalization of incremental info
3553 and creation of incremental info sections to follow finalization of
3554 symbol table. Set offsets for postprocessing sections.
3555 (Layout::create_incremental_info_sections): Call
3556 Incremental_inputs::create_data_sections. Add incremental symtab
3557 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3558 sections to layout after input sections.
3559 * layout.h (struct Timespec): Forward declaration.
3560 (Layout::incremental_inputs): Add const.
3561 (Layout::create_incremental_info_sections): Add parameter.
3562 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3563 * object.cc: Include incremental.h.
3564 (Relobj::finalize_incremental_relocs): New function.
3565 (Sized_relobj::do_layout): Record input sections in incremental info.
3566 * object.h (Object::output_section): New function.
3567 (Object::output_section_offset): Moved from Relobj.
3568 (Object::get_incremental_reloc_base): New function.
3569 (Object::get_incremental_reloc_count): New function.
3570 (Object::do_output_section): New function.
3571 (Object::do_output_section_offset): Moved from Relobj.
3572 (Object::do_get_incremental_reloc_base): New function.
3573 (Object::do_get_incremental_reloc_count): New function.
3574 (Object::Object): Initialize new data members.
3575 (Relobj::output_section): Renamed do_output_section and moved to
3577 (Relobj::output_section_offset): Moved to Object.
3578 (Relobj::do_get_incremental_reloc_base): New function.
3579 (Relobj::do_get_incremental_reloc_count): New function.
3580 (Relobj::allocate_incremental_reloc_counts): New function.
3581 (Relobj::count_incremental_reloc): New function.
3582 (Relobj::finalize_incremental_relocs): New function.
3583 (Relobj::next_incremental_reloc_index): New function.
3584 (Relobj::reloc_counts_): New data member.
3585 (Relobj::reloc_bases_): New data member.
3586 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3587 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3588 (Sized_relobj::incremental_relocs_scan): New function.
3589 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3590 (Sized_relobj::incremental_relocs_write): New function.
3591 (Sized_relobj::incremental_relocs_write_reltype): New function.
3592 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3594 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3595 archives and object files elsewhere.
3596 (Add_symbols::run): Report object files here.
3597 (Finish_group::run): Report end of archive at end of group.
3598 * reloc.cc: Include layout.h, incremental.h.
3599 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3600 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3601 (Sized_relobj::incremental_relocs_scan): New function.
3602 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3603 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3604 (Sized_relobj::incremental_relocs_write): New function.
3605 (Sized_relobj::incremental_relocs_write_reltype): New function.
3606 * script.cc (read_input_script): Rewrite test for incremental link.
3607 Change call to Incremental_inputs::report_script.
3608 * symtab.h (Symbol_table::first_global_index): New function.
3609 (Symbol_table::output_count): New function.
3611 2010-08-12 Doug Kwan <dougkwan@google.com>
3613 * arm.cc (Target_arm::merge_object_attributes): Check command line
3614 options --no-wchar-size-warning and --no-enum-size-warning.
3615 * options.h (General_options): Add ld-compatible options
3616 --no-enum-size-warning and --no-wchar-size-warning.
3618 2010-08-04 Ian Lance Taylor <iant@google.com>
3620 * x86_64.cc (Target_x86_64::Scan::local): Use
3621 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3622 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3623 (Target_x86_64::Scan::global): Likewise.
3624 (Target_x86_64::Relocate::relocate): Likewise.
3625 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3628 2010-08-03 Cary Coutant <ccoutant@google.com>
3630 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3631 to reserve space in merged_strings vector. Keep total input size
3633 (Output_merge_string::do_print_merge_stats): Print total input size.
3634 * merge.h (Output_merge_string): Add input_size_ field.
3635 * stringpool.cc (Stringpool_template::string_length): Move
3636 implementations out of Stringpool_template class and place in
3638 * stringpool.h (string_length): Move out of Stringpool_template.
3640 2010-08-03 Ian Lance Taylor <iant@google.com>
3643 * layout.cc (relaxation_loop_body): If address of load segment is
3644 set, adjust address to include headers if possible.
3646 2010-08-03 Ian Lance Taylor <iant@google.com>
3648 * version.cc (version_string): Bump to 1.10.
3650 2010-08-03 Ian Lance Taylor <iant@google.com>
3653 * layout.h (enum Output_section_order): Define.
3654 (class Layout): Update declarations.
3655 * layout.cc (Layout::get_output_section): Add order parameter.
3656 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3657 is_first_non_relro parameters. Change all callers.
3658 (Layout::choose_output_section): Likewise.
3659 (Layout::add_output_section_data): Likewise.
3660 (Layout::make_output_section): Likewise. Set order.
3661 (Layout::default_section_order): New function.
3662 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3663 * output.cc (Output_section::Output_section): Initialize order_.
3664 Don't initialize deleted fields.
3665 (Output_segment::Output_segment): Don't initialize deleted
3667 (Output_segment::add_output_section_to_load): New function
3668 replacing add_output_section. Change all callers to call this or
3669 add_output_section_to_nonload.
3670 (Output_segment::add_output_section_to_nonload): New function.
3671 (Output_segment::remove_output_section): Rewrite.
3672 (Output_segment::add_initial_output_data): Likewise.
3673 (Output_segment::has_any_data_sections): Likewise.
3674 (Output_segment::is_first_section_relro): Likewise.
3675 (Output_segment::maximum_alignment): Likewise.
3676 (Output_segment::has_dynamic_reloc): New function replacing
3677 dynamic_reloc_count. Change all callers.
3678 (Output_segment::has_dynamic_reloc_list): New function replacing
3679 dynamic_reloc_count_list. Change all callers.
3680 (Output_segment::set_section_addresses): Rewrite.
3681 (Output_segment::set_offset): Rewrite.
3682 (Output_segment::find_first_and_last_list): Remove.
3683 (Output_segment::set_tls_offsets): Rewrite.
3684 (Output_segment::first_section_load_address): Likewise.
3685 (Output_segment::output_section_count): Likewise.
3686 (Output_segment::section_with_lowest_load_address): Likewise.
3687 (Output_segment::write_section_headers): Likewise.
3688 (Output_segment::print_sections_to_map): Likewise.
3689 * output.h (class Output_data): Remove dynamic_reloc_count_
3690 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3691 (Output_data::add_dynamic_reloc): Rewrite.
3692 (Output_data::has_dynamic_reloc): New function.
3693 (Output_data::dynamic_reloc_count): Remove.
3694 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3695 is_last_relro_, is_first_non_relro_, is_interp_,
3696 is_dynamic_linker_section_ fields. Add order and set_order
3697 functions. Remove is_relro_local, set_is_relro_local,
3698 is_last_relro, set_is_last_relro, is_first_non_relro,
3699 set_is_first_non_relro functions, is_interp, set_is_interp,
3700 is_dynamic_linker_section, and set_is_dynamic_linker_section
3702 (class Output_segment): Change Output_data_list from std::list to
3703 std:;vector. Add output_lists_ field. Remove output_data_ and
3704 output_bss_ fields. Update declarations.
3706 2010-08-02 Ian Lance Taylor <iant@google.com>
3708 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3709 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3710 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3712 2010-08-02 Ian Lance Taylor <iant@google.com>
3715 * script.cc (Script_options::Script_options): Initialize
3716 symbol_definitions_ and symbol_references_.
3717 (Script_options::add_symbol_assignment): Update
3718 symbol_definitions_ and symbol_references_.
3719 (Script_options::add_symbol_reference): New function.
3720 (script_symbol): New function.
3721 * script.h (class Script_options): Add symbol_definitions_ and
3722 symbol_references_ fields.
3723 (Script_options::referenced_const_iterator): New type.
3724 (Script_options::referenced_begin): New function.
3725 (Script_options::referenced_end): New function.
3726 (Script_options::is_referenced): New function.
3727 (Script_options::any_unreferenced): New function.
3728 * script-c.h (script_symbol): Declare.
3729 * yyscript.y (exp): Call script_symbol.
3730 * symtab.cc: Include "script.h".
3731 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3732 Change all callers. Check symbols referenced by scripts.
3733 (Symbol_table::add_undefined_symbols_from_command_line): Add
3734 layout parameter. Change all callers.
3735 (Symbol_table::do_add_undefined_symbols_from_command_line):
3736 Likewise. Break out loop body. Check symbols referenced by
3738 (Symbol_table::add_undefined_symbol_from_command_line): New
3739 function broken out of
3740 do_add_undefined_symbols_from_command_line.
3741 * symtab.h (class Symbol_table): Update declarations.
3742 * archive.cc: Include "layout.h".
3743 (Archive::should_include_member): Add layout parameter. Change
3744 all callers. Check for symbol mentioned in expression.
3745 * archive.h (class Archive): Update declaration.
3746 * object.cc (Sized_relobj::do_should_include_member): Add layout
3748 * object.h (Object::should_include_member): Add layout parameter.
3750 (Object::do_should_include_member): Add layout parameter.
3751 (class Sized_relobj): Update declaration.
3752 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3754 * dynobj.h (class Sized_dynobj): Update declaration.
3755 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3757 * plugin.h (class Sized_pluginobj): Update declaration.
3759 2010-08-02 Ian Lance Taylor <iant@google.com>
3762 * output.cc (Output_segment::set_offset): Search for the first and
3763 last sections rather than assuming that the list is in order.
3764 (Output_segment::find_first_and_last_list): New function.
3765 * output.h (class Output_segment): Update declarations.
3766 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3767 (relro_strip_test_SOURCES): New variable.
3768 (relro_strip_test_DEPENDENCIES): New variable.
3769 (relro_strip_test_LDFLAGS): New variable.
3770 (relro_strip_test_LDADD): New variable.
3771 (relro_strip_test.so): New target.
3773 2010-08-02 Ian Lance Taylor <iant@google.com>
3775 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3776 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3777 (Target_i386::got_tlsdesc_section): New function.
3778 (Target_i386::got_section): Create space for GOT entries for
3779 TLSDESC relocations.
3780 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3782 (Target_i386::Scan::global): Likewise.
3783 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3785 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3786 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3787 (Target_x86_64::got_tlsdesc_section): New function.
3788 (Target_x86_64::got_section): Create space for GOT entries for
3789 TLSDESC relocations.
3790 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3792 (Target_x86_64::Scan::global): Likewise.
3793 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3796 2010-08-02 Ian Lance Taylor <iant@google.com>
3798 * testsuite/final_layout.sh: Use dc to convert from hex to
3801 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3803 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3804 paramter to the call to gold::gc_process_relocs.
3805 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3806 paramter to the call to gold::gc_process_relocs.
3807 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3808 parameter to the call to gold::gc_process_relocs.
3809 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3810 template parameter to the call to gold::gc_process_relocs.
3811 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3812 paramter to the call to gold::gc_process_relocs.
3813 * gc.h (get_embedded_addend_size): New function.
3814 (gc_process_relocs): Save the size of the reloc for use by ICF.
3815 * icf.cc (get_section_contents): Get the addend from the text section
3816 for SHT_REL relocation sections.
3817 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3818 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3819 * int_encoding.h (read_from_pointer): New overloaded function.
3820 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3821 * testsuite/icf_sht_rel_addend_test.sh: New file.
3822 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3823 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3825 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3827 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3828 * Makefile.in: Regenerate.
3829 * testsuite/Makefile.in: Regenerate.
3831 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3833 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3834 * gold/testsuite/debug_msg.cc: Likewise.
3835 * gold/testsuite/odr_violation1.cc
3836 * gold/testsuite/odr_violation2.cc
3838 2010-07-21 Cary Coutant <ccoutant@google.com>
3840 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3841 string, and length fields.
3842 (Output_merge_string::Merged_strings_list): New type.
3843 (Output_merge_string::Merged_strings_lists): New typedef.
3844 (Output_merge_string): Replace merged_strings_ with
3845 merged_strings_lists_.
3846 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3847 Merged_strings_list per input object and section. Don't store pointer
3848 to the string. Don't store length with each merged string entry.
3849 (Output_merge_string::finalize_merged_data): Loop over list of merged
3850 strings lists. Recompute length of each merged string.
3852 2010-07-15 Cary Coutant <ccoutant@google.com>
3854 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3857 2010-07-14 Ian Lance Taylor <iant@google.com>
3859 * descriptors.cc (Descriptors::open): Report correct name in error
3862 2010-07-13 Doug Kwan <dougkwan@google.com>
3864 * arm.cc (Arm_input_section::Arm_input_section): For a
3865 SHT_ARM_EXIDX section, always keeps the input sections.
3866 (Arm_input_section::set_exidx_section_link): New method.
3867 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3868 has_errors_ to false.
3869 (Arm_exidx_input_section::has_errors,
3870 Arm_exidx_input_section::set_has_errors): New methods.
3871 (Arm_exidx_input_section::has_errors_): New data member.
3872 (Arm_relobj::get_exidx_shndx_list): New method.
3873 (Arm_output_section::append_text_sections_to_list): Do not skip
3874 section without SHF_EXECINSTR.
3875 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3877 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3878 section header. Make error messages more verbose. Check for
3879 a non-executable section linked to an EXIDX section.
3880 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3881 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3882 check that there is no deferred EXIDX section if we exit early.
3883 Instead of not making an EXIDX section in case of an error, make one
3884 and set the has_errors flag of it.
3885 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3886 in a relocatable link.
3887 (Target_arm::do_relax): Look for the EXIDX output section instead of
3888 assuming that it is called .ARM.exidx.
3889 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3890 section list. Do not check for SHF_EXECINSTR section flags but
3891 skip any input section with errors.
3892 * output.cc (Output_section::Output_section): Initialize
3893 always_keeps_input_sections_ to false.
3894 (Output_section::add_input_section): Check for
3895 always_keeps_input_sections_.
3896 * output.h (Output_section::always_keeps_input_sections,
3897 Output_section::set_always_keeps_input_sections): New methods.
3898 (Output_section::always_keeps_input_sections): New data member.
3900 2010-07-13 Rafael Espindola <espindola@google.com>
3902 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3903 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3905 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3906 Ian Lance Taylor <iant@google.com>
3908 * output.h (Output_section_lookup_maps::add_merge_section):
3909 Correct check of whether value was inserted.
3910 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3911 (Output_section_lookup_maps::add_relaxed_input_section):
3913 * arm.cc (Target_arm::got_section): Remove used local os.
3914 * i386.cc (Target_i386::got_section): Likewise.
3915 * x86_64.cc (Target_x86_64::got_section): Likewise.
3916 * sparc.cc (Target_sparc::got_section): Likewise.
3917 (Target_sparc::relocate): Remove unused local have_got_offset.
3918 * powerpc.cc (Target_powerpc::relocate): Likewise.
3920 2010-07-13 Ian Lance Taylor <iant@google.com>
3922 * compressed_output.cc (zlib_decompress): Fix signature in
3925 * archive.cc (Archive::include_member): Unlock an external member
3926 of a thin archive. Don't bother to delete an object we know is
3929 2010-07-12 Cary Coutant <ccoutant@google.com>
3931 * compressed_output.cc (zlib_decompress): New function.
3932 (get_uncompressed_size): New function.
3933 (decompress_input_section): New function.
3934 * compressed_output.h (get_uncompressed_size): New function.
3935 (decompress_input_section): New function.
3936 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3937 Handle compressed debug sections.
3938 * layout.cc (is_compressed_debug_section): New function.
3939 (Layout::output_section_name): Map compressed section names to
3941 * layout.h (is_compressed_debug_section): New function.
3942 (is_debug_info_section): Recognize compressed debug sections.
3943 * merge.cc: Include compressed_output.h.
3944 (Output_merge_data::do_add_input_section): Handle compressed
3946 (Output_merge_string::do_add_input_section): Handle compressed
3948 * object.cc: Include compressed_output.h.
3949 (Sized_relobj::Sized_relobj): Initialize new data members.
3950 (build_compressed_section_map): New function.
3951 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3952 * object.h (Object::section_is_compressed): New method.
3953 (Object::do_section_is_compressed): New method.
3954 (Sized_relobj::Compressed_section_map): New type.
3955 (Sized_relobj::do_section_is_compressed): New method.
3956 (Sized_relobj::compressed_sections_): New data member.
3957 * output.cc (Output_section::add_input_section): Handle compressed
3959 * reloc.cc: Include compressed_output.h.
3960 (Sized_relobj::write_sections): Handle compressed debug sections.
3962 2010-07-08 Cary Coutant <ccoutant@google.com>
3964 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3965 weak when resolving to a dynamic def.
3966 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3967 for weak undef/dynamic def cases. Adjust callers.
3968 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3969 undef_binding_weak_.
3970 (Symbol_table::sized_write_globals): Adjust symbol binding.
3971 (Symbol_table::sized_write_symbol): Add binding parameter.
3972 * symtab.h (Symbol::set_undef_binding): New method.
3973 (Symbol::is_undef_binding_weak): New method.
3974 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3975 (Symbol_table::should_override): Add new parameter.
3976 (Symbol_table::sized_write_symbol): Add new parameter.
3978 * testsuite/weak_undef_file1.cc: Add new test case.
3979 * testsuite/weak_undef_file2.cc: Fix header comment.
3980 * testsuite/weak_undef_test.cc: Add new test case.
3982 2010-06-29 Doug Kwan <dougkwan@google.com>
3984 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3985 Initialize USE_SYMBOL_.
3986 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3988 (Arm_reloc_property::uses_symbol_): New data member declaration.
3989 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3990 uses symbol value and symbol is undefined but not weakly undefined.
3992 2010-06-28 Rafael Espindola <espindola@google.com>
3994 * plugin.cc (Plugin::load): Use dlerror.
3996 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3998 * symtab.cc (detect_odr_violations): When reporting an ODR
3999 violation, report an object where the symbol is defined.
4001 2010-06-25 Doug Kwan <dougkwan@google.com>
4003 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4004 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4006 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4007 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4008 target hook to detect function points.
4009 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4010 * icf.h (Icf::check_section_for_function_pointers): Change type of
4011 parameter SECTION_NAME to const reference to std::string. Use
4012 target hook to determine if section may have unsafe pointers.
4013 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4016 2010-06-21 Rafael Espindola <espindola@google.com>
4018 * fileread.cc (Input_file::find_fie): New
4019 (Input_file::open): Use Input_file::find_fie.
4020 * fileread.h (Input_file::find_fie): New
4021 * plugin.cc (set_extra_library_path): New.
4022 (Plugin::load): Add set_extra_library_path to the transfer vector.
4023 (Plugin_manager::set_extra_library_path): New.
4024 (Plugin_manager::add_input_file): Use the extra search path if set.
4025 (set_extra_library_path(): New.
4026 * plugin.h (Plugin_manager): Add set_extra_library_path and
4029 2010-06-19 Cary Coutant <ccoutant@google.com>
4031 * layout.cc (gdb_sections): Add .debug_types.
4032 (lines_only_debug_sections): Likewise.
4034 2010-06-18 Rafael Espindola <espindola@google.com>
4036 * plugin.cc (add_input_file,add_input_library)
4037 (Plugin_manager::add_input_file): Make filename arguments const.
4038 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4041 2010-06-16 Doug Kwan <dougkwan@google.com>
4043 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4044 .ARM.attributes section if we have not merged any input
4045 attributes sections.
4047 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4049 * arm.cc: Allow combining objects with no EABI version
4052 2010-06-15 Rafael Espindola <espindola@google.com>
4054 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4056 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4058 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4059 (struct iovec): Correct !HAVE_READV definition.
4061 2010-06-10 Cary Coutant <ccoutant@google.com>
4063 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4064 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4066 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4069 * symtab.h (Symbol::is_placeholder): New member function.
4070 * target-reloc.h (relocate_section): Check for placeholder symbols.
4072 * testsuite/Makefile.am (plugin_test_8): New test.
4073 (plugin_test_9): New test.
4074 * testsuite/Makefile.in: Regenerate.
4076 2010-06-09 Nick Clifton <nickc@redhat.com>
4078 * yyscript.y (input_list_element): Allow strings prefixed with
4079 the '-' character. Treat these as libraries.
4080 * script.cc (script_add_library): New function. Adds a library
4081 specified by "-l<name>" found in an input script.
4082 * script-c.h: Add prototype for script_add_library.
4084 2010-06-07 Doug Kwan <dougkwan@google.com>
4086 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4087 Restrict stub-group size to be within long conditional branch
4088 range when working around cortex-A8 erratum.
4090 2010-06-07 Damien Diederen <dd@crosstwine.com>
4092 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4095 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4099 (Output_section::Input_section_sort_entry::compare_section_ordering):
4100 Change to return non-zero correctly.
4101 (Output_section::Input_section_sort_section_order_index_compare
4102 ::operator()): Change to fix ambiguity in comparisons.
4104 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4106 * gold.h (is_wildcard_string): New function.
4107 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4108 (Layout::layout_eh_frame): Ditto.
4109 (Layout::find_section_order_index): New method.
4110 (Layout::read_layout_from_file): New method.
4111 * layout.h (Layout::find_section_order_index): New method.
4112 (Layout::read_layout_from_file): New method.
4113 (Layout::input_section_position_): New private member.
4114 (Layout::input_section_glob_): New private member.
4115 * main.cc (main): Call read_layout_from_file here.
4116 * options.h (--section-ordering-file): New option.
4117 * output.cc (Output_section::input_section_order_specified_): New
4119 (Output_section::Output_section): Initialize new member.
4120 (Output_section::add_input_section): Add new parameter.
4121 Keep input sections when --section-ordering-file is used.
4122 (Output_section::set_final_data_size): Sort input sections when
4123 section ordering file is specified.
4124 (Output_section::Input_section_sort_entry): Add new parameter.
4126 (Output_section::Input_section_sort_entry::compare_section_ordering):
4128 (Output_section::Input_section_sort_compare::operator()): Change to
4129 consider section_order_index.
4130 (Output_section::Input_section_sort_init_fini_compare::operator()):
4131 Change to consider section_order_index.
4132 (Output_section::Input_section_sort_section_order_index_compare
4133 ::operator()): New method.
4134 (Output_section::sort_attached_input_sections): Change to sort
4135 according to section order when specified.
4136 (Output_section::add_input_section<32, true>): Add new parameter.
4137 (Output_section::add_input_section<64, true>): Add new parameter.
4138 (Output_section::add_input_section<32, false>): Add new parameter.
4139 (Output_section::add_input_section<64, false>): Add new parameter.
4140 * output.h (Output_section::add_input_section): Add new parameter.
4141 (Output_section::input_section_order_specified): New
4143 (Output_section::set_input_section_order_specified): New method.
4144 (Input_section::Input_section): Initialize section_order_index_.
4145 (Input_section::section_order_index): New method.
4146 (Input_section::set_section_order_index): New method.
4147 (Input_section::section_order_index_): New member.
4148 (Input_section::Input_section_sort_section_order_index_compare): New
4150 (Output_section::input_section_order_specified_): New member.
4151 * script-sections.cc (is_wildcard_string): Delete and move modified
4153 (Output_section_element_input::Output_section_element_input): Modify
4154 call to is_wildcard_string.
4155 (Output_section_element_input::Input_section_pattern
4156 ::Input_section_pattern): Ditto.
4157 (Output_section_element_input::Output_section_element_input): Ditto.
4158 * testsuite/Makefile.am (final_layout): New test case.
4159 * testsuite/Makefile.in: Regenerate.
4160 * testsuite/final_layout.cc: New file.
4161 * testsuite/final_layout.sh: New file.
4163 2010-06-01 Rafael Espindola <espindola@google.com>
4165 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4167 2010-06-01 Rafael Espindola <espindola@google.com>
4169 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4170 visibility of symbols.
4172 2010-05-27 Doug Kwan <dougkwan@google.com>
4174 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4175 from start of output section instead of address for a local symbol
4176 in a merged or relaxed section when doing a relocatable link.
4178 2010-05-26 Rafael Espindola <espindola@google.com>
4181 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4182 adding sections the garbage collector removed.
4183 * gold/testsuite/Makefile.am: Add test.
4184 * gold/testsuite/Makefile.in: Regenerate.
4185 * gold/testsuite/plugin_test_7.sh: New.
4186 * gold/testsuite/plugin_test_7_1.c: New.
4187 * gold/testsuite/plugin_test_7_2.c: New.
4189 2010-05-26 Rafael Espindola <espindola@google.com>
4191 * script-sections.cc (Output_section_definition::set_section_addresses):
4192 Check for --section-start.
4194 2010-05-26 Doug Kwan <dougkwan@google.com>
4196 * arm.cc (Arm_scan_relocatable_relocs): New class.
4197 (Target_arm::relocate_special_relocatable): New method.
4198 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4199 (Arm_relocate_functions::thumb_branch_common): Same.
4200 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4201 instead of Default_scan_relocatable_relocs.
4202 * target-reloc.h (relocate_for_relocatable): Let target handle
4203 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4204 * target.h (Sized_target::relocate_special_relocatable): New method.
4206 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4208 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4210 2010-05-23 Doug Kwan <dougkwan@google.com>
4212 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4214 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4215 with a direct branch, not a conditional branch, to a stub.
4216 * merge.cc (Output_merge_base::record_input_section): New method
4218 (Output_merge_data::do_add_input_section): Record input section if
4219 keeps-input-sections flag is set.
4220 (Output_merge_string::do_add_input_section): Ditto.
4221 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4222 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4224 (Output_merge_base::keeps_input_sections,
4225 Output_merge_base::set_keeps_input_sections,
4226 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4228 (Output_merge_base::Input_sections): New type declaration.
4229 (Output_merge_base::input_sections_begin,
4230 Output_merge_base::input_sections_end,
4231 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4232 (Output_merge_base::bool keeps_input_sections_,
4233 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4234 Output_merge_base::input_sections_): New data members.
4235 (Output_merge_data::do_set_keeps_input_sections): New method
4237 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4238 * output.cc (Output_section::Input_section::relobj): Move method
4239 defintion from class declaration to here and handle merge sections.
4240 (Output_section::Input_section::shndx): Ditto.
4241 (Output_section::Output_section): Remove initializations of removed
4242 data members and initialize new data member LOOKUP_MAPS_.
4243 (Output_section::add_input_section): Set keeps-input-sections flag
4244 for a newly created merge output section as appropriate. Adjust code
4245 to use Output_section_lookup_maps class.
4246 (Output_section::add_relaxed_input_section): Adjst code for lookup
4247 maps code refactoring.
4248 (Output_section::add_merge_input_section): Add a new parameter
4249 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4250 class. If adding input section to a newly created merge output
4251 section fails, remove the new merge section.
4252 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4253 Adjust code for use of the Output_section_lookup_maps class.
4254 (Output_section::find_merge_section): Ditto.
4255 (Output_section::build_lookup_maps): New method defintion.
4256 (Output_section::find_relaxed_input_section): Adjust code to use
4257 Output_section_lookup_maps class.
4258 (Output_section::get_input_sections): Export merge sections. Adjust
4259 code to use Output_section_lookup_maps class.
4260 (Output_section:::add_script_input_section): Adjust code to use
4261 Output_section_lookup_maps class. Update lookup maps for merge
4263 (Output_section::discard_states): Use Output_section_lookup_maps.
4264 (Output_section::restore_states): Same.
4265 * output.h (Merge_section_properties): Move class defintion out of
4267 (Output_section_lookup_maps): New class.
4268 (Output_section::Input_section::is_merge_section): New method
4270 (Output_section::Input_section::relobj): Move defintion out of class
4271 defintion. Declare method only.
4272 (Output_section::Input_section::shndx): Ditto.
4273 (Output_section::Input_section::output_merge_base): New method defintion.
4274 (Output_section::Input_section::u2_.pomb): New union field.
4275 (Output_section::Merge_section_by_properties_map,
4276 Output_section::Output_section_data_by_input_section_map,
4277 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4279 (Output_section::add_merge_input_section): Add new parameter
4280 KEEPS_INPUT_SECTIONS.
4281 (Output_section::build_lookup_maps): New method declaration.
4282 (Output_section::merge_section_map_,
4283 Output_section::merge_section_by_properties_map_,
4284 Output_section::relaxed_input_section_map_,
4285 Output_section::is_relaxed_input_section_map_valid_): Remove data
4287 (Output_section::lookup_maps_): New data member.
4289 2010-05-21 Doug Kwan <dougkwan@google.com>
4292 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4293 avoid a compilation error.
4295 2010-05-19 Rafael Espindola <espindola@google.com>
4297 * script-sections.cc (Output_section_definition::allocate_to_segment):
4298 Update the phdrs_list even when the output section is NULL.
4299 * testsuite/Makefile.am: Add test.
4300 * testsuite/Makefile.in: Regenerate.
4301 * testsuite/script_test_9.cc: New.
4302 * testsuite/script_test_9.sh: New.
4303 * testsuite/script_test_9.t: New.
4305 2010-05-19 Doug Kwan <dougkwan@google.com>
4307 * arm.cc (Arm_input_section::original_size): New method.
4308 (Arm_input_section::do_addralign): Add a cast.
4309 (Arm_input_section::do_output_offset): Remove static cast.
4310 (Arm_input_section::original_addralign,
4311 Arm_input_section::original_size_): Change type to uint32_t.
4312 (Arm_input_section::init): Add safe casts for section alignment
4314 (Arm_input_section::set_final_data_size): Do not set address and
4315 offset of stub table.
4316 (Arm_output_section::fix_exidx_coverage): Change use of of
4317 Output_section::Simple_input_section to that of
4318 Output_section::Input_section.
4319 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4320 except for the first pass.
4321 * output.cc (Output_section::get_input_sections): Change type of
4322 input_sections to std::list<Input_section>.
4323 (Output_section::add_script_input_section): Rename from
4324 Output_section::add_simple_input_section. Change type of SIS
4325 parameter from Simple_input_section to Input_section.
4326 * output.h (Output_section::Simple_input_section): Remove class.
4327 (Output_section::Input_section): Change class visibility to public.
4328 (Output_section::Input_section::addralign): Use stored alignments
4329 for special input sections if set.
4330 (Output_section::Input_section::set_addralign): New method.
4331 (Output_section::get_input_sections): Change parameter type from
4332 list of Simple_input_section to list of Input_section.
4333 (Output_section::add_script_input_section): Rename from
4334 Output_section::add_simple_input_section. Change first parameter's
4335 type from Simple_input_section to Input_section and remove the
4336 second and third parameters.
4337 * script-sections.cc (Input_section::Input_section_list): Change
4338 type to list of Output_section::Input_section/
4339 (Input_section_info::Input_section_info): Change parameter type of
4340 INPUT_SECTION to Output_section::Input_section.
4341 (Input_section_info::input_section): Change return type.
4342 (Input_section_info::input_section_): Change type to
4343 Output_section::Input_section.
4344 (Output_section_element_input::set_section_addresses): Adjust code
4345 to use Output_section::Input_section instead of
4346 Output_section::Simple_input_section. Adjust code for renaming
4347 of Output_section::add_simple_input_section.
4348 (Orphan_output_section::set_section_addresses): Ditto.
4350 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4352 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4353 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4355 2010-05-18 Rafael Espindola <espindola@google.com>
4357 * options.cc (General_options::finalize): Handle -nostdlib.
4358 * options.h (nostdlib): New option.
4359 * script.cc (script_add_search_dir): Handle -nostdlib.
4361 2010-05-12 Doug Kwan <dougkwan@google.com>
4363 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4364 attributes section only if there no attributes section after merging.
4365 (Target_arm::merge_object_attributes): Move value of
4366 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4367 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4368 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4369 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4370 and arm_attr_merge_7.stdout.
4371 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4372 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4373 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4374 arm_attr_merge_7b.o): New rules.
4375 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4377 * testsuite/Makefile.in: Regenerate.
4378 * testsuite/arm_attr_merge.sh: New file.
4379 * testsuite/arm_attr_merge_[67][ab].s: Same.
4381 2010-05-05 Nick Clifton <nickc@redhat.com>
4383 * po/es.po: Updated Spanish translation.
4385 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4387 * Makefile.am (install-exec-local): Properly install gold as
4388 default cross linker.
4389 * Makefile.in: Regenerated.
4391 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4392 Nick Clifton <nickc@redhat.com>
4394 * configure.ac (install_as_default): Define and set to false
4395 unless --enable-gold or --enable-gold=both/gold has been
4397 * configure: Regenerate.
4399 * Makefile.am (install-exec-local): Install the executable as
4400 'ld.gold'. If install_as_default is true then also install it as
4402 * Makefile.in: Regenerated.
4404 2010-04-24 Ian Lance Taylor <iant@google.com>
4406 * layout.cc (Layout::layout_reloc): In relocatable link don't
4407 combine reloc sections for grouped sections.
4409 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4411 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4412 sections that are not ordinary to icf.
4413 * icf.cc (get_section_contents): Handle relocation pointing to section
4414 with no object or shndx information.
4415 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4416 * testsuite/Makefile.in: Regenerate.
4417 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4418 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4420 2010-04-22 Ian Lance Taylor <iant@google.com>
4422 * expression.cc (Expression::Expression_eval_info): Add
4423 result_alignment_pointer field.
4424 (Expression::eval_with_dot): Add result_alignment_pointer
4425 parameter. Change all callers.
4426 (Expression::eval_maybe_dot): Likewise.
4427 (class Binary_expression): Add alignment_pointer parameter to
4428 left_value and right_value. Change all callers.
4429 (BINARY_EXPRESSION): Set result alignment.
4430 (class Trinary_expression): Add alignment_pointer parameter to
4431 arg2_value and arg3_value. Change all callers.
4432 (Trinary_cond::value): Set result alignment.
4433 (Max_expression::value, Min_expression::value): Likewise.
4434 (Align_expression::value): Likewise.
4435 * script-sections.cc (class Sections_element): Add dot_alignment
4436 parameter to set_section_addresses virtual function. Update
4438 (class Output_section_element): Likewise.
4439 (Script_sections::create_segments): Add dot_alignment parameter.
4441 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4442 (Script_sections::set_phdrs_clause_addresses): Likewise.
4443 * script-sections.h: Update declarations.
4444 * script.h: Update declarations.
4445 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4447 * testsuite/script_test_3.t: Set large alignment.
4448 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4449 segment has expected alignment.
4451 2010-04-22 Nick Clifton <nickc@redhat.com>
4453 * po/gold.pot: Updated by the Translation project.
4454 * po/vi.po: Updated Vietnamese translation.
4456 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4458 * testsuite/Makefile.am (check_PROGRAMS): Add
4459 icf_virtual_function_folding_test.
4460 * testsuite/Makefile.in: Regenerated.
4462 2010-04-15 Andrew Haley <aph@redhat.com>
4464 * options.h (merge_exidx_entries): New option.
4465 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4466 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4467 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4468 (Target_arm::merge_exidx_entries): New function.
4469 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4470 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4471 to Arm_exidx_fixup constructor.
4472 Add new arg, merge_exidx_entries.
4473 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4474 Arm_output_section::fix_exidx_coverage.
4476 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4478 * icf.cc (get_section_contents): Check for preemptible functions.
4479 Ignore addend when appropriate.
4480 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4482 (add_from_relobj): Check for section folded.
4483 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4484 * symtab.h (should_add_dynsym_entry): Add new parameter.
4485 * target-reloc.h (scan_relocs): Check for section folded.
4486 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4487 Check reloc types for function pointers in shared objects.
4488 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4490 (icf_preemptible_functions_test): New test case.
4491 (icf_string_merge_test): New test case.
4492 * testsuite.Makefile.in: Regenerate.
4493 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4494 bar_glob. Refactor code.
4495 * testsuite/icf_preemptible_functions_test.cc: New file.
4496 * testsuite/icf_preemptible_functions_test.sh: New file.
4497 * testsuite/icf_string_merge_test.cc: New file.
4498 * testsuite/icf_string_merge_test.sh: New file.
4499 * testsuite/icf_virtual_function_folding_test.cc: New file.
4500 * testsuite/icf_virtual_function_folding_test.sh: New file.
4502 2010-04-14 Doug Kwan <dougkwan@google.com>
4504 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4505 for local symbol recounting if we remove a section due to ICF.
4506 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4507 there are no regular objects in input.
4509 2010-04-13 Doug Kwan <dougkwan@google.com>
4511 * arm.cc (Arm_input_section::set_final_data_size): Compute
4512 accurate final data size instead of using current data size.
4514 2010-04-09 Doug Kwan <dougkwan@google.com>
4516 * layout.cc (Layout::choose_output_section): Handle script section
4518 (Layout::make_output_section_for_script): Add section type parameter.
4519 Handle script section types.
4520 * layout.h (Layout::make_output_section_for_script): Add section
4522 * output.cc (Output_section::Output_section): Initialize data member
4524 (Output_section::do_reset_address_and_file_offset): Do not set address
4525 to 0 if section is a NOLOAD section.
4526 * output.h (Output_section::is_noload): New method.
4527 (Output_section::set_is_noload): Ditto.
4528 (Output_section::is_noload_): New data member.
4529 * script-c.h (Script_section_type): New enum type.
4530 (struct Parser_output_section_header): Add new file section_type.
4531 * script-sections.cc (Sections_element::output_section_name): Add
4532 parameter for returning script section type.
4533 (Output_section_definition::output_section_name): Ditto.
4534 (Output_section_definition::section_type)P; New method.
4535 (Output_section_definiton::script_section_type_name): Ditto.
4536 (Output_section_definition::script_section_type_): New data member.
4537 (Output_section_definition::Output_section_definition): Initialize
4538 data member Output_section_definition::script_section_type_.
4539 (Output_section_definition::create_sections): Pass script section type
4540 to Layout::make_output_section_for_script.
4541 (Output_section_definition::output_section_name): Return script
4542 section type to caller.
4543 (Output_section_definition::set_section_address): Do not advance
4544 dot value and load address if section type is NOLOAD. Set address
4545 of NOLOAD sections regardless of section flags.
4546 (Output_section_definition::print): Print section type if it is
4547 not SCRIPT_SECTION_TYPE_NONE.
4548 (Output_section_definition::section_type): New method.
4549 (Output_section_definition::script_section_type_name): Ditto.
4550 (Script_sections::output_section_name): Add new parameter
4551 PSECTION_TYPE for returning script section type. Pass it to
4552 section elements. Handle discard sections.
4553 (Sort_output_sections::operator()): Handle NOLOAD sections.
4554 * script-sections.h (Script_sections::Section_type): New enum type.
4555 (Script_sections::output_section_name): Add a new parameter for
4556 returning script section type.
4557 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4559 * yyscript.y (union): Add new field SECTION_TYPE.
4560 (COPY, DSECT, INFO, NOLOAD): New tokens.
4561 (opt_address_and_section_type): Change type to output_section_header.
4562 (section_type): New non-terminal
4563 (section_header): Handle section type.
4564 (opt_address_and_section_type): Return section type value.
4566 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4568 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4569 * testsuite/plugin_common_test_2.c (foo): Likewise.
4571 2010-04-08 Doug Kwan <dougkwan@google.com>
4573 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4575 * output.cc (Output_section::add_merge_input_section): Simplify
4576 code and return status of Output_merge_base::add_input_section.
4577 Update merge section map only if Output_merge_base::add_input_section
4580 2010-04-07 Doug Kwan <dougkwan@google.com>
4582 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4583 if section is marked as containing instructions but has no mapping
4585 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4586 correct section index.
4587 (Arm_relobj::find_linked_text_section): Ditto.
4589 2010-04-07 Cary Coutant <ccoutant@google.com>
4591 * archive.cc (include_member): Destroy Read_symbols_data object before
4593 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4594 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4595 (Read_symbols_data::~Read_symbols_data) New destructor.
4596 (Section_relocs::Section_relocs) New constructor.
4597 (Section_relocs::~Section_relocs) New destructor.
4598 (Read_relocs_data::Read_relocs_data) New constructor.
4599 (Read_relocs_data::~Read_relocs_data) New destructor.
4600 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4601 pointers to NULL after deleting.
4603 2010-04-07 Doug Kwan <dougkwan@google.com>
4605 * arm.cc: Replace "endianity" with "endianness" in comments.
4606 (Arm_exidx_cantunwind): Ditto.
4607 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4608 (Arm_relobj::merge_flags_and_attributes): New method.
4609 (Arm_relobj::merge_flags_and_attributes_): New data member.
4610 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4611 (Arm_relobj::scan_sections_for_stubs): Ditto.
4612 (Arm_relobj::do_read_symbols): Check to see if we really want to
4613 merge processor-specific flags and attributes. Exit early if
4614 an object is empty except for section names and the undefined symbol.
4615 (Target_arm::do_finalize_sections): Move check for ELF format to
4616 Arm_relobj::do_read_symbols. Merge processor specific flags and
4617 attributes from a regular object only when we have determined that
4618 it is aapropriate. Do not create an .ARM.attributes section in
4619 output if there is no regular input object.
4620 (Target_arm::merge_processor_specific_flags): Check
4621 --warn-mismatch before printing any error.
4622 (Target_arm::merge_object_attributes): Ditto.
4623 * gold.cc (queue_middle_tasks): Handle the case in which there is
4624 no regular object in input.
4625 * options.cc (General_options::parse_EB): New method.
4626 (General_options::parse_EL): Same.
4627 (General_options::General_options): Initialize endianness_.
4628 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4630 (General_options::Endianness): New enum.
4631 (General_options::endianness): New method.
4632 (General_options::endianness_): New data member.
4633 * parameters.cc (Parameters::set_options): Check target endianness.
4634 (Parameters::set_target_once): Ditto.
4635 (Parameters::check_target_endianness): New method.
4636 (parameters_force_valid_target): If either -EL or -EB is specified,
4637 use it to define endianness of default target.
4638 * parameters.h (Parameters::check_target_endianness): New method
4640 * target.h (class Target): Change "endianity" to "endianness"
4643 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4645 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4646 * configure: Regenerate.
4647 * Makefile.in: Regenerate.
4648 * testsuite/Makefile.in: Regenerate.
4650 2010-04-06 Cary Coutant <ccoutant@google.com>
4653 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4654 prevailing definitions of common symbols.
4655 * testsuite/plugin_test_6.sh: New test case.
4656 * testsuite/plugin_common_test_1.c: New test case.
4657 * testsuite/plugin_common_test_2.c: New test case.
4658 * testsuite/Makefile.am (plugin_test_6): New test case.
4659 * testsuite/Makefile.in: Regenerate.
4661 2010-04-06 Nick Clifton <nickc@redhat.com>
4663 * po/vi.po: New Vietnamese translation.
4665 2010-03-30 Doug Kwan <dougkwan@google.com>
4667 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4669 2010-03-25 Doug Kwan <dougkwan@google.com>
4671 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4672 to avoid a conversion warning on a 32-bit host.
4674 2010-03-24 Ian Lance Taylor <iant@google.com>
4676 * testsuite/script_test_3.t: Add a TLS segment.
4677 * testsuite/Makefile.am (check_PROGRAMS): Add
4678 tls_phdrs_script_test.
4679 (tls_phdrs_script_test_SOURCES): Define.
4680 (tls_phdrs_script_test_DEPENDENCIES): Define.
4681 (tls_phdrs_script_test_LDFLAGS): Define.
4682 (tls_phdrs_script_test_LDADD): Define.
4683 * testsuite/Makefile.in: Rebuild.
4685 2010-03-23 Cary Coutant <ccoutant@google.com>
4687 * fileread.cc (find_or_make_view): Fix comment.
4689 2010-03-23 Ian Lance Taylor <iant@google.com>
4691 * script-sections.cc (class Orphan_section_placement): Define
4692 PLACE_TLS and PLACE_TLS_BSS.
4693 (Orphan_section_placement::Orphan_section_placement): Initialize
4695 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4696 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4697 (tls_script_test_SOURCES): Define.
4698 (tls_script_test_DEPENDENCIES): Define.
4699 (tls_script_test_LDFLAGS): Define.
4700 (tls_script_test_LDADD): Define.
4701 * testsuite/Makefile.in: Rebuild.
4703 2010-03-22 Doug Kwan <dougkwan@google.com>
4705 * arm.cc (Arm_relocate_functions::abs8,
4706 Arm_relocate_functions::abs16): Use correct check for overflow
4707 specified in the ARM ELF specs.
4708 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4709 target of a BLX instruction specially.
4710 (Reloc_stub::stub_type_for_reloc): Ditto.
4711 (Relocate::relocate): Use symbolic names instead of numeric relocation
4712 codes to report error.
4713 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4715 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4716 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4717 thumb2_blx_out_of_range.stdout
4718 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4719 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4720 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4721 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4722 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4723 thumb2_blx_in_range, thumb2_blx_in_range.o,
4724 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4725 thumb2_blx_out_of_range.o): New rules.
4726 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4727 thumb2_blx_in_range and thumb2_blx_out_of_range.
4728 * testsuite/Makefile.in: Regenerate.
4729 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4730 * testsuite/thumb_blx_in_range.s: New file.
4731 * testsuite/thumb_blx_out_of_range.s: New file.
4733 2010-03-22 Rafael Espindola <espindola@google.com>
4735 * archive.cc (Should_include): Move to archive.h.
4736 (should_include_member): Make it a member of Archive.
4738 (Add_lib_group_symbols): New.
4739 * archive.h: Include options.h.
4740 (Archive_member): Moved from Archive.
4741 (Should_include): Moved from archive.cc.
4743 (Add_lib_group_symbols): New.
4744 * dynobj.cc (do_should_include_member): New.
4745 * dynobj.h (do_should_include_member): New.
4746 * gold.cc (queue_initial_tasks): Update call to queue.
4747 * main.cc (main): Print lib group stats.
4748 * object.cc (do_should_include_member): New.
4749 * object.h: Include archive.h.
4750 (Object::should_include_member): New.
4751 (Object::do_should_include_member): New.
4752 (Sized_relobj::do_should_include_member): New.
4753 * options.cc (General_options::parse_start_lib): New.
4754 (General_options::parse_end_lib): New.
4755 (Input_arguments::add_file): Handle lib groups.
4756 (Input_arguments::start_group): Check we are not in a lib.
4757 (Input_arguments::start_lib): New.
4758 (Input_arguments::end_lib): New.
4759 * options.h (General_options): Add start_lib and end_lib.
4760 (Input_argument::lib_): New.
4761 (Input_argument::lib): New.
4762 (Input_argument::is_lib): New.
4763 (Input_file_lib): New.
4764 (Input_arguments::in_lib_): New.
4765 (Input_arguments::in_lib): New.
4766 (Input_arguments::start_lib): New.
4767 (Input_arguments::end_lib_): New.
4768 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4769 in unused members as preempted.
4770 (Sized_pluginobj::do_should_include_member): New.
4771 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4772 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4774 (Read_symbols::do_whole_lib_group): New.
4775 (Read_symbols::do_lib_group): New.
4776 (Read_symbols::do_read_symbols): Handle lib groups.
4777 (Read_symbols::get_name): Handle lib groups.
4778 * readsyms.h (Read_symbols): Add an archive member pointer.
4779 (Read_symbols::do_whole_lib_group): New.
4780 (Read_symbols::do_lib_group): New.
4781 (Read_symbols::member_): New.
4782 * script.cc (read_input_script): Update call to queue_soon.
4784 2010-03-19 Doug Kwan <dougkwan@google.com>
4786 * arm.cc (Stub_table::Stub_table): Initialize new data members
4787 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4788 (Stub_table::add_reloc_stub): Assign stub offset and update
4789 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4790 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4792 (Stub_table::update_data_size_and_addralign): Use
4793 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4794 instead of going over all reloc stubs.
4795 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4796 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4797 Stringpool_template::offset_ to size of Stringpool_char.
4798 (Stringpool_template::new_key_offset): Remove code to initialize
4799 Stringpool_template::offset_.
4800 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4801 Stringpool_template::offset_ to zero.
4803 2010-03-15 Doug Kwan <dougkwan@google.com>
4805 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4807 (Stringpool_template::new_key_offset): New method.
4808 (Stringpool_template::add_string): Assign offsets when adding new
4810 (Stringpool_template::set_string_offsets): Do not set string offsets
4811 when not optimizing.
4812 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4814 (Chunked_vector::clear): Clear size_.
4815 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4816 (Chunked_vector::size): Return size_.
4817 (Chunked_vector::push_back): Use size_ to find insert position.
4818 (Chunked_vector::size_): New data member.
4819 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4820 (Stringpool_template::new_key_offset): New method declaration.
4821 (Stringpool_template::offset_): New data member.
4823 2010-03-15 Rafael Espindola <espindola@google.com>
4825 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4826 Add_symbols' constructor.
4827 * readsyms.h (Add_symbols): Remove the input_group member.
4829 2010-03-10 Ian Lance Taylor <iant@google.com>
4831 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4832 target to ask whether a reference to a symbol requires a stack
4834 * target.h (Target::is_call_to_non_split): New function.
4835 (Target::do_is_call_to_non_split): Declare virtual function.
4836 * target.cc: Include "symtab.h".
4837 (Target::do_is_call_to_non_split): New function.
4838 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4840 2010-03-10 Cary Coutant <ccoutant@google.com>
4842 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4843 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4844 (File_read::open[2]): Add whole_file_view_ to list of views.
4845 (File_read::make_view): Remove test of whole_file_view_.
4846 (File_read::find_or_make_view): Create whole_file_view_ if
4848 (File_read::clear_views): Replace bool parameter with enum;
4849 adjust all callers. Don't delete views with permanent data;
4850 do delete cached views and views from archives if
4851 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4852 if clearing the corresponding view.
4853 * fileread.h (File_read::Clear_views_mode): New enum.
4854 (File_read::View::is_permanent_view): New method.
4855 (File_read::clear_views): Replace bool parameter
4856 with enum; adjust all callers.
4857 * options.h (General_options): Change keep_files_mapped option;
4858 add map_whole_files.
4859 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4861 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4864 2010-03-10 David S. Miller <davem@davemloft.net>
4866 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4868 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4870 * icf.cc (get_section_contents): Add '@' marker after processing the
4873 2010-03-08 Doug Kwan <dougkwan@google.com>
4875 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4876 due to a conversion warning.
4877 (Arm_relobj::update_output_local_symbol_count): Check for local
4878 symbol with unset output index.
4880 2010-03-05 Ian Lance Taylor <iant@google.com>
4882 * options.h (class General_options): Add --spare-dynamic-tags.
4883 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4884 --spare-dynamic-tags.
4886 2010-03-05 Ian Lance Taylor <iant@google.com>
4888 * incremental.cc: Include "libiberty.h".
4890 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4892 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4893 function, is_info_ member.
4894 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4895 (Versions::Versions): Update caller.
4896 (Versions::define_base_version): Likewise.
4897 (Versions::add_def): Likewise.
4899 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4901 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4902 (Scan::possible_function_pointer_reloc): New function.
4903 (Scan::local_reloc_may_be_function_pointer): Change to call
4904 possible_function_pointer_reloc.
4905 (Scan::global_reloc_may_be_function_pointer): Ditto.
4906 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4907 relocations in ".data.rel.ro._ZTV" section.
4908 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4909 * testsuite/icf_safe_so_test.cc: Ditto.
4910 * testsuite/icf_safe_test.cc: Ditto.
4911 * testsuite/icf_safe_test.sh: Ditto.
4913 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4914 Ian Lance Taylor <iant@google.com>
4916 * target-reloc.h (relocate_section): Check the symbol table index
4917 for -1U before setting the local symbol index.
4918 (scan_relocatable_relocs): If copying the relocation, record that
4919 the local symbol is required.
4920 * object.h (Symbol_value::is_output_symtab_index_set): New
4922 (Symbol_value::may_be_discarded_from_output_symtab): New
4924 (Symbol_value::has_output_symtab_entry): New function.
4925 (Symbol_value::needs_output_symtab_entry): Remove.
4926 (Symbol_value::output_symtab_index): Make sure the symbol index is
4928 (Symbol_value::set_output_symtab_index): Make sure the symbol
4929 index is not set. Make sure the new index is valid.
4930 (Symbol_value::set_must_have_output_symtab_entry): New function.
4931 (Symbol_value::has_output_dynsym_entry): New function.
4932 (Symbol_value::set_output_dynsym_index): Make sure the new index
4934 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4935 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4936 local symbol if permitted.
4937 (Sized_relobj::do_finalize_local_symbols): Call
4938 is_output_symtab_index_set rather than needs_output_symtab_entry.
4939 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4940 rather than needs_output_symtab_entry. Call
4941 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4942 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4943 is_output_symtab_index_set rather than needs_output_symtab_entry.
4944 * testsuite/discard_locals_relocatable_test.c: New file.
4945 * testsuite/discard_locals_test.sh: Test -r.
4946 * testsuite/Makefile.am (check_DATA): Add
4947 discard_locals_relocatable_test1.syms,
4948 discard_local_relocatable_test2.syms.
4949 (MOSTLYCLEANFILES): Likewise. Also add
4950 discard_locals_relocatable_test1.lout and
4951 discard_locals_relocatable_test2.out.
4952 (discard_locals_relocatable_test1.syms): New target.
4953 (discard_locals_relocatable_test.o): New target.
4954 (discard_locals_relocatable_test1.out): New target.
4955 (discard_locals_relocatable_test2.syms): New target.
4956 (discard_locals_relocatable_test2.out): New target.
4957 (various): Add missing ../ld-new dependencies.
4958 * testsuite/Makefile.in: Rebuild.
4960 2010-03-03 Nick Clifton <nickc@redhat.com>
4962 * po/fi.po: New Finnish translation.
4964 2010-03-01 Doug Kwan <dougkwan@google.com>
4966 * layout.cc (Layout::Layout): Force section types of .init_array*,
4967 .preinit_array* and .fini_array* sections.
4968 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4969 Fix check of return value of std::string::find.().
4970 (Output_section::Input_section_sort_compare::operator()): Remove
4971 comment about .init_array.
4972 (Output_section::Input_section_sort_init_fini_compare::operator()):
4974 (Output_section::sort_attached_input_sections): Handle .init_array
4975 and .fini_array specially.
4976 * output.h (Output_section::Inut_section_sort_compare): Update
4978 (Output_section::Input_section_sort_init_fini_compare): New struct.
4980 2010-02-26 Doug Kwan <dougkwan@google.com>
4982 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4983 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4984 * testsuite/debug_msg.sh: Avoid matching source line number for
4985 use of global variable undef_int.
4987 2010-02-26 Doug Kwan <dougkwan@google.com>
4989 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4990 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4991 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4992 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4993 * options.cc (General_options::General_options): Initialize member
4995 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4996 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4997 and rm_no_fix_v4bx.stdout
4998 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4999 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5000 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5001 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5002 and arm_no_fix_v4bx.
5003 * Makefile.in: Regenerate.
5004 * testsuite/arm_fix_v4bx.s: New file.
5005 * testsuite/arm_fix_v4bx.sh: Ditto.
5007 2010-02-24 Doug Kwan <dougkwan@google.com>
5009 * arm.cc (Target_arm::got_section): Make the .got section the first
5010 non RELRO section in the data segment.
5011 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5012 suffixes of section names.
5014 2010-02-24 Doug Kwan <dougkwan@google.com>
5016 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5017 flags and attributes merging if an input file is a binary file.
5018 * fileread.cc (Input_file::open): Record format of original file.
5019 * fileread.h (Input_file::Format): New enum type.
5020 (Input_file::Input_file): Initialize data member format_.
5021 (Input_file::format): New method definition.
5022 (Input_file::format_):: New data member.
5024 2010-02-24 Doug Kwan <dougkwan@google.com>
5026 * arm.cc (Arm_output_data_got): New class.
5027 (ARM_TCB_SIZE): New constant
5028 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5029 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5030 If user uses a script with a SECTIONS clause, issue only a warning
5031 for a misplaced EXIDX input section. Otherwise, issue an error.
5032 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5034 (Target_arm::got_mode_index_entry): Handle static linking.
5035 (Target_arm::Scan::local): Ditto.
5036 (Target_arm::Scan::global): Ditto.
5037 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5038 all incorrectly implemented relocations.
5039 (Target_arm::fix_exidx_coverage): Pass layout to
5040 Arm_output_section::fix_exidx_coverage.
5041 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5042 from ".ARM.exidx." and ".ARM.extab.".
5044 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5046 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5047 section if it does not already exist.
5048 * attributes.cc (Attributes_section_data::Attributes_section_data):
5049 Don't crash if size is zero.
5051 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5052 Ian Lance Taylor <iant@google.com>
5054 * gold.cc (queue_middle_tasks): If no input files were opened,
5056 * workqueue.h (Task_function::Task_function): Assert that there is
5059 2010-02-22 Doug Kwan <dougkwan@google.com>
5061 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5062 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5063 types to avoid warnings due to different uint64_t implementations
5066 2010-02-21 Doug Kwan <dougkwan@google.com>
5068 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5069 handling of the maximum backward branch offset.
5070 (Arm_relocate_functions::thumb_branch_common): Ditto.
5071 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5072 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5073 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5074 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5075 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5076 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5077 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5078 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5079 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5080 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5081 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5082 thumb2_bl_out_of_range.o): New rules.
5083 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5084 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5085 thumb2_bl_out_of_range
5086 * testsuite/Makefile.in: Regenerate.
5087 * testsuite/arm_bl_in_range.s: New file.
5088 * testsuite/arm_bl_out_of_range.s: Ditto.
5089 * testsuite/arm_branch_in_range.sh: Ditto.
5090 * testsuite/arm_branch_range.t: Ditto.
5091 * testsuite/thumb2_branch_range.t: Ditto.
5092 * testsuite/thumb_bl_in_range.s: Ditto.
5093 * testsuite/thumb_bl_out_of_range.s: Ditto.
5094 * testsuite/thumb_branch_range.t: Ditto.
5096 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5098 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5099 Add reloc offset information.
5100 * icf.cc (get_section_contents): Change iterators to point to the new
5101 vectors. Add reloc offset information to the contents.
5102 * icf.h (Icf::Sections_reachable_info): New typedef.
5103 (Icf::Sections_reachable_list): New typedef.
5104 (Icf::Offset_info): New typedef.
5105 (Icf::Reloc_info): New struct typedef.
5106 (Icf::Reloc_info_list): New typedef.
5107 (Icf::symbol_reloc_list): Delete method.
5108 (Icf::addend_reloc_list): Delete method.
5109 (Icf::section_reloc_list): Delete method.
5110 (Icf::reloc_info_list): New method.
5111 (Icf::reloc_info_list_): New member.
5113 2010-02-19 Doug Kwan <dougkwan@google.com>
5115 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5116 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5117 * arm.cc (Arm_relocation_functions): New forward declaration.
5118 (Target_arm::Target_arm): Initialize new data members
5119 got_mod_index_offset_ and tls_base_symbol_defined_.
5120 (Target_arm::Relocate::relocate_tls): New method.
5121 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5122 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5124 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5125 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5126 (Target_arm::got_mod_index_offset_,
5127 Target_arm::tls_base_symbol_defined_): New data members.
5128 (Target_arm::Scan::local, Target::Scan::global,
5129 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5132 2010-02-18 Doug Kwan <dougkwan@google.com>
5134 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5135 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5136 text section as a parameter becuase some broken tools may not set
5137 the link in section header.
5138 (Target_arm::has_got_section): New method.
5139 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5140 without any mapping symbol as data only. Remove warning.
5141 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5142 link in its section header, try to discover the link by inspecting the
5143 REL31 relocation at the beginning of the section.
5144 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5146 (Target_arm::Scan::global): Treat any reference to the symbol
5147 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5149 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5151 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5152 (Scan::global_reloc_may_be_function_pointer): New function.
5153 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5154 (Scan::global_reloc_may_be_function_pointer): New function.
5155 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5156 (Scan::global_reloc_may_be_function_pointer): New function.
5157 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5158 (Scan::global_reloc_may_be_function_pointer): New function.
5159 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5160 (Scan::global_reloc_may_be_function_pointer): New function.
5161 (Scan::possible_function_pointer_reloc): New function.
5162 (Target_x86_64::can_check_for_function_pointers): New function.
5163 * gc.h (gc_process_relocs): Scan relocation types to determine if
5164 function pointers were taken for targets that support it.
5165 * icf.cc (Icf::find_identical_sections): Include functions for
5166 folding in safe ICF whose pointer is not taken.
5167 * icf.h (Secn_fptr_taken_set): New typedef.
5168 (fptr_section_id_): New member.
5169 (section_has_function_pointers): New function.
5170 (set_section_has_function_pointers): New function.
5171 (check_section_for_function_pointers): New function.
5172 * options.h: Fix comment for safe ICF option.
5173 * target.h (can_check_for_function_pointers): New function.
5174 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5175 Modify icf_safe_test for X86-64.
5176 * testsuite/Makefile.in: Regenerate.
5177 * testsuite/icf_safe_so_test.cc: New file.
5178 * testsuite/icf_safe_so_test.sh: New file.
5179 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5180 (main): Change to take pointer to function kept_func_3.
5181 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5182 folding is done correctly for X86-64.
5184 2010-02-12 David S. Miller <davem@davemloft.net>
5186 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5187 is_symbolless parameter.
5188 (Output_reloc<SHT_REL>::is_symbolless): New.
5189 (Output_reloc<SHT_REL>::is_symbolless_): New.
5190 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5191 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5192 (Output_reloc<SHT_RELA>::is_symbolless): New.
5193 (Output_data_reloc::add_global): Handle is_symbolless.
5194 (Output_data_reloc::add_global_relative): Likewise.
5195 (Output_data_reloc::add_local): Likewise.
5196 (Output_data_reloc::add_local_relative): Likewise.
5197 (Output_data_reloc::add_symbolless_global_addend): New.
5198 (Output_data_reloc::add_symbolless_local_addend): New.
5199 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5201 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5202 instead of ->is_relative_
5203 (Output_reloc::write): Likewise.
5204 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5205 (Output_reloc::write_rel): Simplify.
5207 * sparc.cc (Target_sparc::Scan::local): Use
5208 ->add_symbolless_local_addend as needed.
5209 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5210 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5211 based upon relocation offset.
5213 2010-02-11 Doug Kwan <dougkwan@google.com>
5215 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5216 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5217 beginning of function.
5218 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5219 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5220 parameter is_32bit in calls to should_apply_static_reloc.
5221 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5222 (check_DATA): Add arm_abs_global.stdout.
5223 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5224 arm_abs_global.stdout): New rules.
5225 (MOSTLLYCLEANFILES): Add arm_abs_global
5226 * Makefile.in: Regenerate.
5227 * testsuite/arm_abs_global.s: New file.
5228 * testsuite/arm_abs_global.sh: Ditto.
5229 * testsuite/arm_abs_lib.s: Ditto.
5231 2010-02-11 Ian Lance Taylor <iant@google.com>
5233 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5235 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5236 Allocate_commons_task first.
5237 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5238 task, rather than symtab_lock_.
5239 (Gc_process_relocs::~Gc_process_relocs): New function.
5240 (Gc_process_relocs::is_runnable): Check this_blocker_.
5241 (Gc_process_relocs::locks): Use next_blocker_ rather than
5243 (Scan_relocs::~Scan_relocs): New function.
5244 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5246 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5248 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5249 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5250 constructor accordingly.
5251 (class Gc_process_relocs): Likewise.
5252 (class Scan_relocs): Likewise.
5253 * common.h (class Allocate_commons_task): Remove symtab_lock_
5254 field, and corresponding constructor parameter.
5255 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5257 (Allocate_commons_task::locks): Likewise.
5259 2010-02-11 Ian Lance Taylor <iant@google.com>
5261 * gold-threads.h (class Once): Define.
5262 (class Initialize_lock): Rewrite as child of Once.
5263 * gold-threads.cc (class Once_initialize): Define.
5264 (once_pointer_control): New static variable.
5265 (once_pointer, once_arg): New static variables.
5266 (c_run_once): New static function.
5267 (Once::Once, Once::run_once, Once::internal_run): New functions.
5268 (class Initialize_lock_once): Remove.
5269 (initialize_lock_control): Remove.
5270 (initialize_lock_pointer): Remove.
5271 (initialize_lock_once): Remove.
5272 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5273 (Initialize_lock::initialize): Rewrite.
5274 (Initialize_lock::do_run_once): New function.
5275 * archive.cc (Archive::interpret_header): Only clear name if it is
5277 * fileread.cc: Include "gold-threads.h"
5278 (file_counts_lock): New static variable.
5279 (file_counts_initialize_lock): Likewise.
5280 (File_read::release): Only increment counts when using --stats.
5281 Use a lock around the increment.
5282 * parameters.cc (class Set_parameters_target_once): Define.
5283 (set_parameters_target_once): New static variable.
5284 (Parameters::Parameters): Move here from parameters.h.
5285 (Parameters::set_target): Rewrite.
5286 (Parameters::set_target_once): New function.
5287 (Parameters::clear_target): Move here and rewrite.
5288 * parameters.h (class Parameters): Update declarations. Add
5289 set_parameters_target_once_ field.
5290 (Parameters::Parameters): Move to parameters.cc.
5291 (Parameters::clear_target): Likewise.
5292 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5294 (Start_group::~Start_group): New function.
5295 (Start_group::is_runnable): New function.
5296 (Start_group::locks, Start_group::run): New functions.
5297 (Finish_group::run): Change saw_undefined to size_t.
5298 * readsyms.h (class Start_group): Define.
5299 (class Finish_group): Change saw_undefined_ field to size_t.
5300 (Finish_group::Finish_group): Remove saw_undefined and
5301 this_blocker parameters. Change all callers.
5302 (Finish_group::set_saw_undefined): New function.
5303 (Finish_group::set_blocker): New function.
5304 * symtab.h (class Symbol_table): Change saw_undefined to return
5305 size_t. Change saw_undefined_ field to size_t.
5306 * target-select.cc (Set_target_once::do_run_once): New function.
5307 (Target_selector::Target_selector): Initialize set_target_once_
5308 field. Don't initialize lock_ and initialize_lock_ fields.
5309 (Target_selector::instantiate_target): Rewrite.
5310 (Target_selector::set_target): New function.
5311 * target-select.h (class Set_target_once): Define.
5312 (class Target_selector): Update declarations. Make
5313 Set_target_once a friend. Remove lock_ and initialize_lock_
5314 fields. Add set_target_once_ field.
5316 2010-02-10 Ian Lance Taylor <iant@google.com>
5318 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5320 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5321 (queue_middle_tasks): Add all blockers before queueing any tasks.
5322 (queue_final_tasks): Likewise.
5323 * token.h (Task_token::add_blockers): New function.
5324 * object.h (Input_objects::number_of_relobjs): New function.
5326 2010-02-10 Ian Lance Taylor <iant@google.com>
5328 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5329 shared, not if not position independent.
5330 * x86_64.cc (Relocate::relocate_tls): Likewise.
5331 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5332 (tls_pie_pic_test): New target.
5333 * testsuite/Makefile.in: Rebuild.
5335 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5336 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5337 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5338 * testsuite/Makefile.in: Rebuild.
5340 2010-02-09 David S. Miller <davem@davemloft.net>
5342 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5343 R_SPARC_RELATIVE using ->add_local_relative().
5344 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5346 * output.h (Output_data_dynamic::add_section_size): New method
5347 that takes two Output_data objects.
5348 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5349 entry param. Handle it in initializers.
5350 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5351 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5352 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5354 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5355 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5356 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5357 for dynrel_includes_plt.
5358 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5359 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5360 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5362 (Target_sparc::do_finalize_sections): Update to pass true for
5363 dynrel_includes_plt.
5364 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5365 output before .rela.plt
5366 (Target_powerpc::do_finalize_sections): Update to pass true for
5367 dynrel_includes_plt when 32-bit.
5369 2010-02-08 Doug Kwan <dougkwan@google.com>
5371 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5373 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5374 Arm_relobj::scan_section_for_cortex_a8_stubs,
5375 Arm_relobj::do_relocation_section): Instead of calling
5376 Output_section::output_address, use faster
5377 Arm_relobj::simple_input_section_output_address.
5379 2010-02-08 David S. Miller <davem@davemloft.net>
5381 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5382 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5383 relocation helper function.
5385 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5386 just like R_SPARC_GOT{10,13,22}.
5387 (Target_sparc::Scan::local): Likewise.
5388 (Target_sparc::Relocate:relocate): Likewise.
5390 2010-02-06 Ian Lance Taylor <iant@google.com>
5392 * configure.ac: Rewrite targetobjs duplicate removal code to use
5393 only shell constructs.
5394 * configure: Rebuild.
5396 2010-02-05 Doug Kwan <dougkwan@google.com>
5399 * arm.cc (Arm_relobj::section_is_scannable): New method.
5400 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5401 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5403 2010-02-04 Doug Kwan <dougkwan@google.com>
5406 * arm-reloc-property.cc (cstdio): Include.
5407 * configure.ac (targetobjs): Remove duplicates.
5408 * configure: Regenerate.
5409 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5410 big and little endian version for a given address size.
5412 2010-02-03 Doug Kwan <dougkwan@google.com>
5414 * arm-reloc-property.cc
5415 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5417 * arm-reloc-property.h
5418 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5419 New method definition.
5420 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5422 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5424 (GOT_PREL): Change implemented to Y.
5425 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5426 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5427 (Arm_relocate_functions::movw_abs_nc): Remove method.
5428 (Arm_relocate_functions::movt_abs): Ditto.
5429 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5430 (Arm_relocate_functions::thm_movt_abs): Ditto.
5431 (Arm_relocate_functions::movw_rel_nc): Ditto.
5432 (Arm_relocate_functions::movw_rel): Ditto.
5433 (Arm_relocate_functions::movt_rel): Ditto.
5434 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5435 (Arm_relocate_functions:thm_movw_rel): Ditto.
5436 (Arm_relocate_functions:thm_movt_rel): Ditto.
5437 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5438 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5439 New method definitions.
5440 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5441 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5442 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5443 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5444 (Target_arm::Relocate::relocate): Check for non-static or
5445 unimplemented relocation code and exit early. Change calls to
5446 Target_arm::reloc_uses_thumb_bit and
5447 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5448 instead. Refactor code to handle similar relocations to increase
5449 code sharing. Remove check for unsupported relocation code in switch
5451 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5452 relocation property table to find out size. Change error message to
5453 print out the name of a relocation code instead of the numeric value.
5454 (Target_arm::scan_reloc_for_stub): Use relocation property table
5455 instead of calling Target_arm::reloc_uses_thumb_bit().
5457 2010-02-02 Doug Kwan <dougkwan@google.com>
5459 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5460 types of relaxed input section.
5462 2010-02-02 Doug Kwan <dougkwan@google.com>
5464 * Makefile.am (HFILES): Add arm-reloc-property.h.
5466 (TARGETSOURCES): Add arm-reloc-property.cc
5467 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5468 (libgold_a_SOURCES): $(DEFFILES)
5469 * Makefile.in: Regenerate.
5470 * arm-reloc-property.cc: New file.
5471 * arm-reloc-property.h: New file.
5472 * arm-reloc.def: New file.
5473 * arm.cc: Update comments.
5474 (arm-reloc-property.h): New included header.
5475 (arm_reloc_property_table): New global variable.
5476 (Target_arm::do_select_as_default_target): New method definition.
5477 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5478 arm-reloc-property to targ_extra_obj.
5479 * parameters.cc (set_parameters_target): Call
5480 Target::select_as_default_target().
5481 * target.h (Target::select_as_default_target): New method definition.
5482 (Target::do_select_as_default_target): Same.
5484 2010-02-01 Doug Kwan <dougkwan@google.com>
5486 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5487 first_output_text_section_.
5488 (Arm_exidx_fixup::first_output_text_section): New method definition.
5489 (Arm_exidx_fixup::first_output_text_section_): New data member.
5490 (Arm_exidx_fixup::process_exidx_section): Record the first text
5491 output section seen.
5492 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5493 and entsize in output section header.
5495 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5497 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5498 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5499 (Arm_relocate_functions::thm_alu11): New Method.
5500 (Arm_relocate_functions::thm_pc8): New Method.
5501 (Arm_relocate_functions::thm_pc12): New Method.
5502 (Target_arm::Scan::local): Handle the relocations.
5503 (Target_arm::Scan::global): Likewise.
5504 (Target_arm::Relocate::relocate): Likewise.
5505 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5507 2010-01-29 Doug Kwan <dougkwan@google.com>
5509 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5510 of relocation types as ld.
5512 2010-01-29 Doug Kwan <dougkwan@google.com>
5514 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5516 (Arm_relocate_functions::thumb_branch_common): Ditto.
5517 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5518 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5519 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5520 Arm_relocate_functions::jump24): Remove.
5521 (Target_arm::Relocate::relocate): Adjust code to call
5522 Arm_relocation_functions::arm_branch_common and
5523 Arm_relocation_functions::thumb_branch_common instead of their removed
5524 wrappers. Merge switch-cases together to reduce source code size.
5526 2010-01-29 Doug Kwan <dougkwan@google.com>
5528 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5529 output_local_symbol_count_needs_update_.
5530 (Arm_relobj::output_local_symbol_count_needs_update,
5531 Arm_relobj::set_output_local_symbol_count_needs_update,
5532 Arm_relobj::update_output_local_symbol_count): New methods.
5533 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5535 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5536 of pointed function as in a R_ARM_PREL31 relocation.
5537 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5538 for output local symbol count updating.
5539 (Target_arm::do_relax): Update output local symbol counts in objects
5541 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5543 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5545 * arm.cc: Added support for the ARM relocations:
5546 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5547 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5548 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5550 (Arm_relocate_functions::movw_rel): New method.
5551 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5552 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5554 (Arm_relocate_functions::thm_movw_rel): New method.
5555 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5557 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5559 (Target_arm::Scan::global): Likewise.
5560 (Target_arm::Relocate::relocate): Likewise.
5561 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5564 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5566 * arm.cc: Added support for ARM group relocations.
5567 (Target_arm::reloc_needs_sym_origin): New method.
5568 (Arm_relocate_functions::calc_grp_kn): New method.
5569 (Arm_relocate_functions::calc_grp_residual): New method.
5570 (Arm_relocate_functions::calc_grp_gn): New method.
5571 (Arm_relocate_functions::arm_grp_alu): New Method.
5572 (Arm_relocate_functions::arm_grp_ldr): New Method.
5573 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5574 (Arm_relocate_functions::arm_grp_ldc): New Method.
5575 (Target_arm::Scan::local): Handle the ARM group relocations.
5576 (Target_arm::Scan::global): Likewise.
5577 (Target_arm::Relocate::relocate): Likewise.
5578 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5581 2010-01-26 Doug Kwan <dougkwan@google.com>
5583 * arm.cc (set): Include.
5584 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5586 (Arm_output_section::Text_section_list): New type.
5587 (Arm_output_section::append_text_sections_to_list): New method.
5588 (Arm_output_section::fix_exidx_coverage): Ditto.
5589 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5590 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5591 Relobj::set_section_offset() instead of
5592 Sized_relobj::invalidate_section_offset().
5593 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5594 parameter for section headers. Ignore relocation sections for
5595 unallocated sections and EXIDX sections.
5596 (Target_arm::fix_exidx_coverage): New method.
5597 (Target_arm::output_section_address_less_than): New type.
5598 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5599 linked text section instead of the EXIDX section.
5600 (Arm_output_section::create_stub_group): Add an assertion to check
5601 that this is not an EXIDX output section.
5602 (Arm_output_section::append_text_sections_to_list): New method.
5603 (Arm_output_section::fix_exidx_coverage): Ditto.
5604 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5605 Arm_relobj::section_needs_reloc_stub_scanning.
5606 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5608 (Target_arm::fix_exidx_coverage): New method.
5609 * object.h (Relobj::set_output_section): New method.
5610 (Sized_relobj::invalidate_section_offset): Remove method.
5611 (Sized_relobj::do_invalidate_section_offset): Remove method.
5612 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5614 2010-01-25 Doug Kwan <dougkwan@google.com>
5616 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5617 Fix warning due to signed and unsigned comparison on a 32-bit host.
5619 2010-01-22 Doug Kwan <dougkwan@google.com>
5621 * arm.cc (Target_arm::do_relax): Record an output section for section
5622 offset adjustment it contains any stub table that has changed.
5623 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5624 offsets in an output section if necessary.
5625 * output.cc (Output_section::Output_section): Initialize
5626 section_offsets_need_adjustments_.
5627 (Output_section::add_input_section_for_script): Renamed to
5628 Output_section::add_simple_input_section.
5629 (Output_section::save_states): Add a comment.
5630 (Output_section::discard_states): New method defintion.
5631 (Output_section::adjust_section_offsets): Same.
5632 * output.h (Output_section::add_input_section_for_script): Renamed to
5633 Output_section::add_simple_input_section.
5634 (Output_section::discard_states): New method declaration.
5635 (Output_section::adjust_section_offsets): Same.
5636 (Output_section::section_offsets_need_adjustment,
5637 Output_section::set_section_offsets_need_adjustment): New method
5639 (Output_section::section_offsets_need_adjustment_): New data member.
5640 * script-sections.cc
5641 (Output_section_element_input::set_section_address): Adjust code for
5642 renaming of Output_section::add_input_section_for_script.
5643 (Orphan_output_section::set_section_address): Same.
5645 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5647 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5648 Fix_v4bx enum values .
5649 * gold/options.h (General_options): New option definitions.
5650 (General_options::fix_v4bx): New method.
5651 (General_options::Fix_v4bx): New enum.
5652 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5653 (General_options::parse_fix_v4bx_interworking): New method.
5655 2010-01-22 Doug Kwan <dougkwan@google.com>
5657 * arm.cc (Arm_exidx_fixup): New class.
5659 2010-01-21 Doug Kwan <dougkwan@google.com>
5661 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5663 (Arm_exidx_section_offset_map): New type.
5665 2010-01-21 Doug Kwan <dougkwan@google.com>
5667 * arm.cc (Arm_exidx_input_section): New class.
5668 (Arm_relobj::exidx_input_section_by_link,
5669 Arm_relobj::exidx_input_section_by_shndx,
5670 Arm_relobj::make_exidx_input_section): New methods.
5671 (read_arm_attributes_section): Remove.
5672 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5673 information about them.
5674 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5677 2010-01-20 Doug Kwan <dougkwan@google.com>
5679 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5680 Input_section_specifier to Section_id.
5681 (Target_arm::new_arm_input_section: Adjust code for change of key
5683 (Target_arm::find_arm_input_section): Ditto.
5684 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5685 (Section_id): Remove.
5686 (Garbage_collection::Section_id_hash): Remove.
5687 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5688 (Section_id): Remove.
5689 (Icf::Section_id_hash): Remove.
5690 * object.h (Section_id, Const_section_id, Section_id_hash,
5691 Const_section_id_hash): New type definitions.
5692 * output.cc (Output_section::add_relaxed_input_section): Change to
5693 use Const_section_id instead of Input_section_specifier as key type.
5694 (Output_section::add_merge_input_section): Ditto.
5695 (Output_section::build_relaxation_map): Change to use Section_id
5696 instead of Input_section_specifier as key type.
5697 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5699 (Output_section::convert_input_sections_to_relaxed_sections): Change
5700 to use Const_section_id instead of Input_section_specifier as key type.
5701 (Output_section::find_merge_section): Ditto.
5702 (Output_section::find_relaxed_input_section): Ditto.
5703 * output.h (Input_section_specifier): Remove class.
5704 (Output_section::Output_section_data_by_input_section_map): Change
5705 key type to Const_section_id.
5706 (Output_section::Output_relaxed_input_section_by_input_section_map):
5708 (Output_section::Relaxation_map): Change key type to Section_id.
5710 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5712 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5713 (class Arm_v4bx_stub): New class.
5714 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5715 (Stub_factory::make_arm_v4bx_stub): New method.
5716 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5717 (Stub_table::empty): Handle v4bx stubs.
5718 (Stub_table::add_arm_v4bx_stub): New method.
5719 (Stub_table::find_arm_v4bx_stub): New method.
5720 (Arm_relocate_functions::v4bx): New method.
5721 (Target_arm::fix_v4bx): New method.
5722 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5723 (Stub_table::relocate_stubs): Likewise.
5724 (Stub_table::do_write): Likewise.
5725 (Stub_table::update_data_size_and_addralign): Likewise.
5726 (Stub_table::finalize_stubs): Likewise.
5727 (Target_arm::Scan::local): Likewise.
5728 (Target_arm::Scan::global): Likewise.
5729 (Target_arm::do_finalize_sections): Likewise.
5730 (Target_arm::Relocate::relocate): Likewise.
5731 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5733 (Target_arm::scan_reloc_for_stub): Likewise.
5734 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5736 2010-01-19 Ian Lance Taylor <iant@google.com>
5738 * output.cc (Output_section_headers::do_sized_write): Write large
5739 segment count to sh_info field.
5740 (Output_file_header::do_sized_write): For large segment count,
5741 write PN_XNUM to e_phnum field.
5743 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5745 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5746 (Arm_relocate_functions::thm_jump8): New function.
5747 (Arm_relocate_functions::thm_jump11): New function.
5748 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5750 (Target_arm::Scan::global): Likewise.
5751 (Target_arm::Relocate::relocate): Likewise.
5752 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5755 2010-01-14 Doug Kwan <dougkwan@google.com>
5757 * arm.cc (map, utility): Include headers.
5758 (Target_arm::apply_cortex_a8_workaround): New method.
5759 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5760 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5761 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5762 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5763 the --[no-]fix-cortex-a8 command line options.
5764 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5765 (Target_arm::relocate_stub): Use addend in instruction template.
5766 * options.h (DEFINE_bool): Set the user-set flag.
5767 (General_options): Add --[no-]-fix-cortex options.
5768 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5769 : Update fast look-up map after conversion.
5771 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5773 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5774 in the first pass of do_layout.
5776 2010-01-13 Doug Kwan <dougkwan@google.com>
5778 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5779 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5780 apparent compiler problem of not folding static constant integral
5781 data members of elfcpp::Elf_sizes<32>.
5783 2010-01-13 Doug Kwan <dougkwan@google.com>
5785 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5786 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5787 Arm_relobj::scan_section_for_cortex_a8_erratum,
5788 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5789 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5790 sections to scan for relocation stubs into a new method
5791 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5792 relocation and Cortex-A8 stub scanning.
5793 (Target_arm::do_relax): Force stubs to be after stubbed sections
5794 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5795 the beginning of a new relaxation pass. Update a comment.
5796 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5798 2010-01-12 Ian Lance Taylor <iant@google.com>
5800 * target-reloc.h (visibility_error): New inline function.
5801 (relocate_section): Call visibility_error.
5802 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5803 (MOSTLYCLEANFILES): Likewise.
5804 (protected_4_pic.o, protected_3.err): New targets.
5805 * testsuite/protected_4.cc: New file.
5807 2010-01-12 Doug Kwan <dougkwan@google.com>
5809 * arm.cc (Cortex_a8_reloc): New class.
5810 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5811 and cortex_a8_relocs_info_.
5812 (Target_arm::fix_cortex_a8): New method definition.
5813 (Target_arm::Cortex_a8_relocs_info): New type.
5814 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5815 New data member declarations.
5816 (Target_arm::scan_reloc_for_stub): Record information about
5817 relocations for THUMB branches that might be exempted from the
5818 Cortex-A8 workaround.
5819 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5820 at the beginning of a relaxation pass.
5822 2010-01-12 Doug Kwan <dougkwan@google.com>
5824 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5825 (Arm_relobj::Mapping_symbol_position,
5826 Arm_reloj::Mapping_symbol_position_less,
5827 Arm_relobj::Mapping_symbols_info): New types.
5828 (Target_arm::is_mapping_symbol_name): New method definition.
5829 (Arm_relobj::do_count_local_symbols): Save information about mapping
5832 2010-01-11 Doug Kwan <dougkwan@google.com>
5834 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5835 Arm_relocate_functions::thumb32_branch_upper,
5836 Arm_relocate_functions::thumb32_branch_lower,
5837 Arm_relocate_functions::thumb32_cond_branch_offset,
5838 Arm_relocate_functions::thumb32_cond_branch_upper,
5839 Arm_relocate_functions::thumb32_cond_branch_lower,
5840 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5841 branch offset encoding.
5842 (Arm_relocate_functions::thumb_branch_common): Use new branch
5843 offset encoding methods to avoid code duplication.
5844 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5845 (Stub_addend_reader::operator()): Use new branch encoding method
5846 to avoid code duplication.
5848 2010-01-11 Doug Kwan <dougkwan@google.com>
5850 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5851 (Target_arm::do_finalize_sections): Define special EXIDX section
5852 symbols only if referenced.
5853 * gc.h (Garbage_collection::add_reference): New method.
5854 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5857 2010-01-11 Ian Lance Taylor <iant@google.com>
5859 * script.cc (Version_script_info::build_expression_list_lookup):
5860 Change complaing about duplicate wildcard match from error to
5863 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5865 (Version_script_info::Version_script_info): Initialize globs_,
5866 default_version_, default_is_global_, and exact_. Don't
5867 initialize globals_ or locals_.
5868 (Version_script_info::build_lookup_tables): Build local symbols
5870 (Version_script_info::unquote): New function.
5871 (Version_script_info::add_exact_match): New function.
5872 (Version_script_info::build_expression_list_lookup): Remove lookup
5873 parameter. Add is_global parameter. Change all callers. Handle
5874 wildcard pattern specially. Unquote pattern. Call
5876 (Version_script_info::get_name_to_match): New function.
5877 (Version_script_info::get_symbol_version): New function.
5878 (Version_script_info::get_symbol_version_helper): Remove.
5879 (Version_script_info::check_unmatched_names): Call unquote.
5880 * script.h (class Version_script_info): Change get_symbol_version
5881 to be non-inline and add is_global parameter; change all callers.
5882 Rewrite symbol_is_local. Update declarations. Define struct
5883 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5884 Remove globals_ and locals_ members. Add exact_, globs_,
5885 default_version_, is_global_.
5886 (Version_script_info::Glob): Remove pattern, add expression and
5887 is_global. Update constructor. Change all callers.
5888 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5890 (Versions::symbol_section_contents): If a symbol is undefined, or
5891 defined in a dynamic object, set the version index to
5893 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5895 (Symbol_table::add_from_pluginobj): Likewise.
5896 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5898 2010-01-11 Doug Kwan <dougkwan@google.com>
5900 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5901 (incremental_dump_LDADD): Add linking option for libintl.
5902 * Makefile.in: Regenerate.
5904 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5907 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5909 * testsuite/Makefile.in: Regenerated.
5911 2010-01-10 Doug Kwan <dougkwan@google.com>
5913 * options.h (DEFINE_var): Use parentheses around argument varname__
5914 in macro body to avoid any unintended subsequent substitutions.
5916 2010-01-10 Ian Lance Taylor <iant@google.com>
5918 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5919 candidates before doing symbol resolution.
5921 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5922 ODR candidates if only one is weak.
5924 2010-01-08 Ian Lance Taylor <iant@google.com>
5926 * script.cc (Version_script_info::build_expression_list_lookup):
5927 Don't warn about ambiguous version, just record the ambiguity.
5928 (Version_script_info::get_symbol_version_helper): Give error if
5929 version is ambiguous.
5931 2010-01-08 Doug Kwan <dougkwan@google.com>
5933 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5934 prev_data_size_ and prev_addralign_. Remove initializer for
5935 deleted data member has_been_changed_.
5936 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5937 to determine if the table is empty.
5938 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5940 (Stub_table::add_reloc_stub): Define method in class definition
5941 instead of just declaring it there.
5942 (Stub_table::add_cortex_a8_stub): New method definition.
5943 (Stub_table::update_data_size_and_addralign): Ditto.
5944 (Stub_table::finalize_stubs): Ditto.
5945 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5946 (Stub_table::do_addralign_): Return address alignment in the
5947 (Stub_table::do_reset_address_and_file_offset): Define method in
5948 class definition instead of declaring it there. Set current data
5949 size to be the data size of the previous pass.
5950 (Stub_table::set_final_data_size): Use current data size as the
5952 (Stub_table::relocate_stub): Change parameter type of stub from
5953 Reloc_stub pointer to Stub pointer.
5954 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5955 (Stub_table::Cortex_a8_stub_list): New typedef.
5956 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5957 Stub_table::prev_addralign_): New data member.
5958 (Arm_relobj::Arm_relobj): Initialize data member
5959 section_has_cortex_a8_workaround_.
5960 (Arm_relobj::section_has_cortex_a8_workaround,
5961 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5963 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5965 (Target_arm::relocate_stub): Change parameter type of stub from
5966 Reloc_stub pointer to Stub pointer.
5967 (Insn_template::size, Insn_template::alignment): Handle
5968 THUMB16_SPECIAL_TYPE.
5969 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5970 Stub_table::update_data_size_and_addralign,
5971 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5973 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5974 (Stub_table::do_write): Ditto.
5975 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5977 2010-01-08 Ian Lance Taylor <iant@google.com>
5980 * symtab.h (class Symbol): Remove fields is_target_special_ and
5981 has_plt_offset_. Add field is_defined_in_discarded_section_.
5982 (Symbol::is_defined_in_discarded_section): New function.
5983 (Symbol::set_is_defined_in_discarded_section): New function.
5984 (Symbol::has_plt_offset): Rewrite.
5985 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5986 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5987 Don't initialize is_target_special_ or has_plt_offset_.
5988 Initialize is_defined_in_discarded_section_.
5989 (Symbol_table::add_from_relobj): If appropriate, set
5990 is_defined_in_discarded_section.
5991 * resolve.cc (Symbol::override_base_with_special): Don't test
5992 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5993 * target-reloc.h (relocate_section): Do special handling for
5994 symbols defined in discarded sections for global symbols as well
5997 2010-01-08 Ian Lance Taylor <iant@google.com>
5999 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6000 the SHT_SYMTAB case.
6002 2010-01-08 Ian Lance Taylor <iant@google.com>
6004 * object.cc (Sized_relobj::do_layout): Don't get confused if
6005 layout_eh_frame returns NULL.
6007 2010-01-08 Ian Lance Taylor <iant@google.com>
6010 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6011 dynamic symbol table, use the normal symbol table.
6012 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6015 2010-01-08 Ian Lance Taylor <iant@google.com>
6018 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6021 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6023 * version.cc (print_version): Change to "Copyright 2010".
6025 2010-01-08 Ian Lance Taylor <iant@google.com>
6029 * i386.cc (class Target_i386): Change return type of plt_section
6031 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6032 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6033 tls_desc_rel_ field.
6034 (Output_data_plt_i386::rel_tls_desc): New function.
6035 (Target_i386::rel_tls_desc_section): New function.
6036 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6037 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6038 R_386_TLS_DESC reloc in rel_tls_desc_section.
6039 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6040 Define struct Tlsdesc_info.
6041 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6042 (Target_x86_64::do_reloc_symbol_index): New function.
6043 (Target_x86_64::add_tlsdesc_info): New function.
6044 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6045 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6047 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6049 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6050 (Target_x86_64::rela_tlsdesc_section): New function.
6051 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6053 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6054 (Target_x86_64::do_reloc_addend): New function.
6055 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6056 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6057 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6058 (Output_reloc::type): New function.
6059 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6060 (Output_reloc::is_target_specific): New function.
6061 (Output_reloc::target_arg): New function.
6062 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6063 absolute relocs and target specific relocs.
6064 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6065 add_target_specific.
6066 (class Output_data_reloc) [SHT_RELA]: Likewise.
6067 * output.cc (Output_reloc::Output_reloc): Add four new versions
6068 for absolute relocs and target specific relocs.
6069 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6070 (Output_reloc::get_symbol_index): Likewise.
6071 (Output_reloc::local_section_offset): Check that local_sym_index_
6072 is not TARGET_CODE or 0.
6073 (Output_reloc::symbol_value): Likewise.
6074 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6076 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6077 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6079 * layout.cc (add_target_dynamic_tags): Use output section for
6080 DT_PLTRELSZ and DT_JMPREL.
6082 2010-01-07 Ian Lance Taylor <iant@google.com>
6085 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6087 (class Output_data_reloc_generic): Define.
6088 (class Output_data_reloc_base): Change base class to
6089 Output_data_reloc_generic. Change add() method to call
6090 bump_relative_reloc_count for a relative reloc. Remove
6092 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6094 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6095 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6097 * layout.h (class Layout): Update declaration.
6099 2010-01-07 Ian Lance Taylor <iant@google.com>
6101 * output.h (class Output_data): Add const version of
6102 output_section and do_output_section.
6103 (class Output_section_data): Add const version of
6105 (class Output_section): Likewise.
6106 * layout.cc (Layout::add_target_dynamic_tags): New function.
6107 * layout.h (class Layout): Update declarations.
6108 * arm.cc (Target_arm::do_finalize_sections): Use
6109 add_target_dynamic_tags.
6110 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6111 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6112 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6113 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6115 2010-01-07 Ian Lance Taylor <iant@google.com>
6118 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6121 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6122 Ian Lance Taylor <iant@google.com>
6125 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6126 Xindex::read_symtab_xindex.
6128 2010-01-07 Doug Kwan <dougkwan@google.com>
6130 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6131 (Insn_template::thumb16_bcond_insn): New method declaration.
6132 (Insn_template): Fix spelling.
6133 (Stub::thumb16_special): New method declaration.
6134 (Stub::do_write): Define virtual method which was previously pure
6136 (Stub::do_thumb16_special): New method declaration.
6137 (Stub::do_fixed_endian_write): New template member.
6138 (Reloc_stub::do_write): Remove.
6139 (Reloc_stub::do_fixed_endian_write): Remove.
6140 (Cortex_a8_stub): New class definition.
6141 (Stub_factory::make_cortex_a8_stub): New method definition.
6142 (Stub_factory::Stub_factory): Add missing static storage class
6143 qualifier for elf32_arm_stub_a8_veneer_blx.
6145 2010-01-07 Ian Lance Taylor <iant@google.com>
6148 * options.h (class General_options): Add --warn-unresolved-symbols
6149 and --error-unresolved-symbols.
6150 * errors.cc (Errors::undefined_symbol): Implement
6151 --warn-unresolved-symbols.
6153 * options.h (class General_options): Add -z text and -z textoff.
6154 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6156 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6158 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6159 (Garbage_collection::cident_sections): New function.
6160 (Garbage_collection::add_cident_section): New function.
6161 (Garbage_collection::cident_sections_): New member.
6162 (gc_process_relocs): Add references to sections whose names are C
6164 * gold.h (cident_section_start_prefix): New constant.
6165 (cident_section_stop_prefix): New constant.
6166 (is_cident): New function.
6167 * layout.cc (Layout::define_section_symbols): Replace string constants
6168 with the newly defined constants.
6169 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6171 * testsuite/Makefile.am: Add gc_orphan_section_test.
6172 * testsuite/Makefile.in: Regenerate.
6173 * testsuite/gc_orphan_section_test.cc: New file.
6174 * testsuite/gc_orphan_section_test.sh: New file.
6176 2010-01-06 Ian Lance Taylor <iant@google.com>
6179 * options.h (class General_options): Add --warn-shared-textrel.
6180 * layout.cc (Layout::finish_dynamic_section): Implement
6181 --warn-shared-textrel.
6184 * options.h (class General_options): Add --warn-multiple-gp.
6186 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6188 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6189 $(THREADSLIB) and $(LIBDL).
6190 * Makefile.in: Rebuild.
6192 2010-01-06 Ian Lance Taylor <iant@google.com>
6195 * options.cc (General_options::parse_section_start): New function.
6196 (General_options::section_start): New function.
6197 (General_options::General_options): Initialize all members.
6198 * options.h: Include <map>
6199 (class General_options): Add --section-start. Add section_starts_
6201 * layout.cc (Layout::attach_allocated_section_to_segment): If
6202 --section-start was used, set the address of the segment. Remove
6203 local sort_sections.
6204 (Layout::relaxation_loop_body): If the address of the load segment
6205 has been set by --section-start, don't use it.
6206 * output.h (Output_segment::update_flags_for_output_section): New
6208 * output.cc (Output_segment::add_output_section): Call
6209 update_flags_for_output_section.
6211 2010-01-05 Ian Lance Taylor <iant@google.com>
6214 * options.h (class General_options): Add --undefined-version.
6215 * script.cc (struct Version_expression): Add was_matched_by_symbol
6217 (Version_script_info::matched_symbol): New function.
6218 (Version_script_info::get_symbol_version_helper): Call
6220 (Version_script_info::check_unmatched_names): New function.
6221 * script.h (class Version_script_info): Update declarations.
6222 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6224 * options.h (class General_options): Use DEFINE_bool_alias for
6225 allow_multiple_definition.
6226 * resolve.cc (Symbol_table::should_override): Don't test
6227 allow_multiple_definition.
6230 * options.h (class General_options): Add --cref.
6231 * main.cc (main): Print cref table if --cref. Don't close mapfile
6232 until after printing cref table.
6233 * cref.cc: Include "symtab.h".
6234 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6235 (Cref_table_compare::operator()): New function.
6236 (Cref_inputs::gather_cref): New function.
6237 (filecol): New static const.
6238 (Cref_inputs::print_cref): New function.
6239 (Cref::print_cref): New function.
6240 * cref.h: Include <cstdio>.
6241 (class Cref): Update declarations.
6242 * mapfile.h (Mapfile::file): New function.
6243 * object.h (class Object): Define Symbols. Declare virtual
6244 do_get_global_symbols.
6245 (Object::get_global_symbols): New function.
6246 * object.cc (Input_objects::add_object): Pass object to cref_ if
6248 (Input_objects::archive_start): Likewise.
6249 (Input_objects::archive_stop): Likewise.
6250 (Input_objects::print_cref): New function.
6251 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6252 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6254 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6256 * plugin.h (class Sized_pluginobj): Update declarations.
6258 2010-01-05 Ian Lance Taylor <iant@google.com>
6260 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6261 to is_default_version. Rename insdef to insdefault.
6262 (Symbol_table::add_from_relobj): Rename def to is_default_version
6263 and local to is_forced_local.
6264 (Symbol_table::add_from_pluginobj): Likewise.
6265 (Symbol_table::add_from_dynobj): Likewise.
6266 (Symbol_table::define_special_symbol): Rename insdef to
6269 2010-01-04 Ian Lance Taylor <iant@google.com>
6272 * options.h (class General_options): Add
6273 --allow-multiple-definition and -z muldefs.
6274 * resolve.cc (Symbol_table::should_override): Don't warn about a
6275 multiple symbol definition if --allow-multiple-definition or -z
6279 * options.h (class General_options): Add --add-needed and
6280 --copy-dt-needed-entries. Tweak --as-needed help entry.
6281 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6282 error if --copy-dt-needed-entries aka --add-needed is used and
6283 would cause a change in behaviour.
6286 * options.h (class General_options): Add -G as a short version of
6287 --shared. Add no-op options -assert, -g, and -i.
6289 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6291 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6292 check for .text or .gnu.linkonce.t sections.
6293 * icf.cc (Icf::find_identical_sections): Ditto.
6294 Change the detection for mangled function name within the section
6296 * icf.h (is_section_foldable_candidate): New function.
6298 2009-12-30 Ian Lance Taylor <iant@google.com>
6301 * options.h (class General_options): Permit two dashes with
6302 --retain-symbols-file.
6304 2009-12-30 Ian Lance Taylor <iant@google.com>
6307 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6308 don't put the file header and segment headers in the text
6312 * common.cc (Sort_commons::operator()): Stabilize sort when both
6314 (Symbol_table::do_allocate_commons_list): When allocating common
6315 symbols, skip a symbol which is no longer common.
6316 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6317 an object before checking its type.
6318 * testsuite/common_test_2.c: New file.
6319 * testsuite/common_test_3.c: New file.
6320 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6321 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6322 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6323 (common_test_2_pic.o, common_test_2.so): New targets.
6324 (common_test_3_pic.o, common_test_3.so): New targets.
6325 * testsuite/Makefile.in: Rebuild.
6328 * script.cc (read_input_script): If we see a new SECTIONS clause,
6329 and we have added an input section, give an error.
6330 * layout.h (class Layout): Add have_added_input_section function.
6331 Add have_added_input_section_ field.
6332 * layout.cc (Layout::Layout): Initialize
6333 have_added_input_section_.
6334 (Layout::layout): Set have_added_input_section_.
6335 (Layout::layout_eh_frame): Likewise.
6337 2009-12-30 Ian Lance Taylor <iant@google.com>
6340 * options.h (class General_options): Add --sort-common option.
6341 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6342 * common.cc (Sort_common): Add sort_order parameter to
6343 constructor. Add sort_order_ field.
6344 (Sort_commons::operator): Check sort_order_.
6345 (Symbol_table::allocate_commons): Determine the sort order.
6346 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6348 (Symbol_table::do_allocate_commons_list): Likewise.
6350 2009-12-30 Ian Lance Taylor <iant@google.com>
6353 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6354 symbols from this object, don't change the visibility of an
6356 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6358 2009-12-30 Ian Lance Taylor <iant@google.com>
6361 * script.h (class Version_script_info): Define Language enum.
6362 Update declarations. Define Glob, Exact, and Lookup types. Add
6363 new fields globals_, locals_, and is_finalized_.
6364 * script.cc: Various formatting fixes.
6365 (class Parser_closure): Change language_stack_ from a vector of
6366 std::string to one of Version_script_info::Language. Adjust all
6368 (class Lazy_demangler): Remove.
6369 (struct Version_expression): Change language from std::string to
6370 Version_script_info::Language.
6371 (Version_script_info::Version_script_info): New function.
6372 (Version_script_info::~Version_script_info): Don't call clear.
6373 (Version_script_info::finalize): New function.
6374 (Version_script_info::build_lookup_tables): New function.
6375 (Version_script_info::build_expression_list_lookup): New
6377 (Version_script_info::get_symbol_version_helper): Rewrite to use
6379 (Version_script_info::print_expression_list): Adjust to use
6380 Version_script_info::Language.
6381 (script_push_lex_into_version_mode): Check that the version script
6382 has not been finalized.
6383 (version_script_push_lang): Change language string to
6384 Version_script_info::Language.
6385 * options.cc (Command_line::version_script): New function.
6386 * options.h (class General_options): Add finalize_dynamic_list
6387 function. Change version_script from declaration to definition.
6388 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6389 * testsuite/version_script.map: Remove duplicate def of foo.
6390 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6392 * testsuite/Makefile.in: Rebuild.
6394 2009-12-30 Ian Lance Taylor <iant@google.com>
6397 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6398 if the input symbol index is 0, make the output symbol index 0.
6400 2009-12-30 Ian Lance Taylor <iant@google.com>
6403 * options.h (class General_options): Add -x/--discard-all.
6404 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6405 --discard-all. If the local symbol needs a dynamic entry, check
6406 that before handling --discard-locals.
6408 2009-12-30 Ian Lance Taylor <iant@google.com>
6411 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6413 (Output_segment::add_output_section): Don't change the flags if
6417 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6418 GNU hash table if they need a dynamic value. Otherwise, don't add
6419 them if they are defined in a dynamic object or are forced local.
6421 2009-12-29 Ian Lance Taylor <iant@google.com>
6424 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6425 .gnu.hash table for a 32-bit target.
6428 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6429 regular and a dynamic object only needs a dynamic symbol table
6430 entry if it is externally visible.
6433 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6434 constructor. Add global_offset_table_ field.
6435 (Target_i386::got_section): Set global_offset_table_.
6436 (Target_i386::do_finalize_sections): Set global_offset_table_
6438 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6439 in constructor. Add global_offset_table_ field.
6440 (Target_x86_64::got_section): Set global_offset_table_.
6441 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6444 * layout.cc (Layout::Layout): Initialize increase_relro_.
6445 (Layout::get_output_section): Add is_relro, is_last_relro, and
6446 is_first_non_relro parameters. Change all callers.
6447 (Layout::choose_output_section): Likewise.
6448 (Layout::add_output_section_data): Likewise.
6449 (Layout::make_output_section): Likewise.
6450 (Layout::set_segment_offsets): Clear increase_relro when using a
6452 * layout.h (class Layout): Add increase_relro method. Add
6453 increase_relro_ field. Update declarations.
6454 * output.cc (Output_section::Output_section): Initialize
6455 is_last_relro_ and is_first_non_relro_.
6456 (Output_segment::add_output_section): Group relro sections is
6457 do_sort is true. Handle is_last_relro and is_first_non_relro.
6458 (Output_segment::maximum_alignment): Remove relro handling.
6459 (Output_segment::set_section_addresses): Add increase_relro
6460 parameter. Change all callers. Add initial alignment to align
6461 relro sections on separate page. Remove old relro handling.
6462 (Output_segment::set_section_list_addresses): Remove in_relro
6463 parameter. Change all callers.
6464 (Output_segment::set_offset): Add increase parameter. Change all
6465 callers. Remove old relro handling.
6466 * output.h (class Output_section): Add new methods: is_last_relro,
6467 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6468 Add is_last_relro_ and is_first_non_relro_ fields.
6469 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6470 Create separate .got.plt section. Call increase_relro.
6471 * x86_64.cc (Target_x86_64::got_section): Likewise.
6472 * testsuite/relro_script_test.t: Add .got.plt.
6475 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6476 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6477 (Layout::finalize): Call set_dynamic_symbol_size.
6478 (Layout::set_dynamic_symbol_size): New function.
6479 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6480 set_dynamic_symbol_size.
6483 * output.h (class Output_section): Add is_entsize_zero_ field.
6484 * output.cc (Output_section::Output_section): Initialize
6486 (Output_section::set_entsize): If two different entsizes are
6487 requested, force it to zero.
6488 (Output_section::add_input_section): Set flags for .debug_str
6489 before updating section flags. Set entsize.
6490 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6491 and SHF_STRING if all input sections have those flags.
6493 2009-12-29 Rafael Espindola <espindola@google.com>
6495 * main.cc (main): Fix the sys time reporting.
6496 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6499 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6501 * options.cc (General_options::parse_version): Allow -v to exit
6502 without an error if there is nothing to link.
6504 2009-12-29 Ian Lance Taylor <iant@google.com>
6506 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6507 using a version of gcc before 4.1.
6508 * configure: Rebuild.
6510 2009-12-28 Chris Demetriou <cgd@google.com>
6512 * attributes.cc (Output_attributes_section_data::do_write): Use
6513 std::vector::front rather than std::vector::data.
6515 2009-12-28 Ian Lance Taylor <iant@google.com>
6517 * symtab.h (class Symbol_table): Add enum Defined.
6518 * resolve.cc (Symbol_table::should_override): Add defined
6519 parameter. Change all callers. Test whether object is NULL
6520 before calling a method on it.
6521 (Symbol_table::report_resolve_problem): Add defined parameter.
6523 (Symbol_table::should_override_with_special): Likewise.
6524 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6525 parameter. Change all callers.
6526 (Symbol_table::do_define_in_output_data): Likewise.
6527 (Symbol_table::define_in_output_segment): Likewise.
6528 (Symbol_table::do_define_in_output_segment): Likewise.
6529 (Symbol_table::define_as_constant): Likewise.
6530 (Symbol_table::do_define_as_constant): Likewise.
6531 * script.h (class Symbol_assignment): Add is_defsym parameter to
6532 constructor; change all callers.
6533 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6534 parameter. Change all callers. Add is_defsym_ field.
6535 (class Parser_closure): Add parsing_defsym parameter to
6536 constructor; change all callers. Add parsing_defsym accessor
6537 function. Add parsing_defsym_ field.
6539 2009-12-28 Ian Lance Taylor <iant@google.com>
6541 * gold.cc (queue_middle_tasks): Fix formatting.
6542 * object.cc (Relobj::is_section_name_included): Likewise.
6544 2009-12-23 Ian Lance Taylor <iant@google.com>
6546 * i386.cc (Target_i386::do_calls_non_split): Recognize
6547 -fsplit-stack prologue for a function with a static chain.
6548 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6549 -fsplit-stack prologue when using %r11.
6551 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6553 * options.cc (General_options::parse_version): Make -v continue and do
6554 the link like GNU ld does.
6556 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6558 * Makefile.am (CCFILES): Add timer.cc.
6559 (HFILES): Add timer.h.
6560 * configure.ac: Check for sysconf and times.
6561 * main.cc: include timer.h.
6562 (main): Use Timer instead of get_run_time.
6565 * workqueue.cc: include timer.h.
6566 (Workqueue::find_and_run_task):
6567 Report user, sys and wall time.
6568 * Makefile.in: Regenerate.
6569 * config.in: Regenerate.
6570 * configure: Regenerate.
6572 2009-12-16 Doug Kwan <dougkwan@google.com>
6574 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6576 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6577 relaxed input sections.
6578 * output.cc (Output_section::find_relaxed_input_section): Change
6579 return type to Output_relaxed_input_section pointer. Adjust code
6580 for new type of relaxed_input_section_map_.
6581 * output.h (Output_section::find_relaxed_input_section): Change
6582 return type to Output_relaxed_input_section pointer.
6583 (Output_section::Output_relaxed_input_section_by_input_section_map):
6585 (Output_section::relaxed_input_section_map_): Change type to
6586 Output_section::Output_relaxed_input_section_by_input_section_map.
6587 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6590 2009-12-15 Ian Lance Taylor <iant@google.com>
6592 * layout.cc (Layout::create_shstrtab): Only write out after input
6593 sections if we are compressing debug sections.
6595 2009-12-15 Ian Lance Taylor <iant@google.com>
6597 * archive.cc (Archive::add_symbols): Only look up a symbol without
6598 a version if there is, in fact, a version.
6600 2009-12-14 Ian Lance Taylor <iant@google.com>
6602 Revert -Wshadow changes, all changes from:
6603 2009-12-11 Doug Kwan <dougkwan@google.com>
6604 2009-12-11 Nick Clifton <nickc@redhat.com>
6605 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6607 2009-12-11 Doug Kwan <dougkwan@google.com>
6609 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6611 * attributes.cc (Object_attribute::size): Ditto.
6612 (Attributes_section_data::size): Ditto.
6613 (Attributes_section_data::Attributes_section_data): Ditto.
6614 (Output_attributes_section_data::do_write): Ditto.
6615 * attributes.h (Object_attribute::set_type): Ditto.
6616 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6618 2009-12-11 Nick Clifton <nickc@redhat.com>
6620 * archive.cc: Fix shadowed variable warnings.
6622 * compressed_output.cc: Likewise.
6623 * compressed_output.h: Likewise.
6624 * configure: Likewise.
6625 * dwarf_reader.cc: Likewise.
6626 * dynobj.cc: Likewise.
6627 * dynobj.h: Likewise.
6628 * ehframe.cc: Likewise.
6629 * ehframe.h: Likewise.
6630 * errors.cc: Likewise.
6631 * expression.cc: Likewise.
6632 * fileread.cc: Likewise.
6633 * fileread.h: Likewise.
6634 * freebsd.h: Likewise.
6635 * i386.cc: Likewise.
6637 * incremental.h: Likewise.
6638 * layout.cc: Likewise.
6639 * layout.h: Likewise.
6640 * mapfile.cc: Likewise.
6641 * merge.cc: Likewise.
6642 * merge.h: Likewise.
6643 * object.cc: Likewise.
6644 * object.h: Likewise.
6645 * options.h: Likewise.
6646 * output.cc: Likewise.
6647 * output.h: Likewise.
6648 * parameters.cc: Likewise.
6649 * plugin.cc: Likewise.
6650 * powerpc.cc: Likewise.
6651 * reduced_debug_output.cc: Likewise.
6652 * reduced_debug_output.h: Likewise.
6653 * reloc.cc: Likewise.
6654 * reloc.h: Likewise.
6655 * resolve.cc: Likewise.
6656 * script-sections.cc: Likewise.
6657 * script.cc: Likewise.
6658 * script.h: Likewise.
6659 * sparc.cc: Likewise.
6660 * symtab.cc: Likewise.
6661 * symtab.h: Likewise.
6662 * target-select.cc: Likewise.
6663 * target-select.h: Likewise.
6664 * token.h: Likewise.
6665 * workqueue.cc: Likewise.
6666 * workqueue.h: Likewise.
6667 * x86_64.cc: Likewise.
6669 2009-12-10 Doug Kwan <dougkwan@google.com>
6671 * arm.cc (attributes.h): New include.
6672 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6673 (Arm_relobj::~Arm_relobj): Delete object pointed by
6674 attributes_section_data_.
6675 (Arm_relobj::attributes_section_data): New method definition.
6676 (Arm_relobj::attributes_section_data_): New data member declaration.
6677 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6678 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6679 attributes_section_data_.
6680 (Arm_dynobj::attributes_section_data): New method definition.
6681 (Arm_dynobj::attributes_section_data_): New data member declaration.
6682 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6683 initialization value of may_use_blx_ to false.
6684 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6685 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6686 object attributes to compute results instead of hard-coding.
6687 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6688 Target_arm::get_secondary_compatible_arch,
6689 Target_arm::set_secondary_compatible_arch
6690 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6691 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6692 New method declarations.
6693 (Target_arm::get_aeabi_object_attribute): New method definition.
6694 (Target_arm::attributes_section_data_): New data member declaration.
6695 (read_arm_attributes_section): New template definition.
6696 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6697 (Arm_dynobj::do_read_symbols): Ditto.
6698 (Target_arm::do_finalize_sections): Merge attributes sections from
6699 input. Check for BLX use after attributes section merging.
6700 Fix __exidx_start and __exidx_end visibility. Create an
6701 .ARM.attributes section if necessary.
6702 (Target_arm::get_secondary_compatible_arch,
6703 Target_arm::set_secondary_compatible_arch,
6704 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6705 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6706 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6707 New method definitions.
6709 2009-12-09 Ian Lance Taylor <iant@google.com>
6711 * plugin.cc (Plugin::load): Don't cast from void* to a function
6714 2009-12-09 Ian Lance Taylor <iant@google.com>
6716 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6719 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6721 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6722 Replace two_file_shared_1.so with two_file_shared_2.so.
6723 * testsuite/Makefile.in: Regenerated.
6725 2009-12-08 Doug Kwan <dougkwan@google.com>
6727 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6728 (HFILES): Add attributes.h and int_encoding.h.
6729 * Makefile.in: Regenerate.
6730 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6731 function definitions to int_encoding.cc
6732 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6733 prototypes to int_encoding.h
6734 * reduced_debug_output.cc (int_encoding.h): New include.
6735 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6736 function definitions to int_encoding.cc
6737 (insert_into_vector, read_from_pointer): Move template definitions to
6739 * attributes.cc: New file.
6740 * attributes.h: New file.
6741 * int_encoding.cc: New file.
6742 * int_encoding.h: New file.
6744 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6747 * incremental-dump.cc (dump_incremental_inputs): New.
6748 (main): Use dump_incremental_inputs.
6750 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6753 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6754 checking elfcpp::STT_FUNC.
6755 (Target_i386::Relocate::relocate): Likewise.
6756 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6758 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6759 symbols from shared libraries into normal FUNC symbols.
6761 * symtab.h (Symbol): Add is_func and use it.
6763 2009-12-05 Doug Kwan <dougkwan@google.com>
6765 * arm.cc (Target_arm::arm_info): Initialize new fields
6766 attributes_section and attributes_vendor.
6767 * i386.cc (Target_i386::i386_info): Same.
6768 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6769 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6770 fields attributes_section and attributes_vendor.
6771 * sparc.cc (Target_sparc::sparc_info): Same.
6772 * target.h (Target::attributes_section, Target::attributes_vendor,
6773 Target::is_attributes_section, Target::attribute_arg_type,
6774 Target::attributes_order): New method definitions.
6775 (Target::Target_info::attributes_section,
6776 Target::Target_info::attributes_vendor): New fields.
6777 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6778 virtual method definitions.
6779 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6780 attributes_section and attributes_vendor.
6781 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6783 2009-12-05 Doug Kwan <dougkwan@google.com>
6785 * arm.cc: Update comments about interworking and stub generation.
6786 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6787 considered as non-PIC.
6788 (Arm_relocate_functions::base_abs): Fix formatting.
6789 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6790 of function to use GOT entry address instead of offset.
6791 (Target_arm::Scan::global): Issue an error if a symbol would need a
6792 PLT does not get one because it is untyped. Remove code to create
6793 dynamic symbols for relative branches.
6794 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6795 takes unsigned integer instead of boolean.
6797 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6799 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6800 (two_file_test_LDADD): Likewise.
6801 (common_test_1_LDADD): Likewise.
6802 (exception_test_LDADD) Likewise.
6803 (weak_test_LDADD): Likewise.
6804 (many_sections_test_LDADD): Likewise.
6805 (initpri1_LDADD): Likewise.
6806 (script_test_1_LDADD): Likewise.
6807 (script_test_2_LDADD): Likewise.
6808 (justsyms_LDADD): Likewise.
6809 (binary_test_LDADD): Likewise.
6810 (large_LDADD): Likewise.
6811 * testsuite/Makefile.in: Regenerated.
6813 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6815 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6816 (Symbol_table::override_with_special): Likewise.
6817 (Symbol_table::add_from_object): Likewise.
6819 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6821 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6822 Don't set the data_offset twice.
6824 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6826 * testsuite/Makefile.in: Regenerate.
6828 2009-12-03 Doug Kwan <dougkwan@google.com>
6830 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6831 (Target_arm::do_finalize_sections): Add parameter for symbol table
6832 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6833 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6834 parameter for symbol table pointer.
6835 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6836 an additional parameter for a pointer to symbol table.
6837 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6838 parameter for a symbol table pointer.
6839 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6840 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6842 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6843 parameter for a symbol table pointer.
6845 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6847 * incremental.cc (Incremental_inputs_header)
6848 (Incremental_inputs_header_write, Incremental_inputs_entry)
6849 (Incremental_inputs_entry_write): Move ...
6850 * incremental.h (Incremental_inputs_header)
6851 (Incremental_inputs_header_write, Incremental_inputs_entry)
6852 (Incremental_inputs_entry_write): here.
6854 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6856 * incremental.cc (make_sized_incremental_binary): Set the target.
6857 Error if it is incompatible.
6858 * output.h (Output_file): Add filename method.
6860 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6862 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6863 from the get_* methods.
6865 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6867 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6868 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6869 Write 0 for the data_offset of scripts.
6871 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6873 * testsuite/Makefile.am: Add the incremental_test.sh test.
6874 * testsuite/incremental_test.sh: New.
6875 * testsuite/incremental_test_1.c: New.
6876 * testsuite/incremental_test_2.c: New.
6878 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6880 * incremental-dump.cc (main): Fix typos.
6882 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6885 * incremental-dump.cc (main): Use llu to print 64 bit values.
6887 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6888 H.J. Lu <hongjiu.lu@intel.com>
6890 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6892 (incremental_dump_LDADD): Likewise.
6893 * Makefile.in: Regenerated.
6895 2009-11-25 Doug Kwan <dougkwan@google.com>
6899 2009-11-25 Doug Kwan <dougkwan@google.com>
6901 * arm.cc (Target_arm::Target_arm): Move method definition
6902 outside of class definition. Add code to handle
6903 --target1-rel, --target1-abs and --target2= options.
6904 (Target_arm::get_reloc_reloc_type): Change method to be
6905 non-static and const.
6906 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6907 New data member declaration.
6908 (Target_arm::Scan::local, Target_arm::Scan::global,
6909 Target_arm::Relocate::relocate,
6910 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6911 Adjust call to Target_arm::get_real_reloc_type.
6912 (Target_arm::get_real_reloc_type): Use command line options
6913 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6914 * options.h (--target1-rel, --target1-abs, --target2): New
6917 2009-11-25 Doug Kwan <dougkwan@google.com>
6919 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6920 class definition. Add code to handle --target1-rel, --target1-abs
6921 and --target2= options.
6922 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6924 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6926 (Target_arm::Scan::local, Target_arm::Scan::global,
6927 Target_arm::Relocate::relocate,
6928 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6929 call to Target_arm::get_real_reloc_type.
6930 (Target_arm::get_real_reloc_type): Use command line options to
6931 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6932 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6935 2009-11-25 Doug Kwan <dougkwan@google.com>
6937 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6938 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6939 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6941 (Arm_relocate_functions::thm_call): Replace body with a call to
6942 Arm_relocate_functions::thumb_branch_common.
6943 (Arm_relocate_functions::thm_jump24,
6944 Arm_relocate_functions::thm_xpc22): New method definitions.
6945 (Arm_relocate_functions::thumb_branch_common): New method definition.
6946 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6948 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6949 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6951 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6953 * Makefile.am: Build incremental-dump
6954 * Makefile.in: Regenerate.
6955 * incremental-dump.cc: New.
6956 * incremental.cc (Incremental_inputs_header_data,
6957 Incremental_inputs_entry_data): Move to incremental.h
6958 * incremental.h: (Incremental_inputs_header_data,
6959 Incremental_inputs_entry_data): Move from incremental.cc
6961 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6963 * incremental.cc (Incremental_inputs_header,
6964 Incremental_inputs_header_write, Incremental_inputs_entry,
6965 Incremental_inputs_entry_write): Add a typedef with the data type.
6967 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6969 * incremental.cc (Incremental_inputs_header,
6970 Incremental_inputs_header_write, Incremental_inputs_entry,
6971 Incremental_inputs_entry_write): Update comment about which
6972 type has the filed descriptions.
6974 2009-11-15 Doug Kwan <dougkwan@google.com>
6976 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6977 (Arm_relocate_functions::arm_branch_common): Change method defintion
6978 in class definition to a method declaration and update list of formal
6980 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6981 Arm_relocation_functions::jump24): Adjust call to
6982 Arm_relocate_functions::arm_branch_common. Update list of formal
6984 (Arm_relocate_functions::xpc25): New method definition.
6985 (Arm_relocate_functions::arm_branch_common): Move method defintion
6986 out from class definition. Use stubs for mode-switching and extending
6988 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6989 specially. Change code to enable use of stubs in ARM branches.
6991 2009-11-10 Doug Kwan <dougkwan@google.com>
6993 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6994 in method declaration.
6995 (Target_arm::relocate_stub): New method declaration.
6996 (Target_arm::default_target): Change to return a pointer instead of
6998 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6999 Target_arm::default_target.
7000 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7002 (Target_arm::relocate_section): Adjust view.
7003 (Target_arm::relocate_stub): New method definition.
7005 2009-11-10 Doug Kwan <dougkwan@google.com>
7007 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7009 * incremental.cc (open_incremental_binary): Initialized local
7010 variables to avoid warnings.
7011 * object.cc (make_elf_object): Ditto.
7012 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7015 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7018 * testsuite/plugin_test.c: Include "config.h".
7020 2009-11-09 Doug Kwan <dougkwan@google.com>
7022 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7023 (arm_symbol_value): Remove.
7024 (Arm_relocate_functions::arm_branch_common,
7025 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7026 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7027 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7028 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7029 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7030 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7031 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7032 Arm_relocate_functions::thm_mobw_abs_nc,
7033 Arm_relocate_functions::thm_mov_abs,
7034 Arm_relocate_functions::movw_prel_nc,
7035 Arm_relocate_functions::thm_movt_abs,
7036 Arm_relocate_functions::movt_prel,
7037 Arm_relocate_functions::thm_movw_prel_nc,
7038 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7039 (Target_arm::Relocate::relocate): Only decompose address into two
7040 parts if relocation type uses the thumb-bit and pass the actual
7041 bit instead of a flag indicating that the thumb-bit is used. Adjust
7042 calls to methods in Arm_relocate_functions for this change.
7044 2009-11-08 Ian Lance Taylor <iant@google.com>
7047 * reloc.cc: Instantiate
7048 Sized_relobj::initialize_input_to_output_maps and
7049 Sized_relobj:free_input_to_output_maps.
7051 2009-11-06 Ian Lance Taylor <iant@google.com>
7054 * defstd.cc (in_segment): Set only_if_ref true for "end".
7056 2009-11-06 Doug Kwan <dougkwan@google.com>
7058 * arm.cc (class Reloc_stub): Correct a comment.
7059 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7060 (Target_arm::scan_section_for_stubs): New method declaration.
7061 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7062 Change methods from private to protected.
7063 (Target_arm::do_may_relax): New method definition.
7064 (Target_arm::do_relax, Target_arm::group_sections,
7065 Target_arm::scan_reloc_for_stub,
7066 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7067 (Target_arm::arm_input_section_map_): New data member declaration.
7068 (Target_arm::scan_reloc_for_stub,
7069 Target_arm::scan_reloc_section_for_stubs,
7070 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7071 Target_arm::do_relax): New method definitions.
7073 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7075 * configure.ac: Check for (struct stat)::st_mtim
7076 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7077 * config.in: Regenerate.
7078 * configure: Regenerate.
7080 2009-11-05 Ian Lance Taylor <iant@google.com>
7083 * output.cc (Output_segment::add_output_section): Add missing
7086 2009-11-04 Ian Lance Taylor <iant@google.com>
7089 * object.h (class Object): Add is_needed and set_is_needed
7090 methods. Add is_needed_ field. Make bool fields into bitfields.
7091 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7092 defined in a dynamic object and referenced by a regular object,
7093 set is_needed for the dynamic object.
7094 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7095 if the file is marked with as_needed and it is not needed.
7097 2009-11-04 Ian Lance Taylor <iant@google.com>
7100 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7101 tags if data is discarded by linker script.
7102 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7103 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7104 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7105 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7107 2009-11-04 Ian Lance Taylor <iant@google.com>
7109 * layout.cc (Layout::get_output_section): Add is_interp and
7110 is_dynamic_linker_section parameters. Change all callers.
7111 (Layout::choose_output_section): Likewise.
7112 (Layout::make_output_section): Likewise.
7113 (Layout::add_output_section_data): Add is_dynamic_linker_section
7114 parameter. Change all callers.
7115 * layout.h (class Layout): Update declarations.
7116 * output.h (class Output_section): Add is_interp, set_is_interp,
7117 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7118 Add is_interp_, is_dynamic_linker_section_ fields. Change
7119 generate_code_fills_at_write_ to a bitfield.
7120 * output.cc (Output_section::Output_sections): Initialize new
7122 (Output_segment::add_output_section): Add do_sort parameter.
7125 2009-11-03 Ian Lance Taylor <iant@google.com>
7128 * options.h (class General_options): Add --warn-common.
7129 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7130 merging two common symbols.
7131 (Symbol_table::should_override): Handle --warn-common when merging
7132 a common symbol with a defined symbol. Use report_resolve_problem
7133 for multiple definitions.
7134 (Symbol_table::report_resolve_problem): New function.
7135 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7137 2009-11-03 Doug Kwan <dougkwan@google.com>
7139 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7141 (Target_arm::stub_factory): New method definition.
7142 (Target_arm::new_arm_input_section,
7143 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7144 Target_arm::reloc_uses_thumb_bit): New method declarations.
7145 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7146 New type definitions.
7147 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7148 member declarations.
7149 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7150 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7151 New method definitions.
7153 2009-11-03 Ian Lance Taylor <iant@google.com>
7155 * options.h (class General_options): Add --warn_constructors.
7157 2009-11-03 Ian Lance Taylor <iant@google.com>
7160 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7161 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7163 2009-11-03 Ian Lance Taylor <iant@google.com>
7166 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7167 --msgid-bugs-address.
7168 (install-pdf): New target.
7169 (install-data_yes): Look up one directory to find mkinstalldirs.
7171 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7173 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7176 2009-10-30 Doug Kwan <dougkwan@google.com>
7178 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7180 2009-10-30 Doug Kwan <dougkwan@google.com>
7182 * arm.cc (Stub_addend_reader): New struct template definition
7183 and partial specializations.
7184 (Stub_addend_reader::operator()): New method definition for a
7185 partially specialized template.
7187 2009-10-30 Doug Kwan <dougkwan@google.com>
7189 * arm.cc (Arm_relobj::processor_specific_flags): New method
7191 (Arm_relobj::do_read_symbols): New method declaration.
7192 (Arm_relobj::processor_specific_flags_): New data member declaration.
7193 (Arm_dynobj): New class definition.
7194 (Target_arm::do_finalize_sections): Add input_objects parameter.
7195 (Target_arm::do_adjust_elf_header): New method declaration.
7196 (Target_arm::are_eabi_versions_compatible,
7197 (Target_arm::merge_processor_specific_flags): New method declaration.
7198 (Target_arm::do_make_elf_object): New overloaded method definitions
7200 (Arm_relobj::do_read_symbols): New method definition.
7201 (Arm_dynobj::do_read_symbols): Ditto.
7202 (Target_arm::do_finalize_sections): Add input_objects parameters.
7203 Merge processor-specific flags from all input objects.
7204 (Target_arm::are_eabi_versions_compatible,
7205 Target_arm::merge_processor_specific_flags,
7206 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7207 New method definitions.
7208 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7209 Input_objects pointer type parameter.
7210 * layout.cc (Layout::finalize): Pass input objects to target's.
7211 finalize_sections function.
7212 * output.cc (Output_file_header::do_sized_write): Set ELF file
7213 header's processor-specific flags.
7214 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7215 Input_objects pointer type parameter.
7216 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7217 * target.h (Input_objects): New forward class declaration.
7218 (Target::processor_specific_flags,
7219 Target::are_processor_specific_flags_sect): New method definitions.
7220 (Target::finalize_sections): Add input_objects parameter.
7221 (Target::Target): Initialize processor_specific_flags_ and
7222 are_processor_specific_flags_set_.
7223 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7225 (Target::set_processor_specific_flags): New method definition.
7226 (Target::processor_specific_flags_,
7227 Target::are_processor_specific_flags_set_): New data member
7229 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7230 Input_objects pointer type parameter.
7232 2009-10-30 Doug Kwan <dougkwan@google.com>
7234 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7236 2009-10-28 Ian Lance Taylor <iant@google.com>
7238 * object.h (class Relobj): Drop options parameter from
7239 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7240 do_scan_relocs, do_relocate. Change all callers.
7241 (class Sized_relobj): Drop options parameters from
7242 do_gc_process_relocs, do_scan_relocs, do_relocate,
7243 do_relocate_sections, relocate_sections, emit_relocs_scan,
7244 emit_relocs_scan_reltype. Change all callers.
7245 (struct Relocate_info): Remove options field and all references to
7247 * reloc.h (class Read_relocs): Remove options constructor
7248 parameter and options_ field. Change all callers.
7249 (class Gc_process_relocs, class Scan_relocs): Likewise.
7250 (class Relocate_task): Likewise.
7251 * target-reloc.h (scan_relocs): Remove options parameter. Change
7253 (scan_relocatable_relocs): Likewise.
7254 * target.h (class Sized_target): Remove options parameter from
7255 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7257 * gc.h (gc_process_relocs): Remove options parameter. Change all
7259 * arm.cc: Update functions to remove options parameters.
7260 * i386.cc: Likewise.
7261 * powerpc.cc: Likewise.
7262 * sparc.cc: Likewise.
7263 * x86_64.cc: Likewise.
7264 * testsuite/testfile.cc: Likewise.
7266 2009-10-28 Doug Kwan <dougkwan@google.com>
7268 * arm.cc (Arm_relobj): New class definition.
7269 (Arm_relobj::scan_sections_for_stubs,
7270 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7271 New method definitions.
7273 2009-10-28 Cary Coutant <ccoutant@google.com>
7275 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7276 (Plugin::cleanup_done_): New member.
7277 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7278 (Plugin_manager::cleanup_done_): Remove.
7279 (Plugin_manager::add_input_file): Edit error message.
7280 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7281 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7283 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7285 * fileread.cc: (File_read::View::~View): Use the new
7286 data_ownership_ filed.
7287 (File_read::~File_read): Dispose the new whole_file_view_.
7288 (File_read::open): Mmap the whole file if needed.
7289 (File_read::open): Use whole_file_view_ instead of contents_.
7290 (File_read::find_view): Use whole_file_view_ if applicable.
7291 (File_read::do_read): Use whole_file_view_ instead of contents_.
7292 (File_read::make_view): Use whole_file_view_ instead of contents_,
7293 update File_read::View::View call.
7294 (File_read::find_or_make_view): Update File_read::View::View
7296 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7298 (File_read::View::Data_ownership): New enum.
7299 (File_read::View::View): Replace bool mapped_ with Data_ownership
7301 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7302 (File_read::View::data_ownership_): New field.
7303 (File_read::contents_): Remove (replaced by whole_file_view_).
7304 (File_read::whole_file_view_): New field.
7305 * options.h (class General_options): Add --keep-files-mapped.
7307 2009-10-27 Cary Coutant <ccoutant@google.com>
7309 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7310 * testsuite/Makefile.am (plugin_test_5): New test case.
7311 * testsuite/Makefile.in: Regenerate.
7313 2009-10-25 Doug Kwan <dougkwan@google.com>
7315 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7316 from private to protected to allow access by child class.
7317 (Sized_relobj::do_relocate_sections): New method declaration.
7318 (Sized_relobj::relocate_sections): Virtualize.
7319 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7320 Sized_relobj::relocate_sections. Instantiate template explicitly
7321 for different target sizes and endianity.
7323 2009-10-24 Doug Kwan <dougkwan@google.com>
7325 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7326 (Arm_input_section::as_arm_input_section): New method.
7327 (Arm_output_section): New class definition.
7328 (Arm_output_section::create_stub_group,
7329 Arm_output_section::group_sections): New method definitions.
7331 2009-10-22 Doug Kwan <dougkwan@google.com>
7333 * arm.cc (Arm_input_section): New class definition.
7334 (Arm_input_section::init, Arm_input_section:do_write,
7335 Arm_input_section::set_final_data_size,
7336 Arm_input_section::do_reset_address_and_file_offset): New method
7339 2009-10-21 Doug Kwan <dougkwan@google.com>
7341 * arm.cc (Stub_table, Arm_input_section): New forward class
7343 (Stub_table): New class defintion.
7344 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7345 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7346 New method definition.
7348 2009-10-21 Doug Kwan <dougkwan@google.com>
7350 * arm.cc: Update copyright comments.
7351 (Target_arm): New forward class template declaration.
7352 (Arm_address): New type.
7353 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7354 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7355 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7357 (Insn_template): Same.
7358 (DEF_STUBS): New macro.
7359 (Stub_type): New enum type.
7360 (Stub_template): New class definition.
7363 (Stub_factory): Same.
7364 (Target_arm::Target_arm): Initialize may_use_blx_ and
7365 should_force_pic_veneer_.
7366 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7367 Target_arm::should_force_pic_veneer,
7368 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7369 Target_arm::using_thumb_only, Target_arm:;default_target): New
7371 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7372 New data member declarations.
7373 (Insn_template::size, Insn_template::alignment): New method defintions.
7374 (Stub_template::Stub_template): New method definition.
7375 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7376 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7377 (Stub_factory::Stub_factory): New method definition.
7378 * gold.h (string_hash): New template.
7379 * output.h (Input_section_specifier::hash_value): Use
7381 (Input_section_specifier::string_hash): Remove.
7382 * stringpool.cc (Stringpool_template::string_hash): Use
7385 2009-10-20 Doug Kwan <dougkwan@google.com>
7387 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7388 symbols of relaxed input sections.
7389 * output.h (Output_section::find_relaxed_input_section): Make
7392 2009-10-16 Doug Kwan <dougkwan@google.com>
7394 * dynobj.cc (Versions::Versions): Initialize version_script_.
7395 Only insert base version symbol definition for a shared object
7396 if version script defines any version versions.
7397 (Versions::define_base_version): New method definition.
7398 (Versions::add_def): Check that base version is not needed.
7399 (Versions::add_need): Define base version lazily.
7400 * dynobj.h (Versions::define_base_version): New method declaration.
7401 (Versions::needs_base_version_): New data member declaration.
7402 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7403 (check_DATA): Add no_version_test.stdout.
7404 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7406 * testsuite/Makefile.in: Regenerate.
7407 * testsuite/no_version_test.c: New file.
7408 * testsuite/no_version_test.sh: Ditto.
7410 2009-10-16 Doug Kwan <dougkwan@google.com>
7412 * expression.cc (class Segment_start_expression): New class definition.
7413 (Segment_start_expression::value): New method definition.
7414 (script_exp_function_segment_start): Return a new
7415 Segment_start_expression.
7416 * gold/script-c.h (script_saw_segment_start_expression): New function
7418 * script-sections.cc (Script_sections::Script_sections): Initialize
7419 SAW_SEGMENT_START_EXPRESSION_ to false.
7420 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7421 and -Tbbs options to specify section addresses if given in
7422 command line and no SEGMENT_START expression is seen in a script.
7423 * script-sections.h (Script_sections::saw_segment_start_expression,
7424 Script_sections::set_saw_segment_start_expression): New method
7426 (Script_sections::saw_segment_start_expression_): New data member
7428 * script.cc (script_saw_segment_start_expression): New function.
7429 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7430 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7431 script_test_7.sh and script_test_8.sh.
7432 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7433 script_test_8.stdout.
7434 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7435 (script_test_6, script_test_6.stdout, script_test_7,
7436 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7437 * Makefile.in: Regenerate.
7438 * testsuite/script_test_6.sh: New file.
7439 * testsuite/script_test_6.t: Same.
7440 * testsuite/script_test_7.sh: Same.
7441 * testsuite/script_test_7.t: Same.
7442 * testsuite/script_test_8.sh: Same.
7444 2009-10-16 Doug Kwan <dougkwan@google.com>
7446 * output.cc (Output_segment::set_section_list_address): Cast
7447 expressions to unsigned long long type to avoid format warnings.
7449 2009-10-15 Ian Lance Taylor <iant@google.com>
7451 * script.cc (Script_options::add_symbol_assignment): Always add a
7452 dot assignment to script_sections_.
7453 * script-sections.cc (Script_sections::add_dot_assignment):
7454 Initialize if necessary.
7456 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7457 program headers with no load segment if there is a linker script.
7459 * layout.cc (Layout::set_segment_offsets): Align the file offset
7460 to the segment aligment for -N or -n with no load segment.
7461 * output.cc (Output_segment::add_output_section): Don't crash if
7462 the first section is a TLS section.
7463 (Output_segment::set_section_list_addresses): Print an error
7464 message if the address moves backward in a linker script.
7465 * script-sections.cc
7466 (Output_section_element_input::set_section_addresses): Don't
7467 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7468 (Orphan_output_section::set_section_addresses): Likewise.
7470 2009-10-15 Doug Kwan <dougkwan@google.com>
7472 * layout.cc (Layout::finish_dynamic_section): Generate tags
7473 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7474 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7475 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7477 2009-10-14 Ian Lance Taylor <iant@google.com>
7479 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7481 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7482 data_shdr fields of relinfo.
7483 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7484 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7485 R_386_TLS_LDO_32, adjust based on section flags.
7486 (Target_i386::Relocate::fix_up_ldo): Remove.
7488 2009-10-13 Ian Lance Taylor <iant@google.com>
7490 Add support for -pie.
7491 * options.h (class General_options): Add -pie and
7493 (General_options::output_is_position_independent): Test -pie.
7494 (General_options::output_is_executable): Return true if not shared
7495 and not relocatable.
7496 (General_options::output_is_pie): Remove.
7497 * options.cc (General_options::finalize): Reject incompatible uses
7499 * gold.cc (queue_middle_tasks): A -pie link is not static.
7500 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7501 * symtab.cc (Symbol::final_value_is_known): Return false if
7502 output_is_position_independent.
7503 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7504 output_is_position_independent.
7505 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7506 output_is_position_independent.
7507 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7508 output_is_position_independent.
7509 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7511 (basic_pie_test.o, basic_pie_test): New targets.
7512 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7513 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7514 (two_file_pie_test): New target.
7515 * testsuite/Makefile.in: Rebuild.
7516 * README: Remove note saying that -pie is not supported.
7518 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7520 * options.h (class General_options): Add -init and -fini.
7521 * layout.cc (Layout::finish_dynamic_section): Emit
7522 given init and fini functions.
7524 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7526 * gc.h (gc_process_relocs): Check if icf is enabled using new
7528 * gold.cc (queue_initial_tasks): Likewise.
7529 (queue_middle_tasks): Likewise.
7530 * object.cc (do_layout): Likewise.
7531 * symtab.cc (is_section_folded): Likewise.
7532 * main.cc (main): Likewise.
7533 * reloc.cc (Read_relocs::run): Likewise.
7534 (Sized_relobj::do_scan_relocs): Likewise.
7535 * icf.cc (is_function_ctor_or_dtor): New function.
7536 (Icf::find_identical_sections): Check if function is ctor or dtor when
7538 * options.h (General_options::icf): Change option to be an enum.
7539 (Icf_status): New enum.
7540 (icf_enabled): New method.
7541 (icf_safe_folding): New method.
7542 (set_icf_status): New method.
7543 (icf_status_): New variable.
7544 * (options.cc) (General_options::finalize): Set icf_status_.
7545 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7546 icf_test and icf_keep_unique_test to use the --icf enum flag.
7547 * testsuite/icf_safe_test.sh: New file.
7548 * testsuite/icf_safe_test.cc: New file.
7550 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7552 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7553 includes to gc.h and icf.h.
7554 * arm.cc: Include gc.h.
7555 * gold.cc: Likewise.
7556 * i386.cc: Likewise.
7557 * powerpc.cc: Likewise.
7558 * sparc.cc: Likewise.
7559 * x86_64.cc: Likewise.
7560 * gc.h: Include icf.h.
7562 2009-10-11 Ian Lance Taylor <iant@google.com>
7564 * plugin.cc: Include "gold.h" before other header files.
7566 2009-10-10 Chris Demetriou <cgd@google.com>
7568 * options.h (Input_file_argument::Input_file_type): New enum.
7569 (Input_file_argument::is_lib_): Replace with...
7570 (Input_file_argument::type_): New member.
7571 (Input_file_argument::Input_file_argument): Take Input_file_type
7572 'type' rather than boolean 'is_lib' as second argument.
7573 (Input_file_argument::is_lib): Use type_.
7574 (Input_file_argument::is_searched_file): New function.
7575 (Input_file_argument::may_need_search): Handle is_searched_file.
7576 * options.cc (General_options::parse_library): Support -l:filename.
7577 (General_options::parse_just_symbols): Update for Input_file_argument
7579 (Command_line::process): Likewise.
7580 * archive.cc (Archive::get_file_and_offset): Likewise.
7581 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7582 * script.cc (read_script_file, script_add_file): Likewise.
7583 * fileread.cc (Input_file::Input_file): Likewise.
7584 (Input_file::will_search_for): Handle is_searched_file.
7585 (Input_file::open): Likewise.
7586 * readsyms.cc (Read_symbols::get_name): Likewise.
7587 * testsuite/Makefile.am (searched_file_test): New test.
7588 * testsuite/Makefile.in: Regenerate.
7589 * testsuite/searched_file_test.cc: New file.
7590 * testsuite/searched_file_test_lib.cc: New file.
7592 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7593 Ian Lance Taylor <iant@google.com>
7595 * descriptor.cc: Include <cstdio> and "binary-io.h".
7596 (Descriptors::open): Open the files in binary mode always.
7597 * script.cc (Lex::get_token): Treat \r as whitespace.
7599 2009-10-09 Ian Lance Taylor <iant@google.com>
7601 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7603 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7604 Ian Lance Taylor <iant@google.com>
7606 * configure.ac: Check for readv function also.
7607 * fileread.cc (readv): Define if not HAVE_READV.
7608 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7610 * config.in: Regenerate.
7611 * configure: Regenerate.
7613 2009-10-09 Doug Kwan <dougkwan@google.com>
7615 * layout.cc (Layout::make_output_section): Call target hook to make
7616 ordinary output section.
7617 (Layout::finalize): Adjust parameter list of call the
7618 Target::may_relax().
7619 * layout.h (class Layout::section_list): New method.
7620 * merge.h (Output_merge_base::entsize): Change visibility to public.
7621 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7623 (Output_merge_string::do_is_string): New method.
7624 * object.cc (Sized_relobj::do_setup): renamed from
7625 Sized_relobj::set_up.
7626 * object.h (Sized_relobj::adjust_shndx,
7627 Sized_relobj::initializ_input_to_output_maps,
7628 Sized_relobj::free_input_to_output_maps): Change visibilities to
7630 (Sized_relobj::setup): Virtualize.
7631 (Sized_relobj::do_setup): New method declaration.
7632 (Sized_relobj::invalidate_section_offset,
7633 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7634 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7635 * options.cc (parse_int): New function.
7636 * options.h (parse_int): New declaration.
7637 (DEFINE_int): New macro.
7638 (stub_group_size): New option.
7639 * output.cc (Output_section::Output_section): Initialize memebers
7640 merge_section_map_, merge_section_by_properties_map_,
7641 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7642 (Output_section::add_input_section): Handled deferred code-fill
7643 generation and remove an old comment.
7644 (Output_section::add_relaxed_input_section): New method definition.
7645 (Output_section::add_merge_input_section): Use merge section by
7646 properties map to speed to search. Update merge section maps
7648 (Output_section::build_relaxation_map): New method definition.
7649 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7651 (Output_section::relax_input_section): Renamed to
7652 Output_section::convert_input_sections_to_relaxed_sections and change
7653 interface to take a vector of pointers to relaxed sections.
7654 (Output_section::find_merge_section,
7655 Output_section::find_relaxed_input_section): New method definitions.
7656 (Output_section::is_input_address_mapped,
7657 Output_section::output_offset, Output_section::output_address):
7658 Use output section data maps to speed up searching.
7659 (Output_section::find_starting_output_address): Add comments.
7660 (Output_section::do_write,
7661 Output_section::write_to_postprocessing_buffer): Do code-fill
7662 generation as appropriate.
7663 (Output_section::get_input_sections): Invalidate relaxed input section
7665 (Output_section::restore_states): Adjust type of checkpoint .
7666 Invalidate relaxed input section map.
7667 * output.h (Output_merge_base): New class declaration.
7668 (Input_section_specifier): New class defintion.
7669 (class Output_relaxed_input_section) Change base class to
7670 Output_section_data_build.
7671 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7672 base class initializer.
7673 (Output_section::add_relaxed_input_section): New method declaration.
7674 (Output_section::Input_section): Change visibility to protected.
7675 (Output_section::Input_section::relobj,
7676 Output_section::Input_section::shndx): Handle relaxed input sections.
7677 Output_section::input_sections) Change visibility to protected. Also
7678 define overload to return a non-const pointer.
7679 (Output_section::Merge_section_properties): New class defintion.
7680 (Output_section::Merge_section_by_properties_map,
7681 Output_section::Output_section_data_by_input_section_map,
7682 Output_section::Relaxation_map): New types.
7683 (Output_section::relax_input_section): Rename method to
7684 Output_section::convert_input_sections_to_relaxed_sections and change
7685 interface to take a vector of relaxed section pointers.
7686 (Output_section::find_merge_section,
7687 Output_section::find_relaxed_input_section,
7688 Output_section::build_relaxation_map,
7689 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7690 New method declarations.
7691 (Output_section::merge_section_map_
7692 Output_section::merge_section_by_properties_map_,
7693 Output_section::relaxed_input_section_map_,
7694 Output_section::is_relaxed_input_section_map_valid_,
7695 Output_section::generate_code_fills_at_write_): New data members.
7696 * script-sections.cc
7697 (Output_section_element_input::set_section_addresses): Call
7698 current_data_size and addralign methods of relaxed input sections.
7699 (Orphan_output_section::set_section_addresses): Call current_data_size
7700 and addralign methods of relaxed input sections.
7701 * symtab.cc (Symbol_table::compute_final_value): Extract template
7702 from the body of Symbol_table::sized_finalize_symbol.
7703 (Symbol_table::sized_finalized_symbol): Call
7704 Symbol_table::compute_final_value.
7705 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7706 (Symbol_table::compute_final_value): New templated method declaration.
7707 * target.cc (Target::do_make_output_section): New method defintion.
7708 * target.h (Target::make_output_section): New method declaration.
7709 (Target::relax): Add more parameters for input objects, symbol table
7710 and layout. Adjust call to do_relax.
7711 (Target::do_make_output_section): New method declaration.
7712 (Target::do_relax): Add parameters for input objects, symbol table
7715 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7717 * pread.c: Include stdio.h.
7719 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7721 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7724 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7726 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7727 Change read_shndx type to unsigned int.
7728 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7730 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7731 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7732 Change read_shndx type to unsigned int.
7733 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7735 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7736 * layout.cc (Layout::create_symtab_sections): Cast the result of
7737 local_symcount * symsize to off_t in the gold_assert.
7739 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7741 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7742 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7744 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7745 (Arm_relocate_functions::thm_abs5): New function.
7746 (Arm_relocate_functions::abs12): New function.
7747 (Arm_relocate_functions::abs16): New function.
7748 (Arm_relocate_functions::base_abs): New function.
7749 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7750 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7751 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7753 (Scan::global): Likewise.
7754 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7755 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7756 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7757 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7760 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7762 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7763 (Arm_relocate_functions::movt_prel): New function.
7764 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7765 (Arm_relocate_functions::thm_movt_prel): New function.
7766 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7767 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7768 (Scan::global, Relocate::relocate): Likewise.
7769 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7771 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7773 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7774 Incremental_checker.
7775 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7777 (class Incremental_inputs_header): New class.
7778 (Incremental_inputs_header_writer): Edit comment.
7779 (Incremental_inputs_entry): New class.
7780 (Incremental_inputs_entry_writer): Edit comment.
7781 (Sized_incremental_binary::do_find_incremental_inputs_section):
7782 Add *strtab_shndx parameter, fill it.
7783 (Sized_incremental_binary::do_check_inputs): New method.
7784 (Incremental_checker::can_incrementally_link_output_file): Use
7785 Sized_incremental_binary::check_inputs.
7786 (Incremental_inputs::report_command_line): Save command line in
7789 (Incremental_binary::find_incremental_inputs_section): New
7791 (Incremental_binary::do_find_incremental_inputs_section): Add
7792 strtab_shndx parameter.
7793 (Incremental_binary::do_check_inputs): New pure virtual method.
7794 (Sized_incremental_binary::do_check_inputs): Declare.
7795 (Incremental_checker::Incremental_checker): Add incremental_inputs
7796 parameter, use it to initialize incremental_inputs_.
7797 (Incremental_checker::incremental_inputs_): New field.
7798 (Incremental_checker::command_line): New method.
7799 (Incremental_checker::inputs): New method.
7800 (Incremental_checker::command_line_): New field.
7802 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7804 * incremental.cc: Include <cstdarg> and "target-select.h".
7805 (vexplain_no_incremental): New function.
7806 (explain_no_incremental): New function.
7807 (Incremental_binary::error): New method.
7808 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7810 (make_sized_incremental_binary): New function.
7811 (open_incremental_binary): New function.
7812 (can_incrementally_link_file): Add checks if output is ELF and has
7814 * incremental.h: Include "elfcpp_file.h" and "output.h".
7815 (Incremental_binary): New class.
7816 (Sized_incremental_binary): New class.
7817 (open_incremental_binary): Declare.
7818 * object.cc (is_elf_object): Use
7819 elfcpp::Elf_recognizer::is_elf_file.
7820 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7821 * output.h (Output_file::filesize): New method.
7823 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7825 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7827 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7828 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7830 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7832 (Arm_relocate_functions::movw_abs_nc): New function.
7833 (Arm_relocate_functions::movt_abs): New function.
7834 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7835 (Arm_relocate_functions::thm_movt_abs): New function.
7836 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7837 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7838 (Scan::global): Likewise.
7839 (Relocate::relocate): Likewise.
7840 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7842 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7844 * arm.cc (Arm_relocate_functions::got_prel) New function.
7845 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7846 (Relocate::relocate): Likewise.
7847 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7849 2009-10-06 Ian Lance Taylor <iant@google.com>
7851 * options.h (class General_options): Define
7852 split_stack_adjust_size parameter.
7853 * object.h (class Object): Add uses_split_stack_ and
7854 has_no_split_stack_ fields. Add uses_split_stack and
7855 has_no_split_stack accessor functions. Declare
7856 handle_split_stack_section.
7857 (class Reloc_symbol_changes): Define.
7858 (class Sized_relobj): Define Function_offsets. Declare
7859 split_stack_adjust, split_stack_adjust_reltype, and
7861 * object.cc (Object::handle_split_stack_section): New function.
7862 (Sized_relobj::do_layout): Call handle_split_stack_section.
7863 * dynobj.cc (Sized_dynobj::do_layout): Call
7864 handle_split_stack_section.
7865 * reloc.cc (Sized_relobj::relocate_sections): Call
7866 split_stack_adjust for executable sections in split_stack
7867 objects. Pass reloc_map to relocate_section.
7868 (Sized_relobj::split_stack_adjust): New function.
7869 (Sized_relobj::split_stack_adjust_reltype): New function.
7870 (Sized_relobj::find_functions): New function.
7871 * target-reloc.h: Include "object.h".
7872 (relocate_section): Add reloc_symbol_changes parameter. Change
7874 * target.h (class Target): Add calls_non_split method. Declare
7875 do_calls_non_split virtual method. Declare match_view and
7877 * target.cc: Include "elfcpp.h".
7878 (Target::do_calls_non_split): New function.
7879 (Target::match_view): New function.
7880 (Target::set_view_to_nop): New function.
7881 * gold.cc (queue_middle_tasks): Give an error if mixing
7882 split-stack and non-split-stack objects with -r.
7883 * i386.cc (Target_i386::relocate_section): Add
7884 reloc_symbol_changes parameter.
7885 (Target_i386::do_calls_non_split): New function.
7886 * x86_64.cc (Target_x86_64::relocate_section): Add
7887 reloc_symbol_changes parameter.
7888 (Target_x86_64::do_calls_non_split): New function.
7889 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7891 * powerpc.cc (Target_powerpc::relocate_section): Add
7892 reloc_symbol_changes parameter.
7893 * sparc.cc (Target_sparc::relocate_section): Add
7894 reloc_symbol_changes parameter.
7895 * configure.ac: Call AM_CONDITIONAL for the default target.
7896 * configure: Rebuild.
7897 * testsuite/Makefile.am (TEST_AS): New variable.
7898 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7899 (check_DATA): Add split_i386 and split_x86_64 files.
7900 (SPLIT_DEFSYMS): Define.
7901 (split_i386_[1234n].o): New targets.
7902 (split_i386_[124]): New targets.
7903 (split_i386_[1234r].stdout): New targets.
7904 (split_x86_64_[1234n].o): New targets.
7905 (split_x86_64_[124]): New targets.
7906 (split_x86_64_[1234r].stdout): New targets.
7907 (MOSTLYCLEANFILES): Add new executables.
7908 * testsuite/split_i386.sh: New file.
7909 * testsuite/split_x86_64.sh: New file.
7910 * testsuite/split_i386_1.s: New file.
7911 * testsuite/split_i386_2.s: New file.
7912 * testsuite/split_i386_3.s: New file.
7913 * testsuite/split_i386_4.s: New file.
7914 * testsuite/split_i386_n.s: New file.
7915 * testsuite/split_x86_64_1.s: New file.
7916 * testsuite/split_x86_64_2.s: New file.
7917 * testsuite/split_x86_64_3.s: New file.
7918 * testsuite/split_x86_64_4.s: New file.
7919 * testsuite/split_x86_64_n.s: New file.
7920 * testsuite/testfile.cc (Target_test): Update relocation_section
7922 * testsuite/Makefile.in: Rebuild.
7924 2009-10-06 Ian Lance Taylor <iant@google.com>
7926 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7927 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7928 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7929 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7930 the address on ldo_addrs_.
7931 (Target_i386::Relocate::fix_up_ldo): New function.
7933 2009-10-06 Rafael Espindola <espindola@google.com>
7935 * plugin.cc (add_input_library): New.
7936 (Plugin::load): Add add_input_library to tv.
7937 (Plugin_manager::add_input_file): Add the is_lib argument.
7938 (add_input_file): Update call to Plugin_manager::add_input_file.
7939 (add_input_library): New.
7940 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7942 2009-09-30 Doug Kwan <dougkwan@google.com>
7944 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7945 symbol and call Symbol::may_need_copy_reloc to determine if
7946 a copy reloc is needed.
7947 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7948 nocopyreloc is given in command line.
7949 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7950 given in command line.
7951 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7952 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7953 of the removed Target_i386::may_need_copy_reloc.
7954 * options.h (copyreloc): New option with default value false.
7955 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7956 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7957 instead of the removed Target_powerpc::may_need_copy_reloc.
7958 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7959 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7960 instead of the removed Target_sparc::may_need_copy_reloc.
7961 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7962 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7963 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7964 instead of the removed Target_x86_64::may_need_copy_reloc.
7966 2009-09-30 Ian Lance Taylor <iant@google.com>
7968 * object.h (class Object): Remove target_ field, and target,
7969 sized_target, and set_target methods.
7970 (Object::sized_target): Remove.
7971 (class Sized_relobj): Update declarations. Remove sized_target.
7972 * object.cc (Sized_relobj::setup): Remove target parameter.
7974 (Input_objects::add_object): Don't do anything with the target.
7975 (make_elf_sized_object): Add punconfigured parameter. Change all
7976 callers. Set or test parameter target.
7977 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7979 * parameters.cc (Parameters::set_target): Change parameter type to
7981 (Parameters::default_target): Remove.
7982 (set_parameters_target): Change parameter type to be non-const.
7983 (parameters_force_valid_target): New function.
7984 (parameters_clear_target): New function.
7985 * parameters.h (class Parameters): Update declarations. Remove
7986 default_target method. Add sized_target and clear_target
7987 methods. Change target_ to be non-const.
7988 (set_parameters_target): Update declaration.
7989 (parameters_force_valid_target): Declare.
7990 (parameters_clear_target): Declare.
7991 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7992 as NULL if we aren't searching.
7993 (Add_symbols::run): Don't check for compatible target.
7994 * fileread.cc (Input_file::open_binary): Call
7995 parameters_force_valid_target.
7996 * gold.cc (queue_middle_tasks): Likewise.
7997 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7998 set_target on object.
7999 * dynobj.h (class Sized_dynobj): Update declarations.
8000 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8001 make_elf_object returns NULL.
8002 (Archive::include_member): Don't check whether object target is
8004 * output.cc (Output_section::add_input_section): Get target from
8006 (Output_section::relax_input_section): Likewise.
8007 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8009 (Sized_relobj::do_scan_relocs): Likewise.
8010 (Sized_relobj::relocate_sections): Likewise.
8011 * resolve.cc (Symbol_table::resolve): Likewise.
8012 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8013 parameter. Change all callers.
8014 (Symbol_table::add_from_object): Get target from parameters.
8015 (Symbol_table::add_from_relobj): Don't check object target.
8016 (Symbol_table::add_from_dynobj): Likewise.
8017 (Symbol_table::define_special_symbol): Get target from
8019 * symtab.h (class Symbol_table): Update declaration.
8020 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8021 parameter. Change all callers. Clear parameter target.
8022 (Binary_test): Test target here.
8023 * testsuite/object_unittest.cc (gold_testsuite): Remove
8024 target_test_pointer parameter. Change all callers.
8025 (Object_test): Test target here.
8027 2009-09-26 Ian Lance Taylor <iant@google.com>
8029 * testsuite/initpri1.c: Don't try to use constructor priorities if
8030 compiling with gcc before 4.3.
8032 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8034 * testsuite/retain_symbols_file_test.sh (check_present): Change
8035 output file name to retain_symbols_file_test.stdout.
8036 (check_absent): Likewise.
8038 2009-09-18 Craig Silverstein <csilvers@google.com>
8040 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8041 * options.cc: Include <cerrno> and <fstream>.
8042 (General_options::finalize): Parse -retain-symbols-file tag.
8043 * options.h: New flag.
8044 (General_options): New method should_retain_symbol, new
8045 variable symbols_to_retain.
8046 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8047 should_retain_symbol map.
8048 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8049 * testsuite/Makefile.in: Regenerate.
8050 * testsuite/retain_symbols_file_test.sh: New file.
8052 2009-09-18 Nick Clifton <nickc@redhat.com>
8054 * po/es.po: Updated Spanish translation.
8056 2009-09-17 Doug Kwan <dougkwan@google.com>
8058 * debug.h (DEBUG_RELAXATION): New constant.
8059 (DEBUG_ALL): Add DEBUG_RELAXATION.
8060 (debug_string_to_enum): Add relaxation debug option.
8062 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8063 Layout::Relaxation_debug_check::read_sections,
8064 Layout::Relaxation_debug_check::read_sections): New method definitions.
8065 (Layout::Layout): Initialize data members
8066 record_output_section_data_from_scrips_,
8067 script_output_section_data_list_ and relaxation_debug_check_.
8068 (Layout::save_segments, Layout::restore_segments,
8069 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8070 Layout::relaxation_loop_body): New method definitions.
8071 (Layout::finalize): Support relaxation. Move section layout code to
8072 Layout::relaxation_loop_body.
8073 (Layout::set_asection_address_from_script): Move code for orphan
8074 section placement out.
8075 (Layout::place_orphan_sections_in_script): New method definition.
8076 * layout.h (Output_segment_headers, Output_file_header):
8077 New forward class declarations.
8078 (Layout::~Layout): Define.
8079 (Layout::new_output_section_data_from_script): New method definition.
8080 (Layout::place_orphan_sections_in_script): New method declaration.
8081 (Layout::Segment_states): New type declaration.
8082 (Layout::save_segments, Layout::restore_segments,
8083 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8084 Layout::relaxation_loop_body): New method declarations.
8085 (Layout::Output_section_data_list): New type declaration.
8086 (Layout::Relaxation_debug_check): New class definition.
8087 (Layout::record_output_section_data_from_script_,
8088 Layout::script_output_section_data_list_, Layout::segment_states_,
8089 Layout::relaxation_debug_check_): New data members.
8090 * output.cc: (Output_section_headers::do_size): New method definition.
8091 (Output_section_headers::Output_section_headers): Move size
8092 computation to Output_section_headers::do_size.
8093 (Output_segment_headers::do_size): New method definition.
8094 (Output_file_header::Output_file_header): Move size computation to
8095 Output_file_header::do_size and call it.
8096 (Output_file_header::do_size): New method definition.
8097 (Output_data_group::Output_data_group): Adjust call to
8098 Output_section_data.
8099 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8100 (Output_symtab_xindex::do_write): Add array bound check.
8101 (Output_section::Input_section::print_to_mapfile): Handle
8102 RELAXED_INPUT_SECTION_CODE.
8103 (Output_section::Output_section): Initialize data member checkpoint_.
8104 (Output_section::~Output_section): Delete checkpoint object pointed
8106 (Output_section::add_input_section): Always add an Input_section if
8108 (Output_section::add_merge_input_section): Add assert.
8109 (Output_section::relax_input_section): New method definition.
8110 (Output_section::set_final_data_size): Set load address to zero for
8111 an unallocated section.
8112 (Output_section::do_address_and_file_offset_have_reset_values):
8113 New method definition.
8114 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8115 Handle relaxed input section.
8116 (Output_section::sort_attached_input_sections): Checkpoint input
8117 section list lazily.
8118 (Output_section::get_input_sections): Change type of input_sections to
8119 list of Simple_input_section pointers. Checkpoint input section list
8120 lazily. Also handle relaxed input sections.
8121 (Output_section::add_input_section_for_script): Take a reference to
8122 a Simple_input_section object instead of Relobj pointer and section
8123 index as parameter. Handle relaxed input sections.
8124 (Output_section::save_states, Output_section::restore_states): New
8126 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8127 (Output_data::is_data_size_fixed): New method definition.
8128 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8130 (Output_data::address_and_file_offset_have_reset_values): New method
8132 (Output_data::do_address_and_file_offset_have_reset_values): New method
8134 (Output_data::set_data_size): Check that data size is not fixed.
8135 (Output_data::fix_data_size): New method definition.
8136 (Output_data::is_data_size_fixed_): New data member.
8137 (Output_section_headers::set_final_data_size): New method definition.
8138 (Output_section_headers::do_size): New method declaration.
8139 (Output_segment_headers::set_final_data_size): New method definition.
8140 (Output_segment_headers::do_size): New method declaration.
8141 (Output_file_header::set_final_data_size)::New method definition.
8142 (Output_file_header::do_size)::New method declaration.
8143 (Output_section_data::Output_section_data): Add new parameter
8144 is_data_size_fixed and use it to fix data size.
8145 (Output_data_const::Output_data_const): Adjust call to base class
8146 constructor and fix data size.
8147 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8148 base class constructor and fix data size.
8149 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8150 base class constructor and fix data size.
8151 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8152 class constructor and fix data size.
8153 (Output_data_group::set_final_data_size): New method definition.
8154 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8155 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8156 class constructor and fix data size.
8157 (Output_relaxed_input_section): New class definition.
8158 (Output_section::Simple_input_section): New class definition.
8159 (Output_section::get_input_sections): Adjust parameter list.
8160 (Output_section::add_input_section_for_script): Same.
8161 (Output_section::save_states, Output_section::restore_states,
8162 Output_section::do_address_and_file_offset_have_reset_values,
8163 (Output_section::Input_section::Input_section): Handle
8164 RELAXED_INPUT_SECTION_CODE. Add new overload for
8165 Output_relaxed_input_section.
8166 (Output_section::Input_section::is_input_section,
8167 Output_section::Input_section::set_output_section): Handle relaxed
8169 (Output_section::Input_section::is_relaxed_input_section,
8170 Output_section::Input_section::output_section_data,
8171 Output_section::Input_section::relaxed_input_section): New method
8173 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8175 (Output_section::Input_section::u1_): Update comments.
8176 (Output_section::Input_section::u2_): Add new union member poris.
8177 (Output_section::Checkpoint_output_section): New classs definition.
8178 (Output_section::relax_input_section): New method declaration.
8179 (Output_section::checkpoint_): New data member.
8180 (Output_segment): Update comments.
8181 (Output_segment::Output_segment): Un-privatize copy constructor.
8182 (Output_segment::operator=): Un-privatize.
8183 * script-sections.cc (Output_section_element::Input_section_list):
8184 Change element type to Output_section::Simple_input_section.
8185 (Output_section_element_dot_assignment::set_section_addresses):
8186 Register output section data for relaxation clean up.
8187 (Output_data_exression::Output_data_expression): Adjust call to base
8188 constructor to fix data size.
8189 (Output_section_element_data::set_section_addresses): Register
8190 Output_data_expression object for relaxation clean up.
8191 (struct Input_section_info): Replace Relobj pointer and section index
8192 pair with Output_section::Simple_input_section and Convert struct to a
8194 (Input_section_sorter::operator()): Adjust access to
8195 Input_section_info data member to use accessors.
8196 (Output_section_element_input::set_section_addresses): Use layout
8197 parameter. Adjust code to use Output_section::Simple_input_section
8198 and Input_secction_info classes. Register filler for relaxation
8200 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8201 and section index pair with Output_section::Simple_input_section
8202 class. Adjust code accordingly.
8203 (Phdrs_element::release_segment): New method definition.
8204 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8206 (Script_sections::release_segments): New method definition.
8207 * gold/script-sections.h (Script_sections::release_segments): New
8209 * gold/target.h (Target::may_relax, Target::relax,
8210 Target::do_may_relax, Target::do_relax): New method definitions.
8212 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8214 * arm.cc (has_signed_unsigned_overflow): New function.
8215 (Arm_relocate_functions::abs8): New function.
8216 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8217 (Target_arm::Scan::global): Likewise.
8218 (Target_arm::relocate::relocate): Likewise.
8219 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8222 2009-09-16 Cary Coutant <ccoutant@google.com>
8224 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8225 * testsuite/Makefile.in: Regenerate.
8227 2009-09-11 Nick Clifton <nickc@redhat.com>
8229 * po/gold.pot: Updated by the Translation project.
8231 2009-09-08 Cary Coutant <ccoutant@google.com>
8233 * output.cc (Output_file::open): Add execute permission to empty file.
8234 * testsuite/Makefile.am (permission_test): New test.
8235 * testsuite/Makefile.in: Regenerate.
8237 2009-09-02 Ian Lance Taylor <iant@google.com>
8239 * output.cc (Output_file::resize): Call map_no_anonymous rather
8242 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8244 * gold.cc: Include "incremental.h".
8245 (queue_initial_tasks): Call Incremental_checker methods.
8246 * incremental.cc: Include "output.h".
8247 (Incremental_checker::can_incrementally_link_output_file): New
8249 * incremental.h (Incremental_checker): New class.
8251 * output.cc (Output_file::open_for_modification): New method.
8252 (Output_file::map_anonymous): Changed return type to bool. Record
8254 (Output_file::map_no_anonymous): New method, broken out of map.
8255 (Output_file::map): Use map_no_anonymous and map_anonymous.
8256 * output.h (class Output_file): Update declarations.
8258 2009-08-24 Cary Coutant <ccoutant@google.com>
8260 * options.h (Command_line::Pre_options): New class.
8261 (Command_line::pre_options): New member.
8262 * options.cc (gold::options::ready_to_register): New variable.
8263 (One_option::register_option): Do nothing if not registering options.
8264 Assert if same short option registered twice.
8265 (General_options::General_options): Turn off option registration when
8267 (Command_line::Pre_options::Pre_options): New constructor.
8269 2009-08-24 Cary Coutant <ccoutant@google.com>
8271 * options.h (General_options::no_keep_memory): Remove incorrect
8274 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8276 * Makefile.am (am__skiplex, am__skipyacc): New.
8277 * Makefile.in: Regenerate.
8279 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8281 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8282 (INCLUDES): ... this.
8283 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8284 (AM_CPPFLAGS): Renamed from ...
8285 (INCLUDE): ... this.
8286 * Makefile.in, testsuite/Makefile.in: Regenerate.
8288 * Makefile.in: Regenerate.
8289 * aclocal.m4: Likewise.
8290 * config.in: Likewise.
8291 * configure: Likewise.
8292 * testsuite/Makefile.in: Likewise.
8294 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8295 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8296 * Makefile.in: Regenerate.
8297 * testsuite/Makefile.in: Regenerate.
8299 2009-08-19 Cary Coutant <ccoutant@google.com>
8301 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8302 symbols in shared libraries overridden by hidden or internal symbols
8303 in the main program.
8305 2009-08-19 Chris Demetriou <cgd@google.com>
8307 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8308 checking source file names in error messages.
8310 2009-08-18 Doug Kwan <dougkwan@google.com>
8312 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8313 an elcpp::Ehdr as parameter. Adjust call to set_target.
8314 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8315 an elfcpp::Ehdr as parameter.
8316 * object.cc (Object::set_target): Remove the version that looks up
8317 a target and sets it.
8318 (Sized_relobj::setup): Take a Target object instead of
8319 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8320 (make_elf_sized_object): Find target and ask target to
8322 * object.h: (Object::set_target): Remove the version that looks up
8323 a target and sets it.
8324 (Sized_relobj::setup): Take a Target object instead of
8325 an elfcpp:Ehdr as parameter.
8326 * target.cc: Include dynobj.h.
8327 (Target::do_make_elf_object_implementation): New.
8328 (Target::do_make_elf_object): New.
8329 * target.h (Target::make_elf_object): New template declaration.
8330 (Target::do_make_elf_object): New method declarations.
8331 (Target::do_make_elf_object_implementation): New template declaration.
8333 2009-08-14 Ian Lance Taylor <iant@google.com>
8335 * gold.h (FUNCTION_NAME): Define.
8336 (gold_unreachable): Use FUNCTION_NAME.
8338 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8340 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8341 symbol in the --keep-unique list is not found.
8343 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8345 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8346 been maked as --keep-unique.
8347 (Icf::unfold_section): New function.
8348 * icf.h (Icf::unfold_section): New function.
8349 * options.h (General_options::keep_unique): New option.
8350 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8351 * testsuite/Makefile.in: Regenerate.
8352 * testsuite/icf_keep_unique_test.sh: New file.
8353 * testsuite/icf_keep_unique_test.cc: New file.
8355 2009-08-12 Cary Coutant <ccoutant@google.com>
8358 * resolve.cc (Symbol_table::resolve): Check for references from
8359 dynamic objects to hidden and internal symbols.
8360 * testsuite/Makefile.am (hidden_test.sh): New test.
8361 * testsuite/Makefile.in: Regenerate.
8362 * testsuite/hidden_test.sh: New script.
8363 * testsuite/hidden_test_1.c: New test source.
8364 * testsuite/hidden_test_main.c: New test source.
8366 2009-08-11 Doug Kwan <dougkwan@google.com>
8368 * arm.cc: Update comments.
8369 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8370 segment to locate the .ARM.exidx section if present.
8372 2009-08-09 Doug Kwan <dougkwan@google.com>
8374 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8377 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8378 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8381 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8383 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8384 valid tls_segment only for non-debug-section relocations.
8385 * testsuite/Makefile.am: Add gc_tls_test.
8386 * testsuite/Makefile.in: Regenerate.
8387 * testsuite/gc_tls_test.cc: New file.
8388 * testsuite/gc_tls_test.sh: New file.
8390 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8394 * Makefile.am (CCFILES): Add icf.cc.
8396 * Makefile.in: Regenerate.
8397 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8398 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8399 section, symbol and addend information for the relocs.
8400 * gold.cc (queue_middle_tasks): Call identical code folding.
8401 * gold.h: Add defines for multimap.
8402 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8403 to the call of finalize_local_symbols.
8404 * main.cc (main): Create object of class Icf.
8405 * object.cc (Sized_relobj::do_layout): Allow this function to be
8406 called twice during icf.
8407 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8408 to sections marked as identical by icf.
8409 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8411 (Sized_relobj::do_section_entsize): New function.
8412 * object.h (Object::section_entsize): New function.
8413 (Object::do_section_entsize): New pure virtual function.
8414 (Relobj::finalize_local_symbols): Add new parameter.
8415 (Relobj::do_section_entsize): New function.
8416 * options.h (General_options::icf): New option.
8417 (General_options::icf_iterations): New option.
8418 (General_options::print_icf_sections): New option.
8419 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8420 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8421 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8423 * symtab.cc (Symbol_table::is_section_folded): New function.
8424 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8425 to sections marked as identical by icf.
8426 * symtab.h (Symbol_table::set_icf): New function.
8427 (Symbol_table::icf): New function.
8428 (Symbol_table::is_section_folded): New function.
8429 (Symbol_table::icf_): New data member.
8430 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8431 * testsuite/Makefile.am: Add commands to build icf_test.
8432 * testsuite/Makefile.in: Regenerate.
8433 * testsuite/icf_test.sh: New file.
8434 * testsuite/icf_test.cc: New file.
8436 2009-07-24 Chris Demetriou <cgd@google.com>
8438 * layout.cc (is_compressible_debug_section): Fix incorrect
8439 comment about compressed section names.
8441 2009-07-20 Ian Lance Taylor <ian@airs.com>
8444 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8446 2009-07-16 Ian Lance Taylor <iant@google.com>
8449 * layout.h: #include <map>.
8450 (class Kept_section): Change from struct to class. Add accessors
8451 and setters. Add section size to Comdat_group mapping. Change
8452 Comdat_group to std::map. Add is_comdat_ field. Add
8453 linkonce_size field in union.
8454 (class Layout): Update declaration of find_or_add_kept_section.
8455 Don't declare find_kept_object.
8456 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8457 parameter. Add object, shndx, is_comdat, and is_group_name
8458 parameters. Change all callers. Adjust for new Kept_section.
8459 (Layout::find_kept_object): Remove.
8460 * object.cc (Sized_relobj::include_section_group): Update use of
8461 Kept_section. Rename secnum to shndx. Only record
8462 Kept_comdat_section if sections are the same size.
8463 (Sized_relobj::include_linkonce_section): Update use of
8464 Kept_section. Only record Kept_comdat_section if sections are the
8465 same size. Set size of linkonce section.
8466 (Sized_relobj::map_to_kept_section): Update call to
8467 get_kept_comdat_section.
8468 * object.h (class Sized_relobj): Rename fields in
8469 Kept_comdat_section to drop trailing underscores; change object
8470 field to Relobj*. Change Kept_comdat_section_table to store
8471 struct rather than pointer.
8472 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8473 Add kept_object and kept_shndx parameters. Change all callers.
8474 (Sized_relobj::get_kept_comdat_section): Change return type to
8475 bool. Add kept_object and kept_shndx parameters. Change all
8477 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8478 Layout::find_or_add_kept_section.
8480 2009-07-09 Ian Lance Taylor <iant@google.com>
8482 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8483 Reserve space in the hash table.
8485 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8487 * fileread.cc (File_read::get_mtime): New method.
8488 * fileread.h (Timespec): New structure.
8489 (File_read::get_mtime): New method.
8490 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8491 Renamed from timestamp_nsec.
8492 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8494 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8496 (Incremental_inputs::report_archive): Save mtime; style fix.
8497 (Incremental_inputs::report_obejct): Save mtime; style fix.
8498 (Incremental_inputs::report_script): Save mtime; style fix.
8499 (Incremental_inputs::finalize_inputs): Style fix.
8500 (Incremental_inputs::finalize): Style fix.
8501 (Incremental_inputs::create_input_section_data): Store inputs
8503 * incremental.h (Incremental_inputs::report_script): Add mtime
8505 (Incremental_inputs::Input_info::Input_info): Intialize only one
8507 (Incremental_inputs::Input_info::archive): Move to nameless
8509 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8510 (Incremental_inputs::Input_info::script): Move to nameless union.
8511 (Incremental_inputs::mtime): New field.
8512 * script.cc (read_input_script): Pass file mtime to
8514 * script.h (Script_info::inputs): Style fix.
8516 2009-07-01 Ian Lance Taylor <ian@airs.com>
8518 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8521 2009-06-24 Ian Lance Taylor <iant@google.com>
8524 * layout.cc (Layout::choose_output_section): If we find an
8525 existing section, update the flags.
8526 (Layout::create_notes): New function, broken out of
8528 (Layout::finalize): Don't create note sections.
8529 (Layout::create_note): Don't crash if linker script discards
8531 (Layout::create_gold_note): Likewise.
8532 (Layout::create_build_id): Likewise. Don't set
8533 after_input_sections on the section.
8534 (Layout::create_executable_stack_info): Remove target parameter.
8536 * layout.h (class Layout): Declare create_notes. Update
8537 declaration of create_executable_stack_info.
8538 * gold.cc (queue_middle_tasks): Call create_notes.
8539 * output.cc (Output_section::update_flags_for_input_section): Move
8540 here from output.h. If SHF_ALLOC flag is newly set, mark address
8542 * output.h (Output_data::mark_address_invalid): New function.
8543 (class Output_section): Only declare, not define,
8544 update_flags_for_input_section. Remove set_flags.
8546 2009-06-24 Ian Lance Taylor <iant@google.com>
8548 * script-sections.cc (Output_section_definition::
8549 set_section_addresses): Rename shadowing local load_address to
8552 2009-06-24 Ian Lance Taylor <iant@google.com>
8555 * reloc.cc (relocate_sections): Skip empty relocation sections.
8557 2009-06-23 Ian Lance Taylor <iant@google.com>
8560 * layout.cc (Layout::create_note): Use choose_output_section
8561 rather than make_output_section.
8563 2009-06-23 Ian Lance Taylor <iant@google.com>
8566 * options.cc (General_options::parse_V): Set printed_version_.
8567 (General_options::General_options): Initialize printed_version_.
8568 * options.h (class General_options): Add printed_version_ field.
8569 * gold.cc (queue_initial_tasks): If there are no input files,
8570 don't give a fatal error if we printed the version information.
8571 (queue_middle_tasks): If using -r with a shared object, give a
8572 fatal error rather than an ordinary error.
8574 2009-06-23 Ian Lance Taylor <iant@google.com>
8577 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8578 (Layout::make_output_section): Set have_stabstr_section_ if we see
8579 a .stab*str section.
8580 (Layout::finalize): Call link_stabs_sections.
8581 (Layout::link_stabs_sections): New file.
8582 * layout.h (class Layout): Add have_stabstr_section_ field.
8583 Declare link_stabs_sections.
8585 2009-06-23 Doug Kwan <dougkwan@google.com>
8587 * Makefile.am (libgold_a_LIBADD): New.
8588 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8589 * Makefile.in: Regenerate.
8590 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8591 * configure: Regenerate.
8592 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8593 * fileread.cc: Include sys/state.h
8594 * gold.h: Declare memmem and strndup if found missing.
8595 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8597 2009-06-23 Ian Lance Taylor <iant@google.com>
8599 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8600 * configure: Rebuild.
8602 2009-06-23 Ian Lance Taylor <iant@google.com>
8605 * object.cc (Object::section_contents): Don't try to get a view if
8606 the section has length zero.
8607 (Object::handle_gnu_warning_section): If the section is empty, use
8608 the name of the section as the warning.
8610 2009-06-23 Ian Lance Taylor <iant@google.com>
8613 * stringpool.h (class Stringpool_template): Add optimize_ field.
8614 (Stringpool_template::set_optimize): New function.
8615 * stringpool.cc (Stringpool_template::Stringpool_template):
8616 Initialize optimize_ field.
8617 (Stringpool_template::set_string_offsets): Test local optimize
8618 fild rather than parameter.
8619 * layout.cc (Layout::Layout): Call set_optimize on the section
8622 2009-06-22 Ian Lance Taylor <iant@google.com>
8625 * yyscript.y: Parse TARGET.
8626 * script.cc (script_set_target): New function.
8627 * script-c.h (script_set_target): Declare.
8628 * options.cc (General_options::string_to_object_format): Rename
8629 from string_to_object_format in anonymous namespace. Change
8631 * options.h (class General_options): Declare
8632 string_to_object_format.
8634 2009-06-22 Ian Lance Taylor <iant@google.com>
8636 * script-sections.cc (Script_sections::create_segments): Don't put
8637 program headers in a PT_LOAD segment if -n or -N.
8639 2009-06-22 Ian Lance Taylor <iant@google.com>
8642 * options.h (class General_options): Add -z lazy and -z now. Sort
8643 -z options into alphabetical order.
8644 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8646 2009-06-21 Ian Lance Taylor <iant@google.com>
8648 * layout.cc (Layout::make_output_section): Call
8649 Target::new_output_section.
8650 (Layout::attach_allocated_section_to_segment): Put large section
8651 sections in a separate load segment with the large segment flag
8653 (Layout::segment_precedes): Sort large data segments after other
8655 (align_file_offset): New static function.
8656 (Layout::set_segment_offsets): Use align_file_offset.
8657 * output.h (class Output_section): Add is_small_section_ and
8658 is_large_section_ fields.
8659 (Output_section::is_small_section): New function.
8660 (Output_section::set_is_small_section): New function.
8661 (Output_section::is_large_section): New function.
8662 (Output_section::set_is_large_section): New function.
8663 (Output_section::is_large_data_section): New function.
8664 (class Output_segment): Add is_large_data_segment_ field.
8665 (Output_segment::is_large_data_segment): New function.
8666 (Output_segment::set_is_large_data_segment): New function.
8667 * output.cc (Output_section::Output_section): Initialize new
8669 (Output_segment::Output_segment): Likewise.
8670 (Output_segment::add_output_section): Add assertion that large
8671 data sections always go in large data segments. Force small data
8672 sections to the end of the list of data sections. Force small BSS
8673 sections to the start of the list of BSS sections. For large BSS
8674 sections to the end of the list of BSS sections.
8675 * symtab.h (class Symbol): Declare is_common_shndx.
8676 (Symbol::is_defined): Check Symbol::is_common_shndx.
8677 (Symbol::is_common): Likewise.
8678 (class Symbol_table): Define enum Commons_section_type. Update
8679 declarations. Add small_commons_ and large_commons_ fields.
8680 * symtab.cc (Symbol::is_common_shndx): New function.
8681 (Symbol_table::Symbol_table): Initialize new fields.
8682 (Symbol_table::add_from_object): Put small and large common
8683 symbols in the right list.
8684 (Symbol_table::sized_finalized_symbol): Check
8685 Symbol::is_common_shndx.
8686 (Symbol_table::sized_write_globals): Likewise.
8687 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8688 common symbol lists. Don't call do_allocate_commons_list if the
8690 (Symbol_table::do_allocate_commons_list): Remove is_tls
8691 parameter. Add comons_section_type parameter. Change all
8692 callers. Handle small and large common symbols.
8693 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8694 Symbol::is_common_shndx.
8695 * resolve.cc (symbol_to_bits): Likewise.
8696 * target.h (Target::small_common_shndx): New function.
8697 (Target::small_common_section_flags): New function.
8698 (Target::large_common_shndx): New function.
8699 (Target::large_common_section_flags): New function.
8700 (Target::new_output_section): New function.
8701 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8702 small_common_section_flags, and large_common_section_flags
8704 (Target::do_new_output_section): New virtual function.
8705 * arm.cc (Target_arm::arm_info): Initialize new fields.
8706 * i386.cc (Target_i386::i386_info): Likewise.
8707 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8709 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8710 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8711 (Target_x86_64::do_new_output_section): New function.
8712 * configure.ac: Define conditional MCMODEL_MEDIUM.
8713 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8714 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8715 (large_LDFLAGS): Define.
8716 * testsuite/large.c: New file.
8717 * testsuite/testfile.cc (Target_test::test_target_info):
8718 Initialize new fields.
8719 * configure, testsuite/Makefile.in: Rebuild.
8721 2009-06-05 Doug Kwan <dougkwan@google.com>
8723 * Makefile.am (CCFILES): Add target.cc.
8724 * Makefile.in: Regenerate.
8725 * i386.cc (class Target_i386): Define new virtual method to
8726 override do_is_local_label_name in parent.
8727 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8728 local symbols if --discard-locals or -X is given.
8729 * options.h (class General_options): Declare new options
8730 '--discard-locals' and '-X' for discarding locals.
8731 * target.h (class Target): Define new methods is_local_label_name.
8732 Declare new virtual method do_is_local_label_name.
8733 * target.cc: New file.
8734 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8735 (check_SCRIPTS): Add discard_locals_test.sh.
8736 (check_DATA): Add discard_local_tests.syms.
8737 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8738 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8739 * testsuite/Makefile.in: Regenerate.
8740 * testsuite/discard_locals_test.c: New file.
8741 * testsuite/discard_locals_test.sh: Same.
8743 2009-06-05 Doug Kwan <dougkwan@google.com>
8745 * object.cc (Sized_relobj::Sized_relobj): Initialize
8746 discarded_eh_frame_shndx_ to -1U.
8747 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8749 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8750 a discarded .eh_frame section.
8751 (Sized_relobj::do_finalize_local_symbols): Ditto.
8752 * object.h (class Sized_relobj): Declare new member
8753 discarded_eh_frame_shndx_.
8754 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8755 (local_labels_test.o, local_labels_test): New rules.
8756 * testsuite/Makefile.in: Regenerate.
8758 2009-06-04 Doug Kwan <dougkwan@google.com>
8760 * layout.cc (Layout::section_name_mapping): Add mapping for
8761 special ARM sections.
8763 2009-06-03 Doug Kwan <dougkwan@google.com>
8765 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8766 (utils::has_overflow): Same.
8768 2009-06-03 Ian Lance Taylor <iant@google.com>
8770 * layout.cc (Layout::section_name_mapping): New array, replacing
8771 Layout::linkonce_mapping.
8772 (Layout::section_name_mapping_count): New variable, replacing
8773 Layout::linkonce_mapping_count.
8774 (Layout::linkonce_output_name): Remove.
8775 (Layout::output_section_name): Rewrite.
8776 * layout.h (class Layout): Rename Linkonce_mapping to
8777 Section_name_mapping, linkonce_mapping to section_name_mapping,
8778 linkonce_mapping_count to section_name_mapping_count. Don't
8779 declare linkonce_output_name.
8781 2009-06-03 Doug Kwan <dougkwan@google.com>
8783 * gold/arm.cc (namespace utils): New.
8784 (Target_arm::reloc_is_non_pic): Define new method.
8785 (class Arm_relocate_functions): New.
8786 (Target_arm::Relocate::relocate): Handle relocation types used by
8789 2009-06-03 Ian Lance Taylor <iant@google.com>
8791 * arm.cc (Target_arm::scan::global): Use || instead of |.
8793 2009-06-02 Doug Kwan <dougkwan@google.com>
8795 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8796 issued_non_pic_error_.
8797 (class Target_arm::Scan): Declare new method check_non_pic.
8798 Define new method symbol_needs_plt_entry.
8799 Declare new data member issued_non_pic_error_.
8800 (class Target_arm::Relocate): Declare new method
8801 should_apply_static_reloc.
8802 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8803 (Target_arm::Scan::check_non_pic): Define new method.
8804 (Target_arm::Scan::local): Handle a small subset of reloc types used
8806 (Target_arm::Scan::local): Same.
8807 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8809 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8811 * incremental.cc (Incremental_inputs::report_command_line): Filter
8812 out --incremental-* options.
8814 2009-05-29 Doug Kwan <dougkwan@google.com>
8816 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8818 (class Target_arm): Update comment.
8819 (Target_arm::Target_arm): Initialize new data members GOT_,
8820 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8821 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8822 and Target_arm::rel_dyn_section.
8823 Declare new_enum Target_arm::Got_type.
8824 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8826 Update commments for member do_dynsym_value.
8827 (Target_arm::got_size, Target_arm::plt_section,
8828 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8829 new methods inside class defintion.
8830 (Target_arm::got_section): Define new method.
8831 (Target_arm::rel_dyn_section): Same.
8832 (Output_data_plt_arm): New template class.
8833 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8834 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8835 (Output_data_plt_arm::add_entry): Same.
8836 (Output_data_plt_arm::first_plt_entry): Define new
8837 static data member for PLT instruction template.
8838 (Output_data_plt_arm::plt_entry): Same.
8839 (Output_data_plt_arm::do_write): Define new method.
8840 (Target_arm::make_plt_entry): Same.
8841 (Target_arm::do_finalize_sections): Same.
8842 (Target_arm::do_dynsym_value): Same.
8844 2009-05-28 Doug Kwan <dougkwan@google.com>
8846 * Makefile.am (TARGETSOURCES): Add arm.cc.
8847 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8848 * Makefile.in: Regenerate.
8850 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8852 2009-05-26 Doug Kwan <dougkwan@google.com>
8854 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8855 (General_options::check_excluded_libs): Strip off directories in
8856 archive name before matching like GNU ld does.
8857 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8858 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8859 (exclude_libs_test_LDFLAGS): Add linker option
8860 -Wl,--exclude-libs,libexclude_libs_test_3
8861 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8862 an explicit archive without using -l.
8863 (alt/libexclude_libs_test_3.a): New make rule.
8864 * testsuite/Makefile.in: Regenerate.
8865 * testsuite/exclude_libs_test.c : Declare lib3_default().
8867 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8868 * exclude_libs_test_3.c: New file.
8870 2009-05-26 Nick Clifton <nickc@redhat.com>
8872 * po/id.po: New Indonesian translation.
8873 * po/gold.pot: Updated template file.
8875 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8877 * testsuite/Makefile.am: Add -ffunction-sections to compile
8878 gc_comdat_test files. Add -Wl,--gc-sections to build
8880 * testsuite/Makefile.in: Regenerate.
8881 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8883 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8885 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8886 kept comdat section was garbage collected.
8887 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8888 * testsuite/Makefile.in: Regenerate.
8889 * testsuite/gc_comdat_test.sh: New file.
8890 * testsuite/gc_comdat_test_1.cc: New file.
8891 * testsuite/gc_comdat_test_2.cc: New file.
8893 2009-05-19 Doug Kwan <dougkwan@google.com>
8895 * archive.cc (Archive::Archive): Move constructor from archive.h
8896 to here. Initialize no_export_.
8897 (Archive::get_elf_object_for_member): Set no_export flag of object.
8898 * archive.h (Archive::Archive): Move constructor body to
8900 (Archive::no_export): New method.
8901 (Archive::no_export_): New field.
8902 * object.h (Object::Object): Initialize no_export_ to false.
8903 (Object::no_export, Object::set_no_export): New methods.
8904 (Object::no_export_): New field.
8905 * options.cc (General_options::parse_exclude_libs): New method.
8906 (General_options::check_excluded_libs) Same.
8907 * options.h (exclude_libs): New option.
8908 (General_options::check_excluded_libs): New method declaration.
8909 (General_options::excluded_libs_): New field.
8910 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8911 default or protected visibility if an object has no-export flag set.
8912 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8913 (check_SCRIPTS): Add exclude_libs_test.sh.
8914 (check_DATA): Add exclude_libs_test.syms.
8915 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8916 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8917 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8918 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8919 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8920 libexclude_libs_test_2.a): New rules.
8921 * testsuite/Makefile.in: Regenerate.
8922 * testsuite/exclude_libs_test.c: New file.
8923 * testsuite/exclude_libs_test.sh: Ditto.
8924 * testsuite/exclude_libs_test_1.c: Ditto.
8925 * testsuite/exclude_libs_test_2.c: Ditto.
8927 2009-05-15 Ian Lance Taylor <iant@google.com>
8929 * configure.ac: Check for declarations for cases where libiberty.h
8930 checks HAVE_DECL_xxx.
8931 * configure, config.in: Rebuild.
8933 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8935 * gold.h (Incremental_argument_list): Remove (invalid) forward
8937 * incremental.cc (Incremental_inputs::report_achive): New method.
8938 (Incremental_inputs::report_object): New method.
8939 (Incremental_inputs::report_script): New method.
8940 (Incremental_inputs::finalize_inputs): New method.
8941 (Incremental_inputs::finalize): Call finalize_inputs().
8942 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8943 Create inputs entries.
8944 * incremental.h (Incremental_input_type): New enum.
8945 (Incremental_inputs::Incremental_input): Initialize new fields.
8946 (Incremental_inputs::report_inputs): New method.
8947 (Incremental_inputs::report_achive): New method.
8948 (Incremental_inputs::report_object): New method.
8949 (Incremental_inputs::report_script): New method.
8950 (Incremental_inputs::finalize_inputs): New method.
8951 (Incremental_inputs::Input_info): New struct.
8952 (Incremental_inputs::Input_info_map): New typedef.
8953 (Incremental_inputs::lock_): New field.
8954 (Incremental_inputs::Inputs_): New field.
8955 (Incremental_inputs::Inputs_map): New field.
8956 * main.cc (main): Call Incremental_input::report_inputs.
8957 * options.h (Input_argument_list): Typedef moved from
8959 (Input_file_group::Files): Remove, use ::Input_argument_list.
8960 (Input_file_group::Input_argument_list): Remove, use
8961 ::Input_argument_list.
8962 * plugin.cc (Plugin_manager::add_input_file): Add error in
8964 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8966 * script.cc (read_input_script): Call
8967 Incremental_input::report_script.
8968 * script.h (Script_info): New class.
8970 2009-04-27 Ian Lance Taylor <iant@google.com>
8972 * x86_64.cc (do_adjust_output_section): Set entsize to
8975 2009-04-23 Elliott Hughes <enh@google.com>
8977 * output.cc (Output_file::close): After short writes, continue
8978 writing from the correct offset in the buffer being written.
8980 2009-04-23 Chris Demetriou <cgd@google.com>
8982 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8983 * configure: Regenerate.
8984 * config.in: Regenerate.
8985 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8986 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8988 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8990 * incremental.cc (Incremental_inputs_header_data): Renamed from
8991 Incremental_input_header_data.
8992 (Incremental_inputs_header_data::data_size): New field.
8993 (Incremental_inputs_header_data::put_input_file_count): Renamed
8994 from input_file_count.
8995 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8996 from command_line_offset.
8997 (Incremental_inputs_header_data::put_reserved): Renamed from
8999 (Incremental_inputs_entry_data): Renamed from
9000 Incremental_input_entry_data.
9001 (Incremental_inputs_entry_data::data_size): New field.
9002 (Incremental_inputs::report_command_line): New method.
9003 (Incremental_inputs::finalize): New method.
9004 (Incremental_inputs::create_incremental_inputs_data): New method.
9005 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9006 * incremental.h: New file.
9007 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9008 (Layout::finalize): Create incremental inputs section in
9010 (Layout::create_incremental_info_sections): New method.
9011 * layout.h (Layout::incremental_inputs): New method.
9012 (Layout::create_incremental_info_sections): New method.
9013 (Layout::incremental_inputs_): New field.
9014 * main.cc (main): Notify Incremental_input of the command line.
9016 2009-04-01 Ian Lance Taylor <iant@google.com>
9017 Mikolaj Zalewski <mikolajz@google.com>
9019 * gold.h (reserve_unordered_map): Define, three versions, one for
9020 each version of Unordered_map.
9021 * layout.cc (Layout::Layout): Remove options parameter. Add
9022 number_of_input_files parameter. Don't initialize options_.
9023 Initialize number_of_input_files_ and resized_signatures_. Move
9024 sections_are_attached_.
9025 (Layout::layout_group): Reserve space for group_signatures_.
9026 (Layout::find_or_add_kept_section): Change name parameter to be a
9027 reference. Resize signatures_ map when it gets large enough.
9028 (Layout::layout_eh_frame): Use parameters->options() instead of
9030 (Layout::make_output_section): Likewise.
9031 (Layout::attach_allocated_section_to_segment): Likewise.
9032 (Layout::finalize, Layout::create_executable_stack): Likewise.
9033 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9034 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9035 * layout.h (class Layout): Update declarations. Remove options_
9036 field. Add number_of_input_files_ and resized_signatures_
9037 fields. Move sections_are_attached_ field.
9038 * main.cc (main): Pass number of input files to Layout
9039 constructor. Don't pass options.
9041 2009-03-30 Ian Lance Taylor <iant@google.com>
9043 * ffsll.c (ffsll): Correct implementation.
9045 2009-03-27 Ian Lance Taylor <iant@google.com>
9047 * ffsll.c: New file.
9048 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9049 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9050 * ftruncate.c (ftruncate): Declare before definition.
9051 * mremap.c (mremap): Likewise.
9052 * pread.c (pread): Likewise.
9053 * configure, Makefile.in, config.in: Rebuild.
9055 * mremap.c: New file.
9056 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9057 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9058 (mremap): Declare if HAVE_MREMAP is not defined.
9059 * configure, Makefile.in, config.in: Rebuild.
9061 2009-03-27 Cary Coutant <ccoutant@google.com>
9063 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9064 position independent.
9065 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9066 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9068 2009-03-24 Cary Coutant <ccoutant@google.com>
9070 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9072 (needs_dynamic_reloc): Likewise.
9074 2009-03-24 Ian Lance Taylor <iant@google.com>
9076 * yyscript.y (file_cmd): Recognize EXTERN.
9077 (extern_name_list, extern_name_list_body): New nonterminals.
9078 * script.cc (script_add_extern): Define.
9079 * script-c.h (script_add_extern): Declare.
9081 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9083 * object.cc (is_elf_object): Define.
9084 * object.h (is_elf_object): Declare.
9085 * archive.cc (Archive::get_elf_object_for_member): Call
9087 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9089 2009-03-24 Elliott Hughes <enh@google.com>
9091 * output.cc (Output_file::map_anonymous): Define.
9092 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9093 try an anonymous one. Report the size if the mmap fails.
9094 * output.h (class Output_file): Declare map_anonymous.
9096 2009-03-24 Ian Lance Taylor <iant@google.com>
9098 * target-select.cc (instantiate_target): Don't acquire the lock if
9099 the instantiated_target_ field has already been set.
9101 2009-03-23 Ian Lance Taylor <iant@google.com>
9103 * gold-threads.h (class Initialize_lock): Define.
9104 * gold-threads.cc (class Initialize_lock_once): Define.
9105 (initialize_lock_control): New static variable.
9106 (initialize_lock_pointer): New static variable.
9107 (initialize_lock_once): New static function.
9108 (Initialize_lock::Initialize_lock): Define.
9109 (Initialize_lock::initialize): Define.
9110 * target-select.h: Include "gold-threads.h".
9111 (class Target_selector): Add lock_ and initialize_lock_ fields.
9112 Don't define instantiate_target, just declare it.
9113 * target-select.cc (Target_selector::Target_selector): Initialize
9115 (Target_selector::instantiate_target): Define.
9116 * descriptors.h: Include "gold-threads.h".
9117 (class Descriptors): Add initialize_lock_ field.
9118 * descriptors.cc (Descriptors::Descriptors): Initialize new
9120 (Descriptors::open): Use initialize_lock_ field
9121 * errors.h (class Errors): Add initialize_lock_ field.
9122 * errors.cc (Errors::Errors): Initialize new field.
9123 (Errors::initialize_lock): Use initialize_lock_ field.
9124 * powerpc.cc (class Target_selector_powerpc): Remove
9125 instantiated_target_ field. In do_recognize call
9126 instantiate_target rather than do_instantiate_target. In
9127 do_instantiate_target just allocate a new target.
9128 * sparc.cc (class Target_selector_sparc): Likewise.
9130 * freebsd.h: New file.
9131 * i386.cc: Include "freebsd.h".
9132 (Target_i386): Derive from Target_freebsd rather than
9134 (Target_selector_i386): Derive from Target_selector_freebsd rather
9135 than Target_selector.
9136 * x86_64.cc: Include "freebsd.h".
9137 (Target_x86_64): Derive from Target_freebsd rather than
9139 (Target_selector_x86_64): Derive from Target_selector_freebsd
9140 rather than Target_selector.
9141 * target.h (class Target): Add adjust_elf_header and
9142 do_adjust_elf_header.
9143 * output.cc (Output_file_header:: do_sized_write): Call target
9144 adjust_elf_header routine.
9145 * configure.tgt: Set targ_osabi.
9146 * configure.ac: Define GOLD_DEFAULT_OSABI.
9147 * parameters.cc (Parameters::default_target): Pass
9148 GOLD_DEFAULT_OSABI to select_target.
9149 * target-select.h (class Target_selector): Make instantiate_target
9150 protected rather than private.
9151 * Makefile.am (HFILES): Add freebsd.h.
9152 * configure, Makefile.in, config.in: Rebuild.
9154 * merge.cc (do_add_input_section): Correct pend value. Change
9155 message about last entry not being null terminated from error to
9158 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9160 * incremental.cc: New file.
9161 * Makefile.am (CCFILES): Add incremental.cc.
9162 * Makefile.in: Rebuild.
9164 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9166 * layout.cc (Layout::output_section_name): Preserve names
9167 of '.note.' sections.
9169 2009-03-19 Ian Lance Taylor <iant@google.com>
9171 * descriptors.cc (Descriptors::open): Check that the options are
9172 valid before using them.
9174 2009-03-18 Ian Lance Taylor <iant@google.com>
9176 * script-sections.h: Include <list>.
9177 (class Script_sections): Change Sections_elements from std::vector
9178 to std::list. Typedef public Elements_iterator. Add
9179 orphan_section_placement_, data_segment_align_start_, and
9180 saw_data_segment_align_ fields. Remove data_segment_align_index_
9182 * script-sections.cc (class Orphan_section_placement): New class.
9183 (class Sections_element): Add virtual functions is_relro and
9184 orphan_section_init. Remove virtual function place_orphan_here.
9185 (class Output_section_definition): Add is_relro and
9186 orphan_section_init. Remove place_orphan_here.
9187 (class Orphan_output_section): Likewise.
9188 (Script_sections::Script_sections): Update for field changes.
9189 (Script_sections::data_segment_align): Set saw_data_segment_align_
9190 and data_segment_align_start_, not data_segment_align_index.
9191 (Script_sections::data_segment_relro_end): Check
9192 saw_data_segment_align_. Use data_segment_align_start_ rather
9193 than data_segment_align_index_.
9194 (Script_sections::place_orphan): Rewrite to use
9195 Orphan_section_placement.
9197 2009-03-17 Ian Lance Taylor <iant@google.com>
9199 * archive.cc (Archive::add_symbols): Check for a version attached
9200 to the symbol name in the archive map.
9201 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9202 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9203 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9204 (ver_test_11.a): New target.
9205 * testsuite/Makefile.in: Rebuild.
9207 * configure.ac: Check for chsize and posix_fallocate. Replace
9209 * ftruncate.c: New file, from gnulib.
9210 * output.cc (posix_fallocate): Define dummy version if not
9211 HAVE_POSIX_FALLOCATE.
9212 (Output_file::map): Call posix_fallocate rather than lseek and
9214 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9215 * configure, Makefile.in, config.in: Rebuild.
9217 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9219 * layout.h (Layout::create_note): Add section_name parameter.
9220 * layout.cc (Layout::create_note): Likewise.
9221 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9223 2009-03-17 Ian Lance Taylor <iant@google.com>
9225 * descriptors.cc: Include "options.h".
9226 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9227 (Descriptors::open): Always use O_CLOEXEC when opening a new
9228 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9229 then set FD_CLOEXEC.
9231 * sparc.cc (class Target_sparc): Add has_got_section.
9232 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9233 make sure we have a GOT section.
9235 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9236 (Target_sparc::Scan::local): Likewise.
9237 (Target_sparc::Scan::global): Likewise.
9238 (Target_sparc::Relocate::relocate): Likewise.
9239 (Target_sparc::Relocate::relocate_tls): Likewise.
9241 * symtab.cc (Symbol_table::define_default_version): New function,
9242 broken out of add_from_object.
9243 (Symbol_table::add_from_object): Call define_default_version.
9244 (Symbol_table::define_special_symbol): Add resolve_oldsym
9245 parameter. Change all callers. If the version for a symbol comes
9246 from a version script, resolve it with the symbol with the same
9247 name with no version. Also add the symbol without a version if
9249 (do_define_in_output_data): If resolving with oldsym, don't delete
9251 (do_define_in_output_segment): Likewise.
9252 (do_define_as_constant): Likewise.
9253 * symtab.h (class Symbol_table): Update declarations.
9255 2009-03-13 Ian Lance Taylor <iant@google.com>
9257 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9258 (Read_symbols::requeue): New function.
9259 (Read_symbols::do_read_symbols): If make_elf_object fails because
9260 the target type is not configured, and the file was searched for,
9261 issue a warning and retry with the next directory.
9262 (Add_symbols::run): If the file has an incompatible format, and
9263 it was searched for, requeue the Read_symbols task. On error,
9265 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9266 dirindex parameter to constructor. Change all callers. Declare
9267 incompatible_warning and requeue.
9268 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9269 input_argument_ and input_group_ fields. Add them to
9270 constructor. Change all callers.
9271 (class Read_script): Add dirindex_ field. Add it to constructor.
9273 * archive.cc (Archive::setup): Remove input_objects parameter.
9275 (Archive::get_file_and_offset): Likewise.
9276 (Archive::read_all_symbols): Likewise.
9277 (Archive::read_symbols): Likewise.
9278 (Archive::get_elf_object_for_member): Remove input_objects
9279 parameter. Add punconfigured parameter. Change all callers.
9280 (Archive::add_symbols): Change return type to bool. Check return
9281 value of include_member.
9282 (Archive::include_all_members): Likewise.
9283 (Archive::include_member): Change return type to bool. Return
9284 false if first included object has incompatible target. Set
9285 included_member_ field.
9286 (Add_archive_symbols::run): If add_symbols returns false, requeue
9288 * archive.h (class Archive): Add included_member_ field.
9289 Initialize it in constructor. Add input_file and searched_for
9290 methods. Update declarations.
9291 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9292 input_argument_ fields. Add them to constructor. Change all
9294 * script.cc: Include "target-select.h".
9295 (class Parser_closure): Add skip_on_incompatible_target_ and
9296 found_incompatible_target_ fields. Add
9297 skip_on_incompatible_target parameter to constructor. Change all
9298 callers. Add methods skip_on_incompatible_target,
9299 clear_skip_on_incompatible_target, found_incompatible_target, and
9300 set_found_incompatible_target.
9301 (read_input_script): Add dirindex parameter. Change all callers.
9302 If parser finds an incompatible target, requeue Read_symbols
9304 (script_set_symbol): Clear skip_on_incompatible_target in
9306 (script_add_assertion, script_parse_option): Likewise.
9307 (script_start_sections, script_add_phdr): Likewise.
9308 (script_check_output_format): New function.
9309 * script.h (read_input_script): Update declaration.
9310 * script-c.h (script_check_output_format): Declare.
9311 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9312 (ignore_cmd): Remove OUTPUT_FORMAT.
9313 * fileread.cc (Input_file::Input_file): Add explicit this.
9314 (Input_file::will_search_for): New function.
9315 (Input_file::open): Add pindex parameter. Change all callers.
9316 * fileread.h (class Input_file): Add input_file_argument method.
9317 Declare will_search_for. Update declarations.
9318 * object.cc (make_elf_object): Add punconfigured parameter.
9320 * object.h (class Object): Make input_file public. Add
9321 searched_for method.
9322 (make_elf_object): Update declaration.
9323 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9325 * dirsearch.h (class Dirsearch): Update declaration.
9326 * options.h (class General_options): Add --warn-search-mismatch.
9327 * parameters.cc (Parameters::is_compatible_target): New function.
9328 * parameters.h (class Parameters): Declare is_compatible_target.
9329 * workqueue.cc (Workqueue::add_blocker): New function.
9330 * workqueue.h (class Workqueue): Declare add_blocker.
9332 * fileread.cc (Input_file::open): Remove options parameter.
9334 (Input_file::open_binary): Likewise.
9335 * script.cc (read_input_script): Likewise.
9336 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9337 options parameter from constructor. Change all callers.
9338 (class Read_script): Likewise.
9339 * fileread.h (class Input_file): Update declarations.
9340 * script.h (read_input_script): Update declaration.
9342 2009-03-10 Nick Clifton <nickc@redhat.com>
9344 * po/es.po: New Spanish translation.
9346 2009-03-06 Cary Coutant <ccoutant@google.com>
9348 * options.cc (parse_short_option): Keep dash_z from registering itself.
9350 2009-03-03 Ian Lance Taylor <iant@google.com>
9353 * target-reloc.h (relocate_section): Pass output_section to
9355 * i386.cc (Target_i386::should_apply_static_reloc): Add
9356 output_section parameter. Change all callers.
9357 (Target_i386::Relocate::relocate): Add output_section parameter.
9358 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9359 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9360 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9361 * testsuite/two_file_shared.sh: New script.
9362 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9363 (check_DATA): Add two_file_shared.dbg.
9364 (two_file_shared.dbg): New target.
9365 * testsuite/Makefile.in: Rebuild.
9367 2009-03-01 Ian Lance Taylor <iant@google.com>
9369 * configure.ac: Check for byteswap.h.
9370 * configure: Rebuild.
9371 * config.in: Rebuild.
9373 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9375 * layout.cc (Layout::find_or_add_kept_section): New function.
9376 (Layout::add_comdat): Removed.
9377 * layout.h (struct Kept_section): Move out of class Layout.
9378 Remove trailing underscores from field names. Add group_sections
9379 field. Rename group_ field to is_group. Change all uses.
9380 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9381 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9382 comdat_groups_ field.
9383 (Sized_relobj::include_section_group): Use
9384 find_or_add_kept_section and Kept_section::group_sections.
9385 (Sized_relobj::include_linkonce_section): Likewise.
9386 * object.cc (class Sized_relobj): Don't define Comdat_group or
9387 Comdat_group_table. Remove find_comdat_group and
9388 add_comdat_group. Remove comdat_groups_ field.
9389 * plugin.cc (include_comdat_group): Use
9390 Layout::find_or_add_kept_section.
9392 2009-02-28 Ian Lance Taylor <iant@google.com>
9394 * README: --gc-sections and map files are now supported. Document
9395 some build requirements.
9398 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9399 relocatable link set the value of the section symbol to zero.
9400 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9401 relocatable link don't include the section address in the local
9404 2009-02-27 Ian Lance Taylor <iant@google.com>
9407 * options.h (class Search_directory): Add is_system_directory.
9408 (class General_options): Declare is_in_system_directory.
9409 * options.cc (get_relative_sysroot): Make static.
9410 (get_default_sysroot): Make static.
9411 (General_optoins::is_in_system_directory): New function.
9412 * fileread.cc (Input_file::is_in_system_directory): New function.
9413 * fileread.h (class Input_file): Declare is_in_system_directory.
9414 * object.h (class Object): Add is_in_system_directory.
9415 (class Input_objects): Remove system_library_directory_ field.
9416 * object.cc (Input_objects::add_object): Don't set
9417 system_library_directory_.
9418 (input_objects::found_in_system_library_directory): Remove.
9419 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9420 parameter. Change all callers.
9421 (Symbol_table::sized_write_globals): Likewise.
9422 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9423 Call Object::is_in_system_directory.
9424 * symtab.h (class Symbol_table): Update declarations.
9427 * descriptors.h (Open_descriptor): Add is_on_stack field.
9428 * descriptors.cc (Descriptors::open): If the descriptor is on the
9429 top of the stack, remove it. Initialize is_on_stack field.
9430 (Descriptors::release): Only add pod to stack if it is not on the
9432 (Descriptors::close_some_descriptor): Clear stack_next and
9436 * output.cc (Output_section::find_starting_output_address): Rename
9437 from starting_output_address; add PADDR parameter; change return
9439 * output.h (class Output_section): Declare
9440 find_starting_output_address instead of starting_output_address.
9441 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9442 section symbol for which we can't find a merge section.
9445 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9446 hidden or internal, force the symbol to be local.
9447 * resolve.cc (Symbol::override_visibility): Define.
9448 (Symbol::override_base): Use override_visibility.
9449 (Symbol_table::resolve): Likewise.
9450 (Symbol::override_base_with_special): Likewise.
9451 (Symbol_table::override_with_special): If the visibility is hidden
9452 or internal, force the symbol to be local.
9453 * symtab.h (class Symbol): Add set_visibility and
9454 override_visibility.
9455 * testsuite/ver_test_1.sh: New file.
9456 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9457 (check_DATA): Add ver_test_1.syms.
9458 (ver_test_1.syms): New target.
9459 * testsuite/Makefile.in: Rebuild.
9461 2009-02-25 Cary Coutant <ccoutant@google.com>
9463 * layout.cc (Layout::choose_output_section): Don't rename sections
9464 when using a linker script that has a SECTIONS clause.
9465 * Makefile.in: Regenerate.
9467 * testsuite/Makefile.am (script_test_5.sh): New test case.
9468 * testsuite/Makefile.in: Regenerate.
9469 * testsuite/script_test_5.cc: New file.
9470 * testsuite/script_test_5.sh: New file.
9471 * testsuite/script_test_5.t: New file.
9473 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9475 * archive.cc (Archive::include_member): Update calls to add_symbols.
9476 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9477 the Layout argument.
9478 * dynobj.h (do_add_symbols): Add the Layout argument.
9479 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9481 * object.h (Object::add_symbols): Add the Layout argument.
9482 (Object::do_add_symbols): Add the Layout argument.
9483 (Sized_relobj::do_add_symbols): Add the Layout argument.
9484 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9485 Unify the two versions.
9486 (Add_plugin_symbols): Remove.
9487 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9488 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9489 (Add_plugin_symbols): Remove.
9490 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9491 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9492 (Add_symbols::run): Make it work with Pulginobj.
9494 2009-02-06 Ian Lance Taylor <iant@google.com>
9496 * object.cc (Sized_relobj::do_layout): Make info message start
9497 with lower case letter.
9499 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9501 * binary.cc: Fix file comment.
9503 * options.h (enum Incremental_disposition): Define.
9504 (class General_options): Add new options: --incremental,
9505 --incremental_changed, --incremental_unchanged,
9506 --incremental_unknown. Add incremental_disposition_ and
9507 implicit_incremental_ fields.
9508 (General_options::incremental_disposition): New function.
9509 (class Position_dependent_options): Add incremental_disposition
9511 (Position_dependent_options::copy_from_options): Set incremental
9513 * options.cc (General_options::parse_incremental_changed): New
9515 (General_options::parse_incremental_unchanged): New function.
9516 (General_options::parse_incremental_unknown): New function.
9517 (General_options::General_options): Initialize new fields
9518 incremental_disposition_ and implicit_incremental_.
9519 (General_options::finalize): Check for uasge of --incremental-*
9520 without --incremental.
9522 2009-02-06 Chris Demetriou <cgd@google.com>
9524 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9525 pointer and to report location as the file name associated with
9527 (gold_undefined_symbol_at_location): New function to replace the
9528 old gold_undefined_symbol functionality.
9529 * target-reloc.h (relocate_section): Update to use
9530 gold_undefined_symbol_at_location.
9531 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9532 Call gold_undefined_symbol function rather than gold_error.
9533 * errors.h (Errors::undefined_symbol): Take location as a
9534 string, rather than calculating it from a relocation.
9535 * errors.cc (Errors::fatal): Print "fatal error:" before the
9537 (Errors::error, Errors::error_at_location): Print "error: "
9538 before the formatted message.
9539 (Errors::undefined_symbol): Take location as a string, rather
9540 than calculating it from a relocation.
9541 (gold_undefined_symbol_at_location): New function akin to
9542 old gold_undefined_symbol, calculates location from relocation.
9543 (gold_undefined_symbol): Change to take only a Symbol pointer
9544 and to report location as the file name associated with the symbol.
9545 * testsuite/debug_msg.sh: Update for changed error messages.
9546 * testsuite/undef_symbol.sh: Likewise.
9548 2009-02-04 Duncan Sands <baldrick@free.fr>
9551 * reduced_debug_output.h
9552 (Output_reduced_debug_abbrev_section::failed): Use format for
9554 (Output_reduced_debug_info_section::faild): Likewise.
9556 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9558 * script.cc (Lazy_demangler): New class.
9559 (Version_script_info::get_symbol_version_helper): Demangle a
9562 2009-01-29 Cary Coutant <ccoutant@google.com>
9564 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9566 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9568 2009-01-28 Ian Lance Taylor <iant@google.com>
9570 * version.cc (version_string): Bump to 1.9.
9572 * gold.h: Include <cstring> and <stdint.h>.
9573 * version.cc: Include <cstdio>.
9574 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9576 * reduced_debug_output.cc (insert_into_vector): Rename from
9577 Insert_into_vector; change all callers. Use Swap_unaligned to
9578 avoid aliasing issue; remove union since it is unnecessary.
9580 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9582 * Makefile.am (CCFILES): Add gc.cc.
9584 * Makefile.in: Regenerate.
9585 * gold.cc (Gc_runner): New class.
9586 (queue_initial_tasks): Call garbage collection related tasks
9587 when corresponding options are invoked.
9588 (queue_middle_gc_tasks): New function.
9589 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9590 processed early before laying out sections during garbage collection.
9591 * gold.h (queue_middle_gc_tasks): New function.
9592 (is_prefix_of): Move from "layout.cc".
9593 * i386.cc (Target_i386::gc_process_relocs): New function.
9594 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9595 * main.cc (main): Create object of class "Garbage_collection".
9596 * object.cc (Relobj::copy_symbols_data): New function.
9597 (Relobj::is_section_name_included): New function.
9598 (Sized_relobj::do_layout): Allow this function to be called twice
9599 during garbage collection and defer layout of section during the
9601 * object.h (Relobj::get_symbols_data): New function.
9602 (Relobj::is_section_name_included): New function.
9603 (Relobj::copy_symbols_data): New function.
9604 (Relobj::set_symbols_data): New function.
9605 (Relobj::get_relocs_data): New function.
9606 (Relobj::set_relocs_data): New function.
9607 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9608 (Relobj::gc_process_relocs): New function.
9609 (Relobj::do_gc_process_relocs): New pure virtual function.
9610 (Relobj::sd_): New data member.
9611 (Sized_relobj::is_output_section_offset_invalid): New function.
9612 (Sized_relobj::do_gc_process_relocs): New function.
9613 * options.h (General_options::gc_sections): Modify to not be a no-op.
9614 (General_options::print_gc_sections): New option.
9615 * plugin.cc (Plugin_finish::run): Remove function call to
9616 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9617 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9618 * reloc.cc (Read_relocs::run): Add task to process relocs and
9619 determine unreferenced sections when doing garbage collection.
9620 (Gc_process_relocs): New class.
9621 (Sized_relobj::do_gc_process_relocs): New function.
9622 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9623 sections that are garbage collected.
9624 * reloc.h (Gc_process_relocs): New class.
9625 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9626 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9627 symbols whose corresponding sections are garbage collected.
9628 (Symbol_table::Symbol_table): Add new parameter for the garbage
9630 (Symbol_table::gc_mark_undef_symbols): New function.
9631 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9632 (Symbol_table::gc_mark_dyn_syms): New function.
9633 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9635 (Symbol_table::add_from_object): Likewise.
9636 (Symbol_table::add_from_relobj): When building shared objects, do not
9637 treat externally visible symbols as garbage.
9638 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9639 table information for static and relocatable links.
9640 * symtab.h (Symbol_table::set_gc): New function.
9641 (Symbol_table::gc): New function.
9642 (Symbol_table::gc_mark_undef_symbols): New function.
9643 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9644 (Symbol_table::gc_mark_dyn_syms): New function.
9645 (Symbol_table::gc_): New data member.
9646 * target.h (Sized_target::gc_process_relocs): New pure virtual
9648 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9649 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9651 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9653 * options.h (General_options::gc_sections): Define as a no-op for now.
9654 (General_options::no_keep_memory): Ditto.
9655 (General_options::Bshareable): Define.
9656 * options.cc (General_options::finalize): Honor -Bshareable.
9658 2009-01-20 Andreas Schwab <schwab@suse.de>
9660 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9661 read the value in the contents, since we don't use it. Use the
9662 template endianness when writing.
9663 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9665 2009-01-19 Andreas Schwab <schwab@suse.de>
9667 * configure.tgt (powerpc64-*): Fix targ_obj.
9669 2009-01-15 Ian Lance Taylor <iant@google.com>
9671 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9672 local symbols when stripping all symbols.
9674 2009-01-14 Cary Coutant <ccoutant@google.com>
9676 * output.cc (Output_reloc): Add explicit instantiations.
9678 2009-01-14 Cary Coutant <ccoutant@google.com>
9680 * archive.cc (Archive::get_elf_object_for_member): Remove call
9681 to File_read::claim_for_plugin.
9682 * descriptors.cc (Descriptors::open): Remove reference to
9684 (Descriptors::claim_for_plugin): Remove.
9685 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9686 (Descriptors::is_claimed): Remove.
9687 (claim_descriptor_for_plugin): Remove.
9688 * fileread.cc (File_read::claim_for_plugin): Remove.
9689 * fileread.h (File_read::claim_for_plugin): Remove.
9690 (File_read::descriptor): Reopen descriptor if necessary.
9691 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9692 (Plugin_manager::all_symbols_read): Add task parameter. Change
9694 (Plugin_manager::get_input_file): New function.
9695 (Plugin_manager::release_input_file): New function.
9696 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9697 corresponding data member.
9698 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9699 and pass to base constructor. Change all callers.
9700 (get_input_file, release_input_file): New functions.
9701 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9702 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9703 (Plugin_manager::all_symbols_read): Add task parameter.
9704 (Plugin_manager::get_input_file): New function.
9705 (Plugin_manager::release_input_file): New function.
9706 (Plugin_manager::task_): New data member.
9707 (Pluginobj::Pluginobj): Add filesize parameter.
9708 (Pluginobj::filename): New function.
9709 (Pluginobj::descriptor): New function.
9710 (Pluginobj::filesize): New function.
9711 (Pluginobj::filesize_): New data member.
9712 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9713 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9714 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9716 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9717 with archive libraries.
9718 * testsuite/Makefile.in: Regenerate.
9719 * testsuite/plugin_test.c (struct sym_info): New type.
9720 (get_input_file, release_input_file): New static variables.
9721 (onload): Capture new transfer vector entries.
9722 (claim_file_hook): Stop reading at end of file according to filesize.
9723 Factor out parsing of readelf output into separate function.
9724 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9725 APIs and get the source file name from the symbol table. Convert
9726 source file name to corresponding object file name. Print info
9727 message when adding new input files.
9728 (parse_readelf_line): New function.
9729 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9730 * testsuite/plugin_test_2.sh: Likewise.
9731 * testsuite/plugin_test_3.sh: Likewise.
9732 * testsuite/plugin_test_4.sh: New test case.
9734 2009-01-07 Ian Lance Taylor <iant@google.com>
9736 * version.cc (version_string): Bump to 1.8.
9738 2008-12-23 Cary Coutant <ccoutant@google.com>
9740 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9741 * plugin.cc (Plugin_manager::finish): Rename as
9742 layout_deferred_objects. Move cleanup to separate function.
9743 (Plugin_manager::cleanup): New function.
9744 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9746 * plugin.h (Plugin_manager::finish): Rename as
9747 layout_deferred_objects.
9748 (Plugin_manager::cleanup): New function.
9749 (Plugin_manager::cleanup_done): New field.
9751 2008-12-23 Cary Coutant <ccoutant@google.com>
9753 * plugin.cc (is_visible_from_outside): New function.
9754 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9755 so we don't return "IR only" status for exported symbols or -r links.
9757 * testsuite/Makefile.am (plugin_test_3): New test case.
9758 * testsuite/Makefile.in: Regenerate.
9759 * testsuite/plugin_test_3.sh: New file.
9761 2008-12-22 Cary Coutant <ccoutant@google.com>
9763 * object.cc (Sized_relobj::layout_section): New function.
9764 (Sized_relobj::do_layout): Defer layout of input sections until after
9765 plugin has provided replacement files.
9766 (Sized_relobj::do_layout_deferred_sections): New function.
9767 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9768 (Relobj::layout_deferred_sections): New function.
9769 (Relobj::do_layout_deferred_sections): New function.
9770 (Sized_relobj::do_layout_deferred_sections): New function.
9771 (Sized_relobj::layout_section): New function.
9772 (Sized_relobj::Deferred_layout): New structure.
9773 (Sized_relobj::deferred_layout_): New field.
9774 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9775 Change all callers. Layout deferred sections.
9776 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9778 (Plugin_hook::run): Move code from do_plugin_hook inline.
9779 (Plugin_hook::do_plugin_hook): Remove.
9780 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9781 (Plugin_manager::finish): Renamed, was cleanup.
9782 (Plugin_manager::should_defer_layout): New function.
9783 (Plugin_manager::add_deferred_layout_object): New function.
9784 (Plugin_manager::Deferred_layout_list): New type.
9785 (Plugin_manager::deferred_layout_objects_): New field.
9786 (Plugin_hook::do_plugin_hook): Remove.
9788 2008-12-17 Ian Lance Taylor <iant@google.com>
9790 * options.h (class General_options): Add --no case for
9793 2008-12-16 Cary Coutant <ccoutant@google.com>
9795 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9797 (Plugin_manager::claim_file): Create plugin object even if
9798 plugin did not call the add_symbols callback.
9799 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9800 asking for more symbols than were added.
9801 * testsuite/Makefile.am (plugin_test_1): Add test case with
9803 (empty.syms): New target.
9804 * testsuite/Makefile.in: Regenerate.
9805 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9806 message. Don't call add_symbols if no globals.
9807 (all_symbols_read_hook): Don't provide replacement for empty
9810 2008-12-12 Ian Lance Taylor <iant@google.com>
9812 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9813 r_type == 0 for a local symbol with r_sym == 0.
9814 (scan_relocatable_relocs): Pass r_sym to
9815 local_non_section_strategy.
9816 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9819 * configure.ac: Update test for TLS descriptors: they are
9820 supported as of glibc 2.9.
9821 * configure: Rebuild.
9823 2008-12-11 Ian Lance Taylor <iant@google.com>
9826 * target-reloc.h (Default_scan_relocatable_relocs): For each
9827 function, map r_type == 0 to RELOC_DISCARD.
9829 2008-12-10 Cary Coutant <ccoutant@google.com>
9831 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9832 object to override a kept COMDAT group from a plugin object.
9834 2008-12-09 Ian Lance Taylor <iant@google.com>
9837 * yyscript.y (file_cmd): Handle INPUT.
9839 * testsuite/initpri1.c: Change all declarations to be full
9840 prototypes by adding void, to avoid compiler warnings.
9842 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9844 * options.cc (General_options::parse_plugin_opt): New.
9845 (General_options::add_plugin): The argument now is just the filename.
9846 (General_options::add_plugin_option): New.
9847 * options.h (plugin_opt): New.
9848 (add_plugin): Change argument name.
9849 (add_plugin_option): New.
9850 * plugin.cc (Plugin::load): Don't parse the plugin option.
9851 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9852 (Plugin::add_option): New.
9853 (Plugin::args_): Change type.
9854 (Plugin::filename_): New.
9855 (Plugin_manager::add_plugin_option): New.
9856 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9857 * testsuite/Makefile.in: Regenerate.
9859 2008-12-05 Cary Coutant <ccoutant@google.com>
9861 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9862 Handle --strip-lto-sections option.
9863 * options.h (strip_lto_sections): New option.
9865 2008-12-01 Cary Coutant <ccoutant@google.com>
9867 * plugin.cc (ld_plugin_message): Change format parameter to const.
9868 Fix mismatch between new[] and delete.
9870 2008-11-14 Cary Coutant <ccoutant@google.com>
9872 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9875 2008-11-05 Craig Silverstein <csilvers@google.com>
9877 * options.cc (General_options::parse_dynamic_list): New function.
9878 * options.h (General_options): New flags dynamic_list,
9879 dynamic_list_data, dynamic_list_cpp_new, and
9880 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9881 (General_options::in_dynamic_list): New function.
9882 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9883 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9884 (Lex::can_continue_name): Likewise.
9886 (read_script_file): New parameter script_options.
9887 (read_dynamic_list): New function.
9888 (Script_options::define_dynamic_list): New function.
9889 (dynamic_list_keyword_parsecodes): New variable.
9890 (dynamic_list_keywords): New variable.
9891 * script.h (Script_options::define_dynamic_list): New function
9893 (read_dynamic_list): New function prototype.
9894 * symtab.cc (strprefix): New macro.
9895 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9896 dynamic_list_data, dynamic_list_cpp_new, and
9897 dynamic_list_cpp_typeinfo.
9898 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9899 (dynamic_list_expr): New rule.
9900 (dynamic_list_nodes): Likewise.
9901 (dynamic_list_node): Likewise.
9902 * testsuite/Makefile.am (dynamic_list): New test.
9903 * testsuite/Makefile.in: Regenerated.
9904 * testsuite/dynamic_list.t: New file.
9905 * testsuite/dynamic_list.sh: New file.
9907 2008-11-05 Craig Silverstein <csilvers@google.com>
9909 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9910 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9911 (t11_last): Likewise.
9912 * testsuite/ver_test_6.c (main): Likewise.
9914 2008-10-07 Cary Coutant <ccoutant@google.com>
9916 * options.c (General_options::finalize): Add check for -static and
9918 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9921 2008-10-02 Cary Coutant <ccoutant@google.com>
9923 * plugin.cc (make_sized_plugin_object): Fix conditional
9924 compilation to work when not all targets are enabled.
9926 2008-09-29 Cary Coutant <ccoutant@google.com>
9928 * archive.cc (Archive::get_file_and_offset): Use filename instead
9929 of name to get library path.
9930 (Archive::include_member): Unlock external member of a thin archive.
9932 * testsuite/Makefile.am (TEST_AR): New variable.
9933 (thin_archive_test_1): New test.
9934 (thin_archive_test_2): New test.
9935 * testsuite/Makefile.in: Regenerate.
9936 * testsuite/thin_archive_main.cc: New file.
9937 * testsuite/thin_archive_test_1.cc: New file.
9938 * testsuite/thin_archive_test_2.cc: New file.
9939 * testsuite/thin_archive_test_3.cc: New file.
9940 * testsuite/thin_archive_test_4.cc: New file.
9942 2008-09-29 Cary Coutant <ccoutant@google.com>
9944 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9945 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9947 (Sized_relobj::do_finalize_local_symbols): Likewise.
9948 (Sized_relobj::map_to_kept_section): Likewise.
9949 * object.h (Sized_relobj::invalid_address): New constant.
9950 (Sized_relobj::do_output_section_offset): Check for invalid_address
9952 * output.cc (Output_reloc::local_section_offset): Use constant
9953 invalid_address instead of -1U.
9954 (Output_reloc::get_address): Likewise.
9955 (Output_section::output_address): Change -1U to -1ULL.
9956 * output.h (Output_reloc::invalid_address): New constant.
9957 * reloc.cc (Sized_relobj::write_sections): Use constant
9958 invalid_address instead of -1U.
9959 (Sized_relobj::relocate_sections): Likewise.
9960 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9961 values for merge sections.
9962 * target-reloc.h (relocate_for_relocatable): Use constant
9963 invalid_address instead of -1U.
9965 2008-09-19 Cary Coutant <ccoutant@google.com>
9967 Add plugin functionality for link-time optimization (LTO).
9968 * configure.ac (plugins): Add --enable-plugins option.
9969 * configure: Regenerate.
9970 * config.in: Regenerate.
9971 * Makefile.am (LIBDL): New variable.
9972 (CCFILES): Add plugin.cc.
9973 (HFILES): Add plugin.h.
9974 (ldadd_var): Add LIBDL.
9975 * Makefile.in: Regenerate.
9977 * archive.cc: Include "plugin.h".
9978 (Archive::setup): Don't preread archive symbols when using a plugin.
9979 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9980 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9982 (Archive::include_member): Add symbols from plugin objects.
9983 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9984 * descriptors.cc (Descriptors::open): Check for file descriptors
9985 abandoned by plugins.
9986 (Descriptors::claim_for_plugin): New function.
9987 * descriptors.h (Descriptors::claim_for_plugin): New function.
9988 (Open_descriptor::is_claimed): New field.
9989 (claim_descriptor_for_plugin): New function.
9990 * fileread.cc (File_read::claim_for_plugin): New function.
9991 * fileread.h (File_read::claim_for_plugin): New function.
9992 (File_read::descriptor): New function.
9993 * gold.cc: Include "plugin.h".
9994 (queue_initial_tasks): Add task to call plugin hooks for generating
9996 * main.cc: Include "plugin.h".
9997 (main): Load plugin libraries.
9998 * object.h (Pluginobj): Declare.
9999 (Object::pluginobj): New function.
10000 (Object::do_pluginobj): New function.
10001 (Object::set_target): New function.
10002 * options.cc: Include "plugin.h".
10003 (General_options::parse_plugin): New function.
10004 (General_options::General_options): Initialize plugins_ field.
10005 (General_options::add_plugin): New function.
10006 * options.h (Plugin_manager): Declare.
10007 (General_options): Add --plugin option.
10008 (General_options::has_plugins): New function.
10009 (General_options::plugins): New function.
10010 (General_options::add_plugin): New function.
10011 (General_options::plugins_): New field.
10012 * plugin.cc: New file.
10013 * plugin.h: New file.
10014 * readsyms.cc: Include "plugin.h".
10015 (Read_symbols::do_read_symbols): Check for archive before checking
10016 for ELF file. Call plugin hooks to claim files.
10017 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10018 from a real object file; force override when processing replacement
10020 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10021 (Symbol::init_base_object): Likewise.
10022 (Symbol::init_base_output_data): Likewise.
10023 (Symbol::init_base_output_segment): Likewise.
10024 (Symbol::init_base_constant): Likewise.
10025 (Symbol::init_base_undefined): Likewise.
10026 (Symbol::output_section): Assert that object is not a plugin.
10027 (Symbol_table::add_from_pluginobj): New function.
10028 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10030 (Symbol_table::sized_write_globals): Likewise.
10031 (Symbol_table::add_from_pluginobj): Instantiate template.
10032 * symtab.h (Sized_pluginobj): Declare.
10033 (Symbol::in_real_elf): New function.
10034 (Symbol::set_in_real_elf): New function.
10035 (Symbol::in_real_elf_): New field.
10036 (Symbol_table::add_from_pluginobj): New function.
10038 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10039 (LIBDL): New variable.
10040 (LDADD): Add LIBDL.
10041 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10042 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10043 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10044 (MOSTLYCLEANFILES): Likewise.
10045 * testsuite/Makefile.in: Regenerate.
10046 * testsuite/plugin_test.c: New file.
10047 * testsuite/plugin_test_1.sh: New file.
10048 * testsuite/plugin_test_2.sh: New file.
10050 2008-09-16 Ian Lance Taylor <iant@google.com>
10052 * target-reloc.h (relocate_section): Check whether a symbol is
10053 defined by the ABI before reporting an undefined symbol error.
10054 * target.h (Target::is_defined_by_abi): Make parameter const.
10055 (Target::do_is_defined_by_abi): Likewise.
10056 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10057 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10058 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10059 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10060 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10061 * testsuite/Makefile.in: Rebuild.
10063 * fileread.cc (make_view): Add casts to avoid warning.
10065 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10067 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10068 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10070 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10072 * options.h (General_options::output_is_executable): New.
10073 (General_options::output_is_pie): New.
10074 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10075 for shared libraries.
10076 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10078 2008-09-11 Chris Demetriou <cgd@google.com>
10080 * options.h (origin): New -z option.
10081 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10082 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10085 2008-09-05 Cary Coutant <ccoutant@google.com>
10087 * fileread.cc (File_read::make_view): Add check for attempt to map
10088 beyond end of file.
10090 2008-09-05 Cary Coutant <ccoutant@google.com>
10092 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10093 explicit instantiations.
10095 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10098 * options.cc (General_options::finalize): Allow undefined symbols
10099 in shlibs if linking -shared.
10102 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10103 symbols as not needing a dynsym entry.
10105 2008-08-20 Craig Silverstein <csilvers@google.com>
10107 * fileread.cc (File_read::open): Do not lock the file unless it
10108 was successfully opened.
10110 2008-08-14 Cary Coutant <ccoutant@google.com>
10112 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10113 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10114 * testsuite/tls_test.cc (struct int128): 128-bit struct
10115 for testing TLS relocs with non-zero addend.
10116 (v12): New TLS variable.
10118 (t_last): Add check for v12.
10119 * testsuite/tls_test.h (t12): New function.
10120 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10122 2008-08-13 Ian Lance Taylor <iant@google.com>
10124 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10125 set tls_segment_ or relro_segment_.
10126 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10128 * output.h (Output_section::clear_is_relro): New function.
10129 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10130 sections specially even when output_data_ is empty.
10131 (Output_segment::maximum_alignment): When first section is relro,
10132 only force alignment for PT_LOAD segments.
10133 * script.cc (script_data_segment_align): New function.
10134 (script_data_segment_relro_end): New function.
10135 * script-c.h (script_data_segment_align): Declare.
10136 (script_data_segment_relro_end): Declare.
10137 * script-sections.h (class Script_sections): Declare
10138 data_segment_align and data_segment_relro_end. Add fields
10139 segment_align_index_ and saw_relro_end_.
10140 * script-sections.cc (class Sections_element): Add set_is_relro
10141 virtual function. Add new bool* parameter to place_orphan_here.
10142 Add get_output_section virtual function.
10143 (class Output_section_definition): Add set_is_relro. Add new
10144 bool* parameter to place_orphan_here. Add get_output_section.
10145 Add is_relro_ field.
10146 (Output_section_definition::Output_section_definition): Initialize
10147 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10148 and is_relro_ fields.
10149 (Output_section_definition::place_orphan_here): Add is_relro
10151 (Output_section_definition::set_section_addresses): Set relro for
10153 (Output_section_definition::alternate_constraint): Likewise.
10154 (class Orphan_output_section): Add new bool* parameter to
10155 place_orphan_here. Add get_output_section.
10156 (Orphan_output_section::place_orphan_here): Add is_relro
10158 (Script_sections::Script_sections): Initialize
10159 data_segment_align_index_ and saw_relro_end_.
10160 (Script_sections::data_segment_align): New function.
10161 (Script_sections::data_segment_relro_end): New function.
10162 (Script_sections::place_orphan): Set or clear is_relro.
10163 (Script_sections::set_section_addresses): Force alignment of first
10165 * yyscript.y (exp): Call script_data_segment_align and
10166 script_data_segment_relro_end.
10167 * testsuite/relro_script_test.t: New file.
10168 * testsuite/relro_test.cc (using_script): Declare.
10169 (t1, t2): Test using_script.
10170 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10171 (relro_script_test_SOURCES): Define.
10172 (relro_script_test_DEPENDENCIES): Define.
10173 (relro_script_test_LDFLAGS): Define.
10174 (relro_script_test_LDADD): Define.
10175 (relro_script_test.so): New target.
10176 * testsuite/Makefile.in: Rebuild.
10178 2008-08-06 Cary Coutant <ccoutant@google.com>
10180 * archive.cc (Archive::total_archives, Archive::total_members)
10181 (Archive::total_members_loaded): New variables.
10182 (Archive::setup): Add parameter. Add option to preread
10184 (Archive::read_armap): Add counter.
10185 (Archive::get_file_and_offset): New function.
10186 (Archive::get_elf_object_for_member): New function.
10187 (Archive::read_all_symbols): New function.
10188 (Archive::read_symbols): New function.
10189 (Archive::add_symbols): Add counters.
10190 (Archive::include_all_members): Use armap to find members if it's
10192 (Archive::include_member): Skip reading symbols if already read.
10193 Factored code into Archive::get_file_and_offset and
10194 Archive::get_elf_object_for_member. Changed call to
10195 Mapfile::report_include_archive_member.
10196 (Archive::print_stats): New function.
10197 * archive.h: Declare Object and Read_symbols_data classes.
10198 (Archive::Archive): Add initializers for new members.
10199 (Archive::setup): Add parameter.
10200 (Archive::print_stats): New function.
10201 (Archive::total_archives, Archive::total_members)
10202 (Archive::total_members_loaded): New variables.
10203 (Archive::get_file_and_offset): New function.
10204 (Archive::get_elf_object_for_member): New function.
10205 (Archive::read_all_symbols): New function.
10206 (Archive::read_symbols): New function.
10207 (Archive::Archive_member): New class.
10208 (Archive::members_): New member.
10209 (Archive::num_members_): New member.
10210 * main.cc: Include archive.h.
10211 (main): Call Archive::print_stats.
10212 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10213 archive parameter; member_name is now the fully-decorated name.
10214 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10215 * options.h: (General_options): Add --preread-archive-symbols option.
10216 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10219 2008-08-04 Ian Lance Taylor <iant@google.com>
10221 * symtab.h (Symbol::use_plt_offset): New function.
10222 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10223 * powerpc.cc (Relocate::relocate): Likewise.
10224 * sparc.cc (Relocate::relocate): Likewise.
10225 * x86_64.cc (Relocate::relocate): Likewise.
10226 * testsuite/weak_plt.sh: New test.
10227 * testsuite/weak_plt_main.cc: New test.
10228 * testsuite/weak_plt_shared.cc: New test.
10229 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10230 (check_PROGRAMS): Add weak_plt.
10231 (check_DATA): Add weak_plt_shared.so.
10232 (weak_plt_main_pic.o, weak_plt): New targets.
10233 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10234 * testsuite/Makefile.in: Rebuild.
10236 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10238 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10239 * testsuite/Makefile.in: Rebuild.
10241 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10243 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10244 * Makefile.in: Regenerate.
10245 * po/POTFILES.in: Regenerate.
10247 2008-07-29 Ian Lance Taylor <iant@google.com>
10249 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10250 symbols before other symbols.
10251 * testsuite/script_test_2.cc (test_addr): Declare.
10252 (test_addr_alias): Declare.
10253 (main): Check that test_addr and test_addr_alias have the right
10255 * testsuite/script_test_2.t: Define test_addr_alias and
10258 2008-07-24 Ian Lance Taylor <iant@google.com>
10261 * descriptors.cc: New file.
10262 * descriptors.h: New file.
10263 * gold-threads.h (class Hold_optional_lock): New class.
10264 * fileread.cc: Include "descriptors.h".
10265 (File_read::~File_read): Release descriptor rather than closing
10267 (File_read::open) [file]: Call open_descriptor rather than open.
10268 Set is_descriptor_opened_.
10269 (File_read::open) [memory]: Assert that descriptor is not open.
10270 (File_read::reopen_descriptor): New function.
10271 (File_read::release): Release descriptor.
10272 (File_read::do_read): Make non-const. Reopen descriptor.
10273 (File_read::read): Make non-const.
10274 (File_read::make_view): Reopen descriptor.
10275 (File_read::do_readv): Likewise.
10276 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10277 Update declarations.
10278 * layout.cc: Include "descriptors.h".
10279 (Layout::create_build_id): Use open_descriptor rather than open.
10280 * output.cc: Include "descriptors.h".
10281 (Output_file::open): Use open_descriptor rather than open.
10282 * archive.cc (Archive::const_iterator): Change Archive to be
10284 (Archive::begin, Archive::end): Make non-const.
10285 (Archive::count_members): Likewise.
10286 * archive.h (class Archive): Update declarations.
10287 * object.h (Object::read): Make non-const.
10288 * Makefile.am (CCFILES): Add descriptors.cc.
10289 (HFILES): Add descriptors.h.
10290 * Makefile.in: Rebuild.
10293 * gold.h: Always include <clocale>. Add Solaris workarounds
10294 following code in binutils/sysdep.h.
10297 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10298 this->eh_frame_hdr_ is NULL before using it.
10300 * dynobj.cc (Versions::Versions): Update comment.
10302 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10303 the base version name.
10305 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10306 array size plus one.
10307 (Stringpool_template::set_string_offsets): Subtract one from key
10308 before using it as an array index.
10309 (Stringpool_template::get_offset_with_length): Likewise.
10310 (Stringpool_template::write_to_buffer): Likewise.
10311 * stringpool.h (Stringpool_template::get_offset_from_key):
10314 2008-07-23 Ian Lance Taylor <iant@google.com>
10317 * object.h (Merged_symbol_value::value): Do our best to handle a
10321 * script.cc (Version_script_info::get_versions): Don't add empty
10322 version tag to return value.
10323 (Version_script_info::get_symbol_version_helper): Change return
10324 type to bool. Add pversion parameter. Change all callers.
10325 (script_register_vers_node): Don't require a non-NULL tag.
10326 * script.h (class Version_script_info): Update declarations.
10327 (Version_script_info::get_symbol_version): Change return type to
10328 bool. Add version parameter. Change all callers.
10329 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10330 handling. Handle an empty version from a version script.
10331 (Symbol_table::define_special_symbol): Likewise.
10332 * testsuite/ver_test_10.script: New file.
10333 * testsuite/ver_test_10.sh: New file.
10334 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10335 (check_DATA): Add ver_test_10.syms.
10336 (ver_test_10.syms, ver_test_10.so): New target.
10337 * testsuite/Makefile.in: Rebuild.
10339 2008-07-23 Simon Baldwin <simonb@google.com>
10341 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10342 to zero for undefined symbols from dynamic libraries.
10344 2008-07-23 Ian Lance Taylor <iant@google.com>
10346 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10347 Change all callers.
10348 * symtab.h (class Symbol_table): Update declaration.
10349 * testsuite/ver_test_9.cc: New file.
10350 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10351 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10352 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10353 (ver_test_9.so, ver_test_9.o): New targets.
10354 * testsuite/Makefile.in: Rebuild.
10356 2008-07-22 Ian Lance Taylor <iant@google.com>
10358 * options.h (class General_options): Define --check-sections.
10359 * layout.cc (Layout::set_segment_offsets): Handle
10362 * options.h (class General_options): Define -n/--nmagic and
10364 * options.cc (General_options::finalize): For -n/--nmagic or
10365 -N/--omagic, set -static.
10366 * layout.cc (Layout::attach_allocated_section_to_segment): If
10367 -N/--omagic, don't put read-only and read-write sections in
10368 different segments.
10369 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10370 finding a read-only segment.
10371 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10372 don't set the minimum segment alignment to the common page size,
10373 and don't set the file offset to the address modulo the page size.
10374 * script-sections.cc (Script_sections::create_segments): If
10375 -n/--omagic, don't put read-only and read-write sections in
10376 different segments.
10378 * cref.cc: New file.
10379 * cref.h: New file.
10380 * options.h (class General_options): Add --print-symbol-counts.
10381 * main.cc (main): Issue defined symbol report if requested.
10382 * archive.cc (Archive::interpret_header): Make into a const member
10384 (Archive::add_symbols): Call Input_objects::archive_start and
10386 (Archive::const_iterator): Define new class.
10387 (Archive::begin, Archive::end): New functions.
10388 (Archive::include_all_members): Rewrite to use iterator.
10389 (Archive::count_members): New function.
10390 * archive.h (class Archive): Update declarations.
10391 (Archive::filename): New function.
10392 * object.cc: Include "cref.h".
10393 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10394 (Sized_relobj::do_get_global_symbol_counts): New function.
10395 (Input_objects::add_object): Add object to cross-referencer.
10396 (Input_objects::archive_start): New function.
10397 (Input_objects::archive_stop): New function.
10398 (Input_objects::print_symbol_counts): New function.
10399 * object.h: Declare Cref and Archive.
10400 (Object::get_global_symbol_counts): New function.
10401 (Object::do_get_global_symbol_counts): New pure virtual function.
10402 (class Sized_relobj): Add defined_count_ field. Update
10404 (class Input_objects): Add cref_ field. Update constructor.
10405 Update declarations.
10406 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10408 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10410 (Sized_dynobj::do_get_global_symbol_counts): New function.
10411 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10412 defined_count_. Update declarations. Define Symbols typedef.
10413 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10414 parameter. Change all callers.
10415 (Symbol_table::add_from_dynobj): Add sympointers and defined
10416 parameters. Change all callers.
10417 * symtab.h (class Symbol_table): Update declarations.
10418 * Makefile.am (CCFILES): Add cref.cc.
10419 (HFILES): Add cref.h.
10420 * Makefile.in: Rebuild.
10422 2008-07-22 Simon Baldwin <simonb@google.com>
10424 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10425 to zero when writing undefined symbols.
10427 2008-07-22 Ian Lance Taylor <iant@google.com>
10429 * output.cc (Output_section::add_input_section): Don't try to
10430 merge empty merge sections.
10432 2008-07-21 Craig Silverstein <csilvers@google.com>
10434 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10435 Include symbol version in error message.
10437 2008-07-20 Chris Demetriou <cgd@google.com>
10439 * configure.ac (gold_cv_c_random_seed): New configured variable.
10440 (RANDOM_SEED_CFLAGS): New substituted variable.
10441 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10442 * configure: Rebuild.
10443 * Makefile.in: Likewise.
10444 * testsuite/Makefile.in: Likewise.
10446 2008-07-18 Ian Lance Taylor <iant@google.com>
10448 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10449 where we see NAME/NULL and NAME/VERSION as separate symbols.
10450 * testsuite/ver_test_main.cc (main): Call t4.
10451 (t4, t4_2a): Define.
10452 * testsuite/ver_test_2.cc (t4_2): Define.
10453 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10454 * testsuite/ver_test_4.cc (t4_2a): Define.
10455 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10456 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10458 2008-07-17 Ian Lance Taylor <iant@google.com>
10460 * dynobj.cc (Versions::add_def): If we give an error about a
10461 missing version, go ahead and create the version anyhow.
10463 2008-07-10 Ian Lance Taylor <iant@google.com>
10465 Handle output sections with more than 0x7fffffff bytes.
10466 * object.h (class Relobj): Change map_to_output_ to
10467 output_sections_, and just keep a section pointer. Change all
10468 uses. Move comdat group support to Sized_relobj.
10469 (Relobj::is_section_specially_mapped): Remove.
10470 (Relobj::output_section): Remove poff parameter. Change all
10472 (Relobj::output_section_offset): New function.
10473 (Relobj::set_section_offset): Rewrite.
10474 (Relobj::map_to_output): Remove.
10475 (Relobj::output_sections): New function.
10476 (Relobj::do_output_section_offset): New pure virtual function.
10477 (Relobj::do_set_section_offset): Likewise.
10478 (class Sized_relobj): Add section_offsets_ field. Add comdat
10479 group support from Relobj. Update declarations.
10480 (Sized_relobj::get_output_section_offset): New function.
10481 (Sized_relobj::do_output_section_offset): New function.
10482 (Sized_relobj::do_set_section_offset): New function.
10483 * object.cc (Relobj::output_section_address): Remove.
10484 (Sized_relobj::Sized_relobj): Initialize new fields.
10485 (Sized_relobj::include_section_group): Cast find_kept_object to
10487 (Sized_relobj::include_linkonce_section): Likewise.
10488 (Sized_relobj::do_layout): Use separate arrays for output section
10490 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10492 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10493 output_sections and section_offsets.
10494 (Sized_relobj::write_local_symbols): Likewise.
10495 (map_to_kept_section): Compute output address directly.
10496 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10497 output_sections and section_offsets.
10498 (Sized_relobj::write_sections): Likewise.
10499 (Sized_relobj::relocate_sections): Likewise.
10500 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10501 * output.h (class Output_reloc): Update declarations. Change
10502 u2_.relobj to Sized_relobj*.
10503 (class Output_data_reloc): Change add functions to use
10505 * output.cc (Output_reloc::Output_reloc): Change relobj to
10507 (Output_reloc::local_section_offset): Change return type to
10508 Elf_Addr. Use get_output_section_offset.
10509 (Output_reloc::get_address): Likewise.
10510 (Output_section::is_input_address_mapped): Don't call
10511 is_section_specially_mapped.
10512 (Output_section::output_offset): Likewise.
10513 (Output_section::output_address): Likewise.
10514 (Output_section::starting_output_address): Likewise.
10515 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10516 parameter to Sized_relobj*.
10517 (Copy_relocs::need_copy_reloc): Likewise.
10518 (Copy_relocs::save): Likewise.
10519 * copy-relocs.h (class Copy_relocs): Update declarations.
10520 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10521 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10522 * target-reloc.h (relocate_for_relocatable): Change
10523 offset_in_output_section type to Elf_Addr. Change code that uses
10525 * layout.cc (Layout::layout): Always set *off.
10526 * mapfile.cc (Mapfile::print_input_section): Use
10527 output_section_offset.
10528 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10530 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10531 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10532 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10534 2008-07-03 Ian Lance Taylor <iant@google.com>
10536 * layout.cc (Layout::include_section): Do not discard unrecognized
10537 SHT_STRTAB sections.
10539 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10541 * script.cc (Lex::can_continue_name): Make '?' allowable in
10542 version-script names.
10543 * testsuite/version_script.map: Change glob pattern to use '?'
10545 2008-06-30 Manish Singh <yosh@gimp.org>
10548 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10551 2008-06-30 Ian Lance Taylor <iant@google.com>
10555 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10556 versions]: Don't try to read the value in the contents, since we
10557 don't use it. Use the template endianness when writing.
10559 2008-06-25 Cary Coutant <ccoutant@google.com>
10561 * fileread.cc (File_read::make_view): Assert on zero-length view.
10562 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10563 symbol table when there are no symbols to read.
10565 2008-06-23 Craig Silverstein <csilvers@google.com>
10567 * version.cc (version_string): Bump to 1.7
10569 2008-06-18 Craig Silverstein <csilvers@google.com>
10571 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10572 constant 0xFFFF to type Valtype.
10573 (Powerpc_relocate_functions::rel16_ha): Likewise.
10575 2008-06-17 Ian Lance Taylor <iant@google.com>
10577 * output.h (Output_section::Input_section): Initialize p2align_ to
10578 zero for Output_section_data constructors.
10579 (Output_section::Input_section::addralign): If not an input
10580 section, return the alignment of the Output_section_data.
10581 * testsuite/copy_test.cc: New file.
10582 * testsuite/copy_test_1.cc: New file.
10583 * testsuite/copy_test_2.cc: New file.
10584 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10585 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10586 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10587 (copy_test_1_pic.o, copy_test_1.so): New targets.
10588 (copy_test_2_pic.o, copy_test_2.so): New targets.
10589 * testsuite/Makefile.in: Rebuild.
10591 * script-sections.cc (Script_sections::place_orphan): Initialize
10592 local variable exact.
10594 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10596 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10598 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10599 David S. Miller <davem@davemloft.net>
10601 * powerpc.cc: New file.
10602 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10603 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10604 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10605 * Makefile.in: Rebuild.
10607 2008-06-09 Ian Lance Taylor <iant@google.com>
10609 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10611 (throwing, orig_terminate): New static variables.
10612 (terminate_handler): New static function.
10613 (t2): Set terminate handler.
10615 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10618 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10621 2008-05-30 Cary Coutant <ccoutant@google.com>
10623 * archive.cc (Archive::include_all_members) Correct to step
10624 over symbol table and extended name table in thin archives.
10626 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10629 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10632 2008-05-28 Caleb Howe <cshowe@google.com>
10634 * reduced_debug_output.cc: New file.
10635 * reduced_debug_output.h: New file.
10636 * options.h (class General_options): Add --strip-debug-non-line.
10637 * options.cc (General_options::finalize): Add strip_debug_non_line
10638 to the strip heirarchy.
10639 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10641 * layout.cc: Include "reduced_debug_output.h".
10642 (Layout::Layout): Initialize new fields.
10643 (line_only_debug_sections): New static array.
10644 (is_lines_only_debug_sections): New static inline function.
10645 (Layout::include_section): Handle --strip-debug-non-line.
10646 (Layout::make_output_section): If --strip-debug-non-line, build
10647 new output sections for .debug_abbrev and .debug_info.
10648 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10649 gold. Warn about possible overflow.
10650 (read_signed_LEB_128): Likewise.
10651 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10652 (read_signed_LEB_128): Declare.
10653 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10654 (HFILES): Add reduced_debug_output.h.
10655 * Makefile.in: Rebuild.
10657 2008-05-21 Ian Lance Taylor <iant@google.com>
10659 * mapfile.cc: New file.
10660 * mapfile.h: New file.
10661 * options.h (class General_options): Add -M/--print-map and -Map.
10662 * options.cc (General_options::finalize): Make -M equivalent to
10664 * main.cc: Include <cstdio> and "mapfile.h".
10665 (main): Open mapfile if requested.
10666 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10667 constructor. Change caller.
10668 (queue_initial_tasks): Add mapfile parameter. Change caller.
10669 (queue_middle_tasks): Likewise.
10670 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10672 * archive.cc: Include "mapfile.h".
10673 (Archive::add_symbols): Add mapfile parameter. Change all
10674 callers. Pass mapfile, symbol, and reason to include_member.
10675 (Archive::include_all_members): Add mapfile parameter. Change all
10677 (Archive::include_member): Add mapfile, sym, and why parameters.
10678 Change all callers. Report inclusion to map file.
10679 * archive.h: Include "fileread.h".
10680 (class Archive): Update declarations.
10681 (Archive::file): New const method.
10682 (class Add_archive_symbols): Add mapfile_ field. Update
10683 constructor. Change all callers.
10684 * readsyms.h (class Read_symbols): Likewise.
10685 (class Finish_group): Likewise.
10686 (class Read_script): Likewise.
10687 * common.cc: Include "mapfile.h".
10688 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10690 (Symbol_table::do_allocate_commons): Likewise.
10691 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10692 symbol allocation to mapfile.
10693 * common.h (class Allocate_commons_task): Add mapfile_ field.
10694 Update constructor. Change all callers.
10695 * symtab.h (class Symbol_table): Update declarations.
10696 * layout.cc: Include "mapfile.h".
10697 (Layout_task_runner::run): Print information to mapfile.
10698 (Layout::create_gold_note): Change Output_data_fixed_space to
10699 Output_data_zero_fill.
10700 (Layout::create_build_id): Likewise.
10701 (Layout::print_to_mapfile): New function.
10702 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10703 constructor. Change caller.
10704 (class Layout): Declare print_to_mapfile.
10705 * output.cc (Output_section::Input_section::print_to_mapfile): New
10707 (Output_section::add_input_section): If producing a map, always
10708 add to input_sections_ list.
10709 (Output_section::do_print_to_mapfile): New function.
10710 (Output_segment::print_sections_to_mapfile): New function.
10711 (Output_segment::print_section_list_to_mapfile): New function.
10712 * output.h: Include "mapfile.h".
10713 (Output_data::print_to_mapfile): New function.
10714 (Output_data::do_print_to_mapfile): New virtual function.
10715 (Output_segment_headers::do_print_to_mapfile): New function.
10716 (Output_file_header::do_print_to_mapfile): New function.
10717 (Output_data_const::do_print_to_mapfile): New function.
10718 (class Output_data_const_buffer): Add map_name_ field. Update
10719 constructor. Change all callers. Add do_print_to_mapfile
10721 (class Output_data_fixed_space): Likewise.
10722 (class Output_data_space): Likewise.
10723 (class Output_data_zero_fill): New class.
10724 (Output_data_strtab::do_print_to_mapfile): New function.
10725 (Output_data_reloc_base::do_print_to_mapfile): New function.
10726 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10727 (Output_data_group::do_print_to_mapfile): New function.
10728 (Output_data_got::do_print_to_mapfile): New function.
10729 (Output_data_dynamic::do_print_to_mapfile): New function.
10730 (Output_symtab_xindex::do_print_to_mapfile): New function.
10731 (class Output_section): Declare do_print_to_mapflie. Declare
10732 print_to_mapfile in Input_section.
10733 (class Output_segment): Declare new functions.
10734 * object.h (Sized_relobj::symbol_count): New function.
10735 * script-sections.cc
10736 (Output_section_element_dot_assignment::set_section_addresses):
10737 Change Output_data_fixed_space to Output_data_zero_fill.
10738 (Output_data_expression::do_print_to_mapfile): New function.
10739 * script.cc (read_input_script): Add mapfile parameter. Change
10741 * script.h (read_input_script): Update declaration.
10742 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10743 (Eh_frame::do_print_to_mapfile): New function.
10744 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10745 (Output_merge_string::do_print_to_mapfile): New function.
10746 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10748 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10750 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10752 * Makefile.am (CCFILES): Add mapfile.cc.
10753 (HFILES): Add mapfile.h.
10754 * Makefile.in: Rebuild.
10756 2008-05-19 Ian Lance Taylor <iant@google.com>
10758 * options.h (class General_options): Add -z relro.
10759 * layout.cc (Layout::Layout): Initialize relro_segment_.
10760 (Layout::add_output_section_data): Return the output section.
10761 (Layout::make_output_section): Rcognize relro sections and mark
10762 them appropriately.
10763 (Layout::attach_allocated_section_to_segment): Put relro sections
10764 in a PT_GNU_RELRO segment.
10765 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10767 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10769 (Layout::linkonce_mapping): Map d.rel.ro.local to
10770 .data.rel.ro.local.
10771 (Layout::output_section_name): Us .data.rel.ro.local for any
10772 section which begins with that.
10773 * layout.h (class Layout): Update add_output_section_data
10774 declaration. Add relro_segment_ field.
10775 * output.cc (Output_section::Output_section): Initialize is_relro_
10776 and is_relro_local_ fields.
10777 (Output_segment::add_output_section): Group relro sections.
10778 (Output_segment::is_first_section_relro): New function.
10779 (Output_segment::maximum_alignment): If there is a relro section,
10780 align the segment to the common page size.
10781 (Output_segment::set_section_addresses): Track whether we are
10782 looking at relro sections. If the last section is a relro
10783 section, align to the common page size.
10784 (Output_segment::set_section_list_addresses): Add in_relro
10785 parameter. Change all callers. Align to the page size when
10786 moving from relro to non-relro section.
10787 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10789 * output.h (class Output_section): Add is_relro_ and
10790 is_relro_local_ fields.
10791 (Output_section::is_relro): New function.
10792 (Output_section::set_is_relro): New function.
10793 (Output_section::is_relro_local): New function.
10794 (Output_section::set_is_relro_local): New function.
10795 (class Output_segment): Update declarations.
10796 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10797 * sparc.cc (Target_sparc::got_section): Likewise.
10798 * x86_64.cc (Target_x86_64::got_section): Likewise.
10799 * testsuite/relro_test_main.cc: New file.
10800 * testsuite/relro_test.cc: New file.
10801 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10802 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10803 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10804 (relro_test.so, relro_test_pic.o): New targets.
10805 * testsuite/Makefile.in: Rebuild.
10807 2008-05-16 Ian Lance Taylor <iant@google.com>
10809 * output.cc (Output_segment::add_output_section): Remove front
10811 * output.h (class Output_segment): Remove
10812 add_initial_output_section and overloaded add_output_section.
10813 Update declaration of remaining add_output_section.
10814 * layout.cc (Layout::create_interp): Call add_output_section
10815 rather than add_initial_output_section.
10816 (Layout::finish_dynamic_section): Likewise.
10818 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10819 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10820 know the dynamic type.
10821 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10822 field. Initialize it in constructor.
10823 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10824 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10825 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10828 * output.cc (Output_reloc::get_address): Change return type to
10830 * output.h (class Output_reloc): Update get_address declaration.
10831 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10832 for section addresses.
10834 2008-05-09 Ian Lance Taylor <iant@google.com>
10837 * gold.cc (gold_nomem): Use return value of write.
10839 2008-05-08 Ian Lance Taylor <iant@google.com>
10841 * symtab.c (Symbol::init_base_output_data): Add version
10842 parameter. Change all callers.
10843 (Symbol::init_base_output_segment): Likewise.
10844 (Symbol::init_base_constant): Likewise.
10845 (Symbol::init_base_undefined): Likewise.
10846 (Sized_symbol::init_output_data): Likewise.
10847 (Sized_symbol::init_output_segment): Likewise.
10848 (Sized_symbol::init_constant): Likewise.
10849 (Sized_symbol::init_undefined): Likewise.
10850 (Symbol_table::do_define_in_output_data): If the new symbol has a
10851 version, mark it as the default.
10852 (Symbol_table::do_define_in_output_segment): Likewise.
10853 (Symbol_table::do_define_as_constant): Likewise.
10854 * symtab.h (class Symbol): Update declarations.
10855 (class Sized_symbol): Likewise.
10856 * resolve.cc (Symbol::override_version): New function.
10857 (Symbol::override_base): Call override_version.
10858 (Symbol::override_base_with_special): Likewise.
10859 * testsuite/ver_script_8.script: New file.
10860 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10861 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10862 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10863 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10865 2008-05-06 Ian Lance Taylor <iant@google.com>
10868 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10870 (class General_options): Remove existing --undefined, and add
10871 --no-undefined instead. Add new --undefined as synonym for -u.
10872 * archive.cc (Archive::add_symbols): Check whether symbol was
10874 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10875 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10876 all uses. Add IS_UNDEFINED. Update declarations to split
10877 different versions of init_base. Declare init_base_undefined.
10878 (Symbol::is_defined): Handle IS_UNDEFINED.
10879 (Symbol::is_undefined): Likewise.
10880 (Symbol::is_weak_undefined): Call is_undefined.
10881 (Symbol::is_absolute): Handle IS_CONSTANT.
10882 (class Sized_symbol): Update declarations to split different
10883 versions of init. Declare init_undefined.
10884 (class Symbol_table): Declare new functions.
10885 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10886 Change all callers.
10887 (Symbol::init_base_output_data): Likewise.
10888 (Symbol::init_base_output_segment): Likewise.
10889 (Symbol::init_base_constant): Likewise.
10890 (Symbol::init_base_undefined): New function.
10891 (Sized_symbol::init_object): Rename from init. Change all
10893 (Sized_symbol::init_output_data): Likewise.
10894 (Sized_symbol::init_output_segment): Likewise.
10895 (Sized_symbol::init_constant): Likewise.
10896 (Sized_symbol::init_undefined): New function.
10897 (Symbol_table::add_undefined_symbols_from_command_line): New
10899 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10901 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10902 (Symbol::output_section): Likewise.
10903 (Symbol::set_output_section): Likewise.
10904 (Symbol_table::sized_finalize_symbol): Likewise.
10905 (Symbol_table::sized_write_globals): Likewise.
10906 * resolve.cc (Symbol_table::should_override): Likewise.
10907 (Symbol::override_base_with_special): Likewise.
10909 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10910 symbol, change it to have default visibility.
10911 * testsuite/protected_1.cc: New file.
10912 * testsuite/protected_2.cc: New file.
10913 * testsuite/protected_3.cc: New file.
10914 * testsuite/protected_main_1.cc: New file.
10915 * testsuite/protected_main_2.cc: New file.
10916 * testsuite/protected_main_3.cc: New file.
10917 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10918 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10919 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10920 (protected_1.so): New target.
10921 (protected_1_pic.o, protected_2_pic.o): New targets.
10922 (protected_3_pic.o): New target.
10923 (check_PROGRAMS): Add protected_2.
10924 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10925 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10926 * testsuite/Makefile.in: Rebuild.
10928 * options.h (DEFINE_var): Add set_user_set_##varname__.
10929 (DEFINE_bool_alias): New macro.
10930 (class General_options): Define -Bstatic using DEFINE_bool_alias
10931 rather than DEFINE_special. Add --undefined as an alias for -z
10933 * options.cc (General_options::parse_Bstatic): Remove.
10935 * options.h (class General_options): Add --fatal-warnings.
10936 * main.cc (main): Implement --fatal-warnings.
10937 * errors.h (Errors::warning_count): New function.
10939 * options.h (class General_options): Add -Bsymbolic-functions.
10940 * symtab.h (Symbol::is_preemptible): Check for
10941 -Bsymbolic-functions.
10943 2008-05-05 Ian Lance Taylor <iant@google.com>
10945 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10946 as noVARNAME rather than no-VARNAME.
10947 (class General_options): Add option -z combreloc.
10948 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10950 (Output_reloc::sort_before) [SHT_REL]: New function.
10951 (Output_reloc::sort_before) [SHT_RELA]: New function.
10952 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10953 Sort_relocs_comparison.
10954 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10955 parameter. Change all callers.
10956 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10957 sort_relocs parameter. Change all callers.
10958 * output.cc (Output_reloc::get_address): New function, broken out
10960 (Output_reloc::write_rel): Call it.
10961 (Output_reloc::compare): New function.
10962 (Output_data_reloc_base::do_write): Optionally sort relocs.
10964 * configure.ac: If targ_extra_obj is set, link it in.
10965 * configure.tgt: Initialize all variables.
10966 (x86_64*): Set targ_extra_obj and targ_extra_size.
10967 * configure: Rebuild.
10969 * object.cc (Sized_relobj::include_section_group): Adjust section
10970 indexes read from group data. Build vector to pass to
10972 * layout.cc (Layout::layout_group): Add flags and shndxes
10973 parameters. Remove contents parameter. Change caller. Update
10974 explicit instantiations.
10975 * layout.h (class Layout): Update layout_group declaration.
10976 * output.cc (Output_data_group::Output_data_group): Add flags and
10977 input_shndxes parameters. Remove contents parameter. Change
10979 (Output_data_group::do_write): Change input_sections_ to
10981 * output.h (class Output_data_group): Update constructor
10982 declaration. Rename input_sections_ to input_shndxes_.
10983 * testsuite/many_sections_test.cc: Add template.
10985 2008-04-30 Cary Coutant <ccoutant@google.com>
10987 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10989 * layout.cc (Layout::include_section): Refactored check for debug
10991 (Layout::add_comdat): Add new parameters. Change type
10992 of signature parameter. Add object and shndx to signatures table.
10993 (Layout::find_kept_object): New function.
10994 * layout.h: Include <cstring>.
10995 (Layout::is_debug_info_section): New function.
10996 (Layout::add_comdat): Add new parameters.
10997 (Layout::find_kept_object): New function.
10998 (Layout::Kept_section): New struct.
10999 (Layout::Signatures): Change type of map range.
11000 * object.cc (Relobj::output_section_address): New function.
11001 (Sized_relobj::include_section_group): Add new parameters. Change
11002 calls to Layout::add_comdat. Change to build table of kept comdat
11003 groups and table mapping discarded sections to kept sections.
11004 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11005 (Sized_relobj::do_layout): Change calls to include_section_group and
11006 include_linkonce_section.
11007 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11008 value to zero when section is discarded.
11009 (Sized_relobj::map_to_kept_section): New function.
11010 * object.h (Relobj::output_section_address): New function.
11011 (Relobj::Comdat_group): New type.
11012 (Relobj::find_comdat_group): New function.
11013 (Relobj::Comdat_group_table): New type.
11014 (Relobj::Kept_comdat_section): New type.
11015 (Relobj::Kept_comdat_section_table): New type.
11016 (Relobj::add_comdat_group): New function.
11017 (Relobj::set_kept_comdat_section): New function.
11018 (Relobj::get_kept_comdat_section): New function.
11019 (Relobj::comdat_groups_): New field.
11020 (Relobj::kept_comdat_sections_): New field.
11021 (Symbol_value::input_value): Update comment.
11022 (Sized_relobj::map_to_kept_section) New function.
11023 (Sized_relobj::include_linkonce_section): Add new parameter.
11024 * target-reloc.h (Comdat_behavior): New type.
11025 (get_comdat_behavior): New function.
11026 (relocate_section): Add code to map a discarded section to the
11027 corresponding kept section when applying a relocation.
11029 2008-04-30 Craig Silverstein <csilvers@google.com>
11031 * dwarf_reader.cc (next_generation_count): New static var.
11032 (Addr2line_cache_entry): New struct.
11033 (addr2line_cache): New static var.
11034 (Dwarf_line_info::one_addr2line): Added caching.
11035 (Dwarf_line_info::clear_addr2line_cache): New function.
11036 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11037 cache-size parameter.
11038 (Dwarf_line_info::one_addr2line_cache): New function.
11039 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11040 new cache-size argument to one_addr2line(), and clear cache.
11042 2008-04-28 Cary Coutant <ccoutant@google.com>
11044 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11045 R_386_PC8 relocations.
11047 2008-04-23 Ian Lance Taylor <iant@google.com>
11049 * object.cc (Sized_relobj::include_section_group): Check for
11050 invalid section group.
11052 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11055 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11056 than read for file header.
11057 * archive.cc (Archive::include_member): Likewise.
11059 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11061 * aclocal.m4: Regenerate.
11062 * configure: Regenerate.
11064 2008-04-19 Ian Lance Taylor <iant@google.com>
11066 * version.cc (version_string): Bump to 1.6.
11068 * testsuite/Makefile.am (many_sections_r_test): New target.
11069 (many_sections_r_test_SOURCES): Remove.
11070 (many_sections_r_test_DEPENDENCIES): Remove.
11071 (many_sections_r_test_LDFLAGS): Remove.
11072 (many_sections_r_test_LDADD): Remove.
11074 * object.cc (Sized_relobj::do_add_symbols): Always pass
11075 local_symbol_count_ to add_from_relobj.
11077 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11078 every thousand variables.
11079 * testsuite/Makefile.in: Rebuild.
11081 * object.cc (Xindex::initialize_symtab_xindex): New function.
11082 (Xindex::read_symtab_xindex): New function.
11083 (Xindex::sym_xindex_to_shndx): New function.
11084 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11086 (Sized_relobj::do_initialize_xindex): New function.
11087 (Sized_relobj::do_read_symbols): Adjust section links.
11088 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11089 parameter. Change all callers.
11090 (Sized_relobj::include_section_group): Adjust section links and
11091 symbol section indexes.
11092 (Sized_relobj::do_layout): Adjust section links.
11093 (Sized_relobj::do_count_local_symbols): Adjust section links and
11094 symbol section indexes.
11095 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11096 ordinary and special symbols.
11097 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11098 dynsym_xindex parameters. Change all callers. Adjust section
11099 links. Use SHN_XINDEX when needed.
11100 (Sized_relobj::get_symbol_location_info): Adjust section links.
11101 Don't get fooled by special symbols.
11102 * object.h (class Xindex): Define.
11103 (class Object): Add xindex_ parameter. Declare virtual functoin
11104 do_initialize_xindex.
11105 (Object::adjust_sym_shndx): New function.
11106 (Object::set_xindex): New protected function.
11107 (class Symbol_value): Add is_ordinary_shndx_ field.
11108 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11109 (Symbol_value::value): Assert ordinary section.
11110 (Symbol_value::initialize_input_to_output_map): Likewise.
11111 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11112 Change all callers.
11113 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11115 (class Sized_relobj): Update declarations.
11116 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11117 parameter. Change all callers.
11118 (Sized_relobj::adjust_shndx): New function.
11119 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11121 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11122 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11123 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11124 (Sized_dynobj::read_dynsym_section): Adjust section links.
11125 (Sized_dynobj::read_dynamic): Likewise.
11126 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11128 (Sized_dynobj::do_initialize_xindex): New function.
11129 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11130 do_initialize_xindex.
11131 (Sized_dynobj::adjust_shndx): New function.
11132 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11133 dynsym_xindex_ fields.
11134 (Layout::finalize): Add a call to set_section_indexes before
11135 creating the symtab sections.
11136 (Layout::set_section_indexes): Don't do anything if the section
11137 already has a section index.
11138 (Layout::create_symtab_sections): Add shnum parameter. Change
11139 caller. Create .symtab_shndx section if needed.
11140 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11142 (Layout::allocated_output_section_count): New function.
11143 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11145 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11146 fields. Update declarations.
11147 (Layout::symtab_xindex): New function.
11148 (Layout::dynsym_xindex): New function.
11149 (class Write_symbols_task): Add layout_ field.
11150 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11152 * output.cc (Output_section_headers::Output_section_headers): Add
11153 shstrtab_section parameter. Change all callers.
11154 (Output_section_headers::do_sized_write): Store overflow values
11155 for section count and section string table section index in
11156 section header zero.
11157 (Output_file_header::do_sized_write): Check for overflow of
11158 section count and section string table section index.
11159 (Output_symtab_xindex::do_write): New function.
11160 (Output_symtab_xindex::endian_do_write): New function.
11161 * output.h (class Output_section_headers): Add shstrtab_section_.
11162 Update declarations.
11163 (class Output_symtab_xindex): Define.
11164 (Output_section::has_out_shndx): New function.
11165 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11167 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11168 Change all callers.
11169 (Sized_symbol::init): Likewise.
11170 (Symbol::output_section): Check for ordinary symbol.
11171 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11172 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11174 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11175 Change all callers. Simplify handling of symbols from sections
11176 not included in the link.
11177 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11179 (Weak_alias_sorter::operator()): Assert that symbols are
11181 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11183 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11184 parameters. Change all callers.
11185 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11186 symbol distinction. Use SHN_XINDEX when needed.
11187 (Symbol_table::write_section_symbol): Add symtab_xindex
11188 parameter. Change all callers.
11189 (Symbol_table::sized_write_section_symbol): Likewise. Use
11190 SHN_XINDEX when needed.
11191 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11193 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11194 (Symbol::is_defined): Check is_ordinary.
11195 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11196 (Symbol::is_absolute, Symbol::is_common): Likewise.
11197 (class Sized_symbol): Update declarations.
11198 (class Symbol_table): Update declarations.
11199 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11200 parameters. Change all callers.
11201 (Sized_symbol::override): Likewise.
11202 (Symbol_table::override): Likewise.
11203 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11204 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11205 is_ordinary, and orig_st_shndx parameters. Change all callers.
11206 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11207 to be in an ordinary section.
11208 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11209 object and is_ordinary parameters. Change all callers.
11210 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11211 Change all callers. Don't add undefined or non-ordinary symbols
11213 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11214 Change all callers.
11215 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11217 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11218 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11219 (Sized_relobj::relocate_sections): Likewise.
11220 * target-reloc.h (scan_relocs): Adjust section symbol index.
11221 (scan_relocatable_relocs): Likewise.
11222 * i386.cc (Scan::local): Check for ordinary symbols.
11223 * sparc.cc (Scan::local): Likewise.
11224 * x86_64.cc (Scan::local): Likewise.
11225 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11226 to symbol_section_and_value.
11227 * testsuite/many_sections_test.cc: New file.
11228 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11229 (check_PROGRAMS): Add many_sections_test.
11230 (many_sections_test_SOURCES): Define.
11231 (many_sections_test_DEPENDENCIES): Define.
11232 (many_sections_test_LDFLAGS): Define.
11233 (BUILT_SOURCES): Add many_sections_define.h.
11234 (many_sections_define.h): New target.
11235 (BUILT_SOURCES): Add many_sections_check.h.
11236 (many_sections_check.h): New target.
11237 (check_PROGRAMS): Add many_sections_r_test.
11238 (many_sections_r_test_SOURCES): Define.
11239 (many_sections_r_test_DEPENDENCIES): Define.
11240 (many_sections_r_test_LDFLAGS): Define.
11241 (many_sections_r_test_LDADD): Define.
11242 (many_sections_r_test.o): New target.
11243 * testsuite/Makefile.in: Rebuild.
11245 2008-04-17 Cary Coutant <ccoutant@google.com>
11247 * errors.cc (Errors::info): New function.
11248 (gold_info): New function.
11249 * errors.h (Errors::info): New function.
11250 * gold.h (gold_info): New function.
11251 * object.cc (Input_objects::add_object): Print trace output.
11252 * options.cc (options::parse_set): New function.
11253 (General_options::parse_wrap): Deleted.
11254 (General_options::General_options): Deleted initializer.
11255 * options.h (options::String_set): New typedef.
11256 (options::parse_set): New function.
11257 (DEFINE_set): New macro.
11258 (General_options::wrap): Changed to use DEFINE_set. Changed
11259 callers of any_wrap_symbols and is_wrap_symbol.
11260 (General_options::trace, General_options::trace_symbol):
11262 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11263 (General_options::wrap_symbols_): Deleted.
11264 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11266 2008-04-17 David S. Miller <davem@davemloft.net>
11268 * options.cc (General_options::parse_V): New function.
11269 * options.h: Add entries for -V and -Qy.
11271 2008-04-17 Ian Lance Taylor <iant@google.com>
11273 * common.cc (Symbol_table::allocate_commons): Remove options
11274 parameter. Change caller.
11275 (Symbol_table::do_allocate_commons): Remove options parameter.
11276 Change caller. Just call do_allocate_commons_list twice.
11277 (Symbol_table::do_allocate_commons_list): New function, broken out
11278 of do_allocate_commons.
11279 * common.h (class Allocate_commons_task): Remove options_ field.
11280 Update constructor.
11281 * symtab.cc (Symbol_table::Symbol_table): Initialize
11283 (Symbol_table::add_from_object): Put TLS common symbols on
11285 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11286 which are IN_OUTPUT_DATA.
11287 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11288 allocate_commons and do_allocate_commons declarations. Declare
11289 do_allocate_commons_list.
11290 * gold.cc (queue_middle_tasks): Update creation of
11291 Allocate_commons_task to not pass options.
11292 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11293 (TLS_TEST_C_FLAGS): New variable.
11294 (tls_test_c_pic.o): New target.
11295 (tls_test_shared.so): Link in tls_test_c_pic.o.
11296 (tls_test_c_pic_ie.o): New target.
11297 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11298 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11299 (tls_test_c.o): New target.
11300 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11301 (tls_pic_test_LDADD): Likewise.
11302 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11303 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11304 (tls_test_c_gnu2.o): New target.
11305 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11307 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11308 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11309 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11310 * testsuite/tls_test.cc: Include "config.h".
11311 (t_last): Call t11_last.
11312 * testsuite/tls_test.h (t11, t11_last): Declare.
11313 * testsuite/tls_test_c.c: New file.
11314 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11315 * configure.ac: Check for OpenMP support.
11316 * configure, config.in, Makefile.in: Rebuild.
11317 * testsuite/Makefile.in: Rebuild.
11319 2008-04-16 Cary Coutant <ccoutant@google.com>
11321 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11322 (Target_i386::tls_base_symbol_defined_): New field.
11323 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11324 (Target_i386::Scan::global): Likewise.
11325 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11326 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11327 (Target_x86_64::tls_base_symbol_defined_): New field.
11328 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11329 (Target_x86_64::Scan::global): Likewise.
11331 2008-04-16 Cary Coutant <ccoutant@google.com>
11333 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11334 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11335 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11336 building shared libraries.
11337 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11338 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11339 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11340 * testsuite/Makefile.in: Rebuild.
11341 * testsuite/weak_undef.h: New file.
11342 * testsuite/weak_undef_file1.cc: Add extra test cases.
11343 * testsuite/weak_undef_file2.cc: Likewise.
11344 * testsuite/weak_undef_test.cc: Likewise.
11346 2008-04-16 David S. Miller <davem@davemloft.net>
11348 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11349 Add issued_non_pic_error_ field. Declare check_non_pic.
11350 (Target_sparc::Scan::check_non_pic): New function.
11351 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11352 (Target_sparc::Scan::global): Likewise.
11354 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11355 * configure: Rebuild.
11357 * options.h (DEFINE_enable): New macro.
11358 (new_dtags): New enable option.
11359 (initfirst, interpose, loadfltr, nodefaultlib,
11360 nodelete, nodlopen, nodump): New -z options.
11361 * layout.cc (Layout:finish_dynamic_section): If new
11362 dtags enabled, emit DT_RUNPATH. Also, emit a
11363 DT_FLAGS_1 containing any specified -z flags.
11365 2008-04-16 Ian Lance Taylor <iant@google.com>
11367 * copy-relocs.cc: New file.
11368 * copy-relocs.h: New file.
11369 * reloc.cc: Remove Copy_relocs code.
11370 * reloc.h: Likewise.
11371 * reloc-types.h (struct Reloc_types) [both versions]: Add
11372 get_reloc_addend_noerror.
11373 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11374 variants of add_global which take an addend which must be zero.
11375 * i386.cc: Include "copy-relocs.h".
11376 (class Target_i386): Change type of copy_relocs_ to variable,
11377 update initializer.
11378 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11379 Change all callers.
11380 (Target_i386::do_finalize_sections): Change handling of
11382 * sparc.cc: Include "copy-relocs.h".
11383 (class Target_sparc): Change type of copy_relocs_ to variable,
11384 update initializer.
11385 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11386 Change all callers.
11387 (Target_sparc::do_finalize_sections): Change handling of
11389 * x86_64.cc: Include "copy-relocs.h".
11390 (class Target_x86_64): Change type of copy_relocs_ to variable,
11391 update initializer.
11392 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11393 class. Change all callers.
11394 (Target_x86_64::do_finalize_sections): Change handling of
11396 * Makefile.am (CCFILES): Add copy-relocs.cc.
11397 (HFILES): Add copy-relocs.h.
11399 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11401 * testsuite/script_test_4.sh: Permit leading zeroes.
11403 2008-04-15 Ian Lance Taylor <iant@google.com>
11405 * script-sections.cc (Script_sections::create_segments): Use
11406 header_size_adjustment even when there is enough room for the
11408 * testsuite/script_test_4.sh: New file.
11409 * testsuite/script_test_4.t: New file.
11410 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11411 (check_DATA): Add script_test_4.stdout.
11412 (MOSTLYCLEANFILES): Likewise.
11413 (script_test_4): New target.
11414 (script_test_4.stdout): New target.
11415 * testsuite/Makefile.in: Rebuild.
11417 * sparc.cc: Add definitions for Output_data_plt_sparc class
11420 2008-04-14 David S. Miller <davem@davemloft.net>
11422 * sparc.cc: New file.
11423 * Makefile.am (TARGETSOURCES): Add sparc.cc
11424 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11425 * configure.tgt: Document targ_extra_size and
11426 targ_extra_big_endian. Add entries for sparc-* and
11428 * configure.ac: Handle targ_extra_size and
11429 targ_extra_big_endian.
11430 * Makefile.in: Rebuild.
11431 * configure: Likewise.
11432 * po/POTFILES.in: Likewise.
11433 * po/gold.pot: Likewise.
11435 2008-04-14 Ian Lance Taylor <iant@google.com>
11437 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11438 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11439 in the name/type/flags to section mapping. Don't call
11440 allocate_output_section.
11441 (Layout::choose_output_section): Change parameter from adjust_name
11442 to is_input_section. Don't permit input sections after sections
11443 are attached to segments. Don't call allocate_output_section.
11444 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11445 not write_enable_output_section.
11446 (Layout::make_output_section): Don't push to
11447 unattached_section_list_ nor call attach_to_segment. Call
11448 attach_section_to_segment if sections are attached.
11449 (Layout::attach_sections_to_segments): New function.
11450 (Layout::attach_section_to_segment): New function.
11451 (Layout::attach_allocated_section_to_segment): Rename from
11452 attach_to_segment. Remove flags parameter.
11453 (Layout::allocate_output_section): Remove function.
11454 (Layout::write_enable_output_section): Remove function.
11455 * layout.h (class Layout): Update for above changes. Add new
11456 field sections_are_attached_.
11457 * output.h (Output_section::update_flags_for_input_section): New
11459 * output.cc (Output_section::add_input_section): Call
11460 update_flags_for_input_section.
11461 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11463 2008-04-11 Cary Coutant <ccoutant@google.com>
11465 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11466 thought unnecessary.
11467 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11469 2008-04-11 Ian Lance Taylor <iant@google.com>
11471 * output.h (class Output_section_data): Remove inline definition
11473 * output.cc (Output_section_data::set_addralign): New function.
11475 2008-04-11 Cary Coutant <ccoutant@google.com>
11477 Add support for TLS descriptors for i386 and x86_64.
11478 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11479 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11480 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11482 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11483 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11484 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11486 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11487 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11488 Fix problem with initial-exec relocations.
11489 (Target_i386::Relocate::relocate_tls): Likewise.
11490 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11492 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11493 support for section-plus-offset dynamic table entries.
11494 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11495 (Output_data_dynamic::Dynamic_entry): Add support for
11496 section-plus-offset dynamic table entries.
11497 (Output_data_dynamic::Classification): Likewise.
11498 (Output_data_dynamic::classification_): Renamed offset_.
11499 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11500 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11501 (Target_x86_64::make_plt_section): New function.
11502 (Target_x86_64::reserve_tlsdesc_entries): New function.
11503 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11504 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11505 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11506 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11507 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11508 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11509 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11510 add extra PLT entry for TLS descriptors.
11511 (Output_data_plt_x86_64::got_): New field.
11512 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11513 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11515 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11517 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11518 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11519 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11520 R_386_TLS_DESC_CALL relocations.
11521 (Target_x86_64::Scan::global): Likewise.
11522 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11523 for TLS descriptors.
11524 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11525 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11526 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11527 GD-to-IE relaxation.
11528 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11529 and TLS_DESCRIPTORS.
11530 * Makefile.in: Rebuild.
11531 * configure: Rebuild.
11532 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11533 (tls_test_shared2.so): New target.
11534 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11535 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11536 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11537 (tls_shared_gd_to_ie_test_LDADD): New variable.
11538 (tls_shared_gnu2_gd_to_ie_test): New target.
11539 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11541 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11542 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11543 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11544 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11545 (tls_shared_gnu2_test): New target.
11546 (tls_test_gnu2_shared.so): New target.
11547 (tls_shared_gnu2_test_SOURCES): New variable.
11548 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11549 (tls_shared_gnu2_test_LDFLAGS): New variable.
11550 (tls_shared_gnu2_test_LDADD): New variable.
11551 * testsuite/Makefile.in: Rebuild.
11552 * testsuite/Makefile.
11554 2008-04-11 Ian Lance Taylor <iant@google.com>
11556 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11558 * testsuite/Makefile.in: Rebuild.
11560 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11562 * testsuite/script_test_2.cc (main): Adjust test.
11564 2008-04-11 David S. Miller <davem@davemloft.net>
11565 Ian Lance Taylor <iant@google.com>
11567 * options.h (General_options): Add entries for '-Y' and
11569 * options.cc (General_options:finalize): If -Y was used, add those
11570 entries to the library path instead of the default "/lib" and
11573 2008-04-11 David S. Miller <davem@davemloft.net>
11575 * testsuite/justsyms.t: Start at 0x100.
11576 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11577 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11579 * testsuite/script_test_2.cc: Adjust string and section length
11582 2008-04-09 Ian Lance Taylor <iant@google.com>
11585 * script-sections.cc (Sections_element::allocate_to_segment): Add
11587 (Output_section_definition::allocate_to_segment): Likewise.
11588 (Orphan_output_section::allocate_to_segment): Likewise.
11589 (Script_sections::attach_sections_using_phdrs_clause): Don't
11590 propagate non-PT_LOAD segments to orphan sections.
11591 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11592 readelf rather than objdump.
11593 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11594 .interp section and PT_INTERP segment are the same size.
11595 * testsuite/Makefile.in: Rebuild.
11597 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11598 aliases for symbols defined in the same object.
11599 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11600 (weak_alias_test_SOURCES): New variable.
11601 (weak_alias_test_DEPENDENCIES): New variable.
11602 (weak_alias_test_LDFLAGS): New variable.
11603 (weak_alias_test_LDADD): New variable.
11604 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11605 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11606 (weak_alias_test_3.o): New target.
11607 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11608 * testsuite/weak_alias_test_main.cc: New file.
11609 * testsuite/weak_alias_test_1.cc: New file.
11610 * testsuite/weak_alias_test_2.cc: New file.
11611 * testsuite/weak_alias_test_3.cc: New file.
11613 2008-04-08 Ian Lance Taylor <iant@google.com>
11615 * options.h (class General_options): Add --noinhibit-exec option.
11616 * main.cc (main): Check --noinhibit-exec.
11618 * options.h (class General_options): Define --wrap as a special
11619 option. Add wrap_symbols_ field.
11620 (General_options::any_wrap_symbols): New function.
11621 (General_options::is_wrap_symbol): New function.
11622 * options.cc (General_options::parse_wrap): New function.
11623 (General_options::General_options): Initialize wrap_symbols_.
11624 * symtab.cc (Symbol_table::wrap_symbol): New function.
11625 (Symbol_table::add_from_object): Handle --wrap.
11626 * symtab.h (class Symbol_table): Declare wrap_symbol.
11627 * target.h (Target::wrap_char): New function.
11628 (Target::Target_info): Add wrap_char field.
11629 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11630 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11631 * testsuite/testfile.cc (Target_test::test_target_info):
11634 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11637 * layout.h (class Layout): Add added_eh_frame_data_ field.
11638 * layout.cc (Layout::Layout): Initialize new field.
11639 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11640 output section until we find a section we merged successfully.
11641 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11642 that the size be non-zero.
11644 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11647 2008-04-08 Craig Silverstein <csilvers@google.com>
11649 * configure.ac: Export new conditional variable HAVE_ZLIB.
11650 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11652 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11653 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11655 2008-04-07 Ian Lance Taylor <iant@google.com>
11657 * version.cc (version_string): Set to "1.5".
11659 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11660 Add issued_non_pic_error_ field. Declare check_non_pic.
11661 (Target_x86_64::Scan::check_non_pic): New function.
11662 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11663 (Target_x86_64::Scan::global): Likewise.
11665 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11666 addend parameter. Change caller. Handle merge sections.
11667 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11668 Address to Addend. Don't add in the result of
11669 local_section_offset, pass down the addend and use the returned
11671 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11672 Update declarations of local_section_offset and symbol_value.
11673 * testsuite/two_file_test_1.cc (t18): New function.
11674 * testsuite/two_file_test_2.cc (f18): New function.
11675 * testsuite/two_file_test_main.cc (main): Call t18.
11676 * testsuite/two_file_test.h (t18, f18): Declare.
11678 * configure.ac: Don't test for objdump, c++filt, or readelf.
11679 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11681 (TEST_READELF): New variable.
11682 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11683 (check_PROGRAMS): Add two_file_strip_test.
11684 (two_file_strip_test): New target.
11685 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11686 (two_file_same_shared_strip_test_SOURCES): New variable.
11687 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11688 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11689 (two_file_same_shared_strip_test_LDADD): New variable.
11690 (two_file_shared_strip.so): New target.
11691 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11692 (ver_test_5.syms, ver_test_7.syms): Likewise.
11693 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11694 (strip_test_3.stdout): Use TEST_OBJDUMP.
11695 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11697 2008-04-04 Cary Coutant <ccoutant@google.com>
11699 * symtab.h (Symbol::is_weak_undefined): New function.
11700 (Symbol::is_strong_undefined): New function.
11701 (Symbol::is_absolute): New function.
11702 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11703 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11705 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11706 (weak_undef_test): New target.
11707 * testsuite/Makefile.in: Rebuild.
11708 * testsuite/weak_undef_file1.cc: New file.
11709 * testsuite/weak_undef_file2.cc: New file.
11710 * testsuite/weak_undef_test.cc: New file.
11712 2008-04-03 Craig Silverstein <csilvers@google.com>
11714 * compressed_output.h (class Output_compressed_section): Use
11716 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11718 (zlib_compressed_suffix): Removed.
11719 (Output_compressed_section::set_final_data_size): Use unsigned
11721 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11722 Fix linker invocation.
11723 (flagstest_o_specialfile_and_compress_debug_sections):
11725 * testsuite/Makefile.in: Regenerated.
11727 2008-04-02 David S. Miller <davem@davemloft.net>
11729 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11730 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11732 2008-04-02 Craig Silverstein <csilvers@google.com>
11736 2008-04-02 Ian Lance Taylor <iant@google.com>
11738 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11739 parameters. Update for new key type to views_. Change all
11741 (File_read::read): Adjust for byteshift in returned view.
11742 (File_read::add_view): New function, broken out of
11743 find_and_make_view.
11744 (File_read::make_view): New function, broken out of
11745 find_and_make_view.
11746 (File_read::find_or_make_view): Add offset and aligned
11747 parameters. Rewrite accordingly. Change all callers.
11748 (File_read::get_view): Add offset and aligned parameters. Adjust
11749 for byteshift in return value.
11750 (File_read::get_lasting_view): Likewise.
11751 * fileread.h (class File_read): Update declarations.
11752 (class File_read::View): Add byteshift_ field. Add byteshift to
11753 constructor. Add byteshift method.
11754 * archive.h (Archive::clear_uncached_views): New function.
11755 (Archive::get_view): Add aligned parameter. Change all callers.
11756 * object.h (Object::get_view): Add aligned parameter. Change all
11758 (Object::get_lasting_view): Likewise.
11760 * fileread.cc (File_read::release): Don't call clear_views if
11761 there are multiple objects.
11762 * fileread.h (File_read::clear_uncached_views): New function.
11763 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11766 2008-03-31 Cary Coutant <ccoutant@google.com>
11768 Add thin archive support.
11769 * archive.cc (Archive::armagt): New const.
11770 (Archive::setup): Remove task parameter and calls to unlock.
11771 (Archive::unlock_nested_archives): New function.
11772 (Archive::read_header): Add nested_off parameter. Change
11774 (Archive::interpret_header): Likewise.
11775 (Archive::include_all_members): Change to handle thin
11777 (Archive::include_member): Likewise.
11778 * archive.h (Archive::Archive): Add new parameters and
11780 (Archive::armagt): New const.
11781 (Archive::setup): Remove task parameter.
11782 (Archive::unlock_nested_archives): New function.
11783 (Archive::read_header): Add nested_off parameter.
11784 (Archive::interpret_header): Likewise.
11785 (Archive::Nested_archive_table): New typedef.
11786 (Archive::is_thin_archive_): New field.
11787 (Archive::nested_archives_): New field.
11788 (Archive::options_): New field.
11789 (Archive::dirpath_): New field.
11790 (Archive::task_): New field.
11791 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11792 for thin archives. Pass additional parameters to
11793 Archive::Archive. Unlock the archive file after calling
11796 2008-03-29 Ian Lance Taylor <iant@google.com>
11798 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11799 version symbol to be local.
11800 * testsuite/ver_test_4.sh: New file.
11801 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11802 (check_DATA): Add ver_test_4.syms.
11803 (ver_test_4.syms): New target.
11804 * testsuite/Makefile.in: Rebuild.
11807 (Output_section::Input_section_sort_entry::has_priority): New
11809 (Output_section::Input_section_sort_entry::match_file_name): New
11811 (Output_section::Input_section_sort_entry::match_section_name):
11813 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11815 (Output_section::Input_section_sort_entry::match_section_file):
11817 (Output_section::Input_section_sort_compare::operator()): Rewrite
11818 using new Input_section_sort_entry functions. Sort crtbegin and
11819 crtend first. Sort sections with no priority before sections with
11821 * testsuite/initpri1.c (d3): Check j != 4.
11822 (cd5): New constructor/destructor function.
11823 (main): Check j != 2.
11825 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11826 new symbol when resolving, don't call set_is_default.
11827 * testsuite/ver_test_7.cc: New file.
11828 * testsuite/ver_test_7.sh: New file.
11829 * testsuite/Makefile.am (ver_test_7.so): New target.
11830 (ver_test_7.o): New target.
11831 (check_SCRIPTS): Add ver_test_7.sh.
11832 (check_DATA): Add ver_test_7.syms.
11833 (ver_test_7.syms): New target.
11835 2008-03-28 Ian Lance Taylor <iant@google.com>
11837 * layout.cc (Layout::layout): If we see an input section with a
11838 name that needs sorting, set the must_sort flag for the output
11840 (Layout::make_output_section): If the name of the output section
11841 indicates that it might require sorting, set the may_sort flag.
11842 * output.h (Output_section::may_sort_attached_input_sections): New
11844 (Output_section::set_may_sort_attached_input_sections): New
11846 (Output_section::must_sort_attached_input_sections): New
11848 (Output_section::set_must_sort_attached_input_sections): New
11850 (class Output_section): Declare Input_section_sort_entry. Define
11851 Input_section_sort_compare. Declare
11852 sort_attached_input_sections. Add new fields:
11853 may_sort_attached_input_sections_,
11854 must_sort_attached_input_sections_,
11855 attached_input_sections_are_sorted_.
11856 * output.cc (Output_section::Output_section): Initialize new
11858 (Output_section::add_input_section): Add an entry to
11859 input_sections_ if may_sort or must_sort are true.
11860 (Output_section::set_final_data_size): Call
11861 sort_attached_input_sections if necessary.
11862 (Output_section::Input_section_sort_entry): Define new class.
11863 (Output_section::Input_section_sort_compare::operator()): New
11865 (Output_section::sort_attached_input_sections): New function.
11866 * configure.ac: Check whether the compiler supports constructor
11867 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11868 * testsuite/initpri1.c: New file.
11869 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11870 CONSTRUCTOR_PRIORITY.
11871 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11872 (initpri1_LDFLAGS): New variable.
11873 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11875 2008-03-27 Ian Lance Taylor <iant@google.com>
11877 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11878 * testsuite/common_test_1.c: New file.
11879 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11880 (common_test_1_SOURCES): New variable.
11881 (common_test_1_DEPENDENCIES): New variable.
11882 (common_test_1_LDFLAGS): New variable.
11884 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11885 and commons_ correctly when NAME/VERSION does not override
11887 * testsuite/ver_test_6.c: New file.
11888 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11889 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11890 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11892 2008-03-26 Ian Lance Taylor <iant@google.com>
11894 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11895 of an undefined symbol from a version script.
11896 * testsuite/Makefile.am (ver_test_5.so): New target.
11897 (ver_test_5.o): New target.
11898 (check_SCRIPTS): Add ver_test_5.sh.
11899 (check_DATA): Add ver_test_5.syms.
11900 (ver_test_5.syms): New target.
11901 * testsuite/ver_test_5.cc: New file.
11902 * testsuite/ver_test_5.script: New file.
11903 * testsuite/ver_test_5.sh: New file.
11904 * Makefile.in, testsuite/Makefile.in: Rebuild.
11907 Fix problems building gold with gcc 4.3.0.
11908 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11909 (gold_error_at_location, gold_warning_at_location): Use it.
11910 * configure.ac: Check whether we can compile and use a template
11911 function with a printf attribute.
11912 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11913 when jumping over bytes.
11914 * object.cc: Instantiate Object::read_section_data.
11915 * debug.h: Include <cstring>
11916 * dwarf_reader.cc: Include <algorithm>
11917 * main.cc: Include <cstring>.
11918 * options.cc: Include <cstring>.
11919 * output.cc: Include <cstring>.
11920 * script.cc: Include <cstring>.
11921 * script.h: Include <string>.
11922 * symtab.cc: Include <cstring> and <algorithm>.
11923 * target-select.cc: Include <cstring>.
11924 * version.cc: Include <string>.
11925 * testsuite/testmain.cc: Include <cstdlib>.
11926 * configure, config.in: Rebuild.
11928 2008-03-25 Ian Lance Taylor <iant@google.com>
11930 * options.cc: Include "../bfd/bfdver.h".
11931 (options::help): Print bug reporting address.
11933 * version.cc (print_version): Adjust output for current value of
11934 BFD_VERSION_STRING.
11938 * options.cc (options::help): Print list of supported targets.
11939 * target-select.h: Include <vector>.
11940 (class Target_selector): Make machine_, size_, and is_big_endian_
11941 fields const. Add bfd_name_ and instantiated_target_ fields.
11942 (Target_selector::Target_selector): Add bfd_name parameter.
11943 (Target_selector::recognize): Make non-virtual, call
11945 (Target_selector::recognize_by_name): Make non-virtual, call
11946 do_recognize_by_name.
11947 (Target_selector::supported_names): New function.
11948 (Target_selector::bfd_name): New function.
11949 (Target_selector::do_instantiate_target): New pure virtual
11951 (Target_selector::do_recognize): New virtual function.
11952 (Target_selector::do_recognize_by_name): New virtual function.
11953 (Target_selector::instantiate_target): New private function.
11954 (supported_target_names): Declare.
11955 * target-select.cc (Target_selector::Target_selector): Update for
11956 new parameter and fields.
11957 (select_target_by_name): Check that the name matches before
11958 calling recognize_by_name.
11959 (supported_target_names): New function.
11960 * i386.cc (class Target_selector_i386): Update Target_selector
11961 constructor call. Remove recognize and recognize_by_name. Add
11962 do_instantiate_target.
11963 * x86_64.cc (class Target_selector_x86_64): Likewise.
11964 * testsuite/testfile.cc (class Target_selector_test): Update for
11965 changes to Target_selector.
11967 * README: Rewrite, with some notes on unsupported features.
11969 2008-03-24 Cary Coutant <ccoutant@google.com>
11971 * i386.cc (Target_i386::Got_type): New enum declaration.
11972 (Target_i386::Scan::local): Updated callers of Output_data_got
11974 (Target_i386::Scan::global): Likewise.
11975 (Target_i386::Relocate::relocate): Likewise.
11976 (Target_i386::Relocate::relocate_tls): Likewise.
11977 * object.h (Got_offset_list): New class.
11978 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11979 (Sized_relobj::local_got_offset): Likewise.
11980 (Sized_relobj::set_local_got_offset): Likewise.
11981 (Sized_relobj::local_has_tls_got_offset): Removed.
11982 (Sized_relobj::local_tls_got_offset): Removed.
11983 (Sized_relobj::set_local_tls_got_offset): Removed.
11984 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11985 * output.cc (Output_data_got::add_global): Added got_type parameter.
11986 (Output_data_got::add_global_with_rel): Likewise.
11987 (Output_data_got::add_global_with_rela): Likewise.
11988 (Output_data_got::add_global_pair_with_rel): New function.
11989 (Output_data_got::add_global_pair_with_rela): New function.
11990 (Output_data_got::add_local): Added got_type parameter.
11991 (Output_data_got::add_local_with_rel): Likewise.
11992 (Output_data_got::add_local_with_rela): Likewise.
11993 (Output_data_got::add_local_pair_with_rel): New function.
11994 (Output_data_got::add_local_pair_with_rela): New function.
11995 (Output_data_got::add_global_tls): Removed.
11996 (Output_data_got::add_global_tls_with_rel): Removed.
11997 (Output_data_got::add_global_tls_with_rela): Removed.
11998 (Output_data_got::add_local_tls): Removed.
11999 (Output_data_got::add_local_tls_with_rel): Removed.
12000 (Output_data_got::add_local_tls_with_rela): Removed.
12001 * output.h (Output_data_got::add_global): Added got_type parameter.
12002 (Output_data_got::add_global_with_rel): Likewise.
12003 (Output_data_got::add_global_with_rela): Likewise.
12004 (Output_data_got::add_global_pair_with_rel): New function.
12005 (Output_data_got::add_global_pair_with_rela): New function.
12006 (Output_data_got::add_local): Added got_type parameter.
12007 (Output_data_got::add_local_with_rel): Likewise.
12008 (Output_data_got::add_local_with_rela): Likewise.
12009 (Output_data_got::add_local_pair_with_rel): New function.
12010 (Output_data_got::add_local_pair_with_rela): New function.
12011 (Output_data_got::add_global_tls): Removed.
12012 (Output_data_got::add_global_tls_with_rel): Removed.
12013 (Output_data_got::add_global_tls_with_rela): Removed.
12014 (Output_data_got::add_local_tls): Removed.
12015 (Output_data_got::add_local_tls_with_rel): Removed.
12016 (Output_data_got::add_local_tls_with_rela): Removed.
12017 * resolve.cc (Symbol::override_base_with_special): Removed
12018 reference to has_got_offset_ field.
12019 * symtab.cc (Symbol::init_fields): Replaced initialization
12020 of got_offset_ with got_offsets_. Removed initialization
12022 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12023 (Symbol::got_offset): Likewise.
12024 (Symbol::set_got_offset): Likewise.
12025 (Symbol::has_tls_got_offset): Removed.
12026 (Symbol::tls_got_offset): Removed.
12027 (Symbol::set_tls_got_offset): Removed.
12028 (Symbol::got_offset_): Removed.
12029 (Symbol::tls_mod_got_offset_): Removed.
12030 (Symbol::tls_pair_got_offset_): Removed.
12031 (Symbol::got_offsets_): New field.
12032 (Symbol::has_got_offset): Removed.
12033 (Symbol::has_tls_mod_got_offset): Removed.
12034 (Symbol::has_tls_pair_got_offset): Removed.
12035 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12036 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12038 (Target_x86_64::Scan::global): Likewise.
12039 (Target_x86_64::Relocate::relocate): Likewise.
12040 (Target_x86_64::Relocate::relocate_tls): Likewise.
12042 2008-03-25 Ben Elliston <bje@au.ibm.com>
12044 * yyscript.y: Fix spelling error in comment.
12046 2008-03-24 Ian Lance Taylor <iant@google.com>
12048 * options.h (class General_options): Define build_id option.
12049 * layout.h (class Layout): Declare write_build_id, create_note,
12050 create_build_id. Add build_id_note_ member.
12051 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12052 "libiberty.h", "md5.h", "sha1.h".
12053 (Layout::Layout): Initialize eh_frame_data_,
12054 eh_frame_hdr_section_, and build_id_note_.
12055 (Layout::finalize): Call create_build_id.
12056 (Layout::create_note): New function, broken out of
12057 Layout::create_gold_note.
12058 (Layout::create_gold_note): Call create_note.
12059 (Layout::create_build_id): New function.
12060 (Layout::write_build_id): New function.
12061 (Close_task_runner::run): Call write_build_id.
12063 * x86_64.cc: Correct license to GPLv3.
12065 2008-03-23 Ian Lance Taylor <iant@google.com>
12067 * options.cc: Include "demangle.h".
12068 (parse_optional_string): New function.
12069 (parse_long_option): Handle takes_optional_argument.
12070 (parse_short_option): Update dash_z initializer. Handle
12071 takes_optional_argument.
12072 (General_options::General_options): Initialize do_demangle_.
12073 (General_options::finalize): Set do_demangle_. Handle demangling
12075 * options.h (parse_optional_string): Declare.
12076 (struct One_option): Add optional_arg field. Update constructor.
12077 Update call constructor calls. Add takes_optional_argument
12079 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12080 (DEFINE_optional_string): Define.
12081 (General_options::demangle): Change from DEFINE_bool to
12082 DEFINE_optional_string.
12083 (General_options::no_demangle): New function.
12084 (General_options::do_demangle): New function.
12085 (General_options::set_do_demangle): New function.
12086 (General_options::execstack_status_): Move definition to end of
12088 (General_options::static_): Likewise.
12089 (General_options::do_demangle_): New field.
12090 * object.cc (big_endian>::get_symbol_location_info): Call
12091 Options::do_demangle, not Options::demangle.
12092 * symtab.cc (demangle): Likewise.
12094 2008-03-22 Ian Lance Taylor <iant@google.com>
12096 * gold.h: Include <cstddef> and <sys/types.h>
12097 * options.h: Include <cstring>.
12099 2008-03-21 Ian Lance Taylor <iant@google.com>
12101 * Added source code to GNU binutils.