d844b4001f831494c28925317360ee364598937f
[binutils-gdb.git] / gold / ChangeLog
1 2011-10-19 Ian Lance Taylor <iant@google.com>
2
3 PR gold/13163
4 * script-sections.cc
5 (Output_section_element_dot_assignment::needs_output_section): New
6 function.
7
8 2011-10-19 Ian Lance Taylor <iant@google.com>
9
10 PR gold/13204
11 * layout.cc (Layout::segment_precedes): Don't assert failure if a
12 --section-start option was seen.
13 * options.h (General_options::any_section_start): New function.
14
15 2011-10-18 David S. Miller <davem@davemloft.net>
16
17 PR binutils/13301
18 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
19 member to track relocation locations that have moved during TLS
20 reloc optimizations.
21 (Target_sparc::Relocate::Relocate): Initialize to NULL.
22 (Target_sparc::Relocate::relocate): Adjust view down by 4
23 bytes if it matches reloc_adjust_addr_.
24 (Target_sparc::Relocate::relocate_tls): Always move the
25 __tls_get_addr call delay slot instruction forward 4 bytes when
26 performing relaxation.
27
28 2011-10-18 Cary Coutant <ccoutant@google.com>
29
30 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
31 (Output_file::map_no_anonymous): Check for non-zero
32 return code from posix_fallocate.
33
34 2011-10-17 Cary Coutant <ccoutant@google.com>
35
36 PR gold/13245
37 * plugin.cc (is_visible_from_outside): Check for symbols
38 referenced from dynamic objects.
39 * resolve.cc (Symbol_table::resolve): Don't count references
40 from dynamic objects as references from real ELF files.
41 * testsuite/plugin_test_2.sh: Adjust expected result.
42
43 2011-10-17 Cary Coutant <ccoutant@google.com>
44
45 * gold.cc: Include timer.h.
46 (queue_middle_tasks): Stamp time.
47 (queue_final_tasks): Likewise.
48 * main.cc (main): Store timer in parameters. Print timers
49 for each pass.
50 * parameters.cc (Parameters::Parameters): Initialize timer_.
51 (Parameters::set_timer): New function.
52 (set_parameters_timer): New function.
53 * parameters.h (Parameters::set_timer): New function.
54 (Parameters::timer): New function.
55 (Parameters::timer_): New data member.
56 (set_parameters_timer): New function.
57 * timer.cc (Timer::stamp): New function.
58 (Timer::get_pass_time): New function.
59 * timer.h (Timer::stamp): New function.
60 (Timer::get_pass_time): New function.
61 (Timer::pass_times_): New data member.
62
63 2011-10-17 Cary Coutant <ccoutant@google.com>
64
65 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
66 task for members of lib groups.
67
68 2011-10-17 Cary Coutant <ccoutant@google.com>
69
70 PR gold/13288
71 * fileread.cc (File_read::find_view): Add assert.
72 (File_read::make_view): Move bounds check (replace with assert)...
73 (File_read::find_or_make_view): ... to here.
74
75 2011-10-12 Cary Coutant <ccoutant@google.com>
76
77 * output.cc (Output_file::open_base_file): Handle case where
78 ::read returns less than requested size.
79
80 2011-10-10 Cary Coutant <ccoutant@google.com>
81
82 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
83 Initialize defined_count_.
84 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
85 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
86 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
87 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
88 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
89 * incremental.h (Sized_relobj_incr::defined_count_): New data
90 member.
91 (Sized_incr_dynobj::defined_count_): New data member.
92 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
93 Return zeroes instead of internal error.
94
95 2011-10-10 Cary Coutant <ccoutant@google.com>
96
97 PR gold/13249
98 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
99 (Output_reloc::symbol_value): Return PLT offset if flag is set.
100 * output.h (class Output_reloc): Add use_plt_offset flag.
101 (Output_reloc::type_): Adjust size of bit field.
102 (Output_reloc::use_plt_offset_): New bit field.
103 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
104 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
105 flag. Adjust all callers.
106 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
107 creating RELATIVE relocations.
108
109 2011-10-10 Nick Clifton <nickc@redhat.com>
110
111 * po/es.po: Updated Spanish translation.
112 * po/fi.po: Updated Finnish translation.
113
114 2011-10-03 Diego Novillo <dnovillo@google.com>
115
116 * options.cc (parse_uint): Fix dereference of RETVAL.
117
118 2011-09-29 Sriraman Tallam <tmsriram@google.com>
119
120 * layout.h (section_order_map_): New member.
121 (get_section_order_map): New member function.
122 * output.cc (Output_section::add_input_section): Check for patterns
123 only when --section-ordering-file is specified.
124 * gold.cc (queue_middle_tasks): Delay updating order of sections till
125 output_sections have been formed.
126 * layout.cc (Layout_Layout): Initialize section_order_map_.
127 * plugin.cc (update_section_order): Store order in order_map. Do not
128 update the order.
129 * testsuite/Makefile.am: Add test case for plugin_final_layout.
130 * testsuite/Makefile.in: Regenerate.
131 * testsuite/plugin_section_order.c: New file.
132 * testsuite/plugin_final_layout.cc: New file.
133 * testsuite/plugin_final_layout.sh: New file.
134
135 2011-09-29 Cary Coutant <ccoutant@google.com>
136
137 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
138 Check for NULL.
139 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
140 symbols during incremental update.
141 (Symbol_table::add_from_dynobj): Likewise.
142
143 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
144 Ian Lance Taylor <iant@google.com>
145
146 * symtab.cc (Symbol_table::define_special_symbol): Always
147 canonicalize version string.
148
149 2011-09-26 Cary Coutant <ccoutant@google.com>
150
151 * gold.cc (queue_initial_tasks): Move option checks ...
152 * options.cc (General_options::finalize): ... to here. Disable
153 some options; make others fatal.
154
155 2011-09-26 Cary Coutant <ccoutant@google.com>
156
157 gcc PR lto/47247
158 * plugin.cc (get_symbols_v2): New function.
159 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
160 (is_referenced_from_outside): New function.
161 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
162 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
163 (get_symbols): Pass version parameter.
164 (get_symbols_v2): New function.
165 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
166 parameter.
167 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
168 (onload): Add LDPT_GET_SYMBOLS_V2.
169 (all_symbols_read_hook): Use get_symbols_v2; check for
170 LDPR_PREVAILING_DEF_IRONLY_EXP.
171 * testsuite/plugin_test_3.sh: Update expected results.
172
173 2011-09-23 Simon Baldwin <simonb@google.com>
174
175 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
176 configuration options.
177 * configure: Regenerate.
178 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
179 * Makefile.in: Regenerate.
180 * testsuite/Makefile.in: Regenerate.
181
182 2011-09-19 Sriraman Tallam <tmsriram@google.com>
183
184 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
185
186 2011-09-19 Cary Coutant <ccoutant@google.com>
187
188 * incremental.cc (can_incremental_update): Fix typo in comment.
189 * incremental.h (can_incremental_update): Likewise.
190
191 2011-09-18 Cary Coutant <ccoutant@google.com>
192
193 * incremental.cc (can_incremental_update): New function.
194 * incremental.h (can_incremental_update): New function.
195 * layout.cc (Layout::init_fixed_output_section): Call it.
196 (Layout::make_output_section): Don't allow patch space in .eh_frame.
197 * object.cc (Sized_relobj_file::do_layout): Call
198 can_incremental_update.
199
200 2011-09-13 Cary Coutant <ccoutant@google.com>
201
202 * configure.ac: Check for glibc support for gnu_indirect_function
203 support with static linking, setting automake conditional
204 IFUNC_STATIC.
205 * Makefile.in: Regenerate.
206 * configure: Regenerate.
207
208 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
209 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
210 for IFUNC_STATIC.
211 * testsuite/Makefile.in: Regenerate.
212
213 2011-09-13 Cary Coutant <ccoutant@google.com>
214
215 * incremental.cc (Sized_relobj_incr::do_layout): Call
216 report_comdat_group for kept comdat sections.
217 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
218 * testsuite/Makefile.in: Regenerate.
219 * testsuite/incr_comdat_test_1.cc: New source file.
220 * testsuite/incr_comdat_test_2_v1.cc: New source file.
221 * testsuite/incr_comdat_test_2_v2.cc: New source file.
222 * testsuite/incr_comdat_test_2_v3.cc: New source file.
223
224 2011-09-13 Ian Lance Taylor <iant@google.com>
225
226 * object.cc (Sized_relobj_file::do_layout): Remove unused local
227 variable external_symbols_offset.
228
229 2011-09-12 Ian Lance Taylor <iant@google.com>
230
231 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
232 triggered if object has no symbols.
233
234 2011-09-09 David S. Miller <davem@davemloft.net>
235
236 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
237 (Output_fill_debug_line::do_write): Likewise.
238
239 2011-08-29 Cary Coutant <ccoutant@google.com>
240
241 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
242 casts to match formatting specs.
243 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
244
245 2011-08-26 Cary Coutant <ccoutant@google.com>
246
247 * layout.cc (Free_list::allocate): Provide guarantee of minimum
248 remaining hole size when allocating.
249 (Layout::make_output_section): Set fill methods for debug sections.
250 * layout.h (Free_list::Free_list_node): Move from private to
251 public.
252 (Free_list::set_min_hole_size): New function.
253 (Free_list::begin, Free_list::end): New functions.
254 (Free_list::min_hole_): New data member.
255 * output.cc: Include dwarf.h.
256 (Output_fill_debug_info::do_minimum_hole_size): New function.
257 (Output_fill_debug_info::do_write): New function.
258 (Output_fill_debug_line::do_minimum_hole_size): New function.
259 (Output_fill_debug_line::do_write): New function.
260 (Output_section::Output_section): Initialize new data member.
261 (Output_section::set_final_data_size): Ensure patch space is larger
262 than minimum hole size.
263 (Output_section::do_write): Fill holes in debug sections.
264 * output.h (Output_fill): New class.
265 (Output_fill_debug_info): New class.
266 (Output_fill_debug_line): New class.
267 (Output_section::set_free_space_fill): New function.
268 (Output_section::free_space_fill_): New data member.
269 * testsuite/Makefile.am (incremental_test_3): Add
270 --incremental-patch option.
271 (incremental_test_4): Likewise.
272 (incremental_test_5): Likewise.
273 (incremental_test_6): Likewise.
274 (incremental_copy_test): Likewise.
275 (incremental_common_test_1): Likewise.
276 * testsuite/Makefile.in: Regenerate.
277
278 2011-08-26 Nick Clifton <nickc@redhat.com>
279
280 * po/es.po: Updated Spanish translation.
281
282 2011-08-01 Cary Coutant <ccoutant@google.com>
283
284 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
285 * gold/testsuite/Makefile.in: Regenerate.
286 * gold/testsuite/justsyms_exec.c: New source file.
287 * gold/testsuite/justsyms_lib.c: New source file.
288
289 2011-08-01 Cary Coutant <ccoutant@google.com>
290
291 * layout.cc (Layout::set_segment_offsets): Don't realign text
292 segment if -Ttext was specified.
293 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
294 file type.
295 * object.h (Sized_relobj_file::e_type): New function.
296 (Sized_relobj_file::e_type_): New data member.
297 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
298 base address for ET_EXEC files.
299 * target.cc (Target::do_make_elf_object_implementation): Allow
300 ET_EXEC files with --just-symbols option.
301
302 2011-07-28 Cary Coutant <ccoutant@google.com>
303
304 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
305 Add thread_number parameter.
306 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
307 * workqueue-threads.cc
308 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
309 current thread if its thread number is greater than desired thread
310 count.
311 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
312 Add thread_number parameter.
313 (Workqueue::should_cancel_thread): Likewise.
314 (Workqueue::find_runnable_or_wait): Pass thread_number to
315 should_cancel_thread.
316 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
317 parameter.
318
319 2011-07-22 Sriraman Tallam <tmsriram@google.com>
320
321 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
322 only after checking if it cannot be forced local.
323 * symtab.h (is_externally_visible): Check if the symbol is not forced
324 local.
325
326 2011-07-15 Ian Lance Taylor <iant@google.com>
327
328 * options.h (class General_options): Add --print-output-format.
329 Move -EL next to -EB, for better --help output.
330 * target-select.cc: Include <cstdio>, "options.h", and
331 "parameters.h".
332 (Target_selector::do_target_bfd_name): New function.
333 (print_output_format): New function.
334 * target-select.h (class Target_selector): Update declarations.
335 (Target_selector::target_bfd_name): New function.
336 (print_output_format): Declare.
337 * main.cc: Include "target-select.h".
338 (main): Handle --print-output-format.
339 * gold.cc: Include "target-select.h".
340 (queue_initial_tasks): Handle --print-output-format when there are
341 no input files.
342 * parameters.cc (parameters_force_valid_target): Give a better
343 error message if -EB/-EL does not match target.
344 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
345 function.
346
347 2011-07-15 Ian Lance Taylor <iant@google.com>
348
349 * i386.cc (class Output_data_plt_i386): Add layout_ field.
350 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
351 (Output_data_plt_i386::do_write): Write address of .dynamic
352 section to first entry in .got.plt section.
353 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
354 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
355 Initialize layout_.
356 (Output_data_plt_x86_64::do_write): Write address of .dynamic
357 section to first entry in .got.plt section.
358 * layout.h (Layout::dynamic_section): New function.
359
360 2011-07-13 Sriraman Tallam <tmsriram@google.com>
361
362 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
363 to claim_file call.
364 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
365 input_section_position_, and input_section_glob_.
366 (read_layout_from_file): Call function section_ordering_specified.
367 * layout.h (is_section_ordering_specified): New function.
368 (section_ordering_specified): New function.
369 (section_ordering_specified_): New boolean member.
370 * main.cc(main): Call load_plugins after layout object is defined.
371 * output.cc (Output_section::add_input_section): Use
372 function section_ordering_specified to check if section ordering is
373 needed.
374 * output.cc (Output_section::add_relaxed_input_section): Use
375 function section_ordering_specified to check if section ordering is
376 needed.
377 (Output_section::update_section_layout): New function.
378 (Output_section::sort_attached_input_sections): Check if input section
379 must be reordered.
380 * output.h (Output_section::update_section_layout): New function.
381 * plugin.cc (get_section_count): New function.
382 (get_section_type): New function.
383 (get_section_name): New function.
384 (get_section_contents): New function.
385 (update_section_order): New function.
386 (allow_section_ordering): New function.
387 (Plugin::load): Add the new interfaces to the transfer vector.
388 (Plugin_manager::load_plugins): New parameter.
389 (Plugin_manager::all_symbols_read): New parameter.
390 (Plugin_manager::claim_file): New parameter. Save the elf object for
391 unclaimed objects.
392 (Plugin_manager::get_elf_object): New function.
393 (Plugin_manager::get_view): Change to directly use the bool to check
394 if get_view is called from claim_file_hook.
395 * plugin.h (input_objects): New function
396 (Plugin__manager::load_plugins): New parameter.
397 (Plugin_manager::claim_file): New parameter.
398 (Plugin_manager::get_elf_object): New function.
399 (Plugin_manager::in_claim_file_handler): New function.
400 (Plugin_manager::in_claim_file_handler_): New member.
401 (layout): New function.
402 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
403 handler with an extra parameter. Make the elf object before calling
404 claim_file handler.
405 * testsuite/plugin_test.c (get_section_count): New function pointer.
406 (get_section_type): New function pointer.
407 (get_section_name): New function pointer.
408 (get_section_contents): New function pointer.
409 (update_section_order): New function pointer.
410 (allow_section_ordering): New function pointer.
411 (onload): Check if the new interfaces exist.
412
413 2011-07-13 Ian Lance Taylor <iant@google.com>
414
415 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
416 relro section.
417 * x86_64.cc (Target_x86_64::got_section): Likewise.
418 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
419 (relro_now_test_SOURCES): New variable.
420 (relro_now_test_DEPENDENCIES): New variable.
421 (relro_now_test_LDFLAGS): New variable.
422 (relro_now_test_LDADD): New variable.
423 (relro_now_test.so): New target.
424 * testsuite/Makefile.in: Rebuild.
425
426 2011-07-12 Ian Lance Taylor <iant@google.com>
427
428 PR gold/12980
429 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
430 GLOB_DAT relocation rather than a RELATIVE relocation for a
431 protected symbol when creating a shared library.
432 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
433 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
434 * testsuite/protected_main_1.cc (main): Test that protected
435 function has same address.
436
437 2011-07-11 Ian Lance Taylor <iant@google.com>
438
439 PR gold/12979
440 * options.h (class General_options): Add -Bgroup.
441 * options.cc (General_options::finalize): If -Bgroup is set,
442 default to --unresolved-symbols=report-all.
443 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
444 * target-reloc.h (issue_undefined_symbol_error): Handle
445 --unresolved-symbols=report-all.
446
447 2011-07-08 Ian Lance Taylor <iant@google.com>
448
449 PR gold/11985
450 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
451 if linker script discards key sections.
452 (Layout::create_dynamic_symtab): Likewise.
453 (Layout::assign_local_dynsym_offsets): Likewise.
454 (Layout::sized_create_version_sections): Likewise.
455 (Layout::create_interp): Likewise.
456 (Layout::finish_dynamic_section): Likewise.
457 (Layout::set_dynamic_symbol_size): Likewise.
458
459 2011-07-08 Ian Lance Taylor <iant@google.com>
460
461 PR gold/12386
462 * options.h (class General_options): Add --unresolved-symbols.
463 * target-reloc.h (issue_undefined_symbol_error): Check
464 --unresolved-symbols. Add comments.
465
466 2011-07-08 Ian Lance Taylor <iant@google.com>
467
468 * testsuite/odr_violation2.cc (Ordering::operator()): Make
469 expression more complex.
470
471 2011-07-08 Ian Lance Taylor <iant@google.com>
472
473 PR gold/11317
474 * target-reloc.h (issue_undefined_symbol_error): New inline
475 function, broken out of relocate_section.
476 (relocate_section): Call issue_undefined_symbol_error.
477 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
478 there is no TLS segment if we are about to issue an undefined
479 symbol error.
480 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
481
482 2011-07-08 Ian Lance Taylor <iant@google.com>
483
484 PR gold/12279
485 * resolve.cc (Symbol_table::should_override): Add fromtype
486 parameter. Change all callers. Give error when linking together
487 TLS and non-TLS symbol.
488 (Symbol_table::should_override_with_special): Add fromtype
489 parameter. Change all callers.
490 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
491 there is no TLS segment if we have reported some errors.
492 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
493
494 2011-07-08 Ian Lance Taylor <iant@google.com>
495
496 PR gold/12372
497 * target.h (Target::plt_address_for_global): New function.
498 (Target::plt_address_for_local): New function.
499 (Target::plt_section_for_global): Remove.
500 (Target::plt_section_for_local): Remove.
501 (Target::do_plt_address_for_global): New virtual function.
502 (Target::do_plt_address_for_local): New virtual function.
503 (Target::do_plt_section_for_global): Remove.
504 (Target::do_plt_section_for_local): Remove.
505 (Target::register_global_plt_entry): Add Symbol_table and Layout
506 parameters.
507 * output.cc (Output_data_got::Got_entry::write): Use
508 plt_address_for_global and plt_address_for_local.
509 * layout.cc (Layout::add_target_dynamic_tags): Use size and
510 address of output section.
511 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
512 got_irelative_, and irelative_count_ fields. Update
513 declarations.
514 (Output_data_plt_i386::has_irelative_section): New function.
515 (Output_data_plt_i386::entry_count): Add irelative_count_.
516 (Output_data_plt_i386::set_final_data_size): Likewise.
517 (class Target_i386): Add got_irelative_ and rel_irelative_
518 fields. Update declarations.
519 (Target_i386::Target_i386): Initialize new fields.
520 (Target_i386::do_plt_address_for_global): New function replacing
521 do_plt_section_for_global.
522 (Target_i386::do_plt_address_for_local): New function replacing
523 do_plt_section_for_local.
524 (Target_i386::got_section): Create got_irelative_.
525 (Target_i386::rel_irelative_section): New function.
526 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
527 fields. Don't define __rel_iplt_{start,end}.
528 (Output_data_plt_i386::add_entry): Add symtab and layout
529 parameters. Change all callers. Use different PLT and GOT for
530 IFUNC symbols.
531 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
532 layout parameters. Change all callers. Use different PLT and
533 GOT.
534 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
535 (Output_data_plt_i386::rel_irelative): New function.
536 (Output_data_plt_i386::address_for_global): New function.
537 (Output_data_plt_i386::address_for_local): New function.
538 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
539 IRELATIVE GOT when changing IFUNC GOT entries.
540 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
541 reloc.
542 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
543 if we didn't create an IRELATIVE GOT.
544 (Target_i386::Relocate::relocate): Use plt_address_for_global and
545 plt_address_for_local.
546 (Target_i386::do_dynsym_value): Use plt_address_for_global.
547 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
548 got_irelative_, and irelative_count_ fields. Update
549 declarations.
550 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
551 Initialize new fields. Remove symtab parameter. Change all
552 callers.
553 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
554 irelative_count_.
555 (Output_data_plt_x86_64::has_irelative_section): New function.
556 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
557 (class Target_x86_64): Add got_irelative_ and rel_irelative_
558 fields. Update declarations.
559 (Target_x86_64::Target_x86_64): Initialize new fields.
560 (Target_x86_64::do_plt_address_for_global): New function replacing
561 do_plt_section_for_global.
562 (Target_x86_64::do_plt_address_for_local): New function replacing
563 do_plt_section_for_local.
564 (Target_x86_64::got_section): Create got_irelative_.
565 (Target_x86_64::rela_irelative_section): New function.
566 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
567 all callers. Don't create __rel_iplt_{start,end}.
568 (Output_data_plt_x86_64::add_entry): Add symtab and layout
569 parameters. Change all callers. Use different PLT and GOT for
570 IFUNC symbols.
571 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
572 layout parameters. Change all callers. Use different PLT and
573 GOT.
574 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
575 parameters. Change all callers. Use different PLT and GOT for
576 IFUNC symbols.
577 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
578 (Output_data_plt_x86_64::rela_irelative): New function.
579 (Output_data_plt_x86_64::address_for_global): New function.
580 (Output_data_plt_x86_64::address_for_local): New function.
581 (Output_data_plt_x86_64::set_final_data_size): Likewise.
582 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
583 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
584 (Target_x86_64::register_global_plt_entry): Add symtab and layout
585 parameters.
586 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
587 reloc.
588 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
589 symbols if we didn't create an IRELATIVE GOT.
590 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
591 plt_address_for_local.
592 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
593 * testsuite/ifuncvar1.c: New test file.
594 * testsuite/ifuncvar2.c: New test file.
595 * testsuite/ifuncvar3.c: New test file.
596 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
597 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
598 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
599 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
600 * testsuite/Makefile.in: Rebuild.
601
602 2011-07-07 Cary Coutant <ccoutant@google.com>
603
604 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
605 (two_file_test_1_ndebug.o): Likewise.
606 (two_file_test_1b_ndebug.o): Likewise.
607 (two_file_test_2_ndebug.o): Likewise.
608 (two_file_test_main_ndebug.o): Likewise.
609 (incremental_test_2): Link with no-debug versions.
610
611 2011-07-06 Cary Coutant <ccoutant@google.com>
612
613 * gold/incremental.cc
614 (Output_section_incremental_inputs::write_info_blocks): Check for
615 hidden and internal symbols.
616
617 2011-07-06 Cary Coutant <ccoutant@google.com>
618
619 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
620 Check disposition for startup file.
621 (Incremental_inputs::report_command_line): Ignore
622 --incremental-startup-unchanged option.
623 * options.cc (General_options::parse_incremental_startup_unchanged):
624 New function.
625 (General_options::General_options): Initialize new data member.
626 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
627 (General_options): Add --incremental-startup-unchanged option.
628 (General_options::incremental_startup_disposition): New function.
629 (General_options::incremental_startup_disposition_): New data member.
630
631 2011-07-06 Cary Coutant <ccoutant@google.com>
632
633 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
634 input file index to Script_info ctor.
635 (Sized_incremental_binary::do_file_has_changed): Find the
636 command-line argument for files named in scripts.
637 * incremental.h (Script_info::Script_info): New ctor
638 with input file index.
639 (Script_info::input_file_index): New function.
640 (Script_info::input_file_index_): New data member.
641 (Incremental_binary::get_library): Add const.
642 (Incremental_binary::get_script_info): Add const.
643 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
644 * testsuite/Makefile.am (incremental_test_5): New test case.
645 (incremental_test_6): New test case.
646 * testsuite/Makefile.in: Regenerate.
647
648 2011-07-06 Cary Coutant <ccoutant@google.com>
649
650 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
651 debug output when command lines differ.
652
653 2011-07-06 Cary Coutant <ccoutant@google.com>
654
655 * incremental.cc (Incremental_inputs::report_command_line): Ignore
656 --incremental-patch option.
657 * layout.cc (Free_list::allocate): Extend allocation beyond original
658 end if enabled.
659 (Layout::make_output_section): Mark sections that should get
660 patch space.
661 * options.cc (parse_percent): New function.
662 * options.h (parse_percent): New function.
663 (DEFINE_percent): New macro.
664 (General_options): Add --incremental-patch option.
665 * output.cc (Output_section::Output_section): Initialize new data
666 members.
667 (Output_section::add_input_section): Print section name when out
668 of patch space.
669 (Output_section::add_output_section_data): Likewise.
670 (Output_section::set_final_data_size): Add patch space when
671 doing --incremental-full.
672 (Output_section::do_reset_address_and_file_offset): Remove patch
673 space.
674 (Output_segment::set_section_list_addresses): Print debug output
675 only if --incremental-update.
676 * output.h (Output_section::set_is_patch_space_allowed): New function.
677 (Output_section::is_patch_space_allowed_): New data member.
678 (Output_section::patch_space_): New data member.
679 * parameters.cc (Parameters::incremental_full): New function.
680 * parameters.h (Parameters::incremental_full): New function
681 * testsuite/Makefile.am (incremental_test_2): Add test for
682 --incremental-patch option.
683 * testsuite/Makefile.in: Regenerate.
684 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
685 (t18): Remove function body.
686
687 2011-07-05 Doug Kwan <dougkwan@google.com>
688
689 PR gold/12771
690 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
691 Arm_Address type for relocation result.
692 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
693 overflow check.
694 (Arm_relocate_functions::abs32): Use unaligned access.
695 (Arm_relocate_functions::rel32): Ditto.
696 (Arm_relocate_functions::prel31): Ditto.
697 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
698 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
699 static data relocations.
700 * testsuite/Makefile.in: Regnerate.
701 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
702
703 2011-07-05 Ian Lance Taylor <iant@google.com>
704
705 PR gold/12392
706 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
707 symbols if necessary.
708 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
709
710 2011-07-05 Ian Lance Taylor <iant@google.com>
711
712 PR gold/12952
713 * resolve.cc (Symbol::override_base_with_special): Simply override
714 version with special symbol version, ignoring previous version.
715
716 2011-07-05 Ian Lance Taylor <iant@google.com>
717
718 * object.cc (Sized_relobj_file::include_section_group): Add
719 information to comment about signature location.
720
721 2011-07-02 Ian Lance Taylor <iant@google.com>
722
723 PR gold/12957
724 * options.h (class General_options): Add -f and -F.
725 * options.cc (General_options::finalize): Fatal error if -f/-F
726 are used without -shared.
727 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
728
729 2011-07-02 Ian Lance Taylor <iant@google.com>
730
731 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
732
733 2011-07-01 Ian Lance Taylor <iant@google.com>
734
735 PR gold/12525
736 PR gold/12952
737 * resolve.cc (Symbol::override_base_with_special): Don't override
738 the version if the overriding symbol has a different name.
739 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
740 all callers. If we give an error about an undefined version,
741 define the base version if necessary.
742 * dynobj.h (class Versions): Update declaration.
743 * testsuite/weak_alias_test_5.cc: New file.
744 * testsuite/weak_alias_test.script: New file.
745 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
746 and versioned_alias have the right value, and call t2.
747 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
748 weak_alias_test_5.so.
749 (weak_alias_test_LDADD): Likewise.
750 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
751 * testsuite/Makefile.in: Rebuild.
752
753 2011-07-01 Ian Lance Taylor <iant@google.com>
754
755 PR gold/12525
756 * options.h (class General_options): Support -z notext.
757 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
758 -Wl,-z,notext.
759 (two_file_shared_nonpic.so): Likewise.
760 (two_file_shared_mixed.so): Likewise.
761 (two_file_shared_mixed_1.so): Likewise.
762 (weak_undef_lib_nonpic.so): Likewise.
763 (alt/weak_undef_lib_nonpic.so): Likewise.
764 (tls_test_shared_nonpic.so): Likewise.
765 * testsuite/Makefile.in: Rebuild.
766
767 2011-07-01 Ian Lance Taylor <iant@google.com>
768
769 PR gold/12525
770 * configure.ac: Test whether static linking works, setting
771 the automake conditional HAVE_STATIC.
772 * testsuite/Makefile.am: Disable tests using -static if
773 HAVE_STATIC is not true.
774 * configure, testsuite/Makefile.in: Rebuild.
775
776 2011-07-01 Ian Lance Taylor <iant@google.com>
777
778 PR gold/12525
779 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
780 Assert if we see DW_EH_PE_indirect.
781 * target.h (Target::ehframe_datarel_base): New function.
782 (Target::do_ehframe_datarel_base): New target function.
783 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
784 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
785 function.
786
787 2011-07-01 Ian Lance Taylor <iant@google.com>
788
789 PR gold/12571
790 * options.h (class General_options): Add
791 --ld-generated-unwind-info.
792 * ehframe.cc (Fde::write): Add address parameter. Change all
793 callers. If associated with PLT, fill in address and size.
794 (Cie::set_output_offset): Only add merge mapping if there is an
795 object.
796 (Cie::write): Add address parameter. Change all callers.
797 (Eh_frame::add_ehframe_for_plt): New function.
798 * ehframe.h (class Fde): Update declarations. Move shndx_ and
799 input_offset_ fields into union u_, with new plt field.
800 (Fde::Fde): Adjust for new union field.
801 (Fde::Fde) [Output_data version]: New constructor.
802 (Fde::add_mapping): Only add merge mapping if there is an object.
803 (class Cie): Update declarations.
804 (class Eh_frame): Declare add_ehframe_for_plt.
805 * layout.cc (Layout::layout_eh_frame): Break out code into
806 make_eh_frame_section, and call it.
807 (Layout::make_eh_frame_section): New function.
808 (Layout::add_eh_frame_for_plt): New function.
809 * layout.h (class Layout): Update declarations.
810 * merge.cc (Merge_map::add_mapping): Add assertion.
811 * i386.cc: Include "dwarf.h".
812 (class Output_data_plt_i386): Make first_plt_entry,
813 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
814 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
815 and plt_eh_frame_fde.
816 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
817 boundary. Call add_eh_frame_for_plt if appropriate.
818 * x86_64.cc: Include "dwarf.h".
819 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
820 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
821 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
822 and plt_eh_frame_fde.
823 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
824 appropriate.
825
826 2011-06-29 Ian Lance Taylor <iant@google.com>
827
828 PR gold/12629
829 * object.cc (Sized_relobj_file::layout_section): Change shdr
830 parameter to be const.
831 (Sized_relobj_file::layout_eh_frame_section): New function, broken
832 out of do_layout.
833 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
834 appropriate. Call layout_eh_frame_section.
835 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
836 sections.
837 * object.h (class Sized_relobj_file): Update declarations.
838
839 2011-06-29 Ian Lance Taylor <iant@google.com>
840
841 PR gold/12652
842 * script.cc (Token::integer_value): Accept trailing M/m/K/k
843 modifier.
844 (Lex::gather_token): Accept trailing M/m/K/k for integers.
845
846 2011-06-29 Ian Lance Taylor <iant@google.com>
847
848 PR gold/12675
849 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
850 SHT_X86_64_UNWIND.
851 * layout.cc (Layout::layout_eh_frame): Likewise.
852
853 2011-06-29 Ian Lance Taylor <iant@google.com>
854
855 PR gold/12695
856 * layout.cc (Layout::symtab_section_shndx): New function.
857 * layout.h (class Layout): Declare symtab_section_shndx.
858 * output.cc (Output_section::write_header): Call it.
859
860 2011-06-29 Ian Lance Taylor <iant@google.com>
861
862 PR gold/12818
863 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
864 symbols which are not used in a relocation.
865
866 2011-06-28 Ian Lance Taylor <iant@google.com>
867
868 PR gold/12898
869 * layout.cc (Layout::segment_precedes): Don't crash if a linker
870 script create indistinguishable segments.
871 (Layout::set_segment_offsets): Use stable_sort when sorting
872 segments. Pass this to Compare_segments constructor.
873 * layout.h (class Layout): Make segment_precedes non-static.
874 (class Compare_segments): Change from struct to class. Add
875 layout_ field. Add constructor.
876 * script-sections.cc
877 (Script_sections::attach_sections_using_phdrs_clause): Rename
878 local orphan to is_orphan. Don't report failure to put empty
879 section in segment. On attachment failure, report name of
880 section, and attach to first PT_LOAD segment.
881
882 2011-06-28 Ian Lance Taylor <iant@google.com>
883
884 PR gold/12934
885 * target-select.cc (Target_selector::Target_selector): Add
886 emulation parameter. Change all callers.
887 (select_target_by_bfd_name): Rename from select_target_by_name.
888 Change all callers.
889 (select_target_by_emulation): New function.
890 (supported_emulation_names): New function.
891 * target-select.h (class Target_selector): Add emulation_ field.
892 Update declarations.
893 (Target_selector::recognize_by_bfd_name): Rename from
894 recognize_by_name. Change all callers.
895 (Target_selector::supported_bfd_names): Rename from
896 supported_names. Change all callers.
897 (Target_selector::recognize_by_emulation): New function.
898 (Target_selector::supported_emulations): New function.
899 (Target_selector::emulation): New function.
900 (Target_selector::do_recognize_by_bfd_name): Rename from
901 do_recognize_by_name. Change all callers.
902 (Target_selector::do_supported_bfd_names): Rename from
903 do_supported_names. Change all callers.
904 (Target_selector::do_recognize_by_emulation): New function.
905 (Target_selector::do_supported_emulations): New function.
906 (select_target_by_bfd_name): Change name in declaration.
907 (select_target_by_emulation): Declare.
908 (supported_emulation_names): Declare.
909 * parameters.cc (parameters_force_valid_target): Try to find
910 target based on emulation from -m option.
911 * options.h (class General_options): Change doc string for -m.
912 * options.cc (help): Print emulations.
913 (General_options::parse_V): Likewise.
914 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
915 Add emulation parameter. Change all callers.
916
917 2011-06-28 Ian Lance Taylor <iant@google.com>
918
919 * target.h (class Target): Add osabi_ field.
920 (Target::osabi): New function.
921 (Target::set_osabi): New function.
922 (Target::Target): Initialize osabi_.
923 (Target::do_adjust_elf_header): Make pure virtual.
924 (Sized_target::do_adjust_elf_header): Declare.
925 * target.cc (Sized_target::do_adjust_elf_header): New function.
926 (class Sized_target): Instantiate all versions.
927 * freebsd.h (class Target_freebsd): Remove.
928 (Target_selector_freebsd::do_recognize): Call set_osabi on
929 Target.
930 (Target_selector_freebsd::do_recognize_by_name): Likewise.
931 (Target_selector_freebsd::set_osabi): Remove.
932 * i386.cc (class Target_i386): Inherit from Sized_target rather
933 than Target_freebsd.
934 * x86_64.cc (class Target_x86_64): Likewise.
935
936 2011-06-28 Ian Lance Taylor <iant@google.com>
937
938 * target.h (Target::can_check_for_function_pointers): Rewrite.
939 Make non-virtual.
940 (Target::can_icf_inline_merge_sections): Likewise.
941 (Target::section_may_have_icf_unsafe_poineters): Likewise.
942 (Target::Target_info): Add can_icf_inline_merge_sections field.
943 (Target::do_can_check_for_function_pointers): New virtual
944 function.
945 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
946 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
947 from can_check_for_function_pointers, move in file.
948 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
949 section_may_have_icf_unsafe_poineters, move in file.
950 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
951 * i386.cc (Target_i386::do_can_check_for_function_pointers):
952 Rename from can_check_for_function_pointers, move in file.
953 (Target_i386::can_icf_inline_merge_sections): Remove.
954 (Target_i386::i386_info): Initialize
955 can_icf_inline_merge_sections.
956 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
957 Initialize can_icf_inline_merge_sections.
958 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
959 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
960 Rename from can_check_for_function_pointers, move in file.
961 (Target_x86_64::can_icf_inline_merge_sections): Remove.
962 (Target_x86_64::x86_64_info): Initialize
963 can_icf_inline_merge_sections.
964 * testsuite/testfile.cc (Target_test::test_target_info):
965 Likewise.
966 * icf.cc (get_section_contents): Correct formatting.
967
968 2011-06-27 Ian Lance Taylor <iant@google.com>
969
970 * symtab.cc (Symbol::versioned_name): New function.
971 (Symbol_table::add_to_final_symtab): Use versioned_name when
972 appropriate.
973 (Symbol_table::sized_write_symbol): Likewise.
974 * symtab.h (class Symbol): Declare versioned_name.
975 * stringpool.h (class Stringpool_template): Add variant of add
976 which takes a std::basic_string.
977 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
978 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
979 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
980 (ver_test_12.o): New target.
981 * testsuite/Makefile.in: Rebuild.
982
983 2011-06-27 Doug Kwan <dougkwan@google.com>
984
985 * arm.cc (Arm_relocate_functions::thm_jump8,
986 Arm_relocate_functions::thm_jump11): Use a wider signed
987 type to compute offset.
988 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
989 arm_thm_jump8.
990 * testsuite/Makefile.in: Regenerate.
991 * testsuite/arm_branch_in_range.sh: Check test results of
992 arm_thm_jump11 and arm_thm_jump8.
993 * testsuite/arm_thm_jump11.s: New test source file.
994 * testsuite/arm_thm_jump11.t: New linker script.
995 * testsuite/arm_thm_jump8.s: New test source file.
996 * testsuite/arm_thm_jump8.t: New linker script.
997
998 2011-06-24 Ian Lance Taylor <iant@google.com>
999
1000 * layout.cc: Include "object.h".
1001 (ctors_sections_in_init_array): New static variable.
1002 (Layout::is_ctors_in_init_array): New function.
1003 (Layout::layout): Add entry to ctors_sections_in_init_array if
1004 appropriate.
1005 * layout.h (class Layout): Declare is_ctors_in_init_array.
1006 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1007 is_ctors_reverse_view is set.
1008 (Sized_relobj_file::write_sections): Add layout parameter. Change
1009 all callers. Set is_ctors_reverse_view field of View_size.
1010 (Sized_relobj_file::reverse_words): New function.
1011 * object.h (Sized_relobj_file::View_size): Add
1012 is_ctors_reverse_view field.
1013 (class Sized_relobj_file): Update declarations.
1014 * testsuite/initpri3.c: New test.
1015 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1016 initpri3b.
1017 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1018 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1019 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1020 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1021 * testsuite/Makefile.in: Rebuild.
1022
1023 2011-06-24 Cary Coutant <ccoutant@google.com>
1024
1025 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1026 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1027 (debug_msg_cdebug.err): New targets.
1028 * testsuite/Makefile.in: Regenerate.
1029 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1030 Fix checks for link with shared library.
1031
1032 2011-06-24 Doug Kwan <dougkwan@google.com>
1033
1034 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1035 skip empty text sections.
1036 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1037
1038 2011-06-22 Ian Lance Taylor <iant@google.com>
1039
1040 PR gold/12910
1041 * options.h (class General_options): Add --ctors-in-init-array.
1042 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1043 friends as SHT_PROGBITS for merging sections.
1044 (Layout::layout): Remove special handling of .init_array and
1045 friends. Don't sort if doing relocatable link. Sort for .ctors
1046 and .dtors if ctors_in_init_array.
1047 (Layout::make_output_section): Force correct section types for
1048 .init_array and friends. Don't sort if doing relocatable link,
1049 Don't sort .ctors and .dtors if ctors_in_init_array.
1050 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1051 (Layout::output_section_name): Add relobj parameter. Change all
1052 callers. Handle .ctors. and .dtors. in code rather than table.
1053 Handle .ctors and .dtors if ctors_in_init_array.
1054 (Layout::match_file_name): New function, moved from output.cc.
1055 * layout.h (class Layout): Update declarations.
1056 * output.cc: Include "layout.h".
1057 (Input_section_sort_entry::get_priority): New function.
1058 (Input_section_sort_entry::match_file_name): Just call
1059 Layout::match_file_name.
1060 (Output_section::Input_section_sort_init_fini_compare::operator()):
1061 Handle .ctors and .dtors. Sort by explicit priority rather than
1062 by name.
1063 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1064 * testsuite/initpri2.c: New test.
1065 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1066 (check_PROGRAMS): Add initpri2.
1067 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1068 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1069 * configure, testsuite/Makefile.in: Rebuild.
1070
1071 2011-06-19 Ian Lance Taylor <iant@google.com>
1072
1073 PR gold/12880
1074 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1075 .interp section to a PT_INTERP segment even if we have seen a
1076 --dynamic-linker option. Don't do it if we have seen a PHDRS
1077 clause in a linker script.
1078 (Layout::finalize): Don't create a .interp section if we've
1079 already create a PT_INTERP segment.
1080 (Layout::create_interp): Always call choose_output_section (revert
1081 patch of 2011-06-17). Don't create PT_INTERP segment.
1082 * script-sections.cc
1083 (Script_sections::create_note_and_tls_segments): Add a .interp
1084 section to a PT_INTERP segment even if we have seen a
1085 --dynamic-linker option.
1086
1087 2011-06-18 Ian Lance Taylor <iant@google.com>
1088
1089 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1090 merely because a non-PT_LOAD segment has a dynamic reloc.
1091
1092 2011-06-18 Ian Lance Taylor <iant@google.com>
1093
1094 * layout.cc (Layout::finish_dynamic_section): Don't create
1095 DT_FLAGS entry if not needed.
1096
1097 2011-06-18 Ian Lance Taylor <iant@google.com>
1098
1099 PR gold/12745
1100 * layout.cc (Layout::layout_eh_frame): Correct handling of
1101 writable .eh_frame section.
1102
1103 2011-06-17 Ian Lance Taylor <iant@google.com>
1104
1105 PR gold/12893
1106 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1107 symbol is redefined with the exact same object and value.
1108
1109 2011-06-17 Ian Lance Taylor <iant@google.com>
1110
1111 PR gold/12880
1112 * layout.h (class Layout): Add interp_segment_ field.
1113 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1114 (Layout::attach_allocated_section_to_segment): If making shared
1115 library, put .interp section in PT_INTERP segment.
1116 (Layout::finalize): Also call create_interp if -dynamic-linker
1117 option was used.
1118 (Layout::create_interp): Assert that there is no PT_INTERP
1119 segment. If not using a SECTIONS clause, use make_output_section.
1120 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1121 * script-sections.cc
1122 (Script_sections::create_note_and_tls_segments): If making shared
1123 library, put .interp section in PT_INTERP segment.
1124
1125 2011-06-17 Ian Lance Taylor <iant@google.com>
1126
1127 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1128 when making a shared library.
1129
1130 2011-06-17 Ian Lance Taylor <iant@google.com>
1131
1132 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1133 parameter. Change all callers. Don't issue warning about PC32
1134 against locally defined symbol.
1135
1136 2011-06-16 Ian Lance Taylor <iant@google.com>
1137
1138 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1139 occurs in same object.
1140
1141 2011-06-14 Alan Modra <amodra@gmail.com>
1142
1143 * po/POTFILES.in: Regenerate.
1144
1145 2011-06-09 Ian Lance Taylor <iant@google.com>
1146
1147 * script-sections.cc
1148 (Orphan_output_section::set_section_addresses): For a relocatable
1149 link set address to 0.
1150
1151 2011-06-09 Cary Coutant <ccoutant@google.com>
1152
1153 PR gold/12804
1154 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1155 used with --compress-debug-sections.
1156 * gold/object.cc (Sized_relobj_file::do_layout): Report
1157 uncompressed size of compressed input sections.
1158
1159 2011-06-08 Cary Coutant <ccoutant@google.com>
1160
1161 PR gold/12804
1162 * testsuite/two_file_test_2_v1.cc: Change initialization of
1163 v2 to keep it in .data.
1164
1165 2011-06-07 Cary Coutant <ccoutant@google.com>
1166
1167 * common.cc (Symbol_table::do_allocate_commons_list): Call
1168 gold_fallback.
1169 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1170 (Errors::fallback): New function.
1171 (gold_fallback): New function.
1172 * errors.h (Errors::fallback): New function.
1173 * gold.cc (gold_exit): Change status parameter to enum; adjust
1174 all callers.
1175 (queue_initial_tasks): Call gold_fallback.
1176 * gold.h: Include cstdlib.
1177 (Exit_status): New enum type.
1178 (gold_exit): Change status parameter to enum.
1179 (gold_fallback): New function.
1180 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1181 (Layout::create_symtab_sections): Likewise.
1182 (Layout::create_shdrs): Likewise.
1183 * main.cc (main): Adjust call to gold_exit.
1184 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1185 (Output_data_got::add_got_entry_pair): Likewise.
1186 (Output_section::add_input_section): Likewise.
1187 (Output_section::add_output_section_data): Likewise.
1188 (Output_segment::set_section_list_addresses): Likewise.
1189 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1190
1191 2011-06-07 Cary Coutant <ccoutant@google.com>
1192
1193 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1194 for incremental links.
1195 * output.cc (Output_segment::set_section_list_addresses): Remove
1196 FIXME and test for TLS or BSS.
1197
1198 2011-06-07 Cary Coutant <ccoutant@google.com>
1199
1200 * testsuite/Makefile.am: Add incremental_copy_test,
1201 incremental_common_test_1.
1202 * testsuite/Makefile.in: Regenerate.
1203 * testsuite/common_test_1_v1.c: New source file.
1204 * testsuite/common_test_1_v2.c: New source file.
1205 * testsuite/copy_test_v1.cc: New source file.
1206
1207 2011-06-07 Cary Coutant <ccoutant@google.com>
1208
1209 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1210 update, allocate common from bss section's free list.
1211 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1212 linker-defined symbols.
1213 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1214 Skip GOT and PLT entries that are no longer referenced.
1215 (Output_section_incremental_inputs::write_info_blocks): Mark
1216 linker-defined symbols.
1217 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1218 * output.cc (Output_section::allocate): New function.
1219 * output.h (Output_section::allocate): New function.
1220 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1221 linker-defined symbols.
1222 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1223 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1224 (Symbol::init_base_output_data): Likewise.
1225 (Symbol::init_base_output_segment): Likewise.
1226 (Symbol::init_base_constant): Likewise.
1227 (Sized_symbol::init_output_data): Likewise.
1228 (Sized_symbol::init_output_segment): Likewise.
1229 (Sized_symbol::init_constant): Likewise.
1230 (Symbol_table::do_define_in_output_data): Likewise.
1231 (Symbol_table::do_define_in_output_segment): Likewise.
1232 (Symbol_table::do_define_as_constant): Likewise.
1233 * symtab.h (Symbol::is_predefined): New function.
1234 (Symbol::init_base_output_data): Add is_predefined parameter.
1235 (Symbol::init_base_output_segment): Likewise.
1236 (Symbol::init_base_constant): Likewise.
1237 (Symbol::is_predefined_): New data member.
1238 (Sized_symbol::init_output_data): Add is_predefined parameter.
1239 (Sized_symbol::init_output_segment): Likewise.
1240 (Sized_symbol::init_constant): Likewise.
1241 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1242
1243 2011-06-07 Cary Coutant <ccoutant@google.com>
1244
1245 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1246 instead of emit_copy_reloc.
1247 (Copy_relocs::emit_copy_reloc): Refactor.
1248 (Copy_relocs::make_copy_reloc): New function.
1249 (Copy_relocs::add_copy_reloc): Remove.
1250 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1251 section.
1252 (Copy_relocs::make_copy_reloc): New function.
1253 (Copy_relocs::add_copy_reloc): Remove.
1254 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1255 unchanged input files.
1256 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1257 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1258 Reserve BSS space for COPY relocations.
1259 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1260 (Output_section_incremental_inputs::write_info_blocks): Record
1261 whether a symbol is copied from a shared object.
1262 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1263 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1264 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1265 (Incremental_input_entry_reader::get_output_symbol_index): Add
1266 is_copy parameter.
1267 (Incremental_binary::emit_copy_relocs): New function.
1268 (Incremental_binary::do_emit_copy_relocs): New function.
1269 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1270 new data member.
1271 (Sized_incremental_binary::add_copy_reloc): New function.
1272 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1273 (Sized_incremental_binary::Copy_reloc): New struct.
1274 (Sized_incremental_binary::Copy_relocs): New typedef.
1275 (Sized_incremental_binary::copy_relocs_): New data member.
1276 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1277 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1278 * target.h (Sized_target::emit_copy_reloc): New function.
1279 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1280
1281 2011-06-02 Cary Coutant <ccoutant@google.com>
1282
1283 PR gold/12163
1284 * gold/archive.cc (Archive::Archive): Initialize new data member.
1285 (Archive::include_all_members): Return if archive has already been
1286 included.
1287 * gold/archive.h (Archive::include_all_members_): New data member.
1288
1289 2011-06-02 Nick Clifton <nickc@redhat.com>
1290
1291 * dynobj.h: Fix spelling mistake in comment.
1292 * output.cc: Likewise.
1293
1294 2011-05-31 Doug Kwan <dougkwan@google.com>
1295 Asier Llano
1296
1297 PR gold/12826
1298 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
1299 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1300 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1301 redundant arm_exidx_test.so.
1302 * testsuite/Makefile.in: Regenerate.
1303 (check_SCRIPTS): Add pr12826.sh
1304 (check_DATA): Add pr12826.stdout
1305 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1306 * testsuite/pr12826.sh: New file.
1307 * testsuite/pr12826_1.s: Ditto.
1308 * testsuite/pr12826_1.s: Ditto.
1309
1310 2011-05-30 Ian Lance Taylor <iant@google.com>
1311
1312 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1313 sections.
1314
1315 2011-05-29 Ian Lance Taylor <iant@google.com>
1316
1317 PR gold/12804
1318 * testsuite/Makefile.am: Use different file name for two_file_test
1319 temporary file for each incremental test.
1320 * testsuite/Makefile.in: Rebuild.
1321
1322 2011-05-29 Ian Lance Taylor <iant@google.com>
1323
1324 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1325 binary input file is empty.
1326
1327 2011-05-27 Ian Lance Taylor <iant@google.com>
1328
1329 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1330 (ver_test_9.so): Likewise.
1331 * testsuite/Makefile.in: Rebuild.
1332
1333 2011-05-26 Cary Coutant <ccoutant@google.com>
1334
1335 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1336 * incremental.cc (Incremental_inputs::report_input_section): Fix
1337 comment, indentation.
1338 (Incremental_inputs::report_comdat_group): New function.
1339 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1340 of data for incremental input file entry.
1341 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1342 group count, COMDAT group signatures.
1343 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1344 an unchanged input file.
1345 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1346 Initialize new data member.
1347 (Incremental_object_entry::add_comdat_group): New function.
1348 (Incremental_object_entry::get_comdat_group_count): New function.
1349 (Incremental_object_entry::get_comdat_signature_key): New function.
1350 (Incremental_object_entry::groups_): New data member.
1351 (Incremental_inputs::report_comdat_group): New function.
1352 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1353 data for incremental input file entry.
1354 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1355 (Incremental_input_entry_reader::get_input_section): Adjust size of
1356 data for incremental input file entry.
1357 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1358 (Incremental_input_entry_reader::get_comdat_group_signature): New
1359 function.
1360 * object.cc (Sized_relobj::include_section_group): Report kept
1361 COMDAT groups for incremental links.
1362
1363 2011-05-24 David Meyer <pdox@google.com>
1364
1365 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1366 with name parameter. Add found_name parameter.
1367 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1368 * dirsearch.h (class Dirsearch): Update declaration.
1369
1370 2011-05-24 Ian Lance Taylor <iant@google.com>
1371
1372 * archive.cc (Library_base::should_include_member): Pull in object
1373 from archive if it defines the entry symbol.
1374 * parameters.cc (Parameters::entry): New function.
1375 * parameters.h (class Parameters): Declare entry.
1376 * output.h (class Output_file_header): Remove entry_ field.
1377 * output.cc (Output_file_header::Output_file_header): Remove entry
1378 parameter. Change all callers.
1379 (Output_file_header::entry): Use parameters->entry.
1380 * gold.cc (queue_middle_tasks): Likewise.
1381 * plugin.cc (Plugin_hook::run): Likewise.
1382
1383 2011-05-24 Cary Coutant <ccoutant@google.com>
1384
1385 * gold.cc (queue_initial_tasks): Pass incremental base filename
1386 to Output_file::open_base_file; don't print error message.
1387 * incremental-dump.cc (main): Adjust call to
1388 Output_file::open_for_modification.
1389 * incremental-dump.cc (main): Likewise.
1390 * incremental.cc (Incremental_inputs::report_command_line):
1391 Ignore --incremental-base option when comparing command lines.
1392 Ignore parameter when given as separate argument.
1393 * options.h (class General_options): Add --incremental-base.
1394 * output.cc (Output_file::Output_file):
1395 (Output_file::open_base_file): Add base_name and writable parameters;
1396 read base file into new file; print error message here.
1397 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1398 callers.
1399 * output.h (Output_file::open_for_modification): Rename to...
1400 (Output_file::open_base_file): ...this; add base_name and
1401 writable parameters; adjust all callers.
1402 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1403 callers.
1404 * testsuite/Makefile.am (incremental_test_4): Test
1405 --incremental-base.
1406 * testsuite/Makefile.in: Regenerate.
1407
1408 2011-05-24 Cary Coutant <ccoutant@google.com>
1409
1410 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1411 incremental_test_4.
1412 * testsuite/Makefile.in: Regenerate.
1413 * testsuite/two_file_test_1_v1.cc: New test source file.
1414 * testsuite/two_file_test_1b_v1.cc: New test source file.
1415 * testsuite/two_file_test_2_v1.cc: New test source file.
1416
1417 2011-05-24 Cary Coutant <ccoutant@google.com>
1418
1419 * dynobj.h (Dynobj::do_dynobj): New function.
1420 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1421 flag and soname for shared objects.
1422 * incremental.cc (Incremental_inputs::report_object): Make
1423 either Incremental_object_entry or Incremental_dynobj_entry; add
1424 soname to string table.
1425 (Incremental_inputs::report_input_section): Add assertion.
1426 (Output_section_incremental_inputs::set_final_data_size): Adjust
1427 type of input file entry for shared libraries; adjust size of
1428 shared library info entry.
1429 (Output_section_incremental_inputs::write_input_files): Write
1430 as_needed flag for shared libraries.
1431 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1432 of input file entry for shared libraries; write soname.
1433 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1434 soname from incremental info.
1435 * incremental.h (enum Incremental_input_flags): Add
1436 INCREMENTAL_INPUT_AS_NEEDED.
1437 (Incremental_input_entry::Incremental_input_entry): Initialize new
1438 data member.
1439 (Incremental_input_entry::set_as_needed): New function.
1440 (Incremental_input_entry::as_needed): New function.
1441 (Incremental_input_entry::do_dynobj_entry): New function.
1442 (Incremental_input_entry::as_needed_): New data member.
1443 (Incremental_object_entry::Incremental_object_entry): Don't check
1444 for shared library.
1445 (Incremental_object_entry::do_type): Likewise.
1446 (class Incremental_dynobj_entry): New class.
1447 (Incremental_input_entry_reader::as_needed): New function.
1448 (Incremental_input_entry_reader::get_soname): New function.
1449 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1450 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1451 size of shared library info entry.
1452 * layout.cc (Layout::finish_dynamic_section): Don't test for
1453 incremental link when adding DT_NEEDED entries.
1454 * object.h (Object::Object): Initialize new data member.
1455 (Object::dynobj): New function.
1456 (Object::set_as_needed): New function.
1457 (Object::as_needed): New function.
1458 (Object::do_dynobj): New function.
1459 (Object::as_needed_): New data member.
1460
1461 2011-05-24 Cary Coutant <ccoutant@google.com>
1462
1463 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1464 info; adjust display of GOT entries.
1465 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1466 vector of input objects; remove file_status_.
1467 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1468 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1469 got_plt reader; call target hooks to reserve GOT entries.
1470 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1471 of input file info header and GOT info entry.
1472 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1473 relocation info.
1474 (Got_plt_view_info::got_descriptor): Remove.
1475 (Got_plt_view_info::sym_index): New data member.
1476 (Got_plt_view_info::input_index): New data member.
1477 (Local_got_offset_visitor::visit): Write input file index.
1478 (Global_got_offset_visitor::visit): Write 0 for input file index.
1479 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1480 with sym_index and input_index.
1481 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1482 incremental info GOT entry; replace got_descriptor with input_index.
1483 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1484 map from input file index to object.
1485 (Sized_relobj_incr::do_layout): Replace direct data member reference
1486 with accessor function.
1487 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1488 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1489 Adjust size of input file info header.
1490 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1491 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1492 (Incremental_input_entry_reader::get_input_section): Adjust size of
1493 input file info header.
1494 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1495 of incremental info GOT entry.
1496 (Incremental_got_plt_reader::get_got_desc): Remove.
1497 (Incremental_got_plt_reader::get_got_symndx): New function.
1498 (Incremental_got_plt_reader::get_got_input_index): New function.
1499 (Sized_incremental_binary::Sized_incremental_binary): Remove
1500 file_status_; add input_objects_.
1501 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1502 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1503 (Sized_incremental_binary::file_is_unchanged): Remove.
1504 (Sized_incremental_binary::set_input_object): New function.
1505 (Sized_incremental_binary::input_object): New function.
1506 (Sized_incremental_binary::file_status_): Remove.
1507 (Sized_incremental_binary::input_objects_): New data member.
1508 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1509 references.
1510 (Sized_relobj_incr::invalid_address): Move to base class.
1511 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1512 class.
1513 (Sized_relobj_incr::do_output_section_offset): Likewise.
1514 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1515 (Sized_relobj_incr::section_offsets_): Likewise.
1516 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1517 function.
1518 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1519 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1520 with accessor function.
1521 (Sized_relobj_file::do_layout): Likewise.
1522 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1523 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1524 (Sized_relobj_file::compute_final_local_value): Replace refs to
1525 section_offsets_ with accessor function.
1526 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1527 * object.h (Relobj::Relobj): Initialize new data members.
1528 (Relobj::add_dyn_reloc): New function.
1529 (Relobj::first_dyn_reloc): New function.
1530 (Relobj::dyn_reloc_count): New function.
1531 (Relobj::first_dyn_reloc_): New data member.
1532 (Relobj::dyn_reloc_count_): New data member.
1533 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1534 references.
1535 (Sized_relobj::Address): New typedef.
1536 (Sized_relobj::invalid_address): Move here from child class.
1537 (Sized_relobj::Sized_relobj): Initialize new data members.
1538 (Sized_relobj::sized_relobj): New function.
1539 (Sized_relobj::is_output_section_offset_invalid): Move here from
1540 child class.
1541 (Sized_relobj::get_output_section_offset): Likewise.
1542 (Sized_relobj::local_has_got_offset): Likewise.
1543 (Sized_relobj::local_got_offset): Likewise.
1544 (Sized_relobj::set_local_got_offset): Likewise.
1545 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1546 (Sized_relobj::clear_got_offsets): New function.
1547 (Sized_relobj::section_offsets): Move here from child class.
1548 (Sized_relobj::do_output_section_offset): Likewise.
1549 (Sized_relobj::do_set_section_offset): Likewise.
1550 (Sized_relobj::Local_got_offsets): Likewise.
1551 (Sized_relobj::local_got_offsets_): Likewise.
1552 (Sized_relobj::section_offsets_): Likewise.
1553 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1554 references.
1555 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1556 class.
1557 (Sized_relobj_file::sized_relobj): New function
1558 (Sized_relobj_file::local_has_got_offset): Move to base class.
1559 (Sized_relobj_file::local_got_offset): Likewise.
1560 (Sized_relobj_file::set_local_got_offset): Likewise.
1561 (Sized_relobj_file::get_output_section_offset): Likewise.
1562 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1563 (Sized_relobj_file::do_output_section_offset): Likewise.
1564 (Sized_relobj_file::do_set_section_offset): Likewise.
1565 (Sized_relobj_file::Local_got_offsets): Likewise.
1566 (Sized_relobj_file::local_got_offsets_): Likewise.
1567 (Sized_relobj_file::section_offsets_): Likewise.
1568 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1569 (all constructors).
1570 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1571 (Output_reloc::get_symbol_index): Likewise.
1572 (Output_reloc::local_section_offset): Likewise.
1573 (Output_reloc::get_address): Likewise.
1574 (Output_reloc::symbol_value): Likewise.
1575 (Output_data_got::reserve_slot): Move to class definition.
1576 (Output_data_got::reserve_local): New function.
1577 (Output_data_got::reserve_slot_for_global): Remove.
1578 (Output_data_got::reserve_global): New function.
1579 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1580 (all constructors, two instantiations).
1581 (Output_reloc::get_relobj): New function (two instantiations).
1582 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1583 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1584 (Output_data_reloc::add_global): Adjust type of relobj.
1585 (Output_data_reloc::add_global_relative): Likewise.
1586 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1587 (Output_data_reloc::add_local): Likewise.
1588 (Output_data_reloc::add_local_relative): Likewise.
1589 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1590 (Output_data_reloc::add_local_section): Likewise.
1591 (Output_data_reloc::add_output_section): Likewise.
1592 (Output_data_reloc::add_absolute): Likewise.
1593 (Output_data_reloc::add_target_specific): Likewise.
1594 (Output_data_got::reserve_slot): Move definition here.
1595 (Output_data_got::reserve_local): New function.
1596 (Output_data_got::reserve_global): New function.
1597 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1598 section_offsets_ with accessor function.
1599 (Sized_relobj_file::write_sections): Likewise.
1600 (Sized_relobj_file::do_relocate_sections): Likewise.
1601 * target.h (Sized_target::reserve_local_got_entry): New function.
1602 (Sized_target::reserve_global_got_entry): New function.
1603 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1604 (Target_x86_64::reserve_global_got_entry): New function.
1605 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1606
1607 2011-05-23 Cary Coutant <ccoutant@google.com>
1608
1609 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1610 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1611 bit when checking got_type.
1612 * incremental.cc (Sized_incremental_binary::setup_readers):
1613 Store symbol table and string table locations; initialize bit vector
1614 of file status flags.
1615 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1616 unchanged files.
1617 (Sized_incremental_binary::do_process_got_plt): New function.
1618 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1619 (Output_section_incremental_inputs::set_final_data_size): Record
1620 file index for each input file.
1621 (Output_section_incremental_inputs::write_got_plt): Store file index
1622 instead of input entry offset for each GOT entry.
1623 * incremental.h
1624 (Incremental_input_entry::Incremental_input_entry): Initialize new
1625 data member.
1626 (Incremental_input_entry::set_offset): Store file index.
1627 (Incremental_input_entry::get_file_index): New function.
1628 (Incremental_input_entry::file_index_): New data member.
1629 (Incremental_binary::process_got_plt): New function.
1630 (Incremental_binary::do_process_got_plt): New function.
1631 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1632 data members.
1633 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1634 (Sized_incremental_binary::set_file_is_unchanged): New function.
1635 (Sized_incremental_binary::file_is_unchanged): New function.
1636 (Sized_incremental_binary::do_process_got_plt): New function.
1637 (Sized_incremental_binary::file_status_): New data member.
1638 (Sized_incremental_binary::main_symtab_loc_): New data member.
1639 (Sized_incremental_binary::main_strtab_loc_): New data member.
1640 * output.cc (Output_data_got::Got_entry::write): Add case
1641 RESERVED_CODE.
1642 (Output_data_got::add_global): Call add_got_entry.
1643 (Output_data_got::add_global_plt): Likewise.
1644 (Output_data_got::add_global_with_rel): Likewise.
1645 (Output_data_got::add_global_with_rela): Likewise.
1646 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1647 (Output_data_got::add_global_pair_with_rela): Likewise.
1648 (Output_data_got::add_local): Call add_got_entry.
1649 (Output_data_got::add_local_plt): Likewise.
1650 (Output_data_got::add_local_with_rel): Likewise.
1651 (Output_data_got::add_local_with_rela): Likewise.
1652 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1653 (Output_data_got::add_local_pair_with_rela): Likewise.
1654 (Output_data_got::reserve_slot): New function.
1655 (Output_data_got::reserve_slot_for_global): New function.
1656 (Output_data_got::add_got_entry): New function.
1657 (Output_data_got::add_got_entry_pair): New function.
1658 (Output_section::add_output_section_data): Edit FIXME.
1659 * output.h
1660 (Output_section_data_build::Output_section_data_build): New
1661 constructor with size parameter.
1662 (Output_data_space::Output_data_space): Likewise.
1663 (Output_data_got::Output_data_got): Initialize new data member; new
1664 constructor with size parameter.
1665 (Output_data_got::add_constant): Call add_got_entry.
1666 (Output_data_got::reserve_slot): New function.
1667 (Output_data_got::reserve_slot_for_global): New function.
1668 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1669 (Output_data_got::add_got_entry): New function.
1670 (Output_data_got::add_got_entry_pair): New function.
1671 (Output_data_got::free_list_): New data member.
1672 * target.h (Sized_target::init_got_plt_for_update): New function.
1673 (Sized_target::register_global_plt_entry): New function.
1674 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1675 Initialize new data member; call init; add constructor with PLT count.
1676 (Output_data_plt_x86_64::init): New function.
1677 (Output_data_plt_x86_64::add_relocation): New function.
1678 (Output_data_plt_x86_64::reserve_slot): New function.
1679 (Output_data_plt_x86_64::free_list_): New data member.
1680 (Target_x86_64::init_got_plt_for_update): New function.
1681 (Target_x86_64::register_global_plt_entry): New function.
1682 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1683 incremental updates.
1684 (Output_data_plt_x86_64::add_relocation): New function.
1685 * testsuite/object_unittest.cc (Object_test): Set default options.
1686
1687 2011-05-16 Ian Lance Taylor <iant@google.com>
1688
1689 * options.h (class General_options): Make -i a synonym for -r.
1690
1691 2011-05-16 Ian Lance Taylor <iant@google.com>
1692
1693 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1694
1695 2011-05-10 Cary Coutant <ccoutant@google.com>
1696
1697 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1698 strip_all (-s).
1699
1700 2011-05-06 Ian Lance Taylor <iant@google.com>
1701
1702 * layout.cc (Layout::layout): If the output section flags change,
1703 update the ordering.
1704
1705 2011-04-25 Cary Coutant <ccoutant@google.com>
1706
1707 * incremental-dump.cc (dump_incremental_inputs): Print local
1708 symbol info for each input file.
1709 * incremental.cc
1710 (Output_section_incremental_inputs::set_final_data_size): Add local
1711 symbol info to input file entries in incremental info.
1712 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1713 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1714 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1715 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1716 implementation.
1717 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1718 (Sized_incr_relobj::do_relocate): Write the local symbols.
1719 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1720 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1721 Adjust size of input file header.
1722 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1723 (Incremental_inputs_reader::get_local_symbol_count): New function.
1724 (Incremental_inputs_reader::get_input_section): Adjust size of input
1725 file header.
1726 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1727 (Sized_incr_relobj::This): New typedef.
1728 (Sized_incr_relobj::sym_size): New const data member.
1729 (Sized_incr_relobj::Local_symbol): New struct.
1730 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1731 (Sized_incr_relobj::do_local_symbol_offset): New function.
1732 (Sized_incr_relobj::local_symbol_count_): New data member.
1733 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1734 (Sized_incr_relobj::local_symbol_index_): New data member.
1735 (Sized_incr_relobj::local_symbol_offset_): New data member.
1736 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1737 (Sized_incr_relobj::local_symbols_): New data member.
1738 * object.h (Relobj::output_local_symbol_count): New function.
1739 (Relobj::local_symbol_offset): New function.
1740 (Relobj::do_output_local_symbol_count): New function.
1741 (Relobj::do_local_symbol_offset): New function.
1742 (Sized_relobj::do_output_local_symbol_count): New function.
1743 (Sized_relobj::do_local_symbol_offset): New function.
1744
1745 2011-04-22 Vladimir Simonov <sv@sw.ru>
1746
1747 * descriptors.cc (set_close_on_exec): New function.
1748 (Descriptors::open): Use set_close_on_exec.
1749 * output.cc (S_ISLNK): Define if not defined.
1750
1751 2011-04-22 Cary Coutant <ccoutant@google.com>
1752
1753 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1754 global symbol map.
1755 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1756 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1757 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1758 relocations.
1759 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1760 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1761 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1762 * incremental.h
1763 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1764 function.
1765 (Incremental_binary::apply_incremental_relocs): New function.
1766 (Incremental_binary::do_apply_incremental_relocs): New function.
1767 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1768 data member.
1769 (Sized_incremental_binary::add_global_symbol): New function.
1770 (Sized_incremental_binary::global_symbol): New function.
1771 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1772 (Sized_incremental_binary::symbol_map_): New data member.
1773 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1774 * target.h (Sized_target::apply_relocation): New function.
1775 * target-reloc.h (apply_relocation): New function.
1776 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1777
1778 2011-04-22 Doug Kwan <dougkwan@google.com>
1779
1780 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1781 flag of a SHT_ARM_EXIDX section.
1782 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1783 * testsuite/Makefile.in: Regenerate.
1784 * testsuite/arm_exidx_test.s: New file.
1785 * testsuite/arm_exidx_test.sh: Same.
1786
1787 2011-04-20 Cary Coutant <ccoutant@google.com>
1788
1789 PR gold/12689
1790 * archive.h (Incremental_archive_entry::Archive_member):
1791 Initialize arg_serial_ (second constructor).
1792
1793 2011-04-17 Ian Lance Taylor <iant@google.com>
1794
1795 * object.cc (Relocate_info::location): Simplify location string.
1796 * errors.cc (Errors::error_at_location): Don't print program
1797 name.
1798 (Errors::warning_at_location): Likewise.
1799 (Errors::undefined_symbol): Likewise.
1800 * testsuite/debug_msg.sh: Update accordingly.
1801
1802 2011-04-14 Cary Coutant <ccoutant@google.com>
1803
1804 * gold/layout.cc (Layout::symtab_section_offset): New function.
1805 * gold/layout.h (Layout::symtab_section_offset): New function.
1806 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1807
1808 2011-04-12 Ian Lance Taylor <iant@google.com>
1809
1810 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1811 with MREMAP_MAYMOVE.
1812 * output.h (class Output_file): Add map_is_allocated_ field.
1813 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1814 not available, provide stubs. If mremap is not available, #define
1815 it to gold_mremap.
1816 (MREMAP_MAYMOVE): Define if not defined.
1817 (Output_file::Output_file): Initialize map_is_allocated_.
1818 (Output_file::resize): Check map_is_allocated_.
1819 (Output_file::map_anonymous): If mmap fails, use malloc.
1820 (Output_file::unmap): Don't do anything for an anonymous map.
1821 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1822 is not available, provide stubs.
1823 (File_read::View::~View): Use free rather than delete[].
1824 (File_read::make_view): Use malloc rather than new[]. If mmap
1825 fails, use malloc.
1826 (File_read::find_or_make_view): Use malloc rather than new[].
1827 * gold.h: Remove HAVE_REMAP code.
1828 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1829 exists. Rename mremap to gold_mremap. If mmap is not available
1830 don't do anything.
1831 * configure, config.in: Rebuild.
1832
1833 2011-04-11 Ian Lance Taylor <iant@google.com>
1834
1835 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1836 initialize local variable v.
1837
1838 2011-04-11 Cary Coutant <ccoutant@google.com>
1839
1840 * archive.cc (Archive::include_member): Adjust call to
1841 report_object.
1842 (Add_archive_symbols::run): Track argument serial numbers.
1843 (Lib_group::include_member): Likewise.
1844 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1845 * archive.h (Incremental_archive_entry::Archive_member):
1846 Initialize arg_serial_.
1847 (Archive_member::arg_serial_): New data member.
1848 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1849 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1850 incremental link.
1851 (Sized_dynobj::do_for_all_local_got_entries): New function.
1852 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1853 function.
1854 * fileread.cc (get_mtime): New function.
1855 * fileread.h (get_mtime): New function.
1856 * gold.cc (queue_initial_tasks): Check for incremental update.
1857 (process_incremental_input): New function.
1858 (queue_middle_tasks): Don't force valid target for incremental
1859 update.
1860 * incremental-dump.cc (find_input_containing_global): Adjust
1861 size of symbol info entry.
1862 (dump_incremental_inputs): Dump argument serial number and
1863 in_system_directory flag; bias shndx by 1; print symbol names
1864 when dumping per-file symbol lists; use new symbol info readers.
1865 * incremental.cc
1866 (Output_section_incremental_inputs:update_data_size): New function.
1867 (Sized_incremental_binary::setup_readers): Setup input readers
1868 for each input file; build maps for files added from libraries
1869 and scripts.
1870 (Sized_incremental_binary::check_input_args): New function.
1871 (Sized_incremental_binary::do_check_inputs): Build map of argument
1872 serial numbers to input arguments.
1873 (Sized_incremental_binary::do_file_has_changed): Rename
1874 do_file_is_unchanged to this; compare file modification times.
1875 (Sized_incremental_binary::do_init_layout): New function.
1876 (Sized_incremental_binary::do_reserve_layout): New function.
1877 (Sized_incremental_binary::do_get_input_reader): Remove.
1878 (Sized_incremental_binary::get_symtab_view): New function.
1879 (Incremental_checker::can_incrementally_link_output_file): Remove.
1880 (Incremental_inputs::report_command_line): Exclude --debug options.
1881 (Incremental_inputs::report_archive_begin): Add parameter; track
1882 argument serial numbers; don't put input file entry for archive
1883 before archive members.
1884 (Incremental_inputs::report_archive_end): Put input file entry
1885 for archive after archive members.
1886 (Incremental_inputs::report_object): Add parameter; track argument
1887 serial numbers and in_system_directory flag.
1888 (Incremental_inputs::report_script): Add parameter; track argument
1889 serial numbers.
1890 (Output_section_incremental_inputs::set_final_data_size): Adjust
1891 size of symbol info entry; check for forwarding symbols.
1892 (Output_section_incremental_inputs::write_input_files): Write
1893 in_system_directory flag and argument serial number.
1894 (Output_section_incremental_inputs::write_info_blocks): Map section
1895 indices between incremental info and original input file; store
1896 input section index for each symbol.
1897 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1898 change operator() to visit().
1899 (class Global_got_offset_visitor): Likewise.
1900 (class Global_symbol_visitor_got_plt):
1901 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1902 classes.
1903 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1904 (Sized_incr_relobj::do_read_symbols): New function.
1905 (Sized_incr_relobj::do_layout): New function.
1906 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1907 (Sized_incr_relobj::do_add_symbols): New function.
1908 (Sized_incr_relobj::do_should_include_member): New function.
1909 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1910 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1911 (Sized_incr_relobj::do_section_size): New function.
1912 (Sized_incr_relobj::do_section_name): New function.
1913 (Sized_incr_relobj::do_section_contents): New function.
1914 (Sized_incr_relobj::do_section_flags): New function.
1915 (Sized_incr_relobj::do_section_entsize): New function.
1916 (Sized_incr_relobj::do_section_address): New function.
1917 (Sized_incr_relobj::do_section_type): New function.
1918 (Sized_incr_relobj::do_section_link): New function.
1919 (Sized_incr_relobj::do_section_info): New function.
1920 (Sized_incr_relobj::do_section_addralign): New function.
1921 (Sized_incr_relobj::do_initialize_xindex): New function.
1922 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1923 (Sized_incr_relobj::do_read_relocs): New function.
1924 (Sized_incr_relobj::do_gc_process_relocs): New function.
1925 (Sized_incr_relobj::do_scan_relocs): New function.
1926 (Sized_incr_relobj::do_count_local_symbols): New function.
1927 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1928 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1929 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1930 (Sized_incr_relobj::do_relocate): New function.
1931 (Sized_incr_relobj::do_set_section_offset): New function.
1932 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1933 (Sized_incr_dynobj::do_read_symbols): New function.
1934 (Sized_incr_dynobj::do_layout): New function.
1935 (Sized_incr_dynobj::do_add_symbols): New function.
1936 (Sized_incr_dynobj::do_should_include_member): New function.
1937 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1938 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1939 (Sized_incr_dynobj::do_section_size): New function.
1940 (Sized_incr_dynobj::do_section_name): New function.
1941 (Sized_incr_dynobj::do_section_contents): New function.
1942 (Sized_incr_dynobj::do_section_flags): New function.
1943 (Sized_incr_dynobj::do_section_entsize): New function.
1944 (Sized_incr_dynobj::do_section_address): New function.
1945 (Sized_incr_dynobj::do_section_type): New function.
1946 (Sized_incr_dynobj::do_section_link): New function.
1947 (Sized_incr_dynobj::do_section_info): New function.
1948 (Sized_incr_dynobj::do_section_addralign): New function.
1949 (Sized_incr_dynobj::do_initialize_xindex): New function.
1950 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1951 (make_sized_incremental_object): New function.
1952 (Incremental_library::copy_unused_symbols): New function.
1953 (Incremental_library::do_for_all_unused_symbols): New function.
1954 * incremental.h (enum Incremental_input_flags): New type.
1955 (class Incremental_checker): Remove.
1956 (Incremental_input_entry::Incremental_input_entry): Add argument
1957 serial number.
1958 (Incremental_input_entry::arg_serial): New function.
1959 (Incremental_input_entry::set_is_in_system_directory): New function.
1960 (Incremental_input_entry::is_in_system_directory): New function.
1961 (Incremental_input_entry::arg_serial_): New data member.
1962 (Incremental_input_entry::is_in_system_directory_): New data member.
1963 (class Script_info): Move here from script.h.
1964 (Script_info::Script_info): Add filename parameter.
1965 (Script_info::filename): New function.
1966 (Script_info::filename_): New data member.
1967 (Incremental_script_entry::Incremental_script_entry): Add argument
1968 serial number.
1969 (Incremental_object_entry::Incremental_object_entry): Likewise.
1970 (Incremental_object_entry::add_input_section): Build list of input
1971 sections with map to original shndx.
1972 (Incremental_object_entry::get_input_section_index): New function.
1973 (Incremental_object_entry::shndx_): New data member.
1974 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1975 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1976 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1977 serial number.
1978 (Incremental_inputs::report_archive_begin): Likewise.
1979 (Incremental_inputs::report_object): Likewise.
1980 (Incremental_inputs::report_script): Likewise.
1981 (class Incremental_global_symbol_reader): New class.
1982 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1983 and store flags and input file type.
1984 (Incremental_input_entry_reader::arg_serial): New function.
1985 (Incremental_input_entry_reader::type): Extract type from flags.
1986 (Incremental_input_entry_reader::is_in_system_directory): New function.
1987 (Incremental_input_entry_reader::get_input_section_count): Call
1988 accessor function for type.
1989 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1990 function for type; adjust size of global symbol entry.
1991 (Incremental_input_entry_reader::get_global_symbol_count): Call
1992 accessor function for type.
1993 (Incremental_input_entry_reader::get_object_count): Likewise.
1994 (Incremental_input_entry_reader::get_object_offset): Likewise.
1995 (Incremental_input_entry_reader::get_member_count): Likewise.
1996 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1997 (Incremental_input_entry_reader::get_member_offset): Likewise.
1998 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1999 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2000 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2001 (Incremental_input_entry_reader::get_global_symbol_reader): New
2002 function.
2003 (Incremental_input_entry_reader::get_output_symbol_index): New
2004 function.
2005 (Incremental_input_entry_reader::type_): Remove.
2006 (Incremental_input_entry_reader::flags_): New data member.
2007 (Incremental_inputs_reader::input_file_offset): New function.
2008 (Incremental_inputs_reader::input_file_index): New function.
2009 (Incremental_inputs_reader::input_file): Call input_file_offset.
2010 (Incremental_inputs_reader::input_file_at_offset): New function.
2011 (Incremental_relocs_reader::get_r_type): Reformat.
2012 (Incremental_relocs_reader::get_r_shndx): Reformat.
2013 (Incremental_relocs_reader::get_r_offset): Reformat.
2014 (Incremental_relocs_reader::data): New function.
2015 (Incremental_binary::Incremental_binary): Initialize new data members.
2016 (Incremental_binary::check_inputs): Add cmdline parameter.
2017 (Incremental_binary::file_is_unchanged): Remove.
2018 (Input_reader::arg_serial): New function.
2019 (Input_reader::get_unused_symbol_count): New function.
2020 (Input_reader::get_unused_symbol): New function.
2021 (Input_reader::do_arg_serial): New function.
2022 (Input_reader::do_get_unused_symbol_count): New function.
2023 (Input_reader::do_get_unused_symbol): New function.
2024 (Incremental_binary::input_file_count): New function.
2025 (Incremental_binary::get_input_reader): Change signature to use
2026 index instead of filename.
2027 (Incremental_binary::file_has_changed): New function.
2028 (Incremental_binary::get_input_argument): New function.
2029 (Incremental_binary::get_library): New function.
2030 (Incremental_binary::get_script_info): New function.
2031 (Incremental_binary::init_layout): New function.
2032 (Incremental_binary::reserve_layout): New function.
2033 (Incremental_binary::output_file): New function.
2034 (Incremental_binary::do_check_inputs): New function.
2035 (Incremental_binary::do_file_is_unchanged): Remove.
2036 (Incremental_binary::do_file_has_changed): New function.
2037 (Incremental_binary::do_init_layout): New function.
2038 (Incremental_binary::do_reserve_layout): New function.
2039 (Incremental_binary::do_input_file_count): New function.
2040 (Incremental_binary::do_get_input_reader): Change signature.
2041 (Incremental_binary::input_args_map_): New data member.
2042 (Incremental_binary::library_map_): New data member.
2043 (Incremental_binary::script_map_): New data member.
2044 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2045 new data members.
2046 (Sized_incremental_binary::output_section): New function.
2047 (Sized_incremental_binary::inputs_reader): Add const.
2048 (Sized_incremental_binary::symtab_reader): Add const.
2049 (Sized_incremental_binary::relocs_reader): Add const.
2050 (Sized_incremental_binary::got_plt_reader): Add const.
2051 (Sized_incremental_binary::get_symtab_view): New function.
2052 (Sized_incremental_binary::Inputs_reader): New typedef.
2053 (Sized_incremental_binary::Input_entry_reader): New typedef.
2054 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2055 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2056 (Sized_incremental_binary::do_file_has_changed): New function.
2057 (Sized_incremental_binary::do_init_layout): New function.
2058 (Sized_incremental_binary::do_reserve_layout): New function.
2059 (Sized_input_reader::Inputs_reader): Remove.
2060 (Sized_input_reader::Input_entry_reader): Remove.
2061 (Sized_input_reader::do_arg_serial): New function.
2062 (Sized_input_reader::do_get_unused_symbol_count): New function.
2063 (Sized_input_reader::do_get_unused_symbol): New function.
2064 (Sized_incremental_binary::do_input_file_count): New function.
2065 (Sized_incremental_binary::do_get_input_reader): Change signature;
2066 use index instead of filename.
2067 (Sized_incremental_binary::section_map_): New data member.
2068 (Sized_incremental_binary::input_entry_readers_): New data member.
2069 (class Sized_incr_relobj): New class.
2070 (class Sized_incr_dynobj): New class.
2071 (make_sized_incremental_object): New function.
2072 (class Incremental_library): New class.
2073 * layout.cc (Free_list::num_lists): New static data member.
2074 (Free_list::num_nodes): New static data member.
2075 (Free_list::num_removes): New static data member.
2076 (Free_list::num_remove_visits): New static data member.
2077 (Free_list::num_allocates): New static data member.
2078 (Free_list::num_allocate_visits): New static data member.
2079 (Free_list::init): New function.
2080 (Free_list::remove): New function.
2081 (Free_list::allocate): New function.
2082 (Free_list::dump): New function.
2083 (Free_list::print_stats): New function.
2084 (Layout_task_runner::run): Resize output file for incremental updates.
2085 (Layout::Layout): Initialize new data members.
2086 (Layout::set_incremental_base): New function.
2087 (Layout::init_fixed_output_section): New function.
2088 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2089 incremental updates.
2090 (Layout::create_gold_note): Do not create gold note section for
2091 incremental updates.
2092 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2093 for incremental updates.
2094 (Layout::set_section_offsets): For incremental updates, allocate space
2095 from free list.
2096 (Layout::create_symtab_sections): Layout with offsets relative to
2097 start of section; for incremental updates, allocate space from free
2098 list.
2099 (Layout::create_shdrs): For incremental updates, allocate space from
2100 free list.
2101 (Layout::finish_dynamic_section): For incremental updates, do not
2102 check --as-needed (fixed in subsequent patch).
2103 * layout.h (class Free_list): New class.
2104 (Layout::set_incremental_base): New function.
2105 (Layout::incremental_base): New function.
2106 (Layout::init_fixed_output_section): New function.
2107 (Layout::allocate): New function.
2108 (Layout::incremental_base_): New data member.
2109 (Layout::free_list_): New data member.
2110 * main.cc (main): Print Free_list statistics.
2111 * object.cc (Relobj::finalize_incremental_relocs): Add
2112 clear_counts parameter; clear counts only when clear_counts is set.
2113 (Sized_relobj::Sized_relobj): Initialize new base class.
2114 (Sized_relobj::do_layout): Don't report special sections.
2115 (Sized_relobj::do_for_all_local_got_entries): New function.
2116 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2117 symtab_off to all symbol table offsets.
2118 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2119 * object.h (class Got_offset_list): Move to top of file.
2120 (Object::Object): Allow case where input_file == NULL.
2121 (Object::~Object): Likewise.
2122 (Object::input_file): Assert that input_file != NULL.
2123 (Object::lock): Allow case where input_file == NULL.
2124 (Object::unlock): Likewise.
2125 (Object::is_locked): Likewise.
2126 (Object::token): Likewise.
2127 (Object::release): Likewise.
2128 (Object::is_incremental): New function.
2129 (Object::get_mtime): New function.
2130 (Object::for_all_local_got_entries): New function.
2131 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2132 (Object::set_is_in_system_directory): New function.
2133 (Object::is_in_system_directory): New function.
2134 (Object::do_is_incremental): New function.
2135 (Object::do_get_mtime): New function.
2136 (Object::do_for_all_local_got_entries): New function.
2137 (Object::is_in_system_directory_): New data member.
2138 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2139 (class Sized_relobj_base): New class.
2140 (class Sized_relobj): Derive from Sized_relobj_base.
2141 (class Sized_relobj::Symbols): Redeclare from base class.
2142 (class Sized_relobj::local_got_offset_list): Remove.
2143 (class Sized_relobj::Output_sections): Redeclare from base class.
2144 (class Sized_relobj::do_for_all_local_got_entries): New function.
2145 (class Sized_relobj::write_local_symbols): Add offset parameter.
2146 (class Sized_relobj::local_symbol_offset_): Update comment.
2147 (class Sized_relobj::local_dynsym_offset_): Update comment.
2148 * options.cc (Input_arguments::add_file): Remove const.
2149 * options.h (Input_file_argument::Input_file_argument):
2150 Initialize arg_serial_ (all constructors).
2151 (Input_file_argument::set_arg_serial): New function.
2152 (Input_file_argument::arg_serial): New function.
2153 (Input_file_argument::arg_serial_): New data member.
2154 (Input_arguments::Input_arguments): Initialize file_count_.
2155 (Input_arguments::add_file): Remove const.
2156 (Input_arguments::number_of_input_files): New function.
2157 (Input_arguments::file_count_): New data member.
2158 (Command_line::number_of_input_files): Call
2159 Input_arguments::number_of_input_files.
2160 * output.cc (Output_segment_headers::Output_segment_headers):
2161 Set current size.
2162 (Output_section::Input_section::current_data_size): New function.
2163 (Output_section::Output_section): Initialize new data members.
2164 (Output_section::add_input_section): Don't do merge sections for
2165 an incremental link; allocate space from free list for an
2166 incremental update.
2167 (Output_section::add_output_section_data): Allocate space from
2168 free list for an incremental update.
2169 (Output_section::update_data_size): New function.
2170 (Output_section::set_fixed_layout): New function.
2171 (Output_section::reserve): New function.
2172 (Output_segment::set_section_addresses): Remove const.
2173 (Output_segment::set_section_list_addresses): Remove const; allocate
2174 space from free list for an incremental update.
2175 (Output_segment::set_offset): Adjust size of RELRO segment for an
2176 incremental update.
2177 * output.h (Output_data::current_data_size): Move here from
2178 child classes.
2179 (Output_data::pre_finalize_data_size): New function.
2180 (Output_data::update_data_size): New function.
2181 (Output_section_headers::update_data_size): new function.
2182 (Output_section_data_build::current_data_size): Move to Output_data.
2183 (Output_data_strtab::update_data_size): New function.
2184 (Output_section::current_data_size): Move to Output_data.
2185 (Output_section::set_fixed_layout): New function.
2186 (Output_section::has_fixed_layout): New function.
2187 (Output_section::reserve): New function.
2188 (Output_section::update_data_size): New function.
2189 (Output_section::has_fixed_layout_): New data member.
2190 (Output_section::free_list_): New data member.
2191 (Output_segment::set_section_addresses): Remove const.
2192 (Output_segment::set_section_list_addresses): Remove const.
2193 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2194 New function.
2195 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2196 New function.
2197 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2198 parameter when calling Add_symbols constructor; store argument
2199 serial number for members of a lib group.
2200 (Add_symbols::locks): Allow case where token == NULL.
2201 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2202 (Read_member::~Read_member): New function.
2203 (Read_member::is_runnable): New function.
2204 (Read_member::locks): New function.
2205 (Read_member::run): New function.
2206 (Check_script::~Check_script): New function.
2207 (Check_script::is_runnable): New function.
2208 (Check_script::locks): New function.
2209 (Check_script::run): New function.
2210 (Check_library::~Check_library): New function.
2211 (Check_library::is_runnable): New function.
2212 (Check_library::locks): New function.
2213 (Check_library::run): New function.
2214 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2215 (Add_symbols::library_): New data member.
2216 (class Read_member): New class.
2217 (class Check_script): New class.
2218 (class Check_library): New class.
2219 * reloc.cc (Read_relocs::is_runnable): Allow case where
2220 token == NULL.
2221 (Read_relocs::locks): Likewise.
2222 (Scan_relocs::locks): Likewise.
2223 (Relocate_task::locks): Likewise.
2224 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2225 to clear counters.
2226 (Sized_relobj::incremental_relocs_scan): Fix comment.
2227 (Sized_relobj::do_relocate): Pass output file offset to
2228 write_local_symbols.
2229 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2230 from class declaration.
2231 * script.cc (read_input_script): Allocate Script_info; pass
2232 argument serial number to report_script.
2233 * script.h (class Script_info): Move to incremental.h.
2234 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2235 * symtab.h (Symbol_table::add_from_incrobj): New function.
2236 (Symbol_table::set_file_offset): New function.
2237
2238 2011-04-05 Cary Coutant <ccoutant@google.com>
2239
2240 * incremental-dump.cc (dump_incremental_inputs): Change signature
2241 to take a Sized_incremental_binary; change caller. Use readers
2242 in Sized_incremental_binary.
2243 * incremental.cc
2244 (Sized_incremental_binary::find_incremental_inputs_sections):
2245 Rename do_find_incremental_inputs_sections to this.
2246 (Sized_incremental_binary::setup_readers): New function.
2247 (Sized_incremental_binary::do_check_inputs): Check
2248 has_incremental_info_ flag; move setup code to setup_readers;
2249 use input readers.
2250 (Sized_incremental_binary::do_file_is_unchanged): New function.
2251 (Sized_incremental_binary::do_get_input_reader): New function.
2252 * incremental.h (class Incremental_binary): Move to end of file.
2253 (Incremental_binary::file_is_unchanged): New function.
2254 (Incremental_binary::do_file_is_unchanged): New function.
2255 (Incremental_binary::Input_reader): New class.
2256 (Incremental_binary::get_input_reader): New function.
2257 (class Sized_incremental_binary): Move to end of file.
2258 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2259 input section reader classes.
2260 (Sized_incremental_binary::has_incremental_info): New function.
2261 (Sized_incremental_binary::inputs_reader): New function.
2262 (Sized_incremental_binary::symtab_reader): New function.
2263 (Sized_incremental_binary::relocs_reader): New function.
2264 (Sized_incremental_binary::got_plt_reader): New function.
2265 (Sized_incremental_binary::do_file_is_unchanged): New function.
2266 (Sized_incremental_binary::Sized_input_reader): New class.
2267 (Sized_incremental_binary::get_input_reader): New function.
2268 (Sized_incremental_binary::find_incremental_inputs_sections):
2269 Rename do_find_incremental_inputs_sections to this.
2270 (Sized_incremental_binary::setup_readers): New function.
2271 (Sized_incremental_binary::has_incremental_info_): New data member.
2272 (Sized_incremental_binary::inputs_reader_): New data member.
2273 (Sized_incremental_binary::symtab_reader_): New data member.
2274 (Sized_incremental_binary::relocs_reader_): New data member.
2275 (Sized_incremental_binary::got_plt_reader_): New data member.
2276 (Sized_incremental_binary::current_input_file_): New data member.
2277
2278 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2279
2280 PR gold/12640
2281 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2282 violation.
2283
2284 2011-03-30 Cary Coutant <ccoutant@google.com>
2285
2286 * archive.cc (Archive::include_member): Adjust call to report_object.
2287 (Add_archive_symbols::run): Add script_info to call to
2288 report_archive_begin.
2289 (Lib_group::include_member): Adjust call to report_object.
2290 (Add_lib_group_symbols::run): Adjust call to report_object.
2291 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2292 blocks. Add object count for script input files.
2293 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2294 script_info parameter; change all callers.
2295 (Incremental_inputs::report_object): Add script_info parameter;
2296 change all callers.
2297 (Incremental_inputs::report_script): Store backpointer to
2298 incremental info entry.
2299 (Output_section_incremental_inputs::set_final_data_size): Record
2300 additional information for scripts.
2301 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2302 * incremental.h (Incremental_script_entry::add_object): New function.
2303 (Incremental_script_entry::get_object_count): New function.
2304 (Incremental_script_entry::get_object): New function.
2305 (Incremental_script_entry::objects_): New data member; adjust
2306 constructor.
2307 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2308 (Incremental_inputs::report_object): Add script_info parameter.
2309 (Incremental_inputs_reader::get_object_count): New function.
2310 (Incremental_inputs_reader::get_object_offset): New function.
2311 * options.cc (Input_arguments::add_file): Return reference to
2312 new input argument.
2313 * options.h (Input_argument::set_script_info): New function.
2314 (Input_argument::script_info): New function.
2315 (Input_argument::script_info_): New data member; adjust all
2316 constructors.
2317 (Input_file_group::add_file): Return reference to new input argument.
2318 (Input_file_lib::add_file): Likewise.
2319 (Input_arguments::add_file): Likewise.
2320 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2321 * script.cc (Parser_closure::Parser_closure): Add script_info
2322 parameter; adjust all callers.
2323 (Parser_closure::script_info): New function.
2324 (Parser_closure::script_info_): New data member.
2325 (read_input_script): Report scripts earlier to incremental info.
2326 (script_add_file): Set script_info in Input_argument.
2327 (script_add_library): Likewise.
2328 * script.h (Script_options::Script_info): Rewrite class.
2329
2330 2011-03-29 Cary Coutant <ccoutant@google.com>
2331
2332 * archive.cc (Library_base::should_include_member): Move
2333 method here from class Archive.
2334 (Archive::Archive): Initialize base class.
2335 (Archive::should_include_member): Move to base class.
2336 (Archive::do_for_all_unused_symbols): New function.
2337 (Add_archive_symbols::run): Remove redundant access to
2338 incremental_inputs.
2339 (Lib_group::Lib_group): Initialize base class.
2340 (Lib_group::do_filename): New function.
2341 (Lib_group::include_member): Pass pointer to Lib_group to
2342 report_object.
2343 (Lib_group::do_for_all_unused_symbols): New function.
2344 (Add_lib_group_symbols::run): Report archive information for
2345 incremental links.
2346 * archive.h (class Library_base): New base class.
2347 (class Archive): Derive from Library_base.
2348 (Archive::filename): Move to base class.
2349 (Archive::set_incremental_info): Likewise.
2350 (Archive::incremental_info): Likewise.
2351 (Archive::Should_include): Likewise.
2352 (Archive::should_include_member): Likewise.
2353 (Archive::Armap_entry): Remove.
2354 (Archive::Unused_symbol_iterator): Remove.
2355 (Archive::unused_symbols_begin): Remove.
2356 (Archive::unused_symbols_end): Remove.
2357 (Archive::do_filename): New function.
2358 (Archive::do_get_mtime): New function.
2359 (Archive::do_for_all_unused_symbols): New function.
2360 (Archive::task_): Move to base class.
2361 (Archive::incremental_info_): Likewise.
2362 (class Lib_group): Derive from Library_base.
2363 (Lib_group::do_filename): New function.
2364 (Lib_group::do_get_mtime): New function.
2365 (Lib_group::do_for_all_unused_symbols): New function.
2366 (Lib_group::task_): Move to base class.
2367 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2368 function.
2369 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2370 function.
2371 * incremental.cc (Incremental_inputs::report_archive_begin):
2372 Use Library_base; call library's get_mtime; add incremental inputs
2373 entry before members.
2374 (class Unused_symbol_visitor): New class.
2375 (Incremental_inputs::report_archive_end): Use Library_base; use
2376 visitor class to record unused symbols; don't add incremental inputs
2377 entry after members.
2378 (Incremental_inputs::report_object): Use Library_base.
2379 * incremental.h
2380 (Incremental_archive_entry::Incremental_archive_entry): Remove
2381 unused Archive parameter.
2382 (Incremental_inputs::report_archive_begin): Use Library_base.
2383 (Incremental_inputs::report_archive_end): Likewise.
2384 (Incremental_inputs::report_object): Likewise.
2385 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2386 function.
2387 * object.h (Object::for_all_global_symbols): New function.
2388 (Object::do_for_all_global_symbols): New function.
2389 (Sized_relobj::do_for_all_global_symbols): New function.
2390 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2391 function.
2392 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2393 function.
2394
2395 2011-03-27 Ian Lance Taylor <iant@google.com>
2396
2397 * archive.cc (Archive::interpret_header): Return -1 if something
2398 goes wrong. Change callers accordingly.
2399
2400 2011-03-25 Cary Coutant <ccoutant@google.com>
2401
2402 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2403 * testsuite/Makefile.in: Regenerate.
2404
2405 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
2406
2407 * plugin.cc (get_view): New.
2408 (Plugin::load): Pass get_view to the plugin.
2409 (Plugin_manager::get_view): New.
2410
2411 2011-03-21 Ian Lance Taylor <iant@google.com>
2412
2413 * testsuite/final_layout.sh: Rewrite to not use dc.
2414 * testsuite/relro_test.sh: Fail if dc is not present.
2415
2416 2011-03-21 Sriraman Tallam <tmsriram@google.com>
2417
2418 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2419 Change == to -eq.
2420 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2421 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2422 Change == to -eq.
2423 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2424 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2425
2426 2011-03-14 Ian Lance Taylor <iant@google.com>
2427
2428 * script-sections.cc (Sort_output_sections::script_compare):
2429 Rename from is_before, change return type.
2430 (Sort_output_sections::operator()): Adjust accordingly.
2431
2432 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2433
2434 PR gold/12572
2435 * testsuite/odr_violation2.cc: Add comment to make all error line
2436 numbers double digits.
2437 * testsuite/debug_msg.sh: Adjust expected errors.
2438
2439 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2440
2441 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2442 but mark earlier ones as non-canonical
2443 (offset_to_iterator): Update search target and example
2444 (do_addr2line): Return extra lines in a vector*
2445 (format_file_lineno): Extract from do_addr2line
2446 (one_addr2line): Add vector* out-param
2447 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2448 when a lineno entry appeared last for its instruction
2449 (Dwarf_line_info): Add vector* out-param
2450 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2451 * symtab.cc (Odr_violation_compare): Include the lineno in the
2452 comparison again.
2453 (linenos_from_loc): New. Combine the canonical line for an
2454 address with its other lines.
2455 (True_if_intersect): New. Helper functor to make
2456 std::set_intersection a query.
2457 (detect_odr_violations): Compare sets of lines instead of just
2458 one line for each function. This became less deterministic, but
2459 has fewer false positives.
2460 * symtab.h: Declarations.
2461 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2462 mix an optimized and non-optimized object in the same binary
2463 (odr_violation2.so): Same.
2464 * testsuite/Makefile.in: Regenerate from Makefile.am.
2465 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2466 * testsuite/debug_msg.sh: Update line numbers and add
2467 assertions.
2468 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2469 non-optimized context.
2470 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2471 isn't inlined, and use OdrDerived in an optimized context.
2472 * testsuite/odr_header1.h: Defines OdrDerived, where
2473 optimization will change the
2474 first-instruction-in-the-destructor's file and line number.
2475 * testsuite/odr_header2.h: Defines OdrBase.
2476
2477 2011-03-09 Ian Lance Taylor <iant@google.com>
2478
2479 * fileread.cc (File_read::clear_views): Don't delete the whole
2480 file view.
2481
2482 2011-03-08 Ian Lance Taylor <iant@google.com>
2483
2484 PR gold/12525
2485 * fileread.cc: #include <climits>.
2486 (GOLD_IOV_MAX): Define.
2487 (File_read::read_multiple): Limit number of entries by iov_max.
2488 * fileread.h (class File_read): Always set max_readv_entries to
2489 128.
2490
2491 2011-03-07 Ian Lance Taylor <iant@google.com>
2492
2493 PR gold/12525
2494 * options.h (class General_options): Add -dy and -dn.
2495
2496 2011-03-02 Cary Coutant <ccoutant@google.com>
2497
2498 * testsuite/script_test_9.t: Add TLS segment.
2499
2500 2011-03-02 Simon Baldwin <simonb@google.com>
2501
2502 * configure.ac: Add check for gnu_indirect_function support in
2503 the toolchain building binutils.
2504 * configure: Rebuild.
2505
2506 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2507
2508 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2509 plugin only symbols.
2510 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2511 in plugin files as not needed in the symbol table.
2512
2513 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2514
2515 * output.cc (Output_section::add_input_section): Delay fill
2516 generation for section ordering.
2517
2518 2011-02-09 Ian Lance Taylor <iant@google.com>
2519
2520 PR gold/12316
2521 * object.h (class Sized_relobj): Remove clear_local_symbols.
2522 * reloc.cc (Sized_relobj::do_relocate): Don't call
2523 clear_local_symbols.
2524
2525 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2526
2527 * plugin.cc (is_visible_from_outside): Return true for symbols
2528 in the -u option.
2529
2530 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2531
2532 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2533 filename.
2534
2535 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2536
2537 * icf.h (is_section_foldable_candidate): Change type of parameter
2538 to std::string.
2539 * icf.cc (Icf::find_identical_sections): Change type of local variable
2540 section_name to be std::string.
2541 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2542
2543 2011-01-25 Ian Lance Taylor <iant@google.com>
2544
2545 * script.cc (script_add_extern): Rewrite to use
2546 add_symbol_reference.
2547
2548 2011-01-25 Doug Kwan <dougkwan@google.com>
2549
2550 * icf.cc (get_section_contents): Always lock section's object.
2551
2552 2011-01-24 Ian Lance Taylor <iant@google.com>
2553
2554 * options.h (class General_options): Accept
2555 --no-detect-odr-violations.
2556
2557 2011-01-24 Ian Lance Taylor <iant@google.com>
2558
2559 * version.cc (version_string): Bump to 1.11.
2560
2561 2011-01-24 Ian Lance Taylor <iant@google.com>
2562
2563 * plugin.cc (class Plugin_rescan): Define new class.
2564 (Plugin_manager::claim_file): Set any_claimed_.
2565 (Plugin_manager::save_archive): New function.
2566 (Plugin_manager::save_input_group): New function.
2567 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2568 necessary.
2569 (Plugin_manager::new_undefined_symbol): New function.
2570 (Plugin_manager::rescan): New function.
2571 (Plugin_manager::rescannable_defines): New function.
2572 (Plugin_manager::add_input_file): Set any_added_.
2573 * plugin.h (class Plugin_manager): define new fields rescannable_,
2574 undefined_symbols_, any_claimed_, and any_added_. Declare
2575 Plugin_rescan as friend. Declare new functions.
2576 (Plugin_manager::Rescannable): Define type.
2577 (Plugin_manager::Rescannable_list): Define type.
2578 (Plugin_manager::Undefined_symbol_list): Define type.
2579 (Plugin_manager::Plugin_manager): Initialize new fields.
2580 * archive.cc (Archive::defines_symbol): New function.
2581 (Add_archive_symbols::run): Pass archive to plugins if any.
2582 * archive.h (class Archive): Declare defines_symbol.
2583 * readsyms.cc (Input_group::~Input_group): New function.
2584 (Finish_group::run): Pass input_group to plugins if any.
2585 * readsyms.h (class Input_group): Declare destructor.
2586 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2587 any.
2588
2589 2011-01-10 Ian Lance Taylor <iant@google.com>
2590
2591 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2592 section as relro.
2593 (Layout::set_segment_offsets): Reset increase_relro before calling
2594 set_section_addresses a second time.
2595
2596 2011-01-04 Cary Coutant <ccoutant@google.com>
2597
2598 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2599 sections before NOBITS sections.
2600
2601 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2602
2603 * version.cc (print_version): Update copyright to 2011.
2604
2605 2010-12-23 Cary Coutant <ccoutant@google.com>
2606
2607 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2608 of OS to this->add. Add OD parameter to second form of the function.
2609
2610 2010-12-20 Ian Lance Taylor <iant@google.com>
2611
2612 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2613 second of two consecutive entries with same offset.
2614
2615 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2616
2617 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2618 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2619 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2620 to avoid unneeded links against $(LDADD).
2621 * testsuite/Makefile.in: Regenerate.
2622
2623 2010-12-15 Ian Lance Taylor <iant@google.com>
2624
2625 PR gold/12324
2626 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2627 for R_X86_64_32 and R_X86_64_PC32.
2628 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2629 ver_matching_def_pic.o.
2630 (ver_matching_def_pic.o): New target.
2631
2632 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2633
2634 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2635 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2636 Move definition before File_read::View member definitions.
2637 (File_read::View::~View): Initialize and hold lock before
2638 updating current_mapped_bytes.
2639
2640 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2641
2642 * dwarf_reader.cc: Remove outdated comment.
2643 * gold-threads.cc: Fix typo in error message.
2644 * archive.cc: Fix typos in comments.
2645 * archive.h: Likewise.
2646 * arm-reloc-property.cc: Likewise.
2647 * arm-reloc-property.h: Likewise.
2648 * arm-reloc.def: Likewise.
2649 * arm.cc: Likewise.
2650 * attributes.h: Likewise.
2651 * cref.cc: Likewise.
2652 * ehframe.cc: Likewise.
2653 * fileread.h: Likewise.
2654 * gold.h: Likewise.
2655 * i386.cc: Likewise.
2656 * icf.cc: Likewise.
2657 * incremental.h: Likewise.
2658 * int_encoding.cc: Likewise.
2659 * layout.h: Likewise.
2660 * main.cc: Likewise.
2661 * merge.h: Likewise.
2662 * object.cc: Likewise.
2663 * object.h: Likewise.
2664 * options.cc: Likewise.
2665 * readsyms.cc: Likewise.
2666 * reduced_debug_output.cc: Likewise.
2667 * reloc.cc: Likewise.
2668 * script-sections.cc: Likewise.
2669 * sparc.cc: Likewise.
2670 * symtab.h: Likewise.
2671 * target-reloc.h: Likewise.
2672 * target.cc: Likewise.
2673 * target.h: Likewise.
2674 * timer.cc: Likewise.
2675 * timer.h: Likewise.
2676 * x86_64.cc: Likewise.
2677
2678 2010-12-09 Cary Coutant <ccoutant@google.com>
2679
2680 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2681 stack.
2682 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2683 parameter; change all callers.
2684 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2685 * options.h (warn_execstack): New option.
2686
2687 2010-12-07 Doug Kwan <dougkwan@google.com>
2688
2689 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2690 like function call relocations.
2691
2692 2010-12-07 Ian Lance Taylor <iant@google.com>
2693
2694 * archive.cc (Archive::get_elf_object_for_member): Permit
2695 punconfigured to be NULL.
2696 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2697 (Archive::include_member): Pass NULL to get_elf_object_for_member
2698 if we searched for the archive and this is the first included
2699 object.
2700
2701 2010-12-01 Ian Lance Taylor <iant@google.com>
2702
2703 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2704 track_relocs_type_ field.
2705 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2706 Set track_relocs_type_.
2707 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2708 contents when using RELA relocs.
2709 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2710 reloc_map_.
2711 * reloc.cc (Track_relocs::next_addend): New function.
2712 * reloc.h (class Track_relocs): Declare next_addend.
2713
2714 2010-12-01 Ian Lance Taylor <iant@google.com>
2715
2716 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2717 virtual destructor.
2718
2719 2010-12-01 Ian Lance Taylor <iant@google.com>
2720
2721 * README: Update compilers known to work and fail.
2722
2723 2010-11-23 Matthias Klose <doko@ubuntu.com>
2724
2725 * configure.in: For --enable-gold, handle value `default' instead of
2726 `both*'. Always install ld as ld.bfd, install as ld if gold is
2727 not the default.
2728 * configure: Regenerate.
2729
2730 2010-11-18 Doug Kwan <dougkwan@google.com>
2731
2732 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2733 and right_alignment to be zero. Store result alignment only if it is
2734 greater than existing alignment.
2735
2736 2010-11-16 Cary Coutant <ccoutant@google.com>
2737
2738 PR gold/12220
2739 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2740 Check for ".zdebug_line".
2741
2742 2010-11-16 Doug Kwan <dougkwan@google.com>
2743 Cary Coutant <ccoutant@google.com>
2744
2745 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2746 by reference; adjust all callers.
2747 * output.cc (Output_segment::set_section_addresses): Adjust references
2748 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2749 list is empty.
2750 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2751 end at page boundary.
2752
2753 2010-11-16 Cary Coutant <ccoutant@google.com>
2754
2755 PR gold/12220
2756 * layout.cc (Layout::choose_output_section): Transform names of
2757 compressed sections even when using a script with a SECTIONS clause.
2758 (Layout::output_section_name): Remove code to transform
2759 compressed debug section names.
2760 * output.cc (Output_section::add_input_section): Use uncompressed
2761 section size when tracking input sections.
2762
2763 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2764
2765 * symtab.h (Symbol::NON_PIC_REF): Remove.
2766 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2767 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2768 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2769 (Symbol::use_plt_offset): Take a flags argument and pass it
2770 directly to needs_dynamic_reloc. Restrict check for undefined
2771 weak symbols to function calls.
2772 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2773 (Target_arm::Scan::global): Use it.
2774 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2775 (Target_arm::Relocate::relocate): Likewise.
2776 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2777 parameter with an r_type parameter. Use get_reference_flags
2778 to get the flags.
2779 (Target_arm::Relocate::relocate): Update accordingly.
2780 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2781 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2782 (Target_i386::Scan::global): Likewise.
2783 (Target_i386::Relocate::relocate): Likewise.
2784 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2785 parameter with an r_type parameter. Use get_reference_flags
2786 to get the flags.
2787 (Target_i386::Relocate::relocate): Update accordingly.
2788 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2789 (Target_powerpc::Scan::global): Use it.
2790 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2791 (Target_powerpc::Relocate::relocate): Likewise.
2792 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2793 (Target_sparc::Scan::global): Use it.
2794 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2795 (Target_sparc::Relocate::relocate): Likewise.
2796 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2797 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2798 (Target_x86_64::Scan::global): Likewise.
2799 (Target_x86_64::Relocate::relocate): Likewise.
2800
2801 2010-11-08 Doug Kwan <dougkwan@google.com>
2802 Cary Coutant <ccoutant@google.com>
2803
2804 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2805 (Arm_exidx_merge_section::section_contents_): New data member.
2806 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2807 (Arm_input_section::~Arm_input_section): De-allocate memory.
2808 (Arm_input_section::original_contents_): New data member.
2809 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2810 in parameters instead of calling Object::section_contents without
2811 locking.
2812 (Arm_output_section::group_section): New parameter TASK. Pass it
2813 to callees that need locking objects.
2814 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2815 to lock EXIDX input sections. Fix a formatting issue. Call
2816 Arm_exidx_merged_section::build_contents to create merged section
2817 contents.
2818 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2819 to lock object of stub table owner.
2820 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2821 TEXT_SIZE to initialize data member TEXT_SIZE_.
2822 (Arm_exidx_input_section::addralign): Fix typo in comment.
2823 (Arm_exidx_input_section::text_size): New method.
2824 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2825 that require locking objects. Lock objects before scanning for stubs
2826 and updating local symbols.
2827 (Arm_input_section<big_endian>::init): Copy contents of original
2828 input section.
2829 (Arm_input_section<big_endian>::do_write): Use saved contents of
2830 original input section instead of calling Object::section_contents
2831 without locking.
2832 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2833 size without calling Object::section_size().
2834 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2835 for size. Allocate a buffer for merged EXIDX entries.
2836 (Arm_exidx_merged_section::build_contents): New method.
2837 (Arm_exidx_merged_section::do_write): Move merge section contents
2838 building code to Arm_exidx_merged_section::build_contetns. Write
2839 out contetns in buffer instead of building it on the fly.
2840 (Arm_relobj::make_exidx_input_section): Also pass text section size
2841 to Arm_exidx_input_section constructor.
2842 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2843 (Arm_dynobj::do_read_symbols): Fix memory leak.
2844 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2845 * target.h: (class Task): Add forward declaration.
2846 (Target::relax): Add new parameter TASK and pass it to
2847 Target::do_relax().
2848 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2849
2850 2010-11-05 Cary Coutant <ccoutant@google.com>
2851
2852 PR gold/10708
2853 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2854 object when reading from the file.
2855 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2856 second layout pass.
2857 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2858 when reading section contents.
2859 (get_section_contents): Likewise.
2860 (icf::find_identical_sections): Likewise.
2861 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2862 object when reading from the file.
2863 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2864 the object when doing deferred section layout.
2865
2866 2010-11-03 Nick Clifton <nickc@redhat.com>
2867
2868 PR gold/12001
2869 * script.h (class Symbol_assignment: name): New member. Returns
2870 the name of the symbol.
2871 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2872 Returns true if the given symbol name is on the list of
2873 assignments wating to be processed.
2874 * archive.cc (should_incldue_member): If the symbol is undefined,
2875 check to see if it is on the list of symbols pending assignment.
2876
2877 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2878
2879 * script-sections.cc (Script_sections::find_memory_region): Check
2880 for a NULL output section pointer.
2881
2882 2010-10-29 Doug Kwan <dougkwan@google.com>
2883
2884 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2885 Output_section::add_relaxed_input_section.
2886 * output.cc (Output_section::add_relaxed_input_section): Add new
2887 arguments LAYOUT and NAME. Set section order index.
2888 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2889 Copy section order index.
2890 * output.h (Output_section::add_relaxed_input_section): Add new
2891 arguments LAYOUT and NAME.
2892
2893 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2894
2895 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2896 NATIVE_OR_CROSS_LINKER.
2897 * testsuite/Makefile.in: Regenerate.
2898
2899 2010-10-20 Doug Kwan <dougkwan@google.com>
2900
2901 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2902 without SHF_LINK_ORDER flags.
2903 * layout.cc (Layout::choose_output_section): Do not filter
2904 SHF_LINK_ORDER flag in a relocatable link.
2905
2906 2010-10-17 Cary Coutant <ccoutant@google.com>
2907
2908 * output.h (Output_segment::set_section_addresses): Change function
2909 signature. Update all callers.
2910 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2911 sections.
2912 (Output_segment::set_section_addresses): Align after last TLS
2913 section. Add padding before last relro section instead of after.
2914
2915 2010-10-17 Doug Kwan <dougkwan@google.com>
2916
2917 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2918 GOT output section to be writable.
2919
2920 2010-10-14 Cary Coutant <ccoutant@google.com>
2921
2922 * debug.h (DEBUG_INCREMENTAL): New flag.
2923 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2924 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2925 mode.
2926 * incremental.cc (report_command_line): Ignore all forms of
2927 --incremental.
2928 * layout.cc (Layout::Layout): Check parameters for incremental link
2929 mode.
2930 * options.cc (General_options::parse_incremental): New function.
2931 (General_options::parse_no_incremental): New function.
2932 (General_options::parse_incremental_full): New function.
2933 (General_options::parse_incremental_update): New function.
2934 (General_options::incremental_mode_): New data member.
2935 (General_options::finalize): Check incremental_mode_.
2936 * options.h (General_options): Update help text for --incremental.
2937 Add --no-incremental, --incremental-full, --incremental-update.
2938 (General_options::Incremental_mode): New enum type.
2939 (General_options::incremental_mode): New function.
2940 (General_options::incremental_mode_): New data member.
2941 * parameters.cc (Parameters::incremental_mode_): New data member.
2942 (Parameters::set_options): Set incremental_mode_.
2943 (Parameters::set_incremental_full): New function.
2944 (Parameters::incremental): New function.
2945 (Parameters::incremental_update): New function.
2946 (set_parameters_incremental_full): New function.
2947 * parameters.h (Parameters::set_incremental_full): New function.
2948 (Parameters::incremental): New function.
2949 (Parameters::incremental_update): New function.
2950 (Parameters::incremental_mode_): New data member.
2951 (set_parameters_incremental_full): New function.
2952 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2953 incremental link mode.
2954 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2955 (Sized_relobj::do_relocate_sections): Likewise.
2956 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2957 option.
2958 * testsuite/Makefile.in: Regenerate.
2959 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2960
2961 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2962
2963 * script-sections.h (class Script_sections): Make
2964 Sections_elements typedef public.
2965 * script-sections.cc (class Sort_output_sections): Add elements_
2966 field. Add constructor which sets it; change all callers.
2967 (Sort_output_sections::is_before): New function.
2968 (Sort_output_sections::operator()): Call is_before.
2969 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2970 conditional.
2971 * testsuite/script_test_10.sh: New test. Test script section
2972 order.
2973 * testsuite/script_test_10.t: Likewise.
2974 * testsuite/script_test_10.s: Likewise.
2975 * testsuite/Makefile.am: Wrap the cross linker tests and the
2976 common tests into NATIVE_OR_CROSS_LINKER.
2977 (check_SCRIPTS): Add script_test_10.sh.
2978 (check_DATA): Add script_test_10.stdout.
2979 (script_test_10.o, script_test_10): New targets.
2980 (script_test_10.stdout): New target.
2981 * configure, testsuite/Makefile.in: Regenerate.
2982
2983 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2984
2985 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2986 error for the deprecated relocations.
2987 (Target_arm::Scan::global): Likewise.
2988 (Target_arm::Relocate::relocate): Likewise.
2989
2990 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2991
2992 * fileread.cc (Input_file::find_file): Initialize *found_name
2993 and *namep when using the fallback search for case 4.
2994
2995 2010-10-11 Cary Coutant <ccoutant@google.com>
2996
2997 * options.h (class General_options): Redefine -z lazy as an alias for
2998 the negation of -z now.
2999
3000 2010-10-11 Ian Lance Taylor <iant@google.com>
3001
3002 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3003 binding.
3004
3005 2010-10-06 Nick Clifton <nickc@redhat.com>
3006
3007 * script-sections.cc(class Memory_region): Remove
3008 current_lma_offset_ field. Rename current_vma_offset_ to
3009 current_offset_. Add last_section_ field.
3010 (Memory_region::get_current_vma_address): Rename to
3011 get_current_address.
3012 (Memory_region::get_current_lma_address): Delete.
3013 (Memory_region::increment_vma_offset): Rename to
3014 increment_offset.
3015 (Memory_region::increment_lma_offset): Delete.
3016 (Memory_region::attributes_compatible): New method. Returns
3017 true if the provided section is compatible with the region.
3018 (Memory_region::get_last_section): New method. Returns the last
3019 section to use the region.
3020 (Memory_region::set_last_section): New method. Stores the last
3021 section to use the region.
3022 (Script_sections::block_in_region): New method. Returns true if
3023 a block of memory is contained within a region.
3024 (Script_sections::find_memory_region): New method. Locates a
3025 memory region to be used to set a VMA or LMA address.
3026 (Output_section_definition::set_section_addresses): Add code to
3027 check for addresses set by memory regions.
3028 (Output_segment::set_section_addresses): Remove memory region
3029 walking code.
3030 (Script_sections::create_segment): Add a warning if a header
3031 segment is created outside of any region.
3032 * script-sections.h (class Script_sections): Add prototypes for
3033 find_memory_region and block_in_region methods.
3034 * testsuite/memory_test.s: Use .long instead of .word.
3035 * testsuite/memory_test.t: Add some more output sections.
3036 * testsuite/memory_test.sh: Update expected output.
3037
3038 2010-10-02 Doug Kwan <dougkwan@google.com>
3039
3040 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3041 defintion to symtab.h
3042 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3043 declaration to defintion.
3044
3045 2010-10-01 Nick Clifton <nickc@redhat.com>
3046
3047 * expression.cc (eval): Replace dummy argument with NULL.
3048 (eval_maybe_dot): Check for a NULL result section pointer.
3049 (Symbol_expression::value): Likewise.
3050 (Dot_expression::value): Likewise.
3051 (BINARY_EXPRESSION): Likewise.
3052 (Max_expression::value): Likewise.
3053 (Min_expression::value): Likewise.
3054 (Absolute_expression::value): Likewise.
3055 (Addr_expression::value_from_output_section): Likewise.
3056 (Loaddddr_expression::value_from_output_section): Likewise.
3057 (Segment_start_expression::value): Likewise.
3058 * script-sections.cc
3059 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3060 argument with NULL.
3061 (Sections_elememt_dot_assignment::set_section_addresses):
3062 Likewise.
3063 (Output_data_expression::do_write_to_buffer): Likewise.
3064 (Output_section_definition::finalize_symbols): Likewise.
3065 (Output_section_definition::set_section_addresses): Likewise.
3066
3067 2010-09-30 Doug Kwan <dougkwan@google.com>
3068
3069 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3070
3071 2010-09-28 Sriraman Tallam <tmsriram@google.com>
3072
3073 * target.h (Target::can_icf_inline_merge_sections): New virtual
3074 function.
3075 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3076 virtual function.
3077 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3078 virtual function.
3079 * icf.cc (get_section_contents): Inline merge sections only when
3080 target allows it.
3081
3082 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3083
3084 * configure: Regenerate.
3085
3086 2010-09-17 Ian Lance Taylor <iant@google.com>
3087
3088 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
3089 * testsuite/Makefile.am (memory_test.o): New target.
3090 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3091 memory_test.t.
3092 * testsuite/Makefile.in: Rebuild.
3093
3094 2010-09-17 Doug Kwan <dougkwan@google.com>
3095
3096 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3097 defintion if relocation uses GOT entries of the symbol.
3098 * testsuite/icf_safe_test.sh: Fix test.
3099 * testsuite/icf_safe_so_test.sh: Fix test.
3100
3101 2010-09-16 Cary Coutant <ccoutant@google.com>
3102
3103 * script_sections.cc (class Memory_region): Remove "NULL" from
3104 vector initializations.
3105
3106 2010-09-15 Cary Coutant <ccoutant@google.com>
3107
3108 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3109 Resolve forwarding symbols.
3110
3111 2010-09-15 Doug Kwan <dougkwan@google.com>
3112
3113 * gold/testsuite/script_test_3.t: Add ARM special sections.
3114 * gold/testsuite/script_test_4.t: Same.
3115 * gold/testsuite/script_test_5.t: Same.
3116 * gold/testsuite/script_test_6.t: Same.
3117 * gold/testsuite/script_test_7.t: Same.
3118 * gold/testsuite/script_test_7.t: Same.
3119 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3120
3121 2010-09-14 Cary Coutant <ccoutant@google.com>
3122
3123 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3124 (Target_x86_64::Relocate::relocate_tls): Replace check for
3125 saw_tls_block_reloc_ with test for executable section.
3126
3127 2010-09-12 Cary Coutant <ccoutant@google.com>
3128
3129 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3130 position-independent executables to shared libraries need dynamic
3131 relocations.
3132 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3133 position-independent executables.
3134 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3135 * testsuite/Makefile.in: Regenerate.
3136
3137 2010-09-10 Nick Clifton <nickc@redhat.com>
3138
3139 PR gold/11997
3140 * testsuite/memory_test.t: Discard any sections that are not
3141 needed.
3142
3143 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3144
3145 PR gold/11996
3146 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3147 "This::" to work around a bug in gcc 4.2.
3148
3149 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3150
3151 2010-09-09 Rafael Espindola <espindola@google.com>
3152
3153 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3154 sections with different PF_X flags in the same segment.
3155 (Layout::find_first_load_seg): Search all segments to find the first
3156 one.
3157 * options.h (rosegment): New.
3158
3159 2010-09-08 Rafael Espindola <espindola@google.com>
3160
3161 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
3162
3163 2010-09-08 Doug Kwan <dougkwan@google.com>
3164
3165 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3166 (Arm_relobj::do_relocate_sections): Add new parameter for output
3167 file to match the parent.
3168 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3169 of local symbols instead of input values. Update code to track
3170 changes in gold::relocate_section.
3171 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3172 (Sized_relobj::compute_final_local_value_internal): New methods.
3173 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3174 body into private version of Sized_relobj::compute_final_local_value.
3175 Call the inline method.
3176 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3177 merged symbol value if there is one.
3178 (Symbol_value::has_output_value): New method defintiion.
3179 (Sized_relobj::Compute_final_local_value_status): New enum type.
3180 (Sized_relobj::compute_final_local_value): New methods.
3181 (Sized_relobj::compute_final_local_value_internal): New methods.
3182 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3183 and arm_cortex_a8.sh.
3184 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3185 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3186 New tests.
3187 * Makefile.in: Regenerate.
3188 * testsuite/arm_bl_out_of_range.s: Update test.
3189 * testsuite/thumb_bl_out_of_range.s: Ditto.
3190 * testsuite/thumb_blx_out_of_range.s: Ditto.
3191 * testsuite/arm_branch_out_of_range.sh: New file.
3192 * testsuite/arm_cortex_a8.sh: Ditto.
3193 * testsuite/arm_cortex_a8_b.s: Ditto.
3194 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3195 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3196 * testsuite/arm_cortex_a8_bl.s: Ditto.
3197 * testsuite/arm_cortex_a8_blx.s: Ditto.
3198 * testsuite/arm_cortex_a8_local.s: Ditto.
3199 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3200 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3201
3202 2010-09-08 Rafael Espindola <espindola@google.com>
3203
3204 * Makefile.am (memory_test.stdout): Run readelf with -W.
3205 * Makefile.in: Regenerate.
3206 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3207 64 bit output.
3208
3209 2010-09-08 Rafael Espindola <espindola@google.com>
3210
3211 * script-sections.cc (Script_sections::add_memory_region): Convert
3212 field precision to int.
3213 * script.cc (script_set_section_region, script_set_section_region):
3214 Convert field precision to int.
3215
3216 2010-09-08 Rafael Espindola <espindola@google.com>
3217
3218 * arm.cc (do_finalize_sections): Create the __exidx_start and
3219 __exdix_end symbols even when the section is missing.
3220
3221 2010-09-08 Nick Clifton <nickc@redhat.com>
3222
3223 * README: Remove claim that MEMORY is not supported.
3224 * expression.cc (script_exp_function_origin)
3225 (script_exp_function_length): Move from here to ...
3226 * script.cc: ... here.
3227 (script_set_section_region, script_add_memory)
3228 (script_parse_memory_attr, script_include_directive): New
3229 functions.
3230 * script-sections.cc
3231 (class Memory_region): New class.
3232 (class Output_section_definition): Add set_memory_region,
3233 set_section_vma, set_section_lma and get_section_name methods.
3234 (class Script_Sections): Add add_memory_region,
3235 find_memory_region, find_memory_region_origin,
3236 find_memory_region_length and set_memory_region methods.
3237 Have set_section_addresses method walk the list of set memory
3238 regions.
3239 Extend the print methos to display memory regions.
3240 * script-sections.h: Add prototypes for new methods.
3241 Add enum for MEMORY region attributes.
3242 * yyscript.y: Add support for parsing MEMORY regions.
3243 * script-c.h: Add prototypes for new functions.
3244 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3245 * testsuite/Makefile.in: Regenerate.
3246 * testsuite/memory_test.sh: New script.
3247 * testsuite/memory_test.s: New assembler source file.
3248 * testsuite/memory_test.t: New linker script.
3249
3250 2010-08-27 Doug Kwan <dougkwan@google.com>
3251
3252 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3253 reference override an existing dynamic weak reference.
3254 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3255 * testsuite/Makefile.in: Regenerate.
3256 * testsuite/dyn_weak_ref.sh: New file.
3257 * testsuite/dyn_weak_ref_1.c: Ditto.
3258 * testsuite/dyn_weak_ref_2.c: Ditto.
3259
3260 2010-08-27 Ian Lance Taylor <iant@google.com>
3261
3262 * incremental.h (class Incremental_input_entry): Add virtual
3263 destructor.
3264
3265 2010-08-27 Ian Lance Taylor <iant@google.com>
3266
3267 * testsuite/start_lib_test_3.c: Mark t3 as used.
3268
3269 2010-08-27 Nick Clifton <nickc@redhat.com>
3270
3271 * options.cc (version_script): Fix small typo in previous
3272 whitespace tidyup.
3273
3274 2010-08-25 Nick Clifton <nickc@redhat.com>
3275
3276 * archive.cc: Formatting fixes: Remove whitespace between
3277 typename and following asterisk. Remove whitespace between
3278 function name and opening parenthesis.
3279 * archive.h: Likewise.
3280 * arm.cc: Likewise.
3281 * attributes.cc: Likewise.
3282 * attributes.h: Likewise.
3283 * common.cc: Likewise.
3284 * copy-relocs.cc: Likewise.
3285 * dirsearch.h: Likewise.
3286 * dynobj.cc: Likewise.
3287 * ehframe.cc: Likewise.
3288 * ehframe.h: Likewise.
3289 * expression.cc: Likewise.
3290 * fileread.cc: Likewise.
3291 * fileread.h: Likewise.
3292 * gc.h: Likewise.
3293 * gold-threads.cc: Likewise.
3294 * gold.cc: Likewise.
3295 * i386.cc: Likewise.
3296 * icf.h: Likewise.
3297 * incremental-dump.cc: Likewise.
3298 * incremental.cc: Likewise.
3299 * layout.cc: Likewise.
3300 * layout.h: Likewise.
3301 * main.cc: Likewise.
3302 * merge.cc: Likewise.
3303 * merge.h: Likewise.
3304 * object.cc: Likewise.
3305 * object.h: Likewise.
3306 * options.cc: Likewise.
3307 * options.h: Likewise.
3308 * output.cc: Likewise.
3309 * output.h: Likewise.
3310 * plugin.cc: Likewise.
3311 * plugin.h: Likewise.
3312 * powerpc.cc: Likewise.
3313 * reloc.cc: Likewise.
3314 * script-c.h: Likewise.
3315 * script-sections.cc: Likewise.
3316 * script.cc: Likewise.
3317 * stringpool.cc: Likewise.
3318 * symtab.cc: Likewise.
3319 * symtab.h: Likewise.
3320 * target.cc: Likewise.
3321 * timer.cc: Likewise.
3322 * timer.h: Likewise.
3323 * version.cc: Likewise.
3324 * x86_64.cc: Likewise.
3325
3326 2010-08-24 Nick Clifton <nickc@redhat.com>
3327
3328 PR 11899
3329 * layout.cc (segment_precedes): Sort segments by their physical
3330 addresses, if they have been set.
3331
3332 2010-08-23 Cary Coutant <ccoutant@google.com>
3333
3334 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3335 symbols data.
3336 (Lib_group::include_member): Unlock object after deleting its
3337 symbols data.
3338 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3339 the bug fixed here.
3340
3341 2010-08-19 Neil Vachharajani <nvachhar@google.com>
3342 Cary Coutant <ccoutant@google.com>
3343
3344 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3345 constructor, and set_blocker.
3346 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3347 readsyms_blocker_.
3348 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3349 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3350 * testsuite/Makefile.am (start_lib_test): New test case.
3351 * testsuite/Makefile.in: Regenerate.
3352 * testsuite/start_lib_test_main.c: New file.
3353 * testsuite/start_lib_test_1.c: New file.
3354 * testsuite/start_lib_test_2.c: New file.
3355 * testsuite/start_lib_test_3.c: New file.
3356
3357 2010-08-19 Ian Lance Taylor <iant@google.com>
3358
3359 * Makefile.in: Rebuild with automake 1.11.1.
3360 * aclocal.m4: Likewise.
3361 * testsuite/Makefile.in: Likewise.
3362
3363 2010-08-19 Ian Lance Taylor <iant@google.com>
3364
3365 PR 10893
3366 * i386.cc (class Output_data_plt_i386): Update declarations.
3367 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3368 local_ifuncs_ fields.
3369 (Target_i386::do_plt_section_for_global): New function.
3370 (Target_i386::do_plt_section_for_local): New function.
3371 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3372 parameter; change all callers. Initialize global_ifuncs_ and
3373 local_ifuncs_. If doing a static link define __rel_iplt_start and
3374 __rel_iplt_end.
3375 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3376 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3377 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3378 symbols.
3379 (Target_i386::make_plt_section): New function, broken out of
3380 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3381 (Target_i386::make_plt_entry): Call make_plt_section.
3382 (Target_i386::make_local_ifunc_plt_entry): New function.
3383 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3384 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3385 R_386_IRELATIVE to switch.
3386 (Target_i386::Scan::global): Likewise.
3387 (Target_i386::Relocate::relocate): Likewise.
3388 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3389 switch.
3390 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3391 (Target_x86_64::do_plt_section_for_global): New function.
3392 (Target_x86_64::do_plt_section_for_local): New function.
3393 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3394 parameter; change all callers. If doing a static link define
3395 __rela_iplt_start and __rela_iplt_end.
3396 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3397 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3398 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3399 to point to .plt.
3400 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3401 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3402 switch.
3403 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3404 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3405 R_X86_64_IRELATIVE to switch.
3406 (Target_x86_64::Scan::global): Likewise.
3407 (Target_x86_64::Relocate::relocate): Likewise.
3408 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3409 switch.
3410 * target.h (class Target): Add plt_section_for_global and
3411 plt_section_for_local functions. Add do_plt_section_for_global
3412 and do_plt_section_for_local virtual functions.
3413 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3414 clarifying comments.
3415 (Symbol::use_plt_offset): Handle IFUNC symbol.
3416 * object.cc (Sized_relobj::Sized_relobj): Initialize
3417 local_plt_offsets_.
3418 (Sized_relobj::local_has_plt_offset): New function.
3419 (Sized_relobj::local_plt_offset): New function.
3420 (Sized_relobj::set_local_plt_offset): New function.
3421 (Sized_relobj::do_count): Handle IFUNC symbol.
3422 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3423 a bit away from input_shndx_ field. Add set_is_func_symbol and
3424 is_ifunc_symbol functions.
3425 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3426 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3427 local_plt_offsets_ field.
3428 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3429 * output.h (class Output_section_data): Add non-const
3430 output_section function.
3431 (class Output_data_got): Update declarations.
3432 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3433 Add use_plt_offset parameter to global and local constructors.
3434 Change all callers. Change local_sym_index_ field to 31 bits.
3435 Change GSYM_CODE and CONSTANT_CODE accordingly.
3436 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3437 doing a static link don't set sh_link field.
3438 (Output_data_got::Got_entry::write): Use PLT offset if
3439 appropriate.
3440 (Output_data_got::add_global_plt): New function.
3441 (Output_data_got::add_local_plt): New function.
3442 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3443 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3444 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3445 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3446 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3447 IFUNC conditional.
3448 * testsuite/ifunc-sel.h: New file.
3449 * testsuite/ifuncmain1.c: New file.
3450 * testsuite/ifuncmain1vis.c: New file.
3451 * testsuite/ifuncmod1.c: New file.
3452 * testsuite/ifuncdep2.c: New file.
3453 * testsuite/ifuncmain2.c: New file.
3454 * testsuite/ifuncmain3.c: New file.
3455 * testsuite/ifuncmod3.c: New file.
3456 * testsuite/ifuncmain4.c: New file.
3457 * testsuite/ifuncmain5.c: New file.
3458 * testsuite/ifuncmod5.c: New file.
3459 * testsuite/ifuncmain6pie.c: New file.
3460 * testsuite/ifuncmod6.c: New file.
3461 * testsuite/ifuncmain7.c: New file.
3462 * configure, testsuite/Makefile.in: Rebuild.
3463
3464 2010-08-18 Ian Lance Taylor <iant@google.com>
3465
3466 * incremental.cc
3467 (Output_section_incremental_inputs::write_input_files): Add cast
3468 to avoid signed/unsigned comparison warning.
3469 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3470
3471 2010-08-12 Cary Coutant <ccoutant@google.com>
3472
3473 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3474
3475 2010-08-13 Ian Lance Taylor <iant@google.com>
3476
3477 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3478
3479 2010-08-12 Cary Coutant <ccoutant@google.com>
3480 Doug Kwan <dougkwan@google.com>
3481
3482 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3483 defintion overrides non-weak undef, remember that the original undef
3484 is not weak.
3485 * symtab.cc (Symbol_table::sized_write_global): For undef without
3486 an original weak binding, set binding to global in output.
3487 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3488 * testsuite/Makefile.in: Regenerate.
3489 * testsuite/strong_ref_weak_def.sh: New file.
3490 * testsuite/strong_ref_weak_def_1.c: Ditto.
3491 * testsuite/strong_ref_weak_def_2.c: Ditto.
3492
3493 2010-08-12 Cary Coutant <ccoutant@google.com>
3494
3495 * testsuite/incremental_test.sh: Rewrite.
3496 * testsuite/incremental_test_1.c: Rewrite.
3497 * testsuite/incremental_test_2.c: Rewrite.
3498
3499 2010-08-12 Cary Coutant <ccoutant@google.com>
3500
3501 * arm.cc (Target_arm::got_size): Add const.
3502 (Target_arm::got_entry_count): New function.
3503 (Target_arm::plt_entry_count): New function.
3504 (Target_arm::first_plt_entry_offset): New function.
3505 (Target_arm::plt_entry_size): New function.
3506 (Output_data_plt_arm::entry_count): New function.
3507 (Output_data_plt_arm::first_plt_entry_offset): New function.
3508 (Output_data_plt_arm::get_plt_entry_size): New function.
3509 * i386.cc (Target_i386::got_size): Add const.
3510 (Target_i386::got_entry_count): New function.
3511 (Target_i386::plt_entry_count): New function.
3512 (Target_i386::first_plt_entry_offset): New function.
3513 (Target_i386::plt_entry_size): New function.
3514 (Output_data_plt_i386::entry_count): New function.
3515 (Output_data_plt_i386::first_plt_entry_offset): New function.
3516 (Output_data_plt_i386::get_plt_entry_size): New function.
3517 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3518 find_incremental_inputs_sections. Dump incremental_got_plt section.
3519 * incremental.cc: Include target.h.
3520 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3521 parameter. Adjust all callers. Find incremental_got_plt section.
3522 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3523 section.
3524 (Output_section_incremental_inputs::set_final_data_size): Calculate
3525 size of incremental_got_plt section.
3526 (Output_section_incremental_inputs::do_write): Write the
3527 incremental_got_plt section.
3528 (Got_plt_view_info): New struct.
3529 (Local_got_offset_visitor): New class.
3530 (Global_got_offset_visitor): New class.
3531 (Global_symbol_visitor_got_plt): New class.
3532 (Output_section_incremental_inputs::write_got_plt): New function.
3533 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3534 Add parameter. Adjust all callers.
3535 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3536 (Incremental_inputs::got_plt_section): New function.
3537 (Incremental_inputs::got_plt_section_): New data member.
3538 (Incremental_got_plt_reader): New class.
3539 * layout.cc (Layout::create_incremental_info_sections): Add the
3540 incremental_got_plt section.
3541 * object.h (Got_offset_list::get_list): New function.
3542 (Got offset_list::for_all_got_offsets): New function.
3543 (Sized_relobj::local_got_offset_list): New function.
3544 * powerpc.cc (Target_powerpc::got_size): Add const.
3545 (Target_powerpc::got_entry_count): New function.
3546 (Target_powerpc::plt_entry_count): New function.
3547 (Target_powerpc::first_plt_entry_offset): New function.
3548 (Target_powerpc::plt_entry_size): New function.
3549 (Output_data_plt_powerpc::entry_count): New function.
3550 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3551 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3552 * sparc.cc (Target_sparc::got_size): Add const.
3553 (Target_sparc::got_entry_count): New function.
3554 (Target_sparc::plt_entry_count): New function.
3555 (Target_sparc::first_plt_entry_offset): New function.
3556 (Target_sparc::plt_entry_size): New function.
3557 (Output_data_plt_sparc::entry_count): New function.
3558 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3559 (Output_data_plt_sparc::get_plt_entry_size): New function.
3560 * symtab.h (Symbol::got_offset_list): New function.
3561 (Symbol_table::for_all_symbols): New function.
3562 * target.h (Sized_target::got_entry_count): New function.
3563 (Sized_target::plt_entry_count): New function.
3564 (Sized_target::plt_entry_size): New function.
3565 * x86_64.cc (Target_x86_64::got_size): Add const.
3566 (Target_x86_64::got_entry_count): New function.
3567 (Target_x86_64::plt_entry_count): New function.
3568 (Target_x86_64::first_plt_entry_offset): New function.
3569 (Target_x86_64::plt_entry_size): New function.
3570 (Output_data_plt_x86_64::entry_count): New function.
3571 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3572 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3573
3574 2010-08-12 Cary Coutant <ccoutant@google.com>
3575
3576 * archive.cc: Include incremental.h.
3577 (Archive::Archive): Initialize incremental_info_.
3578 (Archive::include_member): Record archive members in incremental info.
3579 (Add_archive_symbols::run): Record begin and end of an archive in
3580 incremental info.
3581 (Lib_group::include_member): Record objects in incremental info.
3582 * archive.h (Incremental_archive_entry): Forward declaration.
3583 (Archive::set_incremental_info): New member function.
3584 (Archive::incremental_info): New member function.
3585 (Archive::Unused_symbol_iterator): New class.
3586 (Archive::unused_symbols_begin): New member function.
3587 (Archive::unused_symbols_end): New member function.
3588 (Archive::incremental_info_): New data member.
3589 * incremental-dump.cc (find_input_containing_global): New function.
3590 (dump_incremental_inputs): Dump new incremental info sections.
3591 * incremental.cc: Include symtab.h.
3592 (Output_section_incremental_inputs): New class.
3593 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3594 new incremental info sections.
3595 (Sized_incremental_binary::do_check_inputs): Likewise.
3596 (Incremental_inputs::report_archive): Remove.
3597 (Incremental_inputs::report_archive_begin): New function.
3598 (Incremental_inputs::report_archive_end): New function.
3599 (Incremental_inputs::report_object): New function.
3600 (Incremental_inputs::finalize_inputs): Remove.
3601 (Incremental_inputs::report_input_section): New function.
3602 (Incremental_inputs::report_script): Rewrite.
3603 (Incremental_inputs::finalize): Do nothing but finalize string table.
3604 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3605 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3606 (Incremental_inputs::create_data_sections): New function.
3607 (Incremental_inputs::relocs_entsize): New function.
3608 (Output_section_incremental_inputs::set_final_data_size): New function.
3609 (Output_section_incremental_inputs::do_write): New function.
3610 (Output_section_incremental_inputs::write_header): New function.
3611 (Output_section_incremental_inputs::write_input_files): New function.
3612 (Output_section_incremental_inputs::write_info_blocks): New function.
3613 (Output_section_incremental_inputs::write_symtab): New function.
3614 * incremental.h (Incremental_script_entry): Forward declaration.
3615 (Incremental_object_entry): Forward declaration.
3616 (Incremental_archive_entry): Forward declaration.
3617 (Incremental_inputs): Forward declaration.
3618 (Incremental_inputs_header_data): Remove.
3619 (Incremental_inputs_header): Remove.
3620 (Incremental_inputs_header_write): Remove.
3621 (Incremental_inputs_entry_data): Remove.
3622 (Incremental_inputs_entry): Remove.
3623 (Incremental_inputs_entry_write): Remove.
3624 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3625 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3626 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3627 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3628 Likewise.
3629 (Incremental_input_entry): New class.
3630 (Incremental_script_entry): New class.
3631 (Incremental_object_entry): New class.
3632 (Incremental_archive_entry): New class.
3633 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3634 (Incremental_inputs::report_inputs): Remove.
3635 (Incremental_inputs::report_archive): Remove.
3636 (Incremental_inputs::report_archive_begin): New function.
3637 (Incremental_inputs::report_archive_end): New function.
3638 (Incremental_inputs::report_object): Change prototype.
3639 (Incremental_inputs::report_input_section): New function.
3640 (Incremental_inputs::report_script): Change prototype.
3641 (Incremental_inputs::get_reloc_count): New function.
3642 (Incremental_inputs::set_reloc_count): New function.
3643 (Incremental_inputs::create_data_sections): New function.
3644 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3645 (Incremental_inputs::inputs_section): New function.
3646 (Incremental_inputs::symtab_section): New function.
3647 (Incremental_inputs::relocs_section): New function.
3648 (Incremental_inputs::get_stringpool): Add const.
3649 (Incremental_inputs::command_line): Add const.
3650 (Incremental_inputs::inputs): Remove.
3651 (Incremental_inputs::command_line_key): New function.
3652 (Incremental_inputs::input_file_count): New function.
3653 (Incremental_inputs::input_files): New function.
3654 (Incremental_inputs::relocs_entsize): New function.
3655 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3656 (Incremental_inputs::finalize_inputs): Remove.
3657 (Incremental_inputs::Input_info): Remove.
3658 (Incremental_inputs::lock_): Remove.
3659 (Incremental_inputs::inputs_): Change type.
3660 (Incremental_inputs::inputs_map_): Remove.
3661 (Incremental_inputs::current_object_entry_): New data member.
3662 (Incremental_inputs::inputs_section_): New data member.
3663 (Incremental_inputs::symtab_section_): New data member.
3664 (Incremental_inputs::relocs_section_): New data member.
3665 (Incremental_inputs::reloc_count_): New data member.
3666 (Incremental_inputs_reader): New class.
3667 (Incremental_symtab_reader): New class.
3668 (Incremental_relocs_reader): New class.
3669 * layout.cc (Layout::finalize): Move finalization of incremental info
3670 and creation of incremental info sections to follow finalization of
3671 symbol table. Set offsets for postprocessing sections.
3672 (Layout::create_incremental_info_sections): Call
3673 Incremental_inputs::create_data_sections. Add incremental symtab
3674 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3675 sections to layout after input sections.
3676 * layout.h (struct Timespec): Forward declaration.
3677 (Layout::incremental_inputs): Add const.
3678 (Layout::create_incremental_info_sections): Add parameter.
3679 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3680 * object.cc: Include incremental.h.
3681 (Relobj::finalize_incremental_relocs): New function.
3682 (Sized_relobj::do_layout): Record input sections in incremental info.
3683 * object.h (Object::output_section): New function.
3684 (Object::output_section_offset): Moved from Relobj.
3685 (Object::get_incremental_reloc_base): New function.
3686 (Object::get_incremental_reloc_count): New function.
3687 (Object::do_output_section): New function.
3688 (Object::do_output_section_offset): Moved from Relobj.
3689 (Object::do_get_incremental_reloc_base): New function.
3690 (Object::do_get_incremental_reloc_count): New function.
3691 (Object::Object): Initialize new data members.
3692 (Relobj::output_section): Renamed do_output_section and moved to
3693 protected.
3694 (Relobj::output_section_offset): Moved to Object.
3695 (Relobj::do_get_incremental_reloc_base): New function.
3696 (Relobj::do_get_incremental_reloc_count): New function.
3697 (Relobj::allocate_incremental_reloc_counts): New function.
3698 (Relobj::count_incremental_reloc): New function.
3699 (Relobj::finalize_incremental_relocs): New function.
3700 (Relobj::next_incremental_reloc_index): New function.
3701 (Relobj::reloc_counts_): New data member.
3702 (Relobj::reloc_bases_): New data member.
3703 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3704 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3705 (Sized_relobj::incremental_relocs_scan): New function.
3706 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3707 (Sized_relobj::incremental_relocs_write): New function.
3708 (Sized_relobj::incremental_relocs_write_reltype): New function.
3709 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3710 incremental link.
3711 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3712 archives and object files elsewhere.
3713 (Add_symbols::run): Report object files here.
3714 (Finish_group::run): Report end of archive at end of group.
3715 * reloc.cc: Include layout.h, incremental.h.
3716 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3717 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3718 (Sized_relobj::incremental_relocs_scan): New function.
3719 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3720 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3721 (Sized_relobj::incremental_relocs_write): New function.
3722 (Sized_relobj::incremental_relocs_write_reltype): New function.
3723 * script.cc (read_input_script): Rewrite test for incremental link.
3724 Change call to Incremental_inputs::report_script.
3725 * symtab.h (Symbol_table::first_global_index): New function.
3726 (Symbol_table::output_count): New function.
3727
3728 2010-08-12 Doug Kwan <dougkwan@google.com>
3729
3730 * arm.cc (Target_arm::merge_object_attributes): Check command line
3731 options --no-wchar-size-warning and --no-enum-size-warning.
3732 * options.h (General_options): Add ld-compatible options
3733 --no-enum-size-warning and --no-wchar-size-warning.
3734
3735 2010-08-04 Ian Lance Taylor <iant@google.com>
3736
3737 * x86_64.cc (Target_x86_64::Scan::local): Use
3738 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3739 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3740 (Target_x86_64::Scan::global): Likewise.
3741 (Target_x86_64::Relocate::relocate): Likewise.
3742 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3743 Likewise.
3744
3745 2010-08-03 Cary Coutant <ccoutant@google.com>
3746
3747 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3748 to reserve space in merged_strings vector. Keep total input size
3749 for stats.
3750 (Output_merge_string::do_print_merge_stats): Print total input size.
3751 * merge.h (Output_merge_string): Add input_size_ field.
3752 * stringpool.cc (Stringpool_template::string_length): Move
3753 implementations out of Stringpool_template class and place in
3754 stringpool.h.
3755 * stringpool.h (string_length): Move out of Stringpool_template.
3756
3757 2010-08-03 Ian Lance Taylor <iant@google.com>
3758
3759 PR 11712
3760 * layout.cc (relaxation_loop_body): If address of load segment is
3761 set, adjust address to include headers if possible.
3762
3763 2010-08-03 Ian Lance Taylor <iant@google.com>
3764
3765 * version.cc (version_string): Bump to 1.10.
3766
3767 2010-08-03 Ian Lance Taylor <iant@google.com>
3768
3769 PR 11805
3770 * layout.h (enum Output_section_order): Define.
3771 (class Layout): Update declarations.
3772 * layout.cc (Layout::get_output_section): Add order parameter.
3773 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3774 is_first_non_relro parameters. Change all callers.
3775 (Layout::choose_output_section): Likewise.
3776 (Layout::add_output_section_data): Likewise.
3777 (Layout::make_output_section): Likewise. Set order.
3778 (Layout::default_section_order): New function.
3779 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3780 * output.cc (Output_section::Output_section): Initialize order_.
3781 Don't initialize deleted fields.
3782 (Output_segment::Output_segment): Don't initialize deleted
3783 fields.
3784 (Output_segment::add_output_section_to_load): New function
3785 replacing add_output_section. Change all callers to call this or
3786 add_output_section_to_nonload.
3787 (Output_segment::add_output_section_to_nonload): New function.
3788 (Output_segment::remove_output_section): Rewrite.
3789 (Output_segment::add_initial_output_data): Likewise.
3790 (Output_segment::has_any_data_sections): Likewise.
3791 (Output_segment::is_first_section_relro): Likewise.
3792 (Output_segment::maximum_alignment): Likewise.
3793 (Output_segment::has_dynamic_reloc): New function replacing
3794 dynamic_reloc_count. Change all callers.
3795 (Output_segment::has_dynamic_reloc_list): New function replacing
3796 dynamic_reloc_count_list. Change all callers.
3797 (Output_segment::set_section_addresses): Rewrite.
3798 (Output_segment::set_offset): Rewrite.
3799 (Output_segment::find_first_and_last_list): Remove.
3800 (Output_segment::set_tls_offsets): Rewrite.
3801 (Output_segment::first_section_load_address): Likewise.
3802 (Output_segment::output_section_count): Likewise.
3803 (Output_segment::section_with_lowest_load_address): Likewise.
3804 (Output_segment::write_section_headers): Likewise.
3805 (Output_segment::print_sections_to_map): Likewise.
3806 * output.h (class Output_data): Remove dynamic_reloc_count_
3807 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3808 (Output_data::add_dynamic_reloc): Rewrite.
3809 (Output_data::has_dynamic_reloc): New function.
3810 (Output_data::dynamic_reloc_count): Remove.
3811 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3812 is_last_relro_, is_first_non_relro_, is_interp_,
3813 is_dynamic_linker_section_ fields. Add order and set_order
3814 functions. Remove is_relro_local, set_is_relro_local,
3815 is_last_relro, set_is_last_relro, is_first_non_relro,
3816 set_is_first_non_relro functions, is_interp, set_is_interp,
3817 is_dynamic_linker_section, and set_is_dynamic_linker_section
3818 functions.
3819 (class Output_segment): Change Output_data_list from std::list to
3820 std:;vector. Add output_lists_ field. Remove output_data_ and
3821 output_bss_ fields. Update declarations.
3822
3823 2010-08-02 Ian Lance Taylor <iant@google.com>
3824
3825 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3826 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3827 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3828
3829 2010-08-02 Ian Lance Taylor <iant@google.com>
3830
3831 PR 11855
3832 * script.cc (Script_options::Script_options): Initialize
3833 symbol_definitions_ and symbol_references_.
3834 (Script_options::add_symbol_assignment): Update
3835 symbol_definitions_ and symbol_references_.
3836 (Script_options::add_symbol_reference): New function.
3837 (script_symbol): New function.
3838 * script.h (class Script_options): Add symbol_definitions_ and
3839 symbol_references_ fields.
3840 (Script_options::referenced_const_iterator): New type.
3841 (Script_options::referenced_begin): New function.
3842 (Script_options::referenced_end): New function.
3843 (Script_options::is_referenced): New function.
3844 (Script_options::any_unreferenced): New function.
3845 * script-c.h (script_symbol): Declare.
3846 * yyscript.y (exp): Call script_symbol.
3847 * symtab.cc: Include "script.h".
3848 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3849 Change all callers. Check symbols referenced by scripts.
3850 (Symbol_table::add_undefined_symbols_from_command_line): Add
3851 layout parameter. Change all callers.
3852 (Symbol_table::do_add_undefined_symbols_from_command_line):
3853 Likewise. Break out loop body. Check symbols referenced by
3854 scripts.
3855 (Symbol_table::add_undefined_symbol_from_command_line): New
3856 function broken out of
3857 do_add_undefined_symbols_from_command_line.
3858 * symtab.h (class Symbol_table): Update declarations.
3859 * archive.cc: Include "layout.h".
3860 (Archive::should_include_member): Add layout parameter. Change
3861 all callers. Check for symbol mentioned in expression.
3862 * archive.h (class Archive): Update declaration.
3863 * object.cc (Sized_relobj::do_should_include_member): Add layout
3864 parameter.
3865 * object.h (Object::should_include_member): Add layout parameter.
3866 Change all callers.
3867 (Object::do_should_include_member): Add layout parameter.
3868 (class Sized_relobj): Update declaration.
3869 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3870 parameter.
3871 * dynobj.h (class Sized_dynobj): Update declaration.
3872 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3873 layout parameter.
3874 * plugin.h (class Sized_pluginobj): Update declaration.
3875
3876 2010-08-02 Ian Lance Taylor <iant@google.com>
3877
3878 PR 11866
3879 * output.cc (Output_segment::set_offset): Search for the first and
3880 last sections rather than assuming that the list is in order.
3881 (Output_segment::find_first_and_last_list): New function.
3882 * output.h (class Output_segment): Update declarations.
3883 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3884 (relro_strip_test_SOURCES): New variable.
3885 (relro_strip_test_DEPENDENCIES): New variable.
3886 (relro_strip_test_LDFLAGS): New variable.
3887 (relro_strip_test_LDADD): New variable.
3888 (relro_strip_test.so): New target.
3889
3890 2010-08-02 Ian Lance Taylor <iant@google.com>
3891
3892 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3893 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3894 (Target_i386::got_tlsdesc_section): New function.
3895 (Target_i386::got_section): Create space for GOT entries for
3896 TLSDESC relocations.
3897 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3898 R_386_TLS_GOTDESC.
3899 (Target_i386::Scan::global): Likewise.
3900 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3901 using TLSDESC GOT.
3902 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3903 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3904 (Target_x86_64::got_tlsdesc_section): New function.
3905 (Target_x86_64::got_section): Create space for GOT entries for
3906 TLSDESC relocations.
3907 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3908 R_386_TLS_GOTDESC.
3909 (Target_x86_64::Scan::global): Likewise.
3910 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3911 using TLSDESC GOT.
3912
3913 2010-08-02 Ian Lance Taylor <iant@google.com>
3914
3915 * testsuite/final_layout.sh: Use dc to convert from hex to
3916 decimal.
3917
3918 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3919
3920 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3921 paramter to the call to gold::gc_process_relocs.
3922 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3923 paramter to the call to gold::gc_process_relocs.
3924 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3925 parameter to the call to gold::gc_process_relocs.
3926 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3927 template parameter to the call to gold::gc_process_relocs.
3928 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3929 paramter to the call to gold::gc_process_relocs.
3930 * gc.h (get_embedded_addend_size): New function.
3931 (gc_process_relocs): Save the size of the reloc for use by ICF.
3932 * icf.cc (get_section_contents): Get the addend from the text section
3933 for SHT_REL relocation sections.
3934 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3935 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3936 * int_encoding.h (read_from_pointer): New overloaded function.
3937 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3938 * testsuite/icf_sht_rel_addend_test.sh: New file.
3939 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3940 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3941
3942 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3943
3944 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3945 * Makefile.in: Regenerate.
3946 * testsuite/Makefile.in: Regenerate.
3947
3948 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3949
3950 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3951 * gold/testsuite/debug_msg.cc: Likewise.
3952 * gold/testsuite/odr_violation1.cc
3953 * gold/testsuite/odr_violation2.cc
3954
3955 2010-07-21 Cary Coutant <ccoutant@google.com>
3956
3957 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3958 string, and length fields.
3959 (Output_merge_string::Merged_strings_list): New type.
3960 (Output_merge_string::Merged_strings_lists): New typedef.
3961 (Output_merge_string): Replace merged_strings_ with
3962 merged_strings_lists_.
3963 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3964 Merged_strings_list per input object and section. Don't store pointer
3965 to the string. Don't store length with each merged string entry.
3966 (Output_merge_string::finalize_merged_data): Loop over list of merged
3967 strings lists. Recompute length of each merged string.
3968
3969 2010-07-15 Cary Coutant <ccoutant@google.com>
3970
3971 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3972 here.
3973
3974 2010-07-14 Ian Lance Taylor <iant@google.com>
3975
3976 * descriptors.cc (Descriptors::open): Report correct name in error
3977 message.
3978
3979 2010-07-13 Doug Kwan <dougkwan@google.com>
3980
3981 * arm.cc (Arm_input_section::Arm_input_section): For a
3982 SHT_ARM_EXIDX section, always keeps the input sections.
3983 (Arm_input_section::set_exidx_section_link): New method.
3984 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3985 has_errors_ to false.
3986 (Arm_exidx_input_section::has_errors,
3987 Arm_exidx_input_section::set_has_errors): New methods.
3988 (Arm_exidx_input_section::has_errors_): New data member.
3989 (Arm_relobj::get_exidx_shndx_list): New method.
3990 (Arm_output_section::append_text_sections_to_list): Do not skip
3991 section without SHF_EXECINSTR.
3992 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3993 errors.
3994 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3995 section header. Make error messages more verbose. Check for
3996 a non-executable section linked to an EXIDX section.
3997 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3998 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3999 check that there is no deferred EXIDX section if we exit early.
4000 Instead of not making an EXIDX section in case of an error, make one
4001 and set the has_errors flag of it.
4002 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4003 in a relocatable link.
4004 (Target_arm::do_relax): Look for the EXIDX output section instead of
4005 assuming that it is called .ARM.exidx.
4006 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4007 section list. Do not check for SHF_EXECINSTR section flags but
4008 skip any input section with errors.
4009 * output.cc (Output_section::Output_section): Initialize
4010 always_keeps_input_sections_ to false.
4011 (Output_section::add_input_section): Check for
4012 always_keeps_input_sections_.
4013 * output.h (Output_section::always_keeps_input_sections,
4014 Output_section::set_always_keeps_input_sections): New methods.
4015 (Output_section::always_keeps_input_sections): New data member.
4016
4017 2010-07-13 Rafael Espindola <espindola@google.com>
4018
4019 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4020 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4021
4022 2010-07-13 Philip Herron <herron.philip@googlemail.com>
4023 Ian Lance Taylor <iant@google.com>
4024
4025 * output.h (Output_section_lookup_maps::add_merge_section):
4026 Correct check of whether value was inserted.
4027 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4028 (Output_section_lookup_maps::add_relaxed_input_section):
4029 Likewise.
4030 * arm.cc (Target_arm::got_section): Remove used local os.
4031 * i386.cc (Target_i386::got_section): Likewise.
4032 * x86_64.cc (Target_x86_64::got_section): Likewise.
4033 * sparc.cc (Target_sparc::got_section): Likewise.
4034 (Target_sparc::relocate): Remove unused local have_got_offset.
4035 * powerpc.cc (Target_powerpc::relocate): Likewise.
4036
4037 2010-07-13 Ian Lance Taylor <iant@google.com>
4038
4039 * compressed_output.cc (zlib_decompress): Fix signature in
4040 !HAVE_ZLIB_H case.
4041
4042 * archive.cc (Archive::include_member): Unlock an external member
4043 of a thin archive. Don't bother to delete an object we know is
4044 NULL.
4045
4046 2010-07-12 Cary Coutant <ccoutant@google.com>
4047
4048 * compressed_output.cc (zlib_decompress): New function.
4049 (get_uncompressed_size): New function.
4050 (decompress_input_section): New function.
4051 * compressed_output.h (get_uncompressed_size): New function.
4052 (decompress_input_section): New function.
4053 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4054 Handle compressed debug sections.
4055 * layout.cc (is_compressed_debug_section): New function.
4056 (Layout::output_section_name): Map compressed section names to
4057 canonical names.
4058 * layout.h (is_compressed_debug_section): New function.
4059 (is_debug_info_section): Recognize compressed debug sections.
4060 * merge.cc: Include compressed_output.h.
4061 (Output_merge_data::do_add_input_section): Handle compressed
4062 debug sections.
4063 (Output_merge_string::do_add_input_section): Handle compressed
4064 debug sections.
4065 * object.cc: Include compressed_output.h.
4066 (Sized_relobj::Sized_relobj): Initialize new data members.
4067 (build_compressed_section_map): New function.
4068 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4069 * object.h (Object::section_is_compressed): New method.
4070 (Object::do_section_is_compressed): New method.
4071 (Sized_relobj::Compressed_section_map): New type.
4072 (Sized_relobj::do_section_is_compressed): New method.
4073 (Sized_relobj::compressed_sections_): New data member.
4074 * output.cc (Output_section::add_input_section): Handle compressed
4075 debug sections.
4076 * reloc.cc: Include compressed_output.h.
4077 (Sized_relobj::write_sections): Handle compressed debug sections.
4078
4079 2010-07-08 Cary Coutant <ccoutant@google.com>
4080
4081 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4082 weak when resolving to a dynamic def.
4083 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4084 for weak undef/dynamic def cases. Adjust callers.
4085 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4086 undef_binding_weak_.
4087 (Symbol_table::sized_write_globals): Adjust symbol binding.
4088 (Symbol_table::sized_write_symbol): Add binding parameter.
4089 * symtab.h (Symbol::set_undef_binding): New method.
4090 (Symbol::is_undef_binding_weak): New method.
4091 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4092 (Symbol_table::should_override): Add new parameter.
4093 (Symbol_table::sized_write_symbol): Add new parameter.
4094
4095 * testsuite/weak_undef_file1.cc: Add new test case.
4096 * testsuite/weak_undef_file2.cc: Fix header comment.
4097 * testsuite/weak_undef_test.cc: Add new test case.
4098
4099 2010-06-29 Doug Kwan <dougkwan@google.com>
4100
4101 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4102 Initialize USE_SYMBOL_.
4103 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4104 definition.
4105 (Arm_reloc_property::uses_symbol_): New data member declaration.
4106 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4107 uses symbol value and symbol is undefined but not weakly undefined.
4108
4109 2010-06-28 Rafael Espindola <espindola@google.com>
4110
4111 * plugin.cc (Plugin::load): Use dlerror.
4112
4113 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4114
4115 * symtab.cc (detect_odr_violations): When reporting an ODR
4116 violation, report an object where the symbol is defined.
4117
4118 2010-06-25 Doug Kwan <dougkwan@google.com>
4119
4120 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4121 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4122 definition.
4123 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4124 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4125 target hook to detect function points.
4126 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4127 * icf.h (Icf::check_section_for_function_pointers): Change type of
4128 parameter SECTION_NAME to const reference to std::string. Use
4129 target hook to determine if section may have unsafe pointers.
4130 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4131 method definition.
4132
4133 2010-06-21 Rafael Espindola <espindola@google.com>
4134
4135 * fileread.cc (Input_file::find_fie): New
4136 (Input_file::open): Use Input_file::find_fie.
4137 * fileread.h (Input_file::find_fie): New
4138 * plugin.cc (set_extra_library_path): New.
4139 (Plugin::load): Add set_extra_library_path to the transfer vector.
4140 (Plugin_manager::set_extra_library_path): New.
4141 (Plugin_manager::add_input_file): Use the extra search path if set.
4142 (set_extra_library_path(): New.
4143 * plugin.h (Plugin_manager): Add set_extra_library_path and
4144 extra_search_path_.
4145
4146 2010-06-19 Cary Coutant <ccoutant@google.com>
4147
4148 * layout.cc (gdb_sections): Add .debug_types.
4149 (lines_only_debug_sections): Likewise.
4150
4151 2010-06-18 Rafael Espindola <espindola@google.com>
4152
4153 * plugin.cc (add_input_file,add_input_library)
4154 (Plugin_manager::add_input_file): Make filename arguments const.
4155 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4156 const.
4157
4158 2010-06-16 Doug Kwan <dougkwan@google.com>
4159
4160 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4161 .ARM.attributes section if we have not merged any input
4162 attributes sections.
4163
4164 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4165
4166 * arm.cc: Allow combining objects with no EABI version
4167 information.
4168
4169 2010-06-15 Rafael Espindola <espindola@google.com>
4170
4171 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4172
4173 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4174
4175 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4176 (struct iovec): Correct !HAVE_READV definition.
4177
4178 2010-06-10 Cary Coutant <ccoutant@google.com>
4179
4180 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4181 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4182 reloc sections.
4183 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4184
4185 PR 11683
4186 * symtab.h (Symbol::is_placeholder): New member function.
4187 * target-reloc.h (relocate_section): Check for placeholder symbols.
4188
4189 * testsuite/Makefile.am (plugin_test_8): New test.
4190 (plugin_test_9): New test.
4191 * testsuite/Makefile.in: Regenerate.
4192
4193 2010-06-09 Nick Clifton <nickc@redhat.com>
4194
4195 * yyscript.y (input_list_element): Allow strings prefixed with
4196 the '-' character. Treat these as libraries.
4197 * script.cc (script_add_library): New function. Adds a library
4198 specified by "-l<name>" found in an input script.
4199 * script-c.h: Add prototype for script_add_library.
4200
4201 2010-06-07 Doug Kwan <dougkwan@google.com>
4202
4203 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4204 Restrict stub-group size to be within long conditional branch
4205 range when working around cortex-A8 erratum.
4206
4207 2010-06-07 Damien Diederen <dd@crosstwine.com>
4208
4209 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4210 #ifdef typo.
4211
4212 2010-06-03 Sriraman Tallam <tmsriram@google.com>
4213
4214 PR gold/11658
4215 * output.cc
4216 (Output_section::Input_section_sort_entry::compare_section_ordering):
4217 Change to return non-zero correctly.
4218 (Output_section::Input_section_sort_section_order_index_compare
4219 ::operator()): Change to fix ambiguity in comparisons.
4220
4221 2010-06-01 Sriraman Tallam <tmsriram@google.com>
4222
4223 * gold.h (is_wildcard_string): New function.
4224 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4225 (Layout::layout_eh_frame): Ditto.
4226 (Layout::find_section_order_index): New method.
4227 (Layout::read_layout_from_file): New method.
4228 * layout.h (Layout::find_section_order_index): New method.
4229 (Layout::read_layout_from_file): New method.
4230 (Layout::input_section_position_): New private member.
4231 (Layout::input_section_glob_): New private member.
4232 * main.cc (main): Call read_layout_from_file here.
4233 * options.h (--section-ordering-file): New option.
4234 * output.cc (Output_section::input_section_order_specified_): New
4235 member.
4236 (Output_section::Output_section): Initialize new member.
4237 (Output_section::add_input_section): Add new parameter.
4238 Keep input sections when --section-ordering-file is used.
4239 (Output_section::set_final_data_size): Sort input sections when
4240 section ordering file is specified.
4241 (Output_section::Input_section_sort_entry): Add new parameter.
4242 Check sorting type.
4243 (Output_section::Input_section_sort_entry::compare_section_ordering):
4244 New method.
4245 (Output_section::Input_section_sort_compare::operator()): Change to
4246 consider section_order_index.
4247 (Output_section::Input_section_sort_init_fini_compare::operator()):
4248 Change to consider section_order_index.
4249 (Output_section::Input_section_sort_section_order_index_compare
4250 ::operator()): New method.
4251 (Output_section::sort_attached_input_sections): Change to sort
4252 according to section order when specified.
4253 (Output_section::add_input_section<32, true>): Add new parameter.
4254 (Output_section::add_input_section<64, true>): Add new parameter.
4255 (Output_section::add_input_section<32, false>): Add new parameter.
4256 (Output_section::add_input_section<64, false>): Add new parameter.
4257 * output.h (Output_section::add_input_section): Add new parameter.
4258 (Output_section::input_section_order_specified): New
4259 method.
4260 (Output_section::set_input_section_order_specified): New method.
4261 (Input_section::Input_section): Initialize section_order_index_.
4262 (Input_section::section_order_index): New method.
4263 (Input_section::set_section_order_index): New method.
4264 (Input_section::section_order_index_): New member.
4265 (Input_section::Input_section_sort_section_order_index_compare): New
4266 struct.
4267 (Output_section::input_section_order_specified_): New member.
4268 * script-sections.cc (is_wildcard_string): Delete and move modified
4269 method to gold.h.
4270 (Output_section_element_input::Output_section_element_input): Modify
4271 call to is_wildcard_string.
4272 (Output_section_element_input::Input_section_pattern
4273 ::Input_section_pattern): Ditto.
4274 (Output_section_element_input::Output_section_element_input): Ditto.
4275 * testsuite/Makefile.am (final_layout): New test case.
4276 * testsuite/Makefile.in: Regenerate.
4277 * testsuite/final_layout.cc: New file.
4278 * testsuite/final_layout.sh: New file.
4279
4280 2010-06-01 Rafael Espindola <espindola@google.com>
4281
4282 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4283
4284 2010-06-01 Rafael Espindola <espindola@google.com>
4285
4286 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4287 visibility of symbols.
4288
4289 2010-05-27 Doug Kwan <dougkwan@google.com>
4290
4291 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4292 from start of output section instead of address for a local symbol
4293 in a merged or relaxed section when doing a relocatable link.
4294
4295 2010-05-26 Rafael Espindola <espindola@google.com>
4296
4297 PR 11604
4298 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4299 adding sections the garbage collector removed.
4300 * gold/testsuite/Makefile.am: Add test.
4301 * gold/testsuite/Makefile.in: Regenerate.
4302 * gold/testsuite/plugin_test_7.sh: New.
4303 * gold/testsuite/plugin_test_7_1.c: New.
4304 * gold/testsuite/plugin_test_7_2.c: New.
4305
4306 2010-05-26 Rafael Espindola <espindola@google.com>
4307
4308 * script-sections.cc (Output_section_definition::set_section_addresses):
4309 Check for --section-start.
4310
4311 2010-05-26 Doug Kwan <dougkwan@google.com>
4312
4313 * arm.cc (Arm_scan_relocatable_relocs): New class.
4314 (Target_arm::relocate_special_relocatable): New method.
4315 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4316 (Arm_relocate_functions::thumb_branch_common): Same.
4317 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4318 instead of Default_scan_relocatable_relocs.
4319 * target-reloc.h (relocate_for_relocatable): Let target handle
4320 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4321 * target.h (Sized_target::relocate_special_relocatable): New method.
4322
4323 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4324
4325 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4326
4327 2010-05-23 Doug Kwan <dougkwan@google.com>
4328
4329 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4330 instead of a cast.
4331 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4332 with a direct branch, not a conditional branch, to a stub.
4333 * merge.cc (Output_merge_base::record_input_section): New method
4334 defintion.
4335 (Output_merge_data::do_add_input_section): Record input section if
4336 keeps-input-sections flag is set.
4337 (Output_merge_string::do_add_input_section): Ditto.
4338 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4339 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4340 INPUT_SECTIONS_.
4341 (Output_merge_base::keeps_input_sections,
4342 Output_merge_base::set_keeps_input_sections,
4343 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4344 method definitions.
4345 (Output_merge_base::Input_sections): New type declaration.
4346 (Output_merge_base::input_sections_begin,
4347 Output_merge_base::input_sections_end,
4348 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4349 (Output_merge_base::bool keeps_input_sections_,
4350 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4351 Output_merge_base::input_sections_): New data members.
4352 (Output_merge_data::do_set_keeps_input_sections): New method
4353 defintion.
4354 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4355 * output.cc (Output_section::Input_section::relobj): Move method
4356 defintion from class declaration to here and handle merge sections.
4357 (Output_section::Input_section::shndx): Ditto.
4358 (Output_section::Output_section): Remove initializations of removed
4359 data members and initialize new data member LOOKUP_MAPS_.
4360 (Output_section::add_input_section): Set keeps-input-sections flag
4361 for a newly created merge output section as appropriate. Adjust code
4362 to use Output_section_lookup_maps class.
4363 (Output_section::add_relaxed_input_section): Adjst code for lookup
4364 maps code refactoring.
4365 (Output_section::add_merge_input_section): Add a new parameter
4366 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4367 class. If adding input section to a newly created merge output
4368 section fails, remove the new merge section.
4369 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
4370 Adjust code for use of the Output_section_lookup_maps class.
4371 (Output_section::find_merge_section): Ditto.
4372 (Output_section::build_lookup_maps): New method defintion.
4373 (Output_section::find_relaxed_input_section): Adjust code to use
4374 Output_section_lookup_maps class.
4375 (Output_section::get_input_sections): Export merge sections. Adjust
4376 code to use Output_section_lookup_maps class.
4377 (Output_section:::add_script_input_section): Adjust code to use
4378 Output_section_lookup_maps class. Update lookup maps for merge
4379 sections also.
4380 (Output_section::discard_states): Use Output_section_lookup_maps.
4381 (Output_section::restore_states): Same.
4382 * output.h (Merge_section_properties): Move class defintion out of
4383 Output_section.
4384 (Output_section_lookup_maps): New class.
4385 (Output_section::Input_section::is_merge_section): New method
4386 defintion.
4387 (Output_section::Input_section::relobj): Move defintion out of class
4388 defintion. Declare method only.
4389 (Output_section::Input_section::shndx): Ditto.
4390 (Output_section::Input_section::output_merge_base): New method defintion.
4391 (Output_section::Input_section::u2_.pomb): New union field.
4392 (Output_section::Merge_section_by_properties_map,
4393 Output_section::Output_section_data_by_input_section_map,
4394 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4395 Remove types.
4396 (Output_section::add_merge_input_section): Add new parameter
4397 KEEPS_INPUT_SECTIONS.
4398 (Output_section::build_lookup_maps): New method declaration.
4399 (Output_section::merge_section_map_,
4400 Output_section::merge_section_by_properties_map_,
4401 Output_section::relaxed_input_section_map_,
4402 Output_section::is_relaxed_input_section_map_valid_): Remove data
4403 members.
4404 (Output_section::lookup_maps_): New data member.
4405
4406 2010-05-21 Doug Kwan <dougkwan@google.com>
4407
4408 PR gold/11619
4409 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4410 avoid a compilation error.
4411
4412 2010-05-19 Rafael Espindola <espindola@google.com>
4413
4414 * script-sections.cc (Output_section_definition::allocate_to_segment):
4415 Update the phdrs_list even when the output section is NULL.
4416 * testsuite/Makefile.am: Add test.
4417 * testsuite/Makefile.in: Regenerate.
4418 * testsuite/script_test_9.cc: New.
4419 * testsuite/script_test_9.sh: New.
4420 * testsuite/script_test_9.t: New.
4421
4422 2010-05-19 Doug Kwan <dougkwan@google.com>
4423
4424 * arm.cc (Arm_input_section::original_size): New method.
4425 (Arm_input_section::do_addralign): Add a cast.
4426 (Arm_input_section::do_output_offset): Remove static cast.
4427 (Arm_input_section::original_addralign,
4428 Arm_input_section::original_size_): Change type to uint32_t.
4429 (Arm_input_section::init): Add safe casts for section alignment
4430 and size.
4431 (Arm_input_section::set_final_data_size): Do not set address and
4432 offset of stub table.
4433 (Arm_output_section::fix_exidx_coverage): Change use of of
4434 Output_section::Simple_input_section to that of
4435 Output_section::Input_section.
4436 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4437 except for the first pass.
4438 * output.cc (Output_section::get_input_sections): Change type of
4439 input_sections to std::list<Input_section>.
4440 (Output_section::add_script_input_section): Rename from
4441 Output_section::add_simple_input_section. Change type of SIS
4442 parameter from Simple_input_section to Input_section.
4443 * output.h (Output_section::Simple_input_section): Remove class.
4444 (Output_section::Input_section): Change class visibility to public.
4445 (Output_section::Input_section::addralign): Use stored alignments
4446 for special input sections if set.
4447 (Output_section::Input_section::set_addralign): New method.
4448 (Output_section::get_input_sections): Change parameter type from
4449 list of Simple_input_section to list of Input_section.
4450 (Output_section::add_script_input_section): Rename from
4451 Output_section::add_simple_input_section. Change first parameter's
4452 type from Simple_input_section to Input_section and remove the
4453 second and third parameters.
4454 * script-sections.cc (Input_section::Input_section_list): Change
4455 type to list of Output_section::Input_section/
4456 (Input_section_info::Input_section_info): Change parameter type of
4457 INPUT_SECTION to Output_section::Input_section.
4458 (Input_section_info::input_section): Change return type.
4459 (Input_section_info::input_section_): Change type to
4460 Output_section::Input_section.
4461 (Output_section_element_input::set_section_addresses): Adjust code
4462 to use Output_section::Input_section instead of
4463 Output_section::Simple_input_section. Adjust code for renaming
4464 of Output_section::add_simple_input_section.
4465 (Orphan_output_section::set_section_addresses): Ditto.
4466
4467 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4468
4469 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4470 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4471
4472 2010-05-18 Rafael Espindola <espindola@google.com>
4473
4474 * options.cc (General_options::finalize): Handle -nostdlib.
4475 * options.h (nostdlib): New option.
4476 * script.cc (script_add_search_dir): Handle -nostdlib.
4477
4478 2010-05-12 Doug Kwan <dougkwan@google.com>
4479
4480 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4481 attributes section only if there no attributes section after merging.
4482 (Target_arm::merge_object_attributes): Move value of
4483 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4484 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4485 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4486 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4487 and arm_attr_merge_7.stdout.
4488 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4489 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4490 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4491 arm_attr_merge_7b.o): New rules.
4492 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4493 arm_attr_merge_7
4494 * testsuite/Makefile.in: Regenerate.
4495 * testsuite/arm_attr_merge.sh: New file.
4496 * testsuite/arm_attr_merge_[67][ab].s: Same.
4497
4498 2010-05-05 Nick Clifton <nickc@redhat.com>
4499
4500 * po/es.po: Updated Spanish translation.
4501
4502 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4503
4504 * Makefile.am (install-exec-local): Properly install gold as
4505 default cross linker.
4506 * Makefile.in: Regenerated.
4507
4508 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4509 Nick Clifton <nickc@redhat.com>
4510
4511 * configure.ac (install_as_default): Define and set to false
4512 unless --enable-gold or --enable-gold=both/gold has been
4513 specified.
4514 * configure: Regenerate.
4515
4516 * Makefile.am (install-exec-local): Install the executable as
4517 'ld.gold'. If install_as_default is true then also install it as
4518 'ld'.
4519 * Makefile.in: Regenerated.
4520
4521 2010-04-24 Ian Lance Taylor <iant@google.com>
4522
4523 * layout.cc (Layout::layout_reloc): In relocatable link don't
4524 combine reloc sections for grouped sections.
4525
4526 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4527
4528 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4529 sections that are not ordinary to icf.
4530 * icf.cc (get_section_contents): Handle relocation pointing to section
4531 with no object or shndx information.
4532 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4533 * testsuite/Makefile.in: Regenerate.
4534 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4535 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4536
4537 2010-04-22 Ian Lance Taylor <iant@google.com>
4538
4539 * expression.cc (Expression::Expression_eval_info): Add
4540 result_alignment_pointer field.
4541 (Expression::eval_with_dot): Add result_alignment_pointer
4542 parameter. Change all callers.
4543 (Expression::eval_maybe_dot): Likewise.
4544 (class Binary_expression): Add alignment_pointer parameter to
4545 left_value and right_value. Change all callers.
4546 (BINARY_EXPRESSION): Set result alignment.
4547 (class Trinary_expression): Add alignment_pointer parameter to
4548 arg2_value and arg3_value. Change all callers.
4549 (Trinary_cond::value): Set result alignment.
4550 (Max_expression::value, Min_expression::value): Likewise.
4551 (Align_expression::value): Likewise.
4552 * script-sections.cc (class Sections_element): Add dot_alignment
4553 parameter to set_section_addresses virtual function. Update
4554 instantiations.
4555 (class Output_section_element): Likewise.
4556 (Script_sections::create_segments): Add dot_alignment parameter.
4557 Change all callers.
4558 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4559 (Script_sections::set_phdrs_clause_addresses): Likewise.
4560 * script-sections.h: Update declarations.
4561 * script.h: Update declarations.
4562 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4563 min_p_align.
4564 * testsuite/script_test_3.t: Set large alignment.
4565 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4566 segment has expected alignment.
4567
4568 2010-04-22 Nick Clifton <nickc@redhat.com>
4569
4570 * po/gold.pot: Updated by the Translation project.
4571 * po/vi.po: Updated Vietnamese translation.
4572
4573 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4574
4575 * testsuite/Makefile.am (check_PROGRAMS): Add
4576 icf_virtual_function_folding_test.
4577 * testsuite/Makefile.in: Regenerated.
4578
4579 2010-04-15 Andrew Haley <aph@redhat.com>
4580
4581 * options.h (merge_exidx_entries): New option.
4582 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4583 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4584 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4585 (Target_arm::merge_exidx_entries): New function.
4586 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4587 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4588 to Arm_exidx_fixup constructor.
4589 Add new arg, merge_exidx_entries.
4590 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4591 Arm_output_section::fix_exidx_coverage.
4592
4593 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4594
4595 * icf.cc (get_section_contents): Check for preemptible functions.
4596 Ignore addend when appropriate.
4597 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4598 section folded.
4599 (add_from_relobj): Check for section folded.
4600 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4601 * symtab.h (should_add_dynsym_entry): Add new parameter.
4602 * target-reloc.h (scan_relocs): Check for section folded.
4603 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4604 Check reloc types for function pointers in shared objects.
4605 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4606 case.
4607 (icf_preemptible_functions_test): New test case.
4608 (icf_string_merge_test): New test case.
4609 * testsuite.Makefile.in: Regenerate.
4610 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4611 bar_glob. Refactor code.
4612 * testsuite/icf_preemptible_functions_test.cc: New file.
4613 * testsuite/icf_preemptible_functions_test.sh: New file.
4614 * testsuite/icf_string_merge_test.cc: New file.
4615 * testsuite/icf_string_merge_test.sh: New file.
4616 * testsuite/icf_virtual_function_folding_test.cc: New file.
4617 * testsuite/icf_virtual_function_folding_test.sh: New file.
4618
4619 2010-04-14 Doug Kwan <dougkwan@google.com>
4620
4621 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4622 for local symbol recounting if we remove a section due to ICF.
4623 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4624 there are no regular objects in input.
4625
4626 2010-04-13 Doug Kwan <dougkwan@google.com>
4627
4628 * arm.cc (Arm_input_section::set_final_data_size): Compute
4629 accurate final data size instead of using current data size.
4630
4631 2010-04-09 Doug Kwan <dougkwan@google.com>
4632
4633 * layout.cc (Layout::choose_output_section): Handle script section
4634 types.
4635 (Layout::make_output_section_for_script): Add section type parameter.
4636 Handle script section types.
4637 * layout.h (Layout::make_output_section_for_script): Add section
4638 type parameter.
4639 * output.cc (Output_section::Output_section): Initialize data member
4640 is_noload_.
4641 (Output_section::do_reset_address_and_file_offset): Do not set address
4642 to 0 if section is a NOLOAD section.
4643 * output.h (Output_section::is_noload): New method.
4644 (Output_section::set_is_noload): Ditto.
4645 (Output_section::is_noload_): New data member.
4646 * script-c.h (Script_section_type): New enum type.
4647 (struct Parser_output_section_header): Add new file section_type.
4648 * script-sections.cc (Sections_element::output_section_name): Add
4649 parameter for returning script section type.
4650 (Output_section_definition::output_section_name): Ditto.
4651 (Output_section_definition::section_type)P; New method.
4652 (Output_section_definiton::script_section_type_name): Ditto.
4653 (Output_section_definition::script_section_type_): New data member.
4654 (Output_section_definition::Output_section_definition): Initialize
4655 data member Output_section_definition::script_section_type_.
4656 (Output_section_definition::create_sections): Pass script section type
4657 to Layout::make_output_section_for_script.
4658 (Output_section_definition::output_section_name): Return script
4659 section type to caller.
4660 (Output_section_definition::set_section_address): Do not advance
4661 dot value and load address if section type is NOLOAD. Set address
4662 of NOLOAD sections regardless of section flags.
4663 (Output_section_definition::print): Print section type if it is
4664 not SCRIPT_SECTION_TYPE_NONE.
4665 (Output_section_definition::section_type): New method.
4666 (Output_section_definition::script_section_type_name): Ditto.
4667 (Script_sections::output_section_name): Add new parameter
4668 PSECTION_TYPE for returning script section type. Pass it to
4669 section elements. Handle discard sections.
4670 (Sort_output_sections::operator()): Handle NOLOAD sections.
4671 * script-sections.h (Script_sections::Section_type): New enum type.
4672 (Script_sections::output_section_name): Add a new parameter for
4673 returning script section type.
4674 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4675 INFO and NOLOAD.
4676 * yyscript.y (union): Add new field SECTION_TYPE.
4677 (COPY, DSECT, INFO, NOLOAD): New tokens.
4678 (opt_address_and_section_type): Change type to output_section_header.
4679 (section_type): New non-terminal
4680 (section_header): Handle section type.
4681 (opt_address_and_section_type): Return section type value.
4682
4683 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4684
4685 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4686 * testsuite/plugin_common_test_2.c (foo): Likewise.
4687
4688 2010-04-08 Doug Kwan <dougkwan@google.com>
4689
4690 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4691 Output_merge_data.
4692 * output.cc (Output_section::add_merge_input_section): Simplify
4693 code and return status of Output_merge_base::add_input_section.
4694 Update merge section map only if Output_merge_base::add_input_section
4695 returns true.
4696
4697 2010-04-07 Doug Kwan <dougkwan@google.com>
4698
4699 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4700 if section is marked as containing instructions but has no mapping
4701 symbols.
4702 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4703 correct section index.
4704 (Arm_relobj::find_linked_text_section): Ditto.
4705
4706 2010-04-07 Cary Coutant <ccoutant@google.com>
4707
4708 * archive.cc (include_member): Destroy Read_symbols_data object before
4709 releasing file.
4710 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4711 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4712 (Read_symbols_data::~Read_symbols_data) New destructor.
4713 (Section_relocs::Section_relocs) New constructor.
4714 (Section_relocs::~Section_relocs) New destructor.
4715 (Read_relocs_data::Read_relocs_data) New constructor.
4716 (Read_relocs_data::~Read_relocs_data) New destructor.
4717 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4718 pointers to NULL after deleting.
4719
4720 2010-04-07 Doug Kwan <dougkwan@google.com>
4721
4722 * arm.cc: Replace "endianity" with "endianness" in comments.
4723 (Arm_exidx_cantunwind): Ditto.
4724 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4725 (Arm_relobj::merge_flags_and_attributes): New method.
4726 (Arm_relobj::merge_flags_and_attributes_): New data member.
4727 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4728 (Arm_relobj::scan_sections_for_stubs): Ditto.
4729 (Arm_relobj::do_read_symbols): Check to see if we really want to
4730 merge processor-specific flags and attributes. Exit early if
4731 an object is empty except for section names and the undefined symbol.
4732 (Target_arm::do_finalize_sections): Move check for ELF format to
4733 Arm_relobj::do_read_symbols. Merge processor specific flags and
4734 attributes from a regular object only when we have determined that
4735 it is aapropriate. Do not create an .ARM.attributes section in
4736 output if there is no regular input object.
4737 (Target_arm::merge_processor_specific_flags): Check
4738 --warn-mismatch before printing any error.
4739 (Target_arm::merge_object_attributes): Ditto.
4740 * gold.cc (queue_middle_tasks): Handle the case in which there is
4741 no regular object in input.
4742 * options.cc (General_options::parse_EB): New method.
4743 (General_options::parse_EL): Same.
4744 (General_options::General_options): Initialize endianness_.
4745 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4746 New options.
4747 (General_options::Endianness): New enum.
4748 (General_options::endianness): New method.
4749 (General_options::endianness_): New data member.
4750 * parameters.cc (Parameters::set_options): Check target endianness.
4751 (Parameters::set_target_once): Ditto.
4752 (Parameters::check_target_endianness): New method.
4753 (parameters_force_valid_target): If either -EL or -EB is specified,
4754 use it to define endianness of default target.
4755 * parameters.h (Parameters::check_target_endianness): New method
4756 declaration.
4757 * target.h (class Target): Change "endianity" to "endianness"
4758 in comments.
4759
4760 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4761
4762 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4763 * configure: Regenerate.
4764 * Makefile.in: Regenerate.
4765 * testsuite/Makefile.in: Regenerate.
4766
4767 2010-04-06 Cary Coutant <ccoutant@google.com>
4768
4769 gcc PR lto/42757
4770 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4771 prevailing definitions of common symbols.
4772 * testsuite/plugin_test_6.sh: New test case.
4773 * testsuite/plugin_common_test_1.c: New test case.
4774 * testsuite/plugin_common_test_2.c: New test case.
4775 * testsuite/Makefile.am (plugin_test_6): New test case.
4776 * testsuite/Makefile.in: Regenerate.
4777
4778 2010-04-06 Nick Clifton <nickc@redhat.com>
4779
4780 * po/vi.po: New Vietnamese translation.
4781
4782 2010-03-30 Doug Kwan <dougkwan@google.com>
4783
4784 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4785
4786 2010-03-25 Doug Kwan <dougkwan@google.com>
4787
4788 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4789 to avoid a conversion warning on a 32-bit host.
4790
4791 2010-03-24 Ian Lance Taylor <iant@google.com>
4792
4793 * testsuite/script_test_3.t: Add a TLS segment.
4794 * testsuite/Makefile.am (check_PROGRAMS): Add
4795 tls_phdrs_script_test.
4796 (tls_phdrs_script_test_SOURCES): Define.
4797 (tls_phdrs_script_test_DEPENDENCIES): Define.
4798 (tls_phdrs_script_test_LDFLAGS): Define.
4799 (tls_phdrs_script_test_LDADD): Define.
4800 * testsuite/Makefile.in: Rebuild.
4801
4802 2010-03-23 Cary Coutant <ccoutant@google.com>
4803
4804 * fileread.cc (find_or_make_view): Fix comment.
4805
4806 2010-03-23 Ian Lance Taylor <iant@google.com>
4807
4808 * script-sections.cc (class Orphan_section_placement): Define
4809 PLACE_TLS and PLACE_TLS_BSS.
4810 (Orphan_section_placement::Orphan_section_placement): Initialize
4811 new places.
4812 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4813 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4814 (tls_script_test_SOURCES): Define.
4815 (tls_script_test_DEPENDENCIES): Define.
4816 (tls_script_test_LDFLAGS): Define.
4817 (tls_script_test_LDADD): Define.
4818 * testsuite/Makefile.in: Rebuild.
4819
4820 2010-03-22 Doug Kwan <dougkwan@google.com>
4821
4822 * arm.cc (Arm_relocate_functions::abs8,
4823 Arm_relocate_functions::abs16): Use correct check for overflow
4824 specified in the ARM ELF specs.
4825 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4826 target of a BLX instruction specially.
4827 (Reloc_stub::stub_type_for_reloc): Ditto.
4828 (Relocate::relocate): Use symbolic names instead of numeric relocation
4829 codes to report error.
4830 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4831 workaround.
4832 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4833 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4834 thumb2_blx_out_of_range.stdout
4835 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4836 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4837 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4838 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4839 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4840 thumb2_blx_in_range, thumb2_blx_in_range.o,
4841 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4842 thumb2_blx_out_of_range.o): New rules.
4843 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4844 thumb2_blx_in_range and thumb2_blx_out_of_range.
4845 * testsuite/Makefile.in: Regenerate.
4846 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4847 * testsuite/thumb_blx_in_range.s: New file.
4848 * testsuite/thumb_blx_out_of_range.s: New file.
4849
4850 2010-03-22 Rafael Espindola <espindola@google.com>
4851
4852 * archive.cc (Should_include): Move to archive.h.
4853 (should_include_member): Make it a member of Archive.
4854 (Lib_group): New.
4855 (Add_lib_group_symbols): New.
4856 * archive.h: Include options.h.
4857 (Archive_member): Moved from Archive.
4858 (Should_include): Moved from archive.cc.
4859 (Lib_group): New.
4860 (Add_lib_group_symbols): New.
4861 * dynobj.cc (do_should_include_member): New.
4862 * dynobj.h (do_should_include_member): New.
4863 * gold.cc (queue_initial_tasks): Update call to queue.
4864 * main.cc (main): Print lib group stats.
4865 * object.cc (do_should_include_member): New.
4866 * object.h: Include archive.h.
4867 (Object::should_include_member): New.
4868 (Object::do_should_include_member): New.
4869 (Sized_relobj::do_should_include_member): New.
4870 * options.cc (General_options::parse_start_lib): New.
4871 (General_options::parse_end_lib): New.
4872 (Input_arguments::add_file): Handle lib groups.
4873 (Input_arguments::start_group): Check we are not in a lib.
4874 (Input_arguments::start_lib): New.
4875 (Input_arguments::end_lib): New.
4876 * options.h (General_options): Add start_lib and end_lib.
4877 (Input_argument::lib_): New.
4878 (Input_argument::lib): New.
4879 (Input_argument::is_lib): New.
4880 (Input_file_lib): New.
4881 (Input_arguments::in_lib_): New.
4882 (Input_arguments::in_lib): New.
4883 (Input_arguments::start_lib): New.
4884 (Input_arguments::end_lib_): New.
4885 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4886 in unused members as preempted.
4887 (Sized_pluginobj::do_should_include_member): New.
4888 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4889 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4890 return the blocker.
4891 (Read_symbols::do_whole_lib_group): New.
4892 (Read_symbols::do_lib_group): New.
4893 (Read_symbols::do_read_symbols): Handle lib groups.
4894 (Read_symbols::get_name): Handle lib groups.
4895 * readsyms.h (Read_symbols): Add an archive member pointer.
4896 (Read_symbols::do_whole_lib_group): New.
4897 (Read_symbols::do_lib_group): New.
4898 (Read_symbols::member_): New.
4899 * script.cc (read_input_script): Update call to queue_soon.
4900
4901 2010-03-19 Doug Kwan <dougkwan@google.com>
4902
4903 * arm.cc (Stub_table::Stub_table): Initialize new data members
4904 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4905 (Stub_table::add_reloc_stub): Assign stub offset and update
4906 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4907 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4908 New data members.
4909 (Stub_table::update_data_size_and_addralign): Use
4910 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4911 instead of going over all reloc stubs.
4912 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4913 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4914 Stringpool_template::offset_ to size of Stringpool_char.
4915 (Stringpool_template::new_key_offset): Remove code to initialize
4916 Stringpool_template::offset_.
4917 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4918 Stringpool_template::offset_ to zero.
4919
4920 2010-03-15 Doug Kwan <dougkwan@google.com>
4921
4922 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4923 offset_.
4924 (Stringpool_template::new_key_offset): New method.
4925 (Stringpool_template::add_string): Assign offsets when adding new
4926 strings.
4927 (Stringpool_template::set_string_offsets): Do not set string offsets
4928 when not optimizing.
4929 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4930 member size_.
4931 (Chunked_vector::clear): Clear size_.
4932 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4933 (Chunked_vector::size): Return size_.
4934 (Chunked_vector::push_back): Use size_ to find insert position.
4935 (Chunked_vector::size_): New data member.
4936 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4937 (Stringpool_template::new_key_offset): New method declaration.
4938 (Stringpool_template::offset_): New data member.
4939
4940 2010-03-15 Rafael Espindola <espindola@google.com>
4941
4942 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4943 Add_symbols' constructor.
4944 * readsyms.h (Add_symbols): Remove the input_group member.
4945
4946 2010-03-10 Ian Lance Taylor <iant@google.com>
4947
4948 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4949 target to ask whether a reference to a symbol requires a stack
4950 split.
4951 * target.h (Target::is_call_to_non_split): New function.
4952 (Target::do_is_call_to_non_split): Declare virtual function.
4953 * target.cc: Include "symtab.h".
4954 (Target::do_is_call_to_non_split): New function.
4955 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4956
4957 2010-03-10 Cary Coutant <ccoutant@google.com>
4958
4959 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4960 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4961 (File_read::open[2]): Add whole_file_view_ to list of views.
4962 (File_read::make_view): Remove test of whole_file_view_.
4963 (File_read::find_or_make_view): Create whole_file_view_ if
4964 necessary.
4965 (File_read::clear_views): Replace bool parameter with enum;
4966 adjust all callers. Don't delete views with permanent data;
4967 do delete cached views and views from archives if
4968 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4969 if clearing the corresponding view.
4970 * fileread.h (File_read::Clear_views_mode): New enum.
4971 (File_read::View::is_permanent_view): New method.
4972 (File_read::clear_views): Replace bool parameter
4973 with enum; adjust all callers.
4974 * options.h (General_options): Change keep_files_mapped option;
4975 add map_whole_files.
4976 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4977 releasing the file.
4978 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4979 the file.
4980
4981 2010-03-10 David S. Miller <davem@davemloft.net>
4982
4983 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4984
4985 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4986
4987 * icf.cc (get_section_contents): Add '@' marker after processing the
4988 merge reloc.
4989
4990 2010-03-08 Doug Kwan <dougkwan@google.com>
4991
4992 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4993 due to a conversion warning.
4994 (Arm_relobj::update_output_local_symbol_count): Check for local
4995 symbol with unset output index.
4996
4997 2010-03-05 Ian Lance Taylor <iant@google.com>
4998
4999 * options.h (class General_options): Add --spare-dynamic-tags.
5000 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5001 --spare-dynamic-tags.
5002
5003 2010-03-05 Ian Lance Taylor <iant@google.com>
5004
5005 * incremental.cc: Include "libiberty.h".
5006
5007 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5008
5009 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5010 function, is_info_ member.
5011 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5012 (Versions::Versions): Update caller.
5013 (Versions::define_base_version): Likewise.
5014 (Versions::add_def): Likewise.
5015
5016 2010-03-03 Sriraman Tallam <tmsriram@google.com>
5017
5018 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5019 (Scan::possible_function_pointer_reloc): New function.
5020 (Scan::local_reloc_may_be_function_pointer): Change to call
5021 possible_function_pointer_reloc.
5022 (Scan::global_reloc_may_be_function_pointer): Ditto.
5023 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5024 relocations in ".data.rel.ro._ZTV" section.
5025 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5026 * testsuite/icf_safe_so_test.cc: Ditto.
5027 * testsuite/icf_safe_test.cc: Ditto.
5028 * testsuite/icf_safe_test.sh: Ditto.
5029
5030 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5031 Ian Lance Taylor <iant@google.com>
5032
5033 * target-reloc.h (relocate_section): Check the symbol table index
5034 for -1U before setting the local symbol index.
5035 (scan_relocatable_relocs): If copying the relocation, record that
5036 the local symbol is required.
5037 * object.h (Symbol_value::is_output_symtab_index_set): New
5038 function.
5039 (Symbol_value::may_be_discarded_from_output_symtab): New
5040 function.
5041 (Symbol_value::has_output_symtab_entry): New function.
5042 (Symbol_value::needs_output_symtab_entry): Remove.
5043 (Symbol_value::output_symtab_index): Make sure the symbol index is
5044 set.
5045 (Symbol_value::set_output_symtab_index): Make sure the symbol
5046 index is not set. Make sure the new index is valid.
5047 (Symbol_value::set_must_have_output_symtab_entry): New function.
5048 (Symbol_value::has_output_dynsym_entry): New function.
5049 (Symbol_value::set_output_dynsym_index): Make sure the new index
5050 is valid.
5051 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5052 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5053 local symbol if permitted.
5054 (Sized_relobj::do_finalize_local_symbols): Call
5055 is_output_symtab_index_set rather than needs_output_symtab_entry.
5056 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5057 rather than needs_output_symtab_entry. Call
5058 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5059 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5060 is_output_symtab_index_set rather than needs_output_symtab_entry.
5061 * testsuite/discard_locals_relocatable_test.c: New file.
5062 * testsuite/discard_locals_test.sh: Test -r.
5063 * testsuite/Makefile.am (check_DATA): Add
5064 discard_locals_relocatable_test1.syms,
5065 discard_local_relocatable_test2.syms.
5066 (MOSTLYCLEANFILES): Likewise. Also add
5067 discard_locals_relocatable_test1.lout and
5068 discard_locals_relocatable_test2.out.
5069 (discard_locals_relocatable_test1.syms): New target.
5070 (discard_locals_relocatable_test.o): New target.
5071 (discard_locals_relocatable_test1.out): New target.
5072 (discard_locals_relocatable_test2.syms): New target.
5073 (discard_locals_relocatable_test2.out): New target.
5074 (various): Add missing ../ld-new dependencies.
5075 * testsuite/Makefile.in: Rebuild.
5076
5077 2010-03-03 Nick Clifton <nickc@redhat.com>
5078
5079 * po/fi.po: New Finnish translation.
5080
5081 2010-03-01 Doug Kwan <dougkwan@google.com>
5082
5083 * layout.cc (Layout::Layout): Force section types of .init_array*,
5084 .preinit_array* and .fini_array* sections.
5085 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5086 Fix check of return value of std::string::find.().
5087 (Output_section::Input_section_sort_compare::operator()): Remove
5088 comment about .init_array.
5089 (Output_section::Input_section_sort_init_fini_compare::operator()):
5090 New method.
5091 (Output_section::sort_attached_input_sections): Handle .init_array
5092 and .fini_array specially.
5093 * output.h (Output_section::Inut_section_sort_compare): Update
5094 comment.
5095 (Output_section::Input_section_sort_init_fini_compare): New struct.
5096
5097 2010-02-26 Doug Kwan <dougkwan@google.com>
5098
5099 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5100 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5101 * testsuite/debug_msg.sh: Avoid matching source line number for
5102 use of global variable undef_int.
5103
5104 2010-02-26 Doug Kwan <dougkwan@google.com>
5105
5106 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5107 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5108 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5109 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5110 * options.cc (General_options::General_options): Initialize member
5111 fix_v4bx_.
5112 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5113 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5114 and rm_no_fix_v4bx.stdout
5115 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5116 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5117 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5118 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5119 and arm_no_fix_v4bx.
5120 * Makefile.in: Regenerate.
5121 * testsuite/arm_fix_v4bx.s: New file.
5122 * testsuite/arm_fix_v4bx.sh: Ditto.
5123
5124 2010-02-24 Doug Kwan <dougkwan@google.com>
5125
5126 * arm.cc (Target_arm::got_section): Make the .got section the first
5127 non RELRO section in the data segment.
5128 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5129 suffixes of section names.
5130
5131 2010-02-24 Doug Kwan <dougkwan@google.com>
5132
5133 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5134 flags and attributes merging if an input file is a binary file.
5135 * fileread.cc (Input_file::open): Record format of original file.
5136 * fileread.h (Input_file::Format): New enum type.
5137 (Input_file::Input_file): Initialize data member format_.
5138 (Input_file::format): New method definition.
5139 (Input_file::format_):: New data member.
5140
5141 2010-02-24 Doug Kwan <dougkwan@google.com>
5142
5143 * arm.cc (Arm_output_data_got): New class.
5144 (ARM_TCB_SIZE): New constant
5145 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5146 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5147 If user uses a script with a SECTIONS clause, issue only a warning
5148 for a misplaced EXIDX input section. Otherwise, issue an error.
5149 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5150 garbage collection.
5151 (Target_arm::got_mode_index_entry): Handle static linking.
5152 (Target_arm::Scan::local): Ditto.
5153 (Target_arm::Scan::global): Ditto.
5154 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5155 all incorrectly implemented relocations.
5156 (Target_arm::fix_exidx_coverage): Pass layout to
5157 Arm_output_section::fix_exidx_coverage.
5158 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5159 from ".ARM.exidx." and ".ARM.extab.".
5160
5161 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5162
5163 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5164 section if it does not already exist.
5165 * attributes.cc (Attributes_section_data::Attributes_section_data):
5166 Don't crash if size is zero.
5167
5168 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5169 Ian Lance Taylor <iant@google.com>
5170
5171 * gold.cc (queue_middle_tasks): If no input files were opened,
5172 exit.
5173 * workqueue.h (Task_function::Task_function): Assert that there is
5174 a blocker.
5175
5176 2010-02-22 Doug Kwan <dougkwan@google.com>
5177
5178 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5179 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5180 types to avoid warnings due to different uint64_t implementations
5181 on different hosts.
5182
5183 2010-02-21 Doug Kwan <dougkwan@google.com>
5184
5185 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5186 handling of the maximum backward branch offset.
5187 (Arm_relocate_functions::thumb_branch_common): Ditto.
5188 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5189 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
5190 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
5191 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5192 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5193 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5194 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5195 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5196 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5197 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5198 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5199 thumb2_bl_out_of_range.o): New rules.
5200 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5201 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5202 thumb2_bl_out_of_range
5203 * testsuite/Makefile.in: Regenerate.
5204 * testsuite/arm_bl_in_range.s: New file.
5205 * testsuite/arm_bl_out_of_range.s: Ditto.
5206 * testsuite/arm_branch_in_range.sh: Ditto.
5207 * testsuite/arm_branch_range.t: Ditto.
5208 * testsuite/thumb2_branch_range.t: Ditto.
5209 * testsuite/thumb_bl_in_range.s: Ditto.
5210 * testsuite/thumb_bl_out_of_range.s: Ditto.
5211 * testsuite/thumb_branch_range.t: Ditto.
5212
5213 2010-02-20 Sriraman Tallam <tmsriram@google.com>
5214
5215 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5216 Add reloc offset information.
5217 * icf.cc (get_section_contents): Change iterators to point to the new
5218 vectors. Add reloc offset information to the contents.
5219 * icf.h (Icf::Sections_reachable_info): New typedef.
5220 (Icf::Sections_reachable_list): New typedef.
5221 (Icf::Offset_info): New typedef.
5222 (Icf::Reloc_info): New struct typedef.
5223 (Icf::Reloc_info_list): New typedef.
5224 (Icf::symbol_reloc_list): Delete method.
5225 (Icf::addend_reloc_list): Delete method.
5226 (Icf::section_reloc_list): Delete method.
5227 (Icf::reloc_info_list): New method.
5228 (Icf::reloc_info_list_): New member.
5229
5230 2010-02-19 Doug Kwan <dougkwan@google.com>
5231
5232 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5233 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5234 * arm.cc (Arm_relocation_functions): New forward declaration.
5235 (Target_arm::Target_arm): Initialize new data members
5236 got_mod_index_offset_ and tls_base_symbol_defined_.
5237 (Target_arm::Relocate::relocate_tls): New method.
5238 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5239 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5240 New methods.
5241 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5242 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5243 (Target_arm::got_mod_index_offset_,
5244 Target_arm::tls_base_symbol_defined_): New data members.
5245 (Target_arm::Scan::local, Target::Scan::global,
5246 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5247 relocations.
5248
5249 2010-02-18 Doug Kwan <dougkwan@google.com>
5250
5251 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5252 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5253 text section as a parameter becuase some broken tools may not set
5254 the link in section header.
5255 (Target_arm::has_got_section): New method.
5256 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5257 without any mapping symbol as data only. Remove warning.
5258 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5259 link in its section header, try to discover the link by inspecting the
5260 REL31 relocation at the beginning of the section.
5261 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5262 in error message.
5263 (Target_arm::Scan::global): Treat any reference to the symbol
5264 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5265
5266 2010-02-12 Sriraman Tallam <tmsriram@google.com>
5267
5268 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5269 (Scan::global_reloc_may_be_function_pointer): New function.
5270 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5271 (Scan::global_reloc_may_be_function_pointer): New function.
5272 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5273 (Scan::global_reloc_may_be_function_pointer): New function.
5274 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5275 (Scan::global_reloc_may_be_function_pointer): New function.
5276 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5277 (Scan::global_reloc_may_be_function_pointer): New function.
5278 (Scan::possible_function_pointer_reloc): New function.
5279 (Target_x86_64::can_check_for_function_pointers): New function.
5280 * gc.h (gc_process_relocs): Scan relocation types to determine if
5281 function pointers were taken for targets that support it.
5282 * icf.cc (Icf::find_identical_sections): Include functions for
5283 folding in safe ICF whose pointer is not taken.
5284 * icf.h (Secn_fptr_taken_set): New typedef.
5285 (fptr_section_id_): New member.
5286 (section_has_function_pointers): New function.
5287 (set_section_has_function_pointers): New function.
5288 (check_section_for_function_pointers): New function.
5289 * options.h: Fix comment for safe ICF option.
5290 * target.h (can_check_for_function_pointers): New function.
5291 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5292 Modify icf_safe_test for X86-64.
5293 * testsuite/Makefile.in: Regenerate.
5294 * testsuite/icf_safe_so_test.cc: New file.
5295 * testsuite/icf_safe_so_test.sh: New file.
5296 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5297 (main): Change to take pointer to function kept_func_3.
5298 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5299 folding is done correctly for X86-64.
5300
5301 2010-02-12 David S. Miller <davem@davemloft.net>
5302
5303 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5304 is_symbolless parameter.
5305 (Output_reloc<SHT_REL>::is_symbolless): New.
5306 (Output_reloc<SHT_REL>::is_symbolless_): New.
5307 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5308 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5309 (Output_reloc<SHT_RELA>::is_symbolless): New.
5310 (Output_data_reloc::add_global): Handle is_symbolless.
5311 (Output_data_reloc::add_global_relative): Likewise.
5312 (Output_data_reloc::add_local): Likewise.
5313 (Output_data_reloc::add_local_relative): Likewise.
5314 (Output_data_reloc::add_symbolless_global_addend): New.
5315 (Output_data_reloc::add_symbolless_local_addend): New.
5316 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5317 is_symbolless.
5318 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5319 instead of ->is_relative_
5320 (Output_reloc::write): Likewise.
5321 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5322 (Output_reloc::write_rel): Simplify.
5323
5324 * sparc.cc (Target_sparc::Scan::local): Use
5325 ->add_symbolless_local_addend as needed.
5326 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5327 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5328 based upon relocation offset.
5329
5330 2010-02-11 Doug Kwan <dougkwan@google.com>
5331
5332 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5333 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5334 beginning of function.
5335 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5336 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5337 parameter is_32bit in calls to should_apply_static_reloc.
5338 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5339 (check_DATA): Add arm_abs_global.stdout.
5340 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5341 arm_abs_global.stdout): New rules.
5342 (MOSTLLYCLEANFILES): Add arm_abs_global
5343 * Makefile.in: Regenerate.
5344 * testsuite/arm_abs_global.s: New file.
5345 * testsuite/arm_abs_global.sh: Ditto.
5346 * testsuite/arm_abs_lib.s: Ditto.
5347
5348 2010-02-11 Ian Lance Taylor <iant@google.com>
5349
5350 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5351 Read_relocs task.
5352 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5353 Allocate_commons_task first.
5354 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5355 task, rather than symtab_lock_.
5356 (Gc_process_relocs::~Gc_process_relocs): New function.
5357 (Gc_process_relocs::is_runnable): Check this_blocker_.
5358 (Gc_process_relocs::locks): Use next_blocker_ rather than
5359 blocker_.
5360 (Scan_relocs::~Scan_relocs): New function.
5361 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5362 symtab_lock_.
5363 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5364 next_blocker_.
5365 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5366 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5367 constructor accordingly.
5368 (class Gc_process_relocs): Likewise.
5369 (class Scan_relocs): Likewise.
5370 * common.h (class Allocate_commons_task): Remove symtab_lock_
5371 field, and corresponding constructor parameter.
5372 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5373 symtab_lock_.
5374 (Allocate_commons_task::locks): Likewise.
5375
5376 2010-02-11 Ian Lance Taylor <iant@google.com>
5377
5378 * gold-threads.h (class Once): Define.
5379 (class Initialize_lock): Rewrite as child of Once.
5380 * gold-threads.cc (class Once_initialize): Define.
5381 (once_pointer_control): New static variable.
5382 (once_pointer, once_arg): New static variables.
5383 (c_run_once): New static function.
5384 (Once::Once, Once::run_once, Once::internal_run): New functions.
5385 (class Initialize_lock_once): Remove.
5386 (initialize_lock_control): Remove.
5387 (initialize_lock_pointer): Remove.
5388 (initialize_lock_once): Remove.
5389 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5390 (Initialize_lock::initialize): Rewrite.
5391 (Initialize_lock::do_run_once): New function.
5392 * archive.cc (Archive::interpret_header): Only clear name if it is
5393 not already empty.
5394 * fileread.cc: Include "gold-threads.h"
5395 (file_counts_lock): New static variable.
5396 (file_counts_initialize_lock): Likewise.
5397 (File_read::release): Only increment counts when using --stats.
5398 Use a lock around the increment.
5399 * parameters.cc (class Set_parameters_target_once): Define.
5400 (set_parameters_target_once): New static variable.
5401 (Parameters::Parameters): Move here from parameters.h.
5402 (Parameters::set_target): Rewrite.
5403 (Parameters::set_target_once): New function.
5404 (Parameters::clear_target): Move here and rewrite.
5405 * parameters.h (class Parameters): Update declarations. Add
5406 set_parameters_target_once_ field.
5407 (Parameters::Parameters): Move to parameters.cc.
5408 (Parameters::clear_target): Likewise.
5409 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5410 task.
5411 (Start_group::~Start_group): New function.
5412 (Start_group::is_runnable): New function.
5413 (Start_group::locks, Start_group::run): New functions.
5414 (Finish_group::run): Change saw_undefined to size_t.
5415 * readsyms.h (class Start_group): Define.
5416 (class Finish_group): Change saw_undefined_ field to size_t.
5417 (Finish_group::Finish_group): Remove saw_undefined and
5418 this_blocker parameters. Change all callers.
5419 (Finish_group::set_saw_undefined): New function.
5420 (Finish_group::set_blocker): New function.
5421 * symtab.h (class Symbol_table): Change saw_undefined to return
5422 size_t. Change saw_undefined_ field to size_t.
5423 * target-select.cc (Set_target_once::do_run_once): New function.
5424 (Target_selector::Target_selector): Initialize set_target_once_
5425 field. Don't initialize lock_ and initialize_lock_ fields.
5426 (Target_selector::instantiate_target): Rewrite.
5427 (Target_selector::set_target): New function.
5428 * target-select.h (class Set_target_once): Define.
5429 (class Target_selector): Update declarations. Make
5430 Set_target_once a friend. Remove lock_ and initialize_lock_
5431 fields. Add set_target_once_ field.
5432
5433 2010-02-10 Ian Lance Taylor <iant@google.com>
5434
5435 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5436 queueing any tasks.
5437 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5438 (queue_middle_tasks): Add all blockers before queueing any tasks.
5439 (queue_final_tasks): Likewise.
5440 * token.h (Task_token::add_blockers): New function.
5441 * object.h (Input_objects::number_of_relobjs): New function.
5442
5443 2010-02-10 Ian Lance Taylor <iant@google.com>
5444
5445 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5446 shared, not if not position independent.
5447 * x86_64.cc (Relocate::relocate_tls): Likewise.
5448 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5449 (tls_pie_pic_test): New target.
5450 * testsuite/Makefile.in: Rebuild.
5451
5452 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5453 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5454 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5455 * testsuite/Makefile.in: Rebuild.
5456
5457 2010-02-09 David S. Miller <davem@davemloft.net>
5458
5459 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5460 R_SPARC_RELATIVE using ->add_local_relative().
5461 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5462
5463 * output.h (Output_data_dynamic::add_section_size): New method
5464 that takes two Output_data objects.
5465 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5466 entry param. Handle it in initializers.
5467 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5468 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5469 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5470 arg.
5471 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5472 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5473 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5474 for dynrel_includes_plt.
5475 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5476 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5477 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5478 before .rela.plt
5479 (Target_sparc::do_finalize_sections): Update to pass true for
5480 dynrel_includes_plt.
5481 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5482 output before .rela.plt
5483 (Target_powerpc::do_finalize_sections): Update to pass true for
5484 dynrel_includes_plt when 32-bit.
5485
5486 2010-02-08 Doug Kwan <dougkwan@google.com>
5487
5488 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5489 method.
5490 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5491 Arm_relobj::scan_section_for_cortex_a8_stubs,
5492 Arm_relobj::do_relocation_section): Instead of calling
5493 Output_section::output_address, use faster
5494 Arm_relobj::simple_input_section_output_address.
5495
5496 2010-02-08 David S. Miller <davem@davemloft.net>
5497
5498 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5499 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5500 relocation helper function.
5501
5502 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5503 just like R_SPARC_GOT{10,13,22}.
5504 (Target_sparc::Scan::local): Likewise.
5505 (Target_sparc::Relocate:relocate): Likewise.
5506
5507 2010-02-06 Ian Lance Taylor <iant@google.com>
5508
5509 * configure.ac: Rewrite targetobjs duplicate removal code to use
5510 only shell constructs.
5511 * configure: Rebuild.
5512
5513 2010-02-05 Doug Kwan <dougkwan@google.com>
5514
5515 PR 11247
5516 * arm.cc (Arm_relobj::section_is_scannable): New method.
5517 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5518 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5519
5520 2010-02-04 Doug Kwan <dougkwan@google.com>
5521
5522 PR 11247
5523 * arm-reloc-property.cc (cstdio): Include.
5524 * configure.ac (targetobjs): Remove duplicates.
5525 * configure: Regenerate.
5526 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5527 big and little endian version for a given address size.
5528
5529 2010-02-03 Doug Kwan <dougkwan@google.com>
5530
5531 * arm-reloc-property.cc
5532 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5533 definition.
5534 * arm-reloc-property.h
5535 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5536 New method definition.
5537 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5538 declaration.
5539 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5540 overflow to N.
5541 (GOT_PREL): Change implemented to Y.
5542 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5543 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5544 (Arm_relocate_functions::movw_abs_nc): Remove method.
5545 (Arm_relocate_functions::movt_abs): Ditto.
5546 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5547 (Arm_relocate_functions::thm_movt_abs): Ditto.
5548 (Arm_relocate_functions::movw_rel_nc): Ditto.
5549 (Arm_relocate_functions::movw_rel): Ditto.
5550 (Arm_relocate_functions::movt_rel): Ditto.
5551 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5552 (Arm_relocate_functions:thm_movw_rel): Ditto.
5553 (Arm_relocate_functions:thm_movt_rel): Ditto.
5554 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5555 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5556 New method definitions.
5557 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5558 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5559 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5560 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5561 (Target_arm::Relocate::relocate): Check for non-static or
5562 unimplemented relocation code and exit early. Change calls to
5563 Target_arm::reloc_uses_thumb_bit and
5564 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5565 instead. Refactor code to handle similar relocations to increase
5566 code sharing. Remove check for unsupported relocation code in switch
5567 statement.
5568 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5569 relocation property table to find out size. Change error message to
5570 print out the name of a relocation code instead of the numeric value.
5571 (Target_arm::scan_reloc_for_stub): Use relocation property table
5572 instead of calling Target_arm::reloc_uses_thumb_bit().
5573
5574 2010-02-02 Doug Kwan <dougkwan@google.com>
5575
5576 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5577 types of relaxed input section.
5578
5579 2010-02-02 Doug Kwan <dougkwan@google.com>
5580
5581 * Makefile.am (HFILES): Add arm-reloc-property.h.
5582 (DEFFILES): New.
5583 (TARGETSOURCES): Add arm-reloc-property.cc
5584 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5585 (libgold_a_SOURCES): $(DEFFILES)
5586 * Makefile.in: Regenerate.
5587 * arm-reloc-property.cc: New file.
5588 * arm-reloc-property.h: New file.
5589 * arm-reloc.def: New file.
5590 * arm.cc: Update comments.
5591 (arm-reloc-property.h): New included header.
5592 (arm_reloc_property_table): New global variable.
5593 (Target_arm::do_select_as_default_target): New method definition.
5594 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5595 arm-reloc-property to targ_extra_obj.
5596 * parameters.cc (set_parameters_target): Call
5597 Target::select_as_default_target().
5598 * target.h (Target::select_as_default_target): New method definition.
5599 (Target::do_select_as_default_target): Same.
5600
5601 2010-02-01 Doug Kwan <dougkwan@google.com>
5602
5603 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5604 first_output_text_section_.
5605 (Arm_exidx_fixup::first_output_text_section): New method definition.
5606 (Arm_exidx_fixup::first_output_text_section_): New data member.
5607 (Arm_exidx_fixup::process_exidx_section): Record the first text
5608 output section seen.
5609 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5610 and entsize in output section header.
5611
5612 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5613
5614 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5615 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5616 (Arm_relocate_functions::thm_alu11): New Method.
5617 (Arm_relocate_functions::thm_pc8): New Method.
5618 (Arm_relocate_functions::thm_pc12): New Method.
5619 (Target_arm::Scan::local): Handle the relocations.
5620 (Target_arm::Scan::global): Likewise.
5621 (Target_arm::Relocate::relocate): Likewise.
5622 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5623
5624 2010-01-29 Doug Kwan <dougkwan@google.com>
5625
5626 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5627 of relocation types as ld.
5628
5629 2010-01-29 Doug Kwan <dougkwan@google.com>
5630
5631 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5632 to public.
5633 (Arm_relocate_functions::thumb_branch_common): Ditto.
5634 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5635 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5636 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5637 Arm_relocate_functions::jump24): Remove.
5638 (Target_arm::Relocate::relocate): Adjust code to call
5639 Arm_relocation_functions::arm_branch_common and
5640 Arm_relocation_functions::thumb_branch_common instead of their removed
5641 wrappers. Merge switch-cases together to reduce source code size.
5642
5643 2010-01-29 Doug Kwan <dougkwan@google.com>
5644
5645 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5646 output_local_symbol_count_needs_update_.
5647 (Arm_relobj::output_local_symbol_count_needs_update,
5648 Arm_relobj::set_output_local_symbol_count_needs_update,
5649 Arm_relobj::update_output_local_symbol_count): New methods.
5650 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5651 member.
5652 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5653 of pointed function as in a R_ARM_PREL31 relocation.
5654 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5655 for output local symbol count updating.
5656 (Target_arm::do_relax): Update output local symbol counts in objects
5657 if necessary.
5658 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5659
5660 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5661
5662 * arm.cc: Added support for the ARM relocations:
5663 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5664 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5665 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5666 movw_prel_nc).
5667 (Arm_relocate_functions::movw_rel): New method.
5668 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5669 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5670 thm_movw_prel_nc).
5671 (Arm_relocate_functions::thm_movw_rel): New method.
5672 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5673 thm_movt_prel).
5674 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5675 relocations.
5676 (Target_arm::Scan::global): Likewise.
5677 (Target_arm::Relocate::relocate): Likewise.
5678 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5679 Likewise.
5680
5681 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5682
5683 * arm.cc: Added support for ARM group relocations.
5684 (Target_arm::reloc_needs_sym_origin): New method.
5685 (Arm_relocate_functions::calc_grp_kn): New method.
5686 (Arm_relocate_functions::calc_grp_residual): New method.
5687 (Arm_relocate_functions::calc_grp_gn): New method.
5688 (Arm_relocate_functions::arm_grp_alu): New Method.
5689 (Arm_relocate_functions::arm_grp_ldr): New Method.
5690 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5691 (Arm_relocate_functions::arm_grp_ldc): New Method.
5692 (Target_arm::Scan::local): Handle the ARM group relocations.
5693 (Target_arm::Scan::global): Likewise.
5694 (Target_arm::Relocate::relocate): Likewise.
5695 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5696 Likewise.
5697
5698 2010-01-26 Doug Kwan <dougkwan@google.com>
5699
5700 * arm.cc (set): Include.
5701 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5702 pointer type.
5703 (Arm_output_section::Text_section_list): New type.
5704 (Arm_output_section::append_text_sections_to_list): New method.
5705 (Arm_output_section::fix_exidx_coverage): Ditto.
5706 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5707 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5708 Relobj::set_section_offset() instead of
5709 Sized_relobj::invalidate_section_offset().
5710 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5711 parameter for section headers. Ignore relocation sections for
5712 unallocated sections and EXIDX sections.
5713 (Target_arm::fix_exidx_coverage): New method.
5714 (Target_arm::output_section_address_less_than): New type.
5715 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5716 linked text section instead of the EXIDX section.
5717 (Arm_output_section::create_stub_group): Add an assertion to check
5718 that this is not an EXIDX output section.
5719 (Arm_output_section::append_text_sections_to_list): New method.
5720 (Arm_output_section::fix_exidx_coverage): Ditto.
5721 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5722 Arm_relobj::section_needs_reloc_stub_scanning.
5723 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5724 first pass.
5725 (Target_arm::fix_exidx_coverage): New method.
5726 * object.h (Relobj::set_output_section): New method.
5727 (Sized_relobj::invalidate_section_offset): Remove method.
5728 (Sized_relobj::do_invalidate_section_offset): Remove method.
5729 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5730
5731 2010-01-25 Doug Kwan <dougkwan@google.com>
5732
5733 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5734 Fix warning due to signed and unsigned comparison on a 32-bit host.
5735
5736 2010-01-22 Doug Kwan <dougkwan@google.com>
5737
5738 * arm.cc (Target_arm::do_relax): Record an output section for section
5739 offset adjustment it contains any stub table that has changed.
5740 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5741 offsets in an output section if necessary.
5742 * output.cc (Output_section::Output_section): Initialize
5743 section_offsets_need_adjustments_.
5744 (Output_section::add_input_section_for_script): Renamed to
5745 Output_section::add_simple_input_section.
5746 (Output_section::save_states): Add a comment.
5747 (Output_section::discard_states): New method defintion.
5748 (Output_section::adjust_section_offsets): Same.
5749 * output.h (Output_section::add_input_section_for_script): Renamed to
5750 Output_section::add_simple_input_section.
5751 (Output_section::discard_states): New method declaration.
5752 (Output_section::adjust_section_offsets): Same.
5753 (Output_section::section_offsets_need_adjustment,
5754 Output_section::set_section_offsets_need_adjustment): New method
5755 definitions.
5756 (Output_section::section_offsets_need_adjustment_): New data member.
5757 * script-sections.cc
5758 (Output_section_element_input::set_section_address): Adjust code for
5759 renaming of Output_section::add_input_section_for_script.
5760 (Orphan_output_section::set_section_address): Same.
5761
5762 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5763
5764 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5765 Fix_v4bx enum values .
5766 * gold/options.h (General_options): New option definitions.
5767 (General_options::fix_v4bx): New method.
5768 (General_options::Fix_v4bx): New enum.
5769 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5770 (General_options::parse_fix_v4bx_interworking): New method.
5771
5772 2010-01-22 Doug Kwan <dougkwan@google.com>
5773
5774 * arm.cc (Arm_exidx_fixup): New class.
5775
5776 2010-01-21 Doug Kwan <dougkwan@google.com>
5777
5778 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5779 classes.
5780 (Arm_exidx_section_offset_map): New type.
5781
5782 2010-01-21 Doug Kwan <dougkwan@google.com>
5783
5784 * arm.cc (Arm_exidx_input_section): New class.
5785 (Arm_relobj::exidx_input_section_by_link,
5786 Arm_relobj::exidx_input_section_by_shndx,
5787 Arm_relobj::make_exidx_input_section): New methods.
5788 (read_arm_attributes_section): Remove.
5789 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5790 information about them.
5791 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5792 to here.
5793
5794 2010-01-20 Doug Kwan <dougkwan@google.com>
5795
5796 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5797 Input_section_specifier to Section_id.
5798 (Target_arm::new_arm_input_section: Adjust code for change of key
5799 type.
5800 (Target_arm::find_arm_input_section): Ditto.
5801 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5802 (Section_id): Remove.
5803 (Garbage_collection::Section_id_hash): Remove.
5804 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5805 (Section_id): Remove.
5806 (Icf::Section_id_hash): Remove.
5807 * object.h (Section_id, Const_section_id, Section_id_hash,
5808 Const_section_id_hash): New type definitions.
5809 * output.cc (Output_section::add_relaxed_input_section): Change to
5810 use Const_section_id instead of Input_section_specifier as key type.
5811 (Output_section::add_merge_input_section): Ditto.
5812 (Output_section::build_relaxation_map): Change to use Section_id
5813 instead of Input_section_specifier as key type.
5814 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5815 Ditto.
5816 (Output_section::convert_input_sections_to_relaxed_sections): Change
5817 to use Const_section_id instead of Input_section_specifier as key type.
5818 (Output_section::find_merge_section): Ditto.
5819 (Output_section::find_relaxed_input_section): Ditto.
5820 * output.h (Input_section_specifier): Remove class.
5821 (Output_section::Output_section_data_by_input_section_map): Change
5822 key type to Const_section_id.
5823 (Output_section::Output_relaxed_input_section_by_input_section_map):
5824 Ditto.
5825 (Output_section::Relaxation_map): Change key type to Section_id.
5826
5827 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5828
5829 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5830 (class Arm_v4bx_stub): New class.
5831 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5832 (Stub_factory::make_arm_v4bx_stub): New method.
5833 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5834 (Stub_table::empty): Handle v4bx stubs.
5835 (Stub_table::add_arm_v4bx_stub): New method.
5836 (Stub_table::find_arm_v4bx_stub): New method.
5837 (Arm_relocate_functions::v4bx): New method.
5838 (Target_arm::fix_v4bx): New method.
5839 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5840 (Stub_table::relocate_stubs): Likewise.
5841 (Stub_table::do_write): Likewise.
5842 (Stub_table::update_data_size_and_addralign): Likewise.
5843 (Stub_table::finalize_stubs): Likewise.
5844 (Target_arm::Scan::local): Likewise.
5845 (Target_arm::Scan::global): Likewise.
5846 (Target_arm::do_finalize_sections): Likewise.
5847 (Target_arm::Relocate::relocate): Likewise.
5848 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5849 Likewise.
5850 (Target_arm::scan_reloc_for_stub): Likewise.
5851 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5852
5853 2010-01-19 Ian Lance Taylor <iant@google.com>
5854
5855 * output.cc (Output_section_headers::do_sized_write): Write large
5856 segment count to sh_info field.
5857 (Output_file_header::do_sized_write): For large segment count,
5858 write PN_XNUM to e_phnum field.
5859
5860 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5861
5862 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5863 (Arm_relocate_functions::thm_jump8): New function.
5864 (Arm_relocate_functions::thm_jump11): New function.
5865 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5866 R_ARM_THM_JUMP11.
5867 (Target_arm::Scan::global): Likewise.
5868 (Target_arm::Relocate::relocate): Likewise.
5869 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5870 Likewise.
5871
5872 2010-01-14 Doug Kwan <dougkwan@google.com>
5873
5874 * arm.cc (map, utility): Include headers.
5875 (Target_arm::apply_cortex_a8_workaround): New method.
5876 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5877 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5878 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5879 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5880 the --[no-]fix-cortex-a8 command line options.
5881 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5882 (Target_arm::relocate_stub): Use addend in instruction template.
5883 * options.h (DEFINE_bool): Set the user-set flag.
5884 (General_options): Add --[no-]-fix-cortex options.
5885 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5886 : Update fast look-up map after conversion.
5887
5888 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5889
5890 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5891 in the first pass of do_layout.
5892
5893 2010-01-13 Doug Kwan <dougkwan@google.com>
5894
5895 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5896 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5897 apparent compiler problem of not folding static constant integral
5898 data members of elfcpp::Elf_sizes<32>.
5899
5900 2010-01-13 Doug Kwan <dougkwan@google.com>
5901
5902 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5903 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5904 Arm_relobj::scan_section_for_cortex_a8_erratum,
5905 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5906 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5907 sections to scan for relocation stubs into a new method
5908 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5909 relocation and Cortex-A8 stub scanning.
5910 (Target_arm::do_relax): Force stubs to be after stubbed sections
5911 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5912 the beginning of a new relaxation pass. Update a comment.
5913 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5914
5915 2010-01-12 Ian Lance Taylor <iant@google.com>
5916
5917 * target-reloc.h (visibility_error): New inline function.
5918 (relocate_section): Call visibility_error.
5919 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5920 (MOSTLYCLEANFILES): Likewise.
5921 (protected_4_pic.o, protected_3.err): New targets.
5922 * testsuite/protected_4.cc: New file.
5923
5924 2010-01-12 Doug Kwan <dougkwan@google.com>
5925
5926 * arm.cc (Cortex_a8_reloc): New class.
5927 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5928 and cortex_a8_relocs_info_.
5929 (Target_arm::fix_cortex_a8): New method definition.
5930 (Target_arm::Cortex_a8_relocs_info): New type.
5931 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5932 New data member declarations.
5933 (Target_arm::scan_reloc_for_stub): Record information about
5934 relocations for THUMB branches that might be exempted from the
5935 Cortex-A8 workaround.
5936 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5937 at the beginning of a relaxation pass.
5938
5939 2010-01-12 Doug Kwan <dougkwan@google.com>
5940
5941 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5942 (Arm_relobj::Mapping_symbol_position,
5943 Arm_reloj::Mapping_symbol_position_less,
5944 Arm_relobj::Mapping_symbols_info): New types.
5945 (Target_arm::is_mapping_symbol_name): New method definition.
5946 (Arm_relobj::do_count_local_symbols): Save information about mapping
5947 symbols.
5948
5949 2010-01-11 Doug Kwan <dougkwan@google.com>
5950
5951 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5952 Arm_relocate_functions::thumb32_branch_upper,
5953 Arm_relocate_functions::thumb32_branch_lower,
5954 Arm_relocate_functions::thumb32_cond_branch_offset,
5955 Arm_relocate_functions::thumb32_cond_branch_upper,
5956 Arm_relocate_functions::thumb32_cond_branch_lower,
5957 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5958 branch offset encoding.
5959 (Arm_relocate_functions::thumb_branch_common): Use new branch
5960 offset encoding methods to avoid code duplication.
5961 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5962 (Stub_addend_reader::operator()): Use new branch encoding method
5963 to avoid code duplication.
5964
5965 2010-01-11 Doug Kwan <dougkwan@google.com>
5966
5967 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5968 (Target_arm::do_finalize_sections): Define special EXIDX section
5969 symbols only if referenced.
5970 * gc.h (Garbage_collection::add_reference): New method.
5971 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5972 code duplication.
5973
5974 2010-01-11 Ian Lance Taylor <iant@google.com>
5975
5976 * script.cc (Version_script_info::build_expression_list_lookup):
5977 Change complaing about duplicate wildcard match from error to
5978 warning.
5979
5980 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5981 of 2009-12-30.
5982 (Version_script_info::Version_script_info): Initialize globs_,
5983 default_version_, default_is_global_, and exact_. Don't
5984 initialize globals_ or locals_.
5985 (Version_script_info::build_lookup_tables): Build local symbols
5986 first.
5987 (Version_script_info::unquote): New function.
5988 (Version_script_info::add_exact_match): New function.
5989 (Version_script_info::build_expression_list_lookup): Remove lookup
5990 parameter. Add is_global parameter. Change all callers. Handle
5991 wildcard pattern specially. Unquote pattern. Call
5992 add_exact_match.
5993 (Version_script_info::get_name_to_match): New function.
5994 (Version_script_info::get_symbol_version): New function.
5995 (Version_script_info::get_symbol_version_helper): Remove.
5996 (Version_script_info::check_unmatched_names): Call unquote.
5997 * script.h (class Version_script_info): Change get_symbol_version
5998 to be non-inline and add is_global parameter; change all callers.
5999 Rewrite symbol_is_local. Update declarations. Define struct
6000 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6001 Remove globals_ and locals_ members. Add exact_, globs_,
6002 default_version_, is_global_.
6003 (Version_script_info::Glob): Remove pattern, add expression and
6004 is_global. Update constructor. Change all callers.
6005 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6006 default version.
6007 (Versions::symbol_section_contents): If a symbol is undefined, or
6008 defined in a dynamic object, set the version index to
6009 VER_NDX_LOCAL.
6010 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6011 symbol_is_local.
6012 (Symbol_table::add_from_pluginobj): Likewise.
6013 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6014
6015 2010-01-11 Doug Kwan <dougkwan@google.com>
6016
6017 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6018 (incremental_dump_LDADD): Add linking option for libintl.
6019 * Makefile.in: Regenerate.
6020
6021 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6022
6023 PR gold/11144
6024 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6025 instead of -Ds.
6026 * testsuite/Makefile.in: Regenerated.
6027
6028 2010-01-10 Doug Kwan <dougkwan@google.com>
6029
6030 * options.h (DEFINE_var): Use parentheses around argument varname__
6031 in macro body to avoid any unintended subsequent substitutions.
6032
6033 2010-01-10 Ian Lance Taylor <iant@google.com>
6034
6035 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6036 candidates before doing symbol resolution.
6037
6038 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6039 ODR candidates if only one is weak.
6040
6041 2010-01-08 Ian Lance Taylor <iant@google.com>
6042
6043 * script.cc (Version_script_info::build_expression_list_lookup):
6044 Don't warn about ambiguous version, just record the ambiguity.
6045 (Version_script_info::get_symbol_version_helper): Give error if
6046 version is ambiguous.
6047
6048 2010-01-08 Doug Kwan <dougkwan@google.com>
6049
6050 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6051 prev_data_size_ and prev_addralign_. Remove initializer for
6052 deleted data member has_been_changed_.
6053 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6054 to determine if the table is empty.
6055 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6056 Remove.
6057 (Stub_table::add_reloc_stub): Define method in class definition
6058 instead of just declaring it there.
6059 (Stub_table::add_cortex_a8_stub): New method definition.
6060 (Stub_table::update_data_size_and_addralign): Ditto.
6061 (Stub_table::finalize_stubs): Ditto.
6062 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6063 (Stub_table::do_addralign_): Return address alignment in the
6064 (Stub_table::do_reset_address_and_file_offset): Define method in
6065 class definition instead of declaring it there. Set current data
6066 size to be the data size of the previous pass.
6067 (Stub_table::set_final_data_size): Use current data size as the
6068 final data size.
6069 (Stub_table::relocate_stub): Change parameter type of stub from
6070 Reloc_stub pointer to Stub pointer.
6071 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6072 (Stub_table::Cortex_a8_stub_list): New typedef.
6073 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6074 Stub_table::prev_addralign_): New data member.
6075 (Arm_relobj::Arm_relobj): Initialize data member
6076 section_has_cortex_a8_workaround_.
6077 (Arm_relobj::section_has_cortex_a8_workaround,
6078 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6079 definitions.
6080 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6081 declarations.
6082 (Target_arm::relocate_stub): Change parameter type of stub from
6083 Reloc_stub pointer to Stub pointer.
6084 (Insn_template::size, Insn_template::alignment): Handle
6085 THUMB16_SPECIAL_TYPE.
6086 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6087 Stub_table::update_data_size_and_addralign,
6088 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6089 definitions.
6090 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6091 (Stub_table::do_write): Ditto.
6092 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6093
6094 2010-01-08 Ian Lance Taylor <iant@google.com>
6095
6096 PR 11108
6097 * symtab.h (class Symbol): Remove fields is_target_special_ and
6098 has_plt_offset_. Add field is_defined_in_discarded_section_.
6099 (Symbol::is_defined_in_discarded_section): New function.
6100 (Symbol::set_is_defined_in_discarded_section): New function.
6101 (Symbol::has_plt_offset): Rewrite.
6102 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6103 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6104 Don't initialize is_target_special_ or has_plt_offset_.
6105 Initialize is_defined_in_discarded_section_.
6106 (Symbol_table::add_from_relobj): If appropriate, set
6107 is_defined_in_discarded_section.
6108 * resolve.cc (Symbol::override_base_with_special): Don't test
6109 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6110 * target-reloc.h (relocate_section): Do special handling for
6111 symbols defined in discarded sections for global symbols as well
6112 as local symbols.
6113
6114 2010-01-08 Ian Lance Taylor <iant@google.com>
6115
6116 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6117 the SHT_SYMTAB case.
6118
6119 2010-01-08 Ian Lance Taylor <iant@google.com>
6120
6121 * object.cc (Sized_relobj::do_layout): Don't get confused if
6122 layout_eh_frame returns NULL.
6123
6124 2010-01-08 Ian Lance Taylor <iant@google.com>
6125
6126 PR 11084
6127 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6128 dynamic symbol table, use the normal symbol table.
6129 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6130 symbol table.
6131
6132 2010-01-08 Ian Lance Taylor <iant@google.com>
6133
6134 PR 11072
6135 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6136 sections.
6137
6138 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6139
6140 * version.cc (print_version): Change to "Copyright 2010".
6141
6142 2010-01-08 Ian Lance Taylor <iant@google.com>
6143
6144 PR 10287
6145 PR 11063
6146 * i386.cc (class Target_i386): Change return type of plt_section
6147 to be non-const.
6148 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6149 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6150 tls_desc_rel_ field.
6151 (Output_data_plt_i386::rel_tls_desc): New function.
6152 (Target_i386::rel_tls_desc_section): New function.
6153 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6154 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6155 R_386_TLS_DESC reloc in rel_tls_desc_section.
6156 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6157 Define struct Tlsdesc_info.
6158 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6159 (Target_x86_64::do_reloc_symbol_index): New function.
6160 (Target_x86_64::add_tlsdesc_info): New function.
6161 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6162 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6163 tlsdesc_rel_ field.
6164 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6165 all callers.
6166 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6167 (Target_x86_64::rela_tlsdesc_section): New function.
6168 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6169 handling.
6170 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6171 (Target_x86_64::do_reloc_addend): New function.
6172 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6173 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6174 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6175 (Output_reloc::type): New function.
6176 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6177 (Output_reloc::is_target_specific): New function.
6178 (Output_reloc::target_arg): New function.
6179 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6180 absolute relocs and target specific relocs.
6181 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6182 add_target_specific.
6183 (class Output_data_reloc) [SHT_RELA]: Likewise.
6184 * output.cc (Output_reloc::Output_reloc): Add four new versions
6185 for absolute relocs and target specific relocs.
6186 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6187 (Output_reloc::get_symbol_index): Likewise.
6188 (Output_reloc::local_section_offset): Check that local_sym_index_
6189 is not TARGET_CODE or 0.
6190 (Output_reloc::symbol_value): Likewise.
6191 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6192 reloc.
6193 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6194 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6195 functions.
6196 * layout.cc (add_target_dynamic_tags): Use output section for
6197 DT_PLTRELSZ and DT_JMPREL.
6198
6199 2010-01-07 Ian Lance Taylor <iant@google.com>
6200
6201 PR 11061
6202 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6203 function.
6204 (class Output_data_reloc_generic): Define.
6205 (class Output_data_reloc_base): Change base class to
6206 Output_data_reloc_generic. Change add() method to call
6207 bump_relative_reloc_count for a relative reloc. Remove
6208 sort_relocs_ field.
6209 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6210 to sort_relocs().
6211 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6212 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6213 appropriate.
6214 * layout.h (class Layout): Update declaration.
6215
6216 2010-01-07 Ian Lance Taylor <iant@google.com>
6217
6218 * output.h (class Output_data): Add const version of
6219 output_section and do_output_section.
6220 (class Output_section_data): Add const version of
6221 do_output_section.
6222 (class Output_section): Likewise.
6223 * layout.cc (Layout::add_target_dynamic_tags): New function.
6224 * layout.h (class Layout): Update declarations.
6225 * arm.cc (Target_arm::do_finalize_sections): Use
6226 add_target_dynamic_tags.
6227 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6228 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6229 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6230 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6231
6232 2010-01-07 Ian Lance Taylor <iant@google.com>
6233
6234 PR 11042
6235 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6236 object as needed.
6237
6238 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6239 Ian Lance Taylor <iant@google.com>
6240
6241 PR 11019
6242 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6243 Xindex::read_symtab_xindex.
6244
6245 2010-01-07 Doug Kwan <dougkwan@google.com>
6246
6247 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6248 (Insn_template::thumb16_bcond_insn): New method declaration.
6249 (Insn_template): Fix spelling.
6250 (Stub::thumb16_special): New method declaration.
6251 (Stub::do_write): Define virtual method which was previously pure
6252 virtual.
6253 (Stub::do_thumb16_special): New method declaration.
6254 (Stub::do_fixed_endian_write): New template member.
6255 (Reloc_stub::do_write): Remove.
6256 (Reloc_stub::do_fixed_endian_write): Remove.
6257 (Cortex_a8_stub): New class definition.
6258 (Stub_factory::make_cortex_a8_stub): New method definition.
6259 (Stub_factory::Stub_factory): Add missing static storage class
6260 qualifier for elf32_arm_stub_a8_veneer_blx.
6261
6262 2010-01-07 Ian Lance Taylor <iant@google.com>
6263
6264 PR 10980
6265 * options.h (class General_options): Add --warn-unresolved-symbols
6266 and --error-unresolved-symbols.
6267 * errors.cc (Errors::undefined_symbol): Implement
6268 --warn-unresolved-symbols.
6269
6270 * options.h (class General_options): Add -z text and -z textoff.
6271 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6272
6273 2010-01-06 Sriraman Tallam <tmsriram@google.com>
6274
6275 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6276 (Garbage_collection::cident_sections): New function.
6277 (Garbage_collection::add_cident_section): New function.
6278 (Garbage_collection::cident_sections_): New member.
6279 (gc_process_relocs): Add references to sections whose names are C
6280 identifiers.
6281 * gold.h (cident_section_start_prefix): New constant.
6282 (cident_section_stop_prefix): New constant.
6283 (is_cident): New function.
6284 * layout.cc (Layout::define_section_symbols): Replace string constants
6285 with the newly defined constants.
6286 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6287 C identifiers.
6288 * testsuite/Makefile.am: Add gc_orphan_section_test.
6289 * testsuite/Makefile.in: Regenerate.
6290 * testsuite/gc_orphan_section_test.cc: New file.
6291 * testsuite/gc_orphan_section_test.sh: New file.
6292
6293 2010-01-06 Ian Lance Taylor <iant@google.com>
6294
6295 PR 10980
6296 * options.h (class General_options): Add --warn-shared-textrel.
6297 * layout.cc (Layout::finish_dynamic_section): Implement
6298 --warn-shared-textrel.
6299
6300 PR 10980
6301 * options.h (class General_options): Add --warn-multiple-gp.
6302
6303 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6304
6305 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6306 $(THREADSLIB) and $(LIBDL).
6307 * Makefile.in: Rebuild.
6308
6309 2010-01-06 Ian Lance Taylor <iant@google.com>
6310
6311 PR 10980
6312 * options.cc (General_options::parse_section_start): New function.
6313 (General_options::section_start): New function.
6314 (General_options::General_options): Initialize all members.
6315 * options.h: Include <map>
6316 (class General_options): Add --section-start. Add section_starts_
6317 member.
6318 * layout.cc (Layout::attach_allocated_section_to_segment): If
6319 --section-start was used, set the address of the segment. Remove
6320 local sort_sections.
6321 (Layout::relaxation_loop_body): If the address of the load segment
6322 has been set by --section-start, don't use it.
6323 * output.h (Output_segment::update_flags_for_output_section): New
6324 function.
6325 * output.cc (Output_segment::add_output_section): Call
6326 update_flags_for_output_section.
6327
6328 2010-01-05 Ian Lance Taylor <iant@google.com>
6329
6330 PR 10980
6331 * options.h (class General_options): Add --undefined-version.
6332 * script.cc (struct Version_expression): Add was_matched_by_symbol
6333 field.
6334 (Version_script_info::matched_symbol): New function.
6335 (Version_script_info::get_symbol_version_helper): Call
6336 matched_symbol.
6337 (Version_script_info::check_unmatched_names): New function.
6338 * script.h (class Version_script_info): Update declarations.
6339 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6340
6341 * options.h (class General_options): Use DEFINE_bool_alias for
6342 allow_multiple_definition.
6343 * resolve.cc (Symbol_table::should_override): Don't test
6344 allow_multiple_definition.
6345
6346 PR 10980
6347 * options.h (class General_options): Add --cref.
6348 * main.cc (main): Print cref table if --cref. Don't close mapfile
6349 until after printing cref table.
6350 * cref.cc: Include "symtab.h".
6351 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6352 (Cref_table_compare::operator()): New function.
6353 (Cref_inputs::gather_cref): New function.
6354 (filecol): New static const.
6355 (Cref_inputs::print_cref): New function.
6356 (Cref::print_cref): New function.
6357 * cref.h: Include <cstdio>.
6358 (class Cref): Update declarations.
6359 * mapfile.h (Mapfile::file): New function.
6360 * object.h (class Object): Define Symbols. Declare virtual
6361 do_get_global_symbols.
6362 (Object::get_global_symbols): New function.
6363 * object.cc (Input_objects::add_object): Pass object to cref_ if
6364 --cref.
6365 (Input_objects::archive_start): Likewise.
6366 (Input_objects::archive_stop): Likewise.
6367 (Input_objects::print_cref): New function.
6368 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6369 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6370 --cref.
6371 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6372 function.
6373 * plugin.h (class Sized_pluginobj): Update declarations.
6374
6375 2010-01-05 Ian Lance Taylor <iant@google.com>
6376
6377 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6378 to is_default_version. Rename insdef to insdefault.
6379 (Symbol_table::add_from_relobj): Rename def to is_default_version
6380 and local to is_forced_local.
6381 (Symbol_table::add_from_pluginobj): Likewise.
6382 (Symbol_table::add_from_dynobj): Likewise.
6383 (Symbol_table::define_special_symbol): Rename insdef to
6384 insdefault.
6385
6386 2010-01-04 Ian Lance Taylor <iant@google.com>
6387
6388 PR 10980
6389 * options.h (class General_options): Add
6390 --allow-multiple-definition and -z muldefs.
6391 * resolve.cc (Symbol_table::should_override): Don't warn about a
6392 multiple symbol definition if --allow-multiple-definition or -z
6393 muldefs.
6394
6395 PR 10980
6396 * options.h (class General_options): Add --add-needed and
6397 --copy-dt-needed-entries. Tweak --as-needed help entry.
6398 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6399 error if --copy-dt-needed-entries aka --add-needed is used and
6400 would cause a change in behaviour.
6401
6402 PR 10980
6403 * options.h (class General_options): Add -G as a short version of
6404 --shared. Add no-op options -assert, -g, and -i.
6405
6406 2010-01-04 Sriraman Tallam <tmsriram@google.com>
6407
6408 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6409 check for .text or .gnu.linkonce.t sections.
6410 * icf.cc (Icf::find_identical_sections): Ditto.
6411 Change the detection for mangled function name within the section
6412 name.
6413 * icf.h (is_section_foldable_candidate): New function.
6414
6415 2009-12-30 Ian Lance Taylor <iant@google.com>
6416
6417 PR 10980
6418 * options.h (class General_options): Permit two dashes with
6419 --retain-symbols-file.
6420
6421 2009-12-30 Ian Lance Taylor <iant@google.com>
6422
6423 PR 10979
6424 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6425 don't put the file header and segment headers in the text
6426 segment.
6427
6428 PR 10979
6429 * common.cc (Sort_commons::operator()): Stabilize sort when both
6430 entries are NULL.
6431 (Symbol_table::do_allocate_commons_list): When allocating common
6432 symbols, skip a symbol which is no longer common.
6433 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6434 an object before checking its type.
6435 * testsuite/common_test_2.c: New file.
6436 * testsuite/common_test_3.c: New file.
6437 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6438 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6439 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6440 (common_test_2_pic.o, common_test_2.so): New targets.
6441 (common_test_3_pic.o, common_test_3.so): New targets.
6442 * testsuite/Makefile.in: Rebuild.
6443
6444 PR 10979
6445 * script.cc (read_input_script): If we see a new SECTIONS clause,
6446 and we have added an input section, give an error.
6447 * layout.h (class Layout): Add have_added_input_section function.
6448 Add have_added_input_section_ field.
6449 * layout.cc (Layout::Layout): Initialize
6450 have_added_input_section_.
6451 (Layout::layout): Set have_added_input_section_.
6452 (Layout::layout_eh_frame): Likewise.
6453
6454 2009-12-30 Ian Lance Taylor <iant@google.com>
6455
6456 PR 10931
6457 * options.h (class General_options): Add --sort-common option.
6458 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6459 * common.cc (Sort_common): Add sort_order parameter to
6460 constructor. Add sort_order_ field.
6461 (Sort_commons::operator): Check sort_order_.
6462 (Symbol_table::allocate_commons): Determine the sort order.
6463 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6464 Change all callers.
6465 (Symbol_table::do_allocate_commons_list): Likewise.
6466
6467 2009-12-30 Ian Lance Taylor <iant@google.com>
6468
6469 PR 10916
6470 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6471 symbols from this object, don't change the visibility of an
6472 undefined symbol.
6473 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6474
6475 2009-12-30 Ian Lance Taylor <iant@google.com>
6476
6477 PR 10861
6478 * script.h (class Version_script_info): Define Language enum.
6479 Update declarations. Define Glob, Exact, and Lookup types. Add
6480 new fields globals_, locals_, and is_finalized_.
6481 * script.cc: Various formatting fixes.
6482 (class Parser_closure): Change language_stack_ from a vector of
6483 std::string to one of Version_script_info::Language. Adjust all
6484 uses accordingly.
6485 (class Lazy_demangler): Remove.
6486 (struct Version_expression): Change language from std::string to
6487 Version_script_info::Language.
6488 (Version_script_info::Version_script_info): New function.
6489 (Version_script_info::~Version_script_info): Don't call clear.
6490 (Version_script_info::finalize): New function.
6491 (Version_script_info::build_lookup_tables): New function.
6492 (Version_script_info::build_expression_list_lookup): New
6493 function.
6494 (Version_script_info::get_symbol_version_helper): Rewrite to use
6495 lookup tables.
6496 (Version_script_info::print_expression_list): Adjust to use
6497 Version_script_info::Language.
6498 (script_push_lex_into_version_mode): Check that the version script
6499 has not been finalized.
6500 (version_script_push_lang): Change language string to
6501 Version_script_info::Language.
6502 * options.cc (Command_line::version_script): New function.
6503 * options.h (class General_options): Add finalize_dynamic_list
6504 function. Change version_script from declaration to definition.
6505 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6506 * testsuite/version_script.map: Remove duplicate def of foo.
6507 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6508 version_script.map.
6509 * testsuite/Makefile.in: Rebuild.
6510
6511 2009-12-30 Ian Lance Taylor <iant@google.com>
6512
6513 PR 10843
6514 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6515 if the input symbol index is 0, make the output symbol index 0.
6516
6517 2009-12-30 Ian Lance Taylor <iant@google.com>
6518
6519 PR 10670
6520 * options.h (class General_options): Add -x/--discard-all.
6521 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6522 --discard-all. If the local symbol needs a dynamic entry, check
6523 that before handling --discard-locals.
6524
6525 2009-12-30 Ian Lance Taylor <iant@google.com>
6526
6527 PR 10450
6528 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6529 flags to PF_R.
6530 (Output_segment::add_output_section): Don't change the flags if
6531 the type is PT_TLS.
6532
6533 PR 10450
6534 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6535 GNU hash table if they need a dynamic value. Otherwise, don't add
6536 them if they are defined in a dynamic object or are forced local.
6537
6538 2009-12-29 Ian Lance Taylor <iant@google.com>
6539
6540 PR 10450
6541 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6542 .gnu.hash table for a 32-bit target.
6543
6544 PR 10450
6545 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6546 regular and a dynamic object only needs a dynamic symbol table
6547 entry if it is externally visible.
6548
6549 PR 10450
6550 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6551 constructor. Add global_offset_table_ field.
6552 (Target_i386::got_section): Set global_offset_table_.
6553 (Target_i386::do_finalize_sections): Set global_offset_table_
6554 size.
6555 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6556 in constructor. Add global_offset_table_ field.
6557 (Target_x86_64::got_section): Set global_offset_table_.
6558 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6559 size.
6560
6561 * layout.cc (Layout::Layout): Initialize increase_relro_.
6562 (Layout::get_output_section): Add is_relro, is_last_relro, and
6563 is_first_non_relro parameters. Change all callers.
6564 (Layout::choose_output_section): Likewise.
6565 (Layout::add_output_section_data): Likewise.
6566 (Layout::make_output_section): Likewise.
6567 (Layout::set_segment_offsets): Clear increase_relro when using a
6568 linker script.
6569 * layout.h (class Layout): Add increase_relro method. Add
6570 increase_relro_ field. Update declarations.
6571 * output.cc (Output_section::Output_section): Initialize
6572 is_last_relro_ and is_first_non_relro_.
6573 (Output_segment::add_output_section): Group relro sections is
6574 do_sort is true. Handle is_last_relro and is_first_non_relro.
6575 (Output_segment::maximum_alignment): Remove relro handling.
6576 (Output_segment::set_section_addresses): Add increase_relro
6577 parameter. Change all callers. Add initial alignment to align
6578 relro sections on separate page. Remove old relro handling.
6579 (Output_segment::set_section_list_addresses): Remove in_relro
6580 parameter. Change all callers.
6581 (Output_segment::set_offset): Add increase parameter. Change all
6582 callers. Remove old relro handling.
6583 * output.h (class Output_section): Add new methods: is_last_relro,
6584 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6585 Add is_last_relro_ and is_first_non_relro_ fields.
6586 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6587 Create separate .got.plt section. Call increase_relro.
6588 * x86_64.cc (Target_x86_64::got_section): Likewise.
6589 * testsuite/relro_script_test.t: Add .got.plt.
6590
6591 PR 10450
6592 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6593 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6594 (Layout::finalize): Call set_dynamic_symbol_size.
6595 (Layout::set_dynamic_symbol_size): New function.
6596 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6597 set_dynamic_symbol_size.
6598
6599 PR 10450
6600 * output.h (class Output_section): Add is_entsize_zero_ field.
6601 * output.cc (Output_section::Output_section): Initialize
6602 is_entsize_zero_.
6603 (Output_section::set_entsize): If two different entsizes are
6604 requested, force it to zero.
6605 (Output_section::add_input_section): Set flags for .debug_str
6606 before updating section flags. Set entsize.
6607 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6608 and SHF_STRING if all input sections have those flags.
6609
6610 2009-12-29 Rafael Espindola <espindola@google.com>
6611
6612 * main.cc (main): Fix the sys time reporting.
6613 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6614 reporting.
6615
6616 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6617
6618 * options.cc (General_options::parse_version): Allow -v to exit
6619 without an error if there is nothing to link.
6620
6621 2009-12-29 Ian Lance Taylor <iant@google.com>
6622
6623 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6624 using a version of gcc before 4.1.
6625 * configure: Rebuild.
6626
6627 2009-12-28 Chris Demetriou <cgd@google.com>
6628
6629 * attributes.cc (Output_attributes_section_data::do_write): Use
6630 std::vector::front rather than std::vector::data.
6631
6632 2009-12-28 Ian Lance Taylor <iant@google.com>
6633
6634 * symtab.h (class Symbol_table): Add enum Defined.
6635 * resolve.cc (Symbol_table::should_override): Add defined
6636 parameter. Change all callers. Test whether object is NULL
6637 before calling a method on it.
6638 (Symbol_table::report_resolve_problem): Add defined parameter.
6639 Change all callers.
6640 (Symbol_table::should_override_with_special): Likewise.
6641 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6642 parameter. Change all callers.
6643 (Symbol_table::do_define_in_output_data): Likewise.
6644 (Symbol_table::define_in_output_segment): Likewise.
6645 (Symbol_table::do_define_in_output_segment): Likewise.
6646 (Symbol_table::define_as_constant): Likewise.
6647 (Symbol_table::do_define_as_constant): Likewise.
6648 * script.h (class Symbol_assignment): Add is_defsym parameter to
6649 constructor; change all callers.
6650 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6651 parameter. Change all callers. Add is_defsym_ field.
6652 (class Parser_closure): Add parsing_defsym parameter to
6653 constructor; change all callers. Add parsing_defsym accessor
6654 function. Add parsing_defsym_ field.
6655
6656 2009-12-28 Ian Lance Taylor <iant@google.com>
6657
6658 * gold.cc (queue_middle_tasks): Fix formatting.
6659 * object.cc (Relobj::is_section_name_included): Likewise.
6660
6661 2009-12-23 Ian Lance Taylor <iant@google.com>
6662
6663 * i386.cc (Target_i386::do_calls_non_split): Recognize
6664 -fsplit-stack prologue for a function with a static chain.
6665 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6666 -fsplit-stack prologue when using %r11.
6667
6668 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6669
6670 * options.cc (General_options::parse_version): Make -v continue and do
6671 the link like GNU ld does.
6672
6673 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6674
6675 * Makefile.am (CCFILES): Add timer.cc.
6676 (HFILES): Add timer.h.
6677 * configure.ac: Check for sysconf and times.
6678 * main.cc: include timer.h.
6679 (main): Use Timer instead of get_run_time.
6680 * timer.cc: New.
6681 * timer.h: New.
6682 * workqueue.cc: include timer.h.
6683 (Workqueue::find_and_run_task):
6684 Report user, sys and wall time.
6685 * Makefile.in: Regenerate.
6686 * config.in: Regenerate.
6687 * configure: Regenerate.
6688
6689 2009-12-16 Doug Kwan <dougkwan@google.com>
6690
6691 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6692 sections.
6693 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6694 relaxed input sections.
6695 * output.cc (Output_section::find_relaxed_input_section): Change
6696 return type to Output_relaxed_input_section pointer. Adjust code
6697 for new type of relaxed_input_section_map_.
6698 * output.h (Output_section::find_relaxed_input_section): Change
6699 return type to Output_relaxed_input_section pointer.
6700 (Output_section::Output_relaxed_input_section_by_input_section_map):
6701 New type.
6702 (Output_section::relaxed_input_section_map_): Change type to
6703 Output_section::Output_relaxed_input_section_by_input_section_map.
6704 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6705 input section.
6706
6707 2009-12-15 Ian Lance Taylor <iant@google.com>
6708
6709 * layout.cc (Layout::create_shstrtab): Only write out after input
6710 sections if we are compressing debug sections.
6711
6712 2009-12-15 Ian Lance Taylor <iant@google.com>
6713
6714 * archive.cc (Archive::add_symbols): Only look up a symbol without
6715 a version if there is, in fact, a version.
6716
6717 2009-12-14 Ian Lance Taylor <iant@google.com>
6718
6719 Revert -Wshadow changes, all changes from:
6720 2009-12-11 Doug Kwan <dougkwan@google.com>
6721 2009-12-11 Nick Clifton <nickc@redhat.com>
6722 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6723
6724 2009-12-11 Doug Kwan <dougkwan@google.com>
6725
6726 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6727 due to -Wshadow.
6728 * attributes.cc (Object_attribute::size): Ditto.
6729 (Attributes_section_data::size): Ditto.
6730 (Attributes_section_data::Attributes_section_data): Ditto.
6731 (Output_attributes_section_data::do_write): Ditto.
6732 * attributes.h (Object_attribute::set_type): Ditto.
6733 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6734
6735 2009-12-11 Nick Clifton <nickc@redhat.com>
6736
6737 * archive.cc: Fix shadowed variable warnings.
6738 * arm.cc: Likewise.
6739 * compressed_output.cc: Likewise.
6740 * compressed_output.h: Likewise.
6741 * configure: Likewise.
6742 * dwarf_reader.cc: Likewise.
6743 * dynobj.cc: Likewise.
6744 * dynobj.h: Likewise.
6745 * ehframe.cc: Likewise.
6746 * ehframe.h: Likewise.
6747 * errors.cc: Likewise.
6748 * expression.cc: Likewise.
6749 * fileread.cc: Likewise.
6750 * fileread.h: Likewise.
6751 * freebsd.h: Likewise.
6752 * i386.cc: Likewise.
6753 * icf.cc: Likewise.
6754 * incremental.h: Likewise.
6755 * layout.cc: Likewise.
6756 * layout.h: Likewise.
6757 * mapfile.cc: Likewise.
6758 * merge.cc: Likewise.
6759 * merge.h: Likewise.
6760 * object.cc: Likewise.
6761 * object.h: Likewise.
6762 * options.h: Likewise.
6763 * output.cc: Likewise.
6764 * output.h: Likewise.
6765 * parameters.cc: Likewise.
6766 * plugin.cc: Likewise.
6767 * powerpc.cc: Likewise.
6768 * reduced_debug_output.cc: Likewise.
6769 * reduced_debug_output.h: Likewise.
6770 * reloc.cc: Likewise.
6771 * reloc.h: Likewise.
6772 * resolve.cc: Likewise.
6773 * script-sections.cc: Likewise.
6774 * script.cc: Likewise.
6775 * script.h: Likewise.
6776 * sparc.cc: Likewise.
6777 * symtab.cc: Likewise.
6778 * symtab.h: Likewise.
6779 * target-select.cc: Likewise.
6780 * target-select.h: Likewise.
6781 * token.h: Likewise.
6782 * workqueue.cc: Likewise.
6783 * workqueue.h: Likewise.
6784 * x86_64.cc: Likewise.
6785
6786 2009-12-10 Doug Kwan <dougkwan@google.com>
6787
6788 * arm.cc (attributes.h): New include.
6789 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6790 (Arm_relobj::~Arm_relobj): Delete object pointed by
6791 attributes_section_data_.
6792 (Arm_relobj::attributes_section_data): New method definition.
6793 (Arm_relobj::attributes_section_data_): New data member declaration.
6794 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6795 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6796 attributes_section_data_.
6797 (Arm_dynobj::attributes_section_data): New method definition.
6798 (Arm_dynobj::attributes_section_data_): New data member declaration.
6799 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6800 initialization value of may_use_blx_ to false.
6801 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6802 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6803 object attributes to compute results instead of hard-coding.
6804 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6805 Target_arm::get_secondary_compatible_arch,
6806 Target_arm::set_secondary_compatible_arch
6807 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6808 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6809 New method declarations.
6810 (Target_arm::get_aeabi_object_attribute): New method definition.
6811 (Target_arm::attributes_section_data_): New data member declaration.
6812 (read_arm_attributes_section): New template definition.
6813 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6814 (Arm_dynobj::do_read_symbols): Ditto.
6815 (Target_arm::do_finalize_sections): Merge attributes sections from
6816 input. Check for BLX use after attributes section merging.
6817 Fix __exidx_start and __exidx_end visibility. Create an
6818 .ARM.attributes section if necessary.
6819 (Target_arm::get_secondary_compatible_arch,
6820 Target_arm::set_secondary_compatible_arch,
6821 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6822 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6823 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6824 New method definitions.
6825
6826 2009-12-09 Ian Lance Taylor <iant@google.com>
6827
6828 * plugin.cc (Plugin::load): Don't cast from void* to a function
6829 pointer.
6830
6831 2009-12-09 Ian Lance Taylor <iant@google.com>
6832
6833 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6834 information fields.
6835
6836 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6837
6838 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6839 Replace two_file_shared_1.so with two_file_shared_2.so.
6840 * testsuite/Makefile.in: Regenerated.
6841
6842 2009-12-08 Doug Kwan <dougkwan@google.com>
6843
6844 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6845 (HFILES): Add attributes.h and int_encoding.h.
6846 * Makefile.in: Regenerate.
6847 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6848 function definitions to int_encoding.cc
6849 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6850 prototypes to int_encoding.h
6851 * reduced_debug_output.cc (int_encoding.h): New include.
6852 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6853 function definitions to int_encoding.cc
6854 (insert_into_vector, read_from_pointer): Move template definitions to
6855 int_encoding.h
6856 * attributes.cc: New file.
6857 * attributes.h: New file.
6858 * int_encoding.cc: New file.
6859 * int_encoding.h: New file.
6860
6861 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6862
6863 PR gold/11055
6864 * incremental-dump.cc (dump_incremental_inputs): New.
6865 (main): Use dump_incremental_inputs.
6866
6867 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6868
6869 PR gold/10893
6870 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6871 checking elfcpp::STT_FUNC.
6872 (Target_i386::Relocate::relocate): Likewise.
6873 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6874
6875 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6876 symbols from shared libraries into normal FUNC symbols.
6877
6878 * symtab.h (Symbol): Add is_func and use it.
6879
6880 2009-12-05 Doug Kwan <dougkwan@google.com>
6881
6882 * arm.cc (Target_arm::arm_info): Initialize new fields
6883 attributes_section and attributes_vendor.
6884 * i386.cc (Target_i386::i386_info): Same.
6885 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6886 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6887 fields attributes_section and attributes_vendor.
6888 * sparc.cc (Target_sparc::sparc_info): Same.
6889 * target.h (Target::attributes_section, Target::attributes_vendor,
6890 Target::is_attributes_section, Target::attribute_arg_type,
6891 Target::attributes_order): New method definitions.
6892 (Target::Target_info::attributes_section,
6893 Target::Target_info::attributes_vendor): New fields.
6894 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6895 virtual method definitions.
6896 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6897 attributes_section and attributes_vendor.
6898 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6899
6900 2009-12-05 Doug Kwan <dougkwan@google.com>
6901
6902 * arm.cc: Update comments about interworking and stub generation.
6903 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6904 considered as non-PIC.
6905 (Arm_relocate_functions::base_abs): Fix formatting.
6906 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6907 of function to use GOT entry address instead of offset.
6908 (Target_arm::Scan::global): Issue an error if a symbol would need a
6909 PLT does not get one because it is untyped. Remove code to create
6910 dynamic symbols for relative branches.
6911 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6912 takes unsigned integer instead of boolean.
6913
6914 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6915
6916 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6917 (two_file_test_LDADD): Likewise.
6918 (common_test_1_LDADD): Likewise.
6919 (exception_test_LDADD) Likewise.
6920 (weak_test_LDADD): Likewise.
6921 (many_sections_test_LDADD): Likewise.
6922 (initpri1_LDADD): Likewise.
6923 (script_test_1_LDADD): Likewise.
6924 (script_test_2_LDADD): Likewise.
6925 (justsyms_LDADD): Likewise.
6926 (binary_test_LDADD): Likewise.
6927 (large_LDADD): Likewise.
6928 * testsuite/Makefile.in: Regenerated.
6929
6930 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6931
6932 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6933 (Symbol_table::override_with_special): Likewise.
6934 (Symbol_table::add_from_object): Likewise.
6935
6936 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6937
6938 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6939 Don't set the data_offset twice.
6940
6941 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6942
6943 * testsuite/Makefile.in: Regenerate.
6944
6945 2009-12-03 Doug Kwan <dougkwan@google.com>
6946
6947 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6948 (Target_arm::do_finalize_sections): Add parameter for symbol table
6949 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6950 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6951 parameter for symbol table pointer.
6952 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6953 an additional parameter for a pointer to symbol table.
6954 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6955 parameter for a symbol table pointer.
6956 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6957 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6958 Ditto.
6959 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6960 parameter for a symbol table pointer.
6961
6962 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6963
6964 * incremental.cc (Incremental_inputs_header)
6965 (Incremental_inputs_header_write, Incremental_inputs_entry)
6966 (Incremental_inputs_entry_write): Move ...
6967 * incremental.h (Incremental_inputs_header)
6968 (Incremental_inputs_header_write, Incremental_inputs_entry)
6969 (Incremental_inputs_entry_write): here.
6970
6971 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6972
6973 * incremental.cc (make_sized_incremental_binary): Set the target.
6974 Error if it is incompatible.
6975 * output.h (Output_file): Add filename method.
6976
6977 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6978
6979 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6980 from the get_* methods.
6981
6982 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6983
6984 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6985 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6986 Write 0 for the data_offset of scripts.
6987
6988 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6989
6990 * testsuite/Makefile.am: Add the incremental_test.sh test.
6991 * testsuite/incremental_test.sh: New.
6992 * testsuite/incremental_test_1.c: New.
6993 * testsuite/incremental_test_2.c: New.
6994
6995 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6996
6997 * incremental-dump.cc (main): Fix typos.
6998
6999 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
7000
7001 PR gold/11025
7002 * incremental-dump.cc (main): Use llu to print 64 bit values.
7003
7004 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7005 H.J. Lu <hongjiu.lu@intel.com>
7006
7007 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7008 $(LIBDL).
7009 (incremental_dump_LDADD): Likewise.
7010 * Makefile.in: Regenerated.
7011
7012 2009-11-25 Doug Kwan <dougkwan@google.com>
7013
7014 Revert:
7015
7016 2009-11-25 Doug Kwan <dougkwan@google.com>
7017
7018 * arm.cc (Target_arm::Target_arm): Move method definition
7019 outside of class definition. Add code to handle
7020 --target1-rel, --target1-abs and --target2= options.
7021 (Target_arm::get_reloc_reloc_type): Change method to be
7022 non-static and const.
7023 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7024 New data member declaration.
7025 (Target_arm::Scan::local, Target_arm::Scan::global,
7026 Target_arm::Relocate::relocate,
7027 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7028 Adjust call to Target_arm::get_real_reloc_type.
7029 (Target_arm::get_real_reloc_type): Use command line options
7030 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7031 * options.h (--target1-rel, --target1-abs, --target2): New
7032 ARM-only options.
7033
7034 2009-11-25 Doug Kwan <dougkwan@google.com>
7035
7036 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7037 class definition. Add code to handle --target1-rel, --target1-abs
7038 and --target2= options.
7039 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7040 and const.
7041 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7042 member declaration.
7043 (Target_arm::Scan::local, Target_arm::Scan::global,
7044 Target_arm::Relocate::relocate,
7045 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7046 call to Target_arm::get_real_reloc_type.
7047 (Target_arm::get_real_reloc_type): Use command line options to
7048 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7049 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7050 options.
7051
7052 2009-11-25 Doug Kwan <dougkwan@google.com>
7053
7054 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7055 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7056 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7057 formatting.
7058 (Arm_relocate_functions::thm_call): Replace body with a call to
7059 Arm_relocate_functions::thumb_branch_common.
7060 (Arm_relocate_functions::thm_jump24,
7061 Arm_relocate_functions::thm_xpc22): New method definitions.
7062 (Arm_relocate_functions::thumb_branch_common): New method definition.
7063 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7064 operator.
7065 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7066 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7067
7068 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7069
7070 * Makefile.am: Build incremental-dump
7071 * Makefile.in: Regenerate.
7072 * incremental-dump.cc: New.
7073 * incremental.cc (Incremental_inputs_header_data,
7074 Incremental_inputs_entry_data): Move to incremental.h
7075 * incremental.h: (Incremental_inputs_header_data,
7076 Incremental_inputs_entry_data): Move from incremental.cc
7077
7078 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7079
7080 * incremental.cc (Incremental_inputs_header,
7081 Incremental_inputs_header_write, Incremental_inputs_entry,
7082 Incremental_inputs_entry_write): Add a typedef with the data type.
7083
7084 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
7085
7086 * incremental.cc (Incremental_inputs_header,
7087 Incremental_inputs_header_write, Incremental_inputs_entry,
7088 Incremental_inputs_entry_write): Update comment about which
7089 type has the filed descriptions.
7090
7091 2009-11-15 Doug Kwan <dougkwan@google.com>
7092
7093 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7094 (Arm_relocate_functions::arm_branch_common): Change method defintion
7095 in class definition to a method declaration and update list of formal
7096 parameters.
7097 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7098 Arm_relocation_functions::jump24): Adjust call to
7099 Arm_relocate_functions::arm_branch_common. Update list of formal
7100 parameters.
7101 (Arm_relocate_functions::xpc25): New method definition.
7102 (Arm_relocate_functions::arm_branch_common): Move method defintion
7103 out from class definition. Use stubs for mode-switching and extending
7104 branch ranges.
7105 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7106 specially. Change code to enable use of stubs in ARM branches.
7107
7108 2009-11-10 Doug Kwan <dougkwan@google.com>
7109
7110 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7111 in method declaration.
7112 (Target_arm::relocate_stub): New method declaration.
7113 (Target_arm::default_target): Change to return a pointer instead of
7114 a const reference.
7115 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7116 Target_arm::default_target.
7117 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7118 method definition.
7119 (Target_arm::relocate_section): Adjust view.
7120 (Target_arm::relocate_stub): New method definition.
7121
7122 2009-11-10 Doug Kwan <dougkwan@google.com>
7123
7124 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7125 a format warning.
7126 * incremental.cc (open_incremental_binary): Initialized local
7127 variables to avoid warnings.
7128 * object.cc (make_elf_object): Ditto.
7129 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7130 a format warning.
7131
7132 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7133
7134 PR gold/10930
7135 * testsuite/plugin_test.c: Include "config.h".
7136
7137 2009-11-09 Doug Kwan <dougkwan@google.com>
7138
7139 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7140 (arm_symbol_value): Remove.
7141 (Arm_relocate_functions::arm_branch_common,
7142 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7143 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7144 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7145 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7146 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7147 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7148 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7149 Arm_relocate_functions::thm_mobw_abs_nc,
7150 Arm_relocate_functions::thm_mov_abs,
7151 Arm_relocate_functions::movw_prel_nc,
7152 Arm_relocate_functions::thm_movt_abs,
7153 Arm_relocate_functions::movt_prel,
7154 Arm_relocate_functions::thm_movw_prel_nc,
7155 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7156 (Target_arm::Relocate::relocate): Only decompose address into two
7157 parts if relocation type uses the thumb-bit and pass the actual
7158 bit instead of a flag indicating that the thumb-bit is used. Adjust
7159 calls to methods in Arm_relocate_functions for this change.
7160
7161 2009-11-08 Ian Lance Taylor <iant@google.com>
7162
7163 PR 10925
7164 * reloc.cc: Instantiate
7165 Sized_relobj::initialize_input_to_output_maps and
7166 Sized_relobj:free_input_to_output_maps.
7167
7168 2009-11-06 Ian Lance Taylor <iant@google.com>
7169
7170 PR 10876
7171 * defstd.cc (in_segment): Set only_if_ref true for "end".
7172
7173 2009-11-06 Doug Kwan <dougkwan@google.com>
7174
7175 * arm.cc (class Reloc_stub): Correct a comment.
7176 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7177 (Target_arm::scan_section_for_stubs): New method declaration.
7178 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7179 Change methods from private to protected.
7180 (Target_arm::do_may_relax): New method definition.
7181 (Target_arm::do_relax, Target_arm::group_sections,
7182 Target_arm::scan_reloc_for_stub,
7183 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7184 (Target_arm::arm_input_section_map_): New data member declaration.
7185 (Target_arm::scan_reloc_for_stub,
7186 Target_arm::scan_reloc_section_for_stubs,
7187 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7188 Target_arm::do_relax): New method definitions.
7189
7190 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7191
7192 * configure.ac: Check for (struct stat)::st_mtim
7193 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7194 * config.in: Regenerate.
7195 * configure: Regenerate.
7196
7197 2009-11-05 Ian Lance Taylor <iant@google.com>
7198
7199 PR 10910
7200 * output.cc (Output_segment::add_output_section): Add missing
7201 return statement.
7202
7203 2009-11-04 Ian Lance Taylor <iant@google.com>
7204
7205 PR 10880
7206 * object.h (class Object): Add is_needed and set_is_needed
7207 methods. Add is_needed_ field. Make bool fields into bitfields.
7208 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7209 defined in a dynamic object and referenced by a regular object,
7210 set is_needed for the dynamic object.
7211 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7212 if the file is marked with as_needed and it is not needed.
7213
7214 2009-11-04 Ian Lance Taylor <iant@google.com>
7215
7216 PR 10887
7217 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7218 tags if data is discarded by linker script.
7219 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7220 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7221 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7222 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7223
7224 2009-11-04 Ian Lance Taylor <iant@google.com>
7225
7226 * layout.cc (Layout::get_output_section): Add is_interp and
7227 is_dynamic_linker_section parameters. Change all callers.
7228 (Layout::choose_output_section): Likewise.
7229 (Layout::make_output_section): Likewise.
7230 (Layout::add_output_section_data): Add is_dynamic_linker_section
7231 parameter. Change all callers.
7232 * layout.h (class Layout): Update declarations.
7233 * output.h (class Output_section): Add is_interp, set_is_interp,
7234 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7235 Add is_interp_, is_dynamic_linker_section_ fields. Change
7236 generate_code_fills_at_write_ to a bitfield.
7237 * output.cc (Output_section::Output_sections): Initialize new
7238 fields.
7239 (Output_segment::add_output_section): Add do_sort parameter.
7240 Change all callers.
7241
7242 2009-11-03 Ian Lance Taylor <iant@google.com>
7243
7244 PR 10860
7245 * options.h (class General_options): Add --warn-common.
7246 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7247 merging two common symbols.
7248 (Symbol_table::should_override): Handle --warn-common when merging
7249 a common symbol with a defined symbol. Use report_resolve_problem
7250 for multiple definitions.
7251 (Symbol_table::report_resolve_problem): New function.
7252 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7253
7254 2009-11-03 Doug Kwan <dougkwan@google.com>
7255
7256 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7257 stub_factory_.
7258 (Target_arm::stub_factory): New method definition.
7259 (Target_arm::new_arm_input_section,
7260 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7261 Target_arm::reloc_uses_thumb_bit): New method declarations.
7262 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
7263 New type definitions.
7264 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7265 member declarations.
7266 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7267 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7268 New method definitions.
7269
7270 2009-11-03 Ian Lance Taylor <iant@google.com>
7271
7272 * options.h (class General_options): Add --warn_constructors.
7273
7274 2009-11-03 Ian Lance Taylor <iant@google.com>
7275
7276 PR 10893
7277 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7278 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7279
7280 2009-11-03 Ian Lance Taylor <iant@google.com>
7281
7282 PR 10895
7283 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7284 --msgid-bugs-address.
7285 (install-pdf): New target.
7286 (install-data_yes): Look up one directory to find mkinstalldirs.
7287
7288 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7289
7290 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7291 tree.
7292
7293 2009-10-30 Doug Kwan <dougkwan@google.com>
7294
7295 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7296
7297 2009-10-30 Doug Kwan <dougkwan@google.com>
7298
7299 * arm.cc (Stub_addend_reader): New struct template definition
7300 and partial specializations.
7301 (Stub_addend_reader::operator()): New method definition for a
7302 partially specialized template.
7303
7304 2009-10-30 Doug Kwan <dougkwan@google.com>
7305
7306 * arm.cc (Arm_relobj::processor_specific_flags): New method
7307 definition.
7308 (Arm_relobj::do_read_symbols): New method declaration.
7309 (Arm_relobj::processor_specific_flags_): New data member declaration.
7310 (Arm_dynobj): New class definition.
7311 (Target_arm::do_finalize_sections): Add input_objects parameter.
7312 (Target_arm::do_adjust_elf_header): New method declaration.
7313 (Target_arm::are_eabi_versions_compatible,
7314 (Target_arm::merge_processor_specific_flags): New method declaration.
7315 (Target_arm::do_make_elf_object): New overloaded method definitions
7316 and declaration.
7317 (Arm_relobj::do_read_symbols): New method definition.
7318 (Arm_dynobj::do_read_symbols): Ditto.
7319 (Target_arm::do_finalize_sections): Add input_objects parameters.
7320 Merge processor-specific flags from all input objects.
7321 (Target_arm::are_eabi_versions_compatible,
7322 Target_arm::merge_processor_specific_flags,
7323 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7324 New method definitions.
7325 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7326 Input_objects pointer type parameter.
7327 * layout.cc (Layout::finalize): Pass input objects to target's.
7328 finalize_sections function.
7329 * output.cc (Output_file_header::do_sized_write): Set ELF file
7330 header's processor-specific flags.
7331 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7332 Input_objects pointer type parameter.
7333 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7334 * target.h (Input_objects): New forward class declaration.
7335 (Target::processor_specific_flags,
7336 Target::are_processor_specific_flags_sect): New method definitions.
7337 (Target::finalize_sections): Add input_objects parameter.
7338 (Target::Target): Initialize processor_specific_flags_ and
7339 are_processor_specific_flags_set_.
7340 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7341 parameter.
7342 (Target::set_processor_specific_flags): New method definition.
7343 (Target::processor_specific_flags_,
7344 Target::are_processor_specific_flags_set_): New data member
7345 declarations.
7346 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7347 Input_objects pointer type parameter.
7348
7349 2009-10-30 Doug Kwan <dougkwan@google.com>
7350
7351 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7352
7353 2009-10-28 Ian Lance Taylor <iant@google.com>
7354
7355 * object.h (class Relobj): Drop options parameter from
7356 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7357 do_scan_relocs, do_relocate. Change all callers.
7358 (class Sized_relobj): Drop options parameters from
7359 do_gc_process_relocs, do_scan_relocs, do_relocate,
7360 do_relocate_sections, relocate_sections, emit_relocs_scan,
7361 emit_relocs_scan_reltype. Change all callers.
7362 (struct Relocate_info): Remove options field and all references to
7363 it.
7364 * reloc.h (class Read_relocs): Remove options constructor
7365 parameter and options_ field. Change all callers.
7366 (class Gc_process_relocs, class Scan_relocs): Likewise.
7367 (class Relocate_task): Likewise.
7368 * target-reloc.h (scan_relocs): Remove options parameter. Change
7369 all callers.
7370 (scan_relocatable_relocs): Likewise.
7371 * target.h (class Sized_target): Remove options parameter from
7372 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7373 all callers.
7374 * gc.h (gc_process_relocs): Remove options parameter. Change all
7375 callers.
7376 * arm.cc: Update functions to remove options parameters.
7377 * i386.cc: Likewise.
7378 * powerpc.cc: Likewise.
7379 * sparc.cc: Likewise.
7380 * x86_64.cc: Likewise.
7381 * testsuite/testfile.cc: Likewise.
7382
7383 2009-10-28 Doug Kwan <dougkwan@google.com>
7384
7385 * arm.cc (Arm_relobj): New class definition.
7386 (Arm_relobj::scan_sections_for_stubs,
7387 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7388 New method definitions.
7389
7390 2009-10-28 Cary Coutant <ccoutant@google.com>
7391
7392 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7393 (Plugin::cleanup_done_): New member.
7394 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7395 (Plugin_manager::cleanup_done_): Remove.
7396 (Plugin_manager::add_input_file): Edit error message.
7397 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7398 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7399
7400 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7401
7402 * fileread.cc: (File_read::View::~View): Use the new
7403 data_ownership_ filed.
7404 (File_read::~File_read): Dispose the new whole_file_view_.
7405 (File_read::open): Mmap the whole file if needed.
7406 (File_read::open): Use whole_file_view_ instead of contents_.
7407 (File_read::find_view): Use whole_file_view_ if applicable.
7408 (File_read::do_read): Use whole_file_view_ instead of contents_.
7409 (File_read::make_view): Use whole_file_view_ instead of contents_,
7410 update File_read::View::View call.
7411 (File_read::find_or_make_view): Update File_read::View::View
7412 call.
7413 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7414 remove contents_
7415 (File_read::View::Data_ownership): New enum.
7416 (File_read::View::View): Replace bool mapped_ with Data_ownership
7417 argument.
7418 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7419 (File_read::View::data_ownership_): New field.
7420 (File_read::contents_): Remove (replaced by whole_file_view_).
7421 (File_read::whole_file_view_): New field.
7422 * options.h (class General_options): Add --keep-files-mapped.
7423
7424 2009-10-27 Cary Coutant <ccoutant@google.com>
7425
7426 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7427 * testsuite/Makefile.am (plugin_test_5): New test case.
7428 * testsuite/Makefile.in: Regenerate.
7429
7430 2009-10-25 Doug Kwan <dougkwan@google.com>
7431
7432 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7433 from private to protected to allow access by child class.
7434 (Sized_relobj::do_relocate_sections): New method declaration.
7435 (Sized_relobj::relocate_sections): Virtualize.
7436 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
7437 Sized_relobj::relocate_sections. Instantiate template explicitly
7438 for different target sizes and endianity.
7439
7440 2009-10-24 Doug Kwan <dougkwan@google.com>
7441
7442 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7443 (Arm_input_section::as_arm_input_section): New method.
7444 (Arm_output_section): New class definition.
7445 (Arm_output_section::create_stub_group,
7446 Arm_output_section::group_sections): New method definitions.
7447
7448 2009-10-22 Doug Kwan <dougkwan@google.com>
7449
7450 * arm.cc (Arm_input_section): New class definition.
7451 (Arm_input_section::init, Arm_input_section:do_write,
7452 Arm_input_section::set_final_data_size,
7453 Arm_input_section::do_reset_address_and_file_offset): New method
7454 definitions.
7455
7456 2009-10-21 Doug Kwan <dougkwan@google.com>
7457
7458 * arm.cc (Stub_table, Arm_input_section): New forward class
7459 declarations.
7460 (Stub_table): New class defintion.
7461 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7462 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7463 New method definition.
7464
7465 2009-10-21 Doug Kwan <dougkwan@google.com>
7466
7467 * arm.cc: Update copyright comments.
7468 (Target_arm): New forward class template declaration.
7469 (Arm_address): New type.
7470 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7471 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7472 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7473 constants.
7474 (Insn_template): Same.
7475 (DEF_STUBS): New macro.
7476 (Stub_type): New enum type.
7477 (Stub_template): New class definition.
7478 (Stub): Same.
7479 (Reloc_stub): Same.
7480 (Stub_factory): Same.
7481 (Target_arm::Target_arm): Initialize may_use_blx_ and
7482 should_force_pic_veneer_.
7483 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7484 Target_arm::should_force_pic_veneer,
7485 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7486 Target_arm::using_thumb_only, Target_arm:;default_target): New
7487 method defintions.
7488 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7489 New data member declarations.
7490 (Insn_template::size, Insn_template::alignment): New method defintions.
7491 (Stub_template::Stub_template): New method definition.
7492 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7493 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7494 (Stub_factory::Stub_factory): New method definition.
7495 * gold.h (string_hash): New template.
7496 * output.h (Input_section_specifier::hash_value): Use
7497 gold::string_hash.
7498 (Input_section_specifier::string_hash): Remove.
7499 * stringpool.cc (Stringpool_template::string_hash): Use
7500 gold::string_hash.
7501
7502 2009-10-20 Doug Kwan <dougkwan@google.com>
7503
7504 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7505 symbols of relaxed input sections.
7506 * output.h (Output_section::find_relaxed_input_section): Make
7507 method public.
7508
7509 2009-10-16 Doug Kwan <dougkwan@google.com>
7510
7511 * dynobj.cc (Versions::Versions): Initialize version_script_.
7512 Only insert base version symbol definition for a shared object
7513 if version script defines any version versions.
7514 (Versions::define_base_version): New method definition.
7515 (Versions::add_def): Check that base version is not needed.
7516 (Versions::add_need): Define base version lazily.
7517 * dynobj.h (Versions::define_base_version): New method declaration.
7518 (Versions::needs_base_version_): New data member declaration.
7519 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7520 (check_DATA): Add no_version_test.stdout.
7521 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7522 New make rules.
7523 * testsuite/Makefile.in: Regenerate.
7524 * testsuite/no_version_test.c: New file.
7525 * testsuite/no_version_test.sh: Ditto.
7526
7527 2009-10-16 Doug Kwan <dougkwan@google.com>
7528
7529 * expression.cc (class Segment_start_expression): New class definition.
7530 (Segment_start_expression::value): New method definition.
7531 (script_exp_function_segment_start): Return a new
7532 Segment_start_expression.
7533 * gold/script-c.h (script_saw_segment_start_expression): New function
7534 prototype.
7535 * script-sections.cc (Script_sections::Script_sections): Initialize
7536 SAW_SEGMENT_START_EXPRESSION_ to false.
7537 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7538 and -Tbbs options to specify section addresses if given in
7539 command line and no SEGMENT_START expression is seen in a script.
7540 * script-sections.h (Script_sections::saw_segment_start_expression,
7541 Script_sections::set_saw_segment_start_expression): New method
7542 definition.
7543 (Script_sections::saw_segment_start_expression_): New data member
7544 declaration.
7545 * script.cc (script_saw_segment_start_expression): New function.
7546 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7547 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7548 script_test_7.sh and script_test_8.sh.
7549 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7550 script_test_8.stdout.
7551 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7552 (script_test_6, script_test_6.stdout, script_test_7,
7553 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7554 * Makefile.in: Regenerate.
7555 * testsuite/script_test_6.sh: New file.
7556 * testsuite/script_test_6.t: Same.
7557 * testsuite/script_test_7.sh: Same.
7558 * testsuite/script_test_7.t: Same.
7559 * testsuite/script_test_8.sh: Same.
7560
7561 2009-10-16 Doug Kwan <dougkwan@google.com>
7562
7563 * output.cc (Output_segment::set_section_list_address): Cast
7564 expressions to unsigned long long type to avoid format warnings.
7565
7566 2009-10-15 Ian Lance Taylor <iant@google.com>
7567
7568 * script.cc (Script_options::add_symbol_assignment): Always add a
7569 dot assignment to script_sections_.
7570 * script-sections.cc (Script_sections::add_dot_assignment):
7571 Initialize if necessary.
7572
7573 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7574 program headers with no load segment if there is a linker script.
7575
7576 * layout.cc (Layout::set_segment_offsets): Align the file offset
7577 to the segment aligment for -N or -n with no load segment.
7578 * output.cc (Output_segment::add_output_section): Don't crash if
7579 the first section is a TLS section.
7580 (Output_segment::set_section_list_addresses): Print an error
7581 message if the address moves backward in a linker script.
7582 * script-sections.cc
7583 (Output_section_element_input::set_section_addresses): Don't
7584 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7585 (Orphan_output_section::set_section_addresses): Likewise.
7586
7587 2009-10-15 Doug Kwan <dougkwan@google.com>
7588
7589 * layout.cc (Layout::finish_dynamic_section): Generate tags
7590 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7591 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7592 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7593
7594 2009-10-14 Ian Lance Taylor <iant@google.com>
7595
7596 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7597 fields.
7598 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7599 data_shdr fields of relinfo.
7600 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7601 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7602 R_386_TLS_LDO_32, adjust based on section flags.
7603 (Target_i386::Relocate::fix_up_ldo): Remove.
7604
7605 2009-10-13 Ian Lance Taylor <iant@google.com>
7606
7607 Add support for -pie.
7608 * options.h (class General_options): Add -pie and
7609 --pic-executable.
7610 (General_options::output_is_position_independent): Test -pie.
7611 (General_options::output_is_executable): Return true if not shared
7612 and not relocatable.
7613 (General_options::output_is_pie): Remove.
7614 * options.cc (General_options::finalize): Reject incompatible uses
7615 of -pie.
7616 * gold.cc (queue_middle_tasks): A -pie link is not static.
7617 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7618 * symtab.cc (Symbol::final_value_is_known): Return false if
7619 output_is_position_independent.
7620 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7621 output_is_position_independent.
7622 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7623 output_is_position_independent.
7624 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7625 output_is_position_independent.
7626 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7627 two_file_pie_test.
7628 (basic_pie_test.o, basic_pie_test): New targets.
7629 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7630 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7631 (two_file_pie_test): New target.
7632 * testsuite/Makefile.in: Rebuild.
7633 * README: Remove note saying that -pie is not supported.
7634
7635 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7636
7637 * options.h (class General_options): Add -init and -fini.
7638 * layout.cc (Layout::finish_dynamic_section): Emit
7639 given init and fini functions.
7640
7641 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7642
7643 * gc.h (gc_process_relocs): Check if icf is enabled using new
7644 function.
7645 * gold.cc (queue_initial_tasks): Likewise.
7646 (queue_middle_tasks): Likewise.
7647 * object.cc (do_layout): Likewise.
7648 * symtab.cc (is_section_folded): Likewise.
7649 * main.cc (main): Likewise.
7650 * reloc.cc (Read_relocs::run): Likewise.
7651 (Sized_relobj::do_scan_relocs): Likewise.
7652 * icf.cc (is_function_ctor_or_dtor): New function.
7653 (Icf::find_identical_sections): Check if function is ctor or dtor when
7654 safe icf is chosen.
7655 * options.h (General_options::icf): Change option to be an enum.
7656 (Icf_status): New enum.
7657 (icf_enabled): New method.
7658 (icf_safe_folding): New method.
7659 (set_icf_status): New method.
7660 (icf_status_): New variable.
7661 * (options.cc) (General_options::finalize): Set icf_status_.
7662 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7663 icf_test and icf_keep_unique_test to use the --icf enum flag.
7664 * testsuite/icf_safe_test.sh: New file.
7665 * testsuite/icf_safe_test.cc: New file.
7666
7667 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7668
7669 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7670 includes to gc.h and icf.h.
7671 * arm.cc: Include gc.h.
7672 * gold.cc: Likewise.
7673 * i386.cc: Likewise.
7674 * powerpc.cc: Likewise.
7675 * sparc.cc: Likewise.
7676 * x86_64.cc: Likewise.
7677 * gc.h: Include icf.h.
7678
7679 2009-10-11 Ian Lance Taylor <iant@google.com>
7680
7681 * plugin.cc: Include "gold.h" before other header files.
7682
7683 2009-10-10 Chris Demetriou <cgd@google.com>
7684
7685 * options.h (Input_file_argument::Input_file_type): New enum.
7686 (Input_file_argument::is_lib_): Replace with...
7687 (Input_file_argument::type_): New member.
7688 (Input_file_argument::Input_file_argument): Take Input_file_type
7689 'type' rather than boolean 'is_lib' as second argument.
7690 (Input_file_argument::is_lib): Use type_.
7691 (Input_file_argument::is_searched_file): New function.
7692 (Input_file_argument::may_need_search): Handle is_searched_file.
7693 * options.cc (General_options::parse_library): Support -l:filename.
7694 (General_options::parse_just_symbols): Update for Input_file_argument
7695 changes.
7696 (Command_line::process): Likewise.
7697 * archive.cc (Archive::get_file_and_offset): Likewise.
7698 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7699 * script.cc (read_script_file, script_add_file): Likewise.
7700 * fileread.cc (Input_file::Input_file): Likewise.
7701 (Input_file::will_search_for): Handle is_searched_file.
7702 (Input_file::open): Likewise.
7703 * readsyms.cc (Read_symbols::get_name): Likewise.
7704 * testsuite/Makefile.am (searched_file_test): New test.
7705 * testsuite/Makefile.in: Regenerate.
7706 * testsuite/searched_file_test.cc: New file.
7707 * testsuite/searched_file_test_lib.cc: New file.
7708
7709 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7710 Ian Lance Taylor <iant@google.com>
7711
7712 * descriptor.cc: Include <cstdio> and "binary-io.h".
7713 (Descriptors::open): Open the files in binary mode always.
7714 * script.cc (Lex::get_token): Treat \r as whitespace.
7715
7716 2009-10-09 Ian Lance Taylor <iant@google.com>
7717
7718 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7719
7720 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7721 Ian Lance Taylor <iant@google.com>
7722
7723 * configure.ac: Check for readv function also.
7724 * fileread.cc (readv): Define if not HAVE_READV.
7725 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7726 does not exist.
7727 * config.in: Regenerate.
7728 * configure: Regenerate.
7729
7730 2009-10-09 Doug Kwan <dougkwan@google.com>
7731
7732 * layout.cc (Layout::make_output_section): Call target hook to make
7733 ordinary output section.
7734 (Layout::finalize): Adjust parameter list of call the
7735 Target::may_relax().
7736 * layout.h (class Layout::section_list): New method.
7737 * merge.h (Output_merge_base::entsize): Change visibility to public.
7738 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7739 New methods.
7740 (Output_merge_string::do_is_string): New method.
7741 * object.cc (Sized_relobj::do_setup): renamed from
7742 Sized_relobj::set_up.
7743 * object.h (Sized_relobj::adjust_shndx,
7744 Sized_relobj::initializ_input_to_output_maps,
7745 Sized_relobj::free_input_to_output_maps): Change visibilities to
7746 protected.
7747 (Sized_relobj::setup): Virtualize.
7748 (Sized_relobj::do_setup): New method declaration.
7749 (Sized_relobj::invalidate_section_offset,
7750 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7751 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7752 * options.cc (parse_int): New function.
7753 * options.h (parse_int): New declaration.
7754 (DEFINE_int): New macro.
7755 (stub_group_size): New option.
7756 * output.cc (Output_section::Output_section): Initialize memebers
7757 merge_section_map_, merge_section_by_properties_map_,
7758 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7759 (Output_section::add_input_section): Handled deferred code-fill
7760 generation and remove an old comment.
7761 (Output_section::add_relaxed_input_section): New method definition.
7762 (Output_section::add_merge_input_section): Use merge section by
7763 properties map to speed to search. Update merge section maps
7764 as appropriate.
7765 (Output_section::build_relaxation_map): New method definition.
7766 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7767 Same.
7768 (Output_section::relax_input_section): Renamed to
7769 Output_section::convert_input_sections_to_relaxed_sections and change
7770 interface to take a vector of pointers to relaxed sections.
7771 (Output_section::find_merge_section,
7772 Output_section::find_relaxed_input_section): New method definitions.
7773 (Output_section::is_input_address_mapped,
7774 Output_section::output_offset, Output_section::output_address):
7775 Use output section data maps to speed up searching.
7776 (Output_section::find_starting_output_address): Add comments.
7777 (Output_section::do_write,
7778 Output_section::write_to_postprocessing_buffer): Do code-fill
7779 generation as appropriate.
7780 (Output_section::get_input_sections): Invalidate relaxed input section
7781 map.
7782 (Output_section::restore_states): Adjust type of checkpoint .
7783 Invalidate relaxed input section map.
7784 * output.h (Output_merge_base): New class declaration.
7785 (Input_section_specifier): New class defintion.
7786 (class Output_relaxed_input_section) Change base class to
7787 Output_section_data_build.
7788 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7789 base class initializer.
7790 (Output_section::add_relaxed_input_section): New method declaration.
7791 (Output_section::Input_section): Change visibility to protected.
7792 (Output_section::Input_section::relobj,
7793 Output_section::Input_section::shndx): Handle relaxed input sections.
7794 Output_section::input_sections) Change visibility to protected. Also
7795 define overload to return a non-const pointer.
7796 (Output_section::Merge_section_properties): New class defintion.
7797 (Output_section::Merge_section_by_properties_map,
7798 Output_section::Output_section_data_by_input_section_map,
7799 Output_section::Relaxation_map): New types.
7800 (Output_section::relax_input_section): Rename method to
7801 Output_section::convert_input_sections_to_relaxed_sections and change
7802 interface to take a vector of relaxed section pointers.
7803 (Output_section::find_merge_section,
7804 Output_section::find_relaxed_input_section,
7805 Output_section::build_relaxation_map,
7806 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7807 New method declarations.
7808 (Output_section::merge_section_map_
7809 Output_section::merge_section_by_properties_map_,
7810 Output_section::relaxed_input_section_map_,
7811 Output_section::is_relaxed_input_section_map_valid_,
7812 Output_section::generate_code_fills_at_write_): New data members.
7813 * script-sections.cc
7814 (Output_section_element_input::set_section_addresses): Call
7815 current_data_size and addralign methods of relaxed input sections.
7816 (Orphan_output_section::set_section_addresses): Call current_data_size
7817 and addralign methods of relaxed input sections.
7818 * symtab.cc (Symbol_table::compute_final_value): Extract template
7819 from the body of Symbol_table::sized_finalize_symbol.
7820 (Symbol_table::sized_finalized_symbol): Call
7821 Symbol_table::compute_final_value.
7822 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7823 (Symbol_table::compute_final_value): New templated method declaration.
7824 * target.cc (Target::do_make_output_section): New method defintion.
7825 * target.h (Target::make_output_section): New method declaration.
7826 (Target::relax): Add more parameters for input objects, symbol table
7827 and layout. Adjust call to do_relax.
7828 (Target::do_make_output_section): New method declaration.
7829 (Target::do_relax): Add parameters for input objects, symbol table
7830 and layout.
7831
7832 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7833
7834 * pread.c: Include stdio.h.
7835
7836 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7837
7838 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7839 defined.
7840
7841 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7842
7843 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7844 Change read_shndx type to unsigned int.
7845 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7846 int.
7847 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7848 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7849 Change read_shndx type to unsigned int.
7850 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7851 int.
7852 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7853 * layout.cc (Layout::create_symtab_sections): Cast the result of
7854 local_symcount * symsize to off_t in the gold_assert.
7855
7856 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7857
7858 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7859 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7860 R_ARM_BASE_ABS.
7861 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7862 (Arm_relocate_functions::thm_abs5): New function.
7863 (Arm_relocate_functions::abs12): New function.
7864 (Arm_relocate_functions::abs16): New function.
7865 (Arm_relocate_functions::base_abs): New function.
7866 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7867 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7868 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7869 R_ARM_BASE_ABS.
7870 (Scan::global): Likewise.
7871 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7872 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7873 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7874 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7875 R_ARM_BASE_ABS.
7876
7877 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7878
7879 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7880 (Arm_relocate_functions::movt_prel): New function.
7881 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7882 (Arm_relocate_functions::thm_movt_prel): New function.
7883 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7884 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7885 (Scan::global, Relocate::relocate): Likewise.
7886 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7887
7888 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7889
7890 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7891 Incremental_checker.
7892 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7893 unsigned int.
7894 (class Incremental_inputs_header): New class.
7895 (Incremental_inputs_header_writer): Edit comment.
7896 (Incremental_inputs_entry): New class.
7897 (Incremental_inputs_entry_writer): Edit comment.
7898 (Sized_incremental_binary::do_find_incremental_inputs_section):
7899 Add *strtab_shndx parameter, fill it.
7900 (Sized_incremental_binary::do_check_inputs): New method.
7901 (Incremental_checker::can_incrementally_link_output_file): Use
7902 Sized_incremental_binary::check_inputs.
7903 (Incremental_inputs::report_command_line): Save command line in
7904 command_line_.
7905 * incremental.h:
7906 (Incremental_binary::find_incremental_inputs_section): New
7907 method.
7908 (Incremental_binary::do_find_incremental_inputs_section): Add
7909 strtab_shndx parameter.
7910 (Incremental_binary::do_check_inputs): New pure virtual method.
7911 (Sized_incremental_binary::do_check_inputs): Declare.
7912 (Incremental_checker::Incremental_checker): Add incremental_inputs
7913 parameter, use it to initialize incremental_inputs_.
7914 (Incremental_checker::incremental_inputs_): New field.
7915 (Incremental_checker::command_line): New method.
7916 (Incremental_checker::inputs): New method.
7917 (Incremental_checker::command_line_): New field.
7918
7919 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7920
7921 * incremental.cc: Include <cstdarg> and "target-select.h".
7922 (vexplain_no_incremental): New function.
7923 (explain_no_incremental): New function.
7924 (Incremental_binary::error): New method.
7925 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7926 method.
7927 (make_sized_incremental_binary): New function.
7928 (open_incremental_binary): New function.
7929 (can_incrementally_link_file): Add checks if output is ELF and has
7930 inputs section.
7931 * incremental.h: Include "elfcpp_file.h" and "output.h".
7932 (Incremental_binary): New class.
7933 (Sized_incremental_binary): New class.
7934 (open_incremental_binary): Declare.
7935 * object.cc (is_elf_object): Use
7936 elfcpp::Elf_recognizer::is_elf_file.
7937 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7938 * output.h (Output_file::filesize): New method.
7939
7940 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7941
7942 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7943 New function.
7944 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7945 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7946 function.
7947 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7948 function.
7949 (Arm_relocate_functions::movw_abs_nc): New function.
7950 (Arm_relocate_functions::movt_abs): New function.
7951 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7952 (Arm_relocate_functions::thm_movt_abs): New function.
7953 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7954 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7955 (Scan::global): Likewise.
7956 (Relocate::relocate): Likewise.
7957 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7958
7959 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7960
7961 * arm.cc (Arm_relocate_functions::got_prel) New function.
7962 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7963 (Relocate::relocate): Likewise.
7964 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7965
7966 2009-10-06 Ian Lance Taylor <iant@google.com>
7967
7968 * options.h (class General_options): Define
7969 split_stack_adjust_size parameter.
7970 * object.h (class Object): Add uses_split_stack_ and
7971 has_no_split_stack_ fields. Add uses_split_stack and
7972 has_no_split_stack accessor functions. Declare
7973 handle_split_stack_section.
7974 (class Reloc_symbol_changes): Define.
7975 (class Sized_relobj): Define Function_offsets. Declare
7976 split_stack_adjust, split_stack_adjust_reltype, and
7977 find_functions.
7978 * object.cc (Object::handle_split_stack_section): New function.
7979 (Sized_relobj::do_layout): Call handle_split_stack_section.
7980 * dynobj.cc (Sized_dynobj::do_layout): Call
7981 handle_split_stack_section.
7982 * reloc.cc (Sized_relobj::relocate_sections): Call
7983 split_stack_adjust for executable sections in split_stack
7984 objects. Pass reloc_map to relocate_section.
7985 (Sized_relobj::split_stack_adjust): New function.
7986 (Sized_relobj::split_stack_adjust_reltype): New function.
7987 (Sized_relobj::find_functions): New function.
7988 * target-reloc.h: Include "object.h".
7989 (relocate_section): Add reloc_symbol_changes parameter. Change
7990 all callers.
7991 * target.h (class Target): Add calls_non_split method. Declare
7992 do_calls_non_split virtual method. Declare match_view and
7993 set_view_to_nop.
7994 * target.cc: Include "elfcpp.h".
7995 (Target::do_calls_non_split): New function.
7996 (Target::match_view): New function.
7997 (Target::set_view_to_nop): New function.
7998 * gold.cc (queue_middle_tasks): Give an error if mixing
7999 split-stack and non-split-stack objects with -r.
8000 * i386.cc (Target_i386::relocate_section): Add
8001 reloc_symbol_changes parameter.
8002 (Target_i386::do_calls_non_split): New function.
8003 * x86_64.cc (Target_x86_64::relocate_section): Add
8004 reloc_symbol_changes parameter.
8005 (Target_x86_64::do_calls_non_split): New function.
8006 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8007 parameter.
8008 * powerpc.cc (Target_powerpc::relocate_section): Add
8009 reloc_symbol_changes parameter.
8010 * sparc.cc (Target_sparc::relocate_section): Add
8011 reloc_symbol_changes parameter.
8012 * configure.ac: Call AM_CONDITIONAL for the default target.
8013 * configure: Rebuild.
8014 * testsuite/Makefile.am (TEST_AS): New variable.
8015 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8016 (check_DATA): Add split_i386 and split_x86_64 files.
8017 (SPLIT_DEFSYMS): Define.
8018 (split_i386_[1234n].o): New targets.
8019 (split_i386_[124]): New targets.
8020 (split_i386_[1234r].stdout): New targets.
8021 (split_x86_64_[1234n].o): New targets.
8022 (split_x86_64_[124]): New targets.
8023 (split_x86_64_[1234r].stdout): New targets.
8024 (MOSTLYCLEANFILES): Add new executables.
8025 * testsuite/split_i386.sh: New file.
8026 * testsuite/split_x86_64.sh: New file.
8027 * testsuite/split_i386_1.s: New file.
8028 * testsuite/split_i386_2.s: New file.
8029 * testsuite/split_i386_3.s: New file.
8030 * testsuite/split_i386_4.s: New file.
8031 * testsuite/split_i386_n.s: New file.
8032 * testsuite/split_x86_64_1.s: New file.
8033 * testsuite/split_x86_64_2.s: New file.
8034 * testsuite/split_x86_64_3.s: New file.
8035 * testsuite/split_x86_64_4.s: New file.
8036 * testsuite/split_x86_64_n.s: New file.
8037 * testsuite/testfile.cc (Target_test): Update relocation_section
8038 function.
8039 * testsuite/Makefile.in: Rebuild.
8040
8041 2009-10-06 Ian Lance Taylor <iant@google.com>
8042
8043 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8044 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8045 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8046 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8047 the address on ldo_addrs_.
8048 (Target_i386::Relocate::fix_up_ldo): New function.
8049
8050 2009-10-06 Rafael Espindola <espindola@google.com>
8051
8052 * plugin.cc (add_input_library): New.
8053 (Plugin::load): Add add_input_library to tv.
8054 (Plugin_manager::add_input_file): Add the is_lib argument.
8055 (add_input_file): Update call to Plugin_manager::add_input_file.
8056 (add_input_library): New.
8057 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8058
8059 2009-09-30 Doug Kwan <dougkwan@google.com>
8060
8061 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8062 symbol and call Symbol::may_need_copy_reloc to determine if
8063 a copy reloc is needed.
8064 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8065 nocopyreloc is given in command line.
8066 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8067 given in command line.
8068 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8069 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8070 of the removed Target_i386::may_need_copy_reloc.
8071 * options.h (copyreloc): New option with default value false.
8072 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8073 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8074 instead of the removed Target_powerpc::may_need_copy_reloc.
8075 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8076 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8077 instead of the removed Target_sparc::may_need_copy_reloc.
8078 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8079 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8080 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8081 instead of the removed Target_x86_64::may_need_copy_reloc.
8082
8083 2009-09-30 Ian Lance Taylor <iant@google.com>
8084
8085 * object.h (class Object): Remove target_ field, and target,
8086 sized_target, and set_target methods.
8087 (Object::sized_target): Remove.
8088 (class Sized_relobj): Update declarations. Remove sized_target.
8089 * object.cc (Sized_relobj::setup): Remove target parameter.
8090 Change all callers.
8091 (Input_objects::add_object): Don't do anything with the target.
8092 (make_elf_sized_object): Add punconfigured parameter. Change all
8093 callers. Set or test parameter target.
8094 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8095 Change all callers.
8096 * parameters.cc (Parameters::set_target): Change parameter type to
8097 be non-const.
8098 (Parameters::default_target): Remove.
8099 (set_parameters_target): Change parameter type to be non-const.
8100 (parameters_force_valid_target): New function.
8101 (parameters_clear_target): New function.
8102 * parameters.h (class Parameters): Update declarations. Remove
8103 default_target method. Add sized_target and clear_target
8104 methods. Change target_ to be non-const.
8105 (set_parameters_target): Update declaration.
8106 (parameters_force_valid_target): Declare.
8107 (parameters_clear_target): Declare.
8108 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8109 as NULL if we aren't searching.
8110 (Add_symbols::run): Don't check for compatible target.
8111 * fileread.cc (Input_file::open_binary): Call
8112 parameters_force_valid_target.
8113 * gold.cc (queue_middle_tasks): Likewise.
8114 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8115 set_target on object.
8116 * dynobj.h (class Sized_dynobj): Update declarations.
8117 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8118 make_elf_object returns NULL.
8119 (Archive::include_member): Don't check whether object target is
8120 compatible.
8121 * output.cc (Output_section::add_input_section): Get target from
8122 parameters.
8123 (Output_section::relax_input_section): Likewise.
8124 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8125 parameters.
8126 (Sized_relobj::do_scan_relocs): Likewise.
8127 (Sized_relobj::relocate_sections): Likewise.
8128 * resolve.cc (Symbol_table::resolve): Likewise.
8129 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8130 parameter. Change all callers.
8131 (Symbol_table::add_from_object): Get target from parameters.
8132 (Symbol_table::add_from_relobj): Don't check object target.
8133 (Symbol_table::add_from_dynobj): Likewise.
8134 (Symbol_table::define_special_symbol): Get target from
8135 parameters.
8136 * symtab.h (class Symbol_table): Update declaration.
8137 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8138 parameter. Change all callers. Clear parameter target.
8139 (Binary_test): Test target here.
8140 * testsuite/object_unittest.cc (gold_testsuite): Remove
8141 target_test_pointer parameter. Change all callers.
8142 (Object_test): Test target here.
8143
8144 2009-09-26 Ian Lance Taylor <iant@google.com>
8145
8146 * testsuite/initpri1.c: Don't try to use constructor priorities if
8147 compiling with gcc before 4.3.
8148
8149 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8150
8151 * testsuite/retain_symbols_file_test.sh (check_present): Change
8152 output file name to retain_symbols_file_test.stdout.
8153 (check_absent): Likewise.
8154
8155 2009-09-18 Craig Silverstein <csilvers@google.com>
8156
8157 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8158 * options.cc: Include <cerrno> and <fstream>.
8159 (General_options::finalize): Parse -retain-symbols-file tag.
8160 * options.h: New flag.
8161 (General_options): New method should_retain_symbol, new
8162 variable symbols_to_retain.
8163 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8164 should_retain_symbol map.
8165 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8166 * testsuite/Makefile.in: Regenerate.
8167 * testsuite/retain_symbols_file_test.sh: New file.
8168
8169 2009-09-18 Nick Clifton <nickc@redhat.com>
8170
8171 * po/es.po: Updated Spanish translation.
8172
8173 2009-09-17 Doug Kwan <dougkwan@google.com>
8174
8175 * debug.h (DEBUG_RELAXATION): New constant.
8176 (DEBUG_ALL): Add DEBUG_RELAXATION.
8177 (debug_string_to_enum): Add relaxation debug option.
8178 * layout.cc
8179 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8180 Layout::Relaxation_debug_check::read_sections,
8181 Layout::Relaxation_debug_check::read_sections): New method definitions.
8182 (Layout::Layout): Initialize data members
8183 record_output_section_data_from_scrips_,
8184 script_output_section_data_list_ and relaxation_debug_check_.
8185 (Layout::save_segments, Layout::restore_segments,
8186 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8187 Layout::relaxation_loop_body): New method definitions.
8188 (Layout::finalize): Support relaxation. Move section layout code to
8189 Layout::relaxation_loop_body.
8190 (Layout::set_asection_address_from_script): Move code for orphan
8191 section placement out.
8192 (Layout::place_orphan_sections_in_script): New method definition.
8193 * layout.h (Output_segment_headers, Output_file_header):
8194 New forward class declarations.
8195 (Layout::~Layout): Define.
8196 (Layout::new_output_section_data_from_script): New method definition.
8197 (Layout::place_orphan_sections_in_script): New method declaration.
8198 (Layout::Segment_states): New type declaration.
8199 (Layout::save_segments, Layout::restore_segments,
8200 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8201 Layout::relaxation_loop_body): New method declarations.
8202 (Layout::Output_section_data_list): New type declaration.
8203 (Layout::Relaxation_debug_check): New class definition.
8204 (Layout::record_output_section_data_from_script_,
8205 Layout::script_output_section_data_list_, Layout::segment_states_,
8206 Layout::relaxation_debug_check_): New data members.
8207 * output.cc: (Output_section_headers::do_size): New method definition.
8208 (Output_section_headers::Output_section_headers): Move size
8209 computation to Output_section_headers::do_size.
8210 (Output_segment_headers::do_size): New method definition.
8211 (Output_file_header::Output_file_header): Move size computation to
8212 Output_file_header::do_size and call it.
8213 (Output_file_header::do_size): New method definition.
8214 (Output_data_group::Output_data_group): Adjust call to
8215 Output_section_data.
8216 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8217 (Output_symtab_xindex::do_write): Add array bound check.
8218 (Output_section::Input_section::print_to_mapfile): Handle
8219 RELAXED_INPUT_SECTION_CODE.
8220 (Output_section::Output_section): Initialize data member checkpoint_.
8221 (Output_section::~Output_section): Delete checkpoint object pointed
8222 by checkpoint_.
8223 (Output_section::add_input_section): Always add an Input_section if
8224 relaxing.
8225 (Output_section::add_merge_input_section): Add assert.
8226 (Output_section::relax_input_section): New method definition.
8227 (Output_section::set_final_data_size): Set load address to zero for
8228 an unallocated section.
8229 (Output_section::do_address_and_file_offset_have_reset_values):
8230 New method definition.
8231 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8232 Handle relaxed input section.
8233 (Output_section::sort_attached_input_sections): Checkpoint input
8234 section list lazily.
8235 (Output_section::get_input_sections): Change type of input_sections to
8236 list of Simple_input_section pointers. Checkpoint input section list
8237 lazily. Also handle relaxed input sections.
8238 (Output_section::add_input_section_for_script): Take a reference to
8239 a Simple_input_section object instead of Relobj pointer and section
8240 index as parameter. Handle relaxed input sections.
8241 (Output_section::save_states, Output_section::restore_states): New
8242 method definitions.
8243 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8244 (Output_data::is_data_size_fixed): New method definition.
8245 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8246 if it is fixed.
8247 (Output_data::address_and_file_offset_have_reset_values): New method
8248 definition.
8249 (Output_data::do_address_and_file_offset_have_reset_values): New method
8250 definition.
8251 (Output_data::set_data_size): Check that data size is not fixed.
8252 (Output_data::fix_data_size): New method definition.
8253 (Output_data::is_data_size_fixed_): New data member.
8254 (Output_section_headers::set_final_data_size): New method definition.
8255 (Output_section_headers::do_size): New method declaration.
8256 (Output_segment_headers::set_final_data_size): New method definition.
8257 (Output_segment_headers::do_size): New method declaration.
8258 (Output_file_header::set_final_data_size)::New method definition.
8259 (Output_file_header::do_size)::New method declaration.
8260 (Output_section_data::Output_section_data): Add new parameter
8261 is_data_size_fixed and use it to fix data size.
8262 (Output_data_const::Output_data_const): Adjust call to base class
8263 constructor and fix data size.
8264 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8265 base class constructor and fix data size.
8266 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8267 base class constructor and fix data size.
8268 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8269 class constructor and fix data size.
8270 (Output_data_group::set_final_data_size): New method definition.
8271 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8272 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8273 class constructor and fix data size.
8274 (Output_relaxed_input_section): New class definition.
8275 (Output_section::Simple_input_section): New class definition.
8276 (Output_section::get_input_sections): Adjust parameter list.
8277 (Output_section::add_input_section_for_script): Same.
8278 (Output_section::save_states, Output_section::restore_states,
8279 Output_section::do_address_and_file_offset_have_reset_values,
8280 (Output_section::Input_section::Input_section): Handle
8281 RELAXED_INPUT_SECTION_CODE. Add new overload for
8282 Output_relaxed_input_section.
8283 (Output_section::Input_section::is_input_section,
8284 Output_section::Input_section::set_output_section): Handle relaxed
8285 input section.
8286 (Output_section::Input_section::is_relaxed_input_section,
8287 Output_section::Input_section::output_section_data,
8288 Output_section::Input_section::relaxed_input_section): New method
8289 definitions.
8290 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8291 value.
8292 (Output_section::Input_section::u1_): Update comments.
8293 (Output_section::Input_section::u2_): Add new union member poris.
8294 (Output_section::Checkpoint_output_section): New classs definition.
8295 (Output_section::relax_input_section): New method declaration.
8296 (Output_section::checkpoint_): New data member.
8297 (Output_segment): Update comments.
8298 (Output_segment::Output_segment): Un-privatize copy constructor.
8299 (Output_segment::operator=): Un-privatize.
8300 * script-sections.cc (Output_section_element::Input_section_list):
8301 Change element type to Output_section::Simple_input_section.
8302 (Output_section_element_dot_assignment::set_section_addresses):
8303 Register output section data for relaxation clean up.
8304 (Output_data_exression::Output_data_expression): Adjust call to base
8305 constructor to fix data size.
8306 (Output_section_element_data::set_section_addresses): Register
8307 Output_data_expression object for relaxation clean up.
8308 (struct Input_section_info): Replace Relobj pointer and section index
8309 pair with Output_section::Simple_input_section and Convert struct to a
8310 class.
8311 (Input_section_sorter::operator()): Adjust access to
8312 Input_section_info data member to use accessors.
8313 (Output_section_element_input::set_section_addresses): Use layout
8314 parameter. Adjust code to use Output_section::Simple_input_section
8315 and Input_secction_info classes. Register filler for relaxation
8316 clean up.
8317 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8318 and section index pair with Output_section::Simple_input_section
8319 class. Adjust code accordingly.
8320 (Phdrs_element::release_segment): New method definition.
8321 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8322 segment list.
8323 (Script_sections::release_segments): New method definition.
8324 * gold/script-sections.h (Script_sections::release_segments): New
8325 method declaration.
8326 * gold/target.h (Target::may_relax, Target::relax,
8327 Target::do_may_relax, Target::do_relax): New method definitions.
8328
8329 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8330
8331 * arm.cc (has_signed_unsigned_overflow): New function.
8332 (Arm_relocate_functions::abs8): New function.
8333 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8334 (Target_arm::Scan::global): Likewise.
8335 (Target_arm::relocate::relocate): Likewise.
8336 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8337 Likewise.
8338
8339 2009-09-16 Cary Coutant <ccoutant@google.com>
8340
8341 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8342 * testsuite/Makefile.in: Regenerate.
8343
8344 2009-09-11 Nick Clifton <nickc@redhat.com>
8345
8346 * po/gold.pot: Updated by the Translation project.
8347
8348 2009-09-08 Cary Coutant <ccoutant@google.com>
8349
8350 * output.cc (Output_file::open): Add execute permission to empty file.
8351 * testsuite/Makefile.am (permission_test): New test.
8352 * testsuite/Makefile.in: Regenerate.
8353
8354 2009-09-02 Ian Lance Taylor <iant@google.com>
8355
8356 * output.cc (Output_file::resize): Call map_no_anonymous rather
8357 than map.
8358
8359 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8360
8361 * gold.cc: Include "incremental.h".
8362 (queue_initial_tasks): Call Incremental_checker methods.
8363 * incremental.cc: Include "output.h".
8364 (Incremental_checker::can_incrementally_link_output_file): New
8365 method.
8366 * incremental.h (Incremental_checker): New class.
8367
8368 * output.cc (Output_file::open_for_modification): New method.
8369 (Output_file::map_anonymous): Changed return type to bool. Record
8370 map in base_ field.
8371 (Output_file::map_no_anonymous): New method, broken out of map.
8372 (Output_file::map): Use map_no_anonymous and map_anonymous.
8373 * output.h (class Output_file): Update declarations.
8374
8375 2009-08-24 Cary Coutant <ccoutant@google.com>
8376
8377 * options.h (Command_line::Pre_options): New class.
8378 (Command_line::pre_options): New member.
8379 * options.cc (gold::options::ready_to_register): New variable.
8380 (One_option::register_option): Do nothing if not registering options.
8381 Assert if same short option registered twice.
8382 (General_options::General_options): Turn off option registration when
8383 done constructing.
8384 (Command_line::Pre_options::Pre_options): New constructor.
8385
8386 2009-08-24 Cary Coutant <ccoutant@google.com>
8387
8388 * options.h (General_options::no_keep_memory): Remove incorrect
8389 short option.
8390
8391 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8392
8393 * Makefile.am (am__skiplex, am__skipyacc): New.
8394 * Makefile.in: Regenerate.
8395
8396 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8397
8398 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8399 (INCLUDES): ... this.
8400 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8401 (AM_CPPFLAGS): Renamed from ...
8402 (INCLUDE): ... this.
8403 * Makefile.in, testsuite/Makefile.in: Regenerate.
8404
8405 * Makefile.in: Regenerate.
8406 * aclocal.m4: Likewise.
8407 * config.in: Likewise.
8408 * configure: Likewise.
8409 * testsuite/Makefile.in: Likewise.
8410
8411 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8412 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8413 * Makefile.in: Regenerate.
8414 * testsuite/Makefile.in: Regenerate.
8415
8416 2009-08-19 Cary Coutant <ccoutant@google.com>
8417
8418 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8419 symbols in shared libraries overridden by hidden or internal symbols
8420 in the main program.
8421
8422 2009-08-19 Chris Demetriou <cgd@google.com>
8423
8424 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8425 checking source file names in error messages.
8426
8427 2009-08-18 Doug Kwan <dougkwan@google.com>
8428
8429 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8430 an elcpp::Ehdr as parameter. Adjust call to set_target.
8431 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8432 an elfcpp::Ehdr as parameter.
8433 * object.cc (Object::set_target): Remove the version that looks up
8434 a target and sets it.
8435 (Sized_relobj::setup): Take a Target object instead of
8436 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8437 (make_elf_sized_object): Find target and ask target to
8438 make an ELF object.
8439 * object.h: (Object::set_target): Remove the version that looks up
8440 a target and sets it.
8441 (Sized_relobj::setup): Take a Target object instead of
8442 an elfcpp:Ehdr as parameter.
8443 * target.cc: Include dynobj.h.
8444 (Target::do_make_elf_object_implementation): New.
8445 (Target::do_make_elf_object): New.
8446 * target.h (Target::make_elf_object): New template declaration.
8447 (Target::do_make_elf_object): New method declarations.
8448 (Target::do_make_elf_object_implementation): New template declaration.
8449
8450 2009-08-14 Ian Lance Taylor <iant@google.com>
8451
8452 * gold.h (FUNCTION_NAME): Define.
8453 (gold_unreachable): Use FUNCTION_NAME.
8454
8455 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8456
8457 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8458 symbol in the --keep-unique list is not found.
8459
8460 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8461
8462 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8463 been maked as --keep-unique.
8464 (Icf::unfold_section): New function.
8465 * icf.h (Icf::unfold_section): New function.
8466 * options.h (General_options::keep_unique): New option.
8467 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8468 * testsuite/Makefile.in: Regenerate.
8469 * testsuite/icf_keep_unique_test.sh: New file.
8470 * testsuite/icf_keep_unique_test.cc: New file.
8471
8472 2009-08-12 Cary Coutant <ccoutant@google.com>
8473
8474 PR 10471
8475 * resolve.cc (Symbol_table::resolve): Check for references from
8476 dynamic objects to hidden and internal symbols.
8477 * testsuite/Makefile.am (hidden_test.sh): New test.
8478 * testsuite/Makefile.in: Regenerate.
8479 * testsuite/hidden_test.sh: New script.
8480 * testsuite/hidden_test_1.c: New test source.
8481 * testsuite/hidden_test_main.c: New test source.
8482
8483 2009-08-11 Doug Kwan <dougkwan@google.com>
8484
8485 * arm.cc: Update comments.
8486 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8487 segment to locate the .ARM.exidx section if present.
8488
8489 2009-08-09 Doug Kwan <dougkwan@google.com>
8490
8491 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8492 patch.
8493
8494 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8495 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8496 compiler warnings.
8497
8498 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8499
8500 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8501 valid tls_segment only for non-debug-section relocations.
8502 * testsuite/Makefile.am: Add gc_tls_test.
8503 * testsuite/Makefile.in: Regenerate.
8504 * testsuite/gc_tls_test.cc: New file.
8505 * testsuite/gc_tls_test.sh: New file.
8506
8507 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8508
8509 * icf.cc: New file.
8510 * icf.h: New file.
8511 * Makefile.am (CCFILES): Add icf.cc.
8512 (HFILES): Add icf.h
8513 * Makefile.in: Regenerate.
8514 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8515 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8516 section, symbol and addend information for the relocs.
8517 * gold.cc (queue_middle_tasks): Call identical code folding.
8518 * gold.h: Add defines for multimap.
8519 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8520 to the call of finalize_local_symbols.
8521 * main.cc (main): Create object of class Icf.
8522 * object.cc (Sized_relobj::do_layout): Allow this function to be
8523 called twice during icf.
8524 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8525 to sections marked as identical by icf.
8526 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8527 when available.
8528 (Sized_relobj::do_section_entsize): New function.
8529 * object.h (Object::section_entsize): New function.
8530 (Object::do_section_entsize): New pure virtual function.
8531 (Relobj::finalize_local_symbols): Add new parameter.
8532 (Relobj::do_section_entsize): New function.
8533 * options.h (General_options::icf): New option.
8534 (General_options::icf_iterations): New option.
8535 (General_options::print_icf_sections): New option.
8536 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8537 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8538 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8539 icf.
8540 * symtab.cc (Symbol_table::is_section_folded): New function.
8541 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8542 to sections marked as identical by icf.
8543 * symtab.h (Symbol_table::set_icf): New function.
8544 (Symbol_table::icf): New function.
8545 (Symbol_table::is_section_folded): New function.
8546 (Symbol_table::icf_): New data member.
8547 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8548 * testsuite/Makefile.am: Add commands to build icf_test.
8549 * testsuite/Makefile.in: Regenerate.
8550 * testsuite/icf_test.sh: New file.
8551 * testsuite/icf_test.cc: New file.
8552
8553 2009-07-24 Chris Demetriou <cgd@google.com>
8554
8555 * layout.cc (is_compressible_debug_section): Fix incorrect
8556 comment about compressed section names.
8557
8558 2009-07-20 Ian Lance Taylor <ian@airs.com>
8559
8560 PR 10419
8561 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8562
8563 2009-07-16 Ian Lance Taylor <iant@google.com>
8564
8565 PR 10400
8566 * layout.h: #include <map>.
8567 (class Kept_section): Change from struct to class. Add accessors
8568 and setters. Add section size to Comdat_group mapping. Change
8569 Comdat_group to std::map. Add is_comdat_ field. Add
8570 linkonce_size field in union.
8571 (class Layout): Update declaration of find_or_add_kept_section.
8572 Don't declare find_kept_object.
8573 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8574 parameter. Add object, shndx, is_comdat, and is_group_name
8575 parameters. Change all callers. Adjust for new Kept_section.
8576 (Layout::find_kept_object): Remove.
8577 * object.cc (Sized_relobj::include_section_group): Update use of
8578 Kept_section. Rename secnum to shndx. Only record
8579 Kept_comdat_section if sections are the same size.
8580 (Sized_relobj::include_linkonce_section): Update use of
8581 Kept_section. Only record Kept_comdat_section if sections are the
8582 same size. Set size of linkonce section.
8583 (Sized_relobj::map_to_kept_section): Update call to
8584 get_kept_comdat_section.
8585 * object.h (class Sized_relobj): Rename fields in
8586 Kept_comdat_section to drop trailing underscores; change object
8587 field to Relobj*. Change Kept_comdat_section_table to store
8588 struct rather than pointer.
8589 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8590 Add kept_object and kept_shndx parameters. Change all callers.
8591 (Sized_relobj::get_kept_comdat_section): Change return type to
8592 bool. Add kept_object and kept_shndx parameters. Change all
8593 callers.
8594 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8595 Layout::find_or_add_kept_section.
8596
8597 2009-07-09 Ian Lance Taylor <iant@google.com>
8598
8599 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8600 Reserve space in the hash table.
8601
8602 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8603
8604 * fileread.cc (File_read::get_mtime): New method.
8605 * fileread.h (Timespec): New structure.
8606 (File_read::get_mtime): New method.
8607 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8608 Renamed from timestamp_nsec.
8609 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8610 Elf_Xword.
8611 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8612 timestamp_nsec.
8613 (Incremental_inputs::report_archive): Save mtime; style fix.
8614 (Incremental_inputs::report_obejct): Save mtime; style fix.
8615 (Incremental_inputs::report_script): Save mtime; style fix.
8616 (Incremental_inputs::finalize_inputs): Style fix.
8617 (Incremental_inputs::finalize): Style fix.
8618 (Incremental_inputs::create_input_section_data): Store inputs
8619 mtime.
8620 * incremental.h (Incremental_inputs::report_script): Add mtime
8621 argument.
8622 (Incremental_inputs::Input_info::Input_info): Intialize only one
8623 union member.
8624 (Incremental_inputs::Input_info::archive): Move to nameless
8625 union.
8626 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8627 (Incremental_inputs::Input_info::script): Move to nameless union.
8628 (Incremental_inputs::mtime): New field.
8629 * script.cc (read_input_script): Pass file mtime to
8630 Incremental_input.
8631 * script.h (Script_info::inputs): Style fix.
8632
8633 2009-07-01 Ian Lance Taylor <ian@airs.com>
8634
8635 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8636 instead of 32.
8637
8638 2009-06-24 Ian Lance Taylor <iant@google.com>
8639
8640 PR 10156
8641 * layout.cc (Layout::choose_output_section): If we find an
8642 existing section, update the flags.
8643 (Layout::create_notes): New function, broken out of
8644 Layout::finalize.
8645 (Layout::finalize): Don't create note sections.
8646 (Layout::create_note): Don't crash if linker script discards
8647 section.
8648 (Layout::create_gold_note): Likewise.
8649 (Layout::create_build_id): Likewise. Don't set
8650 after_input_sections on the section.
8651 (Layout::create_executable_stack_info): Remove target parameter.
8652 Change caller.
8653 * layout.h (class Layout): Declare create_notes. Update
8654 declaration of create_executable_stack_info.
8655 * gold.cc (queue_middle_tasks): Call create_notes.
8656 * output.cc (Output_section::update_flags_for_input_section): Move
8657 here from output.h. If SHF_ALLOC flag is newly set, mark address
8658 invalid.
8659 * output.h (Output_data::mark_address_invalid): New function.
8660 (class Output_section): Only declare, not define,
8661 update_flags_for_input_section. Remove set_flags.
8662
8663 2009-06-24 Ian Lance Taylor <iant@google.com>
8664
8665 * script-sections.cc (Output_section_definition::
8666 set_section_addresses): Rename shadowing local load_address to
8667 laddr.
8668
8669 2009-06-24 Ian Lance Taylor <iant@google.com>
8670
8671 PR 10244
8672 * reloc.cc (relocate_sections): Skip empty relocation sections.
8673
8674 2009-06-23 Ian Lance Taylor <iant@google.com>
8675
8676 PR 10156
8677 * layout.cc (Layout::create_note): Use choose_output_section
8678 rather than make_output_section.
8679
8680 2009-06-23 Ian Lance Taylor <iant@google.com>
8681
8682 PR 10237
8683 * options.cc (General_options::parse_V): Set printed_version_.
8684 (General_options::General_options): Initialize printed_version_.
8685 * options.h (class General_options): Add printed_version_ field.
8686 * gold.cc (queue_initial_tasks): If there are no input files,
8687 don't give a fatal error if we printed the version information.
8688 (queue_middle_tasks): If using -r with a shared object, give a
8689 fatal error rather than an ordinary error.
8690
8691 2009-06-23 Ian Lance Taylor <iant@google.com>
8692
8693 PR 10219
8694 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8695 (Layout::make_output_section): Set have_stabstr_section_ if we see
8696 a .stab*str section.
8697 (Layout::finalize): Call link_stabs_sections.
8698 (Layout::link_stabs_sections): New file.
8699 * layout.h (class Layout): Add have_stabstr_section_ field.
8700 Declare link_stabs_sections.
8701
8702 2009-06-23 Doug Kwan <dougkwan@google.com>
8703
8704 * Makefile.am (libgold_a_LIBADD): New.
8705 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8706 * Makefile.in: Regenerate.
8707 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8708 * configure: Regenerate.
8709 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8710 * fileread.cc: Include sys/state.h
8711 * gold.h: Declare memmem and strndup if found missing.
8712 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8713
8714 2009-06-23 Ian Lance Taylor <iant@google.com>
8715
8716 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8717 * configure: Rebuild.
8718
8719 2009-06-23 Ian Lance Taylor <iant@google.com>
8720
8721 PR 10147
8722 * object.cc (Object::section_contents): Don't try to get a view if
8723 the section has length zero.
8724 (Object::handle_gnu_warning_section): If the section is empty, use
8725 the name of the section as the warning.
8726
8727 2009-06-23 Ian Lance Taylor <iant@google.com>
8728
8729 PR 10133
8730 * stringpool.h (class Stringpool_template): Add optimize_ field.
8731 (Stringpool_template::set_optimize): New function.
8732 * stringpool.cc (Stringpool_template::Stringpool_template):
8733 Initialize optimize_ field.
8734 (Stringpool_template::set_string_offsets): Test local optimize
8735 fild rather than parameter.
8736 * layout.cc (Layout::Layout): Call set_optimize on the section
8737 name stringpool.
8738
8739 2009-06-22 Ian Lance Taylor <iant@google.com>
8740
8741 PR 10030
8742 * yyscript.y: Parse TARGET.
8743 * script.cc (script_set_target): New function.
8744 * script-c.h (script_set_target): Declare.
8745 * options.cc (General_options::string_to_object_format): Rename
8746 from string_to_object_format in anonymous namespace. Change
8747 callers.
8748 * options.h (class General_options): Declare
8749 string_to_object_format.
8750
8751 2009-06-22 Ian Lance Taylor <iant@google.com>
8752
8753 * script-sections.cc (Script_sections::create_segments): Don't put
8754 program headers in a PT_LOAD segment if -n or -N.
8755
8756 2009-06-22 Ian Lance Taylor <iant@google.com>
8757
8758 PR 10141
8759 * options.h (class General_options): Add -z lazy and -z now. Sort
8760 -z options into alphabetical order.
8761 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8762
8763 2009-06-21 Ian Lance Taylor <iant@google.com>
8764
8765 * layout.cc (Layout::make_output_section): Call
8766 Target::new_output_section.
8767 (Layout::attach_allocated_section_to_segment): Put large section
8768 sections in a separate load segment with the large segment flag
8769 set.
8770 (Layout::segment_precedes): Sort large data segments after other
8771 load segments.
8772 (align_file_offset): New static function.
8773 (Layout::set_segment_offsets): Use align_file_offset.
8774 * output.h (class Output_section): Add is_small_section_ and
8775 is_large_section_ fields.
8776 (Output_section::is_small_section): New function.
8777 (Output_section::set_is_small_section): New function.
8778 (Output_section::is_large_section): New function.
8779 (Output_section::set_is_large_section): New function.
8780 (Output_section::is_large_data_section): New function.
8781 (class Output_segment): Add is_large_data_segment_ field.
8782 (Output_segment::is_large_data_segment): New function.
8783 (Output_segment::set_is_large_data_segment): New function.
8784 * output.cc (Output_section::Output_section): Initialize new
8785 fields.
8786 (Output_segment::Output_segment): Likewise.
8787 (Output_segment::add_output_section): Add assertion that large
8788 data sections always go in large data segments. Force small data
8789 sections to the end of the list of data sections. Force small BSS
8790 sections to the start of the list of BSS sections. For large BSS
8791 sections to the end of the list of BSS sections.
8792 * symtab.h (class Symbol): Declare is_common_shndx.
8793 (Symbol::is_defined): Check Symbol::is_common_shndx.
8794 (Symbol::is_common): Likewise.
8795 (class Symbol_table): Define enum Commons_section_type. Update
8796 declarations. Add small_commons_ and large_commons_ fields.
8797 * symtab.cc (Symbol::is_common_shndx): New function.
8798 (Symbol_table::Symbol_table): Initialize new fields.
8799 (Symbol_table::add_from_object): Put small and large common
8800 symbols in the right list.
8801 (Symbol_table::sized_finalized_symbol): Check
8802 Symbol::is_common_shndx.
8803 (Symbol_table::sized_write_globals): Likewise.
8804 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8805 common symbol lists. Don't call do_allocate_commons_list if the
8806 list is empty.
8807 (Symbol_table::do_allocate_commons_list): Remove is_tls
8808 parameter. Add comons_section_type parameter. Change all
8809 callers. Handle small and large common symbols.
8810 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8811 Symbol::is_common_shndx.
8812 * resolve.cc (symbol_to_bits): Likewise.
8813 * target.h (Target::small_common_shndx): New function.
8814 (Target::small_common_section_flags): New function.
8815 (Target::large_common_shndx): New function.
8816 (Target::large_common_section_flags): New function.
8817 (Target::new_output_section): New function.
8818 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8819 small_common_section_flags, and large_common_section_flags
8820 fields.
8821 (Target::do_new_output_section): New virtual function.
8822 * arm.cc (Target_arm::arm_info): Initialize new fields.
8823 * i386.cc (Target_i386::i386_info): Likewise.
8824 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8825 Likewise.
8826 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8827 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8828 (Target_x86_64::do_new_output_section): New function.
8829 * configure.ac: Define conditional MCMODEL_MEDIUM.
8830 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8831 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8832 (large_LDFLAGS): Define.
8833 * testsuite/large.c: New file.
8834 * testsuite/testfile.cc (Target_test::test_target_info):
8835 Initialize new fields.
8836 * configure, testsuite/Makefile.in: Rebuild.
8837
8838 2009-06-05 Doug Kwan <dougkwan@google.com>
8839
8840 * Makefile.am (CCFILES): Add target.cc.
8841 * Makefile.in: Regenerate.
8842 * i386.cc (class Target_i386): Define new virtual method to
8843 override do_is_local_label_name in parent.
8844 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8845 local symbols if --discard-locals or -X is given.
8846 * options.h (class General_options): Declare new options
8847 '--discard-locals' and '-X' for discarding locals.
8848 * target.h (class Target): Define new methods is_local_label_name.
8849 Declare new virtual method do_is_local_label_name.
8850 * target.cc: New file.
8851 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8852 (check_SCRIPTS): Add discard_locals_test.sh.
8853 (check_DATA): Add discard_local_tests.syms.
8854 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8855 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8856 * testsuite/Makefile.in: Regenerate.
8857 * testsuite/discard_locals_test.c: New file.
8858 * testsuite/discard_locals_test.sh: Same.
8859
8860 2009-06-05 Doug Kwan <dougkwan@google.com>
8861
8862 * object.cc (Sized_relobj::Sized_relobj): Initialize
8863 discarded_eh_frame_shndx_ to -1U.
8864 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8865 section.
8866 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8867 a discarded .eh_frame section.
8868 (Sized_relobj::do_finalize_local_symbols): Ditto.
8869 * object.h (class Sized_relobj): Declare new member
8870 discarded_eh_frame_shndx_.
8871 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8872 (local_labels_test.o, local_labels_test): New rules.
8873 * testsuite/Makefile.in: Regenerate.
8874
8875 2009-06-04 Doug Kwan <dougkwan@google.com>
8876
8877 * layout.cc (Layout::section_name_mapping): Add mapping for
8878 special ARM sections.
8879
8880 2009-06-03 Doug Kwan <dougkwan@google.com>
8881
8882 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8883 (utils::has_overflow): Same.
8884
8885 2009-06-03 Ian Lance Taylor <iant@google.com>
8886
8887 * layout.cc (Layout::section_name_mapping): New array, replacing
8888 Layout::linkonce_mapping.
8889 (Layout::section_name_mapping_count): New variable, replacing
8890 Layout::linkonce_mapping_count.
8891 (Layout::linkonce_output_name): Remove.
8892 (Layout::output_section_name): Rewrite.
8893 * layout.h (class Layout): Rename Linkonce_mapping to
8894 Section_name_mapping, linkonce_mapping to section_name_mapping,
8895 linkonce_mapping_count to section_name_mapping_count. Don't
8896 declare linkonce_output_name.
8897
8898 2009-06-03 Doug Kwan <dougkwan@google.com>
8899
8900 * gold/arm.cc (namespace utils): New.
8901 (Target_arm::reloc_is_non_pic): Define new method.
8902 (class Arm_relocate_functions): New.
8903 (Target_arm::Relocate::relocate): Handle relocation types used by
8904 Android.
8905
8906 2009-06-03 Ian Lance Taylor <iant@google.com>
8907
8908 * arm.cc (Target_arm::scan::global): Use || instead of |.
8909
8910 2009-06-02 Doug Kwan <dougkwan@google.com>
8911
8912 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8913 issued_non_pic_error_.
8914 (class Target_arm::Scan): Declare new method check_non_pic.
8915 Define new method symbol_needs_plt_entry.
8916 Declare new data member issued_non_pic_error_.
8917 (class Target_arm::Relocate): Declare new method
8918 should_apply_static_reloc.
8919 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8920 (Target_arm::Scan::check_non_pic): Define new method.
8921 (Target_arm::Scan::local): Handle a small subset of reloc types used
8922 by Android.
8923 (Target_arm::Scan::local): Same.
8924 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8925
8926 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8927
8928 * incremental.cc (Incremental_inputs::report_command_line): Filter
8929 out --incremental-* options.
8930
8931 2009-05-29 Doug Kwan <dougkwan@google.com>
8932
8933 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8934 template class.
8935 (class Target_arm): Update comment.
8936 (Target_arm::Target_arm): Initialize new data members GOT_,
8937 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8938 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8939 and Target_arm::rel_dyn_section.
8940 Declare new_enum Target_arm::Got_type.
8941 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8942 and DYNBSS_.
8943 Update commments for member do_dynsym_value.
8944 (Target_arm::got_size, Target_arm::plt_section,
8945 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8946 new methods inside class defintion.
8947 (Target_arm::got_section): Define new method.
8948 (Target_arm::rel_dyn_section): Same.
8949 (Output_data_plt_arm): New template class.
8950 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8951 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8952 (Output_data_plt_arm::add_entry): Same.
8953 (Output_data_plt_arm::first_plt_entry): Define new
8954 static data member for PLT instruction template.
8955 (Output_data_plt_arm::plt_entry): Same.
8956 (Output_data_plt_arm::do_write): Define new method.
8957 (Target_arm::make_plt_entry): Same.
8958 (Target_arm::do_finalize_sections): Same.
8959 (Target_arm::do_dynsym_value): Same.
8960
8961 2009-05-28 Doug Kwan <dougkwan@google.com>
8962
8963 * Makefile.am (TARGETSOURCES): Add arm.cc.
8964 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8965 * Makefile.in: Regenerate.
8966 * arm.cc: New file.
8967 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8968
8969 2009-05-26 Doug Kwan <dougkwan@google.com>
8970
8971 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8972 (General_options::check_excluded_libs): Strip off directories in
8973 archive name before matching like GNU ld does.
8974 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8975 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8976 (exclude_libs_test_LDFLAGS): Add linker option
8977 -Wl,--exclude-libs,libexclude_libs_test_3
8978 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8979 an explicit archive without using -l.
8980 (alt/libexclude_libs_test_3.a): New make rule.
8981 * testsuite/Makefile.in: Regenerate.
8982 * testsuite/exclude_libs_test.c : Declare lib3_default().
8983 (main): Call it.
8984 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8985 * exclude_libs_test_3.c: New file.
8986
8987 2009-05-26 Nick Clifton <nickc@redhat.com>
8988
8989 * po/id.po: New Indonesian translation.
8990 * po/gold.pot: Updated template file.
8991
8992 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8993
8994 * testsuite/Makefile.am: Add -ffunction-sections to compile
8995 gc_comdat_test files. Add -Wl,--gc-sections to build
8996 gc_comdat_test.
8997 * testsuite/Makefile.in: Regenerate.
8998 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8999
9000 2009-05-21 Sriraman Tallam <tmsriram@google.com>
9001
9002 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9003 kept comdat section was garbage collected.
9004 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9005 * testsuite/Makefile.in: Regenerate.
9006 * testsuite/gc_comdat_test.sh: New file.
9007 * testsuite/gc_comdat_test_1.cc: New file.
9008 * testsuite/gc_comdat_test_2.cc: New file.
9009
9010 2009-05-19 Doug Kwan <dougkwan@google.com>
9011
9012 * archive.cc (Archive::Archive): Move constructor from archive.h
9013 to here. Initialize no_export_.
9014 (Archive::get_elf_object_for_member): Set no_export flag of object.
9015 * archive.h (Archive::Archive): Move constructor body to
9016 archive.cc.
9017 (Archive::no_export): New method.
9018 (Archive::no_export_): New field.
9019 * object.h (Object::Object): Initialize no_export_ to false.
9020 (Object::no_export, Object::set_no_export): New methods.
9021 (Object::no_export_): New field.
9022 * options.cc (General_options::parse_exclude_libs): New method.
9023 (General_options::check_excluded_libs) Same.
9024 * options.h (exclude_libs): New option.
9025 (General_options::check_excluded_libs): New method declaration.
9026 (General_options::excluded_libs_): New field.
9027 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9028 default or protected visibility if an object has no-export flag set.
9029 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9030 (check_SCRIPTS): Add exclude_libs_test.sh.
9031 (check_DATA): Add exclude_libs_test.syms.
9032 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9033 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9034 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9035 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9036 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9037 libexclude_libs_test_2.a): New rules.
9038 * testsuite/Makefile.in: Regenerate.
9039 * testsuite/exclude_libs_test.c: New file.
9040 * testsuite/exclude_libs_test.sh: Ditto.
9041 * testsuite/exclude_libs_test_1.c: Ditto.
9042 * testsuite/exclude_libs_test_2.c: Ditto.
9043
9044 2009-05-15 Ian Lance Taylor <iant@google.com>
9045
9046 * configure.ac: Check for declarations for cases where libiberty.h
9047 checks HAVE_DECL_xxx.
9048 * configure, config.in: Rebuild.
9049
9050 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9051
9052 * gold.h (Incremental_argument_list): Remove (invalid) forward
9053 declaration.
9054 * incremental.cc (Incremental_inputs::report_achive): New method.
9055 (Incremental_inputs::report_object): New method.
9056 (Incremental_inputs::report_script): New method.
9057 (Incremental_inputs::finalize_inputs): New method.
9058 (Incremental_inputs::finalize): Call finalize_inputs().
9059 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9060 Create inputs entries.
9061 * incremental.h (Incremental_input_type): New enum.
9062 (Incremental_inputs::Incremental_input): Initialize new fields.
9063 (Incremental_inputs::report_inputs): New method.
9064 (Incremental_inputs::report_achive): New method.
9065 (Incremental_inputs::report_object): New method.
9066 (Incremental_inputs::report_script): New method.
9067 (Incremental_inputs::finalize_inputs): New method.
9068 (Incremental_inputs::Input_info): New struct.
9069 (Incremental_inputs::Input_info_map): New typedef.
9070 (Incremental_inputs::lock_): New field.
9071 (Incremental_inputs::Inputs_): New field.
9072 (Incremental_inputs::Inputs_map): New field.
9073 * main.cc (main): Call Incremental_input::report_inputs.
9074 * options.h (Input_argument_list): Typedef moved from
9075 Input_arguments.
9076 (Input_file_group::Files): Remove, use ::Input_argument_list.
9077 (Input_file_group::Input_argument_list): Remove, use
9078 ::Input_argument_list.
9079 * plugin.cc (Plugin_manager::add_input_file): Add error in
9080 incremental build.
9081 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9082 functions.
9083 * script.cc (read_input_script): Call
9084 Incremental_input::report_script.
9085 * script.h (Script_info): New class.
9086
9087 2009-04-27 Ian Lance Taylor <iant@google.com>
9088
9089 * x86_64.cc (do_adjust_output_section): Set entsize to
9090 plt_entry_size.
9091
9092 2009-04-23 Elliott Hughes <enh@google.com>
9093
9094 * output.cc (Output_file::close): After short writes, continue
9095 writing from the correct offset in the buffer being written.
9096
9097 2009-04-23 Chris Demetriou <cgd@google.com>
9098
9099 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9100 * configure: Regenerate.
9101 * config.in: Regenerate.
9102 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9103 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9104
9105 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9106
9107 * incremental.cc (Incremental_inputs_header_data): Renamed from
9108 Incremental_input_header_data.
9109 (Incremental_inputs_header_data::data_size): New field.
9110 (Incremental_inputs_header_data::put_input_file_count): Renamed
9111 from input_file_count.
9112 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9113 from command_line_offset.
9114 (Incremental_inputs_header_data::put_reserved): Renamed from
9115 put_reserved.
9116 (Incremental_inputs_entry_data): Renamed from
9117 Incremental_input_entry_data.
9118 (Incremental_inputs_entry_data::data_size): New field.
9119 (Incremental_inputs::report_command_line): New method.
9120 (Incremental_inputs::finalize): New method.
9121 (Incremental_inputs::create_incremental_inputs_data): New method.
9122 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9123 * incremental.h: New file.
9124 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9125 (Layout::finalize): Create incremental inputs section in
9126 incremental builds.
9127 (Layout::create_incremental_info_sections): New method.
9128 * layout.h (Layout::incremental_inputs): New method.
9129 (Layout::create_incremental_info_sections): New method.
9130 (Layout::incremental_inputs_): New field.
9131 * main.cc (main): Notify Incremental_input of the command line.
9132
9133 2009-04-01 Ian Lance Taylor <iant@google.com>
9134 Mikolaj Zalewski <mikolajz@google.com>
9135
9136 * gold.h (reserve_unordered_map): Define, three versions, one for
9137 each version of Unordered_map.
9138 * layout.cc (Layout::Layout): Remove options parameter. Add
9139 number_of_input_files parameter. Don't initialize options_.
9140 Initialize number_of_input_files_ and resized_signatures_. Move
9141 sections_are_attached_.
9142 (Layout::layout_group): Reserve space for group_signatures_.
9143 (Layout::find_or_add_kept_section): Change name parameter to be a
9144 reference. Resize signatures_ map when it gets large enough.
9145 (Layout::layout_eh_frame): Use parameters->options() instead of
9146 this->options_.
9147 (Layout::make_output_section): Likewise.
9148 (Layout::attach_allocated_section_to_segment): Likewise.
9149 (Layout::finalize, Layout::create_executable_stack): Likewise.
9150 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9151 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9152 * layout.h (class Layout): Update declarations. Remove options_
9153 field. Add number_of_input_files_ and resized_signatures_
9154 fields. Move sections_are_attached_ field.
9155 * main.cc (main): Pass number of input files to Layout
9156 constructor. Don't pass options.
9157
9158 2009-03-30 Ian Lance Taylor <iant@google.com>
9159
9160 * ffsll.c (ffsll): Correct implementation.
9161
9162 2009-03-27 Ian Lance Taylor <iant@google.com>
9163
9164 * ffsll.c: New file.
9165 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9166 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9167 * ftruncate.c (ftruncate): Declare before definition.
9168 * mremap.c (mremap): Likewise.
9169 * pread.c (pread): Likewise.
9170 * configure, Makefile.in, config.in: Rebuild.
9171
9172 * mremap.c: New file.
9173 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9174 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9175 (mremap): Declare if HAVE_MREMAP is not defined.
9176 * configure, Makefile.in, config.in: Rebuild.
9177
9178 2009-03-27 Cary Coutant <ccoutant@google.com>
9179
9180 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9181 position independent.
9182 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9183 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9184
9185 2009-03-24 Cary Coutant <ccoutant@google.com>
9186
9187 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9188 an executable.
9189 (needs_dynamic_reloc): Likewise.
9190
9191 2009-03-24 Ian Lance Taylor <iant@google.com>
9192
9193 * yyscript.y (file_cmd): Recognize EXTERN.
9194 (extern_name_list, extern_name_list_body): New nonterminals.
9195 * script.cc (script_add_extern): Define.
9196 * script-c.h (script_add_extern): Declare.
9197
9198 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
9199
9200 * object.cc (is_elf_object): Define.
9201 * object.h (is_elf_object): Declare.
9202 * archive.cc (Archive::get_elf_object_for_member): Call
9203 is_elf_object.
9204 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
9205
9206 2009-03-24 Elliott Hughes <enh@google.com>
9207
9208 * output.cc (Output_file::map_anonymous): Define.
9209 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9210 try an anonymous one. Report the size if the mmap fails.
9211 * output.h (class Output_file): Declare map_anonymous.
9212
9213 2009-03-24 Ian Lance Taylor <iant@google.com>
9214
9215 * target-select.cc (instantiate_target): Don't acquire the lock if
9216 the instantiated_target_ field has already been set.
9217
9218 2009-03-23 Ian Lance Taylor <iant@google.com>
9219
9220 * gold-threads.h (class Initialize_lock): Define.
9221 * gold-threads.cc (class Initialize_lock_once): Define.
9222 (initialize_lock_control): New static variable.
9223 (initialize_lock_pointer): New static variable.
9224 (initialize_lock_once): New static function.
9225 (Initialize_lock::Initialize_lock): Define.
9226 (Initialize_lock::initialize): Define.
9227 * target-select.h: Include "gold-threads.h".
9228 (class Target_selector): Add lock_ and initialize_lock_ fields.
9229 Don't define instantiate_target, just declare it.
9230 * target-select.cc (Target_selector::Target_selector): Initialize
9231 new fields.
9232 (Target_selector::instantiate_target): Define.
9233 * descriptors.h: Include "gold-threads.h".
9234 (class Descriptors): Add initialize_lock_ field.
9235 * descriptors.cc (Descriptors::Descriptors): Initialize new
9236 field.
9237 (Descriptors::open): Use initialize_lock_ field
9238 * errors.h (class Errors): Add initialize_lock_ field.
9239 * errors.cc (Errors::Errors): Initialize new field.
9240 (Errors::initialize_lock): Use initialize_lock_ field.
9241 * powerpc.cc (class Target_selector_powerpc): Remove
9242 instantiated_target_ field. In do_recognize call
9243 instantiate_target rather than do_instantiate_target. In
9244 do_instantiate_target just allocate a new target.
9245 * sparc.cc (class Target_selector_sparc): Likewise.
9246
9247 * freebsd.h: New file.
9248 * i386.cc: Include "freebsd.h".
9249 (Target_i386): Derive from Target_freebsd rather than
9250 Sized_target.
9251 (Target_selector_i386): Derive from Target_selector_freebsd rather
9252 than Target_selector.
9253 * x86_64.cc: Include "freebsd.h".
9254 (Target_x86_64): Derive from Target_freebsd rather than
9255 Sized_target.
9256 (Target_selector_x86_64): Derive from Target_selector_freebsd
9257 rather than Target_selector.
9258 * target.h (class Target): Add adjust_elf_header and
9259 do_adjust_elf_header.
9260 * output.cc (Output_file_header:: do_sized_write): Call target
9261 adjust_elf_header routine.
9262 * configure.tgt: Set targ_osabi.
9263 * configure.ac: Define GOLD_DEFAULT_OSABI.
9264 * parameters.cc (Parameters::default_target): Pass
9265 GOLD_DEFAULT_OSABI to select_target.
9266 * target-select.h (class Target_selector): Make instantiate_target
9267 protected rather than private.
9268 * Makefile.am (HFILES): Add freebsd.h.
9269 * configure, Makefile.in, config.in: Rebuild.
9270
9271 * merge.cc (do_add_input_section): Correct pend value. Change
9272 message about last entry not being null terminated from error to
9273 warning.
9274
9275 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9276
9277 * incremental.cc: New file.
9278 * Makefile.am (CCFILES): Add incremental.cc.
9279 * Makefile.in: Rebuild.
9280
9281 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9282
9283 * layout.cc (Layout::output_section_name): Preserve names
9284 of '.note.' sections.
9285
9286 2009-03-19 Ian Lance Taylor <iant@google.com>
9287
9288 * descriptors.cc (Descriptors::open): Check that the options are
9289 valid before using them.
9290
9291 2009-03-18 Ian Lance Taylor <iant@google.com>
9292
9293 * script-sections.h: Include <list>.
9294 (class Script_sections): Change Sections_elements from std::vector
9295 to std::list. Typedef public Elements_iterator. Add
9296 orphan_section_placement_, data_segment_align_start_, and
9297 saw_data_segment_align_ fields. Remove data_segment_align_index_
9298 field.
9299 * script-sections.cc (class Orphan_section_placement): New class.
9300 (class Sections_element): Add virtual functions is_relro and
9301 orphan_section_init. Remove virtual function place_orphan_here.
9302 (class Output_section_definition): Add is_relro and
9303 orphan_section_init. Remove place_orphan_here.
9304 (class Orphan_output_section): Likewise.
9305 (Script_sections::Script_sections): Update for field changes.
9306 (Script_sections::data_segment_align): Set saw_data_segment_align_
9307 and data_segment_align_start_, not data_segment_align_index.
9308 (Script_sections::data_segment_relro_end): Check
9309 saw_data_segment_align_. Use data_segment_align_start_ rather
9310 than data_segment_align_index_.
9311 (Script_sections::place_orphan): Rewrite to use
9312 Orphan_section_placement.
9313
9314 2009-03-17 Ian Lance Taylor <iant@google.com>
9315
9316 * archive.cc (Archive::add_symbols): Check for a version attached
9317 to the symbol name in the archive map.
9318 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9319 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9320 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9321 (ver_test_11.a): New target.
9322 * testsuite/Makefile.in: Rebuild.
9323
9324 * configure.ac: Check for chsize and posix_fallocate. Replace
9325 ftruncate.
9326 * ftruncate.c: New file, from gnulib.
9327 * output.cc (posix_fallocate): Define dummy version if not
9328 HAVE_POSIX_FALLOCATE.
9329 (Output_file::map): Call posix_fallocate rather than lseek and
9330 write.
9331 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9332 * configure, Makefile.in, config.in: Rebuild.
9333
9334 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
9335
9336 * layout.h (Layout::create_note): Add section_name parameter.
9337 * layout.cc (Layout::create_note): Likewise.
9338 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
9339
9340 2009-03-17 Ian Lance Taylor <iant@google.com>
9341
9342 * descriptors.cc: Include "options.h".
9343 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9344 (Descriptors::open): Always use O_CLOEXEC when opening a new
9345 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9346 then set FD_CLOEXEC.
9347
9348 * sparc.cc (class Target_sparc): Add has_got_section.
9349 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9350 make sure we have a GOT section.
9351
9352 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9353 (Target_sparc::Scan::local): Likewise.
9354 (Target_sparc::Scan::global): Likewise.
9355 (Target_sparc::Relocate::relocate): Likewise.
9356 (Target_sparc::Relocate::relocate_tls): Likewise.
9357
9358 * symtab.cc (Symbol_table::define_default_version): New function,
9359 broken out of add_from_object.
9360 (Symbol_table::add_from_object): Call define_default_version.
9361 (Symbol_table::define_special_symbol): Add resolve_oldsym
9362 parameter. Change all callers. If the version for a symbol comes
9363 from a version script, resolve it with the symbol with the same
9364 name with no version. Also add the symbol without a version if
9365 appropriate.
9366 (do_define_in_output_data): If resolving with oldsym, don't delete
9367 sym.
9368 (do_define_in_output_segment): Likewise.
9369 (do_define_as_constant): Likewise.
9370 * symtab.h (class Symbol_table): Update declarations.
9371
9372 2009-03-13 Ian Lance Taylor <iant@google.com>
9373
9374 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9375 (Read_symbols::requeue): New function.
9376 (Read_symbols::do_read_symbols): If make_elf_object fails because
9377 the target type is not configured, and the file was searched for,
9378 issue a warning and retry with the next directory.
9379 (Add_symbols::run): If the file has an incompatible format, and
9380 it was searched for, requeue the Read_symbols task. On error,
9381 release the object.
9382 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9383 dirindex parameter to constructor. Change all callers. Declare
9384 incompatible_warning and requeue.
9385 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9386 input_argument_ and input_group_ fields. Add them to
9387 constructor. Change all callers.
9388 (class Read_script): Add dirindex_ field. Add it to constructor.
9389 Change all callers.
9390 * archive.cc (Archive::setup): Remove input_objects parameter.
9391 Change all callers.
9392 (Archive::get_file_and_offset): Likewise.
9393 (Archive::read_all_symbols): Likewise.
9394 (Archive::read_symbols): Likewise.
9395 (Archive::get_elf_object_for_member): Remove input_objects
9396 parameter. Add punconfigured parameter. Change all callers.
9397 (Archive::add_symbols): Change return type to bool. Check return
9398 value of include_member.
9399 (Archive::include_all_members): Likewise.
9400 (Archive::include_member): Change return type to bool. Return
9401 false if first included object has incompatible target. Set
9402 included_member_ field.
9403 (Add_archive_symbols::run): If add_symbols returns false, requeue
9404 Read_symbols task.
9405 * archive.h (class Archive): Add included_member_ field.
9406 Initialize it in constructor. Add input_file and searched_for
9407 methods. Update declarations.
9408 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9409 input_argument_ fields. Add them to constructor. Change all
9410 callers.
9411 * script.cc: Include "target-select.h".
9412 (class Parser_closure): Add skip_on_incompatible_target_ and
9413 found_incompatible_target_ fields. Add
9414 skip_on_incompatible_target parameter to constructor. Change all
9415 callers. Add methods skip_on_incompatible_target,
9416 clear_skip_on_incompatible_target, found_incompatible_target, and
9417 set_found_incompatible_target.
9418 (read_input_script): Add dirindex parameter. Change all callers.
9419 If parser finds an incompatible target, requeue Read_symbols
9420 task.
9421 (script_set_symbol): Clear skip_on_incompatible_target in
9422 closure.
9423 (script_add_assertion, script_parse_option): Likewise.
9424 (script_start_sections, script_add_phdr): Likewise.
9425 (script_check_output_format): New function.
9426 * script.h (read_input_script): Update declaration.
9427 * script-c.h (script_check_output_format): Declare.
9428 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9429 (ignore_cmd): Remove OUTPUT_FORMAT.
9430 * fileread.cc (Input_file::Input_file): Add explicit this.
9431 (Input_file::will_search_for): New function.
9432 (Input_file::open): Add pindex parameter. Change all callers.
9433 * fileread.h (class Input_file): Add input_file_argument method.
9434 Declare will_search_for. Update declarations.
9435 * object.cc (make_elf_object): Add punconfigured parameter.
9436 Change all callers.
9437 * object.h (class Object): Make input_file public. Add
9438 searched_for method.
9439 (make_elf_object): Update declaration.
9440 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9441 restart search.
9442 * dirsearch.h (class Dirsearch): Update declaration.
9443 * options.h (class General_options): Add --warn-search-mismatch.
9444 * parameters.cc (Parameters::is_compatible_target): New function.
9445 * parameters.h (class Parameters): Declare is_compatible_target.
9446 * workqueue.cc (Workqueue::add_blocker): New function.
9447 * workqueue.h (class Workqueue): Declare add_blocker.
9448
9449 * fileread.cc (Input_file::open): Remove options parameter.
9450 Change all callers.
9451 (Input_file::open_binary): Likewise.
9452 * script.cc (read_input_script): Likewise.
9453 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9454 options parameter from constructor. Change all callers.
9455 (class Read_script): Likewise.
9456 * fileread.h (class Input_file): Update declarations.
9457 * script.h (read_input_script): Update declaration.
9458
9459 2009-03-10 Nick Clifton <nickc@redhat.com>
9460
9461 * po/es.po: New Spanish translation.
9462
9463 2009-03-06 Cary Coutant <ccoutant@google.com>
9464
9465 * options.cc (parse_short_option): Keep dash_z from registering itself.
9466
9467 2009-03-03 Ian Lance Taylor <iant@google.com>
9468
9469 PR 9918
9470 * target-reloc.h (relocate_section): Pass output_section to
9471 relocate.
9472 * i386.cc (Target_i386::should_apply_static_reloc): Add
9473 output_section parameter. Change all callers.
9474 (Target_i386::Relocate::relocate): Add output_section parameter.
9475 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9476 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9477 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9478 * testsuite/two_file_shared.sh: New script.
9479 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9480 (check_DATA): Add two_file_shared.dbg.
9481 (two_file_shared.dbg): New target.
9482 * testsuite/Makefile.in: Rebuild.
9483
9484 2009-03-01 Ian Lance Taylor <iant@google.com>
9485
9486 * configure.ac: Check for byteswap.h.
9487 * configure: Rebuild.
9488 * config.in: Rebuild.
9489
9490 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9491
9492 * layout.cc (Layout::find_or_add_kept_section): New function.
9493 (Layout::add_comdat): Removed.
9494 * layout.h (struct Kept_section): Move out of class Layout.
9495 Remove trailing underscores from field names. Add group_sections
9496 field. Rename group_ field to is_group. Change all uses.
9497 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9498 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9499 comdat_groups_ field.
9500 (Sized_relobj::include_section_group): Use
9501 find_or_add_kept_section and Kept_section::group_sections.
9502 (Sized_relobj::include_linkonce_section): Likewise.
9503 * object.cc (class Sized_relobj): Don't define Comdat_group or
9504 Comdat_group_table. Remove find_comdat_group and
9505 add_comdat_group. Remove comdat_groups_ field.
9506 * plugin.cc (include_comdat_group): Use
9507 Layout::find_or_add_kept_section.
9508
9509 2009-02-28 Ian Lance Taylor <iant@google.com>
9510
9511 * README: --gc-sections and map files are now supported. Document
9512 some build requirements.
9513
9514 PR 6992
9515 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9516 relocatable link set the value of the section symbol to zero.
9517 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9518 relocatable link don't include the section address in the local
9519 symbol value.
9520
9521 2009-02-27 Ian Lance Taylor <iant@google.com>
9522
9523 PR 6811
9524 * options.h (class Search_directory): Add is_system_directory.
9525 (class General_options): Declare is_in_system_directory.
9526 * options.cc (get_relative_sysroot): Make static.
9527 (get_default_sysroot): Make static.
9528 (General_optoins::is_in_system_directory): New function.
9529 * fileread.cc (Input_file::is_in_system_directory): New function.
9530 * fileread.h (class Input_file): Declare is_in_system_directory.
9531 * object.h (class Object): Add is_in_system_directory.
9532 (class Input_objects): Remove system_library_directory_ field.
9533 * object.cc (Input_objects::add_object): Don't set
9534 system_library_directory_.
9535 (input_objects::found_in_system_library_directory): Remove.
9536 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9537 parameter. Change all callers.
9538 (Symbol_table::sized_write_globals): Likewise.
9539 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9540 Call Object::is_in_system_directory.
9541 * symtab.h (class Symbol_table): Update declarations.
9542
9543 PR 5990
9544 * descriptors.h (Open_descriptor): Add is_on_stack field.
9545 * descriptors.cc (Descriptors::open): If the descriptor is on the
9546 top of the stack, remove it. Initialize is_on_stack field.
9547 (Descriptors::release): Only add pod to stack if it is not on the
9548 stack already.
9549 (Descriptors::close_some_descriptor): Clear stack_next and
9550 is_on_stack fields.
9551
9552 PR 7091
9553 * output.cc (Output_section::find_starting_output_address): Rename
9554 from starting_output_address; add PADDR parameter; change return
9555 type.
9556 * output.h (class Output_section): Declare
9557 find_starting_output_address instead of starting_output_address.
9558 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9559 section symbol for which we can't find a merge section.
9560
9561 PR 9836
9562 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9563 hidden or internal, force the symbol to be local.
9564 * resolve.cc (Symbol::override_visibility): Define.
9565 (Symbol::override_base): Use override_visibility.
9566 (Symbol_table::resolve): Likewise.
9567 (Symbol::override_base_with_special): Likewise.
9568 (Symbol_table::override_with_special): If the visibility is hidden
9569 or internal, force the symbol to be local.
9570 * symtab.h (class Symbol): Add set_visibility and
9571 override_visibility.
9572 * testsuite/ver_test_1.sh: New file.
9573 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9574 (check_DATA): Add ver_test_1.syms.
9575 (ver_test_1.syms): New target.
9576 * testsuite/Makefile.in: Rebuild.
9577
9578 2009-02-25 Cary Coutant <ccoutant@google.com>
9579
9580 * layout.cc (Layout::choose_output_section): Don't rename sections
9581 when using a linker script that has a SECTIONS clause.
9582 * Makefile.in: Regenerate.
9583
9584 * testsuite/Makefile.am (script_test_5.sh): New test case.
9585 * testsuite/Makefile.in: Regenerate.
9586 * testsuite/script_test_5.cc: New file.
9587 * testsuite/script_test_5.sh: New file.
9588 * testsuite/script_test_5.t: New file.
9589
9590 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9591
9592 * archive.cc (Archive::include_member): Update calls to add_symbols.
9593 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9594 the Layout argument.
9595 * dynobj.h (do_add_symbols): Add the Layout argument.
9596 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9597 Layout argument.
9598 * object.h (Object::add_symbols): Add the Layout argument.
9599 (Object::do_add_symbols): Add the Layout argument.
9600 (Sized_relobj::do_add_symbols): Add the Layout argument.
9601 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9602 Unify the two versions.
9603 (Add_plugin_symbols): Remove.
9604 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9605 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9606 (Add_plugin_symbols): Remove.
9607 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9608 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9609 (Add_symbols::run): Make it work with Pulginobj.
9610
9611 2009-02-06 Ian Lance Taylor <iant@google.com>
9612
9613 * object.cc (Sized_relobj::do_layout): Make info message start
9614 with lower case letter.
9615
9616 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9617
9618 * binary.cc: Fix file comment.
9619
9620 * options.h (enum Incremental_disposition): Define.
9621 (class General_options): Add new options: --incremental,
9622 --incremental_changed, --incremental_unchanged,
9623 --incremental_unknown. Add incremental_disposition_ and
9624 implicit_incremental_ fields.
9625 (General_options::incremental_disposition): New function.
9626 (class Position_dependent_options): Add incremental_disposition
9627 option.
9628 (Position_dependent_options::copy_from_options): Set incremental
9629 dispositions.
9630 * options.cc (General_options::parse_incremental_changed): New
9631 function.
9632 (General_options::parse_incremental_unchanged): New function.
9633 (General_options::parse_incremental_unknown): New function.
9634 (General_options::General_options): Initialize new fields
9635 incremental_disposition_ and implicit_incremental_.
9636 (General_options::finalize): Check for uasge of --incremental-*
9637 without --incremental.
9638
9639 2009-02-06 Chris Demetriou <cgd@google.com>
9640
9641 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9642 pointer and to report location as the file name associated with
9643 the symbol.
9644 (gold_undefined_symbol_at_location): New function to replace the
9645 old gold_undefined_symbol functionality.
9646 * target-reloc.h (relocate_section): Update to use
9647 gold_undefined_symbol_at_location.
9648 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9649 Call gold_undefined_symbol function rather than gold_error.
9650 * errors.h (Errors::undefined_symbol): Take location as a
9651 string, rather than calculating it from a relocation.
9652 * errors.cc (Errors::fatal): Print "fatal error:" before the
9653 formatted message.
9654 (Errors::error, Errors::error_at_location): Print "error: "
9655 before the formatted message.
9656 (Errors::undefined_symbol): Take location as a string, rather
9657 than calculating it from a relocation.
9658 (gold_undefined_symbol_at_location): New function akin to
9659 old gold_undefined_symbol, calculates location from relocation.
9660 (gold_undefined_symbol): Change to take only a Symbol pointer
9661 and to report location as the file name associated with the symbol.
9662 * testsuite/debug_msg.sh: Update for changed error messages.
9663 * testsuite/undef_symbol.sh: Likewise.
9664
9665 2009-02-04 Duncan Sands <baldrick@free.fr>
9666
9667 PR 9812
9668 * reduced_debug_output.h
9669 (Output_reduced_debug_abbrev_section::failed): Use format for
9670 gold_warning.
9671 (Output_reduced_debug_info_section::faild): Likewise.
9672
9673 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9674
9675 * script.cc (Lazy_demangler): New class.
9676 (Version_script_info::get_symbol_version_helper): Demangle a
9677 symbol only once.
9678
9679 2009-01-29 Cary Coutant <ccoutant@google.com>
9680
9681 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9682 to __tls_get_addr.
9683 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9684
9685 2009-01-28 Ian Lance Taylor <iant@google.com>
9686
9687 * version.cc (version_string): Bump to 1.9.
9688
9689 * gold.h: Include <cstring> and <stdint.h>.
9690 * version.cc: Include <cstdio>.
9691 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9692 warning.
9693 * reduced_debug_output.cc (insert_into_vector): Rename from
9694 Insert_into_vector; change all callers. Use Swap_unaligned to
9695 avoid aliasing issue; remove union since it is unnecessary.
9696
9697 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9698
9699 * Makefile.am (CCFILES): Add gc.cc.
9700 (HFILES): Add gc.h.
9701 * Makefile.in: Regenerate.
9702 * gold.cc (Gc_runner): New class.
9703 (queue_initial_tasks): Call garbage collection related tasks
9704 when corresponding options are invoked.
9705 (queue_middle_gc_tasks): New function.
9706 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9707 processed early before laying out sections during garbage collection.
9708 * gold.h (queue_middle_gc_tasks): New function.
9709 (is_prefix_of): Move from "layout.cc".
9710 * i386.cc (Target_i386::gc_process_relocs): New function.
9711 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9712 * main.cc (main): Create object of class "Garbage_collection".
9713 * object.cc (Relobj::copy_symbols_data): New function.
9714 (Relobj::is_section_name_included): New function.
9715 (Sized_relobj::do_layout): Allow this function to be called twice
9716 during garbage collection and defer layout of section during the
9717 first call.
9718 * object.h (Relobj::get_symbols_data): New function.
9719 (Relobj::is_section_name_included): New function.
9720 (Relobj::copy_symbols_data): New function.
9721 (Relobj::set_symbols_data): New function.
9722 (Relobj::get_relocs_data): New function.
9723 (Relobj::set_relocs_data): New function.
9724 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9725 (Relobj::gc_process_relocs): New function.
9726 (Relobj::do_gc_process_relocs): New pure virtual function.
9727 (Relobj::sd_): New data member.
9728 (Sized_relobj::is_output_section_offset_invalid): New function.
9729 (Sized_relobj::do_gc_process_relocs): New function.
9730 * options.h (General_options::gc_sections): Modify to not be a no-op.
9731 (General_options::print_gc_sections): New option.
9732 * plugin.cc (Plugin_finish::run): Remove function call to
9733 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9734 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9735 * reloc.cc (Read_relocs::run): Add task to process relocs and
9736 determine unreferenced sections when doing garbage collection.
9737 (Gc_process_relocs): New class.
9738 (Sized_relobj::do_gc_process_relocs): New function.
9739 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9740 sections that are garbage collected.
9741 * reloc.h (Gc_process_relocs): New class.
9742 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9743 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9744 symbols whose corresponding sections are garbage collected.
9745 (Symbol_table::Symbol_table): Add new parameter for the garbage
9746 collection object.
9747 (Symbol_table::gc_mark_undef_symbols): New function.
9748 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9749 (Symbol_table::gc_mark_dyn_syms): New function.
9750 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9751 as garbage.
9752 (Symbol_table::add_from_object): Likewise.
9753 (Symbol_table::add_from_relobj): When building shared objects, do not
9754 treat externally visible symbols as garbage.
9755 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9756 table information for static and relocatable links.
9757 * symtab.h (Symbol_table::set_gc): New function.
9758 (Symbol_table::gc): New function.
9759 (Symbol_table::gc_mark_undef_symbols): New function.
9760 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9761 (Symbol_table::gc_mark_dyn_syms): New function.
9762 (Symbol_table::gc_): New data member.
9763 * target.h (Sized_target::gc_process_relocs): New pure virtual
9764 function.
9765 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9766 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9767
9768 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9769
9770 * options.h (General_options::gc_sections): Define as a no-op for now.
9771 (General_options::no_keep_memory): Ditto.
9772 (General_options::Bshareable): Define.
9773 * options.cc (General_options::finalize): Honor -Bshareable.
9774
9775 2009-01-20 Andreas Schwab <schwab@suse.de>
9776
9777 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9778 read the value in the contents, since we don't use it. Use the
9779 template endianness when writing.
9780 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9781
9782 2009-01-19 Andreas Schwab <schwab@suse.de>
9783
9784 * configure.tgt (powerpc64-*): Fix targ_obj.
9785
9786 2009-01-15 Ian Lance Taylor <iant@google.com>
9787
9788 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9789 local symbols when stripping all symbols.
9790
9791 2009-01-14 Cary Coutant <ccoutant@google.com>
9792
9793 * output.cc (Output_reloc): Add explicit instantiations.
9794
9795 2009-01-14 Cary Coutant <ccoutant@google.com>
9796
9797 * archive.cc (Archive::get_elf_object_for_member): Remove call
9798 to File_read::claim_for_plugin.
9799 * descriptors.cc (Descriptors::open): Remove reference to
9800 is_claimed.
9801 (Descriptors::claim_for_plugin): Remove.
9802 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9803 (Descriptors::is_claimed): Remove.
9804 (claim_descriptor_for_plugin): Remove.
9805 * fileread.cc (File_read::claim_for_plugin): Remove.
9806 * fileread.h (File_read::claim_for_plugin): Remove.
9807 (File_read::descriptor): Reopen descriptor if necessary.
9808 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9809 (Plugin_manager::all_symbols_read): Add task parameter. Change
9810 all callers.
9811 (Plugin_manager::get_input_file): New function.
9812 (Plugin_manager::release_input_file): New function.
9813 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9814 corresponding data member.
9815 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9816 and pass to base constructor. Change all callers.
9817 (get_input_file, release_input_file): New functions.
9818 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9819 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9820 (Plugin_manager::all_symbols_read): Add task parameter.
9821 (Plugin_manager::get_input_file): New function.
9822 (Plugin_manager::release_input_file): New function.
9823 (Plugin_manager::task_): New data member.
9824 (Pluginobj::Pluginobj): Add filesize parameter.
9825 (Pluginobj::filename): New function.
9826 (Pluginobj::descriptor): New function.
9827 (Pluginobj::filesize): New function.
9828 (Pluginobj::filesize_): New data member.
9829 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9830 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9831 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9832
9833 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9834 with archive libraries.
9835 * testsuite/Makefile.in: Regenerate.
9836 * testsuite/plugin_test.c (struct sym_info): New type.
9837 (get_input_file, release_input_file): New static variables.
9838 (onload): Capture new transfer vector entries.
9839 (claim_file_hook): Stop reading at end of file according to filesize.
9840 Factor out parsing of readelf output into separate function.
9841 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9842 APIs and get the source file name from the symbol table. Convert
9843 source file name to corresponding object file name. Print info
9844 message when adding new input files.
9845 (parse_readelf_line): New function.
9846 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9847 * testsuite/plugin_test_2.sh: Likewise.
9848 * testsuite/plugin_test_3.sh: Likewise.
9849 * testsuite/plugin_test_4.sh: New test case.
9850
9851 2009-01-07 Ian Lance Taylor <iant@google.com>
9852
9853 * version.cc (version_string): Bump to 1.8.
9854
9855 2008-12-23 Cary Coutant <ccoutant@google.com>
9856
9857 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9858 * plugin.cc (Plugin_manager::finish): Rename as
9859 layout_deferred_objects. Move cleanup to separate function.
9860 (Plugin_manager::cleanup): New function.
9861 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9862 separately.
9863 * plugin.h (Plugin_manager::finish): Rename as
9864 layout_deferred_objects.
9865 (Plugin_manager::cleanup): New function.
9866 (Plugin_manager::cleanup_done): New field.
9867
9868 2008-12-23 Cary Coutant <ccoutant@google.com>
9869
9870 * plugin.cc (is_visible_from_outside): New function.
9871 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9872 so we don't return "IR only" status for exported symbols or -r links.
9873
9874 * testsuite/Makefile.am (plugin_test_3): New test case.
9875 * testsuite/Makefile.in: Regenerate.
9876 * testsuite/plugin_test_3.sh: New file.
9877
9878 2008-12-22 Cary Coutant <ccoutant@google.com>
9879
9880 * object.cc (Sized_relobj::layout_section): New function.
9881 (Sized_relobj::do_layout): Defer layout of input sections until after
9882 plugin has provided replacement files.
9883 (Sized_relobj::do_layout_deferred_sections): New function.
9884 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9885 (Relobj::layout_deferred_sections): New function.
9886 (Relobj::do_layout_deferred_sections): New function.
9887 (Sized_relobj::do_layout_deferred_sections): New function.
9888 (Sized_relobj::layout_section): New function.
9889 (Sized_relobj::Deferred_layout): New structure.
9890 (Sized_relobj::deferred_layout_): New field.
9891 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9892 Change all callers. Layout deferred sections.
9893 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9894 references.
9895 (Plugin_hook::run): Move code from do_plugin_hook inline.
9896 (Plugin_hook::do_plugin_hook): Remove.
9897 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9898 (Plugin_manager::finish): Renamed, was cleanup.
9899 (Plugin_manager::should_defer_layout): New function.
9900 (Plugin_manager::add_deferred_layout_object): New function.
9901 (Plugin_manager::Deferred_layout_list): New type.
9902 (Plugin_manager::deferred_layout_objects_): New field.
9903 (Plugin_hook::do_plugin_hook): Remove.
9904
9905 2008-12-17 Ian Lance Taylor <iant@google.com>
9906
9907 * options.h (class General_options): Add --no case for
9908 --export-dynamic.
9909
9910 2008-12-16 Cary Coutant <ccoutant@google.com>
9911
9912 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9913 vector.
9914 (Plugin_manager::claim_file): Create plugin object even if
9915 plugin did not call the add_symbols callback.
9916 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9917 asking for more symbols than were added.
9918 * testsuite/Makefile.am (plugin_test_1): Add test case with
9919 no global symbols.
9920 (empty.syms): New target.
9921 * testsuite/Makefile.in: Regenerate.
9922 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9923 message. Don't call add_symbols if no globals.
9924 (all_symbols_read_hook): Don't provide replacement for empty
9925 claimed file.
9926
9927 2008-12-12 Ian Lance Taylor <iant@google.com>
9928
9929 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9930 r_type == 0 for a local symbol with r_sym == 0.
9931 (scan_relocatable_relocs): Pass r_sym to
9932 local_non_section_strategy.
9933 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9934 r_sym parameter.
9935
9936 * configure.ac: Update test for TLS descriptors: they are
9937 supported as of glibc 2.9.
9938 * configure: Rebuild.
9939
9940 2008-12-11 Ian Lance Taylor <iant@google.com>
9941
9942 PR 7091
9943 * target-reloc.h (Default_scan_relocatable_relocs): For each
9944 function, map r_type == 0 to RELOC_DISCARD.
9945
9946 2008-12-10 Cary Coutant <ccoutant@google.com>
9947
9948 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9949 object to override a kept COMDAT group from a plugin object.
9950
9951 2008-12-09 Ian Lance Taylor <iant@google.com>
9952
9953 PR 7088
9954 * yyscript.y (file_cmd): Handle INPUT.
9955
9956 * testsuite/initpri1.c: Change all declarations to be full
9957 prototypes by adding void, to avoid compiler warnings.
9958
9959 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9960
9961 * options.cc (General_options::parse_plugin_opt): New.
9962 (General_options::add_plugin): The argument now is just the filename.
9963 (General_options::add_plugin_option): New.
9964 * options.h (plugin_opt): New.
9965 (add_plugin): Change argument name.
9966 (add_plugin_option): New.
9967 * plugin.cc (Plugin::load): Don't parse the plugin option.
9968 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9969 (Plugin::add_option): New.
9970 (Plugin::args_): Change type.
9971 (Plugin::filename_): New.
9972 (Plugin_manager::add_plugin_option): New.
9973 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9974 * testsuite/Makefile.in: Regenerate.
9975
9976 2008-12-05 Cary Coutant <ccoutant@google.com>
9977
9978 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9979 Handle --strip-lto-sections option.
9980 * options.h (strip_lto_sections): New option.
9981
9982 2008-12-01 Cary Coutant <ccoutant@google.com>
9983
9984 * plugin.cc (ld_plugin_message): Change format parameter to const.
9985 Fix mismatch between new[] and delete.
9986
9987 2008-11-14 Cary Coutant <ccoutant@google.com>
9988
9989 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9990 instead of -1U.
9991
9992 2008-11-05 Craig Silverstein <csilvers@google.com>
9993
9994 * options.cc (General_options::parse_dynamic_list): New function.
9995 * options.h (General_options): New flags dynamic_list,
9996 dynamic_list_data, dynamic_list_cpp_new, and
9997 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9998 (General_options::in_dynamic_list): New function.
9999 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10000 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10001 (Lex::can_continue_name): Likewise.
10002 (yylex): Likewise.
10003 (read_script_file): New parameter script_options.
10004 (read_dynamic_list): New function.
10005 (Script_options::define_dynamic_list): New function.
10006 (dynamic_list_keyword_parsecodes): New variable.
10007 (dynamic_list_keywords): New variable.
10008 * script.h (Script_options::define_dynamic_list): New function
10009 prototype.
10010 (read_dynamic_list): New function prototype.
10011 * symtab.cc (strprefix): New macro.
10012 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10013 dynamic_list_data, dynamic_list_cpp_new, and
10014 dynamic_list_cpp_typeinfo.
10015 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10016 (dynamic_list_expr): New rule.
10017 (dynamic_list_nodes): Likewise.
10018 (dynamic_list_node): Likewise.
10019 * testsuite/Makefile.am (dynamic_list): New test.
10020 * testsuite/Makefile.in: Regenerated.
10021 * testsuite/dynamic_list.t: New file.
10022 * testsuite/dynamic_list.sh: New file.
10023
10024 2008-11-05 Craig Silverstein <csilvers@google.com>
10025
10026 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10027 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10028 (t11_last): Likewise.
10029 * testsuite/ver_test_6.c (main): Likewise.
10030
10031 2008-10-07 Cary Coutant <ccoutant@google.com>
10032
10033 * options.c (General_options::finalize): Add check for -static and
10034 -shared.
10035 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10036 is not empty.
10037
10038 2008-10-02 Cary Coutant <ccoutant@google.com>
10039
10040 * plugin.cc (make_sized_plugin_object): Fix conditional
10041 compilation to work when not all targets are enabled.
10042
10043 2008-09-29 Cary Coutant <ccoutant@google.com>
10044
10045 * archive.cc (Archive::get_file_and_offset): Use filename instead
10046 of name to get library path.
10047 (Archive::include_member): Unlock external member of a thin archive.
10048
10049 * testsuite/Makefile.am (TEST_AR): New variable.
10050 (thin_archive_test_1): New test.
10051 (thin_archive_test_2): New test.
10052 * testsuite/Makefile.in: Regenerate.
10053 * testsuite/thin_archive_main.cc: New file.
10054 * testsuite/thin_archive_test_1.cc: New file.
10055 * testsuite/thin_archive_test_2.cc: New file.
10056 * testsuite/thin_archive_test_3.cc: New file.
10057 * testsuite/thin_archive_test_4.cc: New file.
10058
10059 2008-09-29 Cary Coutant <ccoutant@google.com>
10060
10061 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10062 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10063 instead of -1U.
10064 (Sized_relobj::do_finalize_local_symbols): Likewise.
10065 (Sized_relobj::map_to_kept_section): Likewise.
10066 * object.h (Sized_relobj::invalid_address): New constant.
10067 (Sized_relobj::do_output_section_offset): Check for invalid_address
10068 and return -1ULL.
10069 * output.cc (Output_reloc::local_section_offset): Use constant
10070 invalid_address instead of -1U.
10071 (Output_reloc::get_address): Likewise.
10072 (Output_section::output_address): Change -1U to -1ULL.
10073 * output.h (Output_reloc::invalid_address): New constant.
10074 * reloc.cc (Sized_relobj::write_sections): Use constant
10075 invalid_address instead of -1U.
10076 (Sized_relobj::relocate_sections): Likewise.
10077 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10078 values for merge sections.
10079 * target-reloc.h (relocate_for_relocatable): Use constant
10080 invalid_address instead of -1U.
10081
10082 2008-09-19 Cary Coutant <ccoutant@google.com>
10083
10084 Add plugin functionality for link-time optimization (LTO).
10085 * configure.ac (plugins): Add --enable-plugins option.
10086 * configure: Regenerate.
10087 * config.in: Regenerate.
10088 * Makefile.am (LIBDL): New variable.
10089 (CCFILES): Add plugin.cc.
10090 (HFILES): Add plugin.h.
10091 (ldadd_var): Add LIBDL.
10092 * Makefile.in: Regenerate.
10093
10094 * archive.cc: Include "plugin.h".
10095 (Archive::setup): Don't preread archive symbols when using a plugin.
10096 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10097 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10098 files.
10099 (Archive::include_member): Add symbols from plugin objects.
10100 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10101 * descriptors.cc (Descriptors::open): Check for file descriptors
10102 abandoned by plugins.
10103 (Descriptors::claim_for_plugin): New function.
10104 * descriptors.h (Descriptors::claim_for_plugin): New function.
10105 (Open_descriptor::is_claimed): New field.
10106 (claim_descriptor_for_plugin): New function.
10107 * fileread.cc (File_read::claim_for_plugin): New function.
10108 * fileread.h (File_read::claim_for_plugin): New function.
10109 (File_read::descriptor): New function.
10110 * gold.cc: Include "plugin.h".
10111 (queue_initial_tasks): Add task to call plugin hooks for generating
10112 new object files.
10113 * main.cc: Include "plugin.h".
10114 (main): Load plugin libraries.
10115 * object.h (Pluginobj): Declare.
10116 (Object::pluginobj): New function.
10117 (Object::do_pluginobj): New function.
10118 (Object::set_target): New function.
10119 * options.cc: Include "plugin.h".
10120 (General_options::parse_plugin): New function.
10121 (General_options::General_options): Initialize plugins_ field.
10122 (General_options::add_plugin): New function.
10123 * options.h (Plugin_manager): Declare.
10124 (General_options): Add --plugin option.
10125 (General_options::has_plugins): New function.
10126 (General_options::plugins): New function.
10127 (General_options::add_plugin): New function.
10128 (General_options::plugins_): New field.
10129 * plugin.cc: New file.
10130 * plugin.h: New file.
10131 * readsyms.cc: Include "plugin.h".
10132 (Read_symbols::do_read_symbols): Check for archive before checking
10133 for ELF file. Call plugin hooks to claim files.
10134 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10135 from a real object file; force override when processing replacement
10136 files.
10137 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10138 (Symbol::init_base_object): Likewise.
10139 (Symbol::init_base_output_data): Likewise.
10140 (Symbol::init_base_output_segment): Likewise.
10141 (Symbol::init_base_constant): Likewise.
10142 (Symbol::init_base_undefined): Likewise.
10143 (Symbol::output_section): Assert that object is not a plugin.
10144 (Symbol_table::add_from_pluginobj): New function.
10145 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10146 undefined.
10147 (Symbol_table::sized_write_globals): Likewise.
10148 (Symbol_table::add_from_pluginobj): Instantiate template.
10149 * symtab.h (Sized_pluginobj): Declare.
10150 (Symbol::in_real_elf): New function.
10151 (Symbol::set_in_real_elf): New function.
10152 (Symbol::in_real_elf_): New field.
10153 (Symbol_table::add_from_pluginobj): New function.
10154
10155 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10156 (LIBDL): New variable.
10157 (LDADD): Add LIBDL.
10158 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10159 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10160 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10161 (MOSTLYCLEANFILES): Likewise.
10162 * testsuite/Makefile.in: Regenerate.
10163 * testsuite/plugin_test.c: New file.
10164 * testsuite/plugin_test_1.sh: New file.
10165 * testsuite/plugin_test_2.sh: New file.
10166
10167 2008-09-16 Ian Lance Taylor <iant@google.com>
10168
10169 * target-reloc.h (relocate_section): Check whether a symbol is
10170 defined by the ABI before reporting an undefined symbol error.
10171 * target.h (Target::is_defined_by_abi): Make parameter const.
10172 (Target::do_is_defined_by_abi): Likewise.
10173 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10174 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10175 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10176 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10177 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10178 * testsuite/Makefile.in: Rebuild.
10179
10180 * fileread.cc (make_view): Add casts to avoid warning.
10181
10182 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10183
10184 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10185 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10186
10187 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
10188
10189 * options.h (General_options::output_is_executable): New.
10190 (General_options::output_is_pie): New.
10191 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10192 for shared libraries.
10193 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10194
10195 2008-09-11 Chris Demetriou <cgd@google.com>
10196
10197 * options.h (origin): New -z option.
10198 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10199 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10200 in DT_FLAGS_1.
10201
10202 2008-09-05 Cary Coutant <ccoutant@google.com>
10203
10204 * fileread.cc (File_read::make_view): Add check for attempt to map
10205 beyond end of file.
10206
10207 2008-09-05 Cary Coutant <ccoutant@google.com>
10208
10209 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10210 explicit instantiations.
10211
10212 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10213
10214 PR gold/6858
10215 * options.cc (General_options::finalize): Allow undefined symbols
10216 in shlibs if linking -shared.
10217
10218 PR gold/6859
10219 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10220 symbols as not needing a dynsym entry.
10221
10222 2008-08-20 Craig Silverstein <csilvers@google.com>
10223
10224 * fileread.cc (File_read::open): Do not lock the file unless it
10225 was successfully opened.
10226
10227 2008-08-14 Cary Coutant <ccoutant@google.com>
10228
10229 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10230 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10231 * testsuite/tls_test.cc (struct int128): 128-bit struct
10232 for testing TLS relocs with non-zero addend.
10233 (v12): New TLS variable.
10234 (t12): New test.
10235 (t_last): Add check for v12.
10236 * testsuite/tls_test.h (t12): New function.
10237 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10238
10239 2008-08-13 Ian Lance Taylor <iant@google.com>
10240
10241 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10242 set tls_segment_ or relro_segment_.
10243 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10244 when appropriate.
10245 * output.h (Output_section::clear_is_relro): New function.
10246 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10247 sections specially even when output_data_ is empty.
10248 (Output_segment::maximum_alignment): When first section is relro,
10249 only force alignment for PT_LOAD segments.
10250 * script.cc (script_data_segment_align): New function.
10251 (script_data_segment_relro_end): New function.
10252 * script-c.h (script_data_segment_align): Declare.
10253 (script_data_segment_relro_end): Declare.
10254 * script-sections.h (class Script_sections): Declare
10255 data_segment_align and data_segment_relro_end. Add fields
10256 segment_align_index_ and saw_relro_end_.
10257 * script-sections.cc (class Sections_element): Add set_is_relro
10258 virtual function. Add new bool* parameter to place_orphan_here.
10259 Add get_output_section virtual function.
10260 (class Output_section_definition): Add set_is_relro. Add new
10261 bool* parameter to place_orphan_here. Add get_output_section.
10262 Add is_relro_ field.
10263 (Output_section_definition::Output_section_definition): Initialize
10264 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10265 and is_relro_ fields.
10266 (Output_section_definition::place_orphan_here): Add is_relro
10267 parameter.
10268 (Output_section_definition::set_section_addresses): Set relro for
10269 output section.
10270 (Output_section_definition::alternate_constraint): Likewise.
10271 (class Orphan_output_section): Add new bool* parameter to
10272 place_orphan_here. Add get_output_section.
10273 (Orphan_output_section::place_orphan_here): Add is_relro
10274 parameter.
10275 (Script_sections::Script_sections): Initialize
10276 data_segment_align_index_ and saw_relro_end_.
10277 (Script_sections::data_segment_align): New function.
10278 (Script_sections::data_segment_relro_end): New function.
10279 (Script_sections::place_orphan): Set or clear is_relro.
10280 (Script_sections::set_section_addresses): Force alignment of first
10281 TLS section.
10282 * yyscript.y (exp): Call script_data_segment_align and
10283 script_data_segment_relro_end.
10284 * testsuite/relro_script_test.t: New file.
10285 * testsuite/relro_test.cc (using_script): Declare.
10286 (t1, t2): Test using_script.
10287 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10288 (relro_script_test_SOURCES): Define.
10289 (relro_script_test_DEPENDENCIES): Define.
10290 (relro_script_test_LDFLAGS): Define.
10291 (relro_script_test_LDADD): Define.
10292 (relro_script_test.so): New target.
10293 * testsuite/Makefile.in: Rebuild.
10294
10295 2008-08-06 Cary Coutant <ccoutant@google.com>
10296
10297 * archive.cc (Archive::total_archives, Archive::total_members)
10298 (Archive::total_members_loaded): New variables.
10299 (Archive::setup): Add parameter. Add option to preread
10300 archive symbols.
10301 (Archive::read_armap): Add counter.
10302 (Archive::get_file_and_offset): New function.
10303 (Archive::get_elf_object_for_member): New function.
10304 (Archive::read_all_symbols): New function.
10305 (Archive::read_symbols): New function.
10306 (Archive::add_symbols): Add counters.
10307 (Archive::include_all_members): Use armap to find members if it's
10308 already built.
10309 (Archive::include_member): Skip reading symbols if already read.
10310 Factored code into Archive::get_file_and_offset and
10311 Archive::get_elf_object_for_member. Changed call to
10312 Mapfile::report_include_archive_member.
10313 (Archive::print_stats): New function.
10314 * archive.h: Declare Object and Read_symbols_data classes.
10315 (Archive::Archive): Add initializers for new members.
10316 (Archive::setup): Add parameter.
10317 (Archive::print_stats): New function.
10318 (Archive::total_archives, Archive::total_members)
10319 (Archive::total_members_loaded): New variables.
10320 (Archive::get_file_and_offset): New function.
10321 (Archive::get_elf_object_for_member): New function.
10322 (Archive::read_all_symbols): New function.
10323 (Archive::read_symbols): New function.
10324 (Archive::Archive_member): New class.
10325 (Archive::members_): New member.
10326 (Archive::num_members_): New member.
10327 * main.cc: Include archive.h.
10328 (main): Call Archive::print_stats.
10329 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10330 archive parameter; member_name is now the fully-decorated name.
10331 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10332 * options.h: (General_options): Add --preread-archive-symbols option.
10333 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10334 Archive::setup.
10335
10336 2008-08-04 Ian Lance Taylor <iant@google.com>
10337
10338 * symtab.h (Symbol::use_plt_offset): New function.
10339 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10340 * powerpc.cc (Relocate::relocate): Likewise.
10341 * sparc.cc (Relocate::relocate): Likewise.
10342 * x86_64.cc (Relocate::relocate): Likewise.
10343 * testsuite/weak_plt.sh: New test.
10344 * testsuite/weak_plt_main.cc: New test.
10345 * testsuite/weak_plt_shared.cc: New test.
10346 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10347 (check_PROGRAMS): Add weak_plt.
10348 (check_DATA): Add weak_plt_shared.so.
10349 (weak_plt_main_pic.o, weak_plt): New targets.
10350 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10351 * testsuite/Makefile.in: Rebuild.
10352
10353 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10354 gcctestdir/ld.
10355 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10356 * testsuite/Makefile.in: Rebuild.
10357
10358 2008-08-04 Alan Modra <amodra@bigpond.net.au>
10359
10360 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10361 * Makefile.in: Regenerate.
10362 * po/POTFILES.in: Regenerate.
10363
10364 2008-07-29 Ian Lance Taylor <iant@google.com>
10365
10366 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10367 symbols before other symbols.
10368 * testsuite/script_test_2.cc (test_addr): Declare.
10369 (test_addr_alias): Declare.
10370 (main): Check that test_addr and test_addr_alias have the right
10371 values.
10372 * testsuite/script_test_2.t: Define test_addr_alias and
10373 test_addr.
10374
10375 2008-07-24 Ian Lance Taylor <iant@google.com>
10376
10377 PR 5990
10378 * descriptors.cc: New file.
10379 * descriptors.h: New file.
10380 * gold-threads.h (class Hold_optional_lock): New class.
10381 * fileread.cc: Include "descriptors.h".
10382 (File_read::~File_read): Release descriptor rather than closing
10383 it.
10384 (File_read::open) [file]: Call open_descriptor rather than open.
10385 Set is_descriptor_opened_.
10386 (File_read::open) [memory]: Assert that descriptor is not open.
10387 (File_read::reopen_descriptor): New function.
10388 (File_read::release): Release descriptor.
10389 (File_read::do_read): Make non-const. Reopen descriptor.
10390 (File_read::read): Make non-const.
10391 (File_read::make_view): Reopen descriptor.
10392 (File_read::do_readv): Likewise.
10393 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10394 Update declarations.
10395 * layout.cc: Include "descriptors.h".
10396 (Layout::create_build_id): Use open_descriptor rather than open.
10397 * output.cc: Include "descriptors.h".
10398 (Output_file::open): Use open_descriptor rather than open.
10399 * archive.cc (Archive::const_iterator): Change Archive to be
10400 non-const.
10401 (Archive::begin, Archive::end): Make non-const.
10402 (Archive::count_members): Likewise.
10403 * archive.h (class Archive): Update declarations.
10404 * object.h (Object::read): Make non-const.
10405 * Makefile.am (CCFILES): Add descriptors.cc.
10406 (HFILES): Add descriptors.h.
10407 * Makefile.in: Rebuild.
10408
10409 PR 6716
10410 * gold.h: Always include <clocale>. Add Solaris workarounds
10411 following code in binutils/sysdep.h.
10412
10413 PR 6048
10414 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10415 this->eh_frame_hdr_ is NULL before using it.
10416
10417 * dynobj.cc (Versions::Versions): Update comment.
10418
10419 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10420 the base version name.
10421
10422 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10423 array size plus one.
10424 (Stringpool_template::set_string_offsets): Subtract one from key
10425 before using it as an array index.
10426 (Stringpool_template::get_offset_with_length): Likewise.
10427 (Stringpool_template::write_to_buffer): Likewise.
10428 * stringpool.h (Stringpool_template::get_offset_from_key):
10429 Likewise.
10430
10431 2008-07-23 Ian Lance Taylor <iant@google.com>
10432
10433 PR 6658
10434 * object.h (Merged_symbol_value::value): Do our best to handle a
10435 negative addend.
10436
10437 PR 6647
10438 * script.cc (Version_script_info::get_versions): Don't add empty
10439 version tag to return value.
10440 (Version_script_info::get_symbol_version_helper): Change return
10441 type to bool. Add pversion parameter. Change all callers.
10442 (script_register_vers_node): Don't require a non-NULL tag.
10443 * script.h (class Version_script_info): Update declarations.
10444 (Version_script_info::get_symbol_version): Change return type to
10445 bool. Add version parameter. Change all callers.
10446 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10447 handling. Handle an empty version from a version script.
10448 (Symbol_table::define_special_symbol): Likewise.
10449 * testsuite/ver_test_10.script: New file.
10450 * testsuite/ver_test_10.sh: New file.
10451 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10452 (check_DATA): Add ver_test_10.syms.
10453 (ver_test_10.syms, ver_test_10.so): New target.
10454 * testsuite/Makefile.in: Rebuild.
10455
10456 2008-07-23 Simon Baldwin <simonb@google.com>
10457
10458 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10459 to zero for undefined symbols from dynamic libraries.
10460
10461 2008-07-23 Ian Lance Taylor <iant@google.com>
10462
10463 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10464 Change all callers.
10465 * symtab.h (class Symbol_table): Update declaration.
10466 * testsuite/ver_test_9.cc: New file.
10467 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10468 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10469 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10470 (ver_test_9.so, ver_test_9.o): New targets.
10471 * testsuite/Makefile.in: Rebuild.
10472
10473 2008-07-22 Ian Lance Taylor <iant@google.com>
10474
10475 * options.h (class General_options): Define --check-sections.
10476 * layout.cc (Layout::set_segment_offsets): Handle
10477 --check-sections.
10478
10479 * options.h (class General_options): Define -n/--nmagic and
10480 -N/--omagic.
10481 * options.cc (General_options::finalize): For -n/--nmagic or
10482 -N/--omagic, set -static.
10483 * layout.cc (Layout::attach_allocated_section_to_segment): If
10484 -N/--omagic, don't put read-only and read-write sections in
10485 different segments.
10486 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10487 finding a read-only segment.
10488 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10489 don't set the minimum segment alignment to the common page size,
10490 and don't set the file offset to the address modulo the page size.
10491 * script-sections.cc (Script_sections::create_segments): If
10492 -n/--omagic, don't put read-only and read-write sections in
10493 different segments.
10494
10495 * cref.cc: New file.
10496 * cref.h: New file.
10497 * options.h (class General_options): Add --print-symbol-counts.
10498 * main.cc (main): Issue defined symbol report if requested.
10499 * archive.cc (Archive::interpret_header): Make into a const member
10500 function.
10501 (Archive::add_symbols): Call Input_objects::archive_start and
10502 archive_stop.
10503 (Archive::const_iterator): Define new class.
10504 (Archive::begin, Archive::end): New functions.
10505 (Archive::include_all_members): Rewrite to use iterator.
10506 (Archive::count_members): New function.
10507 * archive.h (class Archive): Update declarations.
10508 (Archive::filename): New function.
10509 * object.cc: Include "cref.h".
10510 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10511 (Sized_relobj::do_get_global_symbol_counts): New function.
10512 (Input_objects::add_object): Add object to cross-referencer.
10513 (Input_objects::archive_start): New function.
10514 (Input_objects::archive_stop): New function.
10515 (Input_objects::print_symbol_counts): New function.
10516 * object.h: Declare Cref and Archive.
10517 (Object::get_global_symbol_counts): New function.
10518 (Object::do_get_global_symbol_counts): New pure virtual function.
10519 (class Sized_relobj): Add defined_count_ field. Update
10520 declarations.
10521 (class Input_objects): Add cref_ field. Update constructor.
10522 Update declarations.
10523 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10524 defined_count_.
10525 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10526 symbol counts.
10527 (Sized_dynobj::do_get_global_symbol_counts): New function.
10528 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10529 defined_count_. Update declarations. Define Symbols typedef.
10530 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10531 parameter. Change all callers.
10532 (Symbol_table::add_from_dynobj): Add sympointers and defined
10533 parameters. Change all callers.
10534 * symtab.h (class Symbol_table): Update declarations.
10535 * Makefile.am (CCFILES): Add cref.cc.
10536 (HFILES): Add cref.h.
10537 * Makefile.in: Rebuild.
10538
10539 2008-07-22 Simon Baldwin <simonb@google.com>
10540
10541 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10542 to zero when writing undefined symbols.
10543
10544 2008-07-22 Ian Lance Taylor <iant@google.com>
10545
10546 * output.cc (Output_section::add_input_section): Don't try to
10547 merge empty merge sections.
10548
10549 2008-07-21 Craig Silverstein <csilvers@google.com>
10550
10551 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10552 Include symbol version in error message.
10553
10554 2008-07-20 Chris Demetriou <cgd@google.com>
10555
10556 * configure.ac (gold_cv_c_random_seed): New configured variable.
10557 (RANDOM_SEED_CFLAGS): New substituted variable.
10558 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10559 * configure: Rebuild.
10560 * Makefile.in: Likewise.
10561 * testsuite/Makefile.in: Likewise.
10562
10563 2008-07-18 Ian Lance Taylor <iant@google.com>
10564
10565 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10566 where we see NAME/NULL and NAME/VERSION as separate symbols.
10567 * testsuite/ver_test_main.cc (main): Call t4.
10568 (t4, t4_2a): Define.
10569 * testsuite/ver_test_2.cc (t4_2): Define.
10570 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10571 * testsuite/ver_test_4.cc (t4_2a): Define.
10572 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10573 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10574
10575 2008-07-17 Ian Lance Taylor <iant@google.com>
10576
10577 * dynobj.cc (Versions::add_def): If we give an error about a
10578 missing version, go ahead and create the version anyhow.
10579
10580 2008-07-10 Ian Lance Taylor <iant@google.com>
10581
10582 Handle output sections with more than 0x7fffffff bytes.
10583 * object.h (class Relobj): Change map_to_output_ to
10584 output_sections_, and just keep a section pointer. Change all
10585 uses. Move comdat group support to Sized_relobj.
10586 (Relobj::is_section_specially_mapped): Remove.
10587 (Relobj::output_section): Remove poff parameter. Change all
10588 callers.
10589 (Relobj::output_section_offset): New function.
10590 (Relobj::set_section_offset): Rewrite.
10591 (Relobj::map_to_output): Remove.
10592 (Relobj::output_sections): New function.
10593 (Relobj::do_output_section_offset): New pure virtual function.
10594 (Relobj::do_set_section_offset): Likewise.
10595 (class Sized_relobj): Add section_offsets_ field. Add comdat
10596 group support from Relobj. Update declarations.
10597 (Sized_relobj::get_output_section_offset): New function.
10598 (Sized_relobj::do_output_section_offset): New function.
10599 (Sized_relobj::do_set_section_offset): New function.
10600 * object.cc (Relobj::output_section_address): Remove.
10601 (Sized_relobj::Sized_relobj): Initialize new fields.
10602 (Sized_relobj::include_section_group): Cast find_kept_object to
10603 Sized_relobj.
10604 (Sized_relobj::include_linkonce_section): Likewise.
10605 (Sized_relobj::do_layout): Use separate arrays for output section
10606 and output offset.
10607 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10608 output_sections.
10609 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10610 output_sections and section_offsets.
10611 (Sized_relobj::write_local_symbols): Likewise.
10612 (map_to_kept_section): Compute output address directly.
10613 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10614 output_sections and section_offsets.
10615 (Sized_relobj::write_sections): Likewise.
10616 (Sized_relobj::relocate_sections): Likewise.
10617 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10618 * output.h (class Output_reloc): Update declarations. Change
10619 u2_.relobj to Sized_relobj*.
10620 (class Output_data_reloc): Change add functions to use
10621 Sized_relobj*.
10622 * output.cc (Output_reloc::Output_reloc): Change relobj to
10623 Sized_relobj*.
10624 (Output_reloc::local_section_offset): Change return type to
10625 Elf_Addr. Use get_output_section_offset.
10626 (Output_reloc::get_address): Likewise.
10627 (Output_section::is_input_address_mapped): Don't call
10628 is_section_specially_mapped.
10629 (Output_section::output_offset): Likewise.
10630 (Output_section::output_address): Likewise.
10631 (Output_section::starting_output_address): Likewise.
10632 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10633 parameter to Sized_relobj*.
10634 (Copy_relocs::need_copy_reloc): Likewise.
10635 (Copy_relocs::save): Likewise.
10636 * copy-relocs.h (class Copy_relocs): Update declarations.
10637 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10638 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10639 * target-reloc.h (relocate_for_relocatable): Change
10640 offset_in_output_section type to Elf_Addr. Change code that uses
10641 it as well.
10642 * layout.cc (Layout::layout): Always set *off.
10643 * mapfile.cc (Mapfile::print_input_section): Use
10644 output_section_offset.
10645 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10646 Sized_relobj*.
10647 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10648 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10649 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10650
10651 2008-07-03 Ian Lance Taylor <iant@google.com>
10652
10653 * layout.cc (Layout::include_section): Do not discard unrecognized
10654 SHT_STRTAB sections.
10655
10656 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10657
10658 * script.cc (Lex::can_continue_name): Make '?' allowable in
10659 version-script names.
10660 * testsuite/version_script.map: Change glob pattern to use '?'
10661
10662 2008-06-30 Manish Singh <yosh@gimp.org>
10663
10664 PR 6585
10665 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10666 Correct typo.
10667
10668 2008-06-30 Ian Lance Taylor <iant@google.com>
10669
10670 PR 6660
10671 PR 6682
10672 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10673 versions]: Don't try to read the value in the contents, since we
10674 don't use it. Use the template endianness when writing.
10675
10676 2008-06-25 Cary Coutant <ccoutant@google.com>
10677
10678 * fileread.cc (File_read::make_view): Assert on zero-length view.
10679 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10680 symbol table when there are no symbols to read.
10681
10682 2008-06-23 Craig Silverstein <csilvers@google.com>
10683
10684 * version.cc (version_string): Bump to 1.7
10685
10686 2008-06-18 Craig Silverstein <csilvers@google.com>
10687
10688 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10689 constant 0xFFFF to type Valtype.
10690 (Powerpc_relocate_functions::rel16_ha): Likewise.
10691
10692 2008-06-17 Ian Lance Taylor <iant@google.com>
10693
10694 * output.h (Output_section::Input_section): Initialize p2align_ to
10695 zero for Output_section_data constructors.
10696 (Output_section::Input_section::addralign): If not an input
10697 section, return the alignment of the Output_section_data.
10698 * testsuite/copy_test.cc: New file.
10699 * testsuite/copy_test_1.cc: New file.
10700 * testsuite/copy_test_2.cc: New file.
10701 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10702 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10703 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10704 (copy_test_1_pic.o, copy_test_1.so): New targets.
10705 (copy_test_2_pic.o, copy_test_2.so): New targets.
10706 * testsuite/Makefile.in: Rebuild.
10707
10708 * script-sections.cc (Script_sections::place_orphan): Initialize
10709 local variable exact.
10710
10711 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10712
10713 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10714
10715 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10716 David S. Miller <davem@davemloft.net>
10717
10718 * powerpc.cc: New file.
10719 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10720 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10721 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10722 * Makefile.in: Rebuild.
10723
10724 2008-06-09 Ian Lance Taylor <iant@google.com>
10725
10726 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10727 <exception>.
10728 (throwing, orig_terminate): New static variables.
10729 (terminate_handler): New static function.
10730 (t2): Set terminate handler.
10731
10732 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10733
10734 PR 6584
10735 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10736 alignment.
10737
10738 2008-05-30 Cary Coutant <ccoutant@google.com>
10739
10740 * archive.cc (Archive::include_all_members) Correct to step
10741 over symbol table and extended name table in thin archives.
10742
10743 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10744
10745 PR 6407
10746 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10747 calculation.
10748
10749 2008-05-28 Caleb Howe <cshowe@google.com>
10750
10751 * reduced_debug_output.cc: New file.
10752 * reduced_debug_output.h: New file.
10753 * options.h (class General_options): Add --strip-debug-non-line.
10754 * options.cc (General_options::finalize): Add strip_debug_non_line
10755 to the strip heirarchy.
10756 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10757 fields.
10758 * layout.cc: Include "reduced_debug_output.h".
10759 (Layout::Layout): Initialize new fields.
10760 (line_only_debug_sections): New static array.
10761 (is_lines_only_debug_sections): New static inline function.
10762 (Layout::include_section): Handle --strip-debug-non-line.
10763 (Layout::make_output_section): If --strip-debug-non-line, build
10764 new output sections for .debug_abbrev and .debug_info.
10765 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10766 gold. Warn about possible overflow.
10767 (read_signed_LEB_128): Likewise.
10768 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10769 (read_signed_LEB_128): Declare.
10770 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10771 (HFILES): Add reduced_debug_output.h.
10772 * Makefile.in: Rebuild.
10773
10774 2008-05-21 Ian Lance Taylor <iant@google.com>
10775
10776 * mapfile.cc: New file.
10777 * mapfile.h: New file.
10778 * options.h (class General_options): Add -M/--print-map and -Map.
10779 * options.cc (General_options::finalize): Make -M equivalent to
10780 -Map -.
10781 * main.cc: Include <cstdio> and "mapfile.h".
10782 (main): Open mapfile if requested.
10783 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10784 constructor. Change caller.
10785 (queue_initial_tasks): Add mapfile parameter. Change caller.
10786 (queue_middle_tasks): Likewise.
10787 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10788 declarations.
10789 * archive.cc: Include "mapfile.h".
10790 (Archive::add_symbols): Add mapfile parameter. Change all
10791 callers. Pass mapfile, symbol, and reason to include_member.
10792 (Archive::include_all_members): Add mapfile parameter. Change all
10793 callers.
10794 (Archive::include_member): Add mapfile, sym, and why parameters.
10795 Change all callers. Report inclusion to map file.
10796 * archive.h: Include "fileread.h".
10797 (class Archive): Update declarations.
10798 (Archive::file): New const method.
10799 (class Add_archive_symbols): Add mapfile_ field. Update
10800 constructor. Change all callers.
10801 * readsyms.h (class Read_symbols): Likewise.
10802 (class Finish_group): Likewise.
10803 (class Read_script): Likewise.
10804 * common.cc: Include "mapfile.h".
10805 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10806 all callers.
10807 (Symbol_table::do_allocate_commons): Likewise.
10808 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10809 symbol allocation to mapfile.
10810 * common.h (class Allocate_commons_task): Add mapfile_ field.
10811 Update constructor. Change all callers.
10812 * symtab.h (class Symbol_table): Update declarations.
10813 * layout.cc: Include "mapfile.h".
10814 (Layout_task_runner::run): Print information to mapfile.
10815 (Layout::create_gold_note): Change Output_data_fixed_space to
10816 Output_data_zero_fill.
10817 (Layout::create_build_id): Likewise.
10818 (Layout::print_to_mapfile): New function.
10819 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10820 constructor. Change caller.
10821 (class Layout): Declare print_to_mapfile.
10822 * output.cc (Output_section::Input_section::print_to_mapfile): New
10823 function.
10824 (Output_section::add_input_section): If producing a map, always
10825 add to input_sections_ list.
10826 (Output_section::do_print_to_mapfile): New function.
10827 (Output_segment::print_sections_to_mapfile): New function.
10828 (Output_segment::print_section_list_to_mapfile): New function.
10829 * output.h: Include "mapfile.h".
10830 (Output_data::print_to_mapfile): New function.
10831 (Output_data::do_print_to_mapfile): New virtual function.
10832 (Output_segment_headers::do_print_to_mapfile): New function.
10833 (Output_file_header::do_print_to_mapfile): New function.
10834 (Output_data_const::do_print_to_mapfile): New function.
10835 (class Output_data_const_buffer): Add map_name_ field. Update
10836 constructor. Change all callers. Add do_print_to_mapfile
10837 function.
10838 (class Output_data_fixed_space): Likewise.
10839 (class Output_data_space): Likewise.
10840 (class Output_data_zero_fill): New class.
10841 (Output_data_strtab::do_print_to_mapfile): New function.
10842 (Output_data_reloc_base::do_print_to_mapfile): New function.
10843 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10844 (Output_data_group::do_print_to_mapfile): New function.
10845 (Output_data_got::do_print_to_mapfile): New function.
10846 (Output_data_dynamic::do_print_to_mapfile): New function.
10847 (Output_symtab_xindex::do_print_to_mapfile): New function.
10848 (class Output_section): Declare do_print_to_mapflie. Declare
10849 print_to_mapfile in Input_section.
10850 (class Output_segment): Declare new functions.
10851 * object.h (Sized_relobj::symbol_count): New function.
10852 * script-sections.cc
10853 (Output_section_element_dot_assignment::set_section_addresses):
10854 Change Output_data_fixed_space to Output_data_zero_fill.
10855 (Output_data_expression::do_print_to_mapfile): New function.
10856 * script.cc (read_input_script): Add mapfile parameter. Change
10857 all callers.
10858 * script.h (read_input_script): Update declaration.
10859 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10860 (Eh_frame::do_print_to_mapfile): New function.
10861 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10862 (Output_merge_string::do_print_to_mapfile): New function.
10863 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10864 function.
10865 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10866 function.
10867 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10868 function.
10869 * Makefile.am (CCFILES): Add mapfile.cc.
10870 (HFILES): Add mapfile.h.
10871 * Makefile.in: Rebuild.
10872
10873 2008-05-19 Ian Lance Taylor <iant@google.com>
10874
10875 * options.h (class General_options): Add -z relro.
10876 * layout.cc (Layout::Layout): Initialize relro_segment_.
10877 (Layout::add_output_section_data): Return the output section.
10878 (Layout::make_output_section): Rcognize relro sections and mark
10879 them appropriately.
10880 (Layout::attach_allocated_section_to_segment): Put relro sections
10881 in a PT_GNU_RELRO segment.
10882 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10883 section as relro.
10884 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10885 PT_TLS segments.
10886 (Layout::linkonce_mapping): Map d.rel.ro.local to
10887 .data.rel.ro.local.
10888 (Layout::output_section_name): Us .data.rel.ro.local for any
10889 section which begins with that.
10890 * layout.h (class Layout): Update add_output_section_data
10891 declaration. Add relro_segment_ field.
10892 * output.cc (Output_section::Output_section): Initialize is_relro_
10893 and is_relro_local_ fields.
10894 (Output_segment::add_output_section): Group relro sections.
10895 (Output_segment::is_first_section_relro): New function.
10896 (Output_segment::maximum_alignment): If there is a relro section,
10897 align the segment to the common page size.
10898 (Output_segment::set_section_addresses): Track whether we are
10899 looking at relro sections. If the last section is a relro
10900 section, align to the common page size.
10901 (Output_segment::set_section_list_addresses): Add in_relro
10902 parameter. Change all callers. Align to the page size when
10903 moving from relro to non-relro section.
10904 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10905 segment.
10906 * output.h (class Output_section): Add is_relro_ and
10907 is_relro_local_ fields.
10908 (Output_section::is_relro): New function.
10909 (Output_section::set_is_relro): New function.
10910 (Output_section::is_relro_local): New function.
10911 (Output_section::set_is_relro_local): New function.
10912 (class Output_segment): Update declarations.
10913 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10914 * sparc.cc (Target_sparc::got_section): Likewise.
10915 * x86_64.cc (Target_x86_64::got_section): Likewise.
10916 * testsuite/relro_test_main.cc: New file.
10917 * testsuite/relro_test.cc: New file.
10918 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10919 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10920 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10921 (relro_test.so, relro_test_pic.o): New targets.
10922 * testsuite/Makefile.in: Rebuild.
10923
10924 2008-05-16 Ian Lance Taylor <iant@google.com>
10925
10926 * output.cc (Output_segment::add_output_section): Remove front
10927 parameter.
10928 * output.h (class Output_segment): Remove
10929 add_initial_output_section and overloaded add_output_section.
10930 Update declaration of remaining add_output_section.
10931 * layout.cc (Layout::create_interp): Call add_output_section
10932 rather than add_initial_output_section.
10933 (Layout::finish_dynamic_section): Likewise.
10934
10935 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10936 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10937 know the dynamic type.
10938 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10939 field. Initialize it in constructor.
10940 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10941 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10942 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10943 reloc.
10944
10945 * output.cc (Output_reloc::get_address): Change return type to
10946 Elf_Addr.
10947 * output.h (class Output_reloc): Update get_address declaration.
10948 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10949 for section addresses.
10950
10951 2008-05-09 Ian Lance Taylor <iant@google.com>
10952
10953 PR 6493
10954 * gold.cc (gold_nomem): Use return value of write.
10955
10956 2008-05-08 Ian Lance Taylor <iant@google.com>
10957
10958 * symtab.c (Symbol::init_base_output_data): Add version
10959 parameter. Change all callers.
10960 (Symbol::init_base_output_segment): Likewise.
10961 (Symbol::init_base_constant): Likewise.
10962 (Symbol::init_base_undefined): Likewise.
10963 (Sized_symbol::init_output_data): Likewise.
10964 (Sized_symbol::init_output_segment): Likewise.
10965 (Sized_symbol::init_constant): Likewise.
10966 (Sized_symbol::init_undefined): Likewise.
10967 (Symbol_table::do_define_in_output_data): If the new symbol has a
10968 version, mark it as the default.
10969 (Symbol_table::do_define_in_output_segment): Likewise.
10970 (Symbol_table::do_define_as_constant): Likewise.
10971 * symtab.h (class Symbol): Update declarations.
10972 (class Sized_symbol): Likewise.
10973 * resolve.cc (Symbol::override_version): New function.
10974 (Symbol::override_base): Call override_version.
10975 (Symbol::override_base_with_special): Likewise.
10976 * testsuite/ver_script_8.script: New file.
10977 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10978 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10979 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10980 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10981
10982 2008-05-06 Ian Lance Taylor <iant@google.com>
10983
10984 PR 6049
10985 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10986 functions.
10987 (class General_options): Remove existing --undefined, and add
10988 --no-undefined instead. Add new --undefined as synonym for -u.
10989 * archive.cc (Archive::add_symbols): Check whether symbol was
10990 named with -u.
10991 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10992 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10993 all uses. Add IS_UNDEFINED. Update declarations to split
10994 different versions of init_base. Declare init_base_undefined.
10995 (Symbol::is_defined): Handle IS_UNDEFINED.
10996 (Symbol::is_undefined): Likewise.
10997 (Symbol::is_weak_undefined): Call is_undefined.
10998 (Symbol::is_absolute): Handle IS_CONSTANT.
10999 (class Sized_symbol): Update declarations to split different
11000 versions of init. Declare init_undefined.
11001 (class Symbol_table): Declare new functions.
11002 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11003 Change all callers.
11004 (Symbol::init_base_output_data): Likewise.
11005 (Symbol::init_base_output_segment): Likewise.
11006 (Symbol::init_base_constant): Likewise.
11007 (Symbol::init_base_undefined): New function.
11008 (Sized_symbol::init_object): Rename from init. Change all
11009 callers.
11010 (Sized_symbol::init_output_data): Likewise.
11011 (Sized_symbol::init_output_segment): Likewise.
11012 (Sized_symbol::init_constant): Likewise.
11013 (Sized_symbol::init_undefined): New function.
11014 (Symbol_table::add_undefined_symbols_from_command_line): New
11015 function.
11016 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11017 function.
11018 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11019 (Symbol::output_section): Likewise.
11020 (Symbol::set_output_section): Likewise.
11021 (Symbol_table::sized_finalize_symbol): Likewise.
11022 (Symbol_table::sized_write_globals): Likewise.
11023 * resolve.cc (Symbol_table::should_override): Likewise.
11024 (Symbol::override_base_with_special): Likewise.
11025
11026 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11027 symbol, change it to have default visibility.
11028 * testsuite/protected_1.cc: New file.
11029 * testsuite/protected_2.cc: New file.
11030 * testsuite/protected_3.cc: New file.
11031 * testsuite/protected_main_1.cc: New file.
11032 * testsuite/protected_main_2.cc: New file.
11033 * testsuite/protected_main_3.cc: New file.
11034 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11035 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11036 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11037 (protected_1.so): New target.
11038 (protected_1_pic.o, protected_2_pic.o): New targets.
11039 (protected_3_pic.o): New target.
11040 (check_PROGRAMS): Add protected_2.
11041 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11042 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11043 * testsuite/Makefile.in: Rebuild.
11044
11045 * options.h (DEFINE_var): Add set_user_set_##varname__.
11046 (DEFINE_bool_alias): New macro.
11047 (class General_options): Define -Bstatic using DEFINE_bool_alias
11048 rather than DEFINE_special. Add --undefined as an alias for -z
11049 defs.
11050 * options.cc (General_options::parse_Bstatic): Remove.
11051
11052 * options.h (class General_options): Add --fatal-warnings.
11053 * main.cc (main): Implement --fatal-warnings.
11054 * errors.h (Errors::warning_count): New function.
11055
11056 * options.h (class General_options): Add -Bsymbolic-functions.
11057 * symtab.h (Symbol::is_preemptible): Check for
11058 -Bsymbolic-functions.
11059
11060 2008-05-05 Ian Lance Taylor <iant@google.com>
11061
11062 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11063 as noVARNAME rather than no-VARNAME.
11064 (class General_options): Add option -z combreloc.
11065 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11066 get_address.
11067 (Output_reloc::sort_before) [SHT_REL]: New function.
11068 (Output_reloc::sort_before) [SHT_RELA]: New function.
11069 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11070 Sort_relocs_comparison.
11071 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11072 parameter. Change all callers.
11073 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11074 sort_relocs parameter. Change all callers.
11075 * output.cc (Output_reloc::get_address): New function, broken out
11076 of write_rel.
11077 (Output_reloc::write_rel): Call it.
11078 (Output_reloc::compare): New function.
11079 (Output_data_reloc_base::do_write): Optionally sort relocs.
11080
11081 * configure.ac: If targ_extra_obj is set, link it in.
11082 * configure.tgt: Initialize all variables.
11083 (x86_64*): Set targ_extra_obj and targ_extra_size.
11084 * configure: Rebuild.
11085
11086 * object.cc (Sized_relobj::include_section_group): Adjust section
11087 indexes read from group data. Build vector to pass to
11088 layout_group.
11089 * layout.cc (Layout::layout_group): Add flags and shndxes
11090 parameters. Remove contents parameter. Change caller. Update
11091 explicit instantiations.
11092 * layout.h (class Layout): Update layout_group declaration.
11093 * output.cc (Output_data_group::Output_data_group): Add flags and
11094 input_shndxes parameters. Remove contents parameter. Change
11095 caller.
11096 (Output_data_group::do_write): Change input_sections_ to
11097 input_shndxes_.
11098 * output.h (class Output_data_group): Update constructor
11099 declaration. Rename input_sections_ to input_shndxes_.
11100 * testsuite/many_sections_test.cc: Add template.
11101
11102 2008-04-30 Cary Coutant <ccoutant@google.com>
11103
11104 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11105
11106 * layout.cc (Layout::include_section): Refactored check for debug
11107 info section.
11108 (Layout::add_comdat): Add new parameters. Change type
11109 of signature parameter. Add object and shndx to signatures table.
11110 (Layout::find_kept_object): New function.
11111 * layout.h: Include <cstring>.
11112 (Layout::is_debug_info_section): New function.
11113 (Layout::add_comdat): Add new parameters.
11114 (Layout::find_kept_object): New function.
11115 (Layout::Kept_section): New struct.
11116 (Layout::Signatures): Change type of map range.
11117 * object.cc (Relobj::output_section_address): New function.
11118 (Sized_relobj::include_section_group): Add new parameters. Change
11119 calls to Layout::add_comdat. Change to build table of kept comdat
11120 groups and table mapping discarded sections to kept sections.
11121 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11122 (Sized_relobj::do_layout): Change calls to include_section_group and
11123 include_linkonce_section.
11124 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11125 value to zero when section is discarded.
11126 (Sized_relobj::map_to_kept_section): New function.
11127 * object.h (Relobj::output_section_address): New function.
11128 (Relobj::Comdat_group): New type.
11129 (Relobj::find_comdat_group): New function.
11130 (Relobj::Comdat_group_table): New type.
11131 (Relobj::Kept_comdat_section): New type.
11132 (Relobj::Kept_comdat_section_table): New type.
11133 (Relobj::add_comdat_group): New function.
11134 (Relobj::set_kept_comdat_section): New function.
11135 (Relobj::get_kept_comdat_section): New function.
11136 (Relobj::comdat_groups_): New field.
11137 (Relobj::kept_comdat_sections_): New field.
11138 (Symbol_value::input_value): Update comment.
11139 (Sized_relobj::map_to_kept_section) New function.
11140 (Sized_relobj::include_linkonce_section): Add new parameter.
11141 * target-reloc.h (Comdat_behavior): New type.
11142 (get_comdat_behavior): New function.
11143 (relocate_section): Add code to map a discarded section to the
11144 corresponding kept section when applying a relocation.
11145
11146 2008-04-30 Craig Silverstein <csilvers@google.com>
11147
11148 * dwarf_reader.cc (next_generation_count): New static var.
11149 (Addr2line_cache_entry): New struct.
11150 (addr2line_cache): New static var.
11151 (Dwarf_line_info::one_addr2line): Added caching.
11152 (Dwarf_line_info::clear_addr2line_cache): New function.
11153 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11154 cache-size parameter.
11155 (Dwarf_line_info::one_addr2line_cache): New function.
11156 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11157 new cache-size argument to one_addr2line(), and clear cache.
11158
11159 2008-04-28 Cary Coutant <ccoutant@google.com>
11160
11161 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11162 R_386_PC8 relocations.
11163
11164 2008-04-23 Ian Lance Taylor <iant@google.com>
11165
11166 * object.cc (Sized_relobj::include_section_group): Check for
11167 invalid section group.
11168
11169 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11170 header size.
11171
11172 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11173 than read for file header.
11174 * archive.cc (Archive::include_member): Likewise.
11175
11176 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
11177
11178 * aclocal.m4: Regenerate.
11179 * configure: Regenerate.
11180
11181 2008-04-19 Ian Lance Taylor <iant@google.com>
11182
11183 * version.cc (version_string): Bump to 1.6.
11184
11185 * testsuite/Makefile.am (many_sections_r_test): New target.
11186 (many_sections_r_test_SOURCES): Remove.
11187 (many_sections_r_test_DEPENDENCIES): Remove.
11188 (many_sections_r_test_LDFLAGS): Remove.
11189 (many_sections_r_test_LDADD): Remove.
11190
11191 * object.cc (Sized_relobj::do_add_symbols): Always pass
11192 local_symbol_count_ to add_from_relobj.
11193
11194 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11195 every thousand variables.
11196 * testsuite/Makefile.in: Rebuild.
11197
11198 * object.cc (Xindex::initialize_symtab_xindex): New function.
11199 (Xindex::read_symtab_xindex): New function.
11200 (Xindex::sym_xindex_to_shndx): New function.
11201 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11202 available.
11203 (Sized_relobj::do_initialize_xindex): New function.
11204 (Sized_relobj::do_read_symbols): Adjust section links.
11205 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11206 parameter. Change all callers.
11207 (Sized_relobj::include_section_group): Adjust section links and
11208 symbol section indexes.
11209 (Sized_relobj::do_layout): Adjust section links.
11210 (Sized_relobj::do_count_local_symbols): Adjust section links and
11211 symbol section indexes.
11212 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11213 ordinary and special symbols.
11214 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11215 dynsym_xindex parameters. Change all callers. Adjust section
11216 links. Use SHN_XINDEX when needed.
11217 (Sized_relobj::get_symbol_location_info): Adjust section links.
11218 Don't get fooled by special symbols.
11219 * object.h (class Xindex): Define.
11220 (class Object): Add xindex_ parameter. Declare virtual functoin
11221 do_initialize_xindex.
11222 (Object::adjust_sym_shndx): New function.
11223 (Object::set_xindex): New protected function.
11224 (class Symbol_value): Add is_ordinary_shndx_ field.
11225 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11226 (Symbol_value::value): Assert ordinary section.
11227 (Symbol_value::initialize_input_to_output_map): Likewise.
11228 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11229 Change all callers.
11230 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11231 all callers.
11232 (class Sized_relobj): Update declarations.
11233 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11234 parameter. Change all callers.
11235 (Sized_relobj::adjust_shndx): New function.
11236 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11237 field.
11238 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11239 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11240 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11241 (Sized_dynobj::read_dynsym_section): Adjust section links.
11242 (Sized_dynobj::read_dynamic): Likewise.
11243 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11244 section links.
11245 (Sized_dynobj::do_initialize_xindex): New function.
11246 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11247 do_initialize_xindex.
11248 (Sized_dynobj::adjust_shndx): New function.
11249 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11250 dynsym_xindex_ fields.
11251 (Layout::finalize): Add a call to set_section_indexes before
11252 creating the symtab sections.
11253 (Layout::set_section_indexes): Don't do anything if the section
11254 already has a section index.
11255 (Layout::create_symtab_sections): Add shnum parameter. Change
11256 caller. Create .symtab_shndx section if needed.
11257 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11258 caller.
11259 (Layout::allocated_output_section_count): New function.
11260 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11261 needed.
11262 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11263 fields. Update declarations.
11264 (Layout::symtab_xindex): New function.
11265 (Layout::dynsym_xindex): New function.
11266 (class Write_symbols_task): Add layout_ field.
11267 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11268 Change caller.
11269 * output.cc (Output_section_headers::Output_section_headers): Add
11270 shstrtab_section parameter. Change all callers.
11271 (Output_section_headers::do_sized_write): Store overflow values
11272 for section count and section string table section index in
11273 section header zero.
11274 (Output_file_header::do_sized_write): Check for overflow of
11275 section count and section string table section index.
11276 (Output_symtab_xindex::do_write): New function.
11277 (Output_symtab_xindex::endian_do_write): New function.
11278 * output.h (class Output_section_headers): Add shstrtab_section_.
11279 Update declarations.
11280 (class Output_symtab_xindex): Define.
11281 (Output_section::has_out_shndx): New function.
11282 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11283 field.
11284 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11285 Change all callers.
11286 (Sized_symbol::init): Likewise.
11287 (Symbol::output_section): Check for ordinary symbol.
11288 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11289 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11290 callers.
11291 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11292 Change all callers. Simplify handling of symbols from sections
11293 not included in the link.
11294 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11295 distinction.
11296 (Weak_alias_sorter::operator()): Assert that symbols are
11297 ordinary.
11298 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11299 distinction.
11300 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11301 parameters. Change all callers.
11302 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11303 symbol distinction. Use SHN_XINDEX when needed.
11304 (Symbol_table::write_section_symbol): Add symtab_xindex
11305 parameter. Change all callers.
11306 (Symbol_table::sized_write_section_symbol): Likewise. Use
11307 SHN_XINDEX when needed.
11308 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11309 declarations.
11310 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11311 (Symbol::is_defined): Check is_ordinary.
11312 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11313 (Symbol::is_absolute, Symbol::is_common): Likewise.
11314 (class Sized_symbol): Update declarations.
11315 (class Symbol_table): Update declarations.
11316 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11317 parameters. Change all callers.
11318 (Sized_symbol::override): Likewise.
11319 (Symbol_table::override): Likewise.
11320 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11321 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11322 is_ordinary, and orig_st_shndx parameters. Change all callers.
11323 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11324 to be in an ordinary section.
11325 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11326 object and is_ordinary parameters. Change all callers.
11327 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11328 Change all callers. Don't add undefined or non-ordinary symbols
11329 to reloc_map_.
11330 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11331 Change all callers.
11332 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11333 declarations.
11334 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11335 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11336 (Sized_relobj::relocate_sections): Likewise.
11337 * target-reloc.h (scan_relocs): Adjust section symbol index.
11338 (scan_relocatable_relocs): Likewise.
11339 * i386.cc (Scan::local): Check for ordinary symbols.
11340 * sparc.cc (Scan::local): Likewise.
11341 * x86_64.cc (Scan::local): Likewise.
11342 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11343 to symbol_section_and_value.
11344 * testsuite/many_sections_test.cc: New file.
11345 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11346 (check_PROGRAMS): Add many_sections_test.
11347 (many_sections_test_SOURCES): Define.
11348 (many_sections_test_DEPENDENCIES): Define.
11349 (many_sections_test_LDFLAGS): Define.
11350 (BUILT_SOURCES): Add many_sections_define.h.
11351 (many_sections_define.h): New target.
11352 (BUILT_SOURCES): Add many_sections_check.h.
11353 (many_sections_check.h): New target.
11354 (check_PROGRAMS): Add many_sections_r_test.
11355 (many_sections_r_test_SOURCES): Define.
11356 (many_sections_r_test_DEPENDENCIES): Define.
11357 (many_sections_r_test_LDFLAGS): Define.
11358 (many_sections_r_test_LDADD): Define.
11359 (many_sections_r_test.o): New target.
11360 * testsuite/Makefile.in: Rebuild.
11361
11362 2008-04-17 Cary Coutant <ccoutant@google.com>
11363
11364 * errors.cc (Errors::info): New function.
11365 (gold_info): New function.
11366 * errors.h (Errors::info): New function.
11367 * gold.h (gold_info): New function.
11368 * object.cc (Input_objects::add_object): Print trace output.
11369 * options.cc (options::parse_set): New function.
11370 (General_options::parse_wrap): Deleted.
11371 (General_options::General_options): Deleted initializer.
11372 * options.h (options::String_set): New typedef.
11373 (options::parse_set): New function.
11374 (DEFINE_set): New macro.
11375 (General_options::wrap): Changed to use DEFINE_set. Changed
11376 callers of any_wrap_symbols and is_wrap_symbol.
11377 (General_options::trace, General_options::trace_symbol):
11378 New options.
11379 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11380 (General_options::wrap_symbols_): Deleted.
11381 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11382
11383 2008-04-17 David S. Miller <davem@davemloft.net>
11384
11385 * options.cc (General_options::parse_V): New function.
11386 * options.h: Add entries for -V and -Qy.
11387
11388 2008-04-17 Ian Lance Taylor <iant@google.com>
11389
11390 * common.cc (Symbol_table::allocate_commons): Remove options
11391 parameter. Change caller.
11392 (Symbol_table::do_allocate_commons): Remove options parameter.
11393 Change caller. Just call do_allocate_commons_list twice.
11394 (Symbol_table::do_allocate_commons_list): New function, broken out
11395 of do_allocate_commons.
11396 * common.h (class Allocate_commons_task): Remove options_ field.
11397 Update constructor.
11398 * symtab.cc (Symbol_table::Symbol_table): Initialize
11399 tls_commons_.
11400 (Symbol_table::add_from_object): Put TLS common symbols on
11401 tls_commons_ list.
11402 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11403 which are IN_OUTPUT_DATA.
11404 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11405 allocate_commons and do_allocate_commons declarations. Declare
11406 do_allocate_commons_list.
11407 * gold.cc (queue_middle_tasks): Update creation of
11408 Allocate_commons_task to not pass options.
11409 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11410 (TLS_TEST_C_FLAGS): New variable.
11411 (tls_test_c_pic.o): New target.
11412 (tls_test_shared.so): Link in tls_test_c_pic.o.
11413 (tls_test_c_pic_ie.o): New target.
11414 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11415 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11416 (tls_test_c.o): New target.
11417 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11418 (tls_pic_test_LDADD): Likewise.
11419 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11420 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11421 (tls_test_c_gnu2.o): New target.
11422 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11423 tls_test_c_gnu2.o.
11424 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11425 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11426 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11427 * testsuite/tls_test.cc: Include "config.h".
11428 (t_last): Call t11_last.
11429 * testsuite/tls_test.h (t11, t11_last): Declare.
11430 * testsuite/tls_test_c.c: New file.
11431 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11432 * configure.ac: Check for OpenMP support.
11433 * configure, config.in, Makefile.in: Rebuild.
11434 * testsuite/Makefile.in: Rebuild.
11435
11436 2008-04-16 Cary Coutant <ccoutant@google.com>
11437
11438 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11439 (Target_i386::tls_base_symbol_defined_): New field.
11440 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11441 (Target_i386::Scan::global): Likewise.
11442 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11443 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11444 (Target_x86_64::tls_base_symbol_defined_): New field.
11445 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11446 (Target_x86_64::Scan::global): Likewise.
11447
11448 2008-04-16 Cary Coutant <ccoutant@google.com>
11449
11450 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11451 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11452 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11453 building shared libraries.
11454 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11455 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11456 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11457 * testsuite/Makefile.in: Rebuild.
11458 * testsuite/weak_undef.h: New file.
11459 * testsuite/weak_undef_file1.cc: Add extra test cases.
11460 * testsuite/weak_undef_file2.cc: Likewise.
11461 * testsuite/weak_undef_test.cc: Likewise.
11462
11463 2008-04-16 David S. Miller <davem@davemloft.net>
11464
11465 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11466 Add issued_non_pic_error_ field. Declare check_non_pic.
11467 (Target_sparc::Scan::check_non_pic): New function.
11468 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11469 (Target_sparc::Scan::global): Likewise.
11470
11471 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11472 * configure: Rebuild.
11473
11474 * options.h (DEFINE_enable): New macro.
11475 (new_dtags): New enable option.
11476 (initfirst, interpose, loadfltr, nodefaultlib,
11477 nodelete, nodlopen, nodump): New -z options.
11478 * layout.cc (Layout:finish_dynamic_section): If new
11479 dtags enabled, emit DT_RUNPATH. Also, emit a
11480 DT_FLAGS_1 containing any specified -z flags.
11481
11482 2008-04-16 Ian Lance Taylor <iant@google.com>
11483
11484 * copy-relocs.cc: New file.
11485 * copy-relocs.h: New file.
11486 * reloc.cc: Remove Copy_relocs code.
11487 * reloc.h: Likewise.
11488 * reloc-types.h (struct Reloc_types) [both versions]: Add
11489 get_reloc_addend_noerror.
11490 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11491 variants of add_global which take an addend which must be zero.
11492 * i386.cc: Include "copy-relocs.h".
11493 (class Target_i386): Change type of copy_relocs_ to variable,
11494 update initializer.
11495 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11496 Change all callers.
11497 (Target_i386::do_finalize_sections): Change handling of
11498 copy_relocs_.
11499 * sparc.cc: Include "copy-relocs.h".
11500 (class Target_sparc): Change type of copy_relocs_ to variable,
11501 update initializer.
11502 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11503 Change all callers.
11504 (Target_sparc::do_finalize_sections): Change handling of
11505 copy_relocs_.
11506 * x86_64.cc: Include "copy-relocs.h".
11507 (class Target_x86_64): Change type of copy_relocs_ to variable,
11508 update initializer.
11509 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11510 class. Change all callers.
11511 (Target_x86_64::do_finalize_sections): Change handling of
11512 copy_relocs_.
11513 * Makefile.am (CCFILES): Add copy-relocs.cc.
11514 (HFILES): Add copy-relocs.h.
11515
11516 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11517
11518 * testsuite/script_test_4.sh: Permit leading zeroes.
11519
11520 2008-04-15 Ian Lance Taylor <iant@google.com>
11521
11522 * script-sections.cc (Script_sections::create_segments): Use
11523 header_size_adjustment even when there is enough room for the
11524 headers.
11525 * testsuite/script_test_4.sh: New file.
11526 * testsuite/script_test_4.t: New file.
11527 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11528 (check_DATA): Add script_test_4.stdout.
11529 (MOSTLYCLEANFILES): Likewise.
11530 (script_test_4): New target.
11531 (script_test_4.stdout): New target.
11532 * testsuite/Makefile.in: Rebuild.
11533
11534 * sparc.cc: Add definitions for Output_data_plt_sparc class
11535 constants.
11536
11537 2008-04-14 David S. Miller <davem@davemloft.net>
11538
11539 * sparc.cc: New file.
11540 * Makefile.am (TARGETSOURCES): Add sparc.cc
11541 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11542 * configure.tgt: Document targ_extra_size and
11543 targ_extra_big_endian. Add entries for sparc-* and
11544 sparc64-*.
11545 * configure.ac: Handle targ_extra_size and
11546 targ_extra_big_endian.
11547 * Makefile.in: Rebuild.
11548 * configure: Likewise.
11549 * po/POTFILES.in: Likewise.
11550 * po/gold.pot: Likewise.
11551
11552 2008-04-14 Ian Lance Taylor <iant@google.com>
11553
11554 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11555 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11556 in the name/type/flags to section mapping. Don't call
11557 allocate_output_section.
11558 (Layout::choose_output_section): Change parameter from adjust_name
11559 to is_input_section. Don't permit input sections after sections
11560 are attached to segments. Don't call allocate_output_section.
11561 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11562 not write_enable_output_section.
11563 (Layout::make_output_section): Don't push to
11564 unattached_section_list_ nor call attach_to_segment. Call
11565 attach_section_to_segment if sections are attached.
11566 (Layout::attach_sections_to_segments): New function.
11567 (Layout::attach_section_to_segment): New function.
11568 (Layout::attach_allocated_section_to_segment): Rename from
11569 attach_to_segment. Remove flags parameter.
11570 (Layout::allocate_output_section): Remove function.
11571 (Layout::write_enable_output_section): Remove function.
11572 * layout.h (class Layout): Update for above changes. Add new
11573 field sections_are_attached_.
11574 * output.h (Output_section::update_flags_for_input_section): New
11575 function.
11576 * output.cc (Output_section::add_input_section): Call
11577 update_flags_for_input_section.
11578 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11579
11580 2008-04-11 Cary Coutant <ccoutant@google.com>
11581
11582 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11583 thought unnecessary.
11584 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11585
11586 2008-04-11 Ian Lance Taylor <iant@google.com>
11587
11588 * output.h (class Output_section_data): Remove inline definition
11589 of set_addralign.
11590 * output.cc (Output_section_data::set_addralign): New function.
11591
11592 2008-04-11 Cary Coutant <ccoutant@google.com>
11593
11594 Add support for TLS descriptors for i386 and x86_64.
11595 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11596 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11597 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11598 GOT_TYPE_TLS_DESC.
11599 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11600 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11601 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11602 relocations.
11603 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11604 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11605 Fix problem with initial-exec relocations.
11606 (Target_i386::Relocate::relocate_tls): Likewise.
11607 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11608 relaxation.
11609 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11610 support for section-plus-offset dynamic table entries.
11611 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11612 (Output_data_dynamic::Dynamic_entry): Add support for
11613 section-plus-offset dynamic table entries.
11614 (Output_data_dynamic::Classification): Likewise.
11615 (Output_data_dynamic::classification_): Renamed offset_.
11616 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11617 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11618 (Target_x86_64::make_plt_section): New function.
11619 (Target_x86_64::reserve_tlsdesc_entries): New function.
11620 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11621 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11622 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11623 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11624 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11625 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11626 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11627 add extra PLT entry for TLS descriptors.
11628 (Output_data_plt_x86_64::got_): New field.
11629 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11630 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11631 fields.
11632 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11633 descriptors.
11634 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11635 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11636 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11637 R_386_TLS_DESC_CALL relocations.
11638 (Target_x86_64::Scan::global): Likewise.
11639 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11640 for TLS descriptors.
11641 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11642 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11643 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11644 GD-to-IE relaxation.
11645 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11646 and TLS_DESCRIPTORS.
11647 * Makefile.in: Rebuild.
11648 * configure: Rebuild.
11649 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11650 (tls_test_shared2.so): New target.
11651 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11652 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11653 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11654 (tls_shared_gd_to_ie_test_LDADD): New variable.
11655 (tls_shared_gnu2_gd_to_ie_test): New target.
11656 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11657 New targets.
11658 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11659 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11660 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11661 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11662 (tls_shared_gnu2_test): New target.
11663 (tls_test_gnu2_shared.so): New target.
11664 (tls_shared_gnu2_test_SOURCES): New variable.
11665 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11666 (tls_shared_gnu2_test_LDFLAGS): New variable.
11667 (tls_shared_gnu2_test_LDADD): New variable.
11668 * testsuite/Makefile.in: Rebuild.
11669 * testsuite/Makefile.
11670
11671 2008-04-11 Ian Lance Taylor <iant@google.com>
11672
11673 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11674 justsyms.t.
11675 * testsuite/Makefile.in: Rebuild.
11676
11677 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11678 long.
11679 * testsuite/script_test_2.cc (main): Adjust test.
11680
11681 2008-04-11 David S. Miller <davem@davemloft.net>
11682 Ian Lance Taylor <iant@google.com>
11683
11684 * options.h (General_options): Add entries for '-Y' and
11685 '-relax'.
11686 * options.cc (General_options:finalize): If -Y was used, add those
11687 entries to the library path instead of the default "/lib" and
11688 "/usr/lib".
11689
11690 2008-04-11 David S. Miller <davem@davemloft.net>
11691
11692 * testsuite/justsyms.t: Start at 0x100.
11693 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11694 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11695 long.
11696 * testsuite/script_test_2.cc: Adjust string and section length
11697 checks.
11698
11699 2008-04-09 Ian Lance Taylor <iant@google.com>
11700
11701 PR gold/5996
11702 * script-sections.cc (Sections_element::allocate_to_segment): Add
11703 orphan parameter.
11704 (Output_section_definition::allocate_to_segment): Likewise.
11705 (Orphan_output_section::allocate_to_segment): Likewise.
11706 (Script_sections::attach_sections_using_phdrs_clause): Don't
11707 propagate non-PT_LOAD segments to orphan sections.
11708 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11709 readelf rather than objdump.
11710 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11711 .interp section and PT_INTERP segment are the same size.
11712 * testsuite/Makefile.in: Rebuild.
11713
11714 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11715 aliases for symbols defined in the same object.
11716 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11717 (weak_alias_test_SOURCES): New variable.
11718 (weak_alias_test_DEPENDENCIES): New variable.
11719 (weak_alias_test_LDFLAGS): New variable.
11720 (weak_alias_test_LDADD): New variable.
11721 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11722 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11723 (weak_alias_test_3.o): New target.
11724 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11725 * testsuite/weak_alias_test_main.cc: New file.
11726 * testsuite/weak_alias_test_1.cc: New file.
11727 * testsuite/weak_alias_test_2.cc: New file.
11728 * testsuite/weak_alias_test_3.cc: New file.
11729
11730 2008-04-08 Ian Lance Taylor <iant@google.com>
11731
11732 * options.h (class General_options): Add --noinhibit-exec option.
11733 * main.cc (main): Check --noinhibit-exec.
11734
11735 * options.h (class General_options): Define --wrap as a special
11736 option. Add wrap_symbols_ field.
11737 (General_options::any_wrap_symbols): New function.
11738 (General_options::is_wrap_symbol): New function.
11739 * options.cc (General_options::parse_wrap): New function.
11740 (General_options::General_options): Initialize wrap_symbols_.
11741 * symtab.cc (Symbol_table::wrap_symbol): New function.
11742 (Symbol_table::add_from_object): Handle --wrap.
11743 * symtab.h (class Symbol_table): Declare wrap_symbol.
11744 * target.h (Target::wrap_char): New function.
11745 (Target::Target_info): Add wrap_char field.
11746 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11747 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11748 * testsuite/testfile.cc (Target_test::test_target_info):
11749 Likewise.
11750
11751 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11752 there is one.
11753
11754 * layout.h (class Layout): Add added_eh_frame_data_ field.
11755 * layout.cc (Layout::Layout): Initialize new field.
11756 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11757 output section until we find a section we merged successfully.
11758 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11759 that the size be non-zero.
11760
11761 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11762 qualifier.
11763
11764 2008-04-08 Craig Silverstein <csilvers@google.com>
11765
11766 * configure.ac: Export new conditional variable HAVE_ZLIB.
11767 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11768 on HAVE_ZLIB.
11769 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11770 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11771
11772 2008-04-07 Ian Lance Taylor <iant@google.com>
11773
11774 * version.cc (version_string): Set to "1.5".
11775
11776 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11777 Add issued_non_pic_error_ field. Declare check_non_pic.
11778 (Target_x86_64::Scan::check_non_pic): New function.
11779 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11780 (Target_x86_64::Scan::global): Likewise.
11781
11782 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11783 addend parameter. Change caller. Handle merge sections.
11784 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11785 Address to Addend. Don't add in the result of
11786 local_section_offset, pass down the addend and use the returned
11787 value.
11788 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11789 Update declarations of local_section_offset and symbol_value.
11790 * testsuite/two_file_test_1.cc (t18): New function.
11791 * testsuite/two_file_test_2.cc (f18): New function.
11792 * testsuite/two_file_test_main.cc (main): Call t18.
11793 * testsuite/two_file_test.h (t18, f18): Declare.
11794
11795 * configure.ac: Don't test for objdump, c++filt, or readelf.
11796 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11797 conditionals.
11798 (TEST_READELF): New variable.
11799 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11800 (check_PROGRAMS): Add two_file_strip_test.
11801 (two_file_strip_test): New target.
11802 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11803 (two_file_same_shared_strip_test_SOURCES): New variable.
11804 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11805 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11806 (two_file_same_shared_strip_test_LDADD): New variable.
11807 (two_file_shared_strip.so): New target.
11808 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11809 (ver_test_5.syms, ver_test_7.syms): Likewise.
11810 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11811 (strip_test_3.stdout): Use TEST_OBJDUMP.
11812 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11813
11814 2008-04-04 Cary Coutant <ccoutant@google.com>
11815
11816 * symtab.h (Symbol::is_weak_undefined): New function.
11817 (Symbol::is_strong_undefined): New function.
11818 (Symbol::is_absolute): New function.
11819 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11820 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11821 absolute symbols.
11822 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11823 (weak_undef_test): New target.
11824 * testsuite/Makefile.in: Rebuild.
11825 * testsuite/weak_undef_file1.cc: New file.
11826 * testsuite/weak_undef_file2.cc: New file.
11827 * testsuite/weak_undef_test.cc: New file.
11828
11829 2008-04-03 Craig Silverstein <csilvers@google.com>
11830
11831 * compressed_output.h (class Output_compressed_section): Use
11832 unsigned buffer.
11833 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11834 add zlib header.
11835 (zlib_compressed_suffix): Removed.
11836 (Output_compressed_section::set_final_data_size): Use unsigned
11837 buffers.
11838 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11839 Fix linker invocation.
11840 (flagstest_o_specialfile_and_compress_debug_sections):
11841 Likewise.
11842 * testsuite/Makefile.in: Regenerated.
11843
11844 2008-04-02 David S. Miller <davem@davemloft.net>
11845
11846 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11847 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11848
11849 2008-04-02 Craig Silverstein <csilvers@google.com>
11850
11851 * TODO: New file.
11852
11853 2008-04-02 Ian Lance Taylor <iant@google.com>
11854
11855 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11856 parameters. Update for new key type to views_. Change all
11857 callers.
11858 (File_read::read): Adjust for byteshift in returned view.
11859 (File_read::add_view): New function, broken out of
11860 find_and_make_view.
11861 (File_read::make_view): New function, broken out of
11862 find_and_make_view.
11863 (File_read::find_or_make_view): Add offset and aligned
11864 parameters. Rewrite accordingly. Change all callers.
11865 (File_read::get_view): Add offset and aligned parameters. Adjust
11866 for byteshift in return value.
11867 (File_read::get_lasting_view): Likewise.
11868 * fileread.h (class File_read): Update declarations.
11869 (class File_read::View): Add byteshift_ field. Add byteshift to
11870 constructor. Add byteshift method.
11871 * archive.h (Archive::clear_uncached_views): New function.
11872 (Archive::get_view): Add aligned parameter. Change all callers.
11873 * object.h (Object::get_view): Add aligned parameter. Change all
11874 callers.
11875 (Object::get_lasting_view): Likewise.
11876
11877 * fileread.cc (File_read::release): Don't call clear_views if
11878 there are multiple objects.
11879 * fileread.h (File_read::clear_uncached_views): New function.
11880 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11881 on the archive.
11882
11883 2008-03-31 Cary Coutant <ccoutant@google.com>
11884
11885 Add thin archive support.
11886 * archive.cc (Archive::armagt): New const.
11887 (Archive::setup): Remove task parameter and calls to unlock.
11888 (Archive::unlock_nested_archives): New function.
11889 (Archive::read_header): Add nested_off parameter. Change
11890 all callers.
11891 (Archive::interpret_header): Likewise.
11892 (Archive::include_all_members): Change to handle thin
11893 archives.
11894 (Archive::include_member): Likewise.
11895 * archive.h (Archive::Archive): Add new parameters and
11896 initializers.
11897 (Archive::armagt): New const.
11898 (Archive::setup): Remove task parameter.
11899 (Archive::unlock_nested_archives): New function.
11900 (Archive::read_header): Add nested_off parameter.
11901 (Archive::interpret_header): Likewise.
11902 (Archive::Nested_archive_table): New typedef.
11903 (Archive::is_thin_archive_): New field.
11904 (Archive::nested_archives_): New field.
11905 (Archive::options_): New field.
11906 (Archive::dirpath_): New field.
11907 (Archive::task_): New field.
11908 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11909 for thin archives. Pass additional parameters to
11910 Archive::Archive. Unlock the archive file after calling
11911 Archive::setup.
11912
11913 2008-03-29 Ian Lance Taylor <iant@google.com>
11914
11915 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11916 version symbol to be local.
11917 * testsuite/ver_test_4.sh: New file.
11918 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11919 (check_DATA): Add ver_test_4.syms.
11920 (ver_test_4.syms): New target.
11921 * testsuite/Makefile.in: Rebuild.
11922
11923 * output.cc
11924 (Output_section::Input_section_sort_entry::has_priority): New
11925 function.
11926 (Output_section::Input_section_sort_entry::match_file_name): New
11927 function.
11928 (Output_section::Input_section_sort_entry::match_section_name):
11929 Remove.
11930 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11931 Remove.
11932 (Output_section::Input_section_sort_entry::match_section_file):
11933 Remove.
11934 (Output_section::Input_section_sort_compare::operator()): Rewrite
11935 using new Input_section_sort_entry functions. Sort crtbegin and
11936 crtend first. Sort sections with no priority before sections with
11937 a priority.
11938 * testsuite/initpri1.c (d3): Check j != 4.
11939 (cd5): New constructor/destructor function.
11940 (main): Check j != 2.
11941
11942 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11943 new symbol when resolving, don't call set_is_default.
11944 * testsuite/ver_test_7.cc: New file.
11945 * testsuite/ver_test_7.sh: New file.
11946 * testsuite/Makefile.am (ver_test_7.so): New target.
11947 (ver_test_7.o): New target.
11948 (check_SCRIPTS): Add ver_test_7.sh.
11949 (check_DATA): Add ver_test_7.syms.
11950 (ver_test_7.syms): New target.
11951
11952 2008-03-28 Ian Lance Taylor <iant@google.com>
11953
11954 * layout.cc (Layout::layout): If we see an input section with a
11955 name that needs sorting, set the must_sort flag for the output
11956 section.
11957 (Layout::make_output_section): If the name of the output section
11958 indicates that it might require sorting, set the may_sort flag.
11959 * output.h (Output_section::may_sort_attached_input_sections): New
11960 function.
11961 (Output_section::set_may_sort_attached_input_sections): New
11962 function.
11963 (Output_section::must_sort_attached_input_sections): New
11964 function.
11965 (Output_section::set_must_sort_attached_input_sections): New
11966 function.
11967 (class Output_section): Declare Input_section_sort_entry. Define
11968 Input_section_sort_compare. Declare
11969 sort_attached_input_sections. Add new fields:
11970 may_sort_attached_input_sections_,
11971 must_sort_attached_input_sections_,
11972 attached_input_sections_are_sorted_.
11973 * output.cc (Output_section::Output_section): Initialize new
11974 fields.
11975 (Output_section::add_input_section): Add an entry to
11976 input_sections_ if may_sort or must_sort are true.
11977 (Output_section::set_final_data_size): Call
11978 sort_attached_input_sections if necessary.
11979 (Output_section::Input_section_sort_entry): Define new class.
11980 (Output_section::Input_section_sort_compare::operator()): New
11981 function.
11982 (Output_section::sort_attached_input_sections): New function.
11983 * configure.ac: Check whether the compiler supports constructor
11984 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11985 * testsuite/initpri1.c: New file.
11986 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11987 CONSTRUCTOR_PRIORITY.
11988 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11989 (initpri1_LDFLAGS): New variable.
11990 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11991
11992 2008-03-27 Ian Lance Taylor <iant@google.com>
11993
11994 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11995 * testsuite/common_test_1.c: New file.
11996 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11997 (common_test_1_SOURCES): New variable.
11998 (common_test_1_DEPENDENCIES): New variable.
11999 (common_test_1_LDFLAGS): New variable.
12000
12001 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12002 and commons_ correctly when NAME/VERSION does not override
12003 NAME/NULL.
12004 * testsuite/ver_test_6.c: New file.
12005 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12006 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12007 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12008
12009 2008-03-26 Ian Lance Taylor <iant@google.com>
12010
12011 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12012 of an undefined symbol from a version script.
12013 * testsuite/Makefile.am (ver_test_5.so): New target.
12014 (ver_test_5.o): New target.
12015 (check_SCRIPTS): Add ver_test_5.sh.
12016 (check_DATA): Add ver_test_5.syms.
12017 (ver_test_5.syms): New target.
12018 * testsuite/ver_test_5.cc: New file.
12019 * testsuite/ver_test_5.script: New file.
12020 * testsuite/ver_test_5.sh: New file.
12021 * Makefile.in, testsuite/Makefile.in: Rebuild.
12022
12023 PR gold/5986
12024 Fix problems building gold with gcc 4.3.0.
12025 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12026 (gold_error_at_location, gold_warning_at_location): Use it.
12027 * configure.ac: Check whether we can compile and use a template
12028 function with a printf attribute.
12029 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12030 when jumping over bytes.
12031 * object.cc: Instantiate Object::read_section_data.
12032 * debug.h: Include <cstring>
12033 * dwarf_reader.cc: Include <algorithm>
12034 * main.cc: Include <cstring>.
12035 * options.cc: Include <cstring>.
12036 * output.cc: Include <cstring>.
12037 * script.cc: Include <cstring>.
12038 * script.h: Include <string>.
12039 * symtab.cc: Include <cstring> and <algorithm>.
12040 * target-select.cc: Include <cstring>.
12041 * version.cc: Include <string>.
12042 * testsuite/testmain.cc: Include <cstdlib>.
12043 * configure, config.in: Rebuild.
12044
12045 2008-03-25 Ian Lance Taylor <iant@google.com>
12046
12047 * options.cc: Include "../bfd/bfdver.h".
12048 (options::help): Print bug reporting address.
12049
12050 * version.cc (print_version): Adjust output for current value of
12051 BFD_VERSION_STRING.
12052
12053 * NEWS: New file.
12054
12055 * options.cc (options::help): Print list of supported targets.
12056 * target-select.h: Include <vector>.
12057 (class Target_selector): Make machine_, size_, and is_big_endian_
12058 fields const. Add bfd_name_ and instantiated_target_ fields.
12059 (Target_selector::Target_selector): Add bfd_name parameter.
12060 (Target_selector::recognize): Make non-virtual, call
12061 do_recognize.
12062 (Target_selector::recognize_by_name): Make non-virtual, call
12063 do_recognize_by_name.
12064 (Target_selector::supported_names): New function.
12065 (Target_selector::bfd_name): New function.
12066 (Target_selector::do_instantiate_target): New pure virtual
12067 function.
12068 (Target_selector::do_recognize): New virtual function.
12069 (Target_selector::do_recognize_by_name): New virtual function.
12070 (Target_selector::instantiate_target): New private function.
12071 (supported_target_names): Declare.
12072 * target-select.cc (Target_selector::Target_selector): Update for
12073 new parameter and fields.
12074 (select_target_by_name): Check that the name matches before
12075 calling recognize_by_name.
12076 (supported_target_names): New function.
12077 * i386.cc (class Target_selector_i386): Update Target_selector
12078 constructor call. Remove recognize and recognize_by_name. Add
12079 do_instantiate_target.
12080 * x86_64.cc (class Target_selector_x86_64): Likewise.
12081 * testsuite/testfile.cc (class Target_selector_test): Update for
12082 changes to Target_selector.
12083
12084 * README: Rewrite, with some notes on unsupported features.
12085
12086 2008-03-24 Cary Coutant <ccoutant@google.com>
12087
12088 * i386.cc (Target_i386::Got_type): New enum declaration.
12089 (Target_i386::Scan::local): Updated callers of Output_data_got
12090 member functions.
12091 (Target_i386::Scan::global): Likewise.
12092 (Target_i386::Relocate::relocate): Likewise.
12093 (Target_i386::Relocate::relocate_tls): Likewise.
12094 * object.h (Got_offset_list): New class.
12095 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12096 (Sized_relobj::local_got_offset): Likewise.
12097 (Sized_relobj::set_local_got_offset): Likewise.
12098 (Sized_relobj::local_has_tls_got_offset): Removed.
12099 (Sized_relobj::local_tls_got_offset): Removed.
12100 (Sized_relobj::set_local_tls_got_offset): Removed.
12101 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12102 * output.cc (Output_data_got::add_global): Added got_type parameter.
12103 (Output_data_got::add_global_with_rel): Likewise.
12104 (Output_data_got::add_global_with_rela): Likewise.
12105 (Output_data_got::add_global_pair_with_rel): New function.
12106 (Output_data_got::add_global_pair_with_rela): New function.
12107 (Output_data_got::add_local): Added got_type parameter.
12108 (Output_data_got::add_local_with_rel): Likewise.
12109 (Output_data_got::add_local_with_rela): Likewise.
12110 (Output_data_got::add_local_pair_with_rel): New function.
12111 (Output_data_got::add_local_pair_with_rela): New function.
12112 (Output_data_got::add_global_tls): Removed.
12113 (Output_data_got::add_global_tls_with_rel): Removed.
12114 (Output_data_got::add_global_tls_with_rela): Removed.
12115 (Output_data_got::add_local_tls): Removed.
12116 (Output_data_got::add_local_tls_with_rel): Removed.
12117 (Output_data_got::add_local_tls_with_rela): Removed.
12118 * output.h (Output_data_got::add_global): Added got_type parameter.
12119 (Output_data_got::add_global_with_rel): Likewise.
12120 (Output_data_got::add_global_with_rela): Likewise.
12121 (Output_data_got::add_global_pair_with_rel): New function.
12122 (Output_data_got::add_global_pair_with_rela): New function.
12123 (Output_data_got::add_local): Added got_type parameter.
12124 (Output_data_got::add_local_with_rel): Likewise.
12125 (Output_data_got::add_local_with_rela): Likewise.
12126 (Output_data_got::add_local_pair_with_rel): New function.
12127 (Output_data_got::add_local_pair_with_rela): New function.
12128 (Output_data_got::add_global_tls): Removed.
12129 (Output_data_got::add_global_tls_with_rel): Removed.
12130 (Output_data_got::add_global_tls_with_rela): Removed.
12131 (Output_data_got::add_local_tls): Removed.
12132 (Output_data_got::add_local_tls_with_rel): Removed.
12133 (Output_data_got::add_local_tls_with_rela): Removed.
12134 * resolve.cc (Symbol::override_base_with_special): Removed
12135 reference to has_got_offset_ field.
12136 * symtab.cc (Symbol::init_fields): Replaced initialization
12137 of got_offset_ with got_offsets_. Removed initialization
12138 of has_got_offset_
12139 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
12140 (Symbol::got_offset): Likewise.
12141 (Symbol::set_got_offset): Likewise.
12142 (Symbol::has_tls_got_offset): Removed.
12143 (Symbol::tls_got_offset): Removed.
12144 (Symbol::set_tls_got_offset): Removed.
12145 (Symbol::got_offset_): Removed.
12146 (Symbol::tls_mod_got_offset_): Removed.
12147 (Symbol::tls_pair_got_offset_): Removed.
12148 (Symbol::got_offsets_): New field.
12149 (Symbol::has_got_offset): Removed.
12150 (Symbol::has_tls_mod_got_offset): Removed.
12151 (Symbol::has_tls_pair_got_offset): Removed.
12152 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12153 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12154 member functions.
12155 (Target_x86_64::Scan::global): Likewise.
12156 (Target_x86_64::Relocate::relocate): Likewise.
12157 (Target_x86_64::Relocate::relocate_tls): Likewise.
12158
12159 2008-03-25 Ben Elliston <bje@au.ibm.com>
12160
12161 * yyscript.y: Fix spelling error in comment.
12162
12163 2008-03-24 Ian Lance Taylor <iant@google.com>
12164
12165 * options.h (class General_options): Define build_id option.
12166 * layout.h (class Layout): Declare write_build_id, create_note,
12167 create_build_id. Add build_id_note_ member.
12168 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12169 "libiberty.h", "md5.h", "sha1.h".
12170 (Layout::Layout): Initialize eh_frame_data_,
12171 eh_frame_hdr_section_, and build_id_note_.
12172 (Layout::finalize): Call create_build_id.
12173 (Layout::create_note): New function, broken out of
12174 Layout::create_gold_note.
12175 (Layout::create_gold_note): Call create_note.
12176 (Layout::create_build_id): New function.
12177 (Layout::write_build_id): New function.
12178 (Close_task_runner::run): Call write_build_id.
12179
12180 * x86_64.cc: Correct license to GPLv3.
12181
12182 2008-03-23 Ian Lance Taylor <iant@google.com>
12183
12184 * options.cc: Include "demangle.h".
12185 (parse_optional_string): New function.
12186 (parse_long_option): Handle takes_optional_argument.
12187 (parse_short_option): Update dash_z initializer. Handle
12188 takes_optional_argument.
12189 (General_options::General_options): Initialize do_demangle_.
12190 (General_options::finalize): Set do_demangle_. Handle demangling
12191 style.
12192 * options.h (parse_optional_string): Declare.
12193 (struct One_option): Add optional_arg field. Update constructor.
12194 Update call constructor calls. Add takes_optional_argument
12195 function.
12196 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12197 (DEFINE_optional_string): Define.
12198 (General_options::demangle): Change from DEFINE_bool to
12199 DEFINE_optional_string.
12200 (General_options::no_demangle): New function.
12201 (General_options::do_demangle): New function.
12202 (General_options::set_do_demangle): New function.
12203 (General_options::execstack_status_): Move definition to end of
12204 class definition.
12205 (General_options::static_): Likewise.
12206 (General_options::do_demangle_): New field.
12207 * object.cc (big_endian>::get_symbol_location_info): Call
12208 Options::do_demangle, not Options::demangle.
12209 * symtab.cc (demangle): Likewise.
12210
12211 2008-03-22 Ian Lance Taylor <iant@google.com>
12212
12213 * gold.h: Include <cstddef> and <sys/types.h>
12214 * options.h: Include <cstring>.
12215
12216 2008-03-21 Ian Lance Taylor <iant@google.com>
12217
12218 * Added source code to GNU binutils.