1 2011-10-17 Cary Coutant <ccoutant@google.com>
4 * gold/fileread.cc (File_read::find_view): Add assert.
5 (File_read::make_view): Move bounds check (replace with assert)...
6 (File_read::find_or_make_view): ... to here.
8 2011-10-12 Cary Coutant <ccoutant@google.com>
10 * gold/output.cc (Output_file::open_base_file): Handle case where
11 ::read returns less than requested size.
13 2011-10-10 Cary Coutant <ccoutant@google.com>
15 * gold/incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
16 Initialize defined_count_.
17 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
18 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
19 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
20 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
21 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
22 * gold/incremental.h (Sized_relobj_incr::defined_count_): New data
24 (Sized_incr_dynobj::defined_count_): New data member.
25 * gold/plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
26 Return zeroes instead of internal error.
28 2011-10-10 Cary Coutant <ccoutant@google.com>
31 * gold/output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
32 (Output_reloc::symbol_value): Return PLT offset if flag is set.
33 * gold/output.h (class Output_reloc): Add use_plt_offset flag.
34 (Output_reloc::type_): Adjust size of bit field.
35 (Output_reloc::use_plt_offset_): New bit field.
36 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
37 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
38 flag. Adjust all callers.
39 * gold/x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
40 creating RELATIVE relocations.
42 2011-10-10 Nick Clifton <nickc@redhat.com>
44 * po/es.po: Updated Spanish translation.
45 * po/fi.po: Updated Finnish translation.
47 2011-10-03 Diego Novillo <dnovillo@google.com>
49 * options.cc (parse_uint): Fix dereference of RETVAL.
51 2011-09-29 Sriraman Tallam <tmsriram@google.com>
53 * layout.h (section_order_map_): New member.
54 (get_section_order_map): New member function.
55 * output.cc (Output_section::add_input_section): Check for patterns
56 only when --section-ordering-file is specified.
57 * gold.cc (queue_middle_tasks): Delay updating order of sections till
58 output_sections have been formed.
59 * layout.cc (Layout_Layout): Initialize section_order_map_.
60 * plugin.cc (update_section_order): Store order in order_map. Do not
62 * testsuite/Makefile.am: Add test case for plugin_final_layout.
63 * testsuite/Makefile.in: Regenerate.
64 * testsuite/plugin_section_order.c: New file.
65 * testsuite/plugin_final_layout.cc: New file.
66 * testsuite/plugin_final_layout.sh: New file.
68 2011-09-29 Cary Coutant <ccoutant@google.com>
70 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
72 * gold/symtab.cc (Symbol_table::add_from_relobj): Ignore version
73 symbols during incremental update.
74 (Symbol_table::add_from_dynobj): Likewise.
76 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
77 Ian Lance Taylor <iant@google.com>
79 * symtab.cc (Symbol_table::define_special_symbol): Always
80 canonicalize version string.
82 2011-09-26 Cary Coutant <ccoutant@google.com>
84 * gold/gold.cc (queue_initial_tasks): Move option checks ...
85 * gold/options.cc (General_options::finalize): ... to here. Disable
86 some options; make others fatal.
88 2011-09-26 Cary Coutant <ccoutant@google.com>
91 * plugin.cc (get_symbols_v2): New function.
92 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
93 (is_referenced_from_outside): New function.
94 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
95 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
96 (get_symbols): Pass version parameter.
97 (get_symbols_v2): New function.
98 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
100 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
101 (onload): Add LDPT_GET_SYMBOLS_V2.
102 (all_symbols_read_hook): Use get_symbols_v2; check for
103 LDPR_PREVAILING_DEF_IRONLY_EXP.
104 * testsuite/plugin_test_3.sh: Update expected results.
106 2011-09-23 Simon Baldwin <simonb@google.com>
108 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
109 configuration options.
110 * configure: Regenerate.
111 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
112 * Makefile.in: Regenerate.
113 * testsuite/Makefile.in: Regenerate.
115 2011-09-19 Sriraman Tallam <tmsriram@google.com>
117 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
119 2011-09-19 Cary Coutant <ccoutant@google.com>
121 * incremental.cc (can_incremental_update): Fix typo in comment.
122 * incremental.h (can_incremental_update): Likewise.
124 2011-09-18 Cary Coutant <ccoutant@google.com>
126 * incremental.cc (can_incremental_update): New function.
127 * incremental.h (can_incremental_update): New function.
128 * layout.cc (Layout::init_fixed_output_section): Call it.
129 (Layout::make_output_section): Don't allow patch space in .eh_frame.
130 * object.cc (Sized_relobj_file::do_layout): Call
131 can_incremental_update.
133 2011-09-13 Cary Coutant <ccoutant@google.com>
135 * configure.ac: Check for glibc support for gnu_indirect_function
136 support with static linking, setting automake conditional
138 * Makefile.in: Regenerate.
139 * configure: Regenerate.
141 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
142 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
144 * testsuite/Makefile.in: Regenerate.
146 2011-09-13 Cary Coutant <ccoutant@google.com>
148 * incremental.cc (Sized_relobj_incr::do_layout): Call
149 report_comdat_group for kept comdat sections.
150 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
151 * testsuite/Makefile.in: Regenerate.
152 * testsuite/incr_comdat_test_1.cc: New source file.
153 * testsuite/incr_comdat_test_2_v1.cc: New source file.
154 * testsuite/incr_comdat_test_2_v2.cc: New source file.
155 * testsuite/incr_comdat_test_2_v3.cc: New source file.
157 2011-09-13 Ian Lance Taylor <iant@google.com>
159 * object.cc (Sized_relobj_file::do_layout): Remove unused local
160 variable external_symbols_offset.
162 2011-09-12 Ian Lance Taylor <iant@google.com>
164 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
165 triggered if object has no symbols.
167 2011-09-09 David S. Miller <davem@davemloft.net>
169 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
170 (Output_fill_debug_line::do_write): Likewise.
172 2011-08-29 Cary Coutant <ccoutant@google.com>
174 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
175 casts to match formatting specs.
176 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
178 2011-08-26 Cary Coutant <ccoutant@google.com>
180 * layout.cc (Free_list::allocate): Provide guarantee of minimum
181 remaining hole size when allocating.
182 (Layout::make_output_section): Set fill methods for debug sections.
183 * layout.h (Free_list::Free_list_node): Move from private to
185 (Free_list::set_min_hole_size): New function.
186 (Free_list::begin, Free_list::end): New functions.
187 (Free_list::min_hole_): New data member.
188 * output.cc: Include dwarf.h.
189 (Output_fill_debug_info::do_minimum_hole_size): New function.
190 (Output_fill_debug_info::do_write): New function.
191 (Output_fill_debug_line::do_minimum_hole_size): New function.
192 (Output_fill_debug_line::do_write): New function.
193 (Output_section::Output_section): Initialize new data member.
194 (Output_section::set_final_data_size): Ensure patch space is larger
195 than minimum hole size.
196 (Output_section::do_write): Fill holes in debug sections.
197 * output.h (Output_fill): New class.
198 (Output_fill_debug_info): New class.
199 (Output_fill_debug_line): New class.
200 (Output_section::set_free_space_fill): New function.
201 (Output_section::free_space_fill_): New data member.
202 * testsuite/Makefile.am (incremental_test_3): Add
203 --incremental-patch option.
204 (incremental_test_4): Likewise.
205 (incremental_test_5): Likewise.
206 (incremental_test_6): Likewise.
207 (incremental_copy_test): Likewise.
208 (incremental_common_test_1): Likewise.
209 * testsuite/Makefile.in: Regenerate.
211 2011-08-26 Nick Clifton <nickc@redhat.com>
213 * po/es.po: Updated Spanish translation.
215 2011-08-01 Cary Coutant <ccoutant@google.com>
217 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
218 * gold/testsuite/Makefile.in: Regenerate.
219 * gold/testsuite/justsyms_exec.c: New source file.
220 * gold/testsuite/justsyms_lib.c: New source file.
222 2011-08-01 Cary Coutant <ccoutant@google.com>
224 * layout.cc (Layout::set_segment_offsets): Don't realign text
225 segment if -Ttext was specified.
226 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
228 * object.h (Sized_relobj_file::e_type): New function.
229 (Sized_relobj_file::e_type_): New data member.
230 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
231 base address for ET_EXEC files.
232 * target.cc (Target::do_make_elf_object_implementation): Allow
233 ET_EXEC files with --just-symbols option.
235 2011-07-28 Cary Coutant <ccoutant@google.com>
237 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
238 Add thread_number parameter.
239 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
240 * workqueue-threads.cc
241 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
242 current thread if its thread number is greater than desired thread
244 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
245 Add thread_number parameter.
246 (Workqueue::should_cancel_thread): Likewise.
247 (Workqueue::find_runnable_or_wait): Pass thread_number to
248 should_cancel_thread.
249 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
252 2011-07-22 Sriraman Tallam <tmsriram@google.com>
254 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
255 only after checking if it cannot be forced local.
256 * symtab.h (is_externally_visible): Check if the symbol is not forced
259 2011-07-15 Ian Lance Taylor <iant@google.com>
261 * options.h (class General_options): Add --print-output-format.
262 Move -EL next to -EB, for better --help output.
263 * target-select.cc: Include <cstdio>, "options.h", and
265 (Target_selector::do_target_bfd_name): New function.
266 (print_output_format): New function.
267 * target-select.h (class Target_selector): Update declarations.
268 (Target_selector::target_bfd_name): New function.
269 (print_output_format): Declare.
270 * main.cc: Include "target-select.h".
271 (main): Handle --print-output-format.
272 * gold.cc: Include "target-select.h".
273 (queue_initial_tasks): Handle --print-output-format when there are
275 * parameters.cc (parameters_force_valid_target): Give a better
276 error message if -EB/-EL does not match target.
277 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
280 2011-07-15 Ian Lance Taylor <iant@google.com>
282 * i386.cc (class Output_data_plt_i386): Add layout_ field.
283 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
284 (Output_data_plt_i386::do_write): Write address of .dynamic
285 section to first entry in .got.plt section.
286 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
287 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
289 (Output_data_plt_x86_64::do_write): Write address of .dynamic
290 section to first entry in .got.plt section.
291 * layout.h (Layout::dynamic_section): New function.
293 2011-07-13 Sriraman Tallam <tmsriram@google.com>
295 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
297 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
298 input_section_position_, and input_section_glob_.
299 (read_layout_from_file): Call function section_ordering_specified.
300 * layout.h (is_section_ordering_specified): New function.
301 (section_ordering_specified): New function.
302 (section_ordering_specified_): New boolean member.
303 * main.cc(main): Call load_plugins after layout object is defined.
304 * output.cc (Output_section::add_input_section): Use
305 function section_ordering_specified to check if section ordering is
307 * output.cc (Output_section::add_relaxed_input_section): Use
308 function section_ordering_specified to check if section ordering is
310 (Output_section::update_section_layout): New function.
311 (Output_section::sort_attached_input_sections): Check if input section
313 * output.h (Output_section::update_section_layout): New function.
314 * plugin.cc (get_section_count): New function.
315 (get_section_type): New function.
316 (get_section_name): New function.
317 (get_section_contents): New function.
318 (update_section_order): New function.
319 (allow_section_ordering): New function.
320 (Plugin::load): Add the new interfaces to the transfer vector.
321 (Plugin_manager::load_plugins): New parameter.
322 (Plugin_manager::all_symbols_read): New parameter.
323 (Plugin_manager::claim_file): New parameter. Save the elf object for
325 (Plugin_manager::get_elf_object): New function.
326 (Plugin_manager::get_view): Change to directly use the bool to check
327 if get_view is called from claim_file_hook.
328 * plugin.h (input_objects): New function
329 (Plugin__manager::load_plugins): New parameter.
330 (Plugin_manager::claim_file): New parameter.
331 (Plugin_manager::get_elf_object): New function.
332 (Plugin_manager::in_claim_file_handler): New function.
333 (Plugin_manager::in_claim_file_handler_): New member.
334 (layout): New function.
335 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
336 handler with an extra parameter. Make the elf object before calling
338 * testsuite/plugin_test.c (get_section_count): New function pointer.
339 (get_section_type): New function pointer.
340 (get_section_name): New function pointer.
341 (get_section_contents): New function pointer.
342 (update_section_order): New function pointer.
343 (allow_section_ordering): New function pointer.
344 (onload): Check if the new interfaces exist.
346 2011-07-13 Ian Lance Taylor <iant@google.com>
348 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
350 * x86_64.cc (Target_x86_64::got_section): Likewise.
351 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
352 (relro_now_test_SOURCES): New variable.
353 (relro_now_test_DEPENDENCIES): New variable.
354 (relro_now_test_LDFLAGS): New variable.
355 (relro_now_test_LDADD): New variable.
356 (relro_now_test.so): New target.
357 * testsuite/Makefile.in: Rebuild.
359 2011-07-12 Ian Lance Taylor <iant@google.com>
362 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
363 GLOB_DAT relocation rather than a RELATIVE relocation for a
364 protected symbol when creating a shared library.
365 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
366 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
367 * testsuite/protected_main_1.cc (main): Test that protected
368 function has same address.
370 2011-07-11 Ian Lance Taylor <iant@google.com>
373 * options.h (class General_options): Add -Bgroup.
374 * options.cc (General_options::finalize): If -Bgroup is set,
375 default to --unresolved-symbols=report-all.
376 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
377 * target-reloc.h (issue_undefined_symbol_error): Handle
378 --unresolved-symbols=report-all.
380 2011-07-08 Ian Lance Taylor <iant@google.com>
383 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
384 if linker script discards key sections.
385 (Layout::create_dynamic_symtab): Likewise.
386 (Layout::assign_local_dynsym_offsets): Likewise.
387 (Layout::sized_create_version_sections): Likewise.
388 (Layout::create_interp): Likewise.
389 (Layout::finish_dynamic_section): Likewise.
390 (Layout::set_dynamic_symbol_size): Likewise.
392 2011-07-08 Ian Lance Taylor <iant@google.com>
395 * options.h (class General_options): Add --unresolved-symbols.
396 * target-reloc.h (issue_undefined_symbol_error): Check
397 --unresolved-symbols. Add comments.
399 2011-07-08 Ian Lance Taylor <iant@google.com>
401 * testsuite/odr_violation2.cc (Ordering::operator()): Make
402 expression more complex.
404 2011-07-08 Ian Lance Taylor <iant@google.com>
407 * target-reloc.h (issue_undefined_symbol_error): New inline
408 function, broken out of relocate_section.
409 (relocate_section): Call issue_undefined_symbol_error.
410 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
411 there is no TLS segment if we are about to issue an undefined
413 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
415 2011-07-08 Ian Lance Taylor <iant@google.com>
418 * resolve.cc (Symbol_table::should_override): Add fromtype
419 parameter. Change all callers. Give error when linking together
420 TLS and non-TLS symbol.
421 (Symbol_table::should_override_with_special): Add fromtype
422 parameter. Change all callers.
423 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
424 there is no TLS segment if we have reported some errors.
425 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
427 2011-07-08 Ian Lance Taylor <iant@google.com>
430 * target.h (Target::plt_address_for_global): New function.
431 (Target::plt_address_for_local): New function.
432 (Target::plt_section_for_global): Remove.
433 (Target::plt_section_for_local): Remove.
434 (Target::do_plt_address_for_global): New virtual function.
435 (Target::do_plt_address_for_local): New virtual function.
436 (Target::do_plt_section_for_global): Remove.
437 (Target::do_plt_section_for_local): Remove.
438 (Target::register_global_plt_entry): Add Symbol_table and Layout
440 * output.cc (Output_data_got::Got_entry::write): Use
441 plt_address_for_global and plt_address_for_local.
442 * layout.cc (Layout::add_target_dynamic_tags): Use size and
443 address of output section.
444 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
445 got_irelative_, and irelative_count_ fields. Update
447 (Output_data_plt_i386::has_irelative_section): New function.
448 (Output_data_plt_i386::entry_count): Add irelative_count_.
449 (Output_data_plt_i386::set_final_data_size): Likewise.
450 (class Target_i386): Add got_irelative_ and rel_irelative_
451 fields. Update declarations.
452 (Target_i386::Target_i386): Initialize new fields.
453 (Target_i386::do_plt_address_for_global): New function replacing
454 do_plt_section_for_global.
455 (Target_i386::do_plt_address_for_local): New function replacing
456 do_plt_section_for_local.
457 (Target_i386::got_section): Create got_irelative_.
458 (Target_i386::rel_irelative_section): New function.
459 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
460 fields. Don't define __rel_iplt_{start,end}.
461 (Output_data_plt_i386::add_entry): Add symtab and layout
462 parameters. Change all callers. Use different PLT and GOT for
464 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
465 layout parameters. Change all callers. Use different PLT and
467 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
468 (Output_data_plt_i386::rel_irelative): New function.
469 (Output_data_plt_i386::address_for_global): New function.
470 (Output_data_plt_i386::address_for_local): New function.
471 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
472 IRELATIVE GOT when changing IFUNC GOT entries.
473 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
475 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
476 if we didn't create an IRELATIVE GOT.
477 (Target_i386::Relocate::relocate): Use plt_address_for_global and
478 plt_address_for_local.
479 (Target_i386::do_dynsym_value): Use plt_address_for_global.
480 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
481 got_irelative_, and irelative_count_ fields. Update
483 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
484 Initialize new fields. Remove symtab parameter. Change all
486 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
488 (Output_data_plt_x86_64::has_irelative_section): New function.
489 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
490 (class Target_x86_64): Add got_irelative_ and rel_irelative_
491 fields. Update declarations.
492 (Target_x86_64::Target_x86_64): Initialize new fields.
493 (Target_x86_64::do_plt_address_for_global): New function replacing
494 do_plt_section_for_global.
495 (Target_x86_64::do_plt_address_for_local): New function replacing
496 do_plt_section_for_local.
497 (Target_x86_64::got_section): Create got_irelative_.
498 (Target_x86_64::rela_irelative_section): New function.
499 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
500 all callers. Don't create __rel_iplt_{start,end}.
501 (Output_data_plt_x86_64::add_entry): Add symtab and layout
502 parameters. Change all callers. Use different PLT and GOT for
504 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
505 layout parameters. Change all callers. Use different PLT and
507 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
508 parameters. Change all callers. Use different PLT and GOT for
510 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
511 (Output_data_plt_x86_64::rela_irelative): New function.
512 (Output_data_plt_x86_64::address_for_global): New function.
513 (Output_data_plt_x86_64::address_for_local): New function.
514 (Output_data_plt_x86_64::set_final_data_size): Likewise.
515 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
516 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
517 (Target_x86_64::register_global_plt_entry): Add symtab and layout
519 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
521 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
522 symbols if we didn't create an IRELATIVE GOT.
523 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
524 plt_address_for_local.
525 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
526 * testsuite/ifuncvar1.c: New test file.
527 * testsuite/ifuncvar2.c: New test file.
528 * testsuite/ifuncvar3.c: New test file.
529 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
530 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
531 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
532 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
533 * testsuite/Makefile.in: Rebuild.
535 2011-07-07 Cary Coutant <ccoutant@google.com>
537 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
538 (two_file_test_1_ndebug.o): Likewise.
539 (two_file_test_1b_ndebug.o): Likewise.
540 (two_file_test_2_ndebug.o): Likewise.
541 (two_file_test_main_ndebug.o): Likewise.
542 (incremental_test_2): Link with no-debug versions.
544 2011-07-06 Cary Coutant <ccoutant@google.com>
546 * gold/incremental.cc
547 (Output_section_incremental_inputs::write_info_blocks): Check for
548 hidden and internal symbols.
550 2011-07-06 Cary Coutant <ccoutant@google.com>
552 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
553 Check disposition for startup file.
554 (Incremental_inputs::report_command_line): Ignore
555 --incremental-startup-unchanged option.
556 * options.cc (General_options::parse_incremental_startup_unchanged):
558 (General_options::General_options): Initialize new data member.
559 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
560 (General_options): Add --incremental-startup-unchanged option.
561 (General_options::incremental_startup_disposition): New function.
562 (General_options::incremental_startup_disposition_): New data member.
564 2011-07-06 Cary Coutant <ccoutant@google.com>
566 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
567 input file index to Script_info ctor.
568 (Sized_incremental_binary::do_file_has_changed): Find the
569 command-line argument for files named in scripts.
570 * incremental.h (Script_info::Script_info): New ctor
571 with input file index.
572 (Script_info::input_file_index): New function.
573 (Script_info::input_file_index_): New data member.
574 (Incremental_binary::get_library): Add const.
575 (Incremental_binary::get_script_info): Add const.
576 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
577 * testsuite/Makefile.am (incremental_test_5): New test case.
578 (incremental_test_6): New test case.
579 * testsuite/Makefile.in: Regenerate.
581 2011-07-06 Cary Coutant <ccoutant@google.com>
583 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
584 debug output when command lines differ.
586 2011-07-06 Cary Coutant <ccoutant@google.com>
588 * incremental.cc (Incremental_inputs::report_command_line): Ignore
589 --incremental-patch option.
590 * layout.cc (Free_list::allocate): Extend allocation beyond original
592 (Layout::make_output_section): Mark sections that should get
594 * options.cc (parse_percent): New function.
595 * options.h (parse_percent): New function.
596 (DEFINE_percent): New macro.
597 (General_options): Add --incremental-patch option.
598 * output.cc (Output_section::Output_section): Initialize new data
600 (Output_section::add_input_section): Print section name when out
602 (Output_section::add_output_section_data): Likewise.
603 (Output_section::set_final_data_size): Add patch space when
604 doing --incremental-full.
605 (Output_section::do_reset_address_and_file_offset): Remove patch
607 (Output_segment::set_section_list_addresses): Print debug output
608 only if --incremental-update.
609 * output.h (Output_section::set_is_patch_space_allowed): New function.
610 (Output_section::is_patch_space_allowed_): New data member.
611 (Output_section::patch_space_): New data member.
612 * parameters.cc (Parameters::incremental_full): New function.
613 * parameters.h (Parameters::incremental_full): New function
614 * testsuite/Makefile.am (incremental_test_2): Add test for
615 --incremental-patch option.
616 * testsuite/Makefile.in: Regenerate.
617 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
618 (t18): Remove function body.
620 2011-07-05 Doug Kwan <dougkwan@google.com>
623 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
624 Arm_Address type for relocation result.
625 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
627 (Arm_relocate_functions::abs32): Use unaligned access.
628 (Arm_relocate_functions::rel32): Ditto.
629 (Arm_relocate_functions::prel31): Ditto.
630 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
631 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
632 static data relocations.
633 * testsuite/Makefile.in: Regnerate.
634 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
636 2011-07-05 Ian Lance Taylor <iant@google.com>
639 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
640 symbols if necessary.
641 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
643 2011-07-05 Ian Lance Taylor <iant@google.com>
646 * resolve.cc (Symbol::override_base_with_special): Simply override
647 version with special symbol version, ignoring previous version.
649 2011-07-05 Ian Lance Taylor <iant@google.com>
651 * object.cc (Sized_relobj_file::include_section_group): Add
652 information to comment about signature location.
654 2011-07-02 Ian Lance Taylor <iant@google.com>
657 * options.h (class General_options): Add -f and -F.
658 * options.cc (General_options::finalize): Fatal error if -f/-F
659 are used without -shared.
660 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
662 2011-07-02 Ian Lance Taylor <iant@google.com>
664 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
666 2011-07-01 Ian Lance Taylor <iant@google.com>
670 * resolve.cc (Symbol::override_base_with_special): Don't override
671 the version if the overriding symbol has a different name.
672 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
673 all callers. If we give an error about an undefined version,
674 define the base version if necessary.
675 * dynobj.h (class Versions): Update declaration.
676 * testsuite/weak_alias_test_5.cc: New file.
677 * testsuite/weak_alias_test.script: New file.
678 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
679 and versioned_alias have the right value, and call t2.
680 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
681 weak_alias_test_5.so.
682 (weak_alias_test_LDADD): Likewise.
683 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
684 * testsuite/Makefile.in: Rebuild.
686 2011-07-01 Ian Lance Taylor <iant@google.com>
689 * options.h (class General_options): Support -z notext.
690 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
692 (two_file_shared_nonpic.so): Likewise.
693 (two_file_shared_mixed.so): Likewise.
694 (two_file_shared_mixed_1.so): Likewise.
695 (weak_undef_lib_nonpic.so): Likewise.
696 (alt/weak_undef_lib_nonpic.so): Likewise.
697 (tls_test_shared_nonpic.so): Likewise.
698 * testsuite/Makefile.in: Rebuild.
700 2011-07-01 Ian Lance Taylor <iant@google.com>
703 * configure.ac: Test whether static linking works, setting
704 the automake conditional HAVE_STATIC.
705 * testsuite/Makefile.am: Disable tests using -static if
706 HAVE_STATIC is not true.
707 * configure, testsuite/Makefile.in: Rebuild.
709 2011-07-01 Ian Lance Taylor <iant@google.com>
712 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
713 Assert if we see DW_EH_PE_indirect.
714 * target.h (Target::ehframe_datarel_base): New function.
715 (Target::do_ehframe_datarel_base): New target function.
716 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
717 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
720 2011-07-01 Ian Lance Taylor <iant@google.com>
723 * options.h (class General_options): Add
724 --ld-generated-unwind-info.
725 * ehframe.cc (Fde::write): Add address parameter. Change all
726 callers. If associated with PLT, fill in address and size.
727 (Cie::set_output_offset): Only add merge mapping if there is an
729 (Cie::write): Add address parameter. Change all callers.
730 (Eh_frame::add_ehframe_for_plt): New function.
731 * ehframe.h (class Fde): Update declarations. Move shndx_ and
732 input_offset_ fields into union u_, with new plt field.
733 (Fde::Fde): Adjust for new union field.
734 (Fde::Fde) [Output_data version]: New constructor.
735 (Fde::add_mapping): Only add merge mapping if there is an object.
736 (class Cie): Update declarations.
737 (class Eh_frame): Declare add_ehframe_for_plt.
738 * layout.cc (Layout::layout_eh_frame): Break out code into
739 make_eh_frame_section, and call it.
740 (Layout::make_eh_frame_section): New function.
741 (Layout::add_eh_frame_for_plt): New function.
742 * layout.h (class Layout): Update declarations.
743 * merge.cc (Merge_map::add_mapping): Add assertion.
744 * i386.cc: Include "dwarf.h".
745 (class Output_data_plt_i386): Make first_plt_entry,
746 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
747 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
748 and plt_eh_frame_fde.
749 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
750 boundary. Call add_eh_frame_for_plt if appropriate.
751 * x86_64.cc: Include "dwarf.h".
752 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
753 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
754 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
755 and plt_eh_frame_fde.
756 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
759 2011-06-29 Ian Lance Taylor <iant@google.com>
762 * object.cc (Sized_relobj_file::layout_section): Change shdr
763 parameter to be const.
764 (Sized_relobj_file::layout_eh_frame_section): New function, broken
766 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
767 appropriate. Call layout_eh_frame_section.
768 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
770 * object.h (class Sized_relobj_file): Update declarations.
772 2011-06-29 Ian Lance Taylor <iant@google.com>
775 * script.cc (Token::integer_value): Accept trailing M/m/K/k
777 (Lex::gather_token): Accept trailing M/m/K/k for integers.
779 2011-06-29 Ian Lance Taylor <iant@google.com>
782 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
784 * layout.cc (Layout::layout_eh_frame): Likewise.
786 2011-06-29 Ian Lance Taylor <iant@google.com>
789 * layout.cc (Layout::symtab_section_shndx): New function.
790 * layout.h (class Layout): Declare symtab_section_shndx.
791 * output.cc (Output_section::write_header): Call it.
793 2011-06-29 Ian Lance Taylor <iant@google.com>
796 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
797 symbols which are not used in a relocation.
799 2011-06-28 Ian Lance Taylor <iant@google.com>
802 * layout.cc (Layout::segment_precedes): Don't crash if a linker
803 script create indistinguishable segments.
804 (Layout::set_segment_offsets): Use stable_sort when sorting
805 segments. Pass this to Compare_segments constructor.
806 * layout.h (class Layout): Make segment_precedes non-static.
807 (class Compare_segments): Change from struct to class. Add
808 layout_ field. Add constructor.
810 (Script_sections::attach_sections_using_phdrs_clause): Rename
811 local orphan to is_orphan. Don't report failure to put empty
812 section in segment. On attachment failure, report name of
813 section, and attach to first PT_LOAD segment.
815 2011-06-28 Ian Lance Taylor <iant@google.com>
818 * target-select.cc (Target_selector::Target_selector): Add
819 emulation parameter. Change all callers.
820 (select_target_by_bfd_name): Rename from select_target_by_name.
822 (select_target_by_emulation): New function.
823 (supported_emulation_names): New function.
824 * target-select.h (class Target_selector): Add emulation_ field.
826 (Target_selector::recognize_by_bfd_name): Rename from
827 recognize_by_name. Change all callers.
828 (Target_selector::supported_bfd_names): Rename from
829 supported_names. Change all callers.
830 (Target_selector::recognize_by_emulation): New function.
831 (Target_selector::supported_emulations): New function.
832 (Target_selector::emulation): New function.
833 (Target_selector::do_recognize_by_bfd_name): Rename from
834 do_recognize_by_name. Change all callers.
835 (Target_selector::do_supported_bfd_names): Rename from
836 do_supported_names. Change all callers.
837 (Target_selector::do_recognize_by_emulation): New function.
838 (Target_selector::do_supported_emulations): New function.
839 (select_target_by_bfd_name): Change name in declaration.
840 (select_target_by_emulation): Declare.
841 (supported_emulation_names): Declare.
842 * parameters.cc (parameters_force_valid_target): Try to find
843 target based on emulation from -m option.
844 * options.h (class General_options): Change doc string for -m.
845 * options.cc (help): Print emulations.
846 (General_options::parse_V): Likewise.
847 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
848 Add emulation parameter. Change all callers.
850 2011-06-28 Ian Lance Taylor <iant@google.com>
852 * target.h (class Target): Add osabi_ field.
853 (Target::osabi): New function.
854 (Target::set_osabi): New function.
855 (Target::Target): Initialize osabi_.
856 (Target::do_adjust_elf_header): Make pure virtual.
857 (Sized_target::do_adjust_elf_header): Declare.
858 * target.cc (Sized_target::do_adjust_elf_header): New function.
859 (class Sized_target): Instantiate all versions.
860 * freebsd.h (class Target_freebsd): Remove.
861 (Target_selector_freebsd::do_recognize): Call set_osabi on
863 (Target_selector_freebsd::do_recognize_by_name): Likewise.
864 (Target_selector_freebsd::set_osabi): Remove.
865 * i386.cc (class Target_i386): Inherit from Sized_target rather
867 * x86_64.cc (class Target_x86_64): Likewise.
869 2011-06-28 Ian Lance Taylor <iant@google.com>
871 * target.h (Target::can_check_for_function_pointers): Rewrite.
873 (Target::can_icf_inline_merge_sections): Likewise.
874 (Target::section_may_have_icf_unsafe_poineters): Likewise.
875 (Target::Target_info): Add can_icf_inline_merge_sections field.
876 (Target::do_can_check_for_function_pointers): New virtual
878 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
879 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
880 from can_check_for_function_pointers, move in file.
881 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
882 section_may_have_icf_unsafe_poineters, move in file.
883 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
884 * i386.cc (Target_i386::do_can_check_for_function_pointers):
885 Rename from can_check_for_function_pointers, move in file.
886 (Target_i386::can_icf_inline_merge_sections): Remove.
887 (Target_i386::i386_info): Initialize
888 can_icf_inline_merge_sections.
889 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
890 Initialize can_icf_inline_merge_sections.
891 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
892 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
893 Rename from can_check_for_function_pointers, move in file.
894 (Target_x86_64::can_icf_inline_merge_sections): Remove.
895 (Target_x86_64::x86_64_info): Initialize
896 can_icf_inline_merge_sections.
897 * testsuite/testfile.cc (Target_test::test_target_info):
899 * icf.cc (get_section_contents): Correct formatting.
901 2011-06-27 Ian Lance Taylor <iant@google.com>
903 * symtab.cc (Symbol::versioned_name): New function.
904 (Symbol_table::add_to_final_symtab): Use versioned_name when
906 (Symbol_table::sized_write_symbol): Likewise.
907 * symtab.h (class Symbol): Declare versioned_name.
908 * stringpool.h (class Stringpool_template): Add variant of add
909 which takes a std::basic_string.
910 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
911 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
912 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
913 (ver_test_12.o): New target.
914 * testsuite/Makefile.in: Rebuild.
916 2011-06-27 Doug Kwan <dougkwan@google.com>
918 * arm.cc (Arm_relocate_functions::thm_jump8,
919 Arm_relocate_functions::thm_jump11): Use a wider signed
920 type to compute offset.
921 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
923 * testsuite/Makefile.in: Regenerate.
924 * testsuite/arm_branch_in_range.sh: Check test results of
925 arm_thm_jump11 and arm_thm_jump8.
926 * testsuite/arm_thm_jump11.s: New test source file.
927 * testsuite/arm_thm_jump11.t: New linker script.
928 * testsuite/arm_thm_jump8.s: New test source file.
929 * testsuite/arm_thm_jump8.t: New linker script.
931 2011-06-24 Ian Lance Taylor <iant@google.com>
933 * layout.cc: Include "object.h".
934 (ctors_sections_in_init_array): New static variable.
935 (Layout::is_ctors_in_init_array): New function.
936 (Layout::layout): Add entry to ctors_sections_in_init_array if
938 * layout.h (class Layout): Declare is_ctors_in_init_array.
939 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
940 is_ctors_reverse_view is set.
941 (Sized_relobj_file::write_sections): Add layout parameter. Change
942 all callers. Set is_ctors_reverse_view field of View_size.
943 (Sized_relobj_file::reverse_words): New function.
944 * object.h (Sized_relobj_file::View_size): Add
945 is_ctors_reverse_view field.
946 (class Sized_relobj_file): Update declarations.
947 * testsuite/initpri3.c: New test.
948 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
950 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
951 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
952 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
953 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
954 * testsuite/Makefile.in: Rebuild.
956 2011-06-24 Cary Coutant <ccoutant@google.com>
958 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
959 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
960 (debug_msg_cdebug.err): New targets.
961 * testsuite/Makefile.in: Regenerate.
962 * testsuite/debug_msg.sh: Check output of link with compressed debug.
963 Fix checks for link with shared library.
965 2011-06-24 Doug Kwan <dougkwan@google.com>
967 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
968 skip empty text sections.
969 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
971 2011-06-22 Ian Lance Taylor <iant@google.com>
974 * options.h (class General_options): Add --ctors-in-init-array.
975 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
976 friends as SHT_PROGBITS for merging sections.
977 (Layout::layout): Remove special handling of .init_array and
978 friends. Don't sort if doing relocatable link. Sort for .ctors
979 and .dtors if ctors_in_init_array.
980 (Layout::make_output_section): Force correct section types for
981 .init_array and friends. Don't sort if doing relocatable link,
982 Don't sort .ctors and .dtors if ctors_in_init_array.
983 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
984 (Layout::output_section_name): Add relobj parameter. Change all
985 callers. Handle .ctors. and .dtors. in code rather than table.
986 Handle .ctors and .dtors if ctors_in_init_array.
987 (Layout::match_file_name): New function, moved from output.cc.
988 * layout.h (class Layout): Update declarations.
989 * output.cc: Include "layout.h".
990 (Input_section_sort_entry::get_priority): New function.
991 (Input_section_sort_entry::match_file_name): Just call
992 Layout::match_file_name.
993 (Output_section::Input_section_sort_init_fini_compare::operator()):
994 Handle .ctors and .dtors. Sort by explicit priority rather than
996 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
997 * testsuite/initpri2.c: New test.
998 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
999 (check_PROGRAMS): Add initpri2.
1000 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1001 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1002 * configure, testsuite/Makefile.in: Rebuild.
1004 2011-06-19 Ian Lance Taylor <iant@google.com>
1007 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1008 .interp section to a PT_INTERP segment even if we have seen a
1009 --dynamic-linker option. Don't do it if we have seen a PHDRS
1010 clause in a linker script.
1011 (Layout::finalize): Don't create a .interp section if we've
1012 already create a PT_INTERP segment.
1013 (Layout::create_interp): Always call choose_output_section (revert
1014 patch of 2011-06-17). Don't create PT_INTERP segment.
1015 * script-sections.cc
1016 (Script_sections::create_note_and_tls_segments): Add a .interp
1017 section to a PT_INTERP segment even if we have seen a
1018 --dynamic-linker option.
1020 2011-06-18 Ian Lance Taylor <iant@google.com>
1022 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1023 merely because a non-PT_LOAD segment has a dynamic reloc.
1025 2011-06-18 Ian Lance Taylor <iant@google.com>
1027 * layout.cc (Layout::finish_dynamic_section): Don't create
1028 DT_FLAGS entry if not needed.
1030 2011-06-18 Ian Lance Taylor <iant@google.com>
1033 * layout.cc (Layout::layout_eh_frame): Correct handling of
1034 writable .eh_frame section.
1036 2011-06-17 Ian Lance Taylor <iant@google.com>
1039 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1040 symbol is redefined with the exact same object and value.
1042 2011-06-17 Ian Lance Taylor <iant@google.com>
1045 * layout.h (class Layout): Add interp_segment_ field.
1046 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1047 (Layout::attach_allocated_section_to_segment): If making shared
1048 library, put .interp section in PT_INTERP segment.
1049 (Layout::finalize): Also call create_interp if -dynamic-linker
1051 (Layout::create_interp): Assert that there is no PT_INTERP
1052 segment. If not using a SECTIONS clause, use make_output_section.
1053 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1054 * script-sections.cc
1055 (Script_sections::create_note_and_tls_segments): If making shared
1056 library, put .interp section in PT_INTERP segment.
1058 2011-06-17 Ian Lance Taylor <iant@google.com>
1060 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1061 when making a shared library.
1063 2011-06-17 Ian Lance Taylor <iant@google.com>
1065 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1066 parameter. Change all callers. Don't issue warning about PC32
1067 against locally defined symbol.
1069 2011-06-16 Ian Lance Taylor <iant@google.com>
1071 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1072 occurs in same object.
1074 2011-06-14 Alan Modra <amodra@gmail.com>
1076 * po/POTFILES.in: Regenerate.
1078 2011-06-09 Ian Lance Taylor <iant@google.com>
1080 * script-sections.cc
1081 (Orphan_output_section::set_section_addresses): For a relocatable
1082 link set address to 0.
1084 2011-06-09 Cary Coutant <ccoutant@google.com>
1087 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1088 used with --compress-debug-sections.
1089 * gold/object.cc (Sized_relobj_file::do_layout): Report
1090 uncompressed size of compressed input sections.
1092 2011-06-08 Cary Coutant <ccoutant@google.com>
1095 * testsuite/two_file_test_2_v1.cc: Change initialization of
1096 v2 to keep it in .data.
1098 2011-06-07 Cary Coutant <ccoutant@google.com>
1100 * common.cc (Symbol_table::do_allocate_commons_list): Call
1102 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1103 (Errors::fallback): New function.
1104 (gold_fallback): New function.
1105 * errors.h (Errors::fallback): New function.
1106 * gold.cc (gold_exit): Change status parameter to enum; adjust
1108 (queue_initial_tasks): Call gold_fallback.
1109 * gold.h: Include cstdlib.
1110 (Exit_status): New enum type.
1111 (gold_exit): Change status parameter to enum.
1112 (gold_fallback): New function.
1113 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1114 (Layout::create_symtab_sections): Likewise.
1115 (Layout::create_shdrs): Likewise.
1116 * main.cc (main): Adjust call to gold_exit.
1117 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1118 (Output_data_got::add_got_entry_pair): Likewise.
1119 (Output_section::add_input_section): Likewise.
1120 (Output_section::add_output_section_data): Likewise.
1121 (Output_segment::set_section_list_addresses): Likewise.
1122 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1124 2011-06-07 Cary Coutant <ccoutant@google.com>
1126 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1127 for incremental links.
1128 * output.cc (Output_segment::set_section_list_addresses): Remove
1129 FIXME and test for TLS or BSS.
1131 2011-06-07 Cary Coutant <ccoutant@google.com>
1133 * testsuite/Makefile.am: Add incremental_copy_test,
1134 incremental_common_test_1.
1135 * testsuite/Makefile.in: Regenerate.
1136 * testsuite/common_test_1_v1.c: New source file.
1137 * testsuite/common_test_1_v2.c: New source file.
1138 * testsuite/copy_test_v1.cc: New source file.
1140 2011-06-07 Cary Coutant <ccoutant@google.com>
1142 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1143 update, allocate common from bss section's free list.
1144 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1145 linker-defined symbols.
1146 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1147 Skip GOT and PLT entries that are no longer referenced.
1148 (Output_section_incremental_inputs::write_info_blocks): Mark
1149 linker-defined symbols.
1150 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1151 * output.cc (Output_section::allocate): New function.
1152 * output.h (Output_section::allocate): New function.
1153 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1154 linker-defined symbols.
1155 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1156 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1157 (Symbol::init_base_output_data): Likewise.
1158 (Symbol::init_base_output_segment): Likewise.
1159 (Symbol::init_base_constant): Likewise.
1160 (Sized_symbol::init_output_data): Likewise.
1161 (Sized_symbol::init_output_segment): Likewise.
1162 (Sized_symbol::init_constant): Likewise.
1163 (Symbol_table::do_define_in_output_data): Likewise.
1164 (Symbol_table::do_define_in_output_segment): Likewise.
1165 (Symbol_table::do_define_as_constant): Likewise.
1166 * symtab.h (Symbol::is_predefined): New function.
1167 (Symbol::init_base_output_data): Add is_predefined parameter.
1168 (Symbol::init_base_output_segment): Likewise.
1169 (Symbol::init_base_constant): Likewise.
1170 (Symbol::is_predefined_): New data member.
1171 (Sized_symbol::init_output_data): Add is_predefined parameter.
1172 (Sized_symbol::init_output_segment): Likewise.
1173 (Sized_symbol::init_constant): Likewise.
1174 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1176 2011-06-07 Cary Coutant <ccoutant@google.com>
1178 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1179 instead of emit_copy_reloc.
1180 (Copy_relocs::emit_copy_reloc): Refactor.
1181 (Copy_relocs::make_copy_reloc): New function.
1182 (Copy_relocs::add_copy_reloc): Remove.
1183 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1185 (Copy_relocs::make_copy_reloc): New function.
1186 (Copy_relocs::add_copy_reloc): Remove.
1187 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1188 unchanged input files.
1189 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1190 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1191 Reserve BSS space for COPY relocations.
1192 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1193 (Output_section_incremental_inputs::write_info_blocks): Record
1194 whether a symbol is copied from a shared object.
1195 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1196 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1197 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1198 (Incremental_input_entry_reader::get_output_symbol_index): Add
1200 (Incremental_binary::emit_copy_relocs): New function.
1201 (Incremental_binary::do_emit_copy_relocs): New function.
1202 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1204 (Sized_incremental_binary::add_copy_reloc): New function.
1205 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1206 (Sized_incremental_binary::Copy_reloc): New struct.
1207 (Sized_incremental_binary::Copy_relocs): New typedef.
1208 (Sized_incremental_binary::copy_relocs_): New data member.
1209 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1210 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1211 * target.h (Sized_target::emit_copy_reloc): New function.
1212 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1214 2011-06-02 Cary Coutant <ccoutant@google.com>
1217 * gold/archive.cc (Archive::Archive): Initialize new data member.
1218 (Archive::include_all_members): Return if archive has already been
1220 * gold/archive.h (Archive::include_all_members_): New data member.
1222 2011-06-02 Nick Clifton <nickc@redhat.com>
1224 * dynobj.h: Fix spelling mistake in comment.
1225 * output.cc: Likewise.
1227 2011-05-31 Doug Kwan <dougkwan@google.com>
1231 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1232 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1233 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1234 redundant arm_exidx_test.so.
1235 * testsuite/Makefile.in: Regenerate.
1236 (check_SCRIPTS): Add pr12826.sh
1237 (check_DATA): Add pr12826.stdout
1238 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1239 * testsuite/pr12826.sh: New file.
1240 * testsuite/pr12826_1.s: Ditto.
1241 * testsuite/pr12826_1.s: Ditto.
1243 2011-05-30 Ian Lance Taylor <iant@google.com>
1245 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1248 2011-05-29 Ian Lance Taylor <iant@google.com>
1251 * testsuite/Makefile.am: Use different file name for two_file_test
1252 temporary file for each incremental test.
1253 * testsuite/Makefile.in: Rebuild.
1255 2011-05-29 Ian Lance Taylor <iant@google.com>
1257 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1258 binary input file is empty.
1260 2011-05-27 Ian Lance Taylor <iant@google.com>
1262 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1263 (ver_test_9.so): Likewise.
1264 * testsuite/Makefile.in: Rebuild.
1266 2011-05-26 Cary Coutant <ccoutant@google.com>
1268 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1269 * incremental.cc (Incremental_inputs::report_input_section): Fix
1270 comment, indentation.
1271 (Incremental_inputs::report_comdat_group): New function.
1272 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1273 of data for incremental input file entry.
1274 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1275 group count, COMDAT group signatures.
1276 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1277 an unchanged input file.
1278 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1279 Initialize new data member.
1280 (Incremental_object_entry::add_comdat_group): New function.
1281 (Incremental_object_entry::get_comdat_group_count): New function.
1282 (Incremental_object_entry::get_comdat_signature_key): New function.
1283 (Incremental_object_entry::groups_): New data member.
1284 (Incremental_inputs::report_comdat_group): New function.
1285 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1286 data for incremental input file entry.
1287 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1288 (Incremental_input_entry_reader::get_input_section): Adjust size of
1289 data for incremental input file entry.
1290 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1291 (Incremental_input_entry_reader::get_comdat_group_signature): New
1293 * object.cc (Sized_relobj::include_section_group): Report kept
1294 COMDAT groups for incremental links.
1296 2011-05-24 David Meyer <pdox@google.com>
1298 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1299 with name parameter. Add found_name parameter.
1300 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1301 * dirsearch.h (class Dirsearch): Update declaration.
1303 2011-05-24 Ian Lance Taylor <iant@google.com>
1305 * archive.cc (Library_base::should_include_member): Pull in object
1306 from archive if it defines the entry symbol.
1307 * parameters.cc (Parameters::entry): New function.
1308 * parameters.h (class Parameters): Declare entry.
1309 * output.h (class Output_file_header): Remove entry_ field.
1310 * output.cc (Output_file_header::Output_file_header): Remove entry
1311 parameter. Change all callers.
1312 (Output_file_header::entry): Use parameters->entry.
1313 * gold.cc (queue_middle_tasks): Likewise.
1314 * plugin.cc (Plugin_hook::run): Likewise.
1316 2011-05-24 Cary Coutant <ccoutant@google.com>
1318 * gold.cc (queue_initial_tasks): Pass incremental base filename
1319 to Output_file::open_base_file; don't print error message.
1320 * incremental-dump.cc (main): Adjust call to
1321 Output_file::open_for_modification.
1322 * incremental-dump.cc (main): Likewise.
1323 * incremental.cc (Incremental_inputs::report_command_line):
1324 Ignore --incremental-base option when comparing command lines.
1325 Ignore parameter when given as separate argument.
1326 * options.h (class General_options): Add --incremental-base.
1327 * output.cc (Output_file::Output_file):
1328 (Output_file::open_base_file): Add base_name and writable parameters;
1329 read base file into new file; print error message here.
1330 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1332 * output.h (Output_file::open_for_modification): Rename to...
1333 (Output_file::open_base_file): ...this; add base_name and
1334 writable parameters; adjust all callers.
1335 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1337 * testsuite/Makefile.am (incremental_test_4): Test
1339 * testsuite/Makefile.in: Regenerate.
1341 2011-05-24 Cary Coutant <ccoutant@google.com>
1343 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1345 * testsuite/Makefile.in: Regenerate.
1346 * testsuite/two_file_test_1_v1.cc: New test source file.
1347 * testsuite/two_file_test_1b_v1.cc: New test source file.
1348 * testsuite/two_file_test_2_v1.cc: New test source file.
1350 2011-05-24 Cary Coutant <ccoutant@google.com>
1352 * dynobj.h (Dynobj::do_dynobj): New function.
1353 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1354 flag and soname for shared objects.
1355 * incremental.cc (Incremental_inputs::report_object): Make
1356 either Incremental_object_entry or Incremental_dynobj_entry; add
1357 soname to string table.
1358 (Incremental_inputs::report_input_section): Add assertion.
1359 (Output_section_incremental_inputs::set_final_data_size): Adjust
1360 type of input file entry for shared libraries; adjust size of
1361 shared library info entry.
1362 (Output_section_incremental_inputs::write_input_files): Write
1363 as_needed flag for shared libraries.
1364 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1365 of input file entry for shared libraries; write soname.
1366 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1367 soname from incremental info.
1368 * incremental.h (enum Incremental_input_flags): Add
1369 INCREMENTAL_INPUT_AS_NEEDED.
1370 (Incremental_input_entry::Incremental_input_entry): Initialize new
1372 (Incremental_input_entry::set_as_needed): New function.
1373 (Incremental_input_entry::as_needed): New function.
1374 (Incremental_input_entry::do_dynobj_entry): New function.
1375 (Incremental_input_entry::as_needed_): New data member.
1376 (Incremental_object_entry::Incremental_object_entry): Don't check
1378 (Incremental_object_entry::do_type): Likewise.
1379 (class Incremental_dynobj_entry): New class.
1380 (Incremental_input_entry_reader::as_needed): New function.
1381 (Incremental_input_entry_reader::get_soname): New function.
1382 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1383 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1384 size of shared library info entry.
1385 * layout.cc (Layout::finish_dynamic_section): Don't test for
1386 incremental link when adding DT_NEEDED entries.
1387 * object.h (Object::Object): Initialize new data member.
1388 (Object::dynobj): New function.
1389 (Object::set_as_needed): New function.
1390 (Object::as_needed): New function.
1391 (Object::do_dynobj): New function.
1392 (Object::as_needed_): New data member.
1394 2011-05-24 Cary Coutant <ccoutant@google.com>
1396 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1397 info; adjust display of GOT entries.
1398 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1399 vector of input objects; remove file_status_.
1400 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1401 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1402 got_plt reader; call target hooks to reserve GOT entries.
1403 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1404 of input file info header and GOT info entry.
1405 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1407 (Got_plt_view_info::got_descriptor): Remove.
1408 (Got_plt_view_info::sym_index): New data member.
1409 (Got_plt_view_info::input_index): New data member.
1410 (Local_got_offset_visitor::visit): Write input file index.
1411 (Global_got_offset_visitor::visit): Write 0 for input file index.
1412 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1413 with sym_index and input_index.
1414 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1415 incremental info GOT entry; replace got_descriptor with input_index.
1416 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1417 map from input file index to object.
1418 (Sized_relobj_incr::do_layout): Replace direct data member reference
1419 with accessor function.
1420 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1421 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1422 Adjust size of input file info header.
1423 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1424 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1425 (Incremental_input_entry_reader::get_input_section): Adjust size of
1426 input file info header.
1427 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1428 of incremental info GOT entry.
1429 (Incremental_got_plt_reader::get_got_desc): Remove.
1430 (Incremental_got_plt_reader::get_got_symndx): New function.
1431 (Incremental_got_plt_reader::get_got_input_index): New function.
1432 (Sized_incremental_binary::Sized_incremental_binary): Remove
1433 file_status_; add input_objects_.
1434 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1435 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1436 (Sized_incremental_binary::file_is_unchanged): Remove.
1437 (Sized_incremental_binary::set_input_object): New function.
1438 (Sized_incremental_binary::input_object): New function.
1439 (Sized_incremental_binary::file_status_): Remove.
1440 (Sized_incremental_binary::input_objects_): New data member.
1441 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1443 (Sized_relobj_incr::invalid_address): Move to base class.
1444 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1446 (Sized_relobj_incr::do_output_section_offset): Likewise.
1447 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1448 (Sized_relobj_incr::section_offsets_): Likewise.
1449 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1451 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1452 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1453 with accessor function.
1454 (Sized_relobj_file::do_layout): Likewise.
1455 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1456 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1457 (Sized_relobj_file::compute_final_local_value): Replace refs to
1458 section_offsets_ with accessor function.
1459 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1460 * object.h (Relobj::Relobj): Initialize new data members.
1461 (Relobj::add_dyn_reloc): New function.
1462 (Relobj::first_dyn_reloc): New function.
1463 (Relobj::dyn_reloc_count): New function.
1464 (Relobj::first_dyn_reloc_): New data member.
1465 (Relobj::dyn_reloc_count_): New data member.
1466 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1468 (Sized_relobj::Address): New typedef.
1469 (Sized_relobj::invalid_address): Move here from child class.
1470 (Sized_relobj::Sized_relobj): Initialize new data members.
1471 (Sized_relobj::sized_relobj): New function.
1472 (Sized_relobj::is_output_section_offset_invalid): Move here from
1474 (Sized_relobj::get_output_section_offset): Likewise.
1475 (Sized_relobj::local_has_got_offset): Likewise.
1476 (Sized_relobj::local_got_offset): Likewise.
1477 (Sized_relobj::set_local_got_offset): Likewise.
1478 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1479 (Sized_relobj::clear_got_offsets): New function.
1480 (Sized_relobj::section_offsets): Move here from child class.
1481 (Sized_relobj::do_output_section_offset): Likewise.
1482 (Sized_relobj::do_set_section_offset): Likewise.
1483 (Sized_relobj::Local_got_offsets): Likewise.
1484 (Sized_relobj::local_got_offsets_): Likewise.
1485 (Sized_relobj::section_offsets_): Likewise.
1486 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1488 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1490 (Sized_relobj_file::sized_relobj): New function
1491 (Sized_relobj_file::local_has_got_offset): Move to base class.
1492 (Sized_relobj_file::local_got_offset): Likewise.
1493 (Sized_relobj_file::set_local_got_offset): Likewise.
1494 (Sized_relobj_file::get_output_section_offset): Likewise.
1495 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1496 (Sized_relobj_file::do_output_section_offset): Likewise.
1497 (Sized_relobj_file::do_set_section_offset): Likewise.
1498 (Sized_relobj_file::Local_got_offsets): Likewise.
1499 (Sized_relobj_file::local_got_offsets_): Likewise.
1500 (Sized_relobj_file::section_offsets_): Likewise.
1501 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1503 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1504 (Output_reloc::get_symbol_index): Likewise.
1505 (Output_reloc::local_section_offset): Likewise.
1506 (Output_reloc::get_address): Likewise.
1507 (Output_reloc::symbol_value): Likewise.
1508 (Output_data_got::reserve_slot): Move to class definition.
1509 (Output_data_got::reserve_local): New function.
1510 (Output_data_got::reserve_slot_for_global): Remove.
1511 (Output_data_got::reserve_global): New function.
1512 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1513 (all constructors, two instantiations).
1514 (Output_reloc::get_relobj): New function (two instantiations).
1515 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1516 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1517 (Output_data_reloc::add_global): Adjust type of relobj.
1518 (Output_data_reloc::add_global_relative): Likewise.
1519 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1520 (Output_data_reloc::add_local): Likewise.
1521 (Output_data_reloc::add_local_relative): Likewise.
1522 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1523 (Output_data_reloc::add_local_section): Likewise.
1524 (Output_data_reloc::add_output_section): Likewise.
1525 (Output_data_reloc::add_absolute): Likewise.
1526 (Output_data_reloc::add_target_specific): Likewise.
1527 (Output_data_got::reserve_slot): Move definition here.
1528 (Output_data_got::reserve_local): New function.
1529 (Output_data_got::reserve_global): New function.
1530 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1531 section_offsets_ with accessor function.
1532 (Sized_relobj_file::write_sections): Likewise.
1533 (Sized_relobj_file::do_relocate_sections): Likewise.
1534 * target.h (Sized_target::reserve_local_got_entry): New function.
1535 (Sized_target::reserve_global_got_entry): New function.
1536 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1537 (Target_x86_64::reserve_global_got_entry): New function.
1538 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1540 2011-05-23 Cary Coutant <ccoutant@google.com>
1542 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1543 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1544 bit when checking got_type.
1545 * incremental.cc (Sized_incremental_binary::setup_readers):
1546 Store symbol table and string table locations; initialize bit vector
1547 of file status flags.
1548 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1550 (Sized_incremental_binary::do_process_got_plt): New function.
1551 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1552 (Output_section_incremental_inputs::set_final_data_size): Record
1553 file index for each input file.
1554 (Output_section_incremental_inputs::write_got_plt): Store file index
1555 instead of input entry offset for each GOT entry.
1557 (Incremental_input_entry::Incremental_input_entry): Initialize new
1559 (Incremental_input_entry::set_offset): Store file index.
1560 (Incremental_input_entry::get_file_index): New function.
1561 (Incremental_input_entry::file_index_): New data member.
1562 (Incremental_binary::process_got_plt): New function.
1563 (Incremental_binary::do_process_got_plt): New function.
1564 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1566 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1567 (Sized_incremental_binary::set_file_is_unchanged): New function.
1568 (Sized_incremental_binary::file_is_unchanged): New function.
1569 (Sized_incremental_binary::do_process_got_plt): New function.
1570 (Sized_incremental_binary::file_status_): New data member.
1571 (Sized_incremental_binary::main_symtab_loc_): New data member.
1572 (Sized_incremental_binary::main_strtab_loc_): New data member.
1573 * output.cc (Output_data_got::Got_entry::write): Add case
1575 (Output_data_got::add_global): Call add_got_entry.
1576 (Output_data_got::add_global_plt): Likewise.
1577 (Output_data_got::add_global_with_rel): Likewise.
1578 (Output_data_got::add_global_with_rela): Likewise.
1579 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1580 (Output_data_got::add_global_pair_with_rela): Likewise.
1581 (Output_data_got::add_local): Call add_got_entry.
1582 (Output_data_got::add_local_plt): Likewise.
1583 (Output_data_got::add_local_with_rel): Likewise.
1584 (Output_data_got::add_local_with_rela): Likewise.
1585 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1586 (Output_data_got::add_local_pair_with_rela): Likewise.
1587 (Output_data_got::reserve_slot): New function.
1588 (Output_data_got::reserve_slot_for_global): New function.
1589 (Output_data_got::add_got_entry): New function.
1590 (Output_data_got::add_got_entry_pair): New function.
1591 (Output_section::add_output_section_data): Edit FIXME.
1593 (Output_section_data_build::Output_section_data_build): New
1594 constructor with size parameter.
1595 (Output_data_space::Output_data_space): Likewise.
1596 (Output_data_got::Output_data_got): Initialize new data member; new
1597 constructor with size parameter.
1598 (Output_data_got::add_constant): Call add_got_entry.
1599 (Output_data_got::reserve_slot): New function.
1600 (Output_data_got::reserve_slot_for_global): New function.
1601 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1602 (Output_data_got::add_got_entry): New function.
1603 (Output_data_got::add_got_entry_pair): New function.
1604 (Output_data_got::free_list_): New data member.
1605 * target.h (Sized_target::init_got_plt_for_update): New function.
1606 (Sized_target::register_global_plt_entry): New function.
1607 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1608 Initialize new data member; call init; add constructor with PLT count.
1609 (Output_data_plt_x86_64::init): New function.
1610 (Output_data_plt_x86_64::add_relocation): New function.
1611 (Output_data_plt_x86_64::reserve_slot): New function.
1612 (Output_data_plt_x86_64::free_list_): New data member.
1613 (Target_x86_64::init_got_plt_for_update): New function.
1614 (Target_x86_64::register_global_plt_entry): New function.
1615 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1616 incremental updates.
1617 (Output_data_plt_x86_64::add_relocation): New function.
1618 * testsuite/object_unittest.cc (Object_test): Set default options.
1620 2011-05-16 Ian Lance Taylor <iant@google.com>
1622 * options.h (class General_options): Make -i a synonym for -r.
1624 2011-05-16 Ian Lance Taylor <iant@google.com>
1626 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1628 2011-05-10 Cary Coutant <ccoutant@google.com>
1630 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1633 2011-05-06 Ian Lance Taylor <iant@google.com>
1635 * layout.cc (Layout::layout): If the output section flags change,
1636 update the ordering.
1638 2011-04-25 Cary Coutant <ccoutant@google.com>
1640 * incremental-dump.cc (dump_incremental_inputs): Print local
1641 symbol info for each input file.
1643 (Output_section_incremental_inputs::set_final_data_size): Add local
1644 symbol info to input file entries in incremental info.
1645 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1646 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1647 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1648 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1650 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1651 (Sized_incr_relobj::do_relocate): Write the local symbols.
1652 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1653 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1654 Adjust size of input file header.
1655 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1656 (Incremental_inputs_reader::get_local_symbol_count): New function.
1657 (Incremental_inputs_reader::get_input_section): Adjust size of input
1659 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1660 (Sized_incr_relobj::This): New typedef.
1661 (Sized_incr_relobj::sym_size): New const data member.
1662 (Sized_incr_relobj::Local_symbol): New struct.
1663 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1664 (Sized_incr_relobj::do_local_symbol_offset): New function.
1665 (Sized_incr_relobj::local_symbol_count_): New data member.
1666 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1667 (Sized_incr_relobj::local_symbol_index_): New data member.
1668 (Sized_incr_relobj::local_symbol_offset_): New data member.
1669 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1670 (Sized_incr_relobj::local_symbols_): New data member.
1671 * object.h (Relobj::output_local_symbol_count): New function.
1672 (Relobj::local_symbol_offset): New function.
1673 (Relobj::do_output_local_symbol_count): New function.
1674 (Relobj::do_local_symbol_offset): New function.
1675 (Sized_relobj::do_output_local_symbol_count): New function.
1676 (Sized_relobj::do_local_symbol_offset): New function.
1678 2011-04-22 Vladimir Simonov <sv@sw.ru>
1680 * descriptors.cc (set_close_on_exec): New function.
1681 (Descriptors::open): Use set_close_on_exec.
1682 * output.cc (S_ISLNK): Define if not defined.
1684 2011-04-22 Cary Coutant <ccoutant@google.com>
1686 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1688 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1689 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1690 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1692 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1693 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1694 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1696 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1698 (Incremental_binary::apply_incremental_relocs): New function.
1699 (Incremental_binary::do_apply_incremental_relocs): New function.
1700 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1702 (Sized_incremental_binary::add_global_symbol): New function.
1703 (Sized_incremental_binary::global_symbol): New function.
1704 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1705 (Sized_incremental_binary::symbol_map_): New data member.
1706 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1707 * target.h (Sized_target::apply_relocation): New function.
1708 * target-reloc.h (apply_relocation): New function.
1709 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1711 2011-04-22 Doug Kwan <dougkwan@google.com>
1713 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1714 flag of a SHT_ARM_EXIDX section.
1715 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1716 * testsuite/Makefile.in: Regenerate.
1717 * testsuite/arm_exidx_test.s: New file.
1718 * testsuite/arm_exidx_test.sh: Same.
1720 2011-04-20 Cary Coutant <ccoutant@google.com>
1723 * archive.h (Incremental_archive_entry::Archive_member):
1724 Initialize arg_serial_ (second constructor).
1726 2011-04-17 Ian Lance Taylor <iant@google.com>
1728 * object.cc (Relocate_info::location): Simplify location string.
1729 * errors.cc (Errors::error_at_location): Don't print program
1731 (Errors::warning_at_location): Likewise.
1732 (Errors::undefined_symbol): Likewise.
1733 * testsuite/debug_msg.sh: Update accordingly.
1735 2011-04-14 Cary Coutant <ccoutant@google.com>
1737 * gold/layout.cc (Layout::symtab_section_offset): New function.
1738 * gold/layout.h (Layout::symtab_section_offset): New function.
1739 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1741 2011-04-12 Ian Lance Taylor <iant@google.com>
1743 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1744 with MREMAP_MAYMOVE.
1745 * output.h (class Output_file): Add map_is_allocated_ field.
1746 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1747 not available, provide stubs. If mremap is not available, #define
1749 (MREMAP_MAYMOVE): Define if not defined.
1750 (Output_file::Output_file): Initialize map_is_allocated_.
1751 (Output_file::resize): Check map_is_allocated_.
1752 (Output_file::map_anonymous): If mmap fails, use malloc.
1753 (Output_file::unmap): Don't do anything for an anonymous map.
1754 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1755 is not available, provide stubs.
1756 (File_read::View::~View): Use free rather than delete[].
1757 (File_read::make_view): Use malloc rather than new[]. If mmap
1759 (File_read::find_or_make_view): Use malloc rather than new[].
1760 * gold.h: Remove HAVE_REMAP code.
1761 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1762 exists. Rename mremap to gold_mremap. If mmap is not available
1764 * configure, config.in: Rebuild.
1766 2011-04-11 Ian Lance Taylor <iant@google.com>
1768 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1769 initialize local variable v.
1771 2011-04-11 Cary Coutant <ccoutant@google.com>
1773 * archive.cc (Archive::include_member): Adjust call to
1775 (Add_archive_symbols::run): Track argument serial numbers.
1776 (Lib_group::include_member): Likewise.
1777 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1778 * archive.h (Incremental_archive_entry::Archive_member):
1779 Initialize arg_serial_.
1780 (Archive_member::arg_serial_): New data member.
1781 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1782 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1784 (Sized_dynobj::do_for_all_local_got_entries): New function.
1785 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1787 * fileread.cc (get_mtime): New function.
1788 * fileread.h (get_mtime): New function.
1789 * gold.cc (queue_initial_tasks): Check for incremental update.
1790 (process_incremental_input): New function.
1791 (queue_middle_tasks): Don't force valid target for incremental
1793 * incremental-dump.cc (find_input_containing_global): Adjust
1794 size of symbol info entry.
1795 (dump_incremental_inputs): Dump argument serial number and
1796 in_system_directory flag; bias shndx by 1; print symbol names
1797 when dumping per-file symbol lists; use new symbol info readers.
1799 (Output_section_incremental_inputs:update_data_size): New function.
1800 (Sized_incremental_binary::setup_readers): Setup input readers
1801 for each input file; build maps for files added from libraries
1803 (Sized_incremental_binary::check_input_args): New function.
1804 (Sized_incremental_binary::do_check_inputs): Build map of argument
1805 serial numbers to input arguments.
1806 (Sized_incremental_binary::do_file_has_changed): Rename
1807 do_file_is_unchanged to this; compare file modification times.
1808 (Sized_incremental_binary::do_init_layout): New function.
1809 (Sized_incremental_binary::do_reserve_layout): New function.
1810 (Sized_incremental_binary::do_get_input_reader): Remove.
1811 (Sized_incremental_binary::get_symtab_view): New function.
1812 (Incremental_checker::can_incrementally_link_output_file): Remove.
1813 (Incremental_inputs::report_command_line): Exclude --debug options.
1814 (Incremental_inputs::report_archive_begin): Add parameter; track
1815 argument serial numbers; don't put input file entry for archive
1816 before archive members.
1817 (Incremental_inputs::report_archive_end): Put input file entry
1818 for archive after archive members.
1819 (Incremental_inputs::report_object): Add parameter; track argument
1820 serial numbers and in_system_directory flag.
1821 (Incremental_inputs::report_script): Add parameter; track argument
1823 (Output_section_incremental_inputs::set_final_data_size): Adjust
1824 size of symbol info entry; check for forwarding symbols.
1825 (Output_section_incremental_inputs::write_input_files): Write
1826 in_system_directory flag and argument serial number.
1827 (Output_section_incremental_inputs::write_info_blocks): Map section
1828 indices between incremental info and original input file; store
1829 input section index for each symbol.
1830 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1831 change operator() to visit().
1832 (class Global_got_offset_visitor): Likewise.
1833 (class Global_symbol_visitor_got_plt):
1834 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1836 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1837 (Sized_incr_relobj::do_read_symbols): New function.
1838 (Sized_incr_relobj::do_layout): New function.
1839 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1840 (Sized_incr_relobj::do_add_symbols): New function.
1841 (Sized_incr_relobj::do_should_include_member): New function.
1842 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1843 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1844 (Sized_incr_relobj::do_section_size): New function.
1845 (Sized_incr_relobj::do_section_name): New function.
1846 (Sized_incr_relobj::do_section_contents): New function.
1847 (Sized_incr_relobj::do_section_flags): New function.
1848 (Sized_incr_relobj::do_section_entsize): New function.
1849 (Sized_incr_relobj::do_section_address): New function.
1850 (Sized_incr_relobj::do_section_type): New function.
1851 (Sized_incr_relobj::do_section_link): New function.
1852 (Sized_incr_relobj::do_section_info): New function.
1853 (Sized_incr_relobj::do_section_addralign): New function.
1854 (Sized_incr_relobj::do_initialize_xindex): New function.
1855 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1856 (Sized_incr_relobj::do_read_relocs): New function.
1857 (Sized_incr_relobj::do_gc_process_relocs): New function.
1858 (Sized_incr_relobj::do_scan_relocs): New function.
1859 (Sized_incr_relobj::do_count_local_symbols): New function.
1860 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1861 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1862 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1863 (Sized_incr_relobj::do_relocate): New function.
1864 (Sized_incr_relobj::do_set_section_offset): New function.
1865 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1866 (Sized_incr_dynobj::do_read_symbols): New function.
1867 (Sized_incr_dynobj::do_layout): New function.
1868 (Sized_incr_dynobj::do_add_symbols): New function.
1869 (Sized_incr_dynobj::do_should_include_member): New function.
1870 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1871 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1872 (Sized_incr_dynobj::do_section_size): New function.
1873 (Sized_incr_dynobj::do_section_name): New function.
1874 (Sized_incr_dynobj::do_section_contents): New function.
1875 (Sized_incr_dynobj::do_section_flags): New function.
1876 (Sized_incr_dynobj::do_section_entsize): New function.
1877 (Sized_incr_dynobj::do_section_address): New function.
1878 (Sized_incr_dynobj::do_section_type): New function.
1879 (Sized_incr_dynobj::do_section_link): New function.
1880 (Sized_incr_dynobj::do_section_info): New function.
1881 (Sized_incr_dynobj::do_section_addralign): New function.
1882 (Sized_incr_dynobj::do_initialize_xindex): New function.
1883 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1884 (make_sized_incremental_object): New function.
1885 (Incremental_library::copy_unused_symbols): New function.
1886 (Incremental_library::do_for_all_unused_symbols): New function.
1887 * incremental.h (enum Incremental_input_flags): New type.
1888 (class Incremental_checker): Remove.
1889 (Incremental_input_entry::Incremental_input_entry): Add argument
1891 (Incremental_input_entry::arg_serial): New function.
1892 (Incremental_input_entry::set_is_in_system_directory): New function.
1893 (Incremental_input_entry::is_in_system_directory): New function.
1894 (Incremental_input_entry::arg_serial_): New data member.
1895 (Incremental_input_entry::is_in_system_directory_): New data member.
1896 (class Script_info): Move here from script.h.
1897 (Script_info::Script_info): Add filename parameter.
1898 (Script_info::filename): New function.
1899 (Script_info::filename_): New data member.
1900 (Incremental_script_entry::Incremental_script_entry): Add argument
1902 (Incremental_object_entry::Incremental_object_entry): Likewise.
1903 (Incremental_object_entry::add_input_section): Build list of input
1904 sections with map to original shndx.
1905 (Incremental_object_entry::get_input_section_index): New function.
1906 (Incremental_object_entry::shndx_): New data member.
1907 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1908 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1909 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1911 (Incremental_inputs::report_archive_begin): Likewise.
1912 (Incremental_inputs::report_object): Likewise.
1913 (Incremental_inputs::report_script): Likewise.
1914 (class Incremental_global_symbol_reader): New class.
1915 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1916 and store flags and input file type.
1917 (Incremental_input_entry_reader::arg_serial): New function.
1918 (Incremental_input_entry_reader::type): Extract type from flags.
1919 (Incremental_input_entry_reader::is_in_system_directory): New function.
1920 (Incremental_input_entry_reader::get_input_section_count): Call
1921 accessor function for type.
1922 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1923 function for type; adjust size of global symbol entry.
1924 (Incremental_input_entry_reader::get_global_symbol_count): Call
1925 accessor function for type.
1926 (Incremental_input_entry_reader::get_object_count): Likewise.
1927 (Incremental_input_entry_reader::get_object_offset): Likewise.
1928 (Incremental_input_entry_reader::get_member_count): Likewise.
1929 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1930 (Incremental_input_entry_reader::get_member_offset): Likewise.
1931 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1932 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1933 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1934 (Incremental_input_entry_reader::get_global_symbol_reader): New
1936 (Incremental_input_entry_reader::get_output_symbol_index): New
1938 (Incremental_input_entry_reader::type_): Remove.
1939 (Incremental_input_entry_reader::flags_): New data member.
1940 (Incremental_inputs_reader::input_file_offset): New function.
1941 (Incremental_inputs_reader::input_file_index): New function.
1942 (Incremental_inputs_reader::input_file): Call input_file_offset.
1943 (Incremental_inputs_reader::input_file_at_offset): New function.
1944 (Incremental_relocs_reader::get_r_type): Reformat.
1945 (Incremental_relocs_reader::get_r_shndx): Reformat.
1946 (Incremental_relocs_reader::get_r_offset): Reformat.
1947 (Incremental_relocs_reader::data): New function.
1948 (Incremental_binary::Incremental_binary): Initialize new data members.
1949 (Incremental_binary::check_inputs): Add cmdline parameter.
1950 (Incremental_binary::file_is_unchanged): Remove.
1951 (Input_reader::arg_serial): New function.
1952 (Input_reader::get_unused_symbol_count): New function.
1953 (Input_reader::get_unused_symbol): New function.
1954 (Input_reader::do_arg_serial): New function.
1955 (Input_reader::do_get_unused_symbol_count): New function.
1956 (Input_reader::do_get_unused_symbol): New function.
1957 (Incremental_binary::input_file_count): New function.
1958 (Incremental_binary::get_input_reader): Change signature to use
1959 index instead of filename.
1960 (Incremental_binary::file_has_changed): New function.
1961 (Incremental_binary::get_input_argument): New function.
1962 (Incremental_binary::get_library): New function.
1963 (Incremental_binary::get_script_info): New function.
1964 (Incremental_binary::init_layout): New function.
1965 (Incremental_binary::reserve_layout): New function.
1966 (Incremental_binary::output_file): New function.
1967 (Incremental_binary::do_check_inputs): New function.
1968 (Incremental_binary::do_file_is_unchanged): Remove.
1969 (Incremental_binary::do_file_has_changed): New function.
1970 (Incremental_binary::do_init_layout): New function.
1971 (Incremental_binary::do_reserve_layout): New function.
1972 (Incremental_binary::do_input_file_count): New function.
1973 (Incremental_binary::do_get_input_reader): Change signature.
1974 (Incremental_binary::input_args_map_): New data member.
1975 (Incremental_binary::library_map_): New data member.
1976 (Incremental_binary::script_map_): New data member.
1977 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1979 (Sized_incremental_binary::output_section): New function.
1980 (Sized_incremental_binary::inputs_reader): Add const.
1981 (Sized_incremental_binary::symtab_reader): Add const.
1982 (Sized_incremental_binary::relocs_reader): Add const.
1983 (Sized_incremental_binary::got_plt_reader): Add const.
1984 (Sized_incremental_binary::get_symtab_view): New function.
1985 (Sized_incremental_binary::Inputs_reader): New typedef.
1986 (Sized_incremental_binary::Input_entry_reader): New typedef.
1987 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1988 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1989 (Sized_incremental_binary::do_file_has_changed): New function.
1990 (Sized_incremental_binary::do_init_layout): New function.
1991 (Sized_incremental_binary::do_reserve_layout): New function.
1992 (Sized_input_reader::Inputs_reader): Remove.
1993 (Sized_input_reader::Input_entry_reader): Remove.
1994 (Sized_input_reader::do_arg_serial): New function.
1995 (Sized_input_reader::do_get_unused_symbol_count): New function.
1996 (Sized_input_reader::do_get_unused_symbol): New function.
1997 (Sized_incremental_binary::do_input_file_count): New function.
1998 (Sized_incremental_binary::do_get_input_reader): Change signature;
1999 use index instead of filename.
2000 (Sized_incremental_binary::section_map_): New data member.
2001 (Sized_incremental_binary::input_entry_readers_): New data member.
2002 (class Sized_incr_relobj): New class.
2003 (class Sized_incr_dynobj): New class.
2004 (make_sized_incremental_object): New function.
2005 (class Incremental_library): New class.
2006 * layout.cc (Free_list::num_lists): New static data member.
2007 (Free_list::num_nodes): New static data member.
2008 (Free_list::num_removes): New static data member.
2009 (Free_list::num_remove_visits): New static data member.
2010 (Free_list::num_allocates): New static data member.
2011 (Free_list::num_allocate_visits): New static data member.
2012 (Free_list::init): New function.
2013 (Free_list::remove): New function.
2014 (Free_list::allocate): New function.
2015 (Free_list::dump): New function.
2016 (Free_list::print_stats): New function.
2017 (Layout_task_runner::run): Resize output file for incremental updates.
2018 (Layout::Layout): Initialize new data members.
2019 (Layout::set_incremental_base): New function.
2020 (Layout::init_fixed_output_section): New function.
2021 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2022 incremental updates.
2023 (Layout::create_gold_note): Do not create gold note section for
2024 incremental updates.
2025 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2026 for incremental updates.
2027 (Layout::set_section_offsets): For incremental updates, allocate space
2029 (Layout::create_symtab_sections): Layout with offsets relative to
2030 start of section; for incremental updates, allocate space from free
2032 (Layout::create_shdrs): For incremental updates, allocate space from
2034 (Layout::finish_dynamic_section): For incremental updates, do not
2035 check --as-needed (fixed in subsequent patch).
2036 * layout.h (class Free_list): New class.
2037 (Layout::set_incremental_base): New function.
2038 (Layout::incremental_base): New function.
2039 (Layout::init_fixed_output_section): New function.
2040 (Layout::allocate): New function.
2041 (Layout::incremental_base_): New data member.
2042 (Layout::free_list_): New data member.
2043 * main.cc (main): Print Free_list statistics.
2044 * object.cc (Relobj::finalize_incremental_relocs): Add
2045 clear_counts parameter; clear counts only when clear_counts is set.
2046 (Sized_relobj::Sized_relobj): Initialize new base class.
2047 (Sized_relobj::do_layout): Don't report special sections.
2048 (Sized_relobj::do_for_all_local_got_entries): New function.
2049 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2050 symtab_off to all symbol table offsets.
2051 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2052 * object.h (class Got_offset_list): Move to top of file.
2053 (Object::Object): Allow case where input_file == NULL.
2054 (Object::~Object): Likewise.
2055 (Object::input_file): Assert that input_file != NULL.
2056 (Object::lock): Allow case where input_file == NULL.
2057 (Object::unlock): Likewise.
2058 (Object::is_locked): Likewise.
2059 (Object::token): Likewise.
2060 (Object::release): Likewise.
2061 (Object::is_incremental): New function.
2062 (Object::get_mtime): New function.
2063 (Object::for_all_local_got_entries): New function.
2064 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2065 (Object::set_is_in_system_directory): New function.
2066 (Object::is_in_system_directory): New function.
2067 (Object::do_is_incremental): New function.
2068 (Object::do_get_mtime): New function.
2069 (Object::do_for_all_local_got_entries): New function.
2070 (Object::is_in_system_directory_): New data member.
2071 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2072 (class Sized_relobj_base): New class.
2073 (class Sized_relobj): Derive from Sized_relobj_base.
2074 (class Sized_relobj::Symbols): Redeclare from base class.
2075 (class Sized_relobj::local_got_offset_list): Remove.
2076 (class Sized_relobj::Output_sections): Redeclare from base class.
2077 (class Sized_relobj::do_for_all_local_got_entries): New function.
2078 (class Sized_relobj::write_local_symbols): Add offset parameter.
2079 (class Sized_relobj::local_symbol_offset_): Update comment.
2080 (class Sized_relobj::local_dynsym_offset_): Update comment.
2081 * options.cc (Input_arguments::add_file): Remove const.
2082 * options.h (Input_file_argument::Input_file_argument):
2083 Initialize arg_serial_ (all constructors).
2084 (Input_file_argument::set_arg_serial): New function.
2085 (Input_file_argument::arg_serial): New function.
2086 (Input_file_argument::arg_serial_): New data member.
2087 (Input_arguments::Input_arguments): Initialize file_count_.
2088 (Input_arguments::add_file): Remove const.
2089 (Input_arguments::number_of_input_files): New function.
2090 (Input_arguments::file_count_): New data member.
2091 (Command_line::number_of_input_files): Call
2092 Input_arguments::number_of_input_files.
2093 * output.cc (Output_segment_headers::Output_segment_headers):
2095 (Output_section::Input_section::current_data_size): New function.
2096 (Output_section::Output_section): Initialize new data members.
2097 (Output_section::add_input_section): Don't do merge sections for
2098 an incremental link; allocate space from free list for an
2100 (Output_section::add_output_section_data): Allocate space from
2101 free list for an incremental update.
2102 (Output_section::update_data_size): New function.
2103 (Output_section::set_fixed_layout): New function.
2104 (Output_section::reserve): New function.
2105 (Output_segment::set_section_addresses): Remove const.
2106 (Output_segment::set_section_list_addresses): Remove const; allocate
2107 space from free list for an incremental update.
2108 (Output_segment::set_offset): Adjust size of RELRO segment for an
2110 * output.h (Output_data::current_data_size): Move here from
2112 (Output_data::pre_finalize_data_size): New function.
2113 (Output_data::update_data_size): New function.
2114 (Output_section_headers::update_data_size): new function.
2115 (Output_section_data_build::current_data_size): Move to Output_data.
2116 (Output_data_strtab::update_data_size): New function.
2117 (Output_section::current_data_size): Move to Output_data.
2118 (Output_section::set_fixed_layout): New function.
2119 (Output_section::has_fixed_layout): New function.
2120 (Output_section::reserve): New function.
2121 (Output_section::update_data_size): New function.
2122 (Output_section::has_fixed_layout_): New data member.
2123 (Output_section::free_list_): New data member.
2124 (Output_segment::set_section_addresses): Remove const.
2125 (Output_segment::set_section_list_addresses): Remove const.
2126 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2128 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2130 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2131 parameter when calling Add_symbols constructor; store argument
2132 serial number for members of a lib group.
2133 (Add_symbols::locks): Allow case where token == NULL.
2134 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2135 (Read_member::~Read_member): New function.
2136 (Read_member::is_runnable): New function.
2137 (Read_member::locks): New function.
2138 (Read_member::run): New function.
2139 (Check_script::~Check_script): New function.
2140 (Check_script::is_runnable): New function.
2141 (Check_script::locks): New function.
2142 (Check_script::run): New function.
2143 (Check_library::~Check_library): New function.
2144 (Check_library::is_runnable): New function.
2145 (Check_library::locks): New function.
2146 (Check_library::run): New function.
2147 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2148 (Add_symbols::library_): New data member.
2149 (class Read_member): New class.
2150 (class Check_script): New class.
2151 (class Check_library): New class.
2152 * reloc.cc (Read_relocs::is_runnable): Allow case where
2154 (Read_relocs::locks): Likewise.
2155 (Scan_relocs::locks): Likewise.
2156 (Relocate_task::locks): Likewise.
2157 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2159 (Sized_relobj::incremental_relocs_scan): Fix comment.
2160 (Sized_relobj::do_relocate): Pass output file offset to
2161 write_local_symbols.
2162 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2163 from class declaration.
2164 * script.cc (read_input_script): Allocate Script_info; pass
2165 argument serial number to report_script.
2166 * script.h (class Script_info): Move to incremental.h.
2167 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2168 * symtab.h (Symbol_table::add_from_incrobj): New function.
2169 (Symbol_table::set_file_offset): New function.
2171 2011-04-05 Cary Coutant <ccoutant@google.com>
2173 * incremental-dump.cc (dump_incremental_inputs): Change signature
2174 to take a Sized_incremental_binary; change caller. Use readers
2175 in Sized_incremental_binary.
2177 (Sized_incremental_binary::find_incremental_inputs_sections):
2178 Rename do_find_incremental_inputs_sections to this.
2179 (Sized_incremental_binary::setup_readers): New function.
2180 (Sized_incremental_binary::do_check_inputs): Check
2181 has_incremental_info_ flag; move setup code to setup_readers;
2183 (Sized_incremental_binary::do_file_is_unchanged): New function.
2184 (Sized_incremental_binary::do_get_input_reader): New function.
2185 * incremental.h (class Incremental_binary): Move to end of file.
2186 (Incremental_binary::file_is_unchanged): New function.
2187 (Incremental_binary::do_file_is_unchanged): New function.
2188 (Incremental_binary::Input_reader): New class.
2189 (Incremental_binary::get_input_reader): New function.
2190 (class Sized_incremental_binary): Move to end of file.
2191 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2192 input section reader classes.
2193 (Sized_incremental_binary::has_incremental_info): New function.
2194 (Sized_incremental_binary::inputs_reader): New function.
2195 (Sized_incremental_binary::symtab_reader): New function.
2196 (Sized_incremental_binary::relocs_reader): New function.
2197 (Sized_incremental_binary::got_plt_reader): New function.
2198 (Sized_incremental_binary::do_file_is_unchanged): New function.
2199 (Sized_incremental_binary::Sized_input_reader): New class.
2200 (Sized_incremental_binary::get_input_reader): New function.
2201 (Sized_incremental_binary::find_incremental_inputs_sections):
2202 Rename do_find_incremental_inputs_sections to this.
2203 (Sized_incremental_binary::setup_readers): New function.
2204 (Sized_incremental_binary::has_incremental_info_): New data member.
2205 (Sized_incremental_binary::inputs_reader_): New data member.
2206 (Sized_incremental_binary::symtab_reader_): New data member.
2207 (Sized_incremental_binary::relocs_reader_): New data member.
2208 (Sized_incremental_binary::got_plt_reader_): New data member.
2209 (Sized_incremental_binary::current_input_file_): New data member.
2211 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2214 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2217 2011-03-30 Cary Coutant <ccoutant@google.com>
2219 * archive.cc (Archive::include_member): Adjust call to report_object.
2220 (Add_archive_symbols::run): Add script_info to call to
2221 report_archive_begin.
2222 (Lib_group::include_member): Adjust call to report_object.
2223 (Add_lib_group_symbols::run): Adjust call to report_object.
2224 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2225 blocks. Add object count for script input files.
2226 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2227 script_info parameter; change all callers.
2228 (Incremental_inputs::report_object): Add script_info parameter;
2230 (Incremental_inputs::report_script): Store backpointer to
2231 incremental info entry.
2232 (Output_section_incremental_inputs::set_final_data_size): Record
2233 additional information for scripts.
2234 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2235 * incremental.h (Incremental_script_entry::add_object): New function.
2236 (Incremental_script_entry::get_object_count): New function.
2237 (Incremental_script_entry::get_object): New function.
2238 (Incremental_script_entry::objects_): New data member; adjust
2240 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2241 (Incremental_inputs::report_object): Add script_info parameter.
2242 (Incremental_inputs_reader::get_object_count): New function.
2243 (Incremental_inputs_reader::get_object_offset): New function.
2244 * options.cc (Input_arguments::add_file): Return reference to
2246 * options.h (Input_argument::set_script_info): New function.
2247 (Input_argument::script_info): New function.
2248 (Input_argument::script_info_): New data member; adjust all
2250 (Input_file_group::add_file): Return reference to new input argument.
2251 (Input_file_lib::add_file): Likewise.
2252 (Input_arguments::add_file): Likewise.
2253 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2254 * script.cc (Parser_closure::Parser_closure): Add script_info
2255 parameter; adjust all callers.
2256 (Parser_closure::script_info): New function.
2257 (Parser_closure::script_info_): New data member.
2258 (read_input_script): Report scripts earlier to incremental info.
2259 (script_add_file): Set script_info in Input_argument.
2260 (script_add_library): Likewise.
2261 * script.h (Script_options::Script_info): Rewrite class.
2263 2011-03-29 Cary Coutant <ccoutant@google.com>
2265 * archive.cc (Library_base::should_include_member): Move
2266 method here from class Archive.
2267 (Archive::Archive): Initialize base class.
2268 (Archive::should_include_member): Move to base class.
2269 (Archive::do_for_all_unused_symbols): New function.
2270 (Add_archive_symbols::run): Remove redundant access to
2272 (Lib_group::Lib_group): Initialize base class.
2273 (Lib_group::do_filename): New function.
2274 (Lib_group::include_member): Pass pointer to Lib_group to
2276 (Lib_group::do_for_all_unused_symbols): New function.
2277 (Add_lib_group_symbols::run): Report archive information for
2279 * archive.h (class Library_base): New base class.
2280 (class Archive): Derive from Library_base.
2281 (Archive::filename): Move to base class.
2282 (Archive::set_incremental_info): Likewise.
2283 (Archive::incremental_info): Likewise.
2284 (Archive::Should_include): Likewise.
2285 (Archive::should_include_member): Likewise.
2286 (Archive::Armap_entry): Remove.
2287 (Archive::Unused_symbol_iterator): Remove.
2288 (Archive::unused_symbols_begin): Remove.
2289 (Archive::unused_symbols_end): Remove.
2290 (Archive::do_filename): New function.
2291 (Archive::do_get_mtime): New function.
2292 (Archive::do_for_all_unused_symbols): New function.
2293 (Archive::task_): Move to base class.
2294 (Archive::incremental_info_): Likewise.
2295 (class Lib_group): Derive from Library_base.
2296 (Lib_group::do_filename): New function.
2297 (Lib_group::do_get_mtime): New function.
2298 (Lib_group::do_for_all_unused_symbols): New function.
2299 (Lib_group::task_): Move to base class.
2300 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2302 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2304 * incremental.cc (Incremental_inputs::report_archive_begin):
2305 Use Library_base; call library's get_mtime; add incremental inputs
2306 entry before members.
2307 (class Unused_symbol_visitor): New class.
2308 (Incremental_inputs::report_archive_end): Use Library_base; use
2309 visitor class to record unused symbols; don't add incremental inputs
2310 entry after members.
2311 (Incremental_inputs::report_object): Use Library_base.
2313 (Incremental_archive_entry::Incremental_archive_entry): Remove
2314 unused Archive parameter.
2315 (Incremental_inputs::report_archive_begin): Use Library_base.
2316 (Incremental_inputs::report_archive_end): Likewise.
2317 (Incremental_inputs::report_object): Likewise.
2318 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2320 * object.h (Object::for_all_global_symbols): New function.
2321 (Object::do_for_all_global_symbols): New function.
2322 (Sized_relobj::do_for_all_global_symbols): New function.
2323 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2325 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2328 2011-03-27 Ian Lance Taylor <iant@google.com>
2330 * archive.cc (Archive::interpret_header): Return -1 if something
2331 goes wrong. Change callers accordingly.
2333 2011-03-25 Cary Coutant <ccoutant@google.com>
2335 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2336 * testsuite/Makefile.in: Regenerate.
2338 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2340 * plugin.cc (get_view): New.
2341 (Plugin::load): Pass get_view to the plugin.
2342 (Plugin_manager::get_view): New.
2344 2011-03-21 Ian Lance Taylor <iant@google.com>
2346 * testsuite/final_layout.sh: Rewrite to not use dc.
2347 * testsuite/relro_test.sh: Fail if dc is not present.
2349 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2351 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2353 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2354 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2356 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2357 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2359 2011-03-14 Ian Lance Taylor <iant@google.com>
2361 * script-sections.cc (Sort_output_sections::script_compare):
2362 Rename from is_before, change return type.
2363 (Sort_output_sections::operator()): Adjust accordingly.
2365 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2368 * testsuite/odr_violation2.cc: Add comment to make all error line
2369 numbers double digits.
2370 * testsuite/debug_msg.sh: Adjust expected errors.
2372 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2374 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2375 but mark earlier ones as non-canonical
2376 (offset_to_iterator): Update search target and example
2377 (do_addr2line): Return extra lines in a vector*
2378 (format_file_lineno): Extract from do_addr2line
2379 (one_addr2line): Add vector* out-param
2380 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2381 when a lineno entry appeared last for its instruction
2382 (Dwarf_line_info): Add vector* out-param
2383 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2384 * symtab.cc (Odr_violation_compare): Include the lineno in the
2386 (linenos_from_loc): New. Combine the canonical line for an
2387 address with its other lines.
2388 (True_if_intersect): New. Helper functor to make
2389 std::set_intersection a query.
2390 (detect_odr_violations): Compare sets of lines instead of just
2391 one line for each function. This became less deterministic, but
2392 has fewer false positives.
2393 * symtab.h: Declarations.
2394 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2395 mix an optimized and non-optimized object in the same binary
2396 (odr_violation2.so): Same.
2397 * testsuite/Makefile.in: Regenerate from Makefile.am.
2398 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2399 * testsuite/debug_msg.sh: Update line numbers and add
2401 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2402 non-optimized context.
2403 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2404 isn't inlined, and use OdrDerived in an optimized context.
2405 * testsuite/odr_header1.h: Defines OdrDerived, where
2406 optimization will change the
2407 first-instruction-in-the-destructor's file and line number.
2408 * testsuite/odr_header2.h: Defines OdrBase.
2410 2011-03-09 Ian Lance Taylor <iant@google.com>
2412 * fileread.cc (File_read::clear_views): Don't delete the whole
2415 2011-03-08 Ian Lance Taylor <iant@google.com>
2418 * fileread.cc: #include <climits>.
2419 (GOLD_IOV_MAX): Define.
2420 (File_read::read_multiple): Limit number of entries by iov_max.
2421 * fileread.h (class File_read): Always set max_readv_entries to
2424 2011-03-07 Ian Lance Taylor <iant@google.com>
2427 * options.h (class General_options): Add -dy and -dn.
2429 2011-03-02 Cary Coutant <ccoutant@google.com>
2431 * testsuite/script_test_9.t: Add TLS segment.
2433 2011-03-02 Simon Baldwin <simonb@google.com>
2435 * configure.ac: Add check for gnu_indirect_function support in
2436 the toolchain building binutils.
2437 * configure: Rebuild.
2439 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2441 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2442 plugin only symbols.
2443 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2444 in plugin files as not needed in the symbol table.
2446 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2448 * output.cc (Output_section::add_input_section): Delay fill
2449 generation for section ordering.
2451 2011-02-09 Ian Lance Taylor <iant@google.com>
2454 * object.h (class Sized_relobj): Remove clear_local_symbols.
2455 * reloc.cc (Sized_relobj::do_relocate): Don't call
2456 clear_local_symbols.
2458 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2460 * plugin.cc (is_visible_from_outside): Return true for symbols
2463 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2465 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2468 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2470 * icf.h (is_section_foldable_candidate): Change type of parameter
2472 * icf.cc (Icf::find_identical_sections): Change type of local variable
2473 section_name to be std::string.
2474 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2476 2011-01-25 Ian Lance Taylor <iant@google.com>
2478 * script.cc (script_add_extern): Rewrite to use
2479 add_symbol_reference.
2481 2011-01-25 Doug Kwan <dougkwan@google.com>
2483 * icf.cc (get_section_contents): Always lock section's object.
2485 2011-01-24 Ian Lance Taylor <iant@google.com>
2487 * options.h (class General_options): Accept
2488 --no-detect-odr-violations.
2490 2011-01-24 Ian Lance Taylor <iant@google.com>
2492 * version.cc (version_string): Bump to 1.11.
2494 2011-01-24 Ian Lance Taylor <iant@google.com>
2496 * plugin.cc (class Plugin_rescan): Define new class.
2497 (Plugin_manager::claim_file): Set any_claimed_.
2498 (Plugin_manager::save_archive): New function.
2499 (Plugin_manager::save_input_group): New function.
2500 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2502 (Plugin_manager::new_undefined_symbol): New function.
2503 (Plugin_manager::rescan): New function.
2504 (Plugin_manager::rescannable_defines): New function.
2505 (Plugin_manager::add_input_file): Set any_added_.
2506 * plugin.h (class Plugin_manager): define new fields rescannable_,
2507 undefined_symbols_, any_claimed_, and any_added_. Declare
2508 Plugin_rescan as friend. Declare new functions.
2509 (Plugin_manager::Rescannable): Define type.
2510 (Plugin_manager::Rescannable_list): Define type.
2511 (Plugin_manager::Undefined_symbol_list): Define type.
2512 (Plugin_manager::Plugin_manager): Initialize new fields.
2513 * archive.cc (Archive::defines_symbol): New function.
2514 (Add_archive_symbols::run): Pass archive to plugins if any.
2515 * archive.h (class Archive): Declare defines_symbol.
2516 * readsyms.cc (Input_group::~Input_group): New function.
2517 (Finish_group::run): Pass input_group to plugins if any.
2518 * readsyms.h (class Input_group): Declare destructor.
2519 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2522 2011-01-10 Ian Lance Taylor <iant@google.com>
2524 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2526 (Layout::set_segment_offsets): Reset increase_relro before calling
2527 set_section_addresses a second time.
2529 2011-01-04 Cary Coutant <ccoutant@google.com>
2531 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2532 sections before NOBITS sections.
2534 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2536 * version.cc (print_version): Update copyright to 2011.
2538 2010-12-23 Cary Coutant <ccoutant@google.com>
2540 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2541 of OS to this->add. Add OD parameter to second form of the function.
2543 2010-12-20 Ian Lance Taylor <iant@google.com>
2545 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2546 second of two consecutive entries with same offset.
2548 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2550 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2551 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2552 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2553 to avoid unneeded links against $(LDADD).
2554 * testsuite/Makefile.in: Regenerate.
2556 2010-12-15 Ian Lance Taylor <iant@google.com>
2559 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2560 for R_X86_64_32 and R_X86_64_PC32.
2561 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2562 ver_matching_def_pic.o.
2563 (ver_matching_def_pic.o): New target.
2565 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2567 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2568 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2569 Move definition before File_read::View member definitions.
2570 (File_read::View::~View): Initialize and hold lock before
2571 updating current_mapped_bytes.
2573 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2575 * dwarf_reader.cc: Remove outdated comment.
2576 * gold-threads.cc: Fix typo in error message.
2577 * archive.cc: Fix typos in comments.
2578 * archive.h: Likewise.
2579 * arm-reloc-property.cc: Likewise.
2580 * arm-reloc-property.h: Likewise.
2581 * arm-reloc.def: Likewise.
2583 * attributes.h: Likewise.
2584 * cref.cc: Likewise.
2585 * ehframe.cc: Likewise.
2586 * fileread.h: Likewise.
2588 * i386.cc: Likewise.
2590 * incremental.h: Likewise.
2591 * int_encoding.cc: Likewise.
2592 * layout.h: Likewise.
2593 * main.cc: Likewise.
2594 * merge.h: Likewise.
2595 * object.cc: Likewise.
2596 * object.h: Likewise.
2597 * options.cc: Likewise.
2598 * readsyms.cc: Likewise.
2599 * reduced_debug_output.cc: Likewise.
2600 * reloc.cc: Likewise.
2601 * script-sections.cc: Likewise.
2602 * sparc.cc: Likewise.
2603 * symtab.h: Likewise.
2604 * target-reloc.h: Likewise.
2605 * target.cc: Likewise.
2606 * target.h: Likewise.
2607 * timer.cc: Likewise.
2608 * timer.h: Likewise.
2609 * x86_64.cc: Likewise.
2611 2010-12-09 Cary Coutant <ccoutant@google.com>
2613 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2615 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2616 parameter; change all callers.
2617 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2618 * options.h (warn_execstack): New option.
2620 2010-12-07 Doug Kwan <dougkwan@google.com>
2622 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2623 like function call relocations.
2625 2010-12-07 Ian Lance Taylor <iant@google.com>
2627 * archive.cc (Archive::get_elf_object_for_member): Permit
2628 punconfigured to be NULL.
2629 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2630 (Archive::include_member): Pass NULL to get_elf_object_for_member
2631 if we searched for the archive and this is the first included
2634 2010-12-01 Ian Lance Taylor <iant@google.com>
2636 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2637 track_relocs_type_ field.
2638 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2639 Set track_relocs_type_.
2640 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2641 contents when using RELA relocs.
2642 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2644 * reloc.cc (Track_relocs::next_addend): New function.
2645 * reloc.h (class Track_relocs): Declare next_addend.
2647 2010-12-01 Ian Lance Taylor <iant@google.com>
2649 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2652 2010-12-01 Ian Lance Taylor <iant@google.com>
2654 * README: Update compilers known to work and fail.
2656 2010-11-23 Matthias Klose <doko@ubuntu.com>
2658 * configure.in: For --enable-gold, handle value `default' instead of
2659 `both*'. Always install ld as ld.bfd, install as ld if gold is
2661 * configure: Regenerate.
2663 2010-11-18 Doug Kwan <dougkwan@google.com>
2665 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2666 and right_alignment to be zero. Store result alignment only if it is
2667 greater than existing alignment.
2669 2010-11-16 Cary Coutant <ccoutant@google.com>
2672 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2673 Check for ".zdebug_line".
2675 2010-11-16 Doug Kwan <dougkwan@google.com>
2676 Cary Coutant <ccoutant@google.com>
2678 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2679 by reference; adjust all callers.
2680 * output.cc (Output_segment::set_section_addresses): Adjust references
2681 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2683 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2684 end at page boundary.
2686 2010-11-16 Cary Coutant <ccoutant@google.com>
2689 * layout.cc (Layout::choose_output_section): Transform names of
2690 compressed sections even when using a script with a SECTIONS clause.
2691 (Layout::output_section_name): Remove code to transform
2692 compressed debug section names.
2693 * output.cc (Output_section::add_input_section): Use uncompressed
2694 section size when tracking input sections.
2696 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2698 * symtab.h (Symbol::NON_PIC_REF): Remove.
2699 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2700 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2701 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2702 (Symbol::use_plt_offset): Take a flags argument and pass it
2703 directly to needs_dynamic_reloc. Restrict check for undefined
2704 weak symbols to function calls.
2705 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2706 (Target_arm::Scan::global): Use it.
2707 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2708 (Target_arm::Relocate::relocate): Likewise.
2709 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2710 parameter with an r_type parameter. Use get_reference_flags
2712 (Target_arm::Relocate::relocate): Update accordingly.
2713 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2714 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2715 (Target_i386::Scan::global): Likewise.
2716 (Target_i386::Relocate::relocate): Likewise.
2717 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2718 parameter with an r_type parameter. Use get_reference_flags
2720 (Target_i386::Relocate::relocate): Update accordingly.
2721 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2722 (Target_powerpc::Scan::global): Use it.
2723 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2724 (Target_powerpc::Relocate::relocate): Likewise.
2725 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2726 (Target_sparc::Scan::global): Use it.
2727 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2728 (Target_sparc::Relocate::relocate): Likewise.
2729 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2730 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2731 (Target_x86_64::Scan::global): Likewise.
2732 (Target_x86_64::Relocate::relocate): Likewise.
2734 2010-11-08 Doug Kwan <dougkwan@google.com>
2735 Cary Coutant <ccoutant@google.com>
2737 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2738 (Arm_exidx_merge_section::section_contents_): New data member.
2739 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2740 (Arm_input_section::~Arm_input_section): De-allocate memory.
2741 (Arm_input_section::original_contents_): New data member.
2742 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2743 in parameters instead of calling Object::section_contents without
2745 (Arm_output_section::group_section): New parameter TASK. Pass it
2746 to callees that need locking objects.
2747 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2748 to lock EXIDX input sections. Fix a formatting issue. Call
2749 Arm_exidx_merged_section::build_contents to create merged section
2751 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2752 to lock object of stub table owner.
2753 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2754 TEXT_SIZE to initialize data member TEXT_SIZE_.
2755 (Arm_exidx_input_section::addralign): Fix typo in comment.
2756 (Arm_exidx_input_section::text_size): New method.
2757 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2758 that require locking objects. Lock objects before scanning for stubs
2759 and updating local symbols.
2760 (Arm_input_section<big_endian>::init): Copy contents of original
2762 (Arm_input_section<big_endian>::do_write): Use saved contents of
2763 original input section instead of calling Object::section_contents
2765 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2766 size without calling Object::section_size().
2767 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2768 for size. Allocate a buffer for merged EXIDX entries.
2769 (Arm_exidx_merged_section::build_contents): New method.
2770 (Arm_exidx_merged_section::do_write): Move merge section contents
2771 building code to Arm_exidx_merged_section::build_contetns. Write
2772 out contetns in buffer instead of building it on the fly.
2773 (Arm_relobj::make_exidx_input_section): Also pass text section size
2774 to Arm_exidx_input_section constructor.
2775 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2776 (Arm_dynobj::do_read_symbols): Fix memory leak.
2777 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2778 * target.h: (class Task): Add forward declaration.
2779 (Target::relax): Add new parameter TASK and pass it to
2781 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2783 2010-11-05 Cary Coutant <ccoutant@google.com>
2786 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2787 object when reading from the file.
2788 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2790 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2791 when reading section contents.
2792 (get_section_contents): Likewise.
2793 (icf::find_identical_sections): Likewise.
2794 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2795 object when reading from the file.
2796 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2797 the object when doing deferred section layout.
2799 2010-11-03 Nick Clifton <nickc@redhat.com>
2802 * script.h (class Symbol_assignment: name): New member. Returns
2803 the name of the symbol.
2804 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2805 Returns true if the given symbol name is on the list of
2806 assignments wating to be processed.
2807 * archive.cc (should_incldue_member): If the symbol is undefined,
2808 check to see if it is on the list of symbols pending assignment.
2810 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2812 * script-sections.cc (Script_sections::find_memory_region): Check
2813 for a NULL output section pointer.
2815 2010-10-29 Doug Kwan <dougkwan@google.com>
2817 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2818 Output_section::add_relaxed_input_section.
2819 * output.cc (Output_section::add_relaxed_input_section): Add new
2820 arguments LAYOUT and NAME. Set section order index.
2821 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2822 Copy section order index.
2823 * output.h (Output_section::add_relaxed_input_section): Add new
2824 arguments LAYOUT and NAME.
2826 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2828 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2829 NATIVE_OR_CROSS_LINKER.
2830 * testsuite/Makefile.in: Regenerate.
2832 2010-10-20 Doug Kwan <dougkwan@google.com>
2834 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2835 without SHF_LINK_ORDER flags.
2836 * layout.cc (Layout::choose_output_section): Do not filter
2837 SHF_LINK_ORDER flag in a relocatable link.
2839 2010-10-17 Cary Coutant <ccoutant@google.com>
2841 * output.h (Output_segment::set_section_addresses): Change function
2842 signature. Update all callers.
2843 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2845 (Output_segment::set_section_addresses): Align after last TLS
2846 section. Add padding before last relro section instead of after.
2848 2010-10-17 Doug Kwan <dougkwan@google.com>
2850 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2851 GOT output section to be writable.
2853 2010-10-14 Cary Coutant <ccoutant@google.com>
2855 * debug.h (DEBUG_INCREMENTAL): New flag.
2856 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2857 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2859 * incremental.cc (report_command_line): Ignore all forms of
2861 * layout.cc (Layout::Layout): Check parameters for incremental link
2863 * options.cc (General_options::parse_incremental): New function.
2864 (General_options::parse_no_incremental): New function.
2865 (General_options::parse_incremental_full): New function.
2866 (General_options::parse_incremental_update): New function.
2867 (General_options::incremental_mode_): New data member.
2868 (General_options::finalize): Check incremental_mode_.
2869 * options.h (General_options): Update help text for --incremental.
2870 Add --no-incremental, --incremental-full, --incremental-update.
2871 (General_options::Incremental_mode): New enum type.
2872 (General_options::incremental_mode): New function.
2873 (General_options::incremental_mode_): New data member.
2874 * parameters.cc (Parameters::incremental_mode_): New data member.
2875 (Parameters::set_options): Set incremental_mode_.
2876 (Parameters::set_incremental_full): New function.
2877 (Parameters::incremental): New function.
2878 (Parameters::incremental_update): New function.
2879 (set_parameters_incremental_full): New function.
2880 * parameters.h (Parameters::set_incremental_full): New function.
2881 (Parameters::incremental): New function.
2882 (Parameters::incremental_update): New function.
2883 (Parameters::incremental_mode_): New data member.
2884 (set_parameters_incremental_full): New function.
2885 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2886 incremental link mode.
2887 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2888 (Sized_relobj::do_relocate_sections): Likewise.
2889 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2891 * testsuite/Makefile.in: Regenerate.
2892 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2894 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2896 * script-sections.h (class Script_sections): Make
2897 Sections_elements typedef public.
2898 * script-sections.cc (class Sort_output_sections): Add elements_
2899 field. Add constructor which sets it; change all callers.
2900 (Sort_output_sections::is_before): New function.
2901 (Sort_output_sections::operator()): Call is_before.
2902 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2904 * testsuite/script_test_10.sh: New test. Test script section
2906 * testsuite/script_test_10.t: Likewise.
2907 * testsuite/script_test_10.s: Likewise.
2908 * testsuite/Makefile.am: Wrap the cross linker tests and the
2909 common tests into NATIVE_OR_CROSS_LINKER.
2910 (check_SCRIPTS): Add script_test_10.sh.
2911 (check_DATA): Add script_test_10.stdout.
2912 (script_test_10.o, script_test_10): New targets.
2913 (script_test_10.stdout): New target.
2914 * configure, testsuite/Makefile.in: Regenerate.
2916 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2918 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2919 error for the deprecated relocations.
2920 (Target_arm::Scan::global): Likewise.
2921 (Target_arm::Relocate::relocate): Likewise.
2923 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2925 * fileread.cc (Input_file::find_file): Initialize *found_name
2926 and *namep when using the fallback search for case 4.
2928 2010-10-11 Cary Coutant <ccoutant@google.com>
2930 * options.h (class General_options): Redefine -z lazy as an alias for
2931 the negation of -z now.
2933 2010-10-11 Ian Lance Taylor <iant@google.com>
2935 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2938 2010-10-06 Nick Clifton <nickc@redhat.com>
2940 * script-sections.cc(class Memory_region): Remove
2941 current_lma_offset_ field. Rename current_vma_offset_ to
2942 current_offset_. Add last_section_ field.
2943 (Memory_region::get_current_vma_address): Rename to
2944 get_current_address.
2945 (Memory_region::get_current_lma_address): Delete.
2946 (Memory_region::increment_vma_offset): Rename to
2948 (Memory_region::increment_lma_offset): Delete.
2949 (Memory_region::attributes_compatible): New method. Returns
2950 true if the provided section is compatible with the region.
2951 (Memory_region::get_last_section): New method. Returns the last
2952 section to use the region.
2953 (Memory_region::set_last_section): New method. Stores the last
2954 section to use the region.
2955 (Script_sections::block_in_region): New method. Returns true if
2956 a block of memory is contained within a region.
2957 (Script_sections::find_memory_region): New method. Locates a
2958 memory region to be used to set a VMA or LMA address.
2959 (Output_section_definition::set_section_addresses): Add code to
2960 check for addresses set by memory regions.
2961 (Output_segment::set_section_addresses): Remove memory region
2963 (Script_sections::create_segment): Add a warning if a header
2964 segment is created outside of any region.
2965 * script-sections.h (class Script_sections): Add prototypes for
2966 find_memory_region and block_in_region methods.
2967 * testsuite/memory_test.s: Use .long instead of .word.
2968 * testsuite/memory_test.t: Add some more output sections.
2969 * testsuite/memory_test.sh: Update expected output.
2971 2010-10-02 Doug Kwan <dougkwan@google.com>
2973 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2974 defintion to symtab.h
2975 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2976 declaration to defintion.
2978 2010-10-01 Nick Clifton <nickc@redhat.com>
2980 * expression.cc (eval): Replace dummy argument with NULL.
2981 (eval_maybe_dot): Check for a NULL result section pointer.
2982 (Symbol_expression::value): Likewise.
2983 (Dot_expression::value): Likewise.
2984 (BINARY_EXPRESSION): Likewise.
2985 (Max_expression::value): Likewise.
2986 (Min_expression::value): Likewise.
2987 (Absolute_expression::value): Likewise.
2988 (Addr_expression::value_from_output_section): Likewise.
2989 (Loaddddr_expression::value_from_output_section): Likewise.
2990 (Segment_start_expression::value): Likewise.
2991 * script-sections.cc
2992 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2994 (Sections_elememt_dot_assignment::set_section_addresses):
2996 (Output_data_expression::do_write_to_buffer): Likewise.
2997 (Output_section_definition::finalize_symbols): Likewise.
2998 (Output_section_definition::set_section_addresses): Likewise.
3000 2010-09-30 Doug Kwan <dougkwan@google.com>
3002 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3004 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3006 * target.h (Target::can_icf_inline_merge_sections): New virtual
3008 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3010 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3012 * icf.cc (get_section_contents): Inline merge sections only when
3015 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3017 * configure: Regenerate.
3019 2010-09-17 Ian Lance Taylor <iant@google.com>
3021 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3022 * testsuite/Makefile.am (memory_test.o): New target.
3023 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3025 * testsuite/Makefile.in: Rebuild.
3027 2010-09-17 Doug Kwan <dougkwan@google.com>
3029 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3030 defintion if relocation uses GOT entries of the symbol.
3031 * testsuite/icf_safe_test.sh: Fix test.
3032 * testsuite/icf_safe_so_test.sh: Fix test.
3034 2010-09-16 Cary Coutant <ccoutant@google.com>
3036 * script_sections.cc (class Memory_region): Remove "NULL" from
3037 vector initializations.
3039 2010-09-15 Cary Coutant <ccoutant@google.com>
3041 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3042 Resolve forwarding symbols.
3044 2010-09-15 Doug Kwan <dougkwan@google.com>
3046 * gold/testsuite/script_test_3.t: Add ARM special sections.
3047 * gold/testsuite/script_test_4.t: Same.
3048 * gold/testsuite/script_test_5.t: Same.
3049 * gold/testsuite/script_test_6.t: Same.
3050 * gold/testsuite/script_test_7.t: Same.
3051 * gold/testsuite/script_test_7.t: Same.
3052 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3054 2010-09-14 Cary Coutant <ccoutant@google.com>
3056 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3057 (Target_x86_64::Relocate::relocate_tls): Replace check for
3058 saw_tls_block_reloc_ with test for executable section.
3060 2010-09-12 Cary Coutant <ccoutant@google.com>
3062 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3063 position-independent executables to shared libraries need dynamic
3065 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3066 position-independent executables.
3067 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3068 * testsuite/Makefile.in: Regenerate.
3070 2010-09-10 Nick Clifton <nickc@redhat.com>
3073 * testsuite/memory_test.t: Discard any sections that are not
3076 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3079 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3080 "This::" to work around a bug in gcc 4.2.
3082 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3084 2010-09-09 Rafael Espindola <espindola@google.com>
3086 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3087 sections with different PF_X flags in the same segment.
3088 (Layout::find_first_load_seg): Search all segments to find the first
3090 * options.h (rosegment): New.
3092 2010-09-08 Rafael Espindola <espindola@google.com>
3094 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3096 2010-09-08 Doug Kwan <dougkwan@google.com>
3098 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3099 (Arm_relobj::do_relocate_sections): Add new parameter for output
3100 file to match the parent.
3101 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3102 of local symbols instead of input values. Update code to track
3103 changes in gold::relocate_section.
3104 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3105 (Sized_relobj::compute_final_local_value_internal): New methods.
3106 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3107 body into private version of Sized_relobj::compute_final_local_value.
3108 Call the inline method.
3109 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3110 merged symbol value if there is one.
3111 (Symbol_value::has_output_value): New method defintiion.
3112 (Sized_relobj::Compute_final_local_value_status): New enum type.
3113 (Sized_relobj::compute_final_local_value): New methods.
3114 (Sized_relobj::compute_final_local_value_internal): New methods.
3115 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3116 and arm_cortex_a8.sh.
3117 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3118 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3120 * Makefile.in: Regenerate.
3121 * testsuite/arm_bl_out_of_range.s: Update test.
3122 * testsuite/thumb_bl_out_of_range.s: Ditto.
3123 * testsuite/thumb_blx_out_of_range.s: Ditto.
3124 * testsuite/arm_branch_out_of_range.sh: New file.
3125 * testsuite/arm_cortex_a8.sh: Ditto.
3126 * testsuite/arm_cortex_a8_b.s: Ditto.
3127 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3128 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3129 * testsuite/arm_cortex_a8_bl.s: Ditto.
3130 * testsuite/arm_cortex_a8_blx.s: Ditto.
3131 * testsuite/arm_cortex_a8_local.s: Ditto.
3132 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3133 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3135 2010-09-08 Rafael Espindola <espindola@google.com>
3137 * Makefile.am (memory_test.stdout): Run readelf with -W.
3138 * Makefile.in: Regenerate.
3139 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3142 2010-09-08 Rafael Espindola <espindola@google.com>
3144 * script-sections.cc (Script_sections::add_memory_region): Convert
3145 field precision to int.
3146 * script.cc (script_set_section_region, script_set_section_region):
3147 Convert field precision to int.
3149 2010-09-08 Rafael Espindola <espindola@google.com>
3151 * arm.cc (do_finalize_sections): Create the __exidx_start and
3152 __exdix_end symbols even when the section is missing.
3154 2010-09-08 Nick Clifton <nickc@redhat.com>
3156 * README: Remove claim that MEMORY is not supported.
3157 * expression.cc (script_exp_function_origin)
3158 (script_exp_function_length): Move from here to ...
3159 * script.cc: ... here.
3160 (script_set_section_region, script_add_memory)
3161 (script_parse_memory_attr, script_include_directive): New
3163 * script-sections.cc
3164 (class Memory_region): New class.
3165 (class Output_section_definition): Add set_memory_region,
3166 set_section_vma, set_section_lma and get_section_name methods.
3167 (class Script_Sections): Add add_memory_region,
3168 find_memory_region, find_memory_region_origin,
3169 find_memory_region_length and set_memory_region methods.
3170 Have set_section_addresses method walk the list of set memory
3172 Extend the print methos to display memory regions.
3173 * script-sections.h: Add prototypes for new methods.
3174 Add enum for MEMORY region attributes.
3175 * yyscript.y: Add support for parsing MEMORY regions.
3176 * script-c.h: Add prototypes for new functions.
3177 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3178 * testsuite/Makefile.in: Regenerate.
3179 * testsuite/memory_test.sh: New script.
3180 * testsuite/memory_test.s: New assembler source file.
3181 * testsuite/memory_test.t: New linker script.
3183 2010-08-27 Doug Kwan <dougkwan@google.com>
3185 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3186 reference override an existing dynamic weak reference.
3187 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3188 * testsuite/Makefile.in: Regenerate.
3189 * testsuite/dyn_weak_ref.sh: New file.
3190 * testsuite/dyn_weak_ref_1.c: Ditto.
3191 * testsuite/dyn_weak_ref_2.c: Ditto.
3193 2010-08-27 Ian Lance Taylor <iant@google.com>
3195 * incremental.h (class Incremental_input_entry): Add virtual
3198 2010-08-27 Ian Lance Taylor <iant@google.com>
3200 * testsuite/start_lib_test_3.c: Mark t3 as used.
3202 2010-08-27 Nick Clifton <nickc@redhat.com>
3204 * options.cc (version_script): Fix small typo in previous
3207 2010-08-25 Nick Clifton <nickc@redhat.com>
3209 * archive.cc: Formatting fixes: Remove whitespace between
3210 typename and following asterisk. Remove whitespace between
3211 function name and opening parenthesis.
3212 * archive.h: Likewise.
3214 * attributes.cc: Likewise.
3215 * attributes.h: Likewise.
3216 * common.cc: Likewise.
3217 * copy-relocs.cc: Likewise.
3218 * dirsearch.h: Likewise.
3219 * dynobj.cc: Likewise.
3220 * ehframe.cc: Likewise.
3221 * ehframe.h: Likewise.
3222 * expression.cc: Likewise.
3223 * fileread.cc: Likewise.
3224 * fileread.h: Likewise.
3226 * gold-threads.cc: Likewise.
3227 * gold.cc: Likewise.
3228 * i386.cc: Likewise.
3230 * incremental-dump.cc: Likewise.
3231 * incremental.cc: Likewise.
3232 * layout.cc: Likewise.
3233 * layout.h: Likewise.
3234 * main.cc: Likewise.
3235 * merge.cc: Likewise.
3236 * merge.h: Likewise.
3237 * object.cc: Likewise.
3238 * object.h: Likewise.
3239 * options.cc: Likewise.
3240 * options.h: Likewise.
3241 * output.cc: Likewise.
3242 * output.h: Likewise.
3243 * plugin.cc: Likewise.
3244 * plugin.h: Likewise.
3245 * powerpc.cc: Likewise.
3246 * reloc.cc: Likewise.
3247 * script-c.h: Likewise.
3248 * script-sections.cc: Likewise.
3249 * script.cc: Likewise.
3250 * stringpool.cc: Likewise.
3251 * symtab.cc: Likewise.
3252 * symtab.h: Likewise.
3253 * target.cc: Likewise.
3254 * timer.cc: Likewise.
3255 * timer.h: Likewise.
3256 * version.cc: Likewise.
3257 * x86_64.cc: Likewise.
3259 2010-08-24 Nick Clifton <nickc@redhat.com>
3262 * layout.cc (segment_precedes): Sort segments by their physical
3263 addresses, if they have been set.
3265 2010-08-23 Cary Coutant <ccoutant@google.com>
3267 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3269 (Lib_group::include_member): Unlock object after deleting its
3271 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3274 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3275 Cary Coutant <ccoutant@google.com>
3277 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3278 constructor, and set_blocker.
3279 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3281 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3282 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3283 * testsuite/Makefile.am (start_lib_test): New test case.
3284 * testsuite/Makefile.in: Regenerate.
3285 * testsuite/start_lib_test_main.c: New file.
3286 * testsuite/start_lib_test_1.c: New file.
3287 * testsuite/start_lib_test_2.c: New file.
3288 * testsuite/start_lib_test_3.c: New file.
3290 2010-08-19 Ian Lance Taylor <iant@google.com>
3292 * Makefile.in: Rebuild with automake 1.11.1.
3293 * aclocal.m4: Likewise.
3294 * testsuite/Makefile.in: Likewise.
3296 2010-08-19 Ian Lance Taylor <iant@google.com>
3299 * i386.cc (class Output_data_plt_i386): Update declarations.
3300 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3301 local_ifuncs_ fields.
3302 (Target_i386::do_plt_section_for_global): New function.
3303 (Target_i386::do_plt_section_for_local): New function.
3304 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3305 parameter; change all callers. Initialize global_ifuncs_ and
3306 local_ifuncs_. If doing a static link define __rel_iplt_start and
3308 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3309 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3310 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3312 (Target_i386::make_plt_section): New function, broken out of
3313 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3314 (Target_i386::make_plt_entry): Call make_plt_section.
3315 (Target_i386::make_local_ifunc_plt_entry): New function.
3316 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3317 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3318 R_386_IRELATIVE to switch.
3319 (Target_i386::Scan::global): Likewise.
3320 (Target_i386::Relocate::relocate): Likewise.
3321 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3323 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3324 (Target_x86_64::do_plt_section_for_global): New function.
3325 (Target_x86_64::do_plt_section_for_local): New function.
3326 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3327 parameter; change all callers. If doing a static link define
3328 __rela_iplt_start and __rela_iplt_end.
3329 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3330 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3331 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3333 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3334 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3336 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3337 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3338 R_X86_64_IRELATIVE to switch.
3339 (Target_x86_64::Scan::global): Likewise.
3340 (Target_x86_64::Relocate::relocate): Likewise.
3341 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3343 * target.h (class Target): Add plt_section_for_global and
3344 plt_section_for_local functions. Add do_plt_section_for_global
3345 and do_plt_section_for_local virtual functions.
3346 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3347 clarifying comments.
3348 (Symbol::use_plt_offset): Handle IFUNC symbol.
3349 * object.cc (Sized_relobj::Sized_relobj): Initialize
3351 (Sized_relobj::local_has_plt_offset): New function.
3352 (Sized_relobj::local_plt_offset): New function.
3353 (Sized_relobj::set_local_plt_offset): New function.
3354 (Sized_relobj::do_count): Handle IFUNC symbol.
3355 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3356 a bit away from input_shndx_ field. Add set_is_func_symbol and
3357 is_ifunc_symbol functions.
3358 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3359 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3360 local_plt_offsets_ field.
3361 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3362 * output.h (class Output_section_data): Add non-const
3363 output_section function.
3364 (class Output_data_got): Update declarations.
3365 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3366 Add use_plt_offset parameter to global and local constructors.
3367 Change all callers. Change local_sym_index_ field to 31 bits.
3368 Change GSYM_CODE and CONSTANT_CODE accordingly.
3369 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3370 doing a static link don't set sh_link field.
3371 (Output_data_got::Got_entry::write): Use PLT offset if
3373 (Output_data_got::add_global_plt): New function.
3374 (Output_data_got::add_local_plt): New function.
3375 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3376 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3377 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3378 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3379 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3381 * testsuite/ifunc-sel.h: New file.
3382 * testsuite/ifuncmain1.c: New file.
3383 * testsuite/ifuncmain1vis.c: New file.
3384 * testsuite/ifuncmod1.c: New file.
3385 * testsuite/ifuncdep2.c: New file.
3386 * testsuite/ifuncmain2.c: New file.
3387 * testsuite/ifuncmain3.c: New file.
3388 * testsuite/ifuncmod3.c: New file.
3389 * testsuite/ifuncmain4.c: New file.
3390 * testsuite/ifuncmain5.c: New file.
3391 * testsuite/ifuncmod5.c: New file.
3392 * testsuite/ifuncmain6pie.c: New file.
3393 * testsuite/ifuncmod6.c: New file.
3394 * testsuite/ifuncmain7.c: New file.
3395 * configure, testsuite/Makefile.in: Rebuild.
3397 2010-08-18 Ian Lance Taylor <iant@google.com>
3400 (Output_section_incremental_inputs::write_input_files): Add cast
3401 to avoid signed/unsigned comparison warning.
3402 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3404 2010-08-12 Cary Coutant <ccoutant@google.com>
3406 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3408 2010-08-13 Ian Lance Taylor <iant@google.com>
3410 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3412 2010-08-12 Cary Coutant <ccoutant@google.com>
3413 Doug Kwan <dougkwan@google.com>
3415 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3416 defintion overrides non-weak undef, remember that the original undef
3418 * symtab.cc (Symbol_table::sized_write_global): For undef without
3419 an original weak binding, set binding to global in output.
3420 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3421 * testsuite/Makefile.in: Regenerate.
3422 * testsuite/strong_ref_weak_def.sh: New file.
3423 * testsuite/strong_ref_weak_def_1.c: Ditto.
3424 * testsuite/strong_ref_weak_def_2.c: Ditto.
3426 2010-08-12 Cary Coutant <ccoutant@google.com>
3428 * testsuite/incremental_test.sh: Rewrite.
3429 * testsuite/incremental_test_1.c: Rewrite.
3430 * testsuite/incremental_test_2.c: Rewrite.
3432 2010-08-12 Cary Coutant <ccoutant@google.com>
3434 * arm.cc (Target_arm::got_size): Add const.
3435 (Target_arm::got_entry_count): New function.
3436 (Target_arm::plt_entry_count): New function.
3437 (Target_arm::first_plt_entry_offset): New function.
3438 (Target_arm::plt_entry_size): New function.
3439 (Output_data_plt_arm::entry_count): New function.
3440 (Output_data_plt_arm::first_plt_entry_offset): New function.
3441 (Output_data_plt_arm::get_plt_entry_size): New function.
3442 * i386.cc (Target_i386::got_size): Add const.
3443 (Target_i386::got_entry_count): New function.
3444 (Target_i386::plt_entry_count): New function.
3445 (Target_i386::first_plt_entry_offset): New function.
3446 (Target_i386::plt_entry_size): New function.
3447 (Output_data_plt_i386::entry_count): New function.
3448 (Output_data_plt_i386::first_plt_entry_offset): New function.
3449 (Output_data_plt_i386::get_plt_entry_size): New function.
3450 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3451 find_incremental_inputs_sections. Dump incremental_got_plt section.
3452 * incremental.cc: Include target.h.
3453 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3454 parameter. Adjust all callers. Find incremental_got_plt section.
3455 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3457 (Output_section_incremental_inputs::set_final_data_size): Calculate
3458 size of incremental_got_plt section.
3459 (Output_section_incremental_inputs::do_write): Write the
3460 incremental_got_plt section.
3461 (Got_plt_view_info): New struct.
3462 (Local_got_offset_visitor): New class.
3463 (Global_got_offset_visitor): New class.
3464 (Global_symbol_visitor_got_plt): New class.
3465 (Output_section_incremental_inputs::write_got_plt): New function.
3466 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3467 Add parameter. Adjust all callers.
3468 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3469 (Incremental_inputs::got_plt_section): New function.
3470 (Incremental_inputs::got_plt_section_): New data member.
3471 (Incremental_got_plt_reader): New class.
3472 * layout.cc (Layout::create_incremental_info_sections): Add the
3473 incremental_got_plt section.
3474 * object.h (Got_offset_list::get_list): New function.
3475 (Got offset_list::for_all_got_offsets): New function.
3476 (Sized_relobj::local_got_offset_list): New function.
3477 * powerpc.cc (Target_powerpc::got_size): Add const.
3478 (Target_powerpc::got_entry_count): New function.
3479 (Target_powerpc::plt_entry_count): New function.
3480 (Target_powerpc::first_plt_entry_offset): New function.
3481 (Target_powerpc::plt_entry_size): New function.
3482 (Output_data_plt_powerpc::entry_count): New function.
3483 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3484 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3485 * sparc.cc (Target_sparc::got_size): Add const.
3486 (Target_sparc::got_entry_count): New function.
3487 (Target_sparc::plt_entry_count): New function.
3488 (Target_sparc::first_plt_entry_offset): New function.
3489 (Target_sparc::plt_entry_size): New function.
3490 (Output_data_plt_sparc::entry_count): New function.
3491 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3492 (Output_data_plt_sparc::get_plt_entry_size): New function.
3493 * symtab.h (Symbol::got_offset_list): New function.
3494 (Symbol_table::for_all_symbols): New function.
3495 * target.h (Sized_target::got_entry_count): New function.
3496 (Sized_target::plt_entry_count): New function.
3497 (Sized_target::plt_entry_size): New function.
3498 * x86_64.cc (Target_x86_64::got_size): Add const.
3499 (Target_x86_64::got_entry_count): New function.
3500 (Target_x86_64::plt_entry_count): New function.
3501 (Target_x86_64::first_plt_entry_offset): New function.
3502 (Target_x86_64::plt_entry_size): New function.
3503 (Output_data_plt_x86_64::entry_count): New function.
3504 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3505 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3507 2010-08-12 Cary Coutant <ccoutant@google.com>
3509 * archive.cc: Include incremental.h.
3510 (Archive::Archive): Initialize incremental_info_.
3511 (Archive::include_member): Record archive members in incremental info.
3512 (Add_archive_symbols::run): Record begin and end of an archive in
3514 (Lib_group::include_member): Record objects in incremental info.
3515 * archive.h (Incremental_archive_entry): Forward declaration.
3516 (Archive::set_incremental_info): New member function.
3517 (Archive::incremental_info): New member function.
3518 (Archive::Unused_symbol_iterator): New class.
3519 (Archive::unused_symbols_begin): New member function.
3520 (Archive::unused_symbols_end): New member function.
3521 (Archive::incremental_info_): New data member.
3522 * incremental-dump.cc (find_input_containing_global): New function.
3523 (dump_incremental_inputs): Dump new incremental info sections.
3524 * incremental.cc: Include symtab.h.
3525 (Output_section_incremental_inputs): New class.
3526 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3527 new incremental info sections.
3528 (Sized_incremental_binary::do_check_inputs): Likewise.
3529 (Incremental_inputs::report_archive): Remove.
3530 (Incremental_inputs::report_archive_begin): New function.
3531 (Incremental_inputs::report_archive_end): New function.
3532 (Incremental_inputs::report_object): New function.
3533 (Incremental_inputs::finalize_inputs): Remove.
3534 (Incremental_inputs::report_input_section): New function.
3535 (Incremental_inputs::report_script): Rewrite.
3536 (Incremental_inputs::finalize): Do nothing but finalize string table.
3537 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3538 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3539 (Incremental_inputs::create_data_sections): New function.
3540 (Incremental_inputs::relocs_entsize): New function.
3541 (Output_section_incremental_inputs::set_final_data_size): New function.
3542 (Output_section_incremental_inputs::do_write): New function.
3543 (Output_section_incremental_inputs::write_header): New function.
3544 (Output_section_incremental_inputs::write_input_files): New function.
3545 (Output_section_incremental_inputs::write_info_blocks): New function.
3546 (Output_section_incremental_inputs::write_symtab): New function.
3547 * incremental.h (Incremental_script_entry): Forward declaration.
3548 (Incremental_object_entry): Forward declaration.
3549 (Incremental_archive_entry): Forward declaration.
3550 (Incremental_inputs): Forward declaration.
3551 (Incremental_inputs_header_data): Remove.
3552 (Incremental_inputs_header): Remove.
3553 (Incremental_inputs_header_write): Remove.
3554 (Incremental_inputs_entry_data): Remove.
3555 (Incremental_inputs_entry): Remove.
3556 (Incremental_inputs_entry_write): Remove.
3557 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3558 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3559 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3560 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3562 (Incremental_input_entry): New class.
3563 (Incremental_script_entry): New class.
3564 (Incremental_object_entry): New class.
3565 (Incremental_archive_entry): New class.
3566 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3567 (Incremental_inputs::report_inputs): Remove.
3568 (Incremental_inputs::report_archive): Remove.
3569 (Incremental_inputs::report_archive_begin): New function.
3570 (Incremental_inputs::report_archive_end): New function.
3571 (Incremental_inputs::report_object): Change prototype.
3572 (Incremental_inputs::report_input_section): New function.
3573 (Incremental_inputs::report_script): Change prototype.
3574 (Incremental_inputs::get_reloc_count): New function.
3575 (Incremental_inputs::set_reloc_count): New function.
3576 (Incremental_inputs::create_data_sections): New function.
3577 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3578 (Incremental_inputs::inputs_section): New function.
3579 (Incremental_inputs::symtab_section): New function.
3580 (Incremental_inputs::relocs_section): New function.
3581 (Incremental_inputs::get_stringpool): Add const.
3582 (Incremental_inputs::command_line): Add const.
3583 (Incremental_inputs::inputs): Remove.
3584 (Incremental_inputs::command_line_key): New function.
3585 (Incremental_inputs::input_file_count): New function.
3586 (Incremental_inputs::input_files): New function.
3587 (Incremental_inputs::relocs_entsize): New function.
3588 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3589 (Incremental_inputs::finalize_inputs): Remove.
3590 (Incremental_inputs::Input_info): Remove.
3591 (Incremental_inputs::lock_): Remove.
3592 (Incremental_inputs::inputs_): Change type.
3593 (Incremental_inputs::inputs_map_): Remove.
3594 (Incremental_inputs::current_object_entry_): New data member.
3595 (Incremental_inputs::inputs_section_): New data member.
3596 (Incremental_inputs::symtab_section_): New data member.
3597 (Incremental_inputs::relocs_section_): New data member.
3598 (Incremental_inputs::reloc_count_): New data member.
3599 (Incremental_inputs_reader): New class.
3600 (Incremental_symtab_reader): New class.
3601 (Incremental_relocs_reader): New class.
3602 * layout.cc (Layout::finalize): Move finalization of incremental info
3603 and creation of incremental info sections to follow finalization of
3604 symbol table. Set offsets for postprocessing sections.
3605 (Layout::create_incremental_info_sections): Call
3606 Incremental_inputs::create_data_sections. Add incremental symtab
3607 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3608 sections to layout after input sections.
3609 * layout.h (struct Timespec): Forward declaration.
3610 (Layout::incremental_inputs): Add const.
3611 (Layout::create_incremental_info_sections): Add parameter.
3612 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3613 * object.cc: Include incremental.h.
3614 (Relobj::finalize_incremental_relocs): New function.
3615 (Sized_relobj::do_layout): Record input sections in incremental info.
3616 * object.h (Object::output_section): New function.
3617 (Object::output_section_offset): Moved from Relobj.
3618 (Object::get_incremental_reloc_base): New function.
3619 (Object::get_incremental_reloc_count): New function.
3620 (Object::do_output_section): New function.
3621 (Object::do_output_section_offset): Moved from Relobj.
3622 (Object::do_get_incremental_reloc_base): New function.
3623 (Object::do_get_incremental_reloc_count): New function.
3624 (Object::Object): Initialize new data members.
3625 (Relobj::output_section): Renamed do_output_section and moved to
3627 (Relobj::output_section_offset): Moved to Object.
3628 (Relobj::do_get_incremental_reloc_base): New function.
3629 (Relobj::do_get_incremental_reloc_count): New function.
3630 (Relobj::allocate_incremental_reloc_counts): New function.
3631 (Relobj::count_incremental_reloc): New function.
3632 (Relobj::finalize_incremental_relocs): New function.
3633 (Relobj::next_incremental_reloc_index): New function.
3634 (Relobj::reloc_counts_): New data member.
3635 (Relobj::reloc_bases_): New data member.
3636 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3637 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3638 (Sized_relobj::incremental_relocs_scan): New function.
3639 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3640 (Sized_relobj::incremental_relocs_write): New function.
3641 (Sized_relobj::incremental_relocs_write_reltype): New function.
3642 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3644 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3645 archives and object files elsewhere.
3646 (Add_symbols::run): Report object files here.
3647 (Finish_group::run): Report end of archive at end of group.
3648 * reloc.cc: Include layout.h, incremental.h.
3649 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3650 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3651 (Sized_relobj::incremental_relocs_scan): New function.
3652 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3653 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3654 (Sized_relobj::incremental_relocs_write): New function.
3655 (Sized_relobj::incremental_relocs_write_reltype): New function.
3656 * script.cc (read_input_script): Rewrite test for incremental link.
3657 Change call to Incremental_inputs::report_script.
3658 * symtab.h (Symbol_table::first_global_index): New function.
3659 (Symbol_table::output_count): New function.
3661 2010-08-12 Doug Kwan <dougkwan@google.com>
3663 * arm.cc (Target_arm::merge_object_attributes): Check command line
3664 options --no-wchar-size-warning and --no-enum-size-warning.
3665 * options.h (General_options): Add ld-compatible options
3666 --no-enum-size-warning and --no-wchar-size-warning.
3668 2010-08-04 Ian Lance Taylor <iant@google.com>
3670 * x86_64.cc (Target_x86_64::Scan::local): Use
3671 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3672 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3673 (Target_x86_64::Scan::global): Likewise.
3674 (Target_x86_64::Relocate::relocate): Likewise.
3675 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3678 2010-08-03 Cary Coutant <ccoutant@google.com>
3680 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3681 to reserve space in merged_strings vector. Keep total input size
3683 (Output_merge_string::do_print_merge_stats): Print total input size.
3684 * merge.h (Output_merge_string): Add input_size_ field.
3685 * stringpool.cc (Stringpool_template::string_length): Move
3686 implementations out of Stringpool_template class and place in
3688 * stringpool.h (string_length): Move out of Stringpool_template.
3690 2010-08-03 Ian Lance Taylor <iant@google.com>
3693 * layout.cc (relaxation_loop_body): If address of load segment is
3694 set, adjust address to include headers if possible.
3696 2010-08-03 Ian Lance Taylor <iant@google.com>
3698 * version.cc (version_string): Bump to 1.10.
3700 2010-08-03 Ian Lance Taylor <iant@google.com>
3703 * layout.h (enum Output_section_order): Define.
3704 (class Layout): Update declarations.
3705 * layout.cc (Layout::get_output_section): Add order parameter.
3706 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3707 is_first_non_relro parameters. Change all callers.
3708 (Layout::choose_output_section): Likewise.
3709 (Layout::add_output_section_data): Likewise.
3710 (Layout::make_output_section): Likewise. Set order.
3711 (Layout::default_section_order): New function.
3712 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3713 * output.cc (Output_section::Output_section): Initialize order_.
3714 Don't initialize deleted fields.
3715 (Output_segment::Output_segment): Don't initialize deleted
3717 (Output_segment::add_output_section_to_load): New function
3718 replacing add_output_section. Change all callers to call this or
3719 add_output_section_to_nonload.
3720 (Output_segment::add_output_section_to_nonload): New function.
3721 (Output_segment::remove_output_section): Rewrite.
3722 (Output_segment::add_initial_output_data): Likewise.
3723 (Output_segment::has_any_data_sections): Likewise.
3724 (Output_segment::is_first_section_relro): Likewise.
3725 (Output_segment::maximum_alignment): Likewise.
3726 (Output_segment::has_dynamic_reloc): New function replacing
3727 dynamic_reloc_count. Change all callers.
3728 (Output_segment::has_dynamic_reloc_list): New function replacing
3729 dynamic_reloc_count_list. Change all callers.
3730 (Output_segment::set_section_addresses): Rewrite.
3731 (Output_segment::set_offset): Rewrite.
3732 (Output_segment::find_first_and_last_list): Remove.
3733 (Output_segment::set_tls_offsets): Rewrite.
3734 (Output_segment::first_section_load_address): Likewise.
3735 (Output_segment::output_section_count): Likewise.
3736 (Output_segment::section_with_lowest_load_address): Likewise.
3737 (Output_segment::write_section_headers): Likewise.
3738 (Output_segment::print_sections_to_map): Likewise.
3739 * output.h (class Output_data): Remove dynamic_reloc_count_
3740 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3741 (Output_data::add_dynamic_reloc): Rewrite.
3742 (Output_data::has_dynamic_reloc): New function.
3743 (Output_data::dynamic_reloc_count): Remove.
3744 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3745 is_last_relro_, is_first_non_relro_, is_interp_,
3746 is_dynamic_linker_section_ fields. Add order and set_order
3747 functions. Remove is_relro_local, set_is_relro_local,
3748 is_last_relro, set_is_last_relro, is_first_non_relro,
3749 set_is_first_non_relro functions, is_interp, set_is_interp,
3750 is_dynamic_linker_section, and set_is_dynamic_linker_section
3752 (class Output_segment): Change Output_data_list from std::list to
3753 std:;vector. Add output_lists_ field. Remove output_data_ and
3754 output_bss_ fields. Update declarations.
3756 2010-08-02 Ian Lance Taylor <iant@google.com>
3758 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3759 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3760 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3762 2010-08-02 Ian Lance Taylor <iant@google.com>
3765 * script.cc (Script_options::Script_options): Initialize
3766 symbol_definitions_ and symbol_references_.
3767 (Script_options::add_symbol_assignment): Update
3768 symbol_definitions_ and symbol_references_.
3769 (Script_options::add_symbol_reference): New function.
3770 (script_symbol): New function.
3771 * script.h (class Script_options): Add symbol_definitions_ and
3772 symbol_references_ fields.
3773 (Script_options::referenced_const_iterator): New type.
3774 (Script_options::referenced_begin): New function.
3775 (Script_options::referenced_end): New function.
3776 (Script_options::is_referenced): New function.
3777 (Script_options::any_unreferenced): New function.
3778 * script-c.h (script_symbol): Declare.
3779 * yyscript.y (exp): Call script_symbol.
3780 * symtab.cc: Include "script.h".
3781 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3782 Change all callers. Check symbols referenced by scripts.
3783 (Symbol_table::add_undefined_symbols_from_command_line): Add
3784 layout parameter. Change all callers.
3785 (Symbol_table::do_add_undefined_symbols_from_command_line):
3786 Likewise. Break out loop body. Check symbols referenced by
3788 (Symbol_table::add_undefined_symbol_from_command_line): New
3789 function broken out of
3790 do_add_undefined_symbols_from_command_line.
3791 * symtab.h (class Symbol_table): Update declarations.
3792 * archive.cc: Include "layout.h".
3793 (Archive::should_include_member): Add layout parameter. Change
3794 all callers. Check for symbol mentioned in expression.
3795 * archive.h (class Archive): Update declaration.
3796 * object.cc (Sized_relobj::do_should_include_member): Add layout
3798 * object.h (Object::should_include_member): Add layout parameter.
3800 (Object::do_should_include_member): Add layout parameter.
3801 (class Sized_relobj): Update declaration.
3802 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3804 * dynobj.h (class Sized_dynobj): Update declaration.
3805 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3807 * plugin.h (class Sized_pluginobj): Update declaration.
3809 2010-08-02 Ian Lance Taylor <iant@google.com>
3812 * output.cc (Output_segment::set_offset): Search for the first and
3813 last sections rather than assuming that the list is in order.
3814 (Output_segment::find_first_and_last_list): New function.
3815 * output.h (class Output_segment): Update declarations.
3816 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3817 (relro_strip_test_SOURCES): New variable.
3818 (relro_strip_test_DEPENDENCIES): New variable.
3819 (relro_strip_test_LDFLAGS): New variable.
3820 (relro_strip_test_LDADD): New variable.
3821 (relro_strip_test.so): New target.
3823 2010-08-02 Ian Lance Taylor <iant@google.com>
3825 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3826 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3827 (Target_i386::got_tlsdesc_section): New function.
3828 (Target_i386::got_section): Create space for GOT entries for
3829 TLSDESC relocations.
3830 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3832 (Target_i386::Scan::global): Likewise.
3833 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3835 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3836 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3837 (Target_x86_64::got_tlsdesc_section): New function.
3838 (Target_x86_64::got_section): Create space for GOT entries for
3839 TLSDESC relocations.
3840 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3842 (Target_x86_64::Scan::global): Likewise.
3843 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3846 2010-08-02 Ian Lance Taylor <iant@google.com>
3848 * testsuite/final_layout.sh: Use dc to convert from hex to
3851 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3853 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3854 paramter to the call to gold::gc_process_relocs.
3855 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3856 paramter to the call to gold::gc_process_relocs.
3857 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3858 parameter to the call to gold::gc_process_relocs.
3859 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3860 template parameter to the call to gold::gc_process_relocs.
3861 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3862 paramter to the call to gold::gc_process_relocs.
3863 * gc.h (get_embedded_addend_size): New function.
3864 (gc_process_relocs): Save the size of the reloc for use by ICF.
3865 * icf.cc (get_section_contents): Get the addend from the text section
3866 for SHT_REL relocation sections.
3867 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3868 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3869 * int_encoding.h (read_from_pointer): New overloaded function.
3870 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3871 * testsuite/icf_sht_rel_addend_test.sh: New file.
3872 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3873 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3875 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3877 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3878 * Makefile.in: Regenerate.
3879 * testsuite/Makefile.in: Regenerate.
3881 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3883 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3884 * gold/testsuite/debug_msg.cc: Likewise.
3885 * gold/testsuite/odr_violation1.cc
3886 * gold/testsuite/odr_violation2.cc
3888 2010-07-21 Cary Coutant <ccoutant@google.com>
3890 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3891 string, and length fields.
3892 (Output_merge_string::Merged_strings_list): New type.
3893 (Output_merge_string::Merged_strings_lists): New typedef.
3894 (Output_merge_string): Replace merged_strings_ with
3895 merged_strings_lists_.
3896 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3897 Merged_strings_list per input object and section. Don't store pointer
3898 to the string. Don't store length with each merged string entry.
3899 (Output_merge_string::finalize_merged_data): Loop over list of merged
3900 strings lists. Recompute length of each merged string.
3902 2010-07-15 Cary Coutant <ccoutant@google.com>
3904 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3907 2010-07-14 Ian Lance Taylor <iant@google.com>
3909 * descriptors.cc (Descriptors::open): Report correct name in error
3912 2010-07-13 Doug Kwan <dougkwan@google.com>
3914 * arm.cc (Arm_input_section::Arm_input_section): For a
3915 SHT_ARM_EXIDX section, always keeps the input sections.
3916 (Arm_input_section::set_exidx_section_link): New method.
3917 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3918 has_errors_ to false.
3919 (Arm_exidx_input_section::has_errors,
3920 Arm_exidx_input_section::set_has_errors): New methods.
3921 (Arm_exidx_input_section::has_errors_): New data member.
3922 (Arm_relobj::get_exidx_shndx_list): New method.
3923 (Arm_output_section::append_text_sections_to_list): Do not skip
3924 section without SHF_EXECINSTR.
3925 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3927 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3928 section header. Make error messages more verbose. Check for
3929 a non-executable section linked to an EXIDX section.
3930 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3931 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3932 check that there is no deferred EXIDX section if we exit early.
3933 Instead of not making an EXIDX section in case of an error, make one
3934 and set the has_errors flag of it.
3935 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3936 in a relocatable link.
3937 (Target_arm::do_relax): Look for the EXIDX output section instead of
3938 assuming that it is called .ARM.exidx.
3939 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3940 section list. Do not check for SHF_EXECINSTR section flags but
3941 skip any input section with errors.
3942 * output.cc (Output_section::Output_section): Initialize
3943 always_keeps_input_sections_ to false.
3944 (Output_section::add_input_section): Check for
3945 always_keeps_input_sections_.
3946 * output.h (Output_section::always_keeps_input_sections,
3947 Output_section::set_always_keeps_input_sections): New methods.
3948 (Output_section::always_keeps_input_sections): New data member.
3950 2010-07-13 Rafael Espindola <espindola@google.com>
3952 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3953 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3955 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3956 Ian Lance Taylor <iant@google.com>
3958 * output.h (Output_section_lookup_maps::add_merge_section):
3959 Correct check of whether value was inserted.
3960 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3961 (Output_section_lookup_maps::add_relaxed_input_section):
3963 * arm.cc (Target_arm::got_section): Remove used local os.
3964 * i386.cc (Target_i386::got_section): Likewise.
3965 * x86_64.cc (Target_x86_64::got_section): Likewise.
3966 * sparc.cc (Target_sparc::got_section): Likewise.
3967 (Target_sparc::relocate): Remove unused local have_got_offset.
3968 * powerpc.cc (Target_powerpc::relocate): Likewise.
3970 2010-07-13 Ian Lance Taylor <iant@google.com>
3972 * compressed_output.cc (zlib_decompress): Fix signature in
3975 * archive.cc (Archive::include_member): Unlock an external member
3976 of a thin archive. Don't bother to delete an object we know is
3979 2010-07-12 Cary Coutant <ccoutant@google.com>
3981 * compressed_output.cc (zlib_decompress): New function.
3982 (get_uncompressed_size): New function.
3983 (decompress_input_section): New function.
3984 * compressed_output.h (get_uncompressed_size): New function.
3985 (decompress_input_section): New function.
3986 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3987 Handle compressed debug sections.
3988 * layout.cc (is_compressed_debug_section): New function.
3989 (Layout::output_section_name): Map compressed section names to
3991 * layout.h (is_compressed_debug_section): New function.
3992 (is_debug_info_section): Recognize compressed debug sections.
3993 * merge.cc: Include compressed_output.h.
3994 (Output_merge_data::do_add_input_section): Handle compressed
3996 (Output_merge_string::do_add_input_section): Handle compressed
3998 * object.cc: Include compressed_output.h.
3999 (Sized_relobj::Sized_relobj): Initialize new data members.
4000 (build_compressed_section_map): New function.
4001 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4002 * object.h (Object::section_is_compressed): New method.
4003 (Object::do_section_is_compressed): New method.
4004 (Sized_relobj::Compressed_section_map): New type.
4005 (Sized_relobj::do_section_is_compressed): New method.
4006 (Sized_relobj::compressed_sections_): New data member.
4007 * output.cc (Output_section::add_input_section): Handle compressed
4009 * reloc.cc: Include compressed_output.h.
4010 (Sized_relobj::write_sections): Handle compressed debug sections.
4012 2010-07-08 Cary Coutant <ccoutant@google.com>
4014 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4015 weak when resolving to a dynamic def.
4016 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4017 for weak undef/dynamic def cases. Adjust callers.
4018 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4019 undef_binding_weak_.
4020 (Symbol_table::sized_write_globals): Adjust symbol binding.
4021 (Symbol_table::sized_write_symbol): Add binding parameter.
4022 * symtab.h (Symbol::set_undef_binding): New method.
4023 (Symbol::is_undef_binding_weak): New method.
4024 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4025 (Symbol_table::should_override): Add new parameter.
4026 (Symbol_table::sized_write_symbol): Add new parameter.
4028 * testsuite/weak_undef_file1.cc: Add new test case.
4029 * testsuite/weak_undef_file2.cc: Fix header comment.
4030 * testsuite/weak_undef_test.cc: Add new test case.
4032 2010-06-29 Doug Kwan <dougkwan@google.com>
4034 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4035 Initialize USE_SYMBOL_.
4036 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4038 (Arm_reloc_property::uses_symbol_): New data member declaration.
4039 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4040 uses symbol value and symbol is undefined but not weakly undefined.
4042 2010-06-28 Rafael Espindola <espindola@google.com>
4044 * plugin.cc (Plugin::load): Use dlerror.
4046 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4048 * symtab.cc (detect_odr_violations): When reporting an ODR
4049 violation, report an object where the symbol is defined.
4051 2010-06-25 Doug Kwan <dougkwan@google.com>
4053 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4054 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4056 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4057 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4058 target hook to detect function points.
4059 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4060 * icf.h (Icf::check_section_for_function_pointers): Change type of
4061 parameter SECTION_NAME to const reference to std::string. Use
4062 target hook to determine if section may have unsafe pointers.
4063 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4066 2010-06-21 Rafael Espindola <espindola@google.com>
4068 * fileread.cc (Input_file::find_fie): New
4069 (Input_file::open): Use Input_file::find_fie.
4070 * fileread.h (Input_file::find_fie): New
4071 * plugin.cc (set_extra_library_path): New.
4072 (Plugin::load): Add set_extra_library_path to the transfer vector.
4073 (Plugin_manager::set_extra_library_path): New.
4074 (Plugin_manager::add_input_file): Use the extra search path if set.
4075 (set_extra_library_path(): New.
4076 * plugin.h (Plugin_manager): Add set_extra_library_path and
4079 2010-06-19 Cary Coutant <ccoutant@google.com>
4081 * layout.cc (gdb_sections): Add .debug_types.
4082 (lines_only_debug_sections): Likewise.
4084 2010-06-18 Rafael Espindola <espindola@google.com>
4086 * plugin.cc (add_input_file,add_input_library)
4087 (Plugin_manager::add_input_file): Make filename arguments const.
4088 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4091 2010-06-16 Doug Kwan <dougkwan@google.com>
4093 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4094 .ARM.attributes section if we have not merged any input
4095 attributes sections.
4097 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4099 * arm.cc: Allow combining objects with no EABI version
4102 2010-06-15 Rafael Espindola <espindola@google.com>
4104 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4106 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4108 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4109 (struct iovec): Correct !HAVE_READV definition.
4111 2010-06-10 Cary Coutant <ccoutant@google.com>
4113 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4114 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4116 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4119 * symtab.h (Symbol::is_placeholder): New member function.
4120 * target-reloc.h (relocate_section): Check for placeholder symbols.
4122 * testsuite/Makefile.am (plugin_test_8): New test.
4123 (plugin_test_9): New test.
4124 * testsuite/Makefile.in: Regenerate.
4126 2010-06-09 Nick Clifton <nickc@redhat.com>
4128 * yyscript.y (input_list_element): Allow strings prefixed with
4129 the '-' character. Treat these as libraries.
4130 * script.cc (script_add_library): New function. Adds a library
4131 specified by "-l<name>" found in an input script.
4132 * script-c.h: Add prototype for script_add_library.
4134 2010-06-07 Doug Kwan <dougkwan@google.com>
4136 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4137 Restrict stub-group size to be within long conditional branch
4138 range when working around cortex-A8 erratum.
4140 2010-06-07 Damien Diederen <dd@crosstwine.com>
4142 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4145 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4149 (Output_section::Input_section_sort_entry::compare_section_ordering):
4150 Change to return non-zero correctly.
4151 (Output_section::Input_section_sort_section_order_index_compare
4152 ::operator()): Change to fix ambiguity in comparisons.
4154 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4156 * gold.h (is_wildcard_string): New function.
4157 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4158 (Layout::layout_eh_frame): Ditto.
4159 (Layout::find_section_order_index): New method.
4160 (Layout::read_layout_from_file): New method.
4161 * layout.h (Layout::find_section_order_index): New method.
4162 (Layout::read_layout_from_file): New method.
4163 (Layout::input_section_position_): New private member.
4164 (Layout::input_section_glob_): New private member.
4165 * main.cc (main): Call read_layout_from_file here.
4166 * options.h (--section-ordering-file): New option.
4167 * output.cc (Output_section::input_section_order_specified_): New
4169 (Output_section::Output_section): Initialize new member.
4170 (Output_section::add_input_section): Add new parameter.
4171 Keep input sections when --section-ordering-file is used.
4172 (Output_section::set_final_data_size): Sort input sections when
4173 section ordering file is specified.
4174 (Output_section::Input_section_sort_entry): Add new parameter.
4176 (Output_section::Input_section_sort_entry::compare_section_ordering):
4178 (Output_section::Input_section_sort_compare::operator()): Change to
4179 consider section_order_index.
4180 (Output_section::Input_section_sort_init_fini_compare::operator()):
4181 Change to consider section_order_index.
4182 (Output_section::Input_section_sort_section_order_index_compare
4183 ::operator()): New method.
4184 (Output_section::sort_attached_input_sections): Change to sort
4185 according to section order when specified.
4186 (Output_section::add_input_section<32, true>): Add new parameter.
4187 (Output_section::add_input_section<64, true>): Add new parameter.
4188 (Output_section::add_input_section<32, false>): Add new parameter.
4189 (Output_section::add_input_section<64, false>): Add new parameter.
4190 * output.h (Output_section::add_input_section): Add new parameter.
4191 (Output_section::input_section_order_specified): New
4193 (Output_section::set_input_section_order_specified): New method.
4194 (Input_section::Input_section): Initialize section_order_index_.
4195 (Input_section::section_order_index): New method.
4196 (Input_section::set_section_order_index): New method.
4197 (Input_section::section_order_index_): New member.
4198 (Input_section::Input_section_sort_section_order_index_compare): New
4200 (Output_section::input_section_order_specified_): New member.
4201 * script-sections.cc (is_wildcard_string): Delete and move modified
4203 (Output_section_element_input::Output_section_element_input): Modify
4204 call to is_wildcard_string.
4205 (Output_section_element_input::Input_section_pattern
4206 ::Input_section_pattern): Ditto.
4207 (Output_section_element_input::Output_section_element_input): Ditto.
4208 * testsuite/Makefile.am (final_layout): New test case.
4209 * testsuite/Makefile.in: Regenerate.
4210 * testsuite/final_layout.cc: New file.
4211 * testsuite/final_layout.sh: New file.
4213 2010-06-01 Rafael Espindola <espindola@google.com>
4215 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4217 2010-06-01 Rafael Espindola <espindola@google.com>
4219 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4220 visibility of symbols.
4222 2010-05-27 Doug Kwan <dougkwan@google.com>
4224 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4225 from start of output section instead of address for a local symbol
4226 in a merged or relaxed section when doing a relocatable link.
4228 2010-05-26 Rafael Espindola <espindola@google.com>
4231 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4232 adding sections the garbage collector removed.
4233 * gold/testsuite/Makefile.am: Add test.
4234 * gold/testsuite/Makefile.in: Regenerate.
4235 * gold/testsuite/plugin_test_7.sh: New.
4236 * gold/testsuite/plugin_test_7_1.c: New.
4237 * gold/testsuite/plugin_test_7_2.c: New.
4239 2010-05-26 Rafael Espindola <espindola@google.com>
4241 * script-sections.cc (Output_section_definition::set_section_addresses):
4242 Check for --section-start.
4244 2010-05-26 Doug Kwan <dougkwan@google.com>
4246 * arm.cc (Arm_scan_relocatable_relocs): New class.
4247 (Target_arm::relocate_special_relocatable): New method.
4248 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4249 (Arm_relocate_functions::thumb_branch_common): Same.
4250 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4251 instead of Default_scan_relocatable_relocs.
4252 * target-reloc.h (relocate_for_relocatable): Let target handle
4253 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4254 * target.h (Sized_target::relocate_special_relocatable): New method.
4256 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4258 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4260 2010-05-23 Doug Kwan <dougkwan@google.com>
4262 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4264 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4265 with a direct branch, not a conditional branch, to a stub.
4266 * merge.cc (Output_merge_base::record_input_section): New method
4268 (Output_merge_data::do_add_input_section): Record input section if
4269 keeps-input-sections flag is set.
4270 (Output_merge_string::do_add_input_section): Ditto.
4271 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4272 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4274 (Output_merge_base::keeps_input_sections,
4275 Output_merge_base::set_keeps_input_sections,
4276 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4278 (Output_merge_base::Input_sections): New type declaration.
4279 (Output_merge_base::input_sections_begin,
4280 Output_merge_base::input_sections_end,
4281 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4282 (Output_merge_base::bool keeps_input_sections_,
4283 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4284 Output_merge_base::input_sections_): New data members.
4285 (Output_merge_data::do_set_keeps_input_sections): New method
4287 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4288 * output.cc (Output_section::Input_section::relobj): Move method
4289 defintion from class declaration to here and handle merge sections.
4290 (Output_section::Input_section::shndx): Ditto.
4291 (Output_section::Output_section): Remove initializations of removed
4292 data members and initialize new data member LOOKUP_MAPS_.
4293 (Output_section::add_input_section): Set keeps-input-sections flag
4294 for a newly created merge output section as appropriate. Adjust code
4295 to use Output_section_lookup_maps class.
4296 (Output_section::add_relaxed_input_section): Adjst code for lookup
4297 maps code refactoring.
4298 (Output_section::add_merge_input_section): Add a new parameter
4299 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4300 class. If adding input section to a newly created merge output
4301 section fails, remove the new merge section.
4302 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4303 Adjust code for use of the Output_section_lookup_maps class.
4304 (Output_section::find_merge_section): Ditto.
4305 (Output_section::build_lookup_maps): New method defintion.
4306 (Output_section::find_relaxed_input_section): Adjust code to use
4307 Output_section_lookup_maps class.
4308 (Output_section::get_input_sections): Export merge sections. Adjust
4309 code to use Output_section_lookup_maps class.
4310 (Output_section:::add_script_input_section): Adjust code to use
4311 Output_section_lookup_maps class. Update lookup maps for merge
4313 (Output_section::discard_states): Use Output_section_lookup_maps.
4314 (Output_section::restore_states): Same.
4315 * output.h (Merge_section_properties): Move class defintion out of
4317 (Output_section_lookup_maps): New class.
4318 (Output_section::Input_section::is_merge_section): New method
4320 (Output_section::Input_section::relobj): Move defintion out of class
4321 defintion. Declare method only.
4322 (Output_section::Input_section::shndx): Ditto.
4323 (Output_section::Input_section::output_merge_base): New method defintion.
4324 (Output_section::Input_section::u2_.pomb): New union field.
4325 (Output_section::Merge_section_by_properties_map,
4326 Output_section::Output_section_data_by_input_section_map,
4327 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4329 (Output_section::add_merge_input_section): Add new parameter
4330 KEEPS_INPUT_SECTIONS.
4331 (Output_section::build_lookup_maps): New method declaration.
4332 (Output_section::merge_section_map_,
4333 Output_section::merge_section_by_properties_map_,
4334 Output_section::relaxed_input_section_map_,
4335 Output_section::is_relaxed_input_section_map_valid_): Remove data
4337 (Output_section::lookup_maps_): New data member.
4339 2010-05-21 Doug Kwan <dougkwan@google.com>
4342 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4343 avoid a compilation error.
4345 2010-05-19 Rafael Espindola <espindola@google.com>
4347 * script-sections.cc (Output_section_definition::allocate_to_segment):
4348 Update the phdrs_list even when the output section is NULL.
4349 * testsuite/Makefile.am: Add test.
4350 * testsuite/Makefile.in: Regenerate.
4351 * testsuite/script_test_9.cc: New.
4352 * testsuite/script_test_9.sh: New.
4353 * testsuite/script_test_9.t: New.
4355 2010-05-19 Doug Kwan <dougkwan@google.com>
4357 * arm.cc (Arm_input_section::original_size): New method.
4358 (Arm_input_section::do_addralign): Add a cast.
4359 (Arm_input_section::do_output_offset): Remove static cast.
4360 (Arm_input_section::original_addralign,
4361 Arm_input_section::original_size_): Change type to uint32_t.
4362 (Arm_input_section::init): Add safe casts for section alignment
4364 (Arm_input_section::set_final_data_size): Do not set address and
4365 offset of stub table.
4366 (Arm_output_section::fix_exidx_coverage): Change use of of
4367 Output_section::Simple_input_section to that of
4368 Output_section::Input_section.
4369 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4370 except for the first pass.
4371 * output.cc (Output_section::get_input_sections): Change type of
4372 input_sections to std::list<Input_section>.
4373 (Output_section::add_script_input_section): Rename from
4374 Output_section::add_simple_input_section. Change type of SIS
4375 parameter from Simple_input_section to Input_section.
4376 * output.h (Output_section::Simple_input_section): Remove class.
4377 (Output_section::Input_section): Change class visibility to public.
4378 (Output_section::Input_section::addralign): Use stored alignments
4379 for special input sections if set.
4380 (Output_section::Input_section::set_addralign): New method.
4381 (Output_section::get_input_sections): Change parameter type from
4382 list of Simple_input_section to list of Input_section.
4383 (Output_section::add_script_input_section): Rename from
4384 Output_section::add_simple_input_section. Change first parameter's
4385 type from Simple_input_section to Input_section and remove the
4386 second and third parameters.
4387 * script-sections.cc (Input_section::Input_section_list): Change
4388 type to list of Output_section::Input_section/
4389 (Input_section_info::Input_section_info): Change parameter type of
4390 INPUT_SECTION to Output_section::Input_section.
4391 (Input_section_info::input_section): Change return type.
4392 (Input_section_info::input_section_): Change type to
4393 Output_section::Input_section.
4394 (Output_section_element_input::set_section_addresses): Adjust code
4395 to use Output_section::Input_section instead of
4396 Output_section::Simple_input_section. Adjust code for renaming
4397 of Output_section::add_simple_input_section.
4398 (Orphan_output_section::set_section_addresses): Ditto.
4400 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4402 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4403 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4405 2010-05-18 Rafael Espindola <espindola@google.com>
4407 * options.cc (General_options::finalize): Handle -nostdlib.
4408 * options.h (nostdlib): New option.
4409 * script.cc (script_add_search_dir): Handle -nostdlib.
4411 2010-05-12 Doug Kwan <dougkwan@google.com>
4413 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4414 attributes section only if there no attributes section after merging.
4415 (Target_arm::merge_object_attributes): Move value of
4416 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4417 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4418 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4419 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4420 and arm_attr_merge_7.stdout.
4421 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4422 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4423 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4424 arm_attr_merge_7b.o): New rules.
4425 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4427 * testsuite/Makefile.in: Regenerate.
4428 * testsuite/arm_attr_merge.sh: New file.
4429 * testsuite/arm_attr_merge_[67][ab].s: Same.
4431 2010-05-05 Nick Clifton <nickc@redhat.com>
4433 * po/es.po: Updated Spanish translation.
4435 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4437 * Makefile.am (install-exec-local): Properly install gold as
4438 default cross linker.
4439 * Makefile.in: Regenerated.
4441 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4442 Nick Clifton <nickc@redhat.com>
4444 * configure.ac (install_as_default): Define and set to false
4445 unless --enable-gold or --enable-gold=both/gold has been
4447 * configure: Regenerate.
4449 * Makefile.am (install-exec-local): Install the executable as
4450 'ld.gold'. If install_as_default is true then also install it as
4452 * Makefile.in: Regenerated.
4454 2010-04-24 Ian Lance Taylor <iant@google.com>
4456 * layout.cc (Layout::layout_reloc): In relocatable link don't
4457 combine reloc sections for grouped sections.
4459 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4461 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4462 sections that are not ordinary to icf.
4463 * icf.cc (get_section_contents): Handle relocation pointing to section
4464 with no object or shndx information.
4465 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4466 * testsuite/Makefile.in: Regenerate.
4467 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4468 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4470 2010-04-22 Ian Lance Taylor <iant@google.com>
4472 * expression.cc (Expression::Expression_eval_info): Add
4473 result_alignment_pointer field.
4474 (Expression::eval_with_dot): Add result_alignment_pointer
4475 parameter. Change all callers.
4476 (Expression::eval_maybe_dot): Likewise.
4477 (class Binary_expression): Add alignment_pointer parameter to
4478 left_value and right_value. Change all callers.
4479 (BINARY_EXPRESSION): Set result alignment.
4480 (class Trinary_expression): Add alignment_pointer parameter to
4481 arg2_value and arg3_value. Change all callers.
4482 (Trinary_cond::value): Set result alignment.
4483 (Max_expression::value, Min_expression::value): Likewise.
4484 (Align_expression::value): Likewise.
4485 * script-sections.cc (class Sections_element): Add dot_alignment
4486 parameter to set_section_addresses virtual function. Update
4488 (class Output_section_element): Likewise.
4489 (Script_sections::create_segments): Add dot_alignment parameter.
4491 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4492 (Script_sections::set_phdrs_clause_addresses): Likewise.
4493 * script-sections.h: Update declarations.
4494 * script.h: Update declarations.
4495 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4497 * testsuite/script_test_3.t: Set large alignment.
4498 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4499 segment has expected alignment.
4501 2010-04-22 Nick Clifton <nickc@redhat.com>
4503 * po/gold.pot: Updated by the Translation project.
4504 * po/vi.po: Updated Vietnamese translation.
4506 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4508 * testsuite/Makefile.am (check_PROGRAMS): Add
4509 icf_virtual_function_folding_test.
4510 * testsuite/Makefile.in: Regenerated.
4512 2010-04-15 Andrew Haley <aph@redhat.com>
4514 * options.h (merge_exidx_entries): New option.
4515 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4516 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4517 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4518 (Target_arm::merge_exidx_entries): New function.
4519 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4520 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4521 to Arm_exidx_fixup constructor.
4522 Add new arg, merge_exidx_entries.
4523 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4524 Arm_output_section::fix_exidx_coverage.
4526 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4528 * icf.cc (get_section_contents): Check for preemptible functions.
4529 Ignore addend when appropriate.
4530 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4532 (add_from_relobj): Check for section folded.
4533 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4534 * symtab.h (should_add_dynsym_entry): Add new parameter.
4535 * target-reloc.h (scan_relocs): Check for section folded.
4536 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4537 Check reloc types for function pointers in shared objects.
4538 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4540 (icf_preemptible_functions_test): New test case.
4541 (icf_string_merge_test): New test case.
4542 * testsuite.Makefile.in: Regenerate.
4543 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4544 bar_glob. Refactor code.
4545 * testsuite/icf_preemptible_functions_test.cc: New file.
4546 * testsuite/icf_preemptible_functions_test.sh: New file.
4547 * testsuite/icf_string_merge_test.cc: New file.
4548 * testsuite/icf_string_merge_test.sh: New file.
4549 * testsuite/icf_virtual_function_folding_test.cc: New file.
4550 * testsuite/icf_virtual_function_folding_test.sh: New file.
4552 2010-04-14 Doug Kwan <dougkwan@google.com>
4554 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4555 for local symbol recounting if we remove a section due to ICF.
4556 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4557 there are no regular objects in input.
4559 2010-04-13 Doug Kwan <dougkwan@google.com>
4561 * arm.cc (Arm_input_section::set_final_data_size): Compute
4562 accurate final data size instead of using current data size.
4564 2010-04-09 Doug Kwan <dougkwan@google.com>
4566 * layout.cc (Layout::choose_output_section): Handle script section
4568 (Layout::make_output_section_for_script): Add section type parameter.
4569 Handle script section types.
4570 * layout.h (Layout::make_output_section_for_script): Add section
4572 * output.cc (Output_section::Output_section): Initialize data member
4574 (Output_section::do_reset_address_and_file_offset): Do not set address
4575 to 0 if section is a NOLOAD section.
4576 * output.h (Output_section::is_noload): New method.
4577 (Output_section::set_is_noload): Ditto.
4578 (Output_section::is_noload_): New data member.
4579 * script-c.h (Script_section_type): New enum type.
4580 (struct Parser_output_section_header): Add new file section_type.
4581 * script-sections.cc (Sections_element::output_section_name): Add
4582 parameter for returning script section type.
4583 (Output_section_definition::output_section_name): Ditto.
4584 (Output_section_definition::section_type)P; New method.
4585 (Output_section_definiton::script_section_type_name): Ditto.
4586 (Output_section_definition::script_section_type_): New data member.
4587 (Output_section_definition::Output_section_definition): Initialize
4588 data member Output_section_definition::script_section_type_.
4589 (Output_section_definition::create_sections): Pass script section type
4590 to Layout::make_output_section_for_script.
4591 (Output_section_definition::output_section_name): Return script
4592 section type to caller.
4593 (Output_section_definition::set_section_address): Do not advance
4594 dot value and load address if section type is NOLOAD. Set address
4595 of NOLOAD sections regardless of section flags.
4596 (Output_section_definition::print): Print section type if it is
4597 not SCRIPT_SECTION_TYPE_NONE.
4598 (Output_section_definition::section_type): New method.
4599 (Output_section_definition::script_section_type_name): Ditto.
4600 (Script_sections::output_section_name): Add new parameter
4601 PSECTION_TYPE for returning script section type. Pass it to
4602 section elements. Handle discard sections.
4603 (Sort_output_sections::operator()): Handle NOLOAD sections.
4604 * script-sections.h (Script_sections::Section_type): New enum type.
4605 (Script_sections::output_section_name): Add a new parameter for
4606 returning script section type.
4607 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4609 * yyscript.y (union): Add new field SECTION_TYPE.
4610 (COPY, DSECT, INFO, NOLOAD): New tokens.
4611 (opt_address_and_section_type): Change type to output_section_header.
4612 (section_type): New non-terminal
4613 (section_header): Handle section type.
4614 (opt_address_and_section_type): Return section type value.
4616 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4618 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4619 * testsuite/plugin_common_test_2.c (foo): Likewise.
4621 2010-04-08 Doug Kwan <dougkwan@google.com>
4623 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4625 * output.cc (Output_section::add_merge_input_section): Simplify
4626 code and return status of Output_merge_base::add_input_section.
4627 Update merge section map only if Output_merge_base::add_input_section
4630 2010-04-07 Doug Kwan <dougkwan@google.com>
4632 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4633 if section is marked as containing instructions but has no mapping
4635 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4636 correct section index.
4637 (Arm_relobj::find_linked_text_section): Ditto.
4639 2010-04-07 Cary Coutant <ccoutant@google.com>
4641 * archive.cc (include_member): Destroy Read_symbols_data object before
4643 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4644 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4645 (Read_symbols_data::~Read_symbols_data) New destructor.
4646 (Section_relocs::Section_relocs) New constructor.
4647 (Section_relocs::~Section_relocs) New destructor.
4648 (Read_relocs_data::Read_relocs_data) New constructor.
4649 (Read_relocs_data::~Read_relocs_data) New destructor.
4650 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4651 pointers to NULL after deleting.
4653 2010-04-07 Doug Kwan <dougkwan@google.com>
4655 * arm.cc: Replace "endianity" with "endianness" in comments.
4656 (Arm_exidx_cantunwind): Ditto.
4657 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4658 (Arm_relobj::merge_flags_and_attributes): New method.
4659 (Arm_relobj::merge_flags_and_attributes_): New data member.
4660 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4661 (Arm_relobj::scan_sections_for_stubs): Ditto.
4662 (Arm_relobj::do_read_symbols): Check to see if we really want to
4663 merge processor-specific flags and attributes. Exit early if
4664 an object is empty except for section names and the undefined symbol.
4665 (Target_arm::do_finalize_sections): Move check for ELF format to
4666 Arm_relobj::do_read_symbols. Merge processor specific flags and
4667 attributes from a regular object only when we have determined that
4668 it is aapropriate. Do not create an .ARM.attributes section in
4669 output if there is no regular input object.
4670 (Target_arm::merge_processor_specific_flags): Check
4671 --warn-mismatch before printing any error.
4672 (Target_arm::merge_object_attributes): Ditto.
4673 * gold.cc (queue_middle_tasks): Handle the case in which there is
4674 no regular object in input.
4675 * options.cc (General_options::parse_EB): New method.
4676 (General_options::parse_EL): Same.
4677 (General_options::General_options): Initialize endianness_.
4678 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4680 (General_options::Endianness): New enum.
4681 (General_options::endianness): New method.
4682 (General_options::endianness_): New data member.
4683 * parameters.cc (Parameters::set_options): Check target endianness.
4684 (Parameters::set_target_once): Ditto.
4685 (Parameters::check_target_endianness): New method.
4686 (parameters_force_valid_target): If either -EL or -EB is specified,
4687 use it to define endianness of default target.
4688 * parameters.h (Parameters::check_target_endianness): New method
4690 * target.h (class Target): Change "endianity" to "endianness"
4693 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4695 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4696 * configure: Regenerate.
4697 * Makefile.in: Regenerate.
4698 * testsuite/Makefile.in: Regenerate.
4700 2010-04-06 Cary Coutant <ccoutant@google.com>
4703 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4704 prevailing definitions of common symbols.
4705 * testsuite/plugin_test_6.sh: New test case.
4706 * testsuite/plugin_common_test_1.c: New test case.
4707 * testsuite/plugin_common_test_2.c: New test case.
4708 * testsuite/Makefile.am (plugin_test_6): New test case.
4709 * testsuite/Makefile.in: Regenerate.
4711 2010-04-06 Nick Clifton <nickc@redhat.com>
4713 * po/vi.po: New Vietnamese translation.
4715 2010-03-30 Doug Kwan <dougkwan@google.com>
4717 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4719 2010-03-25 Doug Kwan <dougkwan@google.com>
4721 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4722 to avoid a conversion warning on a 32-bit host.
4724 2010-03-24 Ian Lance Taylor <iant@google.com>
4726 * testsuite/script_test_3.t: Add a TLS segment.
4727 * testsuite/Makefile.am (check_PROGRAMS): Add
4728 tls_phdrs_script_test.
4729 (tls_phdrs_script_test_SOURCES): Define.
4730 (tls_phdrs_script_test_DEPENDENCIES): Define.
4731 (tls_phdrs_script_test_LDFLAGS): Define.
4732 (tls_phdrs_script_test_LDADD): Define.
4733 * testsuite/Makefile.in: Rebuild.
4735 2010-03-23 Cary Coutant <ccoutant@google.com>
4737 * fileread.cc (find_or_make_view): Fix comment.
4739 2010-03-23 Ian Lance Taylor <iant@google.com>
4741 * script-sections.cc (class Orphan_section_placement): Define
4742 PLACE_TLS and PLACE_TLS_BSS.
4743 (Orphan_section_placement::Orphan_section_placement): Initialize
4745 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4746 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4747 (tls_script_test_SOURCES): Define.
4748 (tls_script_test_DEPENDENCIES): Define.
4749 (tls_script_test_LDFLAGS): Define.
4750 (tls_script_test_LDADD): Define.
4751 * testsuite/Makefile.in: Rebuild.
4753 2010-03-22 Doug Kwan <dougkwan@google.com>
4755 * arm.cc (Arm_relocate_functions::abs8,
4756 Arm_relocate_functions::abs16): Use correct check for overflow
4757 specified in the ARM ELF specs.
4758 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4759 target of a BLX instruction specially.
4760 (Reloc_stub::stub_type_for_reloc): Ditto.
4761 (Relocate::relocate): Use symbolic names instead of numeric relocation
4762 codes to report error.
4763 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4765 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4766 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4767 thumb2_blx_out_of_range.stdout
4768 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4769 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4770 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4771 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4772 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4773 thumb2_blx_in_range, thumb2_blx_in_range.o,
4774 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4775 thumb2_blx_out_of_range.o): New rules.
4776 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4777 thumb2_blx_in_range and thumb2_blx_out_of_range.
4778 * testsuite/Makefile.in: Regenerate.
4779 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4780 * testsuite/thumb_blx_in_range.s: New file.
4781 * testsuite/thumb_blx_out_of_range.s: New file.
4783 2010-03-22 Rafael Espindola <espindola@google.com>
4785 * archive.cc (Should_include): Move to archive.h.
4786 (should_include_member): Make it a member of Archive.
4788 (Add_lib_group_symbols): New.
4789 * archive.h: Include options.h.
4790 (Archive_member): Moved from Archive.
4791 (Should_include): Moved from archive.cc.
4793 (Add_lib_group_symbols): New.
4794 * dynobj.cc (do_should_include_member): New.
4795 * dynobj.h (do_should_include_member): New.
4796 * gold.cc (queue_initial_tasks): Update call to queue.
4797 * main.cc (main): Print lib group stats.
4798 * object.cc (do_should_include_member): New.
4799 * object.h: Include archive.h.
4800 (Object::should_include_member): New.
4801 (Object::do_should_include_member): New.
4802 (Sized_relobj::do_should_include_member): New.
4803 * options.cc (General_options::parse_start_lib): New.
4804 (General_options::parse_end_lib): New.
4805 (Input_arguments::add_file): Handle lib groups.
4806 (Input_arguments::start_group): Check we are not in a lib.
4807 (Input_arguments::start_lib): New.
4808 (Input_arguments::end_lib): New.
4809 * options.h (General_options): Add start_lib and end_lib.
4810 (Input_argument::lib_): New.
4811 (Input_argument::lib): New.
4812 (Input_argument::is_lib): New.
4813 (Input_file_lib): New.
4814 (Input_arguments::in_lib_): New.
4815 (Input_arguments::in_lib): New.
4816 (Input_arguments::start_lib): New.
4817 (Input_arguments::end_lib_): New.
4818 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4819 in unused members as preempted.
4820 (Sized_pluginobj::do_should_include_member): New.
4821 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4822 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4824 (Read_symbols::do_whole_lib_group): New.
4825 (Read_symbols::do_lib_group): New.
4826 (Read_symbols::do_read_symbols): Handle lib groups.
4827 (Read_symbols::get_name): Handle lib groups.
4828 * readsyms.h (Read_symbols): Add an archive member pointer.
4829 (Read_symbols::do_whole_lib_group): New.
4830 (Read_symbols::do_lib_group): New.
4831 (Read_symbols::member_): New.
4832 * script.cc (read_input_script): Update call to queue_soon.
4834 2010-03-19 Doug Kwan <dougkwan@google.com>
4836 * arm.cc (Stub_table::Stub_table): Initialize new data members
4837 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4838 (Stub_table::add_reloc_stub): Assign stub offset and update
4839 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4840 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4842 (Stub_table::update_data_size_and_addralign): Use
4843 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4844 instead of going over all reloc stubs.
4845 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4846 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4847 Stringpool_template::offset_ to size of Stringpool_char.
4848 (Stringpool_template::new_key_offset): Remove code to initialize
4849 Stringpool_template::offset_.
4850 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4851 Stringpool_template::offset_ to zero.
4853 2010-03-15 Doug Kwan <dougkwan@google.com>
4855 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4857 (Stringpool_template::new_key_offset): New method.
4858 (Stringpool_template::add_string): Assign offsets when adding new
4860 (Stringpool_template::set_string_offsets): Do not set string offsets
4861 when not optimizing.
4862 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4864 (Chunked_vector::clear): Clear size_.
4865 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4866 (Chunked_vector::size): Return size_.
4867 (Chunked_vector::push_back): Use size_ to find insert position.
4868 (Chunked_vector::size_): New data member.
4869 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4870 (Stringpool_template::new_key_offset): New method declaration.
4871 (Stringpool_template::offset_): New data member.
4873 2010-03-15 Rafael Espindola <espindola@google.com>
4875 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4876 Add_symbols' constructor.
4877 * readsyms.h (Add_symbols): Remove the input_group member.
4879 2010-03-10 Ian Lance Taylor <iant@google.com>
4881 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4882 target to ask whether a reference to a symbol requires a stack
4884 * target.h (Target::is_call_to_non_split): New function.
4885 (Target::do_is_call_to_non_split): Declare virtual function.
4886 * target.cc: Include "symtab.h".
4887 (Target::do_is_call_to_non_split): New function.
4888 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4890 2010-03-10 Cary Coutant <ccoutant@google.com>
4892 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4893 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4894 (File_read::open[2]): Add whole_file_view_ to list of views.
4895 (File_read::make_view): Remove test of whole_file_view_.
4896 (File_read::find_or_make_view): Create whole_file_view_ if
4898 (File_read::clear_views): Replace bool parameter with enum;
4899 adjust all callers. Don't delete views with permanent data;
4900 do delete cached views and views from archives if
4901 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4902 if clearing the corresponding view.
4903 * fileread.h (File_read::Clear_views_mode): New enum.
4904 (File_read::View::is_permanent_view): New method.
4905 (File_read::clear_views): Replace bool parameter
4906 with enum; adjust all callers.
4907 * options.h (General_options): Change keep_files_mapped option;
4908 add map_whole_files.
4909 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4911 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4914 2010-03-10 David S. Miller <davem@davemloft.net>
4916 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4918 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4920 * icf.cc (get_section_contents): Add '@' marker after processing the
4923 2010-03-08 Doug Kwan <dougkwan@google.com>
4925 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4926 due to a conversion warning.
4927 (Arm_relobj::update_output_local_symbol_count): Check for local
4928 symbol with unset output index.
4930 2010-03-05 Ian Lance Taylor <iant@google.com>
4932 * options.h (class General_options): Add --spare-dynamic-tags.
4933 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4934 --spare-dynamic-tags.
4936 2010-03-05 Ian Lance Taylor <iant@google.com>
4938 * incremental.cc: Include "libiberty.h".
4940 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4942 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4943 function, is_info_ member.
4944 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4945 (Versions::Versions): Update caller.
4946 (Versions::define_base_version): Likewise.
4947 (Versions::add_def): Likewise.
4949 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4951 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4952 (Scan::possible_function_pointer_reloc): New function.
4953 (Scan::local_reloc_may_be_function_pointer): Change to call
4954 possible_function_pointer_reloc.
4955 (Scan::global_reloc_may_be_function_pointer): Ditto.
4956 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4957 relocations in ".data.rel.ro._ZTV" section.
4958 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4959 * testsuite/icf_safe_so_test.cc: Ditto.
4960 * testsuite/icf_safe_test.cc: Ditto.
4961 * testsuite/icf_safe_test.sh: Ditto.
4963 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4964 Ian Lance Taylor <iant@google.com>
4966 * target-reloc.h (relocate_section): Check the symbol table index
4967 for -1U before setting the local symbol index.
4968 (scan_relocatable_relocs): If copying the relocation, record that
4969 the local symbol is required.
4970 * object.h (Symbol_value::is_output_symtab_index_set): New
4972 (Symbol_value::may_be_discarded_from_output_symtab): New
4974 (Symbol_value::has_output_symtab_entry): New function.
4975 (Symbol_value::needs_output_symtab_entry): Remove.
4976 (Symbol_value::output_symtab_index): Make sure the symbol index is
4978 (Symbol_value::set_output_symtab_index): Make sure the symbol
4979 index is not set. Make sure the new index is valid.
4980 (Symbol_value::set_must_have_output_symtab_entry): New function.
4981 (Symbol_value::has_output_dynsym_entry): New function.
4982 (Symbol_value::set_output_dynsym_index): Make sure the new index
4984 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4985 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4986 local symbol if permitted.
4987 (Sized_relobj::do_finalize_local_symbols): Call
4988 is_output_symtab_index_set rather than needs_output_symtab_entry.
4989 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4990 rather than needs_output_symtab_entry. Call
4991 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4992 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4993 is_output_symtab_index_set rather than needs_output_symtab_entry.
4994 * testsuite/discard_locals_relocatable_test.c: New file.
4995 * testsuite/discard_locals_test.sh: Test -r.
4996 * testsuite/Makefile.am (check_DATA): Add
4997 discard_locals_relocatable_test1.syms,
4998 discard_local_relocatable_test2.syms.
4999 (MOSTLYCLEANFILES): Likewise. Also add
5000 discard_locals_relocatable_test1.lout and
5001 discard_locals_relocatable_test2.out.
5002 (discard_locals_relocatable_test1.syms): New target.
5003 (discard_locals_relocatable_test.o): New target.
5004 (discard_locals_relocatable_test1.out): New target.
5005 (discard_locals_relocatable_test2.syms): New target.
5006 (discard_locals_relocatable_test2.out): New target.
5007 (various): Add missing ../ld-new dependencies.
5008 * testsuite/Makefile.in: Rebuild.
5010 2010-03-03 Nick Clifton <nickc@redhat.com>
5012 * po/fi.po: New Finnish translation.
5014 2010-03-01 Doug Kwan <dougkwan@google.com>
5016 * layout.cc (Layout::Layout): Force section types of .init_array*,
5017 .preinit_array* and .fini_array* sections.
5018 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5019 Fix check of return value of std::string::find.().
5020 (Output_section::Input_section_sort_compare::operator()): Remove
5021 comment about .init_array.
5022 (Output_section::Input_section_sort_init_fini_compare::operator()):
5024 (Output_section::sort_attached_input_sections): Handle .init_array
5025 and .fini_array specially.
5026 * output.h (Output_section::Inut_section_sort_compare): Update
5028 (Output_section::Input_section_sort_init_fini_compare): New struct.
5030 2010-02-26 Doug Kwan <dougkwan@google.com>
5032 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5033 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5034 * testsuite/debug_msg.sh: Avoid matching source line number for
5035 use of global variable undef_int.
5037 2010-02-26 Doug Kwan <dougkwan@google.com>
5039 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5040 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5041 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5042 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5043 * options.cc (General_options::General_options): Initialize member
5045 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5046 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5047 and rm_no_fix_v4bx.stdout
5048 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5049 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5050 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5051 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5052 and arm_no_fix_v4bx.
5053 * Makefile.in: Regenerate.
5054 * testsuite/arm_fix_v4bx.s: New file.
5055 * testsuite/arm_fix_v4bx.sh: Ditto.
5057 2010-02-24 Doug Kwan <dougkwan@google.com>
5059 * arm.cc (Target_arm::got_section): Make the .got section the first
5060 non RELRO section in the data segment.
5061 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5062 suffixes of section names.
5064 2010-02-24 Doug Kwan <dougkwan@google.com>
5066 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5067 flags and attributes merging if an input file is a binary file.
5068 * fileread.cc (Input_file::open): Record format of original file.
5069 * fileread.h (Input_file::Format): New enum type.
5070 (Input_file::Input_file): Initialize data member format_.
5071 (Input_file::format): New method definition.
5072 (Input_file::format_):: New data member.
5074 2010-02-24 Doug Kwan <dougkwan@google.com>
5076 * arm.cc (Arm_output_data_got): New class.
5077 (ARM_TCB_SIZE): New constant
5078 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5079 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5080 If user uses a script with a SECTIONS clause, issue only a warning
5081 for a misplaced EXIDX input section. Otherwise, issue an error.
5082 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5084 (Target_arm::got_mode_index_entry): Handle static linking.
5085 (Target_arm::Scan::local): Ditto.
5086 (Target_arm::Scan::global): Ditto.
5087 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5088 all incorrectly implemented relocations.
5089 (Target_arm::fix_exidx_coverage): Pass layout to
5090 Arm_output_section::fix_exidx_coverage.
5091 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5092 from ".ARM.exidx." and ".ARM.extab.".
5094 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5096 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5097 section if it does not already exist.
5098 * attributes.cc (Attributes_section_data::Attributes_section_data):
5099 Don't crash if size is zero.
5101 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5102 Ian Lance Taylor <iant@google.com>
5104 * gold.cc (queue_middle_tasks): If no input files were opened,
5106 * workqueue.h (Task_function::Task_function): Assert that there is
5109 2010-02-22 Doug Kwan <dougkwan@google.com>
5111 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5112 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5113 types to avoid warnings due to different uint64_t implementations
5116 2010-02-21 Doug Kwan <dougkwan@google.com>
5118 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5119 handling of the maximum backward branch offset.
5120 (Arm_relocate_functions::thumb_branch_common): Ditto.
5121 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5122 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5123 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5124 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5125 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5126 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5127 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5128 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5129 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5130 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5131 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5132 thumb2_bl_out_of_range.o): New rules.
5133 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5134 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5135 thumb2_bl_out_of_range
5136 * testsuite/Makefile.in: Regenerate.
5137 * testsuite/arm_bl_in_range.s: New file.
5138 * testsuite/arm_bl_out_of_range.s: Ditto.
5139 * testsuite/arm_branch_in_range.sh: Ditto.
5140 * testsuite/arm_branch_range.t: Ditto.
5141 * testsuite/thumb2_branch_range.t: Ditto.
5142 * testsuite/thumb_bl_in_range.s: Ditto.
5143 * testsuite/thumb_bl_out_of_range.s: Ditto.
5144 * testsuite/thumb_branch_range.t: Ditto.
5146 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5148 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5149 Add reloc offset information.
5150 * icf.cc (get_section_contents): Change iterators to point to the new
5151 vectors. Add reloc offset information to the contents.
5152 * icf.h (Icf::Sections_reachable_info): New typedef.
5153 (Icf::Sections_reachable_list): New typedef.
5154 (Icf::Offset_info): New typedef.
5155 (Icf::Reloc_info): New struct typedef.
5156 (Icf::Reloc_info_list): New typedef.
5157 (Icf::symbol_reloc_list): Delete method.
5158 (Icf::addend_reloc_list): Delete method.
5159 (Icf::section_reloc_list): Delete method.
5160 (Icf::reloc_info_list): New method.
5161 (Icf::reloc_info_list_): New member.
5163 2010-02-19 Doug Kwan <dougkwan@google.com>
5165 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5166 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5167 * arm.cc (Arm_relocation_functions): New forward declaration.
5168 (Target_arm::Target_arm): Initialize new data members
5169 got_mod_index_offset_ and tls_base_symbol_defined_.
5170 (Target_arm::Relocate::relocate_tls): New method.
5171 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5172 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5174 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5175 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5176 (Target_arm::got_mod_index_offset_,
5177 Target_arm::tls_base_symbol_defined_): New data members.
5178 (Target_arm::Scan::local, Target::Scan::global,
5179 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5182 2010-02-18 Doug Kwan <dougkwan@google.com>
5184 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5185 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5186 text section as a parameter becuase some broken tools may not set
5187 the link in section header.
5188 (Target_arm::has_got_section): New method.
5189 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5190 without any mapping symbol as data only. Remove warning.
5191 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5192 link in its section header, try to discover the link by inspecting the
5193 REL31 relocation at the beginning of the section.
5194 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5196 (Target_arm::Scan::global): Treat any reference to the symbol
5197 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5199 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5201 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5202 (Scan::global_reloc_may_be_function_pointer): New function.
5203 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5204 (Scan::global_reloc_may_be_function_pointer): New function.
5205 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5206 (Scan::global_reloc_may_be_function_pointer): New function.
5207 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5208 (Scan::global_reloc_may_be_function_pointer): New function.
5209 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5210 (Scan::global_reloc_may_be_function_pointer): New function.
5211 (Scan::possible_function_pointer_reloc): New function.
5212 (Target_x86_64::can_check_for_function_pointers): New function.
5213 * gc.h (gc_process_relocs): Scan relocation types to determine if
5214 function pointers were taken for targets that support it.
5215 * icf.cc (Icf::find_identical_sections): Include functions for
5216 folding in safe ICF whose pointer is not taken.
5217 * icf.h (Secn_fptr_taken_set): New typedef.
5218 (fptr_section_id_): New member.
5219 (section_has_function_pointers): New function.
5220 (set_section_has_function_pointers): New function.
5221 (check_section_for_function_pointers): New function.
5222 * options.h: Fix comment for safe ICF option.
5223 * target.h (can_check_for_function_pointers): New function.
5224 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5225 Modify icf_safe_test for X86-64.
5226 * testsuite/Makefile.in: Regenerate.
5227 * testsuite/icf_safe_so_test.cc: New file.
5228 * testsuite/icf_safe_so_test.sh: New file.
5229 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5230 (main): Change to take pointer to function kept_func_3.
5231 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5232 folding is done correctly for X86-64.
5234 2010-02-12 David S. Miller <davem@davemloft.net>
5236 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5237 is_symbolless parameter.
5238 (Output_reloc<SHT_REL>::is_symbolless): New.
5239 (Output_reloc<SHT_REL>::is_symbolless_): New.
5240 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5241 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5242 (Output_reloc<SHT_RELA>::is_symbolless): New.
5243 (Output_data_reloc::add_global): Handle is_symbolless.
5244 (Output_data_reloc::add_global_relative): Likewise.
5245 (Output_data_reloc::add_local): Likewise.
5246 (Output_data_reloc::add_local_relative): Likewise.
5247 (Output_data_reloc::add_symbolless_global_addend): New.
5248 (Output_data_reloc::add_symbolless_local_addend): New.
5249 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5251 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5252 instead of ->is_relative_
5253 (Output_reloc::write): Likewise.
5254 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5255 (Output_reloc::write_rel): Simplify.
5257 * sparc.cc (Target_sparc::Scan::local): Use
5258 ->add_symbolless_local_addend as needed.
5259 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5260 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5261 based upon relocation offset.
5263 2010-02-11 Doug Kwan <dougkwan@google.com>
5265 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5266 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5267 beginning of function.
5268 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5269 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5270 parameter is_32bit in calls to should_apply_static_reloc.
5271 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5272 (check_DATA): Add arm_abs_global.stdout.
5273 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5274 arm_abs_global.stdout): New rules.
5275 (MOSTLLYCLEANFILES): Add arm_abs_global
5276 * Makefile.in: Regenerate.
5277 * testsuite/arm_abs_global.s: New file.
5278 * testsuite/arm_abs_global.sh: Ditto.
5279 * testsuite/arm_abs_lib.s: Ditto.
5281 2010-02-11 Ian Lance Taylor <iant@google.com>
5283 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5285 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5286 Allocate_commons_task first.
5287 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5288 task, rather than symtab_lock_.
5289 (Gc_process_relocs::~Gc_process_relocs): New function.
5290 (Gc_process_relocs::is_runnable): Check this_blocker_.
5291 (Gc_process_relocs::locks): Use next_blocker_ rather than
5293 (Scan_relocs::~Scan_relocs): New function.
5294 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5296 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5298 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5299 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5300 constructor accordingly.
5301 (class Gc_process_relocs): Likewise.
5302 (class Scan_relocs): Likewise.
5303 * common.h (class Allocate_commons_task): Remove symtab_lock_
5304 field, and corresponding constructor parameter.
5305 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5307 (Allocate_commons_task::locks): Likewise.
5309 2010-02-11 Ian Lance Taylor <iant@google.com>
5311 * gold-threads.h (class Once): Define.
5312 (class Initialize_lock): Rewrite as child of Once.
5313 * gold-threads.cc (class Once_initialize): Define.
5314 (once_pointer_control): New static variable.
5315 (once_pointer, once_arg): New static variables.
5316 (c_run_once): New static function.
5317 (Once::Once, Once::run_once, Once::internal_run): New functions.
5318 (class Initialize_lock_once): Remove.
5319 (initialize_lock_control): Remove.
5320 (initialize_lock_pointer): Remove.
5321 (initialize_lock_once): Remove.
5322 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5323 (Initialize_lock::initialize): Rewrite.
5324 (Initialize_lock::do_run_once): New function.
5325 * archive.cc (Archive::interpret_header): Only clear name if it is
5327 * fileread.cc: Include "gold-threads.h"
5328 (file_counts_lock): New static variable.
5329 (file_counts_initialize_lock): Likewise.
5330 (File_read::release): Only increment counts when using --stats.
5331 Use a lock around the increment.
5332 * parameters.cc (class Set_parameters_target_once): Define.
5333 (set_parameters_target_once): New static variable.
5334 (Parameters::Parameters): Move here from parameters.h.
5335 (Parameters::set_target): Rewrite.
5336 (Parameters::set_target_once): New function.
5337 (Parameters::clear_target): Move here and rewrite.
5338 * parameters.h (class Parameters): Update declarations. Add
5339 set_parameters_target_once_ field.
5340 (Parameters::Parameters): Move to parameters.cc.
5341 (Parameters::clear_target): Likewise.
5342 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5344 (Start_group::~Start_group): New function.
5345 (Start_group::is_runnable): New function.
5346 (Start_group::locks, Start_group::run): New functions.
5347 (Finish_group::run): Change saw_undefined to size_t.
5348 * readsyms.h (class Start_group): Define.
5349 (class Finish_group): Change saw_undefined_ field to size_t.
5350 (Finish_group::Finish_group): Remove saw_undefined and
5351 this_blocker parameters. Change all callers.
5352 (Finish_group::set_saw_undefined): New function.
5353 (Finish_group::set_blocker): New function.
5354 * symtab.h (class Symbol_table): Change saw_undefined to return
5355 size_t. Change saw_undefined_ field to size_t.
5356 * target-select.cc (Set_target_once::do_run_once): New function.
5357 (Target_selector::Target_selector): Initialize set_target_once_
5358 field. Don't initialize lock_ and initialize_lock_ fields.
5359 (Target_selector::instantiate_target): Rewrite.
5360 (Target_selector::set_target): New function.
5361 * target-select.h (class Set_target_once): Define.
5362 (class Target_selector): Update declarations. Make
5363 Set_target_once a friend. Remove lock_ and initialize_lock_
5364 fields. Add set_target_once_ field.
5366 2010-02-10 Ian Lance Taylor <iant@google.com>
5368 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5370 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5371 (queue_middle_tasks): Add all blockers before queueing any tasks.
5372 (queue_final_tasks): Likewise.
5373 * token.h (Task_token::add_blockers): New function.
5374 * object.h (Input_objects::number_of_relobjs): New function.
5376 2010-02-10 Ian Lance Taylor <iant@google.com>
5378 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5379 shared, not if not position independent.
5380 * x86_64.cc (Relocate::relocate_tls): Likewise.
5381 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5382 (tls_pie_pic_test): New target.
5383 * testsuite/Makefile.in: Rebuild.
5385 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5386 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5387 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5388 * testsuite/Makefile.in: Rebuild.
5390 2010-02-09 David S. Miller <davem@davemloft.net>
5392 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5393 R_SPARC_RELATIVE using ->add_local_relative().
5394 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5396 * output.h (Output_data_dynamic::add_section_size): New method
5397 that takes two Output_data objects.
5398 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5399 entry param. Handle it in initializers.
5400 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5401 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5402 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5404 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5405 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5406 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5407 for dynrel_includes_plt.
5408 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5409 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5410 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5412 (Target_sparc::do_finalize_sections): Update to pass true for
5413 dynrel_includes_plt.
5414 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5415 output before .rela.plt
5416 (Target_powerpc::do_finalize_sections): Update to pass true for
5417 dynrel_includes_plt when 32-bit.
5419 2010-02-08 Doug Kwan <dougkwan@google.com>
5421 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5423 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5424 Arm_relobj::scan_section_for_cortex_a8_stubs,
5425 Arm_relobj::do_relocation_section): Instead of calling
5426 Output_section::output_address, use faster
5427 Arm_relobj::simple_input_section_output_address.
5429 2010-02-08 David S. Miller <davem@davemloft.net>
5431 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5432 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5433 relocation helper function.
5435 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5436 just like R_SPARC_GOT{10,13,22}.
5437 (Target_sparc::Scan::local): Likewise.
5438 (Target_sparc::Relocate:relocate): Likewise.
5440 2010-02-06 Ian Lance Taylor <iant@google.com>
5442 * configure.ac: Rewrite targetobjs duplicate removal code to use
5443 only shell constructs.
5444 * configure: Rebuild.
5446 2010-02-05 Doug Kwan <dougkwan@google.com>
5449 * arm.cc (Arm_relobj::section_is_scannable): New method.
5450 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5451 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5453 2010-02-04 Doug Kwan <dougkwan@google.com>
5456 * arm-reloc-property.cc (cstdio): Include.
5457 * configure.ac (targetobjs): Remove duplicates.
5458 * configure: Regenerate.
5459 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5460 big and little endian version for a given address size.
5462 2010-02-03 Doug Kwan <dougkwan@google.com>
5464 * arm-reloc-property.cc
5465 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5467 * arm-reloc-property.h
5468 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5469 New method definition.
5470 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5472 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5474 (GOT_PREL): Change implemented to Y.
5475 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5476 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5477 (Arm_relocate_functions::movw_abs_nc): Remove method.
5478 (Arm_relocate_functions::movt_abs): Ditto.
5479 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5480 (Arm_relocate_functions::thm_movt_abs): Ditto.
5481 (Arm_relocate_functions::movw_rel_nc): Ditto.
5482 (Arm_relocate_functions::movw_rel): Ditto.
5483 (Arm_relocate_functions::movt_rel): Ditto.
5484 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5485 (Arm_relocate_functions:thm_movw_rel): Ditto.
5486 (Arm_relocate_functions:thm_movt_rel): Ditto.
5487 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5488 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5489 New method definitions.
5490 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5491 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5492 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5493 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5494 (Target_arm::Relocate::relocate): Check for non-static or
5495 unimplemented relocation code and exit early. Change calls to
5496 Target_arm::reloc_uses_thumb_bit and
5497 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5498 instead. Refactor code to handle similar relocations to increase
5499 code sharing. Remove check for unsupported relocation code in switch
5501 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5502 relocation property table to find out size. Change error message to
5503 print out the name of a relocation code instead of the numeric value.
5504 (Target_arm::scan_reloc_for_stub): Use relocation property table
5505 instead of calling Target_arm::reloc_uses_thumb_bit().
5507 2010-02-02 Doug Kwan <dougkwan@google.com>
5509 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5510 types of relaxed input section.
5512 2010-02-02 Doug Kwan <dougkwan@google.com>
5514 * Makefile.am (HFILES): Add arm-reloc-property.h.
5516 (TARGETSOURCES): Add arm-reloc-property.cc
5517 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5518 (libgold_a_SOURCES): $(DEFFILES)
5519 * Makefile.in: Regenerate.
5520 * arm-reloc-property.cc: New file.
5521 * arm-reloc-property.h: New file.
5522 * arm-reloc.def: New file.
5523 * arm.cc: Update comments.
5524 (arm-reloc-property.h): New included header.
5525 (arm_reloc_property_table): New global variable.
5526 (Target_arm::do_select_as_default_target): New method definition.
5527 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5528 arm-reloc-property to targ_extra_obj.
5529 * parameters.cc (set_parameters_target): Call
5530 Target::select_as_default_target().
5531 * target.h (Target::select_as_default_target): New method definition.
5532 (Target::do_select_as_default_target): Same.
5534 2010-02-01 Doug Kwan <dougkwan@google.com>
5536 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5537 first_output_text_section_.
5538 (Arm_exidx_fixup::first_output_text_section): New method definition.
5539 (Arm_exidx_fixup::first_output_text_section_): New data member.
5540 (Arm_exidx_fixup::process_exidx_section): Record the first text
5541 output section seen.
5542 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5543 and entsize in output section header.
5545 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5547 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5548 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5549 (Arm_relocate_functions::thm_alu11): New Method.
5550 (Arm_relocate_functions::thm_pc8): New Method.
5551 (Arm_relocate_functions::thm_pc12): New Method.
5552 (Target_arm::Scan::local): Handle the relocations.
5553 (Target_arm::Scan::global): Likewise.
5554 (Target_arm::Relocate::relocate): Likewise.
5555 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5557 2010-01-29 Doug Kwan <dougkwan@google.com>
5559 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5560 of relocation types as ld.
5562 2010-01-29 Doug Kwan <dougkwan@google.com>
5564 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5566 (Arm_relocate_functions::thumb_branch_common): Ditto.
5567 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5568 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5569 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5570 Arm_relocate_functions::jump24): Remove.
5571 (Target_arm::Relocate::relocate): Adjust code to call
5572 Arm_relocation_functions::arm_branch_common and
5573 Arm_relocation_functions::thumb_branch_common instead of their removed
5574 wrappers. Merge switch-cases together to reduce source code size.
5576 2010-01-29 Doug Kwan <dougkwan@google.com>
5578 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5579 output_local_symbol_count_needs_update_.
5580 (Arm_relobj::output_local_symbol_count_needs_update,
5581 Arm_relobj::set_output_local_symbol_count_needs_update,
5582 Arm_relobj::update_output_local_symbol_count): New methods.
5583 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5585 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5586 of pointed function as in a R_ARM_PREL31 relocation.
5587 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5588 for output local symbol count updating.
5589 (Target_arm::do_relax): Update output local symbol counts in objects
5591 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5593 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5595 * arm.cc: Added support for the ARM relocations:
5596 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5597 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5598 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5600 (Arm_relocate_functions::movw_rel): New method.
5601 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5602 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5604 (Arm_relocate_functions::thm_movw_rel): New method.
5605 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5607 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5609 (Target_arm::Scan::global): Likewise.
5610 (Target_arm::Relocate::relocate): Likewise.
5611 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5614 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5616 * arm.cc: Added support for ARM group relocations.
5617 (Target_arm::reloc_needs_sym_origin): New method.
5618 (Arm_relocate_functions::calc_grp_kn): New method.
5619 (Arm_relocate_functions::calc_grp_residual): New method.
5620 (Arm_relocate_functions::calc_grp_gn): New method.
5621 (Arm_relocate_functions::arm_grp_alu): New Method.
5622 (Arm_relocate_functions::arm_grp_ldr): New Method.
5623 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5624 (Arm_relocate_functions::arm_grp_ldc): New Method.
5625 (Target_arm::Scan::local): Handle the ARM group relocations.
5626 (Target_arm::Scan::global): Likewise.
5627 (Target_arm::Relocate::relocate): Likewise.
5628 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5631 2010-01-26 Doug Kwan <dougkwan@google.com>
5633 * arm.cc (set): Include.
5634 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5636 (Arm_output_section::Text_section_list): New type.
5637 (Arm_output_section::append_text_sections_to_list): New method.
5638 (Arm_output_section::fix_exidx_coverage): Ditto.
5639 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5640 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5641 Relobj::set_section_offset() instead of
5642 Sized_relobj::invalidate_section_offset().
5643 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5644 parameter for section headers. Ignore relocation sections for
5645 unallocated sections and EXIDX sections.
5646 (Target_arm::fix_exidx_coverage): New method.
5647 (Target_arm::output_section_address_less_than): New type.
5648 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5649 linked text section instead of the EXIDX section.
5650 (Arm_output_section::create_stub_group): Add an assertion to check
5651 that this is not an EXIDX output section.
5652 (Arm_output_section::append_text_sections_to_list): New method.
5653 (Arm_output_section::fix_exidx_coverage): Ditto.
5654 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5655 Arm_relobj::section_needs_reloc_stub_scanning.
5656 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5658 (Target_arm::fix_exidx_coverage): New method.
5659 * object.h (Relobj::set_output_section): New method.
5660 (Sized_relobj::invalidate_section_offset): Remove method.
5661 (Sized_relobj::do_invalidate_section_offset): Remove method.
5662 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5664 2010-01-25 Doug Kwan <dougkwan@google.com>
5666 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5667 Fix warning due to signed and unsigned comparison on a 32-bit host.
5669 2010-01-22 Doug Kwan <dougkwan@google.com>
5671 * arm.cc (Target_arm::do_relax): Record an output section for section
5672 offset adjustment it contains any stub table that has changed.
5673 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5674 offsets in an output section if necessary.
5675 * output.cc (Output_section::Output_section): Initialize
5676 section_offsets_need_adjustments_.
5677 (Output_section::add_input_section_for_script): Renamed to
5678 Output_section::add_simple_input_section.
5679 (Output_section::save_states): Add a comment.
5680 (Output_section::discard_states): New method defintion.
5681 (Output_section::adjust_section_offsets): Same.
5682 * output.h (Output_section::add_input_section_for_script): Renamed to
5683 Output_section::add_simple_input_section.
5684 (Output_section::discard_states): New method declaration.
5685 (Output_section::adjust_section_offsets): Same.
5686 (Output_section::section_offsets_need_adjustment,
5687 Output_section::set_section_offsets_need_adjustment): New method
5689 (Output_section::section_offsets_need_adjustment_): New data member.
5690 * script-sections.cc
5691 (Output_section_element_input::set_section_address): Adjust code for
5692 renaming of Output_section::add_input_section_for_script.
5693 (Orphan_output_section::set_section_address): Same.
5695 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5697 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5698 Fix_v4bx enum values .
5699 * gold/options.h (General_options): New option definitions.
5700 (General_options::fix_v4bx): New method.
5701 (General_options::Fix_v4bx): New enum.
5702 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5703 (General_options::parse_fix_v4bx_interworking): New method.
5705 2010-01-22 Doug Kwan <dougkwan@google.com>
5707 * arm.cc (Arm_exidx_fixup): New class.
5709 2010-01-21 Doug Kwan <dougkwan@google.com>
5711 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5713 (Arm_exidx_section_offset_map): New type.
5715 2010-01-21 Doug Kwan <dougkwan@google.com>
5717 * arm.cc (Arm_exidx_input_section): New class.
5718 (Arm_relobj::exidx_input_section_by_link,
5719 Arm_relobj::exidx_input_section_by_shndx,
5720 Arm_relobj::make_exidx_input_section): New methods.
5721 (read_arm_attributes_section): Remove.
5722 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5723 information about them.
5724 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5727 2010-01-20 Doug Kwan <dougkwan@google.com>
5729 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5730 Input_section_specifier to Section_id.
5731 (Target_arm::new_arm_input_section: Adjust code for change of key
5733 (Target_arm::find_arm_input_section): Ditto.
5734 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5735 (Section_id): Remove.
5736 (Garbage_collection::Section_id_hash): Remove.
5737 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5738 (Section_id): Remove.
5739 (Icf::Section_id_hash): Remove.
5740 * object.h (Section_id, Const_section_id, Section_id_hash,
5741 Const_section_id_hash): New type definitions.
5742 * output.cc (Output_section::add_relaxed_input_section): Change to
5743 use Const_section_id instead of Input_section_specifier as key type.
5744 (Output_section::add_merge_input_section): Ditto.
5745 (Output_section::build_relaxation_map): Change to use Section_id
5746 instead of Input_section_specifier as key type.
5747 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5749 (Output_section::convert_input_sections_to_relaxed_sections): Change
5750 to use Const_section_id instead of Input_section_specifier as key type.
5751 (Output_section::find_merge_section): Ditto.
5752 (Output_section::find_relaxed_input_section): Ditto.
5753 * output.h (Input_section_specifier): Remove class.
5754 (Output_section::Output_section_data_by_input_section_map): Change
5755 key type to Const_section_id.
5756 (Output_section::Output_relaxed_input_section_by_input_section_map):
5758 (Output_section::Relaxation_map): Change key type to Section_id.
5760 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5762 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5763 (class Arm_v4bx_stub): New class.
5764 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5765 (Stub_factory::make_arm_v4bx_stub): New method.
5766 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5767 (Stub_table::empty): Handle v4bx stubs.
5768 (Stub_table::add_arm_v4bx_stub): New method.
5769 (Stub_table::find_arm_v4bx_stub): New method.
5770 (Arm_relocate_functions::v4bx): New method.
5771 (Target_arm::fix_v4bx): New method.
5772 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5773 (Stub_table::relocate_stubs): Likewise.
5774 (Stub_table::do_write): Likewise.
5775 (Stub_table::update_data_size_and_addralign): Likewise.
5776 (Stub_table::finalize_stubs): Likewise.
5777 (Target_arm::Scan::local): Likewise.
5778 (Target_arm::Scan::global): Likewise.
5779 (Target_arm::do_finalize_sections): Likewise.
5780 (Target_arm::Relocate::relocate): Likewise.
5781 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5783 (Target_arm::scan_reloc_for_stub): Likewise.
5784 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5786 2010-01-19 Ian Lance Taylor <iant@google.com>
5788 * output.cc (Output_section_headers::do_sized_write): Write large
5789 segment count to sh_info field.
5790 (Output_file_header::do_sized_write): For large segment count,
5791 write PN_XNUM to e_phnum field.
5793 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5795 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5796 (Arm_relocate_functions::thm_jump8): New function.
5797 (Arm_relocate_functions::thm_jump11): New function.
5798 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5800 (Target_arm::Scan::global): Likewise.
5801 (Target_arm::Relocate::relocate): Likewise.
5802 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5805 2010-01-14 Doug Kwan <dougkwan@google.com>
5807 * arm.cc (map, utility): Include headers.
5808 (Target_arm::apply_cortex_a8_workaround): New method.
5809 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5810 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5811 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5812 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5813 the --[no-]fix-cortex-a8 command line options.
5814 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5815 (Target_arm::relocate_stub): Use addend in instruction template.
5816 * options.h (DEFINE_bool): Set the user-set flag.
5817 (General_options): Add --[no-]-fix-cortex options.
5818 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5819 : Update fast look-up map after conversion.
5821 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5823 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5824 in the first pass of do_layout.
5826 2010-01-13 Doug Kwan <dougkwan@google.com>
5828 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5829 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5830 apparent compiler problem of not folding static constant integral
5831 data members of elfcpp::Elf_sizes<32>.
5833 2010-01-13 Doug Kwan <dougkwan@google.com>
5835 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5836 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5837 Arm_relobj::scan_section_for_cortex_a8_erratum,
5838 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5839 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5840 sections to scan for relocation stubs into a new method
5841 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5842 relocation and Cortex-A8 stub scanning.
5843 (Target_arm::do_relax): Force stubs to be after stubbed sections
5844 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5845 the beginning of a new relaxation pass. Update a comment.
5846 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5848 2010-01-12 Ian Lance Taylor <iant@google.com>
5850 * target-reloc.h (visibility_error): New inline function.
5851 (relocate_section): Call visibility_error.
5852 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5853 (MOSTLYCLEANFILES): Likewise.
5854 (protected_4_pic.o, protected_3.err): New targets.
5855 * testsuite/protected_4.cc: New file.
5857 2010-01-12 Doug Kwan <dougkwan@google.com>
5859 * arm.cc (Cortex_a8_reloc): New class.
5860 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5861 and cortex_a8_relocs_info_.
5862 (Target_arm::fix_cortex_a8): New method definition.
5863 (Target_arm::Cortex_a8_relocs_info): New type.
5864 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5865 New data member declarations.
5866 (Target_arm::scan_reloc_for_stub): Record information about
5867 relocations for THUMB branches that might be exempted from the
5868 Cortex-A8 workaround.
5869 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5870 at the beginning of a relaxation pass.
5872 2010-01-12 Doug Kwan <dougkwan@google.com>
5874 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5875 (Arm_relobj::Mapping_symbol_position,
5876 Arm_reloj::Mapping_symbol_position_less,
5877 Arm_relobj::Mapping_symbols_info): New types.
5878 (Target_arm::is_mapping_symbol_name): New method definition.
5879 (Arm_relobj::do_count_local_symbols): Save information about mapping
5882 2010-01-11 Doug Kwan <dougkwan@google.com>
5884 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5885 Arm_relocate_functions::thumb32_branch_upper,
5886 Arm_relocate_functions::thumb32_branch_lower,
5887 Arm_relocate_functions::thumb32_cond_branch_offset,
5888 Arm_relocate_functions::thumb32_cond_branch_upper,
5889 Arm_relocate_functions::thumb32_cond_branch_lower,
5890 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5891 branch offset encoding.
5892 (Arm_relocate_functions::thumb_branch_common): Use new branch
5893 offset encoding methods to avoid code duplication.
5894 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5895 (Stub_addend_reader::operator()): Use new branch encoding method
5896 to avoid code duplication.
5898 2010-01-11 Doug Kwan <dougkwan@google.com>
5900 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5901 (Target_arm::do_finalize_sections): Define special EXIDX section
5902 symbols only if referenced.
5903 * gc.h (Garbage_collection::add_reference): New method.
5904 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5907 2010-01-11 Ian Lance Taylor <iant@google.com>
5909 * script.cc (Version_script_info::build_expression_list_lookup):
5910 Change complaing about duplicate wildcard match from error to
5913 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5915 (Version_script_info::Version_script_info): Initialize globs_,
5916 default_version_, default_is_global_, and exact_. Don't
5917 initialize globals_ or locals_.
5918 (Version_script_info::build_lookup_tables): Build local symbols
5920 (Version_script_info::unquote): New function.
5921 (Version_script_info::add_exact_match): New function.
5922 (Version_script_info::build_expression_list_lookup): Remove lookup
5923 parameter. Add is_global parameter. Change all callers. Handle
5924 wildcard pattern specially. Unquote pattern. Call
5926 (Version_script_info::get_name_to_match): New function.
5927 (Version_script_info::get_symbol_version): New function.
5928 (Version_script_info::get_symbol_version_helper): Remove.
5929 (Version_script_info::check_unmatched_names): Call unquote.
5930 * script.h (class Version_script_info): Change get_symbol_version
5931 to be non-inline and add is_global parameter; change all callers.
5932 Rewrite symbol_is_local. Update declarations. Define struct
5933 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5934 Remove globals_ and locals_ members. Add exact_, globs_,
5935 default_version_, is_global_.
5936 (Version_script_info::Glob): Remove pattern, add expression and
5937 is_global. Update constructor. Change all callers.
5938 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5940 (Versions::symbol_section_contents): If a symbol is undefined, or
5941 defined in a dynamic object, set the version index to
5943 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5945 (Symbol_table::add_from_pluginobj): Likewise.
5946 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5948 2010-01-11 Doug Kwan <dougkwan@google.com>
5950 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5951 (incremental_dump_LDADD): Add linking option for libintl.
5952 * Makefile.in: Regenerate.
5954 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5957 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5959 * testsuite/Makefile.in: Regenerated.
5961 2010-01-10 Doug Kwan <dougkwan@google.com>
5963 * options.h (DEFINE_var): Use parentheses around argument varname__
5964 in macro body to avoid any unintended subsequent substitutions.
5966 2010-01-10 Ian Lance Taylor <iant@google.com>
5968 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5969 candidates before doing symbol resolution.
5971 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5972 ODR candidates if only one is weak.
5974 2010-01-08 Ian Lance Taylor <iant@google.com>
5976 * script.cc (Version_script_info::build_expression_list_lookup):
5977 Don't warn about ambiguous version, just record the ambiguity.
5978 (Version_script_info::get_symbol_version_helper): Give error if
5979 version is ambiguous.
5981 2010-01-08 Doug Kwan <dougkwan@google.com>
5983 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5984 prev_data_size_ and prev_addralign_. Remove initializer for
5985 deleted data member has_been_changed_.
5986 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5987 to determine if the table is empty.
5988 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5990 (Stub_table::add_reloc_stub): Define method in class definition
5991 instead of just declaring it there.
5992 (Stub_table::add_cortex_a8_stub): New method definition.
5993 (Stub_table::update_data_size_and_addralign): Ditto.
5994 (Stub_table::finalize_stubs): Ditto.
5995 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5996 (Stub_table::do_addralign_): Return address alignment in the
5997 (Stub_table::do_reset_address_and_file_offset): Define method in
5998 class definition instead of declaring it there. Set current data
5999 size to be the data size of the previous pass.
6000 (Stub_table::set_final_data_size): Use current data size as the
6002 (Stub_table::relocate_stub): Change parameter type of stub from
6003 Reloc_stub pointer to Stub pointer.
6004 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6005 (Stub_table::Cortex_a8_stub_list): New typedef.
6006 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6007 Stub_table::prev_addralign_): New data member.
6008 (Arm_relobj::Arm_relobj): Initialize data member
6009 section_has_cortex_a8_workaround_.
6010 (Arm_relobj::section_has_cortex_a8_workaround,
6011 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6013 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6015 (Target_arm::relocate_stub): Change parameter type of stub from
6016 Reloc_stub pointer to Stub pointer.
6017 (Insn_template::size, Insn_template::alignment): Handle
6018 THUMB16_SPECIAL_TYPE.
6019 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6020 Stub_table::update_data_size_and_addralign,
6021 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6023 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6024 (Stub_table::do_write): Ditto.
6025 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6027 2010-01-08 Ian Lance Taylor <iant@google.com>
6030 * symtab.h (class Symbol): Remove fields is_target_special_ and
6031 has_plt_offset_. Add field is_defined_in_discarded_section_.
6032 (Symbol::is_defined_in_discarded_section): New function.
6033 (Symbol::set_is_defined_in_discarded_section): New function.
6034 (Symbol::has_plt_offset): Rewrite.
6035 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6036 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6037 Don't initialize is_target_special_ or has_plt_offset_.
6038 Initialize is_defined_in_discarded_section_.
6039 (Symbol_table::add_from_relobj): If appropriate, set
6040 is_defined_in_discarded_section.
6041 * resolve.cc (Symbol::override_base_with_special): Don't test
6042 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6043 * target-reloc.h (relocate_section): Do special handling for
6044 symbols defined in discarded sections for global symbols as well
6047 2010-01-08 Ian Lance Taylor <iant@google.com>
6049 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6050 the SHT_SYMTAB case.
6052 2010-01-08 Ian Lance Taylor <iant@google.com>
6054 * object.cc (Sized_relobj::do_layout): Don't get confused if
6055 layout_eh_frame returns NULL.
6057 2010-01-08 Ian Lance Taylor <iant@google.com>
6060 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6061 dynamic symbol table, use the normal symbol table.
6062 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6065 2010-01-08 Ian Lance Taylor <iant@google.com>
6068 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6071 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6073 * version.cc (print_version): Change to "Copyright 2010".
6075 2010-01-08 Ian Lance Taylor <iant@google.com>
6079 * i386.cc (class Target_i386): Change return type of plt_section
6081 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6082 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6083 tls_desc_rel_ field.
6084 (Output_data_plt_i386::rel_tls_desc): New function.
6085 (Target_i386::rel_tls_desc_section): New function.
6086 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6087 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6088 R_386_TLS_DESC reloc in rel_tls_desc_section.
6089 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6090 Define struct Tlsdesc_info.
6091 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6092 (Target_x86_64::do_reloc_symbol_index): New function.
6093 (Target_x86_64::add_tlsdesc_info): New function.
6094 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6095 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6097 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6099 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6100 (Target_x86_64::rela_tlsdesc_section): New function.
6101 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6103 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6104 (Target_x86_64::do_reloc_addend): New function.
6105 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6106 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6107 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6108 (Output_reloc::type): New function.
6109 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6110 (Output_reloc::is_target_specific): New function.
6111 (Output_reloc::target_arg): New function.
6112 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6113 absolute relocs and target specific relocs.
6114 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6115 add_target_specific.
6116 (class Output_data_reloc) [SHT_RELA]: Likewise.
6117 * output.cc (Output_reloc::Output_reloc): Add four new versions
6118 for absolute relocs and target specific relocs.
6119 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6120 (Output_reloc::get_symbol_index): Likewise.
6121 (Output_reloc::local_section_offset): Check that local_sym_index_
6122 is not TARGET_CODE or 0.
6123 (Output_reloc::symbol_value): Likewise.
6124 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6126 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6127 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6129 * layout.cc (add_target_dynamic_tags): Use output section for
6130 DT_PLTRELSZ and DT_JMPREL.
6132 2010-01-07 Ian Lance Taylor <iant@google.com>
6135 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6137 (class Output_data_reloc_generic): Define.
6138 (class Output_data_reloc_base): Change base class to
6139 Output_data_reloc_generic. Change add() method to call
6140 bump_relative_reloc_count for a relative reloc. Remove
6142 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6144 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6145 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6147 * layout.h (class Layout): Update declaration.
6149 2010-01-07 Ian Lance Taylor <iant@google.com>
6151 * output.h (class Output_data): Add const version of
6152 output_section and do_output_section.
6153 (class Output_section_data): Add const version of
6155 (class Output_section): Likewise.
6156 * layout.cc (Layout::add_target_dynamic_tags): New function.
6157 * layout.h (class Layout): Update declarations.
6158 * arm.cc (Target_arm::do_finalize_sections): Use
6159 add_target_dynamic_tags.
6160 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6161 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6162 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6163 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6165 2010-01-07 Ian Lance Taylor <iant@google.com>
6168 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6171 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6172 Ian Lance Taylor <iant@google.com>
6175 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6176 Xindex::read_symtab_xindex.
6178 2010-01-07 Doug Kwan <dougkwan@google.com>
6180 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6181 (Insn_template::thumb16_bcond_insn): New method declaration.
6182 (Insn_template): Fix spelling.
6183 (Stub::thumb16_special): New method declaration.
6184 (Stub::do_write): Define virtual method which was previously pure
6186 (Stub::do_thumb16_special): New method declaration.
6187 (Stub::do_fixed_endian_write): New template member.
6188 (Reloc_stub::do_write): Remove.
6189 (Reloc_stub::do_fixed_endian_write): Remove.
6190 (Cortex_a8_stub): New class definition.
6191 (Stub_factory::make_cortex_a8_stub): New method definition.
6192 (Stub_factory::Stub_factory): Add missing static storage class
6193 qualifier for elf32_arm_stub_a8_veneer_blx.
6195 2010-01-07 Ian Lance Taylor <iant@google.com>
6198 * options.h (class General_options): Add --warn-unresolved-symbols
6199 and --error-unresolved-symbols.
6200 * errors.cc (Errors::undefined_symbol): Implement
6201 --warn-unresolved-symbols.
6203 * options.h (class General_options): Add -z text and -z textoff.
6204 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6206 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6208 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6209 (Garbage_collection::cident_sections): New function.
6210 (Garbage_collection::add_cident_section): New function.
6211 (Garbage_collection::cident_sections_): New member.
6212 (gc_process_relocs): Add references to sections whose names are C
6214 * gold.h (cident_section_start_prefix): New constant.
6215 (cident_section_stop_prefix): New constant.
6216 (is_cident): New function.
6217 * layout.cc (Layout::define_section_symbols): Replace string constants
6218 with the newly defined constants.
6219 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6221 * testsuite/Makefile.am: Add gc_orphan_section_test.
6222 * testsuite/Makefile.in: Regenerate.
6223 * testsuite/gc_orphan_section_test.cc: New file.
6224 * testsuite/gc_orphan_section_test.sh: New file.
6226 2010-01-06 Ian Lance Taylor <iant@google.com>
6229 * options.h (class General_options): Add --warn-shared-textrel.
6230 * layout.cc (Layout::finish_dynamic_section): Implement
6231 --warn-shared-textrel.
6234 * options.h (class General_options): Add --warn-multiple-gp.
6236 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6238 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6239 $(THREADSLIB) and $(LIBDL).
6240 * Makefile.in: Rebuild.
6242 2010-01-06 Ian Lance Taylor <iant@google.com>
6245 * options.cc (General_options::parse_section_start): New function.
6246 (General_options::section_start): New function.
6247 (General_options::General_options): Initialize all members.
6248 * options.h: Include <map>
6249 (class General_options): Add --section-start. Add section_starts_
6251 * layout.cc (Layout::attach_allocated_section_to_segment): If
6252 --section-start was used, set the address of the segment. Remove
6253 local sort_sections.
6254 (Layout::relaxation_loop_body): If the address of the load segment
6255 has been set by --section-start, don't use it.
6256 * output.h (Output_segment::update_flags_for_output_section): New
6258 * output.cc (Output_segment::add_output_section): Call
6259 update_flags_for_output_section.
6261 2010-01-05 Ian Lance Taylor <iant@google.com>
6264 * options.h (class General_options): Add --undefined-version.
6265 * script.cc (struct Version_expression): Add was_matched_by_symbol
6267 (Version_script_info::matched_symbol): New function.
6268 (Version_script_info::get_symbol_version_helper): Call
6270 (Version_script_info::check_unmatched_names): New function.
6271 * script.h (class Version_script_info): Update declarations.
6272 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6274 * options.h (class General_options): Use DEFINE_bool_alias for
6275 allow_multiple_definition.
6276 * resolve.cc (Symbol_table::should_override): Don't test
6277 allow_multiple_definition.
6280 * options.h (class General_options): Add --cref.
6281 * main.cc (main): Print cref table if --cref. Don't close mapfile
6282 until after printing cref table.
6283 * cref.cc: Include "symtab.h".
6284 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6285 (Cref_table_compare::operator()): New function.
6286 (Cref_inputs::gather_cref): New function.
6287 (filecol): New static const.
6288 (Cref_inputs::print_cref): New function.
6289 (Cref::print_cref): New function.
6290 * cref.h: Include <cstdio>.
6291 (class Cref): Update declarations.
6292 * mapfile.h (Mapfile::file): New function.
6293 * object.h (class Object): Define Symbols. Declare virtual
6294 do_get_global_symbols.
6295 (Object::get_global_symbols): New function.
6296 * object.cc (Input_objects::add_object): Pass object to cref_ if
6298 (Input_objects::archive_start): Likewise.
6299 (Input_objects::archive_stop): Likewise.
6300 (Input_objects::print_cref): New function.
6301 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6302 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6304 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6306 * plugin.h (class Sized_pluginobj): Update declarations.
6308 2010-01-05 Ian Lance Taylor <iant@google.com>
6310 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6311 to is_default_version. Rename insdef to insdefault.
6312 (Symbol_table::add_from_relobj): Rename def to is_default_version
6313 and local to is_forced_local.
6314 (Symbol_table::add_from_pluginobj): Likewise.
6315 (Symbol_table::add_from_dynobj): Likewise.
6316 (Symbol_table::define_special_symbol): Rename insdef to
6319 2010-01-04 Ian Lance Taylor <iant@google.com>
6322 * options.h (class General_options): Add
6323 --allow-multiple-definition and -z muldefs.
6324 * resolve.cc (Symbol_table::should_override): Don't warn about a
6325 multiple symbol definition if --allow-multiple-definition or -z
6329 * options.h (class General_options): Add --add-needed and
6330 --copy-dt-needed-entries. Tweak --as-needed help entry.
6331 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6332 error if --copy-dt-needed-entries aka --add-needed is used and
6333 would cause a change in behaviour.
6336 * options.h (class General_options): Add -G as a short version of
6337 --shared. Add no-op options -assert, -g, and -i.
6339 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6341 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6342 check for .text or .gnu.linkonce.t sections.
6343 * icf.cc (Icf::find_identical_sections): Ditto.
6344 Change the detection for mangled function name within the section
6346 * icf.h (is_section_foldable_candidate): New function.
6348 2009-12-30 Ian Lance Taylor <iant@google.com>
6351 * options.h (class General_options): Permit two dashes with
6352 --retain-symbols-file.
6354 2009-12-30 Ian Lance Taylor <iant@google.com>
6357 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6358 don't put the file header and segment headers in the text
6362 * common.cc (Sort_commons::operator()): Stabilize sort when both
6364 (Symbol_table::do_allocate_commons_list): When allocating common
6365 symbols, skip a symbol which is no longer common.
6366 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6367 an object before checking its type.
6368 * testsuite/common_test_2.c: New file.
6369 * testsuite/common_test_3.c: New file.
6370 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6371 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6372 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6373 (common_test_2_pic.o, common_test_2.so): New targets.
6374 (common_test_3_pic.o, common_test_3.so): New targets.
6375 * testsuite/Makefile.in: Rebuild.
6378 * script.cc (read_input_script): If we see a new SECTIONS clause,
6379 and we have added an input section, give an error.
6380 * layout.h (class Layout): Add have_added_input_section function.
6381 Add have_added_input_section_ field.
6382 * layout.cc (Layout::Layout): Initialize
6383 have_added_input_section_.
6384 (Layout::layout): Set have_added_input_section_.
6385 (Layout::layout_eh_frame): Likewise.
6387 2009-12-30 Ian Lance Taylor <iant@google.com>
6390 * options.h (class General_options): Add --sort-common option.
6391 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6392 * common.cc (Sort_common): Add sort_order parameter to
6393 constructor. Add sort_order_ field.
6394 (Sort_commons::operator): Check sort_order_.
6395 (Symbol_table::allocate_commons): Determine the sort order.
6396 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6398 (Symbol_table::do_allocate_commons_list): Likewise.
6400 2009-12-30 Ian Lance Taylor <iant@google.com>
6403 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6404 symbols from this object, don't change the visibility of an
6406 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6408 2009-12-30 Ian Lance Taylor <iant@google.com>
6411 * script.h (class Version_script_info): Define Language enum.
6412 Update declarations. Define Glob, Exact, and Lookup types. Add
6413 new fields globals_, locals_, and is_finalized_.
6414 * script.cc: Various formatting fixes.
6415 (class Parser_closure): Change language_stack_ from a vector of
6416 std::string to one of Version_script_info::Language. Adjust all
6418 (class Lazy_demangler): Remove.
6419 (struct Version_expression): Change language from std::string to
6420 Version_script_info::Language.
6421 (Version_script_info::Version_script_info): New function.
6422 (Version_script_info::~Version_script_info): Don't call clear.
6423 (Version_script_info::finalize): New function.
6424 (Version_script_info::build_lookup_tables): New function.
6425 (Version_script_info::build_expression_list_lookup): New
6427 (Version_script_info::get_symbol_version_helper): Rewrite to use
6429 (Version_script_info::print_expression_list): Adjust to use
6430 Version_script_info::Language.
6431 (script_push_lex_into_version_mode): Check that the version script
6432 has not been finalized.
6433 (version_script_push_lang): Change language string to
6434 Version_script_info::Language.
6435 * options.cc (Command_line::version_script): New function.
6436 * options.h (class General_options): Add finalize_dynamic_list
6437 function. Change version_script from declaration to definition.
6438 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6439 * testsuite/version_script.map: Remove duplicate def of foo.
6440 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6442 * testsuite/Makefile.in: Rebuild.
6444 2009-12-30 Ian Lance Taylor <iant@google.com>
6447 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6448 if the input symbol index is 0, make the output symbol index 0.
6450 2009-12-30 Ian Lance Taylor <iant@google.com>
6453 * options.h (class General_options): Add -x/--discard-all.
6454 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6455 --discard-all. If the local symbol needs a dynamic entry, check
6456 that before handling --discard-locals.
6458 2009-12-30 Ian Lance Taylor <iant@google.com>
6461 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6463 (Output_segment::add_output_section): Don't change the flags if
6467 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6468 GNU hash table if they need a dynamic value. Otherwise, don't add
6469 them if they are defined in a dynamic object or are forced local.
6471 2009-12-29 Ian Lance Taylor <iant@google.com>
6474 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6475 .gnu.hash table for a 32-bit target.
6478 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6479 regular and a dynamic object only needs a dynamic symbol table
6480 entry if it is externally visible.
6483 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6484 constructor. Add global_offset_table_ field.
6485 (Target_i386::got_section): Set global_offset_table_.
6486 (Target_i386::do_finalize_sections): Set global_offset_table_
6488 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6489 in constructor. Add global_offset_table_ field.
6490 (Target_x86_64::got_section): Set global_offset_table_.
6491 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6494 * layout.cc (Layout::Layout): Initialize increase_relro_.
6495 (Layout::get_output_section): Add is_relro, is_last_relro, and
6496 is_first_non_relro parameters. Change all callers.
6497 (Layout::choose_output_section): Likewise.
6498 (Layout::add_output_section_data): Likewise.
6499 (Layout::make_output_section): Likewise.
6500 (Layout::set_segment_offsets): Clear increase_relro when using a
6502 * layout.h (class Layout): Add increase_relro method. Add
6503 increase_relro_ field. Update declarations.
6504 * output.cc (Output_section::Output_section): Initialize
6505 is_last_relro_ and is_first_non_relro_.
6506 (Output_segment::add_output_section): Group relro sections is
6507 do_sort is true. Handle is_last_relro and is_first_non_relro.
6508 (Output_segment::maximum_alignment): Remove relro handling.
6509 (Output_segment::set_section_addresses): Add increase_relro
6510 parameter. Change all callers. Add initial alignment to align
6511 relro sections on separate page. Remove old relro handling.
6512 (Output_segment::set_section_list_addresses): Remove in_relro
6513 parameter. Change all callers.
6514 (Output_segment::set_offset): Add increase parameter. Change all
6515 callers. Remove old relro handling.
6516 * output.h (class Output_section): Add new methods: is_last_relro,
6517 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6518 Add is_last_relro_ and is_first_non_relro_ fields.
6519 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6520 Create separate .got.plt section. Call increase_relro.
6521 * x86_64.cc (Target_x86_64::got_section): Likewise.
6522 * testsuite/relro_script_test.t: Add .got.plt.
6525 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6526 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6527 (Layout::finalize): Call set_dynamic_symbol_size.
6528 (Layout::set_dynamic_symbol_size): New function.
6529 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6530 set_dynamic_symbol_size.
6533 * output.h (class Output_section): Add is_entsize_zero_ field.
6534 * output.cc (Output_section::Output_section): Initialize
6536 (Output_section::set_entsize): If two different entsizes are
6537 requested, force it to zero.
6538 (Output_section::add_input_section): Set flags for .debug_str
6539 before updating section flags. Set entsize.
6540 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6541 and SHF_STRING if all input sections have those flags.
6543 2009-12-29 Rafael Espindola <espindola@google.com>
6545 * main.cc (main): Fix the sys time reporting.
6546 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6549 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6551 * options.cc (General_options::parse_version): Allow -v to exit
6552 without an error if there is nothing to link.
6554 2009-12-29 Ian Lance Taylor <iant@google.com>
6556 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6557 using a version of gcc before 4.1.
6558 * configure: Rebuild.
6560 2009-12-28 Chris Demetriou <cgd@google.com>
6562 * attributes.cc (Output_attributes_section_data::do_write): Use
6563 std::vector::front rather than std::vector::data.
6565 2009-12-28 Ian Lance Taylor <iant@google.com>
6567 * symtab.h (class Symbol_table): Add enum Defined.
6568 * resolve.cc (Symbol_table::should_override): Add defined
6569 parameter. Change all callers. Test whether object is NULL
6570 before calling a method on it.
6571 (Symbol_table::report_resolve_problem): Add defined parameter.
6573 (Symbol_table::should_override_with_special): Likewise.
6574 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6575 parameter. Change all callers.
6576 (Symbol_table::do_define_in_output_data): Likewise.
6577 (Symbol_table::define_in_output_segment): Likewise.
6578 (Symbol_table::do_define_in_output_segment): Likewise.
6579 (Symbol_table::define_as_constant): Likewise.
6580 (Symbol_table::do_define_as_constant): Likewise.
6581 * script.h (class Symbol_assignment): Add is_defsym parameter to
6582 constructor; change all callers.
6583 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6584 parameter. Change all callers. Add is_defsym_ field.
6585 (class Parser_closure): Add parsing_defsym parameter to
6586 constructor; change all callers. Add parsing_defsym accessor
6587 function. Add parsing_defsym_ field.
6589 2009-12-28 Ian Lance Taylor <iant@google.com>
6591 * gold.cc (queue_middle_tasks): Fix formatting.
6592 * object.cc (Relobj::is_section_name_included): Likewise.
6594 2009-12-23 Ian Lance Taylor <iant@google.com>
6596 * i386.cc (Target_i386::do_calls_non_split): Recognize
6597 -fsplit-stack prologue for a function with a static chain.
6598 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6599 -fsplit-stack prologue when using %r11.
6601 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6603 * options.cc (General_options::parse_version): Make -v continue and do
6604 the link like GNU ld does.
6606 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6608 * Makefile.am (CCFILES): Add timer.cc.
6609 (HFILES): Add timer.h.
6610 * configure.ac: Check for sysconf and times.
6611 * main.cc: include timer.h.
6612 (main): Use Timer instead of get_run_time.
6615 * workqueue.cc: include timer.h.
6616 (Workqueue::find_and_run_task):
6617 Report user, sys and wall time.
6618 * Makefile.in: Regenerate.
6619 * config.in: Regenerate.
6620 * configure: Regenerate.
6622 2009-12-16 Doug Kwan <dougkwan@google.com>
6624 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6626 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6627 relaxed input sections.
6628 * output.cc (Output_section::find_relaxed_input_section): Change
6629 return type to Output_relaxed_input_section pointer. Adjust code
6630 for new type of relaxed_input_section_map_.
6631 * output.h (Output_section::find_relaxed_input_section): Change
6632 return type to Output_relaxed_input_section pointer.
6633 (Output_section::Output_relaxed_input_section_by_input_section_map):
6635 (Output_section::relaxed_input_section_map_): Change type to
6636 Output_section::Output_relaxed_input_section_by_input_section_map.
6637 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6640 2009-12-15 Ian Lance Taylor <iant@google.com>
6642 * layout.cc (Layout::create_shstrtab): Only write out after input
6643 sections if we are compressing debug sections.
6645 2009-12-15 Ian Lance Taylor <iant@google.com>
6647 * archive.cc (Archive::add_symbols): Only look up a symbol without
6648 a version if there is, in fact, a version.
6650 2009-12-14 Ian Lance Taylor <iant@google.com>
6652 Revert -Wshadow changes, all changes from:
6653 2009-12-11 Doug Kwan <dougkwan@google.com>
6654 2009-12-11 Nick Clifton <nickc@redhat.com>
6655 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6657 2009-12-11 Doug Kwan <dougkwan@google.com>
6659 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6661 * attributes.cc (Object_attribute::size): Ditto.
6662 (Attributes_section_data::size): Ditto.
6663 (Attributes_section_data::Attributes_section_data): Ditto.
6664 (Output_attributes_section_data::do_write): Ditto.
6665 * attributes.h (Object_attribute::set_type): Ditto.
6666 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6668 2009-12-11 Nick Clifton <nickc@redhat.com>
6670 * archive.cc: Fix shadowed variable warnings.
6672 * compressed_output.cc: Likewise.
6673 * compressed_output.h: Likewise.
6674 * configure: Likewise.
6675 * dwarf_reader.cc: Likewise.
6676 * dynobj.cc: Likewise.
6677 * dynobj.h: Likewise.
6678 * ehframe.cc: Likewise.
6679 * ehframe.h: Likewise.
6680 * errors.cc: Likewise.
6681 * expression.cc: Likewise.
6682 * fileread.cc: Likewise.
6683 * fileread.h: Likewise.
6684 * freebsd.h: Likewise.
6685 * i386.cc: Likewise.
6687 * incremental.h: Likewise.
6688 * layout.cc: Likewise.
6689 * layout.h: Likewise.
6690 * mapfile.cc: Likewise.
6691 * merge.cc: Likewise.
6692 * merge.h: Likewise.
6693 * object.cc: Likewise.
6694 * object.h: Likewise.
6695 * options.h: Likewise.
6696 * output.cc: Likewise.
6697 * output.h: Likewise.
6698 * parameters.cc: Likewise.
6699 * plugin.cc: Likewise.
6700 * powerpc.cc: Likewise.
6701 * reduced_debug_output.cc: Likewise.
6702 * reduced_debug_output.h: Likewise.
6703 * reloc.cc: Likewise.
6704 * reloc.h: Likewise.
6705 * resolve.cc: Likewise.
6706 * script-sections.cc: Likewise.
6707 * script.cc: Likewise.
6708 * script.h: Likewise.
6709 * sparc.cc: Likewise.
6710 * symtab.cc: Likewise.
6711 * symtab.h: Likewise.
6712 * target-select.cc: Likewise.
6713 * target-select.h: Likewise.
6714 * token.h: Likewise.
6715 * workqueue.cc: Likewise.
6716 * workqueue.h: Likewise.
6717 * x86_64.cc: Likewise.
6719 2009-12-10 Doug Kwan <dougkwan@google.com>
6721 * arm.cc (attributes.h): New include.
6722 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6723 (Arm_relobj::~Arm_relobj): Delete object pointed by
6724 attributes_section_data_.
6725 (Arm_relobj::attributes_section_data): New method definition.
6726 (Arm_relobj::attributes_section_data_): New data member declaration.
6727 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6728 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6729 attributes_section_data_.
6730 (Arm_dynobj::attributes_section_data): New method definition.
6731 (Arm_dynobj::attributes_section_data_): New data member declaration.
6732 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6733 initialization value of may_use_blx_ to false.
6734 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6735 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6736 object attributes to compute results instead of hard-coding.
6737 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6738 Target_arm::get_secondary_compatible_arch,
6739 Target_arm::set_secondary_compatible_arch
6740 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6741 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6742 New method declarations.
6743 (Target_arm::get_aeabi_object_attribute): New method definition.
6744 (Target_arm::attributes_section_data_): New data member declaration.
6745 (read_arm_attributes_section): New template definition.
6746 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6747 (Arm_dynobj::do_read_symbols): Ditto.
6748 (Target_arm::do_finalize_sections): Merge attributes sections from
6749 input. Check for BLX use after attributes section merging.
6750 Fix __exidx_start and __exidx_end visibility. Create an
6751 .ARM.attributes section if necessary.
6752 (Target_arm::get_secondary_compatible_arch,
6753 Target_arm::set_secondary_compatible_arch,
6754 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6755 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6756 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6757 New method definitions.
6759 2009-12-09 Ian Lance Taylor <iant@google.com>
6761 * plugin.cc (Plugin::load): Don't cast from void* to a function
6764 2009-12-09 Ian Lance Taylor <iant@google.com>
6766 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6769 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6771 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6772 Replace two_file_shared_1.so with two_file_shared_2.so.
6773 * testsuite/Makefile.in: Regenerated.
6775 2009-12-08 Doug Kwan <dougkwan@google.com>
6777 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6778 (HFILES): Add attributes.h and int_encoding.h.
6779 * Makefile.in: Regenerate.
6780 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6781 function definitions to int_encoding.cc
6782 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6783 prototypes to int_encoding.h
6784 * reduced_debug_output.cc (int_encoding.h): New include.
6785 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6786 function definitions to int_encoding.cc
6787 (insert_into_vector, read_from_pointer): Move template definitions to
6789 * attributes.cc: New file.
6790 * attributes.h: New file.
6791 * int_encoding.cc: New file.
6792 * int_encoding.h: New file.
6794 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6797 * incremental-dump.cc (dump_incremental_inputs): New.
6798 (main): Use dump_incremental_inputs.
6800 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6803 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6804 checking elfcpp::STT_FUNC.
6805 (Target_i386::Relocate::relocate): Likewise.
6806 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6808 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6809 symbols from shared libraries into normal FUNC symbols.
6811 * symtab.h (Symbol): Add is_func and use it.
6813 2009-12-05 Doug Kwan <dougkwan@google.com>
6815 * arm.cc (Target_arm::arm_info): Initialize new fields
6816 attributes_section and attributes_vendor.
6817 * i386.cc (Target_i386::i386_info): Same.
6818 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6819 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6820 fields attributes_section and attributes_vendor.
6821 * sparc.cc (Target_sparc::sparc_info): Same.
6822 * target.h (Target::attributes_section, Target::attributes_vendor,
6823 Target::is_attributes_section, Target::attribute_arg_type,
6824 Target::attributes_order): New method definitions.
6825 (Target::Target_info::attributes_section,
6826 Target::Target_info::attributes_vendor): New fields.
6827 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6828 virtual method definitions.
6829 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6830 attributes_section and attributes_vendor.
6831 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6833 2009-12-05 Doug Kwan <dougkwan@google.com>
6835 * arm.cc: Update comments about interworking and stub generation.
6836 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6837 considered as non-PIC.
6838 (Arm_relocate_functions::base_abs): Fix formatting.
6839 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6840 of function to use GOT entry address instead of offset.
6841 (Target_arm::Scan::global): Issue an error if a symbol would need a
6842 PLT does not get one because it is untyped. Remove code to create
6843 dynamic symbols for relative branches.
6844 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6845 takes unsigned integer instead of boolean.
6847 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6849 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6850 (two_file_test_LDADD): Likewise.
6851 (common_test_1_LDADD): Likewise.
6852 (exception_test_LDADD) Likewise.
6853 (weak_test_LDADD): Likewise.
6854 (many_sections_test_LDADD): Likewise.
6855 (initpri1_LDADD): Likewise.
6856 (script_test_1_LDADD): Likewise.
6857 (script_test_2_LDADD): Likewise.
6858 (justsyms_LDADD): Likewise.
6859 (binary_test_LDADD): Likewise.
6860 (large_LDADD): Likewise.
6861 * testsuite/Makefile.in: Regenerated.
6863 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6865 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6866 (Symbol_table::override_with_special): Likewise.
6867 (Symbol_table::add_from_object): Likewise.
6869 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6871 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6872 Don't set the data_offset twice.
6874 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6876 * testsuite/Makefile.in: Regenerate.
6878 2009-12-03 Doug Kwan <dougkwan@google.com>
6880 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6881 (Target_arm::do_finalize_sections): Add parameter for symbol table
6882 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6883 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6884 parameter for symbol table pointer.
6885 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6886 an additional parameter for a pointer to symbol table.
6887 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6888 parameter for a symbol table pointer.
6889 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6890 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6892 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6893 parameter for a symbol table pointer.
6895 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6897 * incremental.cc (Incremental_inputs_header)
6898 (Incremental_inputs_header_write, Incremental_inputs_entry)
6899 (Incremental_inputs_entry_write): Move ...
6900 * incremental.h (Incremental_inputs_header)
6901 (Incremental_inputs_header_write, Incremental_inputs_entry)
6902 (Incremental_inputs_entry_write): here.
6904 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6906 * incremental.cc (make_sized_incremental_binary): Set the target.
6907 Error if it is incompatible.
6908 * output.h (Output_file): Add filename method.
6910 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6912 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6913 from the get_* methods.
6915 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6917 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6918 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6919 Write 0 for the data_offset of scripts.
6921 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6923 * testsuite/Makefile.am: Add the incremental_test.sh test.
6924 * testsuite/incremental_test.sh: New.
6925 * testsuite/incremental_test_1.c: New.
6926 * testsuite/incremental_test_2.c: New.
6928 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6930 * incremental-dump.cc (main): Fix typos.
6932 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6935 * incremental-dump.cc (main): Use llu to print 64 bit values.
6937 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6938 H.J. Lu <hongjiu.lu@intel.com>
6940 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6942 (incremental_dump_LDADD): Likewise.
6943 * Makefile.in: Regenerated.
6945 2009-11-25 Doug Kwan <dougkwan@google.com>
6949 2009-11-25 Doug Kwan <dougkwan@google.com>
6951 * arm.cc (Target_arm::Target_arm): Move method definition
6952 outside of class definition. Add code to handle
6953 --target1-rel, --target1-abs and --target2= options.
6954 (Target_arm::get_reloc_reloc_type): Change method to be
6955 non-static and const.
6956 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6957 New data member declaration.
6958 (Target_arm::Scan::local, Target_arm::Scan::global,
6959 Target_arm::Relocate::relocate,
6960 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6961 Adjust call to Target_arm::get_real_reloc_type.
6962 (Target_arm::get_real_reloc_type): Use command line options
6963 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6964 * options.h (--target1-rel, --target1-abs, --target2): New
6967 2009-11-25 Doug Kwan <dougkwan@google.com>
6969 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6970 class definition. Add code to handle --target1-rel, --target1-abs
6971 and --target2= options.
6972 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6974 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6976 (Target_arm::Scan::local, Target_arm::Scan::global,
6977 Target_arm::Relocate::relocate,
6978 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6979 call to Target_arm::get_real_reloc_type.
6980 (Target_arm::get_real_reloc_type): Use command line options to
6981 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6982 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6985 2009-11-25 Doug Kwan <dougkwan@google.com>
6987 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6988 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6989 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6991 (Arm_relocate_functions::thm_call): Replace body with a call to
6992 Arm_relocate_functions::thumb_branch_common.
6993 (Arm_relocate_functions::thm_jump24,
6994 Arm_relocate_functions::thm_xpc22): New method definitions.
6995 (Arm_relocate_functions::thumb_branch_common): New method definition.
6996 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6998 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6999 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7001 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7003 * Makefile.am: Build incremental-dump
7004 * Makefile.in: Regenerate.
7005 * incremental-dump.cc: New.
7006 * incremental.cc (Incremental_inputs_header_data,
7007 Incremental_inputs_entry_data): Move to incremental.h
7008 * incremental.h: (Incremental_inputs_header_data,
7009 Incremental_inputs_entry_data): Move from incremental.cc
7011 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7013 * incremental.cc (Incremental_inputs_header,
7014 Incremental_inputs_header_write, Incremental_inputs_entry,
7015 Incremental_inputs_entry_write): Add a typedef with the data type.
7017 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7019 * incremental.cc (Incremental_inputs_header,
7020 Incremental_inputs_header_write, Incremental_inputs_entry,
7021 Incremental_inputs_entry_write): Update comment about which
7022 type has the filed descriptions.
7024 2009-11-15 Doug Kwan <dougkwan@google.com>
7026 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7027 (Arm_relocate_functions::arm_branch_common): Change method defintion
7028 in class definition to a method declaration and update list of formal
7030 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7031 Arm_relocation_functions::jump24): Adjust call to
7032 Arm_relocate_functions::arm_branch_common. Update list of formal
7034 (Arm_relocate_functions::xpc25): New method definition.
7035 (Arm_relocate_functions::arm_branch_common): Move method defintion
7036 out from class definition. Use stubs for mode-switching and extending
7038 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7039 specially. Change code to enable use of stubs in ARM branches.
7041 2009-11-10 Doug Kwan <dougkwan@google.com>
7043 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7044 in method declaration.
7045 (Target_arm::relocate_stub): New method declaration.
7046 (Target_arm::default_target): Change to return a pointer instead of
7048 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7049 Target_arm::default_target.
7050 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7052 (Target_arm::relocate_section): Adjust view.
7053 (Target_arm::relocate_stub): New method definition.
7055 2009-11-10 Doug Kwan <dougkwan@google.com>
7057 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7059 * incremental.cc (open_incremental_binary): Initialized local
7060 variables to avoid warnings.
7061 * object.cc (make_elf_object): Ditto.
7062 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7065 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7068 * testsuite/plugin_test.c: Include "config.h".
7070 2009-11-09 Doug Kwan <dougkwan@google.com>
7072 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7073 (arm_symbol_value): Remove.
7074 (Arm_relocate_functions::arm_branch_common,
7075 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7076 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7077 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7078 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7079 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7080 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7081 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7082 Arm_relocate_functions::thm_mobw_abs_nc,
7083 Arm_relocate_functions::thm_mov_abs,
7084 Arm_relocate_functions::movw_prel_nc,
7085 Arm_relocate_functions::thm_movt_abs,
7086 Arm_relocate_functions::movt_prel,
7087 Arm_relocate_functions::thm_movw_prel_nc,
7088 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7089 (Target_arm::Relocate::relocate): Only decompose address into two
7090 parts if relocation type uses the thumb-bit and pass the actual
7091 bit instead of a flag indicating that the thumb-bit is used. Adjust
7092 calls to methods in Arm_relocate_functions for this change.
7094 2009-11-08 Ian Lance Taylor <iant@google.com>
7097 * reloc.cc: Instantiate
7098 Sized_relobj::initialize_input_to_output_maps and
7099 Sized_relobj:free_input_to_output_maps.
7101 2009-11-06 Ian Lance Taylor <iant@google.com>
7104 * defstd.cc (in_segment): Set only_if_ref true for "end".
7106 2009-11-06 Doug Kwan <dougkwan@google.com>
7108 * arm.cc (class Reloc_stub): Correct a comment.
7109 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7110 (Target_arm::scan_section_for_stubs): New method declaration.
7111 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7112 Change methods from private to protected.
7113 (Target_arm::do_may_relax): New method definition.
7114 (Target_arm::do_relax, Target_arm::group_sections,
7115 Target_arm::scan_reloc_for_stub,
7116 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7117 (Target_arm::arm_input_section_map_): New data member declaration.
7118 (Target_arm::scan_reloc_for_stub,
7119 Target_arm::scan_reloc_section_for_stubs,
7120 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7121 Target_arm::do_relax): New method definitions.
7123 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7125 * configure.ac: Check for (struct stat)::st_mtim
7126 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7127 * config.in: Regenerate.
7128 * configure: Regenerate.
7130 2009-11-05 Ian Lance Taylor <iant@google.com>
7133 * output.cc (Output_segment::add_output_section): Add missing
7136 2009-11-04 Ian Lance Taylor <iant@google.com>
7139 * object.h (class Object): Add is_needed and set_is_needed
7140 methods. Add is_needed_ field. Make bool fields into bitfields.
7141 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7142 defined in a dynamic object and referenced by a regular object,
7143 set is_needed for the dynamic object.
7144 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7145 if the file is marked with as_needed and it is not needed.
7147 2009-11-04 Ian Lance Taylor <iant@google.com>
7150 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7151 tags if data is discarded by linker script.
7152 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7153 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7154 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7155 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7157 2009-11-04 Ian Lance Taylor <iant@google.com>
7159 * layout.cc (Layout::get_output_section): Add is_interp and
7160 is_dynamic_linker_section parameters. Change all callers.
7161 (Layout::choose_output_section): Likewise.
7162 (Layout::make_output_section): Likewise.
7163 (Layout::add_output_section_data): Add is_dynamic_linker_section
7164 parameter. Change all callers.
7165 * layout.h (class Layout): Update declarations.
7166 * output.h (class Output_section): Add is_interp, set_is_interp,
7167 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7168 Add is_interp_, is_dynamic_linker_section_ fields. Change
7169 generate_code_fills_at_write_ to a bitfield.
7170 * output.cc (Output_section::Output_sections): Initialize new
7172 (Output_segment::add_output_section): Add do_sort parameter.
7175 2009-11-03 Ian Lance Taylor <iant@google.com>
7178 * options.h (class General_options): Add --warn-common.
7179 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7180 merging two common symbols.
7181 (Symbol_table::should_override): Handle --warn-common when merging
7182 a common symbol with a defined symbol. Use report_resolve_problem
7183 for multiple definitions.
7184 (Symbol_table::report_resolve_problem): New function.
7185 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7187 2009-11-03 Doug Kwan <dougkwan@google.com>
7189 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7191 (Target_arm::stub_factory): New method definition.
7192 (Target_arm::new_arm_input_section,
7193 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7194 Target_arm::reloc_uses_thumb_bit): New method declarations.
7195 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7196 New type definitions.
7197 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7198 member declarations.
7199 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7200 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7201 New method definitions.
7203 2009-11-03 Ian Lance Taylor <iant@google.com>
7205 * options.h (class General_options): Add --warn_constructors.
7207 2009-11-03 Ian Lance Taylor <iant@google.com>
7210 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7211 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7213 2009-11-03 Ian Lance Taylor <iant@google.com>
7216 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7217 --msgid-bugs-address.
7218 (install-pdf): New target.
7219 (install-data_yes): Look up one directory to find mkinstalldirs.
7221 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7223 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7226 2009-10-30 Doug Kwan <dougkwan@google.com>
7228 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7230 2009-10-30 Doug Kwan <dougkwan@google.com>
7232 * arm.cc (Stub_addend_reader): New struct template definition
7233 and partial specializations.
7234 (Stub_addend_reader::operator()): New method definition for a
7235 partially specialized template.
7237 2009-10-30 Doug Kwan <dougkwan@google.com>
7239 * arm.cc (Arm_relobj::processor_specific_flags): New method
7241 (Arm_relobj::do_read_symbols): New method declaration.
7242 (Arm_relobj::processor_specific_flags_): New data member declaration.
7243 (Arm_dynobj): New class definition.
7244 (Target_arm::do_finalize_sections): Add input_objects parameter.
7245 (Target_arm::do_adjust_elf_header): New method declaration.
7246 (Target_arm::are_eabi_versions_compatible,
7247 (Target_arm::merge_processor_specific_flags): New method declaration.
7248 (Target_arm::do_make_elf_object): New overloaded method definitions
7250 (Arm_relobj::do_read_symbols): New method definition.
7251 (Arm_dynobj::do_read_symbols): Ditto.
7252 (Target_arm::do_finalize_sections): Add input_objects parameters.
7253 Merge processor-specific flags from all input objects.
7254 (Target_arm::are_eabi_versions_compatible,
7255 Target_arm::merge_processor_specific_flags,
7256 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7257 New method definitions.
7258 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7259 Input_objects pointer type parameter.
7260 * layout.cc (Layout::finalize): Pass input objects to target's.
7261 finalize_sections function.
7262 * output.cc (Output_file_header::do_sized_write): Set ELF file
7263 header's processor-specific flags.
7264 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7265 Input_objects pointer type parameter.
7266 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7267 * target.h (Input_objects): New forward class declaration.
7268 (Target::processor_specific_flags,
7269 Target::are_processor_specific_flags_sect): New method definitions.
7270 (Target::finalize_sections): Add input_objects parameter.
7271 (Target::Target): Initialize processor_specific_flags_ and
7272 are_processor_specific_flags_set_.
7273 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7275 (Target::set_processor_specific_flags): New method definition.
7276 (Target::processor_specific_flags_,
7277 Target::are_processor_specific_flags_set_): New data member
7279 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7280 Input_objects pointer type parameter.
7282 2009-10-30 Doug Kwan <dougkwan@google.com>
7284 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7286 2009-10-28 Ian Lance Taylor <iant@google.com>
7288 * object.h (class Relobj): Drop options parameter from
7289 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7290 do_scan_relocs, do_relocate. Change all callers.
7291 (class Sized_relobj): Drop options parameters from
7292 do_gc_process_relocs, do_scan_relocs, do_relocate,
7293 do_relocate_sections, relocate_sections, emit_relocs_scan,
7294 emit_relocs_scan_reltype. Change all callers.
7295 (struct Relocate_info): Remove options field and all references to
7297 * reloc.h (class Read_relocs): Remove options constructor
7298 parameter and options_ field. Change all callers.
7299 (class Gc_process_relocs, class Scan_relocs): Likewise.
7300 (class Relocate_task): Likewise.
7301 * target-reloc.h (scan_relocs): Remove options parameter. Change
7303 (scan_relocatable_relocs): Likewise.
7304 * target.h (class Sized_target): Remove options parameter from
7305 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7307 * gc.h (gc_process_relocs): Remove options parameter. Change all
7309 * arm.cc: Update functions to remove options parameters.
7310 * i386.cc: Likewise.
7311 * powerpc.cc: Likewise.
7312 * sparc.cc: Likewise.
7313 * x86_64.cc: Likewise.
7314 * testsuite/testfile.cc: Likewise.
7316 2009-10-28 Doug Kwan <dougkwan@google.com>
7318 * arm.cc (Arm_relobj): New class definition.
7319 (Arm_relobj::scan_sections_for_stubs,
7320 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7321 New method definitions.
7323 2009-10-28 Cary Coutant <ccoutant@google.com>
7325 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7326 (Plugin::cleanup_done_): New member.
7327 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7328 (Plugin_manager::cleanup_done_): Remove.
7329 (Plugin_manager::add_input_file): Edit error message.
7330 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7331 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7333 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7335 * fileread.cc: (File_read::View::~View): Use the new
7336 data_ownership_ filed.
7337 (File_read::~File_read): Dispose the new whole_file_view_.
7338 (File_read::open): Mmap the whole file if needed.
7339 (File_read::open): Use whole_file_view_ instead of contents_.
7340 (File_read::find_view): Use whole_file_view_ if applicable.
7341 (File_read::do_read): Use whole_file_view_ instead of contents_.
7342 (File_read::make_view): Use whole_file_view_ instead of contents_,
7343 update File_read::View::View call.
7344 (File_read::find_or_make_view): Update File_read::View::View
7346 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7348 (File_read::View::Data_ownership): New enum.
7349 (File_read::View::View): Replace bool mapped_ with Data_ownership
7351 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7352 (File_read::View::data_ownership_): New field.
7353 (File_read::contents_): Remove (replaced by whole_file_view_).
7354 (File_read::whole_file_view_): New field.
7355 * options.h (class General_options): Add --keep-files-mapped.
7357 2009-10-27 Cary Coutant <ccoutant@google.com>
7359 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7360 * testsuite/Makefile.am (plugin_test_5): New test case.
7361 * testsuite/Makefile.in: Regenerate.
7363 2009-10-25 Doug Kwan <dougkwan@google.com>
7365 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7366 from private to protected to allow access by child class.
7367 (Sized_relobj::do_relocate_sections): New method declaration.
7368 (Sized_relobj::relocate_sections): Virtualize.
7369 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7370 Sized_relobj::relocate_sections. Instantiate template explicitly
7371 for different target sizes and endianity.
7373 2009-10-24 Doug Kwan <dougkwan@google.com>
7375 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7376 (Arm_input_section::as_arm_input_section): New method.
7377 (Arm_output_section): New class definition.
7378 (Arm_output_section::create_stub_group,
7379 Arm_output_section::group_sections): New method definitions.
7381 2009-10-22 Doug Kwan <dougkwan@google.com>
7383 * arm.cc (Arm_input_section): New class definition.
7384 (Arm_input_section::init, Arm_input_section:do_write,
7385 Arm_input_section::set_final_data_size,
7386 Arm_input_section::do_reset_address_and_file_offset): New method
7389 2009-10-21 Doug Kwan <dougkwan@google.com>
7391 * arm.cc (Stub_table, Arm_input_section): New forward class
7393 (Stub_table): New class defintion.
7394 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7395 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7396 New method definition.
7398 2009-10-21 Doug Kwan <dougkwan@google.com>
7400 * arm.cc: Update copyright comments.
7401 (Target_arm): New forward class template declaration.
7402 (Arm_address): New type.
7403 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7404 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7405 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7407 (Insn_template): Same.
7408 (DEF_STUBS): New macro.
7409 (Stub_type): New enum type.
7410 (Stub_template): New class definition.
7413 (Stub_factory): Same.
7414 (Target_arm::Target_arm): Initialize may_use_blx_ and
7415 should_force_pic_veneer_.
7416 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7417 Target_arm::should_force_pic_veneer,
7418 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7419 Target_arm::using_thumb_only, Target_arm:;default_target): New
7421 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7422 New data member declarations.
7423 (Insn_template::size, Insn_template::alignment): New method defintions.
7424 (Stub_template::Stub_template): New method definition.
7425 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7426 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7427 (Stub_factory::Stub_factory): New method definition.
7428 * gold.h (string_hash): New template.
7429 * output.h (Input_section_specifier::hash_value): Use
7431 (Input_section_specifier::string_hash): Remove.
7432 * stringpool.cc (Stringpool_template::string_hash): Use
7435 2009-10-20 Doug Kwan <dougkwan@google.com>
7437 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7438 symbols of relaxed input sections.
7439 * output.h (Output_section::find_relaxed_input_section): Make
7442 2009-10-16 Doug Kwan <dougkwan@google.com>
7444 * dynobj.cc (Versions::Versions): Initialize version_script_.
7445 Only insert base version symbol definition for a shared object
7446 if version script defines any version versions.
7447 (Versions::define_base_version): New method definition.
7448 (Versions::add_def): Check that base version is not needed.
7449 (Versions::add_need): Define base version lazily.
7450 * dynobj.h (Versions::define_base_version): New method declaration.
7451 (Versions::needs_base_version_): New data member declaration.
7452 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7453 (check_DATA): Add no_version_test.stdout.
7454 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7456 * testsuite/Makefile.in: Regenerate.
7457 * testsuite/no_version_test.c: New file.
7458 * testsuite/no_version_test.sh: Ditto.
7460 2009-10-16 Doug Kwan <dougkwan@google.com>
7462 * expression.cc (class Segment_start_expression): New class definition.
7463 (Segment_start_expression::value): New method definition.
7464 (script_exp_function_segment_start): Return a new
7465 Segment_start_expression.
7466 * gold/script-c.h (script_saw_segment_start_expression): New function
7468 * script-sections.cc (Script_sections::Script_sections): Initialize
7469 SAW_SEGMENT_START_EXPRESSION_ to false.
7470 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7471 and -Tbbs options to specify section addresses if given in
7472 command line and no SEGMENT_START expression is seen in a script.
7473 * script-sections.h (Script_sections::saw_segment_start_expression,
7474 Script_sections::set_saw_segment_start_expression): New method
7476 (Script_sections::saw_segment_start_expression_): New data member
7478 * script.cc (script_saw_segment_start_expression): New function.
7479 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7480 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7481 script_test_7.sh and script_test_8.sh.
7482 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7483 script_test_8.stdout.
7484 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7485 (script_test_6, script_test_6.stdout, script_test_7,
7486 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7487 * Makefile.in: Regenerate.
7488 * testsuite/script_test_6.sh: New file.
7489 * testsuite/script_test_6.t: Same.
7490 * testsuite/script_test_7.sh: Same.
7491 * testsuite/script_test_7.t: Same.
7492 * testsuite/script_test_8.sh: Same.
7494 2009-10-16 Doug Kwan <dougkwan@google.com>
7496 * output.cc (Output_segment::set_section_list_address): Cast
7497 expressions to unsigned long long type to avoid format warnings.
7499 2009-10-15 Ian Lance Taylor <iant@google.com>
7501 * script.cc (Script_options::add_symbol_assignment): Always add a
7502 dot assignment to script_sections_.
7503 * script-sections.cc (Script_sections::add_dot_assignment):
7504 Initialize if necessary.
7506 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7507 program headers with no load segment if there is a linker script.
7509 * layout.cc (Layout::set_segment_offsets): Align the file offset
7510 to the segment aligment for -N or -n with no load segment.
7511 * output.cc (Output_segment::add_output_section): Don't crash if
7512 the first section is a TLS section.
7513 (Output_segment::set_section_list_addresses): Print an error
7514 message if the address moves backward in a linker script.
7515 * script-sections.cc
7516 (Output_section_element_input::set_section_addresses): Don't
7517 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7518 (Orphan_output_section::set_section_addresses): Likewise.
7520 2009-10-15 Doug Kwan <dougkwan@google.com>
7522 * layout.cc (Layout::finish_dynamic_section): Generate tags
7523 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7524 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7525 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7527 2009-10-14 Ian Lance Taylor <iant@google.com>
7529 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7531 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7532 data_shdr fields of relinfo.
7533 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7534 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7535 R_386_TLS_LDO_32, adjust based on section flags.
7536 (Target_i386::Relocate::fix_up_ldo): Remove.
7538 2009-10-13 Ian Lance Taylor <iant@google.com>
7540 Add support for -pie.
7541 * options.h (class General_options): Add -pie and
7543 (General_options::output_is_position_independent): Test -pie.
7544 (General_options::output_is_executable): Return true if not shared
7545 and not relocatable.
7546 (General_options::output_is_pie): Remove.
7547 * options.cc (General_options::finalize): Reject incompatible uses
7549 * gold.cc (queue_middle_tasks): A -pie link is not static.
7550 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7551 * symtab.cc (Symbol::final_value_is_known): Return false if
7552 output_is_position_independent.
7553 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7554 output_is_position_independent.
7555 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7556 output_is_position_independent.
7557 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7558 output_is_position_independent.
7559 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7561 (basic_pie_test.o, basic_pie_test): New targets.
7562 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7563 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7564 (two_file_pie_test): New target.
7565 * testsuite/Makefile.in: Rebuild.
7566 * README: Remove note saying that -pie is not supported.
7568 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7570 * options.h (class General_options): Add -init and -fini.
7571 * layout.cc (Layout::finish_dynamic_section): Emit
7572 given init and fini functions.
7574 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7576 * gc.h (gc_process_relocs): Check if icf is enabled using new
7578 * gold.cc (queue_initial_tasks): Likewise.
7579 (queue_middle_tasks): Likewise.
7580 * object.cc (do_layout): Likewise.
7581 * symtab.cc (is_section_folded): Likewise.
7582 * main.cc (main): Likewise.
7583 * reloc.cc (Read_relocs::run): Likewise.
7584 (Sized_relobj::do_scan_relocs): Likewise.
7585 * icf.cc (is_function_ctor_or_dtor): New function.
7586 (Icf::find_identical_sections): Check if function is ctor or dtor when
7588 * options.h (General_options::icf): Change option to be an enum.
7589 (Icf_status): New enum.
7590 (icf_enabled): New method.
7591 (icf_safe_folding): New method.
7592 (set_icf_status): New method.
7593 (icf_status_): New variable.
7594 * (options.cc) (General_options::finalize): Set icf_status_.
7595 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7596 icf_test and icf_keep_unique_test to use the --icf enum flag.
7597 * testsuite/icf_safe_test.sh: New file.
7598 * testsuite/icf_safe_test.cc: New file.
7600 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7602 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7603 includes to gc.h and icf.h.
7604 * arm.cc: Include gc.h.
7605 * gold.cc: Likewise.
7606 * i386.cc: Likewise.
7607 * powerpc.cc: Likewise.
7608 * sparc.cc: Likewise.
7609 * x86_64.cc: Likewise.
7610 * gc.h: Include icf.h.
7612 2009-10-11 Ian Lance Taylor <iant@google.com>
7614 * plugin.cc: Include "gold.h" before other header files.
7616 2009-10-10 Chris Demetriou <cgd@google.com>
7618 * options.h (Input_file_argument::Input_file_type): New enum.
7619 (Input_file_argument::is_lib_): Replace with...
7620 (Input_file_argument::type_): New member.
7621 (Input_file_argument::Input_file_argument): Take Input_file_type
7622 'type' rather than boolean 'is_lib' as second argument.
7623 (Input_file_argument::is_lib): Use type_.
7624 (Input_file_argument::is_searched_file): New function.
7625 (Input_file_argument::may_need_search): Handle is_searched_file.
7626 * options.cc (General_options::parse_library): Support -l:filename.
7627 (General_options::parse_just_symbols): Update for Input_file_argument
7629 (Command_line::process): Likewise.
7630 * archive.cc (Archive::get_file_and_offset): Likewise.
7631 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7632 * script.cc (read_script_file, script_add_file): Likewise.
7633 * fileread.cc (Input_file::Input_file): Likewise.
7634 (Input_file::will_search_for): Handle is_searched_file.
7635 (Input_file::open): Likewise.
7636 * readsyms.cc (Read_symbols::get_name): Likewise.
7637 * testsuite/Makefile.am (searched_file_test): New test.
7638 * testsuite/Makefile.in: Regenerate.
7639 * testsuite/searched_file_test.cc: New file.
7640 * testsuite/searched_file_test_lib.cc: New file.
7642 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7643 Ian Lance Taylor <iant@google.com>
7645 * descriptor.cc: Include <cstdio> and "binary-io.h".
7646 (Descriptors::open): Open the files in binary mode always.
7647 * script.cc (Lex::get_token): Treat \r as whitespace.
7649 2009-10-09 Ian Lance Taylor <iant@google.com>
7651 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7653 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7654 Ian Lance Taylor <iant@google.com>
7656 * configure.ac: Check for readv function also.
7657 * fileread.cc (readv): Define if not HAVE_READV.
7658 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7660 * config.in: Regenerate.
7661 * configure: Regenerate.
7663 2009-10-09 Doug Kwan <dougkwan@google.com>
7665 * layout.cc (Layout::make_output_section): Call target hook to make
7666 ordinary output section.
7667 (Layout::finalize): Adjust parameter list of call the
7668 Target::may_relax().
7669 * layout.h (class Layout::section_list): New method.
7670 * merge.h (Output_merge_base::entsize): Change visibility to public.
7671 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7673 (Output_merge_string::do_is_string): New method.
7674 * object.cc (Sized_relobj::do_setup): renamed from
7675 Sized_relobj::set_up.
7676 * object.h (Sized_relobj::adjust_shndx,
7677 Sized_relobj::initializ_input_to_output_maps,
7678 Sized_relobj::free_input_to_output_maps): Change visibilities to
7680 (Sized_relobj::setup): Virtualize.
7681 (Sized_relobj::do_setup): New method declaration.
7682 (Sized_relobj::invalidate_section_offset,
7683 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7684 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7685 * options.cc (parse_int): New function.
7686 * options.h (parse_int): New declaration.
7687 (DEFINE_int): New macro.
7688 (stub_group_size): New option.
7689 * output.cc (Output_section::Output_section): Initialize memebers
7690 merge_section_map_, merge_section_by_properties_map_,
7691 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7692 (Output_section::add_input_section): Handled deferred code-fill
7693 generation and remove an old comment.
7694 (Output_section::add_relaxed_input_section): New method definition.
7695 (Output_section::add_merge_input_section): Use merge section by
7696 properties map to speed to search. Update merge section maps
7698 (Output_section::build_relaxation_map): New method definition.
7699 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7701 (Output_section::relax_input_section): Renamed to
7702 Output_section::convert_input_sections_to_relaxed_sections and change
7703 interface to take a vector of pointers to relaxed sections.
7704 (Output_section::find_merge_section,
7705 Output_section::find_relaxed_input_section): New method definitions.
7706 (Output_section::is_input_address_mapped,
7707 Output_section::output_offset, Output_section::output_address):
7708 Use output section data maps to speed up searching.
7709 (Output_section::find_starting_output_address): Add comments.
7710 (Output_section::do_write,
7711 Output_section::write_to_postprocessing_buffer): Do code-fill
7712 generation as appropriate.
7713 (Output_section::get_input_sections): Invalidate relaxed input section
7715 (Output_section::restore_states): Adjust type of checkpoint .
7716 Invalidate relaxed input section map.
7717 * output.h (Output_merge_base): New class declaration.
7718 (Input_section_specifier): New class defintion.
7719 (class Output_relaxed_input_section) Change base class to
7720 Output_section_data_build.
7721 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7722 base class initializer.
7723 (Output_section::add_relaxed_input_section): New method declaration.
7724 (Output_section::Input_section): Change visibility to protected.
7725 (Output_section::Input_section::relobj,
7726 Output_section::Input_section::shndx): Handle relaxed input sections.
7727 Output_section::input_sections) Change visibility to protected. Also
7728 define overload to return a non-const pointer.
7729 (Output_section::Merge_section_properties): New class defintion.
7730 (Output_section::Merge_section_by_properties_map,
7731 Output_section::Output_section_data_by_input_section_map,
7732 Output_section::Relaxation_map): New types.
7733 (Output_section::relax_input_section): Rename method to
7734 Output_section::convert_input_sections_to_relaxed_sections and change
7735 interface to take a vector of relaxed section pointers.
7736 (Output_section::find_merge_section,
7737 Output_section::find_relaxed_input_section,
7738 Output_section::build_relaxation_map,
7739 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7740 New method declarations.
7741 (Output_section::merge_section_map_
7742 Output_section::merge_section_by_properties_map_,
7743 Output_section::relaxed_input_section_map_,
7744 Output_section::is_relaxed_input_section_map_valid_,
7745 Output_section::generate_code_fills_at_write_): New data members.
7746 * script-sections.cc
7747 (Output_section_element_input::set_section_addresses): Call
7748 current_data_size and addralign methods of relaxed input sections.
7749 (Orphan_output_section::set_section_addresses): Call current_data_size
7750 and addralign methods of relaxed input sections.
7751 * symtab.cc (Symbol_table::compute_final_value): Extract template
7752 from the body of Symbol_table::sized_finalize_symbol.
7753 (Symbol_table::sized_finalized_symbol): Call
7754 Symbol_table::compute_final_value.
7755 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7756 (Symbol_table::compute_final_value): New templated method declaration.
7757 * target.cc (Target::do_make_output_section): New method defintion.
7758 * target.h (Target::make_output_section): New method declaration.
7759 (Target::relax): Add more parameters for input objects, symbol table
7760 and layout. Adjust call to do_relax.
7761 (Target::do_make_output_section): New method declaration.
7762 (Target::do_relax): Add parameters for input objects, symbol table
7765 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7767 * pread.c: Include stdio.h.
7769 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7771 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7774 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7776 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7777 Change read_shndx type to unsigned int.
7778 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7780 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7781 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7782 Change read_shndx type to unsigned int.
7783 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7785 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7786 * layout.cc (Layout::create_symtab_sections): Cast the result of
7787 local_symcount * symsize to off_t in the gold_assert.
7789 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7791 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7792 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7794 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7795 (Arm_relocate_functions::thm_abs5): New function.
7796 (Arm_relocate_functions::abs12): New function.
7797 (Arm_relocate_functions::abs16): New function.
7798 (Arm_relocate_functions::base_abs): New function.
7799 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7800 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7801 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7803 (Scan::global): Likewise.
7804 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7805 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7806 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7807 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7810 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7812 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7813 (Arm_relocate_functions::movt_prel): New function.
7814 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7815 (Arm_relocate_functions::thm_movt_prel): New function.
7816 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7817 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7818 (Scan::global, Relocate::relocate): Likewise.
7819 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7821 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7823 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7824 Incremental_checker.
7825 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7827 (class Incremental_inputs_header): New class.
7828 (Incremental_inputs_header_writer): Edit comment.
7829 (Incremental_inputs_entry): New class.
7830 (Incremental_inputs_entry_writer): Edit comment.
7831 (Sized_incremental_binary::do_find_incremental_inputs_section):
7832 Add *strtab_shndx parameter, fill it.
7833 (Sized_incremental_binary::do_check_inputs): New method.
7834 (Incremental_checker::can_incrementally_link_output_file): Use
7835 Sized_incremental_binary::check_inputs.
7836 (Incremental_inputs::report_command_line): Save command line in
7839 (Incremental_binary::find_incremental_inputs_section): New
7841 (Incremental_binary::do_find_incremental_inputs_section): Add
7842 strtab_shndx parameter.
7843 (Incremental_binary::do_check_inputs): New pure virtual method.
7844 (Sized_incremental_binary::do_check_inputs): Declare.
7845 (Incremental_checker::Incremental_checker): Add incremental_inputs
7846 parameter, use it to initialize incremental_inputs_.
7847 (Incremental_checker::incremental_inputs_): New field.
7848 (Incremental_checker::command_line): New method.
7849 (Incremental_checker::inputs): New method.
7850 (Incremental_checker::command_line_): New field.
7852 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7854 * incremental.cc: Include <cstdarg> and "target-select.h".
7855 (vexplain_no_incremental): New function.
7856 (explain_no_incremental): New function.
7857 (Incremental_binary::error): New method.
7858 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7860 (make_sized_incremental_binary): New function.
7861 (open_incremental_binary): New function.
7862 (can_incrementally_link_file): Add checks if output is ELF and has
7864 * incremental.h: Include "elfcpp_file.h" and "output.h".
7865 (Incremental_binary): New class.
7866 (Sized_incremental_binary): New class.
7867 (open_incremental_binary): Declare.
7868 * object.cc (is_elf_object): Use
7869 elfcpp::Elf_recognizer::is_elf_file.
7870 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7871 * output.h (Output_file::filesize): New method.
7873 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7875 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7877 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7878 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7880 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7882 (Arm_relocate_functions::movw_abs_nc): New function.
7883 (Arm_relocate_functions::movt_abs): New function.
7884 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7885 (Arm_relocate_functions::thm_movt_abs): New function.
7886 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7887 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7888 (Scan::global): Likewise.
7889 (Relocate::relocate): Likewise.
7890 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7892 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7894 * arm.cc (Arm_relocate_functions::got_prel) New function.
7895 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7896 (Relocate::relocate): Likewise.
7897 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7899 2009-10-06 Ian Lance Taylor <iant@google.com>
7901 * options.h (class General_options): Define
7902 split_stack_adjust_size parameter.
7903 * object.h (class Object): Add uses_split_stack_ and
7904 has_no_split_stack_ fields. Add uses_split_stack and
7905 has_no_split_stack accessor functions. Declare
7906 handle_split_stack_section.
7907 (class Reloc_symbol_changes): Define.
7908 (class Sized_relobj): Define Function_offsets. Declare
7909 split_stack_adjust, split_stack_adjust_reltype, and
7911 * object.cc (Object::handle_split_stack_section): New function.
7912 (Sized_relobj::do_layout): Call handle_split_stack_section.
7913 * dynobj.cc (Sized_dynobj::do_layout): Call
7914 handle_split_stack_section.
7915 * reloc.cc (Sized_relobj::relocate_sections): Call
7916 split_stack_adjust for executable sections in split_stack
7917 objects. Pass reloc_map to relocate_section.
7918 (Sized_relobj::split_stack_adjust): New function.
7919 (Sized_relobj::split_stack_adjust_reltype): New function.
7920 (Sized_relobj::find_functions): New function.
7921 * target-reloc.h: Include "object.h".
7922 (relocate_section): Add reloc_symbol_changes parameter. Change
7924 * target.h (class Target): Add calls_non_split method. Declare
7925 do_calls_non_split virtual method. Declare match_view and
7927 * target.cc: Include "elfcpp.h".
7928 (Target::do_calls_non_split): New function.
7929 (Target::match_view): New function.
7930 (Target::set_view_to_nop): New function.
7931 * gold.cc (queue_middle_tasks): Give an error if mixing
7932 split-stack and non-split-stack objects with -r.
7933 * i386.cc (Target_i386::relocate_section): Add
7934 reloc_symbol_changes parameter.
7935 (Target_i386::do_calls_non_split): New function.
7936 * x86_64.cc (Target_x86_64::relocate_section): Add
7937 reloc_symbol_changes parameter.
7938 (Target_x86_64::do_calls_non_split): New function.
7939 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7941 * powerpc.cc (Target_powerpc::relocate_section): Add
7942 reloc_symbol_changes parameter.
7943 * sparc.cc (Target_sparc::relocate_section): Add
7944 reloc_symbol_changes parameter.
7945 * configure.ac: Call AM_CONDITIONAL for the default target.
7946 * configure: Rebuild.
7947 * testsuite/Makefile.am (TEST_AS): New variable.
7948 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7949 (check_DATA): Add split_i386 and split_x86_64 files.
7950 (SPLIT_DEFSYMS): Define.
7951 (split_i386_[1234n].o): New targets.
7952 (split_i386_[124]): New targets.
7953 (split_i386_[1234r].stdout): New targets.
7954 (split_x86_64_[1234n].o): New targets.
7955 (split_x86_64_[124]): New targets.
7956 (split_x86_64_[1234r].stdout): New targets.
7957 (MOSTLYCLEANFILES): Add new executables.
7958 * testsuite/split_i386.sh: New file.
7959 * testsuite/split_x86_64.sh: New file.
7960 * testsuite/split_i386_1.s: New file.
7961 * testsuite/split_i386_2.s: New file.
7962 * testsuite/split_i386_3.s: New file.
7963 * testsuite/split_i386_4.s: New file.
7964 * testsuite/split_i386_n.s: New file.
7965 * testsuite/split_x86_64_1.s: New file.
7966 * testsuite/split_x86_64_2.s: New file.
7967 * testsuite/split_x86_64_3.s: New file.
7968 * testsuite/split_x86_64_4.s: New file.
7969 * testsuite/split_x86_64_n.s: New file.
7970 * testsuite/testfile.cc (Target_test): Update relocation_section
7972 * testsuite/Makefile.in: Rebuild.
7974 2009-10-06 Ian Lance Taylor <iant@google.com>
7976 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7977 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7978 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7979 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7980 the address on ldo_addrs_.
7981 (Target_i386::Relocate::fix_up_ldo): New function.
7983 2009-10-06 Rafael Espindola <espindola@google.com>
7985 * plugin.cc (add_input_library): New.
7986 (Plugin::load): Add add_input_library to tv.
7987 (Plugin_manager::add_input_file): Add the is_lib argument.
7988 (add_input_file): Update call to Plugin_manager::add_input_file.
7989 (add_input_library): New.
7990 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7992 2009-09-30 Doug Kwan <dougkwan@google.com>
7994 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7995 symbol and call Symbol::may_need_copy_reloc to determine if
7996 a copy reloc is needed.
7997 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7998 nocopyreloc is given in command line.
7999 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8000 given in command line.
8001 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8002 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8003 of the removed Target_i386::may_need_copy_reloc.
8004 * options.h (copyreloc): New option with default value false.
8005 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8006 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8007 instead of the removed Target_powerpc::may_need_copy_reloc.
8008 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8009 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8010 instead of the removed Target_sparc::may_need_copy_reloc.
8011 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8012 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8013 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8014 instead of the removed Target_x86_64::may_need_copy_reloc.
8016 2009-09-30 Ian Lance Taylor <iant@google.com>
8018 * object.h (class Object): Remove target_ field, and target,
8019 sized_target, and set_target methods.
8020 (Object::sized_target): Remove.
8021 (class Sized_relobj): Update declarations. Remove sized_target.
8022 * object.cc (Sized_relobj::setup): Remove target parameter.
8024 (Input_objects::add_object): Don't do anything with the target.
8025 (make_elf_sized_object): Add punconfigured parameter. Change all
8026 callers. Set or test parameter target.
8027 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8029 * parameters.cc (Parameters::set_target): Change parameter type to
8031 (Parameters::default_target): Remove.
8032 (set_parameters_target): Change parameter type to be non-const.
8033 (parameters_force_valid_target): New function.
8034 (parameters_clear_target): New function.
8035 * parameters.h (class Parameters): Update declarations. Remove
8036 default_target method. Add sized_target and clear_target
8037 methods. Change target_ to be non-const.
8038 (set_parameters_target): Update declaration.
8039 (parameters_force_valid_target): Declare.
8040 (parameters_clear_target): Declare.
8041 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8042 as NULL if we aren't searching.
8043 (Add_symbols::run): Don't check for compatible target.
8044 * fileread.cc (Input_file::open_binary): Call
8045 parameters_force_valid_target.
8046 * gold.cc (queue_middle_tasks): Likewise.
8047 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8048 set_target on object.
8049 * dynobj.h (class Sized_dynobj): Update declarations.
8050 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8051 make_elf_object returns NULL.
8052 (Archive::include_member): Don't check whether object target is
8054 * output.cc (Output_section::add_input_section): Get target from
8056 (Output_section::relax_input_section): Likewise.
8057 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8059 (Sized_relobj::do_scan_relocs): Likewise.
8060 (Sized_relobj::relocate_sections): Likewise.
8061 * resolve.cc (Symbol_table::resolve): Likewise.
8062 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8063 parameter. Change all callers.
8064 (Symbol_table::add_from_object): Get target from parameters.
8065 (Symbol_table::add_from_relobj): Don't check object target.
8066 (Symbol_table::add_from_dynobj): Likewise.
8067 (Symbol_table::define_special_symbol): Get target from
8069 * symtab.h (class Symbol_table): Update declaration.
8070 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8071 parameter. Change all callers. Clear parameter target.
8072 (Binary_test): Test target here.
8073 * testsuite/object_unittest.cc (gold_testsuite): Remove
8074 target_test_pointer parameter. Change all callers.
8075 (Object_test): Test target here.
8077 2009-09-26 Ian Lance Taylor <iant@google.com>
8079 * testsuite/initpri1.c: Don't try to use constructor priorities if
8080 compiling with gcc before 4.3.
8082 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8084 * testsuite/retain_symbols_file_test.sh (check_present): Change
8085 output file name to retain_symbols_file_test.stdout.
8086 (check_absent): Likewise.
8088 2009-09-18 Craig Silverstein <csilvers@google.com>
8090 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8091 * options.cc: Include <cerrno> and <fstream>.
8092 (General_options::finalize): Parse -retain-symbols-file tag.
8093 * options.h: New flag.
8094 (General_options): New method should_retain_symbol, new
8095 variable symbols_to_retain.
8096 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8097 should_retain_symbol map.
8098 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8099 * testsuite/Makefile.in: Regenerate.
8100 * testsuite/retain_symbols_file_test.sh: New file.
8102 2009-09-18 Nick Clifton <nickc@redhat.com>
8104 * po/es.po: Updated Spanish translation.
8106 2009-09-17 Doug Kwan <dougkwan@google.com>
8108 * debug.h (DEBUG_RELAXATION): New constant.
8109 (DEBUG_ALL): Add DEBUG_RELAXATION.
8110 (debug_string_to_enum): Add relaxation debug option.
8112 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8113 Layout::Relaxation_debug_check::read_sections,
8114 Layout::Relaxation_debug_check::read_sections): New method definitions.
8115 (Layout::Layout): Initialize data members
8116 record_output_section_data_from_scrips_,
8117 script_output_section_data_list_ and relaxation_debug_check_.
8118 (Layout::save_segments, Layout::restore_segments,
8119 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8120 Layout::relaxation_loop_body): New method definitions.
8121 (Layout::finalize): Support relaxation. Move section layout code to
8122 Layout::relaxation_loop_body.
8123 (Layout::set_asection_address_from_script): Move code for orphan
8124 section placement out.
8125 (Layout::place_orphan_sections_in_script): New method definition.
8126 * layout.h (Output_segment_headers, Output_file_header):
8127 New forward class declarations.
8128 (Layout::~Layout): Define.
8129 (Layout::new_output_section_data_from_script): New method definition.
8130 (Layout::place_orphan_sections_in_script): New method declaration.
8131 (Layout::Segment_states): New type declaration.
8132 (Layout::save_segments, Layout::restore_segments,
8133 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8134 Layout::relaxation_loop_body): New method declarations.
8135 (Layout::Output_section_data_list): New type declaration.
8136 (Layout::Relaxation_debug_check): New class definition.
8137 (Layout::record_output_section_data_from_script_,
8138 Layout::script_output_section_data_list_, Layout::segment_states_,
8139 Layout::relaxation_debug_check_): New data members.
8140 * output.cc: (Output_section_headers::do_size): New method definition.
8141 (Output_section_headers::Output_section_headers): Move size
8142 computation to Output_section_headers::do_size.
8143 (Output_segment_headers::do_size): New method definition.
8144 (Output_file_header::Output_file_header): Move size computation to
8145 Output_file_header::do_size and call it.
8146 (Output_file_header::do_size): New method definition.
8147 (Output_data_group::Output_data_group): Adjust call to
8148 Output_section_data.
8149 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8150 (Output_symtab_xindex::do_write): Add array bound check.
8151 (Output_section::Input_section::print_to_mapfile): Handle
8152 RELAXED_INPUT_SECTION_CODE.
8153 (Output_section::Output_section): Initialize data member checkpoint_.
8154 (Output_section::~Output_section): Delete checkpoint object pointed
8156 (Output_section::add_input_section): Always add an Input_section if
8158 (Output_section::add_merge_input_section): Add assert.
8159 (Output_section::relax_input_section): New method definition.
8160 (Output_section::set_final_data_size): Set load address to zero for
8161 an unallocated section.
8162 (Output_section::do_address_and_file_offset_have_reset_values):
8163 New method definition.
8164 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8165 Handle relaxed input section.
8166 (Output_section::sort_attached_input_sections): Checkpoint input
8167 section list lazily.
8168 (Output_section::get_input_sections): Change type of input_sections to
8169 list of Simple_input_section pointers. Checkpoint input section list
8170 lazily. Also handle relaxed input sections.
8171 (Output_section::add_input_section_for_script): Take a reference to
8172 a Simple_input_section object instead of Relobj pointer and section
8173 index as parameter. Handle relaxed input sections.
8174 (Output_section::save_states, Output_section::restore_states): New
8176 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8177 (Output_data::is_data_size_fixed): New method definition.
8178 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8180 (Output_data::address_and_file_offset_have_reset_values): New method
8182 (Output_data::do_address_and_file_offset_have_reset_values): New method
8184 (Output_data::set_data_size): Check that data size is not fixed.
8185 (Output_data::fix_data_size): New method definition.
8186 (Output_data::is_data_size_fixed_): New data member.
8187 (Output_section_headers::set_final_data_size): New method definition.
8188 (Output_section_headers::do_size): New method declaration.
8189 (Output_segment_headers::set_final_data_size): New method definition.
8190 (Output_segment_headers::do_size): New method declaration.
8191 (Output_file_header::set_final_data_size)::New method definition.
8192 (Output_file_header::do_size)::New method declaration.
8193 (Output_section_data::Output_section_data): Add new parameter
8194 is_data_size_fixed and use it to fix data size.
8195 (Output_data_const::Output_data_const): Adjust call to base class
8196 constructor and fix data size.
8197 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8198 base class constructor and fix data size.
8199 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8200 base class constructor and fix data size.
8201 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8202 class constructor and fix data size.
8203 (Output_data_group::set_final_data_size): New method definition.
8204 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8205 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8206 class constructor and fix data size.
8207 (Output_relaxed_input_section): New class definition.
8208 (Output_section::Simple_input_section): New class definition.
8209 (Output_section::get_input_sections): Adjust parameter list.
8210 (Output_section::add_input_section_for_script): Same.
8211 (Output_section::save_states, Output_section::restore_states,
8212 Output_section::do_address_and_file_offset_have_reset_values,
8213 (Output_section::Input_section::Input_section): Handle
8214 RELAXED_INPUT_SECTION_CODE. Add new overload for
8215 Output_relaxed_input_section.
8216 (Output_section::Input_section::is_input_section,
8217 Output_section::Input_section::set_output_section): Handle relaxed
8219 (Output_section::Input_section::is_relaxed_input_section,
8220 Output_section::Input_section::output_section_data,
8221 Output_section::Input_section::relaxed_input_section): New method
8223 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8225 (Output_section::Input_section::u1_): Update comments.
8226 (Output_section::Input_section::u2_): Add new union member poris.
8227 (Output_section::Checkpoint_output_section): New classs definition.
8228 (Output_section::relax_input_section): New method declaration.
8229 (Output_section::checkpoint_): New data member.
8230 (Output_segment): Update comments.
8231 (Output_segment::Output_segment): Un-privatize copy constructor.
8232 (Output_segment::operator=): Un-privatize.
8233 * script-sections.cc (Output_section_element::Input_section_list):
8234 Change element type to Output_section::Simple_input_section.
8235 (Output_section_element_dot_assignment::set_section_addresses):
8236 Register output section data for relaxation clean up.
8237 (Output_data_exression::Output_data_expression): Adjust call to base
8238 constructor to fix data size.
8239 (Output_section_element_data::set_section_addresses): Register
8240 Output_data_expression object for relaxation clean up.
8241 (struct Input_section_info): Replace Relobj pointer and section index
8242 pair with Output_section::Simple_input_section and Convert struct to a
8244 (Input_section_sorter::operator()): Adjust access to
8245 Input_section_info data member to use accessors.
8246 (Output_section_element_input::set_section_addresses): Use layout
8247 parameter. Adjust code to use Output_section::Simple_input_section
8248 and Input_secction_info classes. Register filler for relaxation
8250 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8251 and section index pair with Output_section::Simple_input_section
8252 class. Adjust code accordingly.
8253 (Phdrs_element::release_segment): New method definition.
8254 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8256 (Script_sections::release_segments): New method definition.
8257 * gold/script-sections.h (Script_sections::release_segments): New
8259 * gold/target.h (Target::may_relax, Target::relax,
8260 Target::do_may_relax, Target::do_relax): New method definitions.
8262 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8264 * arm.cc (has_signed_unsigned_overflow): New function.
8265 (Arm_relocate_functions::abs8): New function.
8266 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8267 (Target_arm::Scan::global): Likewise.
8268 (Target_arm::relocate::relocate): Likewise.
8269 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8272 2009-09-16 Cary Coutant <ccoutant@google.com>
8274 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8275 * testsuite/Makefile.in: Regenerate.
8277 2009-09-11 Nick Clifton <nickc@redhat.com>
8279 * po/gold.pot: Updated by the Translation project.
8281 2009-09-08 Cary Coutant <ccoutant@google.com>
8283 * output.cc (Output_file::open): Add execute permission to empty file.
8284 * testsuite/Makefile.am (permission_test): New test.
8285 * testsuite/Makefile.in: Regenerate.
8287 2009-09-02 Ian Lance Taylor <iant@google.com>
8289 * output.cc (Output_file::resize): Call map_no_anonymous rather
8292 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8294 * gold.cc: Include "incremental.h".
8295 (queue_initial_tasks): Call Incremental_checker methods.
8296 * incremental.cc: Include "output.h".
8297 (Incremental_checker::can_incrementally_link_output_file): New
8299 * incremental.h (Incremental_checker): New class.
8301 * output.cc (Output_file::open_for_modification): New method.
8302 (Output_file::map_anonymous): Changed return type to bool. Record
8304 (Output_file::map_no_anonymous): New method, broken out of map.
8305 (Output_file::map): Use map_no_anonymous and map_anonymous.
8306 * output.h (class Output_file): Update declarations.
8308 2009-08-24 Cary Coutant <ccoutant@google.com>
8310 * options.h (Command_line::Pre_options): New class.
8311 (Command_line::pre_options): New member.
8312 * options.cc (gold::options::ready_to_register): New variable.
8313 (One_option::register_option): Do nothing if not registering options.
8314 Assert if same short option registered twice.
8315 (General_options::General_options): Turn off option registration when
8317 (Command_line::Pre_options::Pre_options): New constructor.
8319 2009-08-24 Cary Coutant <ccoutant@google.com>
8321 * options.h (General_options::no_keep_memory): Remove incorrect
8324 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8326 * Makefile.am (am__skiplex, am__skipyacc): New.
8327 * Makefile.in: Regenerate.
8329 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8331 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8332 (INCLUDES): ... this.
8333 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8334 (AM_CPPFLAGS): Renamed from ...
8335 (INCLUDE): ... this.
8336 * Makefile.in, testsuite/Makefile.in: Regenerate.
8338 * Makefile.in: Regenerate.
8339 * aclocal.m4: Likewise.
8340 * config.in: Likewise.
8341 * configure: Likewise.
8342 * testsuite/Makefile.in: Likewise.
8344 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8345 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8346 * Makefile.in: Regenerate.
8347 * testsuite/Makefile.in: Regenerate.
8349 2009-08-19 Cary Coutant <ccoutant@google.com>
8351 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8352 symbols in shared libraries overridden by hidden or internal symbols
8353 in the main program.
8355 2009-08-19 Chris Demetriou <cgd@google.com>
8357 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8358 checking source file names in error messages.
8360 2009-08-18 Doug Kwan <dougkwan@google.com>
8362 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8363 an elcpp::Ehdr as parameter. Adjust call to set_target.
8364 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8365 an elfcpp::Ehdr as parameter.
8366 * object.cc (Object::set_target): Remove the version that looks up
8367 a target and sets it.
8368 (Sized_relobj::setup): Take a Target object instead of
8369 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8370 (make_elf_sized_object): Find target and ask target to
8372 * object.h: (Object::set_target): Remove the version that looks up
8373 a target and sets it.
8374 (Sized_relobj::setup): Take a Target object instead of
8375 an elfcpp:Ehdr as parameter.
8376 * target.cc: Include dynobj.h.
8377 (Target::do_make_elf_object_implementation): New.
8378 (Target::do_make_elf_object): New.
8379 * target.h (Target::make_elf_object): New template declaration.
8380 (Target::do_make_elf_object): New method declarations.
8381 (Target::do_make_elf_object_implementation): New template declaration.
8383 2009-08-14 Ian Lance Taylor <iant@google.com>
8385 * gold.h (FUNCTION_NAME): Define.
8386 (gold_unreachable): Use FUNCTION_NAME.
8388 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8390 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8391 symbol in the --keep-unique list is not found.
8393 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8395 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8396 been maked as --keep-unique.
8397 (Icf::unfold_section): New function.
8398 * icf.h (Icf::unfold_section): New function.
8399 * options.h (General_options::keep_unique): New option.
8400 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8401 * testsuite/Makefile.in: Regenerate.
8402 * testsuite/icf_keep_unique_test.sh: New file.
8403 * testsuite/icf_keep_unique_test.cc: New file.
8405 2009-08-12 Cary Coutant <ccoutant@google.com>
8408 * resolve.cc (Symbol_table::resolve): Check for references from
8409 dynamic objects to hidden and internal symbols.
8410 * testsuite/Makefile.am (hidden_test.sh): New test.
8411 * testsuite/Makefile.in: Regenerate.
8412 * testsuite/hidden_test.sh: New script.
8413 * testsuite/hidden_test_1.c: New test source.
8414 * testsuite/hidden_test_main.c: New test source.
8416 2009-08-11 Doug Kwan <dougkwan@google.com>
8418 * arm.cc: Update comments.
8419 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8420 segment to locate the .ARM.exidx section if present.
8422 2009-08-09 Doug Kwan <dougkwan@google.com>
8424 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8427 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8428 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8431 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8433 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8434 valid tls_segment only for non-debug-section relocations.
8435 * testsuite/Makefile.am: Add gc_tls_test.
8436 * testsuite/Makefile.in: Regenerate.
8437 * testsuite/gc_tls_test.cc: New file.
8438 * testsuite/gc_tls_test.sh: New file.
8440 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8444 * Makefile.am (CCFILES): Add icf.cc.
8446 * Makefile.in: Regenerate.
8447 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8448 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8449 section, symbol and addend information for the relocs.
8450 * gold.cc (queue_middle_tasks): Call identical code folding.
8451 * gold.h: Add defines for multimap.
8452 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8453 to the call of finalize_local_symbols.
8454 * main.cc (main): Create object of class Icf.
8455 * object.cc (Sized_relobj::do_layout): Allow this function to be
8456 called twice during icf.
8457 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8458 to sections marked as identical by icf.
8459 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8461 (Sized_relobj::do_section_entsize): New function.
8462 * object.h (Object::section_entsize): New function.
8463 (Object::do_section_entsize): New pure virtual function.
8464 (Relobj::finalize_local_symbols): Add new parameter.
8465 (Relobj::do_section_entsize): New function.
8466 * options.h (General_options::icf): New option.
8467 (General_options::icf_iterations): New option.
8468 (General_options::print_icf_sections): New option.
8469 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8470 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8471 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8473 * symtab.cc (Symbol_table::is_section_folded): New function.
8474 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8475 to sections marked as identical by icf.
8476 * symtab.h (Symbol_table::set_icf): New function.
8477 (Symbol_table::icf): New function.
8478 (Symbol_table::is_section_folded): New function.
8479 (Symbol_table::icf_): New data member.
8480 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8481 * testsuite/Makefile.am: Add commands to build icf_test.
8482 * testsuite/Makefile.in: Regenerate.
8483 * testsuite/icf_test.sh: New file.
8484 * testsuite/icf_test.cc: New file.
8486 2009-07-24 Chris Demetriou <cgd@google.com>
8488 * layout.cc (is_compressible_debug_section): Fix incorrect
8489 comment about compressed section names.
8491 2009-07-20 Ian Lance Taylor <ian@airs.com>
8494 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8496 2009-07-16 Ian Lance Taylor <iant@google.com>
8499 * layout.h: #include <map>.
8500 (class Kept_section): Change from struct to class. Add accessors
8501 and setters. Add section size to Comdat_group mapping. Change
8502 Comdat_group to std::map. Add is_comdat_ field. Add
8503 linkonce_size field in union.
8504 (class Layout): Update declaration of find_or_add_kept_section.
8505 Don't declare find_kept_object.
8506 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8507 parameter. Add object, shndx, is_comdat, and is_group_name
8508 parameters. Change all callers. Adjust for new Kept_section.
8509 (Layout::find_kept_object): Remove.
8510 * object.cc (Sized_relobj::include_section_group): Update use of
8511 Kept_section. Rename secnum to shndx. Only record
8512 Kept_comdat_section if sections are the same size.
8513 (Sized_relobj::include_linkonce_section): Update use of
8514 Kept_section. Only record Kept_comdat_section if sections are the
8515 same size. Set size of linkonce section.
8516 (Sized_relobj::map_to_kept_section): Update call to
8517 get_kept_comdat_section.
8518 * object.h (class Sized_relobj): Rename fields in
8519 Kept_comdat_section to drop trailing underscores; change object
8520 field to Relobj*. Change Kept_comdat_section_table to store
8521 struct rather than pointer.
8522 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8523 Add kept_object and kept_shndx parameters. Change all callers.
8524 (Sized_relobj::get_kept_comdat_section): Change return type to
8525 bool. Add kept_object and kept_shndx parameters. Change all
8527 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8528 Layout::find_or_add_kept_section.
8530 2009-07-09 Ian Lance Taylor <iant@google.com>
8532 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8533 Reserve space in the hash table.
8535 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8537 * fileread.cc (File_read::get_mtime): New method.
8538 * fileread.h (Timespec): New structure.
8539 (File_read::get_mtime): New method.
8540 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8541 Renamed from timestamp_nsec.
8542 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8544 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8546 (Incremental_inputs::report_archive): Save mtime; style fix.
8547 (Incremental_inputs::report_obejct): Save mtime; style fix.
8548 (Incremental_inputs::report_script): Save mtime; style fix.
8549 (Incremental_inputs::finalize_inputs): Style fix.
8550 (Incremental_inputs::finalize): Style fix.
8551 (Incremental_inputs::create_input_section_data): Store inputs
8553 * incremental.h (Incremental_inputs::report_script): Add mtime
8555 (Incremental_inputs::Input_info::Input_info): Intialize only one
8557 (Incremental_inputs::Input_info::archive): Move to nameless
8559 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8560 (Incremental_inputs::Input_info::script): Move to nameless union.
8561 (Incremental_inputs::mtime): New field.
8562 * script.cc (read_input_script): Pass file mtime to
8564 * script.h (Script_info::inputs): Style fix.
8566 2009-07-01 Ian Lance Taylor <ian@airs.com>
8568 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8571 2009-06-24 Ian Lance Taylor <iant@google.com>
8574 * layout.cc (Layout::choose_output_section): If we find an
8575 existing section, update the flags.
8576 (Layout::create_notes): New function, broken out of
8578 (Layout::finalize): Don't create note sections.
8579 (Layout::create_note): Don't crash if linker script discards
8581 (Layout::create_gold_note): Likewise.
8582 (Layout::create_build_id): Likewise. Don't set
8583 after_input_sections on the section.
8584 (Layout::create_executable_stack_info): Remove target parameter.
8586 * layout.h (class Layout): Declare create_notes. Update
8587 declaration of create_executable_stack_info.
8588 * gold.cc (queue_middle_tasks): Call create_notes.
8589 * output.cc (Output_section::update_flags_for_input_section): Move
8590 here from output.h. If SHF_ALLOC flag is newly set, mark address
8592 * output.h (Output_data::mark_address_invalid): New function.
8593 (class Output_section): Only declare, not define,
8594 update_flags_for_input_section. Remove set_flags.
8596 2009-06-24 Ian Lance Taylor <iant@google.com>
8598 * script-sections.cc (Output_section_definition::
8599 set_section_addresses): Rename shadowing local load_address to
8602 2009-06-24 Ian Lance Taylor <iant@google.com>
8605 * reloc.cc (relocate_sections): Skip empty relocation sections.
8607 2009-06-23 Ian Lance Taylor <iant@google.com>
8610 * layout.cc (Layout::create_note): Use choose_output_section
8611 rather than make_output_section.
8613 2009-06-23 Ian Lance Taylor <iant@google.com>
8616 * options.cc (General_options::parse_V): Set printed_version_.
8617 (General_options::General_options): Initialize printed_version_.
8618 * options.h (class General_options): Add printed_version_ field.
8619 * gold.cc (queue_initial_tasks): If there are no input files,
8620 don't give a fatal error if we printed the version information.
8621 (queue_middle_tasks): If using -r with a shared object, give a
8622 fatal error rather than an ordinary error.
8624 2009-06-23 Ian Lance Taylor <iant@google.com>
8627 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8628 (Layout::make_output_section): Set have_stabstr_section_ if we see
8629 a .stab*str section.
8630 (Layout::finalize): Call link_stabs_sections.
8631 (Layout::link_stabs_sections): New file.
8632 * layout.h (class Layout): Add have_stabstr_section_ field.
8633 Declare link_stabs_sections.
8635 2009-06-23 Doug Kwan <dougkwan@google.com>
8637 * Makefile.am (libgold_a_LIBADD): New.
8638 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8639 * Makefile.in: Regenerate.
8640 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8641 * configure: Regenerate.
8642 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8643 * fileread.cc: Include sys/state.h
8644 * gold.h: Declare memmem and strndup if found missing.
8645 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8647 2009-06-23 Ian Lance Taylor <iant@google.com>
8649 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8650 * configure: Rebuild.
8652 2009-06-23 Ian Lance Taylor <iant@google.com>
8655 * object.cc (Object::section_contents): Don't try to get a view if
8656 the section has length zero.
8657 (Object::handle_gnu_warning_section): If the section is empty, use
8658 the name of the section as the warning.
8660 2009-06-23 Ian Lance Taylor <iant@google.com>
8663 * stringpool.h (class Stringpool_template): Add optimize_ field.
8664 (Stringpool_template::set_optimize): New function.
8665 * stringpool.cc (Stringpool_template::Stringpool_template):
8666 Initialize optimize_ field.
8667 (Stringpool_template::set_string_offsets): Test local optimize
8668 fild rather than parameter.
8669 * layout.cc (Layout::Layout): Call set_optimize on the section
8672 2009-06-22 Ian Lance Taylor <iant@google.com>
8675 * yyscript.y: Parse TARGET.
8676 * script.cc (script_set_target): New function.
8677 * script-c.h (script_set_target): Declare.
8678 * options.cc (General_options::string_to_object_format): Rename
8679 from string_to_object_format in anonymous namespace. Change
8681 * options.h (class General_options): Declare
8682 string_to_object_format.
8684 2009-06-22 Ian Lance Taylor <iant@google.com>
8686 * script-sections.cc (Script_sections::create_segments): Don't put
8687 program headers in a PT_LOAD segment if -n or -N.
8689 2009-06-22 Ian Lance Taylor <iant@google.com>
8692 * options.h (class General_options): Add -z lazy and -z now. Sort
8693 -z options into alphabetical order.
8694 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8696 2009-06-21 Ian Lance Taylor <iant@google.com>
8698 * layout.cc (Layout::make_output_section): Call
8699 Target::new_output_section.
8700 (Layout::attach_allocated_section_to_segment): Put large section
8701 sections in a separate load segment with the large segment flag
8703 (Layout::segment_precedes): Sort large data segments after other
8705 (align_file_offset): New static function.
8706 (Layout::set_segment_offsets): Use align_file_offset.
8707 * output.h (class Output_section): Add is_small_section_ and
8708 is_large_section_ fields.
8709 (Output_section::is_small_section): New function.
8710 (Output_section::set_is_small_section): New function.
8711 (Output_section::is_large_section): New function.
8712 (Output_section::set_is_large_section): New function.
8713 (Output_section::is_large_data_section): New function.
8714 (class Output_segment): Add is_large_data_segment_ field.
8715 (Output_segment::is_large_data_segment): New function.
8716 (Output_segment::set_is_large_data_segment): New function.
8717 * output.cc (Output_section::Output_section): Initialize new
8719 (Output_segment::Output_segment): Likewise.
8720 (Output_segment::add_output_section): Add assertion that large
8721 data sections always go in large data segments. Force small data
8722 sections to the end of the list of data sections. Force small BSS
8723 sections to the start of the list of BSS sections. For large BSS
8724 sections to the end of the list of BSS sections.
8725 * symtab.h (class Symbol): Declare is_common_shndx.
8726 (Symbol::is_defined): Check Symbol::is_common_shndx.
8727 (Symbol::is_common): Likewise.
8728 (class Symbol_table): Define enum Commons_section_type. Update
8729 declarations. Add small_commons_ and large_commons_ fields.
8730 * symtab.cc (Symbol::is_common_shndx): New function.
8731 (Symbol_table::Symbol_table): Initialize new fields.
8732 (Symbol_table::add_from_object): Put small and large common
8733 symbols in the right list.
8734 (Symbol_table::sized_finalized_symbol): Check
8735 Symbol::is_common_shndx.
8736 (Symbol_table::sized_write_globals): Likewise.
8737 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8738 common symbol lists. Don't call do_allocate_commons_list if the
8740 (Symbol_table::do_allocate_commons_list): Remove is_tls
8741 parameter. Add comons_section_type parameter. Change all
8742 callers. Handle small and large common symbols.
8743 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8744 Symbol::is_common_shndx.
8745 * resolve.cc (symbol_to_bits): Likewise.
8746 * target.h (Target::small_common_shndx): New function.
8747 (Target::small_common_section_flags): New function.
8748 (Target::large_common_shndx): New function.
8749 (Target::large_common_section_flags): New function.
8750 (Target::new_output_section): New function.
8751 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8752 small_common_section_flags, and large_common_section_flags
8754 (Target::do_new_output_section): New virtual function.
8755 * arm.cc (Target_arm::arm_info): Initialize new fields.
8756 * i386.cc (Target_i386::i386_info): Likewise.
8757 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8759 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8760 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8761 (Target_x86_64::do_new_output_section): New function.
8762 * configure.ac: Define conditional MCMODEL_MEDIUM.
8763 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8764 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8765 (large_LDFLAGS): Define.
8766 * testsuite/large.c: New file.
8767 * testsuite/testfile.cc (Target_test::test_target_info):
8768 Initialize new fields.
8769 * configure, testsuite/Makefile.in: Rebuild.
8771 2009-06-05 Doug Kwan <dougkwan@google.com>
8773 * Makefile.am (CCFILES): Add target.cc.
8774 * Makefile.in: Regenerate.
8775 * i386.cc (class Target_i386): Define new virtual method to
8776 override do_is_local_label_name in parent.
8777 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8778 local symbols if --discard-locals or -X is given.
8779 * options.h (class General_options): Declare new options
8780 '--discard-locals' and '-X' for discarding locals.
8781 * target.h (class Target): Define new methods is_local_label_name.
8782 Declare new virtual method do_is_local_label_name.
8783 * target.cc: New file.
8784 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8785 (check_SCRIPTS): Add discard_locals_test.sh.
8786 (check_DATA): Add discard_local_tests.syms.
8787 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8788 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8789 * testsuite/Makefile.in: Regenerate.
8790 * testsuite/discard_locals_test.c: New file.
8791 * testsuite/discard_locals_test.sh: Same.
8793 2009-06-05 Doug Kwan <dougkwan@google.com>
8795 * object.cc (Sized_relobj::Sized_relobj): Initialize
8796 discarded_eh_frame_shndx_ to -1U.
8797 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8799 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8800 a discarded .eh_frame section.
8801 (Sized_relobj::do_finalize_local_symbols): Ditto.
8802 * object.h (class Sized_relobj): Declare new member
8803 discarded_eh_frame_shndx_.
8804 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8805 (local_labels_test.o, local_labels_test): New rules.
8806 * testsuite/Makefile.in: Regenerate.
8808 2009-06-04 Doug Kwan <dougkwan@google.com>
8810 * layout.cc (Layout::section_name_mapping): Add mapping for
8811 special ARM sections.
8813 2009-06-03 Doug Kwan <dougkwan@google.com>
8815 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8816 (utils::has_overflow): Same.
8818 2009-06-03 Ian Lance Taylor <iant@google.com>
8820 * layout.cc (Layout::section_name_mapping): New array, replacing
8821 Layout::linkonce_mapping.
8822 (Layout::section_name_mapping_count): New variable, replacing
8823 Layout::linkonce_mapping_count.
8824 (Layout::linkonce_output_name): Remove.
8825 (Layout::output_section_name): Rewrite.
8826 * layout.h (class Layout): Rename Linkonce_mapping to
8827 Section_name_mapping, linkonce_mapping to section_name_mapping,
8828 linkonce_mapping_count to section_name_mapping_count. Don't
8829 declare linkonce_output_name.
8831 2009-06-03 Doug Kwan <dougkwan@google.com>
8833 * gold/arm.cc (namespace utils): New.
8834 (Target_arm::reloc_is_non_pic): Define new method.
8835 (class Arm_relocate_functions): New.
8836 (Target_arm::Relocate::relocate): Handle relocation types used by
8839 2009-06-03 Ian Lance Taylor <iant@google.com>
8841 * arm.cc (Target_arm::scan::global): Use || instead of |.
8843 2009-06-02 Doug Kwan <dougkwan@google.com>
8845 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8846 issued_non_pic_error_.
8847 (class Target_arm::Scan): Declare new method check_non_pic.
8848 Define new method symbol_needs_plt_entry.
8849 Declare new data member issued_non_pic_error_.
8850 (class Target_arm::Relocate): Declare new method
8851 should_apply_static_reloc.
8852 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8853 (Target_arm::Scan::check_non_pic): Define new method.
8854 (Target_arm::Scan::local): Handle a small subset of reloc types used
8856 (Target_arm::Scan::local): Same.
8857 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8859 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8861 * incremental.cc (Incremental_inputs::report_command_line): Filter
8862 out --incremental-* options.
8864 2009-05-29 Doug Kwan <dougkwan@google.com>
8866 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8868 (class Target_arm): Update comment.
8869 (Target_arm::Target_arm): Initialize new data members GOT_,
8870 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8871 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8872 and Target_arm::rel_dyn_section.
8873 Declare new_enum Target_arm::Got_type.
8874 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8876 Update commments for member do_dynsym_value.
8877 (Target_arm::got_size, Target_arm::plt_section,
8878 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8879 new methods inside class defintion.
8880 (Target_arm::got_section): Define new method.
8881 (Target_arm::rel_dyn_section): Same.
8882 (Output_data_plt_arm): New template class.
8883 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8884 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8885 (Output_data_plt_arm::add_entry): Same.
8886 (Output_data_plt_arm::first_plt_entry): Define new
8887 static data member for PLT instruction template.
8888 (Output_data_plt_arm::plt_entry): Same.
8889 (Output_data_plt_arm::do_write): Define new method.
8890 (Target_arm::make_plt_entry): Same.
8891 (Target_arm::do_finalize_sections): Same.
8892 (Target_arm::do_dynsym_value): Same.
8894 2009-05-28 Doug Kwan <dougkwan@google.com>
8896 * Makefile.am (TARGETSOURCES): Add arm.cc.
8897 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8898 * Makefile.in: Regenerate.
8900 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8902 2009-05-26 Doug Kwan <dougkwan@google.com>
8904 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8905 (General_options::check_excluded_libs): Strip off directories in
8906 archive name before matching like GNU ld does.
8907 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8908 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8909 (exclude_libs_test_LDFLAGS): Add linker option
8910 -Wl,--exclude-libs,libexclude_libs_test_3
8911 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8912 an explicit archive without using -l.
8913 (alt/libexclude_libs_test_3.a): New make rule.
8914 * testsuite/Makefile.in: Regenerate.
8915 * testsuite/exclude_libs_test.c : Declare lib3_default().
8917 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8918 * exclude_libs_test_3.c: New file.
8920 2009-05-26 Nick Clifton <nickc@redhat.com>
8922 * po/id.po: New Indonesian translation.
8923 * po/gold.pot: Updated template file.
8925 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8927 * testsuite/Makefile.am: Add -ffunction-sections to compile
8928 gc_comdat_test files. Add -Wl,--gc-sections to build
8930 * testsuite/Makefile.in: Regenerate.
8931 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8933 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8935 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8936 kept comdat section was garbage collected.
8937 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8938 * testsuite/Makefile.in: Regenerate.
8939 * testsuite/gc_comdat_test.sh: New file.
8940 * testsuite/gc_comdat_test_1.cc: New file.
8941 * testsuite/gc_comdat_test_2.cc: New file.
8943 2009-05-19 Doug Kwan <dougkwan@google.com>
8945 * archive.cc (Archive::Archive): Move constructor from archive.h
8946 to here. Initialize no_export_.
8947 (Archive::get_elf_object_for_member): Set no_export flag of object.
8948 * archive.h (Archive::Archive): Move constructor body to
8950 (Archive::no_export): New method.
8951 (Archive::no_export_): New field.
8952 * object.h (Object::Object): Initialize no_export_ to false.
8953 (Object::no_export, Object::set_no_export): New methods.
8954 (Object::no_export_): New field.
8955 * options.cc (General_options::parse_exclude_libs): New method.
8956 (General_options::check_excluded_libs) Same.
8957 * options.h (exclude_libs): New option.
8958 (General_options::check_excluded_libs): New method declaration.
8959 (General_options::excluded_libs_): New field.
8960 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8961 default or protected visibility if an object has no-export flag set.
8962 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8963 (check_SCRIPTS): Add exclude_libs_test.sh.
8964 (check_DATA): Add exclude_libs_test.syms.
8965 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8966 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8967 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8968 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8969 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8970 libexclude_libs_test_2.a): New rules.
8971 * testsuite/Makefile.in: Regenerate.
8972 * testsuite/exclude_libs_test.c: New file.
8973 * testsuite/exclude_libs_test.sh: Ditto.
8974 * testsuite/exclude_libs_test_1.c: Ditto.
8975 * testsuite/exclude_libs_test_2.c: Ditto.
8977 2009-05-15 Ian Lance Taylor <iant@google.com>
8979 * configure.ac: Check for declarations for cases where libiberty.h
8980 checks HAVE_DECL_xxx.
8981 * configure, config.in: Rebuild.
8983 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8985 * gold.h (Incremental_argument_list): Remove (invalid) forward
8987 * incremental.cc (Incremental_inputs::report_achive): New method.
8988 (Incremental_inputs::report_object): New method.
8989 (Incremental_inputs::report_script): New method.
8990 (Incremental_inputs::finalize_inputs): New method.
8991 (Incremental_inputs::finalize): Call finalize_inputs().
8992 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8993 Create inputs entries.
8994 * incremental.h (Incremental_input_type): New enum.
8995 (Incremental_inputs::Incremental_input): Initialize new fields.
8996 (Incremental_inputs::report_inputs): New method.
8997 (Incremental_inputs::report_achive): New method.
8998 (Incremental_inputs::report_object): New method.
8999 (Incremental_inputs::report_script): New method.
9000 (Incremental_inputs::finalize_inputs): New method.
9001 (Incremental_inputs::Input_info): New struct.
9002 (Incremental_inputs::Input_info_map): New typedef.
9003 (Incremental_inputs::lock_): New field.
9004 (Incremental_inputs::Inputs_): New field.
9005 (Incremental_inputs::Inputs_map): New field.
9006 * main.cc (main): Call Incremental_input::report_inputs.
9007 * options.h (Input_argument_list): Typedef moved from
9009 (Input_file_group::Files): Remove, use ::Input_argument_list.
9010 (Input_file_group::Input_argument_list): Remove, use
9011 ::Input_argument_list.
9012 * plugin.cc (Plugin_manager::add_input_file): Add error in
9014 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9016 * script.cc (read_input_script): Call
9017 Incremental_input::report_script.
9018 * script.h (Script_info): New class.
9020 2009-04-27 Ian Lance Taylor <iant@google.com>
9022 * x86_64.cc (do_adjust_output_section): Set entsize to
9025 2009-04-23 Elliott Hughes <enh@google.com>
9027 * output.cc (Output_file::close): After short writes, continue
9028 writing from the correct offset in the buffer being written.
9030 2009-04-23 Chris Demetriou <cgd@google.com>
9032 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9033 * configure: Regenerate.
9034 * config.in: Regenerate.
9035 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9036 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9038 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9040 * incremental.cc (Incremental_inputs_header_data): Renamed from
9041 Incremental_input_header_data.
9042 (Incremental_inputs_header_data::data_size): New field.
9043 (Incremental_inputs_header_data::put_input_file_count): Renamed
9044 from input_file_count.
9045 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9046 from command_line_offset.
9047 (Incremental_inputs_header_data::put_reserved): Renamed from
9049 (Incremental_inputs_entry_data): Renamed from
9050 Incremental_input_entry_data.
9051 (Incremental_inputs_entry_data::data_size): New field.
9052 (Incremental_inputs::report_command_line): New method.
9053 (Incremental_inputs::finalize): New method.
9054 (Incremental_inputs::create_incremental_inputs_data): New method.
9055 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9056 * incremental.h: New file.
9057 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9058 (Layout::finalize): Create incremental inputs section in
9060 (Layout::create_incremental_info_sections): New method.
9061 * layout.h (Layout::incremental_inputs): New method.
9062 (Layout::create_incremental_info_sections): New method.
9063 (Layout::incremental_inputs_): New field.
9064 * main.cc (main): Notify Incremental_input of the command line.
9066 2009-04-01 Ian Lance Taylor <iant@google.com>
9067 Mikolaj Zalewski <mikolajz@google.com>
9069 * gold.h (reserve_unordered_map): Define, three versions, one for
9070 each version of Unordered_map.
9071 * layout.cc (Layout::Layout): Remove options parameter. Add
9072 number_of_input_files parameter. Don't initialize options_.
9073 Initialize number_of_input_files_ and resized_signatures_. Move
9074 sections_are_attached_.
9075 (Layout::layout_group): Reserve space for group_signatures_.
9076 (Layout::find_or_add_kept_section): Change name parameter to be a
9077 reference. Resize signatures_ map when it gets large enough.
9078 (Layout::layout_eh_frame): Use parameters->options() instead of
9080 (Layout::make_output_section): Likewise.
9081 (Layout::attach_allocated_section_to_segment): Likewise.
9082 (Layout::finalize, Layout::create_executable_stack): Likewise.
9083 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9084 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9085 * layout.h (class Layout): Update declarations. Remove options_
9086 field. Add number_of_input_files_ and resized_signatures_
9087 fields. Move sections_are_attached_ field.
9088 * main.cc (main): Pass number of input files to Layout
9089 constructor. Don't pass options.
9091 2009-03-30 Ian Lance Taylor <iant@google.com>
9093 * ffsll.c (ffsll): Correct implementation.
9095 2009-03-27 Ian Lance Taylor <iant@google.com>
9097 * ffsll.c: New file.
9098 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9099 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9100 * ftruncate.c (ftruncate): Declare before definition.
9101 * mremap.c (mremap): Likewise.
9102 * pread.c (pread): Likewise.
9103 * configure, Makefile.in, config.in: Rebuild.
9105 * mremap.c: New file.
9106 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9107 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9108 (mremap): Declare if HAVE_MREMAP is not defined.
9109 * configure, Makefile.in, config.in: Rebuild.
9111 2009-03-27 Cary Coutant <ccoutant@google.com>
9113 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9114 position independent.
9115 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9116 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9118 2009-03-24 Cary Coutant <ccoutant@google.com>
9120 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9122 (needs_dynamic_reloc): Likewise.
9124 2009-03-24 Ian Lance Taylor <iant@google.com>
9126 * yyscript.y (file_cmd): Recognize EXTERN.
9127 (extern_name_list, extern_name_list_body): New nonterminals.
9128 * script.cc (script_add_extern): Define.
9129 * script-c.h (script_add_extern): Declare.
9131 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9133 * object.cc (is_elf_object): Define.
9134 * object.h (is_elf_object): Declare.
9135 * archive.cc (Archive::get_elf_object_for_member): Call
9137 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9139 2009-03-24 Elliott Hughes <enh@google.com>
9141 * output.cc (Output_file::map_anonymous): Define.
9142 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9143 try an anonymous one. Report the size if the mmap fails.
9144 * output.h (class Output_file): Declare map_anonymous.
9146 2009-03-24 Ian Lance Taylor <iant@google.com>
9148 * target-select.cc (instantiate_target): Don't acquire the lock if
9149 the instantiated_target_ field has already been set.
9151 2009-03-23 Ian Lance Taylor <iant@google.com>
9153 * gold-threads.h (class Initialize_lock): Define.
9154 * gold-threads.cc (class Initialize_lock_once): Define.
9155 (initialize_lock_control): New static variable.
9156 (initialize_lock_pointer): New static variable.
9157 (initialize_lock_once): New static function.
9158 (Initialize_lock::Initialize_lock): Define.
9159 (Initialize_lock::initialize): Define.
9160 * target-select.h: Include "gold-threads.h".
9161 (class Target_selector): Add lock_ and initialize_lock_ fields.
9162 Don't define instantiate_target, just declare it.
9163 * target-select.cc (Target_selector::Target_selector): Initialize
9165 (Target_selector::instantiate_target): Define.
9166 * descriptors.h: Include "gold-threads.h".
9167 (class Descriptors): Add initialize_lock_ field.
9168 * descriptors.cc (Descriptors::Descriptors): Initialize new
9170 (Descriptors::open): Use initialize_lock_ field
9171 * errors.h (class Errors): Add initialize_lock_ field.
9172 * errors.cc (Errors::Errors): Initialize new field.
9173 (Errors::initialize_lock): Use initialize_lock_ field.
9174 * powerpc.cc (class Target_selector_powerpc): Remove
9175 instantiated_target_ field. In do_recognize call
9176 instantiate_target rather than do_instantiate_target. In
9177 do_instantiate_target just allocate a new target.
9178 * sparc.cc (class Target_selector_sparc): Likewise.
9180 * freebsd.h: New file.
9181 * i386.cc: Include "freebsd.h".
9182 (Target_i386): Derive from Target_freebsd rather than
9184 (Target_selector_i386): Derive from Target_selector_freebsd rather
9185 than Target_selector.
9186 * x86_64.cc: Include "freebsd.h".
9187 (Target_x86_64): Derive from Target_freebsd rather than
9189 (Target_selector_x86_64): Derive from Target_selector_freebsd
9190 rather than Target_selector.
9191 * target.h (class Target): Add adjust_elf_header and
9192 do_adjust_elf_header.
9193 * output.cc (Output_file_header:: do_sized_write): Call target
9194 adjust_elf_header routine.
9195 * configure.tgt: Set targ_osabi.
9196 * configure.ac: Define GOLD_DEFAULT_OSABI.
9197 * parameters.cc (Parameters::default_target): Pass
9198 GOLD_DEFAULT_OSABI to select_target.
9199 * target-select.h (class Target_selector): Make instantiate_target
9200 protected rather than private.
9201 * Makefile.am (HFILES): Add freebsd.h.
9202 * configure, Makefile.in, config.in: Rebuild.
9204 * merge.cc (do_add_input_section): Correct pend value. Change
9205 message about last entry not being null terminated from error to
9208 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9210 * incremental.cc: New file.
9211 * Makefile.am (CCFILES): Add incremental.cc.
9212 * Makefile.in: Rebuild.
9214 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9216 * layout.cc (Layout::output_section_name): Preserve names
9217 of '.note.' sections.
9219 2009-03-19 Ian Lance Taylor <iant@google.com>
9221 * descriptors.cc (Descriptors::open): Check that the options are
9222 valid before using them.
9224 2009-03-18 Ian Lance Taylor <iant@google.com>
9226 * script-sections.h: Include <list>.
9227 (class Script_sections): Change Sections_elements from std::vector
9228 to std::list. Typedef public Elements_iterator. Add
9229 orphan_section_placement_, data_segment_align_start_, and
9230 saw_data_segment_align_ fields. Remove data_segment_align_index_
9232 * script-sections.cc (class Orphan_section_placement): New class.
9233 (class Sections_element): Add virtual functions is_relro and
9234 orphan_section_init. Remove virtual function place_orphan_here.
9235 (class Output_section_definition): Add is_relro and
9236 orphan_section_init. Remove place_orphan_here.
9237 (class Orphan_output_section): Likewise.
9238 (Script_sections::Script_sections): Update for field changes.
9239 (Script_sections::data_segment_align): Set saw_data_segment_align_
9240 and data_segment_align_start_, not data_segment_align_index.
9241 (Script_sections::data_segment_relro_end): Check
9242 saw_data_segment_align_. Use data_segment_align_start_ rather
9243 than data_segment_align_index_.
9244 (Script_sections::place_orphan): Rewrite to use
9245 Orphan_section_placement.
9247 2009-03-17 Ian Lance Taylor <iant@google.com>
9249 * archive.cc (Archive::add_symbols): Check for a version attached
9250 to the symbol name in the archive map.
9251 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9252 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9253 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9254 (ver_test_11.a): New target.
9255 * testsuite/Makefile.in: Rebuild.
9257 * configure.ac: Check for chsize and posix_fallocate. Replace
9259 * ftruncate.c: New file, from gnulib.
9260 * output.cc (posix_fallocate): Define dummy version if not
9261 HAVE_POSIX_FALLOCATE.
9262 (Output_file::map): Call posix_fallocate rather than lseek and
9264 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9265 * configure, Makefile.in, config.in: Rebuild.
9267 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9269 * layout.h (Layout::create_note): Add section_name parameter.
9270 * layout.cc (Layout::create_note): Likewise.
9271 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9273 2009-03-17 Ian Lance Taylor <iant@google.com>
9275 * descriptors.cc: Include "options.h".
9276 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9277 (Descriptors::open): Always use O_CLOEXEC when opening a new
9278 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9279 then set FD_CLOEXEC.
9281 * sparc.cc (class Target_sparc): Add has_got_section.
9282 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9283 make sure we have a GOT section.
9285 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9286 (Target_sparc::Scan::local): Likewise.
9287 (Target_sparc::Scan::global): Likewise.
9288 (Target_sparc::Relocate::relocate): Likewise.
9289 (Target_sparc::Relocate::relocate_tls): Likewise.
9291 * symtab.cc (Symbol_table::define_default_version): New function,
9292 broken out of add_from_object.
9293 (Symbol_table::add_from_object): Call define_default_version.
9294 (Symbol_table::define_special_symbol): Add resolve_oldsym
9295 parameter. Change all callers. If the version for a symbol comes
9296 from a version script, resolve it with the symbol with the same
9297 name with no version. Also add the symbol without a version if
9299 (do_define_in_output_data): If resolving with oldsym, don't delete
9301 (do_define_in_output_segment): Likewise.
9302 (do_define_as_constant): Likewise.
9303 * symtab.h (class Symbol_table): Update declarations.
9305 2009-03-13 Ian Lance Taylor <iant@google.com>
9307 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9308 (Read_symbols::requeue): New function.
9309 (Read_symbols::do_read_symbols): If make_elf_object fails because
9310 the target type is not configured, and the file was searched for,
9311 issue a warning and retry with the next directory.
9312 (Add_symbols::run): If the file has an incompatible format, and
9313 it was searched for, requeue the Read_symbols task. On error,
9315 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9316 dirindex parameter to constructor. Change all callers. Declare
9317 incompatible_warning and requeue.
9318 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9319 input_argument_ and input_group_ fields. Add them to
9320 constructor. Change all callers.
9321 (class Read_script): Add dirindex_ field. Add it to constructor.
9323 * archive.cc (Archive::setup): Remove input_objects parameter.
9325 (Archive::get_file_and_offset): Likewise.
9326 (Archive::read_all_symbols): Likewise.
9327 (Archive::read_symbols): Likewise.
9328 (Archive::get_elf_object_for_member): Remove input_objects
9329 parameter. Add punconfigured parameter. Change all callers.
9330 (Archive::add_symbols): Change return type to bool. Check return
9331 value of include_member.
9332 (Archive::include_all_members): Likewise.
9333 (Archive::include_member): Change return type to bool. Return
9334 false if first included object has incompatible target. Set
9335 included_member_ field.
9336 (Add_archive_symbols::run): If add_symbols returns false, requeue
9338 * archive.h (class Archive): Add included_member_ field.
9339 Initialize it in constructor. Add input_file and searched_for
9340 methods. Update declarations.
9341 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9342 input_argument_ fields. Add them to constructor. Change all
9344 * script.cc: Include "target-select.h".
9345 (class Parser_closure): Add skip_on_incompatible_target_ and
9346 found_incompatible_target_ fields. Add
9347 skip_on_incompatible_target parameter to constructor. Change all
9348 callers. Add methods skip_on_incompatible_target,
9349 clear_skip_on_incompatible_target, found_incompatible_target, and
9350 set_found_incompatible_target.
9351 (read_input_script): Add dirindex parameter. Change all callers.
9352 If parser finds an incompatible target, requeue Read_symbols
9354 (script_set_symbol): Clear skip_on_incompatible_target in
9356 (script_add_assertion, script_parse_option): Likewise.
9357 (script_start_sections, script_add_phdr): Likewise.
9358 (script_check_output_format): New function.
9359 * script.h (read_input_script): Update declaration.
9360 * script-c.h (script_check_output_format): Declare.
9361 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9362 (ignore_cmd): Remove OUTPUT_FORMAT.
9363 * fileread.cc (Input_file::Input_file): Add explicit this.
9364 (Input_file::will_search_for): New function.
9365 (Input_file::open): Add pindex parameter. Change all callers.
9366 * fileread.h (class Input_file): Add input_file_argument method.
9367 Declare will_search_for. Update declarations.
9368 * object.cc (make_elf_object): Add punconfigured parameter.
9370 * object.h (class Object): Make input_file public. Add
9371 searched_for method.
9372 (make_elf_object): Update declaration.
9373 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9375 * dirsearch.h (class Dirsearch): Update declaration.
9376 * options.h (class General_options): Add --warn-search-mismatch.
9377 * parameters.cc (Parameters::is_compatible_target): New function.
9378 * parameters.h (class Parameters): Declare is_compatible_target.
9379 * workqueue.cc (Workqueue::add_blocker): New function.
9380 * workqueue.h (class Workqueue): Declare add_blocker.
9382 * fileread.cc (Input_file::open): Remove options parameter.
9384 (Input_file::open_binary): Likewise.
9385 * script.cc (read_input_script): Likewise.
9386 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9387 options parameter from constructor. Change all callers.
9388 (class Read_script): Likewise.
9389 * fileread.h (class Input_file): Update declarations.
9390 * script.h (read_input_script): Update declaration.
9392 2009-03-10 Nick Clifton <nickc@redhat.com>
9394 * po/es.po: New Spanish translation.
9396 2009-03-06 Cary Coutant <ccoutant@google.com>
9398 * options.cc (parse_short_option): Keep dash_z from registering itself.
9400 2009-03-03 Ian Lance Taylor <iant@google.com>
9403 * target-reloc.h (relocate_section): Pass output_section to
9405 * i386.cc (Target_i386::should_apply_static_reloc): Add
9406 output_section parameter. Change all callers.
9407 (Target_i386::Relocate::relocate): Add output_section parameter.
9408 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9409 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9410 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9411 * testsuite/two_file_shared.sh: New script.
9412 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9413 (check_DATA): Add two_file_shared.dbg.
9414 (two_file_shared.dbg): New target.
9415 * testsuite/Makefile.in: Rebuild.
9417 2009-03-01 Ian Lance Taylor <iant@google.com>
9419 * configure.ac: Check for byteswap.h.
9420 * configure: Rebuild.
9421 * config.in: Rebuild.
9423 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9425 * layout.cc (Layout::find_or_add_kept_section): New function.
9426 (Layout::add_comdat): Removed.
9427 * layout.h (struct Kept_section): Move out of class Layout.
9428 Remove trailing underscores from field names. Add group_sections
9429 field. Rename group_ field to is_group. Change all uses.
9430 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9431 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9432 comdat_groups_ field.
9433 (Sized_relobj::include_section_group): Use
9434 find_or_add_kept_section and Kept_section::group_sections.
9435 (Sized_relobj::include_linkonce_section): Likewise.
9436 * object.cc (class Sized_relobj): Don't define Comdat_group or
9437 Comdat_group_table. Remove find_comdat_group and
9438 add_comdat_group. Remove comdat_groups_ field.
9439 * plugin.cc (include_comdat_group): Use
9440 Layout::find_or_add_kept_section.
9442 2009-02-28 Ian Lance Taylor <iant@google.com>
9444 * README: --gc-sections and map files are now supported. Document
9445 some build requirements.
9448 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9449 relocatable link set the value of the section symbol to zero.
9450 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9451 relocatable link don't include the section address in the local
9454 2009-02-27 Ian Lance Taylor <iant@google.com>
9457 * options.h (class Search_directory): Add is_system_directory.
9458 (class General_options): Declare is_in_system_directory.
9459 * options.cc (get_relative_sysroot): Make static.
9460 (get_default_sysroot): Make static.
9461 (General_optoins::is_in_system_directory): New function.
9462 * fileread.cc (Input_file::is_in_system_directory): New function.
9463 * fileread.h (class Input_file): Declare is_in_system_directory.
9464 * object.h (class Object): Add is_in_system_directory.
9465 (class Input_objects): Remove system_library_directory_ field.
9466 * object.cc (Input_objects::add_object): Don't set
9467 system_library_directory_.
9468 (input_objects::found_in_system_library_directory): Remove.
9469 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9470 parameter. Change all callers.
9471 (Symbol_table::sized_write_globals): Likewise.
9472 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9473 Call Object::is_in_system_directory.
9474 * symtab.h (class Symbol_table): Update declarations.
9477 * descriptors.h (Open_descriptor): Add is_on_stack field.
9478 * descriptors.cc (Descriptors::open): If the descriptor is on the
9479 top of the stack, remove it. Initialize is_on_stack field.
9480 (Descriptors::release): Only add pod to stack if it is not on the
9482 (Descriptors::close_some_descriptor): Clear stack_next and
9486 * output.cc (Output_section::find_starting_output_address): Rename
9487 from starting_output_address; add PADDR parameter; change return
9489 * output.h (class Output_section): Declare
9490 find_starting_output_address instead of starting_output_address.
9491 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9492 section symbol for which we can't find a merge section.
9495 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9496 hidden or internal, force the symbol to be local.
9497 * resolve.cc (Symbol::override_visibility): Define.
9498 (Symbol::override_base): Use override_visibility.
9499 (Symbol_table::resolve): Likewise.
9500 (Symbol::override_base_with_special): Likewise.
9501 (Symbol_table::override_with_special): If the visibility is hidden
9502 or internal, force the symbol to be local.
9503 * symtab.h (class Symbol): Add set_visibility and
9504 override_visibility.
9505 * testsuite/ver_test_1.sh: New file.
9506 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9507 (check_DATA): Add ver_test_1.syms.
9508 (ver_test_1.syms): New target.
9509 * testsuite/Makefile.in: Rebuild.
9511 2009-02-25 Cary Coutant <ccoutant@google.com>
9513 * layout.cc (Layout::choose_output_section): Don't rename sections
9514 when using a linker script that has a SECTIONS clause.
9515 * Makefile.in: Regenerate.
9517 * testsuite/Makefile.am (script_test_5.sh): New test case.
9518 * testsuite/Makefile.in: Regenerate.
9519 * testsuite/script_test_5.cc: New file.
9520 * testsuite/script_test_5.sh: New file.
9521 * testsuite/script_test_5.t: New file.
9523 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9525 * archive.cc (Archive::include_member): Update calls to add_symbols.
9526 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9527 the Layout argument.
9528 * dynobj.h (do_add_symbols): Add the Layout argument.
9529 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9531 * object.h (Object::add_symbols): Add the Layout argument.
9532 (Object::do_add_symbols): Add the Layout argument.
9533 (Sized_relobj::do_add_symbols): Add the Layout argument.
9534 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9535 Unify the two versions.
9536 (Add_plugin_symbols): Remove.
9537 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9538 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9539 (Add_plugin_symbols): Remove.
9540 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9541 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9542 (Add_symbols::run): Make it work with Pulginobj.
9544 2009-02-06 Ian Lance Taylor <iant@google.com>
9546 * object.cc (Sized_relobj::do_layout): Make info message start
9547 with lower case letter.
9549 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9551 * binary.cc: Fix file comment.
9553 * options.h (enum Incremental_disposition): Define.
9554 (class General_options): Add new options: --incremental,
9555 --incremental_changed, --incremental_unchanged,
9556 --incremental_unknown. Add incremental_disposition_ and
9557 implicit_incremental_ fields.
9558 (General_options::incremental_disposition): New function.
9559 (class Position_dependent_options): Add incremental_disposition
9561 (Position_dependent_options::copy_from_options): Set incremental
9563 * options.cc (General_options::parse_incremental_changed): New
9565 (General_options::parse_incremental_unchanged): New function.
9566 (General_options::parse_incremental_unknown): New function.
9567 (General_options::General_options): Initialize new fields
9568 incremental_disposition_ and implicit_incremental_.
9569 (General_options::finalize): Check for uasge of --incremental-*
9570 without --incremental.
9572 2009-02-06 Chris Demetriou <cgd@google.com>
9574 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9575 pointer and to report location as the file name associated with
9577 (gold_undefined_symbol_at_location): New function to replace the
9578 old gold_undefined_symbol functionality.
9579 * target-reloc.h (relocate_section): Update to use
9580 gold_undefined_symbol_at_location.
9581 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9582 Call gold_undefined_symbol function rather than gold_error.
9583 * errors.h (Errors::undefined_symbol): Take location as a
9584 string, rather than calculating it from a relocation.
9585 * errors.cc (Errors::fatal): Print "fatal error:" before the
9587 (Errors::error, Errors::error_at_location): Print "error: "
9588 before the formatted message.
9589 (Errors::undefined_symbol): Take location as a string, rather
9590 than calculating it from a relocation.
9591 (gold_undefined_symbol_at_location): New function akin to
9592 old gold_undefined_symbol, calculates location from relocation.
9593 (gold_undefined_symbol): Change to take only a Symbol pointer
9594 and to report location as the file name associated with the symbol.
9595 * testsuite/debug_msg.sh: Update for changed error messages.
9596 * testsuite/undef_symbol.sh: Likewise.
9598 2009-02-04 Duncan Sands <baldrick@free.fr>
9601 * reduced_debug_output.h
9602 (Output_reduced_debug_abbrev_section::failed): Use format for
9604 (Output_reduced_debug_info_section::faild): Likewise.
9606 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9608 * script.cc (Lazy_demangler): New class.
9609 (Version_script_info::get_symbol_version_helper): Demangle a
9612 2009-01-29 Cary Coutant <ccoutant@google.com>
9614 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9616 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9618 2009-01-28 Ian Lance Taylor <iant@google.com>
9620 * version.cc (version_string): Bump to 1.9.
9622 * gold.h: Include <cstring> and <stdint.h>.
9623 * version.cc: Include <cstdio>.
9624 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9626 * reduced_debug_output.cc (insert_into_vector): Rename from
9627 Insert_into_vector; change all callers. Use Swap_unaligned to
9628 avoid aliasing issue; remove union since it is unnecessary.
9630 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9632 * Makefile.am (CCFILES): Add gc.cc.
9634 * Makefile.in: Regenerate.
9635 * gold.cc (Gc_runner): New class.
9636 (queue_initial_tasks): Call garbage collection related tasks
9637 when corresponding options are invoked.
9638 (queue_middle_gc_tasks): New function.
9639 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9640 processed early before laying out sections during garbage collection.
9641 * gold.h (queue_middle_gc_tasks): New function.
9642 (is_prefix_of): Move from "layout.cc".
9643 * i386.cc (Target_i386::gc_process_relocs): New function.
9644 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9645 * main.cc (main): Create object of class "Garbage_collection".
9646 * object.cc (Relobj::copy_symbols_data): New function.
9647 (Relobj::is_section_name_included): New function.
9648 (Sized_relobj::do_layout): Allow this function to be called twice
9649 during garbage collection and defer layout of section during the
9651 * object.h (Relobj::get_symbols_data): New function.
9652 (Relobj::is_section_name_included): New function.
9653 (Relobj::copy_symbols_data): New function.
9654 (Relobj::set_symbols_data): New function.
9655 (Relobj::get_relocs_data): New function.
9656 (Relobj::set_relocs_data): New function.
9657 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9658 (Relobj::gc_process_relocs): New function.
9659 (Relobj::do_gc_process_relocs): New pure virtual function.
9660 (Relobj::sd_): New data member.
9661 (Sized_relobj::is_output_section_offset_invalid): New function.
9662 (Sized_relobj::do_gc_process_relocs): New function.
9663 * options.h (General_options::gc_sections): Modify to not be a no-op.
9664 (General_options::print_gc_sections): New option.
9665 * plugin.cc (Plugin_finish::run): Remove function call to
9666 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9667 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9668 * reloc.cc (Read_relocs::run): Add task to process relocs and
9669 determine unreferenced sections when doing garbage collection.
9670 (Gc_process_relocs): New class.
9671 (Sized_relobj::do_gc_process_relocs): New function.
9672 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9673 sections that are garbage collected.
9674 * reloc.h (Gc_process_relocs): New class.
9675 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9676 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9677 symbols whose corresponding sections are garbage collected.
9678 (Symbol_table::Symbol_table): Add new parameter for the garbage
9680 (Symbol_table::gc_mark_undef_symbols): New function.
9681 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9682 (Symbol_table::gc_mark_dyn_syms): New function.
9683 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9685 (Symbol_table::add_from_object): Likewise.
9686 (Symbol_table::add_from_relobj): When building shared objects, do not
9687 treat externally visible symbols as garbage.
9688 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9689 table information for static and relocatable links.
9690 * symtab.h (Symbol_table::set_gc): New function.
9691 (Symbol_table::gc): New function.
9692 (Symbol_table::gc_mark_undef_symbols): New function.
9693 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9694 (Symbol_table::gc_mark_dyn_syms): New function.
9695 (Symbol_table::gc_): New data member.
9696 * target.h (Sized_target::gc_process_relocs): New pure virtual
9698 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9699 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9701 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9703 * options.h (General_options::gc_sections): Define as a no-op for now.
9704 (General_options::no_keep_memory): Ditto.
9705 (General_options::Bshareable): Define.
9706 * options.cc (General_options::finalize): Honor -Bshareable.
9708 2009-01-20 Andreas Schwab <schwab@suse.de>
9710 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9711 read the value in the contents, since we don't use it. Use the
9712 template endianness when writing.
9713 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9715 2009-01-19 Andreas Schwab <schwab@suse.de>
9717 * configure.tgt (powerpc64-*): Fix targ_obj.
9719 2009-01-15 Ian Lance Taylor <iant@google.com>
9721 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9722 local symbols when stripping all symbols.
9724 2009-01-14 Cary Coutant <ccoutant@google.com>
9726 * output.cc (Output_reloc): Add explicit instantiations.
9728 2009-01-14 Cary Coutant <ccoutant@google.com>
9730 * archive.cc (Archive::get_elf_object_for_member): Remove call
9731 to File_read::claim_for_plugin.
9732 * descriptors.cc (Descriptors::open): Remove reference to
9734 (Descriptors::claim_for_plugin): Remove.
9735 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9736 (Descriptors::is_claimed): Remove.
9737 (claim_descriptor_for_plugin): Remove.
9738 * fileread.cc (File_read::claim_for_plugin): Remove.
9739 * fileread.h (File_read::claim_for_plugin): Remove.
9740 (File_read::descriptor): Reopen descriptor if necessary.
9741 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9742 (Plugin_manager::all_symbols_read): Add task parameter. Change
9744 (Plugin_manager::get_input_file): New function.
9745 (Plugin_manager::release_input_file): New function.
9746 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9747 corresponding data member.
9748 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9749 and pass to base constructor. Change all callers.
9750 (get_input_file, release_input_file): New functions.
9751 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9752 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9753 (Plugin_manager::all_symbols_read): Add task parameter.
9754 (Plugin_manager::get_input_file): New function.
9755 (Plugin_manager::release_input_file): New function.
9756 (Plugin_manager::task_): New data member.
9757 (Pluginobj::Pluginobj): Add filesize parameter.
9758 (Pluginobj::filename): New function.
9759 (Pluginobj::descriptor): New function.
9760 (Pluginobj::filesize): New function.
9761 (Pluginobj::filesize_): New data member.
9762 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9763 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9764 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9766 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9767 with archive libraries.
9768 * testsuite/Makefile.in: Regenerate.
9769 * testsuite/plugin_test.c (struct sym_info): New type.
9770 (get_input_file, release_input_file): New static variables.
9771 (onload): Capture new transfer vector entries.
9772 (claim_file_hook): Stop reading at end of file according to filesize.
9773 Factor out parsing of readelf output into separate function.
9774 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9775 APIs and get the source file name from the symbol table. Convert
9776 source file name to corresponding object file name. Print info
9777 message when adding new input files.
9778 (parse_readelf_line): New function.
9779 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9780 * testsuite/plugin_test_2.sh: Likewise.
9781 * testsuite/plugin_test_3.sh: Likewise.
9782 * testsuite/plugin_test_4.sh: New test case.
9784 2009-01-07 Ian Lance Taylor <iant@google.com>
9786 * version.cc (version_string): Bump to 1.8.
9788 2008-12-23 Cary Coutant <ccoutant@google.com>
9790 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9791 * plugin.cc (Plugin_manager::finish): Rename as
9792 layout_deferred_objects. Move cleanup to separate function.
9793 (Plugin_manager::cleanup): New function.
9794 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9796 * plugin.h (Plugin_manager::finish): Rename as
9797 layout_deferred_objects.
9798 (Plugin_manager::cleanup): New function.
9799 (Plugin_manager::cleanup_done): New field.
9801 2008-12-23 Cary Coutant <ccoutant@google.com>
9803 * plugin.cc (is_visible_from_outside): New function.
9804 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9805 so we don't return "IR only" status for exported symbols or -r links.
9807 * testsuite/Makefile.am (plugin_test_3): New test case.
9808 * testsuite/Makefile.in: Regenerate.
9809 * testsuite/plugin_test_3.sh: New file.
9811 2008-12-22 Cary Coutant <ccoutant@google.com>
9813 * object.cc (Sized_relobj::layout_section): New function.
9814 (Sized_relobj::do_layout): Defer layout of input sections until after
9815 plugin has provided replacement files.
9816 (Sized_relobj::do_layout_deferred_sections): New function.
9817 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9818 (Relobj::layout_deferred_sections): New function.
9819 (Relobj::do_layout_deferred_sections): New function.
9820 (Sized_relobj::do_layout_deferred_sections): New function.
9821 (Sized_relobj::layout_section): New function.
9822 (Sized_relobj::Deferred_layout): New structure.
9823 (Sized_relobj::deferred_layout_): New field.
9824 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9825 Change all callers. Layout deferred sections.
9826 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9828 (Plugin_hook::run): Move code from do_plugin_hook inline.
9829 (Plugin_hook::do_plugin_hook): Remove.
9830 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9831 (Plugin_manager::finish): Renamed, was cleanup.
9832 (Plugin_manager::should_defer_layout): New function.
9833 (Plugin_manager::add_deferred_layout_object): New function.
9834 (Plugin_manager::Deferred_layout_list): New type.
9835 (Plugin_manager::deferred_layout_objects_): New field.
9836 (Plugin_hook::do_plugin_hook): Remove.
9838 2008-12-17 Ian Lance Taylor <iant@google.com>
9840 * options.h (class General_options): Add --no case for
9843 2008-12-16 Cary Coutant <ccoutant@google.com>
9845 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9847 (Plugin_manager::claim_file): Create plugin object even if
9848 plugin did not call the add_symbols callback.
9849 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9850 asking for more symbols than were added.
9851 * testsuite/Makefile.am (plugin_test_1): Add test case with
9853 (empty.syms): New target.
9854 * testsuite/Makefile.in: Regenerate.
9855 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9856 message. Don't call add_symbols if no globals.
9857 (all_symbols_read_hook): Don't provide replacement for empty
9860 2008-12-12 Ian Lance Taylor <iant@google.com>
9862 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9863 r_type == 0 for a local symbol with r_sym == 0.
9864 (scan_relocatable_relocs): Pass r_sym to
9865 local_non_section_strategy.
9866 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9869 * configure.ac: Update test for TLS descriptors: they are
9870 supported as of glibc 2.9.
9871 * configure: Rebuild.
9873 2008-12-11 Ian Lance Taylor <iant@google.com>
9876 * target-reloc.h (Default_scan_relocatable_relocs): For each
9877 function, map r_type == 0 to RELOC_DISCARD.
9879 2008-12-10 Cary Coutant <ccoutant@google.com>
9881 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9882 object to override a kept COMDAT group from a plugin object.
9884 2008-12-09 Ian Lance Taylor <iant@google.com>
9887 * yyscript.y (file_cmd): Handle INPUT.
9889 * testsuite/initpri1.c: Change all declarations to be full
9890 prototypes by adding void, to avoid compiler warnings.
9892 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9894 * options.cc (General_options::parse_plugin_opt): New.
9895 (General_options::add_plugin): The argument now is just the filename.
9896 (General_options::add_plugin_option): New.
9897 * options.h (plugin_opt): New.
9898 (add_plugin): Change argument name.
9899 (add_plugin_option): New.
9900 * plugin.cc (Plugin::load): Don't parse the plugin option.
9901 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9902 (Plugin::add_option): New.
9903 (Plugin::args_): Change type.
9904 (Plugin::filename_): New.
9905 (Plugin_manager::add_plugin_option): New.
9906 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9907 * testsuite/Makefile.in: Regenerate.
9909 2008-12-05 Cary Coutant <ccoutant@google.com>
9911 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9912 Handle --strip-lto-sections option.
9913 * options.h (strip_lto_sections): New option.
9915 2008-12-01 Cary Coutant <ccoutant@google.com>
9917 * plugin.cc (ld_plugin_message): Change format parameter to const.
9918 Fix mismatch between new[] and delete.
9920 2008-11-14 Cary Coutant <ccoutant@google.com>
9922 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9925 2008-11-05 Craig Silverstein <csilvers@google.com>
9927 * options.cc (General_options::parse_dynamic_list): New function.
9928 * options.h (General_options): New flags dynamic_list,
9929 dynamic_list_data, dynamic_list_cpp_new, and
9930 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9931 (General_options::in_dynamic_list): New function.
9932 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9933 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9934 (Lex::can_continue_name): Likewise.
9936 (read_script_file): New parameter script_options.
9937 (read_dynamic_list): New function.
9938 (Script_options::define_dynamic_list): New function.
9939 (dynamic_list_keyword_parsecodes): New variable.
9940 (dynamic_list_keywords): New variable.
9941 * script.h (Script_options::define_dynamic_list): New function
9943 (read_dynamic_list): New function prototype.
9944 * symtab.cc (strprefix): New macro.
9945 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9946 dynamic_list_data, dynamic_list_cpp_new, and
9947 dynamic_list_cpp_typeinfo.
9948 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9949 (dynamic_list_expr): New rule.
9950 (dynamic_list_nodes): Likewise.
9951 (dynamic_list_node): Likewise.
9952 * testsuite/Makefile.am (dynamic_list): New test.
9953 * testsuite/Makefile.in: Regenerated.
9954 * testsuite/dynamic_list.t: New file.
9955 * testsuite/dynamic_list.sh: New file.
9957 2008-11-05 Craig Silverstein <csilvers@google.com>
9959 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9960 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9961 (t11_last): Likewise.
9962 * testsuite/ver_test_6.c (main): Likewise.
9964 2008-10-07 Cary Coutant <ccoutant@google.com>
9966 * options.c (General_options::finalize): Add check for -static and
9968 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9971 2008-10-02 Cary Coutant <ccoutant@google.com>
9973 * plugin.cc (make_sized_plugin_object): Fix conditional
9974 compilation to work when not all targets are enabled.
9976 2008-09-29 Cary Coutant <ccoutant@google.com>
9978 * archive.cc (Archive::get_file_and_offset): Use filename instead
9979 of name to get library path.
9980 (Archive::include_member): Unlock external member of a thin archive.
9982 * testsuite/Makefile.am (TEST_AR): New variable.
9983 (thin_archive_test_1): New test.
9984 (thin_archive_test_2): New test.
9985 * testsuite/Makefile.in: Regenerate.
9986 * testsuite/thin_archive_main.cc: New file.
9987 * testsuite/thin_archive_test_1.cc: New file.
9988 * testsuite/thin_archive_test_2.cc: New file.
9989 * testsuite/thin_archive_test_3.cc: New file.
9990 * testsuite/thin_archive_test_4.cc: New file.
9992 2008-09-29 Cary Coutant <ccoutant@google.com>
9994 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9995 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9997 (Sized_relobj::do_finalize_local_symbols): Likewise.
9998 (Sized_relobj::map_to_kept_section): Likewise.
9999 * object.h (Sized_relobj::invalid_address): New constant.
10000 (Sized_relobj::do_output_section_offset): Check for invalid_address
10002 * output.cc (Output_reloc::local_section_offset): Use constant
10003 invalid_address instead of -1U.
10004 (Output_reloc::get_address): Likewise.
10005 (Output_section::output_address): Change -1U to -1ULL.
10006 * output.h (Output_reloc::invalid_address): New constant.
10007 * reloc.cc (Sized_relobj::write_sections): Use constant
10008 invalid_address instead of -1U.
10009 (Sized_relobj::relocate_sections): Likewise.
10010 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10011 values for merge sections.
10012 * target-reloc.h (relocate_for_relocatable): Use constant
10013 invalid_address instead of -1U.
10015 2008-09-19 Cary Coutant <ccoutant@google.com>
10017 Add plugin functionality for link-time optimization (LTO).
10018 * configure.ac (plugins): Add --enable-plugins option.
10019 * configure: Regenerate.
10020 * config.in: Regenerate.
10021 * Makefile.am (LIBDL): New variable.
10022 (CCFILES): Add plugin.cc.
10023 (HFILES): Add plugin.h.
10024 (ldadd_var): Add LIBDL.
10025 * Makefile.in: Regenerate.
10027 * archive.cc: Include "plugin.h".
10028 (Archive::setup): Don't preread archive symbols when using a plugin.
10029 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10030 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10032 (Archive::include_member): Add symbols from plugin objects.
10033 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10034 * descriptors.cc (Descriptors::open): Check for file descriptors
10035 abandoned by plugins.
10036 (Descriptors::claim_for_plugin): New function.
10037 * descriptors.h (Descriptors::claim_for_plugin): New function.
10038 (Open_descriptor::is_claimed): New field.
10039 (claim_descriptor_for_plugin): New function.
10040 * fileread.cc (File_read::claim_for_plugin): New function.
10041 * fileread.h (File_read::claim_for_plugin): New function.
10042 (File_read::descriptor): New function.
10043 * gold.cc: Include "plugin.h".
10044 (queue_initial_tasks): Add task to call plugin hooks for generating
10046 * main.cc: Include "plugin.h".
10047 (main): Load plugin libraries.
10048 * object.h (Pluginobj): Declare.
10049 (Object::pluginobj): New function.
10050 (Object::do_pluginobj): New function.
10051 (Object::set_target): New function.
10052 * options.cc: Include "plugin.h".
10053 (General_options::parse_plugin): New function.
10054 (General_options::General_options): Initialize plugins_ field.
10055 (General_options::add_plugin): New function.
10056 * options.h (Plugin_manager): Declare.
10057 (General_options): Add --plugin option.
10058 (General_options::has_plugins): New function.
10059 (General_options::plugins): New function.
10060 (General_options::add_plugin): New function.
10061 (General_options::plugins_): New field.
10062 * plugin.cc: New file.
10063 * plugin.h: New file.
10064 * readsyms.cc: Include "plugin.h".
10065 (Read_symbols::do_read_symbols): Check for archive before checking
10066 for ELF file. Call plugin hooks to claim files.
10067 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10068 from a real object file; force override when processing replacement
10070 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10071 (Symbol::init_base_object): Likewise.
10072 (Symbol::init_base_output_data): Likewise.
10073 (Symbol::init_base_output_segment): Likewise.
10074 (Symbol::init_base_constant): Likewise.
10075 (Symbol::init_base_undefined): Likewise.
10076 (Symbol::output_section): Assert that object is not a plugin.
10077 (Symbol_table::add_from_pluginobj): New function.
10078 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10080 (Symbol_table::sized_write_globals): Likewise.
10081 (Symbol_table::add_from_pluginobj): Instantiate template.
10082 * symtab.h (Sized_pluginobj): Declare.
10083 (Symbol::in_real_elf): New function.
10084 (Symbol::set_in_real_elf): New function.
10085 (Symbol::in_real_elf_): New field.
10086 (Symbol_table::add_from_pluginobj): New function.
10088 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10089 (LIBDL): New variable.
10090 (LDADD): Add LIBDL.
10091 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10092 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10093 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10094 (MOSTLYCLEANFILES): Likewise.
10095 * testsuite/Makefile.in: Regenerate.
10096 * testsuite/plugin_test.c: New file.
10097 * testsuite/plugin_test_1.sh: New file.
10098 * testsuite/plugin_test_2.sh: New file.
10100 2008-09-16 Ian Lance Taylor <iant@google.com>
10102 * target-reloc.h (relocate_section): Check whether a symbol is
10103 defined by the ABI before reporting an undefined symbol error.
10104 * target.h (Target::is_defined_by_abi): Make parameter const.
10105 (Target::do_is_defined_by_abi): Likewise.
10106 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10107 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10108 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10109 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10110 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10111 * testsuite/Makefile.in: Rebuild.
10113 * fileread.cc (make_view): Add casts to avoid warning.
10115 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10117 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10118 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10120 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10122 * options.h (General_options::output_is_executable): New.
10123 (General_options::output_is_pie): New.
10124 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10125 for shared libraries.
10126 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10128 2008-09-11 Chris Demetriou <cgd@google.com>
10130 * options.h (origin): New -z option.
10131 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10132 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10135 2008-09-05 Cary Coutant <ccoutant@google.com>
10137 * fileread.cc (File_read::make_view): Add check for attempt to map
10138 beyond end of file.
10140 2008-09-05 Cary Coutant <ccoutant@google.com>
10142 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10143 explicit instantiations.
10145 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10148 * options.cc (General_options::finalize): Allow undefined symbols
10149 in shlibs if linking -shared.
10152 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10153 symbols as not needing a dynsym entry.
10155 2008-08-20 Craig Silverstein <csilvers@google.com>
10157 * fileread.cc (File_read::open): Do not lock the file unless it
10158 was successfully opened.
10160 2008-08-14 Cary Coutant <ccoutant@google.com>
10162 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10163 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10164 * testsuite/tls_test.cc (struct int128): 128-bit struct
10165 for testing TLS relocs with non-zero addend.
10166 (v12): New TLS variable.
10168 (t_last): Add check for v12.
10169 * testsuite/tls_test.h (t12): New function.
10170 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10172 2008-08-13 Ian Lance Taylor <iant@google.com>
10174 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10175 set tls_segment_ or relro_segment_.
10176 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10178 * output.h (Output_section::clear_is_relro): New function.
10179 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10180 sections specially even when output_data_ is empty.
10181 (Output_segment::maximum_alignment): When first section is relro,
10182 only force alignment for PT_LOAD segments.
10183 * script.cc (script_data_segment_align): New function.
10184 (script_data_segment_relro_end): New function.
10185 * script-c.h (script_data_segment_align): Declare.
10186 (script_data_segment_relro_end): Declare.
10187 * script-sections.h (class Script_sections): Declare
10188 data_segment_align and data_segment_relro_end. Add fields
10189 segment_align_index_ and saw_relro_end_.
10190 * script-sections.cc (class Sections_element): Add set_is_relro
10191 virtual function. Add new bool* parameter to place_orphan_here.
10192 Add get_output_section virtual function.
10193 (class Output_section_definition): Add set_is_relro. Add new
10194 bool* parameter to place_orphan_here. Add get_output_section.
10195 Add is_relro_ field.
10196 (Output_section_definition::Output_section_definition): Initialize
10197 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10198 and is_relro_ fields.
10199 (Output_section_definition::place_orphan_here): Add is_relro
10201 (Output_section_definition::set_section_addresses): Set relro for
10203 (Output_section_definition::alternate_constraint): Likewise.
10204 (class Orphan_output_section): Add new bool* parameter to
10205 place_orphan_here. Add get_output_section.
10206 (Orphan_output_section::place_orphan_here): Add is_relro
10208 (Script_sections::Script_sections): Initialize
10209 data_segment_align_index_ and saw_relro_end_.
10210 (Script_sections::data_segment_align): New function.
10211 (Script_sections::data_segment_relro_end): New function.
10212 (Script_sections::place_orphan): Set or clear is_relro.
10213 (Script_sections::set_section_addresses): Force alignment of first
10215 * yyscript.y (exp): Call script_data_segment_align and
10216 script_data_segment_relro_end.
10217 * testsuite/relro_script_test.t: New file.
10218 * testsuite/relro_test.cc (using_script): Declare.
10219 (t1, t2): Test using_script.
10220 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10221 (relro_script_test_SOURCES): Define.
10222 (relro_script_test_DEPENDENCIES): Define.
10223 (relro_script_test_LDFLAGS): Define.
10224 (relro_script_test_LDADD): Define.
10225 (relro_script_test.so): New target.
10226 * testsuite/Makefile.in: Rebuild.
10228 2008-08-06 Cary Coutant <ccoutant@google.com>
10230 * archive.cc (Archive::total_archives, Archive::total_members)
10231 (Archive::total_members_loaded): New variables.
10232 (Archive::setup): Add parameter. Add option to preread
10234 (Archive::read_armap): Add counter.
10235 (Archive::get_file_and_offset): New function.
10236 (Archive::get_elf_object_for_member): New function.
10237 (Archive::read_all_symbols): New function.
10238 (Archive::read_symbols): New function.
10239 (Archive::add_symbols): Add counters.
10240 (Archive::include_all_members): Use armap to find members if it's
10242 (Archive::include_member): Skip reading symbols if already read.
10243 Factored code into Archive::get_file_and_offset and
10244 Archive::get_elf_object_for_member. Changed call to
10245 Mapfile::report_include_archive_member.
10246 (Archive::print_stats): New function.
10247 * archive.h: Declare Object and Read_symbols_data classes.
10248 (Archive::Archive): Add initializers for new members.
10249 (Archive::setup): Add parameter.
10250 (Archive::print_stats): New function.
10251 (Archive::total_archives, Archive::total_members)
10252 (Archive::total_members_loaded): New variables.
10253 (Archive::get_file_and_offset): New function.
10254 (Archive::get_elf_object_for_member): New function.
10255 (Archive::read_all_symbols): New function.
10256 (Archive::read_symbols): New function.
10257 (Archive::Archive_member): New class.
10258 (Archive::members_): New member.
10259 (Archive::num_members_): New member.
10260 * main.cc: Include archive.h.
10261 (main): Call Archive::print_stats.
10262 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10263 archive parameter; member_name is now the fully-decorated name.
10264 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10265 * options.h: (General_options): Add --preread-archive-symbols option.
10266 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10269 2008-08-04 Ian Lance Taylor <iant@google.com>
10271 * symtab.h (Symbol::use_plt_offset): New function.
10272 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10273 * powerpc.cc (Relocate::relocate): Likewise.
10274 * sparc.cc (Relocate::relocate): Likewise.
10275 * x86_64.cc (Relocate::relocate): Likewise.
10276 * testsuite/weak_plt.sh: New test.
10277 * testsuite/weak_plt_main.cc: New test.
10278 * testsuite/weak_plt_shared.cc: New test.
10279 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10280 (check_PROGRAMS): Add weak_plt.
10281 (check_DATA): Add weak_plt_shared.so.
10282 (weak_plt_main_pic.o, weak_plt): New targets.
10283 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10284 * testsuite/Makefile.in: Rebuild.
10286 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10288 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10289 * testsuite/Makefile.in: Rebuild.
10291 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10293 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10294 * Makefile.in: Regenerate.
10295 * po/POTFILES.in: Regenerate.
10297 2008-07-29 Ian Lance Taylor <iant@google.com>
10299 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10300 symbols before other symbols.
10301 * testsuite/script_test_2.cc (test_addr): Declare.
10302 (test_addr_alias): Declare.
10303 (main): Check that test_addr and test_addr_alias have the right
10305 * testsuite/script_test_2.t: Define test_addr_alias and
10308 2008-07-24 Ian Lance Taylor <iant@google.com>
10311 * descriptors.cc: New file.
10312 * descriptors.h: New file.
10313 * gold-threads.h (class Hold_optional_lock): New class.
10314 * fileread.cc: Include "descriptors.h".
10315 (File_read::~File_read): Release descriptor rather than closing
10317 (File_read::open) [file]: Call open_descriptor rather than open.
10318 Set is_descriptor_opened_.
10319 (File_read::open) [memory]: Assert that descriptor is not open.
10320 (File_read::reopen_descriptor): New function.
10321 (File_read::release): Release descriptor.
10322 (File_read::do_read): Make non-const. Reopen descriptor.
10323 (File_read::read): Make non-const.
10324 (File_read::make_view): Reopen descriptor.
10325 (File_read::do_readv): Likewise.
10326 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10327 Update declarations.
10328 * layout.cc: Include "descriptors.h".
10329 (Layout::create_build_id): Use open_descriptor rather than open.
10330 * output.cc: Include "descriptors.h".
10331 (Output_file::open): Use open_descriptor rather than open.
10332 * archive.cc (Archive::const_iterator): Change Archive to be
10334 (Archive::begin, Archive::end): Make non-const.
10335 (Archive::count_members): Likewise.
10336 * archive.h (class Archive): Update declarations.
10337 * object.h (Object::read): Make non-const.
10338 * Makefile.am (CCFILES): Add descriptors.cc.
10339 (HFILES): Add descriptors.h.
10340 * Makefile.in: Rebuild.
10343 * gold.h: Always include <clocale>. Add Solaris workarounds
10344 following code in binutils/sysdep.h.
10347 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10348 this->eh_frame_hdr_ is NULL before using it.
10350 * dynobj.cc (Versions::Versions): Update comment.
10352 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10353 the base version name.
10355 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10356 array size plus one.
10357 (Stringpool_template::set_string_offsets): Subtract one from key
10358 before using it as an array index.
10359 (Stringpool_template::get_offset_with_length): Likewise.
10360 (Stringpool_template::write_to_buffer): Likewise.
10361 * stringpool.h (Stringpool_template::get_offset_from_key):
10364 2008-07-23 Ian Lance Taylor <iant@google.com>
10367 * object.h (Merged_symbol_value::value): Do our best to handle a
10371 * script.cc (Version_script_info::get_versions): Don't add empty
10372 version tag to return value.
10373 (Version_script_info::get_symbol_version_helper): Change return
10374 type to bool. Add pversion parameter. Change all callers.
10375 (script_register_vers_node): Don't require a non-NULL tag.
10376 * script.h (class Version_script_info): Update declarations.
10377 (Version_script_info::get_symbol_version): Change return type to
10378 bool. Add version parameter. Change all callers.
10379 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10380 handling. Handle an empty version from a version script.
10381 (Symbol_table::define_special_symbol): Likewise.
10382 * testsuite/ver_test_10.script: New file.
10383 * testsuite/ver_test_10.sh: New file.
10384 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10385 (check_DATA): Add ver_test_10.syms.
10386 (ver_test_10.syms, ver_test_10.so): New target.
10387 * testsuite/Makefile.in: Rebuild.
10389 2008-07-23 Simon Baldwin <simonb@google.com>
10391 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10392 to zero for undefined symbols from dynamic libraries.
10394 2008-07-23 Ian Lance Taylor <iant@google.com>
10396 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10397 Change all callers.
10398 * symtab.h (class Symbol_table): Update declaration.
10399 * testsuite/ver_test_9.cc: New file.
10400 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10401 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10402 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10403 (ver_test_9.so, ver_test_9.o): New targets.
10404 * testsuite/Makefile.in: Rebuild.
10406 2008-07-22 Ian Lance Taylor <iant@google.com>
10408 * options.h (class General_options): Define --check-sections.
10409 * layout.cc (Layout::set_segment_offsets): Handle
10412 * options.h (class General_options): Define -n/--nmagic and
10414 * options.cc (General_options::finalize): For -n/--nmagic or
10415 -N/--omagic, set -static.
10416 * layout.cc (Layout::attach_allocated_section_to_segment): If
10417 -N/--omagic, don't put read-only and read-write sections in
10418 different segments.
10419 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10420 finding a read-only segment.
10421 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10422 don't set the minimum segment alignment to the common page size,
10423 and don't set the file offset to the address modulo the page size.
10424 * script-sections.cc (Script_sections::create_segments): If
10425 -n/--omagic, don't put read-only and read-write sections in
10426 different segments.
10428 * cref.cc: New file.
10429 * cref.h: New file.
10430 * options.h (class General_options): Add --print-symbol-counts.
10431 * main.cc (main): Issue defined symbol report if requested.
10432 * archive.cc (Archive::interpret_header): Make into a const member
10434 (Archive::add_symbols): Call Input_objects::archive_start and
10436 (Archive::const_iterator): Define new class.
10437 (Archive::begin, Archive::end): New functions.
10438 (Archive::include_all_members): Rewrite to use iterator.
10439 (Archive::count_members): New function.
10440 * archive.h (class Archive): Update declarations.
10441 (Archive::filename): New function.
10442 * object.cc: Include "cref.h".
10443 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10444 (Sized_relobj::do_get_global_symbol_counts): New function.
10445 (Input_objects::add_object): Add object to cross-referencer.
10446 (Input_objects::archive_start): New function.
10447 (Input_objects::archive_stop): New function.
10448 (Input_objects::print_symbol_counts): New function.
10449 * object.h: Declare Cref and Archive.
10450 (Object::get_global_symbol_counts): New function.
10451 (Object::do_get_global_symbol_counts): New pure virtual function.
10452 (class Sized_relobj): Add defined_count_ field. Update
10454 (class Input_objects): Add cref_ field. Update constructor.
10455 Update declarations.
10456 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10458 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10460 (Sized_dynobj::do_get_global_symbol_counts): New function.
10461 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10462 defined_count_. Update declarations. Define Symbols typedef.
10463 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10464 parameter. Change all callers.
10465 (Symbol_table::add_from_dynobj): Add sympointers and defined
10466 parameters. Change all callers.
10467 * symtab.h (class Symbol_table): Update declarations.
10468 * Makefile.am (CCFILES): Add cref.cc.
10469 (HFILES): Add cref.h.
10470 * Makefile.in: Rebuild.
10472 2008-07-22 Simon Baldwin <simonb@google.com>
10474 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10475 to zero when writing undefined symbols.
10477 2008-07-22 Ian Lance Taylor <iant@google.com>
10479 * output.cc (Output_section::add_input_section): Don't try to
10480 merge empty merge sections.
10482 2008-07-21 Craig Silverstein <csilvers@google.com>
10484 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10485 Include symbol version in error message.
10487 2008-07-20 Chris Demetriou <cgd@google.com>
10489 * configure.ac (gold_cv_c_random_seed): New configured variable.
10490 (RANDOM_SEED_CFLAGS): New substituted variable.
10491 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10492 * configure: Rebuild.
10493 * Makefile.in: Likewise.
10494 * testsuite/Makefile.in: Likewise.
10496 2008-07-18 Ian Lance Taylor <iant@google.com>
10498 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10499 where we see NAME/NULL and NAME/VERSION as separate symbols.
10500 * testsuite/ver_test_main.cc (main): Call t4.
10501 (t4, t4_2a): Define.
10502 * testsuite/ver_test_2.cc (t4_2): Define.
10503 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10504 * testsuite/ver_test_4.cc (t4_2a): Define.
10505 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10506 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10508 2008-07-17 Ian Lance Taylor <iant@google.com>
10510 * dynobj.cc (Versions::add_def): If we give an error about a
10511 missing version, go ahead and create the version anyhow.
10513 2008-07-10 Ian Lance Taylor <iant@google.com>
10515 Handle output sections with more than 0x7fffffff bytes.
10516 * object.h (class Relobj): Change map_to_output_ to
10517 output_sections_, and just keep a section pointer. Change all
10518 uses. Move comdat group support to Sized_relobj.
10519 (Relobj::is_section_specially_mapped): Remove.
10520 (Relobj::output_section): Remove poff parameter. Change all
10522 (Relobj::output_section_offset): New function.
10523 (Relobj::set_section_offset): Rewrite.
10524 (Relobj::map_to_output): Remove.
10525 (Relobj::output_sections): New function.
10526 (Relobj::do_output_section_offset): New pure virtual function.
10527 (Relobj::do_set_section_offset): Likewise.
10528 (class Sized_relobj): Add section_offsets_ field. Add comdat
10529 group support from Relobj. Update declarations.
10530 (Sized_relobj::get_output_section_offset): New function.
10531 (Sized_relobj::do_output_section_offset): New function.
10532 (Sized_relobj::do_set_section_offset): New function.
10533 * object.cc (Relobj::output_section_address): Remove.
10534 (Sized_relobj::Sized_relobj): Initialize new fields.
10535 (Sized_relobj::include_section_group): Cast find_kept_object to
10537 (Sized_relobj::include_linkonce_section): Likewise.
10538 (Sized_relobj::do_layout): Use separate arrays for output section
10540 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10542 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10543 output_sections and section_offsets.
10544 (Sized_relobj::write_local_symbols): Likewise.
10545 (map_to_kept_section): Compute output address directly.
10546 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10547 output_sections and section_offsets.
10548 (Sized_relobj::write_sections): Likewise.
10549 (Sized_relobj::relocate_sections): Likewise.
10550 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10551 * output.h (class Output_reloc): Update declarations. Change
10552 u2_.relobj to Sized_relobj*.
10553 (class Output_data_reloc): Change add functions to use
10555 * output.cc (Output_reloc::Output_reloc): Change relobj to
10557 (Output_reloc::local_section_offset): Change return type to
10558 Elf_Addr. Use get_output_section_offset.
10559 (Output_reloc::get_address): Likewise.
10560 (Output_section::is_input_address_mapped): Don't call
10561 is_section_specially_mapped.
10562 (Output_section::output_offset): Likewise.
10563 (Output_section::output_address): Likewise.
10564 (Output_section::starting_output_address): Likewise.
10565 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10566 parameter to Sized_relobj*.
10567 (Copy_relocs::need_copy_reloc): Likewise.
10568 (Copy_relocs::save): Likewise.
10569 * copy-relocs.h (class Copy_relocs): Update declarations.
10570 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10571 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10572 * target-reloc.h (relocate_for_relocatable): Change
10573 offset_in_output_section type to Elf_Addr. Change code that uses
10575 * layout.cc (Layout::layout): Always set *off.
10576 * mapfile.cc (Mapfile::print_input_section): Use
10577 output_section_offset.
10578 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10580 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10581 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10582 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10584 2008-07-03 Ian Lance Taylor <iant@google.com>
10586 * layout.cc (Layout::include_section): Do not discard unrecognized
10587 SHT_STRTAB sections.
10589 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10591 * script.cc (Lex::can_continue_name): Make '?' allowable in
10592 version-script names.
10593 * testsuite/version_script.map: Change glob pattern to use '?'
10595 2008-06-30 Manish Singh <yosh@gimp.org>
10598 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10601 2008-06-30 Ian Lance Taylor <iant@google.com>
10605 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10606 versions]: Don't try to read the value in the contents, since we
10607 don't use it. Use the template endianness when writing.
10609 2008-06-25 Cary Coutant <ccoutant@google.com>
10611 * fileread.cc (File_read::make_view): Assert on zero-length view.
10612 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10613 symbol table when there are no symbols to read.
10615 2008-06-23 Craig Silverstein <csilvers@google.com>
10617 * version.cc (version_string): Bump to 1.7
10619 2008-06-18 Craig Silverstein <csilvers@google.com>
10621 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10622 constant 0xFFFF to type Valtype.
10623 (Powerpc_relocate_functions::rel16_ha): Likewise.
10625 2008-06-17 Ian Lance Taylor <iant@google.com>
10627 * output.h (Output_section::Input_section): Initialize p2align_ to
10628 zero for Output_section_data constructors.
10629 (Output_section::Input_section::addralign): If not an input
10630 section, return the alignment of the Output_section_data.
10631 * testsuite/copy_test.cc: New file.
10632 * testsuite/copy_test_1.cc: New file.
10633 * testsuite/copy_test_2.cc: New file.
10634 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10635 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10636 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10637 (copy_test_1_pic.o, copy_test_1.so): New targets.
10638 (copy_test_2_pic.o, copy_test_2.so): New targets.
10639 * testsuite/Makefile.in: Rebuild.
10641 * script-sections.cc (Script_sections::place_orphan): Initialize
10642 local variable exact.
10644 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10646 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10648 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10649 David S. Miller <davem@davemloft.net>
10651 * powerpc.cc: New file.
10652 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10653 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10654 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10655 * Makefile.in: Rebuild.
10657 2008-06-09 Ian Lance Taylor <iant@google.com>
10659 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10661 (throwing, orig_terminate): New static variables.
10662 (terminate_handler): New static function.
10663 (t2): Set terminate handler.
10665 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10668 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10671 2008-05-30 Cary Coutant <ccoutant@google.com>
10673 * archive.cc (Archive::include_all_members) Correct to step
10674 over symbol table and extended name table in thin archives.
10676 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10679 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10682 2008-05-28 Caleb Howe <cshowe@google.com>
10684 * reduced_debug_output.cc: New file.
10685 * reduced_debug_output.h: New file.
10686 * options.h (class General_options): Add --strip-debug-non-line.
10687 * options.cc (General_options::finalize): Add strip_debug_non_line
10688 to the strip heirarchy.
10689 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10691 * layout.cc: Include "reduced_debug_output.h".
10692 (Layout::Layout): Initialize new fields.
10693 (line_only_debug_sections): New static array.
10694 (is_lines_only_debug_sections): New static inline function.
10695 (Layout::include_section): Handle --strip-debug-non-line.
10696 (Layout::make_output_section): If --strip-debug-non-line, build
10697 new output sections for .debug_abbrev and .debug_info.
10698 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10699 gold. Warn about possible overflow.
10700 (read_signed_LEB_128): Likewise.
10701 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10702 (read_signed_LEB_128): Declare.
10703 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10704 (HFILES): Add reduced_debug_output.h.
10705 * Makefile.in: Rebuild.
10707 2008-05-21 Ian Lance Taylor <iant@google.com>
10709 * mapfile.cc: New file.
10710 * mapfile.h: New file.
10711 * options.h (class General_options): Add -M/--print-map and -Map.
10712 * options.cc (General_options::finalize): Make -M equivalent to
10714 * main.cc: Include <cstdio> and "mapfile.h".
10715 (main): Open mapfile if requested.
10716 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10717 constructor. Change caller.
10718 (queue_initial_tasks): Add mapfile parameter. Change caller.
10719 (queue_middle_tasks): Likewise.
10720 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10722 * archive.cc: Include "mapfile.h".
10723 (Archive::add_symbols): Add mapfile parameter. Change all
10724 callers. Pass mapfile, symbol, and reason to include_member.
10725 (Archive::include_all_members): Add mapfile parameter. Change all
10727 (Archive::include_member): Add mapfile, sym, and why parameters.
10728 Change all callers. Report inclusion to map file.
10729 * archive.h: Include "fileread.h".
10730 (class Archive): Update declarations.
10731 (Archive::file): New const method.
10732 (class Add_archive_symbols): Add mapfile_ field. Update
10733 constructor. Change all callers.
10734 * readsyms.h (class Read_symbols): Likewise.
10735 (class Finish_group): Likewise.
10736 (class Read_script): Likewise.
10737 * common.cc: Include "mapfile.h".
10738 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10740 (Symbol_table::do_allocate_commons): Likewise.
10741 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10742 symbol allocation to mapfile.
10743 * common.h (class Allocate_commons_task): Add mapfile_ field.
10744 Update constructor. Change all callers.
10745 * symtab.h (class Symbol_table): Update declarations.
10746 * layout.cc: Include "mapfile.h".
10747 (Layout_task_runner::run): Print information to mapfile.
10748 (Layout::create_gold_note): Change Output_data_fixed_space to
10749 Output_data_zero_fill.
10750 (Layout::create_build_id): Likewise.
10751 (Layout::print_to_mapfile): New function.
10752 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10753 constructor. Change caller.
10754 (class Layout): Declare print_to_mapfile.
10755 * output.cc (Output_section::Input_section::print_to_mapfile): New
10757 (Output_section::add_input_section): If producing a map, always
10758 add to input_sections_ list.
10759 (Output_section::do_print_to_mapfile): New function.
10760 (Output_segment::print_sections_to_mapfile): New function.
10761 (Output_segment::print_section_list_to_mapfile): New function.
10762 * output.h: Include "mapfile.h".
10763 (Output_data::print_to_mapfile): New function.
10764 (Output_data::do_print_to_mapfile): New virtual function.
10765 (Output_segment_headers::do_print_to_mapfile): New function.
10766 (Output_file_header::do_print_to_mapfile): New function.
10767 (Output_data_const::do_print_to_mapfile): New function.
10768 (class Output_data_const_buffer): Add map_name_ field. Update
10769 constructor. Change all callers. Add do_print_to_mapfile
10771 (class Output_data_fixed_space): Likewise.
10772 (class Output_data_space): Likewise.
10773 (class Output_data_zero_fill): New class.
10774 (Output_data_strtab::do_print_to_mapfile): New function.
10775 (Output_data_reloc_base::do_print_to_mapfile): New function.
10776 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10777 (Output_data_group::do_print_to_mapfile): New function.
10778 (Output_data_got::do_print_to_mapfile): New function.
10779 (Output_data_dynamic::do_print_to_mapfile): New function.
10780 (Output_symtab_xindex::do_print_to_mapfile): New function.
10781 (class Output_section): Declare do_print_to_mapflie. Declare
10782 print_to_mapfile in Input_section.
10783 (class Output_segment): Declare new functions.
10784 * object.h (Sized_relobj::symbol_count): New function.
10785 * script-sections.cc
10786 (Output_section_element_dot_assignment::set_section_addresses):
10787 Change Output_data_fixed_space to Output_data_zero_fill.
10788 (Output_data_expression::do_print_to_mapfile): New function.
10789 * script.cc (read_input_script): Add mapfile parameter. Change
10791 * script.h (read_input_script): Update declaration.
10792 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10793 (Eh_frame::do_print_to_mapfile): New function.
10794 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10795 (Output_merge_string::do_print_to_mapfile): New function.
10796 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10798 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10800 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10802 * Makefile.am (CCFILES): Add mapfile.cc.
10803 (HFILES): Add mapfile.h.
10804 * Makefile.in: Rebuild.
10806 2008-05-19 Ian Lance Taylor <iant@google.com>
10808 * options.h (class General_options): Add -z relro.
10809 * layout.cc (Layout::Layout): Initialize relro_segment_.
10810 (Layout::add_output_section_data): Return the output section.
10811 (Layout::make_output_section): Rcognize relro sections and mark
10812 them appropriately.
10813 (Layout::attach_allocated_section_to_segment): Put relro sections
10814 in a PT_GNU_RELRO segment.
10815 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10817 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10819 (Layout::linkonce_mapping): Map d.rel.ro.local to
10820 .data.rel.ro.local.
10821 (Layout::output_section_name): Us .data.rel.ro.local for any
10822 section which begins with that.
10823 * layout.h (class Layout): Update add_output_section_data
10824 declaration. Add relro_segment_ field.
10825 * output.cc (Output_section::Output_section): Initialize is_relro_
10826 and is_relro_local_ fields.
10827 (Output_segment::add_output_section): Group relro sections.
10828 (Output_segment::is_first_section_relro): New function.
10829 (Output_segment::maximum_alignment): If there is a relro section,
10830 align the segment to the common page size.
10831 (Output_segment::set_section_addresses): Track whether we are
10832 looking at relro sections. If the last section is a relro
10833 section, align to the common page size.
10834 (Output_segment::set_section_list_addresses): Add in_relro
10835 parameter. Change all callers. Align to the page size when
10836 moving from relro to non-relro section.
10837 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10839 * output.h (class Output_section): Add is_relro_ and
10840 is_relro_local_ fields.
10841 (Output_section::is_relro): New function.
10842 (Output_section::set_is_relro): New function.
10843 (Output_section::is_relro_local): New function.
10844 (Output_section::set_is_relro_local): New function.
10845 (class Output_segment): Update declarations.
10846 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10847 * sparc.cc (Target_sparc::got_section): Likewise.
10848 * x86_64.cc (Target_x86_64::got_section): Likewise.
10849 * testsuite/relro_test_main.cc: New file.
10850 * testsuite/relro_test.cc: New file.
10851 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10852 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10853 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10854 (relro_test.so, relro_test_pic.o): New targets.
10855 * testsuite/Makefile.in: Rebuild.
10857 2008-05-16 Ian Lance Taylor <iant@google.com>
10859 * output.cc (Output_segment::add_output_section): Remove front
10861 * output.h (class Output_segment): Remove
10862 add_initial_output_section and overloaded add_output_section.
10863 Update declaration of remaining add_output_section.
10864 * layout.cc (Layout::create_interp): Call add_output_section
10865 rather than add_initial_output_section.
10866 (Layout::finish_dynamic_section): Likewise.
10868 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10869 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10870 know the dynamic type.
10871 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10872 field. Initialize it in constructor.
10873 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10874 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10875 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10878 * output.cc (Output_reloc::get_address): Change return type to
10880 * output.h (class Output_reloc): Update get_address declaration.
10881 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10882 for section addresses.
10884 2008-05-09 Ian Lance Taylor <iant@google.com>
10887 * gold.cc (gold_nomem): Use return value of write.
10889 2008-05-08 Ian Lance Taylor <iant@google.com>
10891 * symtab.c (Symbol::init_base_output_data): Add version
10892 parameter. Change all callers.
10893 (Symbol::init_base_output_segment): Likewise.
10894 (Symbol::init_base_constant): Likewise.
10895 (Symbol::init_base_undefined): Likewise.
10896 (Sized_symbol::init_output_data): Likewise.
10897 (Sized_symbol::init_output_segment): Likewise.
10898 (Sized_symbol::init_constant): Likewise.
10899 (Sized_symbol::init_undefined): Likewise.
10900 (Symbol_table::do_define_in_output_data): If the new symbol has a
10901 version, mark it as the default.
10902 (Symbol_table::do_define_in_output_segment): Likewise.
10903 (Symbol_table::do_define_as_constant): Likewise.
10904 * symtab.h (class Symbol): Update declarations.
10905 (class Sized_symbol): Likewise.
10906 * resolve.cc (Symbol::override_version): New function.
10907 (Symbol::override_base): Call override_version.
10908 (Symbol::override_base_with_special): Likewise.
10909 * testsuite/ver_script_8.script: New file.
10910 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10911 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10912 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10913 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10915 2008-05-06 Ian Lance Taylor <iant@google.com>
10918 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10920 (class General_options): Remove existing --undefined, and add
10921 --no-undefined instead. Add new --undefined as synonym for -u.
10922 * archive.cc (Archive::add_symbols): Check whether symbol was
10924 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10925 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10926 all uses. Add IS_UNDEFINED. Update declarations to split
10927 different versions of init_base. Declare init_base_undefined.
10928 (Symbol::is_defined): Handle IS_UNDEFINED.
10929 (Symbol::is_undefined): Likewise.
10930 (Symbol::is_weak_undefined): Call is_undefined.
10931 (Symbol::is_absolute): Handle IS_CONSTANT.
10932 (class Sized_symbol): Update declarations to split different
10933 versions of init. Declare init_undefined.
10934 (class Symbol_table): Declare new functions.
10935 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10936 Change all callers.
10937 (Symbol::init_base_output_data): Likewise.
10938 (Symbol::init_base_output_segment): Likewise.
10939 (Symbol::init_base_constant): Likewise.
10940 (Symbol::init_base_undefined): New function.
10941 (Sized_symbol::init_object): Rename from init. Change all
10943 (Sized_symbol::init_output_data): Likewise.
10944 (Sized_symbol::init_output_segment): Likewise.
10945 (Sized_symbol::init_constant): Likewise.
10946 (Sized_symbol::init_undefined): New function.
10947 (Symbol_table::add_undefined_symbols_from_command_line): New
10949 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10951 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10952 (Symbol::output_section): Likewise.
10953 (Symbol::set_output_section): Likewise.
10954 (Symbol_table::sized_finalize_symbol): Likewise.
10955 (Symbol_table::sized_write_globals): Likewise.
10956 * resolve.cc (Symbol_table::should_override): Likewise.
10957 (Symbol::override_base_with_special): Likewise.
10959 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10960 symbol, change it to have default visibility.
10961 * testsuite/protected_1.cc: New file.
10962 * testsuite/protected_2.cc: New file.
10963 * testsuite/protected_3.cc: New file.
10964 * testsuite/protected_main_1.cc: New file.
10965 * testsuite/protected_main_2.cc: New file.
10966 * testsuite/protected_main_3.cc: New file.
10967 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10968 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10969 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10970 (protected_1.so): New target.
10971 (protected_1_pic.o, protected_2_pic.o): New targets.
10972 (protected_3_pic.o): New target.
10973 (check_PROGRAMS): Add protected_2.
10974 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10975 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10976 * testsuite/Makefile.in: Rebuild.
10978 * options.h (DEFINE_var): Add set_user_set_##varname__.
10979 (DEFINE_bool_alias): New macro.
10980 (class General_options): Define -Bstatic using DEFINE_bool_alias
10981 rather than DEFINE_special. Add --undefined as an alias for -z
10983 * options.cc (General_options::parse_Bstatic): Remove.
10985 * options.h (class General_options): Add --fatal-warnings.
10986 * main.cc (main): Implement --fatal-warnings.
10987 * errors.h (Errors::warning_count): New function.
10989 * options.h (class General_options): Add -Bsymbolic-functions.
10990 * symtab.h (Symbol::is_preemptible): Check for
10991 -Bsymbolic-functions.
10993 2008-05-05 Ian Lance Taylor <iant@google.com>
10995 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10996 as noVARNAME rather than no-VARNAME.
10997 (class General_options): Add option -z combreloc.
10998 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11000 (Output_reloc::sort_before) [SHT_REL]: New function.
11001 (Output_reloc::sort_before) [SHT_RELA]: New function.
11002 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11003 Sort_relocs_comparison.
11004 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11005 parameter. Change all callers.
11006 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11007 sort_relocs parameter. Change all callers.
11008 * output.cc (Output_reloc::get_address): New function, broken out
11010 (Output_reloc::write_rel): Call it.
11011 (Output_reloc::compare): New function.
11012 (Output_data_reloc_base::do_write): Optionally sort relocs.
11014 * configure.ac: If targ_extra_obj is set, link it in.
11015 * configure.tgt: Initialize all variables.
11016 (x86_64*): Set targ_extra_obj and targ_extra_size.
11017 * configure: Rebuild.
11019 * object.cc (Sized_relobj::include_section_group): Adjust section
11020 indexes read from group data. Build vector to pass to
11022 * layout.cc (Layout::layout_group): Add flags and shndxes
11023 parameters. Remove contents parameter. Change caller. Update
11024 explicit instantiations.
11025 * layout.h (class Layout): Update layout_group declaration.
11026 * output.cc (Output_data_group::Output_data_group): Add flags and
11027 input_shndxes parameters. Remove contents parameter. Change
11029 (Output_data_group::do_write): Change input_sections_ to
11031 * output.h (class Output_data_group): Update constructor
11032 declaration. Rename input_sections_ to input_shndxes_.
11033 * testsuite/many_sections_test.cc: Add template.
11035 2008-04-30 Cary Coutant <ccoutant@google.com>
11037 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11039 * layout.cc (Layout::include_section): Refactored check for debug
11041 (Layout::add_comdat): Add new parameters. Change type
11042 of signature parameter. Add object and shndx to signatures table.
11043 (Layout::find_kept_object): New function.
11044 * layout.h: Include <cstring>.
11045 (Layout::is_debug_info_section): New function.
11046 (Layout::add_comdat): Add new parameters.
11047 (Layout::find_kept_object): New function.
11048 (Layout::Kept_section): New struct.
11049 (Layout::Signatures): Change type of map range.
11050 * object.cc (Relobj::output_section_address): New function.
11051 (Sized_relobj::include_section_group): Add new parameters. Change
11052 calls to Layout::add_comdat. Change to build table of kept comdat
11053 groups and table mapping discarded sections to kept sections.
11054 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11055 (Sized_relobj::do_layout): Change calls to include_section_group and
11056 include_linkonce_section.
11057 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11058 value to zero when section is discarded.
11059 (Sized_relobj::map_to_kept_section): New function.
11060 * object.h (Relobj::output_section_address): New function.
11061 (Relobj::Comdat_group): New type.
11062 (Relobj::find_comdat_group): New function.
11063 (Relobj::Comdat_group_table): New type.
11064 (Relobj::Kept_comdat_section): New type.
11065 (Relobj::Kept_comdat_section_table): New type.
11066 (Relobj::add_comdat_group): New function.
11067 (Relobj::set_kept_comdat_section): New function.
11068 (Relobj::get_kept_comdat_section): New function.
11069 (Relobj::comdat_groups_): New field.
11070 (Relobj::kept_comdat_sections_): New field.
11071 (Symbol_value::input_value): Update comment.
11072 (Sized_relobj::map_to_kept_section) New function.
11073 (Sized_relobj::include_linkonce_section): Add new parameter.
11074 * target-reloc.h (Comdat_behavior): New type.
11075 (get_comdat_behavior): New function.
11076 (relocate_section): Add code to map a discarded section to the
11077 corresponding kept section when applying a relocation.
11079 2008-04-30 Craig Silverstein <csilvers@google.com>
11081 * dwarf_reader.cc (next_generation_count): New static var.
11082 (Addr2line_cache_entry): New struct.
11083 (addr2line_cache): New static var.
11084 (Dwarf_line_info::one_addr2line): Added caching.
11085 (Dwarf_line_info::clear_addr2line_cache): New function.
11086 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11087 cache-size parameter.
11088 (Dwarf_line_info::one_addr2line_cache): New function.
11089 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11090 new cache-size argument to one_addr2line(), and clear cache.
11092 2008-04-28 Cary Coutant <ccoutant@google.com>
11094 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11095 R_386_PC8 relocations.
11097 2008-04-23 Ian Lance Taylor <iant@google.com>
11099 * object.cc (Sized_relobj::include_section_group): Check for
11100 invalid section group.
11102 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11105 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11106 than read for file header.
11107 * archive.cc (Archive::include_member): Likewise.
11109 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11111 * aclocal.m4: Regenerate.
11112 * configure: Regenerate.
11114 2008-04-19 Ian Lance Taylor <iant@google.com>
11116 * version.cc (version_string): Bump to 1.6.
11118 * testsuite/Makefile.am (many_sections_r_test): New target.
11119 (many_sections_r_test_SOURCES): Remove.
11120 (many_sections_r_test_DEPENDENCIES): Remove.
11121 (many_sections_r_test_LDFLAGS): Remove.
11122 (many_sections_r_test_LDADD): Remove.
11124 * object.cc (Sized_relobj::do_add_symbols): Always pass
11125 local_symbol_count_ to add_from_relobj.
11127 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11128 every thousand variables.
11129 * testsuite/Makefile.in: Rebuild.
11131 * object.cc (Xindex::initialize_symtab_xindex): New function.
11132 (Xindex::read_symtab_xindex): New function.
11133 (Xindex::sym_xindex_to_shndx): New function.
11134 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11136 (Sized_relobj::do_initialize_xindex): New function.
11137 (Sized_relobj::do_read_symbols): Adjust section links.
11138 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11139 parameter. Change all callers.
11140 (Sized_relobj::include_section_group): Adjust section links and
11141 symbol section indexes.
11142 (Sized_relobj::do_layout): Adjust section links.
11143 (Sized_relobj::do_count_local_symbols): Adjust section links and
11144 symbol section indexes.
11145 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11146 ordinary and special symbols.
11147 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11148 dynsym_xindex parameters. Change all callers. Adjust section
11149 links. Use SHN_XINDEX when needed.
11150 (Sized_relobj::get_symbol_location_info): Adjust section links.
11151 Don't get fooled by special symbols.
11152 * object.h (class Xindex): Define.
11153 (class Object): Add xindex_ parameter. Declare virtual functoin
11154 do_initialize_xindex.
11155 (Object::adjust_sym_shndx): New function.
11156 (Object::set_xindex): New protected function.
11157 (class Symbol_value): Add is_ordinary_shndx_ field.
11158 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11159 (Symbol_value::value): Assert ordinary section.
11160 (Symbol_value::initialize_input_to_output_map): Likewise.
11161 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11162 Change all callers.
11163 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11165 (class Sized_relobj): Update declarations.
11166 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11167 parameter. Change all callers.
11168 (Sized_relobj::adjust_shndx): New function.
11169 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11171 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11172 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11173 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11174 (Sized_dynobj::read_dynsym_section): Adjust section links.
11175 (Sized_dynobj::read_dynamic): Likewise.
11176 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11178 (Sized_dynobj::do_initialize_xindex): New function.
11179 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11180 do_initialize_xindex.
11181 (Sized_dynobj::adjust_shndx): New function.
11182 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11183 dynsym_xindex_ fields.
11184 (Layout::finalize): Add a call to set_section_indexes before
11185 creating the symtab sections.
11186 (Layout::set_section_indexes): Don't do anything if the section
11187 already has a section index.
11188 (Layout::create_symtab_sections): Add shnum parameter. Change
11189 caller. Create .symtab_shndx section if needed.
11190 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11192 (Layout::allocated_output_section_count): New function.
11193 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11195 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11196 fields. Update declarations.
11197 (Layout::symtab_xindex): New function.
11198 (Layout::dynsym_xindex): New function.
11199 (class Write_symbols_task): Add layout_ field.
11200 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11202 * output.cc (Output_section_headers::Output_section_headers): Add
11203 shstrtab_section parameter. Change all callers.
11204 (Output_section_headers::do_sized_write): Store overflow values
11205 for section count and section string table section index in
11206 section header zero.
11207 (Output_file_header::do_sized_write): Check for overflow of
11208 section count and section string table section index.
11209 (Output_symtab_xindex::do_write): New function.
11210 (Output_symtab_xindex::endian_do_write): New function.
11211 * output.h (class Output_section_headers): Add shstrtab_section_.
11212 Update declarations.
11213 (class Output_symtab_xindex): Define.
11214 (Output_section::has_out_shndx): New function.
11215 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11217 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11218 Change all callers.
11219 (Sized_symbol::init): Likewise.
11220 (Symbol::output_section): Check for ordinary symbol.
11221 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11222 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11224 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11225 Change all callers. Simplify handling of symbols from sections
11226 not included in the link.
11227 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11229 (Weak_alias_sorter::operator()): Assert that symbols are
11231 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11233 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11234 parameters. Change all callers.
11235 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11236 symbol distinction. Use SHN_XINDEX when needed.
11237 (Symbol_table::write_section_symbol): Add symtab_xindex
11238 parameter. Change all callers.
11239 (Symbol_table::sized_write_section_symbol): Likewise. Use
11240 SHN_XINDEX when needed.
11241 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11243 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11244 (Symbol::is_defined): Check is_ordinary.
11245 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11246 (Symbol::is_absolute, Symbol::is_common): Likewise.
11247 (class Sized_symbol): Update declarations.
11248 (class Symbol_table): Update declarations.
11249 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11250 parameters. Change all callers.
11251 (Sized_symbol::override): Likewise.
11252 (Symbol_table::override): Likewise.
11253 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11254 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11255 is_ordinary, and orig_st_shndx parameters. Change all callers.
11256 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11257 to be in an ordinary section.
11258 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11259 object and is_ordinary parameters. Change all callers.
11260 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11261 Change all callers. Don't add undefined or non-ordinary symbols
11263 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11264 Change all callers.
11265 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11267 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11268 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11269 (Sized_relobj::relocate_sections): Likewise.
11270 * target-reloc.h (scan_relocs): Adjust section symbol index.
11271 (scan_relocatable_relocs): Likewise.
11272 * i386.cc (Scan::local): Check for ordinary symbols.
11273 * sparc.cc (Scan::local): Likewise.
11274 * x86_64.cc (Scan::local): Likewise.
11275 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11276 to symbol_section_and_value.
11277 * testsuite/many_sections_test.cc: New file.
11278 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11279 (check_PROGRAMS): Add many_sections_test.
11280 (many_sections_test_SOURCES): Define.
11281 (many_sections_test_DEPENDENCIES): Define.
11282 (many_sections_test_LDFLAGS): Define.
11283 (BUILT_SOURCES): Add many_sections_define.h.
11284 (many_sections_define.h): New target.
11285 (BUILT_SOURCES): Add many_sections_check.h.
11286 (many_sections_check.h): New target.
11287 (check_PROGRAMS): Add many_sections_r_test.
11288 (many_sections_r_test_SOURCES): Define.
11289 (many_sections_r_test_DEPENDENCIES): Define.
11290 (many_sections_r_test_LDFLAGS): Define.
11291 (many_sections_r_test_LDADD): Define.
11292 (many_sections_r_test.o): New target.
11293 * testsuite/Makefile.in: Rebuild.
11295 2008-04-17 Cary Coutant <ccoutant@google.com>
11297 * errors.cc (Errors::info): New function.
11298 (gold_info): New function.
11299 * errors.h (Errors::info): New function.
11300 * gold.h (gold_info): New function.
11301 * object.cc (Input_objects::add_object): Print trace output.
11302 * options.cc (options::parse_set): New function.
11303 (General_options::parse_wrap): Deleted.
11304 (General_options::General_options): Deleted initializer.
11305 * options.h (options::String_set): New typedef.
11306 (options::parse_set): New function.
11307 (DEFINE_set): New macro.
11308 (General_options::wrap): Changed to use DEFINE_set. Changed
11309 callers of any_wrap_symbols and is_wrap_symbol.
11310 (General_options::trace, General_options::trace_symbol):
11312 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11313 (General_options::wrap_symbols_): Deleted.
11314 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11316 2008-04-17 David S. Miller <davem@davemloft.net>
11318 * options.cc (General_options::parse_V): New function.
11319 * options.h: Add entries for -V and -Qy.
11321 2008-04-17 Ian Lance Taylor <iant@google.com>
11323 * common.cc (Symbol_table::allocate_commons): Remove options
11324 parameter. Change caller.
11325 (Symbol_table::do_allocate_commons): Remove options parameter.
11326 Change caller. Just call do_allocate_commons_list twice.
11327 (Symbol_table::do_allocate_commons_list): New function, broken out
11328 of do_allocate_commons.
11329 * common.h (class Allocate_commons_task): Remove options_ field.
11330 Update constructor.
11331 * symtab.cc (Symbol_table::Symbol_table): Initialize
11333 (Symbol_table::add_from_object): Put TLS common symbols on
11335 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11336 which are IN_OUTPUT_DATA.
11337 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11338 allocate_commons and do_allocate_commons declarations. Declare
11339 do_allocate_commons_list.
11340 * gold.cc (queue_middle_tasks): Update creation of
11341 Allocate_commons_task to not pass options.
11342 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11343 (TLS_TEST_C_FLAGS): New variable.
11344 (tls_test_c_pic.o): New target.
11345 (tls_test_shared.so): Link in tls_test_c_pic.o.
11346 (tls_test_c_pic_ie.o): New target.
11347 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11348 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11349 (tls_test_c.o): New target.
11350 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11351 (tls_pic_test_LDADD): Likewise.
11352 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11353 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11354 (tls_test_c_gnu2.o): New target.
11355 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11357 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11358 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11359 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11360 * testsuite/tls_test.cc: Include "config.h".
11361 (t_last): Call t11_last.
11362 * testsuite/tls_test.h (t11, t11_last): Declare.
11363 * testsuite/tls_test_c.c: New file.
11364 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11365 * configure.ac: Check for OpenMP support.
11366 * configure, config.in, Makefile.in: Rebuild.
11367 * testsuite/Makefile.in: Rebuild.
11369 2008-04-16 Cary Coutant <ccoutant@google.com>
11371 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11372 (Target_i386::tls_base_symbol_defined_): New field.
11373 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11374 (Target_i386::Scan::global): Likewise.
11375 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11376 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11377 (Target_x86_64::tls_base_symbol_defined_): New field.
11378 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11379 (Target_x86_64::Scan::global): Likewise.
11381 2008-04-16 Cary Coutant <ccoutant@google.com>
11383 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11384 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11385 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11386 building shared libraries.
11387 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11388 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11389 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11390 * testsuite/Makefile.in: Rebuild.
11391 * testsuite/weak_undef.h: New file.
11392 * testsuite/weak_undef_file1.cc: Add extra test cases.
11393 * testsuite/weak_undef_file2.cc: Likewise.
11394 * testsuite/weak_undef_test.cc: Likewise.
11396 2008-04-16 David S. Miller <davem@davemloft.net>
11398 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11399 Add issued_non_pic_error_ field. Declare check_non_pic.
11400 (Target_sparc::Scan::check_non_pic): New function.
11401 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11402 (Target_sparc::Scan::global): Likewise.
11404 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11405 * configure: Rebuild.
11407 * options.h (DEFINE_enable): New macro.
11408 (new_dtags): New enable option.
11409 (initfirst, interpose, loadfltr, nodefaultlib,
11410 nodelete, nodlopen, nodump): New -z options.
11411 * layout.cc (Layout:finish_dynamic_section): If new
11412 dtags enabled, emit DT_RUNPATH. Also, emit a
11413 DT_FLAGS_1 containing any specified -z flags.
11415 2008-04-16 Ian Lance Taylor <iant@google.com>
11417 * copy-relocs.cc: New file.
11418 * copy-relocs.h: New file.
11419 * reloc.cc: Remove Copy_relocs code.
11420 * reloc.h: Likewise.
11421 * reloc-types.h (struct Reloc_types) [both versions]: Add
11422 get_reloc_addend_noerror.
11423 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11424 variants of add_global which take an addend which must be zero.
11425 * i386.cc: Include "copy-relocs.h".
11426 (class Target_i386): Change type of copy_relocs_ to variable,
11427 update initializer.
11428 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11429 Change all callers.
11430 (Target_i386::do_finalize_sections): Change handling of
11432 * sparc.cc: Include "copy-relocs.h".
11433 (class Target_sparc): Change type of copy_relocs_ to variable,
11434 update initializer.
11435 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11436 Change all callers.
11437 (Target_sparc::do_finalize_sections): Change handling of
11439 * x86_64.cc: Include "copy-relocs.h".
11440 (class Target_x86_64): Change type of copy_relocs_ to variable,
11441 update initializer.
11442 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11443 class. Change all callers.
11444 (Target_x86_64::do_finalize_sections): Change handling of
11446 * Makefile.am (CCFILES): Add copy-relocs.cc.
11447 (HFILES): Add copy-relocs.h.
11449 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11451 * testsuite/script_test_4.sh: Permit leading zeroes.
11453 2008-04-15 Ian Lance Taylor <iant@google.com>
11455 * script-sections.cc (Script_sections::create_segments): Use
11456 header_size_adjustment even when there is enough room for the
11458 * testsuite/script_test_4.sh: New file.
11459 * testsuite/script_test_4.t: New file.
11460 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11461 (check_DATA): Add script_test_4.stdout.
11462 (MOSTLYCLEANFILES): Likewise.
11463 (script_test_4): New target.
11464 (script_test_4.stdout): New target.
11465 * testsuite/Makefile.in: Rebuild.
11467 * sparc.cc: Add definitions for Output_data_plt_sparc class
11470 2008-04-14 David S. Miller <davem@davemloft.net>
11472 * sparc.cc: New file.
11473 * Makefile.am (TARGETSOURCES): Add sparc.cc
11474 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11475 * configure.tgt: Document targ_extra_size and
11476 targ_extra_big_endian. Add entries for sparc-* and
11478 * configure.ac: Handle targ_extra_size and
11479 targ_extra_big_endian.
11480 * Makefile.in: Rebuild.
11481 * configure: Likewise.
11482 * po/POTFILES.in: Likewise.
11483 * po/gold.pot: Likewise.
11485 2008-04-14 Ian Lance Taylor <iant@google.com>
11487 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11488 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11489 in the name/type/flags to section mapping. Don't call
11490 allocate_output_section.
11491 (Layout::choose_output_section): Change parameter from adjust_name
11492 to is_input_section. Don't permit input sections after sections
11493 are attached to segments. Don't call allocate_output_section.
11494 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11495 not write_enable_output_section.
11496 (Layout::make_output_section): Don't push to
11497 unattached_section_list_ nor call attach_to_segment. Call
11498 attach_section_to_segment if sections are attached.
11499 (Layout::attach_sections_to_segments): New function.
11500 (Layout::attach_section_to_segment): New function.
11501 (Layout::attach_allocated_section_to_segment): Rename from
11502 attach_to_segment. Remove flags parameter.
11503 (Layout::allocate_output_section): Remove function.
11504 (Layout::write_enable_output_section): Remove function.
11505 * layout.h (class Layout): Update for above changes. Add new
11506 field sections_are_attached_.
11507 * output.h (Output_section::update_flags_for_input_section): New
11509 * output.cc (Output_section::add_input_section): Call
11510 update_flags_for_input_section.
11511 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11513 2008-04-11 Cary Coutant <ccoutant@google.com>
11515 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11516 thought unnecessary.
11517 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11519 2008-04-11 Ian Lance Taylor <iant@google.com>
11521 * output.h (class Output_section_data): Remove inline definition
11523 * output.cc (Output_section_data::set_addralign): New function.
11525 2008-04-11 Cary Coutant <ccoutant@google.com>
11527 Add support for TLS descriptors for i386 and x86_64.
11528 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11529 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11530 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11532 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11533 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11534 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11536 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11537 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11538 Fix problem with initial-exec relocations.
11539 (Target_i386::Relocate::relocate_tls): Likewise.
11540 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11542 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11543 support for section-plus-offset dynamic table entries.
11544 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11545 (Output_data_dynamic::Dynamic_entry): Add support for
11546 section-plus-offset dynamic table entries.
11547 (Output_data_dynamic::Classification): Likewise.
11548 (Output_data_dynamic::classification_): Renamed offset_.
11549 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11550 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11551 (Target_x86_64::make_plt_section): New function.
11552 (Target_x86_64::reserve_tlsdesc_entries): New function.
11553 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11554 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11555 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11556 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11557 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11558 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11559 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11560 add extra PLT entry for TLS descriptors.
11561 (Output_data_plt_x86_64::got_): New field.
11562 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11563 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11565 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11567 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11568 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11569 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11570 R_386_TLS_DESC_CALL relocations.
11571 (Target_x86_64::Scan::global): Likewise.
11572 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11573 for TLS descriptors.
11574 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11575 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11576 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11577 GD-to-IE relaxation.
11578 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11579 and TLS_DESCRIPTORS.
11580 * Makefile.in: Rebuild.
11581 * configure: Rebuild.
11582 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11583 (tls_test_shared2.so): New target.
11584 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11585 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11586 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11587 (tls_shared_gd_to_ie_test_LDADD): New variable.
11588 (tls_shared_gnu2_gd_to_ie_test): New target.
11589 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11591 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11592 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11593 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11594 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11595 (tls_shared_gnu2_test): New target.
11596 (tls_test_gnu2_shared.so): New target.
11597 (tls_shared_gnu2_test_SOURCES): New variable.
11598 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11599 (tls_shared_gnu2_test_LDFLAGS): New variable.
11600 (tls_shared_gnu2_test_LDADD): New variable.
11601 * testsuite/Makefile.in: Rebuild.
11602 * testsuite/Makefile.
11604 2008-04-11 Ian Lance Taylor <iant@google.com>
11606 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11608 * testsuite/Makefile.in: Rebuild.
11610 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11612 * testsuite/script_test_2.cc (main): Adjust test.
11614 2008-04-11 David S. Miller <davem@davemloft.net>
11615 Ian Lance Taylor <iant@google.com>
11617 * options.h (General_options): Add entries for '-Y' and
11619 * options.cc (General_options:finalize): If -Y was used, add those
11620 entries to the library path instead of the default "/lib" and
11623 2008-04-11 David S. Miller <davem@davemloft.net>
11625 * testsuite/justsyms.t: Start at 0x100.
11626 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11627 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11629 * testsuite/script_test_2.cc: Adjust string and section length
11632 2008-04-09 Ian Lance Taylor <iant@google.com>
11635 * script-sections.cc (Sections_element::allocate_to_segment): Add
11637 (Output_section_definition::allocate_to_segment): Likewise.
11638 (Orphan_output_section::allocate_to_segment): Likewise.
11639 (Script_sections::attach_sections_using_phdrs_clause): Don't
11640 propagate non-PT_LOAD segments to orphan sections.
11641 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11642 readelf rather than objdump.
11643 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11644 .interp section and PT_INTERP segment are the same size.
11645 * testsuite/Makefile.in: Rebuild.
11647 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11648 aliases for symbols defined in the same object.
11649 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11650 (weak_alias_test_SOURCES): New variable.
11651 (weak_alias_test_DEPENDENCIES): New variable.
11652 (weak_alias_test_LDFLAGS): New variable.
11653 (weak_alias_test_LDADD): New variable.
11654 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11655 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11656 (weak_alias_test_3.o): New target.
11657 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11658 * testsuite/weak_alias_test_main.cc: New file.
11659 * testsuite/weak_alias_test_1.cc: New file.
11660 * testsuite/weak_alias_test_2.cc: New file.
11661 * testsuite/weak_alias_test_3.cc: New file.
11663 2008-04-08 Ian Lance Taylor <iant@google.com>
11665 * options.h (class General_options): Add --noinhibit-exec option.
11666 * main.cc (main): Check --noinhibit-exec.
11668 * options.h (class General_options): Define --wrap as a special
11669 option. Add wrap_symbols_ field.
11670 (General_options::any_wrap_symbols): New function.
11671 (General_options::is_wrap_symbol): New function.
11672 * options.cc (General_options::parse_wrap): New function.
11673 (General_options::General_options): Initialize wrap_symbols_.
11674 * symtab.cc (Symbol_table::wrap_symbol): New function.
11675 (Symbol_table::add_from_object): Handle --wrap.
11676 * symtab.h (class Symbol_table): Declare wrap_symbol.
11677 * target.h (Target::wrap_char): New function.
11678 (Target::Target_info): Add wrap_char field.
11679 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11680 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11681 * testsuite/testfile.cc (Target_test::test_target_info):
11684 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11687 * layout.h (class Layout): Add added_eh_frame_data_ field.
11688 * layout.cc (Layout::Layout): Initialize new field.
11689 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11690 output section until we find a section we merged successfully.
11691 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11692 that the size be non-zero.
11694 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11697 2008-04-08 Craig Silverstein <csilvers@google.com>
11699 * configure.ac: Export new conditional variable HAVE_ZLIB.
11700 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11702 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11703 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11705 2008-04-07 Ian Lance Taylor <iant@google.com>
11707 * version.cc (version_string): Set to "1.5".
11709 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11710 Add issued_non_pic_error_ field. Declare check_non_pic.
11711 (Target_x86_64::Scan::check_non_pic): New function.
11712 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11713 (Target_x86_64::Scan::global): Likewise.
11715 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11716 addend parameter. Change caller. Handle merge sections.
11717 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11718 Address to Addend. Don't add in the result of
11719 local_section_offset, pass down the addend and use the returned
11721 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11722 Update declarations of local_section_offset and symbol_value.
11723 * testsuite/two_file_test_1.cc (t18): New function.
11724 * testsuite/two_file_test_2.cc (f18): New function.
11725 * testsuite/two_file_test_main.cc (main): Call t18.
11726 * testsuite/two_file_test.h (t18, f18): Declare.
11728 * configure.ac: Don't test for objdump, c++filt, or readelf.
11729 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11731 (TEST_READELF): New variable.
11732 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11733 (check_PROGRAMS): Add two_file_strip_test.
11734 (two_file_strip_test): New target.
11735 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11736 (two_file_same_shared_strip_test_SOURCES): New variable.
11737 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11738 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11739 (two_file_same_shared_strip_test_LDADD): New variable.
11740 (two_file_shared_strip.so): New target.
11741 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11742 (ver_test_5.syms, ver_test_7.syms): Likewise.
11743 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11744 (strip_test_3.stdout): Use TEST_OBJDUMP.
11745 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11747 2008-04-04 Cary Coutant <ccoutant@google.com>
11749 * symtab.h (Symbol::is_weak_undefined): New function.
11750 (Symbol::is_strong_undefined): New function.
11751 (Symbol::is_absolute): New function.
11752 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11753 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11755 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11756 (weak_undef_test): New target.
11757 * testsuite/Makefile.in: Rebuild.
11758 * testsuite/weak_undef_file1.cc: New file.
11759 * testsuite/weak_undef_file2.cc: New file.
11760 * testsuite/weak_undef_test.cc: New file.
11762 2008-04-03 Craig Silverstein <csilvers@google.com>
11764 * compressed_output.h (class Output_compressed_section): Use
11766 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11768 (zlib_compressed_suffix): Removed.
11769 (Output_compressed_section::set_final_data_size): Use unsigned
11771 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11772 Fix linker invocation.
11773 (flagstest_o_specialfile_and_compress_debug_sections):
11775 * testsuite/Makefile.in: Regenerated.
11777 2008-04-02 David S. Miller <davem@davemloft.net>
11779 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11780 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11782 2008-04-02 Craig Silverstein <csilvers@google.com>
11786 2008-04-02 Ian Lance Taylor <iant@google.com>
11788 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11789 parameters. Update for new key type to views_. Change all
11791 (File_read::read): Adjust for byteshift in returned view.
11792 (File_read::add_view): New function, broken out of
11793 find_and_make_view.
11794 (File_read::make_view): New function, broken out of
11795 find_and_make_view.
11796 (File_read::find_or_make_view): Add offset and aligned
11797 parameters. Rewrite accordingly. Change all callers.
11798 (File_read::get_view): Add offset and aligned parameters. Adjust
11799 for byteshift in return value.
11800 (File_read::get_lasting_view): Likewise.
11801 * fileread.h (class File_read): Update declarations.
11802 (class File_read::View): Add byteshift_ field. Add byteshift to
11803 constructor. Add byteshift method.
11804 * archive.h (Archive::clear_uncached_views): New function.
11805 (Archive::get_view): Add aligned parameter. Change all callers.
11806 * object.h (Object::get_view): Add aligned parameter. Change all
11808 (Object::get_lasting_view): Likewise.
11810 * fileread.cc (File_read::release): Don't call clear_views if
11811 there are multiple objects.
11812 * fileread.h (File_read::clear_uncached_views): New function.
11813 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11816 2008-03-31 Cary Coutant <ccoutant@google.com>
11818 Add thin archive support.
11819 * archive.cc (Archive::armagt): New const.
11820 (Archive::setup): Remove task parameter and calls to unlock.
11821 (Archive::unlock_nested_archives): New function.
11822 (Archive::read_header): Add nested_off parameter. Change
11824 (Archive::interpret_header): Likewise.
11825 (Archive::include_all_members): Change to handle thin
11827 (Archive::include_member): Likewise.
11828 * archive.h (Archive::Archive): Add new parameters and
11830 (Archive::armagt): New const.
11831 (Archive::setup): Remove task parameter.
11832 (Archive::unlock_nested_archives): New function.
11833 (Archive::read_header): Add nested_off parameter.
11834 (Archive::interpret_header): Likewise.
11835 (Archive::Nested_archive_table): New typedef.
11836 (Archive::is_thin_archive_): New field.
11837 (Archive::nested_archives_): New field.
11838 (Archive::options_): New field.
11839 (Archive::dirpath_): New field.
11840 (Archive::task_): New field.
11841 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11842 for thin archives. Pass additional parameters to
11843 Archive::Archive. Unlock the archive file after calling
11846 2008-03-29 Ian Lance Taylor <iant@google.com>
11848 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11849 version symbol to be local.
11850 * testsuite/ver_test_4.sh: New file.
11851 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11852 (check_DATA): Add ver_test_4.syms.
11853 (ver_test_4.syms): New target.
11854 * testsuite/Makefile.in: Rebuild.
11857 (Output_section::Input_section_sort_entry::has_priority): New
11859 (Output_section::Input_section_sort_entry::match_file_name): New
11861 (Output_section::Input_section_sort_entry::match_section_name):
11863 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11865 (Output_section::Input_section_sort_entry::match_section_file):
11867 (Output_section::Input_section_sort_compare::operator()): Rewrite
11868 using new Input_section_sort_entry functions. Sort crtbegin and
11869 crtend first. Sort sections with no priority before sections with
11871 * testsuite/initpri1.c (d3): Check j != 4.
11872 (cd5): New constructor/destructor function.
11873 (main): Check j != 2.
11875 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11876 new symbol when resolving, don't call set_is_default.
11877 * testsuite/ver_test_7.cc: New file.
11878 * testsuite/ver_test_7.sh: New file.
11879 * testsuite/Makefile.am (ver_test_7.so): New target.
11880 (ver_test_7.o): New target.
11881 (check_SCRIPTS): Add ver_test_7.sh.
11882 (check_DATA): Add ver_test_7.syms.
11883 (ver_test_7.syms): New target.
11885 2008-03-28 Ian Lance Taylor <iant@google.com>
11887 * layout.cc (Layout::layout): If we see an input section with a
11888 name that needs sorting, set the must_sort flag for the output
11890 (Layout::make_output_section): If the name of the output section
11891 indicates that it might require sorting, set the may_sort flag.
11892 * output.h (Output_section::may_sort_attached_input_sections): New
11894 (Output_section::set_may_sort_attached_input_sections): New
11896 (Output_section::must_sort_attached_input_sections): New
11898 (Output_section::set_must_sort_attached_input_sections): New
11900 (class Output_section): Declare Input_section_sort_entry. Define
11901 Input_section_sort_compare. Declare
11902 sort_attached_input_sections. Add new fields:
11903 may_sort_attached_input_sections_,
11904 must_sort_attached_input_sections_,
11905 attached_input_sections_are_sorted_.
11906 * output.cc (Output_section::Output_section): Initialize new
11908 (Output_section::add_input_section): Add an entry to
11909 input_sections_ if may_sort or must_sort are true.
11910 (Output_section::set_final_data_size): Call
11911 sort_attached_input_sections if necessary.
11912 (Output_section::Input_section_sort_entry): Define new class.
11913 (Output_section::Input_section_sort_compare::operator()): New
11915 (Output_section::sort_attached_input_sections): New function.
11916 * configure.ac: Check whether the compiler supports constructor
11917 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11918 * testsuite/initpri1.c: New file.
11919 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11920 CONSTRUCTOR_PRIORITY.
11921 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11922 (initpri1_LDFLAGS): New variable.
11923 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11925 2008-03-27 Ian Lance Taylor <iant@google.com>
11927 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11928 * testsuite/common_test_1.c: New file.
11929 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11930 (common_test_1_SOURCES): New variable.
11931 (common_test_1_DEPENDENCIES): New variable.
11932 (common_test_1_LDFLAGS): New variable.
11934 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11935 and commons_ correctly when NAME/VERSION does not override
11937 * testsuite/ver_test_6.c: New file.
11938 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11939 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11940 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11942 2008-03-26 Ian Lance Taylor <iant@google.com>
11944 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11945 of an undefined symbol from a version script.
11946 * testsuite/Makefile.am (ver_test_5.so): New target.
11947 (ver_test_5.o): New target.
11948 (check_SCRIPTS): Add ver_test_5.sh.
11949 (check_DATA): Add ver_test_5.syms.
11950 (ver_test_5.syms): New target.
11951 * testsuite/ver_test_5.cc: New file.
11952 * testsuite/ver_test_5.script: New file.
11953 * testsuite/ver_test_5.sh: New file.
11954 * Makefile.in, testsuite/Makefile.in: Rebuild.
11957 Fix problems building gold with gcc 4.3.0.
11958 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11959 (gold_error_at_location, gold_warning_at_location): Use it.
11960 * configure.ac: Check whether we can compile and use a template
11961 function with a printf attribute.
11962 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11963 when jumping over bytes.
11964 * object.cc: Instantiate Object::read_section_data.
11965 * debug.h: Include <cstring>
11966 * dwarf_reader.cc: Include <algorithm>
11967 * main.cc: Include <cstring>.
11968 * options.cc: Include <cstring>.
11969 * output.cc: Include <cstring>.
11970 * script.cc: Include <cstring>.
11971 * script.h: Include <string>.
11972 * symtab.cc: Include <cstring> and <algorithm>.
11973 * target-select.cc: Include <cstring>.
11974 * version.cc: Include <string>.
11975 * testsuite/testmain.cc: Include <cstdlib>.
11976 * configure, config.in: Rebuild.
11978 2008-03-25 Ian Lance Taylor <iant@google.com>
11980 * options.cc: Include "../bfd/bfdver.h".
11981 (options::help): Print bug reporting address.
11983 * version.cc (print_version): Adjust output for current value of
11984 BFD_VERSION_STRING.
11988 * options.cc (options::help): Print list of supported targets.
11989 * target-select.h: Include <vector>.
11990 (class Target_selector): Make machine_, size_, and is_big_endian_
11991 fields const. Add bfd_name_ and instantiated_target_ fields.
11992 (Target_selector::Target_selector): Add bfd_name parameter.
11993 (Target_selector::recognize): Make non-virtual, call
11995 (Target_selector::recognize_by_name): Make non-virtual, call
11996 do_recognize_by_name.
11997 (Target_selector::supported_names): New function.
11998 (Target_selector::bfd_name): New function.
11999 (Target_selector::do_instantiate_target): New pure virtual
12001 (Target_selector::do_recognize): New virtual function.
12002 (Target_selector::do_recognize_by_name): New virtual function.
12003 (Target_selector::instantiate_target): New private function.
12004 (supported_target_names): Declare.
12005 * target-select.cc (Target_selector::Target_selector): Update for
12006 new parameter and fields.
12007 (select_target_by_name): Check that the name matches before
12008 calling recognize_by_name.
12009 (supported_target_names): New function.
12010 * i386.cc (class Target_selector_i386): Update Target_selector
12011 constructor call. Remove recognize and recognize_by_name. Add
12012 do_instantiate_target.
12013 * x86_64.cc (class Target_selector_x86_64): Likewise.
12014 * testsuite/testfile.cc (class Target_selector_test): Update for
12015 changes to Target_selector.
12017 * README: Rewrite, with some notes on unsupported features.
12019 2008-03-24 Cary Coutant <ccoutant@google.com>
12021 * i386.cc (Target_i386::Got_type): New enum declaration.
12022 (Target_i386::Scan::local): Updated callers of Output_data_got
12024 (Target_i386::Scan::global): Likewise.
12025 (Target_i386::Relocate::relocate): Likewise.
12026 (Target_i386::Relocate::relocate_tls): Likewise.
12027 * object.h (Got_offset_list): New class.
12028 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12029 (Sized_relobj::local_got_offset): Likewise.
12030 (Sized_relobj::set_local_got_offset): Likewise.
12031 (Sized_relobj::local_has_tls_got_offset): Removed.
12032 (Sized_relobj::local_tls_got_offset): Removed.
12033 (Sized_relobj::set_local_tls_got_offset): Removed.
12034 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12035 * output.cc (Output_data_got::add_global): Added got_type parameter.
12036 (Output_data_got::add_global_with_rel): Likewise.
12037 (Output_data_got::add_global_with_rela): Likewise.
12038 (Output_data_got::add_global_pair_with_rel): New function.
12039 (Output_data_got::add_global_pair_with_rela): New function.
12040 (Output_data_got::add_local): Added got_type parameter.
12041 (Output_data_got::add_local_with_rel): Likewise.
12042 (Output_data_got::add_local_with_rela): Likewise.
12043 (Output_data_got::add_local_pair_with_rel): New function.
12044 (Output_data_got::add_local_pair_with_rela): New function.
12045 (Output_data_got::add_global_tls): Removed.
12046 (Output_data_got::add_global_tls_with_rel): Removed.
12047 (Output_data_got::add_global_tls_with_rela): Removed.
12048 (Output_data_got::add_local_tls): Removed.
12049 (Output_data_got::add_local_tls_with_rel): Removed.
12050 (Output_data_got::add_local_tls_with_rela): Removed.
12051 * output.h (Output_data_got::add_global): Added got_type parameter.
12052 (Output_data_got::add_global_with_rel): Likewise.
12053 (Output_data_got::add_global_with_rela): Likewise.
12054 (Output_data_got::add_global_pair_with_rel): New function.
12055 (Output_data_got::add_global_pair_with_rela): New function.
12056 (Output_data_got::add_local): Added got_type parameter.
12057 (Output_data_got::add_local_with_rel): Likewise.
12058 (Output_data_got::add_local_with_rela): Likewise.
12059 (Output_data_got::add_local_pair_with_rel): New function.
12060 (Output_data_got::add_local_pair_with_rela): New function.
12061 (Output_data_got::add_global_tls): Removed.
12062 (Output_data_got::add_global_tls_with_rel): Removed.
12063 (Output_data_got::add_global_tls_with_rela): Removed.
12064 (Output_data_got::add_local_tls): Removed.
12065 (Output_data_got::add_local_tls_with_rel): Removed.
12066 (Output_data_got::add_local_tls_with_rela): Removed.
12067 * resolve.cc (Symbol::override_base_with_special): Removed
12068 reference to has_got_offset_ field.
12069 * symtab.cc (Symbol::init_fields): Replaced initialization
12070 of got_offset_ with got_offsets_. Removed initialization
12072 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12073 (Symbol::got_offset): Likewise.
12074 (Symbol::set_got_offset): Likewise.
12075 (Symbol::has_tls_got_offset): Removed.
12076 (Symbol::tls_got_offset): Removed.
12077 (Symbol::set_tls_got_offset): Removed.
12078 (Symbol::got_offset_): Removed.
12079 (Symbol::tls_mod_got_offset_): Removed.
12080 (Symbol::tls_pair_got_offset_): Removed.
12081 (Symbol::got_offsets_): New field.
12082 (Symbol::has_got_offset): Removed.
12083 (Symbol::has_tls_mod_got_offset): Removed.
12084 (Symbol::has_tls_pair_got_offset): Removed.
12085 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12086 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12088 (Target_x86_64::Scan::global): Likewise.
12089 (Target_x86_64::Relocate::relocate): Likewise.
12090 (Target_x86_64::Relocate::relocate_tls): Likewise.
12092 2008-03-25 Ben Elliston <bje@au.ibm.com>
12094 * yyscript.y: Fix spelling error in comment.
12096 2008-03-24 Ian Lance Taylor <iant@google.com>
12098 * options.h (class General_options): Define build_id option.
12099 * layout.h (class Layout): Declare write_build_id, create_note,
12100 create_build_id. Add build_id_note_ member.
12101 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12102 "libiberty.h", "md5.h", "sha1.h".
12103 (Layout::Layout): Initialize eh_frame_data_,
12104 eh_frame_hdr_section_, and build_id_note_.
12105 (Layout::finalize): Call create_build_id.
12106 (Layout::create_note): New function, broken out of
12107 Layout::create_gold_note.
12108 (Layout::create_gold_note): Call create_note.
12109 (Layout::create_build_id): New function.
12110 (Layout::write_build_id): New function.
12111 (Close_task_runner::run): Call write_build_id.
12113 * x86_64.cc: Correct license to GPLv3.
12115 2008-03-23 Ian Lance Taylor <iant@google.com>
12117 * options.cc: Include "demangle.h".
12118 (parse_optional_string): New function.
12119 (parse_long_option): Handle takes_optional_argument.
12120 (parse_short_option): Update dash_z initializer. Handle
12121 takes_optional_argument.
12122 (General_options::General_options): Initialize do_demangle_.
12123 (General_options::finalize): Set do_demangle_. Handle demangling
12125 * options.h (parse_optional_string): Declare.
12126 (struct One_option): Add optional_arg field. Update constructor.
12127 Update call constructor calls. Add takes_optional_argument
12129 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12130 (DEFINE_optional_string): Define.
12131 (General_options::demangle): Change from DEFINE_bool to
12132 DEFINE_optional_string.
12133 (General_options::no_demangle): New function.
12134 (General_options::do_demangle): New function.
12135 (General_options::set_do_demangle): New function.
12136 (General_options::execstack_status_): Move definition to end of
12138 (General_options::static_): Likewise.
12139 (General_options::do_demangle_): New field.
12140 * object.cc (big_endian>::get_symbol_location_info): Call
12141 Options::do_demangle, not Options::demangle.
12142 * symtab.cc (demangle): Likewise.
12144 2008-03-22 Ian Lance Taylor <iant@google.com>
12146 * gold.h: Include <cstddef> and <sys/types.h>
12147 * options.h: Include <cstring>.
12149 2008-03-21 Ian Lance Taylor <iant@google.com>
12151 * Added source code to GNU binutils.