* options.h (class General_options): Add --[no-]gnu-unique options.
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
9634ed06
CC
12011-10-31 Cary Coutant <ccoutant@google.com>
2
3 * options.h (class General_options): Add --[no-]gnu-unique options.
4 * symtab.cc (Symbol_table::sized_write_globals): Convert
5 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
6
de4101c7
CC
72011-10-31 Cary Coutant <ccoutant@google.com>
8
9 PR gold/13359
10 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
11 unnecessary assertion.
12 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
13
7257cc92
ST
142011-10-31 Sriraman Tallam <tmsriram@google.com>
15
16 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
17 gc_mark_symbol.
18 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
19 gc_mark_symbol.
20 Change to just keep the section associated with symbol.
21 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
22 they are externally visible and --export-dynamic is turned on.
23 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
24
bfc34b3f
ILT
252011-10-19 Ian Lance Taylor <iant@google.com>
26
27 PR gold/13163
28 * script-sections.cc
29 (Output_section_element_dot_assignment::needs_output_section): New
30 function.
31
ea0d8c47
ILT
322011-10-19 Ian Lance Taylor <iant@google.com>
33
34 PR gold/13204
35 * layout.cc (Layout::segment_precedes): Don't assert failure if a
36 --section-start option was seen.
37 * options.h (General_options::any_section_start): New function.
38
abd242a9
DM
392011-10-18 David S. Miller <davem@davemloft.net>
40
41 PR binutils/13301
42 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
43 member to track relocation locations that have moved during TLS
44 reloc optimizations.
45 (Target_sparc::Relocate::Relocate): Initialize to NULL.
46 (Target_sparc::Relocate::relocate): Adjust view down by 4
47 bytes if it matches reloc_adjust_addr_.
48 (Target_sparc::Relocate::relocate_tls): Always move the
49 __tls_get_addr call delay slot instruction forward 4 bytes when
50 performing relaxation.
51
bab9090f
CC
522011-10-18 Cary Coutant <ccoutant@google.com>
53
54 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
55 (Output_file::map_no_anonymous): Check for non-zero
56 return code from posix_fallocate.
57
f7c5b166
CC
582011-10-17 Cary Coutant <ccoutant@google.com>
59
60 PR gold/13245
61 * plugin.cc (is_visible_from_outside): Check for symbols
62 referenced from dynamic objects.
63 * resolve.cc (Symbol_table::resolve): Don't count references
64 from dynamic objects as references from real ELF files.
65 * testsuite/plugin_test_2.sh: Adjust expected result.
66
b490c0bb
CC
672011-10-17 Cary Coutant <ccoutant@google.com>
68
69 * gold.cc: Include timer.h.
70 (queue_middle_tasks): Stamp time.
71 (queue_final_tasks): Likewise.
72 * main.cc (main): Store timer in parameters. Print timers
73 for each pass.
74 * parameters.cc (Parameters::Parameters): Initialize timer_.
75 (Parameters::set_timer): New function.
76 (set_parameters_timer): New function.
77 * parameters.h (Parameters::set_timer): New function.
78 (Parameters::timer): New function.
79 (Parameters::timer_): New data member.
80 (set_parameters_timer): New function.
81 * timer.cc (Timer::stamp): New function.
82 (Timer::get_pass_time): New function.
83 * timer.h (Timer::stamp): New function.
84 (Timer::get_pass_time): New function.
85 (Timer::pass_times_): New data member.
86
f475cf7b
CC
872011-10-17 Cary Coutant <ccoutant@google.com>
88
89 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
90 task for members of lib groups.
91
cdd7e244
CC
922011-10-17 Cary Coutant <ccoutant@google.com>
93
94 PR gold/13288
4f95c8b4 95 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
96 (File_read::make_view): Move bounds check (replace with assert)...
97 (File_read::find_or_make_view): ... to here.
98
dfb45471
CC
992011-10-12 Cary Coutant <ccoutant@google.com>
100
4f95c8b4 101 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
102 ::read returns less than requested size.
103
53bbcc1b
CC
1042011-10-10 Cary Coutant <ccoutant@google.com>
105
4f95c8b4 106 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
107 Initialize defined_count_.
108 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
109 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
110 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
111 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
112 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 113 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
114 member.
115 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 116 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
117 Return zeroes instead of internal error.
118
397b129b
CC
1192011-10-10 Cary Coutant <ccoutant@google.com>
120
121 PR gold/13249
4f95c8b4 122 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 123 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 124 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
125 (Output_reloc::type_): Adjust size of bit field.
126 (Output_reloc::use_plt_offset_): New bit field.
127 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
128 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
129 flag. Adjust all callers.
4f95c8b4 130 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
131 creating RELATIVE relocations.
132
d5698657
NC
1332011-10-10 Nick Clifton <nickc@redhat.com>
134
135 * po/es.po: Updated Spanish translation.
136 * po/fi.po: Updated Finnish translation.
137
6a59a5c2
DN
1382011-10-03 Diego Novillo <dnovillo@google.com>
139
140 * options.cc (parse_uint): Fix dereference of RETVAL.
141
f0558624
ST
1422011-09-29 Sriraman Tallam <tmsriram@google.com>
143
144 * layout.h (section_order_map_): New member.
145 (get_section_order_map): New member function.
146 * output.cc (Output_section::add_input_section): Check for patterns
147 only when --section-ordering-file is specified.
148 * gold.cc (queue_middle_tasks): Delay updating order of sections till
149 output_sections have been formed.
150 * layout.cc (Layout_Layout): Initialize section_order_map_.
151 * plugin.cc (update_section_order): Store order in order_map. Do not
152 update the order.
153 * testsuite/Makefile.am: Add test case for plugin_final_layout.
154 * testsuite/Makefile.in: Regenerate.
155 * testsuite/plugin_section_order.c: New file.
156 * testsuite/plugin_final_layout.cc: New file.
157 * testsuite/plugin_final_layout.sh: New file.
158
a7dac153
CC
1592011-09-29 Cary Coutant <ccoutant@google.com>
160
4f95c8b4 161 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 162 Check for NULL.
4f95c8b4 163 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
164 symbols during incremental update.
165 (Symbol_table::add_from_dynobj): Likewise.
166
eebd87a5
ILT
1672011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
168 Ian Lance Taylor <iant@google.com>
169
170 * symtab.cc (Symbol_table::define_special_symbol): Always
171 canonicalize version string.
172
403a3331
CC
1732011-09-26 Cary Coutant <ccoutant@google.com>
174
4f95c8b4
CC
175 * gold.cc (queue_initial_tasks): Move option checks ...
176 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
177 some options; make others fatal.
178
235061c2
CC
1792011-09-26 Cary Coutant <ccoutant@google.com>
180
181 gcc PR lto/47247
182 * plugin.cc (get_symbols_v2): New function.
183 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
184 (is_referenced_from_outside): New function.
185 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
186 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
187 (get_symbols): Pass version parameter.
188 (get_symbols_v2): New function.
189 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
190 parameter.
191 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
192 (onload): Add LDPT_GET_SYMBOLS_V2.
193 (all_symbols_read_hook): Use get_symbols_v2; check for
194 LDPR_PREVAILING_DEF_IRONLY_EXP.
195 * testsuite/plugin_test_3.sh: Update expected results.
196
dc87f620
ILT
1972011-09-23 Simon Baldwin <simonb@google.com>
198
199 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
200 configuration options.
201 * configure: Regenerate.
202 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
203 * Makefile.in: Regenerate.
204 * testsuite/Makefile.in: Regenerate.
205
a8279f82
ST
2062011-09-19 Sriraman Tallam <tmsriram@google.com>
207
208 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
209
0c9350c8
CC
2102011-09-19 Cary Coutant <ccoutant@google.com>
211
212 * incremental.cc (can_incremental_update): Fix typo in comment.
213 * incremental.h (can_incremental_update): Likewise.
214
aa06ae28
CC
2152011-09-18 Cary Coutant <ccoutant@google.com>
216
217 * incremental.cc (can_incremental_update): New function.
218 * incremental.h (can_incremental_update): New function.
219 * layout.cc (Layout::init_fixed_output_section): Call it.
220 (Layout::make_output_section): Don't allow patch space in .eh_frame.
221 * object.cc (Sized_relobj_file::do_layout): Call
222 can_incremental_update.
223
ebb300b2
CC
2242011-09-13 Cary Coutant <ccoutant@google.com>
225
226 * configure.ac: Check for glibc support for gnu_indirect_function
227 support with static linking, setting automake conditional
228 IFUNC_STATIC.
229 * Makefile.in: Regenerate.
230 * configure: Regenerate.
231
232 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
233 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
234 for IFUNC_STATIC.
235 * testsuite/Makefile.in: Regenerate.
236
1206d0d5
CC
2372011-09-13 Cary Coutant <ccoutant@google.com>
238
239 * incremental.cc (Sized_relobj_incr::do_layout): Call
240 report_comdat_group for kept comdat sections.
241 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
242 * testsuite/Makefile.in: Regenerate.
243 * testsuite/incr_comdat_test_1.cc: New source file.
244 * testsuite/incr_comdat_test_2_v1.cc: New source file.
245 * testsuite/incr_comdat_test_2_v2.cc: New source file.
246 * testsuite/incr_comdat_test_2_v3.cc: New source file.
247
40b29874
ILT
2482011-09-13 Ian Lance Taylor <iant@google.com>
249
250 * object.cc (Sized_relobj_file::do_layout): Remove unused local
251 variable external_symbols_offset.
252
1b045aac
ILT
2532011-09-12 Ian Lance Taylor <iant@google.com>
254
255 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
256 triggered if object has no symbols.
257
24c6c55a
DM
2582011-09-09 David S. Miller <davem@davemloft.net>
259
260 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
261 (Output_fill_debug_line::do_write): Likewise.
262
66570254
CC
2632011-08-29 Cary Coutant <ccoutant@google.com>
264
265 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
266 casts to match formatting specs.
267 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
268
8ea8cd50
CC
2692011-08-26 Cary Coutant <ccoutant@google.com>
270
271 * layout.cc (Free_list::allocate): Provide guarantee of minimum
272 remaining hole size when allocating.
273 (Layout::make_output_section): Set fill methods for debug sections.
274 * layout.h (Free_list::Free_list_node): Move from private to
275 public.
276 (Free_list::set_min_hole_size): New function.
277 (Free_list::begin, Free_list::end): New functions.
278 (Free_list::min_hole_): New data member.
279 * output.cc: Include dwarf.h.
280 (Output_fill_debug_info::do_minimum_hole_size): New function.
281 (Output_fill_debug_info::do_write): New function.
282 (Output_fill_debug_line::do_minimum_hole_size): New function.
283 (Output_fill_debug_line::do_write): New function.
284 (Output_section::Output_section): Initialize new data member.
285 (Output_section::set_final_data_size): Ensure patch space is larger
286 than minimum hole size.
287 (Output_section::do_write): Fill holes in debug sections.
288 * output.h (Output_fill): New class.
289 (Output_fill_debug_info): New class.
290 (Output_fill_debug_line): New class.
291 (Output_section::set_free_space_fill): New function.
292 (Output_section::free_space_fill_): New data member.
293 * testsuite/Makefile.am (incremental_test_3): Add
294 --incremental-patch option.
295 (incremental_test_4): Likewise.
296 (incremental_test_5): Likewise.
297 (incremental_test_6): Likewise.
298 (incremental_copy_test): Likewise.
299 (incremental_common_test_1): Likewise.
300 * testsuite/Makefile.in: Regenerate.
301
7cf80422
NC
3022011-08-26 Nick Clifton <nickc@redhat.com>
303
304 * po/es.po: Updated Spanish translation.
305
c3f7b0e5
CC
3062011-08-01 Cary Coutant <ccoutant@google.com>
307
308 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
309 * gold/testsuite/Makefile.in: Regenerate.
310 * gold/testsuite/justsyms_exec.c: New source file.
311 * gold/testsuite/justsyms_lib.c: New source file.
312
9590bf25
CC
3132011-08-01 Cary Coutant <ccoutant@google.com>
314
315 * layout.cc (Layout::set_segment_offsets): Don't realign text
316 segment if -Ttext was specified.
317 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
318 file type.
319 * object.h (Sized_relobj_file::e_type): New function.
320 (Sized_relobj_file::e_type_): New data member.
321 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
322 base address for ET_EXEC files.
323 * target.cc (Target::do_make_elf_object_implementation): Allow
324 ET_EXEC files with --just-symbols option.
325
dcd8d12e
CC
3262011-07-28 Cary Coutant <ccoutant@google.com>
327
328 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
329 Add thread_number parameter.
330 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
331 * workqueue-threads.cc
332 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
333 current thread if its thread number is greater than desired thread
334 count.
335 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
336 Add thread_number parameter.
337 (Workqueue::should_cancel_thread): Likewise.
338 (Workqueue::find_runnable_or_wait): Pass thread_number to
339 should_cancel_thread.
340 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
341 parameter.
342
804eb480
ST
3432011-07-22 Sriraman Tallam <tmsriram@google.com>
344
345 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
346 only after checking if it cannot be forced local.
347 * symtab.h (is_externally_visible): Check if the symbol is not forced
348 local.
349
f1ddb600
ILT
3502011-07-15 Ian Lance Taylor <iant@google.com>
351
352 * options.h (class General_options): Add --print-output-format.
353 Move -EL next to -EB, for better --help output.
354 * target-select.cc: Include <cstdio>, "options.h", and
355 "parameters.h".
356 (Target_selector::do_target_bfd_name): New function.
357 (print_output_format): New function.
358 * target-select.h (class Target_selector): Update declarations.
359 (Target_selector::target_bfd_name): New function.
360 (print_output_format): Declare.
361 * main.cc: Include "target-select.h".
362 (main): Handle --print-output-format.
363 * gold.cc: Include "target-select.h".
364 (queue_initial_tasks): Handle --print-output-format when there are
365 no input files.
366 * parameters.cc (parameters_force_valid_target): Give a better
367 error message if -EB/-EL does not match target.
368 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
369 function.
370
7d172687
ILT
3712011-07-15 Ian Lance Taylor <iant@google.com>
372
373 * i386.cc (class Output_data_plt_i386): Add layout_ field.
374 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
375 (Output_data_plt_i386::do_write): Write address of .dynamic
376 section to first entry in .got.plt section.
377 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
378 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
379 Initialize layout_.
380 (Output_data_plt_x86_64::do_write): Write address of .dynamic
381 section to first entry in .got.plt section.
382 * layout.h (Layout::dynamic_section): New function.
383
e9552f7e
ST
3842011-07-13 Sriraman Tallam <tmsriram@google.com>
385
386 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
387 to claim_file call.
388 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
389 input_section_position_, and input_section_glob_.
390 (read_layout_from_file): Call function section_ordering_specified.
391 * layout.h (is_section_ordering_specified): New function.
392 (section_ordering_specified): New function.
393 (section_ordering_specified_): New boolean member.
394 * main.cc(main): Call load_plugins after layout object is defined.
395 * output.cc (Output_section::add_input_section): Use
396 function section_ordering_specified to check if section ordering is
397 needed.
398 * output.cc (Output_section::add_relaxed_input_section): Use
399 function section_ordering_specified to check if section ordering is
400 needed.
401 (Output_section::update_section_layout): New function.
402 (Output_section::sort_attached_input_sections): Check if input section
403 must be reordered.
404 * output.h (Output_section::update_section_layout): New function.
405 * plugin.cc (get_section_count): New function.
406 (get_section_type): New function.
407 (get_section_name): New function.
408 (get_section_contents): New function.
409 (update_section_order): New function.
410 (allow_section_ordering): New function.
411 (Plugin::load): Add the new interfaces to the transfer vector.
412 (Plugin_manager::load_plugins): New parameter.
413 (Plugin_manager::all_symbols_read): New parameter.
414 (Plugin_manager::claim_file): New parameter. Save the elf object for
415 unclaimed objects.
416 (Plugin_manager::get_elf_object): New function.
417 (Plugin_manager::get_view): Change to directly use the bool to check
418 if get_view is called from claim_file_hook.
419 * plugin.h (input_objects): New function
420 (Plugin__manager::load_plugins): New parameter.
421 (Plugin_manager::claim_file): New parameter.
422 (Plugin_manager::get_elf_object): New function.
423 (Plugin_manager::in_claim_file_handler): New function.
424 (Plugin_manager::in_claim_file_handler_): New member.
425 (layout): New function.
426 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
427 handler with an extra parameter. Make the elf object before calling
428 claim_file handler.
429 * testsuite/plugin_test.c (get_section_count): New function pointer.
430 (get_section_type): New function pointer.
431 (get_section_name): New function pointer.
432 (get_section_contents): New function pointer.
433 (update_section_order): New function pointer.
434 (allow_section_ordering): New function pointer.
435 (onload): Check if the new interfaces exist.
436
9446efde
ILT
4372011-07-13 Ian Lance Taylor <iant@google.com>
438
439 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
440 relro section.
441 * x86_64.cc (Target_x86_64::got_section): Likewise.
442 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
443 (relro_now_test_SOURCES): New variable.
444 (relro_now_test_DEPENDENCIES): New variable.
445 (relro_now_test_LDFLAGS): New variable.
446 (relro_now_test_LDADD): New variable.
447 (relro_now_test.so): New target.
448 * testsuite/Makefile.in: Rebuild.
449
07aa62f2
ILT
4502011-07-12 Ian Lance Taylor <iant@google.com>
451
452 PR gold/12980
453 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
454 GLOB_DAT relocation rather than a RELATIVE relocation for a
455 protected symbol when creating a shared library.
456 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
457 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
458 * testsuite/protected_main_1.cc (main): Test that protected
459 function has same address.
460
e2153196
ILT
4612011-07-11 Ian Lance Taylor <iant@google.com>
462
463 PR gold/12979
464 * options.h (class General_options): Add -Bgroup.
465 * options.cc (General_options::finalize): If -Bgroup is set,
466 default to --unresolved-symbols=report-all.
467 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
468 * target-reloc.h (issue_undefined_symbol_error): Handle
469 --unresolved-symbols=report-all.
470
6daf5215
ILT
4712011-07-08 Ian Lance Taylor <iant@google.com>
472
473 PR gold/11985
474 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
475 if linker script discards key sections.
476 (Layout::create_dynamic_symtab): Likewise.
477 (Layout::assign_local_dynsym_offsets): Likewise.
478 (Layout::sized_create_version_sections): Likewise.
479 (Layout::create_interp): Likewise.
480 (Layout::finish_dynamic_section): Likewise.
481 (Layout::set_dynamic_symbol_size): Likewise.
482
beabb2c6
ILT
4832011-07-08 Ian Lance Taylor <iant@google.com>
484
485 PR gold/12386
486 * options.h (class General_options): Add --unresolved-symbols.
487 * target-reloc.h (issue_undefined_symbol_error): Check
488 --unresolved-symbols. Add comments.
489
9c16daf1
ILT
4902011-07-08 Ian Lance Taylor <iant@google.com>
491
492 * testsuite/odr_violation2.cc (Ordering::operator()): Make
493 expression more complex.
494
191f1a2d
ILT
4952011-07-08 Ian Lance Taylor <iant@google.com>
496
497 PR gold/11317
498 * target-reloc.h (issue_undefined_symbol_error): New inline
499 function, broken out of relocate_section.
500 (relocate_section): Call issue_undefined_symbol_error.
501 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
502 there is no TLS segment if we are about to issue an undefined
503 symbol error.
504 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
505
62855347
ILT
5062011-07-08 Ian Lance Taylor <iant@google.com>
507
508 PR gold/12279
509 * resolve.cc (Symbol_table::should_override): Add fromtype
510 parameter. Change all callers. Give error when linking together
511 TLS and non-TLS symbol.
512 (Symbol_table::should_override_with_special): Add fromtype
513 parameter. Change all callers.
514 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
515 there is no TLS segment if we have reported some errors.
516 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
517
67181c72
ILT
5182011-07-08 Ian Lance Taylor <iant@google.com>
519
520 PR gold/12372
521 * target.h (Target::plt_address_for_global): New function.
522 (Target::plt_address_for_local): New function.
523 (Target::plt_section_for_global): Remove.
524 (Target::plt_section_for_local): Remove.
525 (Target::do_plt_address_for_global): New virtual function.
526 (Target::do_plt_address_for_local): New virtual function.
527 (Target::do_plt_section_for_global): Remove.
528 (Target::do_plt_section_for_local): Remove.
529 (Target::register_global_plt_entry): Add Symbol_table and Layout
530 parameters.
531 * output.cc (Output_data_got::Got_entry::write): Use
532 plt_address_for_global and plt_address_for_local.
533 * layout.cc (Layout::add_target_dynamic_tags): Use size and
534 address of output section.
535 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
536 got_irelative_, and irelative_count_ fields. Update
537 declarations.
538 (Output_data_plt_i386::has_irelative_section): New function.
539 (Output_data_plt_i386::entry_count): Add irelative_count_.
540 (Output_data_plt_i386::set_final_data_size): Likewise.
541 (class Target_i386): Add got_irelative_ and rel_irelative_
542 fields. Update declarations.
543 (Target_i386::Target_i386): Initialize new fields.
544 (Target_i386::do_plt_address_for_global): New function replacing
545 do_plt_section_for_global.
546 (Target_i386::do_plt_address_for_local): New function replacing
547 do_plt_section_for_local.
548 (Target_i386::got_section): Create got_irelative_.
549 (Target_i386::rel_irelative_section): New function.
550 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
551 fields. Don't define __rel_iplt_{start,end}.
552 (Output_data_plt_i386::add_entry): Add symtab and layout
553 parameters. Change all callers. Use different PLT and GOT for
554 IFUNC symbols.
555 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
556 layout parameters. Change all callers. Use different PLT and
557 GOT.
558 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
559 (Output_data_plt_i386::rel_irelative): New function.
560 (Output_data_plt_i386::address_for_global): New function.
561 (Output_data_plt_i386::address_for_local): New function.
562 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
563 IRELATIVE GOT when changing IFUNC GOT entries.
564 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
565 reloc.
566 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
567 if we didn't create an IRELATIVE GOT.
568 (Target_i386::Relocate::relocate): Use plt_address_for_global and
569 plt_address_for_local.
570 (Target_i386::do_dynsym_value): Use plt_address_for_global.
571 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
572 got_irelative_, and irelative_count_ fields. Update
573 declarations.
574 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
575 Initialize new fields. Remove symtab parameter. Change all
576 callers.
577 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
578 irelative_count_.
579 (Output_data_plt_x86_64::has_irelative_section): New function.
580 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
581 (class Target_x86_64): Add got_irelative_ and rel_irelative_
582 fields. Update declarations.
583 (Target_x86_64::Target_x86_64): Initialize new fields.
584 (Target_x86_64::do_plt_address_for_global): New function replacing
585 do_plt_section_for_global.
586 (Target_x86_64::do_plt_address_for_local): New function replacing
587 do_plt_section_for_local.
588 (Target_x86_64::got_section): Create got_irelative_.
589 (Target_x86_64::rela_irelative_section): New function.
590 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
591 all callers. Don't create __rel_iplt_{start,end}.
592 (Output_data_plt_x86_64::add_entry): Add symtab and layout
593 parameters. Change all callers. Use different PLT and GOT for
594 IFUNC symbols.
595 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
596 layout parameters. Change all callers. Use different PLT and
597 GOT.
598 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
599 parameters. Change all callers. Use different PLT and GOT for
600 IFUNC symbols.
601 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
602 (Output_data_plt_x86_64::rela_irelative): New function.
603 (Output_data_plt_x86_64::address_for_global): New function.
604 (Output_data_plt_x86_64::address_for_local): New function.
605 (Output_data_plt_x86_64::set_final_data_size): Likewise.
606 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
607 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
608 (Target_x86_64::register_global_plt_entry): Add symtab and layout
609 parameters.
610 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
611 reloc.
612 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
613 symbols if we didn't create an IRELATIVE GOT.
614 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
615 plt_address_for_local.
616 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
617 * testsuite/ifuncvar1.c: New test file.
618 * testsuite/ifuncvar2.c: New test file.
619 * testsuite/ifuncvar3.c: New test file.
620 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
621 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
622 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
623 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
624 * testsuite/Makefile.in: Rebuild.
625
33c15b45
CC
6262011-07-07 Cary Coutant <ccoutant@google.com>
627
628 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
629 (two_file_test_1_ndebug.o): Likewise.
630 (two_file_test_1b_ndebug.o): Likewise.
631 (two_file_test_2_ndebug.o): Likewise.
632 (two_file_test_main_ndebug.o): Likewise.
633 (incremental_test_2): Link with no-debug versions.
634
f48b5fb7
CC
6352011-07-06 Cary Coutant <ccoutant@google.com>
636
637 * gold/incremental.cc
638 (Output_section_incremental_inputs::write_info_blocks): Check for
639 hidden and internal symbols.
640
221597a5
CC
6412011-07-06 Cary Coutant <ccoutant@google.com>
642
643 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
644 Check disposition for startup file.
645 (Incremental_inputs::report_command_line): Ignore
646 --incremental-startup-unchanged option.
647 * options.cc (General_options::parse_incremental_startup_unchanged):
648 New function.
649 (General_options::General_options): Initialize new data member.
650 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
651 (General_options): Add --incremental-startup-unchanged option.
652 (General_options::incremental_startup_disposition): New function.
653 (General_options::incremental_startup_disposition_): New data member.
654
e24719f6
CC
6552011-07-06 Cary Coutant <ccoutant@google.com>
656
657 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
658 input file index to Script_info ctor.
659 (Sized_incremental_binary::do_file_has_changed): Find the
660 command-line argument for files named in scripts.
661 * incremental.h (Script_info::Script_info): New ctor
662 with input file index.
663 (Script_info::input_file_index): New function.
664 (Script_info::input_file_index_): New data member.
665 (Incremental_binary::get_library): Add const.
666 (Incremental_binary::get_script_info): Add const.
667 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
668 * testsuite/Makefile.am (incremental_test_5): New test case.
669 (incremental_test_6): New test case.
670 * testsuite/Makefile.in: Regenerate.
671
8f7c81e8
CC
6722011-07-06 Cary Coutant <ccoutant@google.com>
673
674 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
675 debug output when command lines differ.
676
9fbd3822
CC
6772011-07-06 Cary Coutant <ccoutant@google.com>
678
679 * incremental.cc (Incremental_inputs::report_command_line): Ignore
680 --incremental-patch option.
681 * layout.cc (Free_list::allocate): Extend allocation beyond original
682 end if enabled.
683 (Layout::make_output_section): Mark sections that should get
684 patch space.
685 * options.cc (parse_percent): New function.
686 * options.h (parse_percent): New function.
687 (DEFINE_percent): New macro.
688 (General_options): Add --incremental-patch option.
689 * output.cc (Output_section::Output_section): Initialize new data
690 members.
691 (Output_section::add_input_section): Print section name when out
692 of patch space.
693 (Output_section::add_output_section_data): Likewise.
694 (Output_section::set_final_data_size): Add patch space when
695 doing --incremental-full.
696 (Output_section::do_reset_address_and_file_offset): Remove patch
697 space.
698 (Output_segment::set_section_list_addresses): Print debug output
699 only if --incremental-update.
700 * output.h (Output_section::set_is_patch_space_allowed): New function.
701 (Output_section::is_patch_space_allowed_): New data member.
702 (Output_section::patch_space_): New data member.
703 * parameters.cc (Parameters::incremental_full): New function.
704 * parameters.h (Parameters::incremental_full): New function
705 * testsuite/Makefile.am (incremental_test_2): Add test for
706 --incremental-patch option.
707 * testsuite/Makefile.in: Regenerate.
708 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
709 (t18): Remove function body.
710
f6cccc2c
DK
7112011-07-05 Doug Kwan <dougkwan@google.com>
712
713 PR gold/12771
714 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
715 Arm_Address type for relocation result.
716 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
717 overflow check.
718 (Arm_relocate_functions::abs32): Use unaligned access.
719 (Arm_relocate_functions::rel32): Ditto.
720 (Arm_relocate_functions::prel31): Ditto.
721 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
722 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
723 static data relocations.
724 * testsuite/Makefile.in: Regnerate.
725 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
726
28a13fec
ILT
7272011-07-05 Ian Lance Taylor <iant@google.com>
728
729 PR gold/12392
730 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
731 symbols if necessary.
732 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
733
24d47b34
ILT
7342011-07-05 Ian Lance Taylor <iant@google.com>
735
736 PR gold/12952
737 * resolve.cc (Symbol::override_base_with_special): Simply override
738 version with special symbol version, ignoring previous version.
739
41f9cbbe
ILT
7402011-07-05 Ian Lance Taylor <iant@google.com>
741
742 * object.cc (Sized_relobj_file::include_section_group): Add
743 information to comment about signature location.
744
886288f1
ILT
7452011-07-02 Ian Lance Taylor <iant@google.com>
746
747 PR gold/12957
748 * options.h (class General_options): Add -f and -F.
749 * options.cc (General_options::finalize): Fatal error if -f/-F
750 are used without -shared.
751 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
752
ae3a6d4f
ILT
7532011-07-02 Ian Lance Taylor <iant@google.com>
754
755 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
756
21131061
ILT
7572011-07-01 Ian Lance Taylor <iant@google.com>
758
759 PR gold/12525
760 PR gold/12952
761 * resolve.cc (Symbol::override_base_with_special): Don't override
762 the version if the overriding symbol has a different name.
763 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
764 all callers. If we give an error about an undefined version,
765 define the base version if necessary.
766 * dynobj.h (class Versions): Update declaration.
767 * testsuite/weak_alias_test_5.cc: New file.
768 * testsuite/weak_alias_test.script: New file.
769 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
770 and versioned_alias have the right value, and call t2.
771 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
772 weak_alias_test_5.so.
773 (weak_alias_test_LDADD): Likewise.
774 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
775 * testsuite/Makefile.in: Rebuild.
776
611062c0
ILT
7772011-07-01 Ian Lance Taylor <iant@google.com>
778
779 PR gold/12525
780 * options.h (class General_options): Support -z notext.
781 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
782 -Wl,-z,notext.
783 (two_file_shared_nonpic.so): Likewise.
784 (two_file_shared_mixed.so): Likewise.
785 (two_file_shared_mixed_1.so): Likewise.
786 (weak_undef_lib_nonpic.so): Likewise.
787 (alt/weak_undef_lib_nonpic.so): Likewise.
788 (tls_test_shared_nonpic.so): Likewise.
789 * testsuite/Makefile.in: Rebuild.
790
328c7c2f
ILT
7912011-07-01 Ian Lance Taylor <iant@google.com>
792
793 PR gold/12525
794 * configure.ac: Test whether static linking works, setting
795 the automake conditional HAVE_STATIC.
796 * testsuite/Makefile.am: Disable tests using -static if
797 HAVE_STATIC is not true.
798 * configure, testsuite/Makefile.in: Rebuild.
799
02d7cd44
ILT
8002011-07-01 Ian Lance Taylor <iant@google.com>
801
802 PR gold/12525
803 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
804 Assert if we see DW_EH_PE_indirect.
805 * target.h (Target::ehframe_datarel_base): New function.
806 (Target::do_ehframe_datarel_base): New target function.
807 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
808 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
809 function.
810
07a60597
ILT
8112011-07-01 Ian Lance Taylor <iant@google.com>
812
813 PR gold/12571
814 * options.h (class General_options): Add
815 --ld-generated-unwind-info.
816 * ehframe.cc (Fde::write): Add address parameter. Change all
817 callers. If associated with PLT, fill in address and size.
818 (Cie::set_output_offset): Only add merge mapping if there is an
819 object.
820 (Cie::write): Add address parameter. Change all callers.
821 (Eh_frame::add_ehframe_for_plt): New function.
822 * ehframe.h (class Fde): Update declarations. Move shndx_ and
823 input_offset_ fields into union u_, with new plt field.
824 (Fde::Fde): Adjust for new union field.
825 (Fde::Fde) [Output_data version]: New constructor.
826 (Fde::add_mapping): Only add merge mapping if there is an object.
827 (class Cie): Update declarations.
828 (class Eh_frame): Declare add_ehframe_for_plt.
829 * layout.cc (Layout::layout_eh_frame): Break out code into
830 make_eh_frame_section, and call it.
831 (Layout::make_eh_frame_section): New function.
832 (Layout::add_eh_frame_for_plt): New function.
833 * layout.h (class Layout): Update declarations.
834 * merge.cc (Merge_map::add_mapping): Add assertion.
835 * i386.cc: Include "dwarf.h".
836 (class Output_data_plt_i386): Make first_plt_entry,
837 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
838 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
839 and plt_eh_frame_fde.
840 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
841 boundary. Call add_eh_frame_for_plt if appropriate.
842 * x86_64.cc: Include "dwarf.h".
843 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
844 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
845 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
846 and plt_eh_frame_fde.
847 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
848 appropriate.
849
14788a3f
ILT
8502011-06-29 Ian Lance Taylor <iant@google.com>
851
852 PR gold/12629
853 * object.cc (Sized_relobj_file::layout_section): Change shdr
854 parameter to be const.
855 (Sized_relobj_file::layout_eh_frame_section): New function, broken
856 out of do_layout.
857 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
858 appropriate. Call layout_eh_frame_section.
859 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
860 sections.
861 * object.h (class Sized_relobj_file): Update declarations.
862
6c21fce1
ILT
8632011-06-29 Ian Lance Taylor <iant@google.com>
864
37e41b03 865 PR gold/12652
6c21fce1
ILT
866 * script.cc (Token::integer_value): Accept trailing M/m/K/k
867 modifier.
868 (Lex::gather_token): Accept trailing M/m/K/k for integers.
869
4d5e4e62
ILT
8702011-06-29 Ian Lance Taylor <iant@google.com>
871
872 PR gold/12675
873 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
874 SHT_X86_64_UNWIND.
875 * layout.cc (Layout::layout_eh_frame): Likewise.
876
886f533a
ILT
8772011-06-29 Ian Lance Taylor <iant@google.com>
878
879 PR gold/12695
880 * layout.cc (Layout::symtab_section_shndx): New function.
881 * layout.h (class Layout): Declare symtab_section_shndx.
882 * output.cc (Output_section::write_header): Call it.
883
f3ae1b28
ILT
8842011-06-29 Ian Lance Taylor <iant@google.com>
885
886 PR gold/12818
887 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
888 symbols which are not used in a relocation.
889
aecf301f
ILT
8902011-06-28 Ian Lance Taylor <iant@google.com>
891
892 PR gold/12898
893 * layout.cc (Layout::segment_precedes): Don't crash if a linker
894 script create indistinguishable segments.
895 (Layout::set_segment_offsets): Use stable_sort when sorting
896 segments. Pass this to Compare_segments constructor.
897 * layout.h (class Layout): Make segment_precedes non-static.
898 (class Compare_segments): Change from struct to class. Add
899 layout_ field. Add constructor.
900 * script-sections.cc
901 (Script_sections::attach_sections_using_phdrs_clause): Rename
902 local orphan to is_orphan. Don't report failure to put empty
903 section in segment. On attachment failure, report name of
904 section, and attach to first PT_LOAD segment.
905
03ef7571
ILT
9062011-06-28 Ian Lance Taylor <iant@google.com>
907
908 PR gold/12934
909 * target-select.cc (Target_selector::Target_selector): Add
910 emulation parameter. Change all callers.
911 (select_target_by_bfd_name): Rename from select_target_by_name.
912 Change all callers.
913 (select_target_by_emulation): New function.
914 (supported_emulation_names): New function.
915 * target-select.h (class Target_selector): Add emulation_ field.
916 Update declarations.
917 (Target_selector::recognize_by_bfd_name): Rename from
918 recognize_by_name. Change all callers.
919 (Target_selector::supported_bfd_names): Rename from
920 supported_names. Change all callers.
921 (Target_selector::recognize_by_emulation): New function.
922 (Target_selector::supported_emulations): New function.
923 (Target_selector::emulation): New function.
924 (Target_selector::do_recognize_by_bfd_name): Rename from
925 do_recognize_by_name. Change all callers.
926 (Target_selector::do_supported_bfd_names): Rename from
927 do_supported_names. Change all callers.
928 (Target_selector::do_recognize_by_emulation): New function.
929 (Target_selector::do_supported_emulations): New function.
930 (select_target_by_bfd_name): Change name in declaration.
931 (select_target_by_emulation): Declare.
932 (supported_emulation_names): Declare.
933 * parameters.cc (parameters_force_valid_target): Try to find
934 target based on emulation from -m option.
935 * options.h (class General_options): Change doc string for -m.
936 * options.cc (help): Print emulations.
937 (General_options::parse_V): Likewise.
938 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
939 Add emulation parameter. Change all callers.
940
200b2bb9
ILT
9412011-06-28 Ian Lance Taylor <iant@google.com>
942
943 * target.h (class Target): Add osabi_ field.
944 (Target::osabi): New function.
945 (Target::set_osabi): New function.
946 (Target::Target): Initialize osabi_.
947 (Target::do_adjust_elf_header): Make pure virtual.
948 (Sized_target::do_adjust_elf_header): Declare.
949 * target.cc (Sized_target::do_adjust_elf_header): New function.
950 (class Sized_target): Instantiate all versions.
951 * freebsd.h (class Target_freebsd): Remove.
952 (Target_selector_freebsd::do_recognize): Call set_osabi on
953 Target.
954 (Target_selector_freebsd::do_recognize_by_name): Likewise.
955 (Target_selector_freebsd::set_osabi): Remove.
956 * i386.cc (class Target_i386): Inherit from Sized_target rather
957 than Target_freebsd.
958 * x86_64.cc (class Target_x86_64): Likewise.
959
b3ce541e
ILT
9602011-06-28 Ian Lance Taylor <iant@google.com>
961
962 * target.h (Target::can_check_for_function_pointers): Rewrite.
963 Make non-virtual.
964 (Target::can_icf_inline_merge_sections): Likewise.
965 (Target::section_may_have_icf_unsafe_poineters): Likewise.
966 (Target::Target_info): Add can_icf_inline_merge_sections field.
967 (Target::do_can_check_for_function_pointers): New virtual
968 function.
969 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
970 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
971 from can_check_for_function_pointers, move in file.
972 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
973 section_may_have_icf_unsafe_poineters, move in file.
974 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
975 * i386.cc (Target_i386::do_can_check_for_function_pointers):
976 Rename from can_check_for_function_pointers, move in file.
977 (Target_i386::can_icf_inline_merge_sections): Remove.
978 (Target_i386::i386_info): Initialize
979 can_icf_inline_merge_sections.
980 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
981 Initialize can_icf_inline_merge_sections.
982 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
983 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
984 Rename from can_check_for_function_pointers, move in file.
985 (Target_x86_64::can_icf_inline_merge_sections): Remove.
986 (Target_x86_64::x86_64_info): Initialize
987 can_icf_inline_merge_sections.
988 * testsuite/testfile.cc (Target_test::test_target_info):
989 Likewise.
990 * icf.cc (get_section_contents): Correct formatting.
991
6d1c4efb
ILT
9922011-06-27 Ian Lance Taylor <iant@google.com>
993
994 * symtab.cc (Symbol::versioned_name): New function.
995 (Symbol_table::add_to_final_symtab): Use versioned_name when
996 appropriate.
997 (Symbol_table::sized_write_symbol): Likewise.
998 * symtab.h (class Symbol): Declare versioned_name.
999 * stringpool.h (class Stringpool_template): Add variant of add
1000 which takes a std::basic_string.
1001 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1002 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1003 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1004 (ver_test_12.o): New target.
1005 * testsuite/Makefile.in: Rebuild.
1006
57eb9b50
DK
10072011-06-27 Doug Kwan <dougkwan@google.com>
1008
1009 * arm.cc (Arm_relocate_functions::thm_jump8,
1010 Arm_relocate_functions::thm_jump11): Use a wider signed
1011 type to compute offset.
1012 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1013 arm_thm_jump8.
1014 * testsuite/Makefile.in: Regenerate.
1015 * testsuite/arm_branch_in_range.sh: Check test results of
1016 arm_thm_jump11 and arm_thm_jump8.
1017 * testsuite/arm_thm_jump11.s: New test source file.
1018 * testsuite/arm_thm_jump11.t: New linker script.
1019 * testsuite/arm_thm_jump8.s: New test source file.
1020 * testsuite/arm_thm_jump8.t: New linker script.
1021
487b39df
ILT
10222011-06-24 Ian Lance Taylor <iant@google.com>
1023
1024 * layout.cc: Include "object.h".
1025 (ctors_sections_in_init_array): New static variable.
1026 (Layout::is_ctors_in_init_array): New function.
1027 (Layout::layout): Add entry to ctors_sections_in_init_array if
1028 appropriate.
1029 * layout.h (class Layout): Declare is_ctors_in_init_array.
1030 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1031 is_ctors_reverse_view is set.
1032 (Sized_relobj_file::write_sections): Add layout parameter. Change
1033 all callers. Set is_ctors_reverse_view field of View_size.
1034 (Sized_relobj_file::reverse_words): New function.
1035 * object.h (Sized_relobj_file::View_size): Add
1036 is_ctors_reverse_view field.
1037 (class Sized_relobj_file): Update declarations.
1038 * testsuite/initpri3.c: New test.
1039 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1040 initpri3b.
1041 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1042 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1043 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1044 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1045 * testsuite/Makefile.in: Rebuild.
1046
472076e4
CC
10472011-06-24 Cary Coutant <ccoutant@google.com>
1048
1049 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1050 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1051 (debug_msg_cdebug.err): New targets.
1052 * testsuite/Makefile.in: Regenerate.
1053 * testsuite/debug_msg.sh: Check output of link with compressed debug.
1054 Fix checks for link with shared library.
1055
a60af0db
DK
10562011-06-24 Doug Kwan <dougkwan@google.com>
1057
1058 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1059 skip empty text sections.
1060 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1061
5393d741
ILT
10622011-06-22 Ian Lance Taylor <iant@google.com>
1063
1064 PR gold/12910
1065 * options.h (class General_options): Add --ctors-in-init-array.
1066 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1067 friends as SHT_PROGBITS for merging sections.
1068 (Layout::layout): Remove special handling of .init_array and
1069 friends. Don't sort if doing relocatable link. Sort for .ctors
1070 and .dtors if ctors_in_init_array.
1071 (Layout::make_output_section): Force correct section types for
1072 .init_array and friends. Don't sort if doing relocatable link,
1073 Don't sort .ctors and .dtors if ctors_in_init_array.
1074 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1075 (Layout::output_section_name): Add relobj parameter. Change all
1076 callers. Handle .ctors. and .dtors. in code rather than table.
1077 Handle .ctors and .dtors if ctors_in_init_array.
1078 (Layout::match_file_name): New function, moved from output.cc.
1079 * layout.h (class Layout): Update declarations.
1080 * output.cc: Include "layout.h".
1081 (Input_section_sort_entry::get_priority): New function.
1082 (Input_section_sort_entry::match_file_name): Just call
1083 Layout::match_file_name.
1084 (Output_section::Input_section_sort_init_fini_compare::operator()):
1085 Handle .ctors and .dtors. Sort by explicit priority rather than
1086 by name.
1087 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1088 * testsuite/initpri2.c: New test.
1089 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1090 (check_PROGRAMS): Add initpri2.
1091 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1092 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1093 * configure, testsuite/Makefile.in: Rebuild.
1094
e1f74f98
ILT
10952011-06-19 Ian Lance Taylor <iant@google.com>
1096
1097 PR gold/12880
1098 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1099 .interp section to a PT_INTERP segment even if we have seen a
1100 --dynamic-linker option. Don't do it if we have seen a PHDRS
1101 clause in a linker script.
1102 (Layout::finalize): Don't create a .interp section if we've
1103 already create a PT_INTERP segment.
1104 (Layout::create_interp): Always call choose_output_section (revert
1105 patch of 2011-06-17). Don't create PT_INTERP segment.
1106 * script-sections.cc
1107 (Script_sections::create_note_and_tls_segments): Add a .interp
1108 section to a PT_INTERP segment even if we have seen a
1109 --dynamic-linker option.
1110
766f91bb
ILT
11112011-06-18 Ian Lance Taylor <iant@google.com>
1112
1113 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
1114 merely because a non-PT_LOAD segment has a dynamic reloc.
1115
0d212c3a
ILT
11162011-06-18 Ian Lance Taylor <iant@google.com>
1117
1118 * layout.cc (Layout::finish_dynamic_section): Don't create
1119 DT_FLAGS entry if not needed.
1120
911a5072
ILT
11212011-06-18 Ian Lance Taylor <iant@google.com>
1122
1123 PR gold/12745
1124 * layout.cc (Layout::layout_eh_frame): Correct handling of
1125 writable .eh_frame section.
1126
534b4e5f
ILT
11272011-06-17 Ian Lance Taylor <iant@google.com>
1128
1129 PR gold/12893
1130 * resolve.cc (Symbol_table::resolve): Don't give an error if a
1131 symbol is redefined with the exact same object and value.
1132
10b4f102
ILT
11332011-06-17 Ian Lance Taylor <iant@google.com>
1134
1135 PR gold/12880
1136 * layout.h (class Layout): Add interp_segment_ field.
1137 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
1138 (Layout::attach_allocated_section_to_segment): If making shared
1139 library, put .interp section in PT_INTERP segment.
1140 (Layout::finalize): Also call create_interp if -dynamic-linker
1141 option was used.
1142 (Layout::create_interp): Assert that there is no PT_INTERP
1143 segment. If not using a SECTIONS clause, use make_output_section.
1144 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
1145 * script-sections.cc
1146 (Script_sections::create_note_and_tls_segments): If making shared
1147 library, put .interp section in PT_INTERP segment.
1148
a29b0dad
ILT
11492011-06-17 Ian Lance Taylor <iant@google.com>
1150
e588ea8d
ILT
1151 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
1152 when making a shared library.
1153
11542011-06-17 Ian Lance Taylor <iant@google.com>
1155
1156 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
1157 parameter. Change all callers. Don't issue warning about PC32
1158 against locally defined symbol.
a29b0dad 1159
9d3b0698
ILT
11602011-06-16 Ian Lance Taylor <iant@google.com>
1161
1162 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
1163 occurs in same object.
1164
85b0f90c
AM
11652011-06-14 Alan Modra <amodra@gmail.com>
1166
1167 * po/POTFILES.in: Regenerate.
1168
a94907d9
ILT
11692011-06-09 Ian Lance Taylor <iant@google.com>
1170
1171 * script-sections.cc
1172 (Orphan_output_section::set_section_addresses): For a relocatable
1173 link set address to 0.
1174
4fb3a1c3
CC
11752011-06-09 Cary Coutant <ccoutant@google.com>
1176
1177 PR gold/12804
1178 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
1179 used with --compress-debug-sections.
1180 * gold/object.cc (Sized_relobj_file::do_layout): Report
1181 uncompressed size of compressed input sections.
1182
61220854
CC
11832011-06-08 Cary Coutant <ccoutant@google.com>
1184
1185 PR gold/12804
1186 * testsuite/two_file_test_2_v1.cc: Change initialization of
1187 v2 to keep it in .data.
1188
e6455dfb
CC
11892011-06-07 Cary Coutant <ccoutant@google.com>
1190
1191 * common.cc (Symbol_table::do_allocate_commons_list): Call
1192 gold_fallback.
1193 * errors.cc (Errors::fatal): Adjust call to gold_exit.
1194 (Errors::fallback): New function.
1195 (gold_fallback): New function.
1196 * errors.h (Errors::fallback): New function.
1197 * gold.cc (gold_exit): Change status parameter to enum; adjust
1198 all callers.
1199 (queue_initial_tasks): Call gold_fallback.
1200 * gold.h: Include cstdlib.
1201 (Exit_status): New enum type.
1202 (gold_exit): Change status parameter to enum.
1203 (gold_fallback): New function.
1204 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
1205 (Layout::create_symtab_sections): Likewise.
1206 (Layout::create_shdrs): Likewise.
1207 * main.cc (main): Adjust call to gold_exit.
1208 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
1209 (Output_data_got::add_got_entry_pair): Likewise.
1210 (Output_section::add_input_section): Likewise.
1211 (Output_section::add_output_section_data): Likewise.
1212 (Output_segment::set_section_list_addresses): Likewise.
1213 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1214
fb0e076f
CC
12152011-06-07 Cary Coutant <ccoutant@google.com>
1216
1217 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1218 for incremental links.
1219 * output.cc (Output_segment::set_section_list_addresses): Remove
1220 FIXME and test for TLS or BSS.
1221
a5ee4d5d
CC
12222011-06-07 Cary Coutant <ccoutant@google.com>
1223
1224 * testsuite/Makefile.am: Add incremental_copy_test,
1225 incremental_common_test_1.
1226 * testsuite/Makefile.in: Regenerate.
1227 * testsuite/common_test_1_v1.c: New source file.
1228 * testsuite/common_test_1_v2.c: New source file.
1229 * testsuite/copy_test_v1.cc: New source file.
1230
5146f448
CC
12312011-06-07 Cary Coutant <ccoutant@google.com>
1232
1233 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1234 update, allocate common from bss section's free list.
1235 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1236 linker-defined symbols.
1237 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1238 Skip GOT and PLT entries that are no longer referenced.
1239 (Output_section_incremental_inputs::write_info_blocks): Mark
1240 linker-defined symbols.
1241 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1242 * output.cc (Output_section::allocate): New function.
1243 * output.h (Output_section::allocate): New function.
1244 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1245 linker-defined symbols.
1246 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1247 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1248 (Symbol::init_base_output_data): Likewise.
1249 (Symbol::init_base_output_segment): Likewise.
1250 (Symbol::init_base_constant): Likewise.
1251 (Sized_symbol::init_output_data): Likewise.
1252 (Sized_symbol::init_output_segment): Likewise.
1253 (Sized_symbol::init_constant): Likewise.
1254 (Symbol_table::do_define_in_output_data): Likewise.
1255 (Symbol_table::do_define_in_output_segment): Likewise.
1256 (Symbol_table::do_define_as_constant): Likewise.
1257 * symtab.h (Symbol::is_predefined): New function.
1258 (Symbol::init_base_output_data): Add is_predefined parameter.
1259 (Symbol::init_base_output_segment): Likewise.
1260 (Symbol::init_base_constant): Likewise.
1261 (Symbol::is_predefined_): New data member.
1262 (Sized_symbol::init_output_data): Add is_predefined parameter.
1263 (Sized_symbol::init_output_segment): Likewise.
1264 (Sized_symbol::init_constant): Likewise.
1265 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1266
26d3c67d
CC
12672011-06-07 Cary Coutant <ccoutant@google.com>
1268
1269 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1270 instead of emit_copy_reloc.
1271 (Copy_relocs::emit_copy_reloc): Refactor.
1272 (Copy_relocs::make_copy_reloc): New function.
1273 (Copy_relocs::add_copy_reloc): Remove.
1274 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1275 section.
1276 (Copy_relocs::make_copy_reloc): New function.
1277 (Copy_relocs::add_copy_reloc): Remove.
1278 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1279 unchanged input files.
1280 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1281 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1282 Reserve BSS space for COPY relocations.
1283 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1284 (Output_section_incremental_inputs::write_info_blocks): Record
1285 whether a symbol is copied from a shared object.
1286 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1287 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1288 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1289 (Incremental_input_entry_reader::get_output_symbol_index): Add
1290 is_copy parameter.
1291 (Incremental_binary::emit_copy_relocs): New function.
1292 (Incremental_binary::do_emit_copy_relocs): New function.
1293 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1294 new data member.
1295 (Sized_incremental_binary::add_copy_reloc): New function.
1296 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1297 (Sized_incremental_binary::Copy_reloc): New struct.
1298 (Sized_incremental_binary::Copy_relocs): New typedef.
1299 (Sized_incremental_binary::copy_relocs_): New data member.
1300 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1301 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1302 * target.h (Sized_target::emit_copy_reloc): New function.
1303 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1304
7cdb37d9
CC
13052011-06-02 Cary Coutant <ccoutant@google.com>
1306
1307 PR gold/12163
1308 * gold/archive.cc (Archive::Archive): Initialize new data member.
1309 (Archive::include_all_members): Return if archive has already been
1310 included.
1311 * gold/archive.h (Archive::include_all_members_): New data member.
1312
cc643b88
NC
13132011-06-02 Nick Clifton <nickc@redhat.com>
1314
1315 * dynobj.h: Fix spelling mistake in comment.
1316 * output.cc: Likewise.
1317
f62a3ca7
DK
13182011-05-31 Doug Kwan <dougkwan@google.com>
1319 Asier Llano
1320
1321 PR gold/12826
cc643b88 1322 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
1323 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1324 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1325 redundant arm_exidx_test.so.
1326 * testsuite/Makefile.in: Regenerate.
1327 (check_SCRIPTS): Add pr12826.sh
1328 (check_DATA): Add pr12826.stdout
1329 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1330 * testsuite/pr12826.sh: New file.
1331 * testsuite/pr12826_1.s: Ditto.
1332 * testsuite/pr12826_1.s: Ditto.
1333
8dbe1edc
ILT
13342011-05-30 Ian Lance Taylor <iant@google.com>
1335
1336 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1337 sections.
1338
c49875be
ILT
13392011-05-29 Ian Lance Taylor <iant@google.com>
1340
1341 PR gold/12804
1342 * testsuite/Makefile.am: Use different file name for two_file_test
1343 temporary file for each incremental test.
1344 * testsuite/Makefile.in: Rebuild.
1345
69d53f7a
ILT
13462011-05-29 Ian Lance Taylor <iant@google.com>
1347
1348 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1349 binary input file is empty.
1350
41d0ab5f
ILT
13512011-05-27 Ian Lance Taylor <iant@google.com>
1352
1353 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1354 (ver_test_9.so): Likewise.
1355 * testsuite/Makefile.in: Rebuild.
1356
89d8a36b
CC
13572011-05-26 Cary Coutant <ccoutant@google.com>
1358
1359 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1360 * incremental.cc (Incremental_inputs::report_input_section): Fix
1361 comment, indentation.
1362 (Incremental_inputs::report_comdat_group): New function.
1363 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1364 of data for incremental input file entry.
1365 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1366 group count, COMDAT group signatures.
1367 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1368 an unchanged input file.
1369 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1370 Initialize new data member.
1371 (Incremental_object_entry::add_comdat_group): New function.
1372 (Incremental_object_entry::get_comdat_group_count): New function.
1373 (Incremental_object_entry::get_comdat_signature_key): New function.
1374 (Incremental_object_entry::groups_): New data member.
1375 (Incremental_inputs::report_comdat_group): New function.
1376 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1377 data for incremental input file entry.
1378 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1379 (Incremental_input_entry_reader::get_input_section): Adjust size of
1380 data for incremental input file entry.
1381 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1382 (Incremental_input_entry_reader::get_comdat_group_signature): New
1383 function.
1384 * object.cc (Sized_relobj::include_section_group): Report kept
1385 COMDAT groups for incremental links.
1386
1706a06f
ILT
13872011-05-24 David Meyer <pdox@google.com>
1388
1389 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1390 with name parameter. Add found_name parameter.
1391 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1392 * dirsearch.h (class Dirsearch): Update declaration.
1393
a10ae760
ILT
13942011-05-24 Ian Lance Taylor <iant@google.com>
1395
1396 * archive.cc (Library_base::should_include_member): Pull in object
1397 from archive if it defines the entry symbol.
1398 * parameters.cc (Parameters::entry): New function.
1399 * parameters.h (class Parameters): Declare entry.
1400 * output.h (class Output_file_header): Remove entry_ field.
1401 * output.cc (Output_file_header::Output_file_header): Remove entry
1402 parameter. Change all callers.
1403 (Output_file_header::entry): Use parameters->entry.
1404 * gold.cc (queue_middle_tasks): Likewise.
1405 * plugin.cc (Plugin_hook::run): Likewise.
1406
aa92d6ed
CC
14072011-05-24 Cary Coutant <ccoutant@google.com>
1408
1409 * gold.cc (queue_initial_tasks): Pass incremental base filename
1410 to Output_file::open_base_file; don't print error message.
1411 * incremental-dump.cc (main): Adjust call to
1412 Output_file::open_for_modification.
1413 * incremental-dump.cc (main): Likewise.
1414 * incremental.cc (Incremental_inputs::report_command_line):
1415 Ignore --incremental-base option when comparing command lines.
1416 Ignore parameter when given as separate argument.
1417 * options.h (class General_options): Add --incremental-base.
1418 * output.cc (Output_file::Output_file):
1419 (Output_file::open_base_file): Add base_name and writable parameters;
1420 read base file into new file; print error message here.
1421 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1422 callers.
1423 * output.h (Output_file::open_for_modification): Rename to...
1424 (Output_file::open_base_file): ...this; add base_name and
1425 writable parameters; adjust all callers.
1426 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1427 callers.
1428 * testsuite/Makefile.am (incremental_test_4): Test
1429 --incremental-base.
1430 * testsuite/Makefile.in: Regenerate.
1431
2eedd706
CC
14322011-05-24 Cary Coutant <ccoutant@google.com>
1433
1434 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1435 incremental_test_4.
1436 * testsuite/Makefile.in: Regenerate.
1437 * testsuite/two_file_test_1_v1.cc: New test source file.
1438 * testsuite/two_file_test_1b_v1.cc: New test source file.
1439 * testsuite/two_file_test_2_v1.cc: New test source file.
1440
0f1c85a6
CC
14412011-05-24 Cary Coutant <ccoutant@google.com>
1442
1443 * dynobj.h (Dynobj::do_dynobj): New function.
1444 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1445 flag and soname for shared objects.
1446 * incremental.cc (Incremental_inputs::report_object): Make
1447 either Incremental_object_entry or Incremental_dynobj_entry; add
1448 soname to string table.
1449 (Incremental_inputs::report_input_section): Add assertion.
1450 (Output_section_incremental_inputs::set_final_data_size): Adjust
1451 type of input file entry for shared libraries; adjust size of
1452 shared library info entry.
1453 (Output_section_incremental_inputs::write_input_files): Write
1454 as_needed flag for shared libraries.
1455 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1456 of input file entry for shared libraries; write soname.
1457 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1458 soname from incremental info.
1459 * incremental.h (enum Incremental_input_flags): Add
1460 INCREMENTAL_INPUT_AS_NEEDED.
1461 (Incremental_input_entry::Incremental_input_entry): Initialize new
1462 data member.
1463 (Incremental_input_entry::set_as_needed): New function.
1464 (Incremental_input_entry::as_needed): New function.
1465 (Incremental_input_entry::do_dynobj_entry): New function.
1466 (Incremental_input_entry::as_needed_): New data member.
1467 (Incremental_object_entry::Incremental_object_entry): Don't check
1468 for shared library.
1469 (Incremental_object_entry::do_type): Likewise.
1470 (class Incremental_dynobj_entry): New class.
1471 (Incremental_input_entry_reader::as_needed): New function.
1472 (Incremental_input_entry_reader::get_soname): New function.
1473 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1474 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1475 size of shared library info entry.
1476 * layout.cc (Layout::finish_dynamic_section): Don't test for
1477 incremental link when adding DT_NEEDED entries.
1478 * object.h (Object::Object): Initialize new data member.
1479 (Object::dynobj): New function.
1480 (Object::set_as_needed): New function.
1481 (Object::as_needed): New function.
1482 (Object::do_dynobj): New function.
1483 (Object::as_needed_): New data member.
1484
6fa2a40b
CC
14852011-05-24 Cary Coutant <ccoutant@google.com>
1486
1487 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1488 info; adjust display of GOT entries.
1489 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1490 vector of input objects; remove file_status_.
1491 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1492 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1493 got_plt reader; call target hooks to reserve GOT entries.
1494 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1495 of input file info header and GOT info entry.
1496 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1497 relocation info.
1498 (Got_plt_view_info::got_descriptor): Remove.
1499 (Got_plt_view_info::sym_index): New data member.
1500 (Got_plt_view_info::input_index): New data member.
1501 (Local_got_offset_visitor::visit): Write input file index.
1502 (Global_got_offset_visitor::visit): Write 0 for input file index.
1503 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1504 with sym_index and input_index.
1505 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1506 incremental info GOT entry; replace got_descriptor with input_index.
1507 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1508 map from input file index to object.
1509 (Sized_relobj_incr::do_layout): Replace direct data member reference
1510 with accessor function.
1511 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1512 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1513 Adjust size of input file info header.
1514 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1515 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1516 (Incremental_input_entry_reader::get_input_section): Adjust size of
1517 input file info header.
1518 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1519 of incremental info GOT entry.
1520 (Incremental_got_plt_reader::get_got_desc): Remove.
1521 (Incremental_got_plt_reader::get_got_symndx): New function.
1522 (Incremental_got_plt_reader::get_got_input_index): New function.
1523 (Sized_incremental_binary::Sized_incremental_binary): Remove
1524 file_status_; add input_objects_.
1525 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1526 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1527 (Sized_incremental_binary::file_is_unchanged): Remove.
1528 (Sized_incremental_binary::set_input_object): New function.
1529 (Sized_incremental_binary::input_object): New function.
1530 (Sized_incremental_binary::file_status_): Remove.
1531 (Sized_incremental_binary::input_objects_): New data member.
1532 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1533 references.
1534 (Sized_relobj_incr::invalid_address): Move to base class.
1535 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1536 class.
1537 (Sized_relobj_incr::do_output_section_offset): Likewise.
1538 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1539 (Sized_relobj_incr::section_offsets_): Likewise.
1540 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1541 function.
1542 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1543 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1544 with accessor function.
1545 (Sized_relobj_file::do_layout): Likewise.
1546 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1547 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1548 (Sized_relobj_file::compute_final_local_value): Replace refs to
1549 section_offsets_ with accessor function.
1550 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1551 * object.h (Relobj::Relobj): Initialize new data members.
1552 (Relobj::add_dyn_reloc): New function.
1553 (Relobj::first_dyn_reloc): New function.
1554 (Relobj::dyn_reloc_count): New function.
1555 (Relobj::first_dyn_reloc_): New data member.
1556 (Relobj::dyn_reloc_count_): New data member.
1557 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1558 references.
1559 (Sized_relobj::Address): New typedef.
1560 (Sized_relobj::invalid_address): Move here from child class.
1561 (Sized_relobj::Sized_relobj): Initialize new data members.
1562 (Sized_relobj::sized_relobj): New function.
1563 (Sized_relobj::is_output_section_offset_invalid): Move here from
1564 child class.
1565 (Sized_relobj::get_output_section_offset): Likewise.
1566 (Sized_relobj::local_has_got_offset): Likewise.
1567 (Sized_relobj::local_got_offset): Likewise.
1568 (Sized_relobj::set_local_got_offset): Likewise.
1569 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1570 (Sized_relobj::clear_got_offsets): New function.
1571 (Sized_relobj::section_offsets): Move here from child class.
1572 (Sized_relobj::do_output_section_offset): Likewise.
1573 (Sized_relobj::do_set_section_offset): Likewise.
1574 (Sized_relobj::Local_got_offsets): Likewise.
1575 (Sized_relobj::local_got_offsets_): Likewise.
1576 (Sized_relobj::section_offsets_): Likewise.
1577 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1578 references.
1579 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1580 class.
1581 (Sized_relobj_file::sized_relobj): New function
1582 (Sized_relobj_file::local_has_got_offset): Move to base class.
1583 (Sized_relobj_file::local_got_offset): Likewise.
1584 (Sized_relobj_file::set_local_got_offset): Likewise.
1585 (Sized_relobj_file::get_output_section_offset): Likewise.
1586 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1587 (Sized_relobj_file::do_output_section_offset): Likewise.
1588 (Sized_relobj_file::do_set_section_offset): Likewise.
1589 (Sized_relobj_file::Local_got_offsets): Likewise.
1590 (Sized_relobj_file::local_got_offsets_): Likewise.
1591 (Sized_relobj_file::section_offsets_): Likewise.
1592 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1593 (all constructors).
1594 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1595 (Output_reloc::get_symbol_index): Likewise.
1596 (Output_reloc::local_section_offset): Likewise.
1597 (Output_reloc::get_address): Likewise.
1598 (Output_reloc::symbol_value): Likewise.
1599 (Output_data_got::reserve_slot): Move to class definition.
1600 (Output_data_got::reserve_local): New function.
1601 (Output_data_got::reserve_slot_for_global): Remove.
1602 (Output_data_got::reserve_global): New function.
1603 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1604 (all constructors, two instantiations).
1605 (Output_reloc::get_relobj): New function (two instantiations).
1606 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1607 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1608 (Output_data_reloc::add_global): Adjust type of relobj.
1609 (Output_data_reloc::add_global_relative): Likewise.
1610 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1611 (Output_data_reloc::add_local): Likewise.
1612 (Output_data_reloc::add_local_relative): Likewise.
1613 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1614 (Output_data_reloc::add_local_section): Likewise.
1615 (Output_data_reloc::add_output_section): Likewise.
1616 (Output_data_reloc::add_absolute): Likewise.
1617 (Output_data_reloc::add_target_specific): Likewise.
1618 (Output_data_got::reserve_slot): Move definition here.
1619 (Output_data_got::reserve_local): New function.
1620 (Output_data_got::reserve_global): New function.
1621 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1622 section_offsets_ with accessor function.
1623 (Sized_relobj_file::write_sections): Likewise.
1624 (Sized_relobj_file::do_relocate_sections): Likewise.
1625 * target.h (Sized_target::reserve_local_got_entry): New function.
1626 (Sized_target::reserve_global_got_entry): New function.
1627 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1628 (Target_x86_64::reserve_global_got_entry): New function.
1629 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1630
4829d394
CC
16312011-05-23 Cary Coutant <ccoutant@google.com>
1632
1633 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1634 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1635 bit when checking got_type.
1636 * incremental.cc (Sized_incremental_binary::setup_readers):
1637 Store symbol table and string table locations; initialize bit vector
1638 of file status flags.
1639 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1640 unchanged files.
1641 (Sized_incremental_binary::do_process_got_plt): New function.
1642 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1643 (Output_section_incremental_inputs::set_final_data_size): Record
1644 file index for each input file.
1645 (Output_section_incremental_inputs::write_got_plt): Store file index
1646 instead of input entry offset for each GOT entry.
1647 * incremental.h
1648 (Incremental_input_entry::Incremental_input_entry): Initialize new
1649 data member.
1650 (Incremental_input_entry::set_offset): Store file index.
1651 (Incremental_input_entry::get_file_index): New function.
1652 (Incremental_input_entry::file_index_): New data member.
1653 (Incremental_binary::process_got_plt): New function.
1654 (Incremental_binary::do_process_got_plt): New function.
1655 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1656 data members.
1657 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1658 (Sized_incremental_binary::set_file_is_unchanged): New function.
1659 (Sized_incremental_binary::file_is_unchanged): New function.
1660 (Sized_incremental_binary::do_process_got_plt): New function.
1661 (Sized_incremental_binary::file_status_): New data member.
1662 (Sized_incremental_binary::main_symtab_loc_): New data member.
1663 (Sized_incremental_binary::main_strtab_loc_): New data member.
1664 * output.cc (Output_data_got::Got_entry::write): Add case
1665 RESERVED_CODE.
1666 (Output_data_got::add_global): Call add_got_entry.
1667 (Output_data_got::add_global_plt): Likewise.
1668 (Output_data_got::add_global_with_rel): Likewise.
1669 (Output_data_got::add_global_with_rela): Likewise.
1670 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1671 (Output_data_got::add_global_pair_with_rela): Likewise.
1672 (Output_data_got::add_local): Call add_got_entry.
1673 (Output_data_got::add_local_plt): Likewise.
1674 (Output_data_got::add_local_with_rel): Likewise.
1675 (Output_data_got::add_local_with_rela): Likewise.
1676 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1677 (Output_data_got::add_local_pair_with_rela): Likewise.
1678 (Output_data_got::reserve_slot): New function.
1679 (Output_data_got::reserve_slot_for_global): New function.
1680 (Output_data_got::add_got_entry): New function.
1681 (Output_data_got::add_got_entry_pair): New function.
1682 (Output_section::add_output_section_data): Edit FIXME.
1683 * output.h
1684 (Output_section_data_build::Output_section_data_build): New
1685 constructor with size parameter.
1686 (Output_data_space::Output_data_space): Likewise.
1687 (Output_data_got::Output_data_got): Initialize new data member; new
1688 constructor with size parameter.
1689 (Output_data_got::add_constant): Call add_got_entry.
1690 (Output_data_got::reserve_slot): New function.
1691 (Output_data_got::reserve_slot_for_global): New function.
1692 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1693 (Output_data_got::add_got_entry): New function.
1694 (Output_data_got::add_got_entry_pair): New function.
1695 (Output_data_got::free_list_): New data member.
1696 * target.h (Sized_target::init_got_plt_for_update): New function.
1697 (Sized_target::register_global_plt_entry): New function.
1698 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1699 Initialize new data member; call init; add constructor with PLT count.
1700 (Output_data_plt_x86_64::init): New function.
1701 (Output_data_plt_x86_64::add_relocation): New function.
1702 (Output_data_plt_x86_64::reserve_slot): New function.
1703 (Output_data_plt_x86_64::free_list_): New data member.
1704 (Target_x86_64::init_got_plt_for_update): New function.
1705 (Target_x86_64::register_global_plt_entry): New function.
1706 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1707 incremental updates.
1708 (Output_data_plt_x86_64::add_relocation): New function.
1709 * testsuite/object_unittest.cc (Object_test): Set default options.
1710
ec69d6da
ILT
17112011-05-16 Ian Lance Taylor <iant@google.com>
1712
1713 * options.h (class General_options): Make -i a synonym for -r.
1714
732e31de
ILT
17152011-05-16 Ian Lance Taylor <iant@google.com>
1716
1717 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1718
403676b5
CC
17192011-05-10 Cary Coutant <ccoutant@google.com>
1720
1721 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1722 strip_all (-s).
1723
5b7b7d6e
ILT
17242011-05-06 Ian Lance Taylor <iant@google.com>
1725
1726 * layout.cc (Layout::layout): If the output section flags change,
1727 update the ordering.
1728
f0f9babf
CC
17292011-04-25 Cary Coutant <ccoutant@google.com>
1730
1731 * incremental-dump.cc (dump_incremental_inputs): Print local
1732 symbol info for each input file.
1733 * incremental.cc
1734 (Output_section_incremental_inputs::set_final_data_size): Add local
1735 symbol info to input file entries in incremental info.
1736 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1737 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1738 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1739 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1740 implementation.
1741 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1742 (Sized_incr_relobj::do_relocate): Write the local symbols.
1743 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1744 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1745 Adjust size of input file header.
1746 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1747 (Incremental_inputs_reader::get_local_symbol_count): New function.
1748 (Incremental_inputs_reader::get_input_section): Adjust size of input
1749 file header.
1750 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1751 (Sized_incr_relobj::This): New typedef.
1752 (Sized_incr_relobj::sym_size): New const data member.
1753 (Sized_incr_relobj::Local_symbol): New struct.
1754 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1755 (Sized_incr_relobj::do_local_symbol_offset): New function.
1756 (Sized_incr_relobj::local_symbol_count_): New data member.
1757 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1758 (Sized_incr_relobj::local_symbol_index_): New data member.
1759 (Sized_incr_relobj::local_symbol_offset_): New data member.
1760 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1761 (Sized_incr_relobj::local_symbols_): New data member.
1762 * object.h (Relobj::output_local_symbol_count): New function.
1763 (Relobj::local_symbol_offset): New function.
1764 (Relobj::do_output_local_symbol_count): New function.
1765 (Relobj::do_local_symbol_offset): New function.
1766 (Sized_relobj::do_output_local_symbol_count): New function.
1767 (Sized_relobj::do_local_symbol_offset): New function.
1768
d0a9ace3
ILT
17692011-04-22 Vladimir Simonov <sv@sw.ru>
1770
1771 * descriptors.cc (set_close_on_exec): New function.
1772 (Descriptors::open): Use set_close_on_exec.
1773 * output.cc (S_ISLNK): Define if not defined.
1774
94a3fc8b
CC
17752011-04-22 Cary Coutant <ccoutant@google.com>
1776
1777 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1778 global symbol map.
1779 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1780 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1781 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1782 relocations.
1783 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1784 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1785 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1786 * incremental.h
1787 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1788 function.
1789 (Incremental_binary::apply_incremental_relocs): New function.
1790 (Incremental_binary::do_apply_incremental_relocs): New function.
1791 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1792 data member.
1793 (Sized_incremental_binary::add_global_symbol): New function.
1794 (Sized_incremental_binary::global_symbol): New function.
1795 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1796 (Sized_incremental_binary::symbol_map_): New data member.
1797 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1798 * target.h (Sized_target::apply_relocation): New function.
1799 * target-reloc.h (apply_relocation): New function.
1800 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1801
c87e4302
DK
18022011-04-22 Doug Kwan <dougkwan@google.com>
1803
1804 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1805 flag of a SHT_ARM_EXIDX section.
1806 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1807 * testsuite/Makefile.in: Regenerate.
1808 * testsuite/arm_exidx_test.s: New file.
1809 * testsuite/arm_exidx_test.sh: Same.
1810
e7782cf6
CC
18112011-04-20 Cary Coutant <ccoutant@google.com>
1812
1813 PR gold/12689
1814 * archive.h (Incremental_archive_entry::Archive_member):
1815 Initialize arg_serial_ (second constructor).
1816
308ecdc7
ILT
18172011-04-17 Ian Lance Taylor <iant@google.com>
1818
1819 * object.cc (Relocate_info::location): Simplify location string.
1820 * errors.cc (Errors::error_at_location): Don't print program
1821 name.
1822 (Errors::warning_at_location): Likewise.
1823 (Errors::undefined_symbol): Likewise.
1824 * testsuite/debug_msg.sh: Update accordingly.
1825
bec5b579
CC
18262011-04-14 Cary Coutant <ccoutant@google.com>
1827
1828 * gold/layout.cc (Layout::symtab_section_offset): New function.
1829 * gold/layout.h (Layout::symtab_section_offset): New function.
1830 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1831
88597d34
ILT
18322011-04-12 Ian Lance Taylor <iant@google.com>
1833
1834 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1835 with MREMAP_MAYMOVE.
1836 * output.h (class Output_file): Add map_is_allocated_ field.
1837 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1838 not available, provide stubs. If mremap is not available, #define
1839 it to gold_mremap.
1840 (MREMAP_MAYMOVE): Define if not defined.
1841 (Output_file::Output_file): Initialize map_is_allocated_.
1842 (Output_file::resize): Check map_is_allocated_.
1843 (Output_file::map_anonymous): If mmap fails, use malloc.
1844 (Output_file::unmap): Don't do anything for an anonymous map.
1845 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1846 is not available, provide stubs.
1847 (File_read::View::~View): Use free rather than delete[].
1848 (File_read::make_view): Use malloc rather than new[]. If mmap
1849 fails, use malloc.
1850 (File_read::find_or_make_view): Use malloc rather than new[].
1851 * gold.h: Remove HAVE_REMAP code.
1852 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1853 exists. Rename mremap to gold_mremap. If mmap is not available
1854 don't do anything.
1855 * configure, config.in: Rebuild.
1856
11e361bc
ILT
18572011-04-11 Ian Lance Taylor <iant@google.com>
1858
1859 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1860 initialize local variable v.
1861
cdc29364
CC
18622011-04-11 Cary Coutant <ccoutant@google.com>
1863
1864 * archive.cc (Archive::include_member): Adjust call to
1865 report_object.
1866 (Add_archive_symbols::run): Track argument serial numbers.
1867 (Lib_group::include_member): Likewise.
1868 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1869 * archive.h (Incremental_archive_entry::Archive_member):
1870 Initialize arg_serial_.
1871 (Archive_member::arg_serial_): New data member.
1872 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1873 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1874 incremental link.
1875 (Sized_dynobj::do_for_all_local_got_entries): New function.
1876 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1877 function.
1878 * fileread.cc (get_mtime): New function.
1879 * fileread.h (get_mtime): New function.
1880 * gold.cc (queue_initial_tasks): Check for incremental update.
1881 (process_incremental_input): New function.
1882 (queue_middle_tasks): Don't force valid target for incremental
1883 update.
1884 * incremental-dump.cc (find_input_containing_global): Adjust
1885 size of symbol info entry.
1886 (dump_incremental_inputs): Dump argument serial number and
1887 in_system_directory flag; bias shndx by 1; print symbol names
1888 when dumping per-file symbol lists; use new symbol info readers.
1889 * incremental.cc
1890 (Output_section_incremental_inputs:update_data_size): New function.
1891 (Sized_incremental_binary::setup_readers): Setup input readers
1892 for each input file; build maps for files added from libraries
1893 and scripts.
1894 (Sized_incremental_binary::check_input_args): New function.
1895 (Sized_incremental_binary::do_check_inputs): Build map of argument
1896 serial numbers to input arguments.
1897 (Sized_incremental_binary::do_file_has_changed): Rename
1898 do_file_is_unchanged to this; compare file modification times.
1899 (Sized_incremental_binary::do_init_layout): New function.
1900 (Sized_incremental_binary::do_reserve_layout): New function.
1901 (Sized_incremental_binary::do_get_input_reader): Remove.
1902 (Sized_incremental_binary::get_symtab_view): New function.
1903 (Incremental_checker::can_incrementally_link_output_file): Remove.
1904 (Incremental_inputs::report_command_line): Exclude --debug options.
1905 (Incremental_inputs::report_archive_begin): Add parameter; track
1906 argument serial numbers; don't put input file entry for archive
1907 before archive members.
1908 (Incremental_inputs::report_archive_end): Put input file entry
1909 for archive after archive members.
1910 (Incremental_inputs::report_object): Add parameter; track argument
1911 serial numbers and in_system_directory flag.
1912 (Incremental_inputs::report_script): Add parameter; track argument
1913 serial numbers.
1914 (Output_section_incremental_inputs::set_final_data_size): Adjust
1915 size of symbol info entry; check for forwarding symbols.
1916 (Output_section_incremental_inputs::write_input_files): Write
1917 in_system_directory flag and argument serial number.
1918 (Output_section_incremental_inputs::write_info_blocks): Map section
1919 indices between incremental info and original input file; store
1920 input section index for each symbol.
1921 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1922 change operator() to visit().
1923 (class Global_got_offset_visitor): Likewise.
1924 (class Global_symbol_visitor_got_plt):
1925 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1926 classes.
1927 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1928 (Sized_incr_relobj::do_read_symbols): New function.
1929 (Sized_incr_relobj::do_layout): New function.
1930 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1931 (Sized_incr_relobj::do_add_symbols): New function.
1932 (Sized_incr_relobj::do_should_include_member): New function.
1933 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1934 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1935 (Sized_incr_relobj::do_section_size): New function.
1936 (Sized_incr_relobj::do_section_name): New function.
1937 (Sized_incr_relobj::do_section_contents): New function.
1938 (Sized_incr_relobj::do_section_flags): New function.
1939 (Sized_incr_relobj::do_section_entsize): New function.
1940 (Sized_incr_relobj::do_section_address): New function.
1941 (Sized_incr_relobj::do_section_type): New function.
1942 (Sized_incr_relobj::do_section_link): New function.
1943 (Sized_incr_relobj::do_section_info): New function.
1944 (Sized_incr_relobj::do_section_addralign): New function.
1945 (Sized_incr_relobj::do_initialize_xindex): New function.
1946 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1947 (Sized_incr_relobj::do_read_relocs): New function.
1948 (Sized_incr_relobj::do_gc_process_relocs): New function.
1949 (Sized_incr_relobj::do_scan_relocs): New function.
1950 (Sized_incr_relobj::do_count_local_symbols): New function.
1951 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1952 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1953 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1954 (Sized_incr_relobj::do_relocate): New function.
1955 (Sized_incr_relobj::do_set_section_offset): New function.
1956 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1957 (Sized_incr_dynobj::do_read_symbols): New function.
1958 (Sized_incr_dynobj::do_layout): New function.
1959 (Sized_incr_dynobj::do_add_symbols): New function.
1960 (Sized_incr_dynobj::do_should_include_member): New function.
1961 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1962 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1963 (Sized_incr_dynobj::do_section_size): New function.
1964 (Sized_incr_dynobj::do_section_name): New function.
1965 (Sized_incr_dynobj::do_section_contents): New function.
1966 (Sized_incr_dynobj::do_section_flags): New function.
1967 (Sized_incr_dynobj::do_section_entsize): New function.
1968 (Sized_incr_dynobj::do_section_address): New function.
1969 (Sized_incr_dynobj::do_section_type): New function.
1970 (Sized_incr_dynobj::do_section_link): New function.
1971 (Sized_incr_dynobj::do_section_info): New function.
1972 (Sized_incr_dynobj::do_section_addralign): New function.
1973 (Sized_incr_dynobj::do_initialize_xindex): New function.
1974 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1975 (make_sized_incremental_object): New function.
1976 (Incremental_library::copy_unused_symbols): New function.
1977 (Incremental_library::do_for_all_unused_symbols): New function.
1978 * incremental.h (enum Incremental_input_flags): New type.
1979 (class Incremental_checker): Remove.
1980 (Incremental_input_entry::Incremental_input_entry): Add argument
1981 serial number.
1982 (Incremental_input_entry::arg_serial): New function.
1983 (Incremental_input_entry::set_is_in_system_directory): New function.
1984 (Incremental_input_entry::is_in_system_directory): New function.
1985 (Incremental_input_entry::arg_serial_): New data member.
1986 (Incremental_input_entry::is_in_system_directory_): New data member.
1987 (class Script_info): Move here from script.h.
1988 (Script_info::Script_info): Add filename parameter.
1989 (Script_info::filename): New function.
1990 (Script_info::filename_): New data member.
1991 (Incremental_script_entry::Incremental_script_entry): Add argument
1992 serial number.
1993 (Incremental_object_entry::Incremental_object_entry): Likewise.
1994 (Incremental_object_entry::add_input_section): Build list of input
1995 sections with map to original shndx.
1996 (Incremental_object_entry::get_input_section_index): New function.
1997 (Incremental_object_entry::shndx_): New data member.
1998 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1999 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2000 (Incremental_archive_entry::Incremental_archive_entry): Add argument
2001 serial number.
2002 (Incremental_inputs::report_archive_begin): Likewise.
2003 (Incremental_inputs::report_object): Likewise.
2004 (Incremental_inputs::report_script): Likewise.
2005 (class Incremental_global_symbol_reader): New class.
2006 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2007 and store flags and input file type.
2008 (Incremental_input_entry_reader::arg_serial): New function.
2009 (Incremental_input_entry_reader::type): Extract type from flags.
2010 (Incremental_input_entry_reader::is_in_system_directory): New function.
2011 (Incremental_input_entry_reader::get_input_section_count): Call
2012 accessor function for type.
2013 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2014 function for type; adjust size of global symbol entry.
2015 (Incremental_input_entry_reader::get_global_symbol_count): Call
2016 accessor function for type.
2017 (Incremental_input_entry_reader::get_object_count): Likewise.
2018 (Incremental_input_entry_reader::get_object_offset): Likewise.
2019 (Incremental_input_entry_reader::get_member_count): Likewise.
2020 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2021 (Incremental_input_entry_reader::get_member_offset): Likewise.
2022 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2023 (Incremental_input_entry_reader::Global_symbol_info): Remove.
2024 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2025 (Incremental_input_entry_reader::get_global_symbol_reader): New
2026 function.
2027 (Incremental_input_entry_reader::get_output_symbol_index): New
2028 function.
2029 (Incremental_input_entry_reader::type_): Remove.
2030 (Incremental_input_entry_reader::flags_): New data member.
2031 (Incremental_inputs_reader::input_file_offset): New function.
2032 (Incremental_inputs_reader::input_file_index): New function.
2033 (Incremental_inputs_reader::input_file): Call input_file_offset.
2034 (Incremental_inputs_reader::input_file_at_offset): New function.
2035 (Incremental_relocs_reader::get_r_type): Reformat.
2036 (Incremental_relocs_reader::get_r_shndx): Reformat.
2037 (Incremental_relocs_reader::get_r_offset): Reformat.
2038 (Incremental_relocs_reader::data): New function.
2039 (Incremental_binary::Incremental_binary): Initialize new data members.
2040 (Incremental_binary::check_inputs): Add cmdline parameter.
2041 (Incremental_binary::file_is_unchanged): Remove.
2042 (Input_reader::arg_serial): New function.
2043 (Input_reader::get_unused_symbol_count): New function.
2044 (Input_reader::get_unused_symbol): New function.
2045 (Input_reader::do_arg_serial): New function.
2046 (Input_reader::do_get_unused_symbol_count): New function.
2047 (Input_reader::do_get_unused_symbol): New function.
2048 (Incremental_binary::input_file_count): New function.
2049 (Incremental_binary::get_input_reader): Change signature to use
2050 index instead of filename.
2051 (Incremental_binary::file_has_changed): New function.
2052 (Incremental_binary::get_input_argument): New function.
2053 (Incremental_binary::get_library): New function.
2054 (Incremental_binary::get_script_info): New function.
2055 (Incremental_binary::init_layout): New function.
2056 (Incremental_binary::reserve_layout): New function.
2057 (Incremental_binary::output_file): New function.
2058 (Incremental_binary::do_check_inputs): New function.
2059 (Incremental_binary::do_file_is_unchanged): Remove.
2060 (Incremental_binary::do_file_has_changed): New function.
2061 (Incremental_binary::do_init_layout): New function.
2062 (Incremental_binary::do_reserve_layout): New function.
2063 (Incremental_binary::do_input_file_count): New function.
2064 (Incremental_binary::do_get_input_reader): Change signature.
2065 (Incremental_binary::input_args_map_): New data member.
2066 (Incremental_binary::library_map_): New data member.
2067 (Incremental_binary::script_map_): New data member.
2068 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2069 new data members.
2070 (Sized_incremental_binary::output_section): New function.
2071 (Sized_incremental_binary::inputs_reader): Add const.
2072 (Sized_incremental_binary::symtab_reader): Add const.
2073 (Sized_incremental_binary::relocs_reader): Add const.
2074 (Sized_incremental_binary::got_plt_reader): Add const.
2075 (Sized_incremental_binary::get_symtab_view): New function.
2076 (Sized_incremental_binary::Inputs_reader): New typedef.
2077 (Sized_incremental_binary::Input_entry_reader): New typedef.
2078 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2079 (Sized_incremental_binary::do_file_is_unchanged): Remove.
2080 (Sized_incremental_binary::do_file_has_changed): New function.
2081 (Sized_incremental_binary::do_init_layout): New function.
2082 (Sized_incremental_binary::do_reserve_layout): New function.
2083 (Sized_input_reader::Inputs_reader): Remove.
2084 (Sized_input_reader::Input_entry_reader): Remove.
2085 (Sized_input_reader::do_arg_serial): New function.
2086 (Sized_input_reader::do_get_unused_symbol_count): New function.
2087 (Sized_input_reader::do_get_unused_symbol): New function.
2088 (Sized_incremental_binary::do_input_file_count): New function.
2089 (Sized_incremental_binary::do_get_input_reader): Change signature;
2090 use index instead of filename.
2091 (Sized_incremental_binary::section_map_): New data member.
2092 (Sized_incremental_binary::input_entry_readers_): New data member.
2093 (class Sized_incr_relobj): New class.
2094 (class Sized_incr_dynobj): New class.
2095 (make_sized_incremental_object): New function.
2096 (class Incremental_library): New class.
2097 * layout.cc (Free_list::num_lists): New static data member.
2098 (Free_list::num_nodes): New static data member.
2099 (Free_list::num_removes): New static data member.
2100 (Free_list::num_remove_visits): New static data member.
2101 (Free_list::num_allocates): New static data member.
2102 (Free_list::num_allocate_visits): New static data member.
2103 (Free_list::init): New function.
2104 (Free_list::remove): New function.
2105 (Free_list::allocate): New function.
2106 (Free_list::dump): New function.
2107 (Free_list::print_stats): New function.
2108 (Layout_task_runner::run): Resize output file for incremental updates.
2109 (Layout::Layout): Initialize new data members.
2110 (Layout::set_incremental_base): New function.
2111 (Layout::init_fixed_output_section): New function.
2112 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
2113 incremental updates.
2114 (Layout::create_gold_note): Do not create gold note section for
2115 incremental updates.
2116 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
2117 for incremental updates.
2118 (Layout::set_section_offsets): For incremental updates, allocate space
2119 from free list.
2120 (Layout::create_symtab_sections): Layout with offsets relative to
2121 start of section; for incremental updates, allocate space from free
2122 list.
2123 (Layout::create_shdrs): For incremental updates, allocate space from
2124 free list.
2125 (Layout::finish_dynamic_section): For incremental updates, do not
2126 check --as-needed (fixed in subsequent patch).
2127 * layout.h (class Free_list): New class.
2128 (Layout::set_incremental_base): New function.
2129 (Layout::incremental_base): New function.
2130 (Layout::init_fixed_output_section): New function.
2131 (Layout::allocate): New function.
2132 (Layout::incremental_base_): New data member.
2133 (Layout::free_list_): New data member.
2134 * main.cc (main): Print Free_list statistics.
2135 * object.cc (Relobj::finalize_incremental_relocs): Add
2136 clear_counts parameter; clear counts only when clear_counts is set.
2137 (Sized_relobj::Sized_relobj): Initialize new base class.
2138 (Sized_relobj::do_layout): Don't report special sections.
2139 (Sized_relobj::do_for_all_local_got_entries): New function.
2140 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
2141 symtab_off to all symbol table offsets.
2142 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
2143 * object.h (class Got_offset_list): Move to top of file.
2144 (Object::Object): Allow case where input_file == NULL.
2145 (Object::~Object): Likewise.
2146 (Object::input_file): Assert that input_file != NULL.
2147 (Object::lock): Allow case where input_file == NULL.
2148 (Object::unlock): Likewise.
2149 (Object::is_locked): Likewise.
2150 (Object::token): Likewise.
2151 (Object::release): Likewise.
2152 (Object::is_incremental): New function.
2153 (Object::get_mtime): New function.
2154 (Object::for_all_local_got_entries): New function.
2155 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
2156 (Object::set_is_in_system_directory): New function.
2157 (Object::is_in_system_directory): New function.
2158 (Object::do_is_incremental): New function.
2159 (Object::do_get_mtime): New function.
2160 (Object::do_for_all_local_got_entries): New function.
2161 (Object::is_in_system_directory_): New data member.
2162 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
2163 (class Sized_relobj_base): New class.
2164 (class Sized_relobj): Derive from Sized_relobj_base.
2165 (class Sized_relobj::Symbols): Redeclare from base class.
2166 (class Sized_relobj::local_got_offset_list): Remove.
2167 (class Sized_relobj::Output_sections): Redeclare from base class.
2168 (class Sized_relobj::do_for_all_local_got_entries): New function.
2169 (class Sized_relobj::write_local_symbols): Add offset parameter.
2170 (class Sized_relobj::local_symbol_offset_): Update comment.
2171 (class Sized_relobj::local_dynsym_offset_): Update comment.
2172 * options.cc (Input_arguments::add_file): Remove const.
2173 * options.h (Input_file_argument::Input_file_argument):
2174 Initialize arg_serial_ (all constructors).
2175 (Input_file_argument::set_arg_serial): New function.
2176 (Input_file_argument::arg_serial): New function.
2177 (Input_file_argument::arg_serial_): New data member.
2178 (Input_arguments::Input_arguments): Initialize file_count_.
2179 (Input_arguments::add_file): Remove const.
2180 (Input_arguments::number_of_input_files): New function.
2181 (Input_arguments::file_count_): New data member.
2182 (Command_line::number_of_input_files): Call
2183 Input_arguments::number_of_input_files.
2184 * output.cc (Output_segment_headers::Output_segment_headers):
2185 Set current size.
2186 (Output_section::Input_section::current_data_size): New function.
2187 (Output_section::Output_section): Initialize new data members.
2188 (Output_section::add_input_section): Don't do merge sections for
2189 an incremental link; allocate space from free list for an
2190 incremental update.
2191 (Output_section::add_output_section_data): Allocate space from
2192 free list for an incremental update.
2193 (Output_section::update_data_size): New function.
2194 (Output_section::set_fixed_layout): New function.
2195 (Output_section::reserve): New function.
2196 (Output_segment::set_section_addresses): Remove const.
2197 (Output_segment::set_section_list_addresses): Remove const; allocate
2198 space from free list for an incremental update.
2199 (Output_segment::set_offset): Adjust size of RELRO segment for an
2200 incremental update.
2201 * output.h (Output_data::current_data_size): Move here from
2202 child classes.
2203 (Output_data::pre_finalize_data_size): New function.
2204 (Output_data::update_data_size): New function.
2205 (Output_section_headers::update_data_size): new function.
2206 (Output_section_data_build::current_data_size): Move to Output_data.
2207 (Output_data_strtab::update_data_size): New function.
2208 (Output_section::current_data_size): Move to Output_data.
2209 (Output_section::set_fixed_layout): New function.
2210 (Output_section::has_fixed_layout): New function.
2211 (Output_section::reserve): New function.
2212 (Output_section::update_data_size): New function.
2213 (Output_section::has_fixed_layout_): New data member.
2214 (Output_section::free_list_): New data member.
2215 (Output_segment::set_section_addresses): Remove const.
2216 (Output_segment::set_section_list_addresses): Remove const.
2217 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2218 New function.
2219 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2220 New function.
2221 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2222 parameter when calling Add_symbols constructor; store argument
2223 serial number for members of a lib group.
2224 (Add_symbols::locks): Allow case where token == NULL.
2225 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2226 (Read_member::~Read_member): New function.
2227 (Read_member::is_runnable): New function.
2228 (Read_member::locks): New function.
2229 (Read_member::run): New function.
2230 (Check_script::~Check_script): New function.
2231 (Check_script::is_runnable): New function.
2232 (Check_script::locks): New function.
2233 (Check_script::run): New function.
2234 (Check_library::~Check_library): New function.
2235 (Check_library::is_runnable): New function.
2236 (Check_library::locks): New function.
2237 (Check_library::run): New function.
2238 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2239 (Add_symbols::library_): New data member.
2240 (class Read_member): New class.
2241 (class Check_script): New class.
2242 (class Check_library): New class.
2243 * reloc.cc (Read_relocs::is_runnable): Allow case where
2244 token == NULL.
2245 (Read_relocs::locks): Likewise.
2246 (Scan_relocs::locks): Likewise.
2247 (Relocate_task::locks): Likewise.
2248 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2249 to clear counters.
2250 (Sized_relobj::incremental_relocs_scan): Fix comment.
2251 (Sized_relobj::do_relocate): Pass output file offset to
2252 write_local_symbols.
2253 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2254 from class declaration.
2255 * script.cc (read_input_script): Allocate Script_info; pass
2256 argument serial number to report_script.
2257 * script.h (class Script_info): Move to incremental.h.
2258 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2259 * symtab.h (Symbol_table::add_from_incrobj): New function.
2260 (Symbol_table::set_file_offset): New function.
2261
b961d0d7
CC
22622011-04-05 Cary Coutant <ccoutant@google.com>
2263
2264 * incremental-dump.cc (dump_incremental_inputs): Change signature
2265 to take a Sized_incremental_binary; change caller. Use readers
2266 in Sized_incremental_binary.
2267 * incremental.cc
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::do_check_inputs): Check
2272 has_incremental_info_ flag; move setup code to setup_readers;
2273 use input readers.
2274 (Sized_incremental_binary::do_file_is_unchanged): New function.
2275 (Sized_incremental_binary::do_get_input_reader): New function.
2276 * incremental.h (class Incremental_binary): Move to end of file.
2277 (Incremental_binary::file_is_unchanged): New function.
2278 (Incremental_binary::do_file_is_unchanged): New function.
2279 (Incremental_binary::Input_reader): New class.
2280 (Incremental_binary::get_input_reader): New function.
2281 (class Sized_incremental_binary): Move to end of file.
2282 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2283 input section reader classes.
2284 (Sized_incremental_binary::has_incremental_info): New function.
2285 (Sized_incremental_binary::inputs_reader): New function.
2286 (Sized_incremental_binary::symtab_reader): New function.
2287 (Sized_incremental_binary::relocs_reader): New function.
2288 (Sized_incremental_binary::got_plt_reader): New function.
2289 (Sized_incremental_binary::do_file_is_unchanged): New function.
2290 (Sized_incremental_binary::Sized_input_reader): New class.
2291 (Sized_incremental_binary::get_input_reader): New function.
2292 (Sized_incremental_binary::find_incremental_inputs_sections):
2293 Rename do_find_incremental_inputs_sections to this.
2294 (Sized_incremental_binary::setup_readers): New function.
2295 (Sized_incremental_binary::has_incremental_info_): New data member.
2296 (Sized_incremental_binary::inputs_reader_): New data member.
2297 (Sized_incremental_binary::symtab_reader_): New data member.
2298 (Sized_incremental_binary::relocs_reader_): New data member.
2299 (Sized_incremental_binary::got_plt_reader_): New data member.
2300 (Sized_incremental_binary::current_input_file_): New data member.
2301
a869183f
PP
23022011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2303
2304 PR gold/12640
2305 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2306 violation.
2307
23082011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
2309
2310 * archive.cc (Archive::include_member): Adjust call to report_object.
2311 (Add_archive_symbols::run): Add script_info to call to
2312 report_archive_begin.
2313 (Lib_group::include_member): Adjust call to report_object.
2314 (Add_lib_group_symbols::run): Adjust call to report_object.
2315 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2316 blocks. Add object count for script input files.
2317 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2318 script_info parameter; change all callers.
2319 (Incremental_inputs::report_object): Add script_info parameter;
2320 change all callers.
2321 (Incremental_inputs::report_script): Store backpointer to
2322 incremental info entry.
2323 (Output_section_incremental_inputs::set_final_data_size): Record
2324 additional information for scripts.
2325 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2326 * incremental.h (Incremental_script_entry::add_object): New function.
2327 (Incremental_script_entry::get_object_count): New function.
2328 (Incremental_script_entry::get_object): New function.
2329 (Incremental_script_entry::objects_): New data member; adjust
2330 constructor.
2331 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2332 (Incremental_inputs::report_object): Add script_info parameter.
2333 (Incremental_inputs_reader::get_object_count): New function.
2334 (Incremental_inputs_reader::get_object_offset): New function.
2335 * options.cc (Input_arguments::add_file): Return reference to
2336 new input argument.
2337 * options.h (Input_argument::set_script_info): New function.
2338 (Input_argument::script_info): New function.
2339 (Input_argument::script_info_): New data member; adjust all
2340 constructors.
2341 (Input_file_group::add_file): Return reference to new input argument.
2342 (Input_file_lib::add_file): Likewise.
2343 (Input_arguments::add_file): Likewise.
2344 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2345 * script.cc (Parser_closure::Parser_closure): Add script_info
2346 parameter; adjust all callers.
2347 (Parser_closure::script_info): New function.
2348 (Parser_closure::script_info_): New data member.
2349 (read_input_script): Report scripts earlier to incremental info.
2350 (script_add_file): Set script_info in Input_argument.
2351 (script_add_library): Likewise.
2352 * script.h (Script_options::Script_info): Rewrite class.
2353
a869183f 23542011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
2355
2356 * archive.cc (Library_base::should_include_member): Move
2357 method here from class Archive.
2358 (Archive::Archive): Initialize base class.
2359 (Archive::should_include_member): Move to base class.
2360 (Archive::do_for_all_unused_symbols): New function.
2361 (Add_archive_symbols::run): Remove redundant access to
2362 incremental_inputs.
2363 (Lib_group::Lib_group): Initialize base class.
2364 (Lib_group::do_filename): New function.
2365 (Lib_group::include_member): Pass pointer to Lib_group to
2366 report_object.
2367 (Lib_group::do_for_all_unused_symbols): New function.
2368 (Add_lib_group_symbols::run): Report archive information for
2369 incremental links.
2370 * archive.h (class Library_base): New base class.
2371 (class Archive): Derive from Library_base.
2372 (Archive::filename): Move to base class.
2373 (Archive::set_incremental_info): Likewise.
2374 (Archive::incremental_info): Likewise.
2375 (Archive::Should_include): Likewise.
2376 (Archive::should_include_member): Likewise.
2377 (Archive::Armap_entry): Remove.
2378 (Archive::Unused_symbol_iterator): Remove.
2379 (Archive::unused_symbols_begin): Remove.
2380 (Archive::unused_symbols_end): Remove.
2381 (Archive::do_filename): New function.
2382 (Archive::do_get_mtime): New function.
2383 (Archive::do_for_all_unused_symbols): New function.
2384 (Archive::task_): Move to base class.
2385 (Archive::incremental_info_): Likewise.
2386 (class Lib_group): Derive from Library_base.
2387 (Lib_group::do_filename): New function.
2388 (Lib_group::do_get_mtime): New function.
2389 (Lib_group::do_for_all_unused_symbols): New function.
2390 (Lib_group::task_): Move to base class.
2391 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2392 function.
2393 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2394 function.
2395 * incremental.cc (Incremental_inputs::report_archive_begin):
2396 Use Library_base; call library's get_mtime; add incremental inputs
2397 entry before members.
2398 (class Unused_symbol_visitor): New class.
2399 (Incremental_inputs::report_archive_end): Use Library_base; use
2400 visitor class to record unused symbols; don't add incremental inputs
2401 entry after members.
2402 (Incremental_inputs::report_object): Use Library_base.
2403 * incremental.h
2404 (Incremental_archive_entry::Incremental_archive_entry): Remove
2405 unused Archive parameter.
2406 (Incremental_inputs::report_archive_begin): Use Library_base.
2407 (Incremental_inputs::report_archive_end): Likewise.
2408 (Incremental_inputs::report_object): Likewise.
2409 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2410 function.
2411 * object.h (Object::for_all_global_symbols): New function.
2412 (Object::do_for_all_global_symbols): New function.
2413 (Sized_relobj::do_for_all_global_symbols): New function.
2414 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2415 function.
2416 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2417 function.
2418
61ab3e40
ILT
24192011-03-27 Ian Lance Taylor <iant@google.com>
2420
2421 * archive.cc (Archive::interpret_header): Return -1 if something
2422 goes wrong. Change callers accordingly.
2423
30e1f9e6
CC
24242011-03-25 Cary Coutant <ccoutant@google.com>
2425
2426 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2427 * testsuite/Makefile.in: Regenerate.
2428
9370ce59 24292011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
2430
2431 * plugin.cc (get_view): New.
2432 (Plugin::load): Pass get_view to the plugin.
2433 (Plugin_manager::get_view): New.
2434
9312bb0a
ILT
24352011-03-21 Ian Lance Taylor <iant@google.com>
2436
2437 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 2438 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 2439
7e12ba9e
ST
24402011-03-21 Sriraman Tallam <tmsriram@google.com>
2441
2442 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2443 Change == to -eq.
2444 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2445 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2446 Change == to -eq.
2447 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2448 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2449
fd7a005d
ILT
24502011-03-14 Ian Lance Taylor <iant@google.com>
2451
2452 * script-sections.cc (Sort_output_sections::script_compare):
2453 Rename from is_before, change return type.
2454 (Sort_output_sections::operator()): Adjust accordingly.
2455
ed16fd1b
ILT
24562011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2457
2458 PR gold/12572
2459 * testsuite/odr_violation2.cc: Add comment to make all error line
2460 numbers double digits.
2461 * testsuite/debug_msg.sh: Adjust expected errors.
2462
71ff8986
ILT
24632011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2464
2465 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2466 but mark earlier ones as non-canonical
2467 (offset_to_iterator): Update search target and example
2468 (do_addr2line): Return extra lines in a vector*
2469 (format_file_lineno): Extract from do_addr2line
2470 (one_addr2line): Add vector* out-param
2471 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2472 when a lineno entry appeared last for its instruction
2473 (Dwarf_line_info): Add vector* out-param
2474 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2475 * symtab.cc (Odr_violation_compare): Include the lineno in the
2476 comparison again.
2477 (linenos_from_loc): New. Combine the canonical line for an
2478 address with its other lines.
2479 (True_if_intersect): New. Helper functor to make
2480 std::set_intersection a query.
2481 (detect_odr_violations): Compare sets of lines instead of just
2482 one line for each function. This became less deterministic, but
2483 has fewer false positives.
2484 * symtab.h: Declarations.
2485 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2486 mix an optimized and non-optimized object in the same binary
2487 (odr_violation2.so): Same.
2488 * testsuite/Makefile.in: Regenerate from Makefile.am.
2489 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2490 * testsuite/debug_msg.sh: Update line numbers and add
2491 assertions.
2492 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2493 non-optimized context.
2494 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2495 isn't inlined, and use OdrDerived in an optimized context.
2496 * testsuite/odr_header1.h: Defines OdrDerived, where
2497 optimization will change the
2498 first-instruction-in-the-destructor's file and line number.
2499 * testsuite/odr_header2.h: Defines OdrBase.
2500
a19fefdc
ILT
25012011-03-09 Ian Lance Taylor <iant@google.com>
2502
2503 * fileread.cc (File_read::clear_views): Don't delete the whole
2504 file view.
2505
ecb351e9
ILT
25062011-03-08 Ian Lance Taylor <iant@google.com>
2507
2508 PR gold/12525
2509 * fileread.cc: #include <climits>.
2510 (GOLD_IOV_MAX): Define.
2511 (File_read::read_multiple): Limit number of entries by iov_max.
2512 * fileread.h (class File_read): Always set max_readv_entries to
2513 128.
2514
b821d13c
ILT
25152011-03-07 Ian Lance Taylor <iant@google.com>
2516
2517 PR gold/12525
2518 * options.h (class General_options): Add -dy and -dn.
2519
89243142
CC
25202011-03-02 Cary Coutant <ccoutant@google.com>
2521
2522 * testsuite/script_test_9.t: Add TLS segment.
2523
d0773f31
ILT
25242011-03-02 Simon Baldwin <simonb@google.com>
2525
2526 * configure.ac: Add check for gnu_indirect_function support in
2527 the toolchain building binutils.
2528 * configure: Rebuild.
2529
9370ce59 25302011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
2531
2532 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2533 plugin only symbols.
2534 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2535 in plugin files as not needed in the symbol table.
2536
4cf7a849
ST
25372011-02-11 Sriraman Tallam <tmsriram@google.com>
2538
2539 * output.cc (Output_section::add_input_section): Delay fill
2540 generation for section ordering.
2541
b578bd7d
ILT
25422011-02-09 Ian Lance Taylor <iant@google.com>
2543
2544 PR gold/12316
2545 * object.h (class Sized_relobj): Remove clear_local_symbols.
2546 * reloc.cc (Sized_relobj::do_relocate): Don't call
2547 clear_local_symbols.
2548
9370ce59 25492011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
2550
2551 * plugin.cc (is_visible_from_outside): Return true for symbols
2552 in the -u option.
2553
55382fb7
ILT
25542011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2555
2556 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2557 filename.
2558
4e271fff
ST
25592011-02-02 Sriraman Tallam <tmsriram@google.com>
2560
2561 * icf.h (is_section_foldable_candidate): Change type of parameter
2562 to std::string.
2563 * icf.cc (Icf::find_identical_sections): Change type of local variable
2564 section_name to be std::string.
2565 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2566
d433c3ac
ILT
25672011-01-25 Ian Lance Taylor <iant@google.com>
2568
2569 * script.cc (script_add_extern): Rewrite to use
2570 add_symbol_reference.
2571
880473a6
DK
25722011-01-25 Doug Kwan <dougkwan@google.com>
2573
d433c3ac 2574 * icf.cc (get_section_contents): Always lock section's object.
880473a6 2575
f30f86fa
ILT
25762011-01-24 Ian Lance Taylor <iant@google.com>
2577
2578 * options.h (class General_options): Accept
2579 --no-detect-odr-violations.
2580
8e51a0b9
ILT
25812011-01-24 Ian Lance Taylor <iant@google.com>
2582
2583 * version.cc (version_string): Bump to 1.11.
2584
0f3b89d8
ILT
25852011-01-24 Ian Lance Taylor <iant@google.com>
2586
2587 * plugin.cc (class Plugin_rescan): Define new class.
2588 (Plugin_manager::claim_file): Set any_claimed_.
2589 (Plugin_manager::save_archive): New function.
2590 (Plugin_manager::save_input_group): New function.
2591 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2592 necessary.
2593 (Plugin_manager::new_undefined_symbol): New function.
2594 (Plugin_manager::rescan): New function.
2595 (Plugin_manager::rescannable_defines): New function.
2596 (Plugin_manager::add_input_file): Set any_added_.
2597 * plugin.h (class Plugin_manager): define new fields rescannable_,
2598 undefined_symbols_, any_claimed_, and any_added_. Declare
2599 Plugin_rescan as friend. Declare new functions.
2600 (Plugin_manager::Rescannable): Define type.
2601 (Plugin_manager::Rescannable_list): Define type.
2602 (Plugin_manager::Undefined_symbol_list): Define type.
2603 (Plugin_manager::Plugin_manager): Initialize new fields.
2604 * archive.cc (Archive::defines_symbol): New function.
2605 (Add_archive_symbols::run): Pass archive to plugins if any.
2606 * archive.h (class Archive): Declare defines_symbol.
2607 * readsyms.cc (Input_group::~Input_group): New function.
2608 (Finish_group::run): Pass input_group to plugins if any.
2609 * readsyms.h (class Input_group): Declare destructor.
2610 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2611 any.
2612
3bb951e5
ILT
26132011-01-10 Ian Lance Taylor <iant@google.com>
2614
2615 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2616 section as relro.
2617 (Layout::set_segment_offsets): Reset increase_relro before calling
2618 set_section_addresses a second time.
2619
0aa45fac
CC
26202011-01-04 Cary Coutant <ccoutant@google.com>
2621
2622 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2623 sections before NOBITS sections.
2624
0db46eb4
L
26252011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2626
2627 * version.cc (print_version): Update copyright to 2011.
2628
829c9745
CC
26292010-12-23 Cary Coutant <ccoutant@google.com>
2630
2631 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2632 of OS to this->add. Add OD parameter to second form of the function.
2633
7500420b
ILT
26342010-12-20 Ian Lance Taylor <iant@google.com>
2635
2636 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2637 second of two consecutive entries with same offset.
2638
f8e9a930
RW
26392010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2640
2641 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2642 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2643 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2644 to avoid unneeded links against $(LDADD).
2645 * testsuite/Makefile.in: Regenerate.
2646
2fbb4320
ILT
26472010-12-15 Ian Lance Taylor <iant@google.com>
2648
2649 PR gold/12324
2650 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2651 for R_X86_64_32 and R_X86_64_PC32.
2652 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2653 ver_matching_def_pic.o.
2654 (ver_matching_def_pic.o): New target.
2655
fedb228d
RW
26562010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2657
2658 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2659 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2660 Move definition before File_read::View member definitions.
2661 (File_read::View::~View): Initialize and hold lock before
2662 updating current_mapped_bytes.
2663
9b547ce6
RW
26642010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2665
2666 * dwarf_reader.cc: Remove outdated comment.
2667 * gold-threads.cc: Fix typo in error message.
2668 * archive.cc: Fix typos in comments.
2669 * archive.h: Likewise.
2670 * arm-reloc-property.cc: Likewise.
2671 * arm-reloc-property.h: Likewise.
2672 * arm-reloc.def: Likewise.
2673 * arm.cc: Likewise.
2674 * attributes.h: Likewise.
2675 * cref.cc: Likewise.
2676 * ehframe.cc: Likewise.
2677 * fileread.h: Likewise.
2678 * gold.h: Likewise.
2679 * i386.cc: Likewise.
2680 * icf.cc: Likewise.
2681 * incremental.h: Likewise.
2682 * int_encoding.cc: Likewise.
2683 * layout.h: Likewise.
2684 * main.cc: Likewise.
2685 * merge.h: Likewise.
2686 * object.cc: Likewise.
2687 * object.h: Likewise.
2688 * options.cc: Likewise.
2689 * readsyms.cc: Likewise.
2690 * reduced_debug_output.cc: Likewise.
2691 * reloc.cc: Likewise.
2692 * script-sections.cc: Likewise.
2693 * sparc.cc: Likewise.
2694 * symtab.h: Likewise.
2695 * target-reloc.h: Likewise.
2696 * target.cc: Likewise.
2697 * target.h: Likewise.
2698 * timer.cc: Likewise.
2699 * timer.h: Likewise.
2700 * x86_64.cc: Likewise.
2701
83e17bd5
CC
27022010-12-09 Cary Coutant <ccoutant@google.com>
2703
2704 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2705 stack.
2706 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2707 parameter; change all callers.
2708 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2709 * options.h (warn_execstack): New option.
2710
017257f8
DK
27112010-12-07 Doug Kwan <dougkwan@google.com>
2712
2713 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2714 like function call relocations.
2715
c20cbc06
ILT
27162010-12-07 Ian Lance Taylor <iant@google.com>
2717
2718 * archive.cc (Archive::get_elf_object_for_member): Permit
2719 punconfigured to be NULL.
2720 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2721 (Archive::include_member): Pass NULL to get_elf_object_for_member
2722 if we searched for the archive and this is the first included
2723 object.
2724
4dbfafcc
ILT
27252010-12-01 Ian Lance Taylor <iant@google.com>
2726
2727 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2728 track_relocs_type_ field.
2729 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2730 Set track_relocs_type_.
2731 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2732 contents when using RELA relocs.
2733 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2734 reloc_map_.
2735 * reloc.cc (Track_relocs::next_addend): New function.
2736 * reloc.h (class Track_relocs): Declare next_addend.
2737
e5e19edd
ILT
27382010-12-01 Ian Lance Taylor <iant@google.com>
2739
2740 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2741 virtual destructor.
2742
9a5ce24c
ILT
27432010-12-01 Ian Lance Taylor <iant@google.com>
2744
2745 * README: Update compilers known to work and fail.
2746
c7791212
NC
27472010-11-23 Matthias Klose <doko@ubuntu.com>
2748
2749 * configure.in: For --enable-gold, handle value `default' instead of
2750 `both*'. Always install ld as ld.bfd, install as ld if gold is
2751 not the default.
2752 * configure: Regenerate.
2753
0ad220c9
DK
27542010-11-18 Doug Kwan <dougkwan@google.com>
2755
2756 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2757 and right_alignment to be zero. Store result alignment only if it is
2758 greater than existing alignment.
2759
ab8056e0
CC
27602010-11-16 Cary Coutant <ccoutant@google.com>
2761
2762 PR gold/12220
2763 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2764 Check for ".zdebug_line".
2765
fd064a5b
CC
27662010-11-16 Doug Kwan <dougkwan@google.com>
2767 Cary Coutant <ccoutant@google.com>
2768
2769 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2770 by reference; adjust all callers.
2771 * output.cc (Output_segment::set_section_addresses): Adjust references
2772 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2773 list is empty.
2774 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2775 end at page boundary.
2776
6fc6ea19
CC
27772010-11-16 Cary Coutant <ccoutant@google.com>
2778
2779 PR gold/12220
2780 * layout.cc (Layout::choose_output_section): Transform names of
2781 compressed sections even when using a script with a SECTIONS clause.
2782 (Layout::output_section_name): Remove code to transform
2783 compressed debug section names.
2784 * output.cc (Output_section::add_input_section): Use uncompressed
2785 section size when tracking input sections.
2786
95a2c8d6
RS
27872010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2788
2789 * symtab.h (Symbol::NON_PIC_REF): Remove.
2790 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2791 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2792 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2793 (Symbol::use_plt_offset): Take a flags argument and pass it
2794 directly to needs_dynamic_reloc. Restrict check for undefined
2795 weak symbols to function calls.
2796 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2797 (Target_arm::Scan::global): Use it.
2798 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2799 (Target_arm::Relocate::relocate): Likewise.
2800 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2801 parameter with an r_type parameter. Use get_reference_flags
2802 to get the flags.
2803 (Target_arm::Relocate::relocate): Update accordingly.
2804 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2805 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2806 (Target_i386::Scan::global): Likewise.
2807 (Target_i386::Relocate::relocate): Likewise.
2808 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2809 parameter with an r_type parameter. Use get_reference_flags
2810 to get the flags.
2811 (Target_i386::Relocate::relocate): Update accordingly.
2812 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2813 (Target_powerpc::Scan::global): Use it.
2814 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2815 (Target_powerpc::Relocate::relocate): Likewise.
2816 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2817 (Target_sparc::Scan::global): Use it.
2818 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2819 (Target_sparc::Relocate::relocate): Likewise.
2820 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2821 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2822 (Target_x86_64::Scan::global): Likewise.
2823 (Target_x86_64::Relocate::relocate): Likewise.
2824
f625ae50
DK
28252010-11-08 Doug Kwan <dougkwan@google.com>
2826 Cary Coutant <ccoutant@google.com>
2827
2828 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2829 (Arm_exidx_merge_section::section_contents_): New data member.
2830 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2831 (Arm_input_section::~Arm_input_section): De-allocate memory.
2832 (Arm_input_section::original_contents_): New data member.
2833 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2834 in parameters instead of calling Object::section_contents without
2835 locking.
2836 (Arm_output_section::group_section): New parameter TASK. Pass it
2837 to callees that need locking objects.
2838 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2839 to lock EXIDX input sections. Fix a formatting issue. Call
2840 Arm_exidx_merged_section::build_contents to create merged section
2841 contents.
2842 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2843 to lock object of stub table owner.
2844 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2845 TEXT_SIZE to initialize data member TEXT_SIZE_.
2846 (Arm_exidx_input_section::addralign): Fix typo in comment.
2847 (Arm_exidx_input_section::text_size): New method.
2848 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2849 that require locking objects. Lock objects before scanning for stubs
2850 and updating local symbols.
2851 (Arm_input_section<big_endian>::init): Copy contents of original
2852 input section.
2853 (Arm_input_section<big_endian>::do_write): Use saved contents of
2854 original input section instead of calling Object::section_contents
2855 without locking.
2856 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2857 size without calling Object::section_size().
2858 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2859 for size. Allocate a buffer for merged EXIDX entries.
2860 (Arm_exidx_merged_section::build_contents): New method.
2861 (Arm_exidx_merged_section::do_write): Move merge section contents
2862 building code to Arm_exidx_merged_section::build_contetns. Write
2863 out contetns in buffer instead of building it on the fly.
2864 (Arm_relobj::make_exidx_input_section): Also pass text section size
2865 to Arm_exidx_input_section constructor.
2866 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2867 (Arm_dynobj::do_read_symbols): Fix memory leak.
2868 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2869 * target.h: (class Task): Add forward declaration.
2870 (Target::relax): Add new parameter TASK and pass it to
2871 Target::do_relax().
2872 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2873
5f9bcf58
CC
28742010-11-05 Cary Coutant <ccoutant@google.com>
2875
2876 PR gold/10708
2877 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2878 object when reading from the file.
2879 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2880 second layout pass.
2881 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2882 when reading section contents.
2883 (get_section_contents): Likewise.
2884 (icf::find_identical_sections): Likewise.
2885 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2886 object when reading from the file.
2887 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2888 the object when doing deferred section layout.
2889
e597fa08
NC
28902010-11-03 Nick Clifton <nickc@redhat.com>
2891
2892 PR gold/12001
2893 * script.h (class Symbol_assignment: name): New member. Returns
2894 the name of the symbol.
2895 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2896 Returns true if the given symbol name is on the list of
2897 assignments wating to be processed.
2898 * archive.cc (should_incldue_member): If the symbol is undefined,
2899 check to see if it is on the list of symbols pending assignment.
2900
3f9a3278
ILT
29012010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2902
2903 * script-sections.cc (Script_sections::find_memory_region): Check
2904 for a NULL output section pointer.
2905
d06fb4d1
DK
29062010-10-29 Doug Kwan <dougkwan@google.com>
2907
2908 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2909 Output_section::add_relaxed_input_section.
2910 * output.cc (Output_section::add_relaxed_input_section): Add new
2911 arguments LAYOUT and NAME. Set section order index.
2912 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2913 Copy section order index.
2914 * output.h (Output_section::add_relaxed_input_section): Add new
2915 arguments LAYOUT and NAME.
2916
90e24de5
ILT
29172010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2918
2919 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2920 NATIVE_OR_CROSS_LINKER.
2921 * testsuite/Makefile.in: Regenerate.
2922
c9484ea5
DK
29232010-10-20 Doug Kwan <dougkwan@google.com>
2924
2925 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2926 without SHF_LINK_ORDER flags.
2927 * layout.cc (Layout::choose_output_section): Do not filter
2928 SHF_LINK_ORDER flag in a relocatable link.
2929
5bc2f5be
CC
29302010-10-17 Cary Coutant <ccoutant@google.com>
2931
2932 * output.h (Output_segment::set_section_addresses): Change function
2933 signature. Update all callers.
2934 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2935 sections.
2936 (Output_segment::set_section_addresses): Align after last TLS
2937 section. Add padding before last relro section instead of after.
2938
0c91cf04
DK
29392010-10-17 Doug Kwan <dougkwan@google.com>
2940
2941 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2942 GOT output section to be writable.
2943
8c21d9d3
CC
29442010-10-14 Cary Coutant <ccoutant@google.com>
2945
2946 * debug.h (DEBUG_INCREMENTAL): New flag.
2947 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2948 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2949 mode.
2950 * incremental.cc (report_command_line): Ignore all forms of
2951 --incremental.
2952 * layout.cc (Layout::Layout): Check parameters for incremental link
2953 mode.
2954 * options.cc (General_options::parse_incremental): New function.
2955 (General_options::parse_no_incremental): New function.
2956 (General_options::parse_incremental_full): New function.
2957 (General_options::parse_incremental_update): New function.
2958 (General_options::incremental_mode_): New data member.
2959 (General_options::finalize): Check incremental_mode_.
2960 * options.h (General_options): Update help text for --incremental.
2961 Add --no-incremental, --incremental-full, --incremental-update.
2962 (General_options::Incremental_mode): New enum type.
2963 (General_options::incremental_mode): New function.
2964 (General_options::incremental_mode_): New data member.
2965 * parameters.cc (Parameters::incremental_mode_): New data member.
2966 (Parameters::set_options): Set incremental_mode_.
2967 (Parameters::set_incremental_full): New function.
2968 (Parameters::incremental): New function.
2969 (Parameters::incremental_update): New function.
2970 (set_parameters_incremental_full): New function.
2971 * parameters.h (Parameters::set_incremental_full): New function.
2972 (Parameters::incremental): New function.
2973 (Parameters::incremental_update): New function.
2974 (Parameters::incremental_mode_): New data member.
2975 (set_parameters_incremental_full): New function.
2976 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2977 incremental link mode.
2978 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2979 (Sized_relobj::do_relocate_sections): Likewise.
2980 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2981 option.
2982 * testsuite/Makefile.in: Regenerate.
2983 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2984
bb32aa18 29852010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
2986
2987 * script-sections.h (class Script_sections): Make
2988 Sections_elements typedef public.
2989 * script-sections.cc (class Sort_output_sections): Add elements_
2990 field. Add constructor which sets it; change all callers.
2991 (Sort_output_sections::is_before): New function.
2992 (Sort_output_sections::operator()): Call is_before.
2993 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2994 conditional.
2995 * testsuite/script_test_10.sh: New test. Test script section
2996 order.
2997 * testsuite/script_test_10.t: Likewise.
2998 * testsuite/script_test_10.s: Likewise.
2999 * testsuite/Makefile.am: Wrap the cross linker tests and the
3000 common tests into NATIVE_OR_CROSS_LINKER.
3001 (check_SCRIPTS): Add script_test_10.sh.
3002 (check_DATA): Add script_test_10.stdout.
3003 (script_test_10.o, script_test_10): New targets.
3004 (script_test_10.stdout): New target.
3005 * configure, testsuite/Makefile.in: Regenerate.
3006
3cef7179
ILT
30072010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3008
3009 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3010 error for the deprecated relocations.
3011 (Target_arm::Scan::global): Likewise.
3012 (Target_arm::Relocate::relocate): Likewise.
3013
7411e9a8
RS
30142010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
3015
3016 * fileread.cc (Input_file::find_file): Initialize *found_name
3017 and *namep when using the fallback search for case 4.
3018
6a9da32a
CC
30192010-10-11 Cary Coutant <ccoutant@google.com>
3020
3021 * options.h (class General_options): Redefine -z lazy as an alias for
3022 the negation of -z now.
3023
ac897c20
ILT
30242010-10-11 Ian Lance Taylor <iant@google.com>
3025
3026 * resolve.cc (symbol_to_bits): Report the value of the unsupported
3027 binding.
3028
ea5cae92
NC
30292010-10-06 Nick Clifton <nickc@redhat.com>
3030
3031 * script-sections.cc(class Memory_region): Remove
3032 current_lma_offset_ field. Rename current_vma_offset_ to
3033 current_offset_. Add last_section_ field.
3034 (Memory_region::get_current_vma_address): Rename to
3035 get_current_address.
3036 (Memory_region::get_current_lma_address): Delete.
3037 (Memory_region::increment_vma_offset): Rename to
3038 increment_offset.
3039 (Memory_region::increment_lma_offset): Delete.
3040 (Memory_region::attributes_compatible): New method. Returns
3041 true if the provided section is compatible with the region.
3042 (Memory_region::get_last_section): New method. Returns the last
3043 section to use the region.
3044 (Memory_region::set_last_section): New method. Stores the last
3045 section to use the region.
3046 (Script_sections::block_in_region): New method. Returns true if
3047 a block of memory is contained within a region.
3048 (Script_sections::find_memory_region): New method. Locates a
3049 memory region to be used to set a VMA or LMA address.
3050 (Output_section_definition::set_section_addresses): Add code to
3051 check for addresses set by memory regions.
3052 (Output_segment::set_section_addresses): Remove memory region
3053 walking code.
3054 (Script_sections::create_segment): Add a warning if a header
3055 segment is created outside of any region.
3056 * script-sections.h (class Script_sections): Add prototypes for
3057 find_memory_region and block_in_region methods.
3058 * testsuite/memory_test.s: Use .long instead of .word.
3059 * testsuite/memory_test.t: Add some more output sections.
3060 * testsuite/memory_test.sh: Update expected output.
3061
a9bfd952
DK
30622010-10-02 Doug Kwan <dougkwan@google.com>
3063
3064 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3065 defintion to symtab.h
3066 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3067 declaration to defintion.
3068
bacff3ab
NC
30692010-10-01 Nick Clifton <nickc@redhat.com>
3070
3071 * expression.cc (eval): Replace dummy argument with NULL.
3072 (eval_maybe_dot): Check for a NULL result section pointer.
3073 (Symbol_expression::value): Likewise.
3074 (Dot_expression::value): Likewise.
3075 (BINARY_EXPRESSION): Likewise.
3076 (Max_expression::value): Likewise.
3077 (Min_expression::value): Likewise.
3078 (Absolute_expression::value): Likewise.
3079 (Addr_expression::value_from_output_section): Likewise.
3080 (Loaddddr_expression::value_from_output_section): Likewise.
3081 (Segment_start_expression::value): Likewise.
3082 * script-sections.cc
3083 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3084 argument with NULL.
3085 (Sections_elememt_dot_assignment::set_section_addresses):
3086 Likewise.
3087 (Output_data_expression::do_write_to_buffer): Likewise.
3088 (Output_section_definition::finalize_symbols): Likewise.
3089 (Output_section_definition::set_section_addresses): Likewise.
3090
f81bc8b5
DK
30912010-09-30 Doug Kwan <dougkwan@google.com>
3092
3093 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3094
c95e9f27
ST
30952010-09-28 Sriraman Tallam <tmsriram@google.com>
3096
3097 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 3098 function.
c95e9f27
ST
3099 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3100 virtual function.
3101 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3102 virtual function.
3103 * icf.cc (get_section_contents): Inline merge sections only when
3104 target allows it.
3105
3cac54d2
RW
31062010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3107
3108 * configure: Regenerate.
3109
2904037a
ILT
31102010-09-17 Ian Lance Taylor <iant@google.com>
3111
3112 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
3113 * testsuite/Makefile.am (memory_test.o): New target.
3114 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
3115 memory_test.t.
3116 * testsuite/Makefile.in: Rebuild.
2904037a 3117
bca7fb63
DK
31182010-09-17 Doug Kwan <dougkwan@google.com>
3119
3120 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
3121 defintion if relocation uses GOT entries of the symbol.
3122 * testsuite/icf_safe_test.sh: Fix test.
3123 * testsuite/icf_safe_so_test.sh: Fix test.
3124
4ef28648
CC
31252010-09-16 Cary Coutant <ccoutant@google.com>
3126
3127 * script_sections.cc (class Memory_region): Remove "NULL" from
3128 vector initializations.
3129
793990de
CC
31302010-09-15 Cary Coutant <ccoutant@google.com>
3131
3132 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
3133 Resolve forwarding symbols.
3134
81e015e2
DK
31352010-09-15 Doug Kwan <dougkwan@google.com>
3136
3137 * gold/testsuite/script_test_3.t: Add ARM special sections.
3138 * gold/testsuite/script_test_4.t: Same.
3139 * gold/testsuite/script_test_5.t: Same.
3140 * gold/testsuite/script_test_6.t: Same.
3141 * gold/testsuite/script_test_7.t: Same.
3142 * gold/testsuite/script_test_7.t: Same.
3143 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
3144
36171d64
CC
31452010-09-14 Cary Coutant <ccoutant@google.com>
3146
3147 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
3148 (Target_x86_64::Relocate::relocate_tls): Replace check for
3149 saw_tls_block_reloc_ with test for executable section.
3150
d89051bd
CC
31512010-09-12 Cary Coutant <ccoutant@google.com>
3152
3153 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
3154 position-independent executables to shared libraries need dynamic
3155 relocations.
3156 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
3157 position-independent executables.
3158 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
3159 * testsuite/Makefile.in: Regenerate.
3160
fca41f0f
NC
31612010-09-10 Nick Clifton <nickc@redhat.com>
3162
3163 PR gold/11997
3164 * testsuite/memory_test.t: Discard any sections that are not
3165 needed.
3166
6695e4b3
L
31672010-09-09 H.J. Lu <hongjiu.lu@intel.com>
3168
3169 PR gold/11996
3170 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
3171 "This::" to work around a bug in gcc 4.2.
3172
3173 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
3174
0f72bf6f
RÁE
31752010-09-09 Rafael Espindola <espindola@google.com>
3176
3177 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
3178 sections with different PF_X flags in the same segment.
3179 (Layout::find_first_load_seg): Search all segments to find the first
3180 one.
3181 * options.h (rosegment): New.
3182
31832010-09-08 Rafael Espindola <espindola@google.com>
a6577478 3184
05a79166 3185 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 3186
aa98ff75
DK
31872010-09-08 Doug Kwan <dougkwan@google.com>
3188
3189 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
3190 (Arm_relobj::do_relocate_sections): Add new parameter for output
3191 file to match the parent.
3192 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
3193 of local symbols instead of input values. Update code to track
3194 changes in gold::relocate_section.
3195 * object.cc (Sized_relobj::compute_final_local_value): New methods.
3196 (Sized_relobj::compute_final_local_value_internal): New methods.
3197 (Sized_relobj::do_finalize_local_symbols): Move code from loop
3198 body into private version of Sized_relobj::compute_final_local_value.
3199 Call the inline method.
3200 * object.h (Symbol_value::Symbol_value): Define destructor. Free
3201 merged symbol value if there is one.
3202 (Symbol_value::has_output_value): New method defintiion.
3203 (Sized_relobj::Compute_final_local_value_status): New enum type.
3204 (Sized_relobj::compute_final_local_value): New methods.
3205 (Sized_relobj::compute_final_local_value_internal): New methods.
3206 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
3207 and arm_cortex_a8.sh.
3208 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
3209 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
3210 New tests.
3211 * Makefile.in: Regenerate.
3212 * testsuite/arm_bl_out_of_range.s: Update test.
3213 * testsuite/thumb_bl_out_of_range.s: Ditto.
3214 * testsuite/thumb_blx_out_of_range.s: Ditto.
3215 * testsuite/arm_branch_out_of_range.sh: New file.
3216 * testsuite/arm_cortex_a8.sh: Ditto.
3217 * testsuite/arm_cortex_a8_b.s: Ditto.
3218 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3219 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3220 * testsuite/arm_cortex_a8_bl.s: Ditto.
3221 * testsuite/arm_cortex_a8_blx.s: Ditto.
3222 * testsuite/arm_cortex_a8_local.s: Ditto.
3223 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3224 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3225
05a79166
L
32262010-09-08 Rafael Espindola <espindola@google.com>
3227
3228 * Makefile.am (memory_test.stdout): Run readelf with -W.
3229 * Makefile.in: Regenerate.
3230 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3231 64 bit output.
3232
33dbc701
RÁE
32332010-09-08 Rafael Espindola <espindola@google.com>
3234
3235 * script-sections.cc (Script_sections::add_memory_region): Convert
3236 field precision to int.
3237 * script.cc (script_set_section_region, script_set_section_region):
3238 Convert field precision to int.
3239
731ca54a
RÁE
32402010-09-08 Rafael Espindola <espindola@google.com>
3241
3242 * arm.cc (do_finalize_sections): Create the __exidx_start and
3243 __exdix_end symbols even when the section is missing.
3244
7f8cd844
NC
32452010-09-08 Nick Clifton <nickc@redhat.com>
3246
3247 * README: Remove claim that MEMORY is not supported.
3248 * expression.cc (script_exp_function_origin)
3249 (script_exp_function_length): Move from here to ...
3250 * script.cc: ... here.
3251 (script_set_section_region, script_add_memory)
3252 (script_parse_memory_attr, script_include_directive): New
3253 functions.
3254 * script-sections.cc
3255 (class Memory_region): New class.
3256 (class Output_section_definition): Add set_memory_region,
3257 set_section_vma, set_section_lma and get_section_name methods.
3258 (class Script_Sections): Add add_memory_region,
3259 find_memory_region, find_memory_region_origin,
3260 find_memory_region_length and set_memory_region methods.
3261 Have set_section_addresses method walk the list of set memory
3262 regions.
3263 Extend the print methos to display memory regions.
3264 * script-sections.h: Add prototypes for new methods.
3265 Add enum for MEMORY region attributes.
3266 * yyscript.y: Add support for parsing MEMORY regions.
3267 * script-c.h: Add prototypes for new functions.
3268 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3269 * testsuite/Makefile.in: Regenerate.
3270 * testsuite/memory_test.sh: New script.
3271 * testsuite/memory_test.s: New assembler source file.
3272 * testsuite/memory_test.t: New linker script.
3273
a4649286
DK
32742010-08-27 Doug Kwan <dougkwan@google.com>
3275
3276 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3277 reference override an existing dynamic weak reference.
3278 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3279 * testsuite/Makefile.in: Regenerate.
3280 * testsuite/dyn_weak_ref.sh: New file.
3281 * testsuite/dyn_weak_ref_1.c: Ditto.
3282 * testsuite/dyn_weak_ref_2.c: Ditto.
3283
b56648ad
ILT
32842010-08-27 Ian Lance Taylor <iant@google.com>
3285
3286 * incremental.h (class Incremental_input_entry): Add virtual
3287 destructor.
3288
809313cb
ILT
32892010-08-27 Ian Lance Taylor <iant@google.com>
3290
3291 * testsuite/start_lib_test_3.c: Mark t3 as used.
3292
11e32464
NC
32932010-08-27 Nick Clifton <nickc@redhat.com>
3294
3295 * options.cc (version_script): Fix small typo in previous
3296 whitespace tidyup.
3297
ca09d69a
NC
32982010-08-25 Nick Clifton <nickc@redhat.com>
3299
3300 * archive.cc: Formatting fixes: Remove whitespace between
3301 typename and following asterisk. Remove whitespace between
3302 function name and opening parenthesis.
3303 * archive.h: Likewise.
3304 * arm.cc: Likewise.
3305 * attributes.cc: Likewise.
3306 * attributes.h: Likewise.
3307 * common.cc: Likewise.
3308 * copy-relocs.cc: Likewise.
3309 * dirsearch.h: Likewise.
3310 * dynobj.cc: Likewise.
3311 * ehframe.cc: Likewise.
3312 * ehframe.h: Likewise.
3313 * expression.cc: Likewise.
3314 * fileread.cc: Likewise.
3315 * fileread.h: Likewise.
3316 * gc.h: Likewise.
3317 * gold-threads.cc: Likewise.
3318 * gold.cc: Likewise.
3319 * i386.cc: Likewise.
3320 * icf.h: Likewise.
3321 * incremental-dump.cc: Likewise.
3322 * incremental.cc: Likewise.
3323 * layout.cc: Likewise.
3324 * layout.h: Likewise.
3325 * main.cc: Likewise.
3326 * merge.cc: Likewise.
3327 * merge.h: Likewise.
3328 * object.cc: Likewise.
3329 * object.h: Likewise.
3330 * options.cc: Likewise.
3331 * options.h: Likewise.
3332 * output.cc: Likewise.
3333 * output.h: Likewise.
3334 * plugin.cc: Likewise.
3335 * plugin.h: Likewise.
3336 * powerpc.cc: Likewise.
3337 * reloc.cc: Likewise.
3338 * script-c.h: Likewise.
3339 * script-sections.cc: Likewise.
3340 * script.cc: Likewise.
3341 * stringpool.cc: Likewise.
3342 * symtab.cc: Likewise.
3343 * symtab.h: Likewise.
3344 * target.cc: Likewise.
3345 * timer.cc: Likewise.
3346 * timer.h: Likewise.
3347 * version.cc: Likewise.
3348 * x86_64.cc: Likewise.
3349
b8fa8750
NC
33502010-08-24 Nick Clifton <nickc@redhat.com>
3351
3352 PR 11899
3353 * layout.cc (segment_precedes): Sort segments by their physical
3354 addresses, if they have been set.
3355
9919d93b
CC
33562010-08-23 Cary Coutant <ccoutant@google.com>
3357
3358 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3359 symbols data.
3360 (Lib_group::include_member): Unlock object after deleting its
3361 symbols data.
3362 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3363 the bug fixed here.
3364
97b4be1c
CC
33652010-08-19 Neil Vachharajani <nvachhar@google.com>
3366 Cary Coutant <ccoutant@google.com>
3367
3368 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3369 constructor, and set_blocker.
3370 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3371 readsyms_blocker_.
3372 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3373 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3374 * testsuite/Makefile.am (start_lib_test): New test case.
3375 * testsuite/Makefile.in: Regenerate.
3376 * testsuite/start_lib_test_main.c: New file.
3377 * testsuite/start_lib_test_1.c: New file.
3378 * testsuite/start_lib_test_2.c: New file.
3379 * testsuite/start_lib_test_3.c: New file.
3380
dd0b1884
ILT
33812010-08-19 Ian Lance Taylor <iant@google.com>
3382
3383 * Makefile.in: Rebuild with automake 1.11.1.
3384 * aclocal.m4: Likewise.
3385 * testsuite/Makefile.in: Likewise.
3386
7223e9ca
ILT
33872010-08-19 Ian Lance Taylor <iant@google.com>
3388
3389 PR 10893
3390 * i386.cc (class Output_data_plt_i386): Update declarations.
3391 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3392 local_ifuncs_ fields.
3393 (Target_i386::do_plt_section_for_global): New function.
3394 (Target_i386::do_plt_section_for_local): New function.
3395 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3396 parameter; change all callers. Initialize global_ifuncs_ and
3397 local_ifuncs_. If doing a static link define __rel_iplt_start and
3398 __rel_iplt_end.
3399 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3400 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3401 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3402 symbols.
3403 (Target_i386::make_plt_section): New function, broken out of
3404 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3405 (Target_i386::make_plt_entry): Call make_plt_section.
3406 (Target_i386::make_local_ifunc_plt_entry): New function.
3407 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3408 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3409 R_386_IRELATIVE to switch.
3410 (Target_i386::Scan::global): Likewise.
3411 (Target_i386::Relocate::relocate): Likewise.
3412 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3413 switch.
3414 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3415 (Target_x86_64::do_plt_section_for_global): New function.
3416 (Target_x86_64::do_plt_section_for_local): New function.
3417 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3418 parameter; change all callers. If doing a static link define
3419 __rela_iplt_start and __rela_iplt_end.
3420 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3421 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3422 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3423 to point to .plt.
3424 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3425 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3426 switch.
3427 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3428 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3429 R_X86_64_IRELATIVE to switch.
3430 (Target_x86_64::Scan::global): Likewise.
3431 (Target_x86_64::Relocate::relocate): Likewise.
3432 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3433 switch.
3434 * target.h (class Target): Add plt_section_for_global and
3435 plt_section_for_local functions. Add do_plt_section_for_global
3436 and do_plt_section_for_local virtual functions.
3437 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3438 clarifying comments.
3439 (Symbol::use_plt_offset): Handle IFUNC symbol.
3440 * object.cc (Sized_relobj::Sized_relobj): Initialize
3441 local_plt_offsets_.
3442 (Sized_relobj::local_has_plt_offset): New function.
3443 (Sized_relobj::local_plt_offset): New function.
3444 (Sized_relobj::set_local_plt_offset): New function.
3445 (Sized_relobj::do_count): Handle IFUNC symbol.
3446 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3447 a bit away from input_shndx_ field. Add set_is_func_symbol and
3448 is_ifunc_symbol functions.
3449 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3450 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3451 local_plt_offsets_ field.
3452 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3453 * output.h (class Output_section_data): Add non-const
3454 output_section function.
3455 (class Output_data_got): Update declarations.
3456 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3457 Add use_plt_offset parameter to global and local constructors.
3458 Change all callers. Change local_sym_index_ field to 31 bits.
3459 Change GSYM_CODE and CONSTANT_CODE accordingly.
3460 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3461 doing a static link don't set sh_link field.
3462 (Output_data_got::Got_entry::write): Use PLT offset if
3463 appropriate.
3464 (Output_data_got::add_global_plt): New function.
3465 (Output_data_got::add_local_plt): New function.
3466 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3467 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3468 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3469 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3470 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3471 IFUNC conditional.
3472 * testsuite/ifunc-sel.h: New file.
3473 * testsuite/ifuncmain1.c: New file.
3474 * testsuite/ifuncmain1vis.c: New file.
3475 * testsuite/ifuncmod1.c: New file.
3476 * testsuite/ifuncdep2.c: New file.
3477 * testsuite/ifuncmain2.c: New file.
3478 * testsuite/ifuncmain3.c: New file.
3479 * testsuite/ifuncmod3.c: New file.
3480 * testsuite/ifuncmain4.c: New file.
3481 * testsuite/ifuncmain5.c: New file.
3482 * testsuite/ifuncmod5.c: New file.
3483 * testsuite/ifuncmain6pie.c: New file.
3484 * testsuite/ifuncmod6.c: New file.
3485 * testsuite/ifuncmain7.c: New file.
3486 * configure, testsuite/Makefile.in: Rebuild.
3487
56f75c03
ILT
34882010-08-18 Ian Lance Taylor <iant@google.com>
3489
3490 * incremental.cc
3491 (Output_section_incremental_inputs::write_input_files): Add cast
3492 to avoid signed/unsigned comparison warning.
3493 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3494
55455f89
CC
34952010-08-12 Cary Coutant <ccoutant@google.com>
3496
3497 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3498
e2054bcb
ILT
34992010-08-13 Ian Lance Taylor <iant@google.com>
3500
3501 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3502
74f67560
DK
35032010-08-12 Cary Coutant <ccoutant@google.com>
3504 Doug Kwan <dougkwan@google.com>
3505
3506 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3507 defintion overrides non-weak undef, remember that the original undef
3508 is not weak.
3509 * symtab.cc (Symbol_table::sized_write_global): For undef without
3510 an original weak binding, set binding to global in output.
3511 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3512 * testsuite/Makefile.in: Regenerate.
3513 * testsuite/strong_ref_weak_def.sh: New file.
3514 * testsuite/strong_ref_weak_def_1.c: Ditto.
3515 * testsuite/strong_ref_weak_def_2.c: Ditto.
3516
d1238d12
CC
35172010-08-12 Cary Coutant <ccoutant@google.com>
3518
3519 * testsuite/incremental_test.sh: Rewrite.
3520 * testsuite/incremental_test_1.c: Rewrite.
3521 * testsuite/incremental_test_2.c: Rewrite.
3522
0e70b911
CC
35232010-08-12 Cary Coutant <ccoutant@google.com>
3524
3525 * arm.cc (Target_arm::got_size): Add const.
3526 (Target_arm::got_entry_count): New function.
3527 (Target_arm::plt_entry_count): New function.
3528 (Target_arm::first_plt_entry_offset): New function.
3529 (Target_arm::plt_entry_size): New function.
3530 (Output_data_plt_arm::entry_count): New function.
3531 (Output_data_plt_arm::first_plt_entry_offset): New function.
3532 (Output_data_plt_arm::get_plt_entry_size): New function.
3533 * i386.cc (Target_i386::got_size): Add const.
3534 (Target_i386::got_entry_count): New function.
3535 (Target_i386::plt_entry_count): New function.
3536 (Target_i386::first_plt_entry_offset): New function.
3537 (Target_i386::plt_entry_size): New function.
3538 (Output_data_plt_i386::entry_count): New function.
3539 (Output_data_plt_i386::first_plt_entry_offset): New function.
3540 (Output_data_plt_i386::get_plt_entry_size): New function.
3541 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3542 find_incremental_inputs_sections. Dump incremental_got_plt section.
3543 * incremental.cc: Include target.h.
3544 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3545 parameter. Adjust all callers. Find incremental_got_plt section.
3546 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3547 section.
3548 (Output_section_incremental_inputs::set_final_data_size): Calculate
3549 size of incremental_got_plt section.
3550 (Output_section_incremental_inputs::do_write): Write the
3551 incremental_got_plt section.
3552 (Got_plt_view_info): New struct.
3553 (Local_got_offset_visitor): New class.
3554 (Global_got_offset_visitor): New class.
3555 (Global_symbol_visitor_got_plt): New class.
3556 (Output_section_incremental_inputs::write_got_plt): New function.
3557 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3558 Add parameter. Adjust all callers.
3559 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3560 (Incremental_inputs::got_plt_section): New function.
3561 (Incremental_inputs::got_plt_section_): New data member.
3562 (Incremental_got_plt_reader): New class.
3563 * layout.cc (Layout::create_incremental_info_sections): Add the
3564 incremental_got_plt section.
3565 * object.h (Got_offset_list::get_list): New function.
3566 (Got offset_list::for_all_got_offsets): New function.
3567 (Sized_relobj::local_got_offset_list): New function.
3568 * powerpc.cc (Target_powerpc::got_size): Add const.
3569 (Target_powerpc::got_entry_count): New function.
3570 (Target_powerpc::plt_entry_count): New function.
3571 (Target_powerpc::first_plt_entry_offset): New function.
3572 (Target_powerpc::plt_entry_size): New function.
3573 (Output_data_plt_powerpc::entry_count): New function.
3574 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3575 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3576 * sparc.cc (Target_sparc::got_size): Add const.
3577 (Target_sparc::got_entry_count): New function.
3578 (Target_sparc::plt_entry_count): New function.
3579 (Target_sparc::first_plt_entry_offset): New function.
3580 (Target_sparc::plt_entry_size): New function.
3581 (Output_data_plt_sparc::entry_count): New function.
3582 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3583 (Output_data_plt_sparc::get_plt_entry_size): New function.
3584 * symtab.h (Symbol::got_offset_list): New function.
3585 (Symbol_table::for_all_symbols): New function.
3586 * target.h (Sized_target::got_entry_count): New function.
3587 (Sized_target::plt_entry_count): New function.
3588 (Sized_target::plt_entry_size): New function.
3589 * x86_64.cc (Target_x86_64::got_size): Add const.
3590 (Target_x86_64::got_entry_count): New function.
3591 (Target_x86_64::plt_entry_count): New function.
3592 (Target_x86_64::first_plt_entry_offset): New function.
3593 (Target_x86_64::plt_entry_size): New function.
3594 (Output_data_plt_x86_64::entry_count): New function.
3595 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3596 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3597
09ec0418
CC
35982010-08-12 Cary Coutant <ccoutant@google.com>
3599
3600 * archive.cc: Include incremental.h.
3601 (Archive::Archive): Initialize incremental_info_.
3602 (Archive::include_member): Record archive members in incremental info.
3603 (Add_archive_symbols::run): Record begin and end of an archive in
3604 incremental info.
3605 (Lib_group::include_member): Record objects in incremental info.
3606 * archive.h (Incremental_archive_entry): Forward declaration.
3607 (Archive::set_incremental_info): New member function.
3608 (Archive::incremental_info): New member function.
3609 (Archive::Unused_symbol_iterator): New class.
3610 (Archive::unused_symbols_begin): New member function.
3611 (Archive::unused_symbols_end): New member function.
3612 (Archive::incremental_info_): New data member.
3613 * incremental-dump.cc (find_input_containing_global): New function.
3614 (dump_incremental_inputs): Dump new incremental info sections.
3615 * incremental.cc: Include symtab.h.
3616 (Output_section_incremental_inputs): New class.
3617 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3618 new incremental info sections.
3619 (Sized_incremental_binary::do_check_inputs): Likewise.
3620 (Incremental_inputs::report_archive): Remove.
3621 (Incremental_inputs::report_archive_begin): New function.
3622 (Incremental_inputs::report_archive_end): New function.
3623 (Incremental_inputs::report_object): New function.
3624 (Incremental_inputs::finalize_inputs): Remove.
3625 (Incremental_inputs::report_input_section): New function.
3626 (Incremental_inputs::report_script): Rewrite.
3627 (Incremental_inputs::finalize): Do nothing but finalize string table.
3628 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3629 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3630 (Incremental_inputs::create_data_sections): New function.
3631 (Incremental_inputs::relocs_entsize): New function.
3632 (Output_section_incremental_inputs::set_final_data_size): New function.
3633 (Output_section_incremental_inputs::do_write): New function.
3634 (Output_section_incremental_inputs::write_header): New function.
3635 (Output_section_incremental_inputs::write_input_files): New function.
3636 (Output_section_incremental_inputs::write_info_blocks): New function.
3637 (Output_section_incremental_inputs::write_symtab): New function.
3638 * incremental.h (Incremental_script_entry): Forward declaration.
3639 (Incremental_object_entry): Forward declaration.
3640 (Incremental_archive_entry): Forward declaration.
3641 (Incremental_inputs): Forward declaration.
3642 (Incremental_inputs_header_data): Remove.
3643 (Incremental_inputs_header): Remove.
3644 (Incremental_inputs_header_write): Remove.
3645 (Incremental_inputs_entry_data): Remove.
3646 (Incremental_inputs_entry): Remove.
3647 (Incremental_inputs_entry_write): Remove.
3648 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3649 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3650 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3651 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3652 Likewise.
3653 (Incremental_input_entry): New class.
3654 (Incremental_script_entry): New class.
3655 (Incremental_object_entry): New class.
3656 (Incremental_archive_entry): New class.
3657 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3658 (Incremental_inputs::report_inputs): Remove.
3659 (Incremental_inputs::report_archive): Remove.
3660 (Incremental_inputs::report_archive_begin): New function.
3661 (Incremental_inputs::report_archive_end): New function.
3662 (Incremental_inputs::report_object): Change prototype.
3663 (Incremental_inputs::report_input_section): New function.
3664 (Incremental_inputs::report_script): Change prototype.
3665 (Incremental_inputs::get_reloc_count): New function.
3666 (Incremental_inputs::set_reloc_count): New function.
3667 (Incremental_inputs::create_data_sections): New function.
3668 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3669 (Incremental_inputs::inputs_section): New function.
3670 (Incremental_inputs::symtab_section): New function.
3671 (Incremental_inputs::relocs_section): New function.
3672 (Incremental_inputs::get_stringpool): Add const.
3673 (Incremental_inputs::command_line): Add const.
3674 (Incremental_inputs::inputs): Remove.
3675 (Incremental_inputs::command_line_key): New function.
3676 (Incremental_inputs::input_file_count): New function.
3677 (Incremental_inputs::input_files): New function.
3678 (Incremental_inputs::relocs_entsize): New function.
3679 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3680 (Incremental_inputs::finalize_inputs): Remove.
3681 (Incremental_inputs::Input_info): Remove.
3682 (Incremental_inputs::lock_): Remove.
3683 (Incremental_inputs::inputs_): Change type.
3684 (Incremental_inputs::inputs_map_): Remove.
3685 (Incremental_inputs::current_object_entry_): New data member.
3686 (Incremental_inputs::inputs_section_): New data member.
3687 (Incremental_inputs::symtab_section_): New data member.
3688 (Incremental_inputs::relocs_section_): New data member.
3689 (Incremental_inputs::reloc_count_): New data member.
3690 (Incremental_inputs_reader): New class.
3691 (Incremental_symtab_reader): New class.
3692 (Incremental_relocs_reader): New class.
3693 * layout.cc (Layout::finalize): Move finalization of incremental info
3694 and creation of incremental info sections to follow finalization of
3695 symbol table. Set offsets for postprocessing sections.
3696 (Layout::create_incremental_info_sections): Call
3697 Incremental_inputs::create_data_sections. Add incremental symtab
3698 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3699 sections to layout after input sections.
3700 * layout.h (struct Timespec): Forward declaration.
3701 (Layout::incremental_inputs): Add const.
3702 (Layout::create_incremental_info_sections): Add parameter.
3703 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3704 * object.cc: Include incremental.h.
3705 (Relobj::finalize_incremental_relocs): New function.
3706 (Sized_relobj::do_layout): Record input sections in incremental info.
3707 * object.h (Object::output_section): New function.
3708 (Object::output_section_offset): Moved from Relobj.
3709 (Object::get_incremental_reloc_base): New function.
3710 (Object::get_incremental_reloc_count): New function.
3711 (Object::do_output_section): New function.
3712 (Object::do_output_section_offset): Moved from Relobj.
3713 (Object::do_get_incremental_reloc_base): New function.
3714 (Object::do_get_incremental_reloc_count): New function.
3715 (Object::Object): Initialize new data members.
3716 (Relobj::output_section): Renamed do_output_section and moved to
3717 protected.
3718 (Relobj::output_section_offset): Moved to Object.
3719 (Relobj::do_get_incremental_reloc_base): New function.
3720 (Relobj::do_get_incremental_reloc_count): New function.
3721 (Relobj::allocate_incremental_reloc_counts): New function.
3722 (Relobj::count_incremental_reloc): New function.
3723 (Relobj::finalize_incremental_relocs): New function.
3724 (Relobj::next_incremental_reloc_index): New function.
3725 (Relobj::reloc_counts_): New data member.
3726 (Relobj::reloc_bases_): New data member.
3727 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3728 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3729 (Sized_relobj::incremental_relocs_scan): New function.
3730 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3731 (Sized_relobj::incremental_relocs_write): New function.
3732 (Sized_relobj::incremental_relocs_write_reltype): New function.
3733 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3734 incremental link.
3735 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3736 archives and object files elsewhere.
3737 (Add_symbols::run): Report object files here.
3738 (Finish_group::run): Report end of archive at end of group.
3739 * reloc.cc: Include layout.h, incremental.h.
3740 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3741 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3742 (Sized_relobj::incremental_relocs_scan): New function.
3743 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3744 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3745 (Sized_relobj::incremental_relocs_write): New function.
3746 (Sized_relobj::incremental_relocs_write_reltype): New function.
3747 * script.cc (read_input_script): Rewrite test for incremental link.
3748 Change call to Incremental_inputs::report_script.
3749 * symtab.h (Symbol_table::first_global_index): New function.
3750 (Symbol_table::output_count): New function.
3751
ce0d1972
DK
37522010-08-12 Doug Kwan <dougkwan@google.com>
3753
3754 * arm.cc (Target_arm::merge_object_attributes): Check command line
3755 options --no-wchar-size-warning and --no-enum-size-warning.
3756 * options.h (General_options): Add ld-compatible options
3757 --no-enum-size-warning and --no-wchar-size-warning.
3758
6e5710ce
ILT
37592010-08-04 Ian Lance Taylor <iant@google.com>
3760
3761 * x86_64.cc (Target_x86_64::Scan::local): Use
3762 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3763 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3764 (Target_x86_64::Scan::global): Likewise.
3765 (Target_x86_64::Relocate::relocate): Likewise.
3766 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3767 Likewise.
3768
fef830db
CC
37692010-08-03 Cary Coutant <ccoutant@google.com>
3770
3771 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3772 to reserve space in merged_strings vector. Keep total input size
3773 for stats.
3774 (Output_merge_string::do_print_merge_stats): Print total input size.
3775 * merge.h (Output_merge_string): Add input_size_ field.
3776 * stringpool.cc (Stringpool_template::string_length): Move
3777 implementations out of Stringpool_template class and place in
3778 stringpool.h.
3779 * stringpool.h (string_length): Move out of Stringpool_template.
3780
1e3811b0
ILT
37812010-08-03 Ian Lance Taylor <iant@google.com>
3782
3783 PR 11712
3784 * layout.cc (relaxation_loop_body): If address of load segment is
3785 set, adjust address to include headers if possible.
3786
7af0c620
ILT
37872010-08-03 Ian Lance Taylor <iant@google.com>
3788
3789 * version.cc (version_string): Bump to 1.10.
3790
22f0da72
ILT
37912010-08-03 Ian Lance Taylor <iant@google.com>
3792
3793 PR 11805
3794 * layout.h (enum Output_section_order): Define.
3795 (class Layout): Update declarations.
3796 * layout.cc (Layout::get_output_section): Add order parameter.
3797 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3798 is_first_non_relro parameters. Change all callers.
3799 (Layout::choose_output_section): Likewise.
3800 (Layout::add_output_section_data): Likewise.
3801 (Layout::make_output_section): Likewise. Set order.
3802 (Layout::default_section_order): New function.
3803 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3804 * output.cc (Output_section::Output_section): Initialize order_.
3805 Don't initialize deleted fields.
3806 (Output_segment::Output_segment): Don't initialize deleted
3807 fields.
3808 (Output_segment::add_output_section_to_load): New function
3809 replacing add_output_section. Change all callers to call this or
3810 add_output_section_to_nonload.
3811 (Output_segment::add_output_section_to_nonload): New function.
3812 (Output_segment::remove_output_section): Rewrite.
3813 (Output_segment::add_initial_output_data): Likewise.
3814 (Output_segment::has_any_data_sections): Likewise.
3815 (Output_segment::is_first_section_relro): Likewise.
3816 (Output_segment::maximum_alignment): Likewise.
3817 (Output_segment::has_dynamic_reloc): New function replacing
3818 dynamic_reloc_count. Change all callers.
3819 (Output_segment::has_dynamic_reloc_list): New function replacing
3820 dynamic_reloc_count_list. Change all callers.
3821 (Output_segment::set_section_addresses): Rewrite.
3822 (Output_segment::set_offset): Rewrite.
3823 (Output_segment::find_first_and_last_list): Remove.
3824 (Output_segment::set_tls_offsets): Rewrite.
3825 (Output_segment::first_section_load_address): Likewise.
3826 (Output_segment::output_section_count): Likewise.
3827 (Output_segment::section_with_lowest_load_address): Likewise.
3828 (Output_segment::write_section_headers): Likewise.
3829 (Output_segment::print_sections_to_map): Likewise.
3830 * output.h (class Output_data): Remove dynamic_reloc_count_
3831 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3832 (Output_data::add_dynamic_reloc): Rewrite.
3833 (Output_data::has_dynamic_reloc): New function.
3834 (Output_data::dynamic_reloc_count): Remove.
3835 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3836 is_last_relro_, is_first_non_relro_, is_interp_,
3837 is_dynamic_linker_section_ fields. Add order and set_order
3838 functions. Remove is_relro_local, set_is_relro_local,
3839 is_last_relro, set_is_last_relro, is_first_non_relro,
3840 set_is_first_non_relro functions, is_interp, set_is_interp,
3841 is_dynamic_linker_section, and set_is_dynamic_linker_section
3842 functions.
3843 (class Output_segment): Change Output_data_list from std::list to
3844 std:;vector. Add output_lists_ field. Remove output_data_ and
3845 output_bss_ fields. Update declarations.
3846
3ff2ccb0
ILT
38472010-08-02 Ian Lance Taylor <iant@google.com>
3848
3849 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3850 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3851 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3852
88a4108b
ILT
38532010-08-02 Ian Lance Taylor <iant@google.com>
3854
3855 PR 11855
3856 * script.cc (Script_options::Script_options): Initialize
3857 symbol_definitions_ and symbol_references_.
3858 (Script_options::add_symbol_assignment): Update
3859 symbol_definitions_ and symbol_references_.
3860 (Script_options::add_symbol_reference): New function.
3861 (script_symbol): New function.
3862 * script.h (class Script_options): Add symbol_definitions_ and
3863 symbol_references_ fields.
3864 (Script_options::referenced_const_iterator): New type.
3865 (Script_options::referenced_begin): New function.
3866 (Script_options::referenced_end): New function.
3867 (Script_options::is_referenced): New function.
3868 (Script_options::any_unreferenced): New function.
3869 * script-c.h (script_symbol): Declare.
3870 * yyscript.y (exp): Call script_symbol.
3871 * symtab.cc: Include "script.h".
3872 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3873 Change all callers. Check symbols referenced by scripts.
3874 (Symbol_table::add_undefined_symbols_from_command_line): Add
3875 layout parameter. Change all callers.
3876 (Symbol_table::do_add_undefined_symbols_from_command_line):
3877 Likewise. Break out loop body. Check symbols referenced by
3878 scripts.
3879 (Symbol_table::add_undefined_symbol_from_command_line): New
3880 function broken out of
3881 do_add_undefined_symbols_from_command_line.
3882 * symtab.h (class Symbol_table): Update declarations.
3883 * archive.cc: Include "layout.h".
3884 (Archive::should_include_member): Add layout parameter. Change
3885 all callers. Check for symbol mentioned in expression.
3886 * archive.h (class Archive): Update declaration.
3887 * object.cc (Sized_relobj::do_should_include_member): Add layout
3888 parameter.
3889 * object.h (Object::should_include_member): Add layout parameter.
3890 Change all callers.
3891 (Object::do_should_include_member): Add layout parameter.
3892 (class Sized_relobj): Update declaration.
3893 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3894 parameter.
3895 * dynobj.h (class Sized_dynobj): Update declaration.
3896 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3897 layout parameter.
3898 * plugin.h (class Sized_pluginobj): Update declaration.
3899
5f1ab67a
ILT
39002010-08-02 Ian Lance Taylor <iant@google.com>
3901
3902 PR 11866
3903 * output.cc (Output_segment::set_offset): Search for the first and
3904 last sections rather than assuming that the list is in order.
3905 (Output_segment::find_first_and_last_list): New function.
3906 * output.h (class Output_segment): Update declarations.
3907 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3908 (relro_strip_test_SOURCES): New variable.
3909 (relro_strip_test_DEPENDENCIES): New variable.
3910 (relro_strip_test_LDFLAGS): New variable.
3911 (relro_strip_test_LDADD): New variable.
3912 (relro_strip_test.so): New target.
3913
a8df5856
ILT
39142010-08-02 Ian Lance Taylor <iant@google.com>
3915
3916 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3917 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3918 (Target_i386::got_tlsdesc_section): New function.
3919 (Target_i386::got_section): Create space for GOT entries for
3920 TLSDESC relocations.
3921 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3922 R_386_TLS_GOTDESC.
3923 (Target_i386::Scan::global): Likewise.
3924 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3925 using TLSDESC GOT.
3926 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3927 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3928 (Target_x86_64::got_tlsdesc_section): New function.
3929 (Target_x86_64::got_section): Create space for GOT entries for
3930 TLSDESC relocations.
3931 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3932 R_386_TLS_GOTDESC.
3933 (Target_x86_64::Scan::global): Likewise.
3934 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3935 using TLSDESC GOT.
3936
0c10a0a6
ILT
39372010-08-02 Ian Lance Taylor <iant@google.com>
3938
3939 * testsuite/final_layout.sh: Use dc to convert from hex to
3940 decimal.
3941
41cbeecc
ST
39422010-07-29 Sriraman Tallam <tmsriram@google.com>
3943
3944 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3945 paramter to the call to gold::gc_process_relocs.
3946 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3947 paramter to the call to gold::gc_process_relocs.
3948 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3949 parameter to the call to gold::gc_process_relocs.
3950 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3951 template parameter to the call to gold::gc_process_relocs.
3952 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3953 paramter to the call to gold::gc_process_relocs.
3954 * gc.h (get_embedded_addend_size): New function.
3955 (gc_process_relocs): Save the size of the reloc for use by ICF.
3956 * icf.cc (get_section_contents): Get the addend from the text section
3957 for SHT_REL relocation sections.
3958 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3959 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3960 * int_encoding.h (read_from_pointer): New overloaded function.
3961 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3962 * testsuite/icf_sht_rel_addend_test.sh: New file.
3963 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3964 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3965
6ea55b82
RW
39662010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3967
3968 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3969 * Makefile.in: Regenerate.
3970 * testsuite/Makefile.in: Regenerate.
3971
9691462b
ILT
39722010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3973
3974 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3975 * gold/testsuite/debug_msg.cc: Likewise.
3976 * gold/testsuite/odr_violation1.cc
3977 * gold/testsuite/odr_violation2.cc
3978
76897331
CC
39792010-07-21 Cary Coutant <ccoutant@google.com>
3980
3981 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3982 string, and length fields.
3983 (Output_merge_string::Merged_strings_list): New type.
3984 (Output_merge_string::Merged_strings_lists): New typedef.
3985 (Output_merge_string): Replace merged_strings_ with
3986 merged_strings_lists_.
3987 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3988 Merged_strings_list per input object and section. Don't store pointer
3989 to the string. Don't store length with each merged string entry.
3990 (Output_merge_string::finalize_merged_data): Loop over list of merged
3991 strings lists. Recompute length of each merged string.
3992
78384e8f
CC
39932010-07-15 Cary Coutant <ccoutant@google.com>
3994
3995 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3996 here.
3997
783659f9
ILT
39982010-07-14 Ian Lance Taylor <iant@google.com>
3999
4000 * descriptors.cc (Descriptors::open): Report correct name in error
4001 message.
4002
131687b4
DK
40032010-07-13 Doug Kwan <dougkwan@google.com>
4004
4005 * arm.cc (Arm_input_section::Arm_input_section): For a
4006 SHT_ARM_EXIDX section, always keeps the input sections.
4007 (Arm_input_section::set_exidx_section_link): New method.
4008 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4009 has_errors_ to false.
4010 (Arm_exidx_input_section::has_errors,
4011 Arm_exidx_input_section::set_has_errors): New methods.
4012 (Arm_exidx_input_section::has_errors_): New data member.
4013 (Arm_relobj::get_exidx_shndx_list): New method.
4014 (Arm_output_section::append_text_sections_to_list): Do not skip
4015 section without SHF_EXECINSTR.
4016 (Arm_output_section::fix_exidx_coverage): Skip input sections with
4017 errors.
4018 (Arm_relobj::make_exidx_input_section): Add new parameter for text
4019 section header. Make error messages more verbose. Check for
4020 a non-executable section linked to an EXIDX section.
4021 (Arm_relobj::do_read_symbols): Remove error checking, which has been
4022 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
4023 check that there is no deferred EXIDX section if we exit early.
4024 Instead of not making an EXIDX section in case of an error, make one
4025 and set the has_errors flag of it.
4026 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4027 in a relocatable link.
4028 (Target_arm::do_relax): Look for the EXIDX output section instead of
4029 assuming that it is called .ARM.exidx.
4030 (Target_arm::fix_exidx_coverage): Add a new parameter for input
4031 section list. Do not check for SHF_EXECINSTR section flags but
4032 skip any input section with errors.
4033 * output.cc (Output_section::Output_section): Initialize
4034 always_keeps_input_sections_ to false.
4035 (Output_section::add_input_section): Check for
4036 always_keeps_input_sections_.
4037 * output.h (Output_section::always_keeps_input_sections,
4038 Output_section::set_always_keeps_input_sections): New methods.
4039 (Output_section::always_keeps_input_sections): New data member.
4040
69517287
RÁE
40412010-07-13 Rafael Espindola <espindola@google.com>
4042
4043 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4044 * fileread.h (Input_file): Add try_extra_search_path and find_file.
4045
82742395
ILT
40462010-07-13 Philip Herron <herron.philip@googlemail.com>
4047 Ian Lance Taylor <iant@google.com>
4048
4049 * output.h (Output_section_lookup_maps::add_merge_section):
4050 Correct check of whether value was inserted.
4051 (Output_section_lookup_maps::add_merge_input_section): Likewise.
4052 (Output_section_lookup_maps::add_relaxed_input_section):
4053 Likewise.
4054 * arm.cc (Target_arm::got_section): Remove used local os.
4055 * i386.cc (Target_i386::got_section): Likewise.
4056 * x86_64.cc (Target_x86_64::got_section): Likewise.
4057 * sparc.cc (Target_sparc::got_section): Likewise.
4058 (Target_sparc::relocate): Remove unused local have_got_offset.
4059 * powerpc.cc (Target_powerpc::relocate): Likewise.
4060
f2d707b5
ILT
40612010-07-13 Ian Lance Taylor <iant@google.com>
4062
241531d6
ILT
4063 * compressed_output.cc (zlib_decompress): Fix signature in
4064 !HAVE_ZLIB_H case.
4065
f2d707b5
ILT
4066 * archive.cc (Archive::include_member): Unlock an external member
4067 of a thin archive. Don't bother to delete an object we know is
4068 NULL.
4069
a2e47362
CC
40702010-07-12 Cary Coutant <ccoutant@google.com>
4071
4072 * compressed_output.cc (zlib_decompress): New function.
4073 (get_uncompressed_size): New function.
4074 (decompress_input_section): New function.
4075 * compressed_output.h (get_uncompressed_size): New function.
4076 (decompress_input_section): New function.
4077 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4078 Handle compressed debug sections.
4079 * layout.cc (is_compressed_debug_section): New function.
4080 (Layout::output_section_name): Map compressed section names to
4081 canonical names.
4082 * layout.h (is_compressed_debug_section): New function.
4083 (is_debug_info_section): Recognize compressed debug sections.
4084 * merge.cc: Include compressed_output.h.
4085 (Output_merge_data::do_add_input_section): Handle compressed
4086 debug sections.
4087 (Output_merge_string::do_add_input_section): Handle compressed
4088 debug sections.
4089 * object.cc: Include compressed_output.h.
4090 (Sized_relobj::Sized_relobj): Initialize new data members.
4091 (build_compressed_section_map): New function.
4092 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4093 * object.h (Object::section_is_compressed): New method.
4094 (Object::do_section_is_compressed): New method.
4095 (Sized_relobj::Compressed_section_map): New type.
4096 (Sized_relobj::do_section_is_compressed): New method.
4097 (Sized_relobj::compressed_sections_): New data member.
4098 * output.cc (Output_section::add_input_section): Handle compressed
4099 debug sections.
4100 * reloc.cc: Include compressed_output.h.
4101 (Sized_relobj::write_sections): Handle compressed debug sections.
4102
ce279a62
CC
41032010-07-08 Cary Coutant <ccoutant@google.com>
4104
4105 * resolve.cc (Symbol_table::resolve): Remember whether undef was
4106 weak when resolving to a dynamic def.
4107 (Symbol_table::should_override): Add adjust_dyndef flag; set it
4108 for weak undef/dynamic def cases. Adjust callers.
4109 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
4110 undef_binding_weak_.
4111 (Symbol_table::sized_write_globals): Adjust symbol binding.
4112 (Symbol_table::sized_write_symbol): Add binding parameter.
4113 * symtab.h (Symbol::set_undef_binding): New method.
4114 (Symbol::is_undef_binding_weak): New method.
4115 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
4116 (Symbol_table::should_override): Add new parameter.
4117 (Symbol_table::sized_write_symbol): Add new parameter.
4118
4119 * testsuite/weak_undef_file1.cc: Add new test case.
4120 * testsuite/weak_undef_file2.cc: Fix header comment.
4121 * testsuite/weak_undef_test.cc: Add new test case.
4122
b2286c10
DK
41232010-06-29 Doug Kwan <dougkwan@google.com>
4124
4125 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
4126 Initialize USE_SYMBOL_.
4127 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
4128 definition.
4129 (Arm_reloc_property::uses_symbol_): New data member declaration.
4130 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
4131 uses symbol value and symbol is undefined but not weakly undefined.
4132
4802450a
RÁE
41332010-06-28 Rafael Espindola <espindola@google.com>
4134
4135 * plugin.cc (Plugin::load): Use dlerror.
4136
e5ca47ba
ILT
41372010-06-26 Jeffrey Yaskin <jyasskin@google.com>
4138
4139 * symtab.cc (detect_odr_violations): When reporting an ODR
4140 violation, report an object where the symbol is defined.
4141
8a75a161
DK
41422010-06-25 Doug Kwan <dougkwan@google.com>
4143
4144 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
4145 (Target_arm::section_may_have_icf_unsafe_pointers): New method
4146 definition.
4147 (Target_arm::Scan::local_reloc_may_be_function_pointer,
4148 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
4149 target hook to detect function points.
4150 (Target_arm::Scan::possible_function_pointer_reloc): New method.
4151 * icf.h (Icf::check_section_for_function_pointers): Change type of
4152 parameter SECTION_NAME to const reference to std::string. Use
4153 target hook to determine if section may have unsafe pointers.
4154 * target.h (Target::section_may_have_icf_unsafe_pointers): New
4155 method definition.
4156
42218b9f
RÁE
41572010-06-21 Rafael Espindola <espindola@google.com>
4158
4159 * fileread.cc (Input_file::find_fie): New
4160 (Input_file::open): Use Input_file::find_fie.
4161 * fileread.h (Input_file::find_fie): New
4162 * plugin.cc (set_extra_library_path): New.
4163 (Plugin::load): Add set_extra_library_path to the transfer vector.
4164 (Plugin_manager::set_extra_library_path): New.
4165 (Plugin_manager::add_input_file): Use the extra search path if set.
4166 (set_extra_library_path(): New.
4167 * plugin.h (Plugin_manager): Add set_extra_library_path and
4168 extra_search_path_.
4169
a0506cca
CC
41702010-06-19 Cary Coutant <ccoutant@google.com>
4171
4172 * layout.cc (gdb_sections): Add .debug_types.
4173 (lines_only_debug_sections): Likewise.
4174
6508b958
RÁE
41752010-06-18 Rafael Espindola <espindola@google.com>
4176
4177 * plugin.cc (add_input_file,add_input_library)
4178 (Plugin_manager::add_input_file): Make filename arguments const.
4179 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
4180 const.
4181
3e235302
DK
41822010-06-16 Doug Kwan <dougkwan@google.com>
4183
4184 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
4185 .ARM.attributes section if we have not merged any input
4186 attributes sections.
4187
106e8a6c
DK
41882010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4189
4190 * arm.cc: Allow combining objects with no EABI version
4191 information.
4192
91ff43fe
RÁE
41932010-06-15 Rafael Espindola <espindola@google.com>
4194
4195 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
4196
68ed838c
ILT
41972010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4198
4199 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
4200 (struct iovec): Correct !HAVE_READV definition.
4201
f3a2388f
CC
42022010-06-10 Cary Coutant <ccoutant@google.com>
4203
4204 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
4205 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
4206 reloc sections.
4207 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
4208
4209 PR 11683
4210 * symtab.h (Symbol::is_placeholder): New member function.
4211 * target-reloc.h (relocate_section): Check for placeholder symbols.
4212
4213 * testsuite/Makefile.am (plugin_test_8): New test.
4214 (plugin_test_9): New test.
4215 * testsuite/Makefile.in: Regenerate.
4216
e1df38aa
NC
42172010-06-09 Nick Clifton <nickc@redhat.com>
4218
4219 * yyscript.y (input_list_element): Allow strings prefixed with
4220 the '-' character. Treat these as libraries.
4221 * script.cc (script_add_library): New function. Adds a library
4222 specified by "-l<name>" found in an input script.
4223 * script-c.h: Add prototype for script_add_library.
4224
25bbe950
DK
42252010-06-07 Doug Kwan <dougkwan@google.com>
4226
4227 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4228 Restrict stub-group size to be within long conditional branch
4229 range when working around cortex-A8 erratum.
4230
0f32ea4c
ILT
42312010-06-07 Damien Diederen <dd@crosstwine.com>
4232
4233 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4234 #ifdef typo.
4235
8fe2a369
ST
42362010-06-03 Sriraman Tallam <tmsriram@google.com>
4237
4238 PR gold/11658
4239 * output.cc
4240 (Output_section::Input_section_sort_entry::compare_section_ordering):
4241 Change to return non-zero correctly.
4242 (Output_section::Input_section_sort_section_order_index_compare
4243 ::operator()): Change to fix ambiguity in comparisons.
4244
6e9ba2ca
ST
42452010-06-01 Sriraman Tallam <tmsriram@google.com>
4246
4247 * gold.h (is_wildcard_string): New function.
4248 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4249 (Layout::layout_eh_frame): Ditto.
4250 (Layout::find_section_order_index): New method.
4251 (Layout::read_layout_from_file): New method.
4252 * layout.h (Layout::find_section_order_index): New method.
4253 (Layout::read_layout_from_file): New method.
4254 (Layout::input_section_position_): New private member.
4255 (Layout::input_section_glob_): New private member.
4256 * main.cc (main): Call read_layout_from_file here.
4257 * options.h (--section-ordering-file): New option.
4258 * output.cc (Output_section::input_section_order_specified_): New
4259 member.
4260 (Output_section::Output_section): Initialize new member.
4261 (Output_section::add_input_section): Add new parameter.
4262 Keep input sections when --section-ordering-file is used.
4263 (Output_section::set_final_data_size): Sort input sections when
4264 section ordering file is specified.
4265 (Output_section::Input_section_sort_entry): Add new parameter.
4266 Check sorting type.
4267 (Output_section::Input_section_sort_entry::compare_section_ordering):
4268 New method.
4269 (Output_section::Input_section_sort_compare::operator()): Change to
4270 consider section_order_index.
4271 (Output_section::Input_section_sort_init_fini_compare::operator()):
4272 Change to consider section_order_index.
4273 (Output_section::Input_section_sort_section_order_index_compare
4274 ::operator()): New method.
4275 (Output_section::sort_attached_input_sections): Change to sort
4276 according to section order when specified.
e1df38aa
NC
4277 (Output_section::add_input_section<32, true>): Add new parameter.
4278 (Output_section::add_input_section<64, true>): Add new parameter.
4279 (Output_section::add_input_section<32, false>): Add new parameter.
4280 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
4281 * output.h (Output_section::add_input_section): Add new parameter.
4282 (Output_section::input_section_order_specified): New
4283 method.
4284 (Output_section::set_input_section_order_specified): New method.
4285 (Input_section::Input_section): Initialize section_order_index_.
4286 (Input_section::section_order_index): New method.
4287 (Input_section::set_section_order_index): New method.
4288 (Input_section::section_order_index_): New member.
4289 (Input_section::Input_section_sort_section_order_index_compare): New
4290 struct.
4291 (Output_section::input_section_order_specified_): New member.
4292 * script-sections.cc (is_wildcard_string): Delete and move modified
4293 method to gold.h.
4294 (Output_section_element_input::Output_section_element_input): Modify
4295 call to is_wildcard_string.
4296 (Output_section_element_input::Input_section_pattern
4297 ::Input_section_pattern): Ditto.
4298 (Output_section_element_input::Output_section_element_input): Ditto.
4299 * testsuite/Makefile.am (final_layout): New test case.
4300 * testsuite/Makefile.in: Regenerate.
4301 * testsuite/final_layout.cc: New file.
4302 * testsuite/final_layout.sh: New file.
4303
3537c84b
RÁE
43042010-06-01 Rafael Espindola <espindola@google.com>
4305
4306 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4307
105b6afd
RÁE
43082010-06-01 Rafael Espindola <espindola@google.com>
4309
4310 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4311 visibility of symbols.
4312
29e11421
DK
43132010-05-27 Doug Kwan <dougkwan@google.com>
4314
4315 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4316 from start of output section instead of address for a local symbol
4317 in a merged or relaxed section when doing a relocatable link.
4318
5e0f337e
RÁE
43192010-05-26 Rafael Espindola <espindola@google.com>
4320
4321 PR 11604
4322 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4323 adding sections the garbage collector removed.
4324 * gold/testsuite/Makefile.am: Add test.
4325 * gold/testsuite/Makefile.in: Regenerate.
4326 * gold/testsuite/plugin_test_7.sh: New.
4327 * gold/testsuite/plugin_test_7_1.c: New.
4328 * gold/testsuite/plugin_test_7_2.c: New.
4329
f4187277
RÁE
43302010-05-26 Rafael Espindola <espindola@google.com>
4331
4332 * script-sections.cc (Output_section_definition::set_section_addresses):
4333 Check for --section-start.
4334
5c388529
DK
43352010-05-26 Doug Kwan <dougkwan@google.com>
4336
4337 * arm.cc (Arm_scan_relocatable_relocs): New class.
4338 (Target_arm::relocate_special_relocatable): New method.
4339 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4340 (Arm_relocate_functions::thumb_branch_common): Same.
4341 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4342 instead of Default_scan_relocatable_relocs.
4343 * target-reloc.h (relocate_for_relocatable): Let target handle
4344 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4345 * target.h (Sized_target::relocate_special_relocatable): New method.
4346
bca1c3ae
ILT
43472010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4348
4349 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4350
0439c796
DK
43512010-05-23 Doug Kwan <dougkwan@google.com>
4352
4353 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4354 instead of a cast.
4355 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4356 with a direct branch, not a conditional branch, to a stub.
4357 * merge.cc (Output_merge_base::record_input_section): New method
4358 defintion.
4359 (Output_merge_data::do_add_input_section): Record input section if
4360 keeps-input-sections flag is set.
4361 (Output_merge_string::do_add_input_section): Ditto.
4362 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4363 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4364 INPUT_SECTIONS_.
4365 (Output_merge_base::keeps_input_sections,
4366 Output_merge_base::set_keeps_input_sections,
4367 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4368 method definitions.
4369 (Output_merge_base::Input_sections): New type declaration.
4370 (Output_merge_base::input_sections_begin,
4371 Output_merge_base::input_sections_end,
4372 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4373 (Output_merge_base::bool keeps_input_sections_,
4374 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4375 Output_merge_base::input_sections_): New data members.
4376 (Output_merge_data::do_set_keeps_input_sections): New method
4377 defintion.
4378 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4379 * output.cc (Output_section::Input_section::relobj): Move method
4380 defintion from class declaration to here and handle merge sections.
4381 (Output_section::Input_section::shndx): Ditto.
4382 (Output_section::Output_section): Remove initializations of removed
4383 data members and initialize new data member LOOKUP_MAPS_.
4384 (Output_section::add_input_section): Set keeps-input-sections flag
4385 for a newly created merge output section as appropriate. Adjust code
4386 to use Output_section_lookup_maps class.
4387 (Output_section::add_relaxed_input_section): Adjst code for lookup
4388 maps code refactoring.
4389 (Output_section::add_merge_input_section): Add a new parameter
4390 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4391 class. If adding input section to a newly created merge output
4392 section fails, remove the new merge section.
4393 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 4394 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
4395 (Output_section::find_merge_section): Ditto.
4396 (Output_section::build_lookup_maps): New method defintion.
4397 (Output_section::find_relaxed_input_section): Adjust code to use
4398 Output_section_lookup_maps class.
4399 (Output_section::get_input_sections): Export merge sections. Adjust
4400 code to use Output_section_lookup_maps class.
4401 (Output_section:::add_script_input_section): Adjust code to use
4402 Output_section_lookup_maps class. Update lookup maps for merge
4403 sections also.
4404 (Output_section::discard_states): Use Output_section_lookup_maps.
4405 (Output_section::restore_states): Same.
4406 * output.h (Merge_section_properties): Move class defintion out of
4407 Output_section.
4408 (Output_section_lookup_maps): New class.
4409 (Output_section::Input_section::is_merge_section): New method
4410 defintion.
4411 (Output_section::Input_section::relobj): Move defintion out of class
4412 defintion. Declare method only.
4413 (Output_section::Input_section::shndx): Ditto.
4414 (Output_section::Input_section::output_merge_base): New method defintion.
4415 (Output_section::Input_section::u2_.pomb): New union field.
4416 (Output_section::Merge_section_by_properties_map,
4417 Output_section::Output_section_data_by_input_section_map,
4418 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4419 Remove types.
4420 (Output_section::add_merge_input_section): Add new parameter
4421 KEEPS_INPUT_SECTIONS.
4422 (Output_section::build_lookup_maps): New method declaration.
4423 (Output_section::merge_section_map_,
4424 Output_section::merge_section_by_properties_map_,
4425 Output_section::relaxed_input_section_map_,
4426 Output_section::is_relaxed_input_section_map_valid_): Remove data
4427 members.
4428 (Output_section::lookup_maps_): New data member.
4429
76295588
L
44302010-05-21 Doug Kwan <dougkwan@google.com>
4431
4432 PR gold/11619
4433 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4434 avoid a compilation error.
4435
d103a984
RÁE
44362010-05-19 Rafael Espindola <espindola@google.com>
4437
4438 * script-sections.cc (Output_section_definition::allocate_to_segment):
4439 Update the phdrs_list even when the output section is NULL.
4440 * testsuite/Makefile.am: Add test.
4441 * testsuite/Makefile.in: Regenerate.
4442 * testsuite/script_test_9.cc: New.
4443 * testsuite/script_test_9.sh: New.
4444 * testsuite/script_test_9.t: New.
4445
6625d24e
DK
44462010-05-19 Doug Kwan <dougkwan@google.com>
4447
4448 * arm.cc (Arm_input_section::original_size): New method.
4449 (Arm_input_section::do_addralign): Add a cast.
4450 (Arm_input_section::do_output_offset): Remove static cast.
4451 (Arm_input_section::original_addralign,
4452 Arm_input_section::original_size_): Change type to uint32_t.
4453 (Arm_input_section::init): Add safe casts for section alignment
4454 and size.
4455 (Arm_input_section::set_final_data_size): Do not set address and
4456 offset of stub table.
4457 (Arm_output_section::fix_exidx_coverage): Change use of of
4458 Output_section::Simple_input_section to that of
4459 Output_section::Input_section.
4460 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4461 except for the first pass.
4462 * output.cc (Output_section::get_input_sections): Change type of
4463 input_sections to std::list<Input_section>.
4464 (Output_section::add_script_input_section): Rename from
4465 Output_section::add_simple_input_section. Change type of SIS
4466 parameter from Simple_input_section to Input_section.
4467 * output.h (Output_section::Simple_input_section): Remove class.
4468 (Output_section::Input_section): Change class visibility to public.
4469 (Output_section::Input_section::addralign): Use stored alignments
4470 for special input sections if set.
4471 (Output_section::Input_section::set_addralign): New method.
4472 (Output_section::get_input_sections): Change parameter type from
4473 list of Simple_input_section to list of Input_section.
4474 (Output_section::add_script_input_section): Rename from
4475 Output_section::add_simple_input_section. Change first parameter's
4476 type from Simple_input_section to Input_section and remove the
4477 second and third parameters.
4478 * script-sections.cc (Input_section::Input_section_list): Change
4479 type to list of Output_section::Input_section/
4480 (Input_section_info::Input_section_info): Change parameter type of
4481 INPUT_SECTION to Output_section::Input_section.
4482 (Input_section_info::input_section): Change return type.
4483 (Input_section_info::input_section_): Change type to
4484 Output_section::Input_section.
4485 (Output_section_element_input::set_section_addresses): Adjust code
4486 to use Output_section::Input_section instead of
4487 Output_section::Simple_input_section. Adjust code for renaming
4488 of Output_section::add_simple_input_section.
4489 (Orphan_output_section::set_section_addresses): Ditto.
4490
e1e82ea4
RW
44912010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4492
4493 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4494 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4495
91e75c8a
RÁE
44962010-05-18 Rafael Espindola <espindola@google.com>
4497
4498 * options.cc (General_options::finalize): Handle -nostdlib.
4499 * options.h (nostdlib): New option.
4500 * script.cc (script_add_search_dir): Handle -nostdlib.
4501
da59ad79
DK
45022010-05-12 Doug Kwan <dougkwan@google.com>
4503
4504 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4505 attributes section only if there no attributes section after merging.
4506 (Target_arm::merge_object_attributes): Move value of
e1df38aa 4507 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
4508 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4509 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4510 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4511 and arm_attr_merge_7.stdout.
4512 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4513 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4514 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4515 arm_attr_merge_7b.o): New rules.
4516 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4517 arm_attr_merge_7
4518 * testsuite/Makefile.in: Regenerate.
4519 * testsuite/arm_attr_merge.sh: New file.
4520 * testsuite/arm_attr_merge_[67][ab].s: Same.
4521
3e01a7fd
NC
45222010-05-05 Nick Clifton <nickc@redhat.com>
4523
4524 * po/es.po: Updated Spanish translation.
4525
7ad2014a
L
45262010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4527
4528 * Makefile.am (install-exec-local): Properly install gold as
4529 default cross linker.
4530 * Makefile.in: Regenerated.
4531
4fda8867
NC
45322010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4533 Nick Clifton <nickc@redhat.com>
4534
4535 * configure.ac (install_as_default): Define and set to false
4536 unless --enable-gold or --enable-gold=both/gold has been
4537 specified.
4538 * configure: Regenerate.
4539
4540 * Makefile.am (install-exec-local): Install the executable as
4541 'ld.gold'. If install_as_default is true then also install it as
4542 'ld'.
4543 * Makefile.in: Regenerated.
4544
bd288ea2
ILT
45452010-04-24 Ian Lance Taylor <iant@google.com>
4546
4547 * layout.cc (Layout::layout_reloc): In relocatable link don't
4548 combine reloc sections for grouped sections.
4549
ef38fd8a
ST
45502010-04-23 Sriraman Tallam <tmsriram@google.com>
4551
4552 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4553 sections that are not ordinary to icf.
4554 * icf.cc (get_section_contents): Handle relocation pointing to section
4555 with no object or shndx information.
4556 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4557 * testsuite/Makefile.in: Regenerate.
4558 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4559 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4560
f6973bdc
ILT
45612010-04-22 Ian Lance Taylor <iant@google.com>
4562
4563 * expression.cc (Expression::Expression_eval_info): Add
4564 result_alignment_pointer field.
4565 (Expression::eval_with_dot): Add result_alignment_pointer
4566 parameter. Change all callers.
4567 (Expression::eval_maybe_dot): Likewise.
4568 (class Binary_expression): Add alignment_pointer parameter to
4569 left_value and right_value. Change all callers.
4570 (BINARY_EXPRESSION): Set result alignment.
4571 (class Trinary_expression): Add alignment_pointer parameter to
4572 arg2_value and arg3_value. Change all callers.
4573 (Trinary_cond::value): Set result alignment.
4574 (Max_expression::value, Min_expression::value): Likewise.
4575 (Align_expression::value): Likewise.
4576 * script-sections.cc (class Sections_element): Add dot_alignment
4577 parameter to set_section_addresses virtual function. Update
4578 instantiations.
4579 (class Output_section_element): Likewise.
4580 (Script_sections::create_segments): Add dot_alignment parameter.
4581 Change all callers.
4582 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4583 (Script_sections::set_phdrs_clause_addresses): Likewise.
4584 * script-sections.h: Update declarations.
4585 * script.h: Update declarations.
4586 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4587 min_p_align.
4588 * testsuite/script_test_3.t: Set large alignment.
4589 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4590 segment has expected alignment.
4591
9c9c98a5
NC
45922010-04-22 Nick Clifton <nickc@redhat.com>
4593
4594 * po/gold.pot: Updated by the Translation project.
4595 * po/vi.po: Updated Vietnamese translation.
4596
2253bfba
L
45972010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4598
4599 * testsuite/Makefile.am (check_PROGRAMS): Add
4600 icf_virtual_function_folding_test.
4601 * testsuite/Makefile.in: Regenerated.
4602
85fdf906
AH
46032010-04-15 Andrew Haley <aph@redhat.com>
4604
4605 * options.h (merge_exidx_entries): New option.
4606 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4607 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4608 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4609 (Target_arm::merge_exidx_entries): New function.
4610 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4611 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4612 to Arm_exidx_fixup constructor.
4613 Add new arg, merge_exidx_entries.
4614 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4615 Arm_output_section::fix_exidx_coverage.
4616
ce97fa81
ST
46172010-04-18 Sriraman Tallam <tmsriram@google.com>
4618
4619 * icf.cc (get_section_contents): Check for preemptible functions.
4620 Ignore addend when appropriate.
4621 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4622 section folded.
4623 (add_from_relobj): Check for section folded.
4624 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4625 * symtab.h (should_add_dynsym_entry): Add new parameter.
4626 * target-reloc.h (scan_relocs): Check for section folded.
4627 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4628 Check reloc types for function pointers in shared objects.
4629 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4630 case.
4631 (icf_preemptible_functions_test): New test case.
4632 (icf_string_merge_test): New test case.
4633 * testsuite.Makefile.in: Regenerate.
4634 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4635 bar_glob. Refactor code.
4636 * testsuite/icf_preemptible_functions_test.cc: New file.
4637 * testsuite/icf_preemptible_functions_test.sh: New file.
4638 * testsuite/icf_string_merge_test.cc: New file.
4639 * testsuite/icf_string_merge_test.sh: New file.
4640 * testsuite/icf_virtual_function_folding_test.cc: New file.
4641 * testsuite/icf_virtual_function_folding_test.sh: New file.
4642
04ceb17c
DK
46432010-04-14 Doug Kwan <dougkwan@google.com>
4644
4645 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4646 for local symbol recounting if we remove a section due to ICF.
4647 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4648 there are no regular objects in input.
4649
153e7da4
DK
46502010-04-13 Doug Kwan <dougkwan@google.com>
4651
4652 * arm.cc (Arm_input_section::set_final_data_size): Compute
4653 accurate final data size instead of using current data size.
4654
4dbd9faf
DK
46552010-04-09 Doug Kwan <dougkwan@google.com>
4656
4657 * layout.cc (Layout::choose_output_section): Handle script section
4658 types.
4659 (Layout::make_output_section_for_script): Add section type parameter.
4660 Handle script section types.
4661 * layout.h (Layout::make_output_section_for_script): Add section
4662 type parameter.
4663 * output.cc (Output_section::Output_section): Initialize data member
4664 is_noload_.
4665 (Output_section::do_reset_address_and_file_offset): Do not set address
4666 to 0 if section is a NOLOAD section.
4667 * output.h (Output_section::is_noload): New method.
4668 (Output_section::set_is_noload): Ditto.
4669 (Output_section::is_noload_): New data member.
4670 * script-c.h (Script_section_type): New enum type.
4671 (struct Parser_output_section_header): Add new file section_type.
4672 * script-sections.cc (Sections_element::output_section_name): Add
4673 parameter for returning script section type.
4674 (Output_section_definition::output_section_name): Ditto.
4675 (Output_section_definition::section_type)P; New method.
4676 (Output_section_definiton::script_section_type_name): Ditto.
4677 (Output_section_definition::script_section_type_): New data member.
4678 (Output_section_definition::Output_section_definition): Initialize
4679 data member Output_section_definition::script_section_type_.
4680 (Output_section_definition::create_sections): Pass script section type
4681 to Layout::make_output_section_for_script.
4682 (Output_section_definition::output_section_name): Return script
4683 section type to caller.
4684 (Output_section_definition::set_section_address): Do not advance
4685 dot value and load address if section type is NOLOAD. Set address
4686 of NOLOAD sections regardless of section flags.
4687 (Output_section_definition::print): Print section type if it is
4688 not SCRIPT_SECTION_TYPE_NONE.
4689 (Output_section_definition::section_type): New method.
4690 (Output_section_definition::script_section_type_name): Ditto.
4691 (Script_sections::output_section_name): Add new parameter
4692 PSECTION_TYPE for returning script section type. Pass it to
4693 section elements. Handle discard sections.
4694 (Sort_output_sections::operator()): Handle NOLOAD sections.
4695 * script-sections.h (Script_sections::Section_type): New enum type.
4696 (Script_sections::output_section_name): Add a new parameter for
4697 returning script section type.
4698 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4699 INFO and NOLOAD.
4700 * yyscript.y (union): Add new field SECTION_TYPE.
4701 (COPY, DSECT, INFO, NOLOAD): New tokens.
4702 (opt_address_and_section_type): Change type to output_section_header.
4703 (section_type): New non-terminal
4704 (section_header): Handle section type.
2253bfba 4705 (opt_address_and_section_type): Return section type value.
4dbd9faf 4706
721ea635
L
47072010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4708
4709 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4710 * testsuite/plugin_common_test_2.c (foo): Likewise.
4711
6bf924b0
DK
47122010-04-08 Doug Kwan <dougkwan@google.com>
4713
4714 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4715 Output_merge_data.
4716 * output.cc (Output_section::add_merge_input_section): Simplify
4717 code and return status of Output_merge_base::add_input_section.
e1df38aa 4718 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
4719 returns true.
4720
24af6f92
DK
47212010-04-07 Doug Kwan <dougkwan@google.com>
4722
4723 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4724 if section is marked as containing instructions but has no mapping
4725 symbols.
4726 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4727 correct section index.
4728 (Arm_relobj::find_linked_text_section): Ditto.
4729
00698fc5
CC
47302010-04-07 Cary Coutant <ccoutant@google.com>
4731
4732 * archive.cc (include_member): Destroy Read_symbols_data object before
4733 releasing file.
4734 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4735 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4736 (Read_symbols_data::~Read_symbols_data) New destructor.
4737 (Section_relocs::Section_relocs) New constructor.
4738 (Section_relocs::~Section_relocs) New destructor.
4739 (Read_relocs_data::Read_relocs_data) New constructor.
4740 (Read_relocs_data::~Read_relocs_data) New destructor.
4741 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4742 pointers to NULL after deleting.
4743
7296d933
DK
47442010-04-07 Doug Kwan <dougkwan@google.com>
4745
4746 * arm.cc: Replace "endianity" with "endianness" in comments.
4747 (Arm_exidx_cantunwind): Ditto.
4748 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4749 (Arm_relobj::merge_flags_and_attributes): New method.
4750 (Arm_relobj::merge_flags_and_attributes_): New data member.
4751 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4752 (Arm_relobj::scan_sections_for_stubs): Ditto.
4753 (Arm_relobj::do_read_symbols): Check to see if we really want to
4754 merge processor-specific flags and attributes. Exit early if
4755 an object is empty except for section names and the undefined symbol.
4756 (Target_arm::do_finalize_sections): Move check for ELF format to
4757 Arm_relobj::do_read_symbols. Merge processor specific flags and
4758 attributes from a regular object only when we have determined that
4759 it is aapropriate. Do not create an .ARM.attributes section in
4760 output if there is no regular input object.
4761 (Target_arm::merge_processor_specific_flags): Check
4762 --warn-mismatch before printing any error.
4763 (Target_arm::merge_object_attributes): Ditto.
4764 * gold.cc (queue_middle_tasks): Handle the case in which there is
4765 no regular object in input.
4766 * options.cc (General_options::parse_EB): New method.
4767 (General_options::parse_EL): Same.
4768 (General_options::General_options): Initialize endianness_.
4769 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4770 New options.
4771 (General_options::Endianness): New enum.
4772 (General_options::endianness): New method.
4773 (General_options::endianness_): New data member.
4774 * parameters.cc (Parameters::set_options): Check target endianness.
4775 (Parameters::set_target_once): Ditto.
4776 (Parameters::check_target_endianness): New method.
4777 (parameters_force_valid_target): If either -EL or -EB is specified,
4778 use it to define endianness of default target.
4779 * parameters.h (Parameters::check_target_endianness): New method
4780 declaration.
4781 * target.h (class Target): Change "endianity" to "endianness"
4782 in comments.
4783
efc8d4f2
RW
47842010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4785
4786 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4787 * configure: Regenerate.
4788 * Makefile.in: Regenerate.
4789 * testsuite/Makefile.in: Regenerate.
4790
be234d88
CC
47912010-04-06 Cary Coutant <ccoutant@google.com>
4792
4793 gcc PR lto/42757
4794 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4795 prevailing definitions of common symbols.
4796 * testsuite/plugin_test_6.sh: New test case.
4797 * testsuite/plugin_common_test_1.c: New test case.
4798 * testsuite/plugin_common_test_2.c: New test case.
4799 * testsuite/Makefile.am (plugin_test_6): New test case.
4800 * testsuite/Makefile.in: Regenerate.
4801
bd32c6bd
NC
48022010-04-06 Nick Clifton <nickc@redhat.com>
4803
4804 * po/vi.po: New Vietnamese translation.
4805
323c532f
DK
48062010-03-30 Doug Kwan <dougkwan@google.com>
4807
4808 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4809
4fcd97eb
DK
48102010-03-25 Doug Kwan <dougkwan@google.com>
4811
4812 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4813 to avoid a conversion warning on a 32-bit host.
4814
4ebf39db
ILT
48152010-03-24 Ian Lance Taylor <iant@google.com>
4816
4817 * testsuite/script_test_3.t: Add a TLS segment.
4818 * testsuite/Makefile.am (check_PROGRAMS): Add
4819 tls_phdrs_script_test.
4820 (tls_phdrs_script_test_SOURCES): Define.
4821 (tls_phdrs_script_test_DEPENDENCIES): Define.
4822 (tls_phdrs_script_test_LDFLAGS): Define.
4823 (tls_phdrs_script_test_LDADD): Define.
4824 * testsuite/Makefile.in: Rebuild.
4825
4a599bdd
CC
48262010-03-23 Cary Coutant <ccoutant@google.com>
4827
4828 * fileread.cc (find_or_make_view): Fix comment.
4829
6c93b22c
ILT
48302010-03-23 Ian Lance Taylor <iant@google.com>
4831
4832 * script-sections.cc (class Orphan_section_placement): Define
4833 PLACE_TLS and PLACE_TLS_BSS.
4834 (Orphan_section_placement::Orphan_section_placement): Initialize
4835 new places.
4836 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4837 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4838 (tls_script_test_SOURCES): Define.
4839 (tls_script_test_DEPENDENCIES): Define.
4840 (tls_script_test_LDFLAGS): Define.
4841 (tls_script_test_LDADD): Define.
4842 * testsuite/Makefile.in: Rebuild.
4843
a2c7281b
DK
48442010-03-22 Doug Kwan <dougkwan@google.com>
4845
4846 * arm.cc (Arm_relocate_functions::abs8,
4847 Arm_relocate_functions::abs16): Use correct check for overflow
4848 specified in the ARM ELF specs.
4849 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4850 target of a BLX instruction specially.
4851 (Reloc_stub::stub_type_for_reloc): Ditto.
4852 (Relocate::relocate): Use symbolic names instead of numeric relocation
4853 codes to report error.
4854 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4855 workaround.
4856 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4857 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4858 thumb2_blx_out_of_range.stdout
4859 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4860 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4861 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4862 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4863 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4864 thumb2_blx_in_range, thumb2_blx_in_range.o,
4865 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4866 thumb2_blx_out_of_range.o): New rules.
4867 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4868 thumb2_blx_in_range and thumb2_blx_out_of_range.
4869 * testsuite/Makefile.in: Regenerate.
4870 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4871 * testsuite/thumb_blx_in_range.s: New file.
4872 * testsuite/thumb_blx_out_of_range.s: New file.
4873
b0193076
RÁE
48742010-03-22 Rafael Espindola <espindola@google.com>
4875
4876 * archive.cc (Should_include): Move to archive.h.
4877 (should_include_member): Make it a member of Archive.
4878 (Lib_group): New.
4879 (Add_lib_group_symbols): New.
4880 * archive.h: Include options.h.
4881 (Archive_member): Moved from Archive.
4882 (Should_include): Moved from archive.cc.
4883 (Lib_group): New.
4884 (Add_lib_group_symbols): New.
4885 * dynobj.cc (do_should_include_member): New.
4886 * dynobj.h (do_should_include_member): New.
4887 * gold.cc (queue_initial_tasks): Update call to queue.
4888 * main.cc (main): Print lib group stats.
4889 * object.cc (do_should_include_member): New.
4890 * object.h: Include archive.h.
4891 (Object::should_include_member): New.
4892 (Object::do_should_include_member): New.
4893 (Sized_relobj::do_should_include_member): New.
4894 * options.cc (General_options::parse_start_lib): New.
4895 (General_options::parse_end_lib): New.
4896 (Input_arguments::add_file): Handle lib groups.
4897 (Input_arguments::start_group): Check we are not in a lib.
4898 (Input_arguments::start_lib): New.
4899 (Input_arguments::end_lib): New.
4900 * options.h (General_options): Add start_lib and end_lib.
4901 (Input_argument::lib_): New.
4902 (Input_argument::lib): New.
4903 (Input_argument::is_lib): New.
4904 (Input_file_lib): New.
4905 (Input_arguments::in_lib_): New.
4906 (Input_arguments::in_lib): New.
4907 (Input_arguments::start_lib): New.
4908 (Input_arguments::end_lib_): New.
4909 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4910 in unused members as preempted.
4911 (Sized_pluginobj::do_should_include_member): New.
4912 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4913 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4914 return the blocker.
4915 (Read_symbols::do_whole_lib_group): New.
4916 (Read_symbols::do_lib_group): New.
4917 (Read_symbols::do_read_symbols): Handle lib groups.
4918 (Read_symbols::get_name): Handle lib groups.
4919 * readsyms.h (Read_symbols): Add an archive member pointer.
4920 (Read_symbols::do_whole_lib_group): New.
4921 (Read_symbols::do_lib_group): New.
4922 (Read_symbols::member_): New.
4923 * script.cc (read_input_script): Update call to queue_soon.
4924
d099120c
DK
49252010-03-19 Doug Kwan <dougkwan@google.com>
4926
4927 * arm.cc (Stub_table::Stub_table): Initialize new data members
4928 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4929 (Stub_table::add_reloc_stub): Assign stub offset and update
4930 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4931 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4932 New data members.
4933 (Stub_table::update_data_size_and_addralign): Use
4934 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4935 instead of going over all reloc stubs.
4936 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4937 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4938 Stringpool_template::offset_ to size of Stringpool_char.
4939 (Stringpool_template::new_key_offset): Remove code to initialize
4940 Stringpool_template::offset_.
4941 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4942 Stringpool_template::offset_ to zero.
4943
1aa37384
DK
49442010-03-15 Doug Kwan <dougkwan@google.com>
4945
4946 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4947 offset_.
4948 (Stringpool_template::new_key_offset): New method.
4949 (Stringpool_template::add_string): Assign offsets when adding new
4950 strings.
4951 (Stringpool_template::set_string_offsets): Do not set string offsets
4952 when not optimizing.
4953 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4954 member size_.
4955 (Chunked_vector::clear): Clear size_.
4956 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4957 (Chunked_vector::size): Return size_.
4958 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 4959 (Chunked_vector::size_): New data member.
1aa37384
DK
4960 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4961 (Stringpool_template::new_key_offset): New method declaration.
4962 (Stringpool_template::offset_): New data member.
4963
b672b057
RÁE
49642010-03-15 Rafael Espindola <espindola@google.com>
4965
4966 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4967 Add_symbols' constructor.
4968 * readsyms.h (Add_symbols): Remove the input_group member.
4969
b6848d3c
ILT
49702010-03-10 Ian Lance Taylor <iant@google.com>
4971
4972 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4973 target to ask whether a reference to a symbol requires a stack
4974 split.
4975 * target.h (Target::is_call_to_non_split): New function.
4976 (Target::do_is_call_to_non_split): Declare virtual function.
4977 * target.cc: Include "symtab.h".
4978 (Target::do_is_call_to_non_split): New function.
4979 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4980
a2a5469e
CC
49812010-03-10 Cary Coutant <ccoutant@google.com>
4982
4983 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4984 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4985 (File_read::open[2]): Add whole_file_view_ to list of views.
4986 (File_read::make_view): Remove test of whole_file_view_.
4987 (File_read::find_or_make_view): Create whole_file_view_ if
4988 necessary.
4989 (File_read::clear_views): Replace bool parameter with enum;
4990 adjust all callers. Don't delete views with permanent data;
4991 do delete cached views and views from archives if
4992 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4993 if clearing the corresponding view.
4994 * fileread.h (File_read::Clear_views_mode): New enum.
4995 (File_read::View::is_permanent_view): New method.
4996 (File_read::clear_views): Replace bool parameter
4997 with enum; adjust all callers.
4998 * options.h (General_options): Change keep_files_mapped option;
4999 add map_whole_files.
5000 * readsyms.cc (Add_symbols::run): Delete sd_ object before
5001 releasing the file.
5002 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5003 the file.
5004
8861f32b
DM
50052010-03-10 David S. Miller <davem@davemloft.net>
5006
5007 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5008
d62d0f5f
ST
50092010-03-09 Sriraman Tallam <tmsriram@google.com>
5010
5011 * icf.cc (get_section_contents): Add '@' marker after processing the
5012 merge reloc.
5013
9177756d
DK
50142010-03-08 Doug Kwan <dougkwan@google.com>
5015
5016 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5017 due to a conversion warning.
5018 (Arm_relobj::update_output_local_symbol_count): Check for local
5019 symbol with unset output index.
5020
9e9e071b
ILT
50212010-03-05 Ian Lance Taylor <iant@google.com>
5022
5023 * options.h (class General_options): Add --spare-dynamic-tags.
5024 * output.cc (Output_data_dynamic::set_final_data_size): Implement
5025 --spare-dynamic-tags.
5026
a81ee015
ILT
50272010-03-05 Ian Lance Taylor <iant@google.com>
5028
5029 * incremental.cc: Include "libiberty.h".
5030
44ec90b9
RO
50312010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
5032
5033 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5034 function, is_info_ member.
5035 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5036 (Versions::Versions): Update caller.
5037 (Versions::define_base_version): Likewise.
5038 (Versions::add_def): Likewise.
5039
0897ed3b
ST
50402010-03-03 Sriraman Tallam <tmsriram@google.com>
5041
5042 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5043 (Scan::possible_function_pointer_reloc): New function.
5044 (Scan::local_reloc_may_be_function_pointer): Change to call
5045 possible_function_pointer_reloc.
5046 (Scan::global_reloc_may_be_function_pointer): Ditto.
5047 * icf.h (Icf::check_section_for_function_pointers): Change to reject
5048 relocations in ".data.rel.ro._ZTV" section.
5049 * testsuite/icf_safe_so_test.sh: Change to pass i386.
5050 * testsuite/icf_safe_so_test.cc: Ditto.
5051 * testsuite/icf_safe_test.cc: Ditto.
5052 * testsuite/icf_safe_test.sh: Ditto.
5053
d3bbad62
ILT
50542010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5055 Ian Lance Taylor <iant@google.com>
5056
5057 * target-reloc.h (relocate_section): Check the symbol table index
5058 for -1U before setting the local symbol index.
5059 (scan_relocatable_relocs): If copying the relocation, record that
5060 the local symbol is required.
5061 * object.h (Symbol_value::is_output_symtab_index_set): New
5062 function.
5063 (Symbol_value::may_be_discarded_from_output_symtab): New
5064 function.
5065 (Symbol_value::has_output_symtab_entry): New function.
5066 (Symbol_value::needs_output_symtab_entry): Remove.
5067 (Symbol_value::output_symtab_index): Make sure the symbol index is
5068 set.
5069 (Symbol_value::set_output_symtab_index): Make sure the symbol
5070 index is not set. Make sure the new index is valid.
5071 (Symbol_value::set_must_have_output_symtab_entry): New function.
5072 (Symbol_value::has_output_dynsym_entry): New function.
5073 (Symbol_value::set_output_dynsym_index): Make sure the new index
5074 is valid.
5075 (Sized_relobj::set_must_have_output_symtab_entry): New function.
5076 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5077 local symbol if permitted.
5078 (Sized_relobj::do_finalize_local_symbols): Call
5079 is_output_symtab_index_set rather than needs_output_symtab_entry.
5080 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5081 rather than needs_output_symtab_entry. Call
5082 has_output_dynsym_entry rather than needs_output_dynsym_entry.
5083 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5084 is_output_symtab_index_set rather than needs_output_symtab_entry.
5085 * testsuite/discard_locals_relocatable_test.c: New file.
5086 * testsuite/discard_locals_test.sh: Test -r.
5087 * testsuite/Makefile.am (check_DATA): Add
5088 discard_locals_relocatable_test1.syms,
5089 discard_local_relocatable_test2.syms.
5090 (MOSTLYCLEANFILES): Likewise. Also add
5091 discard_locals_relocatable_test1.lout and
5092 discard_locals_relocatable_test2.out.
5093 (discard_locals_relocatable_test1.syms): New target.
5094 (discard_locals_relocatable_test.o): New target.
5095 (discard_locals_relocatable_test1.out): New target.
5096 (discard_locals_relocatable_test2.syms): New target.
5097 (discard_locals_relocatable_test2.out): New target.
5098 (various): Add missing ../ld-new dependencies.
5099 * testsuite/Makefile.in: Rebuild.
5100
7e8ccf26
NC
51012010-03-03 Nick Clifton <nickc@redhat.com>
5102
5103 * po/fi.po: New Finnish translation.
5104
2a0ff005
DK
51052010-03-01 Doug Kwan <dougkwan@google.com>
5106
5107 * layout.cc (Layout::Layout): Force section types of .init_array*,
5108 .preinit_array* and .fini_array* sections.
5109 * output.cc (Output_section::Input_section_sort_entry::has_priority):
5110 Fix check of return value of std::string::find.().
5111 (Output_section::Input_section_sort_compare::operator()): Remove
5112 comment about .init_array.
5113 (Output_section::Input_section_sort_init_fini_compare::operator()):
5114 New method.
5115 (Output_section::sort_attached_input_sections): Handle .init_array
5116 and .fini_array specially.
5117 * output.h (Output_section::Inut_section_sort_compare): Update
5118 comment.
5119 (Output_section::Input_section_sort_init_fini_compare): New struct.
5120
c3e4ae29
DK
51212010-02-26 Doug Kwan <dougkwan@google.com>
5122
5123 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
5124 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
5125 * testsuite/debug_msg.sh: Avoid matching source line number for
5126 use of global variable undef_int.
5127
2fd9ae7a
DK
51282010-02-26 Doug Kwan <dougkwan@google.com>
5129
5130 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
5131 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
5132 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
5133 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
5134 * options.cc (General_options::General_options): Initialize member
5135 fix_v4bx_.
5136 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
5137 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
5138 and rm_no_fix_v4bx.stdout
5139 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
5140 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
5141 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
5142 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
5143 and arm_no_fix_v4bx.
5144 * Makefile.in: Regenerate.
5145 * testsuite/arm_fix_v4bx.s: New file.
5146 * testsuite/arm_fix_v4bx.sh: Ditto.
5147
67ec7d0b
DK
51482010-02-24 Doug Kwan <dougkwan@google.com>
5149
5150 * arm.cc (Target_arm::got_section): Make the .got section the first
5151 non RELRO section in the data segment.
5152 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
5153 suffixes of section names.
5154
10165461
DK
51552010-02-24 Doug Kwan <dougkwan@google.com>
5156
5157 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
5158 flags and attributes merging if an input file is a binary file.
5159 * fileread.cc (Input_file::open): Record format of original file.
5160 * fileread.h (Input_file::Format): New enum type.
5161 (Input_file::Input_file): Initialize data member format_.
5162 (Input_file::format): New method definition.
5163 (Input_file::format_):: New data member.
5164
4a54abbb
DK
51652010-02-24 Doug Kwan <dougkwan@google.com>
5166
5167 * arm.cc (Arm_output_data_got): New class.
5168 (ARM_TCB_SIZE): New constant
5169 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
5170 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
5171 If user uses a script with a SECTIONS clause, issue only a warning
5172 for a misplaced EXIDX input section. Otherwise, issue an error.
5173 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
5174 garbage collection.
5175 (Target_arm::got_mode_index_entry): Handle static linking.
5176 (Target_arm::Scan::local): Ditto.
5177 (Target_arm::Scan::global): Ditto.
5178 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
5179 all incorrectly implemented relocations.
e1df38aa 5180 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
5181 Arm_output_section::fix_exidx_coverage.
5182 * layout.cc (Layout::section_name_mapping): Remove trailing dots
5183 from ".ARM.exidx." and ".ARM.extab.".
5184
ca419a6f
ILT
51852010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5186
5187 * arm.cc (Target_arm::do_finalize_sections): Create attribute
5188 section if it does not already exist.
5189 * attributes.cc (Attributes_section_data::Attributes_section_data):
5190 Don't crash if size is zero.
5191
135b9c78
ILT
51922010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5193 Ian Lance Taylor <iant@google.com>
5194
5195 * gold.cc (queue_middle_tasks): If no input files were opened,
5196 exit.
5197 * workqueue.h (Task_function::Task_function): Assert that there is
5198 a blocker.
5199
bb0bfe4f
DK
52002010-02-22 Doug Kwan <dougkwan@google.com>
5201
5202 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
5203 * icf.cc (get_section_contents): Cast snprintf arguments to long long
5204 types to avoid warnings due to different uint64_t implementations
5205 on different hosts.
5206
2a2b6d42
DK
52072010-02-21 Doug Kwan <dougkwan@google.com>
5208
5209 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
5210 handling of the maximum backward branch offset.
5211 (Arm_relocate_functions::thumb_branch_common): Ditto.
5212 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
5213 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 5214 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
5215 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5216 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5217 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5218 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5219 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5220 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5221 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5222 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5223 thumb2_bl_out_of_range.o): New rules.
5224 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5225 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5226 thumb2_bl_out_of_range
5227 * testsuite/Makefile.in: Regenerate.
5228 * testsuite/arm_bl_in_range.s: New file.
5229 * testsuite/arm_bl_out_of_range.s: Ditto.
5230 * testsuite/arm_branch_in_range.sh: Ditto.
5231 * testsuite/arm_branch_range.t: Ditto.
5232 * testsuite/thumb2_branch_range.t: Ditto.
5233 * testsuite/thumb_bl_in_range.s: Ditto.
5234 * testsuite/thumb_bl_out_of_range.s: Ditto.
5235 * testsuite/thumb_branch_range.t: Ditto.
5236
b487ad64
ST
52372010-02-20 Sriraman Tallam <tmsriram@google.com>
5238
5239 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5240 Add reloc offset information.
5241 * icf.cc (get_section_contents): Change iterators to point to the new
5242 vectors. Add reloc offset information to the contents.
5243 * icf.h (Icf::Sections_reachable_info): New typedef.
5244 (Icf::Sections_reachable_list): New typedef.
5245 (Icf::Offset_info): New typedef.
5246 (Icf::Reloc_info): New struct typedef.
5247 (Icf::Reloc_info_list): New typedef.
5248 (Icf::symbol_reloc_list): Delete method.
5249 (Icf::addend_reloc_list): Delete method.
5250 (Icf::section_reloc_list): Delete method.
5251 (Icf::reloc_info_list): New method.
5252 (Icf::reloc_info_list_): New member.
5253
f96accdf
DK
52542010-02-19 Doug Kwan <dougkwan@google.com>
5255
5256 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5257 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5258 * arm.cc (Arm_relocation_functions): New forward declaration.
5259 (Target_arm::Target_arm): Initialize new data members
5260 got_mod_index_offset_ and tls_base_symbol_defined_.
5261 (Target_arm::Relocate::relocate_tls): New method.
5262 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5263 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5264 New methods.
5265 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5266 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5267 (Target_arm::got_mod_index_offset_,
5268 Target_arm::tls_base_symbol_defined_): New data members.
5269 (Target_arm::Scan::local, Target::Scan::global,
5270 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5271 relocations.
5272
c8761b9a
DK
52732010-02-18 Doug Kwan <dougkwan@google.com>
5274
5275 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5276 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5277 text section as a parameter becuase some broken tools may not set
5278 the link in section header.
5279 (Target_arm::has_got_section): New method.
5280 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5281 without any mapping symbol as data only. Remove warning.
5282 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5283 link in its section header, try to discover the link by inspecting the
5284 REL31 relocation at the beginning of the section.
5285 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5286 in error message.
5287 (Target_arm::Scan::global): Treat any reference to the symbol
5288 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5289
21bb3914
ST
52902010-02-12 Sriraman Tallam <tmsriram@google.com>
5291
5292 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5293 (Scan::global_reloc_may_be_function_pointer): New function.
5294 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5295 (Scan::global_reloc_may_be_function_pointer): New function.
5296 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5297 (Scan::global_reloc_may_be_function_pointer): New function.
5298 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5299 (Scan::global_reloc_may_be_function_pointer): New function.
5300 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5301 (Scan::global_reloc_may_be_function_pointer): New function.
5302 (Scan::possible_function_pointer_reloc): New function.
5303 (Target_x86_64::can_check_for_function_pointers): New function.
5304 * gc.h (gc_process_relocs): Scan relocation types to determine if
5305 function pointers were taken for targets that support it.
5306 * icf.cc (Icf::find_identical_sections): Include functions for
5307 folding in safe ICF whose pointer is not taken.
5308 * icf.h (Secn_fptr_taken_set): New typedef.
5309 (fptr_section_id_): New member.
5310 (section_has_function_pointers): New function.
5311 (set_section_has_function_pointers): New function.
5312 (check_section_for_function_pointers): New function.
5313 * options.h: Fix comment for safe ICF option.
5314 * target.h (can_check_for_function_pointers): New function.
5315 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5316 Modify icf_safe_test for X86-64.
5317 * testsuite/Makefile.in: Regenerate.
5318 * testsuite/icf_safe_so_test.cc: New file.
5319 * testsuite/icf_safe_so_test.sh: New file.
5320 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5321 (main): Change to take pointer to function kept_func_3.
5322 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5323 folding is done correctly for X86-64.
5324
0da6fa6c
DM
53252010-02-12 David S. Miller <davem@davemloft.net>
5326
5327 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5328 is_symbolless parameter.
5329 (Output_reloc<SHT_REL>::is_symbolless): New.
5330 (Output_reloc<SHT_REL>::is_symbolless_): New.
5331 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5332 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5333 (Output_reloc<SHT_RELA>::is_symbolless): New.
5334 (Output_data_reloc::add_global): Handle is_symbolless.
5335 (Output_data_reloc::add_global_relative): Likewise.
5336 (Output_data_reloc::add_local): Likewise.
5337 (Output_data_reloc::add_local_relative): Likewise.
5338 (Output_data_reloc::add_symbolless_global_addend): New.
5339 (Output_data_reloc::add_symbolless_local_addend): New.
5340 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5341 is_symbolless.
5342 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5343 instead of ->is_relative_
5344 (Output_reloc::write): Likewise.
5345 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5346 (Output_reloc::write_rel): Simplify.
5347
5348 * sparc.cc (Target_sparc::Scan::local): Use
5349 ->add_symbolless_local_addend as needed.
5350 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5351 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5352 based upon relocation offset.
5353
e4782e83
DK
53542010-02-11 Doug Kwan <dougkwan@google.com>
5355
5356 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5357 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5358 beginning of function.
5359 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5360 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5361 parameter is_32bit in calls to should_apply_static_reloc.
5362 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5363 (check_DATA): Add arm_abs_global.stdout.
5364 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5365 arm_abs_global.stdout): New rules.
5366 (MOSTLLYCLEANFILES): Add arm_abs_global
5367 * Makefile.in: Regenerate.
5368 * testsuite/arm_abs_global.s: New file.
5369 * testsuite/arm_abs_global.sh: Ditto.
5370 * testsuite/arm_abs_lib.s: Ditto.
5371
93ceb764
ILT
53722010-02-11 Ian Lance Taylor <iant@google.com>
5373
5374 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5375 Read_relocs task.
5376 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5377 Allocate_commons_task first.
5378 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5379 task, rather than symtab_lock_.
5380 (Gc_process_relocs::~Gc_process_relocs): New function.
5381 (Gc_process_relocs::is_runnable): Check this_blocker_.
5382 (Gc_process_relocs::locks): Use next_blocker_ rather than
5383 blocker_.
5384 (Scan_relocs::~Scan_relocs): New function.
5385 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5386 symtab_lock_.
5387 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5388 next_blocker_.
5389 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5390 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5391 constructor accordingly.
5392 (class Gc_process_relocs): Likewise.
5393 (class Scan_relocs): Likewise.
5394 * common.h (class Allocate_commons_task): Remove symtab_lock_
5395 field, and corresponding constructor parameter.
5396 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5397 symtab_lock_.
5398 (Allocate_commons_task::locks): Likewise.
5399
114dfbe1
ILT
54002010-02-11 Ian Lance Taylor <iant@google.com>
5401
5402 * gold-threads.h (class Once): Define.
5403 (class Initialize_lock): Rewrite as child of Once.
5404 * gold-threads.cc (class Once_initialize): Define.
5405 (once_pointer_control): New static variable.
5406 (once_pointer, once_arg): New static variables.
5407 (c_run_once): New static function.
5408 (Once::Once, Once::run_once, Once::internal_run): New functions.
5409 (class Initialize_lock_once): Remove.
5410 (initialize_lock_control): Remove.
5411 (initialize_lock_pointer): Remove.
5412 (initialize_lock_once): Remove.
5413 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5414 (Initialize_lock::initialize): Rewrite.
5415 (Initialize_lock::do_run_once): New function.
5416 * archive.cc (Archive::interpret_header): Only clear name if it is
5417 not already empty.
5418 * fileread.cc: Include "gold-threads.h"
5419 (file_counts_lock): New static variable.
5420 (file_counts_initialize_lock): Likewise.
5421 (File_read::release): Only increment counts when using --stats.
5422 Use a lock around the increment.
5423 * parameters.cc (class Set_parameters_target_once): Define.
5424 (set_parameters_target_once): New static variable.
5425 (Parameters::Parameters): Move here from parameters.h.
5426 (Parameters::set_target): Rewrite.
5427 (Parameters::set_target_once): New function.
5428 (Parameters::clear_target): Move here and rewrite.
5429 * parameters.h (class Parameters): Update declarations. Add
5430 set_parameters_target_once_ field.
5431 (Parameters::Parameters): Move to parameters.cc.
5432 (Parameters::clear_target): Likewise.
5433 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5434 task.
5435 (Start_group::~Start_group): New function.
5436 (Start_group::is_runnable): New function.
5437 (Start_group::locks, Start_group::run): New functions.
5438 (Finish_group::run): Change saw_undefined to size_t.
5439 * readsyms.h (class Start_group): Define.
5440 (class Finish_group): Change saw_undefined_ field to size_t.
5441 (Finish_group::Finish_group): Remove saw_undefined and
5442 this_blocker parameters. Change all callers.
5443 (Finish_group::set_saw_undefined): New function.
5444 (Finish_group::set_blocker): New function.
5445 * symtab.h (class Symbol_table): Change saw_undefined to return
5446 size_t. Change saw_undefined_ field to size_t.
5447 * target-select.cc (Set_target_once::do_run_once): New function.
5448 (Target_selector::Target_selector): Initialize set_target_once_
5449 field. Don't initialize lock_ and initialize_lock_ fields.
5450 (Target_selector::instantiate_target): Rewrite.
5451 (Target_selector::set_target): New function.
5452 * target-select.h (class Set_target_once): Define.
5453 (class Target_selector): Update declarations. Make
5454 Set_target_once a friend. Remove lock_ and initialize_lock_
5455 fields. Add set_target_once_ field.
5456
fa17a3f4
ILT
54572010-02-10 Ian Lance Taylor <iant@google.com>
5458
5459 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5460 queueing any tasks.
5461 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5462 (queue_middle_tasks): Add all blockers before queueing any tasks.
5463 (queue_final_tasks): Likewise.
5464 * token.h (Task_token::add_blockers): New function.
5465 * object.h (Input_objects::number_of_relobjs): New function.
5466
c7177d31
ILT
54672010-02-10 Ian Lance Taylor <iant@google.com>
5468
5de0e392
ILT
5469 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5470 shared, not if not position independent.
5471 * x86_64.cc (Relocate::relocate_tls): Likewise.
5472 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5473 (tls_pie_pic_test): New target.
5474 * testsuite/Makefile.in: Rebuild.
5475
c7177d31
ILT
5476 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5477 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5478 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5479 * testsuite/Makefile.in: Rebuild.
5480
684b268a
DM
54812010-02-09 David S. Miller <davem@davemloft.net>
5482
5483 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5484 R_SPARC_RELATIVE using ->add_local_relative().
5485 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5486
612a8d3d
DM
5487 * output.h (Output_data_dynamic::add_section_size): New method
5488 that takes two Output_data objects.
5489 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5490 entry param. Handle it in initializers.
5491 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5492 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5493 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5494 arg.
5495 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5496 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5497 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5498 for dynrel_includes_plt.
5499 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5500 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5501 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5502 before .rela.plt
5503 (Target_sparc::do_finalize_sections): Update to pass true for
5504 dynrel_includes_plt.
5505 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5506 output before .rela.plt
5507 (Target_powerpc::do_finalize_sections): Update to pass true for
5508 dynrel_includes_plt when 32-bit.
5509
cb1be87e
DK
55102010-02-08 Doug Kwan <dougkwan@google.com>
5511
5512 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5513 method.
5514 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5515 Arm_relobj::scan_section_for_cortex_a8_stubs,
5516 Arm_relobj::do_relocation_section): Instead of calling
5517 Output_section::output_address, use faster
5518 Arm_relobj::simple_input_section_output_address.
5519
705b5121
DM
55202010-02-08 David S. Miller <davem@davemloft.net>
5521
5522 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5523 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5524 relocation helper function.
5525
024c4466
DM
5526 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5527 just like R_SPARC_GOT{10,13,22}.
5528 (Target_sparc::Scan::local): Likewise.
5529 (Target_sparc::Relocate:relocate): Likewise.
5530
9109c078
ILT
55312010-02-06 Ian Lance Taylor <iant@google.com>
5532
5533 * configure.ac: Rewrite targetobjs duplicate removal code to use
5534 only shell constructs.
5535 * configure: Rebuild.
5536
cf846138
DK
55372010-02-05 Doug Kwan <dougkwan@google.com>
5538
5539 PR 11247
5540 * arm.cc (Arm_relobj::section_is_scannable): New method.
5541 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5542 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5543
6cfaf60b
DK
55442010-02-04 Doug Kwan <dougkwan@google.com>
5545
5546 PR 11247
5547 * arm-reloc-property.cc (cstdio): Include.
5548 * configure.ac (targetobjs): Remove duplicates.
5549 * configure: Regenerate.
5550 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5551 big and little endian version for a given address size.
5552
5c57f1be
DK
55532010-02-03 Doug Kwan <dougkwan@google.com>
5554
5555 * arm-reloc-property.cc
5556 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5557 definition.
5558 * arm-reloc-property.h
5559 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5560 New method definition.
5561 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5562 declaration.
5563 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5564 overflow to N.
5565 (GOT_PREL): Change implemented to Y.
5566 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5567 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5568 (Arm_relocate_functions::movw_abs_nc): Remove method.
5569 (Arm_relocate_functions::movt_abs): Ditto.
5570 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5571 (Arm_relocate_functions::thm_movt_abs): Ditto.
5572 (Arm_relocate_functions::movw_rel_nc): Ditto.
5573 (Arm_relocate_functions::movw_rel): Ditto.
5574 (Arm_relocate_functions::movt_rel): Ditto.
5575 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5576 (Arm_relocate_functions:thm_movw_rel): Ditto.
5577 (Arm_relocate_functions:thm_movt_rel): Ditto.
5578 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5579 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5580 New method definitions.
5581 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5582 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5583 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5584 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5585 (Target_arm::Relocate::relocate): Check for non-static or
5586 unimplemented relocation code and exit early. Change calls to
5587 Target_arm::reloc_uses_thumb_bit and
5588 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5589 instead. Refactor code to handle similar relocations to increase
5590 code sharing. Remove check for unsupported relocation code in switch
5591 statement.
5592 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5593 relocation property table to find out size. Change error message to
5594 print out the name of a relocation code instead of the numeric value.
5595 (Target_arm::scan_reloc_for_stub): Use relocation property table
5596 instead of calling Target_arm::reloc_uses_thumb_bit().
5597
218c5831
DK
55982010-02-02 Doug Kwan <dougkwan@google.com>
5599
5600 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5601 types of relaxed input section.
5602
0d31c79d
DK
56032010-02-02 Doug Kwan <dougkwan@google.com>
5604
5605 * Makefile.am (HFILES): Add arm-reloc-property.h.
5606 (DEFFILES): New.
5607 (TARGETSOURCES): Add arm-reloc-property.cc
5608 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5609 (libgold_a_SOURCES): $(DEFFILES)
5610 * Makefile.in: Regenerate.
5611 * arm-reloc-property.cc: New file.
5612 * arm-reloc-property.h: New file.
5613 * arm-reloc.def: New file.
5614 * arm.cc: Update comments.
5615 (arm-reloc-property.h): New included header.
5616 (arm_reloc_property_table): New global variable.
5617 (Target_arm::do_select_as_default_target): New method definition.
5618 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5619 arm-reloc-property to targ_extra_obj.
5620 * parameters.cc (set_parameters_target): Call
5621 Target::select_as_default_target().
5622 * target.h (Target::select_as_default_target): New method definition.
5623 (Target::do_select_as_default_target): Same.
5624
546c7457
DK
56252010-02-01 Doug Kwan <dougkwan@google.com>
5626
5627 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5628 first_output_text_section_.
5629 (Arm_exidx_fixup::first_output_text_section): New method definition.
5630 (Arm_exidx_fixup::first_output_text_section_): New data member.
5631 (Arm_exidx_fixup::process_exidx_section): Record the first text
5632 output section seen.
5633 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5634 and entsize in output section header.
5635
11b861d5
DK
56362010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5637
5638 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5639 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5640 (Arm_relocate_functions::thm_alu11): New Method.
5641 (Arm_relocate_functions::thm_pc8): New Method.
5642 (Arm_relocate_functions::thm_pc12): New Method.
5643 (Target_arm::Scan::local): Handle the relocations.
5644 (Target_arm::Scan::global): Likewise.
5645 (Target_arm::Relocate::relocate): Likewise.
5646 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5647
c9a2c125
DK
56482010-01-29 Doug Kwan <dougkwan@google.com>
5649
5650 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5651 of relocation types as ld.
5652
1521477a
DK
56532010-01-29 Doug Kwan <dougkwan@google.com>
5654
5655 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5656 to public.
5657 (Arm_relocate_functions::thumb_branch_common): Ditto.
5658 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5659 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5660 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5661 Arm_relocate_functions::jump24): Remove.
5662 (Target_arm::Relocate::relocate): Adjust code to call
5663 Arm_relocation_functions::arm_branch_common and
5664 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 5665 wrappers. Merge switch-cases together to reduce source code size.
1521477a 5666
e7eca48c
DK
56672010-01-29 Doug Kwan <dougkwan@google.com>
5668
5669 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5670 output_local_symbol_count_needs_update_.
5671 (Arm_relobj::output_local_symbol_count_needs_update,
5672 Arm_relobj::set_output_local_symbol_count_needs_update,
5673 Arm_relobj::update_output_local_symbol_count): New methods.
5674 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5675 member.
5676 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5677 of pointed function as in a R_ARM_PREL31 relocation.
5678 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5679 for output local symbol count updating.
5680 (Target_arm::do_relax): Update output local symbol counts in objects
5681 if necessary.
5682 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5683
02961d7e
ILT
56842010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5685
5686 * arm.cc: Added support for the ARM relocations:
5687 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5688 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5689 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5690 movw_prel_nc).
5691 (Arm_relocate_functions::movw_rel): New method.
5692 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5693 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5694 thm_movw_prel_nc).
5695 (Arm_relocate_functions::thm_movw_rel): New method.
5696 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5697 thm_movt_prel).
5698 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5699 relocations.
5700 (Target_arm::Scan::global): Likewise.
5701 (Target_arm::Relocate::relocate): Likewise.
5702 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5703 Likewise.
5704
b10d2873
ILT
57052010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5706
5707 * arm.cc: Added support for ARM group relocations.
5708 (Target_arm::reloc_needs_sym_origin): New method.
5709 (Arm_relocate_functions::calc_grp_kn): New method.
5710 (Arm_relocate_functions::calc_grp_residual): New method.
5711 (Arm_relocate_functions::calc_grp_gn): New method.
5712 (Arm_relocate_functions::arm_grp_alu): New Method.
5713 (Arm_relocate_functions::arm_grp_ldr): New Method.
5714 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5715 (Arm_relocate_functions::arm_grp_ldc): New Method.
5716 (Target_arm::Scan::local): Handle the ARM group relocations.
5717 (Target_arm::Scan::global): Likewise.
5718 (Target_arm::Relocate::relocate): Likewise.
5719 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5720 Likewise.
5721
2b328d4e
DK
57222010-01-26 Doug Kwan <dougkwan@google.com>
5723
5724 * arm.cc (set): Include.
5725 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5726 pointer type.
5727 (Arm_output_section::Text_section_list): New type.
5728 (Arm_output_section::append_text_sections_to_list): New method.
5729 (Arm_output_section::fix_exidx_coverage): Ditto.
5730 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5731 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5732 Relobj::set_section_offset() instead of
5733 Sized_relobj::invalidate_section_offset().
5734 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5735 parameter for section headers. Ignore relocation sections for
5736 unallocated sections and EXIDX sections.
5737 (Target_arm::fix_exidx_coverage): New method.
5738 (Target_arm::output_section_address_less_than): New type.
5739 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5740 linked text section instead of the EXIDX section.
5741 (Arm_output_section::create_stub_group): Add an assertion to check
5742 that this is not an EXIDX output section.
5743 (Arm_output_section::append_text_sections_to_list): New method.
5744 (Arm_output_section::fix_exidx_coverage): Ditto.
5745 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5746 Arm_relobj::section_needs_reloc_stub_scanning.
5747 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5748 first pass.
5749 (Target_arm::fix_exidx_coverage): New method.
5750 * object.h (Relobj::set_output_section): New method.
5751 (Sized_relobj::invalidate_section_offset): Remove method.
5752 (Sized_relobj::do_invalidate_section_offset): Remove method.
5753 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5754
c7f3c371
DK
57552010-01-25 Doug Kwan <dougkwan@google.com>
5756
5757 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5758 Fix warning due to signed and unsigned comparison on a 32-bit host.
5759
8923b24c
DK
57602010-01-22 Doug Kwan <dougkwan@google.com>
5761
5762 * arm.cc (Target_arm::do_relax): Record an output section for section
5763 offset adjustment it contains any stub table that has changed.
5764 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5765 offsets in an output section if necessary.
5766 * output.cc (Output_section::Output_section): Initialize
5767 section_offsets_need_adjustments_.
5768 (Output_section::add_input_section_for_script): Renamed to
5769 Output_section::add_simple_input_section.
5770 (Output_section::save_states): Add a comment.
5771 (Output_section::discard_states): New method defintion.
5772 (Output_section::adjust_section_offsets): Same.
5773 * output.h (Output_section::add_input_section_for_script): Renamed to
5774 Output_section::add_simple_input_section.
5775 (Output_section::discard_states): New method declaration.
5776 (Output_section::adjust_section_offsets): Same.
5777 (Output_section::section_offsets_need_adjustment,
5778 Output_section::set_section_offsets_need_adjustment): New method
5779 definitions.
5780 (Output_section::section_offsets_need_adjustment_): New data member.
5781 * script-sections.cc
5782 (Output_section_element_input::set_section_address): Adjust code for
5783 renaming of Output_section::add_input_section_for_script.
5784 (Orphan_output_section::set_section_address): Same.
5785
9b2fd367
DK
57862010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5787
5788 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5789 Fix_v4bx enum values .
5790 * gold/options.h (General_options): New option definitions.
5791 (General_options::fix_v4bx): New method.
5792 (General_options::Fix_v4bx): New enum.
5793 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5794 (General_options::parse_fix_v4bx_interworking): New method.
5795
80d0d023
DK
57962010-01-22 Doug Kwan <dougkwan@google.com>
5797
5798 * arm.cc (Arm_exidx_fixup): New class.
5799
af2cdeae
DK
58002010-01-21 Doug Kwan <dougkwan@google.com>
5801
5802 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5803 classes.
5804 (Arm_exidx_section_offset_map): New type.
5805
993d07c1
DK
58062010-01-21 Doug Kwan <dougkwan@google.com>
5807
5808 * arm.cc (Arm_exidx_input_section): New class.
5809 (Arm_relobj::exidx_input_section_by_link,
5810 Arm_relobj::exidx_input_section_by_shndx,
5811 Arm_relobj::make_exidx_input_section): New methods.
5812 (read_arm_attributes_section): Remove.
5813 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5814 information about them.
5815 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5816 to here.
5817
5ac169d4
DK
58182010-01-20 Doug Kwan <dougkwan@google.com>
5819
5820 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5821 Input_section_specifier to Section_id.
5822 (Target_arm::new_arm_input_section: Adjust code for change of key
5823 type.
5824 (Target_arm::find_arm_input_section): Ditto.
5825 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5826 (Section_id): Remove.
5827 (Garbage_collection::Section_id_hash): Remove.
5828 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5829 (Section_id): Remove.
5830 (Icf::Section_id_hash): Remove.
5831 * object.h (Section_id, Const_section_id, Section_id_hash,
5832 Const_section_id_hash): New type definitions.
5833 * output.cc (Output_section::add_relaxed_input_section): Change to
5834 use Const_section_id instead of Input_section_specifier as key type.
5835 (Output_section::add_merge_input_section): Ditto.
5836 (Output_section::build_relaxation_map): Change to use Section_id
5837 instead of Input_section_specifier as key type.
5838 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5839 Ditto.
5840 (Output_section::convert_input_sections_to_relaxed_sections): Change
5841 to use Const_section_id instead of Input_section_specifier as key type.
5842 (Output_section::find_merge_section): Ditto.
5843 (Output_section::find_relaxed_input_section): Ditto.
5844 * output.h (Input_section_specifier): Remove class.
5845 (Output_section::Output_section_data_by_input_section_map): Change
5846 key type to Const_section_id.
5847 (Output_section::Output_relaxed_input_section_by_input_section_map):
5848 Ditto.
5849 (Output_section::Relaxation_map): Change key type to Section_id.
5850
a2162063
ILT
58512010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5852
5853 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5854 (class Arm_v4bx_stub): New class.
5855 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5856 (Stub_factory::make_arm_v4bx_stub): New method.
5857 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5858 (Stub_table::empty): Handle v4bx stubs.
5859 (Stub_table::add_arm_v4bx_stub): New method.
5860 (Stub_table::find_arm_v4bx_stub): New method.
5861 (Arm_relocate_functions::v4bx): New method.
5862 (Target_arm::fix_v4bx): New method.
5863 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5864 (Stub_table::relocate_stubs): Likewise.
5865 (Stub_table::do_write): Likewise.
5866 (Stub_table::update_data_size_and_addralign): Likewise.
5867 (Stub_table::finalize_stubs): Likewise.
5868 (Target_arm::Scan::local): Likewise.
5869 (Target_arm::Scan::global): Likewise.
5870 (Target_arm::do_finalize_sections): Likewise.
5871 (Target_arm::Relocate::relocate): Likewise.
5872 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5873 Likewise.
5874 (Target_arm::scan_reloc_for_stub): Likewise.
5875 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5876
5696ab0b
ILT
58772010-01-19 Ian Lance Taylor <iant@google.com>
5878
5879 * output.cc (Output_section_headers::do_sized_write): Write large
5880 segment count to sh_info field.
5881 (Output_file_header::do_sized_write): For large segment count,
5882 write PN_XNUM to e_phnum field.
5883
800d0f56
ILT
58842010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5885
5886 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5887 (Arm_relocate_functions::thm_jump8): New function.
5888 (Arm_relocate_functions::thm_jump11): New function.
5889 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5890 R_ARM_THM_JUMP11.
5891 (Target_arm::Scan::global): Likewise.
5892 (Target_arm::Relocate::relocate): Likewise.
5893 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5894 Likewise.
5895
41263c05
DK
58962010-01-14 Doug Kwan <dougkwan@google.com>
5897
5898 * arm.cc (map, utility): Include headers.
5899 (Target_arm::apply_cortex_a8_workaround): New method.
5900 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5901 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5902 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5903 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5904 the --[no-]fix-cortex-a8 command line options.
5905 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5906 (Target_arm::relocate_stub): Use addend in instruction template.
5907 * options.h (DEFINE_bool): Set the user-set flag.
5908 (General_options): Add --[no-]-fix-cortex options.
5909 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 5910 : Update fast look-up map after conversion.
41263c05 5911
459e9b03
ST
59122010-01-14 Sriraman Tallam <tmsriram@google.com>
5913
5914 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5915 in the first pass of do_layout.
5916
b521dfe4
DK
59172010-01-13 Doug Kwan <dougkwan@google.com>
5918
5919 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5920 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5921 apparent compiler problem of not folding static constant integral
5922 data members of elfcpp::Elf_sizes<32>.
5923
44272192
DK
59242010-01-13 Doug Kwan <dougkwan@google.com>
5925
5926 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5927 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5928 Arm_relobj::scan_section_for_cortex_a8_erratum,
5929 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5930 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5931 sections to scan for relocation stubs into a new method
5932 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5933 relocation and Cortex-A8 stub scanning.
5934 (Target_arm::do_relax): Force stubs to be after stubbed sections
5935 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 5936 the beginning of a new relaxation pass. Update a comment.
44272192
DK
5937 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5938
44b71ece
ILT
59392010-01-12 Ian Lance Taylor <iant@google.com>
5940
5941 * target-reloc.h (visibility_error): New inline function.
5942 (relocate_section): Call visibility_error.
5943 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5944 (MOSTLYCLEANFILES): Likewise.
5945 (protected_4_pic.o, protected_3.err): New targets.
5946 * testsuite/protected_4.cc: New file.
5947
a120bc7f
DK
59482010-01-12 Doug Kwan <dougkwan@google.com>
5949
5950 * arm.cc (Cortex_a8_reloc): New class.
5951 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5952 and cortex_a8_relocs_info_.
5953 (Target_arm::fix_cortex_a8): New method definition.
5954 (Target_arm::Cortex_a8_relocs_info): New type.
5955 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5956 New data member declarations.
5957 (Target_arm::scan_reloc_for_stub): Record information about
5958 relocations for THUMB branches that might be exempted from the
5959 Cortex-A8 workaround.
5960 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5961 at the beginning of a relaxation pass.
5962
20138696
DK
59632010-01-12 Doug Kwan <dougkwan@google.com>
5964
5965 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5966 (Arm_relobj::Mapping_symbol_position,
5967 Arm_reloj::Mapping_symbol_position_less,
5968 Arm_relobj::Mapping_symbols_info): New types.
5969 (Target_arm::is_mapping_symbol_name): New method definition.
5970 (Arm_relobj::do_count_local_symbols): Save information about mapping
5971 symbols.
5972
089d69dc
DK
59732010-01-11 Doug Kwan <dougkwan@google.com>
5974
5975 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5976 Arm_relocate_functions::thumb32_branch_upper,
5977 Arm_relocate_functions::thumb32_branch_lower,
5978 Arm_relocate_functions::thumb32_cond_branch_offset,
5979 Arm_relocate_functions::thumb32_cond_branch_upper,
5980 Arm_relocate_functions::thumb32_cond_branch_lower,
5981 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5982 branch offset encoding.
5983 (Arm_relocate_functions::thumb_branch_common): Use new branch
5984 offset encoding methods to avoid code duplication.
5985 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5986 (Stub_addend_reader::operator()): Use new branch encoding method
5987 to avoid code duplication.
5988
99e5bff2
DK
59892010-01-11 Doug Kwan <dougkwan@google.com>
5990
5991 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5992 (Target_arm::do_finalize_sections): Define special EXIDX section
5993 symbols only if referenced.
5994 * gc.h (Garbage_collection::add_reference): New method.
5995 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5996 code duplication.
5997
98e090bd
ILT
59982010-01-11 Ian Lance Taylor <iant@google.com>
5999
d0a91bd8
ILT
6000 * script.cc (Version_script_info::build_expression_list_lookup):
6001 Change complaing about duplicate wildcard match from error to
6002 warning.
6003
98e090bd
ILT
6004 * script.cc (class Lazy_demangler): Recreate--revert part of patch
6005 of 2009-12-30.
6006 (Version_script_info::Version_script_info): Initialize globs_,
6007 default_version_, default_is_global_, and exact_. Don't
6008 initialize globals_ or locals_.
6009 (Version_script_info::build_lookup_tables): Build local symbols
6010 first.
6011 (Version_script_info::unquote): New function.
6012 (Version_script_info::add_exact_match): New function.
6013 (Version_script_info::build_expression_list_lookup): Remove lookup
6014 parameter. Add is_global parameter. Change all callers. Handle
6015 wildcard pattern specially. Unquote pattern. Call
6016 add_exact_match.
6017 (Version_script_info::get_name_to_match): New function.
6018 (Version_script_info::get_symbol_version): New function.
6019 (Version_script_info::get_symbol_version_helper): Remove.
6020 (Version_script_info::check_unmatched_names): Call unquote.
6021 * script.h (class Version_script_info): Change get_symbol_version
6022 to be non-inline and add is_global parameter; change all callers.
6023 Rewrite symbol_is_local. Update declarations. Define struct
6024 Version_tree_match, Exact, Globs. Don't define struct Lookup.
6025 Remove globals_ and locals_ members. Add exact_, globs_,
6026 default_version_, is_global_.
6027 (Version_script_info::Glob): Remove pattern, add expression and
6028 is_global. Update constructor. Change all callers.
6029 * dynobj.cc (Versions::finalize): Mark the version symbol as the
6030 default version.
6031 (Versions::symbol_section_contents): If a symbol is undefined, or
6032 defined in a dynamic object, set the version index to
6033 VER_NDX_LOCAL.
6034 * symtab.cc (Symbol_table::add_from_relobj): Don't call
6035 symbol_is_local.
6036 (Symbol_table::add_from_pluginobj): Likewise.
6037 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6038
d56962d3
DK
60392010-01-11 Doug Kwan <dougkwan@google.com>
6040
6041 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6042 (incremental_dump_LDADD): Add linking option for libintl.
6043 * Makefile.in: Regenerate.
6044
94e6ee91
L
60452010-01-11 H.J. Lu <hongjiu.lu@intel.com>
6046
6047 PR gold/11144
6048 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6049 instead of -Ds.
6050 * testsuite/Makefile.in: Regenerated.
6051
e96c574b
DK
60522010-01-10 Doug Kwan <dougkwan@google.com>
6053
6054 * options.h (DEFINE_var): Use parentheses around argument varname__
6055 in macro body to avoid any unintended subsequent substitutions.
6056
7198066b
ILT
60572010-01-10 Ian Lance Taylor <iant@google.com>
6058
ba4d53bf
ILT
6059 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6060 candidates before doing symbol resolution.
6061
7198066b
ILT
6062 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6063 ODR candidates if only one is weak.
6064
a2beed37
ILT
60652010-01-08 Ian Lance Taylor <iant@google.com>
6066
6067 * script.cc (Version_script_info::build_expression_list_lookup):
6068 Don't warn about ambiguous version, just record the ambiguity.
6069 (Version_script_info::get_symbol_version_helper): Give error if
6070 version is ambiguous.
6071
2fb7225c
DK
60722010-01-08 Doug Kwan <dougkwan@google.com>
6073
6074 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6075 prev_data_size_ and prev_addralign_. Remove initializer for
6076 deleted data member has_been_changed_.
6077 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6078 to determine if the table is empty.
6079 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6080 Remove.
6081 (Stub_table::add_reloc_stub): Define method in class definition
6082 instead of just declaring it there.
6083 (Stub_table::add_cortex_a8_stub): New method definition.
6084 (Stub_table::update_data_size_and_addralign): Ditto.
6085 (Stub_table::finalize_stubs): Ditto.
6086 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6087 (Stub_table::do_addralign_): Return address alignment in the
6088 (Stub_table::do_reset_address_and_file_offset): Define method in
6089 class definition instead of declaring it there. Set current data
6090 size to be the data size of the previous pass.
6091 (Stub_table::set_final_data_size): Use current data size as the
6092 final data size.
6093 (Stub_table::relocate_stub): Change parameter type of stub from
6094 Reloc_stub pointer to Stub pointer.
6095 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6096 (Stub_table::Cortex_a8_stub_list): New typedef.
6097 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6098 Stub_table::prev_addralign_): New data member.
6099 (Arm_relobj::Arm_relobj): Initialize data member
6100 section_has_cortex_a8_workaround_.
6101 (Arm_relobj::section_has_cortex_a8_workaround,
6102 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6103 definitions.
6104 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6105 declarations.
6106 (Target_arm::relocate_stub): Change parameter type of stub from
6107 Reloc_stub pointer to Stub pointer.
6108 (Insn_template::size, Insn_template::alignment): Handle
6109 THUMB16_SPECIAL_TYPE.
6110 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
6111 Stub_table::update_data_size_and_addralign,
6112 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
6113 definitions.
6114 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
6115 (Stub_table::do_write): Ditto.
6116 (Target_arm::do_relax): Adjust code for changes in Stub_table.
6117
880cd20d
ILT
61182010-01-08 Ian Lance Taylor <iant@google.com>
6119
6120 PR 11108
6121 * symtab.h (class Symbol): Remove fields is_target_special_ and
6122 has_plt_offset_. Add field is_defined_in_discarded_section_.
6123 (Symbol::is_defined_in_discarded_section): New function.
6124 (Symbol::set_is_defined_in_discarded_section): New function.
6125 (Symbol::has_plt_offset): Rewrite.
6126 (Symbol::set_plt_offset): Verify that new offset is not -1U.
6127 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
6128 Don't initialize is_target_special_ or has_plt_offset_.
6129 Initialize is_defined_in_discarded_section_.
6130 (Symbol_table::add_from_relobj): If appropriate, set
6131 is_defined_in_discarded_section.
6132 * resolve.cc (Symbol::override_base_with_special): Don't test
6133 is_target_special_. Change has_plt_offset_ to has_plt_offset().
6134 * target-reloc.h (relocate_section): Do special handling for
6135 symbols defined in discarded sections for global symbols as well
6136 as local symbols.
6137
2703e3eb
ILT
61382010-01-08 Ian Lance Taylor <iant@google.com>
6139
6140 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
6141 the SHT_SYMTAB case.
6142
339d40a3
ILT
61432010-01-08 Ian Lance Taylor <iant@google.com>
6144
6145 * object.cc (Sized_relobj::do_layout): Don't get confused if
6146 layout_eh_frame returns NULL.
6147
abecea76
ILT
61482010-01-08 Ian Lance Taylor <iant@google.com>
6149
6150 PR 11084
6151 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
6152 dynamic symbol table, use the normal symbol table.
6153 (Sized_dynobj::do_read_symbols): Remove assertion about type of
6154 symbol table.
6155
6b7dd3f3
ILT
61562010-01-08 Ian Lance Taylor <iant@google.com>
6157
6158 PR 11072
6159 * layout.cc (Layout::include_section): Remove .gnu_debuglink
6160 sections.
6161
36c50e63
L
61622010-01-08 H.J. Lu <hongjiu.lu@intel.com>
6163
6164 * version.cc (print_version): Change to "Copyright 2010".
6165
e291e7b9
ILT
61662010-01-08 Ian Lance Taylor <iant@google.com>
6167
6168 PR 10287
6169 PR 11063
6170 * i386.cc (class Target_i386): Change return type of plt_section
6171 to be non-const.
6172 (class Output_data_plt_i386): Add tls_desc_rel_ field.
6173 (Output_data_plt_i386::Output_data_plt_i386): Initialize
6174 tls_desc_rel_ field.
6175 (Output_data_plt_i386::rel_tls_desc): New function.
6176 (Target_i386::rel_tls_desc_section): New function.
6177 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
6178 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
6179 R_386_TLS_DESC reloc in rel_tls_desc_section.
6180 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
6181 Define struct Tlsdesc_info.
6182 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
6183 (Target_x86_64::do_reloc_symbol_index): New function.
6184 (Target_x86_64::add_tlsdesc_info): New function.
6185 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
6186 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
6187 tlsdesc_rel_ field.
6188 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
6189 all callers.
6190 (Output_data_plt_x86_64::rela_tlsdesc): New function.
6191 (Target_x86_64::rela_tlsdesc_section): New function.
6192 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
6193 handling.
6194 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
6195 (Target_x86_64::do_reloc_addend): New function.
6196 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
6197 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
6198 declarations. Define TARGET_CODE. Add arg field to u1_ union.
6199 (Output_reloc::type): New function.
6200 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
6201 (Output_reloc::is_target_specific): New function.
6202 (Output_reloc::target_arg): New function.
6203 (class Output_reloc) [SHT_RELA]: Add four new constructors for
6204 absolute relocs and target specific relocs.
6205 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
6206 add_target_specific.
6207 (class Output_data_reloc) [SHT_RELA]: Likewise.
6208 * output.cc (Output_reloc::Output_reloc): Add four new versions
6209 for absolute relocs and target specific relocs.
6210 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
6211 (Output_reloc::get_symbol_index): Likewise.
6212 (Output_reloc::local_section_offset): Check that local_sym_index_
6213 is not TARGET_CODE or 0.
6214 (Output_reloc::symbol_value): Likewise.
6215 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6216 reloc.
6217 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6218 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6219 functions.
6220 * layout.cc (add_target_dynamic_tags): Use output section for
6221 DT_PLTRELSZ and DT_JMPREL.
6222
3a44184e
ILT
62232010-01-07 Ian Lance Taylor <iant@google.com>
6224
6225 PR 11061
6226 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6227 function.
6228 (class Output_data_reloc_generic): Define.
6229 (class Output_data_reloc_base): Change base class to
6230 Output_data_reloc_generic. Change add() method to call
6231 bump_relative_reloc_count for a relative reloc. Remove
6232 sort_relocs_ field.
6233 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6234 to sort_relocs().
6235 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6236 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6237 appropriate.
6238 * layout.h (class Layout): Update declaration.
6239
ea715a34
ILT
62402010-01-07 Ian Lance Taylor <iant@google.com>
6241
6242 * output.h (class Output_data): Add const version of
6243 output_section and do_output_section.
6244 (class Output_section_data): Add const version of
6245 do_output_section.
6246 (class Output_section): Likewise.
6247 * layout.cc (Layout::add_target_dynamic_tags): New function.
6248 * layout.h (class Layout): Update declarations.
6249 * arm.cc (Target_arm::do_finalize_sections): Use
6250 add_target_dynamic_tags.
6251 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6252 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6253 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6254 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6255
659948a4
ILT
62562010-01-07 Ian Lance Taylor <iant@google.com>
6257
6258 PR 11042
6259 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6260 object as needed.
6261
9d3b86f6
ILT
62622010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6263 Ian Lance Taylor <iant@google.com>
6264
6265 PR 11019
6266 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6267 Xindex::read_symtab_xindex.
6268
bb0d3eb0
DK
62692010-01-07 Doug Kwan <dougkwan@google.com>
6270
6271 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6272 (Insn_template::thumb16_bcond_insn): New method declaration.
6273 (Insn_template): Fix spelling.
6274 (Stub::thumb16_special): New method declaration.
6275 (Stub::do_write): Define virtual method which was previously pure
6276 virtual.
6277 (Stub::do_thumb16_special): New method declaration.
6278 (Stub::do_fixed_endian_write): New template member.
6279 (Reloc_stub::do_write): Remove.
6280 (Reloc_stub::do_fixed_endian_write): Remove.
6281 (Cortex_a8_stub): New class definition.
6282 (Stub_factory::make_cortex_a8_stub): New method definition.
6283 (Stub_factory::Stub_factory): Add missing static storage class
6284 qualifier for elf32_arm_stub_a8_veneer_blx.
6285
ffeef7df
ILT
62862010-01-07 Ian Lance Taylor <iant@google.com>
6287
dc3f80fe
ILT
6288 PR 10980
6289 * options.h (class General_options): Add --warn-unresolved-symbols
6290 and --error-unresolved-symbols.
6291 * errors.cc (Errors::undefined_symbol): Implement
6292 --warn-unresolved-symbols.
6293
ffeef7df
ILT
6294 * options.h (class General_options): Add -z text and -z textoff.
6295 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6296
f1ec9ded
ST
62972010-01-06 Sriraman Tallam <tmsriram@google.com>
6298
6299 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6300 (Garbage_collection::cident_sections): New function.
6301 (Garbage_collection::add_cident_section): New function.
6302 (Garbage_collection::cident_sections_): New member.
6303 (gc_process_relocs): Add references to sections whose names are C
6304 identifiers.
6305 * gold.h (cident_section_start_prefix): New constant.
6306 (cident_section_stop_prefix): New constant.
6307 (is_cident): New function.
6308 * layout.cc (Layout::define_section_symbols): Replace string constants
6309 with the newly defined constants.
6310 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6311 C identifiers.
6312 * testsuite/Makefile.am: Add gc_orphan_section_test.
6313 * testsuite/Makefile.in: Regenerate.
6314 * testsuite/gc_orphan_section_test.cc: New file.
6315 * testsuite/gc_orphan_section_test.sh: New file.
6316
6eda8c29
ILT
63172010-01-06 Ian Lance Taylor <iant@google.com>
6318
b9674e17
ILT
6319 PR 10980
6320 * options.h (class General_options): Add --warn-shared-textrel.
6321 * layout.cc (Layout::finish_dynamic_section): Implement
6322 --warn-shared-textrel.
6323
6eda8c29
ILT
6324 PR 10980
6325 * options.h (class General_options): Add --warn-multiple-gp.
6326
32dcd44e
ILT
63272010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6328
6329 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6330 $(THREADSLIB) and $(LIBDL).
6331 * Makefile.in: Rebuild.
6332
a192ba05
ILT
63332010-01-06 Ian Lance Taylor <iant@google.com>
6334
6335 PR 10980
6336 * options.cc (General_options::parse_section_start): New function.
6337 (General_options::section_start): New function.
6338 (General_options::General_options): Initialize all members.
6339 * options.h: Include <map>
6340 (class General_options): Add --section-start. Add section_starts_
6341 member.
6342 * layout.cc (Layout::attach_allocated_section_to_segment): If
6343 --section-start was used, set the address of the segment. Remove
6344 local sort_sections.
6345 (Layout::relaxation_loop_body): If the address of the load segment
6346 has been set by --section-start, don't use it.
6347 * output.h (Output_segment::update_flags_for_output_section): New
6348 function.
6349 * output.cc (Output_segment::add_output_section): Call
6350 update_flags_for_output_section.
6351
dde3f402
ILT
63522010-01-05 Ian Lance Taylor <iant@google.com>
6353
62dfdd4d
ILT
6354 PR 10980
6355 * options.h (class General_options): Add --undefined-version.
6356 * script.cc (struct Version_expression): Add was_matched_by_symbol
6357 field.
6358 (Version_script_info::matched_symbol): New function.
6359 (Version_script_info::get_symbol_version_helper): Call
6360 matched_symbol.
6361 (Version_script_info::check_unmatched_names): New function.
6362 * script.h (class Version_script_info): Update declarations.
6363 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6364
9c4ae156
ILT
6365 * options.h (class General_options): Use DEFINE_bool_alias for
6366 allow_multiple_definition.
6367 * resolve.cc (Symbol_table::should_override): Don't test
6368 allow_multiple_definition.
6369
dde3f402
ILT
6370 PR 10980
6371 * options.h (class General_options): Add --cref.
6372 * main.cc (main): Print cref table if --cref. Don't close mapfile
6373 until after printing cref table.
6374 * cref.cc: Include "symtab.h".
6375 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6376 (Cref_table_compare::operator()): New function.
6377 (Cref_inputs::gather_cref): New function.
6378 (filecol): New static const.
6379 (Cref_inputs::print_cref): New function.
6380 (Cref::print_cref): New function.
6381 * cref.h: Include <cstdio>.
6382 (class Cref): Update declarations.
6383 * mapfile.h (Mapfile::file): New function.
6384 * object.h (class Object): Define Symbols. Declare virtual
6385 do_get_global_symbols.
6386 (Object::get_global_symbols): New function.
6387 * object.cc (Input_objects::add_object): Pass object to cref_ if
6388 --cref.
6389 (Input_objects::archive_start): Likewise.
6390 (Input_objects::archive_stop): Likewise.
6391 (Input_objects::print_cref): New function.
6392 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6393 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6394 --cref.
6395 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6396 function.
6397 * plugin.h (class Sized_pluginobj): Update declarations.
6398
8781f709
ILT
63992010-01-05 Ian Lance Taylor <iant@google.com>
6400
6401 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6402 to is_default_version. Rename insdef to insdefault.
6403 (Symbol_table::add_from_relobj): Rename def to is_default_version
6404 and local to is_forced_local.
6405 (Symbol_table::add_from_pluginobj): Likewise.
6406 (Symbol_table::add_from_dynobj): Likewise.
6407 (Symbol_table::define_special_symbol): Rename insdef to
6408 insdefault.
6409
fe35d28d
ILT
64102010-01-04 Ian Lance Taylor <iant@google.com>
6411
30bc8c46
ILT
6412 PR 10980
6413 * options.h (class General_options): Add
6414 --allow-multiple-definition and -z muldefs.
6415 * resolve.cc (Symbol_table::should_override): Don't warn about a
6416 multiple symbol definition if --allow-multiple-definition or -z
6417 muldefs.
6418
7eaea549
ILT
6419 PR 10980
6420 * options.h (class General_options): Add --add-needed and
6421 --copy-dt-needed-entries. Tweak --as-needed help entry.
6422 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6423 error if --copy-dt-needed-entries aka --add-needed is used and
6424 would cause a change in behaviour.
6425
fe35d28d
ILT
6426 PR 10980
6427 * options.h (class General_options): Add -G as a short version of
6428 --shared. Add no-op options -assert, -g, and -i.
6429
55a2bb35
ST
64302010-01-04 Sriraman Tallam <tmsriram@google.com>
6431
6432 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6433 check for .text or .gnu.linkonce.t sections.
6434 * icf.cc (Icf::find_identical_sections): Ditto.
6435 Change the detection for mangled function name within the section
6436 name.
6437 * icf.h (is_section_foldable_candidate): New function.
6438
719328e1
ILT
64392009-12-30 Ian Lance Taylor <iant@google.com>
6440
6441 PR 10980
6442 * options.h (class General_options): Permit two dashes with
6443 --retain-symbols-file.
6444
d7bb5745
ILT
64452009-12-30 Ian Lance Taylor <iant@google.com>
6446
403a15dd
ILT
6447 PR 10979
6448 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6449 don't put the file header and segment headers in the text
6450 segment.
6451
eda294df
ILT
6452 PR 10979
6453 * common.cc (Sort_commons::operator()): Stabilize sort when both
6454 entries are NULL.
6455 (Symbol_table::do_allocate_commons_list): When allocating common
6456 symbols, skip a symbol which is no longer common.
6457 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6458 an object before checking its type.
6459 * testsuite/common_test_2.c: New file.
6460 * testsuite/common_test_3.c: New file.
6461 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6462 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6463 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6464 (common_test_2_pic.o, common_test_2.so): New targets.
6465 (common_test_3_pic.o, common_test_3.so): New targets.
6466 * testsuite/Makefile.in: Rebuild.
6467
d7bb5745
ILT
6468 PR 10979
6469 * script.cc (read_input_script): If we see a new SECTIONS clause,
6470 and we have added an input section, give an error.
6471 * layout.h (class Layout): Add have_added_input_section function.
6472 Add have_added_input_section_ field.
6473 * layout.cc (Layout::Layout): Initialize
6474 have_added_input_section_.
6475 (Layout::layout): Set have_added_input_section_.
6476 (Layout::layout_eh_frame): Likewise.
6477
fc59c572
ILT
64782009-12-30 Ian Lance Taylor <iant@google.com>
6479
6480 PR 10931
6481 * options.h (class General_options): Add --sort-common option.
6482 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6483 * common.cc (Sort_common): Add sort_order parameter to
6484 constructor. Add sort_order_ field.
6485 (Sort_commons::operator): Check sort_order_.
6486 (Symbol_table::allocate_commons): Determine the sort order.
6487 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6488 Change all callers.
6489 (Symbol_table::do_allocate_commons_list): Likewise.
6490
1c74fab0
ILT
64912009-12-30 Ian Lance Taylor <iant@google.com>
6492
6493 PR 10916
6494 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6495 symbols from this object, don't change the visibility of an
6496 undefined symbol.
6497 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6498
6affe781
ILT
64992009-12-30 Ian Lance Taylor <iant@google.com>
6500
6501 PR 10861
6502 * script.h (class Version_script_info): Define Language enum.
6503 Update declarations. Define Glob, Exact, and Lookup types. Add
6504 new fields globals_, locals_, and is_finalized_.
6505 * script.cc: Various formatting fixes.
6506 (class Parser_closure): Change language_stack_ from a vector of
6507 std::string to one of Version_script_info::Language. Adjust all
6508 uses accordingly.
6509 (class Lazy_demangler): Remove.
6510 (struct Version_expression): Change language from std::string to
6511 Version_script_info::Language.
6512 (Version_script_info::Version_script_info): New function.
6513 (Version_script_info::~Version_script_info): Don't call clear.
6514 (Version_script_info::finalize): New function.
6515 (Version_script_info::build_lookup_tables): New function.
6516 (Version_script_info::build_expression_list_lookup): New
6517 function.
6518 (Version_script_info::get_symbol_version_helper): Rewrite to use
6519 lookup tables.
6520 (Version_script_info::print_expression_list): Adjust to use
6521 Version_script_info::Language.
6522 (script_push_lex_into_version_mode): Check that the version script
6523 has not been finalized.
6524 (version_script_push_lang): Change language string to
6525 Version_script_info::Language.
6526 * options.cc (Command_line::version_script): New function.
6527 * options.h (class General_options): Add finalize_dynamic_list
6528 function. Change version_script from declaration to definition.
6529 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6530 * testsuite/version_script.map: Remove duplicate def of foo.
6531 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6532 version_script.map.
6533 * testsuite/Makefile.in: Rebuild.
6534
818bf354
ILT
65352009-12-30 Ian Lance Taylor <iant@google.com>
6536
6537 PR 10843
6538 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6539 if the input symbol index is 0, make the output symbol index 0.
6540
ebcc8304
ILT
65412009-12-30 Ian Lance Taylor <iant@google.com>
6542
6543 PR 10670
6544 * options.h (class General_options): Add -x/--discard-all.
6545 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6546 --discard-all. If the local symbol needs a dynamic entry, check
6547 that before handling --discard-locals.
6548
176fe33f
ILT
65492009-12-30 Ian Lance Taylor <iant@google.com>
6550
bb321bb1
ILT
6551 PR 10450
6552 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6553 flags to PF_R.
6554 (Output_segment::add_output_section): Don't change the flags if
6555 the type is PT_TLS.
6556
176fe33f
ILT
6557 PR 10450
6558 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6559 GNU hash table if they need a dynamic value. Otherwise, don't add
6560 them if they are defined in a dynamic object or are forced local.
6561
e8cd95c7
ILT
65622009-12-29 Ian Lance Taylor <iant@google.com>
6563
1b81fb71
ILT
6564 PR 10450
6565 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6566 .gnu.hash table for a 32-bit target.
6567
8d6d383d
ILT
6568 PR 10450
6569 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6570 regular and a dynamic object only needs a dynamic symbol table
6571 entry if it is externally visible.
6572
e785ec03
ILT
6573 PR 10450
6574 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6575 constructor. Add global_offset_table_ field.
6576 (Target_i386::got_section): Set global_offset_table_.
6577 (Target_i386::do_finalize_sections): Set global_offset_table_
6578 size.
6579 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6580 in constructor. Add global_offset_table_ field.
6581 (Target_x86_64::got_section): Set global_offset_table_.
6582 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6583 size.
6584
1a2dff53
ILT
6585 * layout.cc (Layout::Layout): Initialize increase_relro_.
6586 (Layout::get_output_section): Add is_relro, is_last_relro, and
6587 is_first_non_relro parameters. Change all callers.
6588 (Layout::choose_output_section): Likewise.
6589 (Layout::add_output_section_data): Likewise.
6590 (Layout::make_output_section): Likewise.
6591 (Layout::set_segment_offsets): Clear increase_relro when using a
6592 linker script.
6593 * layout.h (class Layout): Add increase_relro method. Add
6594 increase_relro_ field. Update declarations.
6595 * output.cc (Output_section::Output_section): Initialize
6596 is_last_relro_ and is_first_non_relro_.
6597 (Output_segment::add_output_section): Group relro sections is
6598 do_sort is true. Handle is_last_relro and is_first_non_relro.
6599 (Output_segment::maximum_alignment): Remove relro handling.
6600 (Output_segment::set_section_addresses): Add increase_relro
6601 parameter. Change all callers. Add initial alignment to align
6602 relro sections on separate page. Remove old relro handling.
6603 (Output_segment::set_section_list_addresses): Remove in_relro
6604 parameter. Change all callers.
6605 (Output_segment::set_offset): Add increase parameter. Change all
6606 callers. Remove old relro handling.
6607 * output.h (class Output_section): Add new methods: is_last_relro,
6608 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6609 Add is_last_relro_ and is_first_non_relro_ fields.
6610 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6611 Create separate .got.plt section. Call increase_relro.
6612 * x86_64.cc (Target_x86_64::got_section): Likewise.
6613 * testsuite/relro_script_test.t: Add .got.plt.
6614
f0ba79e2
ILT
6615 PR 10450
6616 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6617 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6618 (Layout::finalize): Call set_dynamic_symbol_size.
6619 (Layout::set_dynamic_symbol_size): New function.
6620 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6621 set_dynamic_symbol_size.
6622
e8cd95c7
ILT
6623 PR 10450
6624 * output.h (class Output_section): Add is_entsize_zero_ field.
6625 * output.cc (Output_section::Output_section): Initialize
6626 is_entsize_zero_.
6627 (Output_section::set_entsize): If two different entsizes are
6628 requested, force it to zero.
6629 (Output_section::add_input_section): Set flags for .debug_str
6630 before updating section flags. Set entsize.
6631 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6632 and SHF_STRING if all input sections have those flags.
6633
3e1b9a8a
RÁE
66342009-12-29 Rafael Espindola <espindola@google.com>
6635
6636 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
6637 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6638 reporting.
3e1b9a8a 6639
3dcad376
ST
66402009-12-29 Sriraman Tallam <tmsriram@google.com>
6641
6642 * options.cc (General_options::parse_version): Allow -v to exit
6643 without an error if there is nothing to link.
6644
084e2665
ILT
66452009-12-29 Ian Lance Taylor <iant@google.com>
6646
6647 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6648 using a version of gcc before 4.1.
6649 * configure: Rebuild.
6650
250acde3
CD
66512009-12-28 Chris Demetriou <cgd@google.com>
6652
6653 * attributes.cc (Output_attributes_section_data::do_write): Use
6654 std::vector::front rather than std::vector::data.
6655
99fff23b
ILT
66562009-12-28 Ian Lance Taylor <iant@google.com>
6657
6658 * symtab.h (class Symbol_table): Add enum Defined.
6659 * resolve.cc (Symbol_table::should_override): Add defined
6660 parameter. Change all callers. Test whether object is NULL
6661 before calling a method on it.
6662 (Symbol_table::report_resolve_problem): Add defined parameter.
6663 Change all callers.
6664 (Symbol_table::should_override_with_special): Likewise.
6665 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6666 parameter. Change all callers.
6667 (Symbol_table::do_define_in_output_data): Likewise.
6668 (Symbol_table::define_in_output_segment): Likewise.
6669 (Symbol_table::do_define_in_output_segment): Likewise.
6670 (Symbol_table::define_as_constant): Likewise.
6671 (Symbol_table::do_define_as_constant): Likewise.
6672 * script.h (class Symbol_assignment): Add is_defsym parameter to
6673 constructor; change all callers.
6674 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6675 parameter. Change all callers. Add is_defsym_ field.
6676 (class Parser_closure): Add parsing_defsym parameter to
6677 constructor; change all callers. Add parsing_defsym accessor
6678 function. Add parsing_defsym_ field.
6679
556bd683
ILT
66802009-12-28 Ian Lance Taylor <iant@google.com>
6681
6682 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 6683 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 6684
1782c879
ILT
66852009-12-23 Ian Lance Taylor <iant@google.com>
6686
6687 * i386.cc (Target_i386::do_calls_non_split): Recognize
6688 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
6689 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6690 -fsplit-stack prologue when using %r11.
1782c879 6691
329ca2b1
ST
66922009-12-21 Sriraman Tallam <tmsriram@google.com>
6693
6694 * options.cc (General_options::parse_version): Make -v continue and do
6695 the link like GNU ld does.
6696
d675ff46
RÁE
66972009-12-17 Rafael Avila de Espindola <espindola@google.com>
6698
6699 * Makefile.am (CCFILES): Add timer.cc.
6700 (HFILES): Add timer.h.
6701 * configure.ac: Check for sysconf and times.
6702 * main.cc: include timer.h.
6703 (main): Use Timer instead of get_run_time.
6704 * timer.cc: New.
6705 * timer.h: New.
6706 * workqueue.cc: include timer.h.
6707 (Workqueue::find_and_run_task):
6708 Report user, sys and wall time.
6709 * Makefile.in: Regenerate.
6710 * config.in: Regenerate.
6711 * configure: Regenerate.
6712
d6344fb5
DK
67132009-12-16 Doug Kwan <dougkwan@google.com>
6714
6715 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6716 sections.
6717 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6718 relaxed input sections.
6719 * output.cc (Output_section::find_relaxed_input_section): Change
6720 return type to Output_relaxed_input_section pointer. Adjust code
6721 for new type of relaxed_input_section_map_.
6722 * output.h (Output_section::find_relaxed_input_section): Change
6723 return type to Output_relaxed_input_section pointer.
6724 (Output_section::Output_relaxed_input_section_by_input_section_map):
6725 New type.
6726 (Output_section::relaxed_input_section_map_): Change type to
6727 Output_section::Output_relaxed_input_section_by_input_section_map.
6728 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6729 input section.
6730
0e0d5469
ILT
67312009-12-15 Ian Lance Taylor <iant@google.com>
6732
6733 * layout.cc (Layout::create_shstrtab): Only write out after input
6734 sections if we are compressing debug sections.
6735
0649a889
ILT
67362009-12-15 Ian Lance Taylor <iant@google.com>
6737
6738 * archive.cc (Archive::add_symbols): Only look up a symbol without
6739 a version if there is, in fact, a version.
6740
2ea97941
ILT
67412009-12-14 Ian Lance Taylor <iant@google.com>
6742
6743 Revert -Wshadow changes, all changes from:
6744 2009-12-11 Doug Kwan <dougkwan@google.com>
6745 2009-12-11 Nick Clifton <nickc@redhat.com>
6746 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6747
b0eec2cc
DK
67482009-12-11 Doug Kwan <dougkwan@google.com>
6749
6750 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6751 due to -Wshadow.
6752 * attributes.cc (Object_attribute::size): Ditto.
6753 (Attributes_section_data::size): Ditto.
6754 (Attributes_section_data::Attributes_section_data): Ditto.
6755 (Output_attributes_section_data::do_write): Ditto.
6756 * attributes.h (Object_attribute::set_type): Ditto.
6757 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6758
91d6fa6a
NC
67592009-12-11 Nick Clifton <nickc@redhat.com>
6760
6761 * archive.cc: Fix shadowed variable warnings.
6762 * arm.cc: Likewise.
6763 * compressed_output.cc: Likewise.
6764 * compressed_output.h: Likewise.
6765 * configure: Likewise.
6766 * dwarf_reader.cc: Likewise.
6767 * dynobj.cc: Likewise.
6768 * dynobj.h: Likewise.
6769 * ehframe.cc: Likewise.
6770 * ehframe.h: Likewise.
6771 * errors.cc: Likewise.
6772 * expression.cc: Likewise.
6773 * fileread.cc: Likewise.
6774 * fileread.h: Likewise.
6775 * freebsd.h: Likewise.
6776 * i386.cc: Likewise.
6777 * icf.cc: Likewise.
6778 * incremental.h: Likewise.
6779 * layout.cc: Likewise.
6780 * layout.h: Likewise.
6781 * mapfile.cc: Likewise.
6782 * merge.cc: Likewise.
6783 * merge.h: Likewise.
6784 * object.cc: Likewise.
6785 * object.h: Likewise.
6786 * options.h: Likewise.
6787 * output.cc: Likewise.
6788 * output.h: Likewise.
6789 * parameters.cc: Likewise.
6790 * plugin.cc: Likewise.
6791 * powerpc.cc: Likewise.
6792 * reduced_debug_output.cc: Likewise.
6793 * reduced_debug_output.h: Likewise.
6794 * reloc.cc: Likewise.
6795 * reloc.h: Likewise.
6796 * resolve.cc: Likewise.
6797 * script-sections.cc: Likewise.
6798 * script.cc: Likewise.
6799 * script.h: Likewise.
6800 * sparc.cc: Likewise.
6801 * symtab.cc: Likewise.
6802 * symtab.h: Likewise.
6803 * target-select.cc: Likewise.
6804 * target-select.h: Likewise.
6805 * token.h: Likewise.
6806 * workqueue.cc: Likewise.
6807 * workqueue.h: Likewise.
6808 * x86_64.cc: Likewise.
6809
a0351a69
DK
68102009-12-10 Doug Kwan <dougkwan@google.com>
6811
6812 * arm.cc (attributes.h): New include.
6813 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6814 (Arm_relobj::~Arm_relobj): Delete object pointed by
6815 attributes_section_data_.
6816 (Arm_relobj::attributes_section_data): New method definition.
6817 (Arm_relobj::attributes_section_data_): New data member declaration.
6818 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6819 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6820 attributes_section_data_.
6821 (Arm_dynobj::attributes_section_data): New method definition.
6822 (Arm_dynobj::attributes_section_data_): New data member declaration.
6823 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6824 initialization value of may_use_blx_ to false.
6825 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6826 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6827 object attributes to compute results instead of hard-coding.
6828 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6829 Target_arm::get_secondary_compatible_arch,
6830 Target_arm::set_secondary_compatible_arch
6831 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6832 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6833 New method declarations.
6834 (Target_arm::get_aeabi_object_attribute): New method definition.
6835 (Target_arm::attributes_section_data_): New data member declaration.
6836 (read_arm_attributes_section): New template definition.
6837 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6838 (Arm_dynobj::do_read_symbols): Ditto.
6839 (Target_arm::do_finalize_sections): Merge attributes sections from
6840 input. Check for BLX use after attributes section merging.
6841 Fix __exidx_start and __exidx_end visibility. Create an
6842 .ARM.attributes section if necessary.
6843 (Target_arm::get_secondary_compatible_arch,
6844 Target_arm::set_secondary_compatible_arch,
6845 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6846 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 6847 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
6848 New method definitions.
6849
b59befec
ILT
68502009-12-09 Ian Lance Taylor <iant@google.com>
6851
6852 * plugin.cc (Plugin::load): Don't cast from void* to a function
6853 pointer.
6854
1276bc89
ILT
68552009-12-09 Ian Lance Taylor <iant@google.com>
6856
6857 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6858 information fields.
6859
2f2de248
L
68602009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6861
6862 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6863 Replace two_file_shared_1.so with two_file_shared_2.so.
6864 * testsuite/Makefile.in: Regenerated.
6865
4f787271
DK
68662009-12-08 Doug Kwan <dougkwan@google.com>
6867
6868 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6869 (HFILES): Add attributes.h and int_encoding.h.
6870 * Makefile.in: Regenerate.
6871 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6872 function definitions to int_encoding.cc
6873 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6874 prototypes to int_encoding.h
6875 * reduced_debug_output.cc (int_encoding.h): New include.
6876 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6877 function definitions to int_encoding.cc
6878 (insert_into_vector, read_from_pointer): Move template definitions to
6879 int_encoding.h
6880 * attributes.cc: New file.
6881 * attributes.h: New file.
6882 * int_encoding.cc: New file.
6883 * int_encoding.h: New file.
6884
20b52f1a
RÁE
68852009-12-07 Rafael Avila de Espindola <espindola@google.com>
6886
6887 PR gold/11055
6888 * incremental-dump.cc (dump_incremental_inputs): New.
6889 (main): Use dump_incremental_inputs.
6890
53d7974c
L
68912009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6892
6893 PR gold/10893
6894 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6895 checking elfcpp::STT_FUNC.
6896 (Target_i386::Relocate::relocate): Likewise.
6897 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6898
6899 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6900 symbols from shared libraries into normal FUNC symbols.
6901
6902 * symtab.h (Symbol): Add is_func and use it.
6903
05a352e6
DK
69042009-12-05 Doug Kwan <dougkwan@google.com>
6905
6906 * arm.cc (Target_arm::arm_info): Initialize new fields
6907 attributes_section and attributes_vendor.
6908 * i386.cc (Target_i386::i386_info): Same.
6909 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6910 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6911 fields attributes_section and attributes_vendor.
53d7974c 6912 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
6913 * target.h (Target::attributes_section, Target::attributes_vendor,
6914 Target::is_attributes_section, Target::attribute_arg_type,
6915 Target::attributes_order): New method definitions.
6916 (Target::Target_info::attributes_section,
6917 Target::Target_info::attributes_vendor): New fields.
6918 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6919 virtual method definitions.
6920 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6921 attributes_section and attributes_vendor.
6922 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6923
f4e5969c
DK
69242009-12-05 Doug Kwan <dougkwan@google.com>
6925
6926 * arm.cc: Update comments about interworking and stub generation.
6927 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6928 considered as non-PIC.
6929 (Arm_relocate_functions::base_abs): Fix formatting.
6930 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6931 of function to use GOT entry address instead of offset.
6932 (Target_arm::Scan::global): Issue an error if a symbol would need a
6933 PLT does not get one because it is untyped. Remove code to create
6934 dynamic symbols for relative branches.
6935 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6936 takes unsigned integer instead of boolean.
6937
1abce4a6
L
69382009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6939
6940 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6941 (two_file_test_LDADD): Likewise.
6942 (common_test_1_LDADD): Likewise.
6943 (exception_test_LDADD) Likewise.
6944 (weak_test_LDADD): Likewise.
6945 (many_sections_test_LDADD): Likewise.
6946 (initpri1_LDADD): Likewise.
6947 (script_test_1_LDADD): Likewise.
6948 (script_test_2_LDADD): Likewise.
6949 (justsyms_LDADD): Likewise.
6950 (binary_test_LDADD): Likewise.
6951 (large_LDADD): Likewise.
6952 * testsuite/Makefile.in: Regenerated.
6953
adcf2816 69542009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 6955
adcf2816
L
6956 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6957 (Symbol_table::override_with_special): Likewise.
6958 (Symbol_table::add_from_object): Likewise.
6959
28e67f5d
RÁE
69602009-12-04 Rafael Avila de Espindola <espindola@google.com>
6961
6962 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6963 Don't set the data_offset twice.
6964
ae10a101
RÁE
69652009-12-04 Rafael Avila de Espindola <espindola@google.com>
6966
6967 * testsuite/Makefile.in: Regenerate.
6968
f59f41f3
DK
69692009-12-03 Doug Kwan <dougkwan@google.com>
6970
6971 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6972 (Target_arm::do_finalize_sections): Add parameter for symbol table
6973 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6974 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6975 parameter for symbol table pointer.
6976 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6977 an additional parameter for a pointer to symbol table.
6978 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6979 parameter for a symbol table pointer.
6980 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6981 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6982 Ditto.
6983 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6984 parameter for a symbol table pointer.
6985
ca55d848
RÁE
69862009-12-03 Rafael Avila de Espindola <espindola@google.com>
6987
6988 * incremental.cc (Incremental_inputs_header)
6989 (Incremental_inputs_header_write, Incremental_inputs_entry)
6990 (Incremental_inputs_entry_write): Move ...
6991 * incremental.h (Incremental_inputs_header)
6992 (Incremental_inputs_header_write, Incremental_inputs_entry)
6993 (Incremental_inputs_entry_write): here.
6994
3aec4f9c
RÁE
69952009-12-02 Rafael Avila de Espindola <espindola@google.com>
6996
6997 * incremental.cc (make_sized_incremental_binary): Set the target.
6998 Error if it is incompatible.
6999 * output.h (Output_file): Add filename method.
7000
9c0ae74d
RÁE
70012009-12-02 Rafael Avila de Espindola <espindola@google.com>
7002
7003 * incremental.cc (Incremental_inputs_entry): Remove unused argument
7004 from the get_* methods.
7005
a45500ae
RÁE
70062009-12-02 Rafael Avila de Espindola <espindola@google.com>
7007
7008 * incremental-dump.cc (main): Check that the offeset of a script is 0.
7009 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7010 Write 0 for the data_offset of scripts.
7011
325e6408
RÁE
70122009-12-02 Rafael Avila de Espindola <espindola@google.com>
7013
7014 * testsuite/Makefile.am: Add the incremental_test.sh test.
7015 * testsuite/incremental_test.sh: New.
7016 * testsuite/incremental_test_1.c: New.
7017 * testsuite/incremental_test_2.c: New.
7018
954c3e2e
RÁE
70192009-12-01 Rafael Avila de Espindola <espindola@google.com>
7020
7021 * incremental-dump.cc (main): Fix typos.
7022
f8086623
RÁE
70232009-11-27 Rafael Avila de Espindola <espindola@google.com>
7024
7025 PR gold/11025
7026 * incremental-dump.cc (main): Use llu to print 64 bit values.
7027
3b0dd6ac
L
70282009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
7029 H.J. Lu <hongjiu.lu@intel.com>
7030
7031 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7032 $(LIBDL).
7033 (incremental_dump_LDADD): Likewise.
7034 * Makefile.in: Regenerated.
7035
a6d1ef57 70362009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 7037
a6d1ef57
DK
7038 Revert:
7039
7040 2009-11-25 Doug Kwan <dougkwan@google.com>
7041
7042 * arm.cc (Target_arm::Target_arm): Move method definition
7043 outside of class definition. Add code to handle
7044 --target1-rel, --target1-abs and --target2= options.
7045 (Target_arm::get_reloc_reloc_type): Change method to be
7046 non-static and const.
7047 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7048 New data member declaration.
7049 (Target_arm::Scan::local, Target_arm::Scan::global,
7050 Target_arm::Relocate::relocate,
7051 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7052 Adjust call to Target_arm::get_real_reloc_type.
7053 (Target_arm::get_real_reloc_type): Use command line options
7054 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7055 * options.h (--target1-rel, --target1-abs, --target2): New
7056 ARM-only options.
7057
50aeb7d4
DK
70582009-11-25 Doug Kwan <dougkwan@google.com>
7059
7060 * arm.cc (Target_arm::Target_arm): Move method definition outside of
7061 class definition. Add code to handle --target1-rel, --target1-abs
7062 and --target2= options.
7063 (Target_arm::get_reloc_reloc_type): Change method to be non-static
7064 and const.
7065 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7066 member declaration.
7067 (Target_arm::Scan::local, Target_arm::Scan::global,
7068 Target_arm::Relocate::relocate,
7069 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7070 call to Target_arm::get_real_reloc_type.
7071 (Target_arm::get_real_reloc_type): Use command line options to
7072 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7073 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7074 options.
7075
51938283
DK
70762009-11-25 Doug Kwan <dougkwan@google.com>
7077
7078 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7079 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7080 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7081 formatting.
7082 (Arm_relocate_functions::thm_call): Replace body with a call to
7083 Arm_relocate_functions::thumb_branch_common.
7084 (Arm_relocate_functions::thm_jump24,
7085 Arm_relocate_functions::thm_xpc22): New method definitions.
7086 (Arm_relocate_functions::thumb_branch_common): New method definition.
7087 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7088 operator.
7089 (Target_arm::Relocate::relocate): Adjust call to thm_call.
7090 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7091
e2b8f3c4
RÁE
70922009-11-24 Rafael Avila de Espindola <espindola@google.com>
7093
7094 * Makefile.am: Build incremental-dump
7095 * Makefile.in: Regenerate.
7096 * incremental-dump.cc: New.
7097 * incremental.cc (Incremental_inputs_header_data,
7098 Incremental_inputs_entry_data): Move to incremental.h
7099 * incremental.h: (Incremental_inputs_header_data,
7100 Incremental_inputs_entry_data): Move from incremental.cc
7101
bcba9aec
RÁE
71022009-11-24 Rafael Avila de Espindola <espindola@google.com>
7103
7104 * incremental.cc (Incremental_inputs_header,
7105 Incremental_inputs_header_write, Incremental_inputs_entry,
7106 Incremental_inputs_entry_write): Add a typedef with the data type.
7107
7c3afe08
RÁE
71082009-11-24 Rafael Avila de Espindola <espindola@google.com>
7109
7110 * incremental.cc (Incremental_inputs_header,
7111 Incremental_inputs_header_write, Incremental_inputs_entry,
7112 Incremental_inputs_entry_write): Update comment about which
7113 type has the filed descriptions.
7114
d204b6e9
DK
71152009-11-15 Doug Kwan <dougkwan@google.com>
7116
7117 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
7118 (Arm_relocate_functions::arm_branch_common): Change method defintion
7119 in class definition to a method declaration and update list of formal
7120 parameters.
7121 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
7122 Arm_relocation_functions::jump24): Adjust call to
7123 Arm_relocate_functions::arm_branch_common. Update list of formal
7124 parameters.
7125 (Arm_relocate_functions::xpc25): New method definition.
7126 (Arm_relocate_functions::arm_branch_common): Move method defintion
7127 out from class definition. Use stubs for mode-switching and extending
7128 branch ranges.
7129 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
7130 specially. Change code to enable use of stubs in ARM branches.
7131
43d12afe
DK
71322009-11-10 Doug Kwan <dougkwan@google.com>
7133
7134 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
7135 in method declaration.
7136 (Target_arm::relocate_stub): New method declaration.
7137 (Target_arm::default_target): Change to return a pointer instead of
7138 a const reference.
7139 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
7140 Target_arm::default_target.
7141 (Arm_Relobj::do_relocate_sections): Remove options paramater in
7142 method definition.
7143 (Target_arm::relocate_section): Adjust view.
7144 (Target_arm::relocate_stub): New method definition.
7145
ac33a407
DK
71462009-11-10 Doug Kwan <dougkwan@google.com>
7147
7148 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
7149 a format warning.
7150 * incremental.cc (open_incremental_binary): Initialized local
7151 variables to avoid warnings.
7152 * object.cc (make_elf_object): Ditto.
7153 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
7154 a format warning.
e1df38aa 7155
88ee28e9
L
7156009-11-09 H.J. Lu <hongjiu.lu@intel.com>
7157
7158 PR gold/10930
7159 * testsuite/plugin_test.c: Include "config.h".
7160
2daedcd6
DK
71612009-11-09 Doug Kwan <dougkwan@google.com>
7162
7163 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
7164 (arm_symbol_value): Remove.
7165 (Arm_relocate_functions::arm_branch_common,
7166 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
7167 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
7168 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
7169 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
7170 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
7171 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
7172 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
7173 Arm_relocate_functions::thm_mobw_abs_nc,
7174 Arm_relocate_functions::thm_mov_abs,
7175 Arm_relocate_functions::movw_prel_nc,
7176 Arm_relocate_functions::thm_movt_abs,
7177 Arm_relocate_functions::movt_prel,
7178 Arm_relocate_functions::thm_movw_prel_nc,
7179 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
7180 (Target_arm::Relocate::relocate): Only decompose address into two
7181 parts if relocation type uses the thumb-bit and pass the actual
7182 bit instead of a flag indicating that the thumb-bit is used. Adjust
7183 calls to methods in Arm_relocate_functions for this change.
7184
1276bc89 71852009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
7186
7187 PR 10925
7188 * reloc.cc: Instantiate
7189 Sized_relobj::initialize_input_to_output_maps and
7190 Sized_relobj:free_input_to_output_maps.
7191
e53ad1b5
ILT
71922009-11-06 Ian Lance Taylor <iant@google.com>
7193
7194 PR 10876
7195 * defstd.cc (in_segment): Set only_if_ref true for "end".
7196
eb44217c
DK
71972009-11-06 Doug Kwan <dougkwan@google.com>
7198
7199 * arm.cc (class Reloc_stub): Correct a comment.
7200 (Target_arm::Target_arm): Initialize arm_input_section_map_.
7201 (Target_arm::scan_section_for_stubs): New method declaration.
7202 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
7203 Change methods from private to protected.
7204 (Target_arm::do_may_relax): New method definition.
7205 (Target_arm::do_relax, Target_arm::group_sections,
7206 Target_arm::scan_reloc_for_stub,
7207 Target_arm::scan_reloc_section_for_stubs): New method declarations.
7208 (Target_arm::arm_input_section_map_): New data member declaration.
7209 (Target_arm::scan_reloc_for_stub,
7210 Target_arm::scan_reloc_section_for_stubs,
7211 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
7212 Target_arm::do_relax): New method definitions.
7213
5d329b7d
ILT
72142009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7215
7216 * configure.ac: Check for (struct stat)::st_mtim
7217 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7218 * config.in: Regenerate.
7219 * configure: Regenerate.
7220
96a0d71b
ILT
72212009-11-05 Ian Lance Taylor <iant@google.com>
7222
7223 PR 10910
7224 * output.cc (Output_segment::add_output_section): Add missing
7225 return statement.
7226
594c8e5e
ILT
72272009-11-04 Ian Lance Taylor <iant@google.com>
7228
7229 PR 10880
7230 * object.h (class Object): Add is_needed and set_is_needed
7231 methods. Add is_needed_ field. Make bool fields into bitfields.
7232 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7233 defined in a dynamic object and referenced by a regular object,
7234 set is_needed for the dynamic object.
7235 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7236 if the file is marked with as_needed and it is not needed.
7237
22b127cc
ILT
72382009-11-04 Ian Lance Taylor <iant@google.com>
7239
7240 PR 10887
7241 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7242 tags if data is discarded by linker script.
7243 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7244 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7245 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7246 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7247
f5c870d2
ILT
72482009-11-04 Ian Lance Taylor <iant@google.com>
7249
7250 * layout.cc (Layout::get_output_section): Add is_interp and
7251 is_dynamic_linker_section parameters. Change all callers.
7252 (Layout::choose_output_section): Likewise.
7253 (Layout::make_output_section): Likewise.
7254 (Layout::add_output_section_data): Add is_dynamic_linker_section
7255 parameter. Change all callers.
7256 * layout.h (class Layout): Update declarations.
7257 * output.h (class Output_section): Add is_interp, set_is_interp,
7258 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7259 Add is_interp_, is_dynamic_linker_section_ fields. Change
7260 generate_code_fills_at_write_ to a bitfield.
7261 * output.cc (Output_section::Output_sections): Initialize new
7262 fields.
7263 (Output_segment::add_output_section): Add do_sort parameter.
7264 Change all callers.
7265
1ae4d23b
ILT
72662009-11-03 Ian Lance Taylor <iant@google.com>
7267
7268 PR 10860
7269 * options.h (class General_options): Add --warn-common.
7270 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7271 merging two common symbols.
7272 (Symbol_table::should_override): Handle --warn-common when merging
7273 a common symbol with a defined symbol. Use report_resolve_problem
7274 for multiple definitions.
7275 (Symbol_table::report_resolve_problem): New function.
7276 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7277
55da9579
DK
72782009-11-03 Doug Kwan <dougkwan@google.com>
7279
7280 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7281 stub_factory_.
7282 (Target_arm::stub_factory): New method definition.
7283 (Target_arm::new_arm_input_section,
7284 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7285 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 7286 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
7287 New type definitions.
7288 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7289 member declarations.
7290 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7291 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7292 New method definitions.
7293
37a9ac43
ILT
72942009-11-03 Ian Lance Taylor <iant@google.com>
7295
7296 * options.h (class General_options): Add --warn_constructors.
7297
b3d6a3d4
ILT
72982009-11-03 Ian Lance Taylor <iant@google.com>
7299
7300 PR 10893
7301 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7302 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7303
934b01dd
ILT
73042009-11-03 Ian Lance Taylor <iant@google.com>
7305
7306 PR 10895
7307 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7308 --msgid-bugs-address.
7309 (install-pdf): New target.
7310 (install-data_yes): Look up one directory to find mkinstalldirs.
7311
03c1939b
L
73122009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7313
7314 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7315 tree.
7316
ebd95253
DK
73172009-10-30 Doug Kwan <dougkwan@google.com>
7318
7319 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7320
e9bbb538
DK
73212009-10-30 Doug Kwan <dougkwan@google.com>
7322
7323 * arm.cc (Stub_addend_reader): New struct template definition
7324 and partial specializations.
7325 (Stub_addend_reader::operator()): New method definition for a
7326 partially specialized template.
7327
d5b40221
DK
73282009-10-30 Doug Kwan <dougkwan@google.com>
7329
7330 * arm.cc (Arm_relobj::processor_specific_flags): New method
7331 definition.
7332 (Arm_relobj::do_read_symbols): New method declaration.
7333 (Arm_relobj::processor_specific_flags_): New data member declaration.
7334 (Arm_dynobj): New class definition.
7335 (Target_arm::do_finalize_sections): Add input_objects parameter.
7336 (Target_arm::do_adjust_elf_header): New method declaration.
7337 (Target_arm::are_eabi_versions_compatible,
7338 (Target_arm::merge_processor_specific_flags): New method declaration.
7339 (Target_arm::do_make_elf_object): New overloaded method definitions
7340 and declaration.
7341 (Arm_relobj::do_read_symbols): New method definition.
7342 (Arm_dynobj::do_read_symbols): Ditto.
7343 (Target_arm::do_finalize_sections): Add input_objects parameters.
7344 Merge processor-specific flags from all input objects.
7345 (Target_arm::are_eabi_versions_compatible,
7346 Target_arm::merge_processor_specific_flags,
7347 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7348 New method definitions.
7349 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7350 Input_objects pointer type parameter.
7351 * layout.cc (Layout::finalize): Pass input objects to target's.
7352 finalize_sections function.
7353 * output.cc (Output_file_header::do_sized_write): Set ELF file
7354 header's processor-specific flags.
7355 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7356 Input_objects pointer type parameter.
7357 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7358 * target.h (Input_objects): New forward class declaration.
7359 (Target::processor_specific_flags,
7360 Target::are_processor_specific_flags_sect): New method definitions.
7361 (Target::finalize_sections): Add input_objects parameter.
7362 (Target::Target): Initialize processor_specific_flags_ and
7363 are_processor_specific_flags_set_.
7364 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7365 parameter.
7366 (Target::set_processor_specific_flags): New method definition.
7367 (Target::processor_specific_flags_,
7368 Target::are_processor_specific_flags_set_): New data member
7369 declarations.
7370 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7371 Input_objects pointer type parameter.
7372
ebabffbd
DK
73732009-10-30 Doug Kwan <dougkwan@google.com>
7374
7375 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7376
ad0f2072
ILT
73772009-10-28 Ian Lance Taylor <iant@google.com>
7378
7379 * object.h (class Relobj): Drop options parameter from
7380 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7381 do_scan_relocs, do_relocate. Change all callers.
7382 (class Sized_relobj): Drop options parameters from
7383 do_gc_process_relocs, do_scan_relocs, do_relocate,
7384 do_relocate_sections, relocate_sections, emit_relocs_scan,
7385 emit_relocs_scan_reltype. Change all callers.
7386 (struct Relocate_info): Remove options field and all references to
7387 it.
7388 * reloc.h (class Read_relocs): Remove options constructor
7389 parameter and options_ field. Change all callers.
7390 (class Gc_process_relocs, class Scan_relocs): Likewise.
7391 (class Relocate_task): Likewise.
7392 * target-reloc.h (scan_relocs): Remove options parameter. Change
7393 all callers.
7394 (scan_relocatable_relocs): Likewise.
7395 * target.h (class Sized_target): Remove options parameter from
7396 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7397 all callers.
7398 * gc.h (gc_process_relocs): Remove options parameter. Change all
7399 callers.
7400 * arm.cc: Update functions to remove options parameters.
7401 * i386.cc: Likewise.
7402 * powerpc.cc: Likewise.
7403 * sparc.cc: Likewise.
7404 * x86_64.cc: Likewise.
7405 * testsuite/testfile.cc: Likewise.
7406
8ffa3667
DK
74072009-10-28 Doug Kwan <dougkwan@google.com>
7408
7409 * arm.cc (Arm_relobj): New class definition.
e1df38aa 7410 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
7411 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7412 New method definitions.
7413
40f36857
CC
74142009-10-28 Cary Coutant <ccoutant@google.com>
7415
7416 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7417 (Plugin::cleanup_done_): New member.
7418 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7419 (Plugin_manager::cleanup_done_): Remove.
7420 (Plugin_manager::add_input_file): Edit error message.
7421 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7422 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7423
2c849493
ILT
74242009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7425
7426 * fileread.cc: (File_read::View::~View): Use the new
7427 data_ownership_ filed.
7428 (File_read::~File_read): Dispose the new whole_file_view_.
7429 (File_read::open): Mmap the whole file if needed.
7430 (File_read::open): Use whole_file_view_ instead of contents_.
7431 (File_read::find_view): Use whole_file_view_ if applicable.
7432 (File_read::do_read): Use whole_file_view_ instead of contents_.
7433 (File_read::make_view): Use whole_file_view_ instead of contents_,
7434 update File_read::View::View call.
7435 (File_read::find_or_make_view): Update File_read::View::View
7436 call.
7437 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7438 remove contents_
7439 (File_read::View::Data_ownership): New enum.
7440 (File_read::View::View): Replace bool mapped_ with Data_ownership
7441 argument.
7442 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7443 (File_read::View::data_ownership_): New field.
7444 (File_read::contents_): Remove (replaced by whole_file_view_).
7445 (File_read::whole_file_view_): New field.
7446 * options.h (class General_options): Add --keep-files-mapped.
7447
24998053
CC
74482009-10-27 Cary Coutant <ccoutant@google.com>
7449
7450 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7451 * testsuite/Makefile.am (plugin_test_5): New test case.
7452 * testsuite/Makefile.in: Regenerate.
7453
72adc4fa
DK
74542009-10-25 Doug Kwan <dougkwan@google.com>
7455
7456 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7457 from private to protected to allow access by child class.
7458 (Sized_relobj::do_relocate_sections): New method declaration.
7459 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 7460 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
7461 Sized_relobj::relocate_sections. Instantiate template explicitly
7462 for different target sizes and endianity.
7463
07f508a2
DK
74642009-10-24 Doug Kwan <dougkwan@google.com>
7465
7466 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7467 (Arm_input_section::as_arm_input_section): New method.
7468 (Arm_output_section): New class definition.
7469 (Arm_output_section::create_stub_group,
7470 Arm_output_section::group_sections): New method definitions.
7471
10ad9fe5
DK
74722009-10-22 Doug Kwan <dougkwan@google.com>
7473
7474 * arm.cc (Arm_input_section): New class definition.
7475 (Arm_input_section::init, Arm_input_section:do_write,
7476 Arm_input_section::set_final_data_size,
7477 Arm_input_section::do_reset_address_and_file_offset): New method
7478 definitions.
7479
56ee5e00
DK
74802009-10-21 Doug Kwan <dougkwan@google.com>
7481
7482 * arm.cc (Stub_table, Arm_input_section): New forward class
7483 declarations.
7484 (Stub_table): New class defintion.
7485 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7486 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7487 New method definition.
7488
b569affa
DK
74892009-10-21 Doug Kwan <dougkwan@google.com>
7490
7491 * arm.cc: Update copyright comments.
7492 (Target_arm): New forward class template declaration.
7493 (Arm_address): New type.
7494 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7495 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7496 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7497 constants.
7498 (Insn_template): Same.
7499 (DEF_STUBS): New macro.
7500 (Stub_type): New enum type.
7501 (Stub_template): New class definition.
7502 (Stub): Same.
7503 (Reloc_stub): Same.
7504 (Stub_factory): Same.
7505 (Target_arm::Target_arm): Initialize may_use_blx_ and
7506 should_force_pic_veneer_.
7507 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7508 Target_arm::should_force_pic_veneer,
7509 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7510 Target_arm::using_thumb_only, Target_arm:;default_target): New
7511 method defintions.
7512 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7513 New data member declarations.
7514 (Insn_template::size, Insn_template::alignment): New method defintions.
7515 (Stub_template::Stub_template): New method definition.
7516 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7517 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7518 (Stub_factory::Stub_factory): New method definition.
7519 * gold.h (string_hash): New template.
7520 * output.h (Input_section_specifier::hash_value): Use
7521 gold::string_hash.
7522 (Input_section_specifier::string_hash): Remove.
7523 * stringpool.cc (Stringpool_template::string_hash): Use
7524 gold::string_hash.
7525
6c172549
DK
75262009-10-20 Doug Kwan <dougkwan@google.com>
7527
7528 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7529 symbols of relaxed input sections.
7530 * output.h (Output_section::find_relaxed_input_section): Make
7531 method public.
7532
c5617f2f
DK
75332009-10-16 Doug Kwan <dougkwan@google.com>
7534
7535 * dynobj.cc (Versions::Versions): Initialize version_script_.
7536 Only insert base version symbol definition for a shared object
7537 if version script defines any version versions.
7538 (Versions::define_base_version): New method definition.
7539 (Versions::add_def): Check that base version is not needed.
7540 (Versions::add_need): Define base version lazily.
7541 * dynobj.h (Versions::define_base_version): New method declaration.
7542 (Versions::needs_base_version_): New data member declaration.
7543 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7544 (check_DATA): Add no_version_test.stdout.
7545 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7546 New make rules.
7547 * testsuite/Makefile.in: Regenerate.
7548 * testsuite/no_version_test.c: New file.
7549 * testsuite/no_version_test.sh: Ditto.
7550
3c12dcdb
DK
75512009-10-16 Doug Kwan <dougkwan@google.com>
7552
7553 * expression.cc (class Segment_start_expression): New class definition.
7554 (Segment_start_expression::value): New method definition.
7555 (script_exp_function_segment_start): Return a new
7556 Segment_start_expression.
7557 * gold/script-c.h (script_saw_segment_start_expression): New function
7558 prototype.
7559 * script-sections.cc (Script_sections::Script_sections): Initialize
7560 SAW_SEGMENT_START_EXPRESSION_ to false.
7561 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7562 and -Tbbs options to specify section addresses if given in
7563 command line and no SEGMENT_START expression is seen in a script.
7564 * script-sections.h (Script_sections::saw_segment_start_expression,
7565 Script_sections::set_saw_segment_start_expression): New method
7566 definition.
7567 (Script_sections::saw_segment_start_expression_): New data member
7568 declaration.
7569 * script.cc (script_saw_segment_start_expression): New function.
7570 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7571 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7572 script_test_7.sh and script_test_8.sh.
7573 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7574 script_test_8.stdout.
7575 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7576 (script_test_6, script_test_6.stdout, script_test_7,
7577 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7578 * Makefile.in: Regenerate.
7579 * testsuite/script_test_6.sh: New file.
7580 * testsuite/script_test_6.t: Same.
7581 * testsuite/script_test_7.sh: Same.
7582 * testsuite/script_test_7.t: Same.
7583 * testsuite/script_test_8.sh: Same.
7584
64b1ae37
DK
75852009-10-16 Doug Kwan <dougkwan@google.com>
7586
7587 * output.cc (Output_segment::set_section_list_address): Cast
7588 expressions to unsigned long long type to avoid format warnings.
7589
661be1e2
ILT
75902009-10-15 Ian Lance Taylor <iant@google.com>
7591
12edd763 7592 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 7593 dot assignment to script_sections_.
12edd763
ILT
7594 * script-sections.cc (Script_sections::add_dot_assignment):
7595 Initialize if necessary.
7596
68b6574b
ILT
7597 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7598 program headers with no load segment if there is a linker script.
7599
661be1e2
ILT
7600 * layout.cc (Layout::set_segment_offsets): Align the file offset
7601 to the segment aligment for -N or -n with no load segment.
7602 * output.cc (Output_segment::add_output_section): Don't crash if
7603 the first section is a TLS section.
7604 (Output_segment::set_section_list_addresses): Print an error
7605 message if the address moves backward in a linker script.
7606 * script-sections.cc
7607 (Output_section_element_input::set_section_addresses): Don't
7608 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7609 (Orphan_output_section::set_section_addresses): Likewise.
7610
f15f61a7
DK
76112009-10-15 Doug Kwan <dougkwan@google.com>
7612
7613 * layout.cc (Layout::finish_dynamic_section): Generate tags
7614 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7615 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7616 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7617
82bb573a
ILT
76182009-10-14 Ian Lance Taylor <iant@google.com>
7619
7620 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7621 fields.
7622 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7623 data_shdr fields of relinfo.
7624 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7625 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7626 R_386_TLS_LDO_32, adjust based on section flags.
7627 (Target_i386::Relocate::fix_up_ldo): Remove.
7628
374ad285
ILT
76292009-10-13 Ian Lance Taylor <iant@google.com>
7630
7631 Add support for -pie.
7632 * options.h (class General_options): Add -pie and
7633 --pic-executable.
7634 (General_options::output_is_position_independent): Test -pie.
7635 (General_options::output_is_executable): Return true if not shared
7636 and not relocatable.
7637 (General_options::output_is_pie): Remove.
7638 * options.cc (General_options::finalize): Reject incompatible uses
7639 of -pie.
7640 * gold.cc (queue_middle_tasks): A -pie link is not static.
7641 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7642 * symtab.cc (Symbol::final_value_is_known): Return false if
7643 output_is_position_independent.
7644 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7645 output_is_position_independent.
7646 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7647 output_is_position_independent.
7648 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7649 output_is_position_independent.
7650 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7651 two_file_pie_test.
7652 (basic_pie_test.o, basic_pie_test): New targets.
7653 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7654 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7655 (two_file_pie_test): New target.
7656 * testsuite/Makefile.in: Rebuild.
7657 * README: Remove note saying that -pie is not supported.
7658
c6585162
ILT
76592009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7660
7661 * options.h (class General_options): Add -init and -fini.
7662 * layout.cc (Layout::finish_dynamic_section): Emit
7663 given init and fini functions.
7664
032ce4e9
ST
76652009-10-13 Sriraman Tallam <tmsriram@google.com>
7666
7667 * gc.h (gc_process_relocs): Check if icf is enabled using new
7668 function.
7669 * gold.cc (queue_initial_tasks): Likewise.
7670 (queue_middle_tasks): Likewise.
7671 * object.cc (do_layout): Likewise.
7672 * symtab.cc (is_section_folded): Likewise.
7673 * main.cc (main): Likewise.
7674 * reloc.cc (Read_relocs::run): Likewise.
7675 (Sized_relobj::do_scan_relocs): Likewise.
7676 * icf.cc (is_function_ctor_or_dtor): New function.
7677 (Icf::find_identical_sections): Check if function is ctor or dtor when
7678 safe icf is chosen.
7679 * options.h (General_options::icf): Change option to be an enum.
7680 (Icf_status): New enum.
7681 (icf_enabled): New method.
7682 (icf_safe_folding): New method.
7683 (set_icf_status): New method.
7684 (icf_status_): New variable.
7685 * (options.cc) (General_options::finalize): Set icf_status_.
7686 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7687 icf_test and icf_keep_unique_test to use the --icf enum flag.
7688 * testsuite/icf_safe_test.sh: New file.
e1df38aa 7689 * testsuite/icf_safe_test.cc: New file.
032ce4e9 7690
f345227a
ST
76912009-10-12 Sriraman Tallam <tmsriram@google.com>
7692
7693 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7694 includes to gc.h and icf.h.
7695 * arm.cc: Include gc.h.
7696 * gold.cc: Likewise.
7697 * i386.cc: Likewise.
7698 * powerpc.cc: Likewise.
7699 * sparc.cc: Likewise.
7700 * x86_64.cc: Likewise.
7701 * gc.h: Include icf.h.
7702
1c7814ed
ILT
77032009-10-11 Ian Lance Taylor <iant@google.com>
7704
7705 * plugin.cc: Include "gold.h" before other header files.
7706
ae3b5189
CD
77072009-10-10 Chris Demetriou <cgd@google.com>
7708
7709 * options.h (Input_file_argument::Input_file_type): New enum.
7710 (Input_file_argument::is_lib_): Replace with...
7711 (Input_file_argument::type_): New member.
7712 (Input_file_argument::Input_file_argument): Take Input_file_type
7713 'type' rather than boolean 'is_lib' as second argument.
7714 (Input_file_argument::is_lib): Use type_.
7715 (Input_file_argument::is_searched_file): New function.
7716 (Input_file_argument::may_need_search): Handle is_searched_file.
7717 * options.cc (General_options::parse_library): Support -l:filename.
7718 (General_options::parse_just_symbols): Update for Input_file_argument
7719 changes.
7720 (Command_line::process): Likewise.
7721 * archive.cc (Archive::get_file_and_offset): Likewise.
7722 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7723 * script.cc (read_script_file, script_add_file): Likewise.
7724 * fileread.cc (Input_file::Input_file): Likewise.
7725 (Input_file::will_search_for): Handle is_searched_file.
7726 (Input_file::open): Likewise.
7727 * readsyms.cc (Read_symbols::get_name): Likewise.
7728 * testsuite/Makefile.am (searched_file_test): New test.
7729 * testsuite/Makefile.in: Regenerate.
7730 * testsuite/searched_file_test.cc: New file.
7731 * testsuite/searched_file_test_lib.cc: New file.
7732
f3048a1d
ILT
77332009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7734 Ian Lance Taylor <iant@google.com>
7735
7736 * descriptor.cc: Include <cstdio> and "binary-io.h".
7737 (Descriptors::open): Open the files in binary mode always.
7738 * script.cc (Lex::get_token): Treat \r as whitespace.
7739
d4780e57
ILT
77402009-10-09 Ian Lance Taylor <iant@google.com>
7741
7742 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7743
d9a893b8
ILT
77442009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7745 Ian Lance Taylor <iant@google.com>
7746
7747 * configure.ac: Check for readv function also.
7748 * fileread.cc (readv): Define if not HAVE_READV.
7749 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7750 does not exist.
7751 * config.in: Regenerate.
7752 * configure: Regenerate.
7753
c0a62865
DK
77542009-10-09 Doug Kwan <dougkwan@google.com>
7755
7756 * layout.cc (Layout::make_output_section): Call target hook to make
7757 ordinary output section.
7758 (Layout::finalize): Adjust parameter list of call the
7759 Target::may_relax().
7760 * layout.h (class Layout::section_list): New method.
7761 * merge.h (Output_merge_base::entsize): Change visibility to public.
7762 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7763 New methods.
7764 (Output_merge_string::do_is_string): New method.
7765 * object.cc (Sized_relobj::do_setup): renamed from
7766 Sized_relobj::set_up.
7767 * object.h (Sized_relobj::adjust_shndx,
7768 Sized_relobj::initializ_input_to_output_maps,
7769 Sized_relobj::free_input_to_output_maps): Change visibilities to
7770 protected.
7771 (Sized_relobj::setup): Virtualize.
7772 (Sized_relobj::do_setup): New method declaration.
7773 (Sized_relobj::invalidate_section_offset,
7774 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7775 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7776 * options.cc (parse_int): New function.
7777 * options.h (parse_int): New declaration.
7778 (DEFINE_int): New macro.
7779 (stub_group_size): New option.
7780 * output.cc (Output_section::Output_section): Initialize memebers
7781 merge_section_map_, merge_section_by_properties_map_,
7782 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7783 (Output_section::add_input_section): Handled deferred code-fill
7784 generation and remove an old comment.
7785 (Output_section::add_relaxed_input_section): New method definition.
7786 (Output_section::add_merge_input_section): Use merge section by
7787 properties map to speed to search. Update merge section maps
7788 as appropriate.
7789 (Output_section::build_relaxation_map): New method definition.
7790 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7791 Same.
7792 (Output_section::relax_input_section): Renamed to
7793 Output_section::convert_input_sections_to_relaxed_sections and change
7794 interface to take a vector of pointers to relaxed sections.
7795 (Output_section::find_merge_section,
7796 Output_section::find_relaxed_input_section): New method definitions.
7797 (Output_section::is_input_address_mapped,
7798 Output_section::output_offset, Output_section::output_address):
7799 Use output section data maps to speed up searching.
7800 (Output_section::find_starting_output_address): Add comments.
7801 (Output_section::do_write,
7802 Output_section::write_to_postprocessing_buffer): Do code-fill
7803 generation as appropriate.
7804 (Output_section::get_input_sections): Invalidate relaxed input section
7805 map.
7806 (Output_section::restore_states): Adjust type of checkpoint .
7807 Invalidate relaxed input section map.
7808 * output.h (Output_merge_base): New class declaration.
7809 (Input_section_specifier): New class defintion.
7810 (class Output_relaxed_input_section) Change base class to
7811 Output_section_data_build.
7812 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7813 base class initializer.
7814 (Output_section::add_relaxed_input_section): New method declaration.
7815 (Output_section::Input_section): Change visibility to protected.
7816 (Output_section::Input_section::relobj,
7817 Output_section::Input_section::shndx): Handle relaxed input sections.
7818 Output_section::input_sections) Change visibility to protected. Also
7819 define overload to return a non-const pointer.
7820 (Output_section::Merge_section_properties): New class defintion.
7821 (Output_section::Merge_section_by_properties_map,
7822 Output_section::Output_section_data_by_input_section_map,
7823 Output_section::Relaxation_map): New types.
7824 (Output_section::relax_input_section): Rename method to
7825 Output_section::convert_input_sections_to_relaxed_sections and change
7826 interface to take a vector of relaxed section pointers.
7827 (Output_section::find_merge_section,
7828 Output_section::find_relaxed_input_section,
7829 Output_section::build_relaxation_map,
7830 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7831 New method declarations.
7832 (Output_section::merge_section_map_
7833 Output_section::merge_section_by_properties_map_,
7834 Output_section::relaxed_input_section_map_,
7835 Output_section::is_relaxed_input_section_map_valid_,
7836 Output_section::generate_code_fills_at_write_): New data members.
7837 * script-sections.cc
7838 (Output_section_element_input::set_section_addresses): Call
7839 current_data_size and addralign methods of relaxed input sections.
7840 (Orphan_output_section::set_section_addresses): Call current_data_size
7841 and addralign methods of relaxed input sections.
7842 * symtab.cc (Symbol_table::compute_final_value): Extract template
7843 from the body of Symbol_table::sized_finalize_symbol.
7844 (Symbol_table::sized_finalized_symbol): Call
7845 Symbol_table::compute_final_value.
7846 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7847 (Symbol_table::compute_final_value): New templated method declaration.
7848 * target.cc (Target::do_make_output_section): New method defintion.
7849 * target.h (Target::make_output_section): New method declaration.
7850 (Target::relax): Add more parameters for input objects, symbol table
7851 and layout. Adjust call to do_relax.
7852 (Target::do_make_output_section): New method declaration.
7853 (Target::do_relax): Add parameters for input objects, symbol table
7854 and layout.
7855
d446d6c4
ILT
78562009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7857
7858 * pread.c: Include stdio.h.
7859
bc06c745
ILT
78602009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7861
7862 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7863 defined.
7864
75aea3d0
ILT
78652009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7866
7867 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7868 Change read_shndx type to unsigned int.
7869 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7870 int.
7871 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7872 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7873 Change read_shndx type to unsigned int.
7874 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7875 int.
7876 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7877 * layout.cc (Layout::create_symtab_sections): Cast the result of
7878 local_symcount * symsize to off_t in the gold_assert.
7879
be8fcb75
ILT
78802009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7881
7882 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7883 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7884 R_ARM_BASE_ABS.
7885 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7886 (Arm_relocate_functions::thm_abs5): New function.
7887 (Arm_relocate_functions::abs12): New function.
7888 (Arm_relocate_functions::abs16): New function.
7889 (Arm_relocate_functions::base_abs): New function.
7890 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7891 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7892 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7893 R_ARM_BASE_ABS.
7894 (Scan::global): Likewise.
7895 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7896 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7897 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7898 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7899 R_ARM_BASE_ABS.
7900
c2a122b6
ILT
79012009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7902
7903 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7904 (Arm_relocate_functions::movt_prel): New function.
7905 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7906 (Arm_relocate_functions::thm_movt_prel): New function.
7907 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7908 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7909 (Scan::global, Relocate::relocate): Likewise.
7910 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7911
c4aa1e2d
ILT
79122009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7913
7914 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7915 Incremental_checker.
7916 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7917 unsigned int.
7918 (class Incremental_inputs_header): New class.
7919 (Incremental_inputs_header_writer): Edit comment.
7920 (Incremental_inputs_entry): New class.
7921 (Incremental_inputs_entry_writer): Edit comment.
7922 (Sized_incremental_binary::do_find_incremental_inputs_section):
7923 Add *strtab_shndx parameter, fill it.
7924 (Sized_incremental_binary::do_check_inputs): New method.
7925 (Incremental_checker::can_incrementally_link_output_file): Use
7926 Sized_incremental_binary::check_inputs.
7927 (Incremental_inputs::report_command_line): Save command line in
7928 command_line_.
7929 * incremental.h:
7930 (Incremental_binary::find_incremental_inputs_section): New
7931 method.
7932 (Incremental_binary::do_find_incremental_inputs_section): Add
7933 strtab_shndx parameter.
7934 (Incremental_binary::do_check_inputs): New pure virtual method.
7935 (Sized_incremental_binary::do_check_inputs): Declare.
7936 (Incremental_checker::Incremental_checker): Add incremental_inputs
7937 parameter, use it to initialize incremental_inputs_.
7938 (Incremental_checker::incremental_inputs_): New field.
7939 (Incremental_checker::command_line): New method.
7940 (Incremental_checker::inputs): New method.
7941 (Incremental_checker::command_line_): New field.
7942
c549a694
ILT
79432009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7944
7945 * incremental.cc: Include <cstdarg> and "target-select.h".
7946 (vexplain_no_incremental): New function.
7947 (explain_no_incremental): New function.
7948 (Incremental_binary::error): New method.
7949 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7950 method.
7951 (make_sized_incremental_binary): New function.
7952 (open_incremental_binary): New function.
7953 (can_incrementally_link_file): Add checks if output is ELF and has
7954 inputs section.
7955 * incremental.h: Include "elfcpp_file.h" and "output.h".
7956 (Incremental_binary): New class.
7957 (Sized_incremental_binary): New class.
7958 (open_incremental_binary): Declare.
7959 * object.cc (is_elf_object): Use
7960 elfcpp::Elf_recognizer::is_elf_file.
7961 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7962 * output.h (Output_file::filesize): New method.
7963
fd3c5f0b
ILT
79642009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7965
7966 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7967 New function.
7968 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7969 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7970 function.
7971 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7972 function.
7973 (Arm_relocate_functions::movw_abs_nc): New function.
7974 (Arm_relocate_functions::movt_abs): New function.
7975 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7976 (Arm_relocate_functions::thm_movt_abs): New function.
7977 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7978 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7979 (Scan::global): Likewise.
7980 (Relocate::relocate): Likewise.
7981 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7982
7f5309a5
ILT
79832009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7984
7985 * arm.cc (Arm_relocate_functions::got_prel) New function.
7986 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7987 (Relocate::relocate): Likewise.
7988 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7989
364c7fa5
ILT
79902009-10-06 Ian Lance Taylor <iant@google.com>
7991
7992 * options.h (class General_options): Define
7993 split_stack_adjust_size parameter.
7994 * object.h (class Object): Add uses_split_stack_ and
7995 has_no_split_stack_ fields. Add uses_split_stack and
7996 has_no_split_stack accessor functions. Declare
7997 handle_split_stack_section.
7998 (class Reloc_symbol_changes): Define.
7999 (class Sized_relobj): Define Function_offsets. Declare
8000 split_stack_adjust, split_stack_adjust_reltype, and
8001 find_functions.
8002 * object.cc (Object::handle_split_stack_section): New function.
8003 (Sized_relobj::do_layout): Call handle_split_stack_section.
8004 * dynobj.cc (Sized_dynobj::do_layout): Call
8005 handle_split_stack_section.
8006 * reloc.cc (Sized_relobj::relocate_sections): Call
8007 split_stack_adjust for executable sections in split_stack
8008 objects. Pass reloc_map to relocate_section.
8009 (Sized_relobj::split_stack_adjust): New function.
8010 (Sized_relobj::split_stack_adjust_reltype): New function.
8011 (Sized_relobj::find_functions): New function.
8012 * target-reloc.h: Include "object.h".
8013 (relocate_section): Add reloc_symbol_changes parameter. Change
8014 all callers.
8015 * target.h (class Target): Add calls_non_split method. Declare
8016 do_calls_non_split virtual method. Declare match_view and
8017 set_view_to_nop.
8018 * target.cc: Include "elfcpp.h".
8019 (Target::do_calls_non_split): New function.
8020 (Target::match_view): New function.
8021 (Target::set_view_to_nop): New function.
8022 * gold.cc (queue_middle_tasks): Give an error if mixing
8023 split-stack and non-split-stack objects with -r.
8024 * i386.cc (Target_i386::relocate_section): Add
8025 reloc_symbol_changes parameter.
8026 (Target_i386::do_calls_non_split): New function.
8027 * x86_64.cc (Target_x86_64::relocate_section): Add
8028 reloc_symbol_changes parameter.
8029 (Target_x86_64::do_calls_non_split): New function.
8030 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8031 parameter.
8032 * powerpc.cc (Target_powerpc::relocate_section): Add
8033 reloc_symbol_changes parameter.
8034 * sparc.cc (Target_sparc::relocate_section): Add
8035 reloc_symbol_changes parameter.
8036 * configure.ac: Call AM_CONDITIONAL for the default target.
8037 * configure: Rebuild.
8038 * testsuite/Makefile.am (TEST_AS): New variable.
8039 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8040 (check_DATA): Add split_i386 and split_x86_64 files.
8041 (SPLIT_DEFSYMS): Define.
8042 (split_i386_[1234n].o): New targets.
8043 (split_i386_[124]): New targets.
8044 (split_i386_[1234r].stdout): New targets.
8045 (split_x86_64_[1234n].o): New targets.
8046 (split_x86_64_[124]): New targets.
8047 (split_x86_64_[1234r].stdout): New targets.
8048 (MOSTLYCLEANFILES): Add new executables.
8049 * testsuite/split_i386.sh: New file.
8050 * testsuite/split_x86_64.sh: New file.
8051 * testsuite/split_i386_1.s: New file.
8052 * testsuite/split_i386_2.s: New file.
8053 * testsuite/split_i386_3.s: New file.
8054 * testsuite/split_i386_4.s: New file.
8055 * testsuite/split_i386_n.s: New file.
8056 * testsuite/split_x86_64_1.s: New file.
8057 * testsuite/split_x86_64_2.s: New file.
8058 * testsuite/split_x86_64_3.s: New file.
8059 * testsuite/split_x86_64_4.s: New file.
8060 * testsuite/split_x86_64_n.s: New file.
8061 * testsuite/testfile.cc (Target_test): Update relocation_section
8062 function.
8063 * testsuite/Makefile.in: Rebuild.
8064
e8a9fcda
ILT
80652009-10-06 Ian Lance Taylor <iant@google.com>
8066
8067 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8068 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8069 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
8070 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8071 the address on ldo_addrs_.
8072 (Target_i386::Relocate::fix_up_ldo): New function.
8073
e99daf92
ILT
80742009-10-06 Rafael Espindola <espindola@google.com>
8075
8076 * plugin.cc (add_input_library): New.
8077 (Plugin::load): Add add_input_library to tv.
8078 (Plugin_manager::add_input_file): Add the is_lib argument.
8079 (add_input_file): Update call to Plugin_manager::add_input_file.
8080 (add_input_library): New.
8081 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8082
966d4097
DK
80832009-09-30 Doug Kwan <dougkwan@google.com>
8084
8085 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8086 symbol and call Symbol::may_need_copy_reloc to determine if
8087 a copy reloc is needed.
8088 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8089 nocopyreloc is given in command line.
8090 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8091 given in command line.
8092 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8093 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8094 of the removed Target_i386::may_need_copy_reloc.
8095 * options.h (copyreloc): New option with default value false.
8096 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8097 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8098 instead of the removed Target_powerpc::may_need_copy_reloc.
8099 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8100 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8101 instead of the removed Target_sparc::may_need_copy_reloc.
8102 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8103 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8104 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8105 instead of the removed Target_x86_64::may_need_copy_reloc.
8106
029ba973
ILT
81072009-09-30 Ian Lance Taylor <iant@google.com>
8108
8109 * object.h (class Object): Remove target_ field, and target,
8110 sized_target, and set_target methods.
8111 (Object::sized_target): Remove.
8112 (class Sized_relobj): Update declarations. Remove sized_target.
8113 * object.cc (Sized_relobj::setup): Remove target parameter.
8114 Change all callers.
8115 (Input_objects::add_object): Don't do anything with the target.
8116 (make_elf_sized_object): Add punconfigured parameter. Change all
8117 callers. Set or test parameter target.
8118 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
8119 Change all callers.
8120 * parameters.cc (Parameters::set_target): Change parameter type to
8121 be non-const.
8122 (Parameters::default_target): Remove.
8123 (set_parameters_target): Change parameter type to be non-const.
8124 (parameters_force_valid_target): New function.
8125 (parameters_clear_target): New function.
8126 * parameters.h (class Parameters): Update declarations. Remove
8127 default_target method. Add sized_target and clear_target
8128 methods. Change target_ to be non-const.
8129 (set_parameters_target): Update declaration.
8130 (parameters_force_valid_target): Declare.
8131 (parameters_clear_target): Declare.
8132 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
8133 as NULL if we aren't searching.
8134 (Add_symbols::run): Don't check for compatible target.
8135 * fileread.cc (Input_file::open_binary): Call
8136 parameters_force_valid_target.
8137 * gold.cc (queue_middle_tasks): Likewise.
8138 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
8139 set_target on object.
8140 * dynobj.h (class Sized_dynobj): Update declarations.
8141 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
8142 make_elf_object returns NULL.
8143 (Archive::include_member): Don't check whether object target is
8144 compatible.
8145 * output.cc (Output_section::add_input_section): Get target from
8146 parameters.
8147 (Output_section::relax_input_section): Likewise.
8148 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
8149 parameters.
8150 (Sized_relobj::do_scan_relocs): Likewise.
8151 (Sized_relobj::relocate_sections): Likewise.
8152 * resolve.cc (Symbol_table::resolve): Likewise.
8153 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
8154 parameter. Change all callers.
8155 (Symbol_table::add_from_object): Get target from parameters.
8156 (Symbol_table::add_from_relobj): Don't check object target.
8157 (Symbol_table::add_from_dynobj): Likewise.
8158 (Symbol_table::define_special_symbol): Get target from
8159 parameters.
8160 * symtab.h (class Symbol_table): Update declaration.
8161 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
8162 parameter. Change all callers. Clear parameter target.
8163 (Binary_test): Test target here.
8164 * testsuite/object_unittest.cc (gold_testsuite): Remove
8165 target_test_pointer parameter. Change all callers.
8166 (Object_test): Test target here.
8167
a6a22b83
ILT
81682009-09-26 Ian Lance Taylor <iant@google.com>
8169
8170 * testsuite/initpri1.c: Don't try to use constructor priorities if
8171 compiling with gcc before 4.3.
8172
6a8f49fe
ILT
81732009-09-22 Mikolaj Zalewski <mikolajz@google.com>
8174
8175 * testsuite/retain_symbols_file_test.sh (check_present): Change
8176 output file name to retain_symbols_file_test.stdout.
8177 (check_absent): Likewise.
8178
8c604651
CS
81792009-09-18 Craig Silverstein <csilvers@google.com>
8180
8181 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
8182 * options.cc: Include <cerrno> and <fstream>.
8183 (General_options::finalize): Parse -retain-symbols-file tag.
8184 * options.h: New flag.
8185 (General_options): New method should_retain_symbol, new
8186 variable symbols_to_retain.
8187 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
8188 should_retain_symbol map.
8189 * testsuite/Makefile.am (retain_symbols_file_test): New test.
8190 * testsuite/Makefile.in: Regenerate.
8191 * testsuite/retain_symbols_file_test.sh: New file.
8192
ca58b19f
NC
81932009-09-18 Nick Clifton <nickc@redhat.com>
8194
8195 * po/es.po: Updated Spanish translation.
8196
20e6d0d6
DK
81972009-09-17 Doug Kwan <dougkwan@google.com>
8198
8199 * debug.h (DEBUG_RELAXATION): New constant.
8200 (DEBUG_ALL): Add DEBUG_RELAXATION.
8201 (debug_string_to_enum): Add relaxation debug option.
8202 * layout.cc
8203 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
8204 Layout::Relaxation_debug_check::read_sections,
8205 Layout::Relaxation_debug_check::read_sections): New method definitions.
8206 (Layout::Layout): Initialize data members
8207 record_output_section_data_from_scrips_,
8208 script_output_section_data_list_ and relaxation_debug_check_.
8209 (Layout::save_segments, Layout::restore_segments,
8210 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8211 Layout::relaxation_loop_body): New method definitions.
8212 (Layout::finalize): Support relaxation. Move section layout code to
8213 Layout::relaxation_loop_body.
8214 (Layout::set_asection_address_from_script): Move code for orphan
8215 section placement out.
8216 (Layout::place_orphan_sections_in_script): New method definition.
8217 * layout.h (Output_segment_headers, Output_file_header):
8218 New forward class declarations.
8219 (Layout::~Layout): Define.
8220 (Layout::new_output_section_data_from_script): New method definition.
8221 (Layout::place_orphan_sections_in_script): New method declaration.
8222 (Layout::Segment_states): New type declaration.
8223 (Layout::save_segments, Layout::restore_segments,
8224 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8225 Layout::relaxation_loop_body): New method declarations.
8226 (Layout::Output_section_data_list): New type declaration.
8227 (Layout::Relaxation_debug_check): New class definition.
8228 (Layout::record_output_section_data_from_script_,
8229 Layout::script_output_section_data_list_, Layout::segment_states_,
8230 Layout::relaxation_debug_check_): New data members.
8231 * output.cc: (Output_section_headers::do_size): New method definition.
8232 (Output_section_headers::Output_section_headers): Move size
8233 computation to Output_section_headers::do_size.
8234 (Output_segment_headers::do_size): New method definition.
e1df38aa 8235 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
8236 Output_file_header::do_size and call it.
8237 (Output_file_header::do_size): New method definition.
8238 (Output_data_group::Output_data_group): Adjust call to
8239 Output_section_data.
8240 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8241 (Output_symtab_xindex::do_write): Add array bound check.
8242 (Output_section::Input_section::print_to_mapfile): Handle
8243 RELAXED_INPUT_SECTION_CODE.
8244 (Output_section::Output_section): Initialize data member checkpoint_.
8245 (Output_section::~Output_section): Delete checkpoint object pointed
8246 by checkpoint_.
8247 (Output_section::add_input_section): Always add an Input_section if
8248 relaxing.
8249 (Output_section::add_merge_input_section): Add assert.
8250 (Output_section::relax_input_section): New method definition.
8251 (Output_section::set_final_data_size): Set load address to zero for
8252 an unallocated section.
8253 (Output_section::do_address_and_file_offset_have_reset_values):
8254 New method definition.
8255 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8256 Handle relaxed input section.
8257 (Output_section::sort_attached_input_sections): Checkpoint input
8258 section list lazily.
8259 (Output_section::get_input_sections): Change type of input_sections to
8260 list of Simple_input_section pointers. Checkpoint input section list
8261 lazily. Also handle relaxed input sections.
8262 (Output_section::add_input_section_for_script): Take a reference to
8263 a Simple_input_section object instead of Relobj pointer and section
8264 index as parameter. Handle relaxed input sections.
8265 (Output_section::save_states, Output_section::restore_states): New
8266 method definitions.
8267 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8268 (Output_data::is_data_size_fixed): New method definition.
8269 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8270 if it is fixed.
8271 (Output_data::address_and_file_offset_have_reset_values): New method
8272 definition.
8273 (Output_data::do_address_and_file_offset_have_reset_values): New method
8274 definition.
8275 (Output_data::set_data_size): Check that data size is not fixed.
8276 (Output_data::fix_data_size): New method definition.
8277 (Output_data::is_data_size_fixed_): New data member.
8278 (Output_section_headers::set_final_data_size): New method definition.
8279 (Output_section_headers::do_size): New method declaration.
8280 (Output_segment_headers::set_final_data_size): New method definition.
8281 (Output_segment_headers::do_size): New method declaration.
8282 (Output_file_header::set_final_data_size)::New method definition.
8283 (Output_file_header::do_size)::New method declaration.
8284 (Output_section_data::Output_section_data): Add new parameter
8285 is_data_size_fixed and use it to fix data size.
8286 (Output_data_const::Output_data_const): Adjust call to base class
8287 constructor and fix data size.
8288 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8289 base class constructor and fix data size.
8290 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8291 base class constructor and fix data size.
8292 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8293 class constructor and fix data size.
8294 (Output_data_group::set_final_data_size): New method definition.
8295 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8296 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8297 class constructor and fix data size.
8298 (Output_relaxed_input_section): New class definition.
8299 (Output_section::Simple_input_section): New class definition.
8300 (Output_section::get_input_sections): Adjust parameter list.
8301 (Output_section::add_input_section_for_script): Same.
8302 (Output_section::save_states, Output_section::restore_states,
8303 Output_section::do_address_and_file_offset_have_reset_values,
8304 (Output_section::Input_section::Input_section): Handle
8305 RELAXED_INPUT_SECTION_CODE. Add new overload for
8306 Output_relaxed_input_section.
8307 (Output_section::Input_section::is_input_section,
8308 Output_section::Input_section::set_output_section): Handle relaxed
8309 input section.
8310 (Output_section::Input_section::is_relaxed_input_section,
8311 Output_section::Input_section::output_section_data,
8312 Output_section::Input_section::relaxed_input_section): New method
8313 definitions.
8314 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8315 value.
8316 (Output_section::Input_section::u1_): Update comments.
8317 (Output_section::Input_section::u2_): Add new union member poris.
8318 (Output_section::Checkpoint_output_section): New classs definition.
8319 (Output_section::relax_input_section): New method declaration.
8320 (Output_section::checkpoint_): New data member.
8321 (Output_segment): Update comments.
8322 (Output_segment::Output_segment): Un-privatize copy constructor.
8323 (Output_segment::operator=): Un-privatize.
8324 * script-sections.cc (Output_section_element::Input_section_list):
8325 Change element type to Output_section::Simple_input_section.
8326 (Output_section_element_dot_assignment::set_section_addresses):
8327 Register output section data for relaxation clean up.
8328 (Output_data_exression::Output_data_expression): Adjust call to base
8329 constructor to fix data size.
8330 (Output_section_element_data::set_section_addresses): Register
8331 Output_data_expression object for relaxation clean up.
8332 (struct Input_section_info): Replace Relobj pointer and section index
8333 pair with Output_section::Simple_input_section and Convert struct to a
8334 class.
8335 (Input_section_sorter::operator()): Adjust access to
e1df38aa 8336 Input_section_info data member to use accessors.
20e6d0d6
DK
8337 (Output_section_element_input::set_section_addresses): Use layout
8338 parameter. Adjust code to use Output_section::Simple_input_section
8339 and Input_secction_info classes. Register filler for relaxation
8340 clean up.
8341 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8342 and section index pair with Output_section::Simple_input_section
8343 class. Adjust code accordingly.
8344 (Phdrs_element::release_segment): New method definition.
8345 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8346 segment list.
8347 (Script_sections::release_segments): New method definition.
8348 * gold/script-sections.h (Script_sections::release_segments): New
8349 method declaration.
8350 * gold/target.h (Target::may_relax, Target::relax,
8351 Target::do_may_relax, Target::do_relax): New method definitions.
8352
5e445df6
ILT
83532009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8354
8355 * arm.cc (has_signed_unsigned_overflow): New function.
8356 (Arm_relocate_functions::abs8): New function.
8357 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8358 (Target_arm::Scan::global): Likewise.
8359 (Target_arm::relocate::relocate): Likewise.
8360 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8361 Likewise.
8362
8c604651 83632009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
8364
8365 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8366 * testsuite/Makefile.in: Regenerate.
8367
1e9cc1c2
NC
83682009-09-11 Nick Clifton <nickc@redhat.com>
8369
8370 * po/gold.pot: Updated by the Translation project.
8371
6a89f575
CC
83722009-09-08 Cary Coutant <ccoutant@google.com>
8373
8374 * output.cc (Output_file::open): Add execute permission to empty file.
8375 * testsuite/Makefile.am (permission_test): New test.
8376 * testsuite/Makefile.in: Regenerate.
8377
fdcac5af
ILT
83782009-09-02 Ian Lance Taylor <iant@google.com>
8379
8380 * output.cc (Output_file::resize): Call map_no_anonymous rather
8381 than map.
8382
44453f85
ILT
83832009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8384
8385 * gold.cc: Include "incremental.h".
8386 (queue_initial_tasks): Call Incremental_checker methods.
8387 * incremental.cc: Include "output.h".
8388 (Incremental_checker::can_incrementally_link_output_file): New
8389 method.
8390 * incremental.h (Incremental_checker): New class.
8391
8392 * output.cc (Output_file::open_for_modification): New method.
8393 (Output_file::map_anonymous): Changed return type to bool. Record
8394 map in base_ field.
8395 (Output_file::map_no_anonymous): New method, broken out of map.
8396 (Output_file::map): Use map_no_anonymous and map_anonymous.
8397 * output.h (class Output_file): Update declarations.
8398
293c1386
CC
83992009-08-24 Cary Coutant <ccoutant@google.com>
8400
8401 * options.h (Command_line::Pre_options): New class.
8402 (Command_line::pre_options): New member.
8403 * options.cc (gold::options::ready_to_register): New variable.
8404 (One_option::register_option): Do nothing if not registering options.
8405 Assert if same short option registered twice.
8406 (General_options::General_options): Turn off option registration when
8407 done constructing.
8408 (Command_line::Pre_options::Pre_options): New constructor.
8409
f773f3d2
CC
84102009-08-24 Cary Coutant <ccoutant@google.com>
8411
06a73cfe
CC
8412 * options.h (General_options::no_keep_memory): Remove incorrect
8413 short option.
f773f3d2 8414
a15af8e2
RW
84152009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8416
8417 * Makefile.am (am__skiplex, am__skipyacc): New.
8418 * Makefile.in: Regenerate.
8419
c462b41b
RW
84202009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8421
14ec8efd
RW
8422 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8423 (INCLUDES): ... this.
8424 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8425 (AM_CPPFLAGS): Renamed from ...
8426 (INCLUDE): ... this.
8427 * Makefile.in, testsuite/Makefile.in: Regenerate.
8428
81ecdfbb
RW
8429 * Makefile.in: Regenerate.
8430 * aclocal.m4: Likewise.
8431 * config.in: Likewise.
8432 * configure: Likewise.
8433 * testsuite/Makefile.in: Likewise.
8434
c462b41b
RW
8435 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8436 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8437 * Makefile.in: Regenerate.
8438 * testsuite/Makefile.in: Regenerate.
8439
2da73f13
CC
84402009-08-19 Cary Coutant <ccoutant@google.com>
8441
8442 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8443 symbols in shared libraries overridden by hidden or internal symbols
8444 in the main program.
8445
2db70501
CD
84462009-08-19 Chris Demetriou <cgd@google.com>
8447
8448 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8449 checking source file names in error messages.
8450
f733487b
DK
84512009-08-18 Doug Kwan <dougkwan@google.com>
8452
8453 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8454 an elcpp::Ehdr as parameter. Adjust call to set_target.
8455 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8456 an elfcpp::Ehdr as parameter.
8457 * object.cc (Object::set_target): Remove the version that looks up
8458 a target and sets it.
8459 (Sized_relobj::setup): Take a Target object instead of
8460 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8461 (make_elf_sized_object): Find target and ask target to
8462 make an ELF object.
8463 * object.h: (Object::set_target): Remove the version that looks up
8464 a target and sets it.
8465 (Sized_relobj::setup): Take a Target object instead of
8466 an elfcpp:Ehdr as parameter.
8467 * target.cc: Include dynobj.h.
8468 (Target::do_make_elf_object_implementation): New.
8469 (Target::do_make_elf_object): New.
8470 * target.h (Target::make_elf_object): New template declaration.
8471 (Target::do_make_elf_object): New method declarations.
8472 (Target::do_make_elf_object_implementation): New template declaration.
8473
cc70f101
ILT
84742009-08-14 Ian Lance Taylor <iant@google.com>
8475
8476 * gold.h (FUNCTION_NAME): Define.
8477 (gold_unreachable): Use FUNCTION_NAME.
8478
ef5e0cb1
ST
84792009-08-12 Sriraman Tallam <tmsriram@google.com>
8480
8481 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8482 symbol in the --keep-unique list is not found.
8483
48c187ce
ST
84842009-08-12 Sriraman Tallam <tmsriram@google.com>
8485
8486 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8487 been maked as --keep-unique.
8488 (Icf::unfold_section): New function.
8489 * icf.h (Icf::unfold_section): New function.
8490 * options.h (General_options::keep_unique): New option.
8491 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8492 * testsuite/Makefile.in: Regenerate.
8493 * testsuite/icf_keep_unique_test.sh: New file.
8494 * testsuite/icf_keep_unique_test.cc: New file.
8495
645afe0c
CC
84962009-08-12 Cary Coutant <ccoutant@google.com>
8497
8498 PR 10471
8499 * resolve.cc (Symbol_table::resolve): Check for references from
8500 dynamic objects to hidden and internal symbols.
8501 * testsuite/Makefile.am (hidden_test.sh): New test.
8502 * testsuite/Makefile.in: Regenerate.
8503 * testsuite/hidden_test.sh: New script.
8504 * testsuite/hidden_test_1.c: New test source.
8505 * testsuite/hidden_test_main.c: New test source.
8506
11af873f
DK
85072009-08-11 Doug Kwan <dougkwan@google.com>
8508
8509 * arm.cc: Update comments.
8510 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8511 segment to locate the .ARM.exidx section if present.
8512
b9f7d72d
DK
85132009-08-09 Doug Kwan <dougkwan@google.com>
8514
8515 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8516 patch.
8517
ddd3c53c
ST
85182009-08-07 Sriraman Tallam <tmsriram@google.com>
8519 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8520 compiler warnings.
8521
27721062
ST
85222009-08-06 Sriraman Tallam <tmsriram@google.com>
8523
8524 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8525 valid tls_segment only for non-debug-section relocations.
8526 * testsuite/Makefile.am: Add gc_tls_test.
8527 * testsuite/Makefile.in: Regenerate.
8528 * testsuite/gc_tls_test.cc: New file.
8529 * testsuite/gc_tls_test.sh: New file.
8530
ef15dade 85312009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 8532
ef15dade
ST
8533 * icf.cc: New file.
8534 * icf.h: New file.
8535 * Makefile.am (CCFILES): Add icf.cc.
8536 (HFILES): Add icf.h
8537 * Makefile.in: Regenerate.
8538 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8539 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8540 section, symbol and addend information for the relocs.
8541 * gold.cc (queue_middle_tasks): Call identical code folding.
8542 * gold.h: Add defines for multimap.
8543 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8544 to the call of finalize_local_symbols.
8545 * main.cc (main): Create object of class Icf.
8546 * object.cc (Sized_relobj::do_layout): Allow this function to be
8547 called twice during icf.
8548 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8549 to sections marked as identical by icf.
8550 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8551 when available.
8552 (Sized_relobj::do_section_entsize): New function.
8553 * object.h (Object::section_entsize): New function.
8554 (Object::do_section_entsize): New pure virtual function.
8555 (Relobj::finalize_local_symbols): Add new parameter.
8556 (Relobj::do_section_entsize): New function.
8557 * options.h (General_options::icf): New option.
8558 (General_options::icf_iterations): New option.
8559 (General_options::print_icf_sections): New option.
8560 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8561 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8562 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8563 icf.
8564 * symtab.cc (Symbol_table::is_section_folded): New function.
8565 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8566 to sections marked as identical by icf.
8567 * symtab.h (Symbol_table::set_icf): New function.
8568 (Symbol_table::icf): New function.
8569 (Symbol_table::is_section_folded): New function.
8570 (Symbol_table::icf_): New data member.
8571 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8572 * testsuite/Makefile.am: Add commands to build icf_test.
8573 * testsuite/Makefile.in: Regenerate.
8574 * testsuite/icf_test.sh: New file.
8575 * testsuite/icf_test.cc: New file.
8576
c3b65ac4
CD
85772009-07-24 Chris Demetriou <cgd@google.com>
8578
8579 * layout.cc (is_compressible_debug_section): Fix incorrect
8580 comment about compressed section names.
8581
1caf2c51
ILT
85822009-07-20 Ian Lance Taylor <ian@airs.com>
8583
8584 PR 10419
8585 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8586
1ef4d87f
ILT
85872009-07-16 Ian Lance Taylor <iant@google.com>
8588
8589 PR 10400
8590 * layout.h: #include <map>.
8591 (class Kept_section): Change from struct to class. Add accessors
8592 and setters. Add section size to Comdat_group mapping. Change
8593 Comdat_group to std::map. Add is_comdat_ field. Add
8594 linkonce_size field in union.
8595 (class Layout): Update declaration of find_or_add_kept_section.
8596 Don't declare find_kept_object.
8597 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8598 parameter. Add object, shndx, is_comdat, and is_group_name
8599 parameters. Change all callers. Adjust for new Kept_section.
8600 (Layout::find_kept_object): Remove.
8601 * object.cc (Sized_relobj::include_section_group): Update use of
8602 Kept_section. Rename secnum to shndx. Only record
8603 Kept_comdat_section if sections are the same size.
8604 (Sized_relobj::include_linkonce_section): Update use of
8605 Kept_section. Only record Kept_comdat_section if sections are the
8606 same size. Set size of linkonce section.
8607 (Sized_relobj::map_to_kept_section): Update call to
8608 get_kept_comdat_section.
8609 * object.h (class Sized_relobj): Rename fields in
8610 Kept_comdat_section to drop trailing underscores; change object
8611 field to Relobj*. Change Kept_comdat_section_table to store
8612 struct rather than pointer.
8613 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8614 Add kept_object and kept_shndx parameters. Change all callers.
8615 (Sized_relobj::get_kept_comdat_section): Change return type to
8616 bool. Add kept_object and kept_shndx parameters. Change all
8617 callers.
8618 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8619 Layout::find_or_add_kept_section.
8620
37c3b7b0
ILT
86212009-07-09 Ian Lance Taylor <iant@google.com>
8622
8623 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8624 Reserve space in the hash table.
8625
98fa85cb
ILT
86262009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8627
8628 * fileread.cc (File_read::get_mtime): New method.
8629 * fileread.h (Timespec): New structure.
8630 (File_read::get_mtime): New method.
8631 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8632 Renamed from timestamp_nsec.
8633 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8634 Elf_Xword.
e1df38aa 8635 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 8636 timestamp_nsec.
e1df38aa 8637 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
8638 (Incremental_inputs::report_obejct): Save mtime; style fix.
8639 (Incremental_inputs::report_script): Save mtime; style fix.
8640 (Incremental_inputs::finalize_inputs): Style fix.
8641 (Incremental_inputs::finalize): Style fix.
8642 (Incremental_inputs::create_input_section_data): Store inputs
8643 mtime.
8644 * incremental.h (Incremental_inputs::report_script): Add mtime
8645 argument.
8646 (Incremental_inputs::Input_info::Input_info): Intialize only one
8647 union member.
8648 (Incremental_inputs::Input_info::archive): Move to nameless
8649 union.
8650 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8651 (Incremental_inputs::Input_info::script): Move to nameless union.
8652 (Incremental_inputs::mtime): New field.
8653 * script.cc (read_input_script): Pass file mtime to
8654 Incremental_input.
8655 * script.h (Script_info::inputs): Style fix.
8656
c9d70757
ILT
86572009-07-01 Ian Lance Taylor <ian@airs.com>
8658
8659 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8660 instead of 32.
8661
9c547ec3
ILT
86622009-06-24 Ian Lance Taylor <iant@google.com>
8663
8664 PR 10156
8665 * layout.cc (Layout::choose_output_section): If we find an
8666 existing section, update the flags.
8667 (Layout::create_notes): New function, broken out of
8668 Layout::finalize.
8669 (Layout::finalize): Don't create note sections.
8670 (Layout::create_note): Don't crash if linker script discards
8671 section.
8672 (Layout::create_gold_note): Likewise.
8673 (Layout::create_build_id): Likewise. Don't set
8674 after_input_sections on the section.
8675 (Layout::create_executable_stack_info): Remove target parameter.
8676 Change caller.
8677 * layout.h (class Layout): Declare create_notes. Update
8678 declaration of create_executable_stack_info.
8679 * gold.cc (queue_middle_tasks): Call create_notes.
8680 * output.cc (Output_section::update_flags_for_input_section): Move
8681 here from output.h. If SHF_ALLOC flag is newly set, mark address
8682 invalid.
8683 * output.h (Output_data::mark_address_invalid): New function.
8684 (class Output_section): Only declare, not define,
8685 update_flags_for_input_section. Remove set_flags.
8686
55458500
ILT
86872009-06-24 Ian Lance Taylor <iant@google.com>
8688
8689 * script-sections.cc (Output_section_definition::
8690 set_section_addresses): Rename shadowing local load_address to
8691 laddr.
8692
1307d6cd
ILT
86932009-06-24 Ian Lance Taylor <iant@google.com>
8694
8695 PR 10244
8696 * reloc.cc (relocate_sections): Skip empty relocation sections.
8697
ec3f783e
ILT
86982009-06-23 Ian Lance Taylor <iant@google.com>
8699
8700 PR 10156
8701 * layout.cc (Layout::create_note): Use choose_output_section
8702 rather than make_output_section.
8703
459c9f1c
ILT
87042009-06-23 Ian Lance Taylor <iant@google.com>
8705
8706 PR 10237
8707 * options.cc (General_options::parse_V): Set printed_version_.
8708 (General_options::General_options): Initialize printed_version_.
8709 * options.h (class General_options): Add printed_version_ field.
8710 * gold.cc (queue_initial_tasks): If there are no input files,
8711 don't give a fatal error if we printed the version information.
8712 (queue_middle_tasks): If using -r with a shared object, give a
8713 fatal error rather than an ordinary error.
8714
1518dc8f
ILT
87152009-06-23 Ian Lance Taylor <iant@google.com>
8716
8717 PR 10219
8718 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8719 (Layout::make_output_section): Set have_stabstr_section_ if we see
8720 a .stab*str section.
8721 (Layout::finalize): Call link_stabs_sections.
8722 (Layout::link_stabs_sections): New file.
8723 * layout.h (class Layout): Add have_stabstr_section_ field.
8724 Declare link_stabs_sections.
8725
3d857b98
DK
87262009-06-23 Doug Kwan <dougkwan@google.com>
8727
8728 * Makefile.am (libgold_a_LIBADD): New.
8729 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8730 * Makefile.in: Regenerate.
8731 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8732 * configure: Regenerate.
8733 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8734 * fileread.cc: Include sys/state.h
8735 * gold.h: Declare memmem and strndup if found missing.
8736 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8737
0639a6f6
ILT
87382009-06-23 Ian Lance Taylor <iant@google.com>
8739
8740 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8741 * configure: Rebuild.
8742
8d63875c
ILT
87432009-06-23 Ian Lance Taylor <iant@google.com>
8744
8745 PR 10147
8746 * object.cc (Object::section_contents): Don't try to get a view if
8747 the section has length zero.
8748 (Object::handle_gnu_warning_section): If the section is empty, use
8749 the name of the section as the warning.
8750
f7c8a183
ILT
87512009-06-23 Ian Lance Taylor <iant@google.com>
8752
8753 PR 10133
8754 * stringpool.h (class Stringpool_template): Add optimize_ field.
8755 (Stringpool_template::set_optimize): New function.
8756 * stringpool.cc (Stringpool_template::Stringpool_template):
8757 Initialize optimize_ field.
8758 (Stringpool_template::set_string_offsets): Test local optimize
8759 fild rather than parameter.
8760 * layout.cc (Layout::Layout): Call set_optimize on the section
8761 name stringpool.
8762
e6a307ba
ILT
87632009-06-22 Ian Lance Taylor <iant@google.com>
8764
8765 PR 10030
8766 * yyscript.y: Parse TARGET.
8767 * script.cc (script_set_target): New function.
8768 * script-c.h (script_set_target): Declare.
8769 * options.cc (General_options::string_to_object_format): Rename
8770 from string_to_object_format in anonymous namespace. Change
8771 callers.
8772 * options.h (class General_options): Declare
8773 string_to_object_format.
8774
3ee173de
ILT
87752009-06-22 Ian Lance Taylor <iant@google.com>
8776
8777 * script-sections.cc (Script_sections::create_segments): Don't put
8778 program headers in a PT_LOAD segment if -n or -N.
8779
87802009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
8781
8782 PR 10141
8783 * options.h (class General_options): Add -z lazy and -z now. Sort
8784 -z options into alphabetical order.
8785 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8786
cd6739a1 87872009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
8788
8789 * layout.cc (Layout::make_output_section): Call
8790 Target::new_output_section.
8791 (Layout::attach_allocated_section_to_segment): Put large section
8792 sections in a separate load segment with the large segment flag
8793 set.
8794 (Layout::segment_precedes): Sort large data segments after other
8795 load segments.
8796 (align_file_offset): New static function.
8797 (Layout::set_segment_offsets): Use align_file_offset.
8798 * output.h (class Output_section): Add is_small_section_ and
8799 is_large_section_ fields.
8800 (Output_section::is_small_section): New function.
8801 (Output_section::set_is_small_section): New function.
8802 (Output_section::is_large_section): New function.
8803 (Output_section::set_is_large_section): New function.
8804 (Output_section::is_large_data_section): New function.
8805 (class Output_segment): Add is_large_data_segment_ field.
8806 (Output_segment::is_large_data_segment): New function.
8807 (Output_segment::set_is_large_data_segment): New function.
8808 * output.cc (Output_section::Output_section): Initialize new
8809 fields.
8810 (Output_segment::Output_segment): Likewise.
8811 (Output_segment::add_output_section): Add assertion that large
8812 data sections always go in large data segments. Force small data
8813 sections to the end of the list of data sections. Force small BSS
8814 sections to the start of the list of BSS sections. For large BSS
8815 sections to the end of the list of BSS sections.
8816 * symtab.h (class Symbol): Declare is_common_shndx.
8817 (Symbol::is_defined): Check Symbol::is_common_shndx.
8818 (Symbol::is_common): Likewise.
8819 (class Symbol_table): Define enum Commons_section_type. Update
8820 declarations. Add small_commons_ and large_commons_ fields.
8821 * symtab.cc (Symbol::is_common_shndx): New function.
8822 (Symbol_table::Symbol_table): Initialize new fields.
8823 (Symbol_table::add_from_object): Put small and large common
8824 symbols in the right list.
8825 (Symbol_table::sized_finalized_symbol): Check
8826 Symbol::is_common_shndx.
8827 (Symbol_table::sized_write_globals): Likewise.
8828 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8829 common symbol lists. Don't call do_allocate_commons_list if the
8830 list is empty.
8831 (Symbol_table::do_allocate_commons_list): Remove is_tls
8832 parameter. Add comons_section_type parameter. Change all
8833 callers. Handle small and large common symbols.
8834 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8835 Symbol::is_common_shndx.
8836 * resolve.cc (symbol_to_bits): Likewise.
8837 * target.h (Target::small_common_shndx): New function.
8838 (Target::small_common_section_flags): New function.
8839 (Target::large_common_shndx): New function.
8840 (Target::large_common_section_flags): New function.
8841 (Target::new_output_section): New function.
8842 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8843 small_common_section_flags, and large_common_section_flags
8844 fields.
8845 (Target::do_new_output_section): New virtual function.
8846 * arm.cc (Target_arm::arm_info): Initialize new fields.
8847 * i386.cc (Target_i386::i386_info): Likewise.
8848 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8849 Likewise.
8850 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8851 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8852 (Target_x86_64::do_new_output_section): New function.
8853 * configure.ac: Define conditional MCMODEL_MEDIUM.
8854 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8855 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8856 (large_LDFLAGS): Define.
8857 * testsuite/large.c: New file.
8858 * testsuite/testfile.cc (Target_test::test_target_info):
8859 Initialize new fields.
8860 * configure, testsuite/Makefile.in: Rebuild.
8861
bb04269c
DK
88622009-06-05 Doug Kwan <dougkwan@google.com>
8863
8864 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 8865 * Makefile.in: Regenerate.
bb04269c
DK
8866 * i386.cc (class Target_i386): Define new virtual method to
8867 override do_is_local_label_name in parent.
8868 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8869 local symbols if --discard-locals or -X is given.
8870 * options.h (class General_options): Declare new options
8871 '--discard-locals' and '-X' for discarding locals.
8872 * target.h (class Target): Define new methods is_local_label_name.
8873 Declare new virtual method do_is_local_label_name.
8874 * target.cc: New file.
8875 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8876 (check_SCRIPTS): Add discard_locals_test.sh.
8877 (check_DATA): Add discard_local_tests.syms.
8878 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8879 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8880 * testsuite/Makefile.in: Regenerate.
8881 * testsuite/discard_locals_test.c: New file.
8882 * testsuite/discard_locals_test.sh: Same.
8883
805bb01c
DK
88842009-06-05 Doug Kwan <dougkwan@google.com>
8885
8886 * object.cc (Sized_relobj::Sized_relobj): Initialize
8887 discarded_eh_frame_shndx_ to -1U.
8888 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8889 section.
8890 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8891 a discarded .eh_frame section.
8892 (Sized_relobj::do_finalize_local_symbols): Ditto.
8893 * object.h (class Sized_relobj): Declare new member
8894 discarded_eh_frame_shndx_.
8895 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8896 (local_labels_test.o, local_labels_test): New rules.
8897 * testsuite/Makefile.in: Regenerate.
8898
1dcd334d
DK
88992009-06-04 Doug Kwan <dougkwan@google.com>
8900
8901 * layout.cc (Layout::section_name_mapping): Add mapping for
8902 special ARM sections.
8903
96d49306
DK
89042009-06-03 Doug Kwan <dougkwan@google.com>
8905
8906 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8907 (utils::has_overflow): Same.
8908
dff16297
ILT
89092009-06-03 Ian Lance Taylor <iant@google.com>
8910
8911 * layout.cc (Layout::section_name_mapping): New array, replacing
8912 Layout::linkonce_mapping.
8913 (Layout::section_name_mapping_count): New variable, replacing
8914 Layout::linkonce_mapping_count.
8915 (Layout::linkonce_output_name): Remove.
8916 (Layout::output_section_name): Rewrite.
8917 * layout.h (class Layout): Rename Linkonce_mapping to
8918 Section_name_mapping, linkonce_mapping to section_name_mapping,
8919 linkonce_mapping_count to section_name_mapping_count. Don't
8920 declare linkonce_output_name.
8921
c121c671
DK
89222009-06-03 Doug Kwan <dougkwan@google.com>
8923
8924 * gold/arm.cc (namespace utils): New.
8925 (Target_arm::reloc_is_non_pic): Define new method.
8926 (class Arm_relocate_functions): New.
8927 (Target_arm::Relocate::relocate): Handle relocation types used by
8928 Android.
8929
07800fab
ILT
89302009-06-03 Ian Lance Taylor <iant@google.com>
8931
8932 * arm.cc (Target_arm::scan::global): Use || instead of |.
8933
c121c671
DK
89342009-06-02 Doug Kwan <dougkwan@google.com>
8935
8936 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8937 issued_non_pic_error_.
8938 (class Target_arm::Scan): Declare new method check_non_pic.
8939 Define new method symbol_needs_plt_entry.
8940 Declare new data member issued_non_pic_error_.
8941 (class Target_arm::Relocate): Declare new method
8942 should_apply_static_reloc.
8943 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8944 (Target_arm::Scan::check_non_pic): Define new method.
8945 (Target_arm::Scan::local): Handle a small subset of reloc types used
8946 by Android.
8947 (Target_arm::Scan::local): Same.
8948 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8949
b19b0c6d
ILT
89502009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8951
8952 * incremental.cc (Incremental_inputs::report_command_line): Filter
8953 out --incremental-* options.
8954
94cdfcff
DK
89552009-05-29 Doug Kwan <dougkwan@google.com>
8956
8957 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8958 template class.
8959 (class Target_arm): Update comment.
8960 (Target_arm::Target_arm): Initialize new data members GOT_,
8961 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8962 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8963 and Target_arm::rel_dyn_section.
8964 Declare new_enum Target_arm::Got_type.
8965 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8966 and DYNBSS_.
8967 Update commments for member do_dynsym_value.
8968 (Target_arm::got_size, Target_arm::plt_section,
8969 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8970 new methods inside class defintion.
8971 (Target_arm::got_section): Define new method.
8972 (Target_arm::rel_dyn_section): Same.
8973 (Output_data_plt_arm): New template class.
8974 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8975 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8976 (Output_data_plt_arm::add_entry): Same.
8977 (Output_data_plt_arm::first_plt_entry): Define new
8978 static data member for PLT instruction template.
8979 (Output_data_plt_arm::plt_entry): Same.
8980 (Output_data_plt_arm::do_write): Define new method.
8981 (Target_arm::make_plt_entry): Same.
8982 (Target_arm::do_finalize_sections): Same.
8983 (Target_arm::do_dynsym_value): Same.
8984
4a657b0d
DK
89852009-05-28 Doug Kwan <dougkwan@google.com>
8986
8987 * Makefile.am (TARGETSOURCES): Add arm.cc.
8988 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8989 * Makefile.in: Regenerate.
8990 * arm.cc: New file.
8991 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8992
e7ae8c36
DK
89932009-05-26 Doug Kwan <dougkwan@google.com>
8994
8995 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8996 (General_options::check_excluded_libs): Strip off directories in
8997 archive name before matching like GNU ld does.
8998 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8999 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9000 (exclude_libs_test_LDFLAGS): Add linker option
9001 -Wl,--exclude-libs,libexclude_libs_test_3
9002 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9003 an explicit archive without using -l.
9004 (alt/libexclude_libs_test_3.a): New make rule.
9005 * testsuite/Makefile.in: Regenerate.
9006 * testsuite/exclude_libs_test.c : Declare lib3_default().
9007 (main): Call it.
9008 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9009 * exclude_libs_test_3.c: New file.
9010
f12e7348
NC
90112009-05-26 Nick Clifton <nickc@redhat.com>
9012
9013 * po/id.po: New Indonesian translation.
9014 * po/gold.pot: Updated template file.
9015
4daadc0d
ST
90162009-05-22 Sriraman Tallam <tmsriram@google.com>
9017
e1df38aa 9018 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
9019 gc_comdat_test files. Add -Wl,--gc-sections to build
9020 gc_comdat_test.
9021 * testsuite/Makefile.in: Regenerate.
9022 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9023
531813ad
ST
90242009-05-21 Sriraman Tallam <tmsriram@google.com>
9025
9026 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9027 kept comdat section was garbage collected.
9028 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9029 * testsuite/Makefile.in: Regenerate.
9030 * testsuite/gc_comdat_test.sh: New file.
9031 * testsuite/gc_comdat_test_1.cc: New file.
9032 * testsuite/gc_comdat_test_2.cc: New file.
9033
65514900
CC
90342009-05-19 Doug Kwan <dougkwan@google.com>
9035
9036 * archive.cc (Archive::Archive): Move constructor from archive.h
9037 to here. Initialize no_export_.
9038 (Archive::get_elf_object_for_member): Set no_export flag of object.
9039 * archive.h (Archive::Archive): Move constructor body to
9040 archive.cc.
9041 (Archive::no_export): New method.
9042 (Archive::no_export_): New field.
9043 * object.h (Object::Object): Initialize no_export_ to false.
9044 (Object::no_export, Object::set_no_export): New methods.
9045 (Object::no_export_): New field.
9046 * options.cc (General_options::parse_exclude_libs): New method.
9047 (General_options::check_excluded_libs) Same.
9048 * options.h (exclude_libs): New option.
9049 (General_options::check_excluded_libs): New method declaration.
9050 (General_options::excluded_libs_): New field.
9051 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9052 default or protected visibility if an object has no-export flag set.
9053 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9054 (check_SCRIPTS): Add exclude_libs_test.sh.
9055 (check_DATA): Add exclude_libs_test.syms.
9056 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9057 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9058 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9059 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9060 (exclude_libs_test.syms, libexclude_libs_test_1.a,
9061 libexclude_libs_test_2.a): New rules.
9062 * testsuite/Makefile.in: Regenerate.
9063 * testsuite/exclude_libs_test.c: New file.
9064 * testsuite/exclude_libs_test.sh: Ditto.
9065 * testsuite/exclude_libs_test_1.c: Ditto.
9066 * testsuite/exclude_libs_test_2.c: Ditto.
9067
1b77ea50
ILT
90682009-05-15 Ian Lance Taylor <iant@google.com>
9069
9070 * configure.ac: Check for declarations for cases where libiberty.h
9071 checks HAVE_DECL_xxx.
9072 * configure, config.in: Rebuild.
9073
072fe7ce
ILT
90742009-05-15 Mikolaj Zalewski <mikolajz@google.com>
9075
9076 * gold.h (Incremental_argument_list): Remove (invalid) forward
9077 declaration.
9078 * incremental.cc (Incremental_inputs::report_achive): New method.
9079 (Incremental_inputs::report_object): New method.
9080 (Incremental_inputs::report_script): New method.
9081 (Incremental_inputs::finalize_inputs): New method.
9082 (Incremental_inputs::finalize): Call finalize_inputs().
9083 (Incremental_inputs::sized_create_incremental_inputs_section_data):
9084 Create inputs entries.
9085 * incremental.h (Incremental_input_type): New enum.
9086 (Incremental_inputs::Incremental_input): Initialize new fields.
9087 (Incremental_inputs::report_inputs): New method.
9088 (Incremental_inputs::report_achive): New method.
9089 (Incremental_inputs::report_object): New method.
9090 (Incremental_inputs::report_script): New method.
9091 (Incremental_inputs::finalize_inputs): New method.
9092 (Incremental_inputs::Input_info): New struct.
9093 (Incremental_inputs::Input_info_map): New typedef.
9094 (Incremental_inputs::lock_): New field.
9095 (Incremental_inputs::Inputs_): New field.
9096 (Incremental_inputs::Inputs_map): New field.
9097 * main.cc (main): Call Incremental_input::report_inputs.
9098 * options.h (Input_argument_list): Typedef moved from
9099 Input_arguments.
9100 (Input_file_group::Files): Remove, use ::Input_argument_list.
9101 (Input_file_group::Input_argument_list): Remove, use
9102 ::Input_argument_list.
9103 * plugin.cc (Plugin_manager::add_input_file): Add error in
9104 incremental build.
9105 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9106 functions.
9107 * script.cc (read_input_script): Call
9108 Incremental_input::report_script.
9109 * script.h (Script_info): New class.
9110
b0481b0b
ILT
91112009-04-27 Ian Lance Taylor <iant@google.com>
9112
9113 * x86_64.cc (do_adjust_output_section): Set entsize to
9114 plt_entry_size.
9115
b22a5a41 91162009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
9117
9118 * output.cc (Output_file::close): After short writes, continue
9119 writing from the correct offset in the buffer being written.
9120
40fde488
CD
91212009-04-23 Chris Demetriou <cgd@google.com>
9122
9123 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
9124 * configure: Regenerate.
9125 * config.in: Regenerate.
9126 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
9127 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
9128
3ce2c28e
ILT
91292009-04-21 Mikolaj Zalewski <mikolajz@google.com>
9130
9131 * incremental.cc (Incremental_inputs_header_data): Renamed from
9132 Incremental_input_header_data.
9133 (Incremental_inputs_header_data::data_size): New field.
9134 (Incremental_inputs_header_data::put_input_file_count): Renamed
9135 from input_file_count.
9136 (Incremental_inputs_header_data::put_command_line_offset): Renamed
9137 from command_line_offset.
9138 (Incremental_inputs_header_data::put_reserved): Renamed from
9139 put_reserved.
9140 (Incremental_inputs_entry_data): Renamed from
9141 Incremental_input_entry_data.
9142 (Incremental_inputs_entry_data::data_size): New field.
9143 (Incremental_inputs::report_command_line): New method.
9144 (Incremental_inputs::finalize): New method.
9145 (Incremental_inputs::create_incremental_inputs_data): New method.
9146 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
9147 * incremental.h: New file.
9148 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
9149 (Layout::finalize): Create incremental inputs section in
9150 incremental builds.
9151 (Layout::create_incremental_info_sections): New method.
9152 * layout.h (Layout::incremental_inputs): New method.
9153 (Layout::create_incremental_info_sections): New method.
9154 (Layout::incremental_inputs_): New field.
9155 * main.cc (main): Notify Incremental_input of the command line.
9156
e55bde5e
ILT
91572009-04-01 Ian Lance Taylor <iant@google.com>
9158 Mikolaj Zalewski <mikolajz@google.com>
9159
9160 * gold.h (reserve_unordered_map): Define, three versions, one for
9161 each version of Unordered_map.
9162 * layout.cc (Layout::Layout): Remove options parameter. Add
9163 number_of_input_files parameter. Don't initialize options_.
9164 Initialize number_of_input_files_ and resized_signatures_. Move
9165 sections_are_attached_.
9166 (Layout::layout_group): Reserve space for group_signatures_.
9167 (Layout::find_or_add_kept_section): Change name parameter to be a
9168 reference. Resize signatures_ map when it gets large enough.
9169 (Layout::layout_eh_frame): Use parameters->options() instead of
9170 this->options_.
9171 (Layout::make_output_section): Likewise.
9172 (Layout::attach_allocated_section_to_segment): Likewise.
9173 (Layout::finalize, Layout::create_executable_stack): Likewise.
9174 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
9175 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
9176 * layout.h (class Layout): Update declarations. Remove options_
9177 field. Add number_of_input_files_ and resized_signatures_
9178 fields. Move sections_are_attached_ field.
9179 * main.cc (main): Pass number of input files to Layout
9180 constructor. Don't pass options.
9181
154b857c
ILT
91822009-03-30 Ian Lance Taylor <iant@google.com>
9183
9184 * ffsll.c (ffsll): Correct implementation.
9185
2f35ab9b
ILT
91862009-03-27 Ian Lance Taylor <iant@google.com>
9187
fd03461a
ILT
9188 * ffsll.c: New file.
9189 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
9190 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
9191 * ftruncate.c (ftruncate): Declare before definition.
9192 * mremap.c (mremap): Likewise.
9193 * pread.c (pread): Likewise.
9194 * configure, Makefile.in, config.in: Rebuild.
9195
2f35ab9b
ILT
9196 * mremap.c: New file.
9197 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
9198 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
9199 (mremap): Declare if HAVE_MREMAP is not defined.
9200 * configure, Makefile.in, config.in: Rebuild.
9201
33aea2fd
CC
92022009-03-27 Cary Coutant <ccoutant@google.com>
9203
9204 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
9205 position independent.
9206 * sparc.cc (Target_sparc::check_non_pic): Likewise.
9207 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
9208
6d479619
CC
92092009-03-24 Cary Coutant <ccoutant@google.com>
9210
9211 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
9212 an executable.
9213 (needs_dynamic_reloc): Likewise.
9214
afc06bb8
ILT
92152009-03-24 Ian Lance Taylor <iant@google.com>
9216
9217 * yyscript.y (file_cmd): Recognize EXTERN.
9218 (extern_name_list, extern_name_list_body): New nonterminals.
9219 * script.cc (script_add_extern): Define.
9220 * script-c.h (script_add_extern): Declare.
9221
f6060a4d
ILT
92222009-03-24 Rafael Avila de Espindola <espindola@google.com>
9223
9224 * object.cc (is_elf_object): Define.
9225 * object.h (is_elf_object): Declare.
9226 * archive.cc (Archive::get_elf_object_for_member): Call
9227 is_elf_object.
33aea2fd 9228 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 9229
26736d8e
ILT
92302009-03-24 Elliott Hughes <enh@google.com>
9231
9232 * output.cc (Output_file::map_anonymous): Define.
9233 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9234 try an anonymous one. Report the size if the mmap fails.
9235 * output.h (class Output_file): Declare map_anonymous.
9236
22fd9730
ILT
92372009-03-24 Ian Lance Taylor <iant@google.com>
9238
9239 * target-select.cc (instantiate_target): Don't acquire the lock if
9240 the instantiated_target_ field has already been set.
9241
cb010894
ILT
92422009-03-23 Ian Lance Taylor <iant@google.com>
9243
7f055c20
ILT
9244 * gold-threads.h (class Initialize_lock): Define.
9245 * gold-threads.cc (class Initialize_lock_once): Define.
9246 (initialize_lock_control): New static variable.
9247 (initialize_lock_pointer): New static variable.
9248 (initialize_lock_once): New static function.
9249 (Initialize_lock::Initialize_lock): Define.
9250 (Initialize_lock::initialize): Define.
9251 * target-select.h: Include "gold-threads.h".
9252 (class Target_selector): Add lock_ and initialize_lock_ fields.
9253 Don't define instantiate_target, just declare it.
9254 * target-select.cc (Target_selector::Target_selector): Initialize
9255 new fields.
9256 (Target_selector::instantiate_target): Define.
9257 * descriptors.h: Include "gold-threads.h".
9258 (class Descriptors): Add initialize_lock_ field.
9259 * descriptors.cc (Descriptors::Descriptors): Initialize new
9260 field.
9261 (Descriptors::open): Use initialize_lock_ field
9262 * errors.h (class Errors): Add initialize_lock_ field.
9263 * errors.cc (Errors::Errors): Initialize new field.
9264 (Errors::initialize_lock): Use initialize_lock_ field.
9265 * powerpc.cc (class Target_selector_powerpc): Remove
9266 instantiated_target_ field. In do_recognize call
9267 instantiate_target rather than do_instantiate_target. In
9268 do_instantiate_target just allocate a new target.
9269 * sparc.cc (class Target_selector_sparc): Likewise.
9270
36959681
ILT
9271 * freebsd.h: New file.
9272 * i386.cc: Include "freebsd.h".
9273 (Target_i386): Derive from Target_freebsd rather than
9274 Sized_target.
9275 (Target_selector_i386): Derive from Target_selector_freebsd rather
9276 than Target_selector.
9277 * x86_64.cc: Include "freebsd.h".
9278 (Target_x86_64): Derive from Target_freebsd rather than
9279 Sized_target.
9280 (Target_selector_x86_64): Derive from Target_selector_freebsd
9281 rather than Target_selector.
9282 * target.h (class Target): Add adjust_elf_header and
9283 do_adjust_elf_header.
9284 * output.cc (Output_file_header:: do_sized_write): Call target
9285 adjust_elf_header routine.
9286 * configure.tgt: Set targ_osabi.
9287 * configure.ac: Define GOLD_DEFAULT_OSABI.
9288 * parameters.cc (Parameters::default_target): Pass
9289 GOLD_DEFAULT_OSABI to select_target.
9290 * target-select.h (class Target_selector): Make instantiate_target
9291 protected rather than private.
9292 * Makefile.am (HFILES): Add freebsd.h.
9293 * configure, Makefile.in, config.in: Rebuild.
9294
cb010894
ILT
9295 * merge.cc (do_add_input_section): Correct pend value. Change
9296 message about last entry not being null terminated from error to
9297 warning.
9298
0e879927
ILT
92992009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9300
9301 * incremental.cc: New file.
9302 * Makefile.am (CCFILES): Add incremental.cc.
9303 * Makefile.in: Rebuild.
9304
41105937
PP
93052009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9306
9307 * layout.cc (Layout::output_section_name): Preserve names
9308 of '.note.' sections.
e1df38aa 9309
60439920
ILT
93102009-03-19 Ian Lance Taylor <iant@google.com>
9311
9312 * descriptors.cc (Descriptors::open): Check that the options are
9313 valid before using them.
9314
0d371ad3
ILT
93152009-03-18 Ian Lance Taylor <iant@google.com>
9316
9317 * script-sections.h: Include <list>.
9318 (class Script_sections): Change Sections_elements from std::vector
9319 to std::list. Typedef public Elements_iterator. Add
9320 orphan_section_placement_, data_segment_align_start_, and
9321 saw_data_segment_align_ fields. Remove data_segment_align_index_
9322 field.
9323 * script-sections.cc (class Orphan_section_placement): New class.
9324 (class Sections_element): Add virtual functions is_relro and
9325 orphan_section_init. Remove virtual function place_orphan_here.
9326 (class Output_section_definition): Add is_relro and
9327 orphan_section_init. Remove place_orphan_here.
9328 (class Orphan_output_section): Likewise.
9329 (Script_sections::Script_sections): Update for field changes.
9330 (Script_sections::data_segment_align): Set saw_data_segment_align_
9331 and data_segment_align_start_, not data_segment_align_index.
9332 (Script_sections::data_segment_relro_end): Check
9333 saw_data_segment_align_. Use data_segment_align_start_ rather
9334 than data_segment_align_index_.
9335 (Script_sections::place_orphan): Rewrite to use
9336 Orphan_section_placement.
9337
9201d894
ILT
93382009-03-17 Ian Lance Taylor <iant@google.com>
9339
9c5b8369
ILT
9340 * archive.cc (Archive::add_symbols): Check for a version attached
9341 to the symbol name in the archive map.
9342 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9343 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9344 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9345 (ver_test_11.a): New target.
9346 * testsuite/Makefile.in: Rebuild.
9347
9201d894
ILT
9348 * configure.ac: Check for chsize and posix_fallocate. Replace
9349 ftruncate.
9350 * ftruncate.c: New file, from gnulib.
9351 * output.cc (posix_fallocate): Define dummy version if not
9352 HAVE_POSIX_FALLOCATE.
9353 (Output_file::map): Call posix_fallocate rather than lseek and
9354 write.
9355 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9356 * configure, Makefile.in, config.in: Rebuild.
9357
ef4ab7a8 93582009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 9359
ef4ab7a8
PP
9360 * layout.h (Layout::create_note): Add section_name parameter.
9361 * layout.cc (Layout::create_note): Likewise.
9362 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 9363
8c500701
ILT
93642009-03-17 Ian Lance Taylor <iant@google.com>
9365
e85b18e1
ILT
9366 * descriptors.cc: Include "options.h".
9367 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9368 (Descriptors::open): Always use O_CLOEXEC when opening a new
9369 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9370 then set FD_CLOEXEC.
9371
9efe6174
ILT
9372 * sparc.cc (class Target_sparc): Add has_got_section.
9373 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9374 make sure we have a GOT section.
9375
9376 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9377 (Target_sparc::Scan::local): Likewise.
9378 (Target_sparc::Scan::global): Likewise.
9379 (Target_sparc::Relocate::relocate): Likewise.
9380 (Target_sparc::Relocate::relocate_tls): Likewise.
9381
8c500701
ILT
9382 * symtab.cc (Symbol_table::define_default_version): New function,
9383 broken out of add_from_object.
9384 (Symbol_table::add_from_object): Call define_default_version.
9385 (Symbol_table::define_special_symbol): Add resolve_oldsym
9386 parameter. Change all callers. If the version for a symbol comes
9387 from a version script, resolve it with the symbol with the same
9388 name with no version. Also add the symbol without a version if
9389 appropriate.
9390 (do_define_in_output_data): If resolving with oldsym, don't delete
9391 sym.
9392 (do_define_in_output_segment): Likewise.
9393 (do_define_as_constant): Likewise.
9394 * symtab.h (class Symbol_table): Update declarations.
9395
f1ed28fb
ILT
93962009-03-13 Ian Lance Taylor <iant@google.com>
9397
15f8229b
ILT
9398 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9399 (Read_symbols::requeue): New function.
9400 (Read_symbols::do_read_symbols): If make_elf_object fails because
9401 the target type is not configured, and the file was searched for,
9402 issue a warning and retry with the next directory.
9403 (Add_symbols::run): If the file has an incompatible format, and
9404 it was searched for, requeue the Read_symbols task. On error,
9405 release the object.
9406 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9407 dirindex parameter to constructor. Change all callers. Declare
9408 incompatible_warning and requeue.
9409 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9410 input_argument_ and input_group_ fields. Add them to
9411 constructor. Change all callers.
9412 (class Read_script): Add dirindex_ field. Add it to constructor.
9413 Change all callers.
9414 * archive.cc (Archive::setup): Remove input_objects parameter.
9415 Change all callers.
9416 (Archive::get_file_and_offset): Likewise.
9417 (Archive::read_all_symbols): Likewise.
9418 (Archive::read_symbols): Likewise.
9419 (Archive::get_elf_object_for_member): Remove input_objects
9420 parameter. Add punconfigured parameter. Change all callers.
9421 (Archive::add_symbols): Change return type to bool. Check return
9422 value of include_member.
9423 (Archive::include_all_members): Likewise.
9424 (Archive::include_member): Change return type to bool. Return
9425 false if first included object has incompatible target. Set
9426 included_member_ field.
9427 (Add_archive_symbols::run): If add_symbols returns false, requeue
9428 Read_symbols task.
9429 * archive.h (class Archive): Add included_member_ field.
9430 Initialize it in constructor. Add input_file and searched_for
9431 methods. Update declarations.
9432 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9433 input_argument_ fields. Add them to constructor. Change all
9434 callers.
9435 * script.cc: Include "target-select.h".
9436 (class Parser_closure): Add skip_on_incompatible_target_ and
9437 found_incompatible_target_ fields. Add
9438 skip_on_incompatible_target parameter to constructor. Change all
9439 callers. Add methods skip_on_incompatible_target,
9440 clear_skip_on_incompatible_target, found_incompatible_target, and
9441 set_found_incompatible_target.
9442 (read_input_script): Add dirindex parameter. Change all callers.
9443 If parser finds an incompatible target, requeue Read_symbols
9444 task.
9445 (script_set_symbol): Clear skip_on_incompatible_target in
9446 closure.
9447 (script_add_assertion, script_parse_option): Likewise.
9448 (script_start_sections, script_add_phdr): Likewise.
9449 (script_check_output_format): New function.
9450 * script.h (read_input_script): Update declaration.
9451 * script-c.h (script_check_output_format): Declare.
9452 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9453 (ignore_cmd): Remove OUTPUT_FORMAT.
9454 * fileread.cc (Input_file::Input_file): Add explicit this.
9455 (Input_file::will_search_for): New function.
9456 (Input_file::open): Add pindex parameter. Change all callers.
9457 * fileread.h (class Input_file): Add input_file_argument method.
9458 Declare will_search_for. Update declarations.
9459 * object.cc (make_elf_object): Add punconfigured parameter.
9460 Change all callers.
9461 * object.h (class Object): Make input_file public. Add
9462 searched_for method.
9463 (make_elf_object): Update declaration.
9464 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9465 restart search.
9466 * dirsearch.h (class Dirsearch): Update declaration.
9467 * options.h (class General_options): Add --warn-search-mismatch.
9468 * parameters.cc (Parameters::is_compatible_target): New function.
9469 * parameters.h (class Parameters): Declare is_compatible_target.
9470 * workqueue.cc (Workqueue::add_blocker): New function.
9471 * workqueue.h (class Workqueue): Declare add_blocker.
9472
f1ed28fb
ILT
9473 * fileread.cc (Input_file::open): Remove options parameter.
9474 Change all callers.
9475 (Input_file::open_binary): Likewise.
9476 * script.cc (read_input_script): Likewise.
9477 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9478 options parameter from constructor. Change all callers.
9479 (class Read_script): Likewise.
9480 * fileread.h (class Input_file): Update declarations.
9481 * script.h (read_input_script): Update declaration.
9482
34dd024a
NC
94832009-03-10 Nick Clifton <nickc@redhat.com>
9484
9485 * po/es.po: New Spanish translation.
9486
6d71b17c
CC
94872009-03-06 Cary Coutant <ccoutant@google.com>
9488
9489 * options.cc (parse_short_option): Keep dash_z from registering itself.
9490
031cdbed
ILT
94912009-03-03 Ian Lance Taylor <iant@google.com>
9492
9493 PR 9918
9494 * target-reloc.h (relocate_section): Pass output_section to
9495 relocate.
9496 * i386.cc (Target_i386::should_apply_static_reloc): Add
9497 output_section parameter. Change all callers.
9498 (Target_i386::Relocate::relocate): Add output_section parameter.
9499 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9500 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9501 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9502 * testsuite/two_file_shared.sh: New script.
9503 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9504 (check_DATA): Add two_file_shared.dbg.
9505 (two_file_shared.dbg): New target.
9506 * testsuite/Makefile.in: Rebuild.
9507
15d5fa16
ILT
95082009-03-01 Ian Lance Taylor <iant@google.com>
9509
9510 * configure.ac: Check for byteswap.h.
9511 * configure: Rebuild.
9512 * config.in: Rebuild.
9513
8a4c0b0d
ILT
95142009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9515
9516 * layout.cc (Layout::find_or_add_kept_section): New function.
9517 (Layout::add_comdat): Removed.
9518 * layout.h (struct Kept_section): Move out of class Layout.
9519 Remove trailing underscores from field names. Add group_sections
9520 field. Rename group_ field to is_group. Change all uses.
9521 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9522 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9523 comdat_groups_ field.
9524 (Sized_relobj::include_section_group): Use
9525 find_or_add_kept_section and Kept_section::group_sections.
9526 (Sized_relobj::include_linkonce_section): Likewise.
9527 * object.cc (class Sized_relobj): Don't define Comdat_group or
9528 Comdat_group_table. Remove find_comdat_group and
9529 add_comdat_group. Remove comdat_groups_ field.
9530 * plugin.cc (include_comdat_group): Use
9531 Layout::find_or_add_kept_section.
9532
b4ecf66b
ILT
95332009-02-28 Ian Lance Taylor <iant@google.com>
9534
14359ca0
ILT
9535 * README: --gc-sections and map files are now supported. Document
9536 some build requirements.
9537
b4ecf66b
ILT
9538 PR 6992
9539 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9540 relocatable link set the value of the section symbol to zero.
9541 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9542 relocatable link don't include the section address in the local
9543 symbol value.
9544
0602e05a
ILT
95452009-02-27 Ian Lance Taylor <iant@google.com>
9546
fd9d194f
ILT
9547 PR 6811
9548 * options.h (class Search_directory): Add is_system_directory.
9549 (class General_options): Declare is_in_system_directory.
9550 * options.cc (get_relative_sysroot): Make static.
9551 (get_default_sysroot): Make static.
9552 (General_optoins::is_in_system_directory): New function.
9553 * fileread.cc (Input_file::is_in_system_directory): New function.
9554 * fileread.h (class Input_file): Declare is_in_system_directory.
9555 * object.h (class Object): Add is_in_system_directory.
9556 (class Input_objects): Remove system_library_directory_ field.
9557 * object.cc (Input_objects::add_object): Don't set
9558 system_library_directory_.
9559 (input_objects::found_in_system_library_directory): Remove.
9560 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9561 parameter. Change all callers.
9562 (Symbol_table::sized_write_globals): Likewise.
9563 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9564 Call Object::is_in_system_directory.
9565 * symtab.h (class Symbol_table): Update declarations.
9566
61edd21f
ILT
9567 PR 5990
9568 * descriptors.h (Open_descriptor): Add is_on_stack field.
9569 * descriptors.cc (Descriptors::open): If the descriptor is on the
9570 top of the stack, remove it. Initialize is_on_stack field.
9571 (Descriptors::release): Only add pod to stack if it is not on the
9572 stack already.
9573 (Descriptors::close_some_descriptor): Clear stack_next and
9574 is_on_stack fields.
9575
e29e076a
ILT
9576 PR 7091
9577 * output.cc (Output_section::find_starting_output_address): Rename
9578 from starting_output_address; add PADDR parameter; change return
9579 type.
9580 * output.h (class Output_section): Declare
9581 find_starting_output_address instead of starting_output_address.
9582 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9583 section symbol for which we can't find a merge section.
9584
0602e05a
ILT
9585 PR 9836
9586 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9587 hidden or internal, force the symbol to be local.
9588 * resolve.cc (Symbol::override_visibility): Define.
9589 (Symbol::override_base): Use override_visibility.
9590 (Symbol_table::resolve): Likewise.
9591 (Symbol::override_base_with_special): Likewise.
9592 (Symbol_table::override_with_special): If the visibility is hidden
9593 or internal, force the symbol to be local.
9594 * symtab.h (class Symbol): Add set_visibility and
9595 override_visibility.
9596 * testsuite/ver_test_1.sh: New file.
9597 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9598 (check_DATA): Add ver_test_1.syms.
9599 (ver_test_1.syms): New target.
9600 * testsuite/Makefile.in: Rebuild.
9601
401a9a73
CC
96022009-02-25 Cary Coutant <ccoutant@google.com>
9603
9604 * layout.cc (Layout::choose_output_section): Don't rename sections
9605 when using a linker script that has a SECTIONS clause.
9606 * Makefile.in: Regenerate.
9607
9608 * testsuite/Makefile.am (script_test_5.sh): New test case.
9609 * testsuite/Makefile.in: Regenerate.
9610 * testsuite/script_test_5.cc: New file.
9611 * testsuite/script_test_5.sh: New file.
9612 * testsuite/script_test_5.t: New file.
9613
f488e4b0
CC
96142009-02-13 Rafael Avila de Espindola <espindola@google.com>
9615
9616 * archive.cc (Archive::include_member): Update calls to add_symbols.
9617 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9618 the Layout argument.
9619 * dynobj.h (do_add_symbols): Add the Layout argument.
9620 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9621 Layout argument.
9622 * object.h (Object::add_symbols): Add the Layout argument.
9623 (Object::do_add_symbols): Add the Layout argument.
9624 (Sized_relobj::do_add_symbols): Add the Layout argument.
9625 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9626 Unify the two versions.
9627 (Add_plugin_symbols): Remove.
9628 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9629 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9630 (Add_plugin_symbols): Remove.
9631 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9632 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9633 (Add_symbols::run): Make it work with Pulginobj.
9634
89dd1680
ILT
96352009-02-06 Ian Lance Taylor <iant@google.com>
9636
9637 * object.cc (Sized_relobj::do_layout): Make info message start
9638 with lower case letter.
9639
266d0a74
ILT
96402009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9641
602b464e
ILT
9642 * binary.cc: Fix file comment.
9643
266d0a74
ILT
9644 * options.h (enum Incremental_disposition): Define.
9645 (class General_options): Add new options: --incremental,
9646 --incremental_changed, --incremental_unchanged,
9647 --incremental_unknown. Add incremental_disposition_ and
9648 implicit_incremental_ fields.
9649 (General_options::incremental_disposition): New function.
9650 (class Position_dependent_options): Add incremental_disposition
9651 option.
9652 (Position_dependent_options::copy_from_options): Set incremental
9653 dispositions.
9654 * options.cc (General_options::parse_incremental_changed): New
9655 function.
9656 (General_options::parse_incremental_unchanged): New function.
9657 (General_options::parse_incremental_unknown): New function.
9658 (General_options::General_options): Initialize new fields
9659 incremental_disposition_ and implicit_incremental_.
9660 (General_options::finalize): Check for uasge of --incremental-*
9661 without --incremental.
9662
f073bbf7
CD
96632009-02-06 Chris Demetriou <cgd@google.com>
9664
9665 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9666 pointer and to report location as the file name associated with
9667 the symbol.
9668 (gold_undefined_symbol_at_location): New function to replace the
9669 old gold_undefined_symbol functionality.
9670 * target-reloc.h (relocate_section): Update to use
9671 gold_undefined_symbol_at_location.
9672 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9673 Call gold_undefined_symbol function rather than gold_error.
9674 * errors.h (Errors::undefined_symbol): Take location as a
9675 string, rather than calculating it from a relocation.
9676 * errors.cc (Errors::fatal): Print "fatal error:" before the
9677 formatted message.
9678 (Errors::error, Errors::error_at_location): Print "error: "
9679 before the formatted message.
9680 (Errors::undefined_symbol): Take location as a string, rather
9681 than calculating it from a relocation.
9682 (gold_undefined_symbol_at_location): New function akin to
9683 old gold_undefined_symbol, calculates location from relocation.
9684 (gold_undefined_symbol): Change to take only a Symbol pointer
9685 and to report location as the file name associated with the symbol.
9686 * testsuite/debug_msg.sh: Update for changed error messages.
9687 * testsuite/undef_symbol.sh: Likewise.
9688
8e94a90c
ILT
96892009-02-04 Duncan Sands <baldrick@free.fr>
9690
9691 PR 9812
9692 * reduced_debug_output.h
9693 (Output_reduced_debug_abbrev_section::failed): Use format for
9694 gold_warning.
9695 (Output_reduced_debug_info_section::faild): Likewise.
9696
88a0e15b
ILT
96972009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9698
9699 * script.cc (Lazy_demangler): New class.
9700 (Version_script_info::get_symbol_version_helper): Demangle a
9701 symbol only once.
9702
5efc7cd2
CC
97032009-01-29 Cary Coutant <ccoutant@google.com>
9704
9705 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9706 to __tls_get_addr.
9707 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9708
e0ebcf42
ILT
97092009-01-28 Ian Lance Taylor <iant@google.com>
9710
5efc7cd2 9711 * version.cc (version_string): Bump to 1.9.
75fe7426 9712
e0ebcf42
ILT
9713 * gold.h: Include <cstring> and <stdint.h>.
9714 * version.cc: Include <cstdio>.
9715 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9716 warning.
9717 * reduced_debug_output.cc (insert_into_vector): Rename from
9718 Insert_into_vector; change all callers. Use Swap_unaligned to
9719 avoid aliasing issue; remove union since it is unnecessary.
9720
8e2813be 97212009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
9722
9723 * Makefile.am (CCFILES): Add gc.cc.
9724 (HFILES): Add gc.h.
9725 * Makefile.in: Regenerate.
9726 * gold.cc (Gc_runner): New class.
9727 (queue_initial_tasks): Call garbage collection related tasks
9728 when corresponding options are invoked.
9729 (queue_middle_gc_tasks): New function.
9730 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9731 processed early before laying out sections during garbage collection.
9732 * gold.h (queue_middle_gc_tasks): New function.
9733 (is_prefix_of): Move from "layout.cc".
9734 * i386.cc (Target_i386::gc_process_relocs): New function.
9735 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9736 * main.cc (main): Create object of class "Garbage_collection".
9737 * object.cc (Relobj::copy_symbols_data): New function.
9738 (Relobj::is_section_name_included): New function.
e1df38aa
NC
9739 (Sized_relobj::do_layout): Allow this function to be called twice
9740 during garbage collection and defer layout of section during the
6d03d481
ST
9741 first call.
9742 * object.h (Relobj::get_symbols_data): New function.
9743 (Relobj::is_section_name_included): New function.
9744 (Relobj::copy_symbols_data): New function.
9745 (Relobj::set_symbols_data): New function.
9746 (Relobj::get_relocs_data): New function.
9747 (Relobj::set_relocs_data): New function.
9748 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9749 (Relobj::gc_process_relocs): New function.
9750 (Relobj::do_gc_process_relocs): New pure virtual function.
9751 (Relobj::sd_): New data member.
9752 (Sized_relobj::is_output_section_offset_invalid): New function.
9753 (Sized_relobj::do_gc_process_relocs): New function.
9754 * options.h (General_options::gc_sections): Modify to not be a no-op.
9755 (General_options::print_gc_sections): New option.
9756 * plugin.cc (Plugin_finish::run): Remove function call to
9757 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9758 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9759 * reloc.cc (Read_relocs::run): Add task to process relocs and
9760 determine unreferenced sections when doing garbage collection.
9761 (Gc_process_relocs): New class.
9762 (Sized_relobj::do_gc_process_relocs): New function.
9763 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9764 sections that are garbage collected.
9765 * reloc.h (Gc_process_relocs): New class.
9766 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9767 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9768 symbols whose corresponding sections are garbage collected.
9769 (Symbol_table::Symbol_table): Add new parameter for the garbage
9770 collection object.
9771 (Symbol_table::gc_mark_undef_symbols): New function.
9772 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9773 (Symbol_table::gc_mark_dyn_syms): New function.
9774 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9775 as garbage.
9776 (Symbol_table::add_from_object): Likewise.
9777 (Symbol_table::add_from_relobj): When building shared objects, do not
9778 treat externally visible symbols as garbage.
9779 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9780 table information for static and relocatable links.
9781 * symtab.h (Symbol_table::set_gc): New function.
9782 (Symbol_table::gc): New function.
9783 (Symbol_table::gc_mark_undef_symbols): New function.
9784 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9785 (Symbol_table::gc_mark_dyn_syms): New function.
9786 (Symbol_table::gc_): New data member.
e1df38aa 9787 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
9788 function.
9789 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9790 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9791
3b293544
CF
97922009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9793
9794 * options.h (General_options::gc_sections): Define as a no-op for now.
9795 (General_options::no_keep_memory): Ditto.
9796 (General_options::Bshareable): Define.
9797 * options.cc (General_options::finalize): Honor -Bshareable.
9798
83d22aa8
AS
97992009-01-20 Andreas Schwab <schwab@suse.de>
9800
9801 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9802 read the value in the contents, since we don't use it. Use the
9803 template endianness when writing.
9804 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9805
cd536b21
AS
98062009-01-19 Andreas Schwab <schwab@suse.de>
9807
9808 * configure.tgt (powerpc64-*): Fix targ_obj.
9809
99e9a495
ILT
98102009-01-15 Ian Lance Taylor <iant@google.com>
9811
9812 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9813 local symbols when stripping all symbols.
9814
bbbfea06
CC
98152009-01-14 Cary Coutant <ccoutant@google.com>
9816
99e9a495 9817 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 9818
0f7c0701
CC
98192009-01-14 Cary Coutant <ccoutant@google.com>
9820
9821 * archive.cc (Archive::get_elf_object_for_member): Remove call
9822 to File_read::claim_for_plugin.
9823 * descriptors.cc (Descriptors::open): Remove reference to
9824 is_claimed.
9825 (Descriptors::claim_for_plugin): Remove.
9826 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9827 (Descriptors::is_claimed): Remove.
9828 (claim_descriptor_for_plugin): Remove.
9829 * fileread.cc (File_read::claim_for_plugin): Remove.
9830 * fileread.h (File_read::claim_for_plugin): Remove.
9831 (File_read::descriptor): Reopen descriptor if necessary.
9832 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9833 (Plugin_manager::all_symbols_read): Add task parameter. Change
9834 all callers.
9835 (Plugin_manager::get_input_file): New function.
9836 (Plugin_manager::release_input_file): New function.
9837 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9838 corresponding data member.
9839 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9840 and pass to base constructor. Change all callers.
9841 (get_input_file, release_input_file): New functions.
9842 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9843 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9844 (Plugin_manager::all_symbols_read): Add task parameter.
9845 (Plugin_manager::get_input_file): New function.
9846 (Plugin_manager::release_input_file): New function.
9847 (Plugin_manager::task_): New data member.
9848 (Pluginobj::Pluginobj): Add filesize parameter.
9849 (Pluginobj::filename): New function.
9850 (Pluginobj::descriptor): New function.
9851 (Pluginobj::filesize): New function.
9852 (Pluginobj::filesize_): New data member.
9853 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9854 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9855 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9856
9857 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9858 with archive libraries.
9859 * testsuite/Makefile.in: Regenerate.
9860 * testsuite/plugin_test.c (struct sym_info): New type.
9861 (get_input_file, release_input_file): New static variables.
9862 (onload): Capture new transfer vector entries.
9863 (claim_file_hook): Stop reading at end of file according to filesize.
9864 Factor out parsing of readelf output into separate function.
9865 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9866 APIs and get the source file name from the symbol table. Convert
9867 source file name to corresponding object file name. Print info
9868 message when adding new input files.
9869 (parse_readelf_line): New function.
9870 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9871 * testsuite/plugin_test_2.sh: Likewise.
9872 * testsuite/plugin_test_3.sh: Likewise.
9873 * testsuite/plugin_test_4.sh: New test case.
9874
62a6d109
ILT
98752009-01-07 Ian Lance Taylor <iant@google.com>
9876
9877 * version.cc (version_string): Bump to 1.8.
9878
483620e8
CC
98792008-12-23 Cary Coutant <ccoutant@google.com>
9880
9881 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9882 * plugin.cc (Plugin_manager::finish): Rename as
9883 layout_deferred_objects. Move cleanup to separate function.
9884 (Plugin_manager::cleanup): New function.
9885 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9886 separately.
9887 * plugin.h (Plugin_manager::finish): Rename as
9888 layout_deferred_objects.
9889 (Plugin_manager::cleanup): New function.
9890 (Plugin_manager::cleanup_done): New field.
9891
d66a9eb3
CC
98922008-12-23 Cary Coutant <ccoutant@google.com>
9893
9894 * plugin.cc (is_visible_from_outside): New function.
9895 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9896 so we don't return "IR only" status for exported symbols or -r links.
9897
9898 * testsuite/Makefile.am (plugin_test_3): New test case.
9899 * testsuite/Makefile.in: Regenerate.
9900 * testsuite/plugin_test_3.sh: New file.
9901
5995b570
CC
99022008-12-22 Cary Coutant <ccoutant@google.com>
9903
9904 * object.cc (Sized_relobj::layout_section): New function.
9905 (Sized_relobj::do_layout): Defer layout of input sections until after
9906 plugin has provided replacement files.
9907 (Sized_relobj::do_layout_deferred_sections): New function.
9908 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9909 (Relobj::layout_deferred_sections): New function.
9910 (Relobj::do_layout_deferred_sections): New function.
9911 (Sized_relobj::do_layout_deferred_sections): New function.
9912 (Sized_relobj::layout_section): New function.
9913 (Sized_relobj::Deferred_layout): New structure.
9914 (Sized_relobj::deferred_layout_): New field.
9915 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9916 Change all callers. Layout deferred sections.
9917 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9918 references.
9919 (Plugin_hook::run): Move code from do_plugin_hook inline.
9920 (Plugin_hook::do_plugin_hook): Remove.
9921 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9922 (Plugin_manager::finish): Renamed, was cleanup.
9923 (Plugin_manager::should_defer_layout): New function.
9924 (Plugin_manager::add_deferred_layout_object): New function.
9925 (Plugin_manager::Deferred_layout_list): New type.
9926 (Plugin_manager::deferred_layout_objects_): New field.
9927 (Plugin_hook::do_plugin_hook): Remove.
9928
ee769c88
ILT
99292008-12-17 Ian Lance Taylor <iant@google.com>
9930
9931 * options.h (class General_options): Add --no case for
9932 --export-dynamic.
9933
abc8dcba
CC
99342008-12-16 Cary Coutant <ccoutant@google.com>
9935
9936 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9937 vector.
9938 (Plugin_manager::claim_file): Create plugin object even if
9939 plugin did not call the add_symbols callback.
9940 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9941 asking for more symbols than were added.
9942 * testsuite/Makefile.am (plugin_test_1): Add test case with
9943 no global symbols.
9944 (empty.syms): New target.
9945 * testsuite/Makefile.in: Regenerate.
9946 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9947 message. Don't call add_symbols if no globals.
9948 (all_symbols_read_hook): Don't provide replacement for empty
9949 claimed file.
9950
b0074644
ILT
99512008-12-12 Ian Lance Taylor <iant@google.com>
9952
68943102
ILT
9953 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9954 r_type == 0 for a local symbol with r_sym == 0.
9955 (scan_relocatable_relocs): Pass r_sym to
9956 local_non_section_strategy.
9957 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9958 r_sym parameter.
9959
b0074644
ILT
9960 * configure.ac: Update test for TLS descriptors: they are
9961 supported as of glibc 2.9.
9962 * configure: Rebuild.
9963
c2508178
ILT
99642008-12-11 Ian Lance Taylor <iant@google.com>
9965
9966 PR 7091
9967 * target-reloc.h (Default_scan_relocatable_relocs): For each
9968 function, map r_type == 0 to RELOC_DISCARD.
9969
2756a258
CC
99702008-12-10 Cary Coutant <ccoutant@google.com>
9971
9972 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9973 object to override a kept COMDAT group from a plugin object.
9974
bb6f53d3
ILT
99752008-12-09 Ian Lance Taylor <iant@google.com>
9976
fbc558e1
ILT
9977 PR 7088
9978 * yyscript.y (file_cmd): Handle INPUT.
9979
bb6f53d3
ILT
9980 * testsuite/initpri1.c: Change all declarations to be full
9981 prototypes by adding void, to avoid compiler warnings.
9982
4674ecfc
CC
99832008-12-05 Rafael Avila de Espindola <espindola@google.com>
9984
9985 * options.cc (General_options::parse_plugin_opt): New.
9986 (General_options::add_plugin): The argument now is just the filename.
9987 (General_options::add_plugin_option): New.
9988 * options.h (plugin_opt): New.
9989 (add_plugin): Change argument name.
9990 (add_plugin_option): New.
9991 * plugin.cc (Plugin::load): Don't parse the plugin option.
9992 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9993 (Plugin::add_option): New.
9994 (Plugin::args_): Change type.
9995 (Plugin::filename_): New.
9996 (Plugin_manager::add_plugin_option): New.
9997 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9998 * testsuite/Makefile.in: Regenerate.
9999
fd06b4aa
CC
100002008-12-05 Cary Coutant <ccoutant@google.com>
10001
10002 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10003 Handle --strip-lto-sections option.
10004 * options.h (strip_lto_sections): New option.
10005
6c52134c
CC
100062008-12-01 Cary Coutant <ccoutant@google.com>
10007
10008 * plugin.cc (ld_plugin_message): Change format parameter to const.
10009 Fix mismatch between new[] and delete.
10010
a45248e0
CC
100112008-11-14 Cary Coutant <ccoutant@google.com>
10012
10013 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10014 instead of -1U.
10015
c82fbeee
CS
100162008-11-05 Craig Silverstein <csilvers@google.com>
10017
10018 * options.cc (General_options::parse_dynamic_list): New function.
10019 * options.h (General_options): New flags dynamic_list,
10020 dynamic_list_data, dynamic_list_cpp_new, and
10021 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
10022 (General_options::in_dynamic_list): New function.
10023 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10024 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10025 (Lex::can_continue_name): Likewise.
10026 (yylex): Likewise.
10027 (read_script_file): New parameter script_options.
10028 (read_dynamic_list): New function.
10029 (Script_options::define_dynamic_list): New function.
10030 (dynamic_list_keyword_parsecodes): New variable.
10031 (dynamic_list_keywords): New variable.
10032 * script.h (Script_options::define_dynamic_list): New function
10033 prototype.
10034 (read_dynamic_list): New function prototype.
10035 * symtab.cc (strprefix): New macro.
10036 (Symbol::should_add_dynsym_entry): Support dynamic_list,
10037 dynamic_list_data, dynamic_list_cpp_new, and
10038 dynamic_list_cpp_typeinfo.
10039 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10040 (dynamic_list_expr): New rule.
10041 (dynamic_list_nodes): Likewise.
10042 (dynamic_list_node): Likewise.
10043 * testsuite/Makefile.am (dynamic_list): New test.
10044 * testsuite/Makefile.in: Regenerated.
10045 * testsuite/dynamic_list.t: New file.
10046 * testsuite/dynamic_list.sh: New file.
10047
e0bb29a5
CS
100482008-11-05 Craig Silverstein <csilvers@google.com>
10049
10050 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10051 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10052 (t11_last): Likewise.
10053 * testsuite/ver_test_6.c (main): Likewise.
10054
4e1e25e0
CC
100552008-10-07 Cary Coutant <ccoutant@google.com>
10056
10057 * options.c (General_options::finalize): Add check for -static and
10058 -shared.
10059 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10060 is not empty.
10061
92f03fcb
CC
100622008-10-02 Cary Coutant <ccoutant@google.com>
10063
10064 * plugin.cc (make_sized_plugin_object): Fix conditional
10065 compilation to work when not all targets are enabled.
10066
fbd8a257
CC
100672008-09-29 Cary Coutant <ccoutant@google.com>
10068
10069 * archive.cc (Archive::get_file_and_offset): Use filename instead
10070 of name to get library path.
10071 (Archive::include_member): Unlock external member of a thin archive.
10072
10073 * testsuite/Makefile.am (TEST_AR): New variable.
10074 (thin_archive_test_1): New test.
10075 (thin_archive_test_2): New test.
81636b3f
CC
10076 * testsuite/Makefile.in: Regenerate.
10077 * testsuite/thin_archive_main.cc: New file.
10078 * testsuite/thin_archive_test_1.cc: New file.
10079 * testsuite/thin_archive_test_2.cc: New file.
10080 * testsuite/thin_archive_test_3.cc: New file.
10081 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 10082
eff45813
CC
100832008-09-29 Cary Coutant <ccoutant@google.com>
10084
10085 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10086 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10087 instead of -1U.
10088 (Sized_relobj::do_finalize_local_symbols): Likewise.
10089 (Sized_relobj::map_to_kept_section): Likewise.
10090 * object.h (Sized_relobj::invalid_address): New constant.
10091 (Sized_relobj::do_output_section_offset): Check for invalid_address
10092 and return -1ULL.
10093 * output.cc (Output_reloc::local_section_offset): Use constant
10094 invalid_address instead of -1U.
10095 (Output_reloc::get_address): Likewise.
10096 (Output_section::output_address): Change -1U to -1ULL.
10097 * output.h (Output_reloc::invalid_address): New constant.
10098 * reloc.cc (Sized_relobj::write_sections): Use constant
10099 invalid_address instead of -1U.
10100 (Sized_relobj::relocate_sections): Likewise.
10101 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10102 values for merge sections.
10103 * target-reloc.h (relocate_for_relocatable): Use constant
10104 invalid_address instead of -1U.
10105
89fc3421
CC
101062008-09-19 Cary Coutant <ccoutant@google.com>
10107
10108 Add plugin functionality for link-time optimization (LTO).
10109 * configure.ac (plugins): Add --enable-plugins option.
10110 * configure: Regenerate.
10111 * config.in: Regenerate.
10112 * Makefile.am (LIBDL): New variable.
10113 (CCFILES): Add plugin.cc.
10114 (HFILES): Add plugin.h.
10115 (ldadd_var): Add LIBDL.
10116 * Makefile.in: Regenerate.
10117
10118 * archive.cc: Include "plugin.h".
10119 (Archive::setup): Don't preread archive symbols when using a plugin.
10120 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
10121 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
10122 files.
10123 (Archive::include_member): Add symbols from plugin objects.
10124 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
10125 * descriptors.cc (Descriptors::open): Check for file descriptors
10126 abandoned by plugins.
10127 (Descriptors::claim_for_plugin): New function.
10128 * descriptors.h (Descriptors::claim_for_plugin): New function.
10129 (Open_descriptor::is_claimed): New field.
10130 (claim_descriptor_for_plugin): New function.
10131 * fileread.cc (File_read::claim_for_plugin): New function.
10132 * fileread.h (File_read::claim_for_plugin): New function.
10133 (File_read::descriptor): New function.
10134 * gold.cc: Include "plugin.h".
10135 (queue_initial_tasks): Add task to call plugin hooks for generating
10136 new object files.
10137 * main.cc: Include "plugin.h".
10138 (main): Load plugin libraries.
10139 * object.h (Pluginobj): Declare.
10140 (Object::pluginobj): New function.
10141 (Object::do_pluginobj): New function.
10142 (Object::set_target): New function.
10143 * options.cc: Include "plugin.h".
10144 (General_options::parse_plugin): New function.
10145 (General_options::General_options): Initialize plugins_ field.
10146 (General_options::add_plugin): New function.
10147 * options.h (Plugin_manager): Declare.
10148 (General_options): Add --plugin option.
10149 (General_options::has_plugins): New function.
10150 (General_options::plugins): New function.
10151 (General_options::add_plugin): New function.
10152 (General_options::plugins_): New field.
10153 * plugin.cc: New file.
10154 * plugin.h: New file.
10155 * readsyms.cc: Include "plugin.h".
10156 (Read_symbols::do_read_symbols): Check for archive before checking
10157 for ELF file. Call plugin hooks to claim files.
10158 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
10159 from a real object file; force override when processing replacement
10160 files.
10161 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
10162 (Symbol::init_base_object): Likewise.
10163 (Symbol::init_base_output_data): Likewise.
10164 (Symbol::init_base_output_segment): Likewise.
10165 (Symbol::init_base_constant): Likewise.
10166 (Symbol::init_base_undefined): Likewise.
10167 (Symbol::output_section): Assert that object is not a plugin.
10168 (Symbol_table::add_from_pluginobj): New function.
10169 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
10170 undefined.
10171 (Symbol_table::sized_write_globals): Likewise.
10172 (Symbol_table::add_from_pluginobj): Instantiate template.
10173 * symtab.h (Sized_pluginobj): Declare.
10174 (Symbol::in_real_elf): New function.
10175 (Symbol::set_in_real_elf): New function.
10176 (Symbol::in_real_elf_): New field.
10177 (Symbol_table::add_from_pluginobj): New function.
10178
10179 * testsuite/Makefile.am (AM_CFLAGS): New variable.
10180 (LIBDL): New variable.
10181 (LDADD): Add LIBDL.
10182 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
10183 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
10184 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
10185 (MOSTLYCLEANFILES): Likewise.
10186 * testsuite/Makefile.in: Regenerate.
10187 * testsuite/plugin_test.c: New file.
10188 * testsuite/plugin_test_1.sh: New file.
10189 * testsuite/plugin_test_2.sh: New file.
10190
de31bda5
ILT
101912008-09-16 Ian Lance Taylor <iant@google.com>
10192
9c2d0ef9
ILT
10193 * target-reloc.h (relocate_section): Check whether a symbol is
10194 defined by the ABI before reporting an undefined symbol error.
10195 * target.h (Target::is_defined_by_abi): Make parameter const.
10196 (Target::do_is_defined_by_abi): Likewise.
10197 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
10198 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
10199 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
10200 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
10201 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
10202 * testsuite/Makefile.in: Rebuild.
10203
de31bda5
ILT
10204 * fileread.cc (make_view): Add casts to avoid warning.
10205
9fa33bee
AO
102062008-09-16 Alexandre Oliva <aoliva@redhat.com>
10207
10208 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
10209 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10210
183fd0e3
AO
102112008-09-16 Alexandre Oliva <aoliva@redhat.com>
10212
10213 * options.h (General_options::output_is_executable): New.
10214 (General_options::output_is_pie): New.
10215 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10216 for shared libraries.
10217 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10218
7be8330a
CD
102192008-09-11 Chris Demetriou <cgd@google.com>
10220
10221 * options.h (origin): New -z option.
10222 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10223 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10224 in DT_FLAGS_1.
10225
a9caad02
CC
102262008-09-05 Cary Coutant <ccoutant@google.com>
10227
10228 * fileread.cc (File_read::make_view): Add check for attempt to map
10229 beyond end of file.
10230
ae6dce4d
CC
102312008-09-05 Cary Coutant <ccoutant@google.com>
10232
10233 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10234 explicit instantiations.
10235
d7ab2a47
KVH
102362008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10237
10238 PR gold/6858
10239 * options.cc (General_options::finalize): Allow undefined symbols
10240 in shlibs if linking -shared.
10241
10242 PR gold/6859
10243 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10244 symbols as not needing a dynsym entry.
10245
1e52a9c1
CS
102462008-08-20 Craig Silverstein <csilvers@google.com>
10247
10248 * fileread.cc (File_read::open): Do not lock the file unless it
10249 was successfully opened.
10250
d85c80a3
CC
102512008-08-14 Cary Coutant <ccoutant@google.com>
10252
10253 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10254 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10255 * testsuite/tls_test.cc (struct int128): 128-bit struct
10256 for testing TLS relocs with non-zero addend.
10257 (v12): New TLS variable.
10258 (t12): New test.
10259 (t_last): Add check for v12.
10260 * testsuite/tls_test.h (t12): New function.
10261 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10262
2d924fd9
ILT
102632008-08-13 Ian Lance Taylor <iant@google.com>
10264
10265 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10266 set tls_segment_ or relro_segment_.
10267 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10268 when appropriate.
10269 * output.h (Output_section::clear_is_relro): New function.
10270 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10271 sections specially even when output_data_ is empty.
10272 (Output_segment::maximum_alignment): When first section is relro,
10273 only force alignment for PT_LOAD segments.
10274 * script.cc (script_data_segment_align): New function.
10275 (script_data_segment_relro_end): New function.
10276 * script-c.h (script_data_segment_align): Declare.
10277 (script_data_segment_relro_end): Declare.
10278 * script-sections.h (class Script_sections): Declare
10279 data_segment_align and data_segment_relro_end. Add fields
10280 segment_align_index_ and saw_relro_end_.
10281 * script-sections.cc (class Sections_element): Add set_is_relro
10282 virtual function. Add new bool* parameter to place_orphan_here.
10283 Add get_output_section virtual function.
10284 (class Output_section_definition): Add set_is_relro. Add new
10285 bool* parameter to place_orphan_here. Add get_output_section.
10286 Add is_relro_ field.
10287 (Output_section_definition::Output_section_definition): Initialize
10288 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10289 and is_relro_ fields.
10290 (Output_section_definition::place_orphan_here): Add is_relro
10291 parameter.
10292 (Output_section_definition::set_section_addresses): Set relro for
10293 output section.
10294 (Output_section_definition::alternate_constraint): Likewise.
10295 (class Orphan_output_section): Add new bool* parameter to
10296 place_orphan_here. Add get_output_section.
10297 (Orphan_output_section::place_orphan_here): Add is_relro
10298 parameter.
10299 (Script_sections::Script_sections): Initialize
10300 data_segment_align_index_ and saw_relro_end_.
10301 (Script_sections::data_segment_align): New function.
10302 (Script_sections::data_segment_relro_end): New function.
10303 (Script_sections::place_orphan): Set or clear is_relro.
10304 (Script_sections::set_section_addresses): Force alignment of first
10305 TLS section.
10306 * yyscript.y (exp): Call script_data_segment_align and
10307 script_data_segment_relro_end.
10308 * testsuite/relro_script_test.t: New file.
10309 * testsuite/relro_test.cc (using_script): Declare.
10310 (t1, t2): Test using_script.
10311 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10312 (relro_script_test_SOURCES): Define.
10313 (relro_script_test_DEPENDENCIES): Define.
10314 (relro_script_test_LDFLAGS): Define.
10315 (relro_script_test_LDADD): Define.
10316 (relro_script_test.so): New target.
10317 * testsuite/Makefile.in: Rebuild.
10318
f827c9a9
CC
103192008-08-06 Cary Coutant <ccoutant@google.com>
10320
10321 * archive.cc (Archive::total_archives, Archive::total_members)
10322 (Archive::total_members_loaded): New variables.
10323 (Archive::setup): Add parameter. Add option to preread
10324 archive symbols.
10325 (Archive::read_armap): Add counter.
10326 (Archive::get_file_and_offset): New function.
10327 (Archive::get_elf_object_for_member): New function.
10328 (Archive::read_all_symbols): New function.
10329 (Archive::read_symbols): New function.
10330 (Archive::add_symbols): Add counters.
10331 (Archive::include_all_members): Use armap to find members if it's
10332 already built.
10333 (Archive::include_member): Skip reading symbols if already read.
10334 Factored code into Archive::get_file_and_offset and
10335 Archive::get_elf_object_for_member. Changed call to
10336 Mapfile::report_include_archive_member.
10337 (Archive::print_stats): New function.
10338 * archive.h: Declare Object and Read_symbols_data classes.
10339 (Archive::Archive): Add initializers for new members.
10340 (Archive::setup): Add parameter.
10341 (Archive::print_stats): New function.
10342 (Archive::total_archives, Archive::total_members)
10343 (Archive::total_members_loaded): New variables.
10344 (Archive::get_file_and_offset): New function.
10345 (Archive::get_elf_object_for_member): New function.
10346 (Archive::read_all_symbols): New function.
10347 (Archive::read_symbols): New function.
10348 (Archive::Archive_member): New class.
10349 (Archive::members_): New member.
10350 (Archive::num_members_): New member.
10351 * main.cc: Include archive.h.
10352 (main): Call Archive::print_stats.
10353 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10354 archive parameter; member_name is now the fully-decorated name.
10355 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10356 * options.h: (General_options): Add --preread-archive-symbols option.
10357 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10358 Archive::setup.
10359
de4c45bd
ILT
103602008-08-04 Ian Lance Taylor <iant@google.com>
10361
10362 * symtab.h (Symbol::use_plt_offset): New function.
10363 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10364 * powerpc.cc (Relocate::relocate): Likewise.
10365 * sparc.cc (Relocate::relocate): Likewise.
10366 * x86_64.cc (Relocate::relocate): Likewise.
10367 * testsuite/weak_plt.sh: New test.
10368 * testsuite/weak_plt_main.cc: New test.
10369 * testsuite/weak_plt_shared.cc: New test.
10370 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10371 (check_PROGRAMS): Add weak_plt.
10372 (check_DATA): Add weak_plt_shared.so.
10373 (weak_plt_main_pic.o, weak_plt): New targets.
10374 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10375 * testsuite/Makefile.in: Rebuild.
10376
10377 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10378 gcctestdir/ld.
10379 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10380 * testsuite/Makefile.in: Rebuild.
10381
323ee3f4
AM
103822008-08-04 Alan Modra <amodra@bigpond.net.au>
10383
10384 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10385 * Makefile.in: Regenerate.
10386 * po/POTFILES.in: Regenerate.
10387
7c07ecec
ILT
103882008-07-29 Ian Lance Taylor <iant@google.com>
10389
10390 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10391 symbols before other symbols.
10392 * testsuite/script_test_2.cc (test_addr): Declare.
10393 (test_addr_alias): Declare.
10394 (main): Check that test_addr and test_addr_alias have the right
cd536b21 10395 values.
7c07ecec
ILT
10396 * testsuite/script_test_2.t: Define test_addr_alias and
10397 test_addr.
10398
5778530e
ILT
103992008-07-24 Ian Lance Taylor <iant@google.com>
10400
2a00e4fb
ILT
10401 PR 5990
10402 * descriptors.cc: New file.
10403 * descriptors.h: New file.
10404 * gold-threads.h (class Hold_optional_lock): New class.
10405 * fileread.cc: Include "descriptors.h".
10406 (File_read::~File_read): Release descriptor rather than closing
10407 it.
10408 (File_read::open) [file]: Call open_descriptor rather than open.
10409 Set is_descriptor_opened_.
10410 (File_read::open) [memory]: Assert that descriptor is not open.
10411 (File_read::reopen_descriptor): New function.
10412 (File_read::release): Release descriptor.
10413 (File_read::do_read): Make non-const. Reopen descriptor.
10414 (File_read::read): Make non-const.
10415 (File_read::make_view): Reopen descriptor.
10416 (File_read::do_readv): Likewise.
10417 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10418 Update declarations.
10419 * layout.cc: Include "descriptors.h".
10420 (Layout::create_build_id): Use open_descriptor rather than open.
10421 * output.cc: Include "descriptors.h".
10422 (Output_file::open): Use open_descriptor rather than open.
10423 * archive.cc (Archive::const_iterator): Change Archive to be
10424 non-const.
10425 (Archive::begin, Archive::end): Make non-const.
10426 (Archive::count_members): Likewise.
10427 * archive.h (class Archive): Update declarations.
10428 * object.h (Object::read): Make non-const.
10429 * Makefile.am (CCFILES): Add descriptors.cc.
10430 (HFILES): Add descriptors.h.
10431 * Makefile.in: Rebuild.
10432
801647d1
ILT
10433 PR 6716
10434 * gold.h: Always include <clocale>. Add Solaris workarounds
10435 following code in binutils/sysdep.h.
10436
5edd166e
ILT
10437 PR 6048
10438 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10439 this->eh_frame_hdr_ is NULL before using it.
10440
c89ad728
ILT
10441 * dynobj.cc (Versions::Versions): Update comment.
10442
aa86f06b
ILT
10443 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10444 the base version name.
10445
5778530e
ILT
10446 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10447 array size plus one.
10448 (Stringpool_template::set_string_offsets): Subtract one from key
10449 before using it as an array index.
10450 (Stringpool_template::get_offset_with_length): Likewise.
10451 (Stringpool_template::write_to_buffer): Likewise.
10452 * stringpool.h (Stringpool_template::get_offset_from_key):
10453 Likewise.
10454
057ead22
ILT
104552008-07-23 Ian Lance Taylor <iant@google.com>
10456
7f649c59
ILT
10457 PR 6658
10458 * object.h (Merged_symbol_value::value): Do our best to handle a
10459 negative addend.
10460
057ead22
ILT
10461 PR 6647
10462 * script.cc (Version_script_info::get_versions): Don't add empty
10463 version tag to return value.
10464 (Version_script_info::get_symbol_version_helper): Change return
10465 type to bool. Add pversion parameter. Change all callers.
10466 (script_register_vers_node): Don't require a non-NULL tag.
10467 * script.h (class Version_script_info): Update declarations.
10468 (Version_script_info::get_symbol_version): Change return type to
10469 bool. Add version parameter. Change all callers.
10470 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10471 handling. Handle an empty version from a version script.
10472 (Symbol_table::define_special_symbol): Likewise.
10473 * testsuite/ver_test_10.script: New file.
10474 * testsuite/ver_test_10.sh: New file.
10475 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10476 (check_DATA): Add ver_test_10.syms.
10477 (ver_test_10.syms, ver_test_10.so): New target.
10478 * testsuite/Makefile.in: Rebuild.
10479
58e54ac2
CD
104802008-07-23 Simon Baldwin <simonb@google.com>
10481
10482 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10483 to zero for undefined symbols from dynamic libraries.
10484
95d14cd3
ILT
104852008-07-23 Ian Lance Taylor <iant@google.com>
10486
10487 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10488 Change all callers.
10489 * symtab.h (class Symbol_table): Update declaration.
10490 * testsuite/ver_test_9.cc: New file.
10491 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10492 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10493 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10494 (ver_test_9.so, ver_test_9.o): New targets.
10495 * testsuite/Makefile.in: Rebuild.
10496
92de84a6
ILT
104972008-07-22 Ian Lance Taylor <iant@google.com>
10498
34810851
ILT
10499 * options.h (class General_options): Define --check-sections.
10500 * layout.cc (Layout::set_segment_offsets): Handle
10501 --check-sections.
10502
af6156ef
ILT
10503 * options.h (class General_options): Define -n/--nmagic and
10504 -N/--omagic.
10505 * options.cc (General_options::finalize): For -n/--nmagic or
10506 -N/--omagic, set -static.
10507 * layout.cc (Layout::attach_allocated_section_to_segment): If
10508 -N/--omagic, don't put read-only and read-write sections in
10509 different segments.
10510 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10511 finding a read-only segment.
10512 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10513 don't set the minimum segment alignment to the common page size,
10514 and don't set the file offset to the address modulo the page size.
10515 * script-sections.cc (Script_sections::create_segments): If
10516 -n/--omagic, don't put read-only and read-write sections in
10517 different segments.
10518
92de84a6
ILT
10519 * cref.cc: New file.
10520 * cref.h: New file.
10521 * options.h (class General_options): Add --print-symbol-counts.
10522 * main.cc (main): Issue defined symbol report if requested.
10523 * archive.cc (Archive::interpret_header): Make into a const member
10524 function.
10525 (Archive::add_symbols): Call Input_objects::archive_start and
10526 archive_stop.
10527 (Archive::const_iterator): Define new class.
10528 (Archive::begin, Archive::end): New functions.
10529 (Archive::include_all_members): Rewrite to use iterator.
10530 (Archive::count_members): New function.
10531 * archive.h (class Archive): Update declarations.
10532 (Archive::filename): New function.
10533 * object.cc: Include "cref.h".
10534 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10535 (Sized_relobj::do_get_global_symbol_counts): New function.
10536 (Input_objects::add_object): Add object to cross-referencer.
10537 (Input_objects::archive_start): New function.
10538 (Input_objects::archive_stop): New function.
10539 (Input_objects::print_symbol_counts): New function.
10540 * object.h: Declare Cref and Archive.
10541 (Object::get_global_symbol_counts): New function.
10542 (Object::do_get_global_symbol_counts): New pure virtual function.
10543 (class Sized_relobj): Add defined_count_ field. Update
10544 declarations.
10545 (class Input_objects): Add cref_ field. Update constructor.
10546 Update declarations.
10547 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10548 defined_count_.
10549 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10550 symbol counts.
10551 (Sized_dynobj::do_get_global_symbol_counts): New function.
10552 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10553 defined_count_. Update declarations. Define Symbols typedef.
10554 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10555 parameter. Change all callers.
10556 (Symbol_table::add_from_dynobj): Add sympointers and defined
10557 parameters. Change all callers.
10558 * symtab.h (class Symbol_table): Update declarations.
10559 * Makefile.am (CCFILES): Add cref.cc.
10560 (HFILES): Add cref.h.
10561 * Makefile.in: Rebuild.
10562
3f7c5e1d
CD
105632008-07-22 Simon Baldwin <simonb@google.com>
10564
10565 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10566 to zero when writing undefined symbols.
10567
e0b64032
ILT
105682008-07-22 Ian Lance Taylor <iant@google.com>
10569
10570 * output.cc (Output_section::add_input_section): Don't try to
10571 merge empty merge sections.
10572
096b02cf
CS
105732008-07-21 Craig Silverstein <csilvers@google.com>
10574
10575 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10576 Include symbol version in error message.
cd536b21 10577
1d1f116d
CD
105782008-07-20 Chris Demetriou <cgd@google.com>
10579
cd536b21 10580 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
10581 (RANDOM_SEED_CFLAGS): New substituted variable.
10582 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10583 * configure: Rebuild.
10584 * Makefile.in: Likewise.
10585 * testsuite/Makefile.in: Likewise.
10586
a18f591e
ILT
105872008-07-18 Ian Lance Taylor <iant@google.com>
10588
10589 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10590 where we see NAME/NULL and NAME/VERSION as separate symbols.
10591 * testsuite/ver_test_main.cc (main): Call t4.
10592 (t4, t4_2a): Define.
10593 * testsuite/ver_test_2.cc (t4_2): Define.
10594 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10595 * testsuite/ver_test_4.cc (t4_2a): Define.
10596 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10597 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10598
c6e3f6ed
ILT
105992008-07-17 Ian Lance Taylor <iant@google.com>
10600
10601 * dynobj.cc (Versions::add_def): If we give an error about a
10602 missing version, go ahead and create the version anyhow.
10603
ef9beddf
ILT
106042008-07-10 Ian Lance Taylor <iant@google.com>
10605
10606 Handle output sections with more than 0x7fffffff bytes.
10607 * object.h (class Relobj): Change map_to_output_ to
10608 output_sections_, and just keep a section pointer. Change all
10609 uses. Move comdat group support to Sized_relobj.
10610 (Relobj::is_section_specially_mapped): Remove.
10611 (Relobj::output_section): Remove poff parameter. Change all
10612 callers.
10613 (Relobj::output_section_offset): New function.
10614 (Relobj::set_section_offset): Rewrite.
10615 (Relobj::map_to_output): Remove.
10616 (Relobj::output_sections): New function.
10617 (Relobj::do_output_section_offset): New pure virtual function.
10618 (Relobj::do_set_section_offset): Likewise.
10619 (class Sized_relobj): Add section_offsets_ field. Add comdat
10620 group support from Relobj. Update declarations.
10621 (Sized_relobj::get_output_section_offset): New function.
10622 (Sized_relobj::do_output_section_offset): New function.
10623 (Sized_relobj::do_set_section_offset): New function.
10624 * object.cc (Relobj::output_section_address): Remove.
10625 (Sized_relobj::Sized_relobj): Initialize new fields.
10626 (Sized_relobj::include_section_group): Cast find_kept_object to
10627 Sized_relobj.
10628 (Sized_relobj::include_linkonce_section): Likewise.
10629 (Sized_relobj::do_layout): Use separate arrays for output section
10630 and output offset.
10631 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10632 output_sections.
10633 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10634 output_sections and section_offsets.
10635 (Sized_relobj::write_local_symbols): Likewise.
10636 (map_to_kept_section): Compute output address directly.
10637 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10638 output_sections and section_offsets.
10639 (Sized_relobj::write_sections): Likewise.
10640 (Sized_relobj::relocate_sections): Likewise.
10641 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10642 * output.h (class Output_reloc): Update declarations. Change
10643 u2_.relobj to Sized_relobj*.
10644 (class Output_data_reloc): Change add functions to use
10645 Sized_relobj*.
10646 * output.cc (Output_reloc::Output_reloc): Change relobj to
10647 Sized_relobj*.
10648 (Output_reloc::local_section_offset): Change return type to
10649 Elf_Addr. Use get_output_section_offset.
10650 (Output_reloc::get_address): Likewise.
10651 (Output_section::is_input_address_mapped): Don't call
10652 is_section_specially_mapped.
10653 (Output_section::output_offset): Likewise.
10654 (Output_section::output_address): Likewise.
10655 (Output_section::starting_output_address): Likewise.
10656 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10657 parameter to Sized_relobj*.
10658 (Copy_relocs::need_copy_reloc): Likewise.
10659 (Copy_relocs::save): Likewise.
10660 * copy-relocs.h (class Copy_relocs): Update declarations.
10661 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10662 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10663 * target-reloc.h (relocate_for_relocatable): Change
10664 offset_in_output_section type to Elf_Addr. Change code that uses
10665 it as well.
10666 * layout.cc (Layout::layout): Always set *off.
10667 * mapfile.cc (Mapfile::print_input_section): Use
10668 output_section_offset.
10669 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10670 Sized_relobj*.
10671 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10672 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10673 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10674
5cb66f97
ILT
106752008-07-03 Ian Lance Taylor <iant@google.com>
10676
10677 * layout.cc (Layout::include_section): Do not discard unrecognized
10678 SHT_STRTAB sections.
10679
afe47622
CS
106802008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10681
10682 * script.cc (Lex::can_continue_name): Make '?' allowable in
10683 version-script names.
10684 * testsuite/version_script.map: Change glob pattern to use '?'
10685
5adf9721
ILT
106862008-06-30 Manish Singh <yosh@gimp.org>
10687
10688 PR 6585
10689 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10690 Correct typo.
10691
e6fde208
ILT
106922008-06-30 Ian Lance Taylor <iant@google.com>
10693
10694 PR 6660
10695 PR 6682
10696 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10697 versions]: Don't try to read the value in the contents, since we
10698 don't use it. Use the template endianness when writing.
10699
3f2e6a2d
CC
107002008-06-25 Cary Coutant <ccoutant@google.com>
10701
10702 * fileread.cc (File_read::make_view): Assert on zero-length view.
10703 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10704 symbol table when there are no symbols to read.
10705
c43d3a48
CS
107062008-06-23 Craig Silverstein <csilvers@google.com>
10707
10708 * version.cc (version_string): Bump to 1.7
10709
5f494ea0
CS
107102008-06-18 Craig Silverstein <csilvers@google.com>
10711
10712 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10713 constant 0xFFFF to type Valtype.
10714 (Powerpc_relocate_functions::rel16_ha): Likewise.
10715
c42e122e
ILT
107162008-06-17 Ian Lance Taylor <iant@google.com>
10717
f34787f8
ILT
10718 * output.h (Output_section::Input_section): Initialize p2align_ to
10719 zero for Output_section_data constructors.
10720 (Output_section::Input_section::addralign): If not an input
10721 section, return the alignment of the Output_section_data.
10722 * testsuite/copy_test.cc: New file.
10723 * testsuite/copy_test_1.cc: New file.
10724 * testsuite/copy_test_2.cc: New file.
10725 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10726 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10727 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10728 (copy_test_1_pic.o, copy_test_1.so): New targets.
10729 (copy_test_2_pic.o, copy_test_2.so): New targets.
10730 * testsuite/Makefile.in: Rebuild.
10731
c42e122e
ILT
10732 * script-sections.cc (Script_sections::place_orphan): Initialize
10733 local variable exact.
10734
ce3ac18a
DE
107352008-06-13 David Edelsohn <edelsohn@gnu.org>
10736
10737 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10738
42cacb20
DE
107392008-06-12 David Edelsohn <edelsohn@gnu.org>
10740 David S. Miller <davem@davemloft.net>
10741
10742 * powerpc.cc: New file.
10743 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10744 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10745 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10746 * Makefile.in: Rebuild.
10747
7b308235
ILT
107482008-06-09 Ian Lance Taylor <iant@google.com>
10749
10750 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10751 <exception>.
10752 (throwing, orig_terminate): New static variables.
10753 (terminate_handler): New static function.
10754 (t2): Set terminate handler.
10755
f0b886e3
ILT
107562008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10757
10758 PR 6584
cd536b21 10759 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
10760 alignment.
10761
3e90f135
CC
107622008-05-30 Cary Coutant <ccoutant@google.com>
10763
10764 * archive.cc (Archive::include_all_members) Correct to step
10765 over symbol table and extended name table in thin archives.
10766
e09ad04a
ILT
107672008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10768
10769 PR 6407
10770 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10771 calculation.
10772
62b01cb5
ILT
107732008-05-28 Caleb Howe <cshowe@google.com>
10774
10775 * reduced_debug_output.cc: New file.
10776 * reduced_debug_output.h: New file.
92de84a6 10777 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
10778 * options.cc (General_options::finalize): Add strip_debug_non_line
10779 to the strip heirarchy.
10780 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10781 fields.
10782 * layout.cc: Include "reduced_debug_output.h".
10783 (Layout::Layout): Initialize new fields.
10784 (line_only_debug_sections): New static array.
10785 (is_lines_only_debug_sections): New static inline function.
10786 (Layout::include_section): Handle --strip-debug-non-line.
10787 (Layout::make_output_section): If --strip-debug-non-line, build
10788 new output sections for .debug_abbrev and .debug_info.
10789 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10790 gold. Warn about possible overflow.
10791 (read_signed_LEB_128): Likewise.
10792 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10793 (read_signed_LEB_128): Declare.
10794 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10795 (HFILES): Add reduced_debug_output.h.
10796 * Makefile.in: Rebuild.
10797
7d9e3d98
ILT
107982008-05-21 Ian Lance Taylor <iant@google.com>
10799
10800 * mapfile.cc: New file.
10801 * mapfile.h: New file.
10802 * options.h (class General_options): Add -M/--print-map and -Map.
10803 * options.cc (General_options::finalize): Make -M equivalent to
10804 -Map -.
10805 * main.cc: Include <cstdio> and "mapfile.h".
10806 (main): Open mapfile if requested.
10807 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10808 constructor. Change caller.
10809 (queue_initial_tasks): Add mapfile parameter. Change caller.
10810 (queue_middle_tasks): Likewise.
10811 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10812 declarations.
10813 * archive.cc: Include "mapfile.h".
10814 (Archive::add_symbols): Add mapfile parameter. Change all
10815 callers. Pass mapfile, symbol, and reason to include_member.
10816 (Archive::include_all_members): Add mapfile parameter. Change all
10817 callers.
10818 (Archive::include_member): Add mapfile, sym, and why parameters.
10819 Change all callers. Report inclusion to map file.
10820 * archive.h: Include "fileread.h".
10821 (class Archive): Update declarations.
10822 (Archive::file): New const method.
10823 (class Add_archive_symbols): Add mapfile_ field. Update
10824 constructor. Change all callers.
10825 * readsyms.h (class Read_symbols): Likewise.
10826 (class Finish_group): Likewise.
10827 (class Read_script): Likewise.
10828 * common.cc: Include "mapfile.h".
10829 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10830 all callers.
10831 (Symbol_table::do_allocate_commons): Likewise.
10832 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10833 symbol allocation to mapfile.
10834 * common.h (class Allocate_commons_task): Add mapfile_ field.
10835 Update constructor. Change all callers.
10836 * symtab.h (class Symbol_table): Update declarations.
10837 * layout.cc: Include "mapfile.h".
10838 (Layout_task_runner::run): Print information to mapfile.
10839 (Layout::create_gold_note): Change Output_data_fixed_space to
10840 Output_data_zero_fill.
10841 (Layout::create_build_id): Likewise.
10842 (Layout::print_to_mapfile): New function.
10843 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10844 constructor. Change caller.
10845 (class Layout): Declare print_to_mapfile.
10846 * output.cc (Output_section::Input_section::print_to_mapfile): New
10847 function.
10848 (Output_section::add_input_section): If producing a map, always
10849 add to input_sections_ list.
10850 (Output_section::do_print_to_mapfile): New function.
10851 (Output_segment::print_sections_to_mapfile): New function.
10852 (Output_segment::print_section_list_to_mapfile): New function.
10853 * output.h: Include "mapfile.h".
10854 (Output_data::print_to_mapfile): New function.
10855 (Output_data::do_print_to_mapfile): New virtual function.
10856 (Output_segment_headers::do_print_to_mapfile): New function.
10857 (Output_file_header::do_print_to_mapfile): New function.
10858 (Output_data_const::do_print_to_mapfile): New function.
10859 (class Output_data_const_buffer): Add map_name_ field. Update
10860 constructor. Change all callers. Add do_print_to_mapfile
10861 function.
10862 (class Output_data_fixed_space): Likewise.
10863 (class Output_data_space): Likewise.
10864 (class Output_data_zero_fill): New class.
10865 (Output_data_strtab::do_print_to_mapfile): New function.
10866 (Output_data_reloc_base::do_print_to_mapfile): New function.
10867 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10868 (Output_data_group::do_print_to_mapfile): New function.
10869 (Output_data_got::do_print_to_mapfile): New function.
10870 (Output_data_dynamic::do_print_to_mapfile): New function.
10871 (Output_symtab_xindex::do_print_to_mapfile): New function.
10872 (class Output_section): Declare do_print_to_mapflie. Declare
10873 print_to_mapfile in Input_section.
10874 (class Output_segment): Declare new functions.
10875 * object.h (Sized_relobj::symbol_count): New function.
10876 * script-sections.cc
10877 (Output_section_element_dot_assignment::set_section_addresses):
10878 Change Output_data_fixed_space to Output_data_zero_fill.
10879 (Output_data_expression::do_print_to_mapfile): New function.
10880 * script.cc (read_input_script): Add mapfile parameter. Change
10881 all callers.
10882 * script.h (read_input_script): Update declaration.
10883 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10884 (Eh_frame::do_print_to_mapfile): New function.
10885 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10886 (Output_merge_string::do_print_to_mapfile): New function.
10887 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10888 function.
10889 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10890 function.
10891 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10892 function.
10893 * Makefile.am (CCFILES): Add mapfile.cc.
10894 (HFILES): Add mapfile.h.
10895 * Makefile.in: Rebuild.
10896
9f1d377b
ILT
108972008-05-19 Ian Lance Taylor <iant@google.com>
10898
10899 * options.h (class General_options): Add -z relro.
10900 * layout.cc (Layout::Layout): Initialize relro_segment_.
10901 (Layout::add_output_section_data): Return the output section.
10902 (Layout::make_output_section): Rcognize relro sections and mark
10903 them appropriately.
10904 (Layout::attach_allocated_section_to_segment): Put relro sections
10905 in a PT_GNU_RELRO segment.
10906 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10907 section as relro.
10908 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10909 PT_TLS segments.
10910 (Layout::linkonce_mapping): Map d.rel.ro.local to
10911 .data.rel.ro.local.
10912 (Layout::output_section_name): Us .data.rel.ro.local for any
10913 section which begins with that.
10914 * layout.h (class Layout): Update add_output_section_data
10915 declaration. Add relro_segment_ field.
10916 * output.cc (Output_section::Output_section): Initialize is_relro_
10917 and is_relro_local_ fields.
10918 (Output_segment::add_output_section): Group relro sections.
10919 (Output_segment::is_first_section_relro): New function.
10920 (Output_segment::maximum_alignment): If there is a relro section,
10921 align the segment to the common page size.
10922 (Output_segment::set_section_addresses): Track whether we are
10923 looking at relro sections. If the last section is a relro
10924 section, align to the common page size.
10925 (Output_segment::set_section_list_addresses): Add in_relro
10926 parameter. Change all callers. Align to the page size when
10927 moving from relro to non-relro section.
10928 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10929 segment.
10930 * output.h (class Output_section): Add is_relro_ and
10931 is_relro_local_ fields.
10932 (Output_section::is_relro): New function.
10933 (Output_section::set_is_relro): New function.
10934 (Output_section::is_relro_local): New function.
10935 (Output_section::set_is_relro_local): New function.
10936 (class Output_segment): Update declarations.
10937 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10938 * sparc.cc (Target_sparc::got_section): Likewise.
10939 * x86_64.cc (Target_x86_64::got_section): Likewise.
10940 * testsuite/relro_test_main.cc: New file.
10941 * testsuite/relro_test.cc: New file.
10942 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10943 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10944 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10945 (relro_test.so, relro_test_pic.o): New targets.
10946 * testsuite/Makefile.in: Rebuild.
10947
a984ee1d
ILT
109482008-05-16 Ian Lance Taylor <iant@google.com>
10949
01676dcd
ILT
10950 * output.cc (Output_segment::add_output_section): Remove front
10951 parameter.
10952 * output.h (class Output_segment): Remove
10953 add_initial_output_section and overloaded add_output_section.
10954 Update declaration of remaining add_output_section.
10955 * layout.cc (Layout::create_interp): Call add_output_section
10956 rather than add_initial_output_section.
10957 (Layout::finish_dynamic_section): Likewise.
10958
497897f9
ILT
10959 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10960 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10961 know the dynamic type.
10962 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10963 field. Initialize it in constructor.
10964 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10965 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10966 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10967 reloc.
10968
a984ee1d
ILT
10969 * output.cc (Output_reloc::get_address): Change return type to
10970 Elf_Addr.
10971 * output.h (class Output_reloc): Update get_address declaration.
10972 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10973 for section addresses.
10974
55ba0940
ILT
109752008-05-09 Ian Lance Taylor <iant@google.com>
10976
10977 PR 6493
10978 * gold.cc (gold_nomem): Use return value of write.
10979
75517b77
ILT
109802008-05-08 Ian Lance Taylor <iant@google.com>
10981
10982 * symtab.c (Symbol::init_base_output_data): Add version
10983 parameter. Change all callers.
10984 (Symbol::init_base_output_segment): Likewise.
10985 (Symbol::init_base_constant): Likewise.
10986 (Symbol::init_base_undefined): Likewise.
10987 (Sized_symbol::init_output_data): Likewise.
10988 (Sized_symbol::init_output_segment): Likewise.
10989 (Sized_symbol::init_constant): Likewise.
10990 (Sized_symbol::init_undefined): Likewise.
10991 (Symbol_table::do_define_in_output_data): If the new symbol has a
10992 version, mark it as the default.
10993 (Symbol_table::do_define_in_output_segment): Likewise.
10994 (Symbol_table::do_define_as_constant): Likewise.
10995 * symtab.h (class Symbol): Update declarations.
10996 (class Sized_symbol): Likewise.
10997 * resolve.cc (Symbol::override_version): New function.
c42e122e 10998 (Symbol::override_base): Call override_version.
75517b77
ILT
10999 (Symbol::override_base_with_special): Likewise.
11000 * testsuite/ver_script_8.script: New file.
11001 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11002 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11003 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11004 (ver_test_8_1.so, ver_test_8_2.so): New targets.
11005
f1f70eae
ILT
110062008-05-06 Ian Lance Taylor <iant@google.com>
11007
f3e9c5c5
ILT
11008 PR 6049
11009 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11010 functions.
11011 (class General_options): Remove existing --undefined, and add
11012 --no-undefined instead. Add new --undefined as synonym for -u.
11013 * archive.cc (Archive::add_symbols): Check whether symbol was
11014 named with -u.
11015 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11016 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11017 all uses. Add IS_UNDEFINED. Update declarations to split
11018 different versions of init_base. Declare init_base_undefined.
11019 (Symbol::is_defined): Handle IS_UNDEFINED.
11020 (Symbol::is_undefined): Likewise.
11021 (Symbol::is_weak_undefined): Call is_undefined.
11022 (Symbol::is_absolute): Handle IS_CONSTANT.
11023 (class Sized_symbol): Update declarations to split different
11024 versions of init. Declare init_undefined.
11025 (class Symbol_table): Declare new functions.
11026 * symtab.cc (Symbol::init_base_object): Rename from init_base.
11027 Change all callers.
11028 (Symbol::init_base_output_data): Likewise.
11029 (Symbol::init_base_output_segment): Likewise.
11030 (Symbol::init_base_constant): Likewise.
11031 (Symbol::init_base_undefined): New function.
11032 (Sized_symbol::init_object): Rename from init. Change all
11033 callers.
11034 (Sized_symbol::init_output_data): Likewise.
11035 (Sized_symbol::init_output_segment): Likewise.
11036 (Sized_symbol::init_constant): Likewise.
11037 (Sized_symbol::init_undefined): New function.
11038 (Symbol_table::add_undefined_symbols_from_command_line): New
11039 function.
11040 (Symbol_table::do_add_undefined_symbols_from_command_line): New
11041 function.
11042 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11043 (Symbol::output_section): Likewise.
11044 (Symbol::set_output_section): Likewise.
11045 (Symbol_table::sized_finalize_symbol): Likewise.
11046 (Symbol_table::sized_write_globals): Likewise.
11047 * resolve.cc (Symbol_table::should_override): Likewise.
11048 (Symbol::override_base_with_special): Likewise.
11049
8bdcdf2c
ILT
11050 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11051 symbol, change it to have default visibility.
11052 * testsuite/protected_1.cc: New file.
11053 * testsuite/protected_2.cc: New file.
11054 * testsuite/protected_3.cc: New file.
11055 * testsuite/protected_main_1.cc: New file.
11056 * testsuite/protected_main_2.cc: New file.
11057 * testsuite/protected_main_3.cc: New file.
11058 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11059 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11060 (protected_1_LDFLAGS, protected_1_LDADD): Define.
11061 (protected_1.so): New target.
11062 (protected_1_pic.o, protected_2_pic.o): New targets.
11063 (protected_3_pic.o): New target.
11064 (check_PROGRAMS): Add protected_2.
11065 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11066 (protected_2_LDFLAGS, protected_2_LDADD): Define.
11067 * testsuite/Makefile.in: Rebuild.
11068
2b706932
ILT
11069 * options.h (DEFINE_var): Add set_user_set_##varname__.
11070 (DEFINE_bool_alias): New macro.
11071 (class General_options): Define -Bstatic using DEFINE_bool_alias
11072 rather than DEFINE_special. Add --undefined as an alias for -z
11073 defs.
11074 * options.cc (General_options::parse_Bstatic): Remove.
11075
d82a5bcc
ILT
11076 * options.h (class General_options): Add --fatal-warnings.
11077 * main.cc (main): Implement --fatal-warnings.
11078 * errors.h (Errors::warning_count): New function.
11079
f1f70eae
ILT
11080 * options.h (class General_options): Add -Bsymbolic-functions.
11081 * symtab.h (Symbol::is_preemptible): Check for
11082 -Bsymbolic-functions.
11083
8825ac63
ILT
110842008-05-05 Ian Lance Taylor <iant@google.com>
11085
d98bc257
ILT
11086 * options.h (DEFINE_bool): For DASH_Z, create the negative option
11087 as noVARNAME rather than no-VARNAME.
11088 (class General_options): Add option -z combreloc.
11089 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11090 get_address.
11091 (Output_reloc::sort_before) [SHT_REL]: New function.
11092 (Output_reloc::sort_before) [SHT_RELA]: New function.
11093 (class Output_data_reloc_base): Add sort_relocs_ field. Define
11094 Sort_relocs_comparison.
11095 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11096 parameter. Change all callers.
11097 (Output_data_reloc::Output_data_reloc) [both versions]: Add
11098 sort_relocs parameter. Change all callers.
11099 * output.cc (Output_reloc::get_address): New function, broken out
11100 of write_rel.
11101 (Output_reloc::write_rel): Call it.
11102 (Output_reloc::compare): New function.
11103 (Output_data_reloc_base::do_write): Optionally sort relocs.
11104
60b2b4e7
ILT
11105 * configure.ac: If targ_extra_obj is set, link it in.
11106 * configure.tgt: Initialize all variables.
11107 (x86_64*): Set targ_extra_obj and targ_extra_size.
11108 * configure: Rebuild.
11109
8825ac63
ILT
11110 * object.cc (Sized_relobj::include_section_group): Adjust section
11111 indexes read from group data. Build vector to pass to
11112 layout_group.
11113 * layout.cc (Layout::layout_group): Add flags and shndxes
11114 parameters. Remove contents parameter. Change caller. Update
11115 explicit instantiations.
11116 * layout.h (class Layout): Update layout_group declaration.
11117 * output.cc (Output_data_group::Output_data_group): Add flags and
11118 input_shndxes parameters. Remove contents parameter. Change
11119 caller.
11120 (Output_data_group::do_write): Change input_sections_ to
11121 input_shndxes_.
11122 * output.h (class Output_data_group): Update constructor
11123 declaration. Rename input_sections_ to input_shndxes_.
11124 * testsuite/many_sections_test.cc: Add template.
11125
e94cf127
CC
111262008-04-30 Cary Coutant <ccoutant@google.com>
11127
4418b2d5
CC
11128 * target-reloc.h (relocate_section): Fix dead-pointer bug.
11129
e94cf127
CC
11130 * layout.cc (Layout::include_section): Refactored check for debug
11131 info section.
11132 (Layout::add_comdat): Add new parameters. Change type
11133 of signature parameter. Add object and shndx to signatures table.
11134 (Layout::find_kept_object): New function.
11135 * layout.h: Include <cstring>.
11136 (Layout::is_debug_info_section): New function.
11137 (Layout::add_comdat): Add new parameters.
11138 (Layout::find_kept_object): New function.
11139 (Layout::Kept_section): New struct.
11140 (Layout::Signatures): Change type of map range.
11141 * object.cc (Relobj::output_section_address): New function.
11142 (Sized_relobj::include_section_group): Add new parameters. Change
11143 calls to Layout::add_comdat. Change to build table of kept comdat
11144 groups and table mapping discarded sections to kept sections.
11145 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
11146 (Sized_relobj::do_layout): Change calls to include_section_group and
11147 include_linkonce_section.
11148 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
11149 value to zero when section is discarded.
11150 (Sized_relobj::map_to_kept_section): New function.
11151 * object.h (Relobj::output_section_address): New function.
11152 (Relobj::Comdat_group): New type.
11153 (Relobj::find_comdat_group): New function.
11154 (Relobj::Comdat_group_table): New type.
11155 (Relobj::Kept_comdat_section): New type.
11156 (Relobj::Kept_comdat_section_table): New type.
11157 (Relobj::add_comdat_group): New function.
11158 (Relobj::set_kept_comdat_section): New function.
11159 (Relobj::get_kept_comdat_section): New function.
11160 (Relobj::comdat_groups_): New field.
11161 (Relobj::kept_comdat_sections_): New field.
11162 (Symbol_value::input_value): Update comment.
11163 (Sized_relobj::map_to_kept_section) New function.
11164 (Sized_relobj::include_linkonce_section): Add new parameter.
11165 * target-reloc.h (Comdat_behavior): New type.
11166 (get_comdat_behavior): New function.
11167 (relocate_section): Add code to map a discarded section to the
11168 corresponding kept section when applying a relocation.
11169
e4e5049b
CS
111702008-04-30 Craig Silverstein <csilvers@google.com>
11171
11172 * dwarf_reader.cc (next_generation_count): New static var.
11173 (Addr2line_cache_entry): New struct.
11174 (addr2line_cache): New static var.
11175 (Dwarf_line_info::one_addr2line): Added caching.
11176 (Dwarf_line_info::clear_addr2line_cache): New function.
11177 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
11178 cache-size parameter.
11179 (Dwarf_line_info::one_addr2line_cache): New function.
11180 * symtab.cc (Symbol_table::detect_odr_violations): Pass
11181 new cache-size argument to one_addr2line(), and clear cache.
11182
d09e9154
CC
111832008-04-28 Cary Coutant <ccoutant@google.com>
11184
11185 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
11186 R_386_PC8 relocations.
11187
7ef73768
ILT
111882008-04-23 Ian Lance Taylor <iant@google.com>
11189
55438702
ILT
11190 * object.cc (Sized_relobj::include_section_group): Check for
11191 invalid section group.
11192
c165fb93
ILT
11193 * object.cc (make_elf_object): Correct test for 64-bit ELF file
11194 header size.
11195
7ef73768
ILT
11196 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
11197 than read for file header.
11198 * archive.cc (Archive::include_member): Likewise.
11199
6194aaab
L
112002008-04-23 Paolo Bonzini <bonzini@gnu.org>
11201
11202 * aclocal.m4: Regenerate.
11203 * configure: Regenerate.
11204
d491d34e
ILT
112052008-04-19 Ian Lance Taylor <iant@google.com>
11206
5ea2bac6
ILT
11207 * version.cc (version_string): Bump to 1.6.
11208
7bc3e21a
ILT
11209 * testsuite/Makefile.am (many_sections_r_test): New target.
11210 (many_sections_r_test_SOURCES): Remove.
11211 (many_sections_r_test_DEPENDENCIES): Remove.
11212 (many_sections_r_test_LDFLAGS): Remove.
11213 (many_sections_r_test_LDADD): Remove.
11214
7fcd3aa9
ILT
11215 * object.cc (Sized_relobj::do_add_symbols): Always pass
11216 local_symbol_count_ to add_from_relobj.
11217
4c94d6ae
ILT
11218 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11219 every thousand variables.
11220 * testsuite/Makefile.in: Rebuild.
11221
d491d34e
ILT
11222 * object.cc (Xindex::initialize_symtab_xindex): New function.
11223 (Xindex::read_symtab_xindex): New function.
11224 (Xindex::sym_xindex_to_shndx): New function.
11225 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11226 available.
11227 (Sized_relobj::do_initialize_xindex): New function.
11228 (Sized_relobj::do_read_symbols): Adjust section links.
11229 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11230 parameter. Change all callers.
11231 (Sized_relobj::include_section_group): Adjust section links and
11232 symbol section indexes.
11233 (Sized_relobj::do_layout): Adjust section links.
11234 (Sized_relobj::do_count_local_symbols): Adjust section links and
11235 symbol section indexes.
11236 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11237 ordinary and special symbols.
11238 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11239 dynsym_xindex parameters. Change all callers. Adjust section
11240 links. Use SHN_XINDEX when needed.
11241 (Sized_relobj::get_symbol_location_info): Adjust section links.
11242 Don't get fooled by special symbols.
11243 * object.h (class Xindex): Define.
11244 (class Object): Add xindex_ parameter. Declare virtual functoin
11245 do_initialize_xindex.
11246 (Object::adjust_sym_shndx): New function.
11247 (Object::set_xindex): New protected function.
11248 (class Symbol_value): Add is_ordinary_shndx_ field.
11249 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11250 (Symbol_value::value): Assert ordinary section.
11251 (Symbol_value::initialize_input_to_output_map): Likewise.
11252 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11253 Change all callers.
11254 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11255 all callers.
11256 (class Sized_relobj): Update declarations.
11257 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11258 parameter. Change all callers.
11259 (Sized_relobj::adjust_shndx): New function.
11260 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11261 field.
11262 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11263 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11264 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11265 (Sized_dynobj::read_dynsym_section): Adjust section links.
11266 (Sized_dynobj::read_dynamic): Likewise.
11267 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11268 section links.
11269 (Sized_dynobj::do_initialize_xindex): New function.
11270 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11271 do_initialize_xindex.
11272 (Sized_dynobj::adjust_shndx): New function.
11273 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11274 dynsym_xindex_ fields.
11275 (Layout::finalize): Add a call to set_section_indexes before
11276 creating the symtab sections.
11277 (Layout::set_section_indexes): Don't do anything if the section
11278 already has a section index.
11279 (Layout::create_symtab_sections): Add shnum parameter. Change
11280 caller. Create .symtab_shndx section if needed.
11281 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11282 caller.
11283 (Layout::allocated_output_section_count): New function.
11284 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11285 needed.
11286 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11287 fields. Update declarations.
11288 (Layout::symtab_xindex): New function.
11289 (Layout::dynsym_xindex): New function.
11290 (class Write_symbols_task): Add layout_ field.
11291 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11292 Change caller.
11293 * output.cc (Output_section_headers::Output_section_headers): Add
11294 shstrtab_section parameter. Change all callers.
11295 (Output_section_headers::do_sized_write): Store overflow values
11296 for section count and section string table section index in
11297 section header zero.
11298 (Output_file_header::do_sized_write): Check for overflow of
11299 section count and section string table section index.
11300 (Output_symtab_xindex::do_write): New function.
11301 (Output_symtab_xindex::endian_do_write): New function.
11302 * output.h (class Output_section_headers): Add shstrtab_section_.
11303 Update declarations.
11304 (class Output_symtab_xindex): Define.
11305 (Output_section::has_out_shndx): New function.
11306 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11307 field.
11308 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11309 Change all callers.
11310 (Sized_symbol::init): Likewise.
11311 (Symbol::output_section): Check for ordinary symbol.
11312 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11313 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11314 callers.
11315 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11316 Change all callers. Simplify handling of symbols from sections
11317 not included in the link.
11318 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11319 distinction.
11320 (Weak_alias_sorter::operator()): Assert that symbols are
11321 ordinary.
11322 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11323 distinction.
11324 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11325 parameters. Change all callers.
11326 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11327 symbol distinction. Use SHN_XINDEX when needed.
11328 (Symbol_table::write_section_symbol): Add symtab_xindex
11329 parameter. Change all callers.
11330 (Symbol_table::sized_write_section_symbol): Likewise. Use
11331 SHN_XINDEX when needed.
11332 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11333 declarations.
11334 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11335 (Symbol::is_defined): Check is_ordinary.
11336 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11337 (Symbol::is_absolute, Symbol::is_common): Likewise.
11338 (class Sized_symbol): Update declarations.
11339 (class Symbol_table): Update declarations.
11340 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11341 parameters. Change all callers.
11342 (Sized_symbol::override): Likewise.
11343 (Symbol_table::override): Likewise.
11344 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11345 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11346 is_ordinary, and orig_st_shndx parameters. Change all callers.
11347 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11348 to be in an ordinary section.
11349 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11350 object and is_ordinary parameters. Change all callers.
11351 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11352 Change all callers. Don't add undefined or non-ordinary symbols
11353 to reloc_map_.
11354 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11355 Change all callers.
11356 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11357 declarations.
11358 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11359 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11360 (Sized_relobj::relocate_sections): Likewise.
11361 * target-reloc.h (scan_relocs): Adjust section symbol index.
11362 (scan_relocatable_relocs): Likewise.
11363 * i386.cc (Scan::local): Check for ordinary symbols.
11364 * sparc.cc (Scan::local): Likewise.
11365 * x86_64.cc (Scan::local): Likewise.
11366 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11367 to symbol_section_and_value.
11368 * testsuite/many_sections_test.cc: New file.
11369 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11370 (check_PROGRAMS): Add many_sections_test.
11371 (many_sections_test_SOURCES): Define.
11372 (many_sections_test_DEPENDENCIES): Define.
11373 (many_sections_test_LDFLAGS): Define.
11374 (BUILT_SOURCES): Add many_sections_define.h.
11375 (many_sections_define.h): New target.
11376 (BUILT_SOURCES): Add many_sections_check.h.
11377 (many_sections_check.h): New target.
11378 (check_PROGRAMS): Add many_sections_r_test.
11379 (many_sections_r_test_SOURCES): Define.
11380 (many_sections_r_test_DEPENDENCIES): Define.
11381 (many_sections_r_test_LDFLAGS): Define.
11382 (many_sections_r_test_LDADD): Define.
11383 (many_sections_r_test.o): New target.
11384 * testsuite/Makefile.in: Rebuild.
11385
c5818ff1
CC
113862008-04-17 Cary Coutant <ccoutant@google.com>
11387
11388 * errors.cc (Errors::info): New function.
11389 (gold_info): New function.
11390 * errors.h (Errors::info): New function.
11391 * gold.h (gold_info): New function.
11392 * object.cc (Input_objects::add_object): Print trace output.
11393 * options.cc (options::parse_set): New function.
11394 (General_options::parse_wrap): Deleted.
11395 (General_options::General_options): Deleted initializer.
11396 * options.h (options::String_set): New typedef.
11397 (options::parse_set): New function.
11398 (DEFINE_set): New macro.
11399 (General_options::wrap): Changed to use DEFINE_set. Changed
11400 callers of any_wrap_symbols and is_wrap_symbol.
11401 (General_options::trace, General_options::trace_symbol):
11402 New options.
11403 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11404 (General_options::wrap_symbols_): Deleted.
11405 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11406
b5be4a7c
DM
114072008-04-17 David S. Miller <davem@davemloft.net>
11408
11409 * options.cc (General_options::parse_V): New function.
11410 * options.h: Add entries for -V and -Qy.
11411
155a0dd7
ILT
114122008-04-17 Ian Lance Taylor <iant@google.com>
11413
11414 * common.cc (Symbol_table::allocate_commons): Remove options
11415 parameter. Change caller.
11416 (Symbol_table::do_allocate_commons): Remove options parameter.
11417 Change caller. Just call do_allocate_commons_list twice.
11418 (Symbol_table::do_allocate_commons_list): New function, broken out
11419 of do_allocate_commons.
11420 * common.h (class Allocate_commons_task): Remove options_ field.
11421 Update constructor.
11422 * symtab.cc (Symbol_table::Symbol_table): Initialize
11423 tls_commons_.
11424 (Symbol_table::add_from_object): Put TLS common symbols on
11425 tls_commons_ list.
11426 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11427 which are IN_OUTPUT_DATA.
11428 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11429 allocate_commons and do_allocate_commons declarations. Declare
11430 do_allocate_commons_list.
11431 * gold.cc (queue_middle_tasks): Update creation of
11432 Allocate_commons_task to not pass options.
11433 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11434 (TLS_TEST_C_FLAGS): New variable.
11435 (tls_test_c_pic.o): New target.
11436 (tls_test_shared.so): Link in tls_test_c_pic.o.
11437 (tls_test_c_pic_ie.o): New target.
11438 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11439 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11440 (tls_test_c.o): New target.
11441 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11442 (tls_pic_test_LDADD): Likewise.
11443 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11444 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11445 (tls_test_c_gnu2.o): New target.
11446 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11447 tls_test_c_gnu2.o.
11448 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11449 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11450 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11451 * testsuite/tls_test.cc: Include "config.h".
11452 (t_last): Call t11_last.
11453 * testsuite/tls_test.h (t11, t11_last): Declare.
11454 * testsuite/tls_test_c.c: New file.
11455 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11456 * configure.ac: Check for OpenMP support.
11457 * configure, config.in, Makefile.in: Rebuild.
11458 * testsuite/Makefile.in: Rebuild.
11459
edfbb029
CC
114602008-04-16 Cary Coutant <ccoutant@google.com>
11461
11462 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11463 (Target_i386::tls_base_symbol_defined_): New field.
11464 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11465 (Target_i386::Scan::global): Likewise.
11466 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11467 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11468 (Target_x86_64::tls_base_symbol_defined_): New field.
11469 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11470 (Target_x86_64::Scan::global): Likewise.
11471
f3c69fca
CC
114722008-04-16 Cary Coutant <ccoutant@google.com>
11473
11474 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11475 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11476 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11477 building shared libraries.
11478 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11479 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11480 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11481 * testsuite/Makefile.in: Rebuild.
11482 * testsuite/weak_undef.h: New file.
11483 * testsuite/weak_undef_file1.cc: Add extra test cases.
11484 * testsuite/weak_undef_file2.cc: Likewise.
11485 * testsuite/weak_undef_test.cc: Likewise.
11486
7c414435
DM
114872008-04-16 David S. Miller <davem@davemloft.net>
11488
32b769e1
DM
11489 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11490 Add issued_non_pic_error_ field. Declare check_non_pic.
11491 (Target_sparc::Scan::check_non_pic): New function.
11492 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11493 (Target_sparc::Scan::global): Likewise.
11494
11936fb1
DM
11495 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11496 * configure: Rebuild.
11497
7c414435
DM
11498 * options.h (DEFINE_enable): New macro.
11499 (new_dtags): New enable option.
11500 (initfirst, interpose, loadfltr, nodefaultlib,
11501 nodelete, nodlopen, nodump): New -z options.
11502 * layout.cc (Layout:finish_dynamic_section): If new
11503 dtags enabled, emit DT_RUNPATH. Also, emit a
11504 DT_FLAGS_1 containing any specified -z flags.
11505
85c7bf8b
ILT
115062008-04-16 Ian Lance Taylor <iant@google.com>
11507
12c0daef
ILT
11508 * copy-relocs.cc: New file.
11509 * copy-relocs.h: New file.
11510 * reloc.cc: Remove Copy_relocs code.
11511 * reloc.h: Likewise.
11512 * reloc-types.h (struct Reloc_types) [both versions]: Add
11513 get_reloc_addend_noerror.
11514 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11515 variants of add_global which take an addend which must be zero.
11516 * i386.cc: Include "copy-relocs.h".
11517 (class Target_i386): Change type of copy_relocs_ to variable,
11518 update initializer.
11519 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11520 Change all callers.
11521 (Target_i386::do_finalize_sections): Change handling of
11522 copy_relocs_.
11523 * sparc.cc: Include "copy-relocs.h".
11524 (class Target_sparc): Change type of copy_relocs_ to variable,
11525 update initializer.
11526 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11527 Change all callers.
11528 (Target_sparc::do_finalize_sections): Change handling of
11529 copy_relocs_.
11530 * x86_64.cc: Include "copy-relocs.h".
11531 (class Target_x86_64): Change type of copy_relocs_ to variable,
11532 update initializer.
11533 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11534 class. Change all callers.
11535 (Target_x86_64::do_finalize_sections): Change handling of
11536 copy_relocs_.
11537 * Makefile.am (CCFILES): Add copy-relocs.cc.
11538 (HFILES): Add copy-relocs.h.
11539
4f4995b6
ILT
11540 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11541
85c7bf8b
ILT
11542 * testsuite/script_test_4.sh: Permit leading zeroes.
11543
4f2a9edd
ILT
115442008-04-15 Ian Lance Taylor <iant@google.com>
11545
e6188289
ILT
11546 * script-sections.cc (Script_sections::create_segments): Use
11547 header_size_adjustment even when there is enough room for the
11548 headers.
11549 * testsuite/script_test_4.sh: New file.
11550 * testsuite/script_test_4.t: New file.
11551 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11552 (check_DATA): Add script_test_4.stdout.
11553 (MOSTLYCLEANFILES): Likewise.
11554 (script_test_4): New target.
11555 (script_test_4.stdout): New target.
11556 * testsuite/Makefile.in: Rebuild.
11557
4f2a9edd
ILT
11558 * sparc.cc: Add definitions for Output_data_plt_sparc class
11559 constants.
11560
f5314dd5
DM
115612008-04-14 David S. Miller <davem@davemloft.net>
11562
11563 * sparc.cc: New file.
11564 * Makefile.am (TARGETSOURCES): Add sparc.cc
11565 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11566 * configure.tgt: Document targ_extra_size and
11567 targ_extra_big_endian. Add entries for sparc-* and
11568 sparc64-*.
11569 * configure.ac: Handle targ_extra_size and
11570 targ_extra_big_endian.
11571 * Makefile.in: Rebuild.
11572 * configure: Likewise.
11573 * po/POTFILES.in: Likewise.
11574 * po/gold.pot: Likewise.
11575
154e0e9a
ILT
115762008-04-14 Ian Lance Taylor <iant@google.com>
11577
11578 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11579 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11580 in the name/type/flags to section mapping. Don't call
11581 allocate_output_section.
11582 (Layout::choose_output_section): Change parameter from adjust_name
11583 to is_input_section. Don't permit input sections after sections
11584 are attached to segments. Don't call allocate_output_section.
11585 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11586 not write_enable_output_section.
11587 (Layout::make_output_section): Don't push to
11588 unattached_section_list_ nor call attach_to_segment. Call
11589 attach_section_to_segment if sections are attached.
11590 (Layout::attach_sections_to_segments): New function.
11591 (Layout::attach_section_to_segment): New function.
11592 (Layout::attach_allocated_section_to_segment): Rename from
11593 attach_to_segment. Remove flags parameter.
11594 (Layout::allocate_output_section): Remove function.
11595 (Layout::write_enable_output_section): Remove function.
11596 * layout.h (class Layout): Update for above changes. Add new
11597 field sections_are_attached_.
11598 * output.h (Output_section::update_flags_for_input_section): New
11599 function.
11600 * output.cc (Output_section::add_input_section): Call
11601 update_flags_for_input_section.
11602 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11603
009a67a2
CC
116042008-04-11 Cary Coutant <ccoutant@google.com>
11605
11606 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11607 thought unnecessary.
11608 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11609
759b1a24
ILT
116102008-04-11 Ian Lance Taylor <iant@google.com>
11611
11612 * output.h (class Output_section_data): Remove inline definition
11613 of set_addralign.
11614 * output.cc (Output_section_data::set_addralign): New function.
11615
c2b45e22
CC
116162008-04-11 Cary Coutant <ccoutant@google.com>
11617
11618 Add support for TLS descriptors for i386 and x86_64.
11619 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11620 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11621 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11622 GOT_TYPE_TLS_DESC.
11623 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11624 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11625 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11626 relocations.
11627 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11628 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11629 Fix problem with initial-exec relocations.
11630 (Target_i386::Relocate::relocate_tls): Likewise.
11631 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11632 relaxation.
11633 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11634 support for section-plus-offset dynamic table entries.
11635 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11636 (Output_data_dynamic::Dynamic_entry): Add support for
11637 section-plus-offset dynamic table entries.
11638 (Output_data_dynamic::Classification): Likewise.
11639 (Output_data_dynamic::classification_): Renamed offset_.
11640 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11641 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11642 (Target_x86_64::make_plt_section): New function.
11643 (Target_x86_64::reserve_tlsdesc_entries): New function.
11644 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11645 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11646 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11647 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11648 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11649 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11650 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11651 add extra PLT entry for TLS descriptors.
11652 (Output_data_plt_x86_64::got_): New field.
11653 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11654 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11655 fields.
11656 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11657 descriptors.
11658 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11659 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11660 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11661 R_386_TLS_DESC_CALL relocations.
11662 (Target_x86_64::Scan::global): Likewise.
11663 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11664 for TLS descriptors.
11665 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11666 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11667 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11668 GD-to-IE relaxation.
11669 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11670 and TLS_DESCRIPTORS.
11671 * Makefile.in: Rebuild.
11672 * configure: Rebuild.
11673 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11674 (tls_test_shared2.so): New target.
11675 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11676 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11677 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11678 (tls_shared_gd_to_ie_test_LDADD): New variable.
11679 (tls_shared_gnu2_gd_to_ie_test): New target.
11680 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11681 New targets.
11682 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11683 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11684 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11685 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11686 (tls_shared_gnu2_test): New target.
11687 (tls_test_gnu2_shared.so): New target.
11688 (tls_shared_gnu2_test_SOURCES): New variable.
11689 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11690 (tls_shared_gnu2_test_LDFLAGS): New variable.
11691 (tls_shared_gnu2_test_LDADD): New variable.
11692 * testsuite/Makefile.in: Rebuild.
11693 * testsuite/Makefile.
11694
83bfb6b7
ILT
116952008-04-11 Ian Lance Taylor <iant@google.com>
11696
11697 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11698 justsyms.t.
11699 * testsuite/Makefile.in: Rebuild.
11700
11701 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11702 long.
11703 * testsuite/script_test_2.cc (main): Adjust test.
11704
706e1f5e
ILT
117052008-04-11 David S. Miller <davem@davemloft.net>
11706 Ian Lance Taylor <iant@google.com>
11707
11708 * options.h (General_options): Add entries for '-Y' and
11709 '-relax'.
11710 * options.cc (General_options:finalize): If -Y was used, add those
11711 entries to the library path instead of the default "/lib" and
11712 "/usr/lib".
11713
7c98e6bb
DM
117142008-04-11 David S. Miller <davem@davemloft.net>
11715
11716 * testsuite/justsyms.t: Start at 0x100.
11717 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
11718 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11719 long.
11720 * testsuite/script_test_2.cc: Adjust string and section length
11721 checks.
7c98e6bb 11722
99a37bfd
ILT
117232008-04-09 Ian Lance Taylor <iant@google.com>
11724
2cefc357
ILT
11725 PR gold/5996
11726 * script-sections.cc (Sections_element::allocate_to_segment): Add
11727 orphan parameter.
11728 (Output_section_definition::allocate_to_segment): Likewise.
11729 (Orphan_output_section::allocate_to_segment): Likewise.
11730 (Script_sections::attach_sections_using_phdrs_clause): Don't
11731 propagate non-PT_LOAD segments to orphan sections.
11732 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11733 readelf rather than objdump.
11734 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11735 .interp section and PT_INTERP segment are the same size.
11736 * testsuite/Makefile.in: Rebuild.
11737
99a37bfd
ILT
11738 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11739 aliases for symbols defined in the same object.
11740 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11741 (weak_alias_test_SOURCES): New variable.
11742 (weak_alias_test_DEPENDENCIES): New variable.
11743 (weak_alias_test_LDFLAGS): New variable.
11744 (weak_alias_test_LDADD): New variable.
11745 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11746 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11747 (weak_alias_test_3.o): New target.
11748 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11749 * testsuite/weak_alias_test_main.cc: New file.
11750 * testsuite/weak_alias_test_1.cc: New file.
11751 * testsuite/weak_alias_test_2.cc: New file.
11752 * testsuite/weak_alias_test_3.cc: New file.
11753
780e49c5
ILT
117542008-04-08 Ian Lance Taylor <iant@google.com>
11755
cdb0b8f5
ILT
11756 * options.h (class General_options): Add --noinhibit-exec option.
11757 * main.cc (main): Check --noinhibit-exec.
11758
0864d551
ILT
11759 * options.h (class General_options): Define --wrap as a special
11760 option. Add wrap_symbols_ field.
11761 (General_options::any_wrap_symbols): New function.
11762 (General_options::is_wrap_symbol): New function.
11763 * options.cc (General_options::parse_wrap): New function.
11764 (General_options::General_options): Initialize wrap_symbols_.
11765 * symtab.cc (Symbol_table::wrap_symbol): New function.
11766 (Symbol_table::add_from_object): Handle --wrap.
11767 * symtab.h (class Symbol_table): Declare wrap_symbol.
11768 * target.h (Target::wrap_char): New function.
11769 (Target::Target_info): Add wrap_char field.
11770 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11771 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11772 * testsuite/testfile.cc (Target_test::test_target_info):
11773 Likewise.
11774
789aa6de
ILT
11775 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11776 there is one.
11777
2c38906f
ILT
11778 * layout.h (class Layout): Add added_eh_frame_data_ field.
11779 * layout.cc (Layout::Layout): Initialize new field.
11780 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11781 output section until we find a section we merged successfully.
11782 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11783 that the size be non-zero.
11784
780e49c5
ILT
11785 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11786 qualifier.
11787
7fcd0256
ILT
117882008-04-08 Craig Silverstein <csilvers@google.com>
11789
11790 * configure.ac: Export new conditional variable HAVE_ZLIB.
11791 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11792 on HAVE_ZLIB.
11793 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11794 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11795
6835af53
ILT
117962008-04-07 Ian Lance Taylor <iant@google.com>
11797
e24f324c
ILT
11798 * version.cc (version_string): Set to "1.5".
11799
a036edd8
ILT
11800 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11801 Add issued_non_pic_error_ field. Declare check_non_pic.
11802 (Target_x86_64::Scan::check_non_pic): New function.
11803 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11804 (Target_x86_64::Scan::global): Likewise.
11805
624f8810
ILT
11806 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11807 addend parameter. Change caller. Handle merge sections.
11808 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11809 Address to Addend. Don't add in the result of
11810 local_section_offset, pass down the addend and use the returned
11811 value.
11812 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11813 Update declarations of local_section_offset and symbol_value.
11814 * testsuite/two_file_test_1.cc (t18): New function.
11815 * testsuite/two_file_test_2.cc (f18): New function.
11816 * testsuite/two_file_test_main.cc (main): Call t18.
11817 * testsuite/two_file_test.h (t18, f18): Declare.
11818
6835af53
ILT
11819 * configure.ac: Don't test for objdump, c++filt, or readelf.
11820 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11821 conditionals.
11822 (TEST_READELF): New variable.
11823 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11824 (check_PROGRAMS): Add two_file_strip_test.
11825 (two_file_strip_test): New target.
11826 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11827 (two_file_same_shared_strip_test_SOURCES): New variable.
11828 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11829 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11830 (two_file_same_shared_strip_test_LDADD): New variable.
11831 (two_file_shared_strip.so): New target.
11832 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11833 (ver_test_5.syms, ver_test_7.syms): Likewise.
11834 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11835 (strip_test_3.stdout): Use TEST_OBJDUMP.
11836 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11837
86925eef
CC
118382008-04-04 Cary Coutant <ccoutant@google.com>
11839
11840 * symtab.h (Symbol::is_weak_undefined): New function.
11841 (Symbol::is_strong_undefined): New function.
11842 (Symbol::is_absolute): New function.
11843 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11844 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11845 absolute symbols.
11846 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11847 (weak_undef_test): New target.
11848 * testsuite/Makefile.in: Rebuild.
11849 * testsuite/weak_undef_file1.cc: New file.
11850 * testsuite/weak_undef_file2.cc: New file.
11851 * testsuite/weak_undef_test.cc: New file.
11852
126f3ece
ILT
118532008-04-03 Craig Silverstein <csilvers@google.com>
11854
11855 * compressed_output.h (class Output_compressed_section): Use
11856 unsigned buffer.
11857 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11858 add zlib header.
11859 (zlib_compressed_suffix): Removed.
11860 (Output_compressed_section::set_final_data_size): Use unsigned
11861 buffers.
11862 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11863 Fix linker invocation.
11864 (flagstest_o_specialfile_and_compress_debug_sections):
11865 Likewise.
11866 * testsuite/Makefile.in: Regenerated.
11867
deae2a14
DM
118682008-04-02 David S. Miller <davem@davemloft.net>
11869
11870 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11871 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11872
70752818
ILT
118732008-04-02 Craig Silverstein <csilvers@google.com>
11874
11875 * TODO: New file.
11876
39d0cb0e
ILT
118772008-04-02 Ian Lance Taylor <iant@google.com>
11878
11879 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11880 parameters. Update for new key type to views_. Change all
11881 callers.
11882 (File_read::read): Adjust for byteshift in returned view.
11883 (File_read::add_view): New function, broken out of
11884 find_and_make_view.
11885 (File_read::make_view): New function, broken out of
11886 find_and_make_view.
11887 (File_read::find_or_make_view): Add offset and aligned
11888 parameters. Rewrite accordingly. Change all callers.
11889 (File_read::get_view): Add offset and aligned parameters. Adjust
11890 for byteshift in return value.
11891 (File_read::get_lasting_view): Likewise.
11892 * fileread.h (class File_read): Update declarations.
11893 (class File_read::View): Add byteshift_ field. Add byteshift to
11894 constructor. Add byteshift method.
11895 * archive.h (Archive::clear_uncached_views): New function.
11896 (Archive::get_view): Add aligned parameter. Change all callers.
11897 * object.h (Object::get_view): Add aligned parameter. Change all
11898 callers.
11899 (Object::get_lasting_view): Likewise.
11900
11901 * fileread.cc (File_read::release): Don't call clear_views if
11902 there are multiple objects.
11903 * fileread.h (File_read::clear_uncached_views): New function.
11904 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11905 on the archive.
11906
a1207466
CC
119072008-03-31 Cary Coutant <ccoutant@google.com>
11908
11909 Add thin archive support.
11910 * archive.cc (Archive::armagt): New const.
11911 (Archive::setup): Remove task parameter and calls to unlock.
11912 (Archive::unlock_nested_archives): New function.
11913 (Archive::read_header): Add nested_off parameter. Change
11914 all callers.
11915 (Archive::interpret_header): Likewise.
11916 (Archive::include_all_members): Change to handle thin
11917 archives.
11918 (Archive::include_member): Likewise.
11919 * archive.h (Archive::Archive): Add new parameters and
11920 initializers.
11921 (Archive::armagt): New const.
11922 (Archive::setup): Remove task parameter.
11923 (Archive::unlock_nested_archives): New function.
11924 (Archive::read_header): Add nested_off parameter.
11925 (Archive::interpret_header): Likewise.
11926 (Archive::Nested_archive_table): New typedef.
11927 (Archive::is_thin_archive_): New field.
11928 (Archive::nested_archives_): New field.
11929 (Archive::options_): New field.
11930 (Archive::dirpath_): New field.
11931 (Archive::task_): New field.
11932 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11933 for thin archives. Pass additional parameters to
11934 Archive::Archive. Unlock the archive file after calling
11935 Archive::setup.
cd536b21 11936
479f6503
ILT
119372008-03-29 Ian Lance Taylor <iant@google.com>
11938
686c8caf
ILT
11939 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11940 version symbol to be local.
11941 * testsuite/ver_test_4.sh: New file.
11942 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11943 (check_DATA): Add ver_test_4.syms.
11944 (ver_test_4.syms): New target.
11945 * testsuite/Makefile.in: Rebuild.
11946
ab794b6b
ILT
11947 * output.cc
11948 (Output_section::Input_section_sort_entry::has_priority): New
11949 function.
11950 (Output_section::Input_section_sort_entry::match_file_name): New
11951 function.
11952 (Output_section::Input_section_sort_entry::match_section_name):
11953 Remove.
11954 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11955 Remove.
11956 (Output_section::Input_section_sort_entry::match_section_file):
11957 Remove.
11958 (Output_section::Input_section_sort_compare::operator()): Rewrite
11959 using new Input_section_sort_entry functions. Sort crtbegin and
11960 crtend first. Sort sections with no priority before sections with
11961 a priority.
11962 * testsuite/initpri1.c (d3): Check j != 4.
11963 (cd5): New constructor/destructor function.
11964 (main): Check j != 2.
11965
479f6503
ILT
11966 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11967 new symbol when resolving, don't call set_is_default.
11968 * testsuite/ver_test_7.cc: New file.
11969 * testsuite/ver_test_7.sh: New file.
11970 * testsuite/Makefile.am (ver_test_7.so): New target.
11971 (ver_test_7.o): New target.
11972 (check_SCRIPTS): Add ver_test_7.sh.
11973 (check_DATA): Add ver_test_7.syms.
11974 (ver_test_7.syms): New target.
11975
2fd32231
ILT
119762008-03-28 Ian Lance Taylor <iant@google.com>
11977
11978 * layout.cc (Layout::layout): If we see an input section with a
11979 name that needs sorting, set the must_sort flag for the output
11980 section.
11981 (Layout::make_output_section): If the name of the output section
11982 indicates that it might require sorting, set the may_sort flag.
11983 * output.h (Output_section::may_sort_attached_input_sections): New
11984 function.
11985 (Output_section::set_may_sort_attached_input_sections): New
11986 function.
11987 (Output_section::must_sort_attached_input_sections): New
11988 function.
11989 (Output_section::set_must_sort_attached_input_sections): New
11990 function.
11991 (class Output_section): Declare Input_section_sort_entry. Define
11992 Input_section_sort_compare. Declare
11993 sort_attached_input_sections. Add new fields:
11994 may_sort_attached_input_sections_,
11995 must_sort_attached_input_sections_,
11996 attached_input_sections_are_sorted_.
11997 * output.cc (Output_section::Output_section): Initialize new
11998 fields.
11999 (Output_section::add_input_section): Add an entry to
12000 input_sections_ if may_sort or must_sort are true.
12001 (Output_section::set_final_data_size): Call
12002 sort_attached_input_sections if necessary.
12003 (Output_section::Input_section_sort_entry): Define new class.
12004 (Output_section::Input_section_sort_compare::operator()): New
12005 function.
12006 (Output_section::sort_attached_input_sections): New function.
12007 * configure.ac: Check whether the compiler supports constructor
12008 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
12009 * testsuite/initpri1.c: New file.
12010 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12011 CONSTRUCTOR_PRIORITY.
12012 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12013 (initpri1_LDFLAGS): New variable.
12014 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12015
18e6b24e
ILT
120162008-03-27 Ian Lance Taylor <iant@google.com>
12017
49bdd526
ILT
12018 * common.cc (Sort_commons::operator): Correct sorting algorithm.
12019 * testsuite/common_test_1.c: New file.
12020 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12021 (common_test_1_SOURCES): New variable.
12022 (common_test_1_DEPENDENCIES): New variable.
12023 (common_test_1_LDFLAGS): New variable.
12024
18e6b24e
ILT
12025 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12026 and commons_ correctly when NAME/VERSION does not override
12027 NAME/NULL.
12028 * testsuite/ver_test_6.c: New file.
12029 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12030 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12031 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12032
04bf7072
ILT
120332008-03-26 Ian Lance Taylor <iant@google.com>
12034
5871526f
ILT
12035 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12036 of an undefined symbol from a version script.
12037 * testsuite/Makefile.am (ver_test_5.so): New target.
12038 (ver_test_5.o): New target.
12039 (check_SCRIPTS): Add ver_test_5.sh.
12040 (check_DATA): Add ver_test_5.syms.
12041 (ver_test_5.syms): New target.
12042 * testsuite/ver_test_5.cc: New file.
12043 * testsuite/ver_test_5.script: New file.
12044 * testsuite/ver_test_5.sh: New file.
12045 * Makefile.in, testsuite/Makefile.in: Rebuild.
12046
04bf7072
ILT
12047 PR gold/5986
12048 Fix problems building gold with gcc 4.3.0.
12049 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12050 (gold_error_at_location, gold_warning_at_location): Use it.
12051 * configure.ac: Check whether we can compile and use a template
12052 function with a printf attribute.
12053 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12054 when jumping over bytes.
12055 * object.cc: Instantiate Object::read_section_data.
12056 * debug.h: Include <cstring>
12057 * dwarf_reader.cc: Include <algorithm>
12058 * main.cc: Include <cstring>.
12059 * options.cc: Include <cstring>.
12060 * output.cc: Include <cstring>.
12061 * script.cc: Include <cstring>.
12062 * script.h: Include <string>.
12063 * symtab.cc: Include <cstring> and <algorithm>.
12064 * target-select.cc: Include <cstring>.
12065 * version.cc: Include <string>.
12066 * testsuite/testmain.cc: Include <cstdlib>.
12067 * configure, config.in: Rebuild.
12068
874c5b28
ILT
120692008-03-25 Ian Lance Taylor <iant@google.com>
12070
819d6c3a
ILT
12071 * options.cc: Include "../bfd/bfdver.h".
12072 (options::help): Print bug reporting address.
12073
f4b2c6f5
ILT
12074 * version.cc (print_version): Adjust output for current value of
12075 BFD_VERSION_STRING.
12076
12077 * NEWS: New file.
12078
e96caa79
ILT
12079 * options.cc (options::help): Print list of supported targets.
12080 * target-select.h: Include <vector>.
12081 (class Target_selector): Make machine_, size_, and is_big_endian_
12082 fields const. Add bfd_name_ and instantiated_target_ fields.
12083 (Target_selector::Target_selector): Add bfd_name parameter.
12084 (Target_selector::recognize): Make non-virtual, call
12085 do_recognize.
12086 (Target_selector::recognize_by_name): Make non-virtual, call
12087 do_recognize_by_name.
12088 (Target_selector::supported_names): New function.
12089 (Target_selector::bfd_name): New function.
12090 (Target_selector::do_instantiate_target): New pure virtual
12091 function.
12092 (Target_selector::do_recognize): New virtual function.
12093 (Target_selector::do_recognize_by_name): New virtual function.
12094 (Target_selector::instantiate_target): New private function.
12095 (supported_target_names): Declare.
12096 * target-select.cc (Target_selector::Target_selector): Update for
12097 new parameter and fields.
12098 (select_target_by_name): Check that the name matches before
12099 calling recognize_by_name.
12100 (supported_target_names): New function.
12101 * i386.cc (class Target_selector_i386): Update Target_selector
12102 constructor call. Remove recognize and recognize_by_name. Add
12103 do_instantiate_target.
12104 * x86_64.cc (class Target_selector_x86_64): Likewise.
12105 * testsuite/testfile.cc (class Target_selector_test): Update for
12106 changes to Target_selector.
12107
874c5b28
ILT
12108 * README: Rewrite, with some notes on unsupported features.
12109
0a65a3a7
CC
121102008-03-24 Cary Coutant <ccoutant@google.com>
12111
12112 * i386.cc (Target_i386::Got_type): New enum declaration.
12113 (Target_i386::Scan::local): Updated callers of Output_data_got
12114 member functions.
12115 (Target_i386::Scan::global): Likewise.
12116 (Target_i386::Relocate::relocate): Likewise.
12117 (Target_i386::Relocate::relocate_tls): Likewise.
12118 * object.h (Got_offset_list): New class.
12119 (Sized_relobj::local_has_got_offset): Added got_type parameter.
12120 (Sized_relobj::local_got_offset): Likewise.
12121 (Sized_relobj::set_local_got_offset): Likewise.
12122 (Sized_relobj::local_has_tls_got_offset): Removed.
12123 (Sized_relobj::local_tls_got_offset): Removed.
12124 (Sized_relobj::set_local_tls_got_offset): Removed.
12125 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
12126 * output.cc (Output_data_got::add_global): Added got_type parameter.
12127 (Output_data_got::add_global_with_rel): Likewise.
12128 (Output_data_got::add_global_with_rela): Likewise.
12129 (Output_data_got::add_global_pair_with_rel): New function.
12130 (Output_data_got::add_global_pair_with_rela): New function.
12131 (Output_data_got::add_local): Added got_type parameter.
12132 (Output_data_got::add_local_with_rel): Likewise.
12133 (Output_data_got::add_local_with_rela): Likewise.
12134 (Output_data_got::add_local_pair_with_rel): New function.
12135 (Output_data_got::add_local_pair_with_rela): New function.
12136 (Output_data_got::add_global_tls): Removed.
12137 (Output_data_got::add_global_tls_with_rel): Removed.
12138 (Output_data_got::add_global_tls_with_rela): Removed.
12139 (Output_data_got::add_local_tls): Removed.
12140 (Output_data_got::add_local_tls_with_rel): Removed.
12141 (Output_data_got::add_local_tls_with_rela): Removed.
12142 * output.h (Output_data_got::add_global): Added got_type parameter.
12143 (Output_data_got::add_global_with_rel): Likewise.
12144 (Output_data_got::add_global_with_rela): Likewise.
12145 (Output_data_got::add_global_pair_with_rel): New function.
12146 (Output_data_got::add_global_pair_with_rela): New function.
12147 (Output_data_got::add_local): Added got_type parameter.
12148 (Output_data_got::add_local_with_rel): Likewise.
12149 (Output_data_got::add_local_with_rela): Likewise.
12150 (Output_data_got::add_local_pair_with_rel): New function.
12151 (Output_data_got::add_local_pair_with_rela): New function.
12152 (Output_data_got::add_global_tls): Removed.
12153 (Output_data_got::add_global_tls_with_rel): Removed.
12154 (Output_data_got::add_global_tls_with_rela): Removed.
12155 (Output_data_got::add_local_tls): Removed.
12156 (Output_data_got::add_local_tls_with_rel): Removed.
12157 (Output_data_got::add_local_tls_with_rela): Removed.
12158 * resolve.cc (Symbol::override_base_with_special): Removed
12159 reference to has_got_offset_ field.
12160 * symtab.cc (Symbol::init_fields): Replaced initialization
12161 of got_offset_ with got_offsets_. Removed initialization
12162 of has_got_offset_
53fcba31 12163 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
12164 (Symbol::got_offset): Likewise.
12165 (Symbol::set_got_offset): Likewise.
12166 (Symbol::has_tls_got_offset): Removed.
12167 (Symbol::tls_got_offset): Removed.
12168 (Symbol::set_tls_got_offset): Removed.
12169 (Symbol::got_offset_): Removed.
12170 (Symbol::tls_mod_got_offset_): Removed.
12171 (Symbol::tls_pair_got_offset_): Removed.
12172 (Symbol::got_offsets_): New field.
12173 (Symbol::has_got_offset): Removed.
12174 (Symbol::has_tls_mod_got_offset): Removed.
12175 (Symbol::has_tls_pair_got_offset): Removed.
12176 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
12177 (Target_x86_64::Scan::local): Updated callers of Output_data_got
12178 member functions.
12179 (Target_x86_64::Scan::global): Likewise.
12180 (Target_x86_64::Relocate::relocate): Likewise.
12181 (Target_x86_64::Relocate::relocate_tls): Likewise.
12182
bd52eafb
BE
121832008-03-25 Ben Elliston <bje@au.ibm.com>
12184
12185 * yyscript.y: Fix spelling error in comment.
12186
8b105e34
ILT
121872008-03-24 Ian Lance Taylor <iant@google.com>
12188
8ed814a9
ILT
12189 * options.h (class General_options): Define build_id option.
12190 * layout.h (class Layout): Declare write_build_id, create_note,
12191 create_build_id. Add build_id_note_ member.
12192 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
12193 "libiberty.h", "md5.h", "sha1.h".
12194 (Layout::Layout): Initialize eh_frame_data_,
12195 eh_frame_hdr_section_, and build_id_note_.
12196 (Layout::finalize): Call create_build_id.
12197 (Layout::create_note): New function, broken out of
12198 Layout::create_gold_note.
12199 (Layout::create_gold_note): Call create_note.
12200 (Layout::create_build_id): New function.
12201 (Layout::write_build_id): New function.
12202 (Close_task_runner::run): Call write_build_id.
12203
8b105e34
ILT
12204 * x86_64.cc: Correct license to GPLv3.
12205
086a1841
ILT
122062008-03-23 Ian Lance Taylor <iant@google.com>
12207
12208 * options.cc: Include "demangle.h".
12209 (parse_optional_string): New function.
12210 (parse_long_option): Handle takes_optional_argument.
12211 (parse_short_option): Update dash_z initializer. Handle
12212 takes_optional_argument.
12213 (General_options::General_options): Initialize do_demangle_.
12214 (General_options::finalize): Set do_demangle_. Handle demangling
12215 style.
12216 * options.h (parse_optional_string): Declare.
12217 (struct One_option): Add optional_arg field. Update constructor.
12218 Update call constructor calls. Add takes_optional_argument
12219 function.
12220 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12221 (DEFINE_optional_string): Define.
12222 (General_options::demangle): Change from DEFINE_bool to
12223 DEFINE_optional_string.
12224 (General_options::no_demangle): New function.
12225 (General_options::do_demangle): New function.
12226 (General_options::set_do_demangle): New function.
12227 (General_options::execstack_status_): Move definition to end of
12228 class definition.
12229 (General_options::static_): Likewise.
12230 (General_options::do_demangle_): New field.
12231 * object.cc (big_endian>::get_symbol_location_info): Call
12232 Options::do_demangle, not Options::demangle.
12233 * symtab.cc (demangle): Likewise.
12234
cbb93e63
ILT
122352008-03-22 Ian Lance Taylor <iant@google.com>
12236
12237 * gold.h: Include <cstddef> and <sys/types.h>
12238 * options.h: Include <cstring>.
12239
ec531623
ILT
122402008-03-21 Ian Lance Taylor <iant@google.com>
12241
12242 * Added source code to GNU binutils.
This page took 0.778611 seconds and 4 git commands to generate.