* python/py-auto-load.c (source_section_scripts): Fix file
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
aa06ae28
CC
12011-09-18 Cary Coutant <ccoutant@google.com>
2
3 * incremental.cc (can_incremental_update): New function.
4 * incremental.h (can_incremental_update): New function.
5 * layout.cc (Layout::init_fixed_output_section): Call it.
6 (Layout::make_output_section): Don't allow patch space in .eh_frame.
7 * object.cc (Sized_relobj_file::do_layout): Call
8 can_incremental_update.
9
ebb300b2
CC
102011-09-13 Cary Coutant <ccoutant@google.com>
11
12 * configure.ac: Check for glibc support for gnu_indirect_function
13 support with static linking, setting automake conditional
14 IFUNC_STATIC.
15 * Makefile.in: Regenerate.
16 * configure: Regenerate.
17
18 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
19 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
20 for IFUNC_STATIC.
21 * testsuite/Makefile.in: Regenerate.
22
1206d0d5
CC
232011-09-13 Cary Coutant <ccoutant@google.com>
24
25 * incremental.cc (Sized_relobj_incr::do_layout): Call
26 report_comdat_group for kept comdat sections.
27 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
28 * testsuite/Makefile.in: Regenerate.
29 * testsuite/incr_comdat_test_1.cc: New source file.
30 * testsuite/incr_comdat_test_2_v1.cc: New source file.
31 * testsuite/incr_comdat_test_2_v2.cc: New source file.
32 * testsuite/incr_comdat_test_2_v3.cc: New source file.
33
40b29874
ILT
342011-09-13 Ian Lance Taylor <iant@google.com>
35
36 * object.cc (Sized_relobj_file::do_layout): Remove unused local
37 variable external_symbols_offset.
38
1b045aac
ILT
392011-09-12 Ian Lance Taylor <iant@google.com>
40
41 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
42 triggered if object has no symbols.
43
24c6c55a
DM
442011-09-09 David S. Miller <davem@davemloft.net>
45
46 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
47 (Output_fill_debug_line::do_write): Likewise.
48
66570254
CC
492011-08-29 Cary Coutant <ccoutant@google.com>
50
51 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
52 casts to match formatting specs.
53 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
54
8ea8cd50
CC
552011-08-26 Cary Coutant <ccoutant@google.com>
56
57 * layout.cc (Free_list::allocate): Provide guarantee of minimum
58 remaining hole size when allocating.
59 (Layout::make_output_section): Set fill methods for debug sections.
60 * layout.h (Free_list::Free_list_node): Move from private to
61 public.
62 (Free_list::set_min_hole_size): New function.
63 (Free_list::begin, Free_list::end): New functions.
64 (Free_list::min_hole_): New data member.
65 * output.cc: Include dwarf.h.
66 (Output_fill_debug_info::do_minimum_hole_size): New function.
67 (Output_fill_debug_info::do_write): New function.
68 (Output_fill_debug_line::do_minimum_hole_size): New function.
69 (Output_fill_debug_line::do_write): New function.
70 (Output_section::Output_section): Initialize new data member.
71 (Output_section::set_final_data_size): Ensure patch space is larger
72 than minimum hole size.
73 (Output_section::do_write): Fill holes in debug sections.
74 * output.h (Output_fill): New class.
75 (Output_fill_debug_info): New class.
76 (Output_fill_debug_line): New class.
77 (Output_section::set_free_space_fill): New function.
78 (Output_section::free_space_fill_): New data member.
79 * testsuite/Makefile.am (incremental_test_3): Add
80 --incremental-patch option.
81 (incremental_test_4): Likewise.
82 (incremental_test_5): Likewise.
83 (incremental_test_6): Likewise.
84 (incremental_copy_test): Likewise.
85 (incremental_common_test_1): Likewise.
86 * testsuite/Makefile.in: Regenerate.
87
7cf80422
NC
882011-08-26 Nick Clifton <nickc@redhat.com>
89
90 * po/es.po: Updated Spanish translation.
91
c3f7b0e5
CC
922011-08-01 Cary Coutant <ccoutant@google.com>
93
94 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
95 * gold/testsuite/Makefile.in: Regenerate.
96 * gold/testsuite/justsyms_exec.c: New source file.
97 * gold/testsuite/justsyms_lib.c: New source file.
98
9590bf25
CC
992011-08-01 Cary Coutant <ccoutant@google.com>
100
101 * layout.cc (Layout::set_segment_offsets): Don't realign text
102 segment if -Ttext was specified.
103 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
104 file type.
105 * object.h (Sized_relobj_file::e_type): New function.
106 (Sized_relobj_file::e_type_): New data member.
107 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
108 base address for ET_EXEC files.
109 * target.cc (Target::do_make_elf_object_implementation): Allow
110 ET_EXEC files with --just-symbols option.
111
dcd8d12e
CC
1122011-07-28 Cary Coutant <ccoutant@google.com>
113
114 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
115 Add thread_number parameter.
116 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
117 * workqueue-threads.cc
118 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
119 current thread if its thread number is greater than desired thread
120 count.
121 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
122 Add thread_number parameter.
123 (Workqueue::should_cancel_thread): Likewise.
124 (Workqueue::find_runnable_or_wait): Pass thread_number to
125 should_cancel_thread.
126 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
127 parameter.
128
804eb480
ST
1292011-07-22 Sriraman Tallam <tmsriram@google.com>
130
131 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
132 only after checking if it cannot be forced local.
133 * symtab.h (is_externally_visible): Check if the symbol is not forced
134 local.
135
f1ddb600
ILT
1362011-07-15 Ian Lance Taylor <iant@google.com>
137
138 * options.h (class General_options): Add --print-output-format.
139 Move -EL next to -EB, for better --help output.
140 * target-select.cc: Include <cstdio>, "options.h", and
141 "parameters.h".
142 (Target_selector::do_target_bfd_name): New function.
143 (print_output_format): New function.
144 * target-select.h (class Target_selector): Update declarations.
145 (Target_selector::target_bfd_name): New function.
146 (print_output_format): Declare.
147 * main.cc: Include "target-select.h".
148 (main): Handle --print-output-format.
149 * gold.cc: Include "target-select.h".
150 (queue_initial_tasks): Handle --print-output-format when there are
151 no input files.
152 * parameters.cc (parameters_force_valid_target): Give a better
153 error message if -EB/-EL does not match target.
154 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
155 function.
156
7d172687
ILT
1572011-07-15 Ian Lance Taylor <iant@google.com>
158
159 * i386.cc (class Output_data_plt_i386): Add layout_ field.
160 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
161 (Output_data_plt_i386::do_write): Write address of .dynamic
162 section to first entry in .got.plt section.
163 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
164 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
165 Initialize layout_.
166 (Output_data_plt_x86_64::do_write): Write address of .dynamic
167 section to first entry in .got.plt section.
168 * layout.h (Layout::dynamic_section): New function.
169
e9552f7e
ST
1702011-07-13 Sriraman Tallam <tmsriram@google.com>
171
172 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
173 to claim_file call.
174 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
175 input_section_position_, and input_section_glob_.
176 (read_layout_from_file): Call function section_ordering_specified.
177 * layout.h (is_section_ordering_specified): New function.
178 (section_ordering_specified): New function.
179 (section_ordering_specified_): New boolean member.
180 * main.cc(main): Call load_plugins after layout object is defined.
181 * output.cc (Output_section::add_input_section): Use
182 function section_ordering_specified to check if section ordering is
183 needed.
184 * output.cc (Output_section::add_relaxed_input_section): Use
185 function section_ordering_specified to check if section ordering is
186 needed.
187 (Output_section::update_section_layout): New function.
188 (Output_section::sort_attached_input_sections): Check if input section
189 must be reordered.
190 * output.h (Output_section::update_section_layout): New function.
191 * plugin.cc (get_section_count): New function.
192 (get_section_type): New function.
193 (get_section_name): New function.
194 (get_section_contents): New function.
195 (update_section_order): New function.
196 (allow_section_ordering): New function.
197 (Plugin::load): Add the new interfaces to the transfer vector.
198 (Plugin_manager::load_plugins): New parameter.
199 (Plugin_manager::all_symbols_read): New parameter.
200 (Plugin_manager::claim_file): New parameter. Save the elf object for
201 unclaimed objects.
202 (Plugin_manager::get_elf_object): New function.
203 (Plugin_manager::get_view): Change to directly use the bool to check
204 if get_view is called from claim_file_hook.
205 * plugin.h (input_objects): New function
206 (Plugin__manager::load_plugins): New parameter.
207 (Plugin_manager::claim_file): New parameter.
208 (Plugin_manager::get_elf_object): New function.
209 (Plugin_manager::in_claim_file_handler): New function.
210 (Plugin_manager::in_claim_file_handler_): New member.
211 (layout): New function.
212 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
213 handler with an extra parameter. Make the elf object before calling
214 claim_file handler.
215 * testsuite/plugin_test.c (get_section_count): New function pointer.
216 (get_section_type): New function pointer.
217 (get_section_name): New function pointer.
218 (get_section_contents): New function pointer.
219 (update_section_order): New function pointer.
220 (allow_section_ordering): New function pointer.
221 (onload): Check if the new interfaces exist.
222
9446efde
ILT
2232011-07-13 Ian Lance Taylor <iant@google.com>
224
225 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
226 relro section.
227 * x86_64.cc (Target_x86_64::got_section): Likewise.
228 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
229 (relro_now_test_SOURCES): New variable.
230 (relro_now_test_DEPENDENCIES): New variable.
231 (relro_now_test_LDFLAGS): New variable.
232 (relro_now_test_LDADD): New variable.
233 (relro_now_test.so): New target.
234 * testsuite/Makefile.in: Rebuild.
235
07aa62f2
ILT
2362011-07-12 Ian Lance Taylor <iant@google.com>
237
238 PR gold/12980
239 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
240 GLOB_DAT relocation rather than a RELATIVE relocation for a
241 protected symbol when creating a shared library.
242 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
243 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
244 * testsuite/protected_main_1.cc (main): Test that protected
245 function has same address.
246
e2153196
ILT
2472011-07-11 Ian Lance Taylor <iant@google.com>
248
249 PR gold/12979
250 * options.h (class General_options): Add -Bgroup.
251 * options.cc (General_options::finalize): If -Bgroup is set,
252 default to --unresolved-symbols=report-all.
253 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
254 * target-reloc.h (issue_undefined_symbol_error): Handle
255 --unresolved-symbols=report-all.
256
6daf5215
ILT
2572011-07-08 Ian Lance Taylor <iant@google.com>
258
259 PR gold/11985
260 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
261 if linker script discards key sections.
262 (Layout::create_dynamic_symtab): Likewise.
263 (Layout::assign_local_dynsym_offsets): Likewise.
264 (Layout::sized_create_version_sections): Likewise.
265 (Layout::create_interp): Likewise.
266 (Layout::finish_dynamic_section): Likewise.
267 (Layout::set_dynamic_symbol_size): Likewise.
268
beabb2c6
ILT
2692011-07-08 Ian Lance Taylor <iant@google.com>
270
271 PR gold/12386
272 * options.h (class General_options): Add --unresolved-symbols.
273 * target-reloc.h (issue_undefined_symbol_error): Check
274 --unresolved-symbols. Add comments.
275
9c16daf1
ILT
2762011-07-08 Ian Lance Taylor <iant@google.com>
277
278 * testsuite/odr_violation2.cc (Ordering::operator()): Make
279 expression more complex.
280
191f1a2d
ILT
2812011-07-08 Ian Lance Taylor <iant@google.com>
282
283 PR gold/11317
284 * target-reloc.h (issue_undefined_symbol_error): New inline
285 function, broken out of relocate_section.
286 (relocate_section): Call issue_undefined_symbol_error.
287 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
288 there is no TLS segment if we are about to issue an undefined
289 symbol error.
290 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
291
62855347
ILT
2922011-07-08 Ian Lance Taylor <iant@google.com>
293
294 PR gold/12279
295 * resolve.cc (Symbol_table::should_override): Add fromtype
296 parameter. Change all callers. Give error when linking together
297 TLS and non-TLS symbol.
298 (Symbol_table::should_override_with_special): Add fromtype
299 parameter. Change all callers.
300 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
301 there is no TLS segment if we have reported some errors.
302 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
303
67181c72
ILT
3042011-07-08 Ian Lance Taylor <iant@google.com>
305
306 PR gold/12372
307 * target.h (Target::plt_address_for_global): New function.
308 (Target::plt_address_for_local): New function.
309 (Target::plt_section_for_global): Remove.
310 (Target::plt_section_for_local): Remove.
311 (Target::do_plt_address_for_global): New virtual function.
312 (Target::do_plt_address_for_local): New virtual function.
313 (Target::do_plt_section_for_global): Remove.
314 (Target::do_plt_section_for_local): Remove.
315 (Target::register_global_plt_entry): Add Symbol_table and Layout
316 parameters.
317 * output.cc (Output_data_got::Got_entry::write): Use
318 plt_address_for_global and plt_address_for_local.
319 * layout.cc (Layout::add_target_dynamic_tags): Use size and
320 address of output section.
321 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
322 got_irelative_, and irelative_count_ fields. Update
323 declarations.
324 (Output_data_plt_i386::has_irelative_section): New function.
325 (Output_data_plt_i386::entry_count): Add irelative_count_.
326 (Output_data_plt_i386::set_final_data_size): Likewise.
327 (class Target_i386): Add got_irelative_ and rel_irelative_
328 fields. Update declarations.
329 (Target_i386::Target_i386): Initialize new fields.
330 (Target_i386::do_plt_address_for_global): New function replacing
331 do_plt_section_for_global.
332 (Target_i386::do_plt_address_for_local): New function replacing
333 do_plt_section_for_local.
334 (Target_i386::got_section): Create got_irelative_.
335 (Target_i386::rel_irelative_section): New function.
336 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
337 fields. Don't define __rel_iplt_{start,end}.
338 (Output_data_plt_i386::add_entry): Add symtab and layout
339 parameters. Change all callers. Use different PLT and GOT for
340 IFUNC symbols.
341 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
342 layout parameters. Change all callers. Use different PLT and
343 GOT.
344 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
345 (Output_data_plt_i386::rel_irelative): New function.
346 (Output_data_plt_i386::address_for_global): New function.
347 (Output_data_plt_i386::address_for_local): New function.
348 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
349 IRELATIVE GOT when changing IFUNC GOT entries.
350 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
351 reloc.
352 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
353 if we didn't create an IRELATIVE GOT.
354 (Target_i386::Relocate::relocate): Use plt_address_for_global and
355 plt_address_for_local.
356 (Target_i386::do_dynsym_value): Use plt_address_for_global.
357 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
358 got_irelative_, and irelative_count_ fields. Update
359 declarations.
360 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
361 Initialize new fields. Remove symtab parameter. Change all
362 callers.
363 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
364 irelative_count_.
365 (Output_data_plt_x86_64::has_irelative_section): New function.
366 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
367 (class Target_x86_64): Add got_irelative_ and rel_irelative_
368 fields. Update declarations.
369 (Target_x86_64::Target_x86_64): Initialize new fields.
370 (Target_x86_64::do_plt_address_for_global): New function replacing
371 do_plt_section_for_global.
372 (Target_x86_64::do_plt_address_for_local): New function replacing
373 do_plt_section_for_local.
374 (Target_x86_64::got_section): Create got_irelative_.
375 (Target_x86_64::rela_irelative_section): New function.
376 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
377 all callers. Don't create __rel_iplt_{start,end}.
378 (Output_data_plt_x86_64::add_entry): Add symtab and layout
379 parameters. Change all callers. Use different PLT and GOT for
380 IFUNC symbols.
381 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
382 layout parameters. Change all callers. Use different PLT and
383 GOT.
384 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
385 parameters. Change all callers. Use different PLT and GOT for
386 IFUNC symbols.
387 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
388 (Output_data_plt_x86_64::rela_irelative): New function.
389 (Output_data_plt_x86_64::address_for_global): New function.
390 (Output_data_plt_x86_64::address_for_local): New function.
391 (Output_data_plt_x86_64::set_final_data_size): Likewise.
392 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
393 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
394 (Target_x86_64::register_global_plt_entry): Add symtab and layout
395 parameters.
396 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
397 reloc.
398 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
399 symbols if we didn't create an IRELATIVE GOT.
400 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
401 plt_address_for_local.
402 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
403 * testsuite/ifuncvar1.c: New test file.
404 * testsuite/ifuncvar2.c: New test file.
405 * testsuite/ifuncvar3.c: New test file.
406 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
407 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
408 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
409 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
410 * testsuite/Makefile.in: Rebuild.
411
33c15b45
CC
4122011-07-07 Cary Coutant <ccoutant@google.com>
413
414 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
415 (two_file_test_1_ndebug.o): Likewise.
416 (two_file_test_1b_ndebug.o): Likewise.
417 (two_file_test_2_ndebug.o): Likewise.
418 (two_file_test_main_ndebug.o): Likewise.
419 (incremental_test_2): Link with no-debug versions.
420
f48b5fb7
CC
4212011-07-06 Cary Coutant <ccoutant@google.com>
422
423 * gold/incremental.cc
424 (Output_section_incremental_inputs::write_info_blocks): Check for
425 hidden and internal symbols.
426
221597a5
CC
4272011-07-06 Cary Coutant <ccoutant@google.com>
428
429 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
430 Check disposition for startup file.
431 (Incremental_inputs::report_command_line): Ignore
432 --incremental-startup-unchanged option.
433 * options.cc (General_options::parse_incremental_startup_unchanged):
434 New function.
435 (General_options::General_options): Initialize new data member.
436 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
437 (General_options): Add --incremental-startup-unchanged option.
438 (General_options::incremental_startup_disposition): New function.
439 (General_options::incremental_startup_disposition_): New data member.
440
e24719f6
CC
4412011-07-06 Cary Coutant <ccoutant@google.com>
442
443 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
444 input file index to Script_info ctor.
445 (Sized_incremental_binary::do_file_has_changed): Find the
446 command-line argument for files named in scripts.
447 * incremental.h (Script_info::Script_info): New ctor
448 with input file index.
449 (Script_info::input_file_index): New function.
450 (Script_info::input_file_index_): New data member.
451 (Incremental_binary::get_library): Add const.
452 (Incremental_binary::get_script_info): Add const.
453 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
454 * testsuite/Makefile.am (incremental_test_5): New test case.
455 (incremental_test_6): New test case.
456 * testsuite/Makefile.in: Regenerate.
457
8f7c81e8
CC
4582011-07-06 Cary Coutant <ccoutant@google.com>
459
460 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
461 debug output when command lines differ.
462
9fbd3822
CC
4632011-07-06 Cary Coutant <ccoutant@google.com>
464
465 * incremental.cc (Incremental_inputs::report_command_line): Ignore
466 --incremental-patch option.
467 * layout.cc (Free_list::allocate): Extend allocation beyond original
468 end if enabled.
469 (Layout::make_output_section): Mark sections that should get
470 patch space.
471 * options.cc (parse_percent): New function.
472 * options.h (parse_percent): New function.
473 (DEFINE_percent): New macro.
474 (General_options): Add --incremental-patch option.
475 * output.cc (Output_section::Output_section): Initialize new data
476 members.
477 (Output_section::add_input_section): Print section name when out
478 of patch space.
479 (Output_section::add_output_section_data): Likewise.
480 (Output_section::set_final_data_size): Add patch space when
481 doing --incremental-full.
482 (Output_section::do_reset_address_and_file_offset): Remove patch
483 space.
484 (Output_segment::set_section_list_addresses): Print debug output
485 only if --incremental-update.
486 * output.h (Output_section::set_is_patch_space_allowed): New function.
487 (Output_section::is_patch_space_allowed_): New data member.
488 (Output_section::patch_space_): New data member.
489 * parameters.cc (Parameters::incremental_full): New function.
490 * parameters.h (Parameters::incremental_full): New function
491 * testsuite/Makefile.am (incremental_test_2): Add test for
492 --incremental-patch option.
493 * testsuite/Makefile.in: Regenerate.
494 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
495 (t18): Remove function body.
496
f6cccc2c
DK
4972011-07-05 Doug Kwan <dougkwan@google.com>
498
499 PR gold/12771
500 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
501 Arm_Address type for relocation result.
502 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
503 overflow check.
504 (Arm_relocate_functions::abs32): Use unaligned access.
505 (Arm_relocate_functions::rel32): Ditto.
506 (Arm_relocate_functions::prel31): Ditto.
507 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
508 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
509 static data relocations.
510 * testsuite/Makefile.in: Regnerate.
511 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
512
28a13fec
ILT
5132011-07-05 Ian Lance Taylor <iant@google.com>
514
515 PR gold/12392
516 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
517 symbols if necessary.
518 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
519
24d47b34
ILT
5202011-07-05 Ian Lance Taylor <iant@google.com>
521
522 PR gold/12952
523 * resolve.cc (Symbol::override_base_with_special): Simply override
524 version with special symbol version, ignoring previous version.
525
41f9cbbe
ILT
5262011-07-05 Ian Lance Taylor <iant@google.com>
527
528 * object.cc (Sized_relobj_file::include_section_group): Add
529 information to comment about signature location.
530
886288f1
ILT
5312011-07-02 Ian Lance Taylor <iant@google.com>
532
533 PR gold/12957
534 * options.h (class General_options): Add -f and -F.
535 * options.cc (General_options::finalize): Fatal error if -f/-F
536 are used without -shared.
537 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
538
ae3a6d4f
ILT
5392011-07-02 Ian Lance Taylor <iant@google.com>
540
541 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
542
21131061
ILT
5432011-07-01 Ian Lance Taylor <iant@google.com>
544
545 PR gold/12525
546 PR gold/12952
547 * resolve.cc (Symbol::override_base_with_special): Don't override
548 the version if the overriding symbol has a different name.
549 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
550 all callers. If we give an error about an undefined version,
551 define the base version if necessary.
552 * dynobj.h (class Versions): Update declaration.
553 * testsuite/weak_alias_test_5.cc: New file.
554 * testsuite/weak_alias_test.script: New file.
555 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
556 and versioned_alias have the right value, and call t2.
557 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
558 weak_alias_test_5.so.
559 (weak_alias_test_LDADD): Likewise.
560 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
561 * testsuite/Makefile.in: Rebuild.
562
611062c0
ILT
5632011-07-01 Ian Lance Taylor <iant@google.com>
564
565 PR gold/12525
566 * options.h (class General_options): Support -z notext.
567 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
568 -Wl,-z,notext.
569 (two_file_shared_nonpic.so): Likewise.
570 (two_file_shared_mixed.so): Likewise.
571 (two_file_shared_mixed_1.so): Likewise.
572 (weak_undef_lib_nonpic.so): Likewise.
573 (alt/weak_undef_lib_nonpic.so): Likewise.
574 (tls_test_shared_nonpic.so): Likewise.
575 * testsuite/Makefile.in: Rebuild.
576
328c7c2f
ILT
5772011-07-01 Ian Lance Taylor <iant@google.com>
578
579 PR gold/12525
580 * configure.ac: Test whether static linking works, setting
581 the automake conditional HAVE_STATIC.
582 * testsuite/Makefile.am: Disable tests using -static if
583 HAVE_STATIC is not true.
584 * configure, testsuite/Makefile.in: Rebuild.
585
02d7cd44
ILT
5862011-07-01 Ian Lance Taylor <iant@google.com>
587
588 PR gold/12525
589 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
590 Assert if we see DW_EH_PE_indirect.
591 * target.h (Target::ehframe_datarel_base): New function.
592 (Target::do_ehframe_datarel_base): New target function.
593 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
594 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
595 function.
596
07a60597
ILT
5972011-07-01 Ian Lance Taylor <iant@google.com>
598
599 PR gold/12571
600 * options.h (class General_options): Add
601 --ld-generated-unwind-info.
602 * ehframe.cc (Fde::write): Add address parameter. Change all
603 callers. If associated with PLT, fill in address and size.
604 (Cie::set_output_offset): Only add merge mapping if there is an
605 object.
606 (Cie::write): Add address parameter. Change all callers.
607 (Eh_frame::add_ehframe_for_plt): New function.
608 * ehframe.h (class Fde): Update declarations. Move shndx_ and
609 input_offset_ fields into union u_, with new plt field.
610 (Fde::Fde): Adjust for new union field.
611 (Fde::Fde) [Output_data version]: New constructor.
612 (Fde::add_mapping): Only add merge mapping if there is an object.
613 (class Cie): Update declarations.
614 (class Eh_frame): Declare add_ehframe_for_plt.
615 * layout.cc (Layout::layout_eh_frame): Break out code into
616 make_eh_frame_section, and call it.
617 (Layout::make_eh_frame_section): New function.
618 (Layout::add_eh_frame_for_plt): New function.
619 * layout.h (class Layout): Update declarations.
620 * merge.cc (Merge_map::add_mapping): Add assertion.
621 * i386.cc: Include "dwarf.h".
622 (class Output_data_plt_i386): Make first_plt_entry,
623 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
624 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
625 and plt_eh_frame_fde.
626 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
627 boundary. Call add_eh_frame_for_plt if appropriate.
628 * x86_64.cc: Include "dwarf.h".
629 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
630 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
631 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
632 and plt_eh_frame_fde.
633 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
634 appropriate.
635
14788a3f
ILT
6362011-06-29 Ian Lance Taylor <iant@google.com>
637
638 PR gold/12629
639 * object.cc (Sized_relobj_file::layout_section): Change shdr
640 parameter to be const.
641 (Sized_relobj_file::layout_eh_frame_section): New function, broken
642 out of do_layout.
643 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
644 appropriate. Call layout_eh_frame_section.
645 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
646 sections.
647 * object.h (class Sized_relobj_file): Update declarations.
648
6c21fce1
ILT
6492011-06-29 Ian Lance Taylor <iant@google.com>
650
37e41b03 651 PR gold/12652
6c21fce1
ILT
652 * script.cc (Token::integer_value): Accept trailing M/m/K/k
653 modifier.
654 (Lex::gather_token): Accept trailing M/m/K/k for integers.
655
4d5e4e62
ILT
6562011-06-29 Ian Lance Taylor <iant@google.com>
657
658 PR gold/12675
659 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
660 SHT_X86_64_UNWIND.
661 * layout.cc (Layout::layout_eh_frame): Likewise.
662
886f533a
ILT
6632011-06-29 Ian Lance Taylor <iant@google.com>
664
665 PR gold/12695
666 * layout.cc (Layout::symtab_section_shndx): New function.
667 * layout.h (class Layout): Declare symtab_section_shndx.
668 * output.cc (Output_section::write_header): Call it.
669
f3ae1b28
ILT
6702011-06-29 Ian Lance Taylor <iant@google.com>
671
672 PR gold/12818
673 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
674 symbols which are not used in a relocation.
675
aecf301f
ILT
6762011-06-28 Ian Lance Taylor <iant@google.com>
677
678 PR gold/12898
679 * layout.cc (Layout::segment_precedes): Don't crash if a linker
680 script create indistinguishable segments.
681 (Layout::set_segment_offsets): Use stable_sort when sorting
682 segments. Pass this to Compare_segments constructor.
683 * layout.h (class Layout): Make segment_precedes non-static.
684 (class Compare_segments): Change from struct to class. Add
685 layout_ field. Add constructor.
686 * script-sections.cc
687 (Script_sections::attach_sections_using_phdrs_clause): Rename
688 local orphan to is_orphan. Don't report failure to put empty
689 section in segment. On attachment failure, report name of
690 section, and attach to first PT_LOAD segment.
691
03ef7571
ILT
6922011-06-28 Ian Lance Taylor <iant@google.com>
693
694 PR gold/12934
695 * target-select.cc (Target_selector::Target_selector): Add
696 emulation parameter. Change all callers.
697 (select_target_by_bfd_name): Rename from select_target_by_name.
698 Change all callers.
699 (select_target_by_emulation): New function.
700 (supported_emulation_names): New function.
701 * target-select.h (class Target_selector): Add emulation_ field.
702 Update declarations.
703 (Target_selector::recognize_by_bfd_name): Rename from
704 recognize_by_name. Change all callers.
705 (Target_selector::supported_bfd_names): Rename from
706 supported_names. Change all callers.
707 (Target_selector::recognize_by_emulation): New function.
708 (Target_selector::supported_emulations): New function.
709 (Target_selector::emulation): New function.
710 (Target_selector::do_recognize_by_bfd_name): Rename from
711 do_recognize_by_name. Change all callers.
712 (Target_selector::do_supported_bfd_names): Rename from
713 do_supported_names. Change all callers.
714 (Target_selector::do_recognize_by_emulation): New function.
715 (Target_selector::do_supported_emulations): New function.
716 (select_target_by_bfd_name): Change name in declaration.
717 (select_target_by_emulation): Declare.
718 (supported_emulation_names): Declare.
719 * parameters.cc (parameters_force_valid_target): Try to find
720 target based on emulation from -m option.
721 * options.h (class General_options): Change doc string for -m.
722 * options.cc (help): Print emulations.
723 (General_options::parse_V): Likewise.
724 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
725 Add emulation parameter. Change all callers.
726
200b2bb9
ILT
7272011-06-28 Ian Lance Taylor <iant@google.com>
728
729 * target.h (class Target): Add osabi_ field.
730 (Target::osabi): New function.
731 (Target::set_osabi): New function.
732 (Target::Target): Initialize osabi_.
733 (Target::do_adjust_elf_header): Make pure virtual.
734 (Sized_target::do_adjust_elf_header): Declare.
735 * target.cc (Sized_target::do_adjust_elf_header): New function.
736 (class Sized_target): Instantiate all versions.
737 * freebsd.h (class Target_freebsd): Remove.
738 (Target_selector_freebsd::do_recognize): Call set_osabi on
739 Target.
740 (Target_selector_freebsd::do_recognize_by_name): Likewise.
741 (Target_selector_freebsd::set_osabi): Remove.
742 * i386.cc (class Target_i386): Inherit from Sized_target rather
743 than Target_freebsd.
744 * x86_64.cc (class Target_x86_64): Likewise.
745
b3ce541e
ILT
7462011-06-28 Ian Lance Taylor <iant@google.com>
747
748 * target.h (Target::can_check_for_function_pointers): Rewrite.
749 Make non-virtual.
750 (Target::can_icf_inline_merge_sections): Likewise.
751 (Target::section_may_have_icf_unsafe_poineters): Likewise.
752 (Target::Target_info): Add can_icf_inline_merge_sections field.
753 (Target::do_can_check_for_function_pointers): New virtual
754 function.
755 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
756 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
757 from can_check_for_function_pointers, move in file.
758 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
759 section_may_have_icf_unsafe_poineters, move in file.
760 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
761 * i386.cc (Target_i386::do_can_check_for_function_pointers):
762 Rename from can_check_for_function_pointers, move in file.
763 (Target_i386::can_icf_inline_merge_sections): Remove.
764 (Target_i386::i386_info): Initialize
765 can_icf_inline_merge_sections.
766 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
767 Initialize can_icf_inline_merge_sections.
768 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
769 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
770 Rename from can_check_for_function_pointers, move in file.
771 (Target_x86_64::can_icf_inline_merge_sections): Remove.
772 (Target_x86_64::x86_64_info): Initialize
773 can_icf_inline_merge_sections.
774 * testsuite/testfile.cc (Target_test::test_target_info):
775 Likewise.
776 * icf.cc (get_section_contents): Correct formatting.
777
6d1c4efb
ILT
7782011-06-27 Ian Lance Taylor <iant@google.com>
779
780 * symtab.cc (Symbol::versioned_name): New function.
781 (Symbol_table::add_to_final_symtab): Use versioned_name when
782 appropriate.
783 (Symbol_table::sized_write_symbol): Likewise.
784 * symtab.h (class Symbol): Declare versioned_name.
785 * stringpool.h (class Stringpool_template): Add variant of add
786 which takes a std::basic_string.
787 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
788 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
789 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
790 (ver_test_12.o): New target.
791 * testsuite/Makefile.in: Rebuild.
792
57eb9b50
DK
7932011-06-27 Doug Kwan <dougkwan@google.com>
794
795 * arm.cc (Arm_relocate_functions::thm_jump8,
796 Arm_relocate_functions::thm_jump11): Use a wider signed
797 type to compute offset.
798 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
799 arm_thm_jump8.
800 * testsuite/Makefile.in: Regenerate.
801 * testsuite/arm_branch_in_range.sh: Check test results of
802 arm_thm_jump11 and arm_thm_jump8.
803 * testsuite/arm_thm_jump11.s: New test source file.
804 * testsuite/arm_thm_jump11.t: New linker script.
805 * testsuite/arm_thm_jump8.s: New test source file.
806 * testsuite/arm_thm_jump8.t: New linker script.
807
487b39df
ILT
8082011-06-24 Ian Lance Taylor <iant@google.com>
809
810 * layout.cc: Include "object.h".
811 (ctors_sections_in_init_array): New static variable.
812 (Layout::is_ctors_in_init_array): New function.
813 (Layout::layout): Add entry to ctors_sections_in_init_array if
814 appropriate.
815 * layout.h (class Layout): Declare is_ctors_in_init_array.
816 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
817 is_ctors_reverse_view is set.
818 (Sized_relobj_file::write_sections): Add layout parameter. Change
819 all callers. Set is_ctors_reverse_view field of View_size.
820 (Sized_relobj_file::reverse_words): New function.
821 * object.h (Sized_relobj_file::View_size): Add
822 is_ctors_reverse_view field.
823 (class Sized_relobj_file): Update declarations.
824 * testsuite/initpri3.c: New test.
825 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
826 initpri3b.
827 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
828 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
829 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
830 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
831 * testsuite/Makefile.in: Rebuild.
832
472076e4
CC
8332011-06-24 Cary Coutant <ccoutant@google.com>
834
835 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
836 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
837 (debug_msg_cdebug.err): New targets.
838 * testsuite/Makefile.in: Regenerate.
839 * testsuite/debug_msg.sh: Check output of link with compressed debug.
840 Fix checks for link with shared library.
841
a60af0db
DK
8422011-06-24 Doug Kwan <dougkwan@google.com>
843
844 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
845 skip empty text sections.
846 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
847
5393d741
ILT
8482011-06-22 Ian Lance Taylor <iant@google.com>
849
850 PR gold/12910
851 * options.h (class General_options): Add --ctors-in-init-array.
852 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
853 friends as SHT_PROGBITS for merging sections.
854 (Layout::layout): Remove special handling of .init_array and
855 friends. Don't sort if doing relocatable link. Sort for .ctors
856 and .dtors if ctors_in_init_array.
857 (Layout::make_output_section): Force correct section types for
858 .init_array and friends. Don't sort if doing relocatable link,
859 Don't sort .ctors and .dtors if ctors_in_init_array.
860 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
861 (Layout::output_section_name): Add relobj parameter. Change all
862 callers. Handle .ctors. and .dtors. in code rather than table.
863 Handle .ctors and .dtors if ctors_in_init_array.
864 (Layout::match_file_name): New function, moved from output.cc.
865 * layout.h (class Layout): Update declarations.
866 * output.cc: Include "layout.h".
867 (Input_section_sort_entry::get_priority): New function.
868 (Input_section_sort_entry::match_file_name): Just call
869 Layout::match_file_name.
870 (Output_section::Input_section_sort_init_fini_compare::operator()):
871 Handle .ctors and .dtors. Sort by explicit priority rather than
872 by name.
873 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
874 * testsuite/initpri2.c: New test.
875 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
876 (check_PROGRAMS): Add initpri2.
877 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
878 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
879 * configure, testsuite/Makefile.in: Rebuild.
880
e1f74f98
ILT
8812011-06-19 Ian Lance Taylor <iant@google.com>
882
883 PR gold/12880
884 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
885 .interp section to a PT_INTERP segment even if we have seen a
886 --dynamic-linker option. Don't do it if we have seen a PHDRS
887 clause in a linker script.
888 (Layout::finalize): Don't create a .interp section if we've
889 already create a PT_INTERP segment.
890 (Layout::create_interp): Always call choose_output_section (revert
891 patch of 2011-06-17). Don't create PT_INTERP segment.
892 * script-sections.cc
893 (Script_sections::create_note_and_tls_segments): Add a .interp
894 section to a PT_INTERP segment even if we have seen a
895 --dynamic-linker option.
896
766f91bb
ILT
8972011-06-18 Ian Lance Taylor <iant@google.com>
898
899 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
900 merely because a non-PT_LOAD segment has a dynamic reloc.
901
0d212c3a
ILT
9022011-06-18 Ian Lance Taylor <iant@google.com>
903
904 * layout.cc (Layout::finish_dynamic_section): Don't create
905 DT_FLAGS entry if not needed.
906
911a5072
ILT
9072011-06-18 Ian Lance Taylor <iant@google.com>
908
909 PR gold/12745
910 * layout.cc (Layout::layout_eh_frame): Correct handling of
911 writable .eh_frame section.
912
534b4e5f
ILT
9132011-06-17 Ian Lance Taylor <iant@google.com>
914
915 PR gold/12893
916 * resolve.cc (Symbol_table::resolve): Don't give an error if a
917 symbol is redefined with the exact same object and value.
918
10b4f102
ILT
9192011-06-17 Ian Lance Taylor <iant@google.com>
920
921 PR gold/12880
922 * layout.h (class Layout): Add interp_segment_ field.
923 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
924 (Layout::attach_allocated_section_to_segment): If making shared
925 library, put .interp section in PT_INTERP segment.
926 (Layout::finalize): Also call create_interp if -dynamic-linker
927 option was used.
928 (Layout::create_interp): Assert that there is no PT_INTERP
929 segment. If not using a SECTIONS clause, use make_output_section.
930 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
931 * script-sections.cc
932 (Script_sections::create_note_and_tls_segments): If making shared
933 library, put .interp section in PT_INTERP segment.
934
a29b0dad
ILT
9352011-06-17 Ian Lance Taylor <iant@google.com>
936
e588ea8d
ILT
937 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
938 when making a shared library.
939
9402011-06-17 Ian Lance Taylor <iant@google.com>
941
942 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
943 parameter. Change all callers. Don't issue warning about PC32
944 against locally defined symbol.
a29b0dad 945
9d3b0698
ILT
9462011-06-16 Ian Lance Taylor <iant@google.com>
947
948 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
949 occurs in same object.
950
85b0f90c
AM
9512011-06-14 Alan Modra <amodra@gmail.com>
952
953 * po/POTFILES.in: Regenerate.
954
a94907d9
ILT
9552011-06-09 Ian Lance Taylor <iant@google.com>
956
957 * script-sections.cc
958 (Orphan_output_section::set_section_addresses): For a relocatable
959 link set address to 0.
960
4fb3a1c3
CC
9612011-06-09 Cary Coutant <ccoutant@google.com>
962
963 PR gold/12804
964 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
965 used with --compress-debug-sections.
966 * gold/object.cc (Sized_relobj_file::do_layout): Report
967 uncompressed size of compressed input sections.
968
61220854
CC
9692011-06-08 Cary Coutant <ccoutant@google.com>
970
971 PR gold/12804
972 * testsuite/two_file_test_2_v1.cc: Change initialization of
973 v2 to keep it in .data.
974
e6455dfb
CC
9752011-06-07 Cary Coutant <ccoutant@google.com>
976
977 * common.cc (Symbol_table::do_allocate_commons_list): Call
978 gold_fallback.
979 * errors.cc (Errors::fatal): Adjust call to gold_exit.
980 (Errors::fallback): New function.
981 (gold_fallback): New function.
982 * errors.h (Errors::fallback): New function.
983 * gold.cc (gold_exit): Change status parameter to enum; adjust
984 all callers.
985 (queue_initial_tasks): Call gold_fallback.
986 * gold.h: Include cstdlib.
987 (Exit_status): New enum type.
988 (gold_exit): Change status parameter to enum.
989 (gold_fallback): New function.
990 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
991 (Layout::create_symtab_sections): Likewise.
992 (Layout::create_shdrs): Likewise.
993 * main.cc (main): Adjust call to gold_exit.
994 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
995 (Output_data_got::add_got_entry_pair): Likewise.
996 (Output_section::add_input_section): Likewise.
997 (Output_section::add_output_section_data): Likewise.
998 (Output_segment::set_section_list_addresses): Likewise.
999 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
1000
fb0e076f
CC
10012011-06-07 Cary Coutant <ccoutant@google.com>
1002
1003 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
1004 for incremental links.
1005 * output.cc (Output_segment::set_section_list_addresses): Remove
1006 FIXME and test for TLS or BSS.
1007
a5ee4d5d
CC
10082011-06-07 Cary Coutant <ccoutant@google.com>
1009
1010 * testsuite/Makefile.am: Add incremental_copy_test,
1011 incremental_common_test_1.
1012 * testsuite/Makefile.in: Regenerate.
1013 * testsuite/common_test_1_v1.c: New source file.
1014 * testsuite/common_test_1_v2.c: New source file.
1015 * testsuite/copy_test_v1.cc: New source file.
1016
5146f448
CC
10172011-06-07 Cary Coutant <ccoutant@google.com>
1018
1019 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
1020 update, allocate common from bss section's free list.
1021 * incremental-dump.cc (dump_incremental_inputs): Print flag for
1022 linker-defined symbols.
1023 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1024 Skip GOT and PLT entries that are no longer referenced.
1025 (Output_section_incremental_inputs::write_info_blocks): Mark
1026 linker-defined symbols.
1027 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
1028 * output.cc (Output_section::allocate): New function.
1029 * output.h (Output_section::allocate): New function.
1030 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
1031 linker-defined symbols.
1032 (Symbol::override_base_with_special): Copy is_predefined_ flag.
1033 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
1034 (Symbol::init_base_output_data): Likewise.
1035 (Symbol::init_base_output_segment): Likewise.
1036 (Symbol::init_base_constant): Likewise.
1037 (Sized_symbol::init_output_data): Likewise.
1038 (Sized_symbol::init_output_segment): Likewise.
1039 (Sized_symbol::init_constant): Likewise.
1040 (Symbol_table::do_define_in_output_data): Likewise.
1041 (Symbol_table::do_define_in_output_segment): Likewise.
1042 (Symbol_table::do_define_as_constant): Likewise.
1043 * symtab.h (Symbol::is_predefined): New function.
1044 (Symbol::init_base_output_data): Add is_predefined parameter.
1045 (Symbol::init_base_output_segment): Likewise.
1046 (Symbol::init_base_constant): Likewise.
1047 (Symbol::is_predefined_): New data member.
1048 (Sized_symbol::init_output_data): Add is_predefined parameter.
1049 (Sized_symbol::init_output_segment): Likewise.
1050 (Sized_symbol::init_constant): Likewise.
1051 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
1052
26d3c67d
CC
10532011-06-07 Cary Coutant <ccoutant@google.com>
1054
1055 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
1056 instead of emit_copy_reloc.
1057 (Copy_relocs::emit_copy_reloc): Refactor.
1058 (Copy_relocs::make_copy_reloc): New function.
1059 (Copy_relocs::add_copy_reloc): Remove.
1060 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
1061 section.
1062 (Copy_relocs::make_copy_reloc): New function.
1063 (Copy_relocs::add_copy_reloc): Remove.
1064 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
1065 unchanged input files.
1066 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
1067 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
1068 Reserve BSS space for COPY relocations.
1069 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1070 (Output_section_incremental_inputs::write_info_blocks): Record
1071 whether a symbol is copied from a shared object.
1072 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
1073 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
1074 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
1075 (Incremental_input_entry_reader::get_output_symbol_index): Add
1076 is_copy parameter.
1077 (Incremental_binary::emit_copy_relocs): New function.
1078 (Incremental_binary::do_emit_copy_relocs): New function.
1079 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1080 new data member.
1081 (Sized_incremental_binary::add_copy_reloc): New function.
1082 (Sized_incremental_binary::do_emit_copy_relocs): New function.
1083 (Sized_incremental_binary::Copy_reloc): New struct.
1084 (Sized_incremental_binary::Copy_relocs): New typedef.
1085 (Sized_incremental_binary::copy_relocs_): New data member.
1086 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
1087 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
1088 * target.h (Sized_target::emit_copy_reloc): New function.
1089 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
1090
7cdb37d9
CC
10912011-06-02 Cary Coutant <ccoutant@google.com>
1092
1093 PR gold/12163
1094 * gold/archive.cc (Archive::Archive): Initialize new data member.
1095 (Archive::include_all_members): Return if archive has already been
1096 included.
1097 * gold/archive.h (Archive::include_all_members_): New data member.
1098
cc643b88
NC
10992011-06-02 Nick Clifton <nickc@redhat.com>
1100
1101 * dynobj.h: Fix spelling mistake in comment.
1102 * output.cc: Likewise.
1103
f62a3ca7
DK
11042011-05-31 Doug Kwan <dougkwan@google.com>
1105 Asier Llano
1106
1107 PR gold/12826
cc643b88 1108 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
1109 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
1110 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
1111 redundant arm_exidx_test.so.
1112 * testsuite/Makefile.in: Regenerate.
1113 (check_SCRIPTS): Add pr12826.sh
1114 (check_DATA): Add pr12826.stdout
1115 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
1116 * testsuite/pr12826.sh: New file.
1117 * testsuite/pr12826_1.s: Ditto.
1118 * testsuite/pr12826_1.s: Ditto.
1119
8dbe1edc
ILT
11202011-05-30 Ian Lance Taylor <iant@google.com>
1121
1122 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
1123 sections.
1124
c49875be
ILT
11252011-05-29 Ian Lance Taylor <iant@google.com>
1126
1127 PR gold/12804
1128 * testsuite/Makefile.am: Use different file name for two_file_test
1129 temporary file for each incremental test.
1130 * testsuite/Makefile.in: Rebuild.
1131
69d53f7a
ILT
11322011-05-29 Ian Lance Taylor <iant@google.com>
1133
1134 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
1135 binary input file is empty.
1136
41d0ab5f
ILT
11372011-05-27 Ian Lance Taylor <iant@google.com>
1138
1139 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
1140 (ver_test_9.so): Likewise.
1141 * testsuite/Makefile.in: Rebuild.
1142
89d8a36b
CC
11432011-05-26 Cary Coutant <ccoutant@google.com>
1144
1145 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
1146 * incremental.cc (Incremental_inputs::report_input_section): Fix
1147 comment, indentation.
1148 (Incremental_inputs::report_comdat_group): New function.
1149 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1150 of data for incremental input file entry.
1151 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
1152 group count, COMDAT group signatures.
1153 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
1154 an unchanged input file.
1155 * incremental.h (Incremental_object_entry::Incremental_object_entry):
1156 Initialize new data member.
1157 (Incremental_object_entry::add_comdat_group): New function.
1158 (Incremental_object_entry::get_comdat_group_count): New function.
1159 (Incremental_object_entry::get_comdat_signature_key): New function.
1160 (Incremental_object_entry::groups_): New data member.
1161 (Incremental_inputs::report_comdat_group): New function.
1162 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
1163 data for incremental input file entry.
1164 (Incremental_input_entry_reader::get_comdat_group_count): New function.
1165 (Incremental_input_entry_reader::get_input_section): Adjust size of
1166 data for incremental input file entry.
1167 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
1168 (Incremental_input_entry_reader::get_comdat_group_signature): New
1169 function.
1170 * object.cc (Sized_relobj::include_section_group): Report kept
1171 COMDAT groups for incremental links.
1172
1706a06f
ILT
11732011-05-24 David Meyer <pdox@google.com>
1174
1175 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
1176 with name parameter. Add found_name parameter.
1177 * fileread.cc (Input_file::find_file): Adjust code accordingly.
1178 * dirsearch.h (class Dirsearch): Update declaration.
1179
a10ae760
ILT
11802011-05-24 Ian Lance Taylor <iant@google.com>
1181
1182 * archive.cc (Library_base::should_include_member): Pull in object
1183 from archive if it defines the entry symbol.
1184 * parameters.cc (Parameters::entry): New function.
1185 * parameters.h (class Parameters): Declare entry.
1186 * output.h (class Output_file_header): Remove entry_ field.
1187 * output.cc (Output_file_header::Output_file_header): Remove entry
1188 parameter. Change all callers.
1189 (Output_file_header::entry): Use parameters->entry.
1190 * gold.cc (queue_middle_tasks): Likewise.
1191 * plugin.cc (Plugin_hook::run): Likewise.
1192
aa92d6ed
CC
11932011-05-24 Cary Coutant <ccoutant@google.com>
1194
1195 * gold.cc (queue_initial_tasks): Pass incremental base filename
1196 to Output_file::open_base_file; don't print error message.
1197 * incremental-dump.cc (main): Adjust call to
1198 Output_file::open_for_modification.
1199 * incremental-dump.cc (main): Likewise.
1200 * incremental.cc (Incremental_inputs::report_command_line):
1201 Ignore --incremental-base option when comparing command lines.
1202 Ignore parameter when given as separate argument.
1203 * options.h (class General_options): Add --incremental-base.
1204 * output.cc (Output_file::Output_file):
1205 (Output_file::open_base_file): Add base_name and writable parameters;
1206 read base file into new file; print error message here.
1207 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1208 callers.
1209 * output.h (Output_file::open_for_modification): Rename to...
1210 (Output_file::open_base_file): ...this; add base_name and
1211 writable parameters; adjust all callers.
1212 (Output_file::map_no_anonymous): Add writable parameter; adjust all
1213 callers.
1214 * testsuite/Makefile.am (incremental_test_4): Test
1215 --incremental-base.
1216 * testsuite/Makefile.in: Regenerate.
1217
2eedd706
CC
12182011-05-24 Cary Coutant <ccoutant@google.com>
1219
1220 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
1221 incremental_test_4.
1222 * testsuite/Makefile.in: Regenerate.
1223 * testsuite/two_file_test_1_v1.cc: New test source file.
1224 * testsuite/two_file_test_1b_v1.cc: New test source file.
1225 * testsuite/two_file_test_2_v1.cc: New test source file.
1226
0f1c85a6
CC
12272011-05-24 Cary Coutant <ccoutant@google.com>
1228
1229 * dynobj.h (Dynobj::do_dynobj): New function.
1230 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
1231 flag and soname for shared objects.
1232 * incremental.cc (Incremental_inputs::report_object): Make
1233 either Incremental_object_entry or Incremental_dynobj_entry; add
1234 soname to string table.
1235 (Incremental_inputs::report_input_section): Add assertion.
1236 (Output_section_incremental_inputs::set_final_data_size): Adjust
1237 type of input file entry for shared libraries; adjust size of
1238 shared library info entry.
1239 (Output_section_incremental_inputs::write_input_files): Write
1240 as_needed flag for shared libraries.
1241 (Output_section_incremental_inputs::write_info_blocks): Adjust type
1242 of input file entry for shared libraries; write soname.
1243 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
1244 soname from incremental info.
1245 * incremental.h (enum Incremental_input_flags): Add
1246 INCREMENTAL_INPUT_AS_NEEDED.
1247 (Incremental_input_entry::Incremental_input_entry): Initialize new
1248 data member.
1249 (Incremental_input_entry::set_as_needed): New function.
1250 (Incremental_input_entry::as_needed): New function.
1251 (Incremental_input_entry::do_dynobj_entry): New function.
1252 (Incremental_input_entry::as_needed_): New data member.
1253 (Incremental_object_entry::Incremental_object_entry): Don't check
1254 for shared library.
1255 (Incremental_object_entry::do_type): Likewise.
1256 (class Incremental_dynobj_entry): New class.
1257 (Incremental_input_entry_reader::as_needed): New function.
1258 (Incremental_input_entry_reader::get_soname): New function.
1259 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
1260 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
1261 size of shared library info entry.
1262 * layout.cc (Layout::finish_dynamic_section): Don't test for
1263 incremental link when adding DT_NEEDED entries.
1264 * object.h (Object::Object): Initialize new data member.
1265 (Object::dynobj): New function.
1266 (Object::set_as_needed): New function.
1267 (Object::as_needed): New function.
1268 (Object::do_dynobj): New function.
1269 (Object::as_needed_): New data member.
1270
6fa2a40b
CC
12712011-05-24 Cary Coutant <ccoutant@google.com>
1272
1273 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1274 info; adjust display of GOT entries.
1275 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1276 vector of input objects; remove file_status_.
1277 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1278 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1279 got_plt reader; call target hooks to reserve GOT entries.
1280 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1281 of input file info header and GOT info entry.
1282 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1283 relocation info.
1284 (Got_plt_view_info::got_descriptor): Remove.
1285 (Got_plt_view_info::sym_index): New data member.
1286 (Got_plt_view_info::input_index): New data member.
1287 (Local_got_offset_visitor::visit): Write input file index.
1288 (Global_got_offset_visitor::visit): Write 0 for input file index.
1289 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1290 with sym_index and input_index.
1291 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1292 incremental info GOT entry; replace got_descriptor with input_index.
1293 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1294 map from input file index to object.
1295 (Sized_relobj_incr::do_layout): Replace direct data member reference
1296 with accessor function.
1297 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1298 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1299 Adjust size of input file info header.
1300 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1301 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1302 (Incremental_input_entry_reader::get_input_section): Adjust size of
1303 input file info header.
1304 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1305 of incremental info GOT entry.
1306 (Incremental_got_plt_reader::get_got_desc): Remove.
1307 (Incremental_got_plt_reader::get_got_symndx): New function.
1308 (Incremental_got_plt_reader::get_got_input_index): New function.
1309 (Sized_incremental_binary::Sized_incremental_binary): Remove
1310 file_status_; add input_objects_.
1311 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1312 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1313 (Sized_incremental_binary::file_is_unchanged): Remove.
1314 (Sized_incremental_binary::set_input_object): New function.
1315 (Sized_incremental_binary::input_object): New function.
1316 (Sized_incremental_binary::file_status_): Remove.
1317 (Sized_incremental_binary::input_objects_): New data member.
1318 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1319 references.
1320 (Sized_relobj_incr::invalid_address): Move to base class.
1321 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1322 class.
1323 (Sized_relobj_incr::do_output_section_offset): Likewise.
1324 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1325 (Sized_relobj_incr::section_offsets_): Likewise.
1326 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1327 function.
1328 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1329 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1330 with accessor function.
1331 (Sized_relobj_file::do_layout): Likewise.
1332 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1333 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1334 (Sized_relobj_file::compute_final_local_value): Replace refs to
1335 section_offsets_ with accessor function.
1336 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1337 * object.h (Relobj::Relobj): Initialize new data members.
1338 (Relobj::add_dyn_reloc): New function.
1339 (Relobj::first_dyn_reloc): New function.
1340 (Relobj::dyn_reloc_count): New function.
1341 (Relobj::first_dyn_reloc_): New data member.
1342 (Relobj::dyn_reloc_count_): New data member.
1343 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1344 references.
1345 (Sized_relobj::Address): New typedef.
1346 (Sized_relobj::invalid_address): Move here from child class.
1347 (Sized_relobj::Sized_relobj): Initialize new data members.
1348 (Sized_relobj::sized_relobj): New function.
1349 (Sized_relobj::is_output_section_offset_invalid): Move here from
1350 child class.
1351 (Sized_relobj::get_output_section_offset): Likewise.
1352 (Sized_relobj::local_has_got_offset): Likewise.
1353 (Sized_relobj::local_got_offset): Likewise.
1354 (Sized_relobj::set_local_got_offset): Likewise.
1355 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1356 (Sized_relobj::clear_got_offsets): New function.
1357 (Sized_relobj::section_offsets): Move here from child class.
1358 (Sized_relobj::do_output_section_offset): Likewise.
1359 (Sized_relobj::do_set_section_offset): Likewise.
1360 (Sized_relobj::Local_got_offsets): Likewise.
1361 (Sized_relobj::local_got_offsets_): Likewise.
1362 (Sized_relobj::section_offsets_): Likewise.
1363 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1364 references.
1365 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1366 class.
1367 (Sized_relobj_file::sized_relobj): New function
1368 (Sized_relobj_file::local_has_got_offset): Move to base class.
1369 (Sized_relobj_file::local_got_offset): Likewise.
1370 (Sized_relobj_file::set_local_got_offset): Likewise.
1371 (Sized_relobj_file::get_output_section_offset): Likewise.
1372 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1373 (Sized_relobj_file::do_output_section_offset): Likewise.
1374 (Sized_relobj_file::do_set_section_offset): Likewise.
1375 (Sized_relobj_file::Local_got_offsets): Likewise.
1376 (Sized_relobj_file::local_got_offsets_): Likewise.
1377 (Sized_relobj_file::section_offsets_): Likewise.
1378 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1379 (all constructors).
1380 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1381 (Output_reloc::get_symbol_index): Likewise.
1382 (Output_reloc::local_section_offset): Likewise.
1383 (Output_reloc::get_address): Likewise.
1384 (Output_reloc::symbol_value): Likewise.
1385 (Output_data_got::reserve_slot): Move to class definition.
1386 (Output_data_got::reserve_local): New function.
1387 (Output_data_got::reserve_slot_for_global): Remove.
1388 (Output_data_got::reserve_global): New function.
1389 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1390 (all constructors, two instantiations).
1391 (Output_reloc::get_relobj): New function (two instantiations).
1392 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1393 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1394 (Output_data_reloc::add_global): Adjust type of relobj.
1395 (Output_data_reloc::add_global_relative): Likewise.
1396 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1397 (Output_data_reloc::add_local): Likewise.
1398 (Output_data_reloc::add_local_relative): Likewise.
1399 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1400 (Output_data_reloc::add_local_section): Likewise.
1401 (Output_data_reloc::add_output_section): Likewise.
1402 (Output_data_reloc::add_absolute): Likewise.
1403 (Output_data_reloc::add_target_specific): Likewise.
1404 (Output_data_got::reserve_slot): Move definition here.
1405 (Output_data_got::reserve_local): New function.
1406 (Output_data_got::reserve_global): New function.
1407 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1408 section_offsets_ with accessor function.
1409 (Sized_relobj_file::write_sections): Likewise.
1410 (Sized_relobj_file::do_relocate_sections): Likewise.
1411 * target.h (Sized_target::reserve_local_got_entry): New function.
1412 (Sized_target::reserve_global_got_entry): New function.
1413 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1414 (Target_x86_64::reserve_global_got_entry): New function.
1415 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1416
4829d394
CC
14172011-05-23 Cary Coutant <ccoutant@google.com>
1418
1419 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1420 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1421 bit when checking got_type.
1422 * incremental.cc (Sized_incremental_binary::setup_readers):
1423 Store symbol table and string table locations; initialize bit vector
1424 of file status flags.
1425 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1426 unchanged files.
1427 (Sized_incremental_binary::do_process_got_plt): New function.
1428 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1429 (Output_section_incremental_inputs::set_final_data_size): Record
1430 file index for each input file.
1431 (Output_section_incremental_inputs::write_got_plt): Store file index
1432 instead of input entry offset for each GOT entry.
1433 * incremental.h
1434 (Incremental_input_entry::Incremental_input_entry): Initialize new
1435 data member.
1436 (Incremental_input_entry::set_offset): Store file index.
1437 (Incremental_input_entry::get_file_index): New function.
1438 (Incremental_input_entry::file_index_): New data member.
1439 (Incremental_binary::process_got_plt): New function.
1440 (Incremental_binary::do_process_got_plt): New function.
1441 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1442 data members.
1443 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1444 (Sized_incremental_binary::set_file_is_unchanged): New function.
1445 (Sized_incremental_binary::file_is_unchanged): New function.
1446 (Sized_incremental_binary::do_process_got_plt): New function.
1447 (Sized_incremental_binary::file_status_): New data member.
1448 (Sized_incremental_binary::main_symtab_loc_): New data member.
1449 (Sized_incremental_binary::main_strtab_loc_): New data member.
1450 * output.cc (Output_data_got::Got_entry::write): Add case
1451 RESERVED_CODE.
1452 (Output_data_got::add_global): Call add_got_entry.
1453 (Output_data_got::add_global_plt): Likewise.
1454 (Output_data_got::add_global_with_rel): Likewise.
1455 (Output_data_got::add_global_with_rela): Likewise.
1456 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1457 (Output_data_got::add_global_pair_with_rela): Likewise.
1458 (Output_data_got::add_local): Call add_got_entry.
1459 (Output_data_got::add_local_plt): Likewise.
1460 (Output_data_got::add_local_with_rel): Likewise.
1461 (Output_data_got::add_local_with_rela): Likewise.
1462 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1463 (Output_data_got::add_local_pair_with_rela): Likewise.
1464 (Output_data_got::reserve_slot): New function.
1465 (Output_data_got::reserve_slot_for_global): New function.
1466 (Output_data_got::add_got_entry): New function.
1467 (Output_data_got::add_got_entry_pair): New function.
1468 (Output_section::add_output_section_data): Edit FIXME.
1469 * output.h
1470 (Output_section_data_build::Output_section_data_build): New
1471 constructor with size parameter.
1472 (Output_data_space::Output_data_space): Likewise.
1473 (Output_data_got::Output_data_got): Initialize new data member; new
1474 constructor with size parameter.
1475 (Output_data_got::add_constant): Call add_got_entry.
1476 (Output_data_got::reserve_slot): New function.
1477 (Output_data_got::reserve_slot_for_global): New function.
1478 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1479 (Output_data_got::add_got_entry): New function.
1480 (Output_data_got::add_got_entry_pair): New function.
1481 (Output_data_got::free_list_): New data member.
1482 * target.h (Sized_target::init_got_plt_for_update): New function.
1483 (Sized_target::register_global_plt_entry): New function.
1484 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1485 Initialize new data member; call init; add constructor with PLT count.
1486 (Output_data_plt_x86_64::init): New function.
1487 (Output_data_plt_x86_64::add_relocation): New function.
1488 (Output_data_plt_x86_64::reserve_slot): New function.
1489 (Output_data_plt_x86_64::free_list_): New data member.
1490 (Target_x86_64::init_got_plt_for_update): New function.
1491 (Target_x86_64::register_global_plt_entry): New function.
1492 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1493 incremental updates.
1494 (Output_data_plt_x86_64::add_relocation): New function.
1495 * testsuite/object_unittest.cc (Object_test): Set default options.
1496
ec69d6da
ILT
14972011-05-16 Ian Lance Taylor <iant@google.com>
1498
1499 * options.h (class General_options): Make -i a synonym for -r.
1500
732e31de
ILT
15012011-05-16 Ian Lance Taylor <iant@google.com>
1502
1503 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1504
403676b5
CC
15052011-05-10 Cary Coutant <ccoutant@google.com>
1506
1507 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1508 strip_all (-s).
1509
5b7b7d6e
ILT
15102011-05-06 Ian Lance Taylor <iant@google.com>
1511
1512 * layout.cc (Layout::layout): If the output section flags change,
1513 update the ordering.
1514
f0f9babf
CC
15152011-04-25 Cary Coutant <ccoutant@google.com>
1516
1517 * incremental-dump.cc (dump_incremental_inputs): Print local
1518 symbol info for each input file.
1519 * incremental.cc
1520 (Output_section_incremental_inputs::set_final_data_size): Add local
1521 symbol info to input file entries in incremental info.
1522 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1523 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1524 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1525 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1526 implementation.
1527 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1528 (Sized_incr_relobj::do_relocate): Write the local symbols.
1529 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1530 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1531 Adjust size of input file header.
1532 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1533 (Incremental_inputs_reader::get_local_symbol_count): New function.
1534 (Incremental_inputs_reader::get_input_section): Adjust size of input
1535 file header.
1536 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1537 (Sized_incr_relobj::This): New typedef.
1538 (Sized_incr_relobj::sym_size): New const data member.
1539 (Sized_incr_relobj::Local_symbol): New struct.
1540 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1541 (Sized_incr_relobj::do_local_symbol_offset): New function.
1542 (Sized_incr_relobj::local_symbol_count_): New data member.
1543 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1544 (Sized_incr_relobj::local_symbol_index_): New data member.
1545 (Sized_incr_relobj::local_symbol_offset_): New data member.
1546 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1547 (Sized_incr_relobj::local_symbols_): New data member.
1548 * object.h (Relobj::output_local_symbol_count): New function.
1549 (Relobj::local_symbol_offset): New function.
1550 (Relobj::do_output_local_symbol_count): New function.
1551 (Relobj::do_local_symbol_offset): New function.
1552 (Sized_relobj::do_output_local_symbol_count): New function.
1553 (Sized_relobj::do_local_symbol_offset): New function.
1554
d0a9ace3
ILT
15552011-04-22 Vladimir Simonov <sv@sw.ru>
1556
1557 * descriptors.cc (set_close_on_exec): New function.
1558 (Descriptors::open): Use set_close_on_exec.
1559 * output.cc (S_ISLNK): Define if not defined.
1560
94a3fc8b
CC
15612011-04-22 Cary Coutant <ccoutant@google.com>
1562
1563 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1564 global symbol map.
1565 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1566 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1567 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1568 relocations.
1569 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1570 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1571 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1572 * incremental.h
1573 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1574 function.
1575 (Incremental_binary::apply_incremental_relocs): New function.
1576 (Incremental_binary::do_apply_incremental_relocs): New function.
1577 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1578 data member.
1579 (Sized_incremental_binary::add_global_symbol): New function.
1580 (Sized_incremental_binary::global_symbol): New function.
1581 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1582 (Sized_incremental_binary::symbol_map_): New data member.
1583 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1584 * target.h (Sized_target::apply_relocation): New function.
1585 * target-reloc.h (apply_relocation): New function.
1586 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1587
c87e4302
DK
15882011-04-22 Doug Kwan <dougkwan@google.com>
1589
1590 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1591 flag of a SHT_ARM_EXIDX section.
1592 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1593 * testsuite/Makefile.in: Regenerate.
1594 * testsuite/arm_exidx_test.s: New file.
1595 * testsuite/arm_exidx_test.sh: Same.
1596
e7782cf6
CC
15972011-04-20 Cary Coutant <ccoutant@google.com>
1598
1599 PR gold/12689
1600 * archive.h (Incremental_archive_entry::Archive_member):
1601 Initialize arg_serial_ (second constructor).
1602
308ecdc7
ILT
16032011-04-17 Ian Lance Taylor <iant@google.com>
1604
1605 * object.cc (Relocate_info::location): Simplify location string.
1606 * errors.cc (Errors::error_at_location): Don't print program
1607 name.
1608 (Errors::warning_at_location): Likewise.
1609 (Errors::undefined_symbol): Likewise.
1610 * testsuite/debug_msg.sh: Update accordingly.
1611
bec5b579
CC
16122011-04-14 Cary Coutant <ccoutant@google.com>
1613
1614 * gold/layout.cc (Layout::symtab_section_offset): New function.
1615 * gold/layout.h (Layout::symtab_section_offset): New function.
1616 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1617
88597d34
ILT
16182011-04-12 Ian Lance Taylor <iant@google.com>
1619
1620 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1621 with MREMAP_MAYMOVE.
1622 * output.h (class Output_file): Add map_is_allocated_ field.
1623 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1624 not available, provide stubs. If mremap is not available, #define
1625 it to gold_mremap.
1626 (MREMAP_MAYMOVE): Define if not defined.
1627 (Output_file::Output_file): Initialize map_is_allocated_.
1628 (Output_file::resize): Check map_is_allocated_.
1629 (Output_file::map_anonymous): If mmap fails, use malloc.
1630 (Output_file::unmap): Don't do anything for an anonymous map.
1631 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1632 is not available, provide stubs.
1633 (File_read::View::~View): Use free rather than delete[].
1634 (File_read::make_view): Use malloc rather than new[]. If mmap
1635 fails, use malloc.
1636 (File_read::find_or_make_view): Use malloc rather than new[].
1637 * gold.h: Remove HAVE_REMAP code.
1638 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1639 exists. Rename mremap to gold_mremap. If mmap is not available
1640 don't do anything.
1641 * configure, config.in: Rebuild.
1642
11e361bc
ILT
16432011-04-11 Ian Lance Taylor <iant@google.com>
1644
1645 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1646 initialize local variable v.
1647
cdc29364
CC
16482011-04-11 Cary Coutant <ccoutant@google.com>
1649
1650 * archive.cc (Archive::include_member): Adjust call to
1651 report_object.
1652 (Add_archive_symbols::run): Track argument serial numbers.
1653 (Lib_group::include_member): Likewise.
1654 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1655 * archive.h (Incremental_archive_entry::Archive_member):
1656 Initialize arg_serial_.
1657 (Archive_member::arg_serial_): New data member.
1658 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1659 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1660 incremental link.
1661 (Sized_dynobj::do_for_all_local_got_entries): New function.
1662 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1663 function.
1664 * fileread.cc (get_mtime): New function.
1665 * fileread.h (get_mtime): New function.
1666 * gold.cc (queue_initial_tasks): Check for incremental update.
1667 (process_incremental_input): New function.
1668 (queue_middle_tasks): Don't force valid target for incremental
1669 update.
1670 * incremental-dump.cc (find_input_containing_global): Adjust
1671 size of symbol info entry.
1672 (dump_incremental_inputs): Dump argument serial number and
1673 in_system_directory flag; bias shndx by 1; print symbol names
1674 when dumping per-file symbol lists; use new symbol info readers.
1675 * incremental.cc
1676 (Output_section_incremental_inputs:update_data_size): New function.
1677 (Sized_incremental_binary::setup_readers): Setup input readers
1678 for each input file; build maps for files added from libraries
1679 and scripts.
1680 (Sized_incremental_binary::check_input_args): New function.
1681 (Sized_incremental_binary::do_check_inputs): Build map of argument
1682 serial numbers to input arguments.
1683 (Sized_incremental_binary::do_file_has_changed): Rename
1684 do_file_is_unchanged to this; compare file modification times.
1685 (Sized_incremental_binary::do_init_layout): New function.
1686 (Sized_incremental_binary::do_reserve_layout): New function.
1687 (Sized_incremental_binary::do_get_input_reader): Remove.
1688 (Sized_incremental_binary::get_symtab_view): New function.
1689 (Incremental_checker::can_incrementally_link_output_file): Remove.
1690 (Incremental_inputs::report_command_line): Exclude --debug options.
1691 (Incremental_inputs::report_archive_begin): Add parameter; track
1692 argument serial numbers; don't put input file entry for archive
1693 before archive members.
1694 (Incremental_inputs::report_archive_end): Put input file entry
1695 for archive after archive members.
1696 (Incremental_inputs::report_object): Add parameter; track argument
1697 serial numbers and in_system_directory flag.
1698 (Incremental_inputs::report_script): Add parameter; track argument
1699 serial numbers.
1700 (Output_section_incremental_inputs::set_final_data_size): Adjust
1701 size of symbol info entry; check for forwarding symbols.
1702 (Output_section_incremental_inputs::write_input_files): Write
1703 in_system_directory flag and argument serial number.
1704 (Output_section_incremental_inputs::write_info_blocks): Map section
1705 indices between incremental info and original input file; store
1706 input section index for each symbol.
1707 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1708 change operator() to visit().
1709 (class Global_got_offset_visitor): Likewise.
1710 (class Global_symbol_visitor_got_plt):
1711 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1712 classes.
1713 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1714 (Sized_incr_relobj::do_read_symbols): New function.
1715 (Sized_incr_relobj::do_layout): New function.
1716 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1717 (Sized_incr_relobj::do_add_symbols): New function.
1718 (Sized_incr_relobj::do_should_include_member): New function.
1719 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1720 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1721 (Sized_incr_relobj::do_section_size): New function.
1722 (Sized_incr_relobj::do_section_name): New function.
1723 (Sized_incr_relobj::do_section_contents): New function.
1724 (Sized_incr_relobj::do_section_flags): New function.
1725 (Sized_incr_relobj::do_section_entsize): New function.
1726 (Sized_incr_relobj::do_section_address): New function.
1727 (Sized_incr_relobj::do_section_type): New function.
1728 (Sized_incr_relobj::do_section_link): New function.
1729 (Sized_incr_relobj::do_section_info): New function.
1730 (Sized_incr_relobj::do_section_addralign): New function.
1731 (Sized_incr_relobj::do_initialize_xindex): New function.
1732 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1733 (Sized_incr_relobj::do_read_relocs): New function.
1734 (Sized_incr_relobj::do_gc_process_relocs): New function.
1735 (Sized_incr_relobj::do_scan_relocs): New function.
1736 (Sized_incr_relobj::do_count_local_symbols): New function.
1737 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1738 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1739 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1740 (Sized_incr_relobj::do_relocate): New function.
1741 (Sized_incr_relobj::do_set_section_offset): New function.
1742 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1743 (Sized_incr_dynobj::do_read_symbols): New function.
1744 (Sized_incr_dynobj::do_layout): New function.
1745 (Sized_incr_dynobj::do_add_symbols): New function.
1746 (Sized_incr_dynobj::do_should_include_member): New function.
1747 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1748 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1749 (Sized_incr_dynobj::do_section_size): New function.
1750 (Sized_incr_dynobj::do_section_name): New function.
1751 (Sized_incr_dynobj::do_section_contents): New function.
1752 (Sized_incr_dynobj::do_section_flags): New function.
1753 (Sized_incr_dynobj::do_section_entsize): New function.
1754 (Sized_incr_dynobj::do_section_address): New function.
1755 (Sized_incr_dynobj::do_section_type): New function.
1756 (Sized_incr_dynobj::do_section_link): New function.
1757 (Sized_incr_dynobj::do_section_info): New function.
1758 (Sized_incr_dynobj::do_section_addralign): New function.
1759 (Sized_incr_dynobj::do_initialize_xindex): New function.
1760 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1761 (make_sized_incremental_object): New function.
1762 (Incremental_library::copy_unused_symbols): New function.
1763 (Incremental_library::do_for_all_unused_symbols): New function.
1764 * incremental.h (enum Incremental_input_flags): New type.
1765 (class Incremental_checker): Remove.
1766 (Incremental_input_entry::Incremental_input_entry): Add argument
1767 serial number.
1768 (Incremental_input_entry::arg_serial): New function.
1769 (Incremental_input_entry::set_is_in_system_directory): New function.
1770 (Incremental_input_entry::is_in_system_directory): New function.
1771 (Incremental_input_entry::arg_serial_): New data member.
1772 (Incremental_input_entry::is_in_system_directory_): New data member.
1773 (class Script_info): Move here from script.h.
1774 (Script_info::Script_info): Add filename parameter.
1775 (Script_info::filename): New function.
1776 (Script_info::filename_): New data member.
1777 (Incremental_script_entry::Incremental_script_entry): Add argument
1778 serial number.
1779 (Incremental_object_entry::Incremental_object_entry): Likewise.
1780 (Incremental_object_entry::add_input_section): Build list of input
1781 sections with map to original shndx.
1782 (Incremental_object_entry::get_input_section_index): New function.
1783 (Incremental_object_entry::shndx_): New data member.
1784 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1785 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1786 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1787 serial number.
1788 (Incremental_inputs::report_archive_begin): Likewise.
1789 (Incremental_inputs::report_object): Likewise.
1790 (Incremental_inputs::report_script): Likewise.
1791 (class Incremental_global_symbol_reader): New class.
1792 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1793 and store flags and input file type.
1794 (Incremental_input_entry_reader::arg_serial): New function.
1795 (Incremental_input_entry_reader::type): Extract type from flags.
1796 (Incremental_input_entry_reader::is_in_system_directory): New function.
1797 (Incremental_input_entry_reader::get_input_section_count): Call
1798 accessor function for type.
1799 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1800 function for type; adjust size of global symbol entry.
1801 (Incremental_input_entry_reader::get_global_symbol_count): Call
1802 accessor function for type.
1803 (Incremental_input_entry_reader::get_object_count): Likewise.
1804 (Incremental_input_entry_reader::get_object_offset): Likewise.
1805 (Incremental_input_entry_reader::get_member_count): Likewise.
1806 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1807 (Incremental_input_entry_reader::get_member_offset): Likewise.
1808 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1809 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1810 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1811 (Incremental_input_entry_reader::get_global_symbol_reader): New
1812 function.
1813 (Incremental_input_entry_reader::get_output_symbol_index): New
1814 function.
1815 (Incremental_input_entry_reader::type_): Remove.
1816 (Incremental_input_entry_reader::flags_): New data member.
1817 (Incremental_inputs_reader::input_file_offset): New function.
1818 (Incremental_inputs_reader::input_file_index): New function.
1819 (Incremental_inputs_reader::input_file): Call input_file_offset.
1820 (Incremental_inputs_reader::input_file_at_offset): New function.
1821 (Incremental_relocs_reader::get_r_type): Reformat.
1822 (Incremental_relocs_reader::get_r_shndx): Reformat.
1823 (Incremental_relocs_reader::get_r_offset): Reformat.
1824 (Incremental_relocs_reader::data): New function.
1825 (Incremental_binary::Incremental_binary): Initialize new data members.
1826 (Incremental_binary::check_inputs): Add cmdline parameter.
1827 (Incremental_binary::file_is_unchanged): Remove.
1828 (Input_reader::arg_serial): New function.
1829 (Input_reader::get_unused_symbol_count): New function.
1830 (Input_reader::get_unused_symbol): New function.
1831 (Input_reader::do_arg_serial): New function.
1832 (Input_reader::do_get_unused_symbol_count): New function.
1833 (Input_reader::do_get_unused_symbol): New function.
1834 (Incremental_binary::input_file_count): New function.
1835 (Incremental_binary::get_input_reader): Change signature to use
1836 index instead of filename.
1837 (Incremental_binary::file_has_changed): New function.
1838 (Incremental_binary::get_input_argument): New function.
1839 (Incremental_binary::get_library): New function.
1840 (Incremental_binary::get_script_info): New function.
1841 (Incremental_binary::init_layout): New function.
1842 (Incremental_binary::reserve_layout): New function.
1843 (Incremental_binary::output_file): New function.
1844 (Incremental_binary::do_check_inputs): New function.
1845 (Incremental_binary::do_file_is_unchanged): Remove.
1846 (Incremental_binary::do_file_has_changed): New function.
1847 (Incremental_binary::do_init_layout): New function.
1848 (Incremental_binary::do_reserve_layout): New function.
1849 (Incremental_binary::do_input_file_count): New function.
1850 (Incremental_binary::do_get_input_reader): Change signature.
1851 (Incremental_binary::input_args_map_): New data member.
1852 (Incremental_binary::library_map_): New data member.
1853 (Incremental_binary::script_map_): New data member.
1854 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1855 new data members.
1856 (Sized_incremental_binary::output_section): New function.
1857 (Sized_incremental_binary::inputs_reader): Add const.
1858 (Sized_incremental_binary::symtab_reader): Add const.
1859 (Sized_incremental_binary::relocs_reader): Add const.
1860 (Sized_incremental_binary::got_plt_reader): Add const.
1861 (Sized_incremental_binary::get_symtab_view): New function.
1862 (Sized_incremental_binary::Inputs_reader): New typedef.
1863 (Sized_incremental_binary::Input_entry_reader): New typedef.
1864 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1865 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1866 (Sized_incremental_binary::do_file_has_changed): New function.
1867 (Sized_incremental_binary::do_init_layout): New function.
1868 (Sized_incremental_binary::do_reserve_layout): New function.
1869 (Sized_input_reader::Inputs_reader): Remove.
1870 (Sized_input_reader::Input_entry_reader): Remove.
1871 (Sized_input_reader::do_arg_serial): New function.
1872 (Sized_input_reader::do_get_unused_symbol_count): New function.
1873 (Sized_input_reader::do_get_unused_symbol): New function.
1874 (Sized_incremental_binary::do_input_file_count): New function.
1875 (Sized_incremental_binary::do_get_input_reader): Change signature;
1876 use index instead of filename.
1877 (Sized_incremental_binary::section_map_): New data member.
1878 (Sized_incremental_binary::input_entry_readers_): New data member.
1879 (class Sized_incr_relobj): New class.
1880 (class Sized_incr_dynobj): New class.
1881 (make_sized_incremental_object): New function.
1882 (class Incremental_library): New class.
1883 * layout.cc (Free_list::num_lists): New static data member.
1884 (Free_list::num_nodes): New static data member.
1885 (Free_list::num_removes): New static data member.
1886 (Free_list::num_remove_visits): New static data member.
1887 (Free_list::num_allocates): New static data member.
1888 (Free_list::num_allocate_visits): New static data member.
1889 (Free_list::init): New function.
1890 (Free_list::remove): New function.
1891 (Free_list::allocate): New function.
1892 (Free_list::dump): New function.
1893 (Free_list::print_stats): New function.
1894 (Layout_task_runner::run): Resize output file for incremental updates.
1895 (Layout::Layout): Initialize new data members.
1896 (Layout::set_incremental_base): New function.
1897 (Layout::init_fixed_output_section): New function.
1898 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1899 incremental updates.
1900 (Layout::create_gold_note): Do not create gold note section for
1901 incremental updates.
1902 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1903 for incremental updates.
1904 (Layout::set_section_offsets): For incremental updates, allocate space
1905 from free list.
1906 (Layout::create_symtab_sections): Layout with offsets relative to
1907 start of section; for incremental updates, allocate space from free
1908 list.
1909 (Layout::create_shdrs): For incremental updates, allocate space from
1910 free list.
1911 (Layout::finish_dynamic_section): For incremental updates, do not
1912 check --as-needed (fixed in subsequent patch).
1913 * layout.h (class Free_list): New class.
1914 (Layout::set_incremental_base): New function.
1915 (Layout::incremental_base): New function.
1916 (Layout::init_fixed_output_section): New function.
1917 (Layout::allocate): New function.
1918 (Layout::incremental_base_): New data member.
1919 (Layout::free_list_): New data member.
1920 * main.cc (main): Print Free_list statistics.
1921 * object.cc (Relobj::finalize_incremental_relocs): Add
1922 clear_counts parameter; clear counts only when clear_counts is set.
1923 (Sized_relobj::Sized_relobj): Initialize new base class.
1924 (Sized_relobj::do_layout): Don't report special sections.
1925 (Sized_relobj::do_for_all_local_got_entries): New function.
1926 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1927 symtab_off to all symbol table offsets.
1928 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1929 * object.h (class Got_offset_list): Move to top of file.
1930 (Object::Object): Allow case where input_file == NULL.
1931 (Object::~Object): Likewise.
1932 (Object::input_file): Assert that input_file != NULL.
1933 (Object::lock): Allow case where input_file == NULL.
1934 (Object::unlock): Likewise.
1935 (Object::is_locked): Likewise.
1936 (Object::token): Likewise.
1937 (Object::release): Likewise.
1938 (Object::is_incremental): New function.
1939 (Object::get_mtime): New function.
1940 (Object::for_all_local_got_entries): New function.
1941 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1942 (Object::set_is_in_system_directory): New function.
1943 (Object::is_in_system_directory): New function.
1944 (Object::do_is_incremental): New function.
1945 (Object::do_get_mtime): New function.
1946 (Object::do_for_all_local_got_entries): New function.
1947 (Object::is_in_system_directory_): New data member.
1948 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1949 (class Sized_relobj_base): New class.
1950 (class Sized_relobj): Derive from Sized_relobj_base.
1951 (class Sized_relobj::Symbols): Redeclare from base class.
1952 (class Sized_relobj::local_got_offset_list): Remove.
1953 (class Sized_relobj::Output_sections): Redeclare from base class.
1954 (class Sized_relobj::do_for_all_local_got_entries): New function.
1955 (class Sized_relobj::write_local_symbols): Add offset parameter.
1956 (class Sized_relobj::local_symbol_offset_): Update comment.
1957 (class Sized_relobj::local_dynsym_offset_): Update comment.
1958 * options.cc (Input_arguments::add_file): Remove const.
1959 * options.h (Input_file_argument::Input_file_argument):
1960 Initialize arg_serial_ (all constructors).
1961 (Input_file_argument::set_arg_serial): New function.
1962 (Input_file_argument::arg_serial): New function.
1963 (Input_file_argument::arg_serial_): New data member.
1964 (Input_arguments::Input_arguments): Initialize file_count_.
1965 (Input_arguments::add_file): Remove const.
1966 (Input_arguments::number_of_input_files): New function.
1967 (Input_arguments::file_count_): New data member.
1968 (Command_line::number_of_input_files): Call
1969 Input_arguments::number_of_input_files.
1970 * output.cc (Output_segment_headers::Output_segment_headers):
1971 Set current size.
1972 (Output_section::Input_section::current_data_size): New function.
1973 (Output_section::Output_section): Initialize new data members.
1974 (Output_section::add_input_section): Don't do merge sections for
1975 an incremental link; allocate space from free list for an
1976 incremental update.
1977 (Output_section::add_output_section_data): Allocate space from
1978 free list for an incremental update.
1979 (Output_section::update_data_size): New function.
1980 (Output_section::set_fixed_layout): New function.
1981 (Output_section::reserve): New function.
1982 (Output_segment::set_section_addresses): Remove const.
1983 (Output_segment::set_section_list_addresses): Remove const; allocate
1984 space from free list for an incremental update.
1985 (Output_segment::set_offset): Adjust size of RELRO segment for an
1986 incremental update.
1987 * output.h (Output_data::current_data_size): Move here from
1988 child classes.
1989 (Output_data::pre_finalize_data_size): New function.
1990 (Output_data::update_data_size): New function.
1991 (Output_section_headers::update_data_size): new function.
1992 (Output_section_data_build::current_data_size): Move to Output_data.
1993 (Output_data_strtab::update_data_size): New function.
1994 (Output_section::current_data_size): Move to Output_data.
1995 (Output_section::set_fixed_layout): New function.
1996 (Output_section::has_fixed_layout): New function.
1997 (Output_section::reserve): New function.
1998 (Output_section::update_data_size): New function.
1999 (Output_section::has_fixed_layout_): New data member.
2000 (Output_section::free_list_): New data member.
2001 (Output_segment::set_section_addresses): Remove const.
2002 (Output_segment::set_section_list_addresses): Remove const.
2003 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
2004 New function.
2005 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
2006 New function.
2007 * readsyms.cc (Read_symbols::do_read_symbols): Add library
2008 parameter when calling Add_symbols constructor; store argument
2009 serial number for members of a lib group.
2010 (Add_symbols::locks): Allow case where token == NULL.
2011 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
2012 (Read_member::~Read_member): New function.
2013 (Read_member::is_runnable): New function.
2014 (Read_member::locks): New function.
2015 (Read_member::run): New function.
2016 (Check_script::~Check_script): New function.
2017 (Check_script::is_runnable): New function.
2018 (Check_script::locks): New function.
2019 (Check_script::run): New function.
2020 (Check_library::~Check_library): New function.
2021 (Check_library::is_runnable): New function.
2022 (Check_library::locks): New function.
2023 (Check_library::run): New function.
2024 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
2025 (Add_symbols::library_): New data member.
2026 (class Read_member): New class.
2027 (class Check_script): New class.
2028 (class Check_library): New class.
2029 * reloc.cc (Read_relocs::is_runnable): Allow case where
2030 token == NULL.
2031 (Read_relocs::locks): Likewise.
2032 (Scan_relocs::locks): Likewise.
2033 (Relocate_task::locks): Likewise.
2034 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
2035 to clear counters.
2036 (Sized_relobj::incremental_relocs_scan): Fix comment.
2037 (Sized_relobj::do_relocate): Pass output file offset to
2038 write_local_symbols.
2039 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
2040 from class declaration.
2041 * script.cc (read_input_script): Allocate Script_info; pass
2042 argument serial number to report_script.
2043 * script.h (class Script_info): Move to incremental.h.
2044 * symtab.cc (Symbol_table::add_from_incrobj): New function.
2045 * symtab.h (Symbol_table::add_from_incrobj): New function.
2046 (Symbol_table::set_file_offset): New function.
2047
b961d0d7
CC
20482011-04-05 Cary Coutant <ccoutant@google.com>
2049
2050 * incremental-dump.cc (dump_incremental_inputs): Change signature
2051 to take a Sized_incremental_binary; change caller. Use readers
2052 in Sized_incremental_binary.
2053 * incremental.cc
2054 (Sized_incremental_binary::find_incremental_inputs_sections):
2055 Rename do_find_incremental_inputs_sections to this.
2056 (Sized_incremental_binary::setup_readers): New function.
2057 (Sized_incremental_binary::do_check_inputs): Check
2058 has_incremental_info_ flag; move setup code to setup_readers;
2059 use input readers.
2060 (Sized_incremental_binary::do_file_is_unchanged): New function.
2061 (Sized_incremental_binary::do_get_input_reader): New function.
2062 * incremental.h (class Incremental_binary): Move to end of file.
2063 (Incremental_binary::file_is_unchanged): New function.
2064 (Incremental_binary::do_file_is_unchanged): New function.
2065 (Incremental_binary::Input_reader): New class.
2066 (Incremental_binary::get_input_reader): New function.
2067 (class Sized_incremental_binary): Move to end of file.
2068 (Sized_incremental_binary::Sized_incremental_binary): Setup the
2069 input section reader classes.
2070 (Sized_incremental_binary::has_incremental_info): New function.
2071 (Sized_incremental_binary::inputs_reader): New function.
2072 (Sized_incremental_binary::symtab_reader): New function.
2073 (Sized_incremental_binary::relocs_reader): New function.
2074 (Sized_incremental_binary::got_plt_reader): New function.
2075 (Sized_incremental_binary::do_file_is_unchanged): New function.
2076 (Sized_incremental_binary::Sized_input_reader): New class.
2077 (Sized_incremental_binary::get_input_reader): New function.
2078 (Sized_incremental_binary::find_incremental_inputs_sections):
2079 Rename do_find_incremental_inputs_sections to this.
2080 (Sized_incremental_binary::setup_readers): New function.
2081 (Sized_incremental_binary::has_incremental_info_): New data member.
2082 (Sized_incremental_binary::inputs_reader_): New data member.
2083 (Sized_incremental_binary::symtab_reader_): New data member.
2084 (Sized_incremental_binary::relocs_reader_): New data member.
2085 (Sized_incremental_binary::got_plt_reader_): New data member.
2086 (Sized_incremental_binary::current_input_file_): New data member.
2087
a869183f
PP
20882011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
2089
2090 PR gold/12640
2091 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
2092 violation.
2093
20942011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
2095
2096 * archive.cc (Archive::include_member): Adjust call to report_object.
2097 (Add_archive_symbols::run): Add script_info to call to
2098 report_archive_begin.
2099 (Lib_group::include_member): Adjust call to report_object.
2100 (Add_lib_group_symbols::run): Adjust call to report_object.
2101 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
2102 blocks. Add object count for script input files.
2103 * incremental.cc (Incremental_inputs::report_archive_begin): Add
2104 script_info parameter; change all callers.
2105 (Incremental_inputs::report_object): Add script_info parameter;
2106 change all callers.
2107 (Incremental_inputs::report_script): Store backpointer to
2108 incremental info entry.
2109 (Output_section_incremental_inputs::set_final_data_size): Record
2110 additional information for scripts.
2111 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2112 * incremental.h (Incremental_script_entry::add_object): New function.
2113 (Incremental_script_entry::get_object_count): New function.
2114 (Incremental_script_entry::get_object): New function.
2115 (Incremental_script_entry::objects_): New data member; adjust
2116 constructor.
2117 (Incremental_inputs::report_archive_begin): Add script_info parameter.
2118 (Incremental_inputs::report_object): Add script_info parameter.
2119 (Incremental_inputs_reader::get_object_count): New function.
2120 (Incremental_inputs_reader::get_object_offset): New function.
2121 * options.cc (Input_arguments::add_file): Return reference to
2122 new input argument.
2123 * options.h (Input_argument::set_script_info): New function.
2124 (Input_argument::script_info): New function.
2125 (Input_argument::script_info_): New data member; adjust all
2126 constructors.
2127 (Input_file_group::add_file): Return reference to new input argument.
2128 (Input_file_lib::add_file): Likewise.
2129 (Input_arguments::add_file): Likewise.
2130 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
2131 * script.cc (Parser_closure::Parser_closure): Add script_info
2132 parameter; adjust all callers.
2133 (Parser_closure::script_info): New function.
2134 (Parser_closure::script_info_): New data member.
2135 (read_input_script): Report scripts earlier to incremental info.
2136 (script_add_file): Set script_info in Input_argument.
2137 (script_add_library): Likewise.
2138 * script.h (Script_options::Script_info): Rewrite class.
2139
a869183f 21402011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
2141
2142 * archive.cc (Library_base::should_include_member): Move
2143 method here from class Archive.
2144 (Archive::Archive): Initialize base class.
2145 (Archive::should_include_member): Move to base class.
2146 (Archive::do_for_all_unused_symbols): New function.
2147 (Add_archive_symbols::run): Remove redundant access to
2148 incremental_inputs.
2149 (Lib_group::Lib_group): Initialize base class.
2150 (Lib_group::do_filename): New function.
2151 (Lib_group::include_member): Pass pointer to Lib_group to
2152 report_object.
2153 (Lib_group::do_for_all_unused_symbols): New function.
2154 (Add_lib_group_symbols::run): Report archive information for
2155 incremental links.
2156 * archive.h (class Library_base): New base class.
2157 (class Archive): Derive from Library_base.
2158 (Archive::filename): Move to base class.
2159 (Archive::set_incremental_info): Likewise.
2160 (Archive::incremental_info): Likewise.
2161 (Archive::Should_include): Likewise.
2162 (Archive::should_include_member): Likewise.
2163 (Archive::Armap_entry): Remove.
2164 (Archive::Unused_symbol_iterator): Remove.
2165 (Archive::unused_symbols_begin): Remove.
2166 (Archive::unused_symbols_end): Remove.
2167 (Archive::do_filename): New function.
2168 (Archive::do_get_mtime): New function.
2169 (Archive::do_for_all_unused_symbols): New function.
2170 (Archive::task_): Move to base class.
2171 (Archive::incremental_info_): Likewise.
2172 (class Lib_group): Derive from Library_base.
2173 (Lib_group::do_filename): New function.
2174 (Lib_group::do_get_mtime): New function.
2175 (Lib_group::do_for_all_unused_symbols): New function.
2176 (Lib_group::task_): Move to base class.
2177 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
2178 function.
2179 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
2180 function.
2181 * incremental.cc (Incremental_inputs::report_archive_begin):
2182 Use Library_base; call library's get_mtime; add incremental inputs
2183 entry before members.
2184 (class Unused_symbol_visitor): New class.
2185 (Incremental_inputs::report_archive_end): Use Library_base; use
2186 visitor class to record unused symbols; don't add incremental inputs
2187 entry after members.
2188 (Incremental_inputs::report_object): Use Library_base.
2189 * incremental.h
2190 (Incremental_archive_entry::Incremental_archive_entry): Remove
2191 unused Archive parameter.
2192 (Incremental_inputs::report_archive_begin): Use Library_base.
2193 (Incremental_inputs::report_archive_end): Likewise.
2194 (Incremental_inputs::report_object): Likewise.
2195 * object.cc (Sized_relobj::do_for_all_global_symbols): New
2196 function.
2197 * object.h (Object::for_all_global_symbols): New function.
2198 (Object::do_for_all_global_symbols): New function.
2199 (Sized_relobj::do_for_all_global_symbols): New function.
2200 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
2201 function.
2202 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
2203 function.
2204
61ab3e40
ILT
22052011-03-27 Ian Lance Taylor <iant@google.com>
2206
2207 * archive.cc (Archive::interpret_header): Return -1 if something
2208 goes wrong. Change callers accordingly.
2209
30e1f9e6
CC
22102011-03-25 Cary Coutant <ccoutant@google.com>
2211
2212 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
2213 * testsuite/Makefile.in: Regenerate.
2214
9370ce59 22152011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
2216
2217 * plugin.cc (get_view): New.
2218 (Plugin::load): Pass get_view to the plugin.
2219 (Plugin_manager::get_view): New.
2220
9312bb0a
ILT
22212011-03-21 Ian Lance Taylor <iant@google.com>
2222
2223 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 2224 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 2225
7e12ba9e
ST
22262011-03-21 Sriraman Tallam <tmsriram@google.com>
2227
2228 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
2229 Change == to -eq.
2230 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
2231 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
2232 Change == to -eq.
2233 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
2234 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
2235
fd7a005d
ILT
22362011-03-14 Ian Lance Taylor <iant@google.com>
2237
2238 * script-sections.cc (Sort_output_sections::script_compare):
2239 Rename from is_before, change return type.
2240 (Sort_output_sections::operator()): Adjust accordingly.
2241
ed16fd1b
ILT
22422011-03-11 Jeffrey Yasskin <jyasskin@google.com>
2243
2244 PR gold/12572
2245 * testsuite/odr_violation2.cc: Add comment to make all error line
2246 numbers double digits.
2247 * testsuite/debug_msg.sh: Adjust expected errors.
2248
71ff8986
ILT
22492011-03-09 Jeffrey Yasskin <jyasskin@google.com>
2250
2251 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
2252 but mark earlier ones as non-canonical
2253 (offset_to_iterator): Update search target and example
2254 (do_addr2line): Return extra lines in a vector*
2255 (format_file_lineno): Extract from do_addr2line
2256 (one_addr2line): Add vector* out-param
2257 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
2258 when a lineno entry appeared last for its instruction
2259 (Dwarf_line_info): Add vector* out-param
2260 * object.cc (Relocate_info): Pass NULL for the vector* out-param
2261 * symtab.cc (Odr_violation_compare): Include the lineno in the
2262 comparison again.
2263 (linenos_from_loc): New. Combine the canonical line for an
2264 address with its other lines.
2265 (True_if_intersect): New. Helper functor to make
2266 std::set_intersection a query.
2267 (detect_odr_violations): Compare sets of lines instead of just
2268 one line for each function. This became less deterministic, but
2269 has fewer false positives.
2270 * symtab.h: Declarations.
2271 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2272 mix an optimized and non-optimized object in the same binary
2273 (odr_violation2.so): Same.
2274 * testsuite/Makefile.in: Regenerate from Makefile.am.
2275 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2276 * testsuite/debug_msg.sh: Update line numbers and add
2277 assertions.
2278 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2279 non-optimized context.
2280 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2281 isn't inlined, and use OdrDerived in an optimized context.
2282 * testsuite/odr_header1.h: Defines OdrDerived, where
2283 optimization will change the
2284 first-instruction-in-the-destructor's file and line number.
2285 * testsuite/odr_header2.h: Defines OdrBase.
2286
a19fefdc
ILT
22872011-03-09 Ian Lance Taylor <iant@google.com>
2288
2289 * fileread.cc (File_read::clear_views): Don't delete the whole
2290 file view.
2291
ecb351e9
ILT
22922011-03-08 Ian Lance Taylor <iant@google.com>
2293
2294 PR gold/12525
2295 * fileread.cc: #include <climits>.
2296 (GOLD_IOV_MAX): Define.
2297 (File_read::read_multiple): Limit number of entries by iov_max.
2298 * fileread.h (class File_read): Always set max_readv_entries to
2299 128.
2300
b821d13c
ILT
23012011-03-07 Ian Lance Taylor <iant@google.com>
2302
2303 PR gold/12525
2304 * options.h (class General_options): Add -dy and -dn.
2305
89243142
CC
23062011-03-02 Cary Coutant <ccoutant@google.com>
2307
2308 * testsuite/script_test_9.t: Add TLS segment.
2309
d0773f31
ILT
23102011-03-02 Simon Baldwin <simonb@google.com>
2311
2312 * configure.ac: Add check for gnu_indirect_function support in
2313 the toolchain building binutils.
2314 * configure: Rebuild.
2315
9370ce59 23162011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
2317
2318 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2319 plugin only symbols.
2320 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2321 in plugin files as not needed in the symbol table.
2322
4cf7a849
ST
23232011-02-11 Sriraman Tallam <tmsriram@google.com>
2324
2325 * output.cc (Output_section::add_input_section): Delay fill
2326 generation for section ordering.
2327
b578bd7d
ILT
23282011-02-09 Ian Lance Taylor <iant@google.com>
2329
2330 PR gold/12316
2331 * object.h (class Sized_relobj): Remove clear_local_symbols.
2332 * reloc.cc (Sized_relobj::do_relocate): Don't call
2333 clear_local_symbols.
2334
9370ce59 23352011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
2336
2337 * plugin.cc (is_visible_from_outside): Return true for symbols
2338 in the -u option.
2339
55382fb7
ILT
23402011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2341
2342 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2343 filename.
2344
4e271fff
ST
23452011-02-02 Sriraman Tallam <tmsriram@google.com>
2346
2347 * icf.h (is_section_foldable_candidate): Change type of parameter
2348 to std::string.
2349 * icf.cc (Icf::find_identical_sections): Change type of local variable
2350 section_name to be std::string.
2351 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2352
d433c3ac
ILT
23532011-01-25 Ian Lance Taylor <iant@google.com>
2354
2355 * script.cc (script_add_extern): Rewrite to use
2356 add_symbol_reference.
2357
880473a6
DK
23582011-01-25 Doug Kwan <dougkwan@google.com>
2359
d433c3ac 2360 * icf.cc (get_section_contents): Always lock section's object.
880473a6 2361
f30f86fa
ILT
23622011-01-24 Ian Lance Taylor <iant@google.com>
2363
2364 * options.h (class General_options): Accept
2365 --no-detect-odr-violations.
2366
8e51a0b9
ILT
23672011-01-24 Ian Lance Taylor <iant@google.com>
2368
2369 * version.cc (version_string): Bump to 1.11.
2370
0f3b89d8
ILT
23712011-01-24 Ian Lance Taylor <iant@google.com>
2372
2373 * plugin.cc (class Plugin_rescan): Define new class.
2374 (Plugin_manager::claim_file): Set any_claimed_.
2375 (Plugin_manager::save_archive): New function.
2376 (Plugin_manager::save_input_group): New function.
2377 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2378 necessary.
2379 (Plugin_manager::new_undefined_symbol): New function.
2380 (Plugin_manager::rescan): New function.
2381 (Plugin_manager::rescannable_defines): New function.
2382 (Plugin_manager::add_input_file): Set any_added_.
2383 * plugin.h (class Plugin_manager): define new fields rescannable_,
2384 undefined_symbols_, any_claimed_, and any_added_. Declare
2385 Plugin_rescan as friend. Declare new functions.
2386 (Plugin_manager::Rescannable): Define type.
2387 (Plugin_manager::Rescannable_list): Define type.
2388 (Plugin_manager::Undefined_symbol_list): Define type.
2389 (Plugin_manager::Plugin_manager): Initialize new fields.
2390 * archive.cc (Archive::defines_symbol): New function.
2391 (Add_archive_symbols::run): Pass archive to plugins if any.
2392 * archive.h (class Archive): Declare defines_symbol.
2393 * readsyms.cc (Input_group::~Input_group): New function.
2394 (Finish_group::run): Pass input_group to plugins if any.
2395 * readsyms.h (class Input_group): Declare destructor.
2396 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2397 any.
2398
3bb951e5
ILT
23992011-01-10 Ian Lance Taylor <iant@google.com>
2400
2401 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2402 section as relro.
2403 (Layout::set_segment_offsets): Reset increase_relro before calling
2404 set_section_addresses a second time.
2405
0aa45fac
CC
24062011-01-04 Cary Coutant <ccoutant@google.com>
2407
2408 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2409 sections before NOBITS sections.
2410
0db46eb4
L
24112011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2412
2413 * version.cc (print_version): Update copyright to 2011.
2414
829c9745
CC
24152010-12-23 Cary Coutant <ccoutant@google.com>
2416
2417 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2418 of OS to this->add. Add OD parameter to second form of the function.
2419
7500420b
ILT
24202010-12-20 Ian Lance Taylor <iant@google.com>
2421
2422 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2423 second of two consecutive entries with same offset.
2424
f8e9a930
RW
24252010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2426
2427 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2428 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2429 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2430 to avoid unneeded links against $(LDADD).
2431 * testsuite/Makefile.in: Regenerate.
2432
2fbb4320
ILT
24332010-12-15 Ian Lance Taylor <iant@google.com>
2434
2435 PR gold/12324
2436 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2437 for R_X86_64_32 and R_X86_64_PC32.
2438 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2439 ver_matching_def_pic.o.
2440 (ver_matching_def_pic.o): New target.
2441
fedb228d
RW
24422010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2443
2444 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2445 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2446 Move definition before File_read::View member definitions.
2447 (File_read::View::~View): Initialize and hold lock before
2448 updating current_mapped_bytes.
2449
9b547ce6
RW
24502010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2451
2452 * dwarf_reader.cc: Remove outdated comment.
2453 * gold-threads.cc: Fix typo in error message.
2454 * archive.cc: Fix typos in comments.
2455 * archive.h: Likewise.
2456 * arm-reloc-property.cc: Likewise.
2457 * arm-reloc-property.h: Likewise.
2458 * arm-reloc.def: Likewise.
2459 * arm.cc: Likewise.
2460 * attributes.h: Likewise.
2461 * cref.cc: Likewise.
2462 * ehframe.cc: Likewise.
2463 * fileread.h: Likewise.
2464 * gold.h: Likewise.
2465 * i386.cc: Likewise.
2466 * icf.cc: Likewise.
2467 * incremental.h: Likewise.
2468 * int_encoding.cc: Likewise.
2469 * layout.h: Likewise.
2470 * main.cc: Likewise.
2471 * merge.h: Likewise.
2472 * object.cc: Likewise.
2473 * object.h: Likewise.
2474 * options.cc: Likewise.
2475 * readsyms.cc: Likewise.
2476 * reduced_debug_output.cc: Likewise.
2477 * reloc.cc: Likewise.
2478 * script-sections.cc: Likewise.
2479 * sparc.cc: Likewise.
2480 * symtab.h: Likewise.
2481 * target-reloc.h: Likewise.
2482 * target.cc: Likewise.
2483 * target.h: Likewise.
2484 * timer.cc: Likewise.
2485 * timer.h: Likewise.
2486 * x86_64.cc: Likewise.
2487
83e17bd5
CC
24882010-12-09 Cary Coutant <ccoutant@google.com>
2489
2490 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2491 stack.
2492 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2493 parameter; change all callers.
2494 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2495 * options.h (warn_execstack): New option.
2496
017257f8
DK
24972010-12-07 Doug Kwan <dougkwan@google.com>
2498
2499 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2500 like function call relocations.
2501
c20cbc06
ILT
25022010-12-07 Ian Lance Taylor <iant@google.com>
2503
2504 * archive.cc (Archive::get_elf_object_for_member): Permit
2505 punconfigured to be NULL.
2506 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2507 (Archive::include_member): Pass NULL to get_elf_object_for_member
2508 if we searched for the archive and this is the first included
2509 object.
2510
4dbfafcc
ILT
25112010-12-01 Ian Lance Taylor <iant@google.com>
2512
2513 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2514 track_relocs_type_ field.
2515 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2516 Set track_relocs_type_.
2517 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2518 contents when using RELA relocs.
2519 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2520 reloc_map_.
2521 * reloc.cc (Track_relocs::next_addend): New function.
2522 * reloc.h (class Track_relocs): Declare next_addend.
2523
e5e19edd
ILT
25242010-12-01 Ian Lance Taylor <iant@google.com>
2525
2526 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2527 virtual destructor.
2528
9a5ce24c
ILT
25292010-12-01 Ian Lance Taylor <iant@google.com>
2530
2531 * README: Update compilers known to work and fail.
2532
c7791212
NC
25332010-11-23 Matthias Klose <doko@ubuntu.com>
2534
2535 * configure.in: For --enable-gold, handle value `default' instead of
2536 `both*'. Always install ld as ld.bfd, install as ld if gold is
2537 not the default.
2538 * configure: Regenerate.
2539
0ad220c9
DK
25402010-11-18 Doug Kwan <dougkwan@google.com>
2541
2542 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2543 and right_alignment to be zero. Store result alignment only if it is
2544 greater than existing alignment.
2545
ab8056e0
CC
25462010-11-16 Cary Coutant <ccoutant@google.com>
2547
2548 PR gold/12220
2549 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2550 Check for ".zdebug_line".
2551
fd064a5b
CC
25522010-11-16 Doug Kwan <dougkwan@google.com>
2553 Cary Coutant <ccoutant@google.com>
2554
2555 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2556 by reference; adjust all callers.
2557 * output.cc (Output_segment::set_section_addresses): Adjust references
2558 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2559 list is empty.
2560 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2561 end at page boundary.
2562
6fc6ea19
CC
25632010-11-16 Cary Coutant <ccoutant@google.com>
2564
2565 PR gold/12220
2566 * layout.cc (Layout::choose_output_section): Transform names of
2567 compressed sections even when using a script with a SECTIONS clause.
2568 (Layout::output_section_name): Remove code to transform
2569 compressed debug section names.
2570 * output.cc (Output_section::add_input_section): Use uncompressed
2571 section size when tracking input sections.
2572
95a2c8d6
RS
25732010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2574
2575 * symtab.h (Symbol::NON_PIC_REF): Remove.
2576 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2577 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2578 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2579 (Symbol::use_plt_offset): Take a flags argument and pass it
2580 directly to needs_dynamic_reloc. Restrict check for undefined
2581 weak symbols to function calls.
2582 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2583 (Target_arm::Scan::global): Use it.
2584 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2585 (Target_arm::Relocate::relocate): Likewise.
2586 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2587 parameter with an r_type parameter. Use get_reference_flags
2588 to get the flags.
2589 (Target_arm::Relocate::relocate): Update accordingly.
2590 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2591 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2592 (Target_i386::Scan::global): Likewise.
2593 (Target_i386::Relocate::relocate): Likewise.
2594 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2595 parameter with an r_type parameter. Use get_reference_flags
2596 to get the flags.
2597 (Target_i386::Relocate::relocate): Update accordingly.
2598 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2599 (Target_powerpc::Scan::global): Use it.
2600 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2601 (Target_powerpc::Relocate::relocate): Likewise.
2602 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2603 (Target_sparc::Scan::global): Use it.
2604 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2605 (Target_sparc::Relocate::relocate): Likewise.
2606 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2607 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2608 (Target_x86_64::Scan::global): Likewise.
2609 (Target_x86_64::Relocate::relocate): Likewise.
2610
f625ae50
DK
26112010-11-08 Doug Kwan <dougkwan@google.com>
2612 Cary Coutant <ccoutant@google.com>
2613
2614 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2615 (Arm_exidx_merge_section::section_contents_): New data member.
2616 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2617 (Arm_input_section::~Arm_input_section): De-allocate memory.
2618 (Arm_input_section::original_contents_): New data member.
2619 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2620 in parameters instead of calling Object::section_contents without
2621 locking.
2622 (Arm_output_section::group_section): New parameter TASK. Pass it
2623 to callees that need locking objects.
2624 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2625 to lock EXIDX input sections. Fix a formatting issue. Call
2626 Arm_exidx_merged_section::build_contents to create merged section
2627 contents.
2628 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2629 to lock object of stub table owner.
2630 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2631 TEXT_SIZE to initialize data member TEXT_SIZE_.
2632 (Arm_exidx_input_section::addralign): Fix typo in comment.
2633 (Arm_exidx_input_section::text_size): New method.
2634 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2635 that require locking objects. Lock objects before scanning for stubs
2636 and updating local symbols.
2637 (Arm_input_section<big_endian>::init): Copy contents of original
2638 input section.
2639 (Arm_input_section<big_endian>::do_write): Use saved contents of
2640 original input section instead of calling Object::section_contents
2641 without locking.
2642 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2643 size without calling Object::section_size().
2644 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2645 for size. Allocate a buffer for merged EXIDX entries.
2646 (Arm_exidx_merged_section::build_contents): New method.
2647 (Arm_exidx_merged_section::do_write): Move merge section contents
2648 building code to Arm_exidx_merged_section::build_contetns. Write
2649 out contetns in buffer instead of building it on the fly.
2650 (Arm_relobj::make_exidx_input_section): Also pass text section size
2651 to Arm_exidx_input_section constructor.
2652 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2653 (Arm_dynobj::do_read_symbols): Fix memory leak.
2654 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2655 * target.h: (class Task): Add forward declaration.
2656 (Target::relax): Add new parameter TASK and pass it to
2657 Target::do_relax().
2658 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2659
5f9bcf58
CC
26602010-11-05 Cary Coutant <ccoutant@google.com>
2661
2662 PR gold/10708
2663 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2664 object when reading from the file.
2665 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2666 second layout pass.
2667 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2668 when reading section contents.
2669 (get_section_contents): Likewise.
2670 (icf::find_identical_sections): Likewise.
2671 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2672 object when reading from the file.
2673 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2674 the object when doing deferred section layout.
2675
e597fa08
NC
26762010-11-03 Nick Clifton <nickc@redhat.com>
2677
2678 PR gold/12001
2679 * script.h (class Symbol_assignment: name): New member. Returns
2680 the name of the symbol.
2681 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2682 Returns true if the given symbol name is on the list of
2683 assignments wating to be processed.
2684 * archive.cc (should_incldue_member): If the symbol is undefined,
2685 check to see if it is on the list of symbols pending assignment.
2686
3f9a3278
ILT
26872010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2688
2689 * script-sections.cc (Script_sections::find_memory_region): Check
2690 for a NULL output section pointer.
2691
d06fb4d1
DK
26922010-10-29 Doug Kwan <dougkwan@google.com>
2693
2694 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2695 Output_section::add_relaxed_input_section.
2696 * output.cc (Output_section::add_relaxed_input_section): Add new
2697 arguments LAYOUT and NAME. Set section order index.
2698 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2699 Copy section order index.
2700 * output.h (Output_section::add_relaxed_input_section): Add new
2701 arguments LAYOUT and NAME.
2702
90e24de5
ILT
27032010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2704
2705 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2706 NATIVE_OR_CROSS_LINKER.
2707 * testsuite/Makefile.in: Regenerate.
2708
c9484ea5
DK
27092010-10-20 Doug Kwan <dougkwan@google.com>
2710
2711 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2712 without SHF_LINK_ORDER flags.
2713 * layout.cc (Layout::choose_output_section): Do not filter
2714 SHF_LINK_ORDER flag in a relocatable link.
2715
5bc2f5be
CC
27162010-10-17 Cary Coutant <ccoutant@google.com>
2717
2718 * output.h (Output_segment::set_section_addresses): Change function
2719 signature. Update all callers.
2720 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2721 sections.
2722 (Output_segment::set_section_addresses): Align after last TLS
2723 section. Add padding before last relro section instead of after.
2724
0c91cf04
DK
27252010-10-17 Doug Kwan <dougkwan@google.com>
2726
2727 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2728 GOT output section to be writable.
2729
8c21d9d3
CC
27302010-10-14 Cary Coutant <ccoutant@google.com>
2731
2732 * debug.h (DEBUG_INCREMENTAL): New flag.
2733 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2734 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2735 mode.
2736 * incremental.cc (report_command_line): Ignore all forms of
2737 --incremental.
2738 * layout.cc (Layout::Layout): Check parameters for incremental link
2739 mode.
2740 * options.cc (General_options::parse_incremental): New function.
2741 (General_options::parse_no_incremental): New function.
2742 (General_options::parse_incremental_full): New function.
2743 (General_options::parse_incremental_update): New function.
2744 (General_options::incremental_mode_): New data member.
2745 (General_options::finalize): Check incremental_mode_.
2746 * options.h (General_options): Update help text for --incremental.
2747 Add --no-incremental, --incremental-full, --incremental-update.
2748 (General_options::Incremental_mode): New enum type.
2749 (General_options::incremental_mode): New function.
2750 (General_options::incremental_mode_): New data member.
2751 * parameters.cc (Parameters::incremental_mode_): New data member.
2752 (Parameters::set_options): Set incremental_mode_.
2753 (Parameters::set_incremental_full): New function.
2754 (Parameters::incremental): New function.
2755 (Parameters::incremental_update): New function.
2756 (set_parameters_incremental_full): New function.
2757 * parameters.h (Parameters::set_incremental_full): New function.
2758 (Parameters::incremental): New function.
2759 (Parameters::incremental_update): New function.
2760 (Parameters::incremental_mode_): New data member.
2761 (set_parameters_incremental_full): New function.
2762 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2763 incremental link mode.
2764 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2765 (Sized_relobj::do_relocate_sections): Likewise.
2766 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2767 option.
2768 * testsuite/Makefile.in: Regenerate.
2769 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2770
bb32aa18 27712010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
2772
2773 * script-sections.h (class Script_sections): Make
2774 Sections_elements typedef public.
2775 * script-sections.cc (class Sort_output_sections): Add elements_
2776 field. Add constructor which sets it; change all callers.
2777 (Sort_output_sections::is_before): New function.
2778 (Sort_output_sections::operator()): Call is_before.
2779 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2780 conditional.
2781 * testsuite/script_test_10.sh: New test. Test script section
2782 order.
2783 * testsuite/script_test_10.t: Likewise.
2784 * testsuite/script_test_10.s: Likewise.
2785 * testsuite/Makefile.am: Wrap the cross linker tests and the
2786 common tests into NATIVE_OR_CROSS_LINKER.
2787 (check_SCRIPTS): Add script_test_10.sh.
2788 (check_DATA): Add script_test_10.stdout.
2789 (script_test_10.o, script_test_10): New targets.
2790 (script_test_10.stdout): New target.
2791 * configure, testsuite/Makefile.in: Regenerate.
2792
3cef7179
ILT
27932010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2794
2795 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2796 error for the deprecated relocations.
2797 (Target_arm::Scan::global): Likewise.
2798 (Target_arm::Relocate::relocate): Likewise.
2799
7411e9a8
RS
28002010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2801
2802 * fileread.cc (Input_file::find_file): Initialize *found_name
2803 and *namep when using the fallback search for case 4.
2804
6a9da32a
CC
28052010-10-11 Cary Coutant <ccoutant@google.com>
2806
2807 * options.h (class General_options): Redefine -z lazy as an alias for
2808 the negation of -z now.
2809
ac897c20
ILT
28102010-10-11 Ian Lance Taylor <iant@google.com>
2811
2812 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2813 binding.
2814
ea5cae92
NC
28152010-10-06 Nick Clifton <nickc@redhat.com>
2816
2817 * script-sections.cc(class Memory_region): Remove
2818 current_lma_offset_ field. Rename current_vma_offset_ to
2819 current_offset_. Add last_section_ field.
2820 (Memory_region::get_current_vma_address): Rename to
2821 get_current_address.
2822 (Memory_region::get_current_lma_address): Delete.
2823 (Memory_region::increment_vma_offset): Rename to
2824 increment_offset.
2825 (Memory_region::increment_lma_offset): Delete.
2826 (Memory_region::attributes_compatible): New method. Returns
2827 true if the provided section is compatible with the region.
2828 (Memory_region::get_last_section): New method. Returns the last
2829 section to use the region.
2830 (Memory_region::set_last_section): New method. Stores the last
2831 section to use the region.
2832 (Script_sections::block_in_region): New method. Returns true if
2833 a block of memory is contained within a region.
2834 (Script_sections::find_memory_region): New method. Locates a
2835 memory region to be used to set a VMA or LMA address.
2836 (Output_section_definition::set_section_addresses): Add code to
2837 check for addresses set by memory regions.
2838 (Output_segment::set_section_addresses): Remove memory region
2839 walking code.
2840 (Script_sections::create_segment): Add a warning if a header
2841 segment is created outside of any region.
2842 * script-sections.h (class Script_sections): Add prototypes for
2843 find_memory_region and block_in_region methods.
2844 * testsuite/memory_test.s: Use .long instead of .word.
2845 * testsuite/memory_test.t: Add some more output sections.
2846 * testsuite/memory_test.sh: Update expected output.
2847
a9bfd952
DK
28482010-10-02 Doug Kwan <dougkwan@google.com>
2849
2850 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2851 defintion to symtab.h
2852 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2853 declaration to defintion.
2854
bacff3ab
NC
28552010-10-01 Nick Clifton <nickc@redhat.com>
2856
2857 * expression.cc (eval): Replace dummy argument with NULL.
2858 (eval_maybe_dot): Check for a NULL result section pointer.
2859 (Symbol_expression::value): Likewise.
2860 (Dot_expression::value): Likewise.
2861 (BINARY_EXPRESSION): Likewise.
2862 (Max_expression::value): Likewise.
2863 (Min_expression::value): Likewise.
2864 (Absolute_expression::value): Likewise.
2865 (Addr_expression::value_from_output_section): Likewise.
2866 (Loaddddr_expression::value_from_output_section): Likewise.
2867 (Segment_start_expression::value): Likewise.
2868 * script-sections.cc
2869 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2870 argument with NULL.
2871 (Sections_elememt_dot_assignment::set_section_addresses):
2872 Likewise.
2873 (Output_data_expression::do_write_to_buffer): Likewise.
2874 (Output_section_definition::finalize_symbols): Likewise.
2875 (Output_section_definition::set_section_addresses): Likewise.
2876
f81bc8b5
DK
28772010-09-30 Doug Kwan <dougkwan@google.com>
2878
2879 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2880
c95e9f27
ST
28812010-09-28 Sriraman Tallam <tmsriram@google.com>
2882
2883 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 2884 function.
c95e9f27
ST
2885 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2886 virtual function.
2887 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2888 virtual function.
2889 * icf.cc (get_section_contents): Inline merge sections only when
2890 target allows it.
2891
3cac54d2
RW
28922010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2893
2894 * configure: Regenerate.
2895
2904037a
ILT
28962010-09-17 Ian Lance Taylor <iant@google.com>
2897
2898 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
2899 * testsuite/Makefile.am (memory_test.o): New target.
2900 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2901 memory_test.t.
2902 * testsuite/Makefile.in: Rebuild.
2904037a 2903
bca7fb63
DK
29042010-09-17 Doug Kwan <dougkwan@google.com>
2905
2906 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2907 defintion if relocation uses GOT entries of the symbol.
2908 * testsuite/icf_safe_test.sh: Fix test.
2909 * testsuite/icf_safe_so_test.sh: Fix test.
2910
4ef28648
CC
29112010-09-16 Cary Coutant <ccoutant@google.com>
2912
2913 * script_sections.cc (class Memory_region): Remove "NULL" from
2914 vector initializations.
2915
793990de
CC
29162010-09-15 Cary Coutant <ccoutant@google.com>
2917
2918 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2919 Resolve forwarding symbols.
2920
81e015e2
DK
29212010-09-15 Doug Kwan <dougkwan@google.com>
2922
2923 * gold/testsuite/script_test_3.t: Add ARM special sections.
2924 * gold/testsuite/script_test_4.t: Same.
2925 * gold/testsuite/script_test_5.t: Same.
2926 * gold/testsuite/script_test_6.t: Same.
2927 * gold/testsuite/script_test_7.t: Same.
2928 * gold/testsuite/script_test_7.t: Same.
2929 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2930
36171d64
CC
29312010-09-14 Cary Coutant <ccoutant@google.com>
2932
2933 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2934 (Target_x86_64::Relocate::relocate_tls): Replace check for
2935 saw_tls_block_reloc_ with test for executable section.
2936
d89051bd
CC
29372010-09-12 Cary Coutant <ccoutant@google.com>
2938
2939 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2940 position-independent executables to shared libraries need dynamic
2941 relocations.
2942 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2943 position-independent executables.
2944 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2945 * testsuite/Makefile.in: Regenerate.
2946
fca41f0f
NC
29472010-09-10 Nick Clifton <nickc@redhat.com>
2948
2949 PR gold/11997
2950 * testsuite/memory_test.t: Discard any sections that are not
2951 needed.
2952
6695e4b3
L
29532010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2954
2955 PR gold/11996
2956 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2957 "This::" to work around a bug in gcc 4.2.
2958
2959 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2960
0f72bf6f
RÁE
29612010-09-09 Rafael Espindola <espindola@google.com>
2962
2963 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2964 sections with different PF_X flags in the same segment.
2965 (Layout::find_first_load_seg): Search all segments to find the first
2966 one.
2967 * options.h (rosegment): New.
2968
29692010-09-08 Rafael Espindola <espindola@google.com>
a6577478 2970
05a79166 2971 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 2972
aa98ff75
DK
29732010-09-08 Doug Kwan <dougkwan@google.com>
2974
2975 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2976 (Arm_relobj::do_relocate_sections): Add new parameter for output
2977 file to match the parent.
2978 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2979 of local symbols instead of input values. Update code to track
2980 changes in gold::relocate_section.
2981 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2982 (Sized_relobj::compute_final_local_value_internal): New methods.
2983 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2984 body into private version of Sized_relobj::compute_final_local_value.
2985 Call the inline method.
2986 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2987 merged symbol value if there is one.
2988 (Symbol_value::has_output_value): New method defintiion.
2989 (Sized_relobj::Compute_final_local_value_status): New enum type.
2990 (Sized_relobj::compute_final_local_value): New methods.
2991 (Sized_relobj::compute_final_local_value_internal): New methods.
2992 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2993 and arm_cortex_a8.sh.
2994 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2995 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2996 New tests.
2997 * Makefile.in: Regenerate.
2998 * testsuite/arm_bl_out_of_range.s: Update test.
2999 * testsuite/thumb_bl_out_of_range.s: Ditto.
3000 * testsuite/thumb_blx_out_of_range.s: Ditto.
3001 * testsuite/arm_branch_out_of_range.sh: New file.
3002 * testsuite/arm_cortex_a8.sh: Ditto.
3003 * testsuite/arm_cortex_a8_b.s: Ditto.
3004 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
3005 * testsuite/arm_cortex_a8_b_local.s: Ditto.
3006 * testsuite/arm_cortex_a8_bl.s: Ditto.
3007 * testsuite/arm_cortex_a8_blx.s: Ditto.
3008 * testsuite/arm_cortex_a8_local.s: Ditto.
3009 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
3010 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
3011
05a79166
L
30122010-09-08 Rafael Espindola <espindola@google.com>
3013
3014 * Makefile.am (memory_test.stdout): Run readelf with -W.
3015 * Makefile.in: Regenerate.
3016 * testsuite/memory_test.sh: Make the regexps accept both 32 and
3017 64 bit output.
3018
33dbc701
RÁE
30192010-09-08 Rafael Espindola <espindola@google.com>
3020
3021 * script-sections.cc (Script_sections::add_memory_region): Convert
3022 field precision to int.
3023 * script.cc (script_set_section_region, script_set_section_region):
3024 Convert field precision to int.
3025
731ca54a
RÁE
30262010-09-08 Rafael Espindola <espindola@google.com>
3027
3028 * arm.cc (do_finalize_sections): Create the __exidx_start and
3029 __exdix_end symbols even when the section is missing.
3030
7f8cd844
NC
30312010-09-08 Nick Clifton <nickc@redhat.com>
3032
3033 * README: Remove claim that MEMORY is not supported.
3034 * expression.cc (script_exp_function_origin)
3035 (script_exp_function_length): Move from here to ...
3036 * script.cc: ... here.
3037 (script_set_section_region, script_add_memory)
3038 (script_parse_memory_attr, script_include_directive): New
3039 functions.
3040 * script-sections.cc
3041 (class Memory_region): New class.
3042 (class Output_section_definition): Add set_memory_region,
3043 set_section_vma, set_section_lma and get_section_name methods.
3044 (class Script_Sections): Add add_memory_region,
3045 find_memory_region, find_memory_region_origin,
3046 find_memory_region_length and set_memory_region methods.
3047 Have set_section_addresses method walk the list of set memory
3048 regions.
3049 Extend the print methos to display memory regions.
3050 * script-sections.h: Add prototypes for new methods.
3051 Add enum for MEMORY region attributes.
3052 * yyscript.y: Add support for parsing MEMORY regions.
3053 * script-c.h: Add prototypes for new functions.
3054 * testsuite/Makefile.am: Add test of MEMORY region functionality.
3055 * testsuite/Makefile.in: Regenerate.
3056 * testsuite/memory_test.sh: New script.
3057 * testsuite/memory_test.s: New assembler source file.
3058 * testsuite/memory_test.t: New linker script.
3059
a4649286
DK
30602010-08-27 Doug Kwan <dougkwan@google.com>
3061
3062 * gold/resolve.cc (Symbol_table::should_override): Let a weak
3063 reference override an existing dynamic weak reference.
3064 * testsuite/Makefile.am: Add new test dyn_weak_ref.
3065 * testsuite/Makefile.in: Regenerate.
3066 * testsuite/dyn_weak_ref.sh: New file.
3067 * testsuite/dyn_weak_ref_1.c: Ditto.
3068 * testsuite/dyn_weak_ref_2.c: Ditto.
3069
b56648ad
ILT
30702010-08-27 Ian Lance Taylor <iant@google.com>
3071
3072 * incremental.h (class Incremental_input_entry): Add virtual
3073 destructor.
3074
809313cb
ILT
30752010-08-27 Ian Lance Taylor <iant@google.com>
3076
3077 * testsuite/start_lib_test_3.c: Mark t3 as used.
3078
11e32464
NC
30792010-08-27 Nick Clifton <nickc@redhat.com>
3080
3081 * options.cc (version_script): Fix small typo in previous
3082 whitespace tidyup.
3083
ca09d69a
NC
30842010-08-25 Nick Clifton <nickc@redhat.com>
3085
3086 * archive.cc: Formatting fixes: Remove whitespace between
3087 typename and following asterisk. Remove whitespace between
3088 function name and opening parenthesis.
3089 * archive.h: Likewise.
3090 * arm.cc: Likewise.
3091 * attributes.cc: Likewise.
3092 * attributes.h: Likewise.
3093 * common.cc: Likewise.
3094 * copy-relocs.cc: Likewise.
3095 * dirsearch.h: Likewise.
3096 * dynobj.cc: Likewise.
3097 * ehframe.cc: Likewise.
3098 * ehframe.h: Likewise.
3099 * expression.cc: Likewise.
3100 * fileread.cc: Likewise.
3101 * fileread.h: Likewise.
3102 * gc.h: Likewise.
3103 * gold-threads.cc: Likewise.
3104 * gold.cc: Likewise.
3105 * i386.cc: Likewise.
3106 * icf.h: Likewise.
3107 * incremental-dump.cc: Likewise.
3108 * incremental.cc: Likewise.
3109 * layout.cc: Likewise.
3110 * layout.h: Likewise.
3111 * main.cc: Likewise.
3112 * merge.cc: Likewise.
3113 * merge.h: Likewise.
3114 * object.cc: Likewise.
3115 * object.h: Likewise.
3116 * options.cc: Likewise.
3117 * options.h: Likewise.
3118 * output.cc: Likewise.
3119 * output.h: Likewise.
3120 * plugin.cc: Likewise.
3121 * plugin.h: Likewise.
3122 * powerpc.cc: Likewise.
3123 * reloc.cc: Likewise.
3124 * script-c.h: Likewise.
3125 * script-sections.cc: Likewise.
3126 * script.cc: Likewise.
3127 * stringpool.cc: Likewise.
3128 * symtab.cc: Likewise.
3129 * symtab.h: Likewise.
3130 * target.cc: Likewise.
3131 * timer.cc: Likewise.
3132 * timer.h: Likewise.
3133 * version.cc: Likewise.
3134 * x86_64.cc: Likewise.
3135
b8fa8750
NC
31362010-08-24 Nick Clifton <nickc@redhat.com>
3137
3138 PR 11899
3139 * layout.cc (segment_precedes): Sort segments by their physical
3140 addresses, if they have been set.
3141
9919d93b
CC
31422010-08-23 Cary Coutant <ccoutant@google.com>
3143
3144 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
3145 symbols data.
3146 (Lib_group::include_member): Unlock object after deleting its
3147 symbols data.
3148 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
3149 the bug fixed here.
3150
97b4be1c
CC
31512010-08-19 Neil Vachharajani <nvachhar@google.com>
3152 Cary Coutant <ccoutant@google.com>
3153
3154 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
3155 constructor, and set_blocker.
3156 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
3157 readsyms_blocker_.
3158 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
3159 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
3160 * testsuite/Makefile.am (start_lib_test): New test case.
3161 * testsuite/Makefile.in: Regenerate.
3162 * testsuite/start_lib_test_main.c: New file.
3163 * testsuite/start_lib_test_1.c: New file.
3164 * testsuite/start_lib_test_2.c: New file.
3165 * testsuite/start_lib_test_3.c: New file.
3166
dd0b1884
ILT
31672010-08-19 Ian Lance Taylor <iant@google.com>
3168
3169 * Makefile.in: Rebuild with automake 1.11.1.
3170 * aclocal.m4: Likewise.
3171 * testsuite/Makefile.in: Likewise.
3172
7223e9ca
ILT
31732010-08-19 Ian Lance Taylor <iant@google.com>
3174
3175 PR 10893
3176 * i386.cc (class Output_data_plt_i386): Update declarations.
3177 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
3178 local_ifuncs_ fields.
3179 (Target_i386::do_plt_section_for_global): New function.
3180 (Target_i386::do_plt_section_for_local): New function.
3181 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
3182 parameter; change all callers. Initialize global_ifuncs_ and
3183 local_ifuncs_. If doing a static link define __rel_iplt_start and
3184 __rel_iplt_end.
3185 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
3186 (Output_data_plt_i386::add_local_ifunc_entry): New function.
3187 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
3188 symbols.
3189 (Target_i386::make_plt_section): New function, broken out of
3190 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
3191 (Target_i386::make_plt_entry): Call make_plt_section.
3192 (Target_i386::make_local_ifunc_plt_entry): New function.
3193 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
3194 (Target_i386::Scan::local): Handle IFUNC symbols. Add
3195 R_386_IRELATIVE to switch.
3196 (Target_i386::Scan::global): Likewise.
3197 (Target_i386::Relocate::relocate): Likewise.
3198 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
3199 switch.
3200 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
3201 (Target_x86_64::do_plt_section_for_global): New function.
3202 (Target_x86_64::do_plt_section_for_local): New function.
3203 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
3204 parameter; change all callers. If doing a static link define
3205 __rela_iplt_start and __rela_iplt_end.
3206 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
3207 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
3208 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
3209 to point to .plt.
3210 (Target_x86_64::make_local_ifunc_plt_entry): New function.
3211 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
3212 switch.
3213 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
3214 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
3215 R_X86_64_IRELATIVE to switch.
3216 (Target_x86_64::Scan::global): Likewise.
3217 (Target_x86_64::Relocate::relocate): Likewise.
3218 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
3219 switch.
3220 * target.h (class Target): Add plt_section_for_global and
3221 plt_section_for_local functions. Add do_plt_section_for_global
3222 and do_plt_section_for_local virtual functions.
3223 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
3224 clarifying comments.
3225 (Symbol::use_plt_offset): Handle IFUNC symbol.
3226 * object.cc (Sized_relobj::Sized_relobj): Initialize
3227 local_plt_offsets_.
3228 (Sized_relobj::local_has_plt_offset): New function.
3229 (Sized_relobj::local_plt_offset): New function.
3230 (Sized_relobj::set_local_plt_offset): New function.
3231 (Sized_relobj::do_count): Handle IFUNC symbol.
3232 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
3233 a bit away from input_shndx_ field. Add set_is_func_symbol and
3234 is_ifunc_symbol functions.
3235 (class Sized_relobj): Update declarations. Remove Tls_got_entry
3236 and Local_tls_got_offsets. Define Local_plt_offsets. Add
3237 local_plt_offsets_ field.
3238 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
3239 * output.h (class Output_section_data): Add non-const
3240 output_section function.
3241 (class Output_data_got): Update declarations.
3242 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
3243 Add use_plt_offset parameter to global and local constructors.
3244 Change all callers. Change local_sym_index_ field to 31 bits.
3245 Change GSYM_CODE and CONSTANT_CODE accordingly.
3246 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
3247 doing a static link don't set sh_link field.
3248 (Output_data_got::Got_entry::write): Use PLT offset if
3249 appropriate.
3250 (Output_data_got::add_global_plt): New function.
3251 (Output_data_got::add_local_plt): New function.
3252 * target-reloc.h (relocate_section): Handle IFUNC symbol.
3253 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
3254 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
3255 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
3256 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
3257 IFUNC conditional.
3258 * testsuite/ifunc-sel.h: New file.
3259 * testsuite/ifuncmain1.c: New file.
3260 * testsuite/ifuncmain1vis.c: New file.
3261 * testsuite/ifuncmod1.c: New file.
3262 * testsuite/ifuncdep2.c: New file.
3263 * testsuite/ifuncmain2.c: New file.
3264 * testsuite/ifuncmain3.c: New file.
3265 * testsuite/ifuncmod3.c: New file.
3266 * testsuite/ifuncmain4.c: New file.
3267 * testsuite/ifuncmain5.c: New file.
3268 * testsuite/ifuncmod5.c: New file.
3269 * testsuite/ifuncmain6pie.c: New file.
3270 * testsuite/ifuncmod6.c: New file.
3271 * testsuite/ifuncmain7.c: New file.
3272 * configure, testsuite/Makefile.in: Rebuild.
3273
56f75c03
ILT
32742010-08-18 Ian Lance Taylor <iant@google.com>
3275
3276 * incremental.cc
3277 (Output_section_incremental_inputs::write_input_files): Add cast
3278 to avoid signed/unsigned comparison warning.
3279 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3280
55455f89
CC
32812010-08-12 Cary Coutant <ccoutant@google.com>
3282
3283 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3284
e2054bcb
ILT
32852010-08-13 Ian Lance Taylor <iant@google.com>
3286
3287 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3288
74f67560
DK
32892010-08-12 Cary Coutant <ccoutant@google.com>
3290 Doug Kwan <dougkwan@google.com>
3291
3292 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3293 defintion overrides non-weak undef, remember that the original undef
3294 is not weak.
3295 * symtab.cc (Symbol_table::sized_write_global): For undef without
3296 an original weak binding, set binding to global in output.
3297 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3298 * testsuite/Makefile.in: Regenerate.
3299 * testsuite/strong_ref_weak_def.sh: New file.
3300 * testsuite/strong_ref_weak_def_1.c: Ditto.
3301 * testsuite/strong_ref_weak_def_2.c: Ditto.
3302
d1238d12
CC
33032010-08-12 Cary Coutant <ccoutant@google.com>
3304
3305 * testsuite/incremental_test.sh: Rewrite.
3306 * testsuite/incremental_test_1.c: Rewrite.
3307 * testsuite/incremental_test_2.c: Rewrite.
3308
0e70b911
CC
33092010-08-12 Cary Coutant <ccoutant@google.com>
3310
3311 * arm.cc (Target_arm::got_size): Add const.
3312 (Target_arm::got_entry_count): New function.
3313 (Target_arm::plt_entry_count): New function.
3314 (Target_arm::first_plt_entry_offset): New function.
3315 (Target_arm::plt_entry_size): New function.
3316 (Output_data_plt_arm::entry_count): New function.
3317 (Output_data_plt_arm::first_plt_entry_offset): New function.
3318 (Output_data_plt_arm::get_plt_entry_size): New function.
3319 * i386.cc (Target_i386::got_size): Add const.
3320 (Target_i386::got_entry_count): New function.
3321 (Target_i386::plt_entry_count): New function.
3322 (Target_i386::first_plt_entry_offset): New function.
3323 (Target_i386::plt_entry_size): New function.
3324 (Output_data_plt_i386::entry_count): New function.
3325 (Output_data_plt_i386::first_plt_entry_offset): New function.
3326 (Output_data_plt_i386::get_plt_entry_size): New function.
3327 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3328 find_incremental_inputs_sections. Dump incremental_got_plt section.
3329 * incremental.cc: Include target.h.
3330 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3331 parameter. Adjust all callers. Find incremental_got_plt section.
3332 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3333 section.
3334 (Output_section_incremental_inputs::set_final_data_size): Calculate
3335 size of incremental_got_plt section.
3336 (Output_section_incremental_inputs::do_write): Write the
3337 incremental_got_plt section.
3338 (Got_plt_view_info): New struct.
3339 (Local_got_offset_visitor): New class.
3340 (Global_got_offset_visitor): New class.
3341 (Global_symbol_visitor_got_plt): New class.
3342 (Output_section_incremental_inputs::write_got_plt): New function.
3343 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3344 Add parameter. Adjust all callers.
3345 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3346 (Incremental_inputs::got_plt_section): New function.
3347 (Incremental_inputs::got_plt_section_): New data member.
3348 (Incremental_got_plt_reader): New class.
3349 * layout.cc (Layout::create_incremental_info_sections): Add the
3350 incremental_got_plt section.
3351 * object.h (Got_offset_list::get_list): New function.
3352 (Got offset_list::for_all_got_offsets): New function.
3353 (Sized_relobj::local_got_offset_list): New function.
3354 * powerpc.cc (Target_powerpc::got_size): Add const.
3355 (Target_powerpc::got_entry_count): New function.
3356 (Target_powerpc::plt_entry_count): New function.
3357 (Target_powerpc::first_plt_entry_offset): New function.
3358 (Target_powerpc::plt_entry_size): New function.
3359 (Output_data_plt_powerpc::entry_count): New function.
3360 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3361 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3362 * sparc.cc (Target_sparc::got_size): Add const.
3363 (Target_sparc::got_entry_count): New function.
3364 (Target_sparc::plt_entry_count): New function.
3365 (Target_sparc::first_plt_entry_offset): New function.
3366 (Target_sparc::plt_entry_size): New function.
3367 (Output_data_plt_sparc::entry_count): New function.
3368 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3369 (Output_data_plt_sparc::get_plt_entry_size): New function.
3370 * symtab.h (Symbol::got_offset_list): New function.
3371 (Symbol_table::for_all_symbols): New function.
3372 * target.h (Sized_target::got_entry_count): New function.
3373 (Sized_target::plt_entry_count): New function.
3374 (Sized_target::plt_entry_size): New function.
3375 * x86_64.cc (Target_x86_64::got_size): Add const.
3376 (Target_x86_64::got_entry_count): New function.
3377 (Target_x86_64::plt_entry_count): New function.
3378 (Target_x86_64::first_plt_entry_offset): New function.
3379 (Target_x86_64::plt_entry_size): New function.
3380 (Output_data_plt_x86_64::entry_count): New function.
3381 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3382 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3383
09ec0418
CC
33842010-08-12 Cary Coutant <ccoutant@google.com>
3385
3386 * archive.cc: Include incremental.h.
3387 (Archive::Archive): Initialize incremental_info_.
3388 (Archive::include_member): Record archive members in incremental info.
3389 (Add_archive_symbols::run): Record begin and end of an archive in
3390 incremental info.
3391 (Lib_group::include_member): Record objects in incremental info.
3392 * archive.h (Incremental_archive_entry): Forward declaration.
3393 (Archive::set_incremental_info): New member function.
3394 (Archive::incremental_info): New member function.
3395 (Archive::Unused_symbol_iterator): New class.
3396 (Archive::unused_symbols_begin): New member function.
3397 (Archive::unused_symbols_end): New member function.
3398 (Archive::incremental_info_): New data member.
3399 * incremental-dump.cc (find_input_containing_global): New function.
3400 (dump_incremental_inputs): Dump new incremental info sections.
3401 * incremental.cc: Include symtab.h.
3402 (Output_section_incremental_inputs): New class.
3403 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3404 new incremental info sections.
3405 (Sized_incremental_binary::do_check_inputs): Likewise.
3406 (Incremental_inputs::report_archive): Remove.
3407 (Incremental_inputs::report_archive_begin): New function.
3408 (Incremental_inputs::report_archive_end): New function.
3409 (Incremental_inputs::report_object): New function.
3410 (Incremental_inputs::finalize_inputs): Remove.
3411 (Incremental_inputs::report_input_section): New function.
3412 (Incremental_inputs::report_script): Rewrite.
3413 (Incremental_inputs::finalize): Do nothing but finalize string table.
3414 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3415 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3416 (Incremental_inputs::create_data_sections): New function.
3417 (Incremental_inputs::relocs_entsize): New function.
3418 (Output_section_incremental_inputs::set_final_data_size): New function.
3419 (Output_section_incremental_inputs::do_write): New function.
3420 (Output_section_incremental_inputs::write_header): New function.
3421 (Output_section_incremental_inputs::write_input_files): New function.
3422 (Output_section_incremental_inputs::write_info_blocks): New function.
3423 (Output_section_incremental_inputs::write_symtab): New function.
3424 * incremental.h (Incremental_script_entry): Forward declaration.
3425 (Incremental_object_entry): Forward declaration.
3426 (Incremental_archive_entry): Forward declaration.
3427 (Incremental_inputs): Forward declaration.
3428 (Incremental_inputs_header_data): Remove.
3429 (Incremental_inputs_header): Remove.
3430 (Incremental_inputs_header_write): Remove.
3431 (Incremental_inputs_entry_data): Remove.
3432 (Incremental_inputs_entry): Remove.
3433 (Incremental_inputs_entry_write): Remove.
3434 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3435 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3436 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3437 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3438 Likewise.
3439 (Incremental_input_entry): New class.
3440 (Incremental_script_entry): New class.
3441 (Incremental_object_entry): New class.
3442 (Incremental_archive_entry): New class.
3443 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3444 (Incremental_inputs::report_inputs): Remove.
3445 (Incremental_inputs::report_archive): Remove.
3446 (Incremental_inputs::report_archive_begin): New function.
3447 (Incremental_inputs::report_archive_end): New function.
3448 (Incremental_inputs::report_object): Change prototype.
3449 (Incremental_inputs::report_input_section): New function.
3450 (Incremental_inputs::report_script): Change prototype.
3451 (Incremental_inputs::get_reloc_count): New function.
3452 (Incremental_inputs::set_reloc_count): New function.
3453 (Incremental_inputs::create_data_sections): New function.
3454 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3455 (Incremental_inputs::inputs_section): New function.
3456 (Incremental_inputs::symtab_section): New function.
3457 (Incremental_inputs::relocs_section): New function.
3458 (Incremental_inputs::get_stringpool): Add const.
3459 (Incremental_inputs::command_line): Add const.
3460 (Incremental_inputs::inputs): Remove.
3461 (Incremental_inputs::command_line_key): New function.
3462 (Incremental_inputs::input_file_count): New function.
3463 (Incremental_inputs::input_files): New function.
3464 (Incremental_inputs::relocs_entsize): New function.
3465 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3466 (Incremental_inputs::finalize_inputs): Remove.
3467 (Incremental_inputs::Input_info): Remove.
3468 (Incremental_inputs::lock_): Remove.
3469 (Incremental_inputs::inputs_): Change type.
3470 (Incremental_inputs::inputs_map_): Remove.
3471 (Incremental_inputs::current_object_entry_): New data member.
3472 (Incremental_inputs::inputs_section_): New data member.
3473 (Incremental_inputs::symtab_section_): New data member.
3474 (Incremental_inputs::relocs_section_): New data member.
3475 (Incremental_inputs::reloc_count_): New data member.
3476 (Incremental_inputs_reader): New class.
3477 (Incremental_symtab_reader): New class.
3478 (Incremental_relocs_reader): New class.
3479 * layout.cc (Layout::finalize): Move finalization of incremental info
3480 and creation of incremental info sections to follow finalization of
3481 symbol table. Set offsets for postprocessing sections.
3482 (Layout::create_incremental_info_sections): Call
3483 Incremental_inputs::create_data_sections. Add incremental symtab
3484 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3485 sections to layout after input sections.
3486 * layout.h (struct Timespec): Forward declaration.
3487 (Layout::incremental_inputs): Add const.
3488 (Layout::create_incremental_info_sections): Add parameter.
3489 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3490 * object.cc: Include incremental.h.
3491 (Relobj::finalize_incremental_relocs): New function.
3492 (Sized_relobj::do_layout): Record input sections in incremental info.
3493 * object.h (Object::output_section): New function.
3494 (Object::output_section_offset): Moved from Relobj.
3495 (Object::get_incremental_reloc_base): New function.
3496 (Object::get_incremental_reloc_count): New function.
3497 (Object::do_output_section): New function.
3498 (Object::do_output_section_offset): Moved from Relobj.
3499 (Object::do_get_incremental_reloc_base): New function.
3500 (Object::do_get_incremental_reloc_count): New function.
3501 (Object::Object): Initialize new data members.
3502 (Relobj::output_section): Renamed do_output_section and moved to
3503 protected.
3504 (Relobj::output_section_offset): Moved to Object.
3505 (Relobj::do_get_incremental_reloc_base): New function.
3506 (Relobj::do_get_incremental_reloc_count): New function.
3507 (Relobj::allocate_incremental_reloc_counts): New function.
3508 (Relobj::count_incremental_reloc): New function.
3509 (Relobj::finalize_incremental_relocs): New function.
3510 (Relobj::next_incremental_reloc_index): New function.
3511 (Relobj::reloc_counts_): New data member.
3512 (Relobj::reloc_bases_): New data member.
3513 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3514 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3515 (Sized_relobj::incremental_relocs_scan): New function.
3516 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3517 (Sized_relobj::incremental_relocs_write): New function.
3518 (Sized_relobj::incremental_relocs_write_reltype): New function.
3519 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3520 incremental link.
3521 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3522 archives and object files elsewhere.
3523 (Add_symbols::run): Report object files here.
3524 (Finish_group::run): Report end of archive at end of group.
3525 * reloc.cc: Include layout.h, incremental.h.
3526 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3527 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3528 (Sized_relobj::incremental_relocs_scan): New function.
3529 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3530 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3531 (Sized_relobj::incremental_relocs_write): New function.
3532 (Sized_relobj::incremental_relocs_write_reltype): New function.
3533 * script.cc (read_input_script): Rewrite test for incremental link.
3534 Change call to Incremental_inputs::report_script.
3535 * symtab.h (Symbol_table::first_global_index): New function.
3536 (Symbol_table::output_count): New function.
3537
ce0d1972
DK
35382010-08-12 Doug Kwan <dougkwan@google.com>
3539
3540 * arm.cc (Target_arm::merge_object_attributes): Check command line
3541 options --no-wchar-size-warning and --no-enum-size-warning.
3542 * options.h (General_options): Add ld-compatible options
3543 --no-enum-size-warning and --no-wchar-size-warning.
3544
6e5710ce
ILT
35452010-08-04 Ian Lance Taylor <iant@google.com>
3546
3547 * x86_64.cc (Target_x86_64::Scan::local): Use
3548 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3549 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3550 (Target_x86_64::Scan::global): Likewise.
3551 (Target_x86_64::Relocate::relocate): Likewise.
3552 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3553 Likewise.
3554
fef830db
CC
35552010-08-03 Cary Coutant <ccoutant@google.com>
3556
3557 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3558 to reserve space in merged_strings vector. Keep total input size
3559 for stats.
3560 (Output_merge_string::do_print_merge_stats): Print total input size.
3561 * merge.h (Output_merge_string): Add input_size_ field.
3562 * stringpool.cc (Stringpool_template::string_length): Move
3563 implementations out of Stringpool_template class and place in
3564 stringpool.h.
3565 * stringpool.h (string_length): Move out of Stringpool_template.
3566
1e3811b0
ILT
35672010-08-03 Ian Lance Taylor <iant@google.com>
3568
3569 PR 11712
3570 * layout.cc (relaxation_loop_body): If address of load segment is
3571 set, adjust address to include headers if possible.
3572
7af0c620
ILT
35732010-08-03 Ian Lance Taylor <iant@google.com>
3574
3575 * version.cc (version_string): Bump to 1.10.
3576
22f0da72
ILT
35772010-08-03 Ian Lance Taylor <iant@google.com>
3578
3579 PR 11805
3580 * layout.h (enum Output_section_order): Define.
3581 (class Layout): Update declarations.
3582 * layout.cc (Layout::get_output_section): Add order parameter.
3583 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3584 is_first_non_relro parameters. Change all callers.
3585 (Layout::choose_output_section): Likewise.
3586 (Layout::add_output_section_data): Likewise.
3587 (Layout::make_output_section): Likewise. Set order.
3588 (Layout::default_section_order): New function.
3589 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3590 * output.cc (Output_section::Output_section): Initialize order_.
3591 Don't initialize deleted fields.
3592 (Output_segment::Output_segment): Don't initialize deleted
3593 fields.
3594 (Output_segment::add_output_section_to_load): New function
3595 replacing add_output_section. Change all callers to call this or
3596 add_output_section_to_nonload.
3597 (Output_segment::add_output_section_to_nonload): New function.
3598 (Output_segment::remove_output_section): Rewrite.
3599 (Output_segment::add_initial_output_data): Likewise.
3600 (Output_segment::has_any_data_sections): Likewise.
3601 (Output_segment::is_first_section_relro): Likewise.
3602 (Output_segment::maximum_alignment): Likewise.
3603 (Output_segment::has_dynamic_reloc): New function replacing
3604 dynamic_reloc_count. Change all callers.
3605 (Output_segment::has_dynamic_reloc_list): New function replacing
3606 dynamic_reloc_count_list. Change all callers.
3607 (Output_segment::set_section_addresses): Rewrite.
3608 (Output_segment::set_offset): Rewrite.
3609 (Output_segment::find_first_and_last_list): Remove.
3610 (Output_segment::set_tls_offsets): Rewrite.
3611 (Output_segment::first_section_load_address): Likewise.
3612 (Output_segment::output_section_count): Likewise.
3613 (Output_segment::section_with_lowest_load_address): Likewise.
3614 (Output_segment::write_section_headers): Likewise.
3615 (Output_segment::print_sections_to_map): Likewise.
3616 * output.h (class Output_data): Remove dynamic_reloc_count_
3617 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3618 (Output_data::add_dynamic_reloc): Rewrite.
3619 (Output_data::has_dynamic_reloc): New function.
3620 (Output_data::dynamic_reloc_count): Remove.
3621 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3622 is_last_relro_, is_first_non_relro_, is_interp_,
3623 is_dynamic_linker_section_ fields. Add order and set_order
3624 functions. Remove is_relro_local, set_is_relro_local,
3625 is_last_relro, set_is_last_relro, is_first_non_relro,
3626 set_is_first_non_relro functions, is_interp, set_is_interp,
3627 is_dynamic_linker_section, and set_is_dynamic_linker_section
3628 functions.
3629 (class Output_segment): Change Output_data_list from std::list to
3630 std:;vector. Add output_lists_ field. Remove output_data_ and
3631 output_bss_ fields. Update declarations.
3632
3ff2ccb0
ILT
36332010-08-02 Ian Lance Taylor <iant@google.com>
3634
3635 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3636 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3637 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3638
88a4108b
ILT
36392010-08-02 Ian Lance Taylor <iant@google.com>
3640
3641 PR 11855
3642 * script.cc (Script_options::Script_options): Initialize
3643 symbol_definitions_ and symbol_references_.
3644 (Script_options::add_symbol_assignment): Update
3645 symbol_definitions_ and symbol_references_.
3646 (Script_options::add_symbol_reference): New function.
3647 (script_symbol): New function.
3648 * script.h (class Script_options): Add symbol_definitions_ and
3649 symbol_references_ fields.
3650 (Script_options::referenced_const_iterator): New type.
3651 (Script_options::referenced_begin): New function.
3652 (Script_options::referenced_end): New function.
3653 (Script_options::is_referenced): New function.
3654 (Script_options::any_unreferenced): New function.
3655 * script-c.h (script_symbol): Declare.
3656 * yyscript.y (exp): Call script_symbol.
3657 * symtab.cc: Include "script.h".
3658 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3659 Change all callers. Check symbols referenced by scripts.
3660 (Symbol_table::add_undefined_symbols_from_command_line): Add
3661 layout parameter. Change all callers.
3662 (Symbol_table::do_add_undefined_symbols_from_command_line):
3663 Likewise. Break out loop body. Check symbols referenced by
3664 scripts.
3665 (Symbol_table::add_undefined_symbol_from_command_line): New
3666 function broken out of
3667 do_add_undefined_symbols_from_command_line.
3668 * symtab.h (class Symbol_table): Update declarations.
3669 * archive.cc: Include "layout.h".
3670 (Archive::should_include_member): Add layout parameter. Change
3671 all callers. Check for symbol mentioned in expression.
3672 * archive.h (class Archive): Update declaration.
3673 * object.cc (Sized_relobj::do_should_include_member): Add layout
3674 parameter.
3675 * object.h (Object::should_include_member): Add layout parameter.
3676 Change all callers.
3677 (Object::do_should_include_member): Add layout parameter.
3678 (class Sized_relobj): Update declaration.
3679 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3680 parameter.
3681 * dynobj.h (class Sized_dynobj): Update declaration.
3682 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3683 layout parameter.
3684 * plugin.h (class Sized_pluginobj): Update declaration.
3685
5f1ab67a
ILT
36862010-08-02 Ian Lance Taylor <iant@google.com>
3687
3688 PR 11866
3689 * output.cc (Output_segment::set_offset): Search for the first and
3690 last sections rather than assuming that the list is in order.
3691 (Output_segment::find_first_and_last_list): New function.
3692 * output.h (class Output_segment): Update declarations.
3693 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3694 (relro_strip_test_SOURCES): New variable.
3695 (relro_strip_test_DEPENDENCIES): New variable.
3696 (relro_strip_test_LDFLAGS): New variable.
3697 (relro_strip_test_LDADD): New variable.
3698 (relro_strip_test.so): New target.
3699
a8df5856
ILT
37002010-08-02 Ian Lance Taylor <iant@google.com>
3701
3702 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3703 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3704 (Target_i386::got_tlsdesc_section): New function.
3705 (Target_i386::got_section): Create space for GOT entries for
3706 TLSDESC relocations.
3707 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3708 R_386_TLS_GOTDESC.
3709 (Target_i386::Scan::global): Likewise.
3710 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3711 using TLSDESC GOT.
3712 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3713 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3714 (Target_x86_64::got_tlsdesc_section): New function.
3715 (Target_x86_64::got_section): Create space for GOT entries for
3716 TLSDESC relocations.
3717 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3718 R_386_TLS_GOTDESC.
3719 (Target_x86_64::Scan::global): Likewise.
3720 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3721 using TLSDESC GOT.
3722
0c10a0a6
ILT
37232010-08-02 Ian Lance Taylor <iant@google.com>
3724
3725 * testsuite/final_layout.sh: Use dc to convert from hex to
3726 decimal.
3727
41cbeecc
ST
37282010-07-29 Sriraman Tallam <tmsriram@google.com>
3729
3730 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3731 paramter to the call to gold::gc_process_relocs.
3732 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3733 paramter to the call to gold::gc_process_relocs.
3734 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3735 parameter to the call to gold::gc_process_relocs.
3736 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3737 template parameter to the call to gold::gc_process_relocs.
3738 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3739 paramter to the call to gold::gc_process_relocs.
3740 * gc.h (get_embedded_addend_size): New function.
3741 (gc_process_relocs): Save the size of the reloc for use by ICF.
3742 * icf.cc (get_section_contents): Get the addend from the text section
3743 for SHT_REL relocation sections.
3744 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3745 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3746 * int_encoding.h (read_from_pointer): New overloaded function.
3747 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3748 * testsuite/icf_sht_rel_addend_test.sh: New file.
3749 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3750 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3751
6ea55b82
RW
37522010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3753
3754 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3755 * Makefile.in: Regenerate.
3756 * testsuite/Makefile.in: Regenerate.
3757
9691462b
ILT
37582010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3759
3760 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3761 * gold/testsuite/debug_msg.cc: Likewise.
3762 * gold/testsuite/odr_violation1.cc
3763 * gold/testsuite/odr_violation2.cc
3764
76897331
CC
37652010-07-21 Cary Coutant <ccoutant@google.com>
3766
3767 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3768 string, and length fields.
3769 (Output_merge_string::Merged_strings_list): New type.
3770 (Output_merge_string::Merged_strings_lists): New typedef.
3771 (Output_merge_string): Replace merged_strings_ with
3772 merged_strings_lists_.
3773 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3774 Merged_strings_list per input object and section. Don't store pointer
3775 to the string. Don't store length with each merged string entry.
3776 (Output_merge_string::finalize_merged_data): Loop over list of merged
3777 strings lists. Recompute length of each merged string.
3778
78384e8f
CC
37792010-07-15 Cary Coutant <ccoutant@google.com>
3780
3781 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3782 here.
3783
783659f9
ILT
37842010-07-14 Ian Lance Taylor <iant@google.com>
3785
3786 * descriptors.cc (Descriptors::open): Report correct name in error
3787 message.
3788
131687b4
DK
37892010-07-13 Doug Kwan <dougkwan@google.com>
3790
3791 * arm.cc (Arm_input_section::Arm_input_section): For a
3792 SHT_ARM_EXIDX section, always keeps the input sections.
3793 (Arm_input_section::set_exidx_section_link): New method.
3794 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3795 has_errors_ to false.
3796 (Arm_exidx_input_section::has_errors,
3797 Arm_exidx_input_section::set_has_errors): New methods.
3798 (Arm_exidx_input_section::has_errors_): New data member.
3799 (Arm_relobj::get_exidx_shndx_list): New method.
3800 (Arm_output_section::append_text_sections_to_list): Do not skip
3801 section without SHF_EXECINSTR.
3802 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3803 errors.
3804 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3805 section header. Make error messages more verbose. Check for
3806 a non-executable section linked to an EXIDX section.
3807 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3808 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3809 check that there is no deferred EXIDX section if we exit early.
3810 Instead of not making an EXIDX section in case of an error, make one
3811 and set the has_errors flag of it.
3812 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3813 in a relocatable link.
3814 (Target_arm::do_relax): Look for the EXIDX output section instead of
3815 assuming that it is called .ARM.exidx.
3816 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3817 section list. Do not check for SHF_EXECINSTR section flags but
3818 skip any input section with errors.
3819 * output.cc (Output_section::Output_section): Initialize
3820 always_keeps_input_sections_ to false.
3821 (Output_section::add_input_section): Check for
3822 always_keeps_input_sections_.
3823 * output.h (Output_section::always_keeps_input_sections,
3824 Output_section::set_always_keeps_input_sections): New methods.
3825 (Output_section::always_keeps_input_sections): New data member.
3826
69517287
RÁE
38272010-07-13 Rafael Espindola <espindola@google.com>
3828
3829 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3830 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3831
82742395
ILT
38322010-07-13 Philip Herron <herron.philip@googlemail.com>
3833 Ian Lance Taylor <iant@google.com>
3834
3835 * output.h (Output_section_lookup_maps::add_merge_section):
3836 Correct check of whether value was inserted.
3837 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3838 (Output_section_lookup_maps::add_relaxed_input_section):
3839 Likewise.
3840 * arm.cc (Target_arm::got_section): Remove used local os.
3841 * i386.cc (Target_i386::got_section): Likewise.
3842 * x86_64.cc (Target_x86_64::got_section): Likewise.
3843 * sparc.cc (Target_sparc::got_section): Likewise.
3844 (Target_sparc::relocate): Remove unused local have_got_offset.
3845 * powerpc.cc (Target_powerpc::relocate): Likewise.
3846
f2d707b5
ILT
38472010-07-13 Ian Lance Taylor <iant@google.com>
3848
241531d6
ILT
3849 * compressed_output.cc (zlib_decompress): Fix signature in
3850 !HAVE_ZLIB_H case.
3851
f2d707b5
ILT
3852 * archive.cc (Archive::include_member): Unlock an external member
3853 of a thin archive. Don't bother to delete an object we know is
3854 NULL.
3855
a2e47362
CC
38562010-07-12 Cary Coutant <ccoutant@google.com>
3857
3858 * compressed_output.cc (zlib_decompress): New function.
3859 (get_uncompressed_size): New function.
3860 (decompress_input_section): New function.
3861 * compressed_output.h (get_uncompressed_size): New function.
3862 (decompress_input_section): New function.
3863 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3864 Handle compressed debug sections.
3865 * layout.cc (is_compressed_debug_section): New function.
3866 (Layout::output_section_name): Map compressed section names to
3867 canonical names.
3868 * layout.h (is_compressed_debug_section): New function.
3869 (is_debug_info_section): Recognize compressed debug sections.
3870 * merge.cc: Include compressed_output.h.
3871 (Output_merge_data::do_add_input_section): Handle compressed
3872 debug sections.
3873 (Output_merge_string::do_add_input_section): Handle compressed
3874 debug sections.
3875 * object.cc: Include compressed_output.h.
3876 (Sized_relobj::Sized_relobj): Initialize new data members.
3877 (build_compressed_section_map): New function.
3878 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3879 * object.h (Object::section_is_compressed): New method.
3880 (Object::do_section_is_compressed): New method.
3881 (Sized_relobj::Compressed_section_map): New type.
3882 (Sized_relobj::do_section_is_compressed): New method.
3883 (Sized_relobj::compressed_sections_): New data member.
3884 * output.cc (Output_section::add_input_section): Handle compressed
3885 debug sections.
3886 * reloc.cc: Include compressed_output.h.
3887 (Sized_relobj::write_sections): Handle compressed debug sections.
3888
ce279a62
CC
38892010-07-08 Cary Coutant <ccoutant@google.com>
3890
3891 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3892 weak when resolving to a dynamic def.
3893 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3894 for weak undef/dynamic def cases. Adjust callers.
3895 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3896 undef_binding_weak_.
3897 (Symbol_table::sized_write_globals): Adjust symbol binding.
3898 (Symbol_table::sized_write_symbol): Add binding parameter.
3899 * symtab.h (Symbol::set_undef_binding): New method.
3900 (Symbol::is_undef_binding_weak): New method.
3901 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3902 (Symbol_table::should_override): Add new parameter.
3903 (Symbol_table::sized_write_symbol): Add new parameter.
3904
3905 * testsuite/weak_undef_file1.cc: Add new test case.
3906 * testsuite/weak_undef_file2.cc: Fix header comment.
3907 * testsuite/weak_undef_test.cc: Add new test case.
3908
b2286c10
DK
39092010-06-29 Doug Kwan <dougkwan@google.com>
3910
3911 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3912 Initialize USE_SYMBOL_.
3913 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3914 definition.
3915 (Arm_reloc_property::uses_symbol_): New data member declaration.
3916 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3917 uses symbol value and symbol is undefined but not weakly undefined.
3918
4802450a
RÁE
39192010-06-28 Rafael Espindola <espindola@google.com>
3920
3921 * plugin.cc (Plugin::load): Use dlerror.
3922
e5ca47ba
ILT
39232010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3924
3925 * symtab.cc (detect_odr_violations): When reporting an ODR
3926 violation, report an object where the symbol is defined.
3927
8a75a161
DK
39282010-06-25 Doug Kwan <dougkwan@google.com>
3929
3930 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3931 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3932 definition.
3933 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3934 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3935 target hook to detect function points.
3936 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3937 * icf.h (Icf::check_section_for_function_pointers): Change type of
3938 parameter SECTION_NAME to const reference to std::string. Use
3939 target hook to determine if section may have unsafe pointers.
3940 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3941 method definition.
3942
42218b9f
RÁE
39432010-06-21 Rafael Espindola <espindola@google.com>
3944
3945 * fileread.cc (Input_file::find_fie): New
3946 (Input_file::open): Use Input_file::find_fie.
3947 * fileread.h (Input_file::find_fie): New
3948 * plugin.cc (set_extra_library_path): New.
3949 (Plugin::load): Add set_extra_library_path to the transfer vector.
3950 (Plugin_manager::set_extra_library_path): New.
3951 (Plugin_manager::add_input_file): Use the extra search path if set.
3952 (set_extra_library_path(): New.
3953 * plugin.h (Plugin_manager): Add set_extra_library_path and
3954 extra_search_path_.
3955
a0506cca
CC
39562010-06-19 Cary Coutant <ccoutant@google.com>
3957
3958 * layout.cc (gdb_sections): Add .debug_types.
3959 (lines_only_debug_sections): Likewise.
3960
6508b958
RÁE
39612010-06-18 Rafael Espindola <espindola@google.com>
3962
3963 * plugin.cc (add_input_file,add_input_library)
3964 (Plugin_manager::add_input_file): Make filename arguments const.
3965 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3966 const.
3967
3e235302
DK
39682010-06-16 Doug Kwan <dougkwan@google.com>
3969
3970 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3971 .ARM.attributes section if we have not merged any input
3972 attributes sections.
3973
106e8a6c
DK
39742010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3975
3976 * arm.cc: Allow combining objects with no EABI version
3977 information.
3978
91ff43fe
RÁE
39792010-06-15 Rafael Espindola <espindola@google.com>
3980
3981 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3982
68ed838c
ILT
39832010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3984
3985 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3986 (struct iovec): Correct !HAVE_READV definition.
3987
f3a2388f
CC
39882010-06-10 Cary Coutant <ccoutant@google.com>
3989
3990 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3991 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3992 reloc sections.
3993 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3994
3995 PR 11683
3996 * symtab.h (Symbol::is_placeholder): New member function.
3997 * target-reloc.h (relocate_section): Check for placeholder symbols.
3998
3999 * testsuite/Makefile.am (plugin_test_8): New test.
4000 (plugin_test_9): New test.
4001 * testsuite/Makefile.in: Regenerate.
4002
e1df38aa
NC
40032010-06-09 Nick Clifton <nickc@redhat.com>
4004
4005 * yyscript.y (input_list_element): Allow strings prefixed with
4006 the '-' character. Treat these as libraries.
4007 * script.cc (script_add_library): New function. Adds a library
4008 specified by "-l<name>" found in an input script.
4009 * script-c.h: Add prototype for script_add_library.
4010
25bbe950
DK
40112010-06-07 Doug Kwan <dougkwan@google.com>
4012
4013 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
4014 Restrict stub-group size to be within long conditional branch
4015 range when working around cortex-A8 erratum.
4016
0f32ea4c
ILT
40172010-06-07 Damien Diederen <dd@crosstwine.com>
4018
4019 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
4020 #ifdef typo.
4021
8fe2a369
ST
40222010-06-03 Sriraman Tallam <tmsriram@google.com>
4023
4024 PR gold/11658
4025 * output.cc
4026 (Output_section::Input_section_sort_entry::compare_section_ordering):
4027 Change to return non-zero correctly.
4028 (Output_section::Input_section_sort_section_order_index_compare
4029 ::operator()): Change to fix ambiguity in comparisons.
4030
6e9ba2ca
ST
40312010-06-01 Sriraman Tallam <tmsriram@google.com>
4032
4033 * gold.h (is_wildcard_string): New function.
4034 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
4035 (Layout::layout_eh_frame): Ditto.
4036 (Layout::find_section_order_index): New method.
4037 (Layout::read_layout_from_file): New method.
4038 * layout.h (Layout::find_section_order_index): New method.
4039 (Layout::read_layout_from_file): New method.
4040 (Layout::input_section_position_): New private member.
4041 (Layout::input_section_glob_): New private member.
4042 * main.cc (main): Call read_layout_from_file here.
4043 * options.h (--section-ordering-file): New option.
4044 * output.cc (Output_section::input_section_order_specified_): New
4045 member.
4046 (Output_section::Output_section): Initialize new member.
4047 (Output_section::add_input_section): Add new parameter.
4048 Keep input sections when --section-ordering-file is used.
4049 (Output_section::set_final_data_size): Sort input sections when
4050 section ordering file is specified.
4051 (Output_section::Input_section_sort_entry): Add new parameter.
4052 Check sorting type.
4053 (Output_section::Input_section_sort_entry::compare_section_ordering):
4054 New method.
4055 (Output_section::Input_section_sort_compare::operator()): Change to
4056 consider section_order_index.
4057 (Output_section::Input_section_sort_init_fini_compare::operator()):
4058 Change to consider section_order_index.
4059 (Output_section::Input_section_sort_section_order_index_compare
4060 ::operator()): New method.
4061 (Output_section::sort_attached_input_sections): Change to sort
4062 according to section order when specified.
e1df38aa
NC
4063 (Output_section::add_input_section<32, true>): Add new parameter.
4064 (Output_section::add_input_section<64, true>): Add new parameter.
4065 (Output_section::add_input_section<32, false>): Add new parameter.
4066 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
4067 * output.h (Output_section::add_input_section): Add new parameter.
4068 (Output_section::input_section_order_specified): New
4069 method.
4070 (Output_section::set_input_section_order_specified): New method.
4071 (Input_section::Input_section): Initialize section_order_index_.
4072 (Input_section::section_order_index): New method.
4073 (Input_section::set_section_order_index): New method.
4074 (Input_section::section_order_index_): New member.
4075 (Input_section::Input_section_sort_section_order_index_compare): New
4076 struct.
4077 (Output_section::input_section_order_specified_): New member.
4078 * script-sections.cc (is_wildcard_string): Delete and move modified
4079 method to gold.h.
4080 (Output_section_element_input::Output_section_element_input): Modify
4081 call to is_wildcard_string.
4082 (Output_section_element_input::Input_section_pattern
4083 ::Input_section_pattern): Ditto.
4084 (Output_section_element_input::Output_section_element_input): Ditto.
4085 * testsuite/Makefile.am (final_layout): New test case.
4086 * testsuite/Makefile.in: Regenerate.
4087 * testsuite/final_layout.cc: New file.
4088 * testsuite/final_layout.sh: New file.
4089
3537c84b
RÁE
40902010-06-01 Rafael Espindola <espindola@google.com>
4091
4092 * plugin.cc (Plugin::load): Pass the output name to the plugin.
4093
105b6afd
RÁE
40942010-06-01 Rafael Espindola <espindola@google.com>
4095
4096 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
4097 visibility of symbols.
4098
29e11421
DK
40992010-05-27 Doug Kwan <dougkwan@google.com>
4100
4101 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
4102 from start of output section instead of address for a local symbol
4103 in a merged or relaxed section when doing a relocatable link.
4104
5e0f337e
RÁE
41052010-05-26 Rafael Espindola <espindola@google.com>
4106
4107 PR 11604
4108 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
4109 adding sections the garbage collector removed.
4110 * gold/testsuite/Makefile.am: Add test.
4111 * gold/testsuite/Makefile.in: Regenerate.
4112 * gold/testsuite/plugin_test_7.sh: New.
4113 * gold/testsuite/plugin_test_7_1.c: New.
4114 * gold/testsuite/plugin_test_7_2.c: New.
4115
f4187277
RÁE
41162010-05-26 Rafael Espindola <espindola@google.com>
4117
4118 * script-sections.cc (Output_section_definition::set_section_addresses):
4119 Check for --section-start.
4120
5c388529
DK
41212010-05-26 Doug Kwan <dougkwan@google.com>
4122
4123 * arm.cc (Arm_scan_relocatable_relocs): New class.
4124 (Target_arm::relocate_special_relocatable): New method.
4125 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
4126 (Arm_relocate_functions::thumb_branch_common): Same.
4127 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
4128 instead of Default_scan_relocatable_relocs.
4129 * target-reloc.h (relocate_for_relocatable): Let target handle
4130 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
4131 * target.h (Sized_target::relocate_special_relocatable): New method.
4132
bca1c3ae
ILT
41332010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4134
4135 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
4136
0439c796
DK
41372010-05-23 Doug Kwan <dougkwan@google.com>
4138
4139 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
4140 instead of a cast.
4141 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
4142 with a direct branch, not a conditional branch, to a stub.
4143 * merge.cc (Output_merge_base::record_input_section): New method
4144 defintion.
4145 (Output_merge_data::do_add_input_section): Record input section if
4146 keeps-input-sections flag is set.
4147 (Output_merge_string::do_add_input_section): Ditto.
4148 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
4149 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
4150 INPUT_SECTIONS_.
4151 (Output_merge_base::keeps_input_sections,
4152 Output_merge_base::set_keeps_input_sections,
4153 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
4154 method definitions.
4155 (Output_merge_base::Input_sections): New type declaration.
4156 (Output_merge_base::input_sections_begin,
4157 Output_merge_base::input_sections_end,
4158 Output_merge_base::do_set_keeps_input_sections): New method definitions.
4159 (Output_merge_base::bool keeps_input_sections_,
4160 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
4161 Output_merge_base::input_sections_): New data members.
4162 (Output_merge_data::do_set_keeps_input_sections): New method
4163 defintion.
4164 (Output_merge_string::do_set_keeps_input_sections): Ditto.
4165 * output.cc (Output_section::Input_section::relobj): Move method
4166 defintion from class declaration to here and handle merge sections.
4167 (Output_section::Input_section::shndx): Ditto.
4168 (Output_section::Output_section): Remove initializations of removed
4169 data members and initialize new data member LOOKUP_MAPS_.
4170 (Output_section::add_input_section): Set keeps-input-sections flag
4171 for a newly created merge output section as appropriate. Adjust code
4172 to use Output_section_lookup_maps class.
4173 (Output_section::add_relaxed_input_section): Adjst code for lookup
4174 maps code refactoring.
4175 (Output_section::add_merge_input_section): Add a new parameter
4176 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
4177 class. If adding input section to a newly created merge output
4178 section fails, remove the new merge section.
4179 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 4180 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
4181 (Output_section::find_merge_section): Ditto.
4182 (Output_section::build_lookup_maps): New method defintion.
4183 (Output_section::find_relaxed_input_section): Adjust code to use
4184 Output_section_lookup_maps class.
4185 (Output_section::get_input_sections): Export merge sections. Adjust
4186 code to use Output_section_lookup_maps class.
4187 (Output_section:::add_script_input_section): Adjust code to use
4188 Output_section_lookup_maps class. Update lookup maps for merge
4189 sections also.
4190 (Output_section::discard_states): Use Output_section_lookup_maps.
4191 (Output_section::restore_states): Same.
4192 * output.h (Merge_section_properties): Move class defintion out of
4193 Output_section.
4194 (Output_section_lookup_maps): New class.
4195 (Output_section::Input_section::is_merge_section): New method
4196 defintion.
4197 (Output_section::Input_section::relobj): Move defintion out of class
4198 defintion. Declare method only.
4199 (Output_section::Input_section::shndx): Ditto.
4200 (Output_section::Input_section::output_merge_base): New method defintion.
4201 (Output_section::Input_section::u2_.pomb): New union field.
4202 (Output_section::Merge_section_by_properties_map,
4203 Output_section::Output_section_data_by_input_section_map,
4204 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
4205 Remove types.
4206 (Output_section::add_merge_input_section): Add new parameter
4207 KEEPS_INPUT_SECTIONS.
4208 (Output_section::build_lookup_maps): New method declaration.
4209 (Output_section::merge_section_map_,
4210 Output_section::merge_section_by_properties_map_,
4211 Output_section::relaxed_input_section_map_,
4212 Output_section::is_relaxed_input_section_map_valid_): Remove data
4213 members.
4214 (Output_section::lookup_maps_): New data member.
4215
76295588
L
42162010-05-21 Doug Kwan <dougkwan@google.com>
4217
4218 PR gold/11619
4219 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
4220 avoid a compilation error.
4221
d103a984
RÁE
42222010-05-19 Rafael Espindola <espindola@google.com>
4223
4224 * script-sections.cc (Output_section_definition::allocate_to_segment):
4225 Update the phdrs_list even when the output section is NULL.
4226 * testsuite/Makefile.am: Add test.
4227 * testsuite/Makefile.in: Regenerate.
4228 * testsuite/script_test_9.cc: New.
4229 * testsuite/script_test_9.sh: New.
4230 * testsuite/script_test_9.t: New.
4231
6625d24e
DK
42322010-05-19 Doug Kwan <dougkwan@google.com>
4233
4234 * arm.cc (Arm_input_section::original_size): New method.
4235 (Arm_input_section::do_addralign): Add a cast.
4236 (Arm_input_section::do_output_offset): Remove static cast.
4237 (Arm_input_section::original_addralign,
4238 Arm_input_section::original_size_): Change type to uint32_t.
4239 (Arm_input_section::init): Add safe casts for section alignment
4240 and size.
4241 (Arm_input_section::set_final_data_size): Do not set address and
4242 offset of stub table.
4243 (Arm_output_section::fix_exidx_coverage): Change use of of
4244 Output_section::Simple_input_section to that of
4245 Output_section::Input_section.
4246 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
4247 except for the first pass.
4248 * output.cc (Output_section::get_input_sections): Change type of
4249 input_sections to std::list<Input_section>.
4250 (Output_section::add_script_input_section): Rename from
4251 Output_section::add_simple_input_section. Change type of SIS
4252 parameter from Simple_input_section to Input_section.
4253 * output.h (Output_section::Simple_input_section): Remove class.
4254 (Output_section::Input_section): Change class visibility to public.
4255 (Output_section::Input_section::addralign): Use stored alignments
4256 for special input sections if set.
4257 (Output_section::Input_section::set_addralign): New method.
4258 (Output_section::get_input_sections): Change parameter type from
4259 list of Simple_input_section to list of Input_section.
4260 (Output_section::add_script_input_section): Rename from
4261 Output_section::add_simple_input_section. Change first parameter's
4262 type from Simple_input_section to Input_section and remove the
4263 second and third parameters.
4264 * script-sections.cc (Input_section::Input_section_list): Change
4265 type to list of Output_section::Input_section/
4266 (Input_section_info::Input_section_info): Change parameter type of
4267 INPUT_SECTION to Output_section::Input_section.
4268 (Input_section_info::input_section): Change return type.
4269 (Input_section_info::input_section_): Change type to
4270 Output_section::Input_section.
4271 (Output_section_element_input::set_section_addresses): Adjust code
4272 to use Output_section::Input_section instead of
4273 Output_section::Simple_input_section. Adjust code for renaming
4274 of Output_section::add_simple_input_section.
4275 (Orphan_output_section::set_section_addresses): Ditto.
4276
e1e82ea4
RW
42772010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4278
4279 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4280 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4281
91e75c8a
RÁE
42822010-05-18 Rafael Espindola <espindola@google.com>
4283
4284 * options.cc (General_options::finalize): Handle -nostdlib.
4285 * options.h (nostdlib): New option.
4286 * script.cc (script_add_search_dir): Handle -nostdlib.
4287
da59ad79
DK
42882010-05-12 Doug Kwan <dougkwan@google.com>
4289
4290 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4291 attributes section only if there no attributes section after merging.
4292 (Target_arm::merge_object_attributes): Move value of
e1df38aa 4293 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
4294 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4295 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4296 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4297 and arm_attr_merge_7.stdout.
4298 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4299 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4300 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4301 arm_attr_merge_7b.o): New rules.
4302 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4303 arm_attr_merge_7
4304 * testsuite/Makefile.in: Regenerate.
4305 * testsuite/arm_attr_merge.sh: New file.
4306 * testsuite/arm_attr_merge_[67][ab].s: Same.
4307
3e01a7fd
NC
43082010-05-05 Nick Clifton <nickc@redhat.com>
4309
4310 * po/es.po: Updated Spanish translation.
4311
7ad2014a
L
43122010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4313
4314 * Makefile.am (install-exec-local): Properly install gold as
4315 default cross linker.
4316 * Makefile.in: Regenerated.
4317
4fda8867
NC
43182010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4319 Nick Clifton <nickc@redhat.com>
4320
4321 * configure.ac (install_as_default): Define and set to false
4322 unless --enable-gold or --enable-gold=both/gold has been
4323 specified.
4324 * configure: Regenerate.
4325
4326 * Makefile.am (install-exec-local): Install the executable as
4327 'ld.gold'. If install_as_default is true then also install it as
4328 'ld'.
4329 * Makefile.in: Regenerated.
4330
bd288ea2
ILT
43312010-04-24 Ian Lance Taylor <iant@google.com>
4332
4333 * layout.cc (Layout::layout_reloc): In relocatable link don't
4334 combine reloc sections for grouped sections.
4335
ef38fd8a
ST
43362010-04-23 Sriraman Tallam <tmsriram@google.com>
4337
4338 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4339 sections that are not ordinary to icf.
4340 * icf.cc (get_section_contents): Handle relocation pointing to section
4341 with no object or shndx information.
4342 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4343 * testsuite/Makefile.in: Regenerate.
4344 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4345 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4346
f6973bdc
ILT
43472010-04-22 Ian Lance Taylor <iant@google.com>
4348
4349 * expression.cc (Expression::Expression_eval_info): Add
4350 result_alignment_pointer field.
4351 (Expression::eval_with_dot): Add result_alignment_pointer
4352 parameter. Change all callers.
4353 (Expression::eval_maybe_dot): Likewise.
4354 (class Binary_expression): Add alignment_pointer parameter to
4355 left_value and right_value. Change all callers.
4356 (BINARY_EXPRESSION): Set result alignment.
4357 (class Trinary_expression): Add alignment_pointer parameter to
4358 arg2_value and arg3_value. Change all callers.
4359 (Trinary_cond::value): Set result alignment.
4360 (Max_expression::value, Min_expression::value): Likewise.
4361 (Align_expression::value): Likewise.
4362 * script-sections.cc (class Sections_element): Add dot_alignment
4363 parameter to set_section_addresses virtual function. Update
4364 instantiations.
4365 (class Output_section_element): Likewise.
4366 (Script_sections::create_segments): Add dot_alignment parameter.
4367 Change all callers.
4368 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4369 (Script_sections::set_phdrs_clause_addresses): Likewise.
4370 * script-sections.h: Update declarations.
4371 * script.h: Update declarations.
4372 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4373 min_p_align.
4374 * testsuite/script_test_3.t: Set large alignment.
4375 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4376 segment has expected alignment.
4377
9c9c98a5
NC
43782010-04-22 Nick Clifton <nickc@redhat.com>
4379
4380 * po/gold.pot: Updated by the Translation project.
4381 * po/vi.po: Updated Vietnamese translation.
4382
2253bfba
L
43832010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4384
4385 * testsuite/Makefile.am (check_PROGRAMS): Add
4386 icf_virtual_function_folding_test.
4387 * testsuite/Makefile.in: Regenerated.
4388
85fdf906
AH
43892010-04-15 Andrew Haley <aph@redhat.com>
4390
4391 * options.h (merge_exidx_entries): New option.
4392 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4393 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4394 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4395 (Target_arm::merge_exidx_entries): New function.
4396 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4397 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4398 to Arm_exidx_fixup constructor.
4399 Add new arg, merge_exidx_entries.
4400 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4401 Arm_output_section::fix_exidx_coverage.
4402
ce97fa81
ST
44032010-04-18 Sriraman Tallam <tmsriram@google.com>
4404
4405 * icf.cc (get_section_contents): Check for preemptible functions.
4406 Ignore addend when appropriate.
4407 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4408 section folded.
4409 (add_from_relobj): Check for section folded.
4410 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4411 * symtab.h (should_add_dynsym_entry): Add new parameter.
4412 * target-reloc.h (scan_relocs): Check for section folded.
4413 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4414 Check reloc types for function pointers in shared objects.
4415 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4416 case.
4417 (icf_preemptible_functions_test): New test case.
4418 (icf_string_merge_test): New test case.
4419 * testsuite.Makefile.in: Regenerate.
4420 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4421 bar_glob. Refactor code.
4422 * testsuite/icf_preemptible_functions_test.cc: New file.
4423 * testsuite/icf_preemptible_functions_test.sh: New file.
4424 * testsuite/icf_string_merge_test.cc: New file.
4425 * testsuite/icf_string_merge_test.sh: New file.
4426 * testsuite/icf_virtual_function_folding_test.cc: New file.
4427 * testsuite/icf_virtual_function_folding_test.sh: New file.
4428
04ceb17c
DK
44292010-04-14 Doug Kwan <dougkwan@google.com>
4430
4431 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4432 for local symbol recounting if we remove a section due to ICF.
4433 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4434 there are no regular objects in input.
4435
153e7da4
DK
44362010-04-13 Doug Kwan <dougkwan@google.com>
4437
4438 * arm.cc (Arm_input_section::set_final_data_size): Compute
4439 accurate final data size instead of using current data size.
4440
4dbd9faf
DK
44412010-04-09 Doug Kwan <dougkwan@google.com>
4442
4443 * layout.cc (Layout::choose_output_section): Handle script section
4444 types.
4445 (Layout::make_output_section_for_script): Add section type parameter.
4446 Handle script section types.
4447 * layout.h (Layout::make_output_section_for_script): Add section
4448 type parameter.
4449 * output.cc (Output_section::Output_section): Initialize data member
4450 is_noload_.
4451 (Output_section::do_reset_address_and_file_offset): Do not set address
4452 to 0 if section is a NOLOAD section.
4453 * output.h (Output_section::is_noload): New method.
4454 (Output_section::set_is_noload): Ditto.
4455 (Output_section::is_noload_): New data member.
4456 * script-c.h (Script_section_type): New enum type.
4457 (struct Parser_output_section_header): Add new file section_type.
4458 * script-sections.cc (Sections_element::output_section_name): Add
4459 parameter for returning script section type.
4460 (Output_section_definition::output_section_name): Ditto.
4461 (Output_section_definition::section_type)P; New method.
4462 (Output_section_definiton::script_section_type_name): Ditto.
4463 (Output_section_definition::script_section_type_): New data member.
4464 (Output_section_definition::Output_section_definition): Initialize
4465 data member Output_section_definition::script_section_type_.
4466 (Output_section_definition::create_sections): Pass script section type
4467 to Layout::make_output_section_for_script.
4468 (Output_section_definition::output_section_name): Return script
4469 section type to caller.
4470 (Output_section_definition::set_section_address): Do not advance
4471 dot value and load address if section type is NOLOAD. Set address
4472 of NOLOAD sections regardless of section flags.
4473 (Output_section_definition::print): Print section type if it is
4474 not SCRIPT_SECTION_TYPE_NONE.
4475 (Output_section_definition::section_type): New method.
4476 (Output_section_definition::script_section_type_name): Ditto.
4477 (Script_sections::output_section_name): Add new parameter
4478 PSECTION_TYPE for returning script section type. Pass it to
4479 section elements. Handle discard sections.
4480 (Sort_output_sections::operator()): Handle NOLOAD sections.
4481 * script-sections.h (Script_sections::Section_type): New enum type.
4482 (Script_sections::output_section_name): Add a new parameter for
4483 returning script section type.
4484 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4485 INFO and NOLOAD.
4486 * yyscript.y (union): Add new field SECTION_TYPE.
4487 (COPY, DSECT, INFO, NOLOAD): New tokens.
4488 (opt_address_and_section_type): Change type to output_section_header.
4489 (section_type): New non-terminal
4490 (section_header): Handle section type.
2253bfba 4491 (opt_address_and_section_type): Return section type value.
4dbd9faf 4492
721ea635
L
44932010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4494
4495 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4496 * testsuite/plugin_common_test_2.c (foo): Likewise.
4497
6bf924b0
DK
44982010-04-08 Doug Kwan <dougkwan@google.com>
4499
4500 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4501 Output_merge_data.
4502 * output.cc (Output_section::add_merge_input_section): Simplify
4503 code and return status of Output_merge_base::add_input_section.
e1df38aa 4504 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
4505 returns true.
4506
24af6f92
DK
45072010-04-07 Doug Kwan <dougkwan@google.com>
4508
4509 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4510 if section is marked as containing instructions but has no mapping
4511 symbols.
4512 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4513 correct section index.
4514 (Arm_relobj::find_linked_text_section): Ditto.
4515
00698fc5
CC
45162010-04-07 Cary Coutant <ccoutant@google.com>
4517
4518 * archive.cc (include_member): Destroy Read_symbols_data object before
4519 releasing file.
4520 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4521 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4522 (Read_symbols_data::~Read_symbols_data) New destructor.
4523 (Section_relocs::Section_relocs) New constructor.
4524 (Section_relocs::~Section_relocs) New destructor.
4525 (Read_relocs_data::Read_relocs_data) New constructor.
4526 (Read_relocs_data::~Read_relocs_data) New destructor.
4527 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4528 pointers to NULL after deleting.
4529
7296d933
DK
45302010-04-07 Doug Kwan <dougkwan@google.com>
4531
4532 * arm.cc: Replace "endianity" with "endianness" in comments.
4533 (Arm_exidx_cantunwind): Ditto.
4534 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4535 (Arm_relobj::merge_flags_and_attributes): New method.
4536 (Arm_relobj::merge_flags_and_attributes_): New data member.
4537 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4538 (Arm_relobj::scan_sections_for_stubs): Ditto.
4539 (Arm_relobj::do_read_symbols): Check to see if we really want to
4540 merge processor-specific flags and attributes. Exit early if
4541 an object is empty except for section names and the undefined symbol.
4542 (Target_arm::do_finalize_sections): Move check for ELF format to
4543 Arm_relobj::do_read_symbols. Merge processor specific flags and
4544 attributes from a regular object only when we have determined that
4545 it is aapropriate. Do not create an .ARM.attributes section in
4546 output if there is no regular input object.
4547 (Target_arm::merge_processor_specific_flags): Check
4548 --warn-mismatch before printing any error.
4549 (Target_arm::merge_object_attributes): Ditto.
4550 * gold.cc (queue_middle_tasks): Handle the case in which there is
4551 no regular object in input.
4552 * options.cc (General_options::parse_EB): New method.
4553 (General_options::parse_EL): Same.
4554 (General_options::General_options): Initialize endianness_.
4555 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4556 New options.
4557 (General_options::Endianness): New enum.
4558 (General_options::endianness): New method.
4559 (General_options::endianness_): New data member.
4560 * parameters.cc (Parameters::set_options): Check target endianness.
4561 (Parameters::set_target_once): Ditto.
4562 (Parameters::check_target_endianness): New method.
4563 (parameters_force_valid_target): If either -EL or -EB is specified,
4564 use it to define endianness of default target.
4565 * parameters.h (Parameters::check_target_endianness): New method
4566 declaration.
4567 * target.h (class Target): Change "endianity" to "endianness"
4568 in comments.
4569
efc8d4f2
RW
45702010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4571
4572 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4573 * configure: Regenerate.
4574 * Makefile.in: Regenerate.
4575 * testsuite/Makefile.in: Regenerate.
4576
be234d88
CC
45772010-04-06 Cary Coutant <ccoutant@google.com>
4578
4579 gcc PR lto/42757
4580 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4581 prevailing definitions of common symbols.
4582 * testsuite/plugin_test_6.sh: New test case.
4583 * testsuite/plugin_common_test_1.c: New test case.
4584 * testsuite/plugin_common_test_2.c: New test case.
4585 * testsuite/Makefile.am (plugin_test_6): New test case.
4586 * testsuite/Makefile.in: Regenerate.
4587
bd32c6bd
NC
45882010-04-06 Nick Clifton <nickc@redhat.com>
4589
4590 * po/vi.po: New Vietnamese translation.
4591
323c532f
DK
45922010-03-30 Doug Kwan <dougkwan@google.com>
4593
4594 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4595
4fcd97eb
DK
45962010-03-25 Doug Kwan <dougkwan@google.com>
4597
4598 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4599 to avoid a conversion warning on a 32-bit host.
4600
4ebf39db
ILT
46012010-03-24 Ian Lance Taylor <iant@google.com>
4602
4603 * testsuite/script_test_3.t: Add a TLS segment.
4604 * testsuite/Makefile.am (check_PROGRAMS): Add
4605 tls_phdrs_script_test.
4606 (tls_phdrs_script_test_SOURCES): Define.
4607 (tls_phdrs_script_test_DEPENDENCIES): Define.
4608 (tls_phdrs_script_test_LDFLAGS): Define.
4609 (tls_phdrs_script_test_LDADD): Define.
4610 * testsuite/Makefile.in: Rebuild.
4611
4a599bdd
CC
46122010-03-23 Cary Coutant <ccoutant@google.com>
4613
4614 * fileread.cc (find_or_make_view): Fix comment.
4615
6c93b22c
ILT
46162010-03-23 Ian Lance Taylor <iant@google.com>
4617
4618 * script-sections.cc (class Orphan_section_placement): Define
4619 PLACE_TLS and PLACE_TLS_BSS.
4620 (Orphan_section_placement::Orphan_section_placement): Initialize
4621 new places.
4622 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4623 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4624 (tls_script_test_SOURCES): Define.
4625 (tls_script_test_DEPENDENCIES): Define.
4626 (tls_script_test_LDFLAGS): Define.
4627 (tls_script_test_LDADD): Define.
4628 * testsuite/Makefile.in: Rebuild.
4629
a2c7281b
DK
46302010-03-22 Doug Kwan <dougkwan@google.com>
4631
4632 * arm.cc (Arm_relocate_functions::abs8,
4633 Arm_relocate_functions::abs16): Use correct check for overflow
4634 specified in the ARM ELF specs.
4635 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4636 target of a BLX instruction specially.
4637 (Reloc_stub::stub_type_for_reloc): Ditto.
4638 (Relocate::relocate): Use symbolic names instead of numeric relocation
4639 codes to report error.
4640 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4641 workaround.
4642 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4643 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4644 thumb2_blx_out_of_range.stdout
4645 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4646 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4647 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4648 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4649 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4650 thumb2_blx_in_range, thumb2_blx_in_range.o,
4651 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4652 thumb2_blx_out_of_range.o): New rules.
4653 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4654 thumb2_blx_in_range and thumb2_blx_out_of_range.
4655 * testsuite/Makefile.in: Regenerate.
4656 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4657 * testsuite/thumb_blx_in_range.s: New file.
4658 * testsuite/thumb_blx_out_of_range.s: New file.
4659
b0193076
RÁE
46602010-03-22 Rafael Espindola <espindola@google.com>
4661
4662 * archive.cc (Should_include): Move to archive.h.
4663 (should_include_member): Make it a member of Archive.
4664 (Lib_group): New.
4665 (Add_lib_group_symbols): New.
4666 * archive.h: Include options.h.
4667 (Archive_member): Moved from Archive.
4668 (Should_include): Moved from archive.cc.
4669 (Lib_group): New.
4670 (Add_lib_group_symbols): New.
4671 * dynobj.cc (do_should_include_member): New.
4672 * dynobj.h (do_should_include_member): New.
4673 * gold.cc (queue_initial_tasks): Update call to queue.
4674 * main.cc (main): Print lib group stats.
4675 * object.cc (do_should_include_member): New.
4676 * object.h: Include archive.h.
4677 (Object::should_include_member): New.
4678 (Object::do_should_include_member): New.
4679 (Sized_relobj::do_should_include_member): New.
4680 * options.cc (General_options::parse_start_lib): New.
4681 (General_options::parse_end_lib): New.
4682 (Input_arguments::add_file): Handle lib groups.
4683 (Input_arguments::start_group): Check we are not in a lib.
4684 (Input_arguments::start_lib): New.
4685 (Input_arguments::end_lib): New.
4686 * options.h (General_options): Add start_lib and end_lib.
4687 (Input_argument::lib_): New.
4688 (Input_argument::lib): New.
4689 (Input_argument::is_lib): New.
4690 (Input_file_lib): New.
4691 (Input_arguments::in_lib_): New.
4692 (Input_arguments::in_lib): New.
4693 (Input_arguments::start_lib): New.
4694 (Input_arguments::end_lib_): New.
4695 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4696 in unused members as preempted.
4697 (Sized_pluginobj::do_should_include_member): New.
4698 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4699 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4700 return the blocker.
4701 (Read_symbols::do_whole_lib_group): New.
4702 (Read_symbols::do_lib_group): New.
4703 (Read_symbols::do_read_symbols): Handle lib groups.
4704 (Read_symbols::get_name): Handle lib groups.
4705 * readsyms.h (Read_symbols): Add an archive member pointer.
4706 (Read_symbols::do_whole_lib_group): New.
4707 (Read_symbols::do_lib_group): New.
4708 (Read_symbols::member_): New.
4709 * script.cc (read_input_script): Update call to queue_soon.
4710
d099120c
DK
47112010-03-19 Doug Kwan <dougkwan@google.com>
4712
4713 * arm.cc (Stub_table::Stub_table): Initialize new data members
4714 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4715 (Stub_table::add_reloc_stub): Assign stub offset and update
4716 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4717 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4718 New data members.
4719 (Stub_table::update_data_size_and_addralign): Use
4720 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4721 instead of going over all reloc stubs.
4722 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4723 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4724 Stringpool_template::offset_ to size of Stringpool_char.
4725 (Stringpool_template::new_key_offset): Remove code to initialize
4726 Stringpool_template::offset_.
4727 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4728 Stringpool_template::offset_ to zero.
4729
1aa37384
DK
47302010-03-15 Doug Kwan <dougkwan@google.com>
4731
4732 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4733 offset_.
4734 (Stringpool_template::new_key_offset): New method.
4735 (Stringpool_template::add_string): Assign offsets when adding new
4736 strings.
4737 (Stringpool_template::set_string_offsets): Do not set string offsets
4738 when not optimizing.
4739 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4740 member size_.
4741 (Chunked_vector::clear): Clear size_.
4742 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4743 (Chunked_vector::size): Return size_.
4744 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 4745 (Chunked_vector::size_): New data member.
1aa37384
DK
4746 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4747 (Stringpool_template::new_key_offset): New method declaration.
4748 (Stringpool_template::offset_): New data member.
4749
b672b057
RÁE
47502010-03-15 Rafael Espindola <espindola@google.com>
4751
4752 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4753 Add_symbols' constructor.
4754 * readsyms.h (Add_symbols): Remove the input_group member.
4755
b6848d3c
ILT
47562010-03-10 Ian Lance Taylor <iant@google.com>
4757
4758 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4759 target to ask whether a reference to a symbol requires a stack
4760 split.
4761 * target.h (Target::is_call_to_non_split): New function.
4762 (Target::do_is_call_to_non_split): Declare virtual function.
4763 * target.cc: Include "symtab.h".
4764 (Target::do_is_call_to_non_split): New function.
4765 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4766
a2a5469e
CC
47672010-03-10 Cary Coutant <ccoutant@google.com>
4768
4769 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4770 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4771 (File_read::open[2]): Add whole_file_view_ to list of views.
4772 (File_read::make_view): Remove test of whole_file_view_.
4773 (File_read::find_or_make_view): Create whole_file_view_ if
4774 necessary.
4775 (File_read::clear_views): Replace bool parameter with enum;
4776 adjust all callers. Don't delete views with permanent data;
4777 do delete cached views and views from archives if
4778 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4779 if clearing the corresponding view.
4780 * fileread.h (File_read::Clear_views_mode): New enum.
4781 (File_read::View::is_permanent_view): New method.
4782 (File_read::clear_views): Replace bool parameter
4783 with enum; adjust all callers.
4784 * options.h (General_options): Change keep_files_mapped option;
4785 add map_whole_files.
4786 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4787 releasing the file.
4788 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4789 the file.
4790
8861f32b
DM
47912010-03-10 David S. Miller <davem@davemloft.net>
4792
4793 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4794
d62d0f5f
ST
47952010-03-09 Sriraman Tallam <tmsriram@google.com>
4796
4797 * icf.cc (get_section_contents): Add '@' marker after processing the
4798 merge reloc.
4799
9177756d
DK
48002010-03-08 Doug Kwan <dougkwan@google.com>
4801
4802 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4803 due to a conversion warning.
4804 (Arm_relobj::update_output_local_symbol_count): Check for local
4805 symbol with unset output index.
4806
9e9e071b
ILT
48072010-03-05 Ian Lance Taylor <iant@google.com>
4808
4809 * options.h (class General_options): Add --spare-dynamic-tags.
4810 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4811 --spare-dynamic-tags.
4812
a81ee015
ILT
48132010-03-05 Ian Lance Taylor <iant@google.com>
4814
4815 * incremental.cc: Include "libiberty.h".
4816
44ec90b9
RO
48172010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4818
4819 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4820 function, is_info_ member.
4821 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4822 (Versions::Versions): Update caller.
4823 (Versions::define_base_version): Likewise.
4824 (Versions::add_def): Likewise.
4825
0897ed3b
ST
48262010-03-03 Sriraman Tallam <tmsriram@google.com>
4827
4828 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4829 (Scan::possible_function_pointer_reloc): New function.
4830 (Scan::local_reloc_may_be_function_pointer): Change to call
4831 possible_function_pointer_reloc.
4832 (Scan::global_reloc_may_be_function_pointer): Ditto.
4833 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4834 relocations in ".data.rel.ro._ZTV" section.
4835 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4836 * testsuite/icf_safe_so_test.cc: Ditto.
4837 * testsuite/icf_safe_test.cc: Ditto.
4838 * testsuite/icf_safe_test.sh: Ditto.
4839
d3bbad62
ILT
48402010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4841 Ian Lance Taylor <iant@google.com>
4842
4843 * target-reloc.h (relocate_section): Check the symbol table index
4844 for -1U before setting the local symbol index.
4845 (scan_relocatable_relocs): If copying the relocation, record that
4846 the local symbol is required.
4847 * object.h (Symbol_value::is_output_symtab_index_set): New
4848 function.
4849 (Symbol_value::may_be_discarded_from_output_symtab): New
4850 function.
4851 (Symbol_value::has_output_symtab_entry): New function.
4852 (Symbol_value::needs_output_symtab_entry): Remove.
4853 (Symbol_value::output_symtab_index): Make sure the symbol index is
4854 set.
4855 (Symbol_value::set_output_symtab_index): Make sure the symbol
4856 index is not set. Make sure the new index is valid.
4857 (Symbol_value::set_must_have_output_symtab_entry): New function.
4858 (Symbol_value::has_output_dynsym_entry): New function.
4859 (Symbol_value::set_output_dynsym_index): Make sure the new index
4860 is valid.
4861 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4862 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4863 local symbol if permitted.
4864 (Sized_relobj::do_finalize_local_symbols): Call
4865 is_output_symtab_index_set rather than needs_output_symtab_entry.
4866 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4867 rather than needs_output_symtab_entry. Call
4868 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4869 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4870 is_output_symtab_index_set rather than needs_output_symtab_entry.
4871 * testsuite/discard_locals_relocatable_test.c: New file.
4872 * testsuite/discard_locals_test.sh: Test -r.
4873 * testsuite/Makefile.am (check_DATA): Add
4874 discard_locals_relocatable_test1.syms,
4875 discard_local_relocatable_test2.syms.
4876 (MOSTLYCLEANFILES): Likewise. Also add
4877 discard_locals_relocatable_test1.lout and
4878 discard_locals_relocatable_test2.out.
4879 (discard_locals_relocatable_test1.syms): New target.
4880 (discard_locals_relocatable_test.o): New target.
4881 (discard_locals_relocatable_test1.out): New target.
4882 (discard_locals_relocatable_test2.syms): New target.
4883 (discard_locals_relocatable_test2.out): New target.
4884 (various): Add missing ../ld-new dependencies.
4885 * testsuite/Makefile.in: Rebuild.
4886
7e8ccf26
NC
48872010-03-03 Nick Clifton <nickc@redhat.com>
4888
4889 * po/fi.po: New Finnish translation.
4890
2a0ff005
DK
48912010-03-01 Doug Kwan <dougkwan@google.com>
4892
4893 * layout.cc (Layout::Layout): Force section types of .init_array*,
4894 .preinit_array* and .fini_array* sections.
4895 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4896 Fix check of return value of std::string::find.().
4897 (Output_section::Input_section_sort_compare::operator()): Remove
4898 comment about .init_array.
4899 (Output_section::Input_section_sort_init_fini_compare::operator()):
4900 New method.
4901 (Output_section::sort_attached_input_sections): Handle .init_array
4902 and .fini_array specially.
4903 * output.h (Output_section::Inut_section_sort_compare): Update
4904 comment.
4905 (Output_section::Input_section_sort_init_fini_compare): New struct.
4906
c3e4ae29
DK
49072010-02-26 Doug Kwan <dougkwan@google.com>
4908
4909 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4910 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4911 * testsuite/debug_msg.sh: Avoid matching source line number for
4912 use of global variable undef_int.
4913
2fd9ae7a
DK
49142010-02-26 Doug Kwan <dougkwan@google.com>
4915
4916 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4917 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4918 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4919 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4920 * options.cc (General_options::General_options): Initialize member
4921 fix_v4bx_.
4922 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4923 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4924 and rm_no_fix_v4bx.stdout
4925 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4926 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4927 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4928 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4929 and arm_no_fix_v4bx.
4930 * Makefile.in: Regenerate.
4931 * testsuite/arm_fix_v4bx.s: New file.
4932 * testsuite/arm_fix_v4bx.sh: Ditto.
4933
67ec7d0b
DK
49342010-02-24 Doug Kwan <dougkwan@google.com>
4935
4936 * arm.cc (Target_arm::got_section): Make the .got section the first
4937 non RELRO section in the data segment.
4938 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4939 suffixes of section names.
4940
10165461
DK
49412010-02-24 Doug Kwan <dougkwan@google.com>
4942
4943 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4944 flags and attributes merging if an input file is a binary file.
4945 * fileread.cc (Input_file::open): Record format of original file.
4946 * fileread.h (Input_file::Format): New enum type.
4947 (Input_file::Input_file): Initialize data member format_.
4948 (Input_file::format): New method definition.
4949 (Input_file::format_):: New data member.
4950
4a54abbb
DK
49512010-02-24 Doug Kwan <dougkwan@google.com>
4952
4953 * arm.cc (Arm_output_data_got): New class.
4954 (ARM_TCB_SIZE): New constant
4955 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4956 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4957 If user uses a script with a SECTIONS clause, issue only a warning
4958 for a misplaced EXIDX input section. Otherwise, issue an error.
4959 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4960 garbage collection.
4961 (Target_arm::got_mode_index_entry): Handle static linking.
4962 (Target_arm::Scan::local): Ditto.
4963 (Target_arm::Scan::global): Ditto.
4964 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4965 all incorrectly implemented relocations.
e1df38aa 4966 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
4967 Arm_output_section::fix_exidx_coverage.
4968 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4969 from ".ARM.exidx." and ".ARM.extab.".
4970
ca419a6f
ILT
49712010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4972
4973 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4974 section if it does not already exist.
4975 * attributes.cc (Attributes_section_data::Attributes_section_data):
4976 Don't crash if size is zero.
4977
135b9c78
ILT
49782010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4979 Ian Lance Taylor <iant@google.com>
4980
4981 * gold.cc (queue_middle_tasks): If no input files were opened,
4982 exit.
4983 * workqueue.h (Task_function::Task_function): Assert that there is
4984 a blocker.
4985
bb0bfe4f
DK
49862010-02-22 Doug Kwan <dougkwan@google.com>
4987
4988 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4989 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4990 types to avoid warnings due to different uint64_t implementations
4991 on different hosts.
4992
2a2b6d42
DK
49932010-02-21 Doug Kwan <dougkwan@google.com>
4994
4995 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4996 handling of the maximum backward branch offset.
4997 (Arm_relocate_functions::thumb_branch_common): Ditto.
4998 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4999 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 5000 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
5001 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
5002 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
5003 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
5004 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
5005 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
5006 thumb_bl_out_of_range thumb_bl_out_of_range.o,
5007 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
5008 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
5009 thumb2_bl_out_of_range.o): New rules.
5010 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
5011 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
5012 thumb2_bl_out_of_range
5013 * testsuite/Makefile.in: Regenerate.
5014 * testsuite/arm_bl_in_range.s: New file.
5015 * testsuite/arm_bl_out_of_range.s: Ditto.
5016 * testsuite/arm_branch_in_range.sh: Ditto.
5017 * testsuite/arm_branch_range.t: Ditto.
5018 * testsuite/thumb2_branch_range.t: Ditto.
5019 * testsuite/thumb_bl_in_range.s: Ditto.
5020 * testsuite/thumb_bl_out_of_range.s: Ditto.
5021 * testsuite/thumb_branch_range.t: Ditto.
5022
b487ad64
ST
50232010-02-20 Sriraman Tallam <tmsriram@google.com>
5024
5025 * gc.h (gc_process_relocs): Change vectors to point to the new list.
5026 Add reloc offset information.
5027 * icf.cc (get_section_contents): Change iterators to point to the new
5028 vectors. Add reloc offset information to the contents.
5029 * icf.h (Icf::Sections_reachable_info): New typedef.
5030 (Icf::Sections_reachable_list): New typedef.
5031 (Icf::Offset_info): New typedef.
5032 (Icf::Reloc_info): New struct typedef.
5033 (Icf::Reloc_info_list): New typedef.
5034 (Icf::symbol_reloc_list): Delete method.
5035 (Icf::addend_reloc_list): Delete method.
5036 (Icf::section_reloc_list): Delete method.
5037 (Icf::reloc_info_list): New method.
5038 (Icf::reloc_info_list_): New member.
5039
f96accdf
DK
50402010-02-19 Doug Kwan <dougkwan@google.com>
5041
5042 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
5043 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
5044 * arm.cc (Arm_relocation_functions): New forward declaration.
5045 (Target_arm::Target_arm): Initialize new data members
5046 got_mod_index_offset_ and tls_base_symbol_defined_.
5047 (Target_arm::Relocate::relocate_tls): New method.
5048 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
5049 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
5050 New methods.
5051 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
5052 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
5053 (Target_arm::got_mod_index_offset_,
5054 Target_arm::tls_base_symbol_defined_): New data members.
5055 (Target_arm::Scan::local, Target::Scan::global,
5056 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
5057 relocations.
5058
c8761b9a
DK
50592010-02-18 Doug Kwan <dougkwan@google.com>
5060
5061 * arm.cc (Arm_relobj::find_linked_text_section): New method.
5062 (Arm_relobj::make_exidx_input_section): Pass section index of linked
5063 text section as a parameter becuase some broken tools may not set
5064 the link in section header.
5065 (Target_arm::has_got_section): New method.
5066 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
5067 without any mapping symbol as data only. Remove warning.
5068 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
5069 link in its section header, try to discover the link by inspecting the
5070 REL31 relocation at the beginning of the section.
5071 (Target_arm::Scan::check_non_pic): Report name of offending relocation
5072 in error message.
5073 (Target_arm::Scan::global): Treat any reference to the symbol
5074 _GLOBAL_OFFSET_TABLE_ as a GOT access.
5075
21bb3914
ST
50762010-02-12 Sriraman Tallam <tmsriram@google.com>
5077
5078 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
5079 (Scan::global_reloc_may_be_function_pointer): New function.
5080 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5081 (Scan::global_reloc_may_be_function_pointer): New function.
5082 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
5083 (Scan::global_reloc_may_be_function_pointer): New function.
5084 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
5085 (Scan::global_reloc_may_be_function_pointer): New function.
5086 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
5087 (Scan::global_reloc_may_be_function_pointer): New function.
5088 (Scan::possible_function_pointer_reloc): New function.
5089 (Target_x86_64::can_check_for_function_pointers): New function.
5090 * gc.h (gc_process_relocs): Scan relocation types to determine if
5091 function pointers were taken for targets that support it.
5092 * icf.cc (Icf::find_identical_sections): Include functions for
5093 folding in safe ICF whose pointer is not taken.
5094 * icf.h (Secn_fptr_taken_set): New typedef.
5095 (fptr_section_id_): New member.
5096 (section_has_function_pointers): New function.
5097 (set_section_has_function_pointers): New function.
5098 (check_section_for_function_pointers): New function.
5099 * options.h: Fix comment for safe ICF option.
5100 * target.h (can_check_for_function_pointers): New function.
5101 * testsuite/Makefile.am: Add icf_safe_so_test test case.
5102 Modify icf_safe_test for X86-64.
5103 * testsuite/Makefile.in: Regenerate.
5104 * testsuite/icf_safe_so_test.cc: New file.
5105 * testsuite/icf_safe_so_test.sh: New file.
5106 * testsuite/icf_safe_test.cc (kept_func_3): New function.
5107 (main): Change to take pointer to function kept_func_3.
5108 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
5109 folding is done correctly for X86-64.
5110
0da6fa6c
DM
51112010-02-12 David S. Miller <davem@davemloft.net>
5112
5113 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
5114 is_symbolless parameter.
5115 (Output_reloc<SHT_REL>::is_symbolless): New.
5116 (Output_reloc<SHT_REL>::is_symbolless_): New.
5117 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
5118 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
5119 (Output_reloc<SHT_RELA>::is_symbolless): New.
5120 (Output_data_reloc::add_global): Handle is_symbolless.
5121 (Output_data_reloc::add_global_relative): Likewise.
5122 (Output_data_reloc::add_local): Likewise.
5123 (Output_data_reloc::add_local_relative): Likewise.
5124 (Output_data_reloc::add_symbolless_global_addend): New.
5125 (Output_data_reloc::add_symbolless_local_addend): New.
5126 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
5127 is_symbolless.
5128 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
5129 instead of ->is_relative_
5130 (Output_reloc::write): Likewise.
5131 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
5132 (Output_reloc::write_rel): Simplify.
5133
5134 * sparc.cc (Target_sparc::Scan::local): Use
5135 ->add_symbolless_local_addend as needed.
5136 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
5137 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
5138 based upon relocation offset.
5139
e4782e83
DK
51402010-02-11 Doug Kwan <dougkwan@google.com>
5141
5142 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
5143 (Target_arm::Scan::global): Ditto. Also remove a comment before the
5144 beginning of function.
5145 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
5146 and MOVT_ABS relocations. Those are non issued in scanning. Fix
5147 parameter is_32bit in calls to should_apply_static_reloc.
5148 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
5149 (check_DATA): Add arm_abs_global.stdout.
5150 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
5151 arm_abs_global.stdout): New rules.
5152 (MOSTLLYCLEANFILES): Add arm_abs_global
5153 * Makefile.in: Regenerate.
5154 * testsuite/arm_abs_global.s: New file.
5155 * testsuite/arm_abs_global.sh: Ditto.
5156 * testsuite/arm_abs_lib.s: Ditto.
5157
93ceb764
ILT
51582010-02-11 Ian Lance Taylor <iant@google.com>
5159
5160 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
5161 Read_relocs task.
5162 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
5163 Allocate_commons_task first.
5164 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
5165 task, rather than symtab_lock_.
5166 (Gc_process_relocs::~Gc_process_relocs): New function.
5167 (Gc_process_relocs::is_runnable): Check this_blocker_.
5168 (Gc_process_relocs::locks): Use next_blocker_ rather than
5169 blocker_.
5170 (Scan_relocs::~Scan_relocs): New function.
5171 (Scan_relocs::is_runnable): Check this_blocker_ rather than
5172 symtab_lock_.
5173 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
5174 next_blocker_.
5175 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
5176 fields. Add this_blocker_ and next_blocker_ fields. Adjust
5177 constructor accordingly.
5178 (class Gc_process_relocs): Likewise.
5179 (class Scan_relocs): Likewise.
5180 * common.h (class Allocate_commons_task): Remove symtab_lock_
5181 field, and corresponding constructor parameter.
5182 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
5183 symtab_lock_.
5184 (Allocate_commons_task::locks): Likewise.
5185
114dfbe1
ILT
51862010-02-11 Ian Lance Taylor <iant@google.com>
5187
5188 * gold-threads.h (class Once): Define.
5189 (class Initialize_lock): Rewrite as child of Once.
5190 * gold-threads.cc (class Once_initialize): Define.
5191 (once_pointer_control): New static variable.
5192 (once_pointer, once_arg): New static variables.
5193 (c_run_once): New static function.
5194 (Once::Once, Once::run_once, Once::internal_run): New functions.
5195 (class Initialize_lock_once): Remove.
5196 (initialize_lock_control): Remove.
5197 (initialize_lock_pointer): Remove.
5198 (initialize_lock_once): Remove.
5199 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
5200 (Initialize_lock::initialize): Rewrite.
5201 (Initialize_lock::do_run_once): New function.
5202 * archive.cc (Archive::interpret_header): Only clear name if it is
5203 not already empty.
5204 * fileread.cc: Include "gold-threads.h"
5205 (file_counts_lock): New static variable.
5206 (file_counts_initialize_lock): Likewise.
5207 (File_read::release): Only increment counts when using --stats.
5208 Use a lock around the increment.
5209 * parameters.cc (class Set_parameters_target_once): Define.
5210 (set_parameters_target_once): New static variable.
5211 (Parameters::Parameters): Move here from parameters.h.
5212 (Parameters::set_target): Rewrite.
5213 (Parameters::set_target_once): New function.
5214 (Parameters::clear_target): Move here and rewrite.
5215 * parameters.h (class Parameters): Update declarations. Add
5216 set_parameters_target_once_ field.
5217 (Parameters::Parameters): Move to parameters.cc.
5218 (Parameters::clear_target): Likewise.
5219 * readsyms.cc (Read_symbols::do_group): Create a Start_group
5220 task.
5221 (Start_group::~Start_group): New function.
5222 (Start_group::is_runnable): New function.
5223 (Start_group::locks, Start_group::run): New functions.
5224 (Finish_group::run): Change saw_undefined to size_t.
5225 * readsyms.h (class Start_group): Define.
5226 (class Finish_group): Change saw_undefined_ field to size_t.
5227 (Finish_group::Finish_group): Remove saw_undefined and
5228 this_blocker parameters. Change all callers.
5229 (Finish_group::set_saw_undefined): New function.
5230 (Finish_group::set_blocker): New function.
5231 * symtab.h (class Symbol_table): Change saw_undefined to return
5232 size_t. Change saw_undefined_ field to size_t.
5233 * target-select.cc (Set_target_once::do_run_once): New function.
5234 (Target_selector::Target_selector): Initialize set_target_once_
5235 field. Don't initialize lock_ and initialize_lock_ fields.
5236 (Target_selector::instantiate_target): Rewrite.
5237 (Target_selector::set_target): New function.
5238 * target-select.h (class Set_target_once): Define.
5239 (class Target_selector): Update declarations. Make
5240 Set_target_once a friend. Remove lock_ and initialize_lock_
5241 fields. Add set_target_once_ field.
5242
fa17a3f4
ILT
52432010-02-10 Ian Lance Taylor <iant@google.com>
5244
5245 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
5246 queueing any tasks.
5247 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
5248 (queue_middle_tasks): Add all blockers before queueing any tasks.
5249 (queue_final_tasks): Likewise.
5250 * token.h (Task_token::add_blockers): New function.
5251 * object.h (Input_objects::number_of_relobjs): New function.
5252
c7177d31
ILT
52532010-02-10 Ian Lance Taylor <iant@google.com>
5254
5de0e392
ILT
5255 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
5256 shared, not if not position independent.
5257 * x86_64.cc (Relocate::relocate_tls): Likewise.
5258 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
5259 (tls_pie_pic_test): New target.
5260 * testsuite/Makefile.in: Rebuild.
5261
c7177d31
ILT
5262 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
5263 (tls_test_main_pie.o, tls_test_pie.o): New targets.
5264 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
5265 * testsuite/Makefile.in: Rebuild.
5266
684b268a
DM
52672010-02-09 David S. Miller <davem@davemloft.net>
5268
5269 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5270 R_SPARC_RELATIVE using ->add_local_relative().
5271 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5272
612a8d3d
DM
5273 * output.h (Output_data_dynamic::add_section_size): New method
5274 that takes two Output_data objects.
5275 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5276 entry param. Handle it in initializers.
5277 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5278 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5279 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5280 arg.
5281 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5282 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5283 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5284 for dynrel_includes_plt.
5285 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5286 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5287 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5288 before .rela.plt
5289 (Target_sparc::do_finalize_sections): Update to pass true for
5290 dynrel_includes_plt.
5291 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5292 output before .rela.plt
5293 (Target_powerpc::do_finalize_sections): Update to pass true for
5294 dynrel_includes_plt when 32-bit.
5295
cb1be87e
DK
52962010-02-08 Doug Kwan <dougkwan@google.com>
5297
5298 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5299 method.
5300 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5301 Arm_relobj::scan_section_for_cortex_a8_stubs,
5302 Arm_relobj::do_relocation_section): Instead of calling
5303 Output_section::output_address, use faster
5304 Arm_relobj::simple_input_section_output_address.
5305
705b5121
DM
53062010-02-08 David S. Miller <davem@davemloft.net>
5307
5308 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5309 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5310 relocation helper function.
5311
024c4466
DM
5312 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5313 just like R_SPARC_GOT{10,13,22}.
5314 (Target_sparc::Scan::local): Likewise.
5315 (Target_sparc::Relocate:relocate): Likewise.
5316
9109c078
ILT
53172010-02-06 Ian Lance Taylor <iant@google.com>
5318
5319 * configure.ac: Rewrite targetobjs duplicate removal code to use
5320 only shell constructs.
5321 * configure: Rebuild.
5322
cf846138
DK
53232010-02-05 Doug Kwan <dougkwan@google.com>
5324
5325 PR 11247
5326 * arm.cc (Arm_relobj::section_is_scannable): New method.
5327 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5328 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5329
6cfaf60b
DK
53302010-02-04 Doug Kwan <dougkwan@google.com>
5331
5332 PR 11247
5333 * arm-reloc-property.cc (cstdio): Include.
5334 * configure.ac (targetobjs): Remove duplicates.
5335 * configure: Regenerate.
5336 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5337 big and little endian version for a given address size.
5338
5c57f1be
DK
53392010-02-03 Doug Kwan <dougkwan@google.com>
5340
5341 * arm-reloc-property.cc
5342 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5343 definition.
5344 * arm-reloc-property.h
5345 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5346 New method definition.
5347 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5348 declaration.
5349 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5350 overflow to N.
5351 (GOT_PREL): Change implemented to Y.
5352 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5353 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5354 (Arm_relocate_functions::movw_abs_nc): Remove method.
5355 (Arm_relocate_functions::movt_abs): Ditto.
5356 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5357 (Arm_relocate_functions::thm_movt_abs): Ditto.
5358 (Arm_relocate_functions::movw_rel_nc): Ditto.
5359 (Arm_relocate_functions::movw_rel): Ditto.
5360 (Arm_relocate_functions::movt_rel): Ditto.
5361 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5362 (Arm_relocate_functions:thm_movw_rel): Ditto.
5363 (Arm_relocate_functions:thm_movt_rel): Ditto.
5364 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5365 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5366 New method definitions.
5367 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5368 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5369 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5370 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5371 (Target_arm::Relocate::relocate): Check for non-static or
5372 unimplemented relocation code and exit early. Change calls to
5373 Target_arm::reloc_uses_thumb_bit and
5374 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5375 instead. Refactor code to handle similar relocations to increase
5376 code sharing. Remove check for unsupported relocation code in switch
5377 statement.
5378 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5379 relocation property table to find out size. Change error message to
5380 print out the name of a relocation code instead of the numeric value.
5381 (Target_arm::scan_reloc_for_stub): Use relocation property table
5382 instead of calling Target_arm::reloc_uses_thumb_bit().
5383
218c5831
DK
53842010-02-02 Doug Kwan <dougkwan@google.com>
5385
5386 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5387 types of relaxed input section.
5388
0d31c79d
DK
53892010-02-02 Doug Kwan <dougkwan@google.com>
5390
5391 * Makefile.am (HFILES): Add arm-reloc-property.h.
5392 (DEFFILES): New.
5393 (TARGETSOURCES): Add arm-reloc-property.cc
5394 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5395 (libgold_a_SOURCES): $(DEFFILES)
5396 * Makefile.in: Regenerate.
5397 * arm-reloc-property.cc: New file.
5398 * arm-reloc-property.h: New file.
5399 * arm-reloc.def: New file.
5400 * arm.cc: Update comments.
5401 (arm-reloc-property.h): New included header.
5402 (arm_reloc_property_table): New global variable.
5403 (Target_arm::do_select_as_default_target): New method definition.
5404 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5405 arm-reloc-property to targ_extra_obj.
5406 * parameters.cc (set_parameters_target): Call
5407 Target::select_as_default_target().
5408 * target.h (Target::select_as_default_target): New method definition.
5409 (Target::do_select_as_default_target): Same.
5410
546c7457
DK
54112010-02-01 Doug Kwan <dougkwan@google.com>
5412
5413 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5414 first_output_text_section_.
5415 (Arm_exidx_fixup::first_output_text_section): New method definition.
5416 (Arm_exidx_fixup::first_output_text_section_): New data member.
5417 (Arm_exidx_fixup::process_exidx_section): Record the first text
5418 output section seen.
5419 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5420 and entsize in output section header.
5421
11b861d5
DK
54222010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5423
5424 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5425 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5426 (Arm_relocate_functions::thm_alu11): New Method.
5427 (Arm_relocate_functions::thm_pc8): New Method.
5428 (Arm_relocate_functions::thm_pc12): New Method.
5429 (Target_arm::Scan::local): Handle the relocations.
5430 (Target_arm::Scan::global): Likewise.
5431 (Target_arm::Relocate::relocate): Likewise.
5432 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5433
c9a2c125
DK
54342010-01-29 Doug Kwan <dougkwan@google.com>
5435
5436 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5437 of relocation types as ld.
5438
1521477a
DK
54392010-01-29 Doug Kwan <dougkwan@google.com>
5440
5441 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5442 to public.
5443 (Arm_relocate_functions::thumb_branch_common): Ditto.
5444 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5445 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5446 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5447 Arm_relocate_functions::jump24): Remove.
5448 (Target_arm::Relocate::relocate): Adjust code to call
5449 Arm_relocation_functions::arm_branch_common and
5450 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 5451 wrappers. Merge switch-cases together to reduce source code size.
1521477a 5452
e7eca48c
DK
54532010-01-29 Doug Kwan <dougkwan@google.com>
5454
5455 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5456 output_local_symbol_count_needs_update_.
5457 (Arm_relobj::output_local_symbol_count_needs_update,
5458 Arm_relobj::set_output_local_symbol_count_needs_update,
5459 Arm_relobj::update_output_local_symbol_count): New methods.
5460 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5461 member.
5462 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5463 of pointed function as in a R_ARM_PREL31 relocation.
5464 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5465 for output local symbol count updating.
5466 (Target_arm::do_relax): Update output local symbol counts in objects
5467 if necessary.
5468 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5469
02961d7e
ILT
54702010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5471
5472 * arm.cc: Added support for the ARM relocations:
5473 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5474 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5475 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5476 movw_prel_nc).
5477 (Arm_relocate_functions::movw_rel): New method.
5478 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5479 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5480 thm_movw_prel_nc).
5481 (Arm_relocate_functions::thm_movw_rel): New method.
5482 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5483 thm_movt_prel).
5484 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5485 relocations.
5486 (Target_arm::Scan::global): Likewise.
5487 (Target_arm::Relocate::relocate): Likewise.
5488 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5489 Likewise.
5490
b10d2873
ILT
54912010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5492
5493 * arm.cc: Added support for ARM group relocations.
5494 (Target_arm::reloc_needs_sym_origin): New method.
5495 (Arm_relocate_functions::calc_grp_kn): New method.
5496 (Arm_relocate_functions::calc_grp_residual): New method.
5497 (Arm_relocate_functions::calc_grp_gn): New method.
5498 (Arm_relocate_functions::arm_grp_alu): New Method.
5499 (Arm_relocate_functions::arm_grp_ldr): New Method.
5500 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5501 (Arm_relocate_functions::arm_grp_ldc): New Method.
5502 (Target_arm::Scan::local): Handle the ARM group relocations.
5503 (Target_arm::Scan::global): Likewise.
5504 (Target_arm::Relocate::relocate): Likewise.
5505 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5506 Likewise.
5507
2b328d4e
DK
55082010-01-26 Doug Kwan <dougkwan@google.com>
5509
5510 * arm.cc (set): Include.
5511 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5512 pointer type.
5513 (Arm_output_section::Text_section_list): New type.
5514 (Arm_output_section::append_text_sections_to_list): New method.
5515 (Arm_output_section::fix_exidx_coverage): Ditto.
5516 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5517 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5518 Relobj::set_section_offset() instead of
5519 Sized_relobj::invalidate_section_offset().
5520 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5521 parameter for section headers. Ignore relocation sections for
5522 unallocated sections and EXIDX sections.
5523 (Target_arm::fix_exidx_coverage): New method.
5524 (Target_arm::output_section_address_less_than): New type.
5525 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5526 linked text section instead of the EXIDX section.
5527 (Arm_output_section::create_stub_group): Add an assertion to check
5528 that this is not an EXIDX output section.
5529 (Arm_output_section::append_text_sections_to_list): New method.
5530 (Arm_output_section::fix_exidx_coverage): Ditto.
5531 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5532 Arm_relobj::section_needs_reloc_stub_scanning.
5533 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5534 first pass.
5535 (Target_arm::fix_exidx_coverage): New method.
5536 * object.h (Relobj::set_output_section): New method.
5537 (Sized_relobj::invalidate_section_offset): Remove method.
5538 (Sized_relobj::do_invalidate_section_offset): Remove method.
5539 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5540
c7f3c371
DK
55412010-01-25 Doug Kwan <dougkwan@google.com>
5542
5543 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5544 Fix warning due to signed and unsigned comparison on a 32-bit host.
5545
8923b24c
DK
55462010-01-22 Doug Kwan <dougkwan@google.com>
5547
5548 * arm.cc (Target_arm::do_relax): Record an output section for section
5549 offset adjustment it contains any stub table that has changed.
5550 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5551 offsets in an output section if necessary.
5552 * output.cc (Output_section::Output_section): Initialize
5553 section_offsets_need_adjustments_.
5554 (Output_section::add_input_section_for_script): Renamed to
5555 Output_section::add_simple_input_section.
5556 (Output_section::save_states): Add a comment.
5557 (Output_section::discard_states): New method defintion.
5558 (Output_section::adjust_section_offsets): Same.
5559 * output.h (Output_section::add_input_section_for_script): Renamed to
5560 Output_section::add_simple_input_section.
5561 (Output_section::discard_states): New method declaration.
5562 (Output_section::adjust_section_offsets): Same.
5563 (Output_section::section_offsets_need_adjustment,
5564 Output_section::set_section_offsets_need_adjustment): New method
5565 definitions.
5566 (Output_section::section_offsets_need_adjustment_): New data member.
5567 * script-sections.cc
5568 (Output_section_element_input::set_section_address): Adjust code for
5569 renaming of Output_section::add_input_section_for_script.
5570 (Orphan_output_section::set_section_address): Same.
5571
9b2fd367
DK
55722010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5573
5574 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5575 Fix_v4bx enum values .
5576 * gold/options.h (General_options): New option definitions.
5577 (General_options::fix_v4bx): New method.
5578 (General_options::Fix_v4bx): New enum.
5579 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5580 (General_options::parse_fix_v4bx_interworking): New method.
5581
80d0d023
DK
55822010-01-22 Doug Kwan <dougkwan@google.com>
5583
5584 * arm.cc (Arm_exidx_fixup): New class.
5585
af2cdeae
DK
55862010-01-21 Doug Kwan <dougkwan@google.com>
5587
5588 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5589 classes.
5590 (Arm_exidx_section_offset_map): New type.
5591
993d07c1
DK
55922010-01-21 Doug Kwan <dougkwan@google.com>
5593
5594 * arm.cc (Arm_exidx_input_section): New class.
5595 (Arm_relobj::exidx_input_section_by_link,
5596 Arm_relobj::exidx_input_section_by_shndx,
5597 Arm_relobj::make_exidx_input_section): New methods.
5598 (read_arm_attributes_section): Remove.
5599 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5600 information about them.
5601 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5602 to here.
5603
5ac169d4
DK
56042010-01-20 Doug Kwan <dougkwan@google.com>
5605
5606 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5607 Input_section_specifier to Section_id.
5608 (Target_arm::new_arm_input_section: Adjust code for change of key
5609 type.
5610 (Target_arm::find_arm_input_section): Ditto.
5611 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5612 (Section_id): Remove.
5613 (Garbage_collection::Section_id_hash): Remove.
5614 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5615 (Section_id): Remove.
5616 (Icf::Section_id_hash): Remove.
5617 * object.h (Section_id, Const_section_id, Section_id_hash,
5618 Const_section_id_hash): New type definitions.
5619 * output.cc (Output_section::add_relaxed_input_section): Change to
5620 use Const_section_id instead of Input_section_specifier as key type.
5621 (Output_section::add_merge_input_section): Ditto.
5622 (Output_section::build_relaxation_map): Change to use Section_id
5623 instead of Input_section_specifier as key type.
5624 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5625 Ditto.
5626 (Output_section::convert_input_sections_to_relaxed_sections): Change
5627 to use Const_section_id instead of Input_section_specifier as key type.
5628 (Output_section::find_merge_section): Ditto.
5629 (Output_section::find_relaxed_input_section): Ditto.
5630 * output.h (Input_section_specifier): Remove class.
5631 (Output_section::Output_section_data_by_input_section_map): Change
5632 key type to Const_section_id.
5633 (Output_section::Output_relaxed_input_section_by_input_section_map):
5634 Ditto.
5635 (Output_section::Relaxation_map): Change key type to Section_id.
5636
a2162063
ILT
56372010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5638
5639 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5640 (class Arm_v4bx_stub): New class.
5641 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5642 (Stub_factory::make_arm_v4bx_stub): New method.
5643 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5644 (Stub_table::empty): Handle v4bx stubs.
5645 (Stub_table::add_arm_v4bx_stub): New method.
5646 (Stub_table::find_arm_v4bx_stub): New method.
5647 (Arm_relocate_functions::v4bx): New method.
5648 (Target_arm::fix_v4bx): New method.
5649 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5650 (Stub_table::relocate_stubs): Likewise.
5651 (Stub_table::do_write): Likewise.
5652 (Stub_table::update_data_size_and_addralign): Likewise.
5653 (Stub_table::finalize_stubs): Likewise.
5654 (Target_arm::Scan::local): Likewise.
5655 (Target_arm::Scan::global): Likewise.
5656 (Target_arm::do_finalize_sections): Likewise.
5657 (Target_arm::Relocate::relocate): Likewise.
5658 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5659 Likewise.
5660 (Target_arm::scan_reloc_for_stub): Likewise.
5661 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5662
5696ab0b
ILT
56632010-01-19 Ian Lance Taylor <iant@google.com>
5664
5665 * output.cc (Output_section_headers::do_sized_write): Write large
5666 segment count to sh_info field.
5667 (Output_file_header::do_sized_write): For large segment count,
5668 write PN_XNUM to e_phnum field.
5669
800d0f56
ILT
56702010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5671
5672 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5673 (Arm_relocate_functions::thm_jump8): New function.
5674 (Arm_relocate_functions::thm_jump11): New function.
5675 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5676 R_ARM_THM_JUMP11.
5677 (Target_arm::Scan::global): Likewise.
5678 (Target_arm::Relocate::relocate): Likewise.
5679 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5680 Likewise.
5681
41263c05
DK
56822010-01-14 Doug Kwan <dougkwan@google.com>
5683
5684 * arm.cc (map, utility): Include headers.
5685 (Target_arm::apply_cortex_a8_workaround): New method.
5686 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5687 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5688 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5689 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5690 the --[no-]fix-cortex-a8 command line options.
5691 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5692 (Target_arm::relocate_stub): Use addend in instruction template.
5693 * options.h (DEFINE_bool): Set the user-set flag.
5694 (General_options): Add --[no-]-fix-cortex options.
5695 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 5696 : Update fast look-up map after conversion.
41263c05 5697
459e9b03
ST
56982010-01-14 Sriraman Tallam <tmsriram@google.com>
5699
5700 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5701 in the first pass of do_layout.
5702
b521dfe4
DK
57032010-01-13 Doug Kwan <dougkwan@google.com>
5704
5705 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5706 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5707 apparent compiler problem of not folding static constant integral
5708 data members of elfcpp::Elf_sizes<32>.
5709
44272192
DK
57102010-01-13 Doug Kwan <dougkwan@google.com>
5711
5712 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5713 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5714 Arm_relobj::scan_section_for_cortex_a8_erratum,
5715 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5716 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5717 sections to scan for relocation stubs into a new method
5718 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5719 relocation and Cortex-A8 stub scanning.
5720 (Target_arm::do_relax): Force stubs to be after stubbed sections
5721 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 5722 the beginning of a new relaxation pass. Update a comment.
44272192
DK
5723 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5724
44b71ece
ILT
57252010-01-12 Ian Lance Taylor <iant@google.com>
5726
5727 * target-reloc.h (visibility_error): New inline function.
5728 (relocate_section): Call visibility_error.
5729 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5730 (MOSTLYCLEANFILES): Likewise.
5731 (protected_4_pic.o, protected_3.err): New targets.
5732 * testsuite/protected_4.cc: New file.
5733
a120bc7f
DK
57342010-01-12 Doug Kwan <dougkwan@google.com>
5735
5736 * arm.cc (Cortex_a8_reloc): New class.
5737 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5738 and cortex_a8_relocs_info_.
5739 (Target_arm::fix_cortex_a8): New method definition.
5740 (Target_arm::Cortex_a8_relocs_info): New type.
5741 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5742 New data member declarations.
5743 (Target_arm::scan_reloc_for_stub): Record information about
5744 relocations for THUMB branches that might be exempted from the
5745 Cortex-A8 workaround.
5746 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5747 at the beginning of a relaxation pass.
5748
20138696
DK
57492010-01-12 Doug Kwan <dougkwan@google.com>
5750
5751 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5752 (Arm_relobj::Mapping_symbol_position,
5753 Arm_reloj::Mapping_symbol_position_less,
5754 Arm_relobj::Mapping_symbols_info): New types.
5755 (Target_arm::is_mapping_symbol_name): New method definition.
5756 (Arm_relobj::do_count_local_symbols): Save information about mapping
5757 symbols.
5758
089d69dc
DK
57592010-01-11 Doug Kwan <dougkwan@google.com>
5760
5761 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5762 Arm_relocate_functions::thumb32_branch_upper,
5763 Arm_relocate_functions::thumb32_branch_lower,
5764 Arm_relocate_functions::thumb32_cond_branch_offset,
5765 Arm_relocate_functions::thumb32_cond_branch_upper,
5766 Arm_relocate_functions::thumb32_cond_branch_lower,
5767 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5768 branch offset encoding.
5769 (Arm_relocate_functions::thumb_branch_common): Use new branch
5770 offset encoding methods to avoid code duplication.
5771 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5772 (Stub_addend_reader::operator()): Use new branch encoding method
5773 to avoid code duplication.
5774
99e5bff2
DK
57752010-01-11 Doug Kwan <dougkwan@google.com>
5776
5777 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5778 (Target_arm::do_finalize_sections): Define special EXIDX section
5779 symbols only if referenced.
5780 * gc.h (Garbage_collection::add_reference): New method.
5781 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5782 code duplication.
5783
98e090bd
ILT
57842010-01-11 Ian Lance Taylor <iant@google.com>
5785
d0a91bd8
ILT
5786 * script.cc (Version_script_info::build_expression_list_lookup):
5787 Change complaing about duplicate wildcard match from error to
5788 warning.
5789
98e090bd
ILT
5790 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5791 of 2009-12-30.
5792 (Version_script_info::Version_script_info): Initialize globs_,
5793 default_version_, default_is_global_, and exact_. Don't
5794 initialize globals_ or locals_.
5795 (Version_script_info::build_lookup_tables): Build local symbols
5796 first.
5797 (Version_script_info::unquote): New function.
5798 (Version_script_info::add_exact_match): New function.
5799 (Version_script_info::build_expression_list_lookup): Remove lookup
5800 parameter. Add is_global parameter. Change all callers. Handle
5801 wildcard pattern specially. Unquote pattern. Call
5802 add_exact_match.
5803 (Version_script_info::get_name_to_match): New function.
5804 (Version_script_info::get_symbol_version): New function.
5805 (Version_script_info::get_symbol_version_helper): Remove.
5806 (Version_script_info::check_unmatched_names): Call unquote.
5807 * script.h (class Version_script_info): Change get_symbol_version
5808 to be non-inline and add is_global parameter; change all callers.
5809 Rewrite symbol_is_local. Update declarations. Define struct
5810 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5811 Remove globals_ and locals_ members. Add exact_, globs_,
5812 default_version_, is_global_.
5813 (Version_script_info::Glob): Remove pattern, add expression and
5814 is_global. Update constructor. Change all callers.
5815 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5816 default version.
5817 (Versions::symbol_section_contents): If a symbol is undefined, or
5818 defined in a dynamic object, set the version index to
5819 VER_NDX_LOCAL.
5820 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5821 symbol_is_local.
5822 (Symbol_table::add_from_pluginobj): Likewise.
5823 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5824
d56962d3
DK
58252010-01-11 Doug Kwan <dougkwan@google.com>
5826
5827 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5828 (incremental_dump_LDADD): Add linking option for libintl.
5829 * Makefile.in: Regenerate.
5830
94e6ee91
L
58312010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5832
5833 PR gold/11144
5834 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5835 instead of -Ds.
5836 * testsuite/Makefile.in: Regenerated.
5837
e96c574b
DK
58382010-01-10 Doug Kwan <dougkwan@google.com>
5839
5840 * options.h (DEFINE_var): Use parentheses around argument varname__
5841 in macro body to avoid any unintended subsequent substitutions.
5842
7198066b
ILT
58432010-01-10 Ian Lance Taylor <iant@google.com>
5844
ba4d53bf
ILT
5845 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5846 candidates before doing symbol resolution.
5847
7198066b
ILT
5848 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5849 ODR candidates if only one is weak.
5850
a2beed37
ILT
58512010-01-08 Ian Lance Taylor <iant@google.com>
5852
5853 * script.cc (Version_script_info::build_expression_list_lookup):
5854 Don't warn about ambiguous version, just record the ambiguity.
5855 (Version_script_info::get_symbol_version_helper): Give error if
5856 version is ambiguous.
5857
2fb7225c
DK
58582010-01-08 Doug Kwan <dougkwan@google.com>
5859
5860 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5861 prev_data_size_ and prev_addralign_. Remove initializer for
5862 deleted data member has_been_changed_.
5863 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5864 to determine if the table is empty.
5865 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5866 Remove.
5867 (Stub_table::add_reloc_stub): Define method in class definition
5868 instead of just declaring it there.
5869 (Stub_table::add_cortex_a8_stub): New method definition.
5870 (Stub_table::update_data_size_and_addralign): Ditto.
5871 (Stub_table::finalize_stubs): Ditto.
5872 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5873 (Stub_table::do_addralign_): Return address alignment in the
5874 (Stub_table::do_reset_address_and_file_offset): Define method in
5875 class definition instead of declaring it there. Set current data
5876 size to be the data size of the previous pass.
5877 (Stub_table::set_final_data_size): Use current data size as the
5878 final data size.
5879 (Stub_table::relocate_stub): Change parameter type of stub from
5880 Reloc_stub pointer to Stub pointer.
5881 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5882 (Stub_table::Cortex_a8_stub_list): New typedef.
5883 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5884 Stub_table::prev_addralign_): New data member.
5885 (Arm_relobj::Arm_relobj): Initialize data member
5886 section_has_cortex_a8_workaround_.
5887 (Arm_relobj::section_has_cortex_a8_workaround,
5888 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5889 definitions.
5890 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5891 declarations.
5892 (Target_arm::relocate_stub): Change parameter type of stub from
5893 Reloc_stub pointer to Stub pointer.
5894 (Insn_template::size, Insn_template::alignment): Handle
5895 THUMB16_SPECIAL_TYPE.
5896 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5897 Stub_table::update_data_size_and_addralign,
5898 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5899 definitions.
5900 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5901 (Stub_table::do_write): Ditto.
5902 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5903
880cd20d
ILT
59042010-01-08 Ian Lance Taylor <iant@google.com>
5905
5906 PR 11108
5907 * symtab.h (class Symbol): Remove fields is_target_special_ and
5908 has_plt_offset_. Add field is_defined_in_discarded_section_.
5909 (Symbol::is_defined_in_discarded_section): New function.
5910 (Symbol::set_is_defined_in_discarded_section): New function.
5911 (Symbol::has_plt_offset): Rewrite.
5912 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5913 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5914 Don't initialize is_target_special_ or has_plt_offset_.
5915 Initialize is_defined_in_discarded_section_.
5916 (Symbol_table::add_from_relobj): If appropriate, set
5917 is_defined_in_discarded_section.
5918 * resolve.cc (Symbol::override_base_with_special): Don't test
5919 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5920 * target-reloc.h (relocate_section): Do special handling for
5921 symbols defined in discarded sections for global symbols as well
5922 as local symbols.
5923
2703e3eb
ILT
59242010-01-08 Ian Lance Taylor <iant@google.com>
5925
5926 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5927 the SHT_SYMTAB case.
5928
339d40a3
ILT
59292010-01-08 Ian Lance Taylor <iant@google.com>
5930
5931 * object.cc (Sized_relobj::do_layout): Don't get confused if
5932 layout_eh_frame returns NULL.
5933
abecea76
ILT
59342010-01-08 Ian Lance Taylor <iant@google.com>
5935
5936 PR 11084
5937 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5938 dynamic symbol table, use the normal symbol table.
5939 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5940 symbol table.
5941
6b7dd3f3
ILT
59422010-01-08 Ian Lance Taylor <iant@google.com>
5943
5944 PR 11072
5945 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5946 sections.
5947
36c50e63
L
59482010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5949
5950 * version.cc (print_version): Change to "Copyright 2010".
5951
e291e7b9
ILT
59522010-01-08 Ian Lance Taylor <iant@google.com>
5953
5954 PR 10287
5955 PR 11063
5956 * i386.cc (class Target_i386): Change return type of plt_section
5957 to be non-const.
5958 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5959 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5960 tls_desc_rel_ field.
5961 (Output_data_plt_i386::rel_tls_desc): New function.
5962 (Target_i386::rel_tls_desc_section): New function.
5963 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5964 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5965 R_386_TLS_DESC reloc in rel_tls_desc_section.
5966 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5967 Define struct Tlsdesc_info.
5968 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5969 (Target_x86_64::do_reloc_symbol_index): New function.
5970 (Target_x86_64::add_tlsdesc_info): New function.
5971 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5972 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5973 tlsdesc_rel_ field.
5974 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5975 all callers.
5976 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5977 (Target_x86_64::rela_tlsdesc_section): New function.
5978 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5979 handling.
5980 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5981 (Target_x86_64::do_reloc_addend): New function.
5982 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5983 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5984 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5985 (Output_reloc::type): New function.
5986 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5987 (Output_reloc::is_target_specific): New function.
5988 (Output_reloc::target_arg): New function.
5989 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5990 absolute relocs and target specific relocs.
5991 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5992 add_target_specific.
5993 (class Output_data_reloc) [SHT_RELA]: Likewise.
5994 * output.cc (Output_reloc::Output_reloc): Add four new versions
5995 for absolute relocs and target specific relocs.
5996 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5997 (Output_reloc::get_symbol_index): Likewise.
5998 (Output_reloc::local_section_offset): Check that local_sym_index_
5999 is not TARGET_CODE or 0.
6000 (Output_reloc::symbol_value): Likewise.
6001 (Output_reloc::write) [SHT_RELA]: Call target for target specific
6002 reloc.
6003 * target.h (class Target): Add reloc_symbol_index and reloc_addend
6004 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
6005 functions.
6006 * layout.cc (add_target_dynamic_tags): Use output section for
6007 DT_PLTRELSZ and DT_JMPREL.
6008
3a44184e
ILT
60092010-01-07 Ian Lance Taylor <iant@google.com>
6010
6011 PR 11061
6012 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
6013 function.
6014 (class Output_data_reloc_generic): Define.
6015 (class Output_data_reloc_base): Change base class to
6016 Output_data_reloc_generic. Change add() method to call
6017 bump_relative_reloc_count for a relative reloc. Remove
6018 sort_relocs_ field.
6019 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
6020 to sort_relocs().
6021 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
6022 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
6023 appropriate.
6024 * layout.h (class Layout): Update declaration.
6025
ea715a34
ILT
60262010-01-07 Ian Lance Taylor <iant@google.com>
6027
6028 * output.h (class Output_data): Add const version of
6029 output_section and do_output_section.
6030 (class Output_section_data): Add const version of
6031 do_output_section.
6032 (class Output_section): Likewise.
6033 * layout.cc (Layout::add_target_dynamic_tags): New function.
6034 * layout.h (class Layout): Update declarations.
6035 * arm.cc (Target_arm::do_finalize_sections): Use
6036 add_target_dynamic_tags.
6037 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6038 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6039 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6040 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6041
659948a4
ILT
60422010-01-07 Ian Lance Taylor <iant@google.com>
6043
6044 PR 11042
6045 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
6046 object as needed.
6047
9d3b86f6
ILT
60482010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
6049 Ian Lance Taylor <iant@google.com>
6050
6051 PR 11019
6052 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
6053 Xindex::read_symtab_xindex.
6054
bb0d3eb0
DK
60552010-01-07 Doug Kwan <dougkwan@google.com>
6056
6057 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
6058 (Insn_template::thumb16_bcond_insn): New method declaration.
6059 (Insn_template): Fix spelling.
6060 (Stub::thumb16_special): New method declaration.
6061 (Stub::do_write): Define virtual method which was previously pure
6062 virtual.
6063 (Stub::do_thumb16_special): New method declaration.
6064 (Stub::do_fixed_endian_write): New template member.
6065 (Reloc_stub::do_write): Remove.
6066 (Reloc_stub::do_fixed_endian_write): Remove.
6067 (Cortex_a8_stub): New class definition.
6068 (Stub_factory::make_cortex_a8_stub): New method definition.
6069 (Stub_factory::Stub_factory): Add missing static storage class
6070 qualifier for elf32_arm_stub_a8_veneer_blx.
6071
ffeef7df
ILT
60722010-01-07 Ian Lance Taylor <iant@google.com>
6073
dc3f80fe
ILT
6074 PR 10980
6075 * options.h (class General_options): Add --warn-unresolved-symbols
6076 and --error-unresolved-symbols.
6077 * errors.cc (Errors::undefined_symbol): Implement
6078 --warn-unresolved-symbols.
6079
ffeef7df
ILT
6080 * options.h (class General_options): Add -z text and -z textoff.
6081 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
6082
f1ec9ded
ST
60832010-01-06 Sriraman Tallam <tmsriram@google.com>
6084
6085 * gc.h (Garbage_collection::Cident_section_map): New typedef.
6086 (Garbage_collection::cident_sections): New function.
6087 (Garbage_collection::add_cident_section): New function.
6088 (Garbage_collection::cident_sections_): New member.
6089 (gc_process_relocs): Add references to sections whose names are C
6090 identifiers.
6091 * gold.h (cident_section_start_prefix): New constant.
6092 (cident_section_stop_prefix): New constant.
6093 (is_cident): New function.
6094 * layout.cc (Layout::define_section_symbols): Replace string constants
6095 with the newly defined constants.
6096 * object.cc (Sized_relobj::do_layout): Track sections whose names are
6097 C identifiers.
6098 * testsuite/Makefile.am: Add gc_orphan_section_test.
6099 * testsuite/Makefile.in: Regenerate.
6100 * testsuite/gc_orphan_section_test.cc: New file.
6101 * testsuite/gc_orphan_section_test.sh: New file.
6102
6eda8c29
ILT
61032010-01-06 Ian Lance Taylor <iant@google.com>
6104
b9674e17
ILT
6105 PR 10980
6106 * options.h (class General_options): Add --warn-shared-textrel.
6107 * layout.cc (Layout::finish_dynamic_section): Implement
6108 --warn-shared-textrel.
6109
6eda8c29
ILT
6110 PR 10980
6111 * options.h (class General_options): Add --warn-multiple-gp.
6112
32dcd44e
ILT
61132010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6114
6115 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
6116 $(THREADSLIB) and $(LIBDL).
6117 * Makefile.in: Rebuild.
6118
a192ba05
ILT
61192010-01-06 Ian Lance Taylor <iant@google.com>
6120
6121 PR 10980
6122 * options.cc (General_options::parse_section_start): New function.
6123 (General_options::section_start): New function.
6124 (General_options::General_options): Initialize all members.
6125 * options.h: Include <map>
6126 (class General_options): Add --section-start. Add section_starts_
6127 member.
6128 * layout.cc (Layout::attach_allocated_section_to_segment): If
6129 --section-start was used, set the address of the segment. Remove
6130 local sort_sections.
6131 (Layout::relaxation_loop_body): If the address of the load segment
6132 has been set by --section-start, don't use it.
6133 * output.h (Output_segment::update_flags_for_output_section): New
6134 function.
6135 * output.cc (Output_segment::add_output_section): Call
6136 update_flags_for_output_section.
6137
dde3f402
ILT
61382010-01-05 Ian Lance Taylor <iant@google.com>
6139
62dfdd4d
ILT
6140 PR 10980
6141 * options.h (class General_options): Add --undefined-version.
6142 * script.cc (struct Version_expression): Add was_matched_by_symbol
6143 field.
6144 (Version_script_info::matched_symbol): New function.
6145 (Version_script_info::get_symbol_version_helper): Call
6146 matched_symbol.
6147 (Version_script_info::check_unmatched_names): New function.
6148 * script.h (class Version_script_info): Update declarations.
6149 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
6150
9c4ae156
ILT
6151 * options.h (class General_options): Use DEFINE_bool_alias for
6152 allow_multiple_definition.
6153 * resolve.cc (Symbol_table::should_override): Don't test
6154 allow_multiple_definition.
6155
dde3f402
ILT
6156 PR 10980
6157 * options.h (class General_options): Add --cref.
6158 * main.cc (main): Print cref table if --cref. Don't close mapfile
6159 until after printing cref table.
6160 * cref.cc: Include "symtab.h".
6161 (class Cref_inputs): Define Cref_table_compare and Cref_table.
6162 (Cref_table_compare::operator()): New function.
6163 (Cref_inputs::gather_cref): New function.
6164 (filecol): New static const.
6165 (Cref_inputs::print_cref): New function.
6166 (Cref::print_cref): New function.
6167 * cref.h: Include <cstdio>.
6168 (class Cref): Update declarations.
6169 * mapfile.h (Mapfile::file): New function.
6170 * object.h (class Object): Define Symbols. Declare virtual
6171 do_get_global_symbols.
6172 (Object::get_global_symbols): New function.
6173 * object.cc (Input_objects::add_object): Pass object to cref_ if
6174 --cref.
6175 (Input_objects::archive_start): Likewise.
6176 (Input_objects::archive_stop): Likewise.
6177 (Input_objects::print_cref): New function.
6178 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
6179 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
6180 --cref.
6181 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
6182 function.
6183 * plugin.h (class Sized_pluginobj): Update declarations.
6184
8781f709
ILT
61852010-01-05 Ian Lance Taylor <iant@google.com>
6186
6187 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
6188 to is_default_version. Rename insdef to insdefault.
6189 (Symbol_table::add_from_relobj): Rename def to is_default_version
6190 and local to is_forced_local.
6191 (Symbol_table::add_from_pluginobj): Likewise.
6192 (Symbol_table::add_from_dynobj): Likewise.
6193 (Symbol_table::define_special_symbol): Rename insdef to
6194 insdefault.
6195
fe35d28d
ILT
61962010-01-04 Ian Lance Taylor <iant@google.com>
6197
30bc8c46
ILT
6198 PR 10980
6199 * options.h (class General_options): Add
6200 --allow-multiple-definition and -z muldefs.
6201 * resolve.cc (Symbol_table::should_override): Don't warn about a
6202 multiple symbol definition if --allow-multiple-definition or -z
6203 muldefs.
6204
7eaea549
ILT
6205 PR 10980
6206 * options.h (class General_options): Add --add-needed and
6207 --copy-dt-needed-entries. Tweak --as-needed help entry.
6208 * object.cc (Input_objects::check_dynamic_dependencies): Give an
6209 error if --copy-dt-needed-entries aka --add-needed is used and
6210 would cause a change in behaviour.
6211
fe35d28d
ILT
6212 PR 10980
6213 * options.h (class General_options): Add -G as a short version of
6214 --shared. Add no-op options -assert, -g, and -i.
6215
55a2bb35
ST
62162010-01-04 Sriraman Tallam <tmsriram@google.com>
6217
6218 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
6219 check for .text or .gnu.linkonce.t sections.
6220 * icf.cc (Icf::find_identical_sections): Ditto.
6221 Change the detection for mangled function name within the section
6222 name.
6223 * icf.h (is_section_foldable_candidate): New function.
6224
719328e1
ILT
62252009-12-30 Ian Lance Taylor <iant@google.com>
6226
6227 PR 10980
6228 * options.h (class General_options): Permit two dashes with
6229 --retain-symbols-file.
6230
d7bb5745
ILT
62312009-12-30 Ian Lance Taylor <iant@google.com>
6232
403a15dd
ILT
6233 PR 10979
6234 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
6235 don't put the file header and segment headers in the text
6236 segment.
6237
eda294df
ILT
6238 PR 10979
6239 * common.cc (Sort_commons::operator()): Stabilize sort when both
6240 entries are NULL.
6241 (Symbol_table::do_allocate_commons_list): When allocating common
6242 symbols, skip a symbol which is no longer common.
6243 * symtab.h (Symbol::is_common): Test whether the symbol comes from
6244 an object before checking its type.
6245 * testsuite/common_test_2.c: New file.
6246 * testsuite/common_test_3.c: New file.
6247 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
6248 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
6249 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
6250 (common_test_2_pic.o, common_test_2.so): New targets.
6251 (common_test_3_pic.o, common_test_3.so): New targets.
6252 * testsuite/Makefile.in: Rebuild.
6253
d7bb5745
ILT
6254 PR 10979
6255 * script.cc (read_input_script): If we see a new SECTIONS clause,
6256 and we have added an input section, give an error.
6257 * layout.h (class Layout): Add have_added_input_section function.
6258 Add have_added_input_section_ field.
6259 * layout.cc (Layout::Layout): Initialize
6260 have_added_input_section_.
6261 (Layout::layout): Set have_added_input_section_.
6262 (Layout::layout_eh_frame): Likewise.
6263
fc59c572
ILT
62642009-12-30 Ian Lance Taylor <iant@google.com>
6265
6266 PR 10931
6267 * options.h (class General_options): Add --sort-common option.
6268 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6269 * common.cc (Sort_common): Add sort_order parameter to
6270 constructor. Add sort_order_ field.
6271 (Sort_commons::operator): Check sort_order_.
6272 (Symbol_table::allocate_commons): Determine the sort order.
6273 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6274 Change all callers.
6275 (Symbol_table::do_allocate_commons_list): Likewise.
6276
1c74fab0
ILT
62772009-12-30 Ian Lance Taylor <iant@google.com>
6278
6279 PR 10916
6280 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6281 symbols from this object, don't change the visibility of an
6282 undefined symbol.
6283 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6284
6affe781
ILT
62852009-12-30 Ian Lance Taylor <iant@google.com>
6286
6287 PR 10861
6288 * script.h (class Version_script_info): Define Language enum.
6289 Update declarations. Define Glob, Exact, and Lookup types. Add
6290 new fields globals_, locals_, and is_finalized_.
6291 * script.cc: Various formatting fixes.
6292 (class Parser_closure): Change language_stack_ from a vector of
6293 std::string to one of Version_script_info::Language. Adjust all
6294 uses accordingly.
6295 (class Lazy_demangler): Remove.
6296 (struct Version_expression): Change language from std::string to
6297 Version_script_info::Language.
6298 (Version_script_info::Version_script_info): New function.
6299 (Version_script_info::~Version_script_info): Don't call clear.
6300 (Version_script_info::finalize): New function.
6301 (Version_script_info::build_lookup_tables): New function.
6302 (Version_script_info::build_expression_list_lookup): New
6303 function.
6304 (Version_script_info::get_symbol_version_helper): Rewrite to use
6305 lookup tables.
6306 (Version_script_info::print_expression_list): Adjust to use
6307 Version_script_info::Language.
6308 (script_push_lex_into_version_mode): Check that the version script
6309 has not been finalized.
6310 (version_script_push_lang): Change language string to
6311 Version_script_info::Language.
6312 * options.cc (Command_line::version_script): New function.
6313 * options.h (class General_options): Add finalize_dynamic_list
6314 function. Change version_script from declaration to definition.
6315 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6316 * testsuite/version_script.map: Remove duplicate def of foo.
6317 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6318 version_script.map.
6319 * testsuite/Makefile.in: Rebuild.
6320
818bf354
ILT
63212009-12-30 Ian Lance Taylor <iant@google.com>
6322
6323 PR 10843
6324 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6325 if the input symbol index is 0, make the output symbol index 0.
6326
ebcc8304
ILT
63272009-12-30 Ian Lance Taylor <iant@google.com>
6328
6329 PR 10670
6330 * options.h (class General_options): Add -x/--discard-all.
6331 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6332 --discard-all. If the local symbol needs a dynamic entry, check
6333 that before handling --discard-locals.
6334
176fe33f
ILT
63352009-12-30 Ian Lance Taylor <iant@google.com>
6336
bb321bb1
ILT
6337 PR 10450
6338 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6339 flags to PF_R.
6340 (Output_segment::add_output_section): Don't change the flags if
6341 the type is PT_TLS.
6342
176fe33f
ILT
6343 PR 10450
6344 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6345 GNU hash table if they need a dynamic value. Otherwise, don't add
6346 them if they are defined in a dynamic object or are forced local.
6347
e8cd95c7
ILT
63482009-12-29 Ian Lance Taylor <iant@google.com>
6349
1b81fb71
ILT
6350 PR 10450
6351 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6352 .gnu.hash table for a 32-bit target.
6353
8d6d383d
ILT
6354 PR 10450
6355 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6356 regular and a dynamic object only needs a dynamic symbol table
6357 entry if it is externally visible.
6358
e785ec03
ILT
6359 PR 10450
6360 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6361 constructor. Add global_offset_table_ field.
6362 (Target_i386::got_section): Set global_offset_table_.
6363 (Target_i386::do_finalize_sections): Set global_offset_table_
6364 size.
6365 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6366 in constructor. Add global_offset_table_ field.
6367 (Target_x86_64::got_section): Set global_offset_table_.
6368 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6369 size.
6370
1a2dff53
ILT
6371 * layout.cc (Layout::Layout): Initialize increase_relro_.
6372 (Layout::get_output_section): Add is_relro, is_last_relro, and
6373 is_first_non_relro parameters. Change all callers.
6374 (Layout::choose_output_section): Likewise.
6375 (Layout::add_output_section_data): Likewise.
6376 (Layout::make_output_section): Likewise.
6377 (Layout::set_segment_offsets): Clear increase_relro when using a
6378 linker script.
6379 * layout.h (class Layout): Add increase_relro method. Add
6380 increase_relro_ field. Update declarations.
6381 * output.cc (Output_section::Output_section): Initialize
6382 is_last_relro_ and is_first_non_relro_.
6383 (Output_segment::add_output_section): Group relro sections is
6384 do_sort is true. Handle is_last_relro and is_first_non_relro.
6385 (Output_segment::maximum_alignment): Remove relro handling.
6386 (Output_segment::set_section_addresses): Add increase_relro
6387 parameter. Change all callers. Add initial alignment to align
6388 relro sections on separate page. Remove old relro handling.
6389 (Output_segment::set_section_list_addresses): Remove in_relro
6390 parameter. Change all callers.
6391 (Output_segment::set_offset): Add increase parameter. Change all
6392 callers. Remove old relro handling.
6393 * output.h (class Output_section): Add new methods: is_last_relro,
6394 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6395 Add is_last_relro_ and is_first_non_relro_ fields.
6396 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6397 Create separate .got.plt section. Call increase_relro.
6398 * x86_64.cc (Target_x86_64::got_section): Likewise.
6399 * testsuite/relro_script_test.t: Add .got.plt.
6400
f0ba79e2
ILT
6401 PR 10450
6402 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6403 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6404 (Layout::finalize): Call set_dynamic_symbol_size.
6405 (Layout::set_dynamic_symbol_size): New function.
6406 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6407 set_dynamic_symbol_size.
6408
e8cd95c7
ILT
6409 PR 10450
6410 * output.h (class Output_section): Add is_entsize_zero_ field.
6411 * output.cc (Output_section::Output_section): Initialize
6412 is_entsize_zero_.
6413 (Output_section::set_entsize): If two different entsizes are
6414 requested, force it to zero.
6415 (Output_section::add_input_section): Set flags for .debug_str
6416 before updating section flags. Set entsize.
6417 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6418 and SHF_STRING if all input sections have those flags.
6419
3e1b9a8a
RÁE
64202009-12-29 Rafael Espindola <espindola@google.com>
6421
6422 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
6423 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6424 reporting.
3e1b9a8a 6425
3dcad376
ST
64262009-12-29 Sriraman Tallam <tmsriram@google.com>
6427
6428 * options.cc (General_options::parse_version): Allow -v to exit
6429 without an error if there is nothing to link.
6430
084e2665
ILT
64312009-12-29 Ian Lance Taylor <iant@google.com>
6432
6433 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6434 using a version of gcc before 4.1.
6435 * configure: Rebuild.
6436
250acde3
CD
64372009-12-28 Chris Demetriou <cgd@google.com>
6438
6439 * attributes.cc (Output_attributes_section_data::do_write): Use
6440 std::vector::front rather than std::vector::data.
6441
99fff23b
ILT
64422009-12-28 Ian Lance Taylor <iant@google.com>
6443
6444 * symtab.h (class Symbol_table): Add enum Defined.
6445 * resolve.cc (Symbol_table::should_override): Add defined
6446 parameter. Change all callers. Test whether object is NULL
6447 before calling a method on it.
6448 (Symbol_table::report_resolve_problem): Add defined parameter.
6449 Change all callers.
6450 (Symbol_table::should_override_with_special): Likewise.
6451 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6452 parameter. Change all callers.
6453 (Symbol_table::do_define_in_output_data): Likewise.
6454 (Symbol_table::define_in_output_segment): Likewise.
6455 (Symbol_table::do_define_in_output_segment): Likewise.
6456 (Symbol_table::define_as_constant): Likewise.
6457 (Symbol_table::do_define_as_constant): Likewise.
6458 * script.h (class Symbol_assignment): Add is_defsym parameter to
6459 constructor; change all callers.
6460 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6461 parameter. Change all callers. Add is_defsym_ field.
6462 (class Parser_closure): Add parsing_defsym parameter to
6463 constructor; change all callers. Add parsing_defsym accessor
6464 function. Add parsing_defsym_ field.
6465
556bd683
ILT
64662009-12-28 Ian Lance Taylor <iant@google.com>
6467
6468 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 6469 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 6470
1782c879
ILT
64712009-12-23 Ian Lance Taylor <iant@google.com>
6472
6473 * i386.cc (Target_i386::do_calls_non_split): Recognize
6474 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
6475 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6476 -fsplit-stack prologue when using %r11.
1782c879 6477
329ca2b1
ST
64782009-12-21 Sriraman Tallam <tmsriram@google.com>
6479
6480 * options.cc (General_options::parse_version): Make -v continue and do
6481 the link like GNU ld does.
6482
d675ff46
RÁE
64832009-12-17 Rafael Avila de Espindola <espindola@google.com>
6484
6485 * Makefile.am (CCFILES): Add timer.cc.
6486 (HFILES): Add timer.h.
6487 * configure.ac: Check for sysconf and times.
6488 * main.cc: include timer.h.
6489 (main): Use Timer instead of get_run_time.
6490 * timer.cc: New.
6491 * timer.h: New.
6492 * workqueue.cc: include timer.h.
6493 (Workqueue::find_and_run_task):
6494 Report user, sys and wall time.
6495 * Makefile.in: Regenerate.
6496 * config.in: Regenerate.
6497 * configure: Regenerate.
6498
d6344fb5
DK
64992009-12-16 Doug Kwan <dougkwan@google.com>
6500
6501 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6502 sections.
6503 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6504 relaxed input sections.
6505 * output.cc (Output_section::find_relaxed_input_section): Change
6506 return type to Output_relaxed_input_section pointer. Adjust code
6507 for new type of relaxed_input_section_map_.
6508 * output.h (Output_section::find_relaxed_input_section): Change
6509 return type to Output_relaxed_input_section pointer.
6510 (Output_section::Output_relaxed_input_section_by_input_section_map):
6511 New type.
6512 (Output_section::relaxed_input_section_map_): Change type to
6513 Output_section::Output_relaxed_input_section_by_input_section_map.
6514 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6515 input section.
6516
0e0d5469
ILT
65172009-12-15 Ian Lance Taylor <iant@google.com>
6518
6519 * layout.cc (Layout::create_shstrtab): Only write out after input
6520 sections if we are compressing debug sections.
6521
0649a889
ILT
65222009-12-15 Ian Lance Taylor <iant@google.com>
6523
6524 * archive.cc (Archive::add_symbols): Only look up a symbol without
6525 a version if there is, in fact, a version.
6526
2ea97941
ILT
65272009-12-14 Ian Lance Taylor <iant@google.com>
6528
6529 Revert -Wshadow changes, all changes from:
6530 2009-12-11 Doug Kwan <dougkwan@google.com>
6531 2009-12-11 Nick Clifton <nickc@redhat.com>
6532 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6533
b0eec2cc
DK
65342009-12-11 Doug Kwan <dougkwan@google.com>
6535
6536 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6537 due to -Wshadow.
6538 * attributes.cc (Object_attribute::size): Ditto.
6539 (Attributes_section_data::size): Ditto.
6540 (Attributes_section_data::Attributes_section_data): Ditto.
6541 (Output_attributes_section_data::do_write): Ditto.
6542 * attributes.h (Object_attribute::set_type): Ditto.
6543 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6544
91d6fa6a
NC
65452009-12-11 Nick Clifton <nickc@redhat.com>
6546
6547 * archive.cc: Fix shadowed variable warnings.
6548 * arm.cc: Likewise.
6549 * compressed_output.cc: Likewise.
6550 * compressed_output.h: Likewise.
6551 * configure: Likewise.
6552 * dwarf_reader.cc: Likewise.
6553 * dynobj.cc: Likewise.
6554 * dynobj.h: Likewise.
6555 * ehframe.cc: Likewise.
6556 * ehframe.h: Likewise.
6557 * errors.cc: Likewise.
6558 * expression.cc: Likewise.
6559 * fileread.cc: Likewise.
6560 * fileread.h: Likewise.
6561 * freebsd.h: Likewise.
6562 * i386.cc: Likewise.
6563 * icf.cc: Likewise.
6564 * incremental.h: Likewise.
6565 * layout.cc: Likewise.
6566 * layout.h: Likewise.
6567 * mapfile.cc: Likewise.
6568 * merge.cc: Likewise.
6569 * merge.h: Likewise.
6570 * object.cc: Likewise.
6571 * object.h: Likewise.
6572 * options.h: Likewise.
6573 * output.cc: Likewise.
6574 * output.h: Likewise.
6575 * parameters.cc: Likewise.
6576 * plugin.cc: Likewise.
6577 * powerpc.cc: Likewise.
6578 * reduced_debug_output.cc: Likewise.
6579 * reduced_debug_output.h: Likewise.
6580 * reloc.cc: Likewise.
6581 * reloc.h: Likewise.
6582 * resolve.cc: Likewise.
6583 * script-sections.cc: Likewise.
6584 * script.cc: Likewise.
6585 * script.h: Likewise.
6586 * sparc.cc: Likewise.
6587 * symtab.cc: Likewise.
6588 * symtab.h: Likewise.
6589 * target-select.cc: Likewise.
6590 * target-select.h: Likewise.
6591 * token.h: Likewise.
6592 * workqueue.cc: Likewise.
6593 * workqueue.h: Likewise.
6594 * x86_64.cc: Likewise.
6595
a0351a69
DK
65962009-12-10 Doug Kwan <dougkwan@google.com>
6597
6598 * arm.cc (attributes.h): New include.
6599 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6600 (Arm_relobj::~Arm_relobj): Delete object pointed by
6601 attributes_section_data_.
6602 (Arm_relobj::attributes_section_data): New method definition.
6603 (Arm_relobj::attributes_section_data_): New data member declaration.
6604 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6605 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6606 attributes_section_data_.
6607 (Arm_dynobj::attributes_section_data): New method definition.
6608 (Arm_dynobj::attributes_section_data_): New data member declaration.
6609 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6610 initialization value of may_use_blx_ to false.
6611 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6612 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6613 object attributes to compute results instead of hard-coding.
6614 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6615 Target_arm::get_secondary_compatible_arch,
6616 Target_arm::set_secondary_compatible_arch
6617 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6618 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6619 New method declarations.
6620 (Target_arm::get_aeabi_object_attribute): New method definition.
6621 (Target_arm::attributes_section_data_): New data member declaration.
6622 (read_arm_attributes_section): New template definition.
6623 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6624 (Arm_dynobj::do_read_symbols): Ditto.
6625 (Target_arm::do_finalize_sections): Merge attributes sections from
6626 input. Check for BLX use after attributes section merging.
6627 Fix __exidx_start and __exidx_end visibility. Create an
6628 .ARM.attributes section if necessary.
6629 (Target_arm::get_secondary_compatible_arch,
6630 Target_arm::set_secondary_compatible_arch,
6631 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6632 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 6633 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
6634 New method definitions.
6635
b59befec
ILT
66362009-12-09 Ian Lance Taylor <iant@google.com>
6637
6638 * plugin.cc (Plugin::load): Don't cast from void* to a function
6639 pointer.
6640
1276bc89
ILT
66412009-12-09 Ian Lance Taylor <iant@google.com>
6642
6643 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6644 information fields.
6645
2f2de248
L
66462009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6647
6648 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6649 Replace two_file_shared_1.so with two_file_shared_2.so.
6650 * testsuite/Makefile.in: Regenerated.
6651
4f787271
DK
66522009-12-08 Doug Kwan <dougkwan@google.com>
6653
6654 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6655 (HFILES): Add attributes.h and int_encoding.h.
6656 * Makefile.in: Regenerate.
6657 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6658 function definitions to int_encoding.cc
6659 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6660 prototypes to int_encoding.h
6661 * reduced_debug_output.cc (int_encoding.h): New include.
6662 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6663 function definitions to int_encoding.cc
6664 (insert_into_vector, read_from_pointer): Move template definitions to
6665 int_encoding.h
6666 * attributes.cc: New file.
6667 * attributes.h: New file.
6668 * int_encoding.cc: New file.
6669 * int_encoding.h: New file.
6670
20b52f1a
RÁE
66712009-12-07 Rafael Avila de Espindola <espindola@google.com>
6672
6673 PR gold/11055
6674 * incremental-dump.cc (dump_incremental_inputs): New.
6675 (main): Use dump_incremental_inputs.
6676
53d7974c
L
66772009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6678
6679 PR gold/10893
6680 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6681 checking elfcpp::STT_FUNC.
6682 (Target_i386::Relocate::relocate): Likewise.
6683 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6684
6685 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6686 symbols from shared libraries into normal FUNC symbols.
6687
6688 * symtab.h (Symbol): Add is_func and use it.
6689
05a352e6
DK
66902009-12-05 Doug Kwan <dougkwan@google.com>
6691
6692 * arm.cc (Target_arm::arm_info): Initialize new fields
6693 attributes_section and attributes_vendor.
6694 * i386.cc (Target_i386::i386_info): Same.
6695 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6696 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6697 fields attributes_section and attributes_vendor.
53d7974c 6698 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
6699 * target.h (Target::attributes_section, Target::attributes_vendor,
6700 Target::is_attributes_section, Target::attribute_arg_type,
6701 Target::attributes_order): New method definitions.
6702 (Target::Target_info::attributes_section,
6703 Target::Target_info::attributes_vendor): New fields.
6704 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6705 virtual method definitions.
6706 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6707 attributes_section and attributes_vendor.
6708 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6709
f4e5969c
DK
67102009-12-05 Doug Kwan <dougkwan@google.com>
6711
6712 * arm.cc: Update comments about interworking and stub generation.
6713 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6714 considered as non-PIC.
6715 (Arm_relocate_functions::base_abs): Fix formatting.
6716 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6717 of function to use GOT entry address instead of offset.
6718 (Target_arm::Scan::global): Issue an error if a symbol would need a
6719 PLT does not get one because it is untyped. Remove code to create
6720 dynamic symbols for relative branches.
6721 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6722 takes unsigned integer instead of boolean.
6723
1abce4a6
L
67242009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6725
6726 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6727 (two_file_test_LDADD): Likewise.
6728 (common_test_1_LDADD): Likewise.
6729 (exception_test_LDADD) Likewise.
6730 (weak_test_LDADD): Likewise.
6731 (many_sections_test_LDADD): Likewise.
6732 (initpri1_LDADD): Likewise.
6733 (script_test_1_LDADD): Likewise.
6734 (script_test_2_LDADD): Likewise.
6735 (justsyms_LDADD): Likewise.
6736 (binary_test_LDADD): Likewise.
6737 (large_LDADD): Likewise.
6738 * testsuite/Makefile.in: Regenerated.
6739
adcf2816 67402009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 6741
adcf2816
L
6742 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6743 (Symbol_table::override_with_special): Likewise.
6744 (Symbol_table::add_from_object): Likewise.
6745
28e67f5d
RÁE
67462009-12-04 Rafael Avila de Espindola <espindola@google.com>
6747
6748 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6749 Don't set the data_offset twice.
6750
ae10a101
RÁE
67512009-12-04 Rafael Avila de Espindola <espindola@google.com>
6752
6753 * testsuite/Makefile.in: Regenerate.
6754
f59f41f3
DK
67552009-12-03 Doug Kwan <dougkwan@google.com>
6756
6757 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6758 (Target_arm::do_finalize_sections): Add parameter for symbol table
6759 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6760 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6761 parameter for symbol table pointer.
6762 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6763 an additional parameter for a pointer to symbol table.
6764 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6765 parameter for a symbol table pointer.
6766 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6767 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6768 Ditto.
6769 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6770 parameter for a symbol table pointer.
6771
ca55d848
RÁE
67722009-12-03 Rafael Avila de Espindola <espindola@google.com>
6773
6774 * incremental.cc (Incremental_inputs_header)
6775 (Incremental_inputs_header_write, Incremental_inputs_entry)
6776 (Incremental_inputs_entry_write): Move ...
6777 * incremental.h (Incremental_inputs_header)
6778 (Incremental_inputs_header_write, Incremental_inputs_entry)
6779 (Incremental_inputs_entry_write): here.
6780
3aec4f9c
RÁE
67812009-12-02 Rafael Avila de Espindola <espindola@google.com>
6782
6783 * incremental.cc (make_sized_incremental_binary): Set the target.
6784 Error if it is incompatible.
6785 * output.h (Output_file): Add filename method.
6786
9c0ae74d
RÁE
67872009-12-02 Rafael Avila de Espindola <espindola@google.com>
6788
6789 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6790 from the get_* methods.
6791
a45500ae
RÁE
67922009-12-02 Rafael Avila de Espindola <espindola@google.com>
6793
6794 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6795 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6796 Write 0 for the data_offset of scripts.
6797
325e6408
RÁE
67982009-12-02 Rafael Avila de Espindola <espindola@google.com>
6799
6800 * testsuite/Makefile.am: Add the incremental_test.sh test.
6801 * testsuite/incremental_test.sh: New.
6802 * testsuite/incremental_test_1.c: New.
6803 * testsuite/incremental_test_2.c: New.
6804
954c3e2e
RÁE
68052009-12-01 Rafael Avila de Espindola <espindola@google.com>
6806
6807 * incremental-dump.cc (main): Fix typos.
6808
f8086623
RÁE
68092009-11-27 Rafael Avila de Espindola <espindola@google.com>
6810
6811 PR gold/11025
6812 * incremental-dump.cc (main): Use llu to print 64 bit values.
6813
3b0dd6ac
L
68142009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6815 H.J. Lu <hongjiu.lu@intel.com>
6816
6817 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6818 $(LIBDL).
6819 (incremental_dump_LDADD): Likewise.
6820 * Makefile.in: Regenerated.
6821
a6d1ef57 68222009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 6823
a6d1ef57
DK
6824 Revert:
6825
6826 2009-11-25 Doug Kwan <dougkwan@google.com>
6827
6828 * arm.cc (Target_arm::Target_arm): Move method definition
6829 outside of class definition. Add code to handle
6830 --target1-rel, --target1-abs and --target2= options.
6831 (Target_arm::get_reloc_reloc_type): Change method to be
6832 non-static and const.
6833 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6834 New data member declaration.
6835 (Target_arm::Scan::local, Target_arm::Scan::global,
6836 Target_arm::Relocate::relocate,
6837 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6838 Adjust call to Target_arm::get_real_reloc_type.
6839 (Target_arm::get_real_reloc_type): Use command line options
6840 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6841 * options.h (--target1-rel, --target1-abs, --target2): New
6842 ARM-only options.
6843
50aeb7d4
DK
68442009-11-25 Doug Kwan <dougkwan@google.com>
6845
6846 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6847 class definition. Add code to handle --target1-rel, --target1-abs
6848 and --target2= options.
6849 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6850 and const.
6851 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6852 member declaration.
6853 (Target_arm::Scan::local, Target_arm::Scan::global,
6854 Target_arm::Relocate::relocate,
6855 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6856 call to Target_arm::get_real_reloc_type.
6857 (Target_arm::get_real_reloc_type): Use command line options to
6858 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6859 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6860 options.
6861
51938283
DK
68622009-11-25 Doug Kwan <dougkwan@google.com>
6863
6864 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6865 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6866 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6867 formatting.
6868 (Arm_relocate_functions::thm_call): Replace body with a call to
6869 Arm_relocate_functions::thumb_branch_common.
6870 (Arm_relocate_functions::thm_jump24,
6871 Arm_relocate_functions::thm_xpc22): New method definitions.
6872 (Arm_relocate_functions::thumb_branch_common): New method definition.
6873 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6874 operator.
6875 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6876 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6877
e2b8f3c4
RÁE
68782009-11-24 Rafael Avila de Espindola <espindola@google.com>
6879
6880 * Makefile.am: Build incremental-dump
6881 * Makefile.in: Regenerate.
6882 * incremental-dump.cc: New.
6883 * incremental.cc (Incremental_inputs_header_data,
6884 Incremental_inputs_entry_data): Move to incremental.h
6885 * incremental.h: (Incremental_inputs_header_data,
6886 Incremental_inputs_entry_data): Move from incremental.cc
6887
bcba9aec
RÁE
68882009-11-24 Rafael Avila de Espindola <espindola@google.com>
6889
6890 * incremental.cc (Incremental_inputs_header,
6891 Incremental_inputs_header_write, Incremental_inputs_entry,
6892 Incremental_inputs_entry_write): Add a typedef with the data type.
6893
7c3afe08
RÁE
68942009-11-24 Rafael Avila de Espindola <espindola@google.com>
6895
6896 * incremental.cc (Incremental_inputs_header,
6897 Incremental_inputs_header_write, Incremental_inputs_entry,
6898 Incremental_inputs_entry_write): Update comment about which
6899 type has the filed descriptions.
6900
d204b6e9
DK
69012009-11-15 Doug Kwan <dougkwan@google.com>
6902
6903 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6904 (Arm_relocate_functions::arm_branch_common): Change method defintion
6905 in class definition to a method declaration and update list of formal
6906 parameters.
6907 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6908 Arm_relocation_functions::jump24): Adjust call to
6909 Arm_relocate_functions::arm_branch_common. Update list of formal
6910 parameters.
6911 (Arm_relocate_functions::xpc25): New method definition.
6912 (Arm_relocate_functions::arm_branch_common): Move method defintion
6913 out from class definition. Use stubs for mode-switching and extending
6914 branch ranges.
6915 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6916 specially. Change code to enable use of stubs in ARM branches.
6917
43d12afe
DK
69182009-11-10 Doug Kwan <dougkwan@google.com>
6919
6920 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6921 in method declaration.
6922 (Target_arm::relocate_stub): New method declaration.
6923 (Target_arm::default_target): Change to return a pointer instead of
6924 a const reference.
6925 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6926 Target_arm::default_target.
6927 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6928 method definition.
6929 (Target_arm::relocate_section): Adjust view.
6930 (Target_arm::relocate_stub): New method definition.
6931
ac33a407
DK
69322009-11-10 Doug Kwan <dougkwan@google.com>
6933
6934 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6935 a format warning.
6936 * incremental.cc (open_incremental_binary): Initialized local
6937 variables to avoid warnings.
6938 * object.cc (make_elf_object): Ditto.
6939 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6940 a format warning.
e1df38aa 6941
88ee28e9
L
6942009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6943
6944 PR gold/10930
6945 * testsuite/plugin_test.c: Include "config.h".
6946
2daedcd6
DK
69472009-11-09 Doug Kwan <dougkwan@google.com>
6948
6949 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6950 (arm_symbol_value): Remove.
6951 (Arm_relocate_functions::arm_branch_common,
6952 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6953 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6954 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6955 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6956 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6957 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6958 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6959 Arm_relocate_functions::thm_mobw_abs_nc,
6960 Arm_relocate_functions::thm_mov_abs,
6961 Arm_relocate_functions::movw_prel_nc,
6962 Arm_relocate_functions::thm_movt_abs,
6963 Arm_relocate_functions::movt_prel,
6964 Arm_relocate_functions::thm_movw_prel_nc,
6965 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6966 (Target_arm::Relocate::relocate): Only decompose address into two
6967 parts if relocation type uses the thumb-bit and pass the actual
6968 bit instead of a flag indicating that the thumb-bit is used. Adjust
6969 calls to methods in Arm_relocate_functions for this change.
6970
1276bc89 69712009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
6972
6973 PR 10925
6974 * reloc.cc: Instantiate
6975 Sized_relobj::initialize_input_to_output_maps and
6976 Sized_relobj:free_input_to_output_maps.
6977
e53ad1b5
ILT
69782009-11-06 Ian Lance Taylor <iant@google.com>
6979
6980 PR 10876
6981 * defstd.cc (in_segment): Set only_if_ref true for "end".
6982
eb44217c
DK
69832009-11-06 Doug Kwan <dougkwan@google.com>
6984
6985 * arm.cc (class Reloc_stub): Correct a comment.
6986 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6987 (Target_arm::scan_section_for_stubs): New method declaration.
6988 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6989 Change methods from private to protected.
6990 (Target_arm::do_may_relax): New method definition.
6991 (Target_arm::do_relax, Target_arm::group_sections,
6992 Target_arm::scan_reloc_for_stub,
6993 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6994 (Target_arm::arm_input_section_map_): New data member declaration.
6995 (Target_arm::scan_reloc_for_stub,
6996 Target_arm::scan_reloc_section_for_stubs,
6997 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6998 Target_arm::do_relax): New method definitions.
6999
5d329b7d
ILT
70002009-11-06 Mikolaj Zalewski <mikolaj@google.com>
7001
7002 * configure.ac: Check for (struct stat)::st_mtim
7003 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
7004 * config.in: Regenerate.
7005 * configure: Regenerate.
7006
96a0d71b
ILT
70072009-11-05 Ian Lance Taylor <iant@google.com>
7008
7009 PR 10910
7010 * output.cc (Output_segment::add_output_section): Add missing
7011 return statement.
7012
594c8e5e
ILT
70132009-11-04 Ian Lance Taylor <iant@google.com>
7014
7015 PR 10880
7016 * object.h (class Object): Add is_needed and set_is_needed
7017 methods. Add is_needed_ field. Make bool fields into bitfields.
7018 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
7019 defined in a dynamic object and referenced by a regular object,
7020 set is_needed for the dynamic object.
7021 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
7022 if the file is marked with as_needed and it is not needed.
7023
22b127cc
ILT
70242009-11-04 Ian Lance Taylor <iant@google.com>
7025
7026 PR 10887
7027 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
7028 tags if data is discarded by linker script.
7029 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7030 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7031 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7032 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7033
f5c870d2
ILT
70342009-11-04 Ian Lance Taylor <iant@google.com>
7035
7036 * layout.cc (Layout::get_output_section): Add is_interp and
7037 is_dynamic_linker_section parameters. Change all callers.
7038 (Layout::choose_output_section): Likewise.
7039 (Layout::make_output_section): Likewise.
7040 (Layout::add_output_section_data): Add is_dynamic_linker_section
7041 parameter. Change all callers.
7042 * layout.h (class Layout): Update declarations.
7043 * output.h (class Output_section): Add is_interp, set_is_interp,
7044 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
7045 Add is_interp_, is_dynamic_linker_section_ fields. Change
7046 generate_code_fills_at_write_ to a bitfield.
7047 * output.cc (Output_section::Output_sections): Initialize new
7048 fields.
7049 (Output_segment::add_output_section): Add do_sort parameter.
7050 Change all callers.
7051
1ae4d23b
ILT
70522009-11-03 Ian Lance Taylor <iant@google.com>
7053
7054 PR 10860
7055 * options.h (class General_options): Add --warn-common.
7056 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
7057 merging two common symbols.
7058 (Symbol_table::should_override): Handle --warn-common when merging
7059 a common symbol with a defined symbol. Use report_resolve_problem
7060 for multiple definitions.
7061 (Symbol_table::report_resolve_problem): New function.
7062 * symtab.h (class Symbol_table): Declare report_resolve_problem.
7063
55da9579
DK
70642009-11-03 Doug Kwan <dougkwan@google.com>
7065
7066 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
7067 stub_factory_.
7068 (Target_arm::stub_factory): New method definition.
7069 (Target_arm::new_arm_input_section,
7070 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
7071 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 7072 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
7073 New type definitions.
7074 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
7075 member declarations.
7076 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
7077 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
7078 New method definitions.
7079
37a9ac43
ILT
70802009-11-03 Ian Lance Taylor <iant@google.com>
7081
7082 * options.h (class General_options): Add --warn_constructors.
7083
b3d6a3d4
ILT
70842009-11-03 Ian Lance Taylor <iant@google.com>
7085
7086 PR 10893
7087 * defstd.cc (in_section): Add entries for __rel_iplt_start,
7088 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
7089
934b01dd
ILT
70902009-11-03 Ian Lance Taylor <iant@google.com>
7091
7092 PR 10895
7093 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
7094 --msgid-bugs-address.
7095 (install-pdf): New target.
7096 (install-data_yes): Look up one directory to find mkinstalldirs.
7097
03c1939b
L
70982009-11-03 H.J. Lu <hongjiu.lu@intel.com>
7099
7100 * po/Make-in (.po.gmo): Don't generate .gmo files in source
7101 tree.
7102
ebd95253
DK
71032009-10-30 Doug Kwan <dougkwan@google.com>
7104
7105 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
7106
e9bbb538
DK
71072009-10-30 Doug Kwan <dougkwan@google.com>
7108
7109 * arm.cc (Stub_addend_reader): New struct template definition
7110 and partial specializations.
7111 (Stub_addend_reader::operator()): New method definition for a
7112 partially specialized template.
7113
d5b40221
DK
71142009-10-30 Doug Kwan <dougkwan@google.com>
7115
7116 * arm.cc (Arm_relobj::processor_specific_flags): New method
7117 definition.
7118 (Arm_relobj::do_read_symbols): New method declaration.
7119 (Arm_relobj::processor_specific_flags_): New data member declaration.
7120 (Arm_dynobj): New class definition.
7121 (Target_arm::do_finalize_sections): Add input_objects parameter.
7122 (Target_arm::do_adjust_elf_header): New method declaration.
7123 (Target_arm::are_eabi_versions_compatible,
7124 (Target_arm::merge_processor_specific_flags): New method declaration.
7125 (Target_arm::do_make_elf_object): New overloaded method definitions
7126 and declaration.
7127 (Arm_relobj::do_read_symbols): New method definition.
7128 (Arm_dynobj::do_read_symbols): Ditto.
7129 (Target_arm::do_finalize_sections): Add input_objects parameters.
7130 Merge processor-specific flags from all input objects.
7131 (Target_arm::are_eabi_versions_compatible,
7132 Target_arm::merge_processor_specific_flags,
7133 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
7134 New method definitions.
7135 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
7136 Input_objects pointer type parameter.
7137 * layout.cc (Layout::finalize): Pass input objects to target's.
7138 finalize_sections function.
7139 * output.cc (Output_file_header::do_sized_write): Set ELF file
7140 header's processor-specific flags.
7141 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
7142 Input_objects pointer type parameter.
7143 * sparc.cc (Target_sparc::do_finalize_sections): Same.
7144 * target.h (Input_objects): New forward class declaration.
7145 (Target::processor_specific_flags,
7146 Target::are_processor_specific_flags_sect): New method definitions.
7147 (Target::finalize_sections): Add input_objects parameter.
7148 (Target::Target): Initialize processor_specific_flags_ and
7149 are_processor_specific_flags_set_.
7150 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
7151 parameter.
7152 (Target::set_processor_specific_flags): New method definition.
7153 (Target::processor_specific_flags_,
7154 Target::are_processor_specific_flags_set_): New data member
7155 declarations.
7156 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
7157 Input_objects pointer type parameter.
7158
ebabffbd
DK
71592009-10-30 Doug Kwan <dougkwan@google.com>
7160
7161 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
7162
ad0f2072
ILT
71632009-10-28 Ian Lance Taylor <iant@google.com>
7164
7165 * object.h (class Relobj): Drop options parameter from
7166 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
7167 do_scan_relocs, do_relocate. Change all callers.
7168 (class Sized_relobj): Drop options parameters from
7169 do_gc_process_relocs, do_scan_relocs, do_relocate,
7170 do_relocate_sections, relocate_sections, emit_relocs_scan,
7171 emit_relocs_scan_reltype. Change all callers.
7172 (struct Relocate_info): Remove options field and all references to
7173 it.
7174 * reloc.h (class Read_relocs): Remove options constructor
7175 parameter and options_ field. Change all callers.
7176 (class Gc_process_relocs, class Scan_relocs): Likewise.
7177 (class Relocate_task): Likewise.
7178 * target-reloc.h (scan_relocs): Remove options parameter. Change
7179 all callers.
7180 (scan_relocatable_relocs): Likewise.
7181 * target.h (class Sized_target): Remove options parameter from
7182 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
7183 all callers.
7184 * gc.h (gc_process_relocs): Remove options parameter. Change all
7185 callers.
7186 * arm.cc: Update functions to remove options parameters.
7187 * i386.cc: Likewise.
7188 * powerpc.cc: Likewise.
7189 * sparc.cc: Likewise.
7190 * x86_64.cc: Likewise.
7191 * testsuite/testfile.cc: Likewise.
7192
8ffa3667
DK
71932009-10-28 Doug Kwan <dougkwan@google.com>
7194
7195 * arm.cc (Arm_relobj): New class definition.
e1df38aa 7196 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
7197 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
7198 New method definitions.
7199
40f36857
CC
72002009-10-28 Cary Coutant <ccoutant@google.com>
7201
7202 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
7203 (Plugin::cleanup_done_): New member.
7204 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
7205 (Plugin_manager::cleanup_done_): Remove.
7206 (Plugin_manager::add_input_file): Edit error message.
7207 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
7208 (Plugin_manager::cleanup): Remove use of cleanup_done_.
7209
2c849493
ILT
72102009-10-27 Mikolaj Zalewski <mikolajz@google.com>
7211
7212 * fileread.cc: (File_read::View::~View): Use the new
7213 data_ownership_ filed.
7214 (File_read::~File_read): Dispose the new whole_file_view_.
7215 (File_read::open): Mmap the whole file if needed.
7216 (File_read::open): Use whole_file_view_ instead of contents_.
7217 (File_read::find_view): Use whole_file_view_ if applicable.
7218 (File_read::do_read): Use whole_file_view_ instead of contents_.
7219 (File_read::make_view): Use whole_file_view_ instead of contents_,
7220 update File_read::View::View call.
7221 (File_read::find_or_make_view): Update File_read::View::View
7222 call.
7223 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
7224 remove contents_
7225 (File_read::View::Data_ownership): New enum.
7226 (File_read::View::View): Replace bool mapped_ with Data_ownership
7227 argument.
7228 (File_read::View::mapped_): Remove (replaced by data_ownership_).
7229 (File_read::View::data_ownership_): New field.
7230 (File_read::contents_): Remove (replaced by whole_file_view_).
7231 (File_read::whole_file_view_): New field.
7232 * options.h (class General_options): Add --keep-files-mapped.
7233
24998053
CC
72342009-10-27 Cary Coutant <ccoutant@google.com>
7235
7236 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
7237 * testsuite/Makefile.am (plugin_test_5): New test case.
7238 * testsuite/Makefile.in: Regenerate.
7239
72adc4fa
DK
72402009-10-25 Doug Kwan <dougkwan@google.com>
7241
7242 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
7243 from private to protected to allow access by child class.
7244 (Sized_relobj::do_relocate_sections): New method declaration.
7245 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 7246 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
7247 Sized_relobj::relocate_sections. Instantiate template explicitly
7248 for different target sizes and endianity.
7249
07f508a2
DK
72502009-10-24 Doug Kwan <dougkwan@google.com>
7251
7252 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
7253 (Arm_input_section::as_arm_input_section): New method.
7254 (Arm_output_section): New class definition.
7255 (Arm_output_section::create_stub_group,
7256 Arm_output_section::group_sections): New method definitions.
7257
10ad9fe5
DK
72582009-10-22 Doug Kwan <dougkwan@google.com>
7259
7260 * arm.cc (Arm_input_section): New class definition.
7261 (Arm_input_section::init, Arm_input_section:do_write,
7262 Arm_input_section::set_final_data_size,
7263 Arm_input_section::do_reset_address_and_file_offset): New method
7264 definitions.
7265
56ee5e00
DK
72662009-10-21 Doug Kwan <dougkwan@google.com>
7267
7268 * arm.cc (Stub_table, Arm_input_section): New forward class
7269 declarations.
7270 (Stub_table): New class defintion.
7271 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7272 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7273 New method definition.
7274
b569affa
DK
72752009-10-21 Doug Kwan <dougkwan@google.com>
7276
7277 * arm.cc: Update copyright comments.
7278 (Target_arm): New forward class template declaration.
7279 (Arm_address): New type.
7280 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7281 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7282 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7283 constants.
7284 (Insn_template): Same.
7285 (DEF_STUBS): New macro.
7286 (Stub_type): New enum type.
7287 (Stub_template): New class definition.
7288 (Stub): Same.
7289 (Reloc_stub): Same.
7290 (Stub_factory): Same.
7291 (Target_arm::Target_arm): Initialize may_use_blx_ and
7292 should_force_pic_veneer_.
7293 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7294 Target_arm::should_force_pic_veneer,
7295 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7296 Target_arm::using_thumb_only, Target_arm:;default_target): New
7297 method defintions.
7298 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7299 New data member declarations.
7300 (Insn_template::size, Insn_template::alignment): New method defintions.
7301 (Stub_template::Stub_template): New method definition.
7302 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7303 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7304 (Stub_factory::Stub_factory): New method definition.
7305 * gold.h (string_hash): New template.
7306 * output.h (Input_section_specifier::hash_value): Use
7307 gold::string_hash.
7308 (Input_section_specifier::string_hash): Remove.
7309 * stringpool.cc (Stringpool_template::string_hash): Use
7310 gold::string_hash.
7311
6c172549
DK
73122009-10-20 Doug Kwan <dougkwan@google.com>
7313
7314 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7315 symbols of relaxed input sections.
7316 * output.h (Output_section::find_relaxed_input_section): Make
7317 method public.
7318
c5617f2f
DK
73192009-10-16 Doug Kwan <dougkwan@google.com>
7320
7321 * dynobj.cc (Versions::Versions): Initialize version_script_.
7322 Only insert base version symbol definition for a shared object
7323 if version script defines any version versions.
7324 (Versions::define_base_version): New method definition.
7325 (Versions::add_def): Check that base version is not needed.
7326 (Versions::add_need): Define base version lazily.
7327 * dynobj.h (Versions::define_base_version): New method declaration.
7328 (Versions::needs_base_version_): New data member declaration.
7329 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7330 (check_DATA): Add no_version_test.stdout.
7331 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7332 New make rules.
7333 * testsuite/Makefile.in: Regenerate.
7334 * testsuite/no_version_test.c: New file.
7335 * testsuite/no_version_test.sh: Ditto.
7336
3c12dcdb
DK
73372009-10-16 Doug Kwan <dougkwan@google.com>
7338
7339 * expression.cc (class Segment_start_expression): New class definition.
7340 (Segment_start_expression::value): New method definition.
7341 (script_exp_function_segment_start): Return a new
7342 Segment_start_expression.
7343 * gold/script-c.h (script_saw_segment_start_expression): New function
7344 prototype.
7345 * script-sections.cc (Script_sections::Script_sections): Initialize
7346 SAW_SEGMENT_START_EXPRESSION_ to false.
7347 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7348 and -Tbbs options to specify section addresses if given in
7349 command line and no SEGMENT_START expression is seen in a script.
7350 * script-sections.h (Script_sections::saw_segment_start_expression,
7351 Script_sections::set_saw_segment_start_expression): New method
7352 definition.
7353 (Script_sections::saw_segment_start_expression_): New data member
7354 declaration.
7355 * script.cc (script_saw_segment_start_expression): New function.
7356 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7357 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7358 script_test_7.sh and script_test_8.sh.
7359 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7360 script_test_8.stdout.
7361 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7362 (script_test_6, script_test_6.stdout, script_test_7,
7363 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7364 * Makefile.in: Regenerate.
7365 * testsuite/script_test_6.sh: New file.
7366 * testsuite/script_test_6.t: Same.
7367 * testsuite/script_test_7.sh: Same.
7368 * testsuite/script_test_7.t: Same.
7369 * testsuite/script_test_8.sh: Same.
7370
64b1ae37
DK
73712009-10-16 Doug Kwan <dougkwan@google.com>
7372
7373 * output.cc (Output_segment::set_section_list_address): Cast
7374 expressions to unsigned long long type to avoid format warnings.
7375
661be1e2
ILT
73762009-10-15 Ian Lance Taylor <iant@google.com>
7377
12edd763 7378 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 7379 dot assignment to script_sections_.
12edd763
ILT
7380 * script-sections.cc (Script_sections::add_dot_assignment):
7381 Initialize if necessary.
7382
68b6574b
ILT
7383 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7384 program headers with no load segment if there is a linker script.
7385
661be1e2
ILT
7386 * layout.cc (Layout::set_segment_offsets): Align the file offset
7387 to the segment aligment for -N or -n with no load segment.
7388 * output.cc (Output_segment::add_output_section): Don't crash if
7389 the first section is a TLS section.
7390 (Output_segment::set_section_list_addresses): Print an error
7391 message if the address moves backward in a linker script.
7392 * script-sections.cc
7393 (Output_section_element_input::set_section_addresses): Don't
7394 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7395 (Orphan_output_section::set_section_addresses): Likewise.
7396
f15f61a7
DK
73972009-10-15 Doug Kwan <dougkwan@google.com>
7398
7399 * layout.cc (Layout::finish_dynamic_section): Generate tags
7400 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7401 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7402 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7403
82bb573a
ILT
74042009-10-14 Ian Lance Taylor <iant@google.com>
7405
7406 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7407 fields.
7408 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7409 data_shdr fields of relinfo.
7410 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7411 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7412 R_386_TLS_LDO_32, adjust based on section flags.
7413 (Target_i386::Relocate::fix_up_ldo): Remove.
7414
374ad285
ILT
74152009-10-13 Ian Lance Taylor <iant@google.com>
7416
7417 Add support for -pie.
7418 * options.h (class General_options): Add -pie and
7419 --pic-executable.
7420 (General_options::output_is_position_independent): Test -pie.
7421 (General_options::output_is_executable): Return true if not shared
7422 and not relocatable.
7423 (General_options::output_is_pie): Remove.
7424 * options.cc (General_options::finalize): Reject incompatible uses
7425 of -pie.
7426 * gold.cc (queue_middle_tasks): A -pie link is not static.
7427 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7428 * symtab.cc (Symbol::final_value_is_known): Return false if
7429 output_is_position_independent.
7430 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7431 output_is_position_independent.
7432 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7433 output_is_position_independent.
7434 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7435 output_is_position_independent.
7436 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7437 two_file_pie_test.
7438 (basic_pie_test.o, basic_pie_test): New targets.
7439 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7440 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7441 (two_file_pie_test): New target.
7442 * testsuite/Makefile.in: Rebuild.
7443 * README: Remove note saying that -pie is not supported.
7444
c6585162
ILT
74452009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7446
7447 * options.h (class General_options): Add -init and -fini.
7448 * layout.cc (Layout::finish_dynamic_section): Emit
7449 given init and fini functions.
7450
032ce4e9
ST
74512009-10-13 Sriraman Tallam <tmsriram@google.com>
7452
7453 * gc.h (gc_process_relocs): Check if icf is enabled using new
7454 function.
7455 * gold.cc (queue_initial_tasks): Likewise.
7456 (queue_middle_tasks): Likewise.
7457 * object.cc (do_layout): Likewise.
7458 * symtab.cc (is_section_folded): Likewise.
7459 * main.cc (main): Likewise.
7460 * reloc.cc (Read_relocs::run): Likewise.
7461 (Sized_relobj::do_scan_relocs): Likewise.
7462 * icf.cc (is_function_ctor_or_dtor): New function.
7463 (Icf::find_identical_sections): Check if function is ctor or dtor when
7464 safe icf is chosen.
7465 * options.h (General_options::icf): Change option to be an enum.
7466 (Icf_status): New enum.
7467 (icf_enabled): New method.
7468 (icf_safe_folding): New method.
7469 (set_icf_status): New method.
7470 (icf_status_): New variable.
7471 * (options.cc) (General_options::finalize): Set icf_status_.
7472 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7473 icf_test and icf_keep_unique_test to use the --icf enum flag.
7474 * testsuite/icf_safe_test.sh: New file.
e1df38aa 7475 * testsuite/icf_safe_test.cc: New file.
032ce4e9 7476
f345227a
ST
74772009-10-12 Sriraman Tallam <tmsriram@google.com>
7478
7479 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7480 includes to gc.h and icf.h.
7481 * arm.cc: Include gc.h.
7482 * gold.cc: Likewise.
7483 * i386.cc: Likewise.
7484 * powerpc.cc: Likewise.
7485 * sparc.cc: Likewise.
7486 * x86_64.cc: Likewise.
7487 * gc.h: Include icf.h.
7488
1c7814ed
ILT
74892009-10-11 Ian Lance Taylor <iant@google.com>
7490
7491 * plugin.cc: Include "gold.h" before other header files.
7492
ae3b5189
CD
74932009-10-10 Chris Demetriou <cgd@google.com>
7494
7495 * options.h (Input_file_argument::Input_file_type): New enum.
7496 (Input_file_argument::is_lib_): Replace with...
7497 (Input_file_argument::type_): New member.
7498 (Input_file_argument::Input_file_argument): Take Input_file_type
7499 'type' rather than boolean 'is_lib' as second argument.
7500 (Input_file_argument::is_lib): Use type_.
7501 (Input_file_argument::is_searched_file): New function.
7502 (Input_file_argument::may_need_search): Handle is_searched_file.
7503 * options.cc (General_options::parse_library): Support -l:filename.
7504 (General_options::parse_just_symbols): Update for Input_file_argument
7505 changes.
7506 (Command_line::process): Likewise.
7507 * archive.cc (Archive::get_file_and_offset): Likewise.
7508 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7509 * script.cc (read_script_file, script_add_file): Likewise.
7510 * fileread.cc (Input_file::Input_file): Likewise.
7511 (Input_file::will_search_for): Handle is_searched_file.
7512 (Input_file::open): Likewise.
7513 * readsyms.cc (Read_symbols::get_name): Likewise.
7514 * testsuite/Makefile.am (searched_file_test): New test.
7515 * testsuite/Makefile.in: Regenerate.
7516 * testsuite/searched_file_test.cc: New file.
7517 * testsuite/searched_file_test_lib.cc: New file.
7518
f3048a1d
ILT
75192009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7520 Ian Lance Taylor <iant@google.com>
7521
7522 * descriptor.cc: Include <cstdio> and "binary-io.h".
7523 (Descriptors::open): Open the files in binary mode always.
7524 * script.cc (Lex::get_token): Treat \r as whitespace.
7525
d4780e57
ILT
75262009-10-09 Ian Lance Taylor <iant@google.com>
7527
7528 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7529
d9a893b8
ILT
75302009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7531 Ian Lance Taylor <iant@google.com>
7532
7533 * configure.ac: Check for readv function also.
7534 * fileread.cc (readv): Define if not HAVE_READV.
7535 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7536 does not exist.
7537 * config.in: Regenerate.
7538 * configure: Regenerate.
7539
c0a62865
DK
75402009-10-09 Doug Kwan <dougkwan@google.com>
7541
7542 * layout.cc (Layout::make_output_section): Call target hook to make
7543 ordinary output section.
7544 (Layout::finalize): Adjust parameter list of call the
7545 Target::may_relax().
7546 * layout.h (class Layout::section_list): New method.
7547 * merge.h (Output_merge_base::entsize): Change visibility to public.
7548 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7549 New methods.
7550 (Output_merge_string::do_is_string): New method.
7551 * object.cc (Sized_relobj::do_setup): renamed from
7552 Sized_relobj::set_up.
7553 * object.h (Sized_relobj::adjust_shndx,
7554 Sized_relobj::initializ_input_to_output_maps,
7555 Sized_relobj::free_input_to_output_maps): Change visibilities to
7556 protected.
7557 (Sized_relobj::setup): Virtualize.
7558 (Sized_relobj::do_setup): New method declaration.
7559 (Sized_relobj::invalidate_section_offset,
7560 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7561 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7562 * options.cc (parse_int): New function.
7563 * options.h (parse_int): New declaration.
7564 (DEFINE_int): New macro.
7565 (stub_group_size): New option.
7566 * output.cc (Output_section::Output_section): Initialize memebers
7567 merge_section_map_, merge_section_by_properties_map_,
7568 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7569 (Output_section::add_input_section): Handled deferred code-fill
7570 generation and remove an old comment.
7571 (Output_section::add_relaxed_input_section): New method definition.
7572 (Output_section::add_merge_input_section): Use merge section by
7573 properties map to speed to search. Update merge section maps
7574 as appropriate.
7575 (Output_section::build_relaxation_map): New method definition.
7576 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7577 Same.
7578 (Output_section::relax_input_section): Renamed to
7579 Output_section::convert_input_sections_to_relaxed_sections and change
7580 interface to take a vector of pointers to relaxed sections.
7581 (Output_section::find_merge_section,
7582 Output_section::find_relaxed_input_section): New method definitions.
7583 (Output_section::is_input_address_mapped,
7584 Output_section::output_offset, Output_section::output_address):
7585 Use output section data maps to speed up searching.
7586 (Output_section::find_starting_output_address): Add comments.
7587 (Output_section::do_write,
7588 Output_section::write_to_postprocessing_buffer): Do code-fill
7589 generation as appropriate.
7590 (Output_section::get_input_sections): Invalidate relaxed input section
7591 map.
7592 (Output_section::restore_states): Adjust type of checkpoint .
7593 Invalidate relaxed input section map.
7594 * output.h (Output_merge_base): New class declaration.
7595 (Input_section_specifier): New class defintion.
7596 (class Output_relaxed_input_section) Change base class to
7597 Output_section_data_build.
7598 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7599 base class initializer.
7600 (Output_section::add_relaxed_input_section): New method declaration.
7601 (Output_section::Input_section): Change visibility to protected.
7602 (Output_section::Input_section::relobj,
7603 Output_section::Input_section::shndx): Handle relaxed input sections.
7604 Output_section::input_sections) Change visibility to protected. Also
7605 define overload to return a non-const pointer.
7606 (Output_section::Merge_section_properties): New class defintion.
7607 (Output_section::Merge_section_by_properties_map,
7608 Output_section::Output_section_data_by_input_section_map,
7609 Output_section::Relaxation_map): New types.
7610 (Output_section::relax_input_section): Rename method to
7611 Output_section::convert_input_sections_to_relaxed_sections and change
7612 interface to take a vector of relaxed section pointers.
7613 (Output_section::find_merge_section,
7614 Output_section::find_relaxed_input_section,
7615 Output_section::build_relaxation_map,
7616 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7617 New method declarations.
7618 (Output_section::merge_section_map_
7619 Output_section::merge_section_by_properties_map_,
7620 Output_section::relaxed_input_section_map_,
7621 Output_section::is_relaxed_input_section_map_valid_,
7622 Output_section::generate_code_fills_at_write_): New data members.
7623 * script-sections.cc
7624 (Output_section_element_input::set_section_addresses): Call
7625 current_data_size and addralign methods of relaxed input sections.
7626 (Orphan_output_section::set_section_addresses): Call current_data_size
7627 and addralign methods of relaxed input sections.
7628 * symtab.cc (Symbol_table::compute_final_value): Extract template
7629 from the body of Symbol_table::sized_finalize_symbol.
7630 (Symbol_table::sized_finalized_symbol): Call
7631 Symbol_table::compute_final_value.
7632 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7633 (Symbol_table::compute_final_value): New templated method declaration.
7634 * target.cc (Target::do_make_output_section): New method defintion.
7635 * target.h (Target::make_output_section): New method declaration.
7636 (Target::relax): Add more parameters for input objects, symbol table
7637 and layout. Adjust call to do_relax.
7638 (Target::do_make_output_section): New method declaration.
7639 (Target::do_relax): Add parameters for input objects, symbol table
7640 and layout.
7641
d446d6c4
ILT
76422009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7643
7644 * pread.c: Include stdio.h.
7645
bc06c745
ILT
76462009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7647
7648 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7649 defined.
7650
75aea3d0
ILT
76512009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7652
7653 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7654 Change read_shndx type to unsigned int.
7655 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7656 int.
7657 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7658 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7659 Change read_shndx type to unsigned int.
7660 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7661 int.
7662 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7663 * layout.cc (Layout::create_symtab_sections): Cast the result of
7664 local_symcount * symsize to off_t in the gold_assert.
7665
be8fcb75
ILT
76662009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7667
7668 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7669 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7670 R_ARM_BASE_ABS.
7671 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7672 (Arm_relocate_functions::thm_abs5): New function.
7673 (Arm_relocate_functions::abs12): New function.
7674 (Arm_relocate_functions::abs16): New function.
7675 (Arm_relocate_functions::base_abs): New function.
7676 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7677 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7678 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7679 R_ARM_BASE_ABS.
7680 (Scan::global): Likewise.
7681 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7682 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7683 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7684 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7685 R_ARM_BASE_ABS.
7686
c2a122b6
ILT
76872009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7688
7689 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7690 (Arm_relocate_functions::movt_prel): New function.
7691 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7692 (Arm_relocate_functions::thm_movt_prel): New function.
7693 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7694 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7695 (Scan::global, Relocate::relocate): Likewise.
7696 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7697
c4aa1e2d
ILT
76982009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7699
7700 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7701 Incremental_checker.
7702 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7703 unsigned int.
7704 (class Incremental_inputs_header): New class.
7705 (Incremental_inputs_header_writer): Edit comment.
7706 (Incremental_inputs_entry): New class.
7707 (Incremental_inputs_entry_writer): Edit comment.
7708 (Sized_incremental_binary::do_find_incremental_inputs_section):
7709 Add *strtab_shndx parameter, fill it.
7710 (Sized_incremental_binary::do_check_inputs): New method.
7711 (Incremental_checker::can_incrementally_link_output_file): Use
7712 Sized_incremental_binary::check_inputs.
7713 (Incremental_inputs::report_command_line): Save command line in
7714 command_line_.
7715 * incremental.h:
7716 (Incremental_binary::find_incremental_inputs_section): New
7717 method.
7718 (Incremental_binary::do_find_incremental_inputs_section): Add
7719 strtab_shndx parameter.
7720 (Incremental_binary::do_check_inputs): New pure virtual method.
7721 (Sized_incremental_binary::do_check_inputs): Declare.
7722 (Incremental_checker::Incremental_checker): Add incremental_inputs
7723 parameter, use it to initialize incremental_inputs_.
7724 (Incremental_checker::incremental_inputs_): New field.
7725 (Incremental_checker::command_line): New method.
7726 (Incremental_checker::inputs): New method.
7727 (Incremental_checker::command_line_): New field.
7728
c549a694
ILT
77292009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7730
7731 * incremental.cc: Include <cstdarg> and "target-select.h".
7732 (vexplain_no_incremental): New function.
7733 (explain_no_incremental): New function.
7734 (Incremental_binary::error): New method.
7735 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7736 method.
7737 (make_sized_incremental_binary): New function.
7738 (open_incremental_binary): New function.
7739 (can_incrementally_link_file): Add checks if output is ELF and has
7740 inputs section.
7741 * incremental.h: Include "elfcpp_file.h" and "output.h".
7742 (Incremental_binary): New class.
7743 (Sized_incremental_binary): New class.
7744 (open_incremental_binary): Declare.
7745 * object.cc (is_elf_object): Use
7746 elfcpp::Elf_recognizer::is_elf_file.
7747 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7748 * output.h (Output_file::filesize): New method.
7749
fd3c5f0b
ILT
77502009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7751
7752 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7753 New function.
7754 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7755 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7756 function.
7757 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7758 function.
7759 (Arm_relocate_functions::movw_abs_nc): New function.
7760 (Arm_relocate_functions::movt_abs): New function.
7761 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7762 (Arm_relocate_functions::thm_movt_abs): New function.
7763 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7764 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7765 (Scan::global): Likewise.
7766 (Relocate::relocate): Likewise.
7767 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7768
7f5309a5
ILT
77692009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7770
7771 * arm.cc (Arm_relocate_functions::got_prel) New function.
7772 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7773 (Relocate::relocate): Likewise.
7774 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7775
364c7fa5
ILT
77762009-10-06 Ian Lance Taylor <iant@google.com>
7777
7778 * options.h (class General_options): Define
7779 split_stack_adjust_size parameter.
7780 * object.h (class Object): Add uses_split_stack_ and
7781 has_no_split_stack_ fields. Add uses_split_stack and
7782 has_no_split_stack accessor functions. Declare
7783 handle_split_stack_section.
7784 (class Reloc_symbol_changes): Define.
7785 (class Sized_relobj): Define Function_offsets. Declare
7786 split_stack_adjust, split_stack_adjust_reltype, and
7787 find_functions.
7788 * object.cc (Object::handle_split_stack_section): New function.
7789 (Sized_relobj::do_layout): Call handle_split_stack_section.
7790 * dynobj.cc (Sized_dynobj::do_layout): Call
7791 handle_split_stack_section.
7792 * reloc.cc (Sized_relobj::relocate_sections): Call
7793 split_stack_adjust for executable sections in split_stack
7794 objects. Pass reloc_map to relocate_section.
7795 (Sized_relobj::split_stack_adjust): New function.
7796 (Sized_relobj::split_stack_adjust_reltype): New function.
7797 (Sized_relobj::find_functions): New function.
7798 * target-reloc.h: Include "object.h".
7799 (relocate_section): Add reloc_symbol_changes parameter. Change
7800 all callers.
7801 * target.h (class Target): Add calls_non_split method. Declare
7802 do_calls_non_split virtual method. Declare match_view and
7803 set_view_to_nop.
7804 * target.cc: Include "elfcpp.h".
7805 (Target::do_calls_non_split): New function.
7806 (Target::match_view): New function.
7807 (Target::set_view_to_nop): New function.
7808 * gold.cc (queue_middle_tasks): Give an error if mixing
7809 split-stack and non-split-stack objects with -r.
7810 * i386.cc (Target_i386::relocate_section): Add
7811 reloc_symbol_changes parameter.
7812 (Target_i386::do_calls_non_split): New function.
7813 * x86_64.cc (Target_x86_64::relocate_section): Add
7814 reloc_symbol_changes parameter.
7815 (Target_x86_64::do_calls_non_split): New function.
7816 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7817 parameter.
7818 * powerpc.cc (Target_powerpc::relocate_section): Add
7819 reloc_symbol_changes parameter.
7820 * sparc.cc (Target_sparc::relocate_section): Add
7821 reloc_symbol_changes parameter.
7822 * configure.ac: Call AM_CONDITIONAL for the default target.
7823 * configure: Rebuild.
7824 * testsuite/Makefile.am (TEST_AS): New variable.
7825 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7826 (check_DATA): Add split_i386 and split_x86_64 files.
7827 (SPLIT_DEFSYMS): Define.
7828 (split_i386_[1234n].o): New targets.
7829 (split_i386_[124]): New targets.
7830 (split_i386_[1234r].stdout): New targets.
7831 (split_x86_64_[1234n].o): New targets.
7832 (split_x86_64_[124]): New targets.
7833 (split_x86_64_[1234r].stdout): New targets.
7834 (MOSTLYCLEANFILES): Add new executables.
7835 * testsuite/split_i386.sh: New file.
7836 * testsuite/split_x86_64.sh: New file.
7837 * testsuite/split_i386_1.s: New file.
7838 * testsuite/split_i386_2.s: New file.
7839 * testsuite/split_i386_3.s: New file.
7840 * testsuite/split_i386_4.s: New file.
7841 * testsuite/split_i386_n.s: New file.
7842 * testsuite/split_x86_64_1.s: New file.
7843 * testsuite/split_x86_64_2.s: New file.
7844 * testsuite/split_x86_64_3.s: New file.
7845 * testsuite/split_x86_64_4.s: New file.
7846 * testsuite/split_x86_64_n.s: New file.
7847 * testsuite/testfile.cc (Target_test): Update relocation_section
7848 function.
7849 * testsuite/Makefile.in: Rebuild.
7850
e8a9fcda
ILT
78512009-10-06 Ian Lance Taylor <iant@google.com>
7852
7853 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7854 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7855 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7856 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7857 the address on ldo_addrs_.
7858 (Target_i386::Relocate::fix_up_ldo): New function.
7859
e99daf92
ILT
78602009-10-06 Rafael Espindola <espindola@google.com>
7861
7862 * plugin.cc (add_input_library): New.
7863 (Plugin::load): Add add_input_library to tv.
7864 (Plugin_manager::add_input_file): Add the is_lib argument.
7865 (add_input_file): Update call to Plugin_manager::add_input_file.
7866 (add_input_library): New.
7867 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7868
966d4097
DK
78692009-09-30 Doug Kwan <dougkwan@google.com>
7870
7871 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7872 symbol and call Symbol::may_need_copy_reloc to determine if
7873 a copy reloc is needed.
7874 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7875 nocopyreloc is given in command line.
7876 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7877 given in command line.
7878 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7879 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7880 of the removed Target_i386::may_need_copy_reloc.
7881 * options.h (copyreloc): New option with default value false.
7882 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7883 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7884 instead of the removed Target_powerpc::may_need_copy_reloc.
7885 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7886 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7887 instead of the removed Target_sparc::may_need_copy_reloc.
7888 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7889 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7890 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7891 instead of the removed Target_x86_64::may_need_copy_reloc.
7892
029ba973
ILT
78932009-09-30 Ian Lance Taylor <iant@google.com>
7894
7895 * object.h (class Object): Remove target_ field, and target,
7896 sized_target, and set_target methods.
7897 (Object::sized_target): Remove.
7898 (class Sized_relobj): Update declarations. Remove sized_target.
7899 * object.cc (Sized_relobj::setup): Remove target parameter.
7900 Change all callers.
7901 (Input_objects::add_object): Don't do anything with the target.
7902 (make_elf_sized_object): Add punconfigured parameter. Change all
7903 callers. Set or test parameter target.
7904 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7905 Change all callers.
7906 * parameters.cc (Parameters::set_target): Change parameter type to
7907 be non-const.
7908 (Parameters::default_target): Remove.
7909 (set_parameters_target): Change parameter type to be non-const.
7910 (parameters_force_valid_target): New function.
7911 (parameters_clear_target): New function.
7912 * parameters.h (class Parameters): Update declarations. Remove
7913 default_target method. Add sized_target and clear_target
7914 methods. Change target_ to be non-const.
7915 (set_parameters_target): Update declaration.
7916 (parameters_force_valid_target): Declare.
7917 (parameters_clear_target): Declare.
7918 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7919 as NULL if we aren't searching.
7920 (Add_symbols::run): Don't check for compatible target.
7921 * fileread.cc (Input_file::open_binary): Call
7922 parameters_force_valid_target.
7923 * gold.cc (queue_middle_tasks): Likewise.
7924 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7925 set_target on object.
7926 * dynobj.h (class Sized_dynobj): Update declarations.
7927 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7928 make_elf_object returns NULL.
7929 (Archive::include_member): Don't check whether object target is
7930 compatible.
7931 * output.cc (Output_section::add_input_section): Get target from
7932 parameters.
7933 (Output_section::relax_input_section): Likewise.
7934 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7935 parameters.
7936 (Sized_relobj::do_scan_relocs): Likewise.
7937 (Sized_relobj::relocate_sections): Likewise.
7938 * resolve.cc (Symbol_table::resolve): Likewise.
7939 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7940 parameter. Change all callers.
7941 (Symbol_table::add_from_object): Get target from parameters.
7942 (Symbol_table::add_from_relobj): Don't check object target.
7943 (Symbol_table::add_from_dynobj): Likewise.
7944 (Symbol_table::define_special_symbol): Get target from
7945 parameters.
7946 * symtab.h (class Symbol_table): Update declaration.
7947 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7948 parameter. Change all callers. Clear parameter target.
7949 (Binary_test): Test target here.
7950 * testsuite/object_unittest.cc (gold_testsuite): Remove
7951 target_test_pointer parameter. Change all callers.
7952 (Object_test): Test target here.
7953
a6a22b83
ILT
79542009-09-26 Ian Lance Taylor <iant@google.com>
7955
7956 * testsuite/initpri1.c: Don't try to use constructor priorities if
7957 compiling with gcc before 4.3.
7958
6a8f49fe
ILT
79592009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7960
7961 * testsuite/retain_symbols_file_test.sh (check_present): Change
7962 output file name to retain_symbols_file_test.stdout.
7963 (check_absent): Likewise.
7964
8c604651
CS
79652009-09-18 Craig Silverstein <csilvers@google.com>
7966
7967 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7968 * options.cc: Include <cerrno> and <fstream>.
7969 (General_options::finalize): Parse -retain-symbols-file tag.
7970 * options.h: New flag.
7971 (General_options): New method should_retain_symbol, new
7972 variable symbols_to_retain.
7973 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7974 should_retain_symbol map.
7975 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7976 * testsuite/Makefile.in: Regenerate.
7977 * testsuite/retain_symbols_file_test.sh: New file.
7978
ca58b19f
NC
79792009-09-18 Nick Clifton <nickc@redhat.com>
7980
7981 * po/es.po: Updated Spanish translation.
7982
20e6d0d6
DK
79832009-09-17 Doug Kwan <dougkwan@google.com>
7984
7985 * debug.h (DEBUG_RELAXATION): New constant.
7986 (DEBUG_ALL): Add DEBUG_RELAXATION.
7987 (debug_string_to_enum): Add relaxation debug option.
7988 * layout.cc
7989 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7990 Layout::Relaxation_debug_check::read_sections,
7991 Layout::Relaxation_debug_check::read_sections): New method definitions.
7992 (Layout::Layout): Initialize data members
7993 record_output_section_data_from_scrips_,
7994 script_output_section_data_list_ and relaxation_debug_check_.
7995 (Layout::save_segments, Layout::restore_segments,
7996 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7997 Layout::relaxation_loop_body): New method definitions.
7998 (Layout::finalize): Support relaxation. Move section layout code to
7999 Layout::relaxation_loop_body.
8000 (Layout::set_asection_address_from_script): Move code for orphan
8001 section placement out.
8002 (Layout::place_orphan_sections_in_script): New method definition.
8003 * layout.h (Output_segment_headers, Output_file_header):
8004 New forward class declarations.
8005 (Layout::~Layout): Define.
8006 (Layout::new_output_section_data_from_script): New method definition.
8007 (Layout::place_orphan_sections_in_script): New method declaration.
8008 (Layout::Segment_states): New type declaration.
8009 (Layout::save_segments, Layout::restore_segments,
8010 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
8011 Layout::relaxation_loop_body): New method declarations.
8012 (Layout::Output_section_data_list): New type declaration.
8013 (Layout::Relaxation_debug_check): New class definition.
8014 (Layout::record_output_section_data_from_script_,
8015 Layout::script_output_section_data_list_, Layout::segment_states_,
8016 Layout::relaxation_debug_check_): New data members.
8017 * output.cc: (Output_section_headers::do_size): New method definition.
8018 (Output_section_headers::Output_section_headers): Move size
8019 computation to Output_section_headers::do_size.
8020 (Output_segment_headers::do_size): New method definition.
e1df38aa 8021 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
8022 Output_file_header::do_size and call it.
8023 (Output_file_header::do_size): New method definition.
8024 (Output_data_group::Output_data_group): Adjust call to
8025 Output_section_data.
8026 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
8027 (Output_symtab_xindex::do_write): Add array bound check.
8028 (Output_section::Input_section::print_to_mapfile): Handle
8029 RELAXED_INPUT_SECTION_CODE.
8030 (Output_section::Output_section): Initialize data member checkpoint_.
8031 (Output_section::~Output_section): Delete checkpoint object pointed
8032 by checkpoint_.
8033 (Output_section::add_input_section): Always add an Input_section if
8034 relaxing.
8035 (Output_section::add_merge_input_section): Add assert.
8036 (Output_section::relax_input_section): New method definition.
8037 (Output_section::set_final_data_size): Set load address to zero for
8038 an unallocated section.
8039 (Output_section::do_address_and_file_offset_have_reset_values):
8040 New method definition.
8041 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
8042 Handle relaxed input section.
8043 (Output_section::sort_attached_input_sections): Checkpoint input
8044 section list lazily.
8045 (Output_section::get_input_sections): Change type of input_sections to
8046 list of Simple_input_section pointers. Checkpoint input section list
8047 lazily. Also handle relaxed input sections.
8048 (Output_section::add_input_section_for_script): Take a reference to
8049 a Simple_input_section object instead of Relobj pointer and section
8050 index as parameter. Handle relaxed input sections.
8051 (Output_section::save_states, Output_section::restore_states): New
8052 method definitions.
8053 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
8054 (Output_data::is_data_size_fixed): New method definition.
8055 (Output_data::reset_addresss_and_file_offset): Do not reset data size
8056 if it is fixed.
8057 (Output_data::address_and_file_offset_have_reset_values): New method
8058 definition.
8059 (Output_data::do_address_and_file_offset_have_reset_values): New method
8060 definition.
8061 (Output_data::set_data_size): Check that data size is not fixed.
8062 (Output_data::fix_data_size): New method definition.
8063 (Output_data::is_data_size_fixed_): New data member.
8064 (Output_section_headers::set_final_data_size): New method definition.
8065 (Output_section_headers::do_size): New method declaration.
8066 (Output_segment_headers::set_final_data_size): New method definition.
8067 (Output_segment_headers::do_size): New method declaration.
8068 (Output_file_header::set_final_data_size)::New method definition.
8069 (Output_file_header::do_size)::New method declaration.
8070 (Output_section_data::Output_section_data): Add new parameter
8071 is_data_size_fixed and use it to fix data size.
8072 (Output_data_const::Output_data_const): Adjust call to base class
8073 constructor and fix data size.
8074 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
8075 base class constructor and fix data size.
8076 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
8077 base class constructor and fix data size.
8078 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
8079 class constructor and fix data size.
8080 (Output_data_group::set_final_data_size): New method definition.
8081 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
8082 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
8083 class constructor and fix data size.
8084 (Output_relaxed_input_section): New class definition.
8085 (Output_section::Simple_input_section): New class definition.
8086 (Output_section::get_input_sections): Adjust parameter list.
8087 (Output_section::add_input_section_for_script): Same.
8088 (Output_section::save_states, Output_section::restore_states,
8089 Output_section::do_address_and_file_offset_have_reset_values,
8090 (Output_section::Input_section::Input_section): Handle
8091 RELAXED_INPUT_SECTION_CODE. Add new overload for
8092 Output_relaxed_input_section.
8093 (Output_section::Input_section::is_input_section,
8094 Output_section::Input_section::set_output_section): Handle relaxed
8095 input section.
8096 (Output_section::Input_section::is_relaxed_input_section,
8097 Output_section::Input_section::output_section_data,
8098 Output_section::Input_section::relaxed_input_section): New method
8099 definitions.
8100 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
8101 value.
8102 (Output_section::Input_section::u1_): Update comments.
8103 (Output_section::Input_section::u2_): Add new union member poris.
8104 (Output_section::Checkpoint_output_section): New classs definition.
8105 (Output_section::relax_input_section): New method declaration.
8106 (Output_section::checkpoint_): New data member.
8107 (Output_segment): Update comments.
8108 (Output_segment::Output_segment): Un-privatize copy constructor.
8109 (Output_segment::operator=): Un-privatize.
8110 * script-sections.cc (Output_section_element::Input_section_list):
8111 Change element type to Output_section::Simple_input_section.
8112 (Output_section_element_dot_assignment::set_section_addresses):
8113 Register output section data for relaxation clean up.
8114 (Output_data_exression::Output_data_expression): Adjust call to base
8115 constructor to fix data size.
8116 (Output_section_element_data::set_section_addresses): Register
8117 Output_data_expression object for relaxation clean up.
8118 (struct Input_section_info): Replace Relobj pointer and section index
8119 pair with Output_section::Simple_input_section and Convert struct to a
8120 class.
8121 (Input_section_sorter::operator()): Adjust access to
e1df38aa 8122 Input_section_info data member to use accessors.
20e6d0d6
DK
8123 (Output_section_element_input::set_section_addresses): Use layout
8124 parameter. Adjust code to use Output_section::Simple_input_section
8125 and Input_secction_info classes. Register filler for relaxation
8126 clean up.
8127 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
8128 and section index pair with Output_section::Simple_input_section
8129 class. Adjust code accordingly.
8130 (Phdrs_element::release_segment): New method definition.
8131 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
8132 segment list.
8133 (Script_sections::release_segments): New method definition.
8134 * gold/script-sections.h (Script_sections::release_segments): New
8135 method declaration.
8136 * gold/target.h (Target::may_relax, Target::relax,
8137 Target::do_may_relax, Target::do_relax): New method definitions.
8138
5e445df6
ILT
81392009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8140
8141 * arm.cc (has_signed_unsigned_overflow): New function.
8142 (Arm_relocate_functions::abs8): New function.
8143 (Target_arm::Scan::local): Handle R_ARM_ABS8.
8144 (Target_arm::Scan::global): Likewise.
8145 (Target_arm::relocate::relocate): Likewise.
8146 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8147 Likewise.
8148
8c604651 81492009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
8150
8151 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
8152 * testsuite/Makefile.in: Regenerate.
8153
1e9cc1c2
NC
81542009-09-11 Nick Clifton <nickc@redhat.com>
8155
8156 * po/gold.pot: Updated by the Translation project.
8157
6a89f575
CC
81582009-09-08 Cary Coutant <ccoutant@google.com>
8159
8160 * output.cc (Output_file::open): Add execute permission to empty file.
8161 * testsuite/Makefile.am (permission_test): New test.
8162 * testsuite/Makefile.in: Regenerate.
8163
fdcac5af
ILT
81642009-09-02 Ian Lance Taylor <iant@google.com>
8165
8166 * output.cc (Output_file::resize): Call map_no_anonymous rather
8167 than map.
8168
44453f85
ILT
81692009-09-01 Mikolaj Zalewski <mikolajz@google.com>
8170
8171 * gold.cc: Include "incremental.h".
8172 (queue_initial_tasks): Call Incremental_checker methods.
8173 * incremental.cc: Include "output.h".
8174 (Incremental_checker::can_incrementally_link_output_file): New
8175 method.
8176 * incremental.h (Incremental_checker): New class.
8177
8178 * output.cc (Output_file::open_for_modification): New method.
8179 (Output_file::map_anonymous): Changed return type to bool. Record
8180 map in base_ field.
8181 (Output_file::map_no_anonymous): New method, broken out of map.
8182 (Output_file::map): Use map_no_anonymous and map_anonymous.
8183 * output.h (class Output_file): Update declarations.
8184
293c1386
CC
81852009-08-24 Cary Coutant <ccoutant@google.com>
8186
8187 * options.h (Command_line::Pre_options): New class.
8188 (Command_line::pre_options): New member.
8189 * options.cc (gold::options::ready_to_register): New variable.
8190 (One_option::register_option): Do nothing if not registering options.
8191 Assert if same short option registered twice.
8192 (General_options::General_options): Turn off option registration when
8193 done constructing.
8194 (Command_line::Pre_options::Pre_options): New constructor.
8195
f773f3d2
CC
81962009-08-24 Cary Coutant <ccoutant@google.com>
8197
06a73cfe
CC
8198 * options.h (General_options::no_keep_memory): Remove incorrect
8199 short option.
f773f3d2 8200
a15af8e2
RW
82012009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8202
8203 * Makefile.am (am__skiplex, am__skipyacc): New.
8204 * Makefile.in: Regenerate.
8205
c462b41b
RW
82062009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8207
14ec8efd
RW
8208 * Makefile.am (AM_CPPFLAGS): Renamed from ...
8209 (INCLUDES): ... this.
8210 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
8211 (AM_CPPFLAGS): Renamed from ...
8212 (INCLUDE): ... this.
8213 * Makefile.in, testsuite/Makefile.in: Regenerate.
8214
81ecdfbb
RW
8215 * Makefile.in: Regenerate.
8216 * aclocal.m4: Likewise.
8217 * config.in: Likewise.
8218 * configure: Likewise.
8219 * testsuite/Makefile.in: Likewise.
8220
c462b41b
RW
8221 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8222 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
8223 * Makefile.in: Regenerate.
8224 * testsuite/Makefile.in: Regenerate.
8225
2da73f13
CC
82262009-08-19 Cary Coutant <ccoutant@google.com>
8227
8228 * resolve.cc (Symbol_table::resolve): Don't complain about defined
8229 symbols in shared libraries overridden by hidden or internal symbols
8230 in the main program.
8231
2db70501
CD
82322009-08-19 Chris Demetriou <cgd@google.com>
8233
8234 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
8235 checking source file names in error messages.
8236
f733487b
DK
82372009-08-18 Doug Kwan <dougkwan@google.com>
8238
8239 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
8240 an elcpp::Ehdr as parameter. Adjust call to set_target.
8241 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
8242 an elfcpp::Ehdr as parameter.
8243 * object.cc (Object::set_target): Remove the version that looks up
8244 a target and sets it.
8245 (Sized_relobj::setup): Take a Target object instead of
8246 an elfcpp::Ehdr as parameter. Adjust call to set_target.
8247 (make_elf_sized_object): Find target and ask target to
8248 make an ELF object.
8249 * object.h: (Object::set_target): Remove the version that looks up
8250 a target and sets it.
8251 (Sized_relobj::setup): Take a Target object instead of
8252 an elfcpp:Ehdr as parameter.
8253 * target.cc: Include dynobj.h.
8254 (Target::do_make_elf_object_implementation): New.
8255 (Target::do_make_elf_object): New.
8256 * target.h (Target::make_elf_object): New template declaration.
8257 (Target::do_make_elf_object): New method declarations.
8258 (Target::do_make_elf_object_implementation): New template declaration.
8259
cc70f101
ILT
82602009-08-14 Ian Lance Taylor <iant@google.com>
8261
8262 * gold.h (FUNCTION_NAME): Define.
8263 (gold_unreachable): Use FUNCTION_NAME.
8264
ef5e0cb1
ST
82652009-08-12 Sriraman Tallam <tmsriram@google.com>
8266
8267 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8268 symbol in the --keep-unique list is not found.
8269
48c187ce
ST
82702009-08-12 Sriraman Tallam <tmsriram@google.com>
8271
8272 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8273 been maked as --keep-unique.
8274 (Icf::unfold_section): New function.
8275 * icf.h (Icf::unfold_section): New function.
8276 * options.h (General_options::keep_unique): New option.
8277 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8278 * testsuite/Makefile.in: Regenerate.
8279 * testsuite/icf_keep_unique_test.sh: New file.
8280 * testsuite/icf_keep_unique_test.cc: New file.
8281
645afe0c
CC
82822009-08-12 Cary Coutant <ccoutant@google.com>
8283
8284 PR 10471
8285 * resolve.cc (Symbol_table::resolve): Check for references from
8286 dynamic objects to hidden and internal symbols.
8287 * testsuite/Makefile.am (hidden_test.sh): New test.
8288 * testsuite/Makefile.in: Regenerate.
8289 * testsuite/hidden_test.sh: New script.
8290 * testsuite/hidden_test_1.c: New test source.
8291 * testsuite/hidden_test_main.c: New test source.
8292
11af873f
DK
82932009-08-11 Doug Kwan <dougkwan@google.com>
8294
8295 * arm.cc: Update comments.
8296 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8297 segment to locate the .ARM.exidx section if present.
8298
b9f7d72d
DK
82992009-08-09 Doug Kwan <dougkwan@google.com>
8300
8301 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8302 patch.
8303
ddd3c53c
ST
83042009-08-07 Sriraman Tallam <tmsriram@google.com>
8305 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8306 compiler warnings.
8307
27721062
ST
83082009-08-06 Sriraman Tallam <tmsriram@google.com>
8309
8310 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8311 valid tls_segment only for non-debug-section relocations.
8312 * testsuite/Makefile.am: Add gc_tls_test.
8313 * testsuite/Makefile.in: Regenerate.
8314 * testsuite/gc_tls_test.cc: New file.
8315 * testsuite/gc_tls_test.sh: New file.
8316
ef15dade 83172009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 8318
ef15dade
ST
8319 * icf.cc: New file.
8320 * icf.h: New file.
8321 * Makefile.am (CCFILES): Add icf.cc.
8322 (HFILES): Add icf.h
8323 * Makefile.in: Regenerate.
8324 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8325 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8326 section, symbol and addend information for the relocs.
8327 * gold.cc (queue_middle_tasks): Call identical code folding.
8328 * gold.h: Add defines for multimap.
8329 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8330 to the call of finalize_local_symbols.
8331 * main.cc (main): Create object of class Icf.
8332 * object.cc (Sized_relobj::do_layout): Allow this function to be
8333 called twice during icf.
8334 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8335 to sections marked as identical by icf.
8336 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8337 when available.
8338 (Sized_relobj::do_section_entsize): New function.
8339 * object.h (Object::section_entsize): New function.
8340 (Object::do_section_entsize): New pure virtual function.
8341 (Relobj::finalize_local_symbols): Add new parameter.
8342 (Relobj::do_section_entsize): New function.
8343 * options.h (General_options::icf): New option.
8344 (General_options::icf_iterations): New option.
8345 (General_options::print_icf_sections): New option.
8346 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8347 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8348 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8349 icf.
8350 * symtab.cc (Symbol_table::is_section_folded): New function.
8351 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8352 to sections marked as identical by icf.
8353 * symtab.h (Symbol_table::set_icf): New function.
8354 (Symbol_table::icf): New function.
8355 (Symbol_table::is_section_folded): New function.
8356 (Symbol_table::icf_): New data member.
8357 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8358 * testsuite/Makefile.am: Add commands to build icf_test.
8359 * testsuite/Makefile.in: Regenerate.
8360 * testsuite/icf_test.sh: New file.
8361 * testsuite/icf_test.cc: New file.
8362
c3b65ac4
CD
83632009-07-24 Chris Demetriou <cgd@google.com>
8364
8365 * layout.cc (is_compressible_debug_section): Fix incorrect
8366 comment about compressed section names.
8367
1caf2c51
ILT
83682009-07-20 Ian Lance Taylor <ian@airs.com>
8369
8370 PR 10419
8371 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8372
1ef4d87f
ILT
83732009-07-16 Ian Lance Taylor <iant@google.com>
8374
8375 PR 10400
8376 * layout.h: #include <map>.
8377 (class Kept_section): Change from struct to class. Add accessors
8378 and setters. Add section size to Comdat_group mapping. Change
8379 Comdat_group to std::map. Add is_comdat_ field. Add
8380 linkonce_size field in union.
8381 (class Layout): Update declaration of find_or_add_kept_section.
8382 Don't declare find_kept_object.
8383 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8384 parameter. Add object, shndx, is_comdat, and is_group_name
8385 parameters. Change all callers. Adjust for new Kept_section.
8386 (Layout::find_kept_object): Remove.
8387 * object.cc (Sized_relobj::include_section_group): Update use of
8388 Kept_section. Rename secnum to shndx. Only record
8389 Kept_comdat_section if sections are the same size.
8390 (Sized_relobj::include_linkonce_section): Update use of
8391 Kept_section. Only record Kept_comdat_section if sections are the
8392 same size. Set size of linkonce section.
8393 (Sized_relobj::map_to_kept_section): Update call to
8394 get_kept_comdat_section.
8395 * object.h (class Sized_relobj): Rename fields in
8396 Kept_comdat_section to drop trailing underscores; change object
8397 field to Relobj*. Change Kept_comdat_section_table to store
8398 struct rather than pointer.
8399 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8400 Add kept_object and kept_shndx parameters. Change all callers.
8401 (Sized_relobj::get_kept_comdat_section): Change return type to
8402 bool. Add kept_object and kept_shndx parameters. Change all
8403 callers.
8404 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8405 Layout::find_or_add_kept_section.
8406
37c3b7b0
ILT
84072009-07-09 Ian Lance Taylor <iant@google.com>
8408
8409 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8410 Reserve space in the hash table.
8411
98fa85cb
ILT
84122009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8413
8414 * fileread.cc (File_read::get_mtime): New method.
8415 * fileread.h (Timespec): New structure.
8416 (File_read::get_mtime): New method.
8417 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8418 Renamed from timestamp_nsec.
8419 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8420 Elf_Xword.
e1df38aa 8421 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 8422 timestamp_nsec.
e1df38aa 8423 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
8424 (Incremental_inputs::report_obejct): Save mtime; style fix.
8425 (Incremental_inputs::report_script): Save mtime; style fix.
8426 (Incremental_inputs::finalize_inputs): Style fix.
8427 (Incremental_inputs::finalize): Style fix.
8428 (Incremental_inputs::create_input_section_data): Store inputs
8429 mtime.
8430 * incremental.h (Incremental_inputs::report_script): Add mtime
8431 argument.
8432 (Incremental_inputs::Input_info::Input_info): Intialize only one
8433 union member.
8434 (Incremental_inputs::Input_info::archive): Move to nameless
8435 union.
8436 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8437 (Incremental_inputs::Input_info::script): Move to nameless union.
8438 (Incremental_inputs::mtime): New field.
8439 * script.cc (read_input_script): Pass file mtime to
8440 Incremental_input.
8441 * script.h (Script_info::inputs): Style fix.
8442
c9d70757
ILT
84432009-07-01 Ian Lance Taylor <ian@airs.com>
8444
8445 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8446 instead of 32.
8447
9c547ec3
ILT
84482009-06-24 Ian Lance Taylor <iant@google.com>
8449
8450 PR 10156
8451 * layout.cc (Layout::choose_output_section): If we find an
8452 existing section, update the flags.
8453 (Layout::create_notes): New function, broken out of
8454 Layout::finalize.
8455 (Layout::finalize): Don't create note sections.
8456 (Layout::create_note): Don't crash if linker script discards
8457 section.
8458 (Layout::create_gold_note): Likewise.
8459 (Layout::create_build_id): Likewise. Don't set
8460 after_input_sections on the section.
8461 (Layout::create_executable_stack_info): Remove target parameter.
8462 Change caller.
8463 * layout.h (class Layout): Declare create_notes. Update
8464 declaration of create_executable_stack_info.
8465 * gold.cc (queue_middle_tasks): Call create_notes.
8466 * output.cc (Output_section::update_flags_for_input_section): Move
8467 here from output.h. If SHF_ALLOC flag is newly set, mark address
8468 invalid.
8469 * output.h (Output_data::mark_address_invalid): New function.
8470 (class Output_section): Only declare, not define,
8471 update_flags_for_input_section. Remove set_flags.
8472
55458500
ILT
84732009-06-24 Ian Lance Taylor <iant@google.com>
8474
8475 * script-sections.cc (Output_section_definition::
8476 set_section_addresses): Rename shadowing local load_address to
8477 laddr.
8478
1307d6cd
ILT
84792009-06-24 Ian Lance Taylor <iant@google.com>
8480
8481 PR 10244
8482 * reloc.cc (relocate_sections): Skip empty relocation sections.
8483
ec3f783e
ILT
84842009-06-23 Ian Lance Taylor <iant@google.com>
8485
8486 PR 10156
8487 * layout.cc (Layout::create_note): Use choose_output_section
8488 rather than make_output_section.
8489
459c9f1c
ILT
84902009-06-23 Ian Lance Taylor <iant@google.com>
8491
8492 PR 10237
8493 * options.cc (General_options::parse_V): Set printed_version_.
8494 (General_options::General_options): Initialize printed_version_.
8495 * options.h (class General_options): Add printed_version_ field.
8496 * gold.cc (queue_initial_tasks): If there are no input files,
8497 don't give a fatal error if we printed the version information.
8498 (queue_middle_tasks): If using -r with a shared object, give a
8499 fatal error rather than an ordinary error.
8500
1518dc8f
ILT
85012009-06-23 Ian Lance Taylor <iant@google.com>
8502
8503 PR 10219
8504 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8505 (Layout::make_output_section): Set have_stabstr_section_ if we see
8506 a .stab*str section.
8507 (Layout::finalize): Call link_stabs_sections.
8508 (Layout::link_stabs_sections): New file.
8509 * layout.h (class Layout): Add have_stabstr_section_ field.
8510 Declare link_stabs_sections.
8511
3d857b98
DK
85122009-06-23 Doug Kwan <dougkwan@google.com>
8513
8514 * Makefile.am (libgold_a_LIBADD): New.
8515 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8516 * Makefile.in: Regenerate.
8517 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8518 * configure: Regenerate.
8519 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8520 * fileread.cc: Include sys/state.h
8521 * gold.h: Declare memmem and strndup if found missing.
8522 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8523
0639a6f6
ILT
85242009-06-23 Ian Lance Taylor <iant@google.com>
8525
8526 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8527 * configure: Rebuild.
8528
8d63875c
ILT
85292009-06-23 Ian Lance Taylor <iant@google.com>
8530
8531 PR 10147
8532 * object.cc (Object::section_contents): Don't try to get a view if
8533 the section has length zero.
8534 (Object::handle_gnu_warning_section): If the section is empty, use
8535 the name of the section as the warning.
8536
f7c8a183
ILT
85372009-06-23 Ian Lance Taylor <iant@google.com>
8538
8539 PR 10133
8540 * stringpool.h (class Stringpool_template): Add optimize_ field.
8541 (Stringpool_template::set_optimize): New function.
8542 * stringpool.cc (Stringpool_template::Stringpool_template):
8543 Initialize optimize_ field.
8544 (Stringpool_template::set_string_offsets): Test local optimize
8545 fild rather than parameter.
8546 * layout.cc (Layout::Layout): Call set_optimize on the section
8547 name stringpool.
8548
e6a307ba
ILT
85492009-06-22 Ian Lance Taylor <iant@google.com>
8550
8551 PR 10030
8552 * yyscript.y: Parse TARGET.
8553 * script.cc (script_set_target): New function.
8554 * script-c.h (script_set_target): Declare.
8555 * options.cc (General_options::string_to_object_format): Rename
8556 from string_to_object_format in anonymous namespace. Change
8557 callers.
8558 * options.h (class General_options): Declare
8559 string_to_object_format.
8560
3ee173de
ILT
85612009-06-22 Ian Lance Taylor <iant@google.com>
8562
8563 * script-sections.cc (Script_sections::create_segments): Don't put
8564 program headers in a PT_LOAD segment if -n or -N.
8565
85662009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
8567
8568 PR 10141
8569 * options.h (class General_options): Add -z lazy and -z now. Sort
8570 -z options into alphabetical order.
8571 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8572
cd6739a1 85732009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
8574
8575 * layout.cc (Layout::make_output_section): Call
8576 Target::new_output_section.
8577 (Layout::attach_allocated_section_to_segment): Put large section
8578 sections in a separate load segment with the large segment flag
8579 set.
8580 (Layout::segment_precedes): Sort large data segments after other
8581 load segments.
8582 (align_file_offset): New static function.
8583 (Layout::set_segment_offsets): Use align_file_offset.
8584 * output.h (class Output_section): Add is_small_section_ and
8585 is_large_section_ fields.
8586 (Output_section::is_small_section): New function.
8587 (Output_section::set_is_small_section): New function.
8588 (Output_section::is_large_section): New function.
8589 (Output_section::set_is_large_section): New function.
8590 (Output_section::is_large_data_section): New function.
8591 (class Output_segment): Add is_large_data_segment_ field.
8592 (Output_segment::is_large_data_segment): New function.
8593 (Output_segment::set_is_large_data_segment): New function.
8594 * output.cc (Output_section::Output_section): Initialize new
8595 fields.
8596 (Output_segment::Output_segment): Likewise.
8597 (Output_segment::add_output_section): Add assertion that large
8598 data sections always go in large data segments. Force small data
8599 sections to the end of the list of data sections. Force small BSS
8600 sections to the start of the list of BSS sections. For large BSS
8601 sections to the end of the list of BSS sections.
8602 * symtab.h (class Symbol): Declare is_common_shndx.
8603 (Symbol::is_defined): Check Symbol::is_common_shndx.
8604 (Symbol::is_common): Likewise.
8605 (class Symbol_table): Define enum Commons_section_type. Update
8606 declarations. Add small_commons_ and large_commons_ fields.
8607 * symtab.cc (Symbol::is_common_shndx): New function.
8608 (Symbol_table::Symbol_table): Initialize new fields.
8609 (Symbol_table::add_from_object): Put small and large common
8610 symbols in the right list.
8611 (Symbol_table::sized_finalized_symbol): Check
8612 Symbol::is_common_shndx.
8613 (Symbol_table::sized_write_globals): Likewise.
8614 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8615 common symbol lists. Don't call do_allocate_commons_list if the
8616 list is empty.
8617 (Symbol_table::do_allocate_commons_list): Remove is_tls
8618 parameter. Add comons_section_type parameter. Change all
8619 callers. Handle small and large common symbols.
8620 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8621 Symbol::is_common_shndx.
8622 * resolve.cc (symbol_to_bits): Likewise.
8623 * target.h (Target::small_common_shndx): New function.
8624 (Target::small_common_section_flags): New function.
8625 (Target::large_common_shndx): New function.
8626 (Target::large_common_section_flags): New function.
8627 (Target::new_output_section): New function.
8628 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8629 small_common_section_flags, and large_common_section_flags
8630 fields.
8631 (Target::do_new_output_section): New virtual function.
8632 * arm.cc (Target_arm::arm_info): Initialize new fields.
8633 * i386.cc (Target_i386::i386_info): Likewise.
8634 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8635 Likewise.
8636 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8637 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8638 (Target_x86_64::do_new_output_section): New function.
8639 * configure.ac: Define conditional MCMODEL_MEDIUM.
8640 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8641 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8642 (large_LDFLAGS): Define.
8643 * testsuite/large.c: New file.
8644 * testsuite/testfile.cc (Target_test::test_target_info):
8645 Initialize new fields.
8646 * configure, testsuite/Makefile.in: Rebuild.
8647
bb04269c
DK
86482009-06-05 Doug Kwan <dougkwan@google.com>
8649
8650 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 8651 * Makefile.in: Regenerate.
bb04269c
DK
8652 * i386.cc (class Target_i386): Define new virtual method to
8653 override do_is_local_label_name in parent.
8654 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8655 local symbols if --discard-locals or -X is given.
8656 * options.h (class General_options): Declare new options
8657 '--discard-locals' and '-X' for discarding locals.
8658 * target.h (class Target): Define new methods is_local_label_name.
8659 Declare new virtual method do_is_local_label_name.
8660 * target.cc: New file.
8661 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8662 (check_SCRIPTS): Add discard_locals_test.sh.
8663 (check_DATA): Add discard_local_tests.syms.
8664 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8665 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8666 * testsuite/Makefile.in: Regenerate.
8667 * testsuite/discard_locals_test.c: New file.
8668 * testsuite/discard_locals_test.sh: Same.
8669
805bb01c
DK
86702009-06-05 Doug Kwan <dougkwan@google.com>
8671
8672 * object.cc (Sized_relobj::Sized_relobj): Initialize
8673 discarded_eh_frame_shndx_ to -1U.
8674 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8675 section.
8676 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8677 a discarded .eh_frame section.
8678 (Sized_relobj::do_finalize_local_symbols): Ditto.
8679 * object.h (class Sized_relobj): Declare new member
8680 discarded_eh_frame_shndx_.
8681 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8682 (local_labels_test.o, local_labels_test): New rules.
8683 * testsuite/Makefile.in: Regenerate.
8684
1dcd334d
DK
86852009-06-04 Doug Kwan <dougkwan@google.com>
8686
8687 * layout.cc (Layout::section_name_mapping): Add mapping for
8688 special ARM sections.
8689
96d49306
DK
86902009-06-03 Doug Kwan <dougkwan@google.com>
8691
8692 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8693 (utils::has_overflow): Same.
8694
dff16297
ILT
86952009-06-03 Ian Lance Taylor <iant@google.com>
8696
8697 * layout.cc (Layout::section_name_mapping): New array, replacing
8698 Layout::linkonce_mapping.
8699 (Layout::section_name_mapping_count): New variable, replacing
8700 Layout::linkonce_mapping_count.
8701 (Layout::linkonce_output_name): Remove.
8702 (Layout::output_section_name): Rewrite.
8703 * layout.h (class Layout): Rename Linkonce_mapping to
8704 Section_name_mapping, linkonce_mapping to section_name_mapping,
8705 linkonce_mapping_count to section_name_mapping_count. Don't
8706 declare linkonce_output_name.
8707
c121c671
DK
87082009-06-03 Doug Kwan <dougkwan@google.com>
8709
8710 * gold/arm.cc (namespace utils): New.
8711 (Target_arm::reloc_is_non_pic): Define new method.
8712 (class Arm_relocate_functions): New.
8713 (Target_arm::Relocate::relocate): Handle relocation types used by
8714 Android.
8715
07800fab
ILT
87162009-06-03 Ian Lance Taylor <iant@google.com>
8717
8718 * arm.cc (Target_arm::scan::global): Use || instead of |.
8719
c121c671
DK
87202009-06-02 Doug Kwan <dougkwan@google.com>
8721
8722 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8723 issued_non_pic_error_.
8724 (class Target_arm::Scan): Declare new method check_non_pic.
8725 Define new method symbol_needs_plt_entry.
8726 Declare new data member issued_non_pic_error_.
8727 (class Target_arm::Relocate): Declare new method
8728 should_apply_static_reloc.
8729 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8730 (Target_arm::Scan::check_non_pic): Define new method.
8731 (Target_arm::Scan::local): Handle a small subset of reloc types used
8732 by Android.
8733 (Target_arm::Scan::local): Same.
8734 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8735
b19b0c6d
ILT
87362009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8737
8738 * incremental.cc (Incremental_inputs::report_command_line): Filter
8739 out --incremental-* options.
8740
94cdfcff
DK
87412009-05-29 Doug Kwan <dougkwan@google.com>
8742
8743 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8744 template class.
8745 (class Target_arm): Update comment.
8746 (Target_arm::Target_arm): Initialize new data members GOT_,
8747 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8748 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8749 and Target_arm::rel_dyn_section.
8750 Declare new_enum Target_arm::Got_type.
8751 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8752 and DYNBSS_.
8753 Update commments for member do_dynsym_value.
8754 (Target_arm::got_size, Target_arm::plt_section,
8755 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8756 new methods inside class defintion.
8757 (Target_arm::got_section): Define new method.
8758 (Target_arm::rel_dyn_section): Same.
8759 (Output_data_plt_arm): New template class.
8760 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8761 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8762 (Output_data_plt_arm::add_entry): Same.
8763 (Output_data_plt_arm::first_plt_entry): Define new
8764 static data member for PLT instruction template.
8765 (Output_data_plt_arm::plt_entry): Same.
8766 (Output_data_plt_arm::do_write): Define new method.
8767 (Target_arm::make_plt_entry): Same.
8768 (Target_arm::do_finalize_sections): Same.
8769 (Target_arm::do_dynsym_value): Same.
8770
4a657b0d
DK
87712009-05-28 Doug Kwan <dougkwan@google.com>
8772
8773 * Makefile.am (TARGETSOURCES): Add arm.cc.
8774 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8775 * Makefile.in: Regenerate.
8776 * arm.cc: New file.
8777 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8778
e7ae8c36
DK
87792009-05-26 Doug Kwan <dougkwan@google.com>
8780
8781 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8782 (General_options::check_excluded_libs): Strip off directories in
8783 archive name before matching like GNU ld does.
8784 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8785 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8786 (exclude_libs_test_LDFLAGS): Add linker option
8787 -Wl,--exclude-libs,libexclude_libs_test_3
8788 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8789 an explicit archive without using -l.
8790 (alt/libexclude_libs_test_3.a): New make rule.
8791 * testsuite/Makefile.in: Regenerate.
8792 * testsuite/exclude_libs_test.c : Declare lib3_default().
8793 (main): Call it.
8794 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8795 * exclude_libs_test_3.c: New file.
8796
f12e7348
NC
87972009-05-26 Nick Clifton <nickc@redhat.com>
8798
8799 * po/id.po: New Indonesian translation.
8800 * po/gold.pot: Updated template file.
8801
4daadc0d
ST
88022009-05-22 Sriraman Tallam <tmsriram@google.com>
8803
e1df38aa 8804 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
8805 gc_comdat_test files. Add -Wl,--gc-sections to build
8806 gc_comdat_test.
8807 * testsuite/Makefile.in: Regenerate.
8808 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8809
531813ad
ST
88102009-05-21 Sriraman Tallam <tmsriram@google.com>
8811
8812 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8813 kept comdat section was garbage collected.
8814 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8815 * testsuite/Makefile.in: Regenerate.
8816 * testsuite/gc_comdat_test.sh: New file.
8817 * testsuite/gc_comdat_test_1.cc: New file.
8818 * testsuite/gc_comdat_test_2.cc: New file.
8819
65514900
CC
88202009-05-19 Doug Kwan <dougkwan@google.com>
8821
8822 * archive.cc (Archive::Archive): Move constructor from archive.h
8823 to here. Initialize no_export_.
8824 (Archive::get_elf_object_for_member): Set no_export flag of object.
8825 * archive.h (Archive::Archive): Move constructor body to
8826 archive.cc.
8827 (Archive::no_export): New method.
8828 (Archive::no_export_): New field.
8829 * object.h (Object::Object): Initialize no_export_ to false.
8830 (Object::no_export, Object::set_no_export): New methods.
8831 (Object::no_export_): New field.
8832 * options.cc (General_options::parse_exclude_libs): New method.
8833 (General_options::check_excluded_libs) Same.
8834 * options.h (exclude_libs): New option.
8835 (General_options::check_excluded_libs): New method declaration.
8836 (General_options::excluded_libs_): New field.
8837 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8838 default or protected visibility if an object has no-export flag set.
8839 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8840 (check_SCRIPTS): Add exclude_libs_test.sh.
8841 (check_DATA): Add exclude_libs_test.syms.
8842 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8843 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8844 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8845 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8846 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8847 libexclude_libs_test_2.a): New rules.
8848 * testsuite/Makefile.in: Regenerate.
8849 * testsuite/exclude_libs_test.c: New file.
8850 * testsuite/exclude_libs_test.sh: Ditto.
8851 * testsuite/exclude_libs_test_1.c: Ditto.
8852 * testsuite/exclude_libs_test_2.c: Ditto.
8853
1b77ea50
ILT
88542009-05-15 Ian Lance Taylor <iant@google.com>
8855
8856 * configure.ac: Check for declarations for cases where libiberty.h
8857 checks HAVE_DECL_xxx.
8858 * configure, config.in: Rebuild.
8859
072fe7ce
ILT
88602009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8861
8862 * gold.h (Incremental_argument_list): Remove (invalid) forward
8863 declaration.
8864 * incremental.cc (Incremental_inputs::report_achive): New method.
8865 (Incremental_inputs::report_object): New method.
8866 (Incremental_inputs::report_script): New method.
8867 (Incremental_inputs::finalize_inputs): New method.
8868 (Incremental_inputs::finalize): Call finalize_inputs().
8869 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8870 Create inputs entries.
8871 * incremental.h (Incremental_input_type): New enum.
8872 (Incremental_inputs::Incremental_input): Initialize new fields.
8873 (Incremental_inputs::report_inputs): New method.
8874 (Incremental_inputs::report_achive): New method.
8875 (Incremental_inputs::report_object): New method.
8876 (Incremental_inputs::report_script): New method.
8877 (Incremental_inputs::finalize_inputs): New method.
8878 (Incremental_inputs::Input_info): New struct.
8879 (Incremental_inputs::Input_info_map): New typedef.
8880 (Incremental_inputs::lock_): New field.
8881 (Incremental_inputs::Inputs_): New field.
8882 (Incremental_inputs::Inputs_map): New field.
8883 * main.cc (main): Call Incremental_input::report_inputs.
8884 * options.h (Input_argument_list): Typedef moved from
8885 Input_arguments.
8886 (Input_file_group::Files): Remove, use ::Input_argument_list.
8887 (Input_file_group::Input_argument_list): Remove, use
8888 ::Input_argument_list.
8889 * plugin.cc (Plugin_manager::add_input_file): Add error in
8890 incremental build.
8891 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8892 functions.
8893 * script.cc (read_input_script): Call
8894 Incremental_input::report_script.
8895 * script.h (Script_info): New class.
8896
b0481b0b
ILT
88972009-04-27 Ian Lance Taylor <iant@google.com>
8898
8899 * x86_64.cc (do_adjust_output_section): Set entsize to
8900 plt_entry_size.
8901
b22a5a41 89022009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
8903
8904 * output.cc (Output_file::close): After short writes, continue
8905 writing from the correct offset in the buffer being written.
8906
40fde488
CD
89072009-04-23 Chris Demetriou <cgd@google.com>
8908
8909 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8910 * configure: Regenerate.
8911 * config.in: Regenerate.
8912 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8913 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8914
3ce2c28e
ILT
89152009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8916
8917 * incremental.cc (Incremental_inputs_header_data): Renamed from
8918 Incremental_input_header_data.
8919 (Incremental_inputs_header_data::data_size): New field.
8920 (Incremental_inputs_header_data::put_input_file_count): Renamed
8921 from input_file_count.
8922 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8923 from command_line_offset.
8924 (Incremental_inputs_header_data::put_reserved): Renamed from
8925 put_reserved.
8926 (Incremental_inputs_entry_data): Renamed from
8927 Incremental_input_entry_data.
8928 (Incremental_inputs_entry_data::data_size): New field.
8929 (Incremental_inputs::report_command_line): New method.
8930 (Incremental_inputs::finalize): New method.
8931 (Incremental_inputs::create_incremental_inputs_data): New method.
8932 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8933 * incremental.h: New file.
8934 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8935 (Layout::finalize): Create incremental inputs section in
8936 incremental builds.
8937 (Layout::create_incremental_info_sections): New method.
8938 * layout.h (Layout::incremental_inputs): New method.
8939 (Layout::create_incremental_info_sections): New method.
8940 (Layout::incremental_inputs_): New field.
8941 * main.cc (main): Notify Incremental_input of the command line.
8942
e55bde5e
ILT
89432009-04-01 Ian Lance Taylor <iant@google.com>
8944 Mikolaj Zalewski <mikolajz@google.com>
8945
8946 * gold.h (reserve_unordered_map): Define, three versions, one for
8947 each version of Unordered_map.
8948 * layout.cc (Layout::Layout): Remove options parameter. Add
8949 number_of_input_files parameter. Don't initialize options_.
8950 Initialize number_of_input_files_ and resized_signatures_. Move
8951 sections_are_attached_.
8952 (Layout::layout_group): Reserve space for group_signatures_.
8953 (Layout::find_or_add_kept_section): Change name parameter to be a
8954 reference. Resize signatures_ map when it gets large enough.
8955 (Layout::layout_eh_frame): Use parameters->options() instead of
8956 this->options_.
8957 (Layout::make_output_section): Likewise.
8958 (Layout::attach_allocated_section_to_segment): Likewise.
8959 (Layout::finalize, Layout::create_executable_stack): Likewise.
8960 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8961 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8962 * layout.h (class Layout): Update declarations. Remove options_
8963 field. Add number_of_input_files_ and resized_signatures_
8964 fields. Move sections_are_attached_ field.
8965 * main.cc (main): Pass number of input files to Layout
8966 constructor. Don't pass options.
8967
154b857c
ILT
89682009-03-30 Ian Lance Taylor <iant@google.com>
8969
8970 * ffsll.c (ffsll): Correct implementation.
8971
2f35ab9b
ILT
89722009-03-27 Ian Lance Taylor <iant@google.com>
8973
fd03461a
ILT
8974 * ffsll.c: New file.
8975 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8976 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8977 * ftruncate.c (ftruncate): Declare before definition.
8978 * mremap.c (mremap): Likewise.
8979 * pread.c (pread): Likewise.
8980 * configure, Makefile.in, config.in: Rebuild.
8981
2f35ab9b
ILT
8982 * mremap.c: New file.
8983 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8984 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8985 (mremap): Declare if HAVE_MREMAP is not defined.
8986 * configure, Makefile.in, config.in: Rebuild.
8987
33aea2fd
CC
89882009-03-27 Cary Coutant <ccoutant@google.com>
8989
8990 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8991 position independent.
8992 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8993 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8994
6d479619
CC
89952009-03-24 Cary Coutant <ccoutant@google.com>
8996
8997 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8998 an executable.
8999 (needs_dynamic_reloc): Likewise.
9000
afc06bb8
ILT
90012009-03-24 Ian Lance Taylor <iant@google.com>
9002
9003 * yyscript.y (file_cmd): Recognize EXTERN.
9004 (extern_name_list, extern_name_list_body): New nonterminals.
9005 * script.cc (script_add_extern): Define.
9006 * script-c.h (script_add_extern): Declare.
9007
f6060a4d
ILT
90082009-03-24 Rafael Avila de Espindola <espindola@google.com>
9009
9010 * object.cc (is_elf_object): Define.
9011 * object.h (is_elf_object): Declare.
9012 * archive.cc (Archive::get_elf_object_for_member): Call
9013 is_elf_object.
33aea2fd 9014 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 9015
26736d8e
ILT
90162009-03-24 Elliott Hughes <enh@google.com>
9017
9018 * output.cc (Output_file::map_anonymous): Define.
9019 (Output_file::map): Use map_anonymous. If the regular mmap fails,
9020 try an anonymous one. Report the size if the mmap fails.
9021 * output.h (class Output_file): Declare map_anonymous.
9022
22fd9730
ILT
90232009-03-24 Ian Lance Taylor <iant@google.com>
9024
9025 * target-select.cc (instantiate_target): Don't acquire the lock if
9026 the instantiated_target_ field has already been set.
9027
cb010894
ILT
90282009-03-23 Ian Lance Taylor <iant@google.com>
9029
7f055c20
ILT
9030 * gold-threads.h (class Initialize_lock): Define.
9031 * gold-threads.cc (class Initialize_lock_once): Define.
9032 (initialize_lock_control): New static variable.
9033 (initialize_lock_pointer): New static variable.
9034 (initialize_lock_once): New static function.
9035 (Initialize_lock::Initialize_lock): Define.
9036 (Initialize_lock::initialize): Define.
9037 * target-select.h: Include "gold-threads.h".
9038 (class Target_selector): Add lock_ and initialize_lock_ fields.
9039 Don't define instantiate_target, just declare it.
9040 * target-select.cc (Target_selector::Target_selector): Initialize
9041 new fields.
9042 (Target_selector::instantiate_target): Define.
9043 * descriptors.h: Include "gold-threads.h".
9044 (class Descriptors): Add initialize_lock_ field.
9045 * descriptors.cc (Descriptors::Descriptors): Initialize new
9046 field.
9047 (Descriptors::open): Use initialize_lock_ field
9048 * errors.h (class Errors): Add initialize_lock_ field.
9049 * errors.cc (Errors::Errors): Initialize new field.
9050 (Errors::initialize_lock): Use initialize_lock_ field.
9051 * powerpc.cc (class Target_selector_powerpc): Remove
9052 instantiated_target_ field. In do_recognize call
9053 instantiate_target rather than do_instantiate_target. In
9054 do_instantiate_target just allocate a new target.
9055 * sparc.cc (class Target_selector_sparc): Likewise.
9056
36959681
ILT
9057 * freebsd.h: New file.
9058 * i386.cc: Include "freebsd.h".
9059 (Target_i386): Derive from Target_freebsd rather than
9060 Sized_target.
9061 (Target_selector_i386): Derive from Target_selector_freebsd rather
9062 than Target_selector.
9063 * x86_64.cc: Include "freebsd.h".
9064 (Target_x86_64): Derive from Target_freebsd rather than
9065 Sized_target.
9066 (Target_selector_x86_64): Derive from Target_selector_freebsd
9067 rather than Target_selector.
9068 * target.h (class Target): Add adjust_elf_header and
9069 do_adjust_elf_header.
9070 * output.cc (Output_file_header:: do_sized_write): Call target
9071 adjust_elf_header routine.
9072 * configure.tgt: Set targ_osabi.
9073 * configure.ac: Define GOLD_DEFAULT_OSABI.
9074 * parameters.cc (Parameters::default_target): Pass
9075 GOLD_DEFAULT_OSABI to select_target.
9076 * target-select.h (class Target_selector): Make instantiate_target
9077 protected rather than private.
9078 * Makefile.am (HFILES): Add freebsd.h.
9079 * configure, Makefile.in, config.in: Rebuild.
9080
cb010894
ILT
9081 * merge.cc (do_add_input_section): Correct pend value. Change
9082 message about last entry not being null terminated from error to
9083 warning.
9084
0e879927
ILT
90852009-03-20 Mikolaj Zalewski <mikolajz@google.com>
9086
9087 * incremental.cc: New file.
9088 * Makefile.am (CCFILES): Add incremental.cc.
9089 * Makefile.in: Rebuild.
9090
41105937
PP
90912009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
9092
9093 * layout.cc (Layout::output_section_name): Preserve names
9094 of '.note.' sections.
e1df38aa 9095
60439920
ILT
90962009-03-19 Ian Lance Taylor <iant@google.com>
9097
9098 * descriptors.cc (Descriptors::open): Check that the options are
9099 valid before using them.
9100
0d371ad3
ILT
91012009-03-18 Ian Lance Taylor <iant@google.com>
9102
9103 * script-sections.h: Include <list>.
9104 (class Script_sections): Change Sections_elements from std::vector
9105 to std::list. Typedef public Elements_iterator. Add
9106 orphan_section_placement_, data_segment_align_start_, and
9107 saw_data_segment_align_ fields. Remove data_segment_align_index_
9108 field.
9109 * script-sections.cc (class Orphan_section_placement): New class.
9110 (class Sections_element): Add virtual functions is_relro and
9111 orphan_section_init. Remove virtual function place_orphan_here.
9112 (class Output_section_definition): Add is_relro and
9113 orphan_section_init. Remove place_orphan_here.
9114 (class Orphan_output_section): Likewise.
9115 (Script_sections::Script_sections): Update for field changes.
9116 (Script_sections::data_segment_align): Set saw_data_segment_align_
9117 and data_segment_align_start_, not data_segment_align_index.
9118 (Script_sections::data_segment_relro_end): Check
9119 saw_data_segment_align_. Use data_segment_align_start_ rather
9120 than data_segment_align_index_.
9121 (Script_sections::place_orphan): Rewrite to use
9122 Orphan_section_placement.
9123
9201d894
ILT
91242009-03-17 Ian Lance Taylor <iant@google.com>
9125
9c5b8369
ILT
9126 * archive.cc (Archive::add_symbols): Check for a version attached
9127 to the symbol name in the archive map.
9128 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
9129 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
9130 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
9131 (ver_test_11.a): New target.
9132 * testsuite/Makefile.in: Rebuild.
9133
9201d894
ILT
9134 * configure.ac: Check for chsize and posix_fallocate. Replace
9135 ftruncate.
9136 * ftruncate.c: New file, from gnulib.
9137 * output.cc (posix_fallocate): Define dummy version if not
9138 HAVE_POSIX_FALLOCATE.
9139 (Output_file::map): Call posix_fallocate rather than lseek and
9140 write.
9141 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
9142 * configure, Makefile.in, config.in: Rebuild.
9143
ef4ab7a8 91442009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 9145
ef4ab7a8
PP
9146 * layout.h (Layout::create_note): Add section_name parameter.
9147 * layout.cc (Layout::create_note): Likewise.
9148 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 9149
8c500701
ILT
91502009-03-17 Ian Lance Taylor <iant@google.com>
9151
e85b18e1
ILT
9152 * descriptors.cc: Include "options.h".
9153 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
9154 (Descriptors::open): Always use O_CLOEXEC when opening a new
9155 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
9156 then set FD_CLOEXEC.
9157
9efe6174
ILT
9158 * sparc.cc (class Target_sparc): Add has_got_section.
9159 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
9160 make sure we have a GOT section.
9161
9162 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
9163 (Target_sparc::Scan::local): Likewise.
9164 (Target_sparc::Scan::global): Likewise.
9165 (Target_sparc::Relocate::relocate): Likewise.
9166 (Target_sparc::Relocate::relocate_tls): Likewise.
9167
8c500701
ILT
9168 * symtab.cc (Symbol_table::define_default_version): New function,
9169 broken out of add_from_object.
9170 (Symbol_table::add_from_object): Call define_default_version.
9171 (Symbol_table::define_special_symbol): Add resolve_oldsym
9172 parameter. Change all callers. If the version for a symbol comes
9173 from a version script, resolve it with the symbol with the same
9174 name with no version. Also add the symbol without a version if
9175 appropriate.
9176 (do_define_in_output_data): If resolving with oldsym, don't delete
9177 sym.
9178 (do_define_in_output_segment): Likewise.
9179 (do_define_as_constant): Likewise.
9180 * symtab.h (class Symbol_table): Update declarations.
9181
f1ed28fb
ILT
91822009-03-13 Ian Lance Taylor <iant@google.com>
9183
15f8229b
ILT
9184 * readsyms.cc (Read_symbols::incompatible_warning): New function.
9185 (Read_symbols::requeue): New function.
9186 (Read_symbols::do_read_symbols): If make_elf_object fails because
9187 the target type is not configured, and the file was searched for,
9188 issue a warning and retry with the next directory.
9189 (Add_symbols::run): If the file has an incompatible format, and
9190 it was searched for, requeue the Read_symbols task. On error,
9191 release the object.
9192 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
9193 dirindex parameter to constructor. Change all callers. Declare
9194 incompatible_warning and requeue.
9195 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
9196 input_argument_ and input_group_ fields. Add them to
9197 constructor. Change all callers.
9198 (class Read_script): Add dirindex_ field. Add it to constructor.
9199 Change all callers.
9200 * archive.cc (Archive::setup): Remove input_objects parameter.
9201 Change all callers.
9202 (Archive::get_file_and_offset): Likewise.
9203 (Archive::read_all_symbols): Likewise.
9204 (Archive::read_symbols): Likewise.
9205 (Archive::get_elf_object_for_member): Remove input_objects
9206 parameter. Add punconfigured parameter. Change all callers.
9207 (Archive::add_symbols): Change return type to bool. Check return
9208 value of include_member.
9209 (Archive::include_all_members): Likewise.
9210 (Archive::include_member): Change return type to bool. Return
9211 false if first included object has incompatible target. Set
9212 included_member_ field.
9213 (Add_archive_symbols::run): If add_symbols returns false, requeue
9214 Read_symbols task.
9215 * archive.h (class Archive): Add included_member_ field.
9216 Initialize it in constructor. Add input_file and searched_for
9217 methods. Update declarations.
9218 (class Add_archive_symbols): Add dirpath_, dirindex_, and
9219 input_argument_ fields. Add them to constructor. Change all
9220 callers.
9221 * script.cc: Include "target-select.h".
9222 (class Parser_closure): Add skip_on_incompatible_target_ and
9223 found_incompatible_target_ fields. Add
9224 skip_on_incompatible_target parameter to constructor. Change all
9225 callers. Add methods skip_on_incompatible_target,
9226 clear_skip_on_incompatible_target, found_incompatible_target, and
9227 set_found_incompatible_target.
9228 (read_input_script): Add dirindex parameter. Change all callers.
9229 If parser finds an incompatible target, requeue Read_symbols
9230 task.
9231 (script_set_symbol): Clear skip_on_incompatible_target in
9232 closure.
9233 (script_add_assertion, script_parse_option): Likewise.
9234 (script_start_sections, script_add_phdr): Likewise.
9235 (script_check_output_format): New function.
9236 * script.h (read_input_script): Update declaration.
9237 * script-c.h (script_check_output_format): Declare.
9238 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
9239 (ignore_cmd): Remove OUTPUT_FORMAT.
9240 * fileread.cc (Input_file::Input_file): Add explicit this.
9241 (Input_file::will_search_for): New function.
9242 (Input_file::open): Add pindex parameter. Change all callers.
9243 * fileread.h (class Input_file): Add input_file_argument method.
9244 Declare will_search_for. Update declarations.
9245 * object.cc (make_elf_object): Add punconfigured parameter.
9246 Change all callers.
9247 * object.h (class Object): Make input_file public. Add
9248 searched_for method.
9249 (make_elf_object): Update declaration.
9250 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
9251 restart search.
9252 * dirsearch.h (class Dirsearch): Update declaration.
9253 * options.h (class General_options): Add --warn-search-mismatch.
9254 * parameters.cc (Parameters::is_compatible_target): New function.
9255 * parameters.h (class Parameters): Declare is_compatible_target.
9256 * workqueue.cc (Workqueue::add_blocker): New function.
9257 * workqueue.h (class Workqueue): Declare add_blocker.
9258
f1ed28fb
ILT
9259 * fileread.cc (Input_file::open): Remove options parameter.
9260 Change all callers.
9261 (Input_file::open_binary): Likewise.
9262 * script.cc (read_input_script): Likewise.
9263 * readsyms.h (class Read_symbols): Remove options_ field. Remove
9264 options parameter from constructor. Change all callers.
9265 (class Read_script): Likewise.
9266 * fileread.h (class Input_file): Update declarations.
9267 * script.h (read_input_script): Update declaration.
9268
34dd024a
NC
92692009-03-10 Nick Clifton <nickc@redhat.com>
9270
9271 * po/es.po: New Spanish translation.
9272
6d71b17c
CC
92732009-03-06 Cary Coutant <ccoutant@google.com>
9274
9275 * options.cc (parse_short_option): Keep dash_z from registering itself.
9276
031cdbed
ILT
92772009-03-03 Ian Lance Taylor <iant@google.com>
9278
9279 PR 9918
9280 * target-reloc.h (relocate_section): Pass output_section to
9281 relocate.
9282 * i386.cc (Target_i386::should_apply_static_reloc): Add
9283 output_section parameter. Change all callers.
9284 (Target_i386::Relocate::relocate): Add output_section parameter.
9285 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9286 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9287 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9288 * testsuite/two_file_shared.sh: New script.
9289 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9290 (check_DATA): Add two_file_shared.dbg.
9291 (two_file_shared.dbg): New target.
9292 * testsuite/Makefile.in: Rebuild.
9293
15d5fa16
ILT
92942009-03-01 Ian Lance Taylor <iant@google.com>
9295
9296 * configure.ac: Check for byteswap.h.
9297 * configure: Rebuild.
9298 * config.in: Rebuild.
9299
8a4c0b0d
ILT
93002009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9301
9302 * layout.cc (Layout::find_or_add_kept_section): New function.
9303 (Layout::add_comdat): Removed.
9304 * layout.h (struct Kept_section): Move out of class Layout.
9305 Remove trailing underscores from field names. Add group_sections
9306 field. Rename group_ field to is_group. Change all uses.
9307 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9308 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9309 comdat_groups_ field.
9310 (Sized_relobj::include_section_group): Use
9311 find_or_add_kept_section and Kept_section::group_sections.
9312 (Sized_relobj::include_linkonce_section): Likewise.
9313 * object.cc (class Sized_relobj): Don't define Comdat_group or
9314 Comdat_group_table. Remove find_comdat_group and
9315 add_comdat_group. Remove comdat_groups_ field.
9316 * plugin.cc (include_comdat_group): Use
9317 Layout::find_or_add_kept_section.
9318
b4ecf66b
ILT
93192009-02-28 Ian Lance Taylor <iant@google.com>
9320
14359ca0
ILT
9321 * README: --gc-sections and map files are now supported. Document
9322 some build requirements.
9323
b4ecf66b
ILT
9324 PR 6992
9325 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9326 relocatable link set the value of the section symbol to zero.
9327 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9328 relocatable link don't include the section address in the local
9329 symbol value.
9330
0602e05a
ILT
93312009-02-27 Ian Lance Taylor <iant@google.com>
9332
fd9d194f
ILT
9333 PR 6811
9334 * options.h (class Search_directory): Add is_system_directory.
9335 (class General_options): Declare is_in_system_directory.
9336 * options.cc (get_relative_sysroot): Make static.
9337 (get_default_sysroot): Make static.
9338 (General_optoins::is_in_system_directory): New function.
9339 * fileread.cc (Input_file::is_in_system_directory): New function.
9340 * fileread.h (class Input_file): Declare is_in_system_directory.
9341 * object.h (class Object): Add is_in_system_directory.
9342 (class Input_objects): Remove system_library_directory_ field.
9343 * object.cc (Input_objects::add_object): Don't set
9344 system_library_directory_.
9345 (input_objects::found_in_system_library_directory): Remove.
9346 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9347 parameter. Change all callers.
9348 (Symbol_table::sized_write_globals): Likewise.
9349 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9350 Call Object::is_in_system_directory.
9351 * symtab.h (class Symbol_table): Update declarations.
9352
61edd21f
ILT
9353 PR 5990
9354 * descriptors.h (Open_descriptor): Add is_on_stack field.
9355 * descriptors.cc (Descriptors::open): If the descriptor is on the
9356 top of the stack, remove it. Initialize is_on_stack field.
9357 (Descriptors::release): Only add pod to stack if it is not on the
9358 stack already.
9359 (Descriptors::close_some_descriptor): Clear stack_next and
9360 is_on_stack fields.
9361
e29e076a
ILT
9362 PR 7091
9363 * output.cc (Output_section::find_starting_output_address): Rename
9364 from starting_output_address; add PADDR parameter; change return
9365 type.
9366 * output.h (class Output_section): Declare
9367 find_starting_output_address instead of starting_output_address.
9368 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9369 section symbol for which we can't find a merge section.
9370
0602e05a
ILT
9371 PR 9836
9372 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9373 hidden or internal, force the symbol to be local.
9374 * resolve.cc (Symbol::override_visibility): Define.
9375 (Symbol::override_base): Use override_visibility.
9376 (Symbol_table::resolve): Likewise.
9377 (Symbol::override_base_with_special): Likewise.
9378 (Symbol_table::override_with_special): If the visibility is hidden
9379 or internal, force the symbol to be local.
9380 * symtab.h (class Symbol): Add set_visibility and
9381 override_visibility.
9382 * testsuite/ver_test_1.sh: New file.
9383 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9384 (check_DATA): Add ver_test_1.syms.
9385 (ver_test_1.syms): New target.
9386 * testsuite/Makefile.in: Rebuild.
9387
401a9a73
CC
93882009-02-25 Cary Coutant <ccoutant@google.com>
9389
9390 * layout.cc (Layout::choose_output_section): Don't rename sections
9391 when using a linker script that has a SECTIONS clause.
9392 * Makefile.in: Regenerate.
9393
9394 * testsuite/Makefile.am (script_test_5.sh): New test case.
9395 * testsuite/Makefile.in: Regenerate.
9396 * testsuite/script_test_5.cc: New file.
9397 * testsuite/script_test_5.sh: New file.
9398 * testsuite/script_test_5.t: New file.
9399
f488e4b0
CC
94002009-02-13 Rafael Avila de Espindola <espindola@google.com>
9401
9402 * archive.cc (Archive::include_member): Update calls to add_symbols.
9403 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9404 the Layout argument.
9405 * dynobj.h (do_add_symbols): Add the Layout argument.
9406 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9407 Layout argument.
9408 * object.h (Object::add_symbols): Add the Layout argument.
9409 (Object::do_add_symbols): Add the Layout argument.
9410 (Sized_relobj::do_add_symbols): Add the Layout argument.
9411 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9412 Unify the two versions.
9413 (Add_plugin_symbols): Remove.
9414 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9415 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9416 (Add_plugin_symbols): Remove.
9417 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9418 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9419 (Add_symbols::run): Make it work with Pulginobj.
9420
89dd1680
ILT
94212009-02-06 Ian Lance Taylor <iant@google.com>
9422
9423 * object.cc (Sized_relobj::do_layout): Make info message start
9424 with lower case letter.
9425
266d0a74
ILT
94262009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9427
602b464e
ILT
9428 * binary.cc: Fix file comment.
9429
266d0a74
ILT
9430 * options.h (enum Incremental_disposition): Define.
9431 (class General_options): Add new options: --incremental,
9432 --incremental_changed, --incremental_unchanged,
9433 --incremental_unknown. Add incremental_disposition_ and
9434 implicit_incremental_ fields.
9435 (General_options::incremental_disposition): New function.
9436 (class Position_dependent_options): Add incremental_disposition
9437 option.
9438 (Position_dependent_options::copy_from_options): Set incremental
9439 dispositions.
9440 * options.cc (General_options::parse_incremental_changed): New
9441 function.
9442 (General_options::parse_incremental_unchanged): New function.
9443 (General_options::parse_incremental_unknown): New function.
9444 (General_options::General_options): Initialize new fields
9445 incremental_disposition_ and implicit_incremental_.
9446 (General_options::finalize): Check for uasge of --incremental-*
9447 without --incremental.
9448
f073bbf7
CD
94492009-02-06 Chris Demetriou <cgd@google.com>
9450
9451 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9452 pointer and to report location as the file name associated with
9453 the symbol.
9454 (gold_undefined_symbol_at_location): New function to replace the
9455 old gold_undefined_symbol functionality.
9456 * target-reloc.h (relocate_section): Update to use
9457 gold_undefined_symbol_at_location.
9458 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9459 Call gold_undefined_symbol function rather than gold_error.
9460 * errors.h (Errors::undefined_symbol): Take location as a
9461 string, rather than calculating it from a relocation.
9462 * errors.cc (Errors::fatal): Print "fatal error:" before the
9463 formatted message.
9464 (Errors::error, Errors::error_at_location): Print "error: "
9465 before the formatted message.
9466 (Errors::undefined_symbol): Take location as a string, rather
9467 than calculating it from a relocation.
9468 (gold_undefined_symbol_at_location): New function akin to
9469 old gold_undefined_symbol, calculates location from relocation.
9470 (gold_undefined_symbol): Change to take only a Symbol pointer
9471 and to report location as the file name associated with the symbol.
9472 * testsuite/debug_msg.sh: Update for changed error messages.
9473 * testsuite/undef_symbol.sh: Likewise.
9474
8e94a90c
ILT
94752009-02-04 Duncan Sands <baldrick@free.fr>
9476
9477 PR 9812
9478 * reduced_debug_output.h
9479 (Output_reduced_debug_abbrev_section::failed): Use format for
9480 gold_warning.
9481 (Output_reduced_debug_info_section::faild): Likewise.
9482
88a0e15b
ILT
94832009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9484
9485 * script.cc (Lazy_demangler): New class.
9486 (Version_script_info::get_symbol_version_helper): Demangle a
9487 symbol only once.
9488
5efc7cd2
CC
94892009-01-29 Cary Coutant <ccoutant@google.com>
9490
9491 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9492 to __tls_get_addr.
9493 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9494
e0ebcf42
ILT
94952009-01-28 Ian Lance Taylor <iant@google.com>
9496
5efc7cd2 9497 * version.cc (version_string): Bump to 1.9.
75fe7426 9498
e0ebcf42
ILT
9499 * gold.h: Include <cstring> and <stdint.h>.
9500 * version.cc: Include <cstdio>.
9501 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9502 warning.
9503 * reduced_debug_output.cc (insert_into_vector): Rename from
9504 Insert_into_vector; change all callers. Use Swap_unaligned to
9505 avoid aliasing issue; remove union since it is unnecessary.
9506
8e2813be 95072009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
9508
9509 * Makefile.am (CCFILES): Add gc.cc.
9510 (HFILES): Add gc.h.
9511 * Makefile.in: Regenerate.
9512 * gold.cc (Gc_runner): New class.
9513 (queue_initial_tasks): Call garbage collection related tasks
9514 when corresponding options are invoked.
9515 (queue_middle_gc_tasks): New function.
9516 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9517 processed early before laying out sections during garbage collection.
9518 * gold.h (queue_middle_gc_tasks): New function.
9519 (is_prefix_of): Move from "layout.cc".
9520 * i386.cc (Target_i386::gc_process_relocs): New function.
9521 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9522 * main.cc (main): Create object of class "Garbage_collection".
9523 * object.cc (Relobj::copy_symbols_data): New function.
9524 (Relobj::is_section_name_included): New function.
e1df38aa
NC
9525 (Sized_relobj::do_layout): Allow this function to be called twice
9526 during garbage collection and defer layout of section during the
6d03d481
ST
9527 first call.
9528 * object.h (Relobj::get_symbols_data): New function.
9529 (Relobj::is_section_name_included): New function.
9530 (Relobj::copy_symbols_data): New function.
9531 (Relobj::set_symbols_data): New function.
9532 (Relobj::get_relocs_data): New function.
9533 (Relobj::set_relocs_data): New function.
9534 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9535 (Relobj::gc_process_relocs): New function.
9536 (Relobj::do_gc_process_relocs): New pure virtual function.
9537 (Relobj::sd_): New data member.
9538 (Sized_relobj::is_output_section_offset_invalid): New function.
9539 (Sized_relobj::do_gc_process_relocs): New function.
9540 * options.h (General_options::gc_sections): Modify to not be a no-op.
9541 (General_options::print_gc_sections): New option.
9542 * plugin.cc (Plugin_finish::run): Remove function call to
9543 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9544 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9545 * reloc.cc (Read_relocs::run): Add task to process relocs and
9546 determine unreferenced sections when doing garbage collection.
9547 (Gc_process_relocs): New class.
9548 (Sized_relobj::do_gc_process_relocs): New function.
9549 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9550 sections that are garbage collected.
9551 * reloc.h (Gc_process_relocs): New class.
9552 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9553 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9554 symbols whose corresponding sections are garbage collected.
9555 (Symbol_table::Symbol_table): Add new parameter for the garbage
9556 collection object.
9557 (Symbol_table::gc_mark_undef_symbols): New function.
9558 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9559 (Symbol_table::gc_mark_dyn_syms): New function.
9560 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9561 as garbage.
9562 (Symbol_table::add_from_object): Likewise.
9563 (Symbol_table::add_from_relobj): When building shared objects, do not
9564 treat externally visible symbols as garbage.
9565 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9566 table information for static and relocatable links.
9567 * symtab.h (Symbol_table::set_gc): New function.
9568 (Symbol_table::gc): New function.
9569 (Symbol_table::gc_mark_undef_symbols): New function.
9570 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9571 (Symbol_table::gc_mark_dyn_syms): New function.
9572 (Symbol_table::gc_): New data member.
e1df38aa 9573 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
9574 function.
9575 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9576 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9577
3b293544
CF
95782009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9579
9580 * options.h (General_options::gc_sections): Define as a no-op for now.
9581 (General_options::no_keep_memory): Ditto.
9582 (General_options::Bshareable): Define.
9583 * options.cc (General_options::finalize): Honor -Bshareable.
9584
83d22aa8
AS
95852009-01-20 Andreas Schwab <schwab@suse.de>
9586
9587 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9588 read the value in the contents, since we don't use it. Use the
9589 template endianness when writing.
9590 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9591
cd536b21
AS
95922009-01-19 Andreas Schwab <schwab@suse.de>
9593
9594 * configure.tgt (powerpc64-*): Fix targ_obj.
9595
99e9a495
ILT
95962009-01-15 Ian Lance Taylor <iant@google.com>
9597
9598 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9599 local symbols when stripping all symbols.
9600
bbbfea06
CC
96012009-01-14 Cary Coutant <ccoutant@google.com>
9602
99e9a495 9603 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 9604
0f7c0701
CC
96052009-01-14 Cary Coutant <ccoutant@google.com>
9606
9607 * archive.cc (Archive::get_elf_object_for_member): Remove call
9608 to File_read::claim_for_plugin.
9609 * descriptors.cc (Descriptors::open): Remove reference to
9610 is_claimed.
9611 (Descriptors::claim_for_plugin): Remove.
9612 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9613 (Descriptors::is_claimed): Remove.
9614 (claim_descriptor_for_plugin): Remove.
9615 * fileread.cc (File_read::claim_for_plugin): Remove.
9616 * fileread.h (File_read::claim_for_plugin): Remove.
9617 (File_read::descriptor): Reopen descriptor if necessary.
9618 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9619 (Plugin_manager::all_symbols_read): Add task parameter. Change
9620 all callers.
9621 (Plugin_manager::get_input_file): New function.
9622 (Plugin_manager::release_input_file): New function.
9623 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9624 corresponding data member.
9625 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9626 and pass to base constructor. Change all callers.
9627 (get_input_file, release_input_file): New functions.
9628 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9629 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9630 (Plugin_manager::all_symbols_read): Add task parameter.
9631 (Plugin_manager::get_input_file): New function.
9632 (Plugin_manager::release_input_file): New function.
9633 (Plugin_manager::task_): New data member.
9634 (Pluginobj::Pluginobj): Add filesize parameter.
9635 (Pluginobj::filename): New function.
9636 (Pluginobj::descriptor): New function.
9637 (Pluginobj::filesize): New function.
9638 (Pluginobj::filesize_): New data member.
9639 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9640 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9641 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9642
9643 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9644 with archive libraries.
9645 * testsuite/Makefile.in: Regenerate.
9646 * testsuite/plugin_test.c (struct sym_info): New type.
9647 (get_input_file, release_input_file): New static variables.
9648 (onload): Capture new transfer vector entries.
9649 (claim_file_hook): Stop reading at end of file according to filesize.
9650 Factor out parsing of readelf output into separate function.
9651 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9652 APIs and get the source file name from the symbol table. Convert
9653 source file name to corresponding object file name. Print info
9654 message when adding new input files.
9655 (parse_readelf_line): New function.
9656 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9657 * testsuite/plugin_test_2.sh: Likewise.
9658 * testsuite/plugin_test_3.sh: Likewise.
9659 * testsuite/plugin_test_4.sh: New test case.
9660
62a6d109
ILT
96612009-01-07 Ian Lance Taylor <iant@google.com>
9662
9663 * version.cc (version_string): Bump to 1.8.
9664
483620e8
CC
96652008-12-23 Cary Coutant <ccoutant@google.com>
9666
9667 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9668 * plugin.cc (Plugin_manager::finish): Rename as
9669 layout_deferred_objects. Move cleanup to separate function.
9670 (Plugin_manager::cleanup): New function.
9671 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9672 separately.
9673 * plugin.h (Plugin_manager::finish): Rename as
9674 layout_deferred_objects.
9675 (Plugin_manager::cleanup): New function.
9676 (Plugin_manager::cleanup_done): New field.
9677
d66a9eb3
CC
96782008-12-23 Cary Coutant <ccoutant@google.com>
9679
9680 * plugin.cc (is_visible_from_outside): New function.
9681 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9682 so we don't return "IR only" status for exported symbols or -r links.
9683
9684 * testsuite/Makefile.am (plugin_test_3): New test case.
9685 * testsuite/Makefile.in: Regenerate.
9686 * testsuite/plugin_test_3.sh: New file.
9687
5995b570
CC
96882008-12-22 Cary Coutant <ccoutant@google.com>
9689
9690 * object.cc (Sized_relobj::layout_section): New function.
9691 (Sized_relobj::do_layout): Defer layout of input sections until after
9692 plugin has provided replacement files.
9693 (Sized_relobj::do_layout_deferred_sections): New function.
9694 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9695 (Relobj::layout_deferred_sections): New function.
9696 (Relobj::do_layout_deferred_sections): New function.
9697 (Sized_relobj::do_layout_deferred_sections): New function.
9698 (Sized_relobj::layout_section): New function.
9699 (Sized_relobj::Deferred_layout): New structure.
9700 (Sized_relobj::deferred_layout_): New field.
9701 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9702 Change all callers. Layout deferred sections.
9703 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9704 references.
9705 (Plugin_hook::run): Move code from do_plugin_hook inline.
9706 (Plugin_hook::do_plugin_hook): Remove.
9707 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9708 (Plugin_manager::finish): Renamed, was cleanup.
9709 (Plugin_manager::should_defer_layout): New function.
9710 (Plugin_manager::add_deferred_layout_object): New function.
9711 (Plugin_manager::Deferred_layout_list): New type.
9712 (Plugin_manager::deferred_layout_objects_): New field.
9713 (Plugin_hook::do_plugin_hook): Remove.
9714
ee769c88
ILT
97152008-12-17 Ian Lance Taylor <iant@google.com>
9716
9717 * options.h (class General_options): Add --no case for
9718 --export-dynamic.
9719
abc8dcba
CC
97202008-12-16 Cary Coutant <ccoutant@google.com>
9721
9722 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9723 vector.
9724 (Plugin_manager::claim_file): Create plugin object even if
9725 plugin did not call the add_symbols callback.
9726 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9727 asking for more symbols than were added.
9728 * testsuite/Makefile.am (plugin_test_1): Add test case with
9729 no global symbols.
9730 (empty.syms): New target.
9731 * testsuite/Makefile.in: Regenerate.
9732 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9733 message. Don't call add_symbols if no globals.
9734 (all_symbols_read_hook): Don't provide replacement for empty
9735 claimed file.
9736
b0074644
ILT
97372008-12-12 Ian Lance Taylor <iant@google.com>
9738
68943102
ILT
9739 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9740 r_type == 0 for a local symbol with r_sym == 0.
9741 (scan_relocatable_relocs): Pass r_sym to
9742 local_non_section_strategy.
9743 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9744 r_sym parameter.
9745
b0074644
ILT
9746 * configure.ac: Update test for TLS descriptors: they are
9747 supported as of glibc 2.9.
9748 * configure: Rebuild.
9749
c2508178
ILT
97502008-12-11 Ian Lance Taylor <iant@google.com>
9751
9752 PR 7091
9753 * target-reloc.h (Default_scan_relocatable_relocs): For each
9754 function, map r_type == 0 to RELOC_DISCARD.
9755
2756a258
CC
97562008-12-10 Cary Coutant <ccoutant@google.com>
9757
9758 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9759 object to override a kept COMDAT group from a plugin object.
9760
bb6f53d3
ILT
97612008-12-09 Ian Lance Taylor <iant@google.com>
9762
fbc558e1
ILT
9763 PR 7088
9764 * yyscript.y (file_cmd): Handle INPUT.
9765
bb6f53d3
ILT
9766 * testsuite/initpri1.c: Change all declarations to be full
9767 prototypes by adding void, to avoid compiler warnings.
9768
4674ecfc
CC
97692008-12-05 Rafael Avila de Espindola <espindola@google.com>
9770
9771 * options.cc (General_options::parse_plugin_opt): New.
9772 (General_options::add_plugin): The argument now is just the filename.
9773 (General_options::add_plugin_option): New.
9774 * options.h (plugin_opt): New.
9775 (add_plugin): Change argument name.
9776 (add_plugin_option): New.
9777 * plugin.cc (Plugin::load): Don't parse the plugin option.
9778 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9779 (Plugin::add_option): New.
9780 (Plugin::args_): Change type.
9781 (Plugin::filename_): New.
9782 (Plugin_manager::add_plugin_option): New.
9783 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9784 * testsuite/Makefile.in: Regenerate.
9785
fd06b4aa
CC
97862008-12-05 Cary Coutant <ccoutant@google.com>
9787
9788 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9789 Handle --strip-lto-sections option.
9790 * options.h (strip_lto_sections): New option.
9791
6c52134c
CC
97922008-12-01 Cary Coutant <ccoutant@google.com>
9793
9794 * plugin.cc (ld_plugin_message): Change format parameter to const.
9795 Fix mismatch between new[] and delete.
9796
a45248e0
CC
97972008-11-14 Cary Coutant <ccoutant@google.com>
9798
9799 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9800 instead of -1U.
9801
c82fbeee
CS
98022008-11-05 Craig Silverstein <csilvers@google.com>
9803
9804 * options.cc (General_options::parse_dynamic_list): New function.
9805 * options.h (General_options): New flags dynamic_list,
9806 dynamic_list_data, dynamic_list_cpp_new, and
9807 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9808 (General_options::in_dynamic_list): New function.
9809 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9810 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9811 (Lex::can_continue_name): Likewise.
9812 (yylex): Likewise.
9813 (read_script_file): New parameter script_options.
9814 (read_dynamic_list): New function.
9815 (Script_options::define_dynamic_list): New function.
9816 (dynamic_list_keyword_parsecodes): New variable.
9817 (dynamic_list_keywords): New variable.
9818 * script.h (Script_options::define_dynamic_list): New function
9819 prototype.
9820 (read_dynamic_list): New function prototype.
9821 * symtab.cc (strprefix): New macro.
9822 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9823 dynamic_list_data, dynamic_list_cpp_new, and
9824 dynamic_list_cpp_typeinfo.
9825 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9826 (dynamic_list_expr): New rule.
9827 (dynamic_list_nodes): Likewise.
9828 (dynamic_list_node): Likewise.
9829 * testsuite/Makefile.am (dynamic_list): New test.
9830 * testsuite/Makefile.in: Regenerated.
9831 * testsuite/dynamic_list.t: New file.
9832 * testsuite/dynamic_list.sh: New file.
9833
e0bb29a5
CS
98342008-11-05 Craig Silverstein <csilvers@google.com>
9835
9836 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9837 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9838 (t11_last): Likewise.
9839 * testsuite/ver_test_6.c (main): Likewise.
9840
4e1e25e0
CC
98412008-10-07 Cary Coutant <ccoutant@google.com>
9842
9843 * options.c (General_options::finalize): Add check for -static and
9844 -shared.
9845 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9846 is not empty.
9847
92f03fcb
CC
98482008-10-02 Cary Coutant <ccoutant@google.com>
9849
9850 * plugin.cc (make_sized_plugin_object): Fix conditional
9851 compilation to work when not all targets are enabled.
9852
fbd8a257
CC
98532008-09-29 Cary Coutant <ccoutant@google.com>
9854
9855 * archive.cc (Archive::get_file_and_offset): Use filename instead
9856 of name to get library path.
9857 (Archive::include_member): Unlock external member of a thin archive.
9858
9859 * testsuite/Makefile.am (TEST_AR): New variable.
9860 (thin_archive_test_1): New test.
9861 (thin_archive_test_2): New test.
81636b3f
CC
9862 * testsuite/Makefile.in: Regenerate.
9863 * testsuite/thin_archive_main.cc: New file.
9864 * testsuite/thin_archive_test_1.cc: New file.
9865 * testsuite/thin_archive_test_2.cc: New file.
9866 * testsuite/thin_archive_test_3.cc: New file.
9867 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 9868
eff45813
CC
98692008-09-29 Cary Coutant <ccoutant@google.com>
9870
9871 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9872 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9873 instead of -1U.
9874 (Sized_relobj::do_finalize_local_symbols): Likewise.
9875 (Sized_relobj::map_to_kept_section): Likewise.
9876 * object.h (Sized_relobj::invalid_address): New constant.
9877 (Sized_relobj::do_output_section_offset): Check for invalid_address
9878 and return -1ULL.
9879 * output.cc (Output_reloc::local_section_offset): Use constant
9880 invalid_address instead of -1U.
9881 (Output_reloc::get_address): Likewise.
9882 (Output_section::output_address): Change -1U to -1ULL.
9883 * output.h (Output_reloc::invalid_address): New constant.
9884 * reloc.cc (Sized_relobj::write_sections): Use constant
9885 invalid_address instead of -1U.
9886 (Sized_relobj::relocate_sections): Likewise.
9887 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9888 values for merge sections.
9889 * target-reloc.h (relocate_for_relocatable): Use constant
9890 invalid_address instead of -1U.
9891
89fc3421
CC
98922008-09-19 Cary Coutant <ccoutant@google.com>
9893
9894 Add plugin functionality for link-time optimization (LTO).
9895 * configure.ac (plugins): Add --enable-plugins option.
9896 * configure: Regenerate.
9897 * config.in: Regenerate.
9898 * Makefile.am (LIBDL): New variable.
9899 (CCFILES): Add plugin.cc.
9900 (HFILES): Add plugin.h.
9901 (ldadd_var): Add LIBDL.
9902 * Makefile.in: Regenerate.
9903
9904 * archive.cc: Include "plugin.h".
9905 (Archive::setup): Don't preread archive symbols when using a plugin.
9906 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9907 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9908 files.
9909 (Archive::include_member): Add symbols from plugin objects.
9910 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9911 * descriptors.cc (Descriptors::open): Check for file descriptors
9912 abandoned by plugins.
9913 (Descriptors::claim_for_plugin): New function.
9914 * descriptors.h (Descriptors::claim_for_plugin): New function.
9915 (Open_descriptor::is_claimed): New field.
9916 (claim_descriptor_for_plugin): New function.
9917 * fileread.cc (File_read::claim_for_plugin): New function.
9918 * fileread.h (File_read::claim_for_plugin): New function.
9919 (File_read::descriptor): New function.
9920 * gold.cc: Include "plugin.h".
9921 (queue_initial_tasks): Add task to call plugin hooks for generating
9922 new object files.
9923 * main.cc: Include "plugin.h".
9924 (main): Load plugin libraries.
9925 * object.h (Pluginobj): Declare.
9926 (Object::pluginobj): New function.
9927 (Object::do_pluginobj): New function.
9928 (Object::set_target): New function.
9929 * options.cc: Include "plugin.h".
9930 (General_options::parse_plugin): New function.
9931 (General_options::General_options): Initialize plugins_ field.
9932 (General_options::add_plugin): New function.
9933 * options.h (Plugin_manager): Declare.
9934 (General_options): Add --plugin option.
9935 (General_options::has_plugins): New function.
9936 (General_options::plugins): New function.
9937 (General_options::add_plugin): New function.
9938 (General_options::plugins_): New field.
9939 * plugin.cc: New file.
9940 * plugin.h: New file.
9941 * readsyms.cc: Include "plugin.h".
9942 (Read_symbols::do_read_symbols): Check for archive before checking
9943 for ELF file. Call plugin hooks to claim files.
9944 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9945 from a real object file; force override when processing replacement
9946 files.
9947 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9948 (Symbol::init_base_object): Likewise.
9949 (Symbol::init_base_output_data): Likewise.
9950 (Symbol::init_base_output_segment): Likewise.
9951 (Symbol::init_base_constant): Likewise.
9952 (Symbol::init_base_undefined): Likewise.
9953 (Symbol::output_section): Assert that object is not a plugin.
9954 (Symbol_table::add_from_pluginobj): New function.
9955 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9956 undefined.
9957 (Symbol_table::sized_write_globals): Likewise.
9958 (Symbol_table::add_from_pluginobj): Instantiate template.
9959 * symtab.h (Sized_pluginobj): Declare.
9960 (Symbol::in_real_elf): New function.
9961 (Symbol::set_in_real_elf): New function.
9962 (Symbol::in_real_elf_): New field.
9963 (Symbol_table::add_from_pluginobj): New function.
9964
9965 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9966 (LIBDL): New variable.
9967 (LDADD): Add LIBDL.
9968 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9969 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9970 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9971 (MOSTLYCLEANFILES): Likewise.
9972 * testsuite/Makefile.in: Regenerate.
9973 * testsuite/plugin_test.c: New file.
9974 * testsuite/plugin_test_1.sh: New file.
9975 * testsuite/plugin_test_2.sh: New file.
9976
de31bda5
ILT
99772008-09-16 Ian Lance Taylor <iant@google.com>
9978
9c2d0ef9
ILT
9979 * target-reloc.h (relocate_section): Check whether a symbol is
9980 defined by the ABI before reporting an undefined symbol error.
9981 * target.h (Target::is_defined_by_abi): Make parameter const.
9982 (Target::do_is_defined_by_abi): Likewise.
9983 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9984 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9985 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9986 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9987 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9988 * testsuite/Makefile.in: Rebuild.
9989
de31bda5
ILT
9990 * fileread.cc (make_view): Add casts to avoid warning.
9991
9fa33bee
AO
99922008-09-16 Alexandre Oliva <aoliva@redhat.com>
9993
9994 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9995 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9996
183fd0e3
AO
99972008-09-16 Alexandre Oliva <aoliva@redhat.com>
9998
9999 * options.h (General_options::output_is_executable): New.
10000 (General_options::output_is_pie): New.
10001 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
10002 for shared libraries.
10003 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
10004
7be8330a
CD
100052008-09-11 Chris Demetriou <cgd@google.com>
10006
10007 * options.h (origin): New -z option.
10008 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
10009 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
10010 in DT_FLAGS_1.
10011
a9caad02
CC
100122008-09-05 Cary Coutant <ccoutant@google.com>
10013
10014 * fileread.cc (File_read::make_view): Add check for attempt to map
10015 beyond end of file.
10016
ae6dce4d
CC
100172008-09-05 Cary Coutant <ccoutant@google.com>
10018
10019 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
10020 explicit instantiations.
10021
d7ab2a47
KVH
100222008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
10023
10024 PR gold/6858
10025 * options.cc (General_options::finalize): Allow undefined symbols
10026 in shlibs if linking -shared.
10027
10028 PR gold/6859
10029 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
10030 symbols as not needing a dynsym entry.
10031
1e52a9c1
CS
100322008-08-20 Craig Silverstein <csilvers@google.com>
10033
10034 * fileread.cc (File_read::open): Do not lock the file unless it
10035 was successfully opened.
10036
d85c80a3
CC
100372008-08-14 Cary Coutant <ccoutant@google.com>
10038
10039 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
10040 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
10041 * testsuite/tls_test.cc (struct int128): 128-bit struct
10042 for testing TLS relocs with non-zero addend.
10043 (v12): New TLS variable.
10044 (t12): New test.
10045 (t_last): Add check for v12.
10046 * testsuite/tls_test.h (t12): New function.
10047 * testsuite/tls_test_main.cc (thread_routine): Call new test.
10048
2d924fd9
ILT
100492008-08-13 Ian Lance Taylor <iant@google.com>
10050
10051 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
10052 set tls_segment_ or relro_segment_.
10053 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
10054 when appropriate.
10055 * output.h (Output_section::clear_is_relro): New function.
10056 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
10057 sections specially even when output_data_ is empty.
10058 (Output_segment::maximum_alignment): When first section is relro,
10059 only force alignment for PT_LOAD segments.
10060 * script.cc (script_data_segment_align): New function.
10061 (script_data_segment_relro_end): New function.
10062 * script-c.h (script_data_segment_align): Declare.
10063 (script_data_segment_relro_end): Declare.
10064 * script-sections.h (class Script_sections): Declare
10065 data_segment_align and data_segment_relro_end. Add fields
10066 segment_align_index_ and saw_relro_end_.
10067 * script-sections.cc (class Sections_element): Add set_is_relro
10068 virtual function. Add new bool* parameter to place_orphan_here.
10069 Add get_output_section virtual function.
10070 (class Output_section_definition): Add set_is_relro. Add new
10071 bool* parameter to place_orphan_here. Add get_output_section.
10072 Add is_relro_ field.
10073 (Output_section_definition::Output_section_definition): Initialize
10074 evaluated_address_, evaluated_load_address, evaluated_addralign_,
10075 and is_relro_ fields.
10076 (Output_section_definition::place_orphan_here): Add is_relro
10077 parameter.
10078 (Output_section_definition::set_section_addresses): Set relro for
10079 output section.
10080 (Output_section_definition::alternate_constraint): Likewise.
10081 (class Orphan_output_section): Add new bool* parameter to
10082 place_orphan_here. Add get_output_section.
10083 (Orphan_output_section::place_orphan_here): Add is_relro
10084 parameter.
10085 (Script_sections::Script_sections): Initialize
10086 data_segment_align_index_ and saw_relro_end_.
10087 (Script_sections::data_segment_align): New function.
10088 (Script_sections::data_segment_relro_end): New function.
10089 (Script_sections::place_orphan): Set or clear is_relro.
10090 (Script_sections::set_section_addresses): Force alignment of first
10091 TLS section.
10092 * yyscript.y (exp): Call script_data_segment_align and
10093 script_data_segment_relro_end.
10094 * testsuite/relro_script_test.t: New file.
10095 * testsuite/relro_test.cc (using_script): Declare.
10096 (t1, t2): Test using_script.
10097 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
10098 (relro_script_test_SOURCES): Define.
10099 (relro_script_test_DEPENDENCIES): Define.
10100 (relro_script_test_LDFLAGS): Define.
10101 (relro_script_test_LDADD): Define.
10102 (relro_script_test.so): New target.
10103 * testsuite/Makefile.in: Rebuild.
10104
f827c9a9
CC
101052008-08-06 Cary Coutant <ccoutant@google.com>
10106
10107 * archive.cc (Archive::total_archives, Archive::total_members)
10108 (Archive::total_members_loaded): New variables.
10109 (Archive::setup): Add parameter. Add option to preread
10110 archive symbols.
10111 (Archive::read_armap): Add counter.
10112 (Archive::get_file_and_offset): New function.
10113 (Archive::get_elf_object_for_member): New function.
10114 (Archive::read_all_symbols): New function.
10115 (Archive::read_symbols): New function.
10116 (Archive::add_symbols): Add counters.
10117 (Archive::include_all_members): Use armap to find members if it's
10118 already built.
10119 (Archive::include_member): Skip reading symbols if already read.
10120 Factored code into Archive::get_file_and_offset and
10121 Archive::get_elf_object_for_member. Changed call to
10122 Mapfile::report_include_archive_member.
10123 (Archive::print_stats): New function.
10124 * archive.h: Declare Object and Read_symbols_data classes.
10125 (Archive::Archive): Add initializers for new members.
10126 (Archive::setup): Add parameter.
10127 (Archive::print_stats): New function.
10128 (Archive::total_archives, Archive::total_members)
10129 (Archive::total_members_loaded): New variables.
10130 (Archive::get_file_and_offset): New function.
10131 (Archive::get_elf_object_for_member): New function.
10132 (Archive::read_all_symbols): New function.
10133 (Archive::read_symbols): New function.
10134 (Archive::Archive_member): New class.
10135 (Archive::members_): New member.
10136 (Archive::num_members_): New member.
10137 * main.cc: Include archive.h.
10138 (main): Call Archive::print_stats.
10139 * mapfile.cc (Mapfile::report_include_archive_member): Delete
10140 archive parameter; member_name is now the fully-decorated name.
10141 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
10142 * options.h: (General_options): Add --preread-archive-symbols option.
10143 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
10144 Archive::setup.
10145
de4c45bd
ILT
101462008-08-04 Ian Lance Taylor <iant@google.com>
10147
10148 * symtab.h (Symbol::use_plt_offset): New function.
10149 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
10150 * powerpc.cc (Relocate::relocate): Likewise.
10151 * sparc.cc (Relocate::relocate): Likewise.
10152 * x86_64.cc (Relocate::relocate): Likewise.
10153 * testsuite/weak_plt.sh: New test.
10154 * testsuite/weak_plt_main.cc: New test.
10155 * testsuite/weak_plt_shared.cc: New test.
10156 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
10157 (check_PROGRAMS): Add weak_plt.
10158 (check_DATA): Add weak_plt_shared.so.
10159 (weak_plt_main_pic.o, weak_plt): New targets.
10160 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
10161 * testsuite/Makefile.in: Rebuild.
10162
10163 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
10164 gcctestdir/ld.
10165 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
10166 * testsuite/Makefile.in: Rebuild.
10167
323ee3f4
AM
101682008-08-04 Alan Modra <amodra@bigpond.net.au>
10169
10170 * Makefile.am (POTFILES.in): Set LC_ALL=C.
10171 * Makefile.in: Regenerate.
10172 * po/POTFILES.in: Regenerate.
10173
7c07ecec
ILT
101742008-07-29 Ian Lance Taylor <iant@google.com>
10175
10176 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
10177 symbols before other symbols.
10178 * testsuite/script_test_2.cc (test_addr): Declare.
10179 (test_addr_alias): Declare.
10180 (main): Check that test_addr and test_addr_alias have the right
cd536b21 10181 values.
7c07ecec
ILT
10182 * testsuite/script_test_2.t: Define test_addr_alias and
10183 test_addr.
10184
5778530e
ILT
101852008-07-24 Ian Lance Taylor <iant@google.com>
10186
2a00e4fb
ILT
10187 PR 5990
10188 * descriptors.cc: New file.
10189 * descriptors.h: New file.
10190 * gold-threads.h (class Hold_optional_lock): New class.
10191 * fileread.cc: Include "descriptors.h".
10192 (File_read::~File_read): Release descriptor rather than closing
10193 it.
10194 (File_read::open) [file]: Call open_descriptor rather than open.
10195 Set is_descriptor_opened_.
10196 (File_read::open) [memory]: Assert that descriptor is not open.
10197 (File_read::reopen_descriptor): New function.
10198 (File_read::release): Release descriptor.
10199 (File_read::do_read): Make non-const. Reopen descriptor.
10200 (File_read::read): Make non-const.
10201 (File_read::make_view): Reopen descriptor.
10202 (File_read::do_readv): Likewise.
10203 * fileread.h (class File_read): Add is_descriptor_opened_ field.
10204 Update declarations.
10205 * layout.cc: Include "descriptors.h".
10206 (Layout::create_build_id): Use open_descriptor rather than open.
10207 * output.cc: Include "descriptors.h".
10208 (Output_file::open): Use open_descriptor rather than open.
10209 * archive.cc (Archive::const_iterator): Change Archive to be
10210 non-const.
10211 (Archive::begin, Archive::end): Make non-const.
10212 (Archive::count_members): Likewise.
10213 * archive.h (class Archive): Update declarations.
10214 * object.h (Object::read): Make non-const.
10215 * Makefile.am (CCFILES): Add descriptors.cc.
10216 (HFILES): Add descriptors.h.
10217 * Makefile.in: Rebuild.
10218
801647d1
ILT
10219 PR 6716
10220 * gold.h: Always include <clocale>. Add Solaris workarounds
10221 following code in binutils/sysdep.h.
10222
5edd166e
ILT
10223 PR 6048
10224 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
10225 this->eh_frame_hdr_ is NULL before using it.
10226
c89ad728
ILT
10227 * dynobj.cc (Versions::Versions): Update comment.
10228
aa86f06b
ILT
10229 * dynobj.cc (Versions::Versions): If there is an soname, use it as
10230 the base version name.
10231
5778530e
ILT
10232 * stringpool.cc (Stringpool_template::add_with_length): Set key to
10233 array size plus one.
10234 (Stringpool_template::set_string_offsets): Subtract one from key
10235 before using it as an array index.
10236 (Stringpool_template::get_offset_with_length): Likewise.
10237 (Stringpool_template::write_to_buffer): Likewise.
10238 * stringpool.h (Stringpool_template::get_offset_from_key):
10239 Likewise.
10240
057ead22
ILT
102412008-07-23 Ian Lance Taylor <iant@google.com>
10242
7f649c59
ILT
10243 PR 6658
10244 * object.h (Merged_symbol_value::value): Do our best to handle a
10245 negative addend.
10246
057ead22
ILT
10247 PR 6647
10248 * script.cc (Version_script_info::get_versions): Don't add empty
10249 version tag to return value.
10250 (Version_script_info::get_symbol_version_helper): Change return
10251 type to bool. Add pversion parameter. Change all callers.
10252 (script_register_vers_node): Don't require a non-NULL tag.
10253 * script.h (class Version_script_info): Update declarations.
10254 (Version_script_info::get_symbol_version): Change return type to
10255 bool. Add version parameter. Change all callers.
10256 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
10257 handling. Handle an empty version from a version script.
10258 (Symbol_table::define_special_symbol): Likewise.
10259 * testsuite/ver_test_10.script: New file.
10260 * testsuite/ver_test_10.sh: New file.
10261 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
10262 (check_DATA): Add ver_test_10.syms.
10263 (ver_test_10.syms, ver_test_10.so): New target.
10264 * testsuite/Makefile.in: Rebuild.
10265
58e54ac2
CD
102662008-07-23 Simon Baldwin <simonb@google.com>
10267
10268 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10269 to zero for undefined symbols from dynamic libraries.
10270
95d14cd3
ILT
102712008-07-23 Ian Lance Taylor <iant@google.com>
10272
10273 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10274 Change all callers.
10275 * symtab.h (class Symbol_table): Update declaration.
10276 * testsuite/ver_test_9.cc: New file.
10277 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10278 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10279 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10280 (ver_test_9.so, ver_test_9.o): New targets.
10281 * testsuite/Makefile.in: Rebuild.
10282
92de84a6
ILT
102832008-07-22 Ian Lance Taylor <iant@google.com>
10284
34810851
ILT
10285 * options.h (class General_options): Define --check-sections.
10286 * layout.cc (Layout::set_segment_offsets): Handle
10287 --check-sections.
10288
af6156ef
ILT
10289 * options.h (class General_options): Define -n/--nmagic and
10290 -N/--omagic.
10291 * options.cc (General_options::finalize): For -n/--nmagic or
10292 -N/--omagic, set -static.
10293 * layout.cc (Layout::attach_allocated_section_to_segment): If
10294 -N/--omagic, don't put read-only and read-write sections in
10295 different segments.
10296 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10297 finding a read-only segment.
10298 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10299 don't set the minimum segment alignment to the common page size,
10300 and don't set the file offset to the address modulo the page size.
10301 * script-sections.cc (Script_sections::create_segments): If
10302 -n/--omagic, don't put read-only and read-write sections in
10303 different segments.
10304
92de84a6
ILT
10305 * cref.cc: New file.
10306 * cref.h: New file.
10307 * options.h (class General_options): Add --print-symbol-counts.
10308 * main.cc (main): Issue defined symbol report if requested.
10309 * archive.cc (Archive::interpret_header): Make into a const member
10310 function.
10311 (Archive::add_symbols): Call Input_objects::archive_start and
10312 archive_stop.
10313 (Archive::const_iterator): Define new class.
10314 (Archive::begin, Archive::end): New functions.
10315 (Archive::include_all_members): Rewrite to use iterator.
10316 (Archive::count_members): New function.
10317 * archive.h (class Archive): Update declarations.
10318 (Archive::filename): New function.
10319 * object.cc: Include "cref.h".
10320 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10321 (Sized_relobj::do_get_global_symbol_counts): New function.
10322 (Input_objects::add_object): Add object to cross-referencer.
10323 (Input_objects::archive_start): New function.
10324 (Input_objects::archive_stop): New function.
10325 (Input_objects::print_symbol_counts): New function.
10326 * object.h: Declare Cref and Archive.
10327 (Object::get_global_symbol_counts): New function.
10328 (Object::do_get_global_symbol_counts): New pure virtual function.
10329 (class Sized_relobj): Add defined_count_ field. Update
10330 declarations.
10331 (class Input_objects): Add cref_ field. Update constructor.
10332 Update declarations.
10333 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10334 defined_count_.
10335 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10336 symbol counts.
10337 (Sized_dynobj::do_get_global_symbol_counts): New function.
10338 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10339 defined_count_. Update declarations. Define Symbols typedef.
10340 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10341 parameter. Change all callers.
10342 (Symbol_table::add_from_dynobj): Add sympointers and defined
10343 parameters. Change all callers.
10344 * symtab.h (class Symbol_table): Update declarations.
10345 * Makefile.am (CCFILES): Add cref.cc.
10346 (HFILES): Add cref.h.
10347 * Makefile.in: Rebuild.
10348
3f7c5e1d
CD
103492008-07-22 Simon Baldwin <simonb@google.com>
10350
10351 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10352 to zero when writing undefined symbols.
10353
e0b64032
ILT
103542008-07-22 Ian Lance Taylor <iant@google.com>
10355
10356 * output.cc (Output_section::add_input_section): Don't try to
10357 merge empty merge sections.
10358
096b02cf
CS
103592008-07-21 Craig Silverstein <csilvers@google.com>
10360
10361 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10362 Include symbol version in error message.
cd536b21 10363
1d1f116d
CD
103642008-07-20 Chris Demetriou <cgd@google.com>
10365
cd536b21 10366 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
10367 (RANDOM_SEED_CFLAGS): New substituted variable.
10368 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10369 * configure: Rebuild.
10370 * Makefile.in: Likewise.
10371 * testsuite/Makefile.in: Likewise.
10372
a18f591e
ILT
103732008-07-18 Ian Lance Taylor <iant@google.com>
10374
10375 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10376 where we see NAME/NULL and NAME/VERSION as separate symbols.
10377 * testsuite/ver_test_main.cc (main): Call t4.
10378 (t4, t4_2a): Define.
10379 * testsuite/ver_test_2.cc (t4_2): Define.
10380 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10381 * testsuite/ver_test_4.cc (t4_2a): Define.
10382 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10383 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10384
c6e3f6ed
ILT
103852008-07-17 Ian Lance Taylor <iant@google.com>
10386
10387 * dynobj.cc (Versions::add_def): If we give an error about a
10388 missing version, go ahead and create the version anyhow.
10389
ef9beddf
ILT
103902008-07-10 Ian Lance Taylor <iant@google.com>
10391
10392 Handle output sections with more than 0x7fffffff bytes.
10393 * object.h (class Relobj): Change map_to_output_ to
10394 output_sections_, and just keep a section pointer. Change all
10395 uses. Move comdat group support to Sized_relobj.
10396 (Relobj::is_section_specially_mapped): Remove.
10397 (Relobj::output_section): Remove poff parameter. Change all
10398 callers.
10399 (Relobj::output_section_offset): New function.
10400 (Relobj::set_section_offset): Rewrite.
10401 (Relobj::map_to_output): Remove.
10402 (Relobj::output_sections): New function.
10403 (Relobj::do_output_section_offset): New pure virtual function.
10404 (Relobj::do_set_section_offset): Likewise.
10405 (class Sized_relobj): Add section_offsets_ field. Add comdat
10406 group support from Relobj. Update declarations.
10407 (Sized_relobj::get_output_section_offset): New function.
10408 (Sized_relobj::do_output_section_offset): New function.
10409 (Sized_relobj::do_set_section_offset): New function.
10410 * object.cc (Relobj::output_section_address): Remove.
10411 (Sized_relobj::Sized_relobj): Initialize new fields.
10412 (Sized_relobj::include_section_group): Cast find_kept_object to
10413 Sized_relobj.
10414 (Sized_relobj::include_linkonce_section): Likewise.
10415 (Sized_relobj::do_layout): Use separate arrays for output section
10416 and output offset.
10417 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10418 output_sections.
10419 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10420 output_sections and section_offsets.
10421 (Sized_relobj::write_local_symbols): Likewise.
10422 (map_to_kept_section): Compute output address directly.
10423 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10424 output_sections and section_offsets.
10425 (Sized_relobj::write_sections): Likewise.
10426 (Sized_relobj::relocate_sections): Likewise.
10427 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10428 * output.h (class Output_reloc): Update declarations. Change
10429 u2_.relobj to Sized_relobj*.
10430 (class Output_data_reloc): Change add functions to use
10431 Sized_relobj*.
10432 * output.cc (Output_reloc::Output_reloc): Change relobj to
10433 Sized_relobj*.
10434 (Output_reloc::local_section_offset): Change return type to
10435 Elf_Addr. Use get_output_section_offset.
10436 (Output_reloc::get_address): Likewise.
10437 (Output_section::is_input_address_mapped): Don't call
10438 is_section_specially_mapped.
10439 (Output_section::output_offset): Likewise.
10440 (Output_section::output_address): Likewise.
10441 (Output_section::starting_output_address): Likewise.
10442 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10443 parameter to Sized_relobj*.
10444 (Copy_relocs::need_copy_reloc): Likewise.
10445 (Copy_relocs::save): Likewise.
10446 * copy-relocs.h (class Copy_relocs): Update declarations.
10447 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10448 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10449 * target-reloc.h (relocate_for_relocatable): Change
10450 offset_in_output_section type to Elf_Addr. Change code that uses
10451 it as well.
10452 * layout.cc (Layout::layout): Always set *off.
10453 * mapfile.cc (Mapfile::print_input_section): Use
10454 output_section_offset.
10455 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10456 Sized_relobj*.
10457 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10458 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10459 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10460
5cb66f97
ILT
104612008-07-03 Ian Lance Taylor <iant@google.com>
10462
10463 * layout.cc (Layout::include_section): Do not discard unrecognized
10464 SHT_STRTAB sections.
10465
afe47622
CS
104662008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10467
10468 * script.cc (Lex::can_continue_name): Make '?' allowable in
10469 version-script names.
10470 * testsuite/version_script.map: Change glob pattern to use '?'
10471
5adf9721
ILT
104722008-06-30 Manish Singh <yosh@gimp.org>
10473
10474 PR 6585
10475 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10476 Correct typo.
10477
e6fde208
ILT
104782008-06-30 Ian Lance Taylor <iant@google.com>
10479
10480 PR 6660
10481 PR 6682
10482 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10483 versions]: Don't try to read the value in the contents, since we
10484 don't use it. Use the template endianness when writing.
10485
3f2e6a2d
CC
104862008-06-25 Cary Coutant <ccoutant@google.com>
10487
10488 * fileread.cc (File_read::make_view): Assert on zero-length view.
10489 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10490 symbol table when there are no symbols to read.
10491
c43d3a48
CS
104922008-06-23 Craig Silverstein <csilvers@google.com>
10493
10494 * version.cc (version_string): Bump to 1.7
10495
5f494ea0
CS
104962008-06-18 Craig Silverstein <csilvers@google.com>
10497
10498 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10499 constant 0xFFFF to type Valtype.
10500 (Powerpc_relocate_functions::rel16_ha): Likewise.
10501
c42e122e
ILT
105022008-06-17 Ian Lance Taylor <iant@google.com>
10503
f34787f8
ILT
10504 * output.h (Output_section::Input_section): Initialize p2align_ to
10505 zero for Output_section_data constructors.
10506 (Output_section::Input_section::addralign): If not an input
10507 section, return the alignment of the Output_section_data.
10508 * testsuite/copy_test.cc: New file.
10509 * testsuite/copy_test_1.cc: New file.
10510 * testsuite/copy_test_2.cc: New file.
10511 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10512 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10513 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10514 (copy_test_1_pic.o, copy_test_1.so): New targets.
10515 (copy_test_2_pic.o, copy_test_2.so): New targets.
10516 * testsuite/Makefile.in: Rebuild.
10517
c42e122e
ILT
10518 * script-sections.cc (Script_sections::place_orphan): Initialize
10519 local variable exact.
10520
ce3ac18a
DE
105212008-06-13 David Edelsohn <edelsohn@gnu.org>
10522
10523 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10524
42cacb20
DE
105252008-06-12 David Edelsohn <edelsohn@gnu.org>
10526 David S. Miller <davem@davemloft.net>
10527
10528 * powerpc.cc: New file.
10529 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10530 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10531 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10532 * Makefile.in: Rebuild.
10533
7b308235
ILT
105342008-06-09 Ian Lance Taylor <iant@google.com>
10535
10536 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10537 <exception>.
10538 (throwing, orig_terminate): New static variables.
10539 (terminate_handler): New static function.
10540 (t2): Set terminate handler.
10541
f0b886e3
ILT
105422008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10543
10544 PR 6584
cd536b21 10545 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
10546 alignment.
10547
3e90f135
CC
105482008-05-30 Cary Coutant <ccoutant@google.com>
10549
10550 * archive.cc (Archive::include_all_members) Correct to step
10551 over symbol table and extended name table in thin archives.
10552
e09ad04a
ILT
105532008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10554
10555 PR 6407
10556 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10557 calculation.
10558
62b01cb5
ILT
105592008-05-28 Caleb Howe <cshowe@google.com>
10560
10561 * reduced_debug_output.cc: New file.
10562 * reduced_debug_output.h: New file.
92de84a6 10563 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
10564 * options.cc (General_options::finalize): Add strip_debug_non_line
10565 to the strip heirarchy.
10566 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10567 fields.
10568 * layout.cc: Include "reduced_debug_output.h".
10569 (Layout::Layout): Initialize new fields.
10570 (line_only_debug_sections): New static array.
10571 (is_lines_only_debug_sections): New static inline function.
10572 (Layout::include_section): Handle --strip-debug-non-line.
10573 (Layout::make_output_section): If --strip-debug-non-line, build
10574 new output sections for .debug_abbrev and .debug_info.
10575 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10576 gold. Warn about possible overflow.
10577 (read_signed_LEB_128): Likewise.
10578 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10579 (read_signed_LEB_128): Declare.
10580 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10581 (HFILES): Add reduced_debug_output.h.
10582 * Makefile.in: Rebuild.
10583
7d9e3d98
ILT
105842008-05-21 Ian Lance Taylor <iant@google.com>
10585
10586 * mapfile.cc: New file.
10587 * mapfile.h: New file.
10588 * options.h (class General_options): Add -M/--print-map and -Map.
10589 * options.cc (General_options::finalize): Make -M equivalent to
10590 -Map -.
10591 * main.cc: Include <cstdio> and "mapfile.h".
10592 (main): Open mapfile if requested.
10593 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10594 constructor. Change caller.
10595 (queue_initial_tasks): Add mapfile parameter. Change caller.
10596 (queue_middle_tasks): Likewise.
10597 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10598 declarations.
10599 * archive.cc: Include "mapfile.h".
10600 (Archive::add_symbols): Add mapfile parameter. Change all
10601 callers. Pass mapfile, symbol, and reason to include_member.
10602 (Archive::include_all_members): Add mapfile parameter. Change all
10603 callers.
10604 (Archive::include_member): Add mapfile, sym, and why parameters.
10605 Change all callers. Report inclusion to map file.
10606 * archive.h: Include "fileread.h".
10607 (class Archive): Update declarations.
10608 (Archive::file): New const method.
10609 (class Add_archive_symbols): Add mapfile_ field. Update
10610 constructor. Change all callers.
10611 * readsyms.h (class Read_symbols): Likewise.
10612 (class Finish_group): Likewise.
10613 (class Read_script): Likewise.
10614 * common.cc: Include "mapfile.h".
10615 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10616 all callers.
10617 (Symbol_table::do_allocate_commons): Likewise.
10618 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10619 symbol allocation to mapfile.
10620 * common.h (class Allocate_commons_task): Add mapfile_ field.
10621 Update constructor. Change all callers.
10622 * symtab.h (class Symbol_table): Update declarations.
10623 * layout.cc: Include "mapfile.h".
10624 (Layout_task_runner::run): Print information to mapfile.
10625 (Layout::create_gold_note): Change Output_data_fixed_space to
10626 Output_data_zero_fill.
10627 (Layout::create_build_id): Likewise.
10628 (Layout::print_to_mapfile): New function.
10629 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10630 constructor. Change caller.
10631 (class Layout): Declare print_to_mapfile.
10632 * output.cc (Output_section::Input_section::print_to_mapfile): New
10633 function.
10634 (Output_section::add_input_section): If producing a map, always
10635 add to input_sections_ list.
10636 (Output_section::do_print_to_mapfile): New function.
10637 (Output_segment::print_sections_to_mapfile): New function.
10638 (Output_segment::print_section_list_to_mapfile): New function.
10639 * output.h: Include "mapfile.h".
10640 (Output_data::print_to_mapfile): New function.
10641 (Output_data::do_print_to_mapfile): New virtual function.
10642 (Output_segment_headers::do_print_to_mapfile): New function.
10643 (Output_file_header::do_print_to_mapfile): New function.
10644 (Output_data_const::do_print_to_mapfile): New function.
10645 (class Output_data_const_buffer): Add map_name_ field. Update
10646 constructor. Change all callers. Add do_print_to_mapfile
10647 function.
10648 (class Output_data_fixed_space): Likewise.
10649 (class Output_data_space): Likewise.
10650 (class Output_data_zero_fill): New class.
10651 (Output_data_strtab::do_print_to_mapfile): New function.
10652 (Output_data_reloc_base::do_print_to_mapfile): New function.
10653 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10654 (Output_data_group::do_print_to_mapfile): New function.
10655 (Output_data_got::do_print_to_mapfile): New function.
10656 (Output_data_dynamic::do_print_to_mapfile): New function.
10657 (Output_symtab_xindex::do_print_to_mapfile): New function.
10658 (class Output_section): Declare do_print_to_mapflie. Declare
10659 print_to_mapfile in Input_section.
10660 (class Output_segment): Declare new functions.
10661 * object.h (Sized_relobj::symbol_count): New function.
10662 * script-sections.cc
10663 (Output_section_element_dot_assignment::set_section_addresses):
10664 Change Output_data_fixed_space to Output_data_zero_fill.
10665 (Output_data_expression::do_print_to_mapfile): New function.
10666 * script.cc (read_input_script): Add mapfile parameter. Change
10667 all callers.
10668 * script.h (read_input_script): Update declaration.
10669 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10670 (Eh_frame::do_print_to_mapfile): New function.
10671 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10672 (Output_merge_string::do_print_to_mapfile): New function.
10673 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10674 function.
10675 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10676 function.
10677 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10678 function.
10679 * Makefile.am (CCFILES): Add mapfile.cc.
10680 (HFILES): Add mapfile.h.
10681 * Makefile.in: Rebuild.
10682
9f1d377b
ILT
106832008-05-19 Ian Lance Taylor <iant@google.com>
10684
10685 * options.h (class General_options): Add -z relro.
10686 * layout.cc (Layout::Layout): Initialize relro_segment_.
10687 (Layout::add_output_section_data): Return the output section.
10688 (Layout::make_output_section): Rcognize relro sections and mark
10689 them appropriately.
10690 (Layout::attach_allocated_section_to_segment): Put relro sections
10691 in a PT_GNU_RELRO segment.
10692 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10693 section as relro.
10694 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10695 PT_TLS segments.
10696 (Layout::linkonce_mapping): Map d.rel.ro.local to
10697 .data.rel.ro.local.
10698 (Layout::output_section_name): Us .data.rel.ro.local for any
10699 section which begins with that.
10700 * layout.h (class Layout): Update add_output_section_data
10701 declaration. Add relro_segment_ field.
10702 * output.cc (Output_section::Output_section): Initialize is_relro_
10703 and is_relro_local_ fields.
10704 (Output_segment::add_output_section): Group relro sections.
10705 (Output_segment::is_first_section_relro): New function.
10706 (Output_segment::maximum_alignment): If there is a relro section,
10707 align the segment to the common page size.
10708 (Output_segment::set_section_addresses): Track whether we are
10709 looking at relro sections. If the last section is a relro
10710 section, align to the common page size.
10711 (Output_segment::set_section_list_addresses): Add in_relro
10712 parameter. Change all callers. Align to the page size when
10713 moving from relro to non-relro section.
10714 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10715 segment.
10716 * output.h (class Output_section): Add is_relro_ and
10717 is_relro_local_ fields.
10718 (Output_section::is_relro): New function.
10719 (Output_section::set_is_relro): New function.
10720 (Output_section::is_relro_local): New function.
10721 (Output_section::set_is_relro_local): New function.
10722 (class Output_segment): Update declarations.
10723 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10724 * sparc.cc (Target_sparc::got_section): Likewise.
10725 * x86_64.cc (Target_x86_64::got_section): Likewise.
10726 * testsuite/relro_test_main.cc: New file.
10727 * testsuite/relro_test.cc: New file.
10728 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10729 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10730 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10731 (relro_test.so, relro_test_pic.o): New targets.
10732 * testsuite/Makefile.in: Rebuild.
10733
a984ee1d
ILT
107342008-05-16 Ian Lance Taylor <iant@google.com>
10735
01676dcd
ILT
10736 * output.cc (Output_segment::add_output_section): Remove front
10737 parameter.
10738 * output.h (class Output_segment): Remove
10739 add_initial_output_section and overloaded add_output_section.
10740 Update declaration of remaining add_output_section.
10741 * layout.cc (Layout::create_interp): Call add_output_section
10742 rather than add_initial_output_section.
10743 (Layout::finish_dynamic_section): Likewise.
10744
497897f9
ILT
10745 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10746 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10747 know the dynamic type.
10748 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10749 field. Initialize it in constructor.
10750 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10751 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10752 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10753 reloc.
10754
a984ee1d
ILT
10755 * output.cc (Output_reloc::get_address): Change return type to
10756 Elf_Addr.
10757 * output.h (class Output_reloc): Update get_address declaration.
10758 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10759 for section addresses.
10760
55ba0940
ILT
107612008-05-09 Ian Lance Taylor <iant@google.com>
10762
10763 PR 6493
10764 * gold.cc (gold_nomem): Use return value of write.
10765
75517b77
ILT
107662008-05-08 Ian Lance Taylor <iant@google.com>
10767
10768 * symtab.c (Symbol::init_base_output_data): Add version
10769 parameter. Change all callers.
10770 (Symbol::init_base_output_segment): Likewise.
10771 (Symbol::init_base_constant): Likewise.
10772 (Symbol::init_base_undefined): Likewise.
10773 (Sized_symbol::init_output_data): Likewise.
10774 (Sized_symbol::init_output_segment): Likewise.
10775 (Sized_symbol::init_constant): Likewise.
10776 (Sized_symbol::init_undefined): Likewise.
10777 (Symbol_table::do_define_in_output_data): If the new symbol has a
10778 version, mark it as the default.
10779 (Symbol_table::do_define_in_output_segment): Likewise.
10780 (Symbol_table::do_define_as_constant): Likewise.
10781 * symtab.h (class Symbol): Update declarations.
10782 (class Sized_symbol): Likewise.
10783 * resolve.cc (Symbol::override_version): New function.
c42e122e 10784 (Symbol::override_base): Call override_version.
75517b77
ILT
10785 (Symbol::override_base_with_special): Likewise.
10786 * testsuite/ver_script_8.script: New file.
10787 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10788 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10789 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10790 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10791
f1f70eae
ILT
107922008-05-06 Ian Lance Taylor <iant@google.com>
10793
f3e9c5c5
ILT
10794 PR 6049
10795 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10796 functions.
10797 (class General_options): Remove existing --undefined, and add
10798 --no-undefined instead. Add new --undefined as synonym for -u.
10799 * archive.cc (Archive::add_symbols): Check whether symbol was
10800 named with -u.
10801 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10802 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10803 all uses. Add IS_UNDEFINED. Update declarations to split
10804 different versions of init_base. Declare init_base_undefined.
10805 (Symbol::is_defined): Handle IS_UNDEFINED.
10806 (Symbol::is_undefined): Likewise.
10807 (Symbol::is_weak_undefined): Call is_undefined.
10808 (Symbol::is_absolute): Handle IS_CONSTANT.
10809 (class Sized_symbol): Update declarations to split different
10810 versions of init. Declare init_undefined.
10811 (class Symbol_table): Declare new functions.
10812 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10813 Change all callers.
10814 (Symbol::init_base_output_data): Likewise.
10815 (Symbol::init_base_output_segment): Likewise.
10816 (Symbol::init_base_constant): Likewise.
10817 (Symbol::init_base_undefined): New function.
10818 (Sized_symbol::init_object): Rename from init. Change all
10819 callers.
10820 (Sized_symbol::init_output_data): Likewise.
10821 (Sized_symbol::init_output_segment): Likewise.
10822 (Sized_symbol::init_constant): Likewise.
10823 (Sized_symbol::init_undefined): New function.
10824 (Symbol_table::add_undefined_symbols_from_command_line): New
10825 function.
10826 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10827 function.
10828 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10829 (Symbol::output_section): Likewise.
10830 (Symbol::set_output_section): Likewise.
10831 (Symbol_table::sized_finalize_symbol): Likewise.
10832 (Symbol_table::sized_write_globals): Likewise.
10833 * resolve.cc (Symbol_table::should_override): Likewise.
10834 (Symbol::override_base_with_special): Likewise.
10835
8bdcdf2c
ILT
10836 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10837 symbol, change it to have default visibility.
10838 * testsuite/protected_1.cc: New file.
10839 * testsuite/protected_2.cc: New file.
10840 * testsuite/protected_3.cc: New file.
10841 * testsuite/protected_main_1.cc: New file.
10842 * testsuite/protected_main_2.cc: New file.
10843 * testsuite/protected_main_3.cc: New file.
10844 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10845 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10846 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10847 (protected_1.so): New target.
10848 (protected_1_pic.o, protected_2_pic.o): New targets.
10849 (protected_3_pic.o): New target.
10850 (check_PROGRAMS): Add protected_2.
10851 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10852 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10853 * testsuite/Makefile.in: Rebuild.
10854
2b706932
ILT
10855 * options.h (DEFINE_var): Add set_user_set_##varname__.
10856 (DEFINE_bool_alias): New macro.
10857 (class General_options): Define -Bstatic using DEFINE_bool_alias
10858 rather than DEFINE_special. Add --undefined as an alias for -z
10859 defs.
10860 * options.cc (General_options::parse_Bstatic): Remove.
10861
d82a5bcc
ILT
10862 * options.h (class General_options): Add --fatal-warnings.
10863 * main.cc (main): Implement --fatal-warnings.
10864 * errors.h (Errors::warning_count): New function.
10865
f1f70eae
ILT
10866 * options.h (class General_options): Add -Bsymbolic-functions.
10867 * symtab.h (Symbol::is_preemptible): Check for
10868 -Bsymbolic-functions.
10869
8825ac63
ILT
108702008-05-05 Ian Lance Taylor <iant@google.com>
10871
d98bc257
ILT
10872 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10873 as noVARNAME rather than no-VARNAME.
10874 (class General_options): Add option -z combreloc.
10875 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10876 get_address.
10877 (Output_reloc::sort_before) [SHT_REL]: New function.
10878 (Output_reloc::sort_before) [SHT_RELA]: New function.
10879 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10880 Sort_relocs_comparison.
10881 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10882 parameter. Change all callers.
10883 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10884 sort_relocs parameter. Change all callers.
10885 * output.cc (Output_reloc::get_address): New function, broken out
10886 of write_rel.
10887 (Output_reloc::write_rel): Call it.
10888 (Output_reloc::compare): New function.
10889 (Output_data_reloc_base::do_write): Optionally sort relocs.
10890
60b2b4e7
ILT
10891 * configure.ac: If targ_extra_obj is set, link it in.
10892 * configure.tgt: Initialize all variables.
10893 (x86_64*): Set targ_extra_obj and targ_extra_size.
10894 * configure: Rebuild.
10895
8825ac63
ILT
10896 * object.cc (Sized_relobj::include_section_group): Adjust section
10897 indexes read from group data. Build vector to pass to
10898 layout_group.
10899 * layout.cc (Layout::layout_group): Add flags and shndxes
10900 parameters. Remove contents parameter. Change caller. Update
10901 explicit instantiations.
10902 * layout.h (class Layout): Update layout_group declaration.
10903 * output.cc (Output_data_group::Output_data_group): Add flags and
10904 input_shndxes parameters. Remove contents parameter. Change
10905 caller.
10906 (Output_data_group::do_write): Change input_sections_ to
10907 input_shndxes_.
10908 * output.h (class Output_data_group): Update constructor
10909 declaration. Rename input_sections_ to input_shndxes_.
10910 * testsuite/many_sections_test.cc: Add template.
10911
e94cf127
CC
109122008-04-30 Cary Coutant <ccoutant@google.com>
10913
4418b2d5
CC
10914 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10915
e94cf127
CC
10916 * layout.cc (Layout::include_section): Refactored check for debug
10917 info section.
10918 (Layout::add_comdat): Add new parameters. Change type
10919 of signature parameter. Add object and shndx to signatures table.
10920 (Layout::find_kept_object): New function.
10921 * layout.h: Include <cstring>.
10922 (Layout::is_debug_info_section): New function.
10923 (Layout::add_comdat): Add new parameters.
10924 (Layout::find_kept_object): New function.
10925 (Layout::Kept_section): New struct.
10926 (Layout::Signatures): Change type of map range.
10927 * object.cc (Relobj::output_section_address): New function.
10928 (Sized_relobj::include_section_group): Add new parameters. Change
10929 calls to Layout::add_comdat. Change to build table of kept comdat
10930 groups and table mapping discarded sections to kept sections.
10931 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10932 (Sized_relobj::do_layout): Change calls to include_section_group and
10933 include_linkonce_section.
10934 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10935 value to zero when section is discarded.
10936 (Sized_relobj::map_to_kept_section): New function.
10937 * object.h (Relobj::output_section_address): New function.
10938 (Relobj::Comdat_group): New type.
10939 (Relobj::find_comdat_group): New function.
10940 (Relobj::Comdat_group_table): New type.
10941 (Relobj::Kept_comdat_section): New type.
10942 (Relobj::Kept_comdat_section_table): New type.
10943 (Relobj::add_comdat_group): New function.
10944 (Relobj::set_kept_comdat_section): New function.
10945 (Relobj::get_kept_comdat_section): New function.
10946 (Relobj::comdat_groups_): New field.
10947 (Relobj::kept_comdat_sections_): New field.
10948 (Symbol_value::input_value): Update comment.
10949 (Sized_relobj::map_to_kept_section) New function.
10950 (Sized_relobj::include_linkonce_section): Add new parameter.
10951 * target-reloc.h (Comdat_behavior): New type.
10952 (get_comdat_behavior): New function.
10953 (relocate_section): Add code to map a discarded section to the
10954 corresponding kept section when applying a relocation.
10955
e4e5049b
CS
109562008-04-30 Craig Silverstein <csilvers@google.com>
10957
10958 * dwarf_reader.cc (next_generation_count): New static var.
10959 (Addr2line_cache_entry): New struct.
10960 (addr2line_cache): New static var.
10961 (Dwarf_line_info::one_addr2line): Added caching.
10962 (Dwarf_line_info::clear_addr2line_cache): New function.
10963 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10964 cache-size parameter.
10965 (Dwarf_line_info::one_addr2line_cache): New function.
10966 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10967 new cache-size argument to one_addr2line(), and clear cache.
10968
d09e9154
CC
109692008-04-28 Cary Coutant <ccoutant@google.com>
10970
10971 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10972 R_386_PC8 relocations.
10973
7ef73768
ILT
109742008-04-23 Ian Lance Taylor <iant@google.com>
10975
55438702
ILT
10976 * object.cc (Sized_relobj::include_section_group): Check for
10977 invalid section group.
10978
c165fb93
ILT
10979 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10980 header size.
10981
7ef73768
ILT
10982 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10983 than read for file header.
10984 * archive.cc (Archive::include_member): Likewise.
10985
6194aaab
L
109862008-04-23 Paolo Bonzini <bonzini@gnu.org>
10987
10988 * aclocal.m4: Regenerate.
10989 * configure: Regenerate.
10990
d491d34e
ILT
109912008-04-19 Ian Lance Taylor <iant@google.com>
10992
5ea2bac6
ILT
10993 * version.cc (version_string): Bump to 1.6.
10994
7bc3e21a
ILT
10995 * testsuite/Makefile.am (many_sections_r_test): New target.
10996 (many_sections_r_test_SOURCES): Remove.
10997 (many_sections_r_test_DEPENDENCIES): Remove.
10998 (many_sections_r_test_LDFLAGS): Remove.
10999 (many_sections_r_test_LDADD): Remove.
11000
7fcd3aa9
ILT
11001 * object.cc (Sized_relobj::do_add_symbols): Always pass
11002 local_symbol_count_ to add_from_relobj.
11003
4c94d6ae
ILT
11004 * testsuite/Makefile.am (many_sections_check.h): Only check one in
11005 every thousand variables.
11006 * testsuite/Makefile.in: Rebuild.
11007
d491d34e
ILT
11008 * object.cc (Xindex::initialize_symtab_xindex): New function.
11009 (Xindex::read_symtab_xindex): New function.
11010 (Xindex::sym_xindex_to_shndx): New function.
11011 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
11012 available.
11013 (Sized_relobj::do_initialize_xindex): New function.
11014 (Sized_relobj::do_read_symbols): Adjust section links.
11015 (Sized_relobj::symbol_section_and_value): Add is_ordinary
11016 parameter. Change all callers.
11017 (Sized_relobj::include_section_group): Adjust section links and
11018 symbol section indexes.
11019 (Sized_relobj::do_layout): Adjust section links.
11020 (Sized_relobj::do_count_local_symbols): Adjust section links and
11021 symbol section indexes.
11022 (Sized_relobj::do_finalize_local_symbols): Distinguish between
11023 ordinary and special symbols.
11024 (Sized_relobj::write_local_symbols): Add symtab_xindex and
11025 dynsym_xindex parameters. Change all callers. Adjust section
11026 links. Use SHN_XINDEX when needed.
11027 (Sized_relobj::get_symbol_location_info): Adjust section links.
11028 Don't get fooled by special symbols.
11029 * object.h (class Xindex): Define.
11030 (class Object): Add xindex_ parameter. Declare virtual functoin
11031 do_initialize_xindex.
11032 (Object::adjust_sym_shndx): New function.
11033 (Object::set_xindex): New protected function.
11034 (class Symbol_value): Add is_ordinary_shndx_ field.
11035 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
11036 (Symbol_value::value): Assert ordinary section.
11037 (Symbol_value::initialize_input_to_output_map): Likewise.
11038 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
11039 Change all callers.
11040 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
11041 all callers.
11042 (class Sized_relobj): Update declarations.
11043 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
11044 parameter. Change all callers.
11045 (Sized_relobj::adjust_shndx): New function.
11046 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
11047 field.
11048 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
11049 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
11050 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
11051 (Sized_dynobj::read_dynsym_section): Adjust section links.
11052 (Sized_dynobj::read_dynamic): Likewise.
11053 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
11054 section links.
11055 (Sized_dynobj::do_initialize_xindex): New function.
11056 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
11057 do_initialize_xindex.
11058 (Sized_dynobj::adjust_shndx): New function.
11059 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
11060 dynsym_xindex_ fields.
11061 (Layout::finalize): Add a call to set_section_indexes before
11062 creating the symtab sections.
11063 (Layout::set_section_indexes): Don't do anything if the section
11064 already has a section index.
11065 (Layout::create_symtab_sections): Add shnum parameter. Change
11066 caller. Create .symtab_shndx section if needed.
11067 (Layout::create_shdrs): Add shstrtab_section parameter. Change
11068 caller.
11069 (Layout::allocated_output_section_count): New function.
11070 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
11071 needed.
11072 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
11073 fields. Update declarations.
11074 (Layout::symtab_xindex): New function.
11075 (Layout::dynsym_xindex): New function.
11076 (class Write_symbols_task): Add layout_ field.
11077 (Write_symbols_task::Write_symbols_task): Add layout parameter.
11078 Change caller.
11079 * output.cc (Output_section_headers::Output_section_headers): Add
11080 shstrtab_section parameter. Change all callers.
11081 (Output_section_headers::do_sized_write): Store overflow values
11082 for section count and section string table section index in
11083 section header zero.
11084 (Output_file_header::do_sized_write): Check for overflow of
11085 section count and section string table section index.
11086 (Output_symtab_xindex::do_write): New function.
11087 (Output_symtab_xindex::endian_do_write): New function.
11088 * output.h (class Output_section_headers): Add shstrtab_section_.
11089 Update declarations.
11090 (class Output_symtab_xindex): Define.
11091 (Output_section::has_out_shndx): New function.
11092 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
11093 field.
11094 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
11095 Change all callers.
11096 (Sized_symbol::init): Likewise.
11097 (Symbol::output_section): Check for ordinary symbol.
11098 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
11099 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
11100 callers.
11101 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
11102 Change all callers. Simplify handling of symbols from sections
11103 not included in the link.
11104 (Symbol_table::add_from_dynobj): Handle ordinary symbol
11105 distinction.
11106 (Weak_alias_sorter::operator()): Assert that symbols are
11107 ordinary.
11108 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
11109 distinction.
11110 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
11111 parameters. Change all callers.
11112 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
11113 symbol distinction. Use SHN_XINDEX when needed.
11114 (Symbol_table::write_section_symbol): Add symtab_xindex
11115 parameter. Change all callers.
11116 (Symbol_table::sized_write_section_symbol): Likewise. Use
11117 SHN_XINDEX when needed.
11118 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
11119 declarations.
11120 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
11121 (Symbol::is_defined): Check is_ordinary.
11122 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
11123 (Symbol::is_absolute, Symbol::is_common): Likewise.
11124 (class Sized_symbol): Update declarations.
11125 (class Symbol_table): Update declarations.
11126 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
11127 parameters. Change all callers.
11128 (Sized_symbol::override): Likewise.
11129 (Symbol_table::override): Likewise.
11130 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
11131 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
11132 is_ordinary, and orig_st_shndx parameters. Change all callers.
11133 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
11134 to be in an ordinary section.
11135 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
11136 object and is_ordinary parameters. Change all callers.
11137 (Sized_dwarf_line_info::read_relocs): Add object parameter.
11138 Change all callers. Don't add undefined or non-ordinary symbols
11139 to reloc_map_.
11140 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
11141 Change all callers.
11142 * dwarf_reader.h (class Sized_dwarf_line_info): Update
11143 declarations.
11144 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
11145 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
11146 (Sized_relobj::relocate_sections): Likewise.
11147 * target-reloc.h (scan_relocs): Adjust section symbol index.
11148 (scan_relocatable_relocs): Likewise.
11149 * i386.cc (Scan::local): Check for ordinary symbols.
11150 * sparc.cc (Scan::local): Likewise.
11151 * x86_64.cc (Scan::local): Likewise.
11152 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
11153 to symbol_section_and_value.
11154 * testsuite/many_sections_test.cc: New file.
11155 * testsuite/Makefile.am (BUILT_SOURCES): Define.
11156 (check_PROGRAMS): Add many_sections_test.
11157 (many_sections_test_SOURCES): Define.
11158 (many_sections_test_DEPENDENCIES): Define.
11159 (many_sections_test_LDFLAGS): Define.
11160 (BUILT_SOURCES): Add many_sections_define.h.
11161 (many_sections_define.h): New target.
11162 (BUILT_SOURCES): Add many_sections_check.h.
11163 (many_sections_check.h): New target.
11164 (check_PROGRAMS): Add many_sections_r_test.
11165 (many_sections_r_test_SOURCES): Define.
11166 (many_sections_r_test_DEPENDENCIES): Define.
11167 (many_sections_r_test_LDFLAGS): Define.
11168 (many_sections_r_test_LDADD): Define.
11169 (many_sections_r_test.o): New target.
11170 * testsuite/Makefile.in: Rebuild.
11171
c5818ff1
CC
111722008-04-17 Cary Coutant <ccoutant@google.com>
11173
11174 * errors.cc (Errors::info): New function.
11175 (gold_info): New function.
11176 * errors.h (Errors::info): New function.
11177 * gold.h (gold_info): New function.
11178 * object.cc (Input_objects::add_object): Print trace output.
11179 * options.cc (options::parse_set): New function.
11180 (General_options::parse_wrap): Deleted.
11181 (General_options::General_options): Deleted initializer.
11182 * options.h (options::String_set): New typedef.
11183 (options::parse_set): New function.
11184 (DEFINE_set): New macro.
11185 (General_options::wrap): Changed to use DEFINE_set. Changed
11186 callers of any_wrap_symbols and is_wrap_symbol.
11187 (General_options::trace, General_options::trace_symbol):
11188 New options.
11189 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
11190 (General_options::wrap_symbols_): Deleted.
11191 * symtab.cc (Symbol_table::add_from_object): Print trace output.
11192
b5be4a7c
DM
111932008-04-17 David S. Miller <davem@davemloft.net>
11194
11195 * options.cc (General_options::parse_V): New function.
11196 * options.h: Add entries for -V and -Qy.
11197
155a0dd7
ILT
111982008-04-17 Ian Lance Taylor <iant@google.com>
11199
11200 * common.cc (Symbol_table::allocate_commons): Remove options
11201 parameter. Change caller.
11202 (Symbol_table::do_allocate_commons): Remove options parameter.
11203 Change caller. Just call do_allocate_commons_list twice.
11204 (Symbol_table::do_allocate_commons_list): New function, broken out
11205 of do_allocate_commons.
11206 * common.h (class Allocate_commons_task): Remove options_ field.
11207 Update constructor.
11208 * symtab.cc (Symbol_table::Symbol_table): Initialize
11209 tls_commons_.
11210 (Symbol_table::add_from_object): Put TLS common symbols on
11211 tls_commons_ list.
11212 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
11213 which are IN_OUTPUT_DATA.
11214 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
11215 allocate_commons and do_allocate_commons declarations. Declare
11216 do_allocate_commons_list.
11217 * gold.cc (queue_middle_tasks): Update creation of
11218 Allocate_commons_task to not pass options.
11219 * testsuite/Makefile.am (INCLUDES): Add -I.. .
11220 (TLS_TEST_C_FLAGS): New variable.
11221 (tls_test_c_pic.o): New target.
11222 (tls_test_shared.so): Link in tls_test_c_pic.o.
11223 (tls_test_c_pic_ie.o): New target.
11224 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
11225 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
11226 (tls_test_c.o): New target.
11227 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
11228 (tls_pic_test_LDADD): Likewise.
11229 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
11230 (tls_shared_gd_to_ie_test_LDADD): Likewise.
11231 (tls_test_c_gnu2.o): New target.
11232 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
11233 tls_test_c_gnu2.o.
11234 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
11235 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
11236 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
11237 * testsuite/tls_test.cc: Include "config.h".
11238 (t_last): Call t11_last.
11239 * testsuite/tls_test.h (t11, t11_last): Declare.
11240 * testsuite/tls_test_c.c: New file.
11241 * testsuite/tls_test_main.cc (thread_routine): Call t11.
11242 * configure.ac: Check for OpenMP support.
11243 * configure, config.in, Makefile.in: Rebuild.
11244 * testsuite/Makefile.in: Rebuild.
11245
edfbb029
CC
112462008-04-16 Cary Coutant <ccoutant@google.com>
11247
11248 * i386.cc (Target_i386::define_tls_base_symbol): New function.
11249 (Target_i386::tls_base_symbol_defined_): New field.
11250 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11251 (Target_i386::Scan::global): Likewise.
11252 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
11253 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
11254 (Target_x86_64::tls_base_symbol_defined_): New field.
11255 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
11256 (Target_x86_64::Scan::global): Likewise.
11257
f3c69fca
CC
112582008-04-16 Cary Coutant <ccoutant@google.com>
11259
11260 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
11261 (Symbol::needs_plt_entry): Allow weak undefined symbols.
11262 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
11263 building shared libraries.
11264 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
11265 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
11266 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
11267 * testsuite/Makefile.in: Rebuild.
11268 * testsuite/weak_undef.h: New file.
11269 * testsuite/weak_undef_file1.cc: Add extra test cases.
11270 * testsuite/weak_undef_file2.cc: Likewise.
11271 * testsuite/weak_undef_test.cc: Likewise.
11272
7c414435
DM
112732008-04-16 David S. Miller <davem@davemloft.net>
11274
32b769e1
DM
11275 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11276 Add issued_non_pic_error_ field. Declare check_non_pic.
11277 (Target_sparc::Scan::check_non_pic): New function.
11278 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11279 (Target_sparc::Scan::global): Likewise.
11280
11936fb1
DM
11281 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11282 * configure: Rebuild.
11283
7c414435
DM
11284 * options.h (DEFINE_enable): New macro.
11285 (new_dtags): New enable option.
11286 (initfirst, interpose, loadfltr, nodefaultlib,
11287 nodelete, nodlopen, nodump): New -z options.
11288 * layout.cc (Layout:finish_dynamic_section): If new
11289 dtags enabled, emit DT_RUNPATH. Also, emit a
11290 DT_FLAGS_1 containing any specified -z flags.
11291
85c7bf8b
ILT
112922008-04-16 Ian Lance Taylor <iant@google.com>
11293
12c0daef
ILT
11294 * copy-relocs.cc: New file.
11295 * copy-relocs.h: New file.
11296 * reloc.cc: Remove Copy_relocs code.
11297 * reloc.h: Likewise.
11298 * reloc-types.h (struct Reloc_types) [both versions]: Add
11299 get_reloc_addend_noerror.
11300 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11301 variants of add_global which take an addend which must be zero.
11302 * i386.cc: Include "copy-relocs.h".
11303 (class Target_i386): Change type of copy_relocs_ to variable,
11304 update initializer.
11305 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11306 Change all callers.
11307 (Target_i386::do_finalize_sections): Change handling of
11308 copy_relocs_.
11309 * sparc.cc: Include "copy-relocs.h".
11310 (class Target_sparc): Change type of copy_relocs_ to variable,
11311 update initializer.
11312 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11313 Change all callers.
11314 (Target_sparc::do_finalize_sections): Change handling of
11315 copy_relocs_.
11316 * x86_64.cc: Include "copy-relocs.h".
11317 (class Target_x86_64): Change type of copy_relocs_ to variable,
11318 update initializer.
11319 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11320 class. Change all callers.
11321 (Target_x86_64::do_finalize_sections): Change handling of
11322 copy_relocs_.
11323 * Makefile.am (CCFILES): Add copy-relocs.cc.
11324 (HFILES): Add copy-relocs.h.
11325
4f4995b6
ILT
11326 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11327
85c7bf8b
ILT
11328 * testsuite/script_test_4.sh: Permit leading zeroes.
11329
4f2a9edd
ILT
113302008-04-15 Ian Lance Taylor <iant@google.com>
11331
e6188289
ILT
11332 * script-sections.cc (Script_sections::create_segments): Use
11333 header_size_adjustment even when there is enough room for the
11334 headers.
11335 * testsuite/script_test_4.sh: New file.
11336 * testsuite/script_test_4.t: New file.
11337 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11338 (check_DATA): Add script_test_4.stdout.
11339 (MOSTLYCLEANFILES): Likewise.
11340 (script_test_4): New target.
11341 (script_test_4.stdout): New target.
11342 * testsuite/Makefile.in: Rebuild.
11343
4f2a9edd
ILT
11344 * sparc.cc: Add definitions for Output_data_plt_sparc class
11345 constants.
11346
f5314dd5
DM
113472008-04-14 David S. Miller <davem@davemloft.net>
11348
11349 * sparc.cc: New file.
11350 * Makefile.am (TARGETSOURCES): Add sparc.cc
11351 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11352 * configure.tgt: Document targ_extra_size and
11353 targ_extra_big_endian. Add entries for sparc-* and
11354 sparc64-*.
11355 * configure.ac: Handle targ_extra_size and
11356 targ_extra_big_endian.
11357 * Makefile.in: Rebuild.
11358 * configure: Likewise.
11359 * po/POTFILES.in: Likewise.
11360 * po/gold.pot: Likewise.
11361
154e0e9a
ILT
113622008-04-14 Ian Lance Taylor <iant@google.com>
11363
11364 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11365 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11366 in the name/type/flags to section mapping. Don't call
11367 allocate_output_section.
11368 (Layout::choose_output_section): Change parameter from adjust_name
11369 to is_input_section. Don't permit input sections after sections
11370 are attached to segments. Don't call allocate_output_section.
11371 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11372 not write_enable_output_section.
11373 (Layout::make_output_section): Don't push to
11374 unattached_section_list_ nor call attach_to_segment. Call
11375 attach_section_to_segment if sections are attached.
11376 (Layout::attach_sections_to_segments): New function.
11377 (Layout::attach_section_to_segment): New function.
11378 (Layout::attach_allocated_section_to_segment): Rename from
11379 attach_to_segment. Remove flags parameter.
11380 (Layout::allocate_output_section): Remove function.
11381 (Layout::write_enable_output_section): Remove function.
11382 * layout.h (class Layout): Update for above changes. Add new
11383 field sections_are_attached_.
11384 * output.h (Output_section::update_flags_for_input_section): New
11385 function.
11386 * output.cc (Output_section::add_input_section): Call
11387 update_flags_for_input_section.
11388 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11389
009a67a2
CC
113902008-04-11 Cary Coutant <ccoutant@google.com>
11391
11392 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11393 thought unnecessary.
11394 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11395
759b1a24
ILT
113962008-04-11 Ian Lance Taylor <iant@google.com>
11397
11398 * output.h (class Output_section_data): Remove inline definition
11399 of set_addralign.
11400 * output.cc (Output_section_data::set_addralign): New function.
11401
c2b45e22
CC
114022008-04-11 Cary Coutant <ccoutant@google.com>
11403
11404 Add support for TLS descriptors for i386 and x86_64.
11405 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11406 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11407 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11408 GOT_TYPE_TLS_DESC.
11409 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11410 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11411 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11412 relocations.
11413 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11414 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11415 Fix problem with initial-exec relocations.
11416 (Target_i386::Relocate::relocate_tls): Likewise.
11417 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11418 relaxation.
11419 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11420 support for section-plus-offset dynamic table entries.
11421 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11422 (Output_data_dynamic::Dynamic_entry): Add support for
11423 section-plus-offset dynamic table entries.
11424 (Output_data_dynamic::Classification): Likewise.
11425 (Output_data_dynamic::classification_): Renamed offset_.
11426 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11427 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11428 (Target_x86_64::make_plt_section): New function.
11429 (Target_x86_64::reserve_tlsdesc_entries): New function.
11430 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11431 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11432 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11433 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11434 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11435 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11436 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11437 add extra PLT entry for TLS descriptors.
11438 (Output_data_plt_x86_64::got_): New field.
11439 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11440 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11441 fields.
11442 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11443 descriptors.
11444 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11445 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11446 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11447 R_386_TLS_DESC_CALL relocations.
11448 (Target_x86_64::Scan::global): Likewise.
11449 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11450 for TLS descriptors.
11451 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11452 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11453 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11454 GD-to-IE relaxation.
11455 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11456 and TLS_DESCRIPTORS.
11457 * Makefile.in: Rebuild.
11458 * configure: Rebuild.
11459 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11460 (tls_test_shared2.so): New target.
11461 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11462 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11463 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11464 (tls_shared_gd_to_ie_test_LDADD): New variable.
11465 (tls_shared_gnu2_gd_to_ie_test): New target.
11466 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11467 New targets.
11468 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11469 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11470 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11471 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11472 (tls_shared_gnu2_test): New target.
11473 (tls_test_gnu2_shared.so): New target.
11474 (tls_shared_gnu2_test_SOURCES): New variable.
11475 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11476 (tls_shared_gnu2_test_LDFLAGS): New variable.
11477 (tls_shared_gnu2_test_LDADD): New variable.
11478 * testsuite/Makefile.in: Rebuild.
11479 * testsuite/Makefile.
11480
83bfb6b7
ILT
114812008-04-11 Ian Lance Taylor <iant@google.com>
11482
11483 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11484 justsyms.t.
11485 * testsuite/Makefile.in: Rebuild.
11486
11487 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11488 long.
11489 * testsuite/script_test_2.cc (main): Adjust test.
11490
706e1f5e
ILT
114912008-04-11 David S. Miller <davem@davemloft.net>
11492 Ian Lance Taylor <iant@google.com>
11493
11494 * options.h (General_options): Add entries for '-Y' and
11495 '-relax'.
11496 * options.cc (General_options:finalize): If -Y was used, add those
11497 entries to the library path instead of the default "/lib" and
11498 "/usr/lib".
11499
7c98e6bb
DM
115002008-04-11 David S. Miller <davem@davemloft.net>
11501
11502 * testsuite/justsyms.t: Start at 0x100.
11503 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
11504 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11505 long.
11506 * testsuite/script_test_2.cc: Adjust string and section length
11507 checks.
7c98e6bb 11508
99a37bfd
ILT
115092008-04-09 Ian Lance Taylor <iant@google.com>
11510
2cefc357
ILT
11511 PR gold/5996
11512 * script-sections.cc (Sections_element::allocate_to_segment): Add
11513 orphan parameter.
11514 (Output_section_definition::allocate_to_segment): Likewise.
11515 (Orphan_output_section::allocate_to_segment): Likewise.
11516 (Script_sections::attach_sections_using_phdrs_clause): Don't
11517 propagate non-PT_LOAD segments to orphan sections.
11518 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11519 readelf rather than objdump.
11520 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11521 .interp section and PT_INTERP segment are the same size.
11522 * testsuite/Makefile.in: Rebuild.
11523
99a37bfd
ILT
11524 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11525 aliases for symbols defined in the same object.
11526 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11527 (weak_alias_test_SOURCES): New variable.
11528 (weak_alias_test_DEPENDENCIES): New variable.
11529 (weak_alias_test_LDFLAGS): New variable.
11530 (weak_alias_test_LDADD): New variable.
11531 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11532 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11533 (weak_alias_test_3.o): New target.
11534 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11535 * testsuite/weak_alias_test_main.cc: New file.
11536 * testsuite/weak_alias_test_1.cc: New file.
11537 * testsuite/weak_alias_test_2.cc: New file.
11538 * testsuite/weak_alias_test_3.cc: New file.
11539
780e49c5
ILT
115402008-04-08 Ian Lance Taylor <iant@google.com>
11541
cdb0b8f5
ILT
11542 * options.h (class General_options): Add --noinhibit-exec option.
11543 * main.cc (main): Check --noinhibit-exec.
11544
0864d551
ILT
11545 * options.h (class General_options): Define --wrap as a special
11546 option. Add wrap_symbols_ field.
11547 (General_options::any_wrap_symbols): New function.
11548 (General_options::is_wrap_symbol): New function.
11549 * options.cc (General_options::parse_wrap): New function.
11550 (General_options::General_options): Initialize wrap_symbols_.
11551 * symtab.cc (Symbol_table::wrap_symbol): New function.
11552 (Symbol_table::add_from_object): Handle --wrap.
11553 * symtab.h (class Symbol_table): Declare wrap_symbol.
11554 * target.h (Target::wrap_char): New function.
11555 (Target::Target_info): Add wrap_char field.
11556 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11557 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11558 * testsuite/testfile.cc (Target_test::test_target_info):
11559 Likewise.
11560
789aa6de
ILT
11561 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11562 there is one.
11563
2c38906f
ILT
11564 * layout.h (class Layout): Add added_eh_frame_data_ field.
11565 * layout.cc (Layout::Layout): Initialize new field.
11566 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11567 output section until we find a section we merged successfully.
11568 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11569 that the size be non-zero.
11570
780e49c5
ILT
11571 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11572 qualifier.
11573
7fcd0256
ILT
115742008-04-08 Craig Silverstein <csilvers@google.com>
11575
11576 * configure.ac: Export new conditional variable HAVE_ZLIB.
11577 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11578 on HAVE_ZLIB.
11579 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11580 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11581
6835af53
ILT
115822008-04-07 Ian Lance Taylor <iant@google.com>
11583
e24f324c
ILT
11584 * version.cc (version_string): Set to "1.5".
11585
a036edd8
ILT
11586 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11587 Add issued_non_pic_error_ field. Declare check_non_pic.
11588 (Target_x86_64::Scan::check_non_pic): New function.
11589 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11590 (Target_x86_64::Scan::global): Likewise.
11591
624f8810
ILT
11592 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11593 addend parameter. Change caller. Handle merge sections.
11594 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11595 Address to Addend. Don't add in the result of
11596 local_section_offset, pass down the addend and use the returned
11597 value.
11598 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11599 Update declarations of local_section_offset and symbol_value.
11600 * testsuite/two_file_test_1.cc (t18): New function.
11601 * testsuite/two_file_test_2.cc (f18): New function.
11602 * testsuite/two_file_test_main.cc (main): Call t18.
11603 * testsuite/two_file_test.h (t18, f18): Declare.
11604
6835af53
ILT
11605 * configure.ac: Don't test for objdump, c++filt, or readelf.
11606 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11607 conditionals.
11608 (TEST_READELF): New variable.
11609 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11610 (check_PROGRAMS): Add two_file_strip_test.
11611 (two_file_strip_test): New target.
11612 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11613 (two_file_same_shared_strip_test_SOURCES): New variable.
11614 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11615 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11616 (two_file_same_shared_strip_test_LDADD): New variable.
11617 (two_file_shared_strip.so): New target.
11618 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11619 (ver_test_5.syms, ver_test_7.syms): Likewise.
11620 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11621 (strip_test_3.stdout): Use TEST_OBJDUMP.
11622 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11623
86925eef
CC
116242008-04-04 Cary Coutant <ccoutant@google.com>
11625
11626 * symtab.h (Symbol::is_weak_undefined): New function.
11627 (Symbol::is_strong_undefined): New function.
11628 (Symbol::is_absolute): New function.
11629 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11630 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11631 absolute symbols.
11632 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11633 (weak_undef_test): New target.
11634 * testsuite/Makefile.in: Rebuild.
11635 * testsuite/weak_undef_file1.cc: New file.
11636 * testsuite/weak_undef_file2.cc: New file.
11637 * testsuite/weak_undef_test.cc: New file.
11638
126f3ece
ILT
116392008-04-03 Craig Silverstein <csilvers@google.com>
11640
11641 * compressed_output.h (class Output_compressed_section): Use
11642 unsigned buffer.
11643 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11644 add zlib header.
11645 (zlib_compressed_suffix): Removed.
11646 (Output_compressed_section::set_final_data_size): Use unsigned
11647 buffers.
11648 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11649 Fix linker invocation.
11650 (flagstest_o_specialfile_and_compress_debug_sections):
11651 Likewise.
11652 * testsuite/Makefile.in: Regenerated.
11653
deae2a14
DM
116542008-04-02 David S. Miller <davem@davemloft.net>
11655
11656 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11657 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11658
70752818
ILT
116592008-04-02 Craig Silverstein <csilvers@google.com>
11660
11661 * TODO: New file.
11662
39d0cb0e
ILT
116632008-04-02 Ian Lance Taylor <iant@google.com>
11664
11665 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11666 parameters. Update for new key type to views_. Change all
11667 callers.
11668 (File_read::read): Adjust for byteshift in returned view.
11669 (File_read::add_view): New function, broken out of
11670 find_and_make_view.
11671 (File_read::make_view): New function, broken out of
11672 find_and_make_view.
11673 (File_read::find_or_make_view): Add offset and aligned
11674 parameters. Rewrite accordingly. Change all callers.
11675 (File_read::get_view): Add offset and aligned parameters. Adjust
11676 for byteshift in return value.
11677 (File_read::get_lasting_view): Likewise.
11678 * fileread.h (class File_read): Update declarations.
11679 (class File_read::View): Add byteshift_ field. Add byteshift to
11680 constructor. Add byteshift method.
11681 * archive.h (Archive::clear_uncached_views): New function.
11682 (Archive::get_view): Add aligned parameter. Change all callers.
11683 * object.h (Object::get_view): Add aligned parameter. Change all
11684 callers.
11685 (Object::get_lasting_view): Likewise.
11686
11687 * fileread.cc (File_read::release): Don't call clear_views if
11688 there are multiple objects.
11689 * fileread.h (File_read::clear_uncached_views): New function.
11690 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11691 on the archive.
11692
a1207466
CC
116932008-03-31 Cary Coutant <ccoutant@google.com>
11694
11695 Add thin archive support.
11696 * archive.cc (Archive::armagt): New const.
11697 (Archive::setup): Remove task parameter and calls to unlock.
11698 (Archive::unlock_nested_archives): New function.
11699 (Archive::read_header): Add nested_off parameter. Change
11700 all callers.
11701 (Archive::interpret_header): Likewise.
11702 (Archive::include_all_members): Change to handle thin
11703 archives.
11704 (Archive::include_member): Likewise.
11705 * archive.h (Archive::Archive): Add new parameters and
11706 initializers.
11707 (Archive::armagt): New const.
11708 (Archive::setup): Remove task parameter.
11709 (Archive::unlock_nested_archives): New function.
11710 (Archive::read_header): Add nested_off parameter.
11711 (Archive::interpret_header): Likewise.
11712 (Archive::Nested_archive_table): New typedef.
11713 (Archive::is_thin_archive_): New field.
11714 (Archive::nested_archives_): New field.
11715 (Archive::options_): New field.
11716 (Archive::dirpath_): New field.
11717 (Archive::task_): New field.
11718 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11719 for thin archives. Pass additional parameters to
11720 Archive::Archive. Unlock the archive file after calling
11721 Archive::setup.
cd536b21 11722
479f6503
ILT
117232008-03-29 Ian Lance Taylor <iant@google.com>
11724
686c8caf
ILT
11725 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11726 version symbol to be local.
11727 * testsuite/ver_test_4.sh: New file.
11728 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11729 (check_DATA): Add ver_test_4.syms.
11730 (ver_test_4.syms): New target.
11731 * testsuite/Makefile.in: Rebuild.
11732
ab794b6b
ILT
11733 * output.cc
11734 (Output_section::Input_section_sort_entry::has_priority): New
11735 function.
11736 (Output_section::Input_section_sort_entry::match_file_name): New
11737 function.
11738 (Output_section::Input_section_sort_entry::match_section_name):
11739 Remove.
11740 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11741 Remove.
11742 (Output_section::Input_section_sort_entry::match_section_file):
11743 Remove.
11744 (Output_section::Input_section_sort_compare::operator()): Rewrite
11745 using new Input_section_sort_entry functions. Sort crtbegin and
11746 crtend first. Sort sections with no priority before sections with
11747 a priority.
11748 * testsuite/initpri1.c (d3): Check j != 4.
11749 (cd5): New constructor/destructor function.
11750 (main): Check j != 2.
11751
479f6503
ILT
11752 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11753 new symbol when resolving, don't call set_is_default.
11754 * testsuite/ver_test_7.cc: New file.
11755 * testsuite/ver_test_7.sh: New file.
11756 * testsuite/Makefile.am (ver_test_7.so): New target.
11757 (ver_test_7.o): New target.
11758 (check_SCRIPTS): Add ver_test_7.sh.
11759 (check_DATA): Add ver_test_7.syms.
11760 (ver_test_7.syms): New target.
11761
2fd32231
ILT
117622008-03-28 Ian Lance Taylor <iant@google.com>
11763
11764 * layout.cc (Layout::layout): If we see an input section with a
11765 name that needs sorting, set the must_sort flag for the output
11766 section.
11767 (Layout::make_output_section): If the name of the output section
11768 indicates that it might require sorting, set the may_sort flag.
11769 * output.h (Output_section::may_sort_attached_input_sections): New
11770 function.
11771 (Output_section::set_may_sort_attached_input_sections): New
11772 function.
11773 (Output_section::must_sort_attached_input_sections): New
11774 function.
11775 (Output_section::set_must_sort_attached_input_sections): New
11776 function.
11777 (class Output_section): Declare Input_section_sort_entry. Define
11778 Input_section_sort_compare. Declare
11779 sort_attached_input_sections. Add new fields:
11780 may_sort_attached_input_sections_,
11781 must_sort_attached_input_sections_,
11782 attached_input_sections_are_sorted_.
11783 * output.cc (Output_section::Output_section): Initialize new
11784 fields.
11785 (Output_section::add_input_section): Add an entry to
11786 input_sections_ if may_sort or must_sort are true.
11787 (Output_section::set_final_data_size): Call
11788 sort_attached_input_sections if necessary.
11789 (Output_section::Input_section_sort_entry): Define new class.
11790 (Output_section::Input_section_sort_compare::operator()): New
11791 function.
11792 (Output_section::sort_attached_input_sections): New function.
11793 * configure.ac: Check whether the compiler supports constructor
11794 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11795 * testsuite/initpri1.c: New file.
11796 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11797 CONSTRUCTOR_PRIORITY.
11798 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11799 (initpri1_LDFLAGS): New variable.
11800 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11801
18e6b24e
ILT
118022008-03-27 Ian Lance Taylor <iant@google.com>
11803
49bdd526
ILT
11804 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11805 * testsuite/common_test_1.c: New file.
11806 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11807 (common_test_1_SOURCES): New variable.
11808 (common_test_1_DEPENDENCIES): New variable.
11809 (common_test_1_LDFLAGS): New variable.
11810
18e6b24e
ILT
11811 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11812 and commons_ correctly when NAME/VERSION does not override
11813 NAME/NULL.
11814 * testsuite/ver_test_6.c: New file.
11815 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11816 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11817 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11818
04bf7072
ILT
118192008-03-26 Ian Lance Taylor <iant@google.com>
11820
5871526f
ILT
11821 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11822 of an undefined symbol from a version script.
11823 * testsuite/Makefile.am (ver_test_5.so): New target.
11824 (ver_test_5.o): New target.
11825 (check_SCRIPTS): Add ver_test_5.sh.
11826 (check_DATA): Add ver_test_5.syms.
11827 (ver_test_5.syms): New target.
11828 * testsuite/ver_test_5.cc: New file.
11829 * testsuite/ver_test_5.script: New file.
11830 * testsuite/ver_test_5.sh: New file.
11831 * Makefile.in, testsuite/Makefile.in: Rebuild.
11832
04bf7072
ILT
11833 PR gold/5986
11834 Fix problems building gold with gcc 4.3.0.
11835 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11836 (gold_error_at_location, gold_warning_at_location): Use it.
11837 * configure.ac: Check whether we can compile and use a template
11838 function with a printf attribute.
11839 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11840 when jumping over bytes.
11841 * object.cc: Instantiate Object::read_section_data.
11842 * debug.h: Include <cstring>
11843 * dwarf_reader.cc: Include <algorithm>
11844 * main.cc: Include <cstring>.
11845 * options.cc: Include <cstring>.
11846 * output.cc: Include <cstring>.
11847 * script.cc: Include <cstring>.
11848 * script.h: Include <string>.
11849 * symtab.cc: Include <cstring> and <algorithm>.
11850 * target-select.cc: Include <cstring>.
11851 * version.cc: Include <string>.
11852 * testsuite/testmain.cc: Include <cstdlib>.
11853 * configure, config.in: Rebuild.
11854
874c5b28
ILT
118552008-03-25 Ian Lance Taylor <iant@google.com>
11856
819d6c3a
ILT
11857 * options.cc: Include "../bfd/bfdver.h".
11858 (options::help): Print bug reporting address.
11859
f4b2c6f5
ILT
11860 * version.cc (print_version): Adjust output for current value of
11861 BFD_VERSION_STRING.
11862
11863 * NEWS: New file.
11864
e96caa79
ILT
11865 * options.cc (options::help): Print list of supported targets.
11866 * target-select.h: Include <vector>.
11867 (class Target_selector): Make machine_, size_, and is_big_endian_
11868 fields const. Add bfd_name_ and instantiated_target_ fields.
11869 (Target_selector::Target_selector): Add bfd_name parameter.
11870 (Target_selector::recognize): Make non-virtual, call
11871 do_recognize.
11872 (Target_selector::recognize_by_name): Make non-virtual, call
11873 do_recognize_by_name.
11874 (Target_selector::supported_names): New function.
11875 (Target_selector::bfd_name): New function.
11876 (Target_selector::do_instantiate_target): New pure virtual
11877 function.
11878 (Target_selector::do_recognize): New virtual function.
11879 (Target_selector::do_recognize_by_name): New virtual function.
11880 (Target_selector::instantiate_target): New private function.
11881 (supported_target_names): Declare.
11882 * target-select.cc (Target_selector::Target_selector): Update for
11883 new parameter and fields.
11884 (select_target_by_name): Check that the name matches before
11885 calling recognize_by_name.
11886 (supported_target_names): New function.
11887 * i386.cc (class Target_selector_i386): Update Target_selector
11888 constructor call. Remove recognize and recognize_by_name. Add
11889 do_instantiate_target.
11890 * x86_64.cc (class Target_selector_x86_64): Likewise.
11891 * testsuite/testfile.cc (class Target_selector_test): Update for
11892 changes to Target_selector.
11893
874c5b28
ILT
11894 * README: Rewrite, with some notes on unsupported features.
11895
0a65a3a7
CC
118962008-03-24 Cary Coutant <ccoutant@google.com>
11897
11898 * i386.cc (Target_i386::Got_type): New enum declaration.
11899 (Target_i386::Scan::local): Updated callers of Output_data_got
11900 member functions.
11901 (Target_i386::Scan::global): Likewise.
11902 (Target_i386::Relocate::relocate): Likewise.
11903 (Target_i386::Relocate::relocate_tls): Likewise.
11904 * object.h (Got_offset_list): New class.
11905 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11906 (Sized_relobj::local_got_offset): Likewise.
11907 (Sized_relobj::set_local_got_offset): Likewise.
11908 (Sized_relobj::local_has_tls_got_offset): Removed.
11909 (Sized_relobj::local_tls_got_offset): Removed.
11910 (Sized_relobj::set_local_tls_got_offset): Removed.
11911 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11912 * output.cc (Output_data_got::add_global): Added got_type parameter.
11913 (Output_data_got::add_global_with_rel): Likewise.
11914 (Output_data_got::add_global_with_rela): Likewise.
11915 (Output_data_got::add_global_pair_with_rel): New function.
11916 (Output_data_got::add_global_pair_with_rela): New function.
11917 (Output_data_got::add_local): Added got_type parameter.
11918 (Output_data_got::add_local_with_rel): Likewise.
11919 (Output_data_got::add_local_with_rela): Likewise.
11920 (Output_data_got::add_local_pair_with_rel): New function.
11921 (Output_data_got::add_local_pair_with_rela): New function.
11922 (Output_data_got::add_global_tls): Removed.
11923 (Output_data_got::add_global_tls_with_rel): Removed.
11924 (Output_data_got::add_global_tls_with_rela): Removed.
11925 (Output_data_got::add_local_tls): Removed.
11926 (Output_data_got::add_local_tls_with_rel): Removed.
11927 (Output_data_got::add_local_tls_with_rela): Removed.
11928 * output.h (Output_data_got::add_global): Added got_type parameter.
11929 (Output_data_got::add_global_with_rel): Likewise.
11930 (Output_data_got::add_global_with_rela): Likewise.
11931 (Output_data_got::add_global_pair_with_rel): New function.
11932 (Output_data_got::add_global_pair_with_rela): New function.
11933 (Output_data_got::add_local): Added got_type parameter.
11934 (Output_data_got::add_local_with_rel): Likewise.
11935 (Output_data_got::add_local_with_rela): Likewise.
11936 (Output_data_got::add_local_pair_with_rel): New function.
11937 (Output_data_got::add_local_pair_with_rela): New function.
11938 (Output_data_got::add_global_tls): Removed.
11939 (Output_data_got::add_global_tls_with_rel): Removed.
11940 (Output_data_got::add_global_tls_with_rela): Removed.
11941 (Output_data_got::add_local_tls): Removed.
11942 (Output_data_got::add_local_tls_with_rel): Removed.
11943 (Output_data_got::add_local_tls_with_rela): Removed.
11944 * resolve.cc (Symbol::override_base_with_special): Removed
11945 reference to has_got_offset_ field.
11946 * symtab.cc (Symbol::init_fields): Replaced initialization
11947 of got_offset_ with got_offsets_. Removed initialization
11948 of has_got_offset_
53fcba31 11949 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
11950 (Symbol::got_offset): Likewise.
11951 (Symbol::set_got_offset): Likewise.
11952 (Symbol::has_tls_got_offset): Removed.
11953 (Symbol::tls_got_offset): Removed.
11954 (Symbol::set_tls_got_offset): Removed.
11955 (Symbol::got_offset_): Removed.
11956 (Symbol::tls_mod_got_offset_): Removed.
11957 (Symbol::tls_pair_got_offset_): Removed.
11958 (Symbol::got_offsets_): New field.
11959 (Symbol::has_got_offset): Removed.
11960 (Symbol::has_tls_mod_got_offset): Removed.
11961 (Symbol::has_tls_pair_got_offset): Removed.
11962 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11963 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11964 member functions.
11965 (Target_x86_64::Scan::global): Likewise.
11966 (Target_x86_64::Relocate::relocate): Likewise.
11967 (Target_x86_64::Relocate::relocate_tls): Likewise.
11968
bd52eafb
BE
119692008-03-25 Ben Elliston <bje@au.ibm.com>
11970
11971 * yyscript.y: Fix spelling error in comment.
11972
8b105e34
ILT
119732008-03-24 Ian Lance Taylor <iant@google.com>
11974
8ed814a9
ILT
11975 * options.h (class General_options): Define build_id option.
11976 * layout.h (class Layout): Declare write_build_id, create_note,
11977 create_build_id. Add build_id_note_ member.
11978 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11979 "libiberty.h", "md5.h", "sha1.h".
11980 (Layout::Layout): Initialize eh_frame_data_,
11981 eh_frame_hdr_section_, and build_id_note_.
11982 (Layout::finalize): Call create_build_id.
11983 (Layout::create_note): New function, broken out of
11984 Layout::create_gold_note.
11985 (Layout::create_gold_note): Call create_note.
11986 (Layout::create_build_id): New function.
11987 (Layout::write_build_id): New function.
11988 (Close_task_runner::run): Call write_build_id.
11989
8b105e34
ILT
11990 * x86_64.cc: Correct license to GPLv3.
11991
086a1841
ILT
119922008-03-23 Ian Lance Taylor <iant@google.com>
11993
11994 * options.cc: Include "demangle.h".
11995 (parse_optional_string): New function.
11996 (parse_long_option): Handle takes_optional_argument.
11997 (parse_short_option): Update dash_z initializer. Handle
11998 takes_optional_argument.
11999 (General_options::General_options): Initialize do_demangle_.
12000 (General_options::finalize): Set do_demangle_. Handle demangling
12001 style.
12002 * options.h (parse_optional_string): Declare.
12003 (struct One_option): Add optional_arg field. Update constructor.
12004 Update call constructor calls. Add takes_optional_argument
12005 function.
12006 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
12007 (DEFINE_optional_string): Define.
12008 (General_options::demangle): Change from DEFINE_bool to
12009 DEFINE_optional_string.
12010 (General_options::no_demangle): New function.
12011 (General_options::do_demangle): New function.
12012 (General_options::set_do_demangle): New function.
12013 (General_options::execstack_status_): Move definition to end of
12014 class definition.
12015 (General_options::static_): Likewise.
12016 (General_options::do_demangle_): New field.
12017 * object.cc (big_endian>::get_symbol_location_info): Call
12018 Options::do_demangle, not Options::demangle.
12019 * symtab.cc (demangle): Likewise.
12020
cbb93e63
ILT
120212008-03-22 Ian Lance Taylor <iant@google.com>
12022
12023 * gold.h: Include <cstddef> and <sys/types.h>
12024 * options.h: Include <cstring>.
12025
ec531623
ILT
120262008-03-21 Ian Lance Taylor <iant@google.com>
12027
12028 * Added source code to GNU binutils.
This page took 0.680899 seconds and 4 git commands to generate.