PR gold/12386
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2011-07-08 Ian Lance Taylor <iant@google.com>
2
3 PR gold/12386
4 * options.h (class General_options): Add --unresolved-symbols.
5 * target-reloc.h (issue_undefined_symbol_error): Check
6 --unresolved-symbols. Add comments.
7
8 2011-07-08 Ian Lance Taylor <iant@google.com>
9
10 * testsuite/odr_violation2.cc (Ordering::operator()): Make
11 expression more complex.
12
13 2011-07-08 Ian Lance Taylor <iant@google.com>
14
15 PR gold/11317
16 * target-reloc.h (issue_undefined_symbol_error): New inline
17 function, broken out of relocate_section.
18 (relocate_section): Call issue_undefined_symbol_error.
19 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
20 there is no TLS segment if we are about to issue an undefined
21 symbol error.
22 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
23
24 2011-07-08 Ian Lance Taylor <iant@google.com>
25
26 PR gold/12279
27 * resolve.cc (Symbol_table::should_override): Add fromtype
28 parameter. Change all callers. Give error when linking together
29 TLS and non-TLS symbol.
30 (Symbol_table::should_override_with_special): Add fromtype
31 parameter. Change all callers.
32 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
33 there is no TLS segment if we have reported some errors.
34 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
35
36 2011-07-08 Ian Lance Taylor <iant@google.com>
37
38 PR gold/12372
39 * target.h (Target::plt_address_for_global): New function.
40 (Target::plt_address_for_local): New function.
41 (Target::plt_section_for_global): Remove.
42 (Target::plt_section_for_local): Remove.
43 (Target::do_plt_address_for_global): New virtual function.
44 (Target::do_plt_address_for_local): New virtual function.
45 (Target::do_plt_section_for_global): Remove.
46 (Target::do_plt_section_for_local): Remove.
47 (Target::register_global_plt_entry): Add Symbol_table and Layout
48 parameters.
49 * output.cc (Output_data_got::Got_entry::write): Use
50 plt_address_for_global and plt_address_for_local.
51 * layout.cc (Layout::add_target_dynamic_tags): Use size and
52 address of output section.
53 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
54 got_irelative_, and irelative_count_ fields. Update
55 declarations.
56 (Output_data_plt_i386::has_irelative_section): New function.
57 (Output_data_plt_i386::entry_count): Add irelative_count_.
58 (Output_data_plt_i386::set_final_data_size): Likewise.
59 (class Target_i386): Add got_irelative_ and rel_irelative_
60 fields. Update declarations.
61 (Target_i386::Target_i386): Initialize new fields.
62 (Target_i386::do_plt_address_for_global): New function replacing
63 do_plt_section_for_global.
64 (Target_i386::do_plt_address_for_local): New function replacing
65 do_plt_section_for_local.
66 (Target_i386::got_section): Create got_irelative_.
67 (Target_i386::rel_irelative_section): New function.
68 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
69 fields. Don't define __rel_iplt_{start,end}.
70 (Output_data_plt_i386::add_entry): Add symtab and layout
71 parameters. Change all callers. Use different PLT and GOT for
72 IFUNC symbols.
73 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
74 layout parameters. Change all callers. Use different PLT and
75 GOT.
76 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
77 (Output_data_plt_i386::rel_irelative): New function.
78 (Output_data_plt_i386::address_for_global): New function.
79 (Output_data_plt_i386::address_for_local): New function.
80 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
81 IRELATIVE GOT when changing IFUNC GOT entries.
82 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
83 reloc.
84 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
85 if we didn't create an IRELATIVE GOT.
86 (Target_i386::Relocate::relocate): Use plt_address_for_global and
87 plt_address_for_local.
88 (Target_i386::do_dynsym_value): Use plt_address_for_global.
89 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
90 got_irelative_, and irelative_count_ fields. Update
91 declarations.
92 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
93 Initialize new fields. Remove symtab parameter. Change all
94 callers.
95 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
96 irelative_count_.
97 (Output_data_plt_x86_64::has_irelative_section): New function.
98 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
99 (class Target_x86_64): Add got_irelative_ and rel_irelative_
100 fields. Update declarations.
101 (Target_x86_64::Target_x86_64): Initialize new fields.
102 (Target_x86_64::do_plt_address_for_global): New function replacing
103 do_plt_section_for_global.
104 (Target_x86_64::do_plt_address_for_local): New function replacing
105 do_plt_section_for_local.
106 (Target_x86_64::got_section): Create got_irelative_.
107 (Target_x86_64::rela_irelative_section): New function.
108 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
109 all callers. Don't create __rel_iplt_{start,end}.
110 (Output_data_plt_x86_64::add_entry): Add symtab and layout
111 parameters. Change all callers. Use different PLT and GOT for
112 IFUNC symbols.
113 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
114 layout parameters. Change all callers. Use different PLT and
115 GOT.
116 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
117 parameters. Change all callers. Use different PLT and GOT for
118 IFUNC symbols.
119 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
120 (Output_data_plt_x86_64::rela_irelative): New function.
121 (Output_data_plt_x86_64::address_for_global): New function.
122 (Output_data_plt_x86_64::address_for_local): New function.
123 (Output_data_plt_x86_64::set_final_data_size): Likewise.
124 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
125 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
126 (Target_x86_64::register_global_plt_entry): Add symtab and layout
127 parameters.
128 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
129 reloc.
130 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
131 symbols if we didn't create an IRELATIVE GOT.
132 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
133 plt_address_for_local.
134 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
135 * testsuite/ifuncvar1.c: New test file.
136 * testsuite/ifuncvar2.c: New test file.
137 * testsuite/ifuncvar3.c: New test file.
138 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
139 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
140 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
141 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
142 * testsuite/Makefile.in: Rebuild.
143
144 2011-07-07 Cary Coutant <ccoutant@google.com>
145
146 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
147 (two_file_test_1_ndebug.o): Likewise.
148 (two_file_test_1b_ndebug.o): Likewise.
149 (two_file_test_2_ndebug.o): Likewise.
150 (two_file_test_main_ndebug.o): Likewise.
151 (incremental_test_2): Link with no-debug versions.
152
153 2011-07-06 Cary Coutant <ccoutant@google.com>
154
155 * gold/incremental.cc
156 (Output_section_incremental_inputs::write_info_blocks): Check for
157 hidden and internal symbols.
158
159 2011-07-06 Cary Coutant <ccoutant@google.com>
160
161 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
162 Check disposition for startup file.
163 (Incremental_inputs::report_command_line): Ignore
164 --incremental-startup-unchanged option.
165 * options.cc (General_options::parse_incremental_startup_unchanged):
166 New function.
167 (General_options::General_options): Initialize new data member.
168 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
169 (General_options): Add --incremental-startup-unchanged option.
170 (General_options::incremental_startup_disposition): New function.
171 (General_options::incremental_startup_disposition_): New data member.
172
173 2011-07-06 Cary Coutant <ccoutant@google.com>
174
175 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
176 input file index to Script_info ctor.
177 (Sized_incremental_binary::do_file_has_changed): Find the
178 command-line argument for files named in scripts.
179 * incremental.h (Script_info::Script_info): New ctor
180 with input file index.
181 (Script_info::input_file_index): New function.
182 (Script_info::input_file_index_): New data member.
183 (Incremental_binary::get_library): Add const.
184 (Incremental_binary::get_script_info): Add const.
185 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
186 * testsuite/Makefile.am (incremental_test_5): New test case.
187 (incremental_test_6): New test case.
188 * testsuite/Makefile.in: Regenerate.
189
190 2011-07-06 Cary Coutant <ccoutant@google.com>
191
192 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
193 debug output when command lines differ.
194
195 2011-07-06 Cary Coutant <ccoutant@google.com>
196
197 * incremental.cc (Incremental_inputs::report_command_line): Ignore
198 --incremental-patch option.
199 * layout.cc (Free_list::allocate): Extend allocation beyond original
200 end if enabled.
201 (Layout::make_output_section): Mark sections that should get
202 patch space.
203 * options.cc (parse_percent): New function.
204 * options.h (parse_percent): New function.
205 (DEFINE_percent): New macro.
206 (General_options): Add --incremental-patch option.
207 * output.cc (Output_section::Output_section): Initialize new data
208 members.
209 (Output_section::add_input_section): Print section name when out
210 of patch space.
211 (Output_section::add_output_section_data): Likewise.
212 (Output_section::set_final_data_size): Add patch space when
213 doing --incremental-full.
214 (Output_section::do_reset_address_and_file_offset): Remove patch
215 space.
216 (Output_segment::set_section_list_addresses): Print debug output
217 only if --incremental-update.
218 * output.h (Output_section::set_is_patch_space_allowed): New function.
219 (Output_section::is_patch_space_allowed_): New data member.
220 (Output_section::patch_space_): New data member.
221 * parameters.cc (Parameters::incremental_full): New function.
222 * parameters.h (Parameters::incremental_full): New function
223 * testsuite/Makefile.am (incremental_test_2): Add test for
224 --incremental-patch option.
225 * testsuite/Makefile.in: Regenerate.
226 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
227 (t18): Remove function body.
228
229 2011-07-05 Doug Kwan <dougkwan@google.com>
230
231 PR gold/12771
232 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
233 Arm_Address type for relocation result.
234 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
235 overflow check.
236 (Arm_relocate_functions::abs32): Use unaligned access.
237 (Arm_relocate_functions::rel32): Ditto.
238 (Arm_relocate_functions::prel31): Ditto.
239 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
240 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
241 static data relocations.
242 * testsuite/Makefile.in: Regnerate.
243 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
244
245 2011-07-05 Ian Lance Taylor <iant@google.com>
246
247 PR gold/12392
248 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
249 symbols if necessary.
250 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
251
252 2011-07-05 Ian Lance Taylor <iant@google.com>
253
254 PR gold/12952
255 * resolve.cc (Symbol::override_base_with_special): Simply override
256 version with special symbol version, ignoring previous version.
257
258 2011-07-05 Ian Lance Taylor <iant@google.com>
259
260 * object.cc (Sized_relobj_file::include_section_group): Add
261 information to comment about signature location.
262
263 2011-07-02 Ian Lance Taylor <iant@google.com>
264
265 PR gold/12957
266 * options.h (class General_options): Add -f and -F.
267 * options.cc (General_options::finalize): Fatal error if -f/-F
268 are used without -shared.
269 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
270
271 2011-07-02 Ian Lance Taylor <iant@google.com>
272
273 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
274
275 2011-07-01 Ian Lance Taylor <iant@google.com>
276
277 PR gold/12525
278 PR gold/12952
279 * resolve.cc (Symbol::override_base_with_special): Don't override
280 the version if the overriding symbol has a different name.
281 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
282 all callers. If we give an error about an undefined version,
283 define the base version if necessary.
284 * dynobj.h (class Versions): Update declaration.
285 * testsuite/weak_alias_test_5.cc: New file.
286 * testsuite/weak_alias_test.script: New file.
287 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
288 and versioned_alias have the right value, and call t2.
289 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
290 weak_alias_test_5.so.
291 (weak_alias_test_LDADD): Likewise.
292 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
293 * testsuite/Makefile.in: Rebuild.
294
295 2011-07-01 Ian Lance Taylor <iant@google.com>
296
297 PR gold/12525
298 * options.h (class General_options): Support -z notext.
299 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
300 -Wl,-z,notext.
301 (two_file_shared_nonpic.so): Likewise.
302 (two_file_shared_mixed.so): Likewise.
303 (two_file_shared_mixed_1.so): Likewise.
304 (weak_undef_lib_nonpic.so): Likewise.
305 (alt/weak_undef_lib_nonpic.so): Likewise.
306 (tls_test_shared_nonpic.so): Likewise.
307 * testsuite/Makefile.in: Rebuild.
308
309 2011-07-01 Ian Lance Taylor <iant@google.com>
310
311 PR gold/12525
312 * configure.ac: Test whether static linking works, setting
313 the automake conditional HAVE_STATIC.
314 * testsuite/Makefile.am: Disable tests using -static if
315 HAVE_STATIC is not true.
316 * configure, testsuite/Makefile.in: Rebuild.
317
318 2011-07-01 Ian Lance Taylor <iant@google.com>
319
320 PR gold/12525
321 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
322 Assert if we see DW_EH_PE_indirect.
323 * target.h (Target::ehframe_datarel_base): New function.
324 (Target::do_ehframe_datarel_base): New target function.
325 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
326 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
327 function.
328
329 2011-07-01 Ian Lance Taylor <iant@google.com>
330
331 PR gold/12571
332 * options.h (class General_options): Add
333 --ld-generated-unwind-info.
334 * ehframe.cc (Fde::write): Add address parameter. Change all
335 callers. If associated with PLT, fill in address and size.
336 (Cie::set_output_offset): Only add merge mapping if there is an
337 object.
338 (Cie::write): Add address parameter. Change all callers.
339 (Eh_frame::add_ehframe_for_plt): New function.
340 * ehframe.h (class Fde): Update declarations. Move shndx_ and
341 input_offset_ fields into union u_, with new plt field.
342 (Fde::Fde): Adjust for new union field.
343 (Fde::Fde) [Output_data version]: New constructor.
344 (Fde::add_mapping): Only add merge mapping if there is an object.
345 (class Cie): Update declarations.
346 (class Eh_frame): Declare add_ehframe_for_plt.
347 * layout.cc (Layout::layout_eh_frame): Break out code into
348 make_eh_frame_section, and call it.
349 (Layout::make_eh_frame_section): New function.
350 (Layout::add_eh_frame_for_plt): New function.
351 * layout.h (class Layout): Update declarations.
352 * merge.cc (Merge_map::add_mapping): Add assertion.
353 * i386.cc: Include "dwarf.h".
354 (class Output_data_plt_i386): Make first_plt_entry,
355 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
356 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
357 and plt_eh_frame_fde.
358 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
359 boundary. Call add_eh_frame_for_plt if appropriate.
360 * x86_64.cc: Include "dwarf.h".
361 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
362 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
363 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
364 and plt_eh_frame_fde.
365 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
366 appropriate.
367
368 2011-06-29 Ian Lance Taylor <iant@google.com>
369
370 PR gold/12629
371 * object.cc (Sized_relobj_file::layout_section): Change shdr
372 parameter to be const.
373 (Sized_relobj_file::layout_eh_frame_section): New function, broken
374 out of do_layout.
375 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
376 appropriate. Call layout_eh_frame_section.
377 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
378 sections.
379 * object.h (class Sized_relobj_file): Update declarations.
380
381 2011-06-29 Ian Lance Taylor <iant@google.com>
382
383 PR gold/12652
384 * script.cc (Token::integer_value): Accept trailing M/m/K/k
385 modifier.
386 (Lex::gather_token): Accept trailing M/m/K/k for integers.
387
388 2011-06-29 Ian Lance Taylor <iant@google.com>
389
390 PR gold/12675
391 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
392 SHT_X86_64_UNWIND.
393 * layout.cc (Layout::layout_eh_frame): Likewise.
394
395 2011-06-29 Ian Lance Taylor <iant@google.com>
396
397 PR gold/12695
398 * layout.cc (Layout::symtab_section_shndx): New function.
399 * layout.h (class Layout): Declare symtab_section_shndx.
400 * output.cc (Output_section::write_header): Call it.
401
402 2011-06-29 Ian Lance Taylor <iant@google.com>
403
404 PR gold/12818
405 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
406 symbols which are not used in a relocation.
407
408 2011-06-28 Ian Lance Taylor <iant@google.com>
409
410 PR gold/12898
411 * layout.cc (Layout::segment_precedes): Don't crash if a linker
412 script create indistinguishable segments.
413 (Layout::set_segment_offsets): Use stable_sort when sorting
414 segments. Pass this to Compare_segments constructor.
415 * layout.h (class Layout): Make segment_precedes non-static.
416 (class Compare_segments): Change from struct to class. Add
417 layout_ field. Add constructor.
418 * script-sections.cc
419 (Script_sections::attach_sections_using_phdrs_clause): Rename
420 local orphan to is_orphan. Don't report failure to put empty
421 section in segment. On attachment failure, report name of
422 section, and attach to first PT_LOAD segment.
423
424 2011-06-28 Ian Lance Taylor <iant@google.com>
425
426 PR gold/12934
427 * target-select.cc (Target_selector::Target_selector): Add
428 emulation parameter. Change all callers.
429 (select_target_by_bfd_name): Rename from select_target_by_name.
430 Change all callers.
431 (select_target_by_emulation): New function.
432 (supported_emulation_names): New function.
433 * target-select.h (class Target_selector): Add emulation_ field.
434 Update declarations.
435 (Target_selector::recognize_by_bfd_name): Rename from
436 recognize_by_name. Change all callers.
437 (Target_selector::supported_bfd_names): Rename from
438 supported_names. Change all callers.
439 (Target_selector::recognize_by_emulation): New function.
440 (Target_selector::supported_emulations): New function.
441 (Target_selector::emulation): New function.
442 (Target_selector::do_recognize_by_bfd_name): Rename from
443 do_recognize_by_name. Change all callers.
444 (Target_selector::do_supported_bfd_names): Rename from
445 do_supported_names. Change all callers.
446 (Target_selector::do_recognize_by_emulation): New function.
447 (Target_selector::do_supported_emulations): New function.
448 (select_target_by_bfd_name): Change name in declaration.
449 (select_target_by_emulation): Declare.
450 (supported_emulation_names): Declare.
451 * parameters.cc (parameters_force_valid_target): Try to find
452 target based on emulation from -m option.
453 * options.h (class General_options): Change doc string for -m.
454 * options.cc (help): Print emulations.
455 (General_options::parse_V): Likewise.
456 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
457 Add emulation parameter. Change all callers.
458
459 2011-06-28 Ian Lance Taylor <iant@google.com>
460
461 * target.h (class Target): Add osabi_ field.
462 (Target::osabi): New function.
463 (Target::set_osabi): New function.
464 (Target::Target): Initialize osabi_.
465 (Target::do_adjust_elf_header): Make pure virtual.
466 (Sized_target::do_adjust_elf_header): Declare.
467 * target.cc (Sized_target::do_adjust_elf_header): New function.
468 (class Sized_target): Instantiate all versions.
469 * freebsd.h (class Target_freebsd): Remove.
470 (Target_selector_freebsd::do_recognize): Call set_osabi on
471 Target.
472 (Target_selector_freebsd::do_recognize_by_name): Likewise.
473 (Target_selector_freebsd::set_osabi): Remove.
474 * i386.cc (class Target_i386): Inherit from Sized_target rather
475 than Target_freebsd.
476 * x86_64.cc (class Target_x86_64): Likewise.
477
478 2011-06-28 Ian Lance Taylor <iant@google.com>
479
480 * target.h (Target::can_check_for_function_pointers): Rewrite.
481 Make non-virtual.
482 (Target::can_icf_inline_merge_sections): Likewise.
483 (Target::section_may_have_icf_unsafe_poineters): Likewise.
484 (Target::Target_info): Add can_icf_inline_merge_sections field.
485 (Target::do_can_check_for_function_pointers): New virtual
486 function.
487 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
488 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
489 from can_check_for_function_pointers, move in file.
490 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
491 section_may_have_icf_unsafe_poineters, move in file.
492 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
493 * i386.cc (Target_i386::do_can_check_for_function_pointers):
494 Rename from can_check_for_function_pointers, move in file.
495 (Target_i386::can_icf_inline_merge_sections): Remove.
496 (Target_i386::i386_info): Initialize
497 can_icf_inline_merge_sections.
498 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
499 Initialize can_icf_inline_merge_sections.
500 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
501 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
502 Rename from can_check_for_function_pointers, move in file.
503 (Target_x86_64::can_icf_inline_merge_sections): Remove.
504 (Target_x86_64::x86_64_info): Initialize
505 can_icf_inline_merge_sections.
506 * testsuite/testfile.cc (Target_test::test_target_info):
507 Likewise.
508 * icf.cc (get_section_contents): Correct formatting.
509
510 2011-06-27 Ian Lance Taylor <iant@google.com>
511
512 * symtab.cc (Symbol::versioned_name): New function.
513 (Symbol_table::add_to_final_symtab): Use versioned_name when
514 appropriate.
515 (Symbol_table::sized_write_symbol): Likewise.
516 * symtab.h (class Symbol): Declare versioned_name.
517 * stringpool.h (class Stringpool_template): Add variant of add
518 which takes a std::basic_string.
519 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
520 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
521 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
522 (ver_test_12.o): New target.
523 * testsuite/Makefile.in: Rebuild.
524
525 2011-06-27 Doug Kwan <dougkwan@google.com>
526
527 * arm.cc (Arm_relocate_functions::thm_jump8,
528 Arm_relocate_functions::thm_jump11): Use a wider signed
529 type to compute offset.
530 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
531 arm_thm_jump8.
532 * testsuite/Makefile.in: Regenerate.
533 * testsuite/arm_branch_in_range.sh: Check test results of
534 arm_thm_jump11 and arm_thm_jump8.
535 * testsuite/arm_thm_jump11.s: New test source file.
536 * testsuite/arm_thm_jump11.t: New linker script.
537 * testsuite/arm_thm_jump8.s: New test source file.
538 * testsuite/arm_thm_jump8.t: New linker script.
539
540 2011-06-24 Ian Lance Taylor <iant@google.com>
541
542 * layout.cc: Include "object.h".
543 (ctors_sections_in_init_array): New static variable.
544 (Layout::is_ctors_in_init_array): New function.
545 (Layout::layout): Add entry to ctors_sections_in_init_array if
546 appropriate.
547 * layout.h (class Layout): Declare is_ctors_in_init_array.
548 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
549 is_ctors_reverse_view is set.
550 (Sized_relobj_file::write_sections): Add layout parameter. Change
551 all callers. Set is_ctors_reverse_view field of View_size.
552 (Sized_relobj_file::reverse_words): New function.
553 * object.h (Sized_relobj_file::View_size): Add
554 is_ctors_reverse_view field.
555 (class Sized_relobj_file): Update declarations.
556 * testsuite/initpri3.c: New test.
557 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
558 initpri3b.
559 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
560 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
561 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
562 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
563 * testsuite/Makefile.in: Rebuild.
564
565 2011-06-24 Cary Coutant <ccoutant@google.com>
566
567 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
568 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
569 (debug_msg_cdebug.err): New targets.
570 * testsuite/Makefile.in: Regenerate.
571 * testsuite/debug_msg.sh: Check output of link with compressed debug.
572 Fix checks for link with shared library.
573
574 2011-06-24 Doug Kwan <dougkwan@google.com>
575
576 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
577 skip empty text sections.
578 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
579
580 2011-06-22 Ian Lance Taylor <iant@google.com>
581
582 PR gold/12910
583 * options.h (class General_options): Add --ctors-in-init-array.
584 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
585 friends as SHT_PROGBITS for merging sections.
586 (Layout::layout): Remove special handling of .init_array and
587 friends. Don't sort if doing relocatable link. Sort for .ctors
588 and .dtors if ctors_in_init_array.
589 (Layout::make_output_section): Force correct section types for
590 .init_array and friends. Don't sort if doing relocatable link,
591 Don't sort .ctors and .dtors if ctors_in_init_array.
592 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
593 (Layout::output_section_name): Add relobj parameter. Change all
594 callers. Handle .ctors. and .dtors. in code rather than table.
595 Handle .ctors and .dtors if ctors_in_init_array.
596 (Layout::match_file_name): New function, moved from output.cc.
597 * layout.h (class Layout): Update declarations.
598 * output.cc: Include "layout.h".
599 (Input_section_sort_entry::get_priority): New function.
600 (Input_section_sort_entry::match_file_name): Just call
601 Layout::match_file_name.
602 (Output_section::Input_section_sort_init_fini_compare::operator()):
603 Handle .ctors and .dtors. Sort by explicit priority rather than
604 by name.
605 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
606 * testsuite/initpri2.c: New test.
607 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
608 (check_PROGRAMS): Add initpri2.
609 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
610 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
611 * configure, testsuite/Makefile.in: Rebuild.
612
613 2011-06-19 Ian Lance Taylor <iant@google.com>
614
615 PR gold/12880
616 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
617 .interp section to a PT_INTERP segment even if we have seen a
618 --dynamic-linker option. Don't do it if we have seen a PHDRS
619 clause in a linker script.
620 (Layout::finalize): Don't create a .interp section if we've
621 already create a PT_INTERP segment.
622 (Layout::create_interp): Always call choose_output_section (revert
623 patch of 2011-06-17). Don't create PT_INTERP segment.
624 * script-sections.cc
625 (Script_sections::create_note_and_tls_segments): Add a .interp
626 section to a PT_INTERP segment even if we have seen a
627 --dynamic-linker option.
628
629 2011-06-18 Ian Lance Taylor <iant@google.com>
630
631 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
632 merely because a non-PT_LOAD segment has a dynamic reloc.
633
634 2011-06-18 Ian Lance Taylor <iant@google.com>
635
636 * layout.cc (Layout::finish_dynamic_section): Don't create
637 DT_FLAGS entry if not needed.
638
639 2011-06-18 Ian Lance Taylor <iant@google.com>
640
641 PR gold/12745
642 * layout.cc (Layout::layout_eh_frame): Correct handling of
643 writable .eh_frame section.
644
645 2011-06-17 Ian Lance Taylor <iant@google.com>
646
647 PR gold/12893
648 * resolve.cc (Symbol_table::resolve): Don't give an error if a
649 symbol is redefined with the exact same object and value.
650
651 2011-06-17 Ian Lance Taylor <iant@google.com>
652
653 PR gold/12880
654 * layout.h (class Layout): Add interp_segment_ field.
655 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
656 (Layout::attach_allocated_section_to_segment): If making shared
657 library, put .interp section in PT_INTERP segment.
658 (Layout::finalize): Also call create_interp if -dynamic-linker
659 option was used.
660 (Layout::create_interp): Assert that there is no PT_INTERP
661 segment. If not using a SECTIONS clause, use make_output_section.
662 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
663 * script-sections.cc
664 (Script_sections::create_note_and_tls_segments): If making shared
665 library, put .interp section in PT_INTERP segment.
666
667 2011-06-17 Ian Lance Taylor <iant@google.com>
668
669 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
670 when making a shared library.
671
672 2011-06-17 Ian Lance Taylor <iant@google.com>
673
674 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
675 parameter. Change all callers. Don't issue warning about PC32
676 against locally defined symbol.
677
678 2011-06-16 Ian Lance Taylor <iant@google.com>
679
680 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
681 occurs in same object.
682
683 2011-06-14 Alan Modra <amodra@gmail.com>
684
685 * po/POTFILES.in: Regenerate.
686
687 2011-06-09 Ian Lance Taylor <iant@google.com>
688
689 * script-sections.cc
690 (Orphan_output_section::set_section_addresses): For a relocatable
691 link set address to 0.
692
693 2011-06-09 Cary Coutant <ccoutant@google.com>
694
695 PR gold/12804
696 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
697 used with --compress-debug-sections.
698 * gold/object.cc (Sized_relobj_file::do_layout): Report
699 uncompressed size of compressed input sections.
700
701 2011-06-08 Cary Coutant <ccoutant@google.com>
702
703 PR gold/12804
704 * testsuite/two_file_test_2_v1.cc: Change initialization of
705 v2 to keep it in .data.
706
707 2011-06-07 Cary Coutant <ccoutant@google.com>
708
709 * common.cc (Symbol_table::do_allocate_commons_list): Call
710 gold_fallback.
711 * errors.cc (Errors::fatal): Adjust call to gold_exit.
712 (Errors::fallback): New function.
713 (gold_fallback): New function.
714 * errors.h (Errors::fallback): New function.
715 * gold.cc (gold_exit): Change status parameter to enum; adjust
716 all callers.
717 (queue_initial_tasks): Call gold_fallback.
718 * gold.h: Include cstdlib.
719 (Exit_status): New enum type.
720 (gold_exit): Change status parameter to enum.
721 (gold_fallback): New function.
722 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
723 (Layout::create_symtab_sections): Likewise.
724 (Layout::create_shdrs): Likewise.
725 * main.cc (main): Adjust call to gold_exit.
726 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
727 (Output_data_got::add_got_entry_pair): Likewise.
728 (Output_section::add_input_section): Likewise.
729 (Output_section::add_output_section_data): Likewise.
730 (Output_segment::set_section_list_addresses): Likewise.
731 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
732
733 2011-06-07 Cary Coutant <ccoutant@google.com>
734
735 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
736 for incremental links.
737 * output.cc (Output_segment::set_section_list_addresses): Remove
738 FIXME and test for TLS or BSS.
739
740 2011-06-07 Cary Coutant <ccoutant@google.com>
741
742 * testsuite/Makefile.am: Add incremental_copy_test,
743 incremental_common_test_1.
744 * testsuite/Makefile.in: Regenerate.
745 * testsuite/common_test_1_v1.c: New source file.
746 * testsuite/common_test_1_v2.c: New source file.
747 * testsuite/copy_test_v1.cc: New source file.
748
749 2011-06-07 Cary Coutant <ccoutant@google.com>
750
751 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
752 update, allocate common from bss section's free list.
753 * incremental-dump.cc (dump_incremental_inputs): Print flag for
754 linker-defined symbols.
755 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
756 Skip GOT and PLT entries that are no longer referenced.
757 (Output_section_incremental_inputs::write_info_blocks): Mark
758 linker-defined symbols.
759 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
760 * output.cc (Output_section::allocate): New function.
761 * output.h (Output_section::allocate): New function.
762 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
763 linker-defined symbols.
764 (Symbol::override_base_with_special): Copy is_predefined_ flag.
765 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
766 (Symbol::init_base_output_data): Likewise.
767 (Symbol::init_base_output_segment): Likewise.
768 (Symbol::init_base_constant): Likewise.
769 (Sized_symbol::init_output_data): Likewise.
770 (Sized_symbol::init_output_segment): Likewise.
771 (Sized_symbol::init_constant): Likewise.
772 (Symbol_table::do_define_in_output_data): Likewise.
773 (Symbol_table::do_define_in_output_segment): Likewise.
774 (Symbol_table::do_define_as_constant): Likewise.
775 * symtab.h (Symbol::is_predefined): New function.
776 (Symbol::init_base_output_data): Add is_predefined parameter.
777 (Symbol::init_base_output_segment): Likewise.
778 (Symbol::init_base_constant): Likewise.
779 (Symbol::is_predefined_): New data member.
780 (Sized_symbol::init_output_data): Add is_predefined parameter.
781 (Sized_symbol::init_output_segment): Likewise.
782 (Sized_symbol::init_constant): Likewise.
783 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
784
785 2011-06-07 Cary Coutant <ccoutant@google.com>
786
787 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
788 instead of emit_copy_reloc.
789 (Copy_relocs::emit_copy_reloc): Refactor.
790 (Copy_relocs::make_copy_reloc): New function.
791 (Copy_relocs::add_copy_reloc): Remove.
792 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
793 section.
794 (Copy_relocs::make_copy_reloc): New function.
795 (Copy_relocs::add_copy_reloc): Remove.
796 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
797 unchanged input files.
798 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
799 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
800 Reserve BSS space for COPY relocations.
801 (Sized_incremental_binary::do_emit_copy_relocs): New function.
802 (Output_section_incremental_inputs::write_info_blocks): Record
803 whether a symbol is copied from a shared object.
804 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
805 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
806 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
807 (Incremental_input_entry_reader::get_output_symbol_index): Add
808 is_copy parameter.
809 (Incremental_binary::emit_copy_relocs): New function.
810 (Incremental_binary::do_emit_copy_relocs): New function.
811 (Sized_incremental_binary::Sized_incremental_binary): Initialize
812 new data member.
813 (Sized_incremental_binary::add_copy_reloc): New function.
814 (Sized_incremental_binary::do_emit_copy_relocs): New function.
815 (Sized_incremental_binary::Copy_reloc): New struct.
816 (Sized_incremental_binary::Copy_relocs): New typedef.
817 (Sized_incremental_binary::copy_relocs_): New data member.
818 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
819 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
820 * target.h (Sized_target::emit_copy_reloc): New function.
821 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
822
823 2011-06-02 Cary Coutant <ccoutant@google.com>
824
825 PR gold/12163
826 * gold/archive.cc (Archive::Archive): Initialize new data member.
827 (Archive::include_all_members): Return if archive has already been
828 included.
829 * gold/archive.h (Archive::include_all_members_): New data member.
830
831 2011-06-02 Nick Clifton <nickc@redhat.com>
832
833 * dynobj.h: Fix spelling mistake in comment.
834 * output.cc: Likewise.
835
836 2011-05-31 Doug Kwan <dougkwan@google.com>
837 Asier Llano
838
839 PR gold/12826
840 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
841 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
842 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
843 redundant arm_exidx_test.so.
844 * testsuite/Makefile.in: Regenerate.
845 (check_SCRIPTS): Add pr12826.sh
846 (check_DATA): Add pr12826.stdout
847 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
848 * testsuite/pr12826.sh: New file.
849 * testsuite/pr12826_1.s: Ditto.
850 * testsuite/pr12826_1.s: Ditto.
851
852 2011-05-30 Ian Lance Taylor <iant@google.com>
853
854 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
855 sections.
856
857 2011-05-29 Ian Lance Taylor <iant@google.com>
858
859 PR gold/12804
860 * testsuite/Makefile.am: Use different file name for two_file_test
861 temporary file for each incremental test.
862 * testsuite/Makefile.in: Rebuild.
863
864 2011-05-29 Ian Lance Taylor <iant@google.com>
865
866 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
867 binary input file is empty.
868
869 2011-05-27 Ian Lance Taylor <iant@google.com>
870
871 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
872 (ver_test_9.so): Likewise.
873 * testsuite/Makefile.in: Rebuild.
874
875 2011-05-26 Cary Coutant <ccoutant@google.com>
876
877 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
878 * incremental.cc (Incremental_inputs::report_input_section): Fix
879 comment, indentation.
880 (Incremental_inputs::report_comdat_group): New function.
881 (Output_section_incremental_inputs::set_final_data_size): Adjust size
882 of data for incremental input file entry.
883 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
884 group count, COMDAT group signatures.
885 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
886 an unchanged input file.
887 * incremental.h (Incremental_object_entry::Incremental_object_entry):
888 Initialize new data member.
889 (Incremental_object_entry::add_comdat_group): New function.
890 (Incremental_object_entry::get_comdat_group_count): New function.
891 (Incremental_object_entry::get_comdat_signature_key): New function.
892 (Incremental_object_entry::groups_): New data member.
893 (Incremental_inputs::report_comdat_group): New function.
894 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
895 data for incremental input file entry.
896 (Incremental_input_entry_reader::get_comdat_group_count): New function.
897 (Incremental_input_entry_reader::get_input_section): Adjust size of
898 data for incremental input file entry.
899 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
900 (Incremental_input_entry_reader::get_comdat_group_signature): New
901 function.
902 * object.cc (Sized_relobj::include_section_group): Report kept
903 COMDAT groups for incremental links.
904
905 2011-05-24 David Meyer <pdox@google.com>
906
907 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
908 with name parameter. Add found_name parameter.
909 * fileread.cc (Input_file::find_file): Adjust code accordingly.
910 * dirsearch.h (class Dirsearch): Update declaration.
911
912 2011-05-24 Ian Lance Taylor <iant@google.com>
913
914 * archive.cc (Library_base::should_include_member): Pull in object
915 from archive if it defines the entry symbol.
916 * parameters.cc (Parameters::entry): New function.
917 * parameters.h (class Parameters): Declare entry.
918 * output.h (class Output_file_header): Remove entry_ field.
919 * output.cc (Output_file_header::Output_file_header): Remove entry
920 parameter. Change all callers.
921 (Output_file_header::entry): Use parameters->entry.
922 * gold.cc (queue_middle_tasks): Likewise.
923 * plugin.cc (Plugin_hook::run): Likewise.
924
925 2011-05-24 Cary Coutant <ccoutant@google.com>
926
927 * gold.cc (queue_initial_tasks): Pass incremental base filename
928 to Output_file::open_base_file; don't print error message.
929 * incremental-dump.cc (main): Adjust call to
930 Output_file::open_for_modification.
931 * incremental-dump.cc (main): Likewise.
932 * incremental.cc (Incremental_inputs::report_command_line):
933 Ignore --incremental-base option when comparing command lines.
934 Ignore parameter when given as separate argument.
935 * options.h (class General_options): Add --incremental-base.
936 * output.cc (Output_file::Output_file):
937 (Output_file::open_base_file): Add base_name and writable parameters;
938 read base file into new file; print error message here.
939 (Output_file::map_no_anonymous): Add writable parameter; adjust all
940 callers.
941 * output.h (Output_file::open_for_modification): Rename to...
942 (Output_file::open_base_file): ...this; add base_name and
943 writable parameters; adjust all callers.
944 (Output_file::map_no_anonymous): Add writable parameter; adjust all
945 callers.
946 * testsuite/Makefile.am (incremental_test_4): Test
947 --incremental-base.
948 * testsuite/Makefile.in: Regenerate.
949
950 2011-05-24 Cary Coutant <ccoutant@google.com>
951
952 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
953 incremental_test_4.
954 * testsuite/Makefile.in: Regenerate.
955 * testsuite/two_file_test_1_v1.cc: New test source file.
956 * testsuite/two_file_test_1b_v1.cc: New test source file.
957 * testsuite/two_file_test_2_v1.cc: New test source file.
958
959 2011-05-24 Cary Coutant <ccoutant@google.com>
960
961 * dynobj.h (Dynobj::do_dynobj): New function.
962 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
963 flag and soname for shared objects.
964 * incremental.cc (Incremental_inputs::report_object): Make
965 either Incremental_object_entry or Incremental_dynobj_entry; add
966 soname to string table.
967 (Incremental_inputs::report_input_section): Add assertion.
968 (Output_section_incremental_inputs::set_final_data_size): Adjust
969 type of input file entry for shared libraries; adjust size of
970 shared library info entry.
971 (Output_section_incremental_inputs::write_input_files): Write
972 as_needed flag for shared libraries.
973 (Output_section_incremental_inputs::write_info_blocks): Adjust type
974 of input file entry for shared libraries; write soname.
975 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
976 soname from incremental info.
977 * incremental.h (enum Incremental_input_flags): Add
978 INCREMENTAL_INPUT_AS_NEEDED.
979 (Incremental_input_entry::Incremental_input_entry): Initialize new
980 data member.
981 (Incremental_input_entry::set_as_needed): New function.
982 (Incremental_input_entry::as_needed): New function.
983 (Incremental_input_entry::do_dynobj_entry): New function.
984 (Incremental_input_entry::as_needed_): New data member.
985 (Incremental_object_entry::Incremental_object_entry): Don't check
986 for shared library.
987 (Incremental_object_entry::do_type): Likewise.
988 (class Incremental_dynobj_entry): New class.
989 (Incremental_input_entry_reader::as_needed): New function.
990 (Incremental_input_entry_reader::get_soname): New function.
991 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
992 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
993 size of shared library info entry.
994 * layout.cc (Layout::finish_dynamic_section): Don't test for
995 incremental link when adding DT_NEEDED entries.
996 * object.h (Object::Object): Initialize new data member.
997 (Object::dynobj): New function.
998 (Object::set_as_needed): New function.
999 (Object::as_needed): New function.
1000 (Object::do_dynobj): New function.
1001 (Object::as_needed_): New data member.
1002
1003 2011-05-24 Cary Coutant <ccoutant@google.com>
1004
1005 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
1006 info; adjust display of GOT entries.
1007 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1008 vector of input objects; remove file_status_.
1009 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
1010 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
1011 got_plt reader; call target hooks to reserve GOT entries.
1012 (Output_section_incremental_inputs::set_final_data_size): Adjust size
1013 of input file info header and GOT info entry.
1014 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
1015 relocation info.
1016 (Got_plt_view_info::got_descriptor): Remove.
1017 (Got_plt_view_info::sym_index): New data member.
1018 (Got_plt_view_info::input_index): New data member.
1019 (Local_got_offset_visitor::visit): Write input file index.
1020 (Global_got_offset_visitor::visit): Write 0 for input file index.
1021 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
1022 with sym_index and input_index.
1023 (Output_section_incremental_inputs::write_got_plt): Adjust size of
1024 incremental info GOT entry; replace got_descriptor with input_index.
1025 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
1026 map from input file index to object.
1027 (Sized_relobj_incr::do_layout): Replace direct data member reference
1028 with accessor function.
1029 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
1030 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
1031 Adjust size of input file info header.
1032 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
1033 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
1034 (Incremental_input_entry_reader::get_input_section): Adjust size of
1035 input file info header.
1036 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
1037 of incremental info GOT entry.
1038 (Incremental_got_plt_reader::get_got_desc): Remove.
1039 (Incremental_got_plt_reader::get_got_symndx): New function.
1040 (Incremental_got_plt_reader::get_got_input_index): New function.
1041 (Sized_incremental_binary::Sized_incremental_binary): Remove
1042 file_status_; add input_objects_.
1043 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
1044 (Sized_incremental_binary::set_file_is_unchanged): Remove.
1045 (Sized_incremental_binary::file_is_unchanged): Remove.
1046 (Sized_incremental_binary::set_input_object): New function.
1047 (Sized_incremental_binary::input_object): New function.
1048 (Sized_incremental_binary::file_status_): Remove.
1049 (Sized_incremental_binary::input_objects_): New data member.
1050 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
1051 references.
1052 (Sized_relobj_incr::invalid_address): Move to base class.
1053 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
1054 class.
1055 (Sized_relobj_incr::do_output_section_offset): Likewise.
1056 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
1057 (Sized_relobj_incr::section_offsets_): Likewise.
1058 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
1059 function.
1060 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
1061 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
1062 with accessor function.
1063 (Sized_relobj_file::do_layout): Likewise.
1064 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
1065 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
1066 (Sized_relobj_file::compute_final_local_value): Replace refs to
1067 section_offsets_ with accessor function.
1068 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
1069 * object.h (Relobj::Relobj): Initialize new data members.
1070 (Relobj::add_dyn_reloc): New function.
1071 (Relobj::first_dyn_reloc): New function.
1072 (Relobj::dyn_reloc_count): New function.
1073 (Relobj::first_dyn_reloc_): New data member.
1074 (Relobj::dyn_reloc_count_): New data member.
1075 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
1076 references.
1077 (Sized_relobj::Address): New typedef.
1078 (Sized_relobj::invalid_address): Move here from child class.
1079 (Sized_relobj::Sized_relobj): Initialize new data members.
1080 (Sized_relobj::sized_relobj): New function.
1081 (Sized_relobj::is_output_section_offset_invalid): Move here from
1082 child class.
1083 (Sized_relobj::get_output_section_offset): Likewise.
1084 (Sized_relobj::local_has_got_offset): Likewise.
1085 (Sized_relobj::local_got_offset): Likewise.
1086 (Sized_relobj::set_local_got_offset): Likewise.
1087 (Sized_relobj::do_for_all_local_got_entries): Likewise.
1088 (Sized_relobj::clear_got_offsets): New function.
1089 (Sized_relobj::section_offsets): Move here from child class.
1090 (Sized_relobj::do_output_section_offset): Likewise.
1091 (Sized_relobj::do_set_section_offset): Likewise.
1092 (Sized_relobj::Local_got_offsets): Likewise.
1093 (Sized_relobj::local_got_offsets_): Likewise.
1094 (Sized_relobj::section_offsets_): Likewise.
1095 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
1096 references.
1097 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
1098 class.
1099 (Sized_relobj_file::sized_relobj): New function
1100 (Sized_relobj_file::local_has_got_offset): Move to base class.
1101 (Sized_relobj_file::local_got_offset): Likewise.
1102 (Sized_relobj_file::set_local_got_offset): Likewise.
1103 (Sized_relobj_file::get_output_section_offset): Likewise.
1104 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
1105 (Sized_relobj_file::do_output_section_offset): Likewise.
1106 (Sized_relobj_file::do_set_section_offset): Likewise.
1107 (Sized_relobj_file::Local_got_offsets): Likewise.
1108 (Sized_relobj_file::local_got_offsets_): Likewise.
1109 (Sized_relobj_file::section_offsets_): Likewise.
1110 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
1111 (all constructors).
1112 (set_needs_dynsym_index): Convert relobj to derived class pointer.
1113 (Output_reloc::get_symbol_index): Likewise.
1114 (Output_reloc::local_section_offset): Likewise.
1115 (Output_reloc::get_address): Likewise.
1116 (Output_reloc::symbol_value): Likewise.
1117 (Output_data_got::reserve_slot): Move to class definition.
1118 (Output_data_got::reserve_local): New function.
1119 (Output_data_got::reserve_slot_for_global): Remove.
1120 (Output_data_got::reserve_global): New function.
1121 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
1122 (all constructors, two instantiations).
1123 (Output_reloc::get_relobj): New function (two instantiations).
1124 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
1125 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
1126 (Output_data_reloc::add_global): Adjust type of relobj.
1127 (Output_data_reloc::add_global_relative): Likewise.
1128 (Output_data_reloc::add_symbolless_global_addend): Likewise.
1129 (Output_data_reloc::add_local): Likewise.
1130 (Output_data_reloc::add_local_relative): Likewise.
1131 (Output_data_reloc::add_symbolless_local_addend): Likewise.
1132 (Output_data_reloc::add_local_section): Likewise.
1133 (Output_data_reloc::add_output_section): Likewise.
1134 (Output_data_reloc::add_absolute): Likewise.
1135 (Output_data_reloc::add_target_specific): Likewise.
1136 (Output_data_got::reserve_slot): Move definition here.
1137 (Output_data_got::reserve_local): New function.
1138 (Output_data_got::reserve_global): New function.
1139 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
1140 section_offsets_ with accessor function.
1141 (Sized_relobj_file::write_sections): Likewise.
1142 (Sized_relobj_file::do_relocate_sections): Likewise.
1143 * target.h (Sized_target::reserve_local_got_entry): New function.
1144 (Sized_target::reserve_global_got_entry): New function.
1145 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
1146 (Target_x86_64::reserve_global_got_entry): New function.
1147 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
1148
1149 2011-05-23 Cary Coutant <ccoutant@google.com>
1150
1151 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
1152 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
1153 bit when checking got_type.
1154 * incremental.cc (Sized_incremental_binary::setup_readers):
1155 Store symbol table and string table locations; initialize bit vector
1156 of file status flags.
1157 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
1158 unchanged files.
1159 (Sized_incremental_binary::do_process_got_plt): New function.
1160 (Sized_incremental_binary::get_symtab_view): Use stored locations.
1161 (Output_section_incremental_inputs::set_final_data_size): Record
1162 file index for each input file.
1163 (Output_section_incremental_inputs::write_got_plt): Store file index
1164 instead of input entry offset for each GOT entry.
1165 * incremental.h
1166 (Incremental_input_entry::Incremental_input_entry): Initialize new
1167 data member.
1168 (Incremental_input_entry::set_offset): Store file index.
1169 (Incremental_input_entry::get_file_index): New function.
1170 (Incremental_input_entry::file_index_): New data member.
1171 (Incremental_binary::process_got_plt): New function.
1172 (Incremental_binary::do_process_got_plt): New function.
1173 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1174 data members.
1175 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
1176 (Sized_incremental_binary::set_file_is_unchanged): New function.
1177 (Sized_incremental_binary::file_is_unchanged): New function.
1178 (Sized_incremental_binary::do_process_got_plt): New function.
1179 (Sized_incremental_binary::file_status_): New data member.
1180 (Sized_incremental_binary::main_symtab_loc_): New data member.
1181 (Sized_incremental_binary::main_strtab_loc_): New data member.
1182 * output.cc (Output_data_got::Got_entry::write): Add case
1183 RESERVED_CODE.
1184 (Output_data_got::add_global): Call add_got_entry.
1185 (Output_data_got::add_global_plt): Likewise.
1186 (Output_data_got::add_global_with_rel): Likewise.
1187 (Output_data_got::add_global_with_rela): Likewise.
1188 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1189 (Output_data_got::add_global_pair_with_rela): Likewise.
1190 (Output_data_got::add_local): Call add_got_entry.
1191 (Output_data_got::add_local_plt): Likewise.
1192 (Output_data_got::add_local_with_rel): Likewise.
1193 (Output_data_got::add_local_with_rela): Likewise.
1194 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1195 (Output_data_got::add_local_pair_with_rela): Likewise.
1196 (Output_data_got::reserve_slot): New function.
1197 (Output_data_got::reserve_slot_for_global): New function.
1198 (Output_data_got::add_got_entry): New function.
1199 (Output_data_got::add_got_entry_pair): New function.
1200 (Output_section::add_output_section_data): Edit FIXME.
1201 * output.h
1202 (Output_section_data_build::Output_section_data_build): New
1203 constructor with size parameter.
1204 (Output_data_space::Output_data_space): Likewise.
1205 (Output_data_got::Output_data_got): Initialize new data member; new
1206 constructor with size parameter.
1207 (Output_data_got::add_constant): Call add_got_entry.
1208 (Output_data_got::reserve_slot): New function.
1209 (Output_data_got::reserve_slot_for_global): New function.
1210 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1211 (Output_data_got::add_got_entry): New function.
1212 (Output_data_got::add_got_entry_pair): New function.
1213 (Output_data_got::free_list_): New data member.
1214 * target.h (Sized_target::init_got_plt_for_update): New function.
1215 (Sized_target::register_global_plt_entry): New function.
1216 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1217 Initialize new data member; call init; add constructor with PLT count.
1218 (Output_data_plt_x86_64::init): New function.
1219 (Output_data_plt_x86_64::add_relocation): New function.
1220 (Output_data_plt_x86_64::reserve_slot): New function.
1221 (Output_data_plt_x86_64::free_list_): New data member.
1222 (Target_x86_64::init_got_plt_for_update): New function.
1223 (Target_x86_64::register_global_plt_entry): New function.
1224 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1225 incremental updates.
1226 (Output_data_plt_x86_64::add_relocation): New function.
1227 * testsuite/object_unittest.cc (Object_test): Set default options.
1228
1229 2011-05-16 Ian Lance Taylor <iant@google.com>
1230
1231 * options.h (class General_options): Make -i a synonym for -r.
1232
1233 2011-05-16 Ian Lance Taylor <iant@google.com>
1234
1235 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1236
1237 2011-05-10 Cary Coutant <ccoutant@google.com>
1238
1239 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1240 strip_all (-s).
1241
1242 2011-05-06 Ian Lance Taylor <iant@google.com>
1243
1244 * layout.cc (Layout::layout): If the output section flags change,
1245 update the ordering.
1246
1247 2011-04-25 Cary Coutant <ccoutant@google.com>
1248
1249 * incremental-dump.cc (dump_incremental_inputs): Print local
1250 symbol info for each input file.
1251 * incremental.cc
1252 (Output_section_incremental_inputs::set_final_data_size): Add local
1253 symbol info to input file entries in incremental info.
1254 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1255 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1256 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1257 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1258 implementation.
1259 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1260 (Sized_incr_relobj::do_relocate): Write the local symbols.
1261 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1262 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1263 Adjust size of input file header.
1264 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1265 (Incremental_inputs_reader::get_local_symbol_count): New function.
1266 (Incremental_inputs_reader::get_input_section): Adjust size of input
1267 file header.
1268 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1269 (Sized_incr_relobj::This): New typedef.
1270 (Sized_incr_relobj::sym_size): New const data member.
1271 (Sized_incr_relobj::Local_symbol): New struct.
1272 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1273 (Sized_incr_relobj::do_local_symbol_offset): New function.
1274 (Sized_incr_relobj::local_symbol_count_): New data member.
1275 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1276 (Sized_incr_relobj::local_symbol_index_): New data member.
1277 (Sized_incr_relobj::local_symbol_offset_): New data member.
1278 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1279 (Sized_incr_relobj::local_symbols_): New data member.
1280 * object.h (Relobj::output_local_symbol_count): New function.
1281 (Relobj::local_symbol_offset): New function.
1282 (Relobj::do_output_local_symbol_count): New function.
1283 (Relobj::do_local_symbol_offset): New function.
1284 (Sized_relobj::do_output_local_symbol_count): New function.
1285 (Sized_relobj::do_local_symbol_offset): New function.
1286
1287 2011-04-22 Vladimir Simonov <sv@sw.ru>
1288
1289 * descriptors.cc (set_close_on_exec): New function.
1290 (Descriptors::open): Use set_close_on_exec.
1291 * output.cc (S_ISLNK): Define if not defined.
1292
1293 2011-04-22 Cary Coutant <ccoutant@google.com>
1294
1295 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1296 global symbol map.
1297 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1298 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1299 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1300 relocations.
1301 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1302 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1303 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1304 * incremental.h
1305 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1306 function.
1307 (Incremental_binary::apply_incremental_relocs): New function.
1308 (Incremental_binary::do_apply_incremental_relocs): New function.
1309 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1310 data member.
1311 (Sized_incremental_binary::add_global_symbol): New function.
1312 (Sized_incremental_binary::global_symbol): New function.
1313 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1314 (Sized_incremental_binary::symbol_map_): New data member.
1315 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1316 * target.h (Sized_target::apply_relocation): New function.
1317 * target-reloc.h (apply_relocation): New function.
1318 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1319
1320 2011-04-22 Doug Kwan <dougkwan@google.com>
1321
1322 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1323 flag of a SHT_ARM_EXIDX section.
1324 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1325 * testsuite/Makefile.in: Regenerate.
1326 * testsuite/arm_exidx_test.s: New file.
1327 * testsuite/arm_exidx_test.sh: Same.
1328
1329 2011-04-20 Cary Coutant <ccoutant@google.com>
1330
1331 PR gold/12689
1332 * archive.h (Incremental_archive_entry::Archive_member):
1333 Initialize arg_serial_ (second constructor).
1334
1335 2011-04-17 Ian Lance Taylor <iant@google.com>
1336
1337 * object.cc (Relocate_info::location): Simplify location string.
1338 * errors.cc (Errors::error_at_location): Don't print program
1339 name.
1340 (Errors::warning_at_location): Likewise.
1341 (Errors::undefined_symbol): Likewise.
1342 * testsuite/debug_msg.sh: Update accordingly.
1343
1344 2011-04-14 Cary Coutant <ccoutant@google.com>
1345
1346 * gold/layout.cc (Layout::symtab_section_offset): New function.
1347 * gold/layout.h (Layout::symtab_section_offset): New function.
1348 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1349
1350 2011-04-12 Ian Lance Taylor <iant@google.com>
1351
1352 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1353 with MREMAP_MAYMOVE.
1354 * output.h (class Output_file): Add map_is_allocated_ field.
1355 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1356 not available, provide stubs. If mremap is not available, #define
1357 it to gold_mremap.
1358 (MREMAP_MAYMOVE): Define if not defined.
1359 (Output_file::Output_file): Initialize map_is_allocated_.
1360 (Output_file::resize): Check map_is_allocated_.
1361 (Output_file::map_anonymous): If mmap fails, use malloc.
1362 (Output_file::unmap): Don't do anything for an anonymous map.
1363 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1364 is not available, provide stubs.
1365 (File_read::View::~View): Use free rather than delete[].
1366 (File_read::make_view): Use malloc rather than new[]. If mmap
1367 fails, use malloc.
1368 (File_read::find_or_make_view): Use malloc rather than new[].
1369 * gold.h: Remove HAVE_REMAP code.
1370 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1371 exists. Rename mremap to gold_mremap. If mmap is not available
1372 don't do anything.
1373 * configure, config.in: Rebuild.
1374
1375 2011-04-11 Ian Lance Taylor <iant@google.com>
1376
1377 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1378 initialize local variable v.
1379
1380 2011-04-11 Cary Coutant <ccoutant@google.com>
1381
1382 * archive.cc (Archive::include_member): Adjust call to
1383 report_object.
1384 (Add_archive_symbols::run): Track argument serial numbers.
1385 (Lib_group::include_member): Likewise.
1386 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1387 * archive.h (Incremental_archive_entry::Archive_member):
1388 Initialize arg_serial_.
1389 (Archive_member::arg_serial_): New data member.
1390 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1391 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1392 incremental link.
1393 (Sized_dynobj::do_for_all_local_got_entries): New function.
1394 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1395 function.
1396 * fileread.cc (get_mtime): New function.
1397 * fileread.h (get_mtime): New function.
1398 * gold.cc (queue_initial_tasks): Check for incremental update.
1399 (process_incremental_input): New function.
1400 (queue_middle_tasks): Don't force valid target for incremental
1401 update.
1402 * incremental-dump.cc (find_input_containing_global): Adjust
1403 size of symbol info entry.
1404 (dump_incremental_inputs): Dump argument serial number and
1405 in_system_directory flag; bias shndx by 1; print symbol names
1406 when dumping per-file symbol lists; use new symbol info readers.
1407 * incremental.cc
1408 (Output_section_incremental_inputs:update_data_size): New function.
1409 (Sized_incremental_binary::setup_readers): Setup input readers
1410 for each input file; build maps for files added from libraries
1411 and scripts.
1412 (Sized_incremental_binary::check_input_args): New function.
1413 (Sized_incremental_binary::do_check_inputs): Build map of argument
1414 serial numbers to input arguments.
1415 (Sized_incremental_binary::do_file_has_changed): Rename
1416 do_file_is_unchanged to this; compare file modification times.
1417 (Sized_incremental_binary::do_init_layout): New function.
1418 (Sized_incremental_binary::do_reserve_layout): New function.
1419 (Sized_incremental_binary::do_get_input_reader): Remove.
1420 (Sized_incremental_binary::get_symtab_view): New function.
1421 (Incremental_checker::can_incrementally_link_output_file): Remove.
1422 (Incremental_inputs::report_command_line): Exclude --debug options.
1423 (Incremental_inputs::report_archive_begin): Add parameter; track
1424 argument serial numbers; don't put input file entry for archive
1425 before archive members.
1426 (Incremental_inputs::report_archive_end): Put input file entry
1427 for archive after archive members.
1428 (Incremental_inputs::report_object): Add parameter; track argument
1429 serial numbers and in_system_directory flag.
1430 (Incremental_inputs::report_script): Add parameter; track argument
1431 serial numbers.
1432 (Output_section_incremental_inputs::set_final_data_size): Adjust
1433 size of symbol info entry; check for forwarding symbols.
1434 (Output_section_incremental_inputs::write_input_files): Write
1435 in_system_directory flag and argument serial number.
1436 (Output_section_incremental_inputs::write_info_blocks): Map section
1437 indices between incremental info and original input file; store
1438 input section index for each symbol.
1439 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1440 change operator() to visit().
1441 (class Global_got_offset_visitor): Likewise.
1442 (class Global_symbol_visitor_got_plt):
1443 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1444 classes.
1445 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1446 (Sized_incr_relobj::do_read_symbols): New function.
1447 (Sized_incr_relobj::do_layout): New function.
1448 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1449 (Sized_incr_relobj::do_add_symbols): New function.
1450 (Sized_incr_relobj::do_should_include_member): New function.
1451 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1452 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1453 (Sized_incr_relobj::do_section_size): New function.
1454 (Sized_incr_relobj::do_section_name): New function.
1455 (Sized_incr_relobj::do_section_contents): New function.
1456 (Sized_incr_relobj::do_section_flags): New function.
1457 (Sized_incr_relobj::do_section_entsize): New function.
1458 (Sized_incr_relobj::do_section_address): New function.
1459 (Sized_incr_relobj::do_section_type): New function.
1460 (Sized_incr_relobj::do_section_link): New function.
1461 (Sized_incr_relobj::do_section_info): New function.
1462 (Sized_incr_relobj::do_section_addralign): New function.
1463 (Sized_incr_relobj::do_initialize_xindex): New function.
1464 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1465 (Sized_incr_relobj::do_read_relocs): New function.
1466 (Sized_incr_relobj::do_gc_process_relocs): New function.
1467 (Sized_incr_relobj::do_scan_relocs): New function.
1468 (Sized_incr_relobj::do_count_local_symbols): New function.
1469 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1470 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1471 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1472 (Sized_incr_relobj::do_relocate): New function.
1473 (Sized_incr_relobj::do_set_section_offset): New function.
1474 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1475 (Sized_incr_dynobj::do_read_symbols): New function.
1476 (Sized_incr_dynobj::do_layout): New function.
1477 (Sized_incr_dynobj::do_add_symbols): New function.
1478 (Sized_incr_dynobj::do_should_include_member): New function.
1479 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1480 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1481 (Sized_incr_dynobj::do_section_size): New function.
1482 (Sized_incr_dynobj::do_section_name): New function.
1483 (Sized_incr_dynobj::do_section_contents): New function.
1484 (Sized_incr_dynobj::do_section_flags): New function.
1485 (Sized_incr_dynobj::do_section_entsize): New function.
1486 (Sized_incr_dynobj::do_section_address): New function.
1487 (Sized_incr_dynobj::do_section_type): New function.
1488 (Sized_incr_dynobj::do_section_link): New function.
1489 (Sized_incr_dynobj::do_section_info): New function.
1490 (Sized_incr_dynobj::do_section_addralign): New function.
1491 (Sized_incr_dynobj::do_initialize_xindex): New function.
1492 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1493 (make_sized_incremental_object): New function.
1494 (Incremental_library::copy_unused_symbols): New function.
1495 (Incremental_library::do_for_all_unused_symbols): New function.
1496 * incremental.h (enum Incremental_input_flags): New type.
1497 (class Incremental_checker): Remove.
1498 (Incremental_input_entry::Incremental_input_entry): Add argument
1499 serial number.
1500 (Incremental_input_entry::arg_serial): New function.
1501 (Incremental_input_entry::set_is_in_system_directory): New function.
1502 (Incremental_input_entry::is_in_system_directory): New function.
1503 (Incremental_input_entry::arg_serial_): New data member.
1504 (Incremental_input_entry::is_in_system_directory_): New data member.
1505 (class Script_info): Move here from script.h.
1506 (Script_info::Script_info): Add filename parameter.
1507 (Script_info::filename): New function.
1508 (Script_info::filename_): New data member.
1509 (Incremental_script_entry::Incremental_script_entry): Add argument
1510 serial number.
1511 (Incremental_object_entry::Incremental_object_entry): Likewise.
1512 (Incremental_object_entry::add_input_section): Build list of input
1513 sections with map to original shndx.
1514 (Incremental_object_entry::get_input_section_index): New function.
1515 (Incremental_object_entry::shndx_): New data member.
1516 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1517 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1518 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1519 serial number.
1520 (Incremental_inputs::report_archive_begin): Likewise.
1521 (Incremental_inputs::report_object): Likewise.
1522 (Incremental_inputs::report_script): Likewise.
1523 (class Incremental_global_symbol_reader): New class.
1524 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1525 and store flags and input file type.
1526 (Incremental_input_entry_reader::arg_serial): New function.
1527 (Incremental_input_entry_reader::type): Extract type from flags.
1528 (Incremental_input_entry_reader::is_in_system_directory): New function.
1529 (Incremental_input_entry_reader::get_input_section_count): Call
1530 accessor function for type.
1531 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1532 function for type; adjust size of global symbol entry.
1533 (Incremental_input_entry_reader::get_global_symbol_count): Call
1534 accessor function for type.
1535 (Incremental_input_entry_reader::get_object_count): Likewise.
1536 (Incremental_input_entry_reader::get_object_offset): Likewise.
1537 (Incremental_input_entry_reader::get_member_count): Likewise.
1538 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1539 (Incremental_input_entry_reader::get_member_offset): Likewise.
1540 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1541 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1542 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1543 (Incremental_input_entry_reader::get_global_symbol_reader): New
1544 function.
1545 (Incremental_input_entry_reader::get_output_symbol_index): New
1546 function.
1547 (Incremental_input_entry_reader::type_): Remove.
1548 (Incremental_input_entry_reader::flags_): New data member.
1549 (Incremental_inputs_reader::input_file_offset): New function.
1550 (Incremental_inputs_reader::input_file_index): New function.
1551 (Incremental_inputs_reader::input_file): Call input_file_offset.
1552 (Incremental_inputs_reader::input_file_at_offset): New function.
1553 (Incremental_relocs_reader::get_r_type): Reformat.
1554 (Incremental_relocs_reader::get_r_shndx): Reformat.
1555 (Incremental_relocs_reader::get_r_offset): Reformat.
1556 (Incremental_relocs_reader::data): New function.
1557 (Incremental_binary::Incremental_binary): Initialize new data members.
1558 (Incremental_binary::check_inputs): Add cmdline parameter.
1559 (Incremental_binary::file_is_unchanged): Remove.
1560 (Input_reader::arg_serial): New function.
1561 (Input_reader::get_unused_symbol_count): New function.
1562 (Input_reader::get_unused_symbol): New function.
1563 (Input_reader::do_arg_serial): New function.
1564 (Input_reader::do_get_unused_symbol_count): New function.
1565 (Input_reader::do_get_unused_symbol): New function.
1566 (Incremental_binary::input_file_count): New function.
1567 (Incremental_binary::get_input_reader): Change signature to use
1568 index instead of filename.
1569 (Incremental_binary::file_has_changed): New function.
1570 (Incremental_binary::get_input_argument): New function.
1571 (Incremental_binary::get_library): New function.
1572 (Incremental_binary::get_script_info): New function.
1573 (Incremental_binary::init_layout): New function.
1574 (Incremental_binary::reserve_layout): New function.
1575 (Incremental_binary::output_file): New function.
1576 (Incremental_binary::do_check_inputs): New function.
1577 (Incremental_binary::do_file_is_unchanged): Remove.
1578 (Incremental_binary::do_file_has_changed): New function.
1579 (Incremental_binary::do_init_layout): New function.
1580 (Incremental_binary::do_reserve_layout): New function.
1581 (Incremental_binary::do_input_file_count): New function.
1582 (Incremental_binary::do_get_input_reader): Change signature.
1583 (Incremental_binary::input_args_map_): New data member.
1584 (Incremental_binary::library_map_): New data member.
1585 (Incremental_binary::script_map_): New data member.
1586 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1587 new data members.
1588 (Sized_incremental_binary::output_section): New function.
1589 (Sized_incremental_binary::inputs_reader): Add const.
1590 (Sized_incremental_binary::symtab_reader): Add const.
1591 (Sized_incremental_binary::relocs_reader): Add const.
1592 (Sized_incremental_binary::got_plt_reader): Add const.
1593 (Sized_incremental_binary::get_symtab_view): New function.
1594 (Sized_incremental_binary::Inputs_reader): New typedef.
1595 (Sized_incremental_binary::Input_entry_reader): New typedef.
1596 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1597 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1598 (Sized_incremental_binary::do_file_has_changed): New function.
1599 (Sized_incremental_binary::do_init_layout): New function.
1600 (Sized_incremental_binary::do_reserve_layout): New function.
1601 (Sized_input_reader::Inputs_reader): Remove.
1602 (Sized_input_reader::Input_entry_reader): Remove.
1603 (Sized_input_reader::do_arg_serial): New function.
1604 (Sized_input_reader::do_get_unused_symbol_count): New function.
1605 (Sized_input_reader::do_get_unused_symbol): New function.
1606 (Sized_incremental_binary::do_input_file_count): New function.
1607 (Sized_incremental_binary::do_get_input_reader): Change signature;
1608 use index instead of filename.
1609 (Sized_incremental_binary::section_map_): New data member.
1610 (Sized_incremental_binary::input_entry_readers_): New data member.
1611 (class Sized_incr_relobj): New class.
1612 (class Sized_incr_dynobj): New class.
1613 (make_sized_incremental_object): New function.
1614 (class Incremental_library): New class.
1615 * layout.cc (Free_list::num_lists): New static data member.
1616 (Free_list::num_nodes): New static data member.
1617 (Free_list::num_removes): New static data member.
1618 (Free_list::num_remove_visits): New static data member.
1619 (Free_list::num_allocates): New static data member.
1620 (Free_list::num_allocate_visits): New static data member.
1621 (Free_list::init): New function.
1622 (Free_list::remove): New function.
1623 (Free_list::allocate): New function.
1624 (Free_list::dump): New function.
1625 (Free_list::print_stats): New function.
1626 (Layout_task_runner::run): Resize output file for incremental updates.
1627 (Layout::Layout): Initialize new data members.
1628 (Layout::set_incremental_base): New function.
1629 (Layout::init_fixed_output_section): New function.
1630 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1631 incremental updates.
1632 (Layout::create_gold_note): Do not create gold note section for
1633 incremental updates.
1634 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1635 for incremental updates.
1636 (Layout::set_section_offsets): For incremental updates, allocate space
1637 from free list.
1638 (Layout::create_symtab_sections): Layout with offsets relative to
1639 start of section; for incremental updates, allocate space from free
1640 list.
1641 (Layout::create_shdrs): For incremental updates, allocate space from
1642 free list.
1643 (Layout::finish_dynamic_section): For incremental updates, do not
1644 check --as-needed (fixed in subsequent patch).
1645 * layout.h (class Free_list): New class.
1646 (Layout::set_incremental_base): New function.
1647 (Layout::incremental_base): New function.
1648 (Layout::init_fixed_output_section): New function.
1649 (Layout::allocate): New function.
1650 (Layout::incremental_base_): New data member.
1651 (Layout::free_list_): New data member.
1652 * main.cc (main): Print Free_list statistics.
1653 * object.cc (Relobj::finalize_incremental_relocs): Add
1654 clear_counts parameter; clear counts only when clear_counts is set.
1655 (Sized_relobj::Sized_relobj): Initialize new base class.
1656 (Sized_relobj::do_layout): Don't report special sections.
1657 (Sized_relobj::do_for_all_local_got_entries): New function.
1658 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1659 symtab_off to all symbol table offsets.
1660 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1661 * object.h (class Got_offset_list): Move to top of file.
1662 (Object::Object): Allow case where input_file == NULL.
1663 (Object::~Object): Likewise.
1664 (Object::input_file): Assert that input_file != NULL.
1665 (Object::lock): Allow case where input_file == NULL.
1666 (Object::unlock): Likewise.
1667 (Object::is_locked): Likewise.
1668 (Object::token): Likewise.
1669 (Object::release): Likewise.
1670 (Object::is_incremental): New function.
1671 (Object::get_mtime): New function.
1672 (Object::for_all_local_got_entries): New function.
1673 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1674 (Object::set_is_in_system_directory): New function.
1675 (Object::is_in_system_directory): New function.
1676 (Object::do_is_incremental): New function.
1677 (Object::do_get_mtime): New function.
1678 (Object::do_for_all_local_got_entries): New function.
1679 (Object::is_in_system_directory_): New data member.
1680 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1681 (class Sized_relobj_base): New class.
1682 (class Sized_relobj): Derive from Sized_relobj_base.
1683 (class Sized_relobj::Symbols): Redeclare from base class.
1684 (class Sized_relobj::local_got_offset_list): Remove.
1685 (class Sized_relobj::Output_sections): Redeclare from base class.
1686 (class Sized_relobj::do_for_all_local_got_entries): New function.
1687 (class Sized_relobj::write_local_symbols): Add offset parameter.
1688 (class Sized_relobj::local_symbol_offset_): Update comment.
1689 (class Sized_relobj::local_dynsym_offset_): Update comment.
1690 * options.cc (Input_arguments::add_file): Remove const.
1691 * options.h (Input_file_argument::Input_file_argument):
1692 Initialize arg_serial_ (all constructors).
1693 (Input_file_argument::set_arg_serial): New function.
1694 (Input_file_argument::arg_serial): New function.
1695 (Input_file_argument::arg_serial_): New data member.
1696 (Input_arguments::Input_arguments): Initialize file_count_.
1697 (Input_arguments::add_file): Remove const.
1698 (Input_arguments::number_of_input_files): New function.
1699 (Input_arguments::file_count_): New data member.
1700 (Command_line::number_of_input_files): Call
1701 Input_arguments::number_of_input_files.
1702 * output.cc (Output_segment_headers::Output_segment_headers):
1703 Set current size.
1704 (Output_section::Input_section::current_data_size): New function.
1705 (Output_section::Output_section): Initialize new data members.
1706 (Output_section::add_input_section): Don't do merge sections for
1707 an incremental link; allocate space from free list for an
1708 incremental update.
1709 (Output_section::add_output_section_data): Allocate space from
1710 free list for an incremental update.
1711 (Output_section::update_data_size): New function.
1712 (Output_section::set_fixed_layout): New function.
1713 (Output_section::reserve): New function.
1714 (Output_segment::set_section_addresses): Remove const.
1715 (Output_segment::set_section_list_addresses): Remove const; allocate
1716 space from free list for an incremental update.
1717 (Output_segment::set_offset): Adjust size of RELRO segment for an
1718 incremental update.
1719 * output.h (Output_data::current_data_size): Move here from
1720 child classes.
1721 (Output_data::pre_finalize_data_size): New function.
1722 (Output_data::update_data_size): New function.
1723 (Output_section_headers::update_data_size): new function.
1724 (Output_section_data_build::current_data_size): Move to Output_data.
1725 (Output_data_strtab::update_data_size): New function.
1726 (Output_section::current_data_size): Move to Output_data.
1727 (Output_section::set_fixed_layout): New function.
1728 (Output_section::has_fixed_layout): New function.
1729 (Output_section::reserve): New function.
1730 (Output_section::update_data_size): New function.
1731 (Output_section::has_fixed_layout_): New data member.
1732 (Output_section::free_list_): New data member.
1733 (Output_segment::set_section_addresses): Remove const.
1734 (Output_segment::set_section_list_addresses): Remove const.
1735 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1736 New function.
1737 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1738 New function.
1739 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1740 parameter when calling Add_symbols constructor; store argument
1741 serial number for members of a lib group.
1742 (Add_symbols::locks): Allow case where token == NULL.
1743 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1744 (Read_member::~Read_member): New function.
1745 (Read_member::is_runnable): New function.
1746 (Read_member::locks): New function.
1747 (Read_member::run): New function.
1748 (Check_script::~Check_script): New function.
1749 (Check_script::is_runnable): New function.
1750 (Check_script::locks): New function.
1751 (Check_script::run): New function.
1752 (Check_library::~Check_library): New function.
1753 (Check_library::is_runnable): New function.
1754 (Check_library::locks): New function.
1755 (Check_library::run): New function.
1756 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1757 (Add_symbols::library_): New data member.
1758 (class Read_member): New class.
1759 (class Check_script): New class.
1760 (class Check_library): New class.
1761 * reloc.cc (Read_relocs::is_runnable): Allow case where
1762 token == NULL.
1763 (Read_relocs::locks): Likewise.
1764 (Scan_relocs::locks): Likewise.
1765 (Relocate_task::locks): Likewise.
1766 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1767 to clear counters.
1768 (Sized_relobj::incremental_relocs_scan): Fix comment.
1769 (Sized_relobj::do_relocate): Pass output file offset to
1770 write_local_symbols.
1771 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1772 from class declaration.
1773 * script.cc (read_input_script): Allocate Script_info; pass
1774 argument serial number to report_script.
1775 * script.h (class Script_info): Move to incremental.h.
1776 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1777 * symtab.h (Symbol_table::add_from_incrobj): New function.
1778 (Symbol_table::set_file_offset): New function.
1779
1780 2011-04-05 Cary Coutant <ccoutant@google.com>
1781
1782 * incremental-dump.cc (dump_incremental_inputs): Change signature
1783 to take a Sized_incremental_binary; change caller. Use readers
1784 in Sized_incremental_binary.
1785 * incremental.cc
1786 (Sized_incremental_binary::find_incremental_inputs_sections):
1787 Rename do_find_incremental_inputs_sections to this.
1788 (Sized_incremental_binary::setup_readers): New function.
1789 (Sized_incremental_binary::do_check_inputs): Check
1790 has_incremental_info_ flag; move setup code to setup_readers;
1791 use input readers.
1792 (Sized_incremental_binary::do_file_is_unchanged): New function.
1793 (Sized_incremental_binary::do_get_input_reader): New function.
1794 * incremental.h (class Incremental_binary): Move to end of file.
1795 (Incremental_binary::file_is_unchanged): New function.
1796 (Incremental_binary::do_file_is_unchanged): New function.
1797 (Incremental_binary::Input_reader): New class.
1798 (Incremental_binary::get_input_reader): New function.
1799 (class Sized_incremental_binary): Move to end of file.
1800 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1801 input section reader classes.
1802 (Sized_incremental_binary::has_incremental_info): New function.
1803 (Sized_incremental_binary::inputs_reader): New function.
1804 (Sized_incremental_binary::symtab_reader): New function.
1805 (Sized_incremental_binary::relocs_reader): New function.
1806 (Sized_incremental_binary::got_plt_reader): New function.
1807 (Sized_incremental_binary::do_file_is_unchanged): New function.
1808 (Sized_incremental_binary::Sized_input_reader): New class.
1809 (Sized_incremental_binary::get_input_reader): New function.
1810 (Sized_incremental_binary::find_incremental_inputs_sections):
1811 Rename do_find_incremental_inputs_sections to this.
1812 (Sized_incremental_binary::setup_readers): New function.
1813 (Sized_incremental_binary::has_incremental_info_): New data member.
1814 (Sized_incremental_binary::inputs_reader_): New data member.
1815 (Sized_incremental_binary::symtab_reader_): New data member.
1816 (Sized_incremental_binary::relocs_reader_): New data member.
1817 (Sized_incremental_binary::got_plt_reader_): New data member.
1818 (Sized_incremental_binary::current_input_file_): New data member.
1819
1820 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1821
1822 PR gold/12640
1823 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1824 violation.
1825
1826 2011-03-30 Cary Coutant <ccoutant@google.com>
1827
1828 * archive.cc (Archive::include_member): Adjust call to report_object.
1829 (Add_archive_symbols::run): Add script_info to call to
1830 report_archive_begin.
1831 (Lib_group::include_member): Adjust call to report_object.
1832 (Add_lib_group_symbols::run): Adjust call to report_object.
1833 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1834 blocks. Add object count for script input files.
1835 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1836 script_info parameter; change all callers.
1837 (Incremental_inputs::report_object): Add script_info parameter;
1838 change all callers.
1839 (Incremental_inputs::report_script): Store backpointer to
1840 incremental info entry.
1841 (Output_section_incremental_inputs::set_final_data_size): Record
1842 additional information for scripts.
1843 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1844 * incremental.h (Incremental_script_entry::add_object): New function.
1845 (Incremental_script_entry::get_object_count): New function.
1846 (Incremental_script_entry::get_object): New function.
1847 (Incremental_script_entry::objects_): New data member; adjust
1848 constructor.
1849 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1850 (Incremental_inputs::report_object): Add script_info parameter.
1851 (Incremental_inputs_reader::get_object_count): New function.
1852 (Incremental_inputs_reader::get_object_offset): New function.
1853 * options.cc (Input_arguments::add_file): Return reference to
1854 new input argument.
1855 * options.h (Input_argument::set_script_info): New function.
1856 (Input_argument::script_info): New function.
1857 (Input_argument::script_info_): New data member; adjust all
1858 constructors.
1859 (Input_file_group::add_file): Return reference to new input argument.
1860 (Input_file_lib::add_file): Likewise.
1861 (Input_arguments::add_file): Likewise.
1862 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1863 * script.cc (Parser_closure::Parser_closure): Add script_info
1864 parameter; adjust all callers.
1865 (Parser_closure::script_info): New function.
1866 (Parser_closure::script_info_): New data member.
1867 (read_input_script): Report scripts earlier to incremental info.
1868 (script_add_file): Set script_info in Input_argument.
1869 (script_add_library): Likewise.
1870 * script.h (Script_options::Script_info): Rewrite class.
1871
1872 2011-03-29 Cary Coutant <ccoutant@google.com>
1873
1874 * archive.cc (Library_base::should_include_member): Move
1875 method here from class Archive.
1876 (Archive::Archive): Initialize base class.
1877 (Archive::should_include_member): Move to base class.
1878 (Archive::do_for_all_unused_symbols): New function.
1879 (Add_archive_symbols::run): Remove redundant access to
1880 incremental_inputs.
1881 (Lib_group::Lib_group): Initialize base class.
1882 (Lib_group::do_filename): New function.
1883 (Lib_group::include_member): Pass pointer to Lib_group to
1884 report_object.
1885 (Lib_group::do_for_all_unused_symbols): New function.
1886 (Add_lib_group_symbols::run): Report archive information for
1887 incremental links.
1888 * archive.h (class Library_base): New base class.
1889 (class Archive): Derive from Library_base.
1890 (Archive::filename): Move to base class.
1891 (Archive::set_incremental_info): Likewise.
1892 (Archive::incremental_info): Likewise.
1893 (Archive::Should_include): Likewise.
1894 (Archive::should_include_member): Likewise.
1895 (Archive::Armap_entry): Remove.
1896 (Archive::Unused_symbol_iterator): Remove.
1897 (Archive::unused_symbols_begin): Remove.
1898 (Archive::unused_symbols_end): Remove.
1899 (Archive::do_filename): New function.
1900 (Archive::do_get_mtime): New function.
1901 (Archive::do_for_all_unused_symbols): New function.
1902 (Archive::task_): Move to base class.
1903 (Archive::incremental_info_): Likewise.
1904 (class Lib_group): Derive from Library_base.
1905 (Lib_group::do_filename): New function.
1906 (Lib_group::do_get_mtime): New function.
1907 (Lib_group::do_for_all_unused_symbols): New function.
1908 (Lib_group::task_): Move to base class.
1909 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1910 function.
1911 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1912 function.
1913 * incremental.cc (Incremental_inputs::report_archive_begin):
1914 Use Library_base; call library's get_mtime; add incremental inputs
1915 entry before members.
1916 (class Unused_symbol_visitor): New class.
1917 (Incremental_inputs::report_archive_end): Use Library_base; use
1918 visitor class to record unused symbols; don't add incremental inputs
1919 entry after members.
1920 (Incremental_inputs::report_object): Use Library_base.
1921 * incremental.h
1922 (Incremental_archive_entry::Incremental_archive_entry): Remove
1923 unused Archive parameter.
1924 (Incremental_inputs::report_archive_begin): Use Library_base.
1925 (Incremental_inputs::report_archive_end): Likewise.
1926 (Incremental_inputs::report_object): Likewise.
1927 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1928 function.
1929 * object.h (Object::for_all_global_symbols): New function.
1930 (Object::do_for_all_global_symbols): New function.
1931 (Sized_relobj::do_for_all_global_symbols): New function.
1932 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1933 function.
1934 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1935 function.
1936
1937 2011-03-27 Ian Lance Taylor <iant@google.com>
1938
1939 * archive.cc (Archive::interpret_header): Return -1 if something
1940 goes wrong. Change callers accordingly.
1941
1942 2011-03-25 Cary Coutant <ccoutant@google.com>
1943
1944 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1945 * testsuite/Makefile.in: Regenerate.
1946
1947 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1948
1949 * plugin.cc (get_view): New.
1950 (Plugin::load): Pass get_view to the plugin.
1951 (Plugin_manager::get_view): New.
1952
1953 2011-03-21 Ian Lance Taylor <iant@google.com>
1954
1955 * testsuite/final_layout.sh: Rewrite to not use dc.
1956 * testsuite/relro_test.sh: Fail if dc is not present.
1957
1958 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1959
1960 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1961 Change == to -eq.
1962 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1963 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1964 Change == to -eq.
1965 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1966 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1967
1968 2011-03-14 Ian Lance Taylor <iant@google.com>
1969
1970 * script-sections.cc (Sort_output_sections::script_compare):
1971 Rename from is_before, change return type.
1972 (Sort_output_sections::operator()): Adjust accordingly.
1973
1974 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1975
1976 PR gold/12572
1977 * testsuite/odr_violation2.cc: Add comment to make all error line
1978 numbers double digits.
1979 * testsuite/debug_msg.sh: Adjust expected errors.
1980
1981 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1982
1983 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1984 but mark earlier ones as non-canonical
1985 (offset_to_iterator): Update search target and example
1986 (do_addr2line): Return extra lines in a vector*
1987 (format_file_lineno): Extract from do_addr2line
1988 (one_addr2line): Add vector* out-param
1989 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1990 when a lineno entry appeared last for its instruction
1991 (Dwarf_line_info): Add vector* out-param
1992 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1993 * symtab.cc (Odr_violation_compare): Include the lineno in the
1994 comparison again.
1995 (linenos_from_loc): New. Combine the canonical line for an
1996 address with its other lines.
1997 (True_if_intersect): New. Helper functor to make
1998 std::set_intersection a query.
1999 (detect_odr_violations): Compare sets of lines instead of just
2000 one line for each function. This became less deterministic, but
2001 has fewer false positives.
2002 * symtab.h: Declarations.
2003 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
2004 mix an optimized and non-optimized object in the same binary
2005 (odr_violation2.so): Same.
2006 * testsuite/Makefile.in: Regenerate from Makefile.am.
2007 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
2008 * testsuite/debug_msg.sh: Update line numbers and add
2009 assertions.
2010 * testsuite/odr_violation1.cc: Use OdrDerived, in a
2011 non-optimized context.
2012 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
2013 isn't inlined, and use OdrDerived in an optimized context.
2014 * testsuite/odr_header1.h: Defines OdrDerived, where
2015 optimization will change the
2016 first-instruction-in-the-destructor's file and line number.
2017 * testsuite/odr_header2.h: Defines OdrBase.
2018
2019 2011-03-09 Ian Lance Taylor <iant@google.com>
2020
2021 * fileread.cc (File_read::clear_views): Don't delete the whole
2022 file view.
2023
2024 2011-03-08 Ian Lance Taylor <iant@google.com>
2025
2026 PR gold/12525
2027 * fileread.cc: #include <climits>.
2028 (GOLD_IOV_MAX): Define.
2029 (File_read::read_multiple): Limit number of entries by iov_max.
2030 * fileread.h (class File_read): Always set max_readv_entries to
2031 128.
2032
2033 2011-03-07 Ian Lance Taylor <iant@google.com>
2034
2035 PR gold/12525
2036 * options.h (class General_options): Add -dy and -dn.
2037
2038 2011-03-02 Cary Coutant <ccoutant@google.com>
2039
2040 * testsuite/script_test_9.t: Add TLS segment.
2041
2042 2011-03-02 Simon Baldwin <simonb@google.com>
2043
2044 * configure.ac: Add check for gnu_indirect_function support in
2045 the toolchain building binutils.
2046 * configure: Rebuild.
2047
2048 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
2049
2050 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
2051 plugin only symbols.
2052 (Symbol_table::sized_finalize_symbol) Mark symbol only present
2053 in plugin files as not needed in the symbol table.
2054
2055 2011-02-11 Sriraman Tallam <tmsriram@google.com>
2056
2057 * output.cc (Output_section::add_input_section): Delay fill
2058 generation for section ordering.
2059
2060 2011-02-09 Ian Lance Taylor <iant@google.com>
2061
2062 PR gold/12316
2063 * object.h (class Sized_relobj): Remove clear_local_symbols.
2064 * reloc.cc (Sized_relobj::do_relocate): Don't call
2065 clear_local_symbols.
2066
2067 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
2068
2069 * plugin.cc (is_visible_from_outside): Return true for symbols
2070 in the -u option.
2071
2072 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
2073
2074 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
2075 filename.
2076
2077 2011-02-02 Sriraman Tallam <tmsriram@google.com>
2078
2079 * icf.h (is_section_foldable_candidate): Change type of parameter
2080 to std::string.
2081 * icf.cc (Icf::find_identical_sections): Change type of local variable
2082 section_name to be std::string.
2083 (is_function_ctor_or_dtor): Change type of parameter to std::string.
2084
2085 2011-01-25 Ian Lance Taylor <iant@google.com>
2086
2087 * script.cc (script_add_extern): Rewrite to use
2088 add_symbol_reference.
2089
2090 2011-01-25 Doug Kwan <dougkwan@google.com>
2091
2092 * icf.cc (get_section_contents): Always lock section's object.
2093
2094 2011-01-24 Ian Lance Taylor <iant@google.com>
2095
2096 * options.h (class General_options): Accept
2097 --no-detect-odr-violations.
2098
2099 2011-01-24 Ian Lance Taylor <iant@google.com>
2100
2101 * version.cc (version_string): Bump to 1.11.
2102
2103 2011-01-24 Ian Lance Taylor <iant@google.com>
2104
2105 * plugin.cc (class Plugin_rescan): Define new class.
2106 (Plugin_manager::claim_file): Set any_claimed_.
2107 (Plugin_manager::save_archive): New function.
2108 (Plugin_manager::save_input_group): New function.
2109 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
2110 necessary.
2111 (Plugin_manager::new_undefined_symbol): New function.
2112 (Plugin_manager::rescan): New function.
2113 (Plugin_manager::rescannable_defines): New function.
2114 (Plugin_manager::add_input_file): Set any_added_.
2115 * plugin.h (class Plugin_manager): define new fields rescannable_,
2116 undefined_symbols_, any_claimed_, and any_added_. Declare
2117 Plugin_rescan as friend. Declare new functions.
2118 (Plugin_manager::Rescannable): Define type.
2119 (Plugin_manager::Rescannable_list): Define type.
2120 (Plugin_manager::Undefined_symbol_list): Define type.
2121 (Plugin_manager::Plugin_manager): Initialize new fields.
2122 * archive.cc (Archive::defines_symbol): New function.
2123 (Add_archive_symbols::run): Pass archive to plugins if any.
2124 * archive.h (class Archive): Declare defines_symbol.
2125 * readsyms.cc (Input_group::~Input_group): New function.
2126 (Finish_group::run): Pass input_group to plugins if any.
2127 * readsyms.h (class Input_group): Declare destructor.
2128 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
2129 any.
2130
2131 2011-01-10 Ian Lance Taylor <iant@google.com>
2132
2133 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
2134 section as relro.
2135 (Layout::set_segment_offsets): Reset increase_relro before calling
2136 set_section_addresses a second time.
2137
2138 2011-01-04 Cary Coutant <ccoutant@google.com>
2139
2140 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
2141 sections before NOBITS sections.
2142
2143 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
2144
2145 * version.cc (print_version): Update copyright to 2011.
2146
2147 2010-12-23 Cary Coutant <ccoutant@google.com>
2148
2149 * output.h (Output_data_reloc::add_output_section): Pass OD instead
2150 of OS to this->add. Add OD parameter to second form of the function.
2151
2152 2010-12-20 Ian Lance Taylor <iant@google.com>
2153
2154 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
2155 second of two consecutive entries with same offset.
2156
2157 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2158
2159 * testsuite/Makefile.am (ifuncmain2static_LDADD)
2160 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
2161 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
2162 to avoid unneeded links against $(LDADD).
2163 * testsuite/Makefile.in: Regenerate.
2164
2165 2010-12-15 Ian Lance Taylor <iant@google.com>
2166
2167 PR gold/12324
2168 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
2169 for R_X86_64_32 and R_X86_64_PC32.
2170 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
2171 ver_matching_def_pic.o.
2172 (ver_matching_def_pic.o): New target.
2173
2174 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2175
2176 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
2177 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
2178 Move definition before File_read::View member definitions.
2179 (File_read::View::~View): Initialize and hold lock before
2180 updating current_mapped_bytes.
2181
2182 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2183
2184 * dwarf_reader.cc: Remove outdated comment.
2185 * gold-threads.cc: Fix typo in error message.
2186 * archive.cc: Fix typos in comments.
2187 * archive.h: Likewise.
2188 * arm-reloc-property.cc: Likewise.
2189 * arm-reloc-property.h: Likewise.
2190 * arm-reloc.def: Likewise.
2191 * arm.cc: Likewise.
2192 * attributes.h: Likewise.
2193 * cref.cc: Likewise.
2194 * ehframe.cc: Likewise.
2195 * fileread.h: Likewise.
2196 * gold.h: Likewise.
2197 * i386.cc: Likewise.
2198 * icf.cc: Likewise.
2199 * incremental.h: Likewise.
2200 * int_encoding.cc: Likewise.
2201 * layout.h: Likewise.
2202 * main.cc: Likewise.
2203 * merge.h: Likewise.
2204 * object.cc: Likewise.
2205 * object.h: Likewise.
2206 * options.cc: Likewise.
2207 * readsyms.cc: Likewise.
2208 * reduced_debug_output.cc: Likewise.
2209 * reloc.cc: Likewise.
2210 * script-sections.cc: Likewise.
2211 * sparc.cc: Likewise.
2212 * symtab.h: Likewise.
2213 * target-reloc.h: Likewise.
2214 * target.cc: Likewise.
2215 * target.h: Likewise.
2216 * timer.cc: Likewise.
2217 * timer.h: Likewise.
2218 * x86_64.cc: Likewise.
2219
2220 2010-12-09 Cary Coutant <ccoutant@google.com>
2221
2222 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2223 stack.
2224 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2225 parameter; change all callers.
2226 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2227 * options.h (warn_execstack): New option.
2228
2229 2010-12-07 Doug Kwan <dougkwan@google.com>
2230
2231 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2232 like function call relocations.
2233
2234 2010-12-07 Ian Lance Taylor <iant@google.com>
2235
2236 * archive.cc (Archive::get_elf_object_for_member): Permit
2237 punconfigured to be NULL.
2238 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2239 (Archive::include_member): Pass NULL to get_elf_object_for_member
2240 if we searched for the archive and this is the first included
2241 object.
2242
2243 2010-12-01 Ian Lance Taylor <iant@google.com>
2244
2245 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2246 track_relocs_type_ field.
2247 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2248 Set track_relocs_type_.
2249 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2250 contents when using RELA relocs.
2251 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2252 reloc_map_.
2253 * reloc.cc (Track_relocs::next_addend): New function.
2254 * reloc.h (class Track_relocs): Declare next_addend.
2255
2256 2010-12-01 Ian Lance Taylor <iant@google.com>
2257
2258 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2259 virtual destructor.
2260
2261 2010-12-01 Ian Lance Taylor <iant@google.com>
2262
2263 * README: Update compilers known to work and fail.
2264
2265 2010-11-23 Matthias Klose <doko@ubuntu.com>
2266
2267 * configure.in: For --enable-gold, handle value `default' instead of
2268 `both*'. Always install ld as ld.bfd, install as ld if gold is
2269 not the default.
2270 * configure: Regenerate.
2271
2272 2010-11-18 Doug Kwan <dougkwan@google.com>
2273
2274 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2275 and right_alignment to be zero. Store result alignment only if it is
2276 greater than existing alignment.
2277
2278 2010-11-16 Cary Coutant <ccoutant@google.com>
2279
2280 PR gold/12220
2281 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2282 Check for ".zdebug_line".
2283
2284 2010-11-16 Doug Kwan <dougkwan@google.com>
2285 Cary Coutant <ccoutant@google.com>
2286
2287 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2288 by reference; adjust all callers.
2289 * output.cc (Output_segment::set_section_addresses): Adjust references
2290 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2291 list is empty.
2292 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2293 end at page boundary.
2294
2295 2010-11-16 Cary Coutant <ccoutant@google.com>
2296
2297 PR gold/12220
2298 * layout.cc (Layout::choose_output_section): Transform names of
2299 compressed sections even when using a script with a SECTIONS clause.
2300 (Layout::output_section_name): Remove code to transform
2301 compressed debug section names.
2302 * output.cc (Output_section::add_input_section): Use uncompressed
2303 section size when tracking input sections.
2304
2305 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2306
2307 * symtab.h (Symbol::NON_PIC_REF): Remove.
2308 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2309 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2310 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2311 (Symbol::use_plt_offset): Take a flags argument and pass it
2312 directly to needs_dynamic_reloc. Restrict check for undefined
2313 weak symbols to function calls.
2314 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2315 (Target_arm::Scan::global): Use it.
2316 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2317 (Target_arm::Relocate::relocate): Likewise.
2318 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2319 parameter with an r_type parameter. Use get_reference_flags
2320 to get the flags.
2321 (Target_arm::Relocate::relocate): Update accordingly.
2322 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2323 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2324 (Target_i386::Scan::global): Likewise.
2325 (Target_i386::Relocate::relocate): Likewise.
2326 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2327 parameter with an r_type parameter. Use get_reference_flags
2328 to get the flags.
2329 (Target_i386::Relocate::relocate): Update accordingly.
2330 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2331 (Target_powerpc::Scan::global): Use it.
2332 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2333 (Target_powerpc::Relocate::relocate): Likewise.
2334 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2335 (Target_sparc::Scan::global): Use it.
2336 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2337 (Target_sparc::Relocate::relocate): Likewise.
2338 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2339 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2340 (Target_x86_64::Scan::global): Likewise.
2341 (Target_x86_64::Relocate::relocate): Likewise.
2342
2343 2010-11-08 Doug Kwan <dougkwan@google.com>
2344 Cary Coutant <ccoutant@google.com>
2345
2346 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2347 (Arm_exidx_merge_section::section_contents_): New data member.
2348 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2349 (Arm_input_section::~Arm_input_section): De-allocate memory.
2350 (Arm_input_section::original_contents_): New data member.
2351 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2352 in parameters instead of calling Object::section_contents without
2353 locking.
2354 (Arm_output_section::group_section): New parameter TASK. Pass it
2355 to callees that need locking objects.
2356 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2357 to lock EXIDX input sections. Fix a formatting issue. Call
2358 Arm_exidx_merged_section::build_contents to create merged section
2359 contents.
2360 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2361 to lock object of stub table owner.
2362 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2363 TEXT_SIZE to initialize data member TEXT_SIZE_.
2364 (Arm_exidx_input_section::addralign): Fix typo in comment.
2365 (Arm_exidx_input_section::text_size): New method.
2366 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2367 that require locking objects. Lock objects before scanning for stubs
2368 and updating local symbols.
2369 (Arm_input_section<big_endian>::init): Copy contents of original
2370 input section.
2371 (Arm_input_section<big_endian>::do_write): Use saved contents of
2372 original input section instead of calling Object::section_contents
2373 without locking.
2374 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2375 size without calling Object::section_size().
2376 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2377 for size. Allocate a buffer for merged EXIDX entries.
2378 (Arm_exidx_merged_section::build_contents): New method.
2379 (Arm_exidx_merged_section::do_write): Move merge section contents
2380 building code to Arm_exidx_merged_section::build_contetns. Write
2381 out contetns in buffer instead of building it on the fly.
2382 (Arm_relobj::make_exidx_input_section): Also pass text section size
2383 to Arm_exidx_input_section constructor.
2384 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2385 (Arm_dynobj::do_read_symbols): Fix memory leak.
2386 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2387 * target.h: (class Task): Add forward declaration.
2388 (Target::relax): Add new parameter TASK and pass it to
2389 Target::do_relax().
2390 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2391
2392 2010-11-05 Cary Coutant <ccoutant@google.com>
2393
2394 PR gold/10708
2395 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2396 object when reading from the file.
2397 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2398 second layout pass.
2399 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2400 when reading section contents.
2401 (get_section_contents): Likewise.
2402 (icf::find_identical_sections): Likewise.
2403 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2404 object when reading from the file.
2405 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2406 the object when doing deferred section layout.
2407
2408 2010-11-03 Nick Clifton <nickc@redhat.com>
2409
2410 PR gold/12001
2411 * script.h (class Symbol_assignment: name): New member. Returns
2412 the name of the symbol.
2413 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2414 Returns true if the given symbol name is on the list of
2415 assignments wating to be processed.
2416 * archive.cc (should_incldue_member): If the symbol is undefined,
2417 check to see if it is on the list of symbols pending assignment.
2418
2419 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2420
2421 * script-sections.cc (Script_sections::find_memory_region): Check
2422 for a NULL output section pointer.
2423
2424 2010-10-29 Doug Kwan <dougkwan@google.com>
2425
2426 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2427 Output_section::add_relaxed_input_section.
2428 * output.cc (Output_section::add_relaxed_input_section): Add new
2429 arguments LAYOUT and NAME. Set section order index.
2430 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2431 Copy section order index.
2432 * output.h (Output_section::add_relaxed_input_section): Add new
2433 arguments LAYOUT and NAME.
2434
2435 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2436
2437 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2438 NATIVE_OR_CROSS_LINKER.
2439 * testsuite/Makefile.in: Regenerate.
2440
2441 2010-10-20 Doug Kwan <dougkwan@google.com>
2442
2443 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2444 without SHF_LINK_ORDER flags.
2445 * layout.cc (Layout::choose_output_section): Do not filter
2446 SHF_LINK_ORDER flag in a relocatable link.
2447
2448 2010-10-17 Cary Coutant <ccoutant@google.com>
2449
2450 * output.h (Output_segment::set_section_addresses): Change function
2451 signature. Update all callers.
2452 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2453 sections.
2454 (Output_segment::set_section_addresses): Align after last TLS
2455 section. Add padding before last relro section instead of after.
2456
2457 2010-10-17 Doug Kwan <dougkwan@google.com>
2458
2459 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2460 GOT output section to be writable.
2461
2462 2010-10-14 Cary Coutant <ccoutant@google.com>
2463
2464 * debug.h (DEBUG_INCREMENTAL): New flag.
2465 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2466 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2467 mode.
2468 * incremental.cc (report_command_line): Ignore all forms of
2469 --incremental.
2470 * layout.cc (Layout::Layout): Check parameters for incremental link
2471 mode.
2472 * options.cc (General_options::parse_incremental): New function.
2473 (General_options::parse_no_incremental): New function.
2474 (General_options::parse_incremental_full): New function.
2475 (General_options::parse_incremental_update): New function.
2476 (General_options::incremental_mode_): New data member.
2477 (General_options::finalize): Check incremental_mode_.
2478 * options.h (General_options): Update help text for --incremental.
2479 Add --no-incremental, --incremental-full, --incremental-update.
2480 (General_options::Incremental_mode): New enum type.
2481 (General_options::incremental_mode): New function.
2482 (General_options::incremental_mode_): New data member.
2483 * parameters.cc (Parameters::incremental_mode_): New data member.
2484 (Parameters::set_options): Set incremental_mode_.
2485 (Parameters::set_incremental_full): New function.
2486 (Parameters::incremental): New function.
2487 (Parameters::incremental_update): New function.
2488 (set_parameters_incremental_full): New function.
2489 * parameters.h (Parameters::set_incremental_full): New function.
2490 (Parameters::incremental): New function.
2491 (Parameters::incremental_update): New function.
2492 (Parameters::incremental_mode_): New data member.
2493 (set_parameters_incremental_full): New function.
2494 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2495 incremental link mode.
2496 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2497 (Sized_relobj::do_relocate_sections): Likewise.
2498 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2499 option.
2500 * testsuite/Makefile.in: Regenerate.
2501 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2502
2503 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2504
2505 * script-sections.h (class Script_sections): Make
2506 Sections_elements typedef public.
2507 * script-sections.cc (class Sort_output_sections): Add elements_
2508 field. Add constructor which sets it; change all callers.
2509 (Sort_output_sections::is_before): New function.
2510 (Sort_output_sections::operator()): Call is_before.
2511 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2512 conditional.
2513 * testsuite/script_test_10.sh: New test. Test script section
2514 order.
2515 * testsuite/script_test_10.t: Likewise.
2516 * testsuite/script_test_10.s: Likewise.
2517 * testsuite/Makefile.am: Wrap the cross linker tests and the
2518 common tests into NATIVE_OR_CROSS_LINKER.
2519 (check_SCRIPTS): Add script_test_10.sh.
2520 (check_DATA): Add script_test_10.stdout.
2521 (script_test_10.o, script_test_10): New targets.
2522 (script_test_10.stdout): New target.
2523 * configure, testsuite/Makefile.in: Regenerate.
2524
2525 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2526
2527 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2528 error for the deprecated relocations.
2529 (Target_arm::Scan::global): Likewise.
2530 (Target_arm::Relocate::relocate): Likewise.
2531
2532 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2533
2534 * fileread.cc (Input_file::find_file): Initialize *found_name
2535 and *namep when using the fallback search for case 4.
2536
2537 2010-10-11 Cary Coutant <ccoutant@google.com>
2538
2539 * options.h (class General_options): Redefine -z lazy as an alias for
2540 the negation of -z now.
2541
2542 2010-10-11 Ian Lance Taylor <iant@google.com>
2543
2544 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2545 binding.
2546
2547 2010-10-06 Nick Clifton <nickc@redhat.com>
2548
2549 * script-sections.cc(class Memory_region): Remove
2550 current_lma_offset_ field. Rename current_vma_offset_ to
2551 current_offset_. Add last_section_ field.
2552 (Memory_region::get_current_vma_address): Rename to
2553 get_current_address.
2554 (Memory_region::get_current_lma_address): Delete.
2555 (Memory_region::increment_vma_offset): Rename to
2556 increment_offset.
2557 (Memory_region::increment_lma_offset): Delete.
2558 (Memory_region::attributes_compatible): New method. Returns
2559 true if the provided section is compatible with the region.
2560 (Memory_region::get_last_section): New method. Returns the last
2561 section to use the region.
2562 (Memory_region::set_last_section): New method. Stores the last
2563 section to use the region.
2564 (Script_sections::block_in_region): New method. Returns true if
2565 a block of memory is contained within a region.
2566 (Script_sections::find_memory_region): New method. Locates a
2567 memory region to be used to set a VMA or LMA address.
2568 (Output_section_definition::set_section_addresses): Add code to
2569 check for addresses set by memory regions.
2570 (Output_segment::set_section_addresses): Remove memory region
2571 walking code.
2572 (Script_sections::create_segment): Add a warning if a header
2573 segment is created outside of any region.
2574 * script-sections.h (class Script_sections): Add prototypes for
2575 find_memory_region and block_in_region methods.
2576 * testsuite/memory_test.s: Use .long instead of .word.
2577 * testsuite/memory_test.t: Add some more output sections.
2578 * testsuite/memory_test.sh: Update expected output.
2579
2580 2010-10-02 Doug Kwan <dougkwan@google.com>
2581
2582 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2583 defintion to symtab.h
2584 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2585 declaration to defintion.
2586
2587 2010-10-01 Nick Clifton <nickc@redhat.com>
2588
2589 * expression.cc (eval): Replace dummy argument with NULL.
2590 (eval_maybe_dot): Check for a NULL result section pointer.
2591 (Symbol_expression::value): Likewise.
2592 (Dot_expression::value): Likewise.
2593 (BINARY_EXPRESSION): Likewise.
2594 (Max_expression::value): Likewise.
2595 (Min_expression::value): Likewise.
2596 (Absolute_expression::value): Likewise.
2597 (Addr_expression::value_from_output_section): Likewise.
2598 (Loaddddr_expression::value_from_output_section): Likewise.
2599 (Segment_start_expression::value): Likewise.
2600 * script-sections.cc
2601 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2602 argument with NULL.
2603 (Sections_elememt_dot_assignment::set_section_addresses):
2604 Likewise.
2605 (Output_data_expression::do_write_to_buffer): Likewise.
2606 (Output_section_definition::finalize_symbols): Likewise.
2607 (Output_section_definition::set_section_addresses): Likewise.
2608
2609 2010-09-30 Doug Kwan <dougkwan@google.com>
2610
2611 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2612
2613 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2614
2615 * target.h (Target::can_icf_inline_merge_sections): New virtual
2616 function.
2617 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2618 virtual function.
2619 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2620 virtual function.
2621 * icf.cc (get_section_contents): Inline merge sections only when
2622 target allows it.
2623
2624 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2625
2626 * configure: Regenerate.
2627
2628 2010-09-17 Ian Lance Taylor <iant@google.com>
2629
2630 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2631 * testsuite/Makefile.am (memory_test.o): New target.
2632 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2633 memory_test.t.
2634 * testsuite/Makefile.in: Rebuild.
2635
2636 2010-09-17 Doug Kwan <dougkwan@google.com>
2637
2638 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2639 defintion if relocation uses GOT entries of the symbol.
2640 * testsuite/icf_safe_test.sh: Fix test.
2641 * testsuite/icf_safe_so_test.sh: Fix test.
2642
2643 2010-09-16 Cary Coutant <ccoutant@google.com>
2644
2645 * script_sections.cc (class Memory_region): Remove "NULL" from
2646 vector initializations.
2647
2648 2010-09-15 Cary Coutant <ccoutant@google.com>
2649
2650 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2651 Resolve forwarding symbols.
2652
2653 2010-09-15 Doug Kwan <dougkwan@google.com>
2654
2655 * gold/testsuite/script_test_3.t: Add ARM special sections.
2656 * gold/testsuite/script_test_4.t: Same.
2657 * gold/testsuite/script_test_5.t: Same.
2658 * gold/testsuite/script_test_6.t: Same.
2659 * gold/testsuite/script_test_7.t: Same.
2660 * gold/testsuite/script_test_7.t: Same.
2661 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2662
2663 2010-09-14 Cary Coutant <ccoutant@google.com>
2664
2665 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2666 (Target_x86_64::Relocate::relocate_tls): Replace check for
2667 saw_tls_block_reloc_ with test for executable section.
2668
2669 2010-09-12 Cary Coutant <ccoutant@google.com>
2670
2671 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2672 position-independent executables to shared libraries need dynamic
2673 relocations.
2674 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2675 position-independent executables.
2676 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2677 * testsuite/Makefile.in: Regenerate.
2678
2679 2010-09-10 Nick Clifton <nickc@redhat.com>
2680
2681 PR gold/11997
2682 * testsuite/memory_test.t: Discard any sections that are not
2683 needed.
2684
2685 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2686
2687 PR gold/11996
2688 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2689 "This::" to work around a bug in gcc 4.2.
2690
2691 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2692
2693 2010-09-09 Rafael Espindola <espindola@google.com>
2694
2695 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2696 sections with different PF_X flags in the same segment.
2697 (Layout::find_first_load_seg): Search all segments to find the first
2698 one.
2699 * options.h (rosegment): New.
2700
2701 2010-09-08 Rafael Espindola <espindola@google.com>
2702
2703 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2704
2705 2010-09-08 Doug Kwan <dougkwan@google.com>
2706
2707 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2708 (Arm_relobj::do_relocate_sections): Add new parameter for output
2709 file to match the parent.
2710 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2711 of local symbols instead of input values. Update code to track
2712 changes in gold::relocate_section.
2713 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2714 (Sized_relobj::compute_final_local_value_internal): New methods.
2715 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2716 body into private version of Sized_relobj::compute_final_local_value.
2717 Call the inline method.
2718 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2719 merged symbol value if there is one.
2720 (Symbol_value::has_output_value): New method defintiion.
2721 (Sized_relobj::Compute_final_local_value_status): New enum type.
2722 (Sized_relobj::compute_final_local_value): New methods.
2723 (Sized_relobj::compute_final_local_value_internal): New methods.
2724 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2725 and arm_cortex_a8.sh.
2726 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2727 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2728 New tests.
2729 * Makefile.in: Regenerate.
2730 * testsuite/arm_bl_out_of_range.s: Update test.
2731 * testsuite/thumb_bl_out_of_range.s: Ditto.
2732 * testsuite/thumb_blx_out_of_range.s: Ditto.
2733 * testsuite/arm_branch_out_of_range.sh: New file.
2734 * testsuite/arm_cortex_a8.sh: Ditto.
2735 * testsuite/arm_cortex_a8_b.s: Ditto.
2736 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2737 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2738 * testsuite/arm_cortex_a8_bl.s: Ditto.
2739 * testsuite/arm_cortex_a8_blx.s: Ditto.
2740 * testsuite/arm_cortex_a8_local.s: Ditto.
2741 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2742 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2743
2744 2010-09-08 Rafael Espindola <espindola@google.com>
2745
2746 * Makefile.am (memory_test.stdout): Run readelf with -W.
2747 * Makefile.in: Regenerate.
2748 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2749 64 bit output.
2750
2751 2010-09-08 Rafael Espindola <espindola@google.com>
2752
2753 * script-sections.cc (Script_sections::add_memory_region): Convert
2754 field precision to int.
2755 * script.cc (script_set_section_region, script_set_section_region):
2756 Convert field precision to int.
2757
2758 2010-09-08 Rafael Espindola <espindola@google.com>
2759
2760 * arm.cc (do_finalize_sections): Create the __exidx_start and
2761 __exdix_end symbols even when the section is missing.
2762
2763 2010-09-08 Nick Clifton <nickc@redhat.com>
2764
2765 * README: Remove claim that MEMORY is not supported.
2766 * expression.cc (script_exp_function_origin)
2767 (script_exp_function_length): Move from here to ...
2768 * script.cc: ... here.
2769 (script_set_section_region, script_add_memory)
2770 (script_parse_memory_attr, script_include_directive): New
2771 functions.
2772 * script-sections.cc
2773 (class Memory_region): New class.
2774 (class Output_section_definition): Add set_memory_region,
2775 set_section_vma, set_section_lma and get_section_name methods.
2776 (class Script_Sections): Add add_memory_region,
2777 find_memory_region, find_memory_region_origin,
2778 find_memory_region_length and set_memory_region methods.
2779 Have set_section_addresses method walk the list of set memory
2780 regions.
2781 Extend the print methos to display memory regions.
2782 * script-sections.h: Add prototypes for new methods.
2783 Add enum for MEMORY region attributes.
2784 * yyscript.y: Add support for parsing MEMORY regions.
2785 * script-c.h: Add prototypes for new functions.
2786 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2787 * testsuite/Makefile.in: Regenerate.
2788 * testsuite/memory_test.sh: New script.
2789 * testsuite/memory_test.s: New assembler source file.
2790 * testsuite/memory_test.t: New linker script.
2791
2792 2010-08-27 Doug Kwan <dougkwan@google.com>
2793
2794 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2795 reference override an existing dynamic weak reference.
2796 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2797 * testsuite/Makefile.in: Regenerate.
2798 * testsuite/dyn_weak_ref.sh: New file.
2799 * testsuite/dyn_weak_ref_1.c: Ditto.
2800 * testsuite/dyn_weak_ref_2.c: Ditto.
2801
2802 2010-08-27 Ian Lance Taylor <iant@google.com>
2803
2804 * incremental.h (class Incremental_input_entry): Add virtual
2805 destructor.
2806
2807 2010-08-27 Ian Lance Taylor <iant@google.com>
2808
2809 * testsuite/start_lib_test_3.c: Mark t3 as used.
2810
2811 2010-08-27 Nick Clifton <nickc@redhat.com>
2812
2813 * options.cc (version_script): Fix small typo in previous
2814 whitespace tidyup.
2815
2816 2010-08-25 Nick Clifton <nickc@redhat.com>
2817
2818 * archive.cc: Formatting fixes: Remove whitespace between
2819 typename and following asterisk. Remove whitespace between
2820 function name and opening parenthesis.
2821 * archive.h: Likewise.
2822 * arm.cc: Likewise.
2823 * attributes.cc: Likewise.
2824 * attributes.h: Likewise.
2825 * common.cc: Likewise.
2826 * copy-relocs.cc: Likewise.
2827 * dirsearch.h: Likewise.
2828 * dynobj.cc: Likewise.
2829 * ehframe.cc: Likewise.
2830 * ehframe.h: Likewise.
2831 * expression.cc: Likewise.
2832 * fileread.cc: Likewise.
2833 * fileread.h: Likewise.
2834 * gc.h: Likewise.
2835 * gold-threads.cc: Likewise.
2836 * gold.cc: Likewise.
2837 * i386.cc: Likewise.
2838 * icf.h: Likewise.
2839 * incremental-dump.cc: Likewise.
2840 * incremental.cc: Likewise.
2841 * layout.cc: Likewise.
2842 * layout.h: Likewise.
2843 * main.cc: Likewise.
2844 * merge.cc: Likewise.
2845 * merge.h: Likewise.
2846 * object.cc: Likewise.
2847 * object.h: Likewise.
2848 * options.cc: Likewise.
2849 * options.h: Likewise.
2850 * output.cc: Likewise.
2851 * output.h: Likewise.
2852 * plugin.cc: Likewise.
2853 * plugin.h: Likewise.
2854 * powerpc.cc: Likewise.
2855 * reloc.cc: Likewise.
2856 * script-c.h: Likewise.
2857 * script-sections.cc: Likewise.
2858 * script.cc: Likewise.
2859 * stringpool.cc: Likewise.
2860 * symtab.cc: Likewise.
2861 * symtab.h: Likewise.
2862 * target.cc: Likewise.
2863 * timer.cc: Likewise.
2864 * timer.h: Likewise.
2865 * version.cc: Likewise.
2866 * x86_64.cc: Likewise.
2867
2868 2010-08-24 Nick Clifton <nickc@redhat.com>
2869
2870 PR 11899
2871 * layout.cc (segment_precedes): Sort segments by their physical
2872 addresses, if they have been set.
2873
2874 2010-08-23 Cary Coutant <ccoutant@google.com>
2875
2876 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2877 symbols data.
2878 (Lib_group::include_member): Unlock object after deleting its
2879 symbols data.
2880 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2881 the bug fixed here.
2882
2883 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2884 Cary Coutant <ccoutant@google.com>
2885
2886 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2887 constructor, and set_blocker.
2888 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2889 readsyms_blocker_.
2890 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2891 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2892 * testsuite/Makefile.am (start_lib_test): New test case.
2893 * testsuite/Makefile.in: Regenerate.
2894 * testsuite/start_lib_test_main.c: New file.
2895 * testsuite/start_lib_test_1.c: New file.
2896 * testsuite/start_lib_test_2.c: New file.
2897 * testsuite/start_lib_test_3.c: New file.
2898
2899 2010-08-19 Ian Lance Taylor <iant@google.com>
2900
2901 * Makefile.in: Rebuild with automake 1.11.1.
2902 * aclocal.m4: Likewise.
2903 * testsuite/Makefile.in: Likewise.
2904
2905 2010-08-19 Ian Lance Taylor <iant@google.com>
2906
2907 PR 10893
2908 * i386.cc (class Output_data_plt_i386): Update declarations.
2909 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2910 local_ifuncs_ fields.
2911 (Target_i386::do_plt_section_for_global): New function.
2912 (Target_i386::do_plt_section_for_local): New function.
2913 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2914 parameter; change all callers. Initialize global_ifuncs_ and
2915 local_ifuncs_. If doing a static link define __rel_iplt_start and
2916 __rel_iplt_end.
2917 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2918 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2919 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2920 symbols.
2921 (Target_i386::make_plt_section): New function, broken out of
2922 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2923 (Target_i386::make_plt_entry): Call make_plt_section.
2924 (Target_i386::make_local_ifunc_plt_entry): New function.
2925 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2926 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2927 R_386_IRELATIVE to switch.
2928 (Target_i386::Scan::global): Likewise.
2929 (Target_i386::Relocate::relocate): Likewise.
2930 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2931 switch.
2932 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2933 (Target_x86_64::do_plt_section_for_global): New function.
2934 (Target_x86_64::do_plt_section_for_local): New function.
2935 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2936 parameter; change all callers. If doing a static link define
2937 __rela_iplt_start and __rela_iplt_end.
2938 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2939 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2940 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2941 to point to .plt.
2942 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2943 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2944 switch.
2945 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2946 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2947 R_X86_64_IRELATIVE to switch.
2948 (Target_x86_64::Scan::global): Likewise.
2949 (Target_x86_64::Relocate::relocate): Likewise.
2950 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2951 switch.
2952 * target.h (class Target): Add plt_section_for_global and
2953 plt_section_for_local functions. Add do_plt_section_for_global
2954 and do_plt_section_for_local virtual functions.
2955 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2956 clarifying comments.
2957 (Symbol::use_plt_offset): Handle IFUNC symbol.
2958 * object.cc (Sized_relobj::Sized_relobj): Initialize
2959 local_plt_offsets_.
2960 (Sized_relobj::local_has_plt_offset): New function.
2961 (Sized_relobj::local_plt_offset): New function.
2962 (Sized_relobj::set_local_plt_offset): New function.
2963 (Sized_relobj::do_count): Handle IFUNC symbol.
2964 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2965 a bit away from input_shndx_ field. Add set_is_func_symbol and
2966 is_ifunc_symbol functions.
2967 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2968 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2969 local_plt_offsets_ field.
2970 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2971 * output.h (class Output_section_data): Add non-const
2972 output_section function.
2973 (class Output_data_got): Update declarations.
2974 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2975 Add use_plt_offset parameter to global and local constructors.
2976 Change all callers. Change local_sym_index_ field to 31 bits.
2977 Change GSYM_CODE and CONSTANT_CODE accordingly.
2978 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2979 doing a static link don't set sh_link field.
2980 (Output_data_got::Got_entry::write): Use PLT offset if
2981 appropriate.
2982 (Output_data_got::add_global_plt): New function.
2983 (Output_data_got::add_local_plt): New function.
2984 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2985 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2986 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2987 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2988 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2989 IFUNC conditional.
2990 * testsuite/ifunc-sel.h: New file.
2991 * testsuite/ifuncmain1.c: New file.
2992 * testsuite/ifuncmain1vis.c: New file.
2993 * testsuite/ifuncmod1.c: New file.
2994 * testsuite/ifuncdep2.c: New file.
2995 * testsuite/ifuncmain2.c: New file.
2996 * testsuite/ifuncmain3.c: New file.
2997 * testsuite/ifuncmod3.c: New file.
2998 * testsuite/ifuncmain4.c: New file.
2999 * testsuite/ifuncmain5.c: New file.
3000 * testsuite/ifuncmod5.c: New file.
3001 * testsuite/ifuncmain6pie.c: New file.
3002 * testsuite/ifuncmod6.c: New file.
3003 * testsuite/ifuncmain7.c: New file.
3004 * configure, testsuite/Makefile.in: Rebuild.
3005
3006 2010-08-18 Ian Lance Taylor <iant@google.com>
3007
3008 * incremental.cc
3009 (Output_section_incremental_inputs::write_input_files): Add cast
3010 to avoid signed/unsigned comparison warning.
3011 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3012
3013 2010-08-12 Cary Coutant <ccoutant@google.com>
3014
3015 * common.cc (Sort_commons::operator()): Remove unnecessary code.
3016
3017 2010-08-13 Ian Lance Taylor <iant@google.com>
3018
3019 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
3020
3021 2010-08-12 Cary Coutant <ccoutant@google.com>
3022 Doug Kwan <dougkwan@google.com>
3023
3024 * resolve.cc (Symbol_table::should_override): When a weak dynamic
3025 defintion overrides non-weak undef, remember that the original undef
3026 is not weak.
3027 * symtab.cc (Symbol_table::sized_write_global): For undef without
3028 an original weak binding, set binding to global in output.
3029 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
3030 * testsuite/Makefile.in: Regenerate.
3031 * testsuite/strong_ref_weak_def.sh: New file.
3032 * testsuite/strong_ref_weak_def_1.c: Ditto.
3033 * testsuite/strong_ref_weak_def_2.c: Ditto.
3034
3035 2010-08-12 Cary Coutant <ccoutant@google.com>
3036
3037 * testsuite/incremental_test.sh: Rewrite.
3038 * testsuite/incremental_test_1.c: Rewrite.
3039 * testsuite/incremental_test_2.c: Rewrite.
3040
3041 2010-08-12 Cary Coutant <ccoutant@google.com>
3042
3043 * arm.cc (Target_arm::got_size): Add const.
3044 (Target_arm::got_entry_count): New function.
3045 (Target_arm::plt_entry_count): New function.
3046 (Target_arm::first_plt_entry_offset): New function.
3047 (Target_arm::plt_entry_size): New function.
3048 (Output_data_plt_arm::entry_count): New function.
3049 (Output_data_plt_arm::first_plt_entry_offset): New function.
3050 (Output_data_plt_arm::get_plt_entry_size): New function.
3051 * i386.cc (Target_i386::got_size): Add const.
3052 (Target_i386::got_entry_count): New function.
3053 (Target_i386::plt_entry_count): New function.
3054 (Target_i386::first_plt_entry_offset): New function.
3055 (Target_i386::plt_entry_size): New function.
3056 (Output_data_plt_i386::entry_count): New function.
3057 (Output_data_plt_i386::first_plt_entry_offset): New function.
3058 (Output_data_plt_i386::get_plt_entry_size): New function.
3059 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
3060 find_incremental_inputs_sections. Dump incremental_got_plt section.
3061 * incremental.cc: Include target.h.
3062 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
3063 parameter. Adjust all callers. Find incremental_got_plt section.
3064 (Incremental_inputs::create_data_sections): Create incremental_got_plt
3065 section.
3066 (Output_section_incremental_inputs::set_final_data_size): Calculate
3067 size of incremental_got_plt section.
3068 (Output_section_incremental_inputs::do_write): Write the
3069 incremental_got_plt section.
3070 (Got_plt_view_info): New struct.
3071 (Local_got_offset_visitor): New class.
3072 (Global_got_offset_visitor): New class.
3073 (Global_symbol_visitor_got_plt): New class.
3074 (Output_section_incremental_inputs::write_got_plt): New function.
3075 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
3076 Add parameter. Adjust all callers.
3077 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3078 (Incremental_inputs::got_plt_section): New function.
3079 (Incremental_inputs::got_plt_section_): New data member.
3080 (Incremental_got_plt_reader): New class.
3081 * layout.cc (Layout::create_incremental_info_sections): Add the
3082 incremental_got_plt section.
3083 * object.h (Got_offset_list::get_list): New function.
3084 (Got offset_list::for_all_got_offsets): New function.
3085 (Sized_relobj::local_got_offset_list): New function.
3086 * powerpc.cc (Target_powerpc::got_size): Add const.
3087 (Target_powerpc::got_entry_count): New function.
3088 (Target_powerpc::plt_entry_count): New function.
3089 (Target_powerpc::first_plt_entry_offset): New function.
3090 (Target_powerpc::plt_entry_size): New function.
3091 (Output_data_plt_powerpc::entry_count): New function.
3092 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
3093 (Output_data_plt_powerpc::get_plt_entry_size): New function.
3094 * sparc.cc (Target_sparc::got_size): Add const.
3095 (Target_sparc::got_entry_count): New function.
3096 (Target_sparc::plt_entry_count): New function.
3097 (Target_sparc::first_plt_entry_offset): New function.
3098 (Target_sparc::plt_entry_size): New function.
3099 (Output_data_plt_sparc::entry_count): New function.
3100 (Output_data_plt_sparc::first_plt_entry_offset): New function.
3101 (Output_data_plt_sparc::get_plt_entry_size): New function.
3102 * symtab.h (Symbol::got_offset_list): New function.
3103 (Symbol_table::for_all_symbols): New function.
3104 * target.h (Sized_target::got_entry_count): New function.
3105 (Sized_target::plt_entry_count): New function.
3106 (Sized_target::plt_entry_size): New function.
3107 * x86_64.cc (Target_x86_64::got_size): Add const.
3108 (Target_x86_64::got_entry_count): New function.
3109 (Target_x86_64::plt_entry_count): New function.
3110 (Target_x86_64::first_plt_entry_offset): New function.
3111 (Target_x86_64::plt_entry_size): New function.
3112 (Output_data_plt_x86_64::entry_count): New function.
3113 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
3114 (Output_data_plt_x86_64::get_plt_entry_size): New function.
3115
3116 2010-08-12 Cary Coutant <ccoutant@google.com>
3117
3118 * archive.cc: Include incremental.h.
3119 (Archive::Archive): Initialize incremental_info_.
3120 (Archive::include_member): Record archive members in incremental info.
3121 (Add_archive_symbols::run): Record begin and end of an archive in
3122 incremental info.
3123 (Lib_group::include_member): Record objects in incremental info.
3124 * archive.h (Incremental_archive_entry): Forward declaration.
3125 (Archive::set_incremental_info): New member function.
3126 (Archive::incremental_info): New member function.
3127 (Archive::Unused_symbol_iterator): New class.
3128 (Archive::unused_symbols_begin): New member function.
3129 (Archive::unused_symbols_end): New member function.
3130 (Archive::incremental_info_): New data member.
3131 * incremental-dump.cc (find_input_containing_global): New function.
3132 (dump_incremental_inputs): Dump new incremental info sections.
3133 * incremental.cc: Include symtab.h.
3134 (Output_section_incremental_inputs): New class.
3135 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
3136 new incremental info sections.
3137 (Sized_incremental_binary::do_check_inputs): Likewise.
3138 (Incremental_inputs::report_archive): Remove.
3139 (Incremental_inputs::report_archive_begin): New function.
3140 (Incremental_inputs::report_archive_end): New function.
3141 (Incremental_inputs::report_object): New function.
3142 (Incremental_inputs::finalize_inputs): Remove.
3143 (Incremental_inputs::report_input_section): New function.
3144 (Incremental_inputs::report_script): Rewrite.
3145 (Incremental_inputs::finalize): Do nothing but finalize string table.
3146 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3147 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3148 (Incremental_inputs::create_data_sections): New function.
3149 (Incremental_inputs::relocs_entsize): New function.
3150 (Output_section_incremental_inputs::set_final_data_size): New function.
3151 (Output_section_incremental_inputs::do_write): New function.
3152 (Output_section_incremental_inputs::write_header): New function.
3153 (Output_section_incremental_inputs::write_input_files): New function.
3154 (Output_section_incremental_inputs::write_info_blocks): New function.
3155 (Output_section_incremental_inputs::write_symtab): New function.
3156 * incremental.h (Incremental_script_entry): Forward declaration.
3157 (Incremental_object_entry): Forward declaration.
3158 (Incremental_archive_entry): Forward declaration.
3159 (Incremental_inputs): Forward declaration.
3160 (Incremental_inputs_header_data): Remove.
3161 (Incremental_inputs_header): Remove.
3162 (Incremental_inputs_header_write): Remove.
3163 (Incremental_inputs_entry_data): Remove.
3164 (Incremental_inputs_entry): Remove.
3165 (Incremental_inputs_entry_write): Remove.
3166 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
3167 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
3168 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
3169 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
3170 Likewise.
3171 (Incremental_input_entry): New class.
3172 (Incremental_script_entry): New class.
3173 (Incremental_object_entry): New class.
3174 (Incremental_archive_entry): New class.
3175 (Incremental_inputs::Incremental_inputs): Initialize new data members.
3176 (Incremental_inputs::report_inputs): Remove.
3177 (Incremental_inputs::report_archive): Remove.
3178 (Incremental_inputs::report_archive_begin): New function.
3179 (Incremental_inputs::report_archive_end): New function.
3180 (Incremental_inputs::report_object): Change prototype.
3181 (Incremental_inputs::report_input_section): New function.
3182 (Incremental_inputs::report_script): Change prototype.
3183 (Incremental_inputs::get_reloc_count): New function.
3184 (Incremental_inputs::set_reloc_count): New function.
3185 (Incremental_inputs::create_data_sections): New function.
3186 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
3187 (Incremental_inputs::inputs_section): New function.
3188 (Incremental_inputs::symtab_section): New function.
3189 (Incremental_inputs::relocs_section): New function.
3190 (Incremental_inputs::get_stringpool): Add const.
3191 (Incremental_inputs::command_line): Add const.
3192 (Incremental_inputs::inputs): Remove.
3193 (Incremental_inputs::command_line_key): New function.
3194 (Incremental_inputs::input_file_count): New function.
3195 (Incremental_inputs::input_files): New function.
3196 (Incremental_inputs::relocs_entsize): New function.
3197 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3198 (Incremental_inputs::finalize_inputs): Remove.
3199 (Incremental_inputs::Input_info): Remove.
3200 (Incremental_inputs::lock_): Remove.
3201 (Incremental_inputs::inputs_): Change type.
3202 (Incremental_inputs::inputs_map_): Remove.
3203 (Incremental_inputs::current_object_entry_): New data member.
3204 (Incremental_inputs::inputs_section_): New data member.
3205 (Incremental_inputs::symtab_section_): New data member.
3206 (Incremental_inputs::relocs_section_): New data member.
3207 (Incremental_inputs::reloc_count_): New data member.
3208 (Incremental_inputs_reader): New class.
3209 (Incremental_symtab_reader): New class.
3210 (Incremental_relocs_reader): New class.
3211 * layout.cc (Layout::finalize): Move finalization of incremental info
3212 and creation of incremental info sections to follow finalization of
3213 symbol table. Set offsets for postprocessing sections.
3214 (Layout::create_incremental_info_sections): Call
3215 Incremental_inputs::create_data_sections. Add incremental symtab
3216 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3217 sections to layout after input sections.
3218 * layout.h (struct Timespec): Forward declaration.
3219 (Layout::incremental_inputs): Add const.
3220 (Layout::create_incremental_info_sections): Add parameter.
3221 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3222 * object.cc: Include incremental.h.
3223 (Relobj::finalize_incremental_relocs): New function.
3224 (Sized_relobj::do_layout): Record input sections in incremental info.
3225 * object.h (Object::output_section): New function.
3226 (Object::output_section_offset): Moved from Relobj.
3227 (Object::get_incremental_reloc_base): New function.
3228 (Object::get_incremental_reloc_count): New function.
3229 (Object::do_output_section): New function.
3230 (Object::do_output_section_offset): Moved from Relobj.
3231 (Object::do_get_incremental_reloc_base): New function.
3232 (Object::do_get_incremental_reloc_count): New function.
3233 (Object::Object): Initialize new data members.
3234 (Relobj::output_section): Renamed do_output_section and moved to
3235 protected.
3236 (Relobj::output_section_offset): Moved to Object.
3237 (Relobj::do_get_incremental_reloc_base): New function.
3238 (Relobj::do_get_incremental_reloc_count): New function.
3239 (Relobj::allocate_incremental_reloc_counts): New function.
3240 (Relobj::count_incremental_reloc): New function.
3241 (Relobj::finalize_incremental_relocs): New function.
3242 (Relobj::next_incremental_reloc_index): New function.
3243 (Relobj::reloc_counts_): New data member.
3244 (Relobj::reloc_bases_): New data member.
3245 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3246 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3247 (Sized_relobj::incremental_relocs_scan): New function.
3248 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3249 (Sized_relobj::incremental_relocs_write): New function.
3250 (Sized_relobj::incremental_relocs_write_reltype): New function.
3251 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3252 incremental link.
3253 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3254 archives and object files elsewhere.
3255 (Add_symbols::run): Report object files here.
3256 (Finish_group::run): Report end of archive at end of group.
3257 * reloc.cc: Include layout.h, incremental.h.
3258 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3259 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3260 (Sized_relobj::incremental_relocs_scan): New function.
3261 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3262 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3263 (Sized_relobj::incremental_relocs_write): New function.
3264 (Sized_relobj::incremental_relocs_write_reltype): New function.
3265 * script.cc (read_input_script): Rewrite test for incremental link.
3266 Change call to Incremental_inputs::report_script.
3267 * symtab.h (Symbol_table::first_global_index): New function.
3268 (Symbol_table::output_count): New function.
3269
3270 2010-08-12 Doug Kwan <dougkwan@google.com>
3271
3272 * arm.cc (Target_arm::merge_object_attributes): Check command line
3273 options --no-wchar-size-warning and --no-enum-size-warning.
3274 * options.h (General_options): Add ld-compatible options
3275 --no-enum-size-warning and --no-wchar-size-warning.
3276
3277 2010-08-04 Ian Lance Taylor <iant@google.com>
3278
3279 * x86_64.cc (Target_x86_64::Scan::local): Use
3280 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3281 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3282 (Target_x86_64::Scan::global): Likewise.
3283 (Target_x86_64::Relocate::relocate): Likewise.
3284 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3285 Likewise.
3286
3287 2010-08-03 Cary Coutant <ccoutant@google.com>
3288
3289 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3290 to reserve space in merged_strings vector. Keep total input size
3291 for stats.
3292 (Output_merge_string::do_print_merge_stats): Print total input size.
3293 * merge.h (Output_merge_string): Add input_size_ field.
3294 * stringpool.cc (Stringpool_template::string_length): Move
3295 implementations out of Stringpool_template class and place in
3296 stringpool.h.
3297 * stringpool.h (string_length): Move out of Stringpool_template.
3298
3299 2010-08-03 Ian Lance Taylor <iant@google.com>
3300
3301 PR 11712
3302 * layout.cc (relaxation_loop_body): If address of load segment is
3303 set, adjust address to include headers if possible.
3304
3305 2010-08-03 Ian Lance Taylor <iant@google.com>
3306
3307 * version.cc (version_string): Bump to 1.10.
3308
3309 2010-08-03 Ian Lance Taylor <iant@google.com>
3310
3311 PR 11805
3312 * layout.h (enum Output_section_order): Define.
3313 (class Layout): Update declarations.
3314 * layout.cc (Layout::get_output_section): Add order parameter.
3315 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3316 is_first_non_relro parameters. Change all callers.
3317 (Layout::choose_output_section): Likewise.
3318 (Layout::add_output_section_data): Likewise.
3319 (Layout::make_output_section): Likewise. Set order.
3320 (Layout::default_section_order): New function.
3321 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3322 * output.cc (Output_section::Output_section): Initialize order_.
3323 Don't initialize deleted fields.
3324 (Output_segment::Output_segment): Don't initialize deleted
3325 fields.
3326 (Output_segment::add_output_section_to_load): New function
3327 replacing add_output_section. Change all callers to call this or
3328 add_output_section_to_nonload.
3329 (Output_segment::add_output_section_to_nonload): New function.
3330 (Output_segment::remove_output_section): Rewrite.
3331 (Output_segment::add_initial_output_data): Likewise.
3332 (Output_segment::has_any_data_sections): Likewise.
3333 (Output_segment::is_first_section_relro): Likewise.
3334 (Output_segment::maximum_alignment): Likewise.
3335 (Output_segment::has_dynamic_reloc): New function replacing
3336 dynamic_reloc_count. Change all callers.
3337 (Output_segment::has_dynamic_reloc_list): New function replacing
3338 dynamic_reloc_count_list. Change all callers.
3339 (Output_segment::set_section_addresses): Rewrite.
3340 (Output_segment::set_offset): Rewrite.
3341 (Output_segment::find_first_and_last_list): Remove.
3342 (Output_segment::set_tls_offsets): Rewrite.
3343 (Output_segment::first_section_load_address): Likewise.
3344 (Output_segment::output_section_count): Likewise.
3345 (Output_segment::section_with_lowest_load_address): Likewise.
3346 (Output_segment::write_section_headers): Likewise.
3347 (Output_segment::print_sections_to_map): Likewise.
3348 * output.h (class Output_data): Remove dynamic_reloc_count_
3349 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3350 (Output_data::add_dynamic_reloc): Rewrite.
3351 (Output_data::has_dynamic_reloc): New function.
3352 (Output_data::dynamic_reloc_count): Remove.
3353 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3354 is_last_relro_, is_first_non_relro_, is_interp_,
3355 is_dynamic_linker_section_ fields. Add order and set_order
3356 functions. Remove is_relro_local, set_is_relro_local,
3357 is_last_relro, set_is_last_relro, is_first_non_relro,
3358 set_is_first_non_relro functions, is_interp, set_is_interp,
3359 is_dynamic_linker_section, and set_is_dynamic_linker_section
3360 functions.
3361 (class Output_segment): Change Output_data_list from std::list to
3362 std:;vector. Add output_lists_ field. Remove output_data_ and
3363 output_bss_ fields. Update declarations.
3364
3365 2010-08-02 Ian Lance Taylor <iant@google.com>
3366
3367 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3368 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3369 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3370
3371 2010-08-02 Ian Lance Taylor <iant@google.com>
3372
3373 PR 11855
3374 * script.cc (Script_options::Script_options): Initialize
3375 symbol_definitions_ and symbol_references_.
3376 (Script_options::add_symbol_assignment): Update
3377 symbol_definitions_ and symbol_references_.
3378 (Script_options::add_symbol_reference): New function.
3379 (script_symbol): New function.
3380 * script.h (class Script_options): Add symbol_definitions_ and
3381 symbol_references_ fields.
3382 (Script_options::referenced_const_iterator): New type.
3383 (Script_options::referenced_begin): New function.
3384 (Script_options::referenced_end): New function.
3385 (Script_options::is_referenced): New function.
3386 (Script_options::any_unreferenced): New function.
3387 * script-c.h (script_symbol): Declare.
3388 * yyscript.y (exp): Call script_symbol.
3389 * symtab.cc: Include "script.h".
3390 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3391 Change all callers. Check symbols referenced by scripts.
3392 (Symbol_table::add_undefined_symbols_from_command_line): Add
3393 layout parameter. Change all callers.
3394 (Symbol_table::do_add_undefined_symbols_from_command_line):
3395 Likewise. Break out loop body. Check symbols referenced by
3396 scripts.
3397 (Symbol_table::add_undefined_symbol_from_command_line): New
3398 function broken out of
3399 do_add_undefined_symbols_from_command_line.
3400 * symtab.h (class Symbol_table): Update declarations.
3401 * archive.cc: Include "layout.h".
3402 (Archive::should_include_member): Add layout parameter. Change
3403 all callers. Check for symbol mentioned in expression.
3404 * archive.h (class Archive): Update declaration.
3405 * object.cc (Sized_relobj::do_should_include_member): Add layout
3406 parameter.
3407 * object.h (Object::should_include_member): Add layout parameter.
3408 Change all callers.
3409 (Object::do_should_include_member): Add layout parameter.
3410 (class Sized_relobj): Update declaration.
3411 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3412 parameter.
3413 * dynobj.h (class Sized_dynobj): Update declaration.
3414 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3415 layout parameter.
3416 * plugin.h (class Sized_pluginobj): Update declaration.
3417
3418 2010-08-02 Ian Lance Taylor <iant@google.com>
3419
3420 PR 11866
3421 * output.cc (Output_segment::set_offset): Search for the first and
3422 last sections rather than assuming that the list is in order.
3423 (Output_segment::find_first_and_last_list): New function.
3424 * output.h (class Output_segment): Update declarations.
3425 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3426 (relro_strip_test_SOURCES): New variable.
3427 (relro_strip_test_DEPENDENCIES): New variable.
3428 (relro_strip_test_LDFLAGS): New variable.
3429 (relro_strip_test_LDADD): New variable.
3430 (relro_strip_test.so): New target.
3431
3432 2010-08-02 Ian Lance Taylor <iant@google.com>
3433
3434 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3435 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3436 (Target_i386::got_tlsdesc_section): New function.
3437 (Target_i386::got_section): Create space for GOT entries for
3438 TLSDESC relocations.
3439 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3440 R_386_TLS_GOTDESC.
3441 (Target_i386::Scan::global): Likewise.
3442 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3443 using TLSDESC GOT.
3444 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3445 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3446 (Target_x86_64::got_tlsdesc_section): New function.
3447 (Target_x86_64::got_section): Create space for GOT entries for
3448 TLSDESC relocations.
3449 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3450 R_386_TLS_GOTDESC.
3451 (Target_x86_64::Scan::global): Likewise.
3452 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3453 using TLSDESC GOT.
3454
3455 2010-08-02 Ian Lance Taylor <iant@google.com>
3456
3457 * testsuite/final_layout.sh: Use dc to convert from hex to
3458 decimal.
3459
3460 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3461
3462 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3463 paramter to the call to gold::gc_process_relocs.
3464 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3465 paramter to the call to gold::gc_process_relocs.
3466 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3467 parameter to the call to gold::gc_process_relocs.
3468 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3469 template parameter to the call to gold::gc_process_relocs.
3470 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3471 paramter to the call to gold::gc_process_relocs.
3472 * gc.h (get_embedded_addend_size): New function.
3473 (gc_process_relocs): Save the size of the reloc for use by ICF.
3474 * icf.cc (get_section_contents): Get the addend from the text section
3475 for SHT_REL relocation sections.
3476 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3477 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3478 * int_encoding.h (read_from_pointer): New overloaded function.
3479 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3480 * testsuite/icf_sht_rel_addend_test.sh: New file.
3481 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3482 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3483
3484 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3485
3486 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3487 * Makefile.in: Regenerate.
3488 * testsuite/Makefile.in: Regenerate.
3489
3490 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3491
3492 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3493 * gold/testsuite/debug_msg.cc: Likewise.
3494 * gold/testsuite/odr_violation1.cc
3495 * gold/testsuite/odr_violation2.cc
3496
3497 2010-07-21 Cary Coutant <ccoutant@google.com>
3498
3499 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3500 string, and length fields.
3501 (Output_merge_string::Merged_strings_list): New type.
3502 (Output_merge_string::Merged_strings_lists): New typedef.
3503 (Output_merge_string): Replace merged_strings_ with
3504 merged_strings_lists_.
3505 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3506 Merged_strings_list per input object and section. Don't store pointer
3507 to the string. Don't store length with each merged string entry.
3508 (Output_merge_string::finalize_merged_data): Loop over list of merged
3509 strings lists. Recompute length of each merged string.
3510
3511 2010-07-15 Cary Coutant <ccoutant@google.com>
3512
3513 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3514 here.
3515
3516 2010-07-14 Ian Lance Taylor <iant@google.com>
3517
3518 * descriptors.cc (Descriptors::open): Report correct name in error
3519 message.
3520
3521 2010-07-13 Doug Kwan <dougkwan@google.com>
3522
3523 * arm.cc (Arm_input_section::Arm_input_section): For a
3524 SHT_ARM_EXIDX section, always keeps the input sections.
3525 (Arm_input_section::set_exidx_section_link): New method.
3526 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3527 has_errors_ to false.
3528 (Arm_exidx_input_section::has_errors,
3529 Arm_exidx_input_section::set_has_errors): New methods.
3530 (Arm_exidx_input_section::has_errors_): New data member.
3531 (Arm_relobj::get_exidx_shndx_list): New method.
3532 (Arm_output_section::append_text_sections_to_list): Do not skip
3533 section without SHF_EXECINSTR.
3534 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3535 errors.
3536 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3537 section header. Make error messages more verbose. Check for
3538 a non-executable section linked to an EXIDX section.
3539 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3540 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3541 check that there is no deferred EXIDX section if we exit early.
3542 Instead of not making an EXIDX section in case of an error, make one
3543 and set the has_errors flag of it.
3544 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3545 in a relocatable link.
3546 (Target_arm::do_relax): Look for the EXIDX output section instead of
3547 assuming that it is called .ARM.exidx.
3548 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3549 section list. Do not check for SHF_EXECINSTR section flags but
3550 skip any input section with errors.
3551 * output.cc (Output_section::Output_section): Initialize
3552 always_keeps_input_sections_ to false.
3553 (Output_section::add_input_section): Check for
3554 always_keeps_input_sections_.
3555 * output.h (Output_section::always_keeps_input_sections,
3556 Output_section::set_always_keeps_input_sections): New methods.
3557 (Output_section::always_keeps_input_sections): New data member.
3558
3559 2010-07-13 Rafael Espindola <espindola@google.com>
3560
3561 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3562 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3563
3564 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3565 Ian Lance Taylor <iant@google.com>
3566
3567 * output.h (Output_section_lookup_maps::add_merge_section):
3568 Correct check of whether value was inserted.
3569 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3570 (Output_section_lookup_maps::add_relaxed_input_section):
3571 Likewise.
3572 * arm.cc (Target_arm::got_section): Remove used local os.
3573 * i386.cc (Target_i386::got_section): Likewise.
3574 * x86_64.cc (Target_x86_64::got_section): Likewise.
3575 * sparc.cc (Target_sparc::got_section): Likewise.
3576 (Target_sparc::relocate): Remove unused local have_got_offset.
3577 * powerpc.cc (Target_powerpc::relocate): Likewise.
3578
3579 2010-07-13 Ian Lance Taylor <iant@google.com>
3580
3581 * compressed_output.cc (zlib_decompress): Fix signature in
3582 !HAVE_ZLIB_H case.
3583
3584 * archive.cc (Archive::include_member): Unlock an external member
3585 of a thin archive. Don't bother to delete an object we know is
3586 NULL.
3587
3588 2010-07-12 Cary Coutant <ccoutant@google.com>
3589
3590 * compressed_output.cc (zlib_decompress): New function.
3591 (get_uncompressed_size): New function.
3592 (decompress_input_section): New function.
3593 * compressed_output.h (get_uncompressed_size): New function.
3594 (decompress_input_section): New function.
3595 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3596 Handle compressed debug sections.
3597 * layout.cc (is_compressed_debug_section): New function.
3598 (Layout::output_section_name): Map compressed section names to
3599 canonical names.
3600 * layout.h (is_compressed_debug_section): New function.
3601 (is_debug_info_section): Recognize compressed debug sections.
3602 * merge.cc: Include compressed_output.h.
3603 (Output_merge_data::do_add_input_section): Handle compressed
3604 debug sections.
3605 (Output_merge_string::do_add_input_section): Handle compressed
3606 debug sections.
3607 * object.cc: Include compressed_output.h.
3608 (Sized_relobj::Sized_relobj): Initialize new data members.
3609 (build_compressed_section_map): New function.
3610 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3611 * object.h (Object::section_is_compressed): New method.
3612 (Object::do_section_is_compressed): New method.
3613 (Sized_relobj::Compressed_section_map): New type.
3614 (Sized_relobj::do_section_is_compressed): New method.
3615 (Sized_relobj::compressed_sections_): New data member.
3616 * output.cc (Output_section::add_input_section): Handle compressed
3617 debug sections.
3618 * reloc.cc: Include compressed_output.h.
3619 (Sized_relobj::write_sections): Handle compressed debug sections.
3620
3621 2010-07-08 Cary Coutant <ccoutant@google.com>
3622
3623 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3624 weak when resolving to a dynamic def.
3625 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3626 for weak undef/dynamic def cases. Adjust callers.
3627 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3628 undef_binding_weak_.
3629 (Symbol_table::sized_write_globals): Adjust symbol binding.
3630 (Symbol_table::sized_write_symbol): Add binding parameter.
3631 * symtab.h (Symbol::set_undef_binding): New method.
3632 (Symbol::is_undef_binding_weak): New method.
3633 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3634 (Symbol_table::should_override): Add new parameter.
3635 (Symbol_table::sized_write_symbol): Add new parameter.
3636
3637 * testsuite/weak_undef_file1.cc: Add new test case.
3638 * testsuite/weak_undef_file2.cc: Fix header comment.
3639 * testsuite/weak_undef_test.cc: Add new test case.
3640
3641 2010-06-29 Doug Kwan <dougkwan@google.com>
3642
3643 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3644 Initialize USE_SYMBOL_.
3645 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3646 definition.
3647 (Arm_reloc_property::uses_symbol_): New data member declaration.
3648 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3649 uses symbol value and symbol is undefined but not weakly undefined.
3650
3651 2010-06-28 Rafael Espindola <espindola@google.com>
3652
3653 * plugin.cc (Plugin::load): Use dlerror.
3654
3655 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3656
3657 * symtab.cc (detect_odr_violations): When reporting an ODR
3658 violation, report an object where the symbol is defined.
3659
3660 2010-06-25 Doug Kwan <dougkwan@google.com>
3661
3662 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3663 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3664 definition.
3665 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3666 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3667 target hook to detect function points.
3668 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3669 * icf.h (Icf::check_section_for_function_pointers): Change type of
3670 parameter SECTION_NAME to const reference to std::string. Use
3671 target hook to determine if section may have unsafe pointers.
3672 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3673 method definition.
3674
3675 2010-06-21 Rafael Espindola <espindola@google.com>
3676
3677 * fileread.cc (Input_file::find_fie): New
3678 (Input_file::open): Use Input_file::find_fie.
3679 * fileread.h (Input_file::find_fie): New
3680 * plugin.cc (set_extra_library_path): New.
3681 (Plugin::load): Add set_extra_library_path to the transfer vector.
3682 (Plugin_manager::set_extra_library_path): New.
3683 (Plugin_manager::add_input_file): Use the extra search path if set.
3684 (set_extra_library_path(): New.
3685 * plugin.h (Plugin_manager): Add set_extra_library_path and
3686 extra_search_path_.
3687
3688 2010-06-19 Cary Coutant <ccoutant@google.com>
3689
3690 * layout.cc (gdb_sections): Add .debug_types.
3691 (lines_only_debug_sections): Likewise.
3692
3693 2010-06-18 Rafael Espindola <espindola@google.com>
3694
3695 * plugin.cc (add_input_file,add_input_library)
3696 (Plugin_manager::add_input_file): Make filename arguments const.
3697 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3698 const.
3699
3700 2010-06-16 Doug Kwan <dougkwan@google.com>
3701
3702 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3703 .ARM.attributes section if we have not merged any input
3704 attributes sections.
3705
3706 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3707
3708 * arm.cc: Allow combining objects with no EABI version
3709 information.
3710
3711 2010-06-15 Rafael Espindola <espindola@google.com>
3712
3713 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3714
3715 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3716
3717 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3718 (struct iovec): Correct !HAVE_READV definition.
3719
3720 2010-06-10 Cary Coutant <ccoutant@google.com>
3721
3722 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3723 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3724 reloc sections.
3725 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3726
3727 PR 11683
3728 * symtab.h (Symbol::is_placeholder): New member function.
3729 * target-reloc.h (relocate_section): Check for placeholder symbols.
3730
3731 * testsuite/Makefile.am (plugin_test_8): New test.
3732 (plugin_test_9): New test.
3733 * testsuite/Makefile.in: Regenerate.
3734
3735 2010-06-09 Nick Clifton <nickc@redhat.com>
3736
3737 * yyscript.y (input_list_element): Allow strings prefixed with
3738 the '-' character. Treat these as libraries.
3739 * script.cc (script_add_library): New function. Adds a library
3740 specified by "-l<name>" found in an input script.
3741 * script-c.h: Add prototype for script_add_library.
3742
3743 2010-06-07 Doug Kwan <dougkwan@google.com>
3744
3745 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3746 Restrict stub-group size to be within long conditional branch
3747 range when working around cortex-A8 erratum.
3748
3749 2010-06-07 Damien Diederen <dd@crosstwine.com>
3750
3751 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3752 #ifdef typo.
3753
3754 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3755
3756 PR gold/11658
3757 * output.cc
3758 (Output_section::Input_section_sort_entry::compare_section_ordering):
3759 Change to return non-zero correctly.
3760 (Output_section::Input_section_sort_section_order_index_compare
3761 ::operator()): Change to fix ambiguity in comparisons.
3762
3763 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3764
3765 * gold.h (is_wildcard_string): New function.
3766 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3767 (Layout::layout_eh_frame): Ditto.
3768 (Layout::find_section_order_index): New method.
3769 (Layout::read_layout_from_file): New method.
3770 * layout.h (Layout::find_section_order_index): New method.
3771 (Layout::read_layout_from_file): New method.
3772 (Layout::input_section_position_): New private member.
3773 (Layout::input_section_glob_): New private member.
3774 * main.cc (main): Call read_layout_from_file here.
3775 * options.h (--section-ordering-file): New option.
3776 * output.cc (Output_section::input_section_order_specified_): New
3777 member.
3778 (Output_section::Output_section): Initialize new member.
3779 (Output_section::add_input_section): Add new parameter.
3780 Keep input sections when --section-ordering-file is used.
3781 (Output_section::set_final_data_size): Sort input sections when
3782 section ordering file is specified.
3783 (Output_section::Input_section_sort_entry): Add new parameter.
3784 Check sorting type.
3785 (Output_section::Input_section_sort_entry::compare_section_ordering):
3786 New method.
3787 (Output_section::Input_section_sort_compare::operator()): Change to
3788 consider section_order_index.
3789 (Output_section::Input_section_sort_init_fini_compare::operator()):
3790 Change to consider section_order_index.
3791 (Output_section::Input_section_sort_section_order_index_compare
3792 ::operator()): New method.
3793 (Output_section::sort_attached_input_sections): Change to sort
3794 according to section order when specified.
3795 (Output_section::add_input_section<32, true>): Add new parameter.
3796 (Output_section::add_input_section<64, true>): Add new parameter.
3797 (Output_section::add_input_section<32, false>): Add new parameter.
3798 (Output_section::add_input_section<64, false>): Add new parameter.
3799 * output.h (Output_section::add_input_section): Add new parameter.
3800 (Output_section::input_section_order_specified): New
3801 method.
3802 (Output_section::set_input_section_order_specified): New method.
3803 (Input_section::Input_section): Initialize section_order_index_.
3804 (Input_section::section_order_index): New method.
3805 (Input_section::set_section_order_index): New method.
3806 (Input_section::section_order_index_): New member.
3807 (Input_section::Input_section_sort_section_order_index_compare): New
3808 struct.
3809 (Output_section::input_section_order_specified_): New member.
3810 * script-sections.cc (is_wildcard_string): Delete and move modified
3811 method to gold.h.
3812 (Output_section_element_input::Output_section_element_input): Modify
3813 call to is_wildcard_string.
3814 (Output_section_element_input::Input_section_pattern
3815 ::Input_section_pattern): Ditto.
3816 (Output_section_element_input::Output_section_element_input): Ditto.
3817 * testsuite/Makefile.am (final_layout): New test case.
3818 * testsuite/Makefile.in: Regenerate.
3819 * testsuite/final_layout.cc: New file.
3820 * testsuite/final_layout.sh: New file.
3821
3822 2010-06-01 Rafael Espindola <espindola@google.com>
3823
3824 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3825
3826 2010-06-01 Rafael Espindola <espindola@google.com>
3827
3828 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3829 visibility of symbols.
3830
3831 2010-05-27 Doug Kwan <dougkwan@google.com>
3832
3833 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3834 from start of output section instead of address for a local symbol
3835 in a merged or relaxed section when doing a relocatable link.
3836
3837 2010-05-26 Rafael Espindola <espindola@google.com>
3838
3839 PR 11604
3840 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3841 adding sections the garbage collector removed.
3842 * gold/testsuite/Makefile.am: Add test.
3843 * gold/testsuite/Makefile.in: Regenerate.
3844 * gold/testsuite/plugin_test_7.sh: New.
3845 * gold/testsuite/plugin_test_7_1.c: New.
3846 * gold/testsuite/plugin_test_7_2.c: New.
3847
3848 2010-05-26 Rafael Espindola <espindola@google.com>
3849
3850 * script-sections.cc (Output_section_definition::set_section_addresses):
3851 Check for --section-start.
3852
3853 2010-05-26 Doug Kwan <dougkwan@google.com>
3854
3855 * arm.cc (Arm_scan_relocatable_relocs): New class.
3856 (Target_arm::relocate_special_relocatable): New method.
3857 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3858 (Arm_relocate_functions::thumb_branch_common): Same.
3859 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3860 instead of Default_scan_relocatable_relocs.
3861 * target-reloc.h (relocate_for_relocatable): Let target handle
3862 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3863 * target.h (Sized_target::relocate_special_relocatable): New method.
3864
3865 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3866
3867 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3868
3869 2010-05-23 Doug Kwan <dougkwan@google.com>
3870
3871 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3872 instead of a cast.
3873 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3874 with a direct branch, not a conditional branch, to a stub.
3875 * merge.cc (Output_merge_base::record_input_section): New method
3876 defintion.
3877 (Output_merge_data::do_add_input_section): Record input section if
3878 keeps-input-sections flag is set.
3879 (Output_merge_string::do_add_input_section): Ditto.
3880 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3881 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3882 INPUT_SECTIONS_.
3883 (Output_merge_base::keeps_input_sections,
3884 Output_merge_base::set_keeps_input_sections,
3885 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3886 method definitions.
3887 (Output_merge_base::Input_sections): New type declaration.
3888 (Output_merge_base::input_sections_begin,
3889 Output_merge_base::input_sections_end,
3890 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3891 (Output_merge_base::bool keeps_input_sections_,
3892 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3893 Output_merge_base::input_sections_): New data members.
3894 (Output_merge_data::do_set_keeps_input_sections): New method
3895 defintion.
3896 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3897 * output.cc (Output_section::Input_section::relobj): Move method
3898 defintion from class declaration to here and handle merge sections.
3899 (Output_section::Input_section::shndx): Ditto.
3900 (Output_section::Output_section): Remove initializations of removed
3901 data members and initialize new data member LOOKUP_MAPS_.
3902 (Output_section::add_input_section): Set keeps-input-sections flag
3903 for a newly created merge output section as appropriate. Adjust code
3904 to use Output_section_lookup_maps class.
3905 (Output_section::add_relaxed_input_section): Adjst code for lookup
3906 maps code refactoring.
3907 (Output_section::add_merge_input_section): Add a new parameter
3908 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3909 class. If adding input section to a newly created merge output
3910 section fails, remove the new merge section.
3911 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3912 Adjust code for use of the Output_section_lookup_maps class.
3913 (Output_section::find_merge_section): Ditto.
3914 (Output_section::build_lookup_maps): New method defintion.
3915 (Output_section::find_relaxed_input_section): Adjust code to use
3916 Output_section_lookup_maps class.
3917 (Output_section::get_input_sections): Export merge sections. Adjust
3918 code to use Output_section_lookup_maps class.
3919 (Output_section:::add_script_input_section): Adjust code to use
3920 Output_section_lookup_maps class. Update lookup maps for merge
3921 sections also.
3922 (Output_section::discard_states): Use Output_section_lookup_maps.
3923 (Output_section::restore_states): Same.
3924 * output.h (Merge_section_properties): Move class defintion out of
3925 Output_section.
3926 (Output_section_lookup_maps): New class.
3927 (Output_section::Input_section::is_merge_section): New method
3928 defintion.
3929 (Output_section::Input_section::relobj): Move defintion out of class
3930 defintion. Declare method only.
3931 (Output_section::Input_section::shndx): Ditto.
3932 (Output_section::Input_section::output_merge_base): New method defintion.
3933 (Output_section::Input_section::u2_.pomb): New union field.
3934 (Output_section::Merge_section_by_properties_map,
3935 Output_section::Output_section_data_by_input_section_map,
3936 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3937 Remove types.
3938 (Output_section::add_merge_input_section): Add new parameter
3939 KEEPS_INPUT_SECTIONS.
3940 (Output_section::build_lookup_maps): New method declaration.
3941 (Output_section::merge_section_map_,
3942 Output_section::merge_section_by_properties_map_,
3943 Output_section::relaxed_input_section_map_,
3944 Output_section::is_relaxed_input_section_map_valid_): Remove data
3945 members.
3946 (Output_section::lookup_maps_): New data member.
3947
3948 2010-05-21 Doug Kwan <dougkwan@google.com>
3949
3950 PR gold/11619
3951 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3952 avoid a compilation error.
3953
3954 2010-05-19 Rafael Espindola <espindola@google.com>
3955
3956 * script-sections.cc (Output_section_definition::allocate_to_segment):
3957 Update the phdrs_list even when the output section is NULL.
3958 * testsuite/Makefile.am: Add test.
3959 * testsuite/Makefile.in: Regenerate.
3960 * testsuite/script_test_9.cc: New.
3961 * testsuite/script_test_9.sh: New.
3962 * testsuite/script_test_9.t: New.
3963
3964 2010-05-19 Doug Kwan <dougkwan@google.com>
3965
3966 * arm.cc (Arm_input_section::original_size): New method.
3967 (Arm_input_section::do_addralign): Add a cast.
3968 (Arm_input_section::do_output_offset): Remove static cast.
3969 (Arm_input_section::original_addralign,
3970 Arm_input_section::original_size_): Change type to uint32_t.
3971 (Arm_input_section::init): Add safe casts for section alignment
3972 and size.
3973 (Arm_input_section::set_final_data_size): Do not set address and
3974 offset of stub table.
3975 (Arm_output_section::fix_exidx_coverage): Change use of of
3976 Output_section::Simple_input_section to that of
3977 Output_section::Input_section.
3978 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3979 except for the first pass.
3980 * output.cc (Output_section::get_input_sections): Change type of
3981 input_sections to std::list<Input_section>.
3982 (Output_section::add_script_input_section): Rename from
3983 Output_section::add_simple_input_section. Change type of SIS
3984 parameter from Simple_input_section to Input_section.
3985 * output.h (Output_section::Simple_input_section): Remove class.
3986 (Output_section::Input_section): Change class visibility to public.
3987 (Output_section::Input_section::addralign): Use stored alignments
3988 for special input sections if set.
3989 (Output_section::Input_section::set_addralign): New method.
3990 (Output_section::get_input_sections): Change parameter type from
3991 list of Simple_input_section to list of Input_section.
3992 (Output_section::add_script_input_section): Rename from
3993 Output_section::add_simple_input_section. Change first parameter's
3994 type from Simple_input_section to Input_section and remove the
3995 second and third parameters.
3996 * script-sections.cc (Input_section::Input_section_list): Change
3997 type to list of Output_section::Input_section/
3998 (Input_section_info::Input_section_info): Change parameter type of
3999 INPUT_SECTION to Output_section::Input_section.
4000 (Input_section_info::input_section): Change return type.
4001 (Input_section_info::input_section_): Change type to
4002 Output_section::Input_section.
4003 (Output_section_element_input::set_section_addresses): Adjust code
4004 to use Output_section::Input_section instead of
4005 Output_section::Simple_input_section. Adjust code for renaming
4006 of Output_section::add_simple_input_section.
4007 (Orphan_output_section::set_section_addresses): Ditto.
4008
4009 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4010
4011 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
4012 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
4013
4014 2010-05-18 Rafael Espindola <espindola@google.com>
4015
4016 * options.cc (General_options::finalize): Handle -nostdlib.
4017 * options.h (nostdlib): New option.
4018 * script.cc (script_add_search_dir): Handle -nostdlib.
4019
4020 2010-05-12 Doug Kwan <dougkwan@google.com>
4021
4022 * arm.cc (Target_arm::do_finalize_sections): Create an empty
4023 attributes section only if there no attributes section after merging.
4024 (Target_arm::merge_object_attributes): Move value of
4025 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
4026 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
4027 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
4028 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
4029 and arm_attr_merge_7.stdout.
4030 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
4031 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
4032 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
4033 arm_attr_merge_7b.o): New rules.
4034 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
4035 arm_attr_merge_7
4036 * testsuite/Makefile.in: Regenerate.
4037 * testsuite/arm_attr_merge.sh: New file.
4038 * testsuite/arm_attr_merge_[67][ab].s: Same.
4039
4040 2010-05-05 Nick Clifton <nickc@redhat.com>
4041
4042 * po/es.po: Updated Spanish translation.
4043
4044 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4045
4046 * Makefile.am (install-exec-local): Properly install gold as
4047 default cross linker.
4048 * Makefile.in: Regenerated.
4049
4050 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
4051 Nick Clifton <nickc@redhat.com>
4052
4053 * configure.ac (install_as_default): Define and set to false
4054 unless --enable-gold or --enable-gold=both/gold has been
4055 specified.
4056 * configure: Regenerate.
4057
4058 * Makefile.am (install-exec-local): Install the executable as
4059 'ld.gold'. If install_as_default is true then also install it as
4060 'ld'.
4061 * Makefile.in: Regenerated.
4062
4063 2010-04-24 Ian Lance Taylor <iant@google.com>
4064
4065 * layout.cc (Layout::layout_reloc): In relocatable link don't
4066 combine reloc sections for grouped sections.
4067
4068 2010-04-23 Sriraman Tallam <tmsriram@google.com>
4069
4070 * gc.h (gc_process_relocs): Pass information on relocs pointing to
4071 sections that are not ordinary to icf.
4072 * icf.cc (get_section_contents): Handle relocation pointing to section
4073 with no object or shndx information.
4074 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
4075 * testsuite/Makefile.in: Regenerate.
4076 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
4077 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
4078
4079 2010-04-22 Ian Lance Taylor <iant@google.com>
4080
4081 * expression.cc (Expression::Expression_eval_info): Add
4082 result_alignment_pointer field.
4083 (Expression::eval_with_dot): Add result_alignment_pointer
4084 parameter. Change all callers.
4085 (Expression::eval_maybe_dot): Likewise.
4086 (class Binary_expression): Add alignment_pointer parameter to
4087 left_value and right_value. Change all callers.
4088 (BINARY_EXPRESSION): Set result alignment.
4089 (class Trinary_expression): Add alignment_pointer parameter to
4090 arg2_value and arg3_value. Change all callers.
4091 (Trinary_cond::value): Set result alignment.
4092 (Max_expression::value, Min_expression::value): Likewise.
4093 (Align_expression::value): Likewise.
4094 * script-sections.cc (class Sections_element): Add dot_alignment
4095 parameter to set_section_addresses virtual function. Update
4096 instantiations.
4097 (class Output_section_element): Likewise.
4098 (Script_sections::create_segments): Add dot_alignment parameter.
4099 Change all callers.
4100 (Script_sections::create_segments_from_phdrs_clause): Likewise.
4101 (Script_sections::set_phdrs_clause_addresses): Likewise.
4102 * script-sections.h: Update declarations.
4103 * script.h: Update declarations.
4104 * output.h (Output_segment::set_minimum_p_align): Don't decrease
4105 min_p_align.
4106 * testsuite/script_test_3.t: Set large alignment.
4107 * testsuite/script_test_3.sh: Make sure that at least one LOAD
4108 segment has expected alignment.
4109
4110 2010-04-22 Nick Clifton <nickc@redhat.com>
4111
4112 * po/gold.pot: Updated by the Translation project.
4113 * po/vi.po: Updated Vietnamese translation.
4114
4115 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
4116
4117 * testsuite/Makefile.am (check_PROGRAMS): Add
4118 icf_virtual_function_folding_test.
4119 * testsuite/Makefile.in: Regenerated.
4120
4121 2010-04-15 Andrew Haley <aph@redhat.com>
4122
4123 * options.h (merge_exidx_entries): New option.
4124 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
4125 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
4126 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
4127 (Target_arm::merge_exidx_entries): New function.
4128 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
4129 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
4130 to Arm_exidx_fixup constructor.
4131 Add new arg, merge_exidx_entries.
4132 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
4133 Arm_output_section::fix_exidx_coverage.
4134
4135 2010-04-18 Sriraman Tallam <tmsriram@google.com>
4136
4137 * icf.cc (get_section_contents): Check for preemptible functions.
4138 Ignore addend when appropriate.
4139 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
4140 section folded.
4141 (add_from_relobj): Check for section folded.
4142 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
4143 * symtab.h (should_add_dynsym_entry): Add new parameter.
4144 * target-reloc.h (scan_relocs): Check for section folded.
4145 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
4146 Check reloc types for function pointers in shared objects.
4147 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
4148 case.
4149 (icf_preemptible_functions_test): New test case.
4150 (icf_string_merge_test): New test case.
4151 * testsuite.Makefile.in: Regenerate.
4152 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
4153 bar_glob. Refactor code.
4154 * testsuite/icf_preemptible_functions_test.cc: New file.
4155 * testsuite/icf_preemptible_functions_test.sh: New file.
4156 * testsuite/icf_string_merge_test.cc: New file.
4157 * testsuite/icf_string_merge_test.sh: New file.
4158 * testsuite/icf_virtual_function_folding_test.cc: New file.
4159 * testsuite/icf_virtual_function_folding_test.sh: New file.
4160
4161 2010-04-14 Doug Kwan <dougkwan@google.com>
4162
4163 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
4164 for local symbol recounting if we remove a section due to ICF.
4165 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
4166 there are no regular objects in input.
4167
4168 2010-04-13 Doug Kwan <dougkwan@google.com>
4169
4170 * arm.cc (Arm_input_section::set_final_data_size): Compute
4171 accurate final data size instead of using current data size.
4172
4173 2010-04-09 Doug Kwan <dougkwan@google.com>
4174
4175 * layout.cc (Layout::choose_output_section): Handle script section
4176 types.
4177 (Layout::make_output_section_for_script): Add section type parameter.
4178 Handle script section types.
4179 * layout.h (Layout::make_output_section_for_script): Add section
4180 type parameter.
4181 * output.cc (Output_section::Output_section): Initialize data member
4182 is_noload_.
4183 (Output_section::do_reset_address_and_file_offset): Do not set address
4184 to 0 if section is a NOLOAD section.
4185 * output.h (Output_section::is_noload): New method.
4186 (Output_section::set_is_noload): Ditto.
4187 (Output_section::is_noload_): New data member.
4188 * script-c.h (Script_section_type): New enum type.
4189 (struct Parser_output_section_header): Add new file section_type.
4190 * script-sections.cc (Sections_element::output_section_name): Add
4191 parameter for returning script section type.
4192 (Output_section_definition::output_section_name): Ditto.
4193 (Output_section_definition::section_type)P; New method.
4194 (Output_section_definiton::script_section_type_name): Ditto.
4195 (Output_section_definition::script_section_type_): New data member.
4196 (Output_section_definition::Output_section_definition): Initialize
4197 data member Output_section_definition::script_section_type_.
4198 (Output_section_definition::create_sections): Pass script section type
4199 to Layout::make_output_section_for_script.
4200 (Output_section_definition::output_section_name): Return script
4201 section type to caller.
4202 (Output_section_definition::set_section_address): Do not advance
4203 dot value and load address if section type is NOLOAD. Set address
4204 of NOLOAD sections regardless of section flags.
4205 (Output_section_definition::print): Print section type if it is
4206 not SCRIPT_SECTION_TYPE_NONE.
4207 (Output_section_definition::section_type): New method.
4208 (Output_section_definition::script_section_type_name): Ditto.
4209 (Script_sections::output_section_name): Add new parameter
4210 PSECTION_TYPE for returning script section type. Pass it to
4211 section elements. Handle discard sections.
4212 (Sort_output_sections::operator()): Handle NOLOAD sections.
4213 * script-sections.h (Script_sections::Section_type): New enum type.
4214 (Script_sections::output_section_name): Add a new parameter for
4215 returning script section type.
4216 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4217 INFO and NOLOAD.
4218 * yyscript.y (union): Add new field SECTION_TYPE.
4219 (COPY, DSECT, INFO, NOLOAD): New tokens.
4220 (opt_address_and_section_type): Change type to output_section_header.
4221 (section_type): New non-terminal
4222 (section_header): Handle section type.
4223 (opt_address_and_section_type): Return section type value.
4224
4225 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4226
4227 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4228 * testsuite/plugin_common_test_2.c (foo): Likewise.
4229
4230 2010-04-08 Doug Kwan <dougkwan@google.com>
4231
4232 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4233 Output_merge_data.
4234 * output.cc (Output_section::add_merge_input_section): Simplify
4235 code and return status of Output_merge_base::add_input_section.
4236 Update merge section map only if Output_merge_base::add_input_section
4237 returns true.
4238
4239 2010-04-07 Doug Kwan <dougkwan@google.com>
4240
4241 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4242 if section is marked as containing instructions but has no mapping
4243 symbols.
4244 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4245 correct section index.
4246 (Arm_relobj::find_linked_text_section): Ditto.
4247
4248 2010-04-07 Cary Coutant <ccoutant@google.com>
4249
4250 * archive.cc (include_member): Destroy Read_symbols_data object before
4251 releasing file.
4252 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4253 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4254 (Read_symbols_data::~Read_symbols_data) New destructor.
4255 (Section_relocs::Section_relocs) New constructor.
4256 (Section_relocs::~Section_relocs) New destructor.
4257 (Read_relocs_data::Read_relocs_data) New constructor.
4258 (Read_relocs_data::~Read_relocs_data) New destructor.
4259 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4260 pointers to NULL after deleting.
4261
4262 2010-04-07 Doug Kwan <dougkwan@google.com>
4263
4264 * arm.cc: Replace "endianity" with "endianness" in comments.
4265 (Arm_exidx_cantunwind): Ditto.
4266 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4267 (Arm_relobj::merge_flags_and_attributes): New method.
4268 (Arm_relobj::merge_flags_and_attributes_): New data member.
4269 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4270 (Arm_relobj::scan_sections_for_stubs): Ditto.
4271 (Arm_relobj::do_read_symbols): Check to see if we really want to
4272 merge processor-specific flags and attributes. Exit early if
4273 an object is empty except for section names and the undefined symbol.
4274 (Target_arm::do_finalize_sections): Move check for ELF format to
4275 Arm_relobj::do_read_symbols. Merge processor specific flags and
4276 attributes from a regular object only when we have determined that
4277 it is aapropriate. Do not create an .ARM.attributes section in
4278 output if there is no regular input object.
4279 (Target_arm::merge_processor_specific_flags): Check
4280 --warn-mismatch before printing any error.
4281 (Target_arm::merge_object_attributes): Ditto.
4282 * gold.cc (queue_middle_tasks): Handle the case in which there is
4283 no regular object in input.
4284 * options.cc (General_options::parse_EB): New method.
4285 (General_options::parse_EL): Same.
4286 (General_options::General_options): Initialize endianness_.
4287 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4288 New options.
4289 (General_options::Endianness): New enum.
4290 (General_options::endianness): New method.
4291 (General_options::endianness_): New data member.
4292 * parameters.cc (Parameters::set_options): Check target endianness.
4293 (Parameters::set_target_once): Ditto.
4294 (Parameters::check_target_endianness): New method.
4295 (parameters_force_valid_target): If either -EL or -EB is specified,
4296 use it to define endianness of default target.
4297 * parameters.h (Parameters::check_target_endianness): New method
4298 declaration.
4299 * target.h (class Target): Change "endianity" to "endianness"
4300 in comments.
4301
4302 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4303
4304 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4305 * configure: Regenerate.
4306 * Makefile.in: Regenerate.
4307 * testsuite/Makefile.in: Regenerate.
4308
4309 2010-04-06 Cary Coutant <ccoutant@google.com>
4310
4311 gcc PR lto/42757
4312 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4313 prevailing definitions of common symbols.
4314 * testsuite/plugin_test_6.sh: New test case.
4315 * testsuite/plugin_common_test_1.c: New test case.
4316 * testsuite/plugin_common_test_2.c: New test case.
4317 * testsuite/Makefile.am (plugin_test_6): New test case.
4318 * testsuite/Makefile.in: Regenerate.
4319
4320 2010-04-06 Nick Clifton <nickc@redhat.com>
4321
4322 * po/vi.po: New Vietnamese translation.
4323
4324 2010-03-30 Doug Kwan <dougkwan@google.com>
4325
4326 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4327
4328 2010-03-25 Doug Kwan <dougkwan@google.com>
4329
4330 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4331 to avoid a conversion warning on a 32-bit host.
4332
4333 2010-03-24 Ian Lance Taylor <iant@google.com>
4334
4335 * testsuite/script_test_3.t: Add a TLS segment.
4336 * testsuite/Makefile.am (check_PROGRAMS): Add
4337 tls_phdrs_script_test.
4338 (tls_phdrs_script_test_SOURCES): Define.
4339 (tls_phdrs_script_test_DEPENDENCIES): Define.
4340 (tls_phdrs_script_test_LDFLAGS): Define.
4341 (tls_phdrs_script_test_LDADD): Define.
4342 * testsuite/Makefile.in: Rebuild.
4343
4344 2010-03-23 Cary Coutant <ccoutant@google.com>
4345
4346 * fileread.cc (find_or_make_view): Fix comment.
4347
4348 2010-03-23 Ian Lance Taylor <iant@google.com>
4349
4350 * script-sections.cc (class Orphan_section_placement): Define
4351 PLACE_TLS and PLACE_TLS_BSS.
4352 (Orphan_section_placement::Orphan_section_placement): Initialize
4353 new places.
4354 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4355 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4356 (tls_script_test_SOURCES): Define.
4357 (tls_script_test_DEPENDENCIES): Define.
4358 (tls_script_test_LDFLAGS): Define.
4359 (tls_script_test_LDADD): Define.
4360 * testsuite/Makefile.in: Rebuild.
4361
4362 2010-03-22 Doug Kwan <dougkwan@google.com>
4363
4364 * arm.cc (Arm_relocate_functions::abs8,
4365 Arm_relocate_functions::abs16): Use correct check for overflow
4366 specified in the ARM ELF specs.
4367 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4368 target of a BLX instruction specially.
4369 (Reloc_stub::stub_type_for_reloc): Ditto.
4370 (Relocate::relocate): Use symbolic names instead of numeric relocation
4371 codes to report error.
4372 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4373 workaround.
4374 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4375 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4376 thumb2_blx_out_of_range.stdout
4377 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4378 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4379 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4380 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4381 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4382 thumb2_blx_in_range, thumb2_blx_in_range.o,
4383 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4384 thumb2_blx_out_of_range.o): New rules.
4385 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4386 thumb2_blx_in_range and thumb2_blx_out_of_range.
4387 * testsuite/Makefile.in: Regenerate.
4388 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4389 * testsuite/thumb_blx_in_range.s: New file.
4390 * testsuite/thumb_blx_out_of_range.s: New file.
4391
4392 2010-03-22 Rafael Espindola <espindola@google.com>
4393
4394 * archive.cc (Should_include): Move to archive.h.
4395 (should_include_member): Make it a member of Archive.
4396 (Lib_group): New.
4397 (Add_lib_group_symbols): New.
4398 * archive.h: Include options.h.
4399 (Archive_member): Moved from Archive.
4400 (Should_include): Moved from archive.cc.
4401 (Lib_group): New.
4402 (Add_lib_group_symbols): New.
4403 * dynobj.cc (do_should_include_member): New.
4404 * dynobj.h (do_should_include_member): New.
4405 * gold.cc (queue_initial_tasks): Update call to queue.
4406 * main.cc (main): Print lib group stats.
4407 * object.cc (do_should_include_member): New.
4408 * object.h: Include archive.h.
4409 (Object::should_include_member): New.
4410 (Object::do_should_include_member): New.
4411 (Sized_relobj::do_should_include_member): New.
4412 * options.cc (General_options::parse_start_lib): New.
4413 (General_options::parse_end_lib): New.
4414 (Input_arguments::add_file): Handle lib groups.
4415 (Input_arguments::start_group): Check we are not in a lib.
4416 (Input_arguments::start_lib): New.
4417 (Input_arguments::end_lib): New.
4418 * options.h (General_options): Add start_lib and end_lib.
4419 (Input_argument::lib_): New.
4420 (Input_argument::lib): New.
4421 (Input_argument::is_lib): New.
4422 (Input_file_lib): New.
4423 (Input_arguments::in_lib_): New.
4424 (Input_arguments::in_lib): New.
4425 (Input_arguments::start_lib): New.
4426 (Input_arguments::end_lib_): New.
4427 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4428 in unused members as preempted.
4429 (Sized_pluginobj::do_should_include_member): New.
4430 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4431 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4432 return the blocker.
4433 (Read_symbols::do_whole_lib_group): New.
4434 (Read_symbols::do_lib_group): New.
4435 (Read_symbols::do_read_symbols): Handle lib groups.
4436 (Read_symbols::get_name): Handle lib groups.
4437 * readsyms.h (Read_symbols): Add an archive member pointer.
4438 (Read_symbols::do_whole_lib_group): New.
4439 (Read_symbols::do_lib_group): New.
4440 (Read_symbols::member_): New.
4441 * script.cc (read_input_script): Update call to queue_soon.
4442
4443 2010-03-19 Doug Kwan <dougkwan@google.com>
4444
4445 * arm.cc (Stub_table::Stub_table): Initialize new data members
4446 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4447 (Stub_table::add_reloc_stub): Assign stub offset and update
4448 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4449 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4450 New data members.
4451 (Stub_table::update_data_size_and_addralign): Use
4452 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4453 instead of going over all reloc stubs.
4454 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4455 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4456 Stringpool_template::offset_ to size of Stringpool_char.
4457 (Stringpool_template::new_key_offset): Remove code to initialize
4458 Stringpool_template::offset_.
4459 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4460 Stringpool_template::offset_ to zero.
4461
4462 2010-03-15 Doug Kwan <dougkwan@google.com>
4463
4464 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4465 offset_.
4466 (Stringpool_template::new_key_offset): New method.
4467 (Stringpool_template::add_string): Assign offsets when adding new
4468 strings.
4469 (Stringpool_template::set_string_offsets): Do not set string offsets
4470 when not optimizing.
4471 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4472 member size_.
4473 (Chunked_vector::clear): Clear size_.
4474 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4475 (Chunked_vector::size): Return size_.
4476 (Chunked_vector::push_back): Use size_ to find insert position.
4477 (Chunked_vector::size_): New data member.
4478 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4479 (Stringpool_template::new_key_offset): New method declaration.
4480 (Stringpool_template::offset_): New data member.
4481
4482 2010-03-15 Rafael Espindola <espindola@google.com>
4483
4484 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4485 Add_symbols' constructor.
4486 * readsyms.h (Add_symbols): Remove the input_group member.
4487
4488 2010-03-10 Ian Lance Taylor <iant@google.com>
4489
4490 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4491 target to ask whether a reference to a symbol requires a stack
4492 split.
4493 * target.h (Target::is_call_to_non_split): New function.
4494 (Target::do_is_call_to_non_split): Declare virtual function.
4495 * target.cc: Include "symtab.h".
4496 (Target::do_is_call_to_non_split): New function.
4497 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4498
4499 2010-03-10 Cary Coutant <ccoutant@google.com>
4500
4501 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4502 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4503 (File_read::open[2]): Add whole_file_view_ to list of views.
4504 (File_read::make_view): Remove test of whole_file_view_.
4505 (File_read::find_or_make_view): Create whole_file_view_ if
4506 necessary.
4507 (File_read::clear_views): Replace bool parameter with enum;
4508 adjust all callers. Don't delete views with permanent data;
4509 do delete cached views and views from archives if
4510 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4511 if clearing the corresponding view.
4512 * fileread.h (File_read::Clear_views_mode): New enum.
4513 (File_read::View::is_permanent_view): New method.
4514 (File_read::clear_views): Replace bool parameter
4515 with enum; adjust all callers.
4516 * options.h (General_options): Change keep_files_mapped option;
4517 add map_whole_files.
4518 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4519 releasing the file.
4520 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4521 the file.
4522
4523 2010-03-10 David S. Miller <davem@davemloft.net>
4524
4525 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4526
4527 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4528
4529 * icf.cc (get_section_contents): Add '@' marker after processing the
4530 merge reloc.
4531
4532 2010-03-08 Doug Kwan <dougkwan@google.com>
4533
4534 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4535 due to a conversion warning.
4536 (Arm_relobj::update_output_local_symbol_count): Check for local
4537 symbol with unset output index.
4538
4539 2010-03-05 Ian Lance Taylor <iant@google.com>
4540
4541 * options.h (class General_options): Add --spare-dynamic-tags.
4542 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4543 --spare-dynamic-tags.
4544
4545 2010-03-05 Ian Lance Taylor <iant@google.com>
4546
4547 * incremental.cc: Include "libiberty.h".
4548
4549 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4550
4551 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4552 function, is_info_ member.
4553 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4554 (Versions::Versions): Update caller.
4555 (Versions::define_base_version): Likewise.
4556 (Versions::add_def): Likewise.
4557
4558 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4559
4560 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4561 (Scan::possible_function_pointer_reloc): New function.
4562 (Scan::local_reloc_may_be_function_pointer): Change to call
4563 possible_function_pointer_reloc.
4564 (Scan::global_reloc_may_be_function_pointer): Ditto.
4565 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4566 relocations in ".data.rel.ro._ZTV" section.
4567 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4568 * testsuite/icf_safe_so_test.cc: Ditto.
4569 * testsuite/icf_safe_test.cc: Ditto.
4570 * testsuite/icf_safe_test.sh: Ditto.
4571
4572 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4573 Ian Lance Taylor <iant@google.com>
4574
4575 * target-reloc.h (relocate_section): Check the symbol table index
4576 for -1U before setting the local symbol index.
4577 (scan_relocatable_relocs): If copying the relocation, record that
4578 the local symbol is required.
4579 * object.h (Symbol_value::is_output_symtab_index_set): New
4580 function.
4581 (Symbol_value::may_be_discarded_from_output_symtab): New
4582 function.
4583 (Symbol_value::has_output_symtab_entry): New function.
4584 (Symbol_value::needs_output_symtab_entry): Remove.
4585 (Symbol_value::output_symtab_index): Make sure the symbol index is
4586 set.
4587 (Symbol_value::set_output_symtab_index): Make sure the symbol
4588 index is not set. Make sure the new index is valid.
4589 (Symbol_value::set_must_have_output_symtab_entry): New function.
4590 (Symbol_value::has_output_dynsym_entry): New function.
4591 (Symbol_value::set_output_dynsym_index): Make sure the new index
4592 is valid.
4593 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4594 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4595 local symbol if permitted.
4596 (Sized_relobj::do_finalize_local_symbols): Call
4597 is_output_symtab_index_set rather than needs_output_symtab_entry.
4598 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4599 rather than needs_output_symtab_entry. Call
4600 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4601 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4602 is_output_symtab_index_set rather than needs_output_symtab_entry.
4603 * testsuite/discard_locals_relocatable_test.c: New file.
4604 * testsuite/discard_locals_test.sh: Test -r.
4605 * testsuite/Makefile.am (check_DATA): Add
4606 discard_locals_relocatable_test1.syms,
4607 discard_local_relocatable_test2.syms.
4608 (MOSTLYCLEANFILES): Likewise. Also add
4609 discard_locals_relocatable_test1.lout and
4610 discard_locals_relocatable_test2.out.
4611 (discard_locals_relocatable_test1.syms): New target.
4612 (discard_locals_relocatable_test.o): New target.
4613 (discard_locals_relocatable_test1.out): New target.
4614 (discard_locals_relocatable_test2.syms): New target.
4615 (discard_locals_relocatable_test2.out): New target.
4616 (various): Add missing ../ld-new dependencies.
4617 * testsuite/Makefile.in: Rebuild.
4618
4619 2010-03-03 Nick Clifton <nickc@redhat.com>
4620
4621 * po/fi.po: New Finnish translation.
4622
4623 2010-03-01 Doug Kwan <dougkwan@google.com>
4624
4625 * layout.cc (Layout::Layout): Force section types of .init_array*,
4626 .preinit_array* and .fini_array* sections.
4627 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4628 Fix check of return value of std::string::find.().
4629 (Output_section::Input_section_sort_compare::operator()): Remove
4630 comment about .init_array.
4631 (Output_section::Input_section_sort_init_fini_compare::operator()):
4632 New method.
4633 (Output_section::sort_attached_input_sections): Handle .init_array
4634 and .fini_array specially.
4635 * output.h (Output_section::Inut_section_sort_compare): Update
4636 comment.
4637 (Output_section::Input_section_sort_init_fini_compare): New struct.
4638
4639 2010-02-26 Doug Kwan <dougkwan@google.com>
4640
4641 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4642 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4643 * testsuite/debug_msg.sh: Avoid matching source line number for
4644 use of global variable undef_int.
4645
4646 2010-02-26 Doug Kwan <dougkwan@google.com>
4647
4648 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4649 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4650 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4651 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4652 * options.cc (General_options::General_options): Initialize member
4653 fix_v4bx_.
4654 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4655 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4656 and rm_no_fix_v4bx.stdout
4657 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4658 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4659 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4660 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4661 and arm_no_fix_v4bx.
4662 * Makefile.in: Regenerate.
4663 * testsuite/arm_fix_v4bx.s: New file.
4664 * testsuite/arm_fix_v4bx.sh: Ditto.
4665
4666 2010-02-24 Doug Kwan <dougkwan@google.com>
4667
4668 * arm.cc (Target_arm::got_section): Make the .got section the first
4669 non RELRO section in the data segment.
4670 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4671 suffixes of section names.
4672
4673 2010-02-24 Doug Kwan <dougkwan@google.com>
4674
4675 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4676 flags and attributes merging if an input file is a binary file.
4677 * fileread.cc (Input_file::open): Record format of original file.
4678 * fileread.h (Input_file::Format): New enum type.
4679 (Input_file::Input_file): Initialize data member format_.
4680 (Input_file::format): New method definition.
4681 (Input_file::format_):: New data member.
4682
4683 2010-02-24 Doug Kwan <dougkwan@google.com>
4684
4685 * arm.cc (Arm_output_data_got): New class.
4686 (ARM_TCB_SIZE): New constant
4687 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4688 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4689 If user uses a script with a SECTIONS clause, issue only a warning
4690 for a misplaced EXIDX input section. Otherwise, issue an error.
4691 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4692 garbage collection.
4693 (Target_arm::got_mode_index_entry): Handle static linking.
4694 (Target_arm::Scan::local): Ditto.
4695 (Target_arm::Scan::global): Ditto.
4696 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4697 all incorrectly implemented relocations.
4698 (Target_arm::fix_exidx_coverage): Pass layout to
4699 Arm_output_section::fix_exidx_coverage.
4700 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4701 from ".ARM.exidx." and ".ARM.extab.".
4702
4703 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4704
4705 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4706 section if it does not already exist.
4707 * attributes.cc (Attributes_section_data::Attributes_section_data):
4708 Don't crash if size is zero.
4709
4710 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4711 Ian Lance Taylor <iant@google.com>
4712
4713 * gold.cc (queue_middle_tasks): If no input files were opened,
4714 exit.
4715 * workqueue.h (Task_function::Task_function): Assert that there is
4716 a blocker.
4717
4718 2010-02-22 Doug Kwan <dougkwan@google.com>
4719
4720 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4721 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4722 types to avoid warnings due to different uint64_t implementations
4723 on different hosts.
4724
4725 2010-02-21 Doug Kwan <dougkwan@google.com>
4726
4727 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4728 handling of the maximum backward branch offset.
4729 (Arm_relocate_functions::thumb_branch_common): Ditto.
4730 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4731 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4732 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4733 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4734 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4735 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4736 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4737 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4738 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4739 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4740 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4741 thumb2_bl_out_of_range.o): New rules.
4742 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4743 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4744 thumb2_bl_out_of_range
4745 * testsuite/Makefile.in: Regenerate.
4746 * testsuite/arm_bl_in_range.s: New file.
4747 * testsuite/arm_bl_out_of_range.s: Ditto.
4748 * testsuite/arm_branch_in_range.sh: Ditto.
4749 * testsuite/arm_branch_range.t: Ditto.
4750 * testsuite/thumb2_branch_range.t: Ditto.
4751 * testsuite/thumb_bl_in_range.s: Ditto.
4752 * testsuite/thumb_bl_out_of_range.s: Ditto.
4753 * testsuite/thumb_branch_range.t: Ditto.
4754
4755 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4756
4757 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4758 Add reloc offset information.
4759 * icf.cc (get_section_contents): Change iterators to point to the new
4760 vectors. Add reloc offset information to the contents.
4761 * icf.h (Icf::Sections_reachable_info): New typedef.
4762 (Icf::Sections_reachable_list): New typedef.
4763 (Icf::Offset_info): New typedef.
4764 (Icf::Reloc_info): New struct typedef.
4765 (Icf::Reloc_info_list): New typedef.
4766 (Icf::symbol_reloc_list): Delete method.
4767 (Icf::addend_reloc_list): Delete method.
4768 (Icf::section_reloc_list): Delete method.
4769 (Icf::reloc_info_list): New method.
4770 (Icf::reloc_info_list_): New member.
4771
4772 2010-02-19 Doug Kwan <dougkwan@google.com>
4773
4774 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4775 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4776 * arm.cc (Arm_relocation_functions): New forward declaration.
4777 (Target_arm::Target_arm): Initialize new data members
4778 got_mod_index_offset_ and tls_base_symbol_defined_.
4779 (Target_arm::Relocate::relocate_tls): New method.
4780 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4781 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4782 New methods.
4783 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4784 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4785 (Target_arm::got_mod_index_offset_,
4786 Target_arm::tls_base_symbol_defined_): New data members.
4787 (Target_arm::Scan::local, Target::Scan::global,
4788 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4789 relocations.
4790
4791 2010-02-18 Doug Kwan <dougkwan@google.com>
4792
4793 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4794 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4795 text section as a parameter becuase some broken tools may not set
4796 the link in section header.
4797 (Target_arm::has_got_section): New method.
4798 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4799 without any mapping symbol as data only. Remove warning.
4800 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4801 link in its section header, try to discover the link by inspecting the
4802 REL31 relocation at the beginning of the section.
4803 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4804 in error message.
4805 (Target_arm::Scan::global): Treat any reference to the symbol
4806 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4807
4808 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4809
4810 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4811 (Scan::global_reloc_may_be_function_pointer): New function.
4812 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4813 (Scan::global_reloc_may_be_function_pointer): New function.
4814 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4815 (Scan::global_reloc_may_be_function_pointer): New function.
4816 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4817 (Scan::global_reloc_may_be_function_pointer): New function.
4818 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4819 (Scan::global_reloc_may_be_function_pointer): New function.
4820 (Scan::possible_function_pointer_reloc): New function.
4821 (Target_x86_64::can_check_for_function_pointers): New function.
4822 * gc.h (gc_process_relocs): Scan relocation types to determine if
4823 function pointers were taken for targets that support it.
4824 * icf.cc (Icf::find_identical_sections): Include functions for
4825 folding in safe ICF whose pointer is not taken.
4826 * icf.h (Secn_fptr_taken_set): New typedef.
4827 (fptr_section_id_): New member.
4828 (section_has_function_pointers): New function.
4829 (set_section_has_function_pointers): New function.
4830 (check_section_for_function_pointers): New function.
4831 * options.h: Fix comment for safe ICF option.
4832 * target.h (can_check_for_function_pointers): New function.
4833 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4834 Modify icf_safe_test for X86-64.
4835 * testsuite/Makefile.in: Regenerate.
4836 * testsuite/icf_safe_so_test.cc: New file.
4837 * testsuite/icf_safe_so_test.sh: New file.
4838 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4839 (main): Change to take pointer to function kept_func_3.
4840 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4841 folding is done correctly for X86-64.
4842
4843 2010-02-12 David S. Miller <davem@davemloft.net>
4844
4845 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4846 is_symbolless parameter.
4847 (Output_reloc<SHT_REL>::is_symbolless): New.
4848 (Output_reloc<SHT_REL>::is_symbolless_): New.
4849 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4850 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4851 (Output_reloc<SHT_RELA>::is_symbolless): New.
4852 (Output_data_reloc::add_global): Handle is_symbolless.
4853 (Output_data_reloc::add_global_relative): Likewise.
4854 (Output_data_reloc::add_local): Likewise.
4855 (Output_data_reloc::add_local_relative): Likewise.
4856 (Output_data_reloc::add_symbolless_global_addend): New.
4857 (Output_data_reloc::add_symbolless_local_addend): New.
4858 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4859 is_symbolless.
4860 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4861 instead of ->is_relative_
4862 (Output_reloc::write): Likewise.
4863 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4864 (Output_reloc::write_rel): Simplify.
4865
4866 * sparc.cc (Target_sparc::Scan::local): Use
4867 ->add_symbolless_local_addend as needed.
4868 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4869 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4870 based upon relocation offset.
4871
4872 2010-02-11 Doug Kwan <dougkwan@google.com>
4873
4874 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4875 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4876 beginning of function.
4877 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4878 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4879 parameter is_32bit in calls to should_apply_static_reloc.
4880 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4881 (check_DATA): Add arm_abs_global.stdout.
4882 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4883 arm_abs_global.stdout): New rules.
4884 (MOSTLLYCLEANFILES): Add arm_abs_global
4885 * Makefile.in: Regenerate.
4886 * testsuite/arm_abs_global.s: New file.
4887 * testsuite/arm_abs_global.sh: Ditto.
4888 * testsuite/arm_abs_lib.s: Ditto.
4889
4890 2010-02-11 Ian Lance Taylor <iant@google.com>
4891
4892 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4893 Read_relocs task.
4894 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4895 Allocate_commons_task first.
4896 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4897 task, rather than symtab_lock_.
4898 (Gc_process_relocs::~Gc_process_relocs): New function.
4899 (Gc_process_relocs::is_runnable): Check this_blocker_.
4900 (Gc_process_relocs::locks): Use next_blocker_ rather than
4901 blocker_.
4902 (Scan_relocs::~Scan_relocs): New function.
4903 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4904 symtab_lock_.
4905 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4906 next_blocker_.
4907 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4908 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4909 constructor accordingly.
4910 (class Gc_process_relocs): Likewise.
4911 (class Scan_relocs): Likewise.
4912 * common.h (class Allocate_commons_task): Remove symtab_lock_
4913 field, and corresponding constructor parameter.
4914 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4915 symtab_lock_.
4916 (Allocate_commons_task::locks): Likewise.
4917
4918 2010-02-11 Ian Lance Taylor <iant@google.com>
4919
4920 * gold-threads.h (class Once): Define.
4921 (class Initialize_lock): Rewrite as child of Once.
4922 * gold-threads.cc (class Once_initialize): Define.
4923 (once_pointer_control): New static variable.
4924 (once_pointer, once_arg): New static variables.
4925 (c_run_once): New static function.
4926 (Once::Once, Once::run_once, Once::internal_run): New functions.
4927 (class Initialize_lock_once): Remove.
4928 (initialize_lock_control): Remove.
4929 (initialize_lock_pointer): Remove.
4930 (initialize_lock_once): Remove.
4931 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4932 (Initialize_lock::initialize): Rewrite.
4933 (Initialize_lock::do_run_once): New function.
4934 * archive.cc (Archive::interpret_header): Only clear name if it is
4935 not already empty.
4936 * fileread.cc: Include "gold-threads.h"
4937 (file_counts_lock): New static variable.
4938 (file_counts_initialize_lock): Likewise.
4939 (File_read::release): Only increment counts when using --stats.
4940 Use a lock around the increment.
4941 * parameters.cc (class Set_parameters_target_once): Define.
4942 (set_parameters_target_once): New static variable.
4943 (Parameters::Parameters): Move here from parameters.h.
4944 (Parameters::set_target): Rewrite.
4945 (Parameters::set_target_once): New function.
4946 (Parameters::clear_target): Move here and rewrite.
4947 * parameters.h (class Parameters): Update declarations. Add
4948 set_parameters_target_once_ field.
4949 (Parameters::Parameters): Move to parameters.cc.
4950 (Parameters::clear_target): Likewise.
4951 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4952 task.
4953 (Start_group::~Start_group): New function.
4954 (Start_group::is_runnable): New function.
4955 (Start_group::locks, Start_group::run): New functions.
4956 (Finish_group::run): Change saw_undefined to size_t.
4957 * readsyms.h (class Start_group): Define.
4958 (class Finish_group): Change saw_undefined_ field to size_t.
4959 (Finish_group::Finish_group): Remove saw_undefined and
4960 this_blocker parameters. Change all callers.
4961 (Finish_group::set_saw_undefined): New function.
4962 (Finish_group::set_blocker): New function.
4963 * symtab.h (class Symbol_table): Change saw_undefined to return
4964 size_t. Change saw_undefined_ field to size_t.
4965 * target-select.cc (Set_target_once::do_run_once): New function.
4966 (Target_selector::Target_selector): Initialize set_target_once_
4967 field. Don't initialize lock_ and initialize_lock_ fields.
4968 (Target_selector::instantiate_target): Rewrite.
4969 (Target_selector::set_target): New function.
4970 * target-select.h (class Set_target_once): Define.
4971 (class Target_selector): Update declarations. Make
4972 Set_target_once a friend. Remove lock_ and initialize_lock_
4973 fields. Add set_target_once_ field.
4974
4975 2010-02-10 Ian Lance Taylor <iant@google.com>
4976
4977 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4978 queueing any tasks.
4979 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4980 (queue_middle_tasks): Add all blockers before queueing any tasks.
4981 (queue_final_tasks): Likewise.
4982 * token.h (Task_token::add_blockers): New function.
4983 * object.h (Input_objects::number_of_relobjs): New function.
4984
4985 2010-02-10 Ian Lance Taylor <iant@google.com>
4986
4987 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4988 shared, not if not position independent.
4989 * x86_64.cc (Relocate::relocate_tls): Likewise.
4990 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4991 (tls_pie_pic_test): New target.
4992 * testsuite/Makefile.in: Rebuild.
4993
4994 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4995 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4996 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4997 * testsuite/Makefile.in: Rebuild.
4998
4999 2010-02-09 David S. Miller <davem@davemloft.net>
5000
5001 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
5002 R_SPARC_RELATIVE using ->add_local_relative().
5003 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
5004
5005 * output.h (Output_data_dynamic::add_section_size): New method
5006 that takes two Output_data objects.
5007 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
5008 entry param. Handle it in initializers.
5009 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
5010 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
5011 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
5012 arg.
5013 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
5014 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
5015 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
5016 for dynrel_includes_plt.
5017 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5018 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5019 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
5020 before .rela.plt
5021 (Target_sparc::do_finalize_sections): Update to pass true for
5022 dynrel_includes_plt.
5023 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
5024 output before .rela.plt
5025 (Target_powerpc::do_finalize_sections): Update to pass true for
5026 dynrel_includes_plt when 32-bit.
5027
5028 2010-02-08 Doug Kwan <dougkwan@google.com>
5029
5030 * arm.cc (Arm_relobj::simple_input_section_output_address): New
5031 method.
5032 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
5033 Arm_relobj::scan_section_for_cortex_a8_stubs,
5034 Arm_relobj::do_relocation_section): Instead of calling
5035 Output_section::output_address, use faster
5036 Arm_relobj::simple_input_section_output_address.
5037
5038 2010-02-08 David S. Miller <davem@davemloft.net>
5039
5040 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
5041 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
5042 relocation helper function.
5043
5044 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
5045 just like R_SPARC_GOT{10,13,22}.
5046 (Target_sparc::Scan::local): Likewise.
5047 (Target_sparc::Relocate:relocate): Likewise.
5048
5049 2010-02-06 Ian Lance Taylor <iant@google.com>
5050
5051 * configure.ac: Rewrite targetobjs duplicate removal code to use
5052 only shell constructs.
5053 * configure: Rebuild.
5054
5055 2010-02-05 Doug Kwan <dougkwan@google.com>
5056
5057 PR 11247
5058 * arm.cc (Arm_relobj::section_is_scannable): New method.
5059 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
5060 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
5061
5062 2010-02-04 Doug Kwan <dougkwan@google.com>
5063
5064 PR 11247
5065 * arm-reloc-property.cc (cstdio): Include.
5066 * configure.ac (targetobjs): Remove duplicates.
5067 * configure: Regenerate.
5068 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
5069 big and little endian version for a given address size.
5070
5071 2010-02-03 Doug Kwan <dougkwan@google.com>
5072
5073 * arm-reloc-property.cc
5074 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5075 definition.
5076 * arm-reloc-property.h
5077 (Arm_reloc_property_table::get_implemented_static_reloc_property):
5078 New method definition.
5079 (Arm_reloc_property_table::reloc_name_in_error_message): New method
5080 declaration.
5081 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
5082 overflow to N.
5083 (GOT_PREL): Change implemented to Y.
5084 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
5085 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
5086 (Arm_relocate_functions::movw_abs_nc): Remove method.
5087 (Arm_relocate_functions::movt_abs): Ditto.
5088 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
5089 (Arm_relocate_functions::thm_movt_abs): Ditto.
5090 (Arm_relocate_functions::movw_rel_nc): Ditto.
5091 (Arm_relocate_functions::movw_rel): Ditto.
5092 (Arm_relocate_functions::movt_rel): Ditto.
5093 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
5094 (Arm_relocate_functions:thm_movw_rel): Ditto.
5095 (Arm_relocate_functions:thm_movt_rel): Ditto.
5096 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
5097 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
5098 New method definitions.
5099 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
5100 (Arm_relocation_functions::arm_grp_ldr): Ditto.
5101 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
5102 (Arm_relocation_functions::arm_grp_ldc): Ditto.
5103 (Target_arm::Relocate::relocate): Check for non-static or
5104 unimplemented relocation code and exit early. Change calls to
5105 Target_arm::reloc_uses_thumb_bit and
5106 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
5107 instead. Refactor code to handle similar relocations to increase
5108 code sharing. Remove check for unsupported relocation code in switch
5109 statement.
5110 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
5111 relocation property table to find out size. Change error message to
5112 print out the name of a relocation code instead of the numeric value.
5113 (Target_arm::scan_reloc_for_stub): Use relocation property table
5114 instead of calling Target_arm::reloc_uses_thumb_bit().
5115
5116 2010-02-02 Doug Kwan <dougkwan@google.com>
5117
5118 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
5119 types of relaxed input section.
5120
5121 2010-02-02 Doug Kwan <dougkwan@google.com>
5122
5123 * Makefile.am (HFILES): Add arm-reloc-property.h.
5124 (DEFFILES): New.
5125 (TARGETSOURCES): Add arm-reloc-property.cc
5126 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
5127 (libgold_a_SOURCES): $(DEFFILES)
5128 * Makefile.in: Regenerate.
5129 * arm-reloc-property.cc: New file.
5130 * arm-reloc-property.h: New file.
5131 * arm-reloc.def: New file.
5132 * arm.cc: Update comments.
5133 (arm-reloc-property.h): New included header.
5134 (arm_reloc_property_table): New global variable.
5135 (Target_arm::do_select_as_default_target): New method definition.
5136 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
5137 arm-reloc-property to targ_extra_obj.
5138 * parameters.cc (set_parameters_target): Call
5139 Target::select_as_default_target().
5140 * target.h (Target::select_as_default_target): New method definition.
5141 (Target::do_select_as_default_target): Same.
5142
5143 2010-02-01 Doug Kwan <dougkwan@google.com>
5144
5145 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
5146 first_output_text_section_.
5147 (Arm_exidx_fixup::first_output_text_section): New method definition.
5148 (Arm_exidx_fixup::first_output_text_section_): New data member.
5149 (Arm_exidx_fixup::process_exidx_section): Record the first text
5150 output section seen.
5151 (Arm_output_section::fix_exidx_coverage): Set correct linked section
5152 and entsize in output section header.
5153
5154 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5155
5156 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
5157 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
5158 (Arm_relocate_functions::thm_alu11): New Method.
5159 (Arm_relocate_functions::thm_pc8): New Method.
5160 (Arm_relocate_functions::thm_pc12): New Method.
5161 (Target_arm::Scan::local): Handle the relocations.
5162 (Target_arm::Scan::global): Likewise.
5163 (Target_arm::Relocate::relocate): Likewise.
5164 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
5165
5166 2010-01-29 Doug Kwan <dougkwan@google.com>
5167
5168 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
5169 of relocation types as ld.
5170
5171 2010-01-29 Doug Kwan <dougkwan@google.com>
5172
5173 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
5174 to public.
5175 (Arm_relocate_functions::thumb_branch_common): Ditto.
5176 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
5177 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
5178 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
5179 Arm_relocate_functions::jump24): Remove.
5180 (Target_arm::Relocate::relocate): Adjust code to call
5181 Arm_relocation_functions::arm_branch_common and
5182 Arm_relocation_functions::thumb_branch_common instead of their removed
5183 wrappers. Merge switch-cases together to reduce source code size.
5184
5185 2010-01-29 Doug Kwan <dougkwan@google.com>
5186
5187 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
5188 output_local_symbol_count_needs_update_.
5189 (Arm_relobj::output_local_symbol_count_needs_update,
5190 Arm_relobj::set_output_local_symbol_count_needs_update,
5191 Arm_relobj::update_output_local_symbol_count): New methods.
5192 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5193 member.
5194 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5195 of pointed function as in a R_ARM_PREL31 relocation.
5196 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5197 for output local symbol count updating.
5198 (Target_arm::do_relax): Update output local symbol counts in objects
5199 if necessary.
5200 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5201
5202 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5203
5204 * arm.cc: Added support for the ARM relocations:
5205 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5206 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5207 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5208 movw_prel_nc).
5209 (Arm_relocate_functions::movw_rel): New method.
5210 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5211 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5212 thm_movw_prel_nc).
5213 (Arm_relocate_functions::thm_movw_rel): New method.
5214 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5215 thm_movt_prel).
5216 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5217 relocations.
5218 (Target_arm::Scan::global): Likewise.
5219 (Target_arm::Relocate::relocate): Likewise.
5220 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5221 Likewise.
5222
5223 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5224
5225 * arm.cc: Added support for ARM group relocations.
5226 (Target_arm::reloc_needs_sym_origin): New method.
5227 (Arm_relocate_functions::calc_grp_kn): New method.
5228 (Arm_relocate_functions::calc_grp_residual): New method.
5229 (Arm_relocate_functions::calc_grp_gn): New method.
5230 (Arm_relocate_functions::arm_grp_alu): New Method.
5231 (Arm_relocate_functions::arm_grp_ldr): New Method.
5232 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5233 (Arm_relocate_functions::arm_grp_ldc): New Method.
5234 (Target_arm::Scan::local): Handle the ARM group relocations.
5235 (Target_arm::Scan::global): Likewise.
5236 (Target_arm::Relocate::relocate): Likewise.
5237 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5238 Likewise.
5239
5240 2010-01-26 Doug Kwan <dougkwan@google.com>
5241
5242 * arm.cc (set): Include.
5243 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5244 pointer type.
5245 (Arm_output_section::Text_section_list): New type.
5246 (Arm_output_section::append_text_sections_to_list): New method.
5247 (Arm_output_section::fix_exidx_coverage): Ditto.
5248 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5249 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5250 Relobj::set_section_offset() instead of
5251 Sized_relobj::invalidate_section_offset().
5252 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5253 parameter for section headers. Ignore relocation sections for
5254 unallocated sections and EXIDX sections.
5255 (Target_arm::fix_exidx_coverage): New method.
5256 (Target_arm::output_section_address_less_than): New type.
5257 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5258 linked text section instead of the EXIDX section.
5259 (Arm_output_section::create_stub_group): Add an assertion to check
5260 that this is not an EXIDX output section.
5261 (Arm_output_section::append_text_sections_to_list): New method.
5262 (Arm_output_section::fix_exidx_coverage): Ditto.
5263 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5264 Arm_relobj::section_needs_reloc_stub_scanning.
5265 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5266 first pass.
5267 (Target_arm::fix_exidx_coverage): New method.
5268 * object.h (Relobj::set_output_section): New method.
5269 (Sized_relobj::invalidate_section_offset): Remove method.
5270 (Sized_relobj::do_invalidate_section_offset): Remove method.
5271 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5272
5273 2010-01-25 Doug Kwan <dougkwan@google.com>
5274
5275 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5276 Fix warning due to signed and unsigned comparison on a 32-bit host.
5277
5278 2010-01-22 Doug Kwan <dougkwan@google.com>
5279
5280 * arm.cc (Target_arm::do_relax): Record an output section for section
5281 offset adjustment it contains any stub table that has changed.
5282 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5283 offsets in an output section if necessary.
5284 * output.cc (Output_section::Output_section): Initialize
5285 section_offsets_need_adjustments_.
5286 (Output_section::add_input_section_for_script): Renamed to
5287 Output_section::add_simple_input_section.
5288 (Output_section::save_states): Add a comment.
5289 (Output_section::discard_states): New method defintion.
5290 (Output_section::adjust_section_offsets): Same.
5291 * output.h (Output_section::add_input_section_for_script): Renamed to
5292 Output_section::add_simple_input_section.
5293 (Output_section::discard_states): New method declaration.
5294 (Output_section::adjust_section_offsets): Same.
5295 (Output_section::section_offsets_need_adjustment,
5296 Output_section::set_section_offsets_need_adjustment): New method
5297 definitions.
5298 (Output_section::section_offsets_need_adjustment_): New data member.
5299 * script-sections.cc
5300 (Output_section_element_input::set_section_address): Adjust code for
5301 renaming of Output_section::add_input_section_for_script.
5302 (Orphan_output_section::set_section_address): Same.
5303
5304 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5305
5306 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5307 Fix_v4bx enum values .
5308 * gold/options.h (General_options): New option definitions.
5309 (General_options::fix_v4bx): New method.
5310 (General_options::Fix_v4bx): New enum.
5311 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5312 (General_options::parse_fix_v4bx_interworking): New method.
5313
5314 2010-01-22 Doug Kwan <dougkwan@google.com>
5315
5316 * arm.cc (Arm_exidx_fixup): New class.
5317
5318 2010-01-21 Doug Kwan <dougkwan@google.com>
5319
5320 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5321 classes.
5322 (Arm_exidx_section_offset_map): New type.
5323
5324 2010-01-21 Doug Kwan <dougkwan@google.com>
5325
5326 * arm.cc (Arm_exidx_input_section): New class.
5327 (Arm_relobj::exidx_input_section_by_link,
5328 Arm_relobj::exidx_input_section_by_shndx,
5329 Arm_relobj::make_exidx_input_section): New methods.
5330 (read_arm_attributes_section): Remove.
5331 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5332 information about them.
5333 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5334 to here.
5335
5336 2010-01-20 Doug Kwan <dougkwan@google.com>
5337
5338 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5339 Input_section_specifier to Section_id.
5340 (Target_arm::new_arm_input_section: Adjust code for change of key
5341 type.
5342 (Target_arm::find_arm_input_section): Ditto.
5343 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5344 (Section_id): Remove.
5345 (Garbage_collection::Section_id_hash): Remove.
5346 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5347 (Section_id): Remove.
5348 (Icf::Section_id_hash): Remove.
5349 * object.h (Section_id, Const_section_id, Section_id_hash,
5350 Const_section_id_hash): New type definitions.
5351 * output.cc (Output_section::add_relaxed_input_section): Change to
5352 use Const_section_id instead of Input_section_specifier as key type.
5353 (Output_section::add_merge_input_section): Ditto.
5354 (Output_section::build_relaxation_map): Change to use Section_id
5355 instead of Input_section_specifier as key type.
5356 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5357 Ditto.
5358 (Output_section::convert_input_sections_to_relaxed_sections): Change
5359 to use Const_section_id instead of Input_section_specifier as key type.
5360 (Output_section::find_merge_section): Ditto.
5361 (Output_section::find_relaxed_input_section): Ditto.
5362 * output.h (Input_section_specifier): Remove class.
5363 (Output_section::Output_section_data_by_input_section_map): Change
5364 key type to Const_section_id.
5365 (Output_section::Output_relaxed_input_section_by_input_section_map):
5366 Ditto.
5367 (Output_section::Relaxation_map): Change key type to Section_id.
5368
5369 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5370
5371 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5372 (class Arm_v4bx_stub): New class.
5373 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5374 (Stub_factory::make_arm_v4bx_stub): New method.
5375 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5376 (Stub_table::empty): Handle v4bx stubs.
5377 (Stub_table::add_arm_v4bx_stub): New method.
5378 (Stub_table::find_arm_v4bx_stub): New method.
5379 (Arm_relocate_functions::v4bx): New method.
5380 (Target_arm::fix_v4bx): New method.
5381 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5382 (Stub_table::relocate_stubs): Likewise.
5383 (Stub_table::do_write): Likewise.
5384 (Stub_table::update_data_size_and_addralign): Likewise.
5385 (Stub_table::finalize_stubs): Likewise.
5386 (Target_arm::Scan::local): Likewise.
5387 (Target_arm::Scan::global): Likewise.
5388 (Target_arm::do_finalize_sections): Likewise.
5389 (Target_arm::Relocate::relocate): Likewise.
5390 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5391 Likewise.
5392 (Target_arm::scan_reloc_for_stub): Likewise.
5393 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5394
5395 2010-01-19 Ian Lance Taylor <iant@google.com>
5396
5397 * output.cc (Output_section_headers::do_sized_write): Write large
5398 segment count to sh_info field.
5399 (Output_file_header::do_sized_write): For large segment count,
5400 write PN_XNUM to e_phnum field.
5401
5402 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5403
5404 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5405 (Arm_relocate_functions::thm_jump8): New function.
5406 (Arm_relocate_functions::thm_jump11): New function.
5407 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5408 R_ARM_THM_JUMP11.
5409 (Target_arm::Scan::global): Likewise.
5410 (Target_arm::Relocate::relocate): Likewise.
5411 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5412 Likewise.
5413
5414 2010-01-14 Doug Kwan <dougkwan@google.com>
5415
5416 * arm.cc (map, utility): Include headers.
5417 (Target_arm::apply_cortex_a8_workaround): New method.
5418 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5419 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5420 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5421 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5422 the --[no-]fix-cortex-a8 command line options.
5423 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5424 (Target_arm::relocate_stub): Use addend in instruction template.
5425 * options.h (DEFINE_bool): Set the user-set flag.
5426 (General_options): Add --[no-]-fix-cortex options.
5427 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5428 : Update fast look-up map after conversion.
5429
5430 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5431
5432 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5433 in the first pass of do_layout.
5434
5435 2010-01-13 Doug Kwan <dougkwan@google.com>
5436
5437 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5438 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5439 apparent compiler problem of not folding static constant integral
5440 data members of elfcpp::Elf_sizes<32>.
5441
5442 2010-01-13 Doug Kwan <dougkwan@google.com>
5443
5444 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5445 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5446 Arm_relobj::scan_section_for_cortex_a8_erratum,
5447 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5448 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5449 sections to scan for relocation stubs into a new method
5450 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5451 relocation and Cortex-A8 stub scanning.
5452 (Target_arm::do_relax): Force stubs to be after stubbed sections
5453 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5454 the beginning of a new relaxation pass. Update a comment.
5455 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5456
5457 2010-01-12 Ian Lance Taylor <iant@google.com>
5458
5459 * target-reloc.h (visibility_error): New inline function.
5460 (relocate_section): Call visibility_error.
5461 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5462 (MOSTLYCLEANFILES): Likewise.
5463 (protected_4_pic.o, protected_3.err): New targets.
5464 * testsuite/protected_4.cc: New file.
5465
5466 2010-01-12 Doug Kwan <dougkwan@google.com>
5467
5468 * arm.cc (Cortex_a8_reloc): New class.
5469 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5470 and cortex_a8_relocs_info_.
5471 (Target_arm::fix_cortex_a8): New method definition.
5472 (Target_arm::Cortex_a8_relocs_info): New type.
5473 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5474 New data member declarations.
5475 (Target_arm::scan_reloc_for_stub): Record information about
5476 relocations for THUMB branches that might be exempted from the
5477 Cortex-A8 workaround.
5478 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5479 at the beginning of a relaxation pass.
5480
5481 2010-01-12 Doug Kwan <dougkwan@google.com>
5482
5483 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5484 (Arm_relobj::Mapping_symbol_position,
5485 Arm_reloj::Mapping_symbol_position_less,
5486 Arm_relobj::Mapping_symbols_info): New types.
5487 (Target_arm::is_mapping_symbol_name): New method definition.
5488 (Arm_relobj::do_count_local_symbols): Save information about mapping
5489 symbols.
5490
5491 2010-01-11 Doug Kwan <dougkwan@google.com>
5492
5493 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5494 Arm_relocate_functions::thumb32_branch_upper,
5495 Arm_relocate_functions::thumb32_branch_lower,
5496 Arm_relocate_functions::thumb32_cond_branch_offset,
5497 Arm_relocate_functions::thumb32_cond_branch_upper,
5498 Arm_relocate_functions::thumb32_cond_branch_lower,
5499 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5500 branch offset encoding.
5501 (Arm_relocate_functions::thumb_branch_common): Use new branch
5502 offset encoding methods to avoid code duplication.
5503 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5504 (Stub_addend_reader::operator()): Use new branch encoding method
5505 to avoid code duplication.
5506
5507 2010-01-11 Doug Kwan <dougkwan@google.com>
5508
5509 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5510 (Target_arm::do_finalize_sections): Define special EXIDX section
5511 symbols only if referenced.
5512 * gc.h (Garbage_collection::add_reference): New method.
5513 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5514 code duplication.
5515
5516 2010-01-11 Ian Lance Taylor <iant@google.com>
5517
5518 * script.cc (Version_script_info::build_expression_list_lookup):
5519 Change complaing about duplicate wildcard match from error to
5520 warning.
5521
5522 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5523 of 2009-12-30.
5524 (Version_script_info::Version_script_info): Initialize globs_,
5525 default_version_, default_is_global_, and exact_. Don't
5526 initialize globals_ or locals_.
5527 (Version_script_info::build_lookup_tables): Build local symbols
5528 first.
5529 (Version_script_info::unquote): New function.
5530 (Version_script_info::add_exact_match): New function.
5531 (Version_script_info::build_expression_list_lookup): Remove lookup
5532 parameter. Add is_global parameter. Change all callers. Handle
5533 wildcard pattern specially. Unquote pattern. Call
5534 add_exact_match.
5535 (Version_script_info::get_name_to_match): New function.
5536 (Version_script_info::get_symbol_version): New function.
5537 (Version_script_info::get_symbol_version_helper): Remove.
5538 (Version_script_info::check_unmatched_names): Call unquote.
5539 * script.h (class Version_script_info): Change get_symbol_version
5540 to be non-inline and add is_global parameter; change all callers.
5541 Rewrite symbol_is_local. Update declarations. Define struct
5542 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5543 Remove globals_ and locals_ members. Add exact_, globs_,
5544 default_version_, is_global_.
5545 (Version_script_info::Glob): Remove pattern, add expression and
5546 is_global. Update constructor. Change all callers.
5547 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5548 default version.
5549 (Versions::symbol_section_contents): If a symbol is undefined, or
5550 defined in a dynamic object, set the version index to
5551 VER_NDX_LOCAL.
5552 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5553 symbol_is_local.
5554 (Symbol_table::add_from_pluginobj): Likewise.
5555 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5556
5557 2010-01-11 Doug Kwan <dougkwan@google.com>
5558
5559 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5560 (incremental_dump_LDADD): Add linking option for libintl.
5561 * Makefile.in: Regenerate.
5562
5563 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5564
5565 PR gold/11144
5566 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5567 instead of -Ds.
5568 * testsuite/Makefile.in: Regenerated.
5569
5570 2010-01-10 Doug Kwan <dougkwan@google.com>
5571
5572 * options.h (DEFINE_var): Use parentheses around argument varname__
5573 in macro body to avoid any unintended subsequent substitutions.
5574
5575 2010-01-10 Ian Lance Taylor <iant@google.com>
5576
5577 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5578 candidates before doing symbol resolution.
5579
5580 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5581 ODR candidates if only one is weak.
5582
5583 2010-01-08 Ian Lance Taylor <iant@google.com>
5584
5585 * script.cc (Version_script_info::build_expression_list_lookup):
5586 Don't warn about ambiguous version, just record the ambiguity.
5587 (Version_script_info::get_symbol_version_helper): Give error if
5588 version is ambiguous.
5589
5590 2010-01-08 Doug Kwan <dougkwan@google.com>
5591
5592 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5593 prev_data_size_ and prev_addralign_. Remove initializer for
5594 deleted data member has_been_changed_.
5595 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5596 to determine if the table is empty.
5597 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5598 Remove.
5599 (Stub_table::add_reloc_stub): Define method in class definition
5600 instead of just declaring it there.
5601 (Stub_table::add_cortex_a8_stub): New method definition.
5602 (Stub_table::update_data_size_and_addralign): Ditto.
5603 (Stub_table::finalize_stubs): Ditto.
5604 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5605 (Stub_table::do_addralign_): Return address alignment in the
5606 (Stub_table::do_reset_address_and_file_offset): Define method in
5607 class definition instead of declaring it there. Set current data
5608 size to be the data size of the previous pass.
5609 (Stub_table::set_final_data_size): Use current data size as the
5610 final data size.
5611 (Stub_table::relocate_stub): Change parameter type of stub from
5612 Reloc_stub pointer to Stub pointer.
5613 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5614 (Stub_table::Cortex_a8_stub_list): New typedef.
5615 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5616 Stub_table::prev_addralign_): New data member.
5617 (Arm_relobj::Arm_relobj): Initialize data member
5618 section_has_cortex_a8_workaround_.
5619 (Arm_relobj::section_has_cortex_a8_workaround,
5620 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5621 definitions.
5622 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5623 declarations.
5624 (Target_arm::relocate_stub): Change parameter type of stub from
5625 Reloc_stub pointer to Stub pointer.
5626 (Insn_template::size, Insn_template::alignment): Handle
5627 THUMB16_SPECIAL_TYPE.
5628 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5629 Stub_table::update_data_size_and_addralign,
5630 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5631 definitions.
5632 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5633 (Stub_table::do_write): Ditto.
5634 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5635
5636 2010-01-08 Ian Lance Taylor <iant@google.com>
5637
5638 PR 11108
5639 * symtab.h (class Symbol): Remove fields is_target_special_ and
5640 has_plt_offset_. Add field is_defined_in_discarded_section_.
5641 (Symbol::is_defined_in_discarded_section): New function.
5642 (Symbol::set_is_defined_in_discarded_section): New function.
5643 (Symbol::has_plt_offset): Rewrite.
5644 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5645 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5646 Don't initialize is_target_special_ or has_plt_offset_.
5647 Initialize is_defined_in_discarded_section_.
5648 (Symbol_table::add_from_relobj): If appropriate, set
5649 is_defined_in_discarded_section.
5650 * resolve.cc (Symbol::override_base_with_special): Don't test
5651 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5652 * target-reloc.h (relocate_section): Do special handling for
5653 symbols defined in discarded sections for global symbols as well
5654 as local symbols.
5655
5656 2010-01-08 Ian Lance Taylor <iant@google.com>
5657
5658 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5659 the SHT_SYMTAB case.
5660
5661 2010-01-08 Ian Lance Taylor <iant@google.com>
5662
5663 * object.cc (Sized_relobj::do_layout): Don't get confused if
5664 layout_eh_frame returns NULL.
5665
5666 2010-01-08 Ian Lance Taylor <iant@google.com>
5667
5668 PR 11084
5669 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5670 dynamic symbol table, use the normal symbol table.
5671 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5672 symbol table.
5673
5674 2010-01-08 Ian Lance Taylor <iant@google.com>
5675
5676 PR 11072
5677 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5678 sections.
5679
5680 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5681
5682 * version.cc (print_version): Change to "Copyright 2010".
5683
5684 2010-01-08 Ian Lance Taylor <iant@google.com>
5685
5686 PR 10287
5687 PR 11063
5688 * i386.cc (class Target_i386): Change return type of plt_section
5689 to be non-const.
5690 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5691 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5692 tls_desc_rel_ field.
5693 (Output_data_plt_i386::rel_tls_desc): New function.
5694 (Target_i386::rel_tls_desc_section): New function.
5695 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5696 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5697 R_386_TLS_DESC reloc in rel_tls_desc_section.
5698 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5699 Define struct Tlsdesc_info.
5700 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5701 (Target_x86_64::do_reloc_symbol_index): New function.
5702 (Target_x86_64::add_tlsdesc_info): New function.
5703 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5704 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5705 tlsdesc_rel_ field.
5706 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5707 all callers.
5708 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5709 (Target_x86_64::rela_tlsdesc_section): New function.
5710 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5711 handling.
5712 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5713 (Target_x86_64::do_reloc_addend): New function.
5714 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5715 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5716 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5717 (Output_reloc::type): New function.
5718 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5719 (Output_reloc::is_target_specific): New function.
5720 (Output_reloc::target_arg): New function.
5721 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5722 absolute relocs and target specific relocs.
5723 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5724 add_target_specific.
5725 (class Output_data_reloc) [SHT_RELA]: Likewise.
5726 * output.cc (Output_reloc::Output_reloc): Add four new versions
5727 for absolute relocs and target specific relocs.
5728 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5729 (Output_reloc::get_symbol_index): Likewise.
5730 (Output_reloc::local_section_offset): Check that local_sym_index_
5731 is not TARGET_CODE or 0.
5732 (Output_reloc::symbol_value): Likewise.
5733 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5734 reloc.
5735 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5736 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5737 functions.
5738 * layout.cc (add_target_dynamic_tags): Use output section for
5739 DT_PLTRELSZ and DT_JMPREL.
5740
5741 2010-01-07 Ian Lance Taylor <iant@google.com>
5742
5743 PR 11061
5744 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5745 function.
5746 (class Output_data_reloc_generic): Define.
5747 (class Output_data_reloc_base): Change base class to
5748 Output_data_reloc_generic. Change add() method to call
5749 bump_relative_reloc_count for a relative reloc. Remove
5750 sort_relocs_ field.
5751 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5752 to sort_relocs().
5753 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5754 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5755 appropriate.
5756 * layout.h (class Layout): Update declaration.
5757
5758 2010-01-07 Ian Lance Taylor <iant@google.com>
5759
5760 * output.h (class Output_data): Add const version of
5761 output_section and do_output_section.
5762 (class Output_section_data): Add const version of
5763 do_output_section.
5764 (class Output_section): Likewise.
5765 * layout.cc (Layout::add_target_dynamic_tags): New function.
5766 * layout.h (class Layout): Update declarations.
5767 * arm.cc (Target_arm::do_finalize_sections): Use
5768 add_target_dynamic_tags.
5769 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5770 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5771 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5772 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5773
5774 2010-01-07 Ian Lance Taylor <iant@google.com>
5775
5776 PR 11042
5777 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5778 object as needed.
5779
5780 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5781 Ian Lance Taylor <iant@google.com>
5782
5783 PR 11019
5784 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5785 Xindex::read_symtab_xindex.
5786
5787 2010-01-07 Doug Kwan <dougkwan@google.com>
5788
5789 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5790 (Insn_template::thumb16_bcond_insn): New method declaration.
5791 (Insn_template): Fix spelling.
5792 (Stub::thumb16_special): New method declaration.
5793 (Stub::do_write): Define virtual method which was previously pure
5794 virtual.
5795 (Stub::do_thumb16_special): New method declaration.
5796 (Stub::do_fixed_endian_write): New template member.
5797 (Reloc_stub::do_write): Remove.
5798 (Reloc_stub::do_fixed_endian_write): Remove.
5799 (Cortex_a8_stub): New class definition.
5800 (Stub_factory::make_cortex_a8_stub): New method definition.
5801 (Stub_factory::Stub_factory): Add missing static storage class
5802 qualifier for elf32_arm_stub_a8_veneer_blx.
5803
5804 2010-01-07 Ian Lance Taylor <iant@google.com>
5805
5806 PR 10980
5807 * options.h (class General_options): Add --warn-unresolved-symbols
5808 and --error-unresolved-symbols.
5809 * errors.cc (Errors::undefined_symbol): Implement
5810 --warn-unresolved-symbols.
5811
5812 * options.h (class General_options): Add -z text and -z textoff.
5813 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5814
5815 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5816
5817 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5818 (Garbage_collection::cident_sections): New function.
5819 (Garbage_collection::add_cident_section): New function.
5820 (Garbage_collection::cident_sections_): New member.
5821 (gc_process_relocs): Add references to sections whose names are C
5822 identifiers.
5823 * gold.h (cident_section_start_prefix): New constant.
5824 (cident_section_stop_prefix): New constant.
5825 (is_cident): New function.
5826 * layout.cc (Layout::define_section_symbols): Replace string constants
5827 with the newly defined constants.
5828 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5829 C identifiers.
5830 * testsuite/Makefile.am: Add gc_orphan_section_test.
5831 * testsuite/Makefile.in: Regenerate.
5832 * testsuite/gc_orphan_section_test.cc: New file.
5833 * testsuite/gc_orphan_section_test.sh: New file.
5834
5835 2010-01-06 Ian Lance Taylor <iant@google.com>
5836
5837 PR 10980
5838 * options.h (class General_options): Add --warn-shared-textrel.
5839 * layout.cc (Layout::finish_dynamic_section): Implement
5840 --warn-shared-textrel.
5841
5842 PR 10980
5843 * options.h (class General_options): Add --warn-multiple-gp.
5844
5845 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5846
5847 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5848 $(THREADSLIB) and $(LIBDL).
5849 * Makefile.in: Rebuild.
5850
5851 2010-01-06 Ian Lance Taylor <iant@google.com>
5852
5853 PR 10980
5854 * options.cc (General_options::parse_section_start): New function.
5855 (General_options::section_start): New function.
5856 (General_options::General_options): Initialize all members.
5857 * options.h: Include <map>
5858 (class General_options): Add --section-start. Add section_starts_
5859 member.
5860 * layout.cc (Layout::attach_allocated_section_to_segment): If
5861 --section-start was used, set the address of the segment. Remove
5862 local sort_sections.
5863 (Layout::relaxation_loop_body): If the address of the load segment
5864 has been set by --section-start, don't use it.
5865 * output.h (Output_segment::update_flags_for_output_section): New
5866 function.
5867 * output.cc (Output_segment::add_output_section): Call
5868 update_flags_for_output_section.
5869
5870 2010-01-05 Ian Lance Taylor <iant@google.com>
5871
5872 PR 10980
5873 * options.h (class General_options): Add --undefined-version.
5874 * script.cc (struct Version_expression): Add was_matched_by_symbol
5875 field.
5876 (Version_script_info::matched_symbol): New function.
5877 (Version_script_info::get_symbol_version_helper): Call
5878 matched_symbol.
5879 (Version_script_info::check_unmatched_names): New function.
5880 * script.h (class Version_script_info): Update declarations.
5881 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5882
5883 * options.h (class General_options): Use DEFINE_bool_alias for
5884 allow_multiple_definition.
5885 * resolve.cc (Symbol_table::should_override): Don't test
5886 allow_multiple_definition.
5887
5888 PR 10980
5889 * options.h (class General_options): Add --cref.
5890 * main.cc (main): Print cref table if --cref. Don't close mapfile
5891 until after printing cref table.
5892 * cref.cc: Include "symtab.h".
5893 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5894 (Cref_table_compare::operator()): New function.
5895 (Cref_inputs::gather_cref): New function.
5896 (filecol): New static const.
5897 (Cref_inputs::print_cref): New function.
5898 (Cref::print_cref): New function.
5899 * cref.h: Include <cstdio>.
5900 (class Cref): Update declarations.
5901 * mapfile.h (Mapfile::file): New function.
5902 * object.h (class Object): Define Symbols. Declare virtual
5903 do_get_global_symbols.
5904 (Object::get_global_symbols): New function.
5905 * object.cc (Input_objects::add_object): Pass object to cref_ if
5906 --cref.
5907 (Input_objects::archive_start): Likewise.
5908 (Input_objects::archive_stop): Likewise.
5909 (Input_objects::print_cref): New function.
5910 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5911 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5912 --cref.
5913 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5914 function.
5915 * plugin.h (class Sized_pluginobj): Update declarations.
5916
5917 2010-01-05 Ian Lance Taylor <iant@google.com>
5918
5919 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5920 to is_default_version. Rename insdef to insdefault.
5921 (Symbol_table::add_from_relobj): Rename def to is_default_version
5922 and local to is_forced_local.
5923 (Symbol_table::add_from_pluginobj): Likewise.
5924 (Symbol_table::add_from_dynobj): Likewise.
5925 (Symbol_table::define_special_symbol): Rename insdef to
5926 insdefault.
5927
5928 2010-01-04 Ian Lance Taylor <iant@google.com>
5929
5930 PR 10980
5931 * options.h (class General_options): Add
5932 --allow-multiple-definition and -z muldefs.
5933 * resolve.cc (Symbol_table::should_override): Don't warn about a
5934 multiple symbol definition if --allow-multiple-definition or -z
5935 muldefs.
5936
5937 PR 10980
5938 * options.h (class General_options): Add --add-needed and
5939 --copy-dt-needed-entries. Tweak --as-needed help entry.
5940 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5941 error if --copy-dt-needed-entries aka --add-needed is used and
5942 would cause a change in behaviour.
5943
5944 PR 10980
5945 * options.h (class General_options): Add -G as a short version of
5946 --shared. Add no-op options -assert, -g, and -i.
5947
5948 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5949
5950 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5951 check for .text or .gnu.linkonce.t sections.
5952 * icf.cc (Icf::find_identical_sections): Ditto.
5953 Change the detection for mangled function name within the section
5954 name.
5955 * icf.h (is_section_foldable_candidate): New function.
5956
5957 2009-12-30 Ian Lance Taylor <iant@google.com>
5958
5959 PR 10980
5960 * options.h (class General_options): Permit two dashes with
5961 --retain-symbols-file.
5962
5963 2009-12-30 Ian Lance Taylor <iant@google.com>
5964
5965 PR 10979
5966 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5967 don't put the file header and segment headers in the text
5968 segment.
5969
5970 PR 10979
5971 * common.cc (Sort_commons::operator()): Stabilize sort when both
5972 entries are NULL.
5973 (Symbol_table::do_allocate_commons_list): When allocating common
5974 symbols, skip a symbol which is no longer common.
5975 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5976 an object before checking its type.
5977 * testsuite/common_test_2.c: New file.
5978 * testsuite/common_test_3.c: New file.
5979 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5980 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5981 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5982 (common_test_2_pic.o, common_test_2.so): New targets.
5983 (common_test_3_pic.o, common_test_3.so): New targets.
5984 * testsuite/Makefile.in: Rebuild.
5985
5986 PR 10979
5987 * script.cc (read_input_script): If we see a new SECTIONS clause,
5988 and we have added an input section, give an error.
5989 * layout.h (class Layout): Add have_added_input_section function.
5990 Add have_added_input_section_ field.
5991 * layout.cc (Layout::Layout): Initialize
5992 have_added_input_section_.
5993 (Layout::layout): Set have_added_input_section_.
5994 (Layout::layout_eh_frame): Likewise.
5995
5996 2009-12-30 Ian Lance Taylor <iant@google.com>
5997
5998 PR 10931
5999 * options.h (class General_options): Add --sort-common option.
6000 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
6001 * common.cc (Sort_common): Add sort_order parameter to
6002 constructor. Add sort_order_ field.
6003 (Sort_commons::operator): Check sort_order_.
6004 (Symbol_table::allocate_commons): Determine the sort order.
6005 (Symbol_table::do_allocate_commons): Add sort_order parameter.
6006 Change all callers.
6007 (Symbol_table::do_allocate_commons_list): Likewise.
6008
6009 2009-12-30 Ian Lance Taylor <iant@google.com>
6010
6011 PR 10916
6012 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
6013 symbols from this object, don't change the visibility of an
6014 undefined symbol.
6015 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
6016
6017 2009-12-30 Ian Lance Taylor <iant@google.com>
6018
6019 PR 10861
6020 * script.h (class Version_script_info): Define Language enum.
6021 Update declarations. Define Glob, Exact, and Lookup types. Add
6022 new fields globals_, locals_, and is_finalized_.
6023 * script.cc: Various formatting fixes.
6024 (class Parser_closure): Change language_stack_ from a vector of
6025 std::string to one of Version_script_info::Language. Adjust all
6026 uses accordingly.
6027 (class Lazy_demangler): Remove.
6028 (struct Version_expression): Change language from std::string to
6029 Version_script_info::Language.
6030 (Version_script_info::Version_script_info): New function.
6031 (Version_script_info::~Version_script_info): Don't call clear.
6032 (Version_script_info::finalize): New function.
6033 (Version_script_info::build_lookup_tables): New function.
6034 (Version_script_info::build_expression_list_lookup): New
6035 function.
6036 (Version_script_info::get_symbol_version_helper): Rewrite to use
6037 lookup tables.
6038 (Version_script_info::print_expression_list): Adjust to use
6039 Version_script_info::Language.
6040 (script_push_lex_into_version_mode): Check that the version script
6041 has not been finalized.
6042 (version_script_push_lang): Change language string to
6043 Version_script_info::Language.
6044 * options.cc (Command_line::version_script): New function.
6045 * options.h (class General_options): Add finalize_dynamic_list
6046 function. Change version_script from declaration to definition.
6047 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
6048 * testsuite/version_script.map: Remove duplicate def of foo.
6049 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
6050 version_script.map.
6051 * testsuite/Makefile.in: Rebuild.
6052
6053 2009-12-30 Ian Lance Taylor <iant@google.com>
6054
6055 PR 10843
6056 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
6057 if the input symbol index is 0, make the output symbol index 0.
6058
6059 2009-12-30 Ian Lance Taylor <iant@google.com>
6060
6061 PR 10670
6062 * options.h (class General_options): Add -x/--discard-all.
6063 * object.cc (Sized_relobj::do_count_local_symbols): Handle
6064 --discard-all. If the local symbol needs a dynamic entry, check
6065 that before handling --discard-locals.
6066
6067 2009-12-30 Ian Lance Taylor <iant@google.com>
6068
6069 PR 10450
6070 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
6071 flags to PF_R.
6072 (Output_segment::add_output_section): Don't change the flags if
6073 the type is PT_TLS.
6074
6075 PR 10450
6076 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
6077 GNU hash table if they need a dynamic value. Otherwise, don't add
6078 them if they are defined in a dynamic object or are forced local.
6079
6080 2009-12-29 Ian Lance Taylor <iant@google.com>
6081
6082 PR 10450
6083 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
6084 .gnu.hash table for a 32-bit target.
6085
6086 PR 10450
6087 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
6088 regular and a dynamic object only needs a dynamic symbol table
6089 entry if it is externally visible.
6090
6091 PR 10450
6092 * i386.cc (class Target_i386): Initialize global_offset_table_ in
6093 constructor. Add global_offset_table_ field.
6094 (Target_i386::got_section): Set global_offset_table_.
6095 (Target_i386::do_finalize_sections): Set global_offset_table_
6096 size.
6097 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
6098 in constructor. Add global_offset_table_ field.
6099 (Target_x86_64::got_section): Set global_offset_table_.
6100 (Target_x86_64::do_finalize_sections): Set global_offset_table_
6101 size.
6102
6103 * layout.cc (Layout::Layout): Initialize increase_relro_.
6104 (Layout::get_output_section): Add is_relro, is_last_relro, and
6105 is_first_non_relro parameters. Change all callers.
6106 (Layout::choose_output_section): Likewise.
6107 (Layout::add_output_section_data): Likewise.
6108 (Layout::make_output_section): Likewise.
6109 (Layout::set_segment_offsets): Clear increase_relro when using a
6110 linker script.
6111 * layout.h (class Layout): Add increase_relro method. Add
6112 increase_relro_ field. Update declarations.
6113 * output.cc (Output_section::Output_section): Initialize
6114 is_last_relro_ and is_first_non_relro_.
6115 (Output_segment::add_output_section): Group relro sections is
6116 do_sort is true. Handle is_last_relro and is_first_non_relro.
6117 (Output_segment::maximum_alignment): Remove relro handling.
6118 (Output_segment::set_section_addresses): Add increase_relro
6119 parameter. Change all callers. Add initial alignment to align
6120 relro sections on separate page. Remove old relro handling.
6121 (Output_segment::set_section_list_addresses): Remove in_relro
6122 parameter. Change all callers.
6123 (Output_segment::set_offset): Add increase parameter. Change all
6124 callers. Remove old relro handling.
6125 * output.h (class Output_section): Add new methods: is_last_relro,
6126 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
6127 Add is_last_relro_ and is_first_non_relro_ fields.
6128 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
6129 Create separate .got.plt section. Call increase_relro.
6130 * x86_64.cc (Target_x86_64::got_section): Likewise.
6131 * testsuite/relro_script_test.t: Add .got.plt.
6132
6133 PR 10450
6134 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
6135 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
6136 (Layout::finalize): Call set_dynamic_symbol_size.
6137 (Layout::set_dynamic_symbol_size): New function.
6138 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
6139 set_dynamic_symbol_size.
6140
6141 PR 10450
6142 * output.h (class Output_section): Add is_entsize_zero_ field.
6143 * output.cc (Output_section::Output_section): Initialize
6144 is_entsize_zero_.
6145 (Output_section::set_entsize): If two different entsizes are
6146 requested, force it to zero.
6147 (Output_section::add_input_section): Set flags for .debug_str
6148 before updating section flags. Set entsize.
6149 (Output_section::update_flags_for_input_section): Set SHF_MERGE
6150 and SHF_STRING if all input sections have those flags.
6151
6152 2009-12-29 Rafael Espindola <espindola@google.com>
6153
6154 * main.cc (main): Fix the sys time reporting.
6155 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
6156 reporting.
6157
6158 2009-12-29 Sriraman Tallam <tmsriram@google.com>
6159
6160 * options.cc (General_options::parse_version): Allow -v to exit
6161 without an error if there is nothing to link.
6162
6163 2009-12-29 Ian Lance Taylor <iant@google.com>
6164
6165 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
6166 using a version of gcc before 4.1.
6167 * configure: Rebuild.
6168
6169 2009-12-28 Chris Demetriou <cgd@google.com>
6170
6171 * attributes.cc (Output_attributes_section_data::do_write): Use
6172 std::vector::front rather than std::vector::data.
6173
6174 2009-12-28 Ian Lance Taylor <iant@google.com>
6175
6176 * symtab.h (class Symbol_table): Add enum Defined.
6177 * resolve.cc (Symbol_table::should_override): Add defined
6178 parameter. Change all callers. Test whether object is NULL
6179 before calling a method on it.
6180 (Symbol_table::report_resolve_problem): Add defined parameter.
6181 Change all callers.
6182 (Symbol_table::should_override_with_special): Likewise.
6183 * symtab.cc (Symbol_table::define_in_output_data): Add defined
6184 parameter. Change all callers.
6185 (Symbol_table::do_define_in_output_data): Likewise.
6186 (Symbol_table::define_in_output_segment): Likewise.
6187 (Symbol_table::do_define_in_output_segment): Likewise.
6188 (Symbol_table::define_as_constant): Likewise.
6189 (Symbol_table::do_define_as_constant): Likewise.
6190 * script.h (class Symbol_assignment): Add is_defsym parameter to
6191 constructor; change all callers.
6192 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6193 parameter. Change all callers. Add is_defsym_ field.
6194 (class Parser_closure): Add parsing_defsym parameter to
6195 constructor; change all callers. Add parsing_defsym accessor
6196 function. Add parsing_defsym_ field.
6197
6198 2009-12-28 Ian Lance Taylor <iant@google.com>
6199
6200 * gold.cc (queue_middle_tasks): Fix formatting.
6201 * object.cc (Relobj::is_section_name_included): Likewise.
6202
6203 2009-12-23 Ian Lance Taylor <iant@google.com>
6204
6205 * i386.cc (Target_i386::do_calls_non_split): Recognize
6206 -fsplit-stack prologue for a function with a static chain.
6207 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6208 -fsplit-stack prologue when using %r11.
6209
6210 2009-12-21 Sriraman Tallam <tmsriram@google.com>
6211
6212 * options.cc (General_options::parse_version): Make -v continue and do
6213 the link like GNU ld does.
6214
6215 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
6216
6217 * Makefile.am (CCFILES): Add timer.cc.
6218 (HFILES): Add timer.h.
6219 * configure.ac: Check for sysconf and times.
6220 * main.cc: include timer.h.
6221 (main): Use Timer instead of get_run_time.
6222 * timer.cc: New.
6223 * timer.h: New.
6224 * workqueue.cc: include timer.h.
6225 (Workqueue::find_and_run_task):
6226 Report user, sys and wall time.
6227 * Makefile.in: Regenerate.
6228 * config.in: Regenerate.
6229 * configure: Regenerate.
6230
6231 2009-12-16 Doug Kwan <dougkwan@google.com>
6232
6233 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6234 sections.
6235 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6236 relaxed input sections.
6237 * output.cc (Output_section::find_relaxed_input_section): Change
6238 return type to Output_relaxed_input_section pointer. Adjust code
6239 for new type of relaxed_input_section_map_.
6240 * output.h (Output_section::find_relaxed_input_section): Change
6241 return type to Output_relaxed_input_section pointer.
6242 (Output_section::Output_relaxed_input_section_by_input_section_map):
6243 New type.
6244 (Output_section::relaxed_input_section_map_): Change type to
6245 Output_section::Output_relaxed_input_section_by_input_section_map.
6246 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6247 input section.
6248
6249 2009-12-15 Ian Lance Taylor <iant@google.com>
6250
6251 * layout.cc (Layout::create_shstrtab): Only write out after input
6252 sections if we are compressing debug sections.
6253
6254 2009-12-15 Ian Lance Taylor <iant@google.com>
6255
6256 * archive.cc (Archive::add_symbols): Only look up a symbol without
6257 a version if there is, in fact, a version.
6258
6259 2009-12-14 Ian Lance Taylor <iant@google.com>
6260
6261 Revert -Wshadow changes, all changes from:
6262 2009-12-11 Doug Kwan <dougkwan@google.com>
6263 2009-12-11 Nick Clifton <nickc@redhat.com>
6264 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6265
6266 2009-12-11 Doug Kwan <dougkwan@google.com>
6267
6268 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6269 due to -Wshadow.
6270 * attributes.cc (Object_attribute::size): Ditto.
6271 (Attributes_section_data::size): Ditto.
6272 (Attributes_section_data::Attributes_section_data): Ditto.
6273 (Output_attributes_section_data::do_write): Ditto.
6274 * attributes.h (Object_attribute::set_type): Ditto.
6275 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6276
6277 2009-12-11 Nick Clifton <nickc@redhat.com>
6278
6279 * archive.cc: Fix shadowed variable warnings.
6280 * arm.cc: Likewise.
6281 * compressed_output.cc: Likewise.
6282 * compressed_output.h: Likewise.
6283 * configure: Likewise.
6284 * dwarf_reader.cc: Likewise.
6285 * dynobj.cc: Likewise.
6286 * dynobj.h: Likewise.
6287 * ehframe.cc: Likewise.
6288 * ehframe.h: Likewise.
6289 * errors.cc: Likewise.
6290 * expression.cc: Likewise.
6291 * fileread.cc: Likewise.
6292 * fileread.h: Likewise.
6293 * freebsd.h: Likewise.
6294 * i386.cc: Likewise.
6295 * icf.cc: Likewise.
6296 * incremental.h: Likewise.
6297 * layout.cc: Likewise.
6298 * layout.h: Likewise.
6299 * mapfile.cc: Likewise.
6300 * merge.cc: Likewise.
6301 * merge.h: Likewise.
6302 * object.cc: Likewise.
6303 * object.h: Likewise.
6304 * options.h: Likewise.
6305 * output.cc: Likewise.
6306 * output.h: Likewise.
6307 * parameters.cc: Likewise.
6308 * plugin.cc: Likewise.
6309 * powerpc.cc: Likewise.
6310 * reduced_debug_output.cc: Likewise.
6311 * reduced_debug_output.h: Likewise.
6312 * reloc.cc: Likewise.
6313 * reloc.h: Likewise.
6314 * resolve.cc: Likewise.
6315 * script-sections.cc: Likewise.
6316 * script.cc: Likewise.
6317 * script.h: Likewise.
6318 * sparc.cc: Likewise.
6319 * symtab.cc: Likewise.
6320 * symtab.h: Likewise.
6321 * target-select.cc: Likewise.
6322 * target-select.h: Likewise.
6323 * token.h: Likewise.
6324 * workqueue.cc: Likewise.
6325 * workqueue.h: Likewise.
6326 * x86_64.cc: Likewise.
6327
6328 2009-12-10 Doug Kwan <dougkwan@google.com>
6329
6330 * arm.cc (attributes.h): New include.
6331 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6332 (Arm_relobj::~Arm_relobj): Delete object pointed by
6333 attributes_section_data_.
6334 (Arm_relobj::attributes_section_data): New method definition.
6335 (Arm_relobj::attributes_section_data_): New data member declaration.
6336 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6337 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6338 attributes_section_data_.
6339 (Arm_dynobj::attributes_section_data): New method definition.
6340 (Arm_dynobj::attributes_section_data_): New data member declaration.
6341 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6342 initialization value of may_use_blx_ to false.
6343 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6344 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6345 object attributes to compute results instead of hard-coding.
6346 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6347 Target_arm::get_secondary_compatible_arch,
6348 Target_arm::set_secondary_compatible_arch
6349 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6350 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6351 New method declarations.
6352 (Target_arm::get_aeabi_object_attribute): New method definition.
6353 (Target_arm::attributes_section_data_): New data member declaration.
6354 (read_arm_attributes_section): New template definition.
6355 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6356 (Arm_dynobj::do_read_symbols): Ditto.
6357 (Target_arm::do_finalize_sections): Merge attributes sections from
6358 input. Check for BLX use after attributes section merging.
6359 Fix __exidx_start and __exidx_end visibility. Create an
6360 .ARM.attributes section if necessary.
6361 (Target_arm::get_secondary_compatible_arch,
6362 Target_arm::set_secondary_compatible_arch,
6363 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6364 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
6365 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
6366 New method definitions.
6367
6368 2009-12-09 Ian Lance Taylor <iant@google.com>
6369
6370 * plugin.cc (Plugin::load): Don't cast from void* to a function
6371 pointer.
6372
6373 2009-12-09 Ian Lance Taylor <iant@google.com>
6374
6375 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6376 information fields.
6377
6378 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6379
6380 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6381 Replace two_file_shared_1.so with two_file_shared_2.so.
6382 * testsuite/Makefile.in: Regenerated.
6383
6384 2009-12-08 Doug Kwan <dougkwan@google.com>
6385
6386 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6387 (HFILES): Add attributes.h and int_encoding.h.
6388 * Makefile.in: Regenerate.
6389 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6390 function definitions to int_encoding.cc
6391 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6392 prototypes to int_encoding.h
6393 * reduced_debug_output.cc (int_encoding.h): New include.
6394 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6395 function definitions to int_encoding.cc
6396 (insert_into_vector, read_from_pointer): Move template definitions to
6397 int_encoding.h
6398 * attributes.cc: New file.
6399 * attributes.h: New file.
6400 * int_encoding.cc: New file.
6401 * int_encoding.h: New file.
6402
6403 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6404
6405 PR gold/11055
6406 * incremental-dump.cc (dump_incremental_inputs): New.
6407 (main): Use dump_incremental_inputs.
6408
6409 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6410
6411 PR gold/10893
6412 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6413 checking elfcpp::STT_FUNC.
6414 (Target_i386::Relocate::relocate): Likewise.
6415 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6416
6417 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6418 symbols from shared libraries into normal FUNC symbols.
6419
6420 * symtab.h (Symbol): Add is_func and use it.
6421
6422 2009-12-05 Doug Kwan <dougkwan@google.com>
6423
6424 * arm.cc (Target_arm::arm_info): Initialize new fields
6425 attributes_section and attributes_vendor.
6426 * i386.cc (Target_i386::i386_info): Same.
6427 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6428 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6429 fields attributes_section and attributes_vendor.
6430 * sparc.cc (Target_sparc::sparc_info): Same.
6431 * target.h (Target::attributes_section, Target::attributes_vendor,
6432 Target::is_attributes_section, Target::attribute_arg_type,
6433 Target::attributes_order): New method definitions.
6434 (Target::Target_info::attributes_section,
6435 Target::Target_info::attributes_vendor): New fields.
6436 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6437 virtual method definitions.
6438 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6439 attributes_section and attributes_vendor.
6440 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6441
6442 2009-12-05 Doug Kwan <dougkwan@google.com>
6443
6444 * arm.cc: Update comments about interworking and stub generation.
6445 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6446 considered as non-PIC.
6447 (Arm_relocate_functions::base_abs): Fix formatting.
6448 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6449 of function to use GOT entry address instead of offset.
6450 (Target_arm::Scan::global): Issue an error if a symbol would need a
6451 PLT does not get one because it is untyped. Remove code to create
6452 dynamic symbols for relative branches.
6453 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6454 takes unsigned integer instead of boolean.
6455
6456 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6457
6458 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6459 (two_file_test_LDADD): Likewise.
6460 (common_test_1_LDADD): Likewise.
6461 (exception_test_LDADD) Likewise.
6462 (weak_test_LDADD): Likewise.
6463 (many_sections_test_LDADD): Likewise.
6464 (initpri1_LDADD): Likewise.
6465 (script_test_1_LDADD): Likewise.
6466 (script_test_2_LDADD): Likewise.
6467 (justsyms_LDADD): Likewise.
6468 (binary_test_LDADD): Likewise.
6469 (large_LDADD): Likewise.
6470 * testsuite/Makefile.in: Regenerated.
6471
6472 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6473
6474 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6475 (Symbol_table::override_with_special): Likewise.
6476 (Symbol_table::add_from_object): Likewise.
6477
6478 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6479
6480 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6481 Don't set the data_offset twice.
6482
6483 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6484
6485 * testsuite/Makefile.in: Regenerate.
6486
6487 2009-12-03 Doug Kwan <dougkwan@google.com>
6488
6489 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6490 (Target_arm::do_finalize_sections): Add parameter for symbol table
6491 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6492 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6493 parameter for symbol table pointer.
6494 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6495 an additional parameter for a pointer to symbol table.
6496 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6497 parameter for a symbol table pointer.
6498 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6499 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6500 Ditto.
6501 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6502 parameter for a symbol table pointer.
6503
6504 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6505
6506 * incremental.cc (Incremental_inputs_header)
6507 (Incremental_inputs_header_write, Incremental_inputs_entry)
6508 (Incremental_inputs_entry_write): Move ...
6509 * incremental.h (Incremental_inputs_header)
6510 (Incremental_inputs_header_write, Incremental_inputs_entry)
6511 (Incremental_inputs_entry_write): here.
6512
6513 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6514
6515 * incremental.cc (make_sized_incremental_binary): Set the target.
6516 Error if it is incompatible.
6517 * output.h (Output_file): Add filename method.
6518
6519 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6520
6521 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6522 from the get_* methods.
6523
6524 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6525
6526 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6527 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6528 Write 0 for the data_offset of scripts.
6529
6530 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6531
6532 * testsuite/Makefile.am: Add the incremental_test.sh test.
6533 * testsuite/incremental_test.sh: New.
6534 * testsuite/incremental_test_1.c: New.
6535 * testsuite/incremental_test_2.c: New.
6536
6537 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6538
6539 * incremental-dump.cc (main): Fix typos.
6540
6541 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6542
6543 PR gold/11025
6544 * incremental-dump.cc (main): Use llu to print 64 bit values.
6545
6546 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6547 H.J. Lu <hongjiu.lu@intel.com>
6548
6549 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6550 $(LIBDL).
6551 (incremental_dump_LDADD): Likewise.
6552 * Makefile.in: Regenerated.
6553
6554 2009-11-25 Doug Kwan <dougkwan@google.com>
6555
6556 Revert:
6557
6558 2009-11-25 Doug Kwan <dougkwan@google.com>
6559
6560 * arm.cc (Target_arm::Target_arm): Move method definition
6561 outside of class definition. Add code to handle
6562 --target1-rel, --target1-abs and --target2= options.
6563 (Target_arm::get_reloc_reloc_type): Change method to be
6564 non-static and const.
6565 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6566 New data member declaration.
6567 (Target_arm::Scan::local, Target_arm::Scan::global,
6568 Target_arm::Relocate::relocate,
6569 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6570 Adjust call to Target_arm::get_real_reloc_type.
6571 (Target_arm::get_real_reloc_type): Use command line options
6572 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6573 * options.h (--target1-rel, --target1-abs, --target2): New
6574 ARM-only options.
6575
6576 2009-11-25 Doug Kwan <dougkwan@google.com>
6577
6578 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6579 class definition. Add code to handle --target1-rel, --target1-abs
6580 and --target2= options.
6581 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6582 and const.
6583 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6584 member declaration.
6585 (Target_arm::Scan::local, Target_arm::Scan::global,
6586 Target_arm::Relocate::relocate,
6587 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6588 call to Target_arm::get_real_reloc_type.
6589 (Target_arm::get_real_reloc_type): Use command line options to
6590 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6591 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6592 options.
6593
6594 2009-11-25 Doug Kwan <dougkwan@google.com>
6595
6596 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6597 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6598 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6599 formatting.
6600 (Arm_relocate_functions::thm_call): Replace body with a call to
6601 Arm_relocate_functions::thumb_branch_common.
6602 (Arm_relocate_functions::thm_jump24,
6603 Arm_relocate_functions::thm_xpc22): New method definitions.
6604 (Arm_relocate_functions::thumb_branch_common): New method definition.
6605 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6606 operator.
6607 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6608 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6609
6610 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6611
6612 * Makefile.am: Build incremental-dump
6613 * Makefile.in: Regenerate.
6614 * incremental-dump.cc: New.
6615 * incremental.cc (Incremental_inputs_header_data,
6616 Incremental_inputs_entry_data): Move to incremental.h
6617 * incremental.h: (Incremental_inputs_header_data,
6618 Incremental_inputs_entry_data): Move from incremental.cc
6619
6620 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6621
6622 * incremental.cc (Incremental_inputs_header,
6623 Incremental_inputs_header_write, Incremental_inputs_entry,
6624 Incremental_inputs_entry_write): Add a typedef with the data type.
6625
6626 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6627
6628 * incremental.cc (Incremental_inputs_header,
6629 Incremental_inputs_header_write, Incremental_inputs_entry,
6630 Incremental_inputs_entry_write): Update comment about which
6631 type has the filed descriptions.
6632
6633 2009-11-15 Doug Kwan <dougkwan@google.com>
6634
6635 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6636 (Arm_relocate_functions::arm_branch_common): Change method defintion
6637 in class definition to a method declaration and update list of formal
6638 parameters.
6639 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6640 Arm_relocation_functions::jump24): Adjust call to
6641 Arm_relocate_functions::arm_branch_common. Update list of formal
6642 parameters.
6643 (Arm_relocate_functions::xpc25): New method definition.
6644 (Arm_relocate_functions::arm_branch_common): Move method defintion
6645 out from class definition. Use stubs for mode-switching and extending
6646 branch ranges.
6647 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6648 specially. Change code to enable use of stubs in ARM branches.
6649
6650 2009-11-10 Doug Kwan <dougkwan@google.com>
6651
6652 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6653 in method declaration.
6654 (Target_arm::relocate_stub): New method declaration.
6655 (Target_arm::default_target): Change to return a pointer instead of
6656 a const reference.
6657 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6658 Target_arm::default_target.
6659 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6660 method definition.
6661 (Target_arm::relocate_section): Adjust view.
6662 (Target_arm::relocate_stub): New method definition.
6663
6664 2009-11-10 Doug Kwan <dougkwan@google.com>
6665
6666 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6667 a format warning.
6668 * incremental.cc (open_incremental_binary): Initialized local
6669 variables to avoid warnings.
6670 * object.cc (make_elf_object): Ditto.
6671 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6672 a format warning.
6673
6674 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6675
6676 PR gold/10930
6677 * testsuite/plugin_test.c: Include "config.h".
6678
6679 2009-11-09 Doug Kwan <dougkwan@google.com>
6680
6681 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6682 (arm_symbol_value): Remove.
6683 (Arm_relocate_functions::arm_branch_common,
6684 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6685 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6686 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6687 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6688 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6689 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6690 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6691 Arm_relocate_functions::thm_mobw_abs_nc,
6692 Arm_relocate_functions::thm_mov_abs,
6693 Arm_relocate_functions::movw_prel_nc,
6694 Arm_relocate_functions::thm_movt_abs,
6695 Arm_relocate_functions::movt_prel,
6696 Arm_relocate_functions::thm_movw_prel_nc,
6697 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6698 (Target_arm::Relocate::relocate): Only decompose address into two
6699 parts if relocation type uses the thumb-bit and pass the actual
6700 bit instead of a flag indicating that the thumb-bit is used. Adjust
6701 calls to methods in Arm_relocate_functions for this change.
6702
6703 2009-11-08 Ian Lance Taylor <iant@google.com>
6704
6705 PR 10925
6706 * reloc.cc: Instantiate
6707 Sized_relobj::initialize_input_to_output_maps and
6708 Sized_relobj:free_input_to_output_maps.
6709
6710 2009-11-06 Ian Lance Taylor <iant@google.com>
6711
6712 PR 10876
6713 * defstd.cc (in_segment): Set only_if_ref true for "end".
6714
6715 2009-11-06 Doug Kwan <dougkwan@google.com>
6716
6717 * arm.cc (class Reloc_stub): Correct a comment.
6718 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6719 (Target_arm::scan_section_for_stubs): New method declaration.
6720 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6721 Change methods from private to protected.
6722 (Target_arm::do_may_relax): New method definition.
6723 (Target_arm::do_relax, Target_arm::group_sections,
6724 Target_arm::scan_reloc_for_stub,
6725 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6726 (Target_arm::arm_input_section_map_): New data member declaration.
6727 (Target_arm::scan_reloc_for_stub,
6728 Target_arm::scan_reloc_section_for_stubs,
6729 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6730 Target_arm::do_relax): New method definitions.
6731
6732 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6733
6734 * configure.ac: Check for (struct stat)::st_mtim
6735 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6736 * config.in: Regenerate.
6737 * configure: Regenerate.
6738
6739 2009-11-05 Ian Lance Taylor <iant@google.com>
6740
6741 PR 10910
6742 * output.cc (Output_segment::add_output_section): Add missing
6743 return statement.
6744
6745 2009-11-04 Ian Lance Taylor <iant@google.com>
6746
6747 PR 10880
6748 * object.h (class Object): Add is_needed and set_is_needed
6749 methods. Add is_needed_ field. Make bool fields into bitfields.
6750 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6751 defined in a dynamic object and referenced by a regular object,
6752 set is_needed for the dynamic object.
6753 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6754 if the file is marked with as_needed and it is not needed.
6755
6756 2009-11-04 Ian Lance Taylor <iant@google.com>
6757
6758 PR 10887
6759 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6760 tags if data is discarded by linker script.
6761 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6762 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6763 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6764 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6765
6766 2009-11-04 Ian Lance Taylor <iant@google.com>
6767
6768 * layout.cc (Layout::get_output_section): Add is_interp and
6769 is_dynamic_linker_section parameters. Change all callers.
6770 (Layout::choose_output_section): Likewise.
6771 (Layout::make_output_section): Likewise.
6772 (Layout::add_output_section_data): Add is_dynamic_linker_section
6773 parameter. Change all callers.
6774 * layout.h (class Layout): Update declarations.
6775 * output.h (class Output_section): Add is_interp, set_is_interp,
6776 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6777 Add is_interp_, is_dynamic_linker_section_ fields. Change
6778 generate_code_fills_at_write_ to a bitfield.
6779 * output.cc (Output_section::Output_sections): Initialize new
6780 fields.
6781 (Output_segment::add_output_section): Add do_sort parameter.
6782 Change all callers.
6783
6784 2009-11-03 Ian Lance Taylor <iant@google.com>
6785
6786 PR 10860
6787 * options.h (class General_options): Add --warn-common.
6788 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6789 merging two common symbols.
6790 (Symbol_table::should_override): Handle --warn-common when merging
6791 a common symbol with a defined symbol. Use report_resolve_problem
6792 for multiple definitions.
6793 (Symbol_table::report_resolve_problem): New function.
6794 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6795
6796 2009-11-03 Doug Kwan <dougkwan@google.com>
6797
6798 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6799 stub_factory_.
6800 (Target_arm::stub_factory): New method definition.
6801 (Target_arm::new_arm_input_section,
6802 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6803 Target_arm::reloc_uses_thumb_bit): New method declarations.
6804 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6805 New type definitions.
6806 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6807 member declarations.
6808 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6809 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6810 New method definitions.
6811
6812 2009-11-03 Ian Lance Taylor <iant@google.com>
6813
6814 * options.h (class General_options): Add --warn_constructors.
6815
6816 2009-11-03 Ian Lance Taylor <iant@google.com>
6817
6818 PR 10893
6819 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6820 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6821
6822 2009-11-03 Ian Lance Taylor <iant@google.com>
6823
6824 PR 10895
6825 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6826 --msgid-bugs-address.
6827 (install-pdf): New target.
6828 (install-data_yes): Look up one directory to find mkinstalldirs.
6829
6830 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6831
6832 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6833 tree.
6834
6835 2009-10-30 Doug Kwan <dougkwan@google.com>
6836
6837 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6838
6839 2009-10-30 Doug Kwan <dougkwan@google.com>
6840
6841 * arm.cc (Stub_addend_reader): New struct template definition
6842 and partial specializations.
6843 (Stub_addend_reader::operator()): New method definition for a
6844 partially specialized template.
6845
6846 2009-10-30 Doug Kwan <dougkwan@google.com>
6847
6848 * arm.cc (Arm_relobj::processor_specific_flags): New method
6849 definition.
6850 (Arm_relobj::do_read_symbols): New method declaration.
6851 (Arm_relobj::processor_specific_flags_): New data member declaration.
6852 (Arm_dynobj): New class definition.
6853 (Target_arm::do_finalize_sections): Add input_objects parameter.
6854 (Target_arm::do_adjust_elf_header): New method declaration.
6855 (Target_arm::are_eabi_versions_compatible,
6856 (Target_arm::merge_processor_specific_flags): New method declaration.
6857 (Target_arm::do_make_elf_object): New overloaded method definitions
6858 and declaration.
6859 (Arm_relobj::do_read_symbols): New method definition.
6860 (Arm_dynobj::do_read_symbols): Ditto.
6861 (Target_arm::do_finalize_sections): Add input_objects parameters.
6862 Merge processor-specific flags from all input objects.
6863 (Target_arm::are_eabi_versions_compatible,
6864 Target_arm::merge_processor_specific_flags,
6865 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6866 New method definitions.
6867 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6868 Input_objects pointer type parameter.
6869 * layout.cc (Layout::finalize): Pass input objects to target's.
6870 finalize_sections function.
6871 * output.cc (Output_file_header::do_sized_write): Set ELF file
6872 header's processor-specific flags.
6873 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6874 Input_objects pointer type parameter.
6875 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6876 * target.h (Input_objects): New forward class declaration.
6877 (Target::processor_specific_flags,
6878 Target::are_processor_specific_flags_sect): New method definitions.
6879 (Target::finalize_sections): Add input_objects parameter.
6880 (Target::Target): Initialize processor_specific_flags_ and
6881 are_processor_specific_flags_set_.
6882 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6883 parameter.
6884 (Target::set_processor_specific_flags): New method definition.
6885 (Target::processor_specific_flags_,
6886 Target::are_processor_specific_flags_set_): New data member
6887 declarations.
6888 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6889 Input_objects pointer type parameter.
6890
6891 2009-10-30 Doug Kwan <dougkwan@google.com>
6892
6893 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6894
6895 2009-10-28 Ian Lance Taylor <iant@google.com>
6896
6897 * object.h (class Relobj): Drop options parameter from
6898 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6899 do_scan_relocs, do_relocate. Change all callers.
6900 (class Sized_relobj): Drop options parameters from
6901 do_gc_process_relocs, do_scan_relocs, do_relocate,
6902 do_relocate_sections, relocate_sections, emit_relocs_scan,
6903 emit_relocs_scan_reltype. Change all callers.
6904 (struct Relocate_info): Remove options field and all references to
6905 it.
6906 * reloc.h (class Read_relocs): Remove options constructor
6907 parameter and options_ field. Change all callers.
6908 (class Gc_process_relocs, class Scan_relocs): Likewise.
6909 (class Relocate_task): Likewise.
6910 * target-reloc.h (scan_relocs): Remove options parameter. Change
6911 all callers.
6912 (scan_relocatable_relocs): Likewise.
6913 * target.h (class Sized_target): Remove options parameter from
6914 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6915 all callers.
6916 * gc.h (gc_process_relocs): Remove options parameter. Change all
6917 callers.
6918 * arm.cc: Update functions to remove options parameters.
6919 * i386.cc: Likewise.
6920 * powerpc.cc: Likewise.
6921 * sparc.cc: Likewise.
6922 * x86_64.cc: Likewise.
6923 * testsuite/testfile.cc: Likewise.
6924
6925 2009-10-28 Doug Kwan <dougkwan@google.com>
6926
6927 * arm.cc (Arm_relobj): New class definition.
6928 (Arm_relobj::scan_sections_for_stubs,
6929 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6930 New method definitions.
6931
6932 2009-10-28 Cary Coutant <ccoutant@google.com>
6933
6934 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6935 (Plugin::cleanup_done_): New member.
6936 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6937 (Plugin_manager::cleanup_done_): Remove.
6938 (Plugin_manager::add_input_file): Edit error message.
6939 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6940 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6941
6942 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6943
6944 * fileread.cc: (File_read::View::~View): Use the new
6945 data_ownership_ filed.
6946 (File_read::~File_read): Dispose the new whole_file_view_.
6947 (File_read::open): Mmap the whole file if needed.
6948 (File_read::open): Use whole_file_view_ instead of contents_.
6949 (File_read::find_view): Use whole_file_view_ if applicable.
6950 (File_read::do_read): Use whole_file_view_ instead of contents_.
6951 (File_read::make_view): Use whole_file_view_ instead of contents_,
6952 update File_read::View::View call.
6953 (File_read::find_or_make_view): Update File_read::View::View
6954 call.
6955 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6956 remove contents_
6957 (File_read::View::Data_ownership): New enum.
6958 (File_read::View::View): Replace bool mapped_ with Data_ownership
6959 argument.
6960 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6961 (File_read::View::data_ownership_): New field.
6962 (File_read::contents_): Remove (replaced by whole_file_view_).
6963 (File_read::whole_file_view_): New field.
6964 * options.h (class General_options): Add --keep-files-mapped.
6965
6966 2009-10-27 Cary Coutant <ccoutant@google.com>
6967
6968 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6969 * testsuite/Makefile.am (plugin_test_5): New test case.
6970 * testsuite/Makefile.in: Regenerate.
6971
6972 2009-10-25 Doug Kwan <dougkwan@google.com>
6973
6974 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6975 from private to protected to allow access by child class.
6976 (Sized_relobj::do_relocate_sections): New method declaration.
6977 (Sized_relobj::relocate_sections): Virtualize.
6978 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6979 Sized_relobj::relocate_sections. Instantiate template explicitly
6980 for different target sizes and endianity.
6981
6982 2009-10-24 Doug Kwan <dougkwan@google.com>
6983
6984 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6985 (Arm_input_section::as_arm_input_section): New method.
6986 (Arm_output_section): New class definition.
6987 (Arm_output_section::create_stub_group,
6988 Arm_output_section::group_sections): New method definitions.
6989
6990 2009-10-22 Doug Kwan <dougkwan@google.com>
6991
6992 * arm.cc (Arm_input_section): New class definition.
6993 (Arm_input_section::init, Arm_input_section:do_write,
6994 Arm_input_section::set_final_data_size,
6995 Arm_input_section::do_reset_address_and_file_offset): New method
6996 definitions.
6997
6998 2009-10-21 Doug Kwan <dougkwan@google.com>
6999
7000 * arm.cc (Stub_table, Arm_input_section): New forward class
7001 declarations.
7002 (Stub_table): New class defintion.
7003 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
7004 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
7005 New method definition.
7006
7007 2009-10-21 Doug Kwan <dougkwan@google.com>
7008
7009 * arm.cc: Update copyright comments.
7010 (Target_arm): New forward class template declaration.
7011 (Arm_address): New type.
7012 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
7013 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
7014 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
7015 constants.
7016 (Insn_template): Same.
7017 (DEF_STUBS): New macro.
7018 (Stub_type): New enum type.
7019 (Stub_template): New class definition.
7020 (Stub): Same.
7021 (Reloc_stub): Same.
7022 (Stub_factory): Same.
7023 (Target_arm::Target_arm): Initialize may_use_blx_ and
7024 should_force_pic_veneer_.
7025 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
7026 Target_arm::should_force_pic_veneer,
7027 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
7028 Target_arm::using_thumb_only, Target_arm:;default_target): New
7029 method defintions.
7030 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
7031 New data member declarations.
7032 (Insn_template::size, Insn_template::alignment): New method defintions.
7033 (Stub_template::Stub_template): New method definition.
7034 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
7035 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
7036 (Stub_factory::Stub_factory): New method definition.
7037 * gold.h (string_hash): New template.
7038 * output.h (Input_section_specifier::hash_value): Use
7039 gold::string_hash.
7040 (Input_section_specifier::string_hash): Remove.
7041 * stringpool.cc (Stringpool_template::string_hash): Use
7042 gold::string_hash.
7043
7044 2009-10-20 Doug Kwan <dougkwan@google.com>
7045
7046 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
7047 symbols of relaxed input sections.
7048 * output.h (Output_section::find_relaxed_input_section): Make
7049 method public.
7050
7051 2009-10-16 Doug Kwan <dougkwan@google.com>
7052
7053 * dynobj.cc (Versions::Versions): Initialize version_script_.
7054 Only insert base version symbol definition for a shared object
7055 if version script defines any version versions.
7056 (Versions::define_base_version): New method definition.
7057 (Versions::add_def): Check that base version is not needed.
7058 (Versions::add_need): Define base version lazily.
7059 * dynobj.h (Versions::define_base_version): New method declaration.
7060 (Versions::needs_base_version_): New data member declaration.
7061 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
7062 (check_DATA): Add no_version_test.stdout.
7063 (libno_version_test.so, no_version_test.o no_version_test.stdout):
7064 New make rules.
7065 * testsuite/Makefile.in: Regenerate.
7066 * testsuite/no_version_test.c: New file.
7067 * testsuite/no_version_test.sh: Ditto.
7068
7069 2009-10-16 Doug Kwan <dougkwan@google.com>
7070
7071 * expression.cc (class Segment_start_expression): New class definition.
7072 (Segment_start_expression::value): New method definition.
7073 (script_exp_function_segment_start): Return a new
7074 Segment_start_expression.
7075 * gold/script-c.h (script_saw_segment_start_expression): New function
7076 prototype.
7077 * script-sections.cc (Script_sections::Script_sections): Initialize
7078 SAW_SEGMENT_START_EXPRESSION_ to false.
7079 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
7080 and -Tbbs options to specify section addresses if given in
7081 command line and no SEGMENT_START expression is seen in a script.
7082 * script-sections.h (Script_sections::saw_segment_start_expression,
7083 Script_sections::set_saw_segment_start_expression): New method
7084 definition.
7085 (Script_sections::saw_segment_start_expression_): New data member
7086 declaration.
7087 * script.cc (script_saw_segment_start_expression): New function.
7088 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
7089 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
7090 script_test_7.sh and script_test_8.sh.
7091 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
7092 script_test_8.stdout.
7093 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
7094 (script_test_6, script_test_6.stdout, script_test_7,
7095 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
7096 * Makefile.in: Regenerate.
7097 * testsuite/script_test_6.sh: New file.
7098 * testsuite/script_test_6.t: Same.
7099 * testsuite/script_test_7.sh: Same.
7100 * testsuite/script_test_7.t: Same.
7101 * testsuite/script_test_8.sh: Same.
7102
7103 2009-10-16 Doug Kwan <dougkwan@google.com>
7104
7105 * output.cc (Output_segment::set_section_list_address): Cast
7106 expressions to unsigned long long type to avoid format warnings.
7107
7108 2009-10-15 Ian Lance Taylor <iant@google.com>
7109
7110 * script.cc (Script_options::add_symbol_assignment): Always add a
7111 dot assignment to script_sections_.
7112 * script-sections.cc (Script_sections::add_dot_assignment):
7113 Initialize if necessary.
7114
7115 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
7116 program headers with no load segment if there is a linker script.
7117
7118 * layout.cc (Layout::set_segment_offsets): Align the file offset
7119 to the segment aligment for -N or -n with no load segment.
7120 * output.cc (Output_segment::add_output_section): Don't crash if
7121 the first section is a TLS section.
7122 (Output_segment::set_section_list_addresses): Print an error
7123 message if the address moves backward in a linker script.
7124 * script-sections.cc
7125 (Output_section_element_input::set_section_addresses): Don't
7126 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
7127 (Orphan_output_section::set_section_addresses): Likewise.
7128
7129 2009-10-15 Doug Kwan <dougkwan@google.com>
7130
7131 * layout.cc (Layout::finish_dynamic_section): Generate tags
7132 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
7133 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
7134 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
7135
7136 2009-10-14 Ian Lance Taylor <iant@google.com>
7137
7138 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
7139 fields.
7140 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
7141 data_shdr fields of relinfo.
7142 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
7143 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
7144 R_386_TLS_LDO_32, adjust based on section flags.
7145 (Target_i386::Relocate::fix_up_ldo): Remove.
7146
7147 2009-10-13 Ian Lance Taylor <iant@google.com>
7148
7149 Add support for -pie.
7150 * options.h (class General_options): Add -pie and
7151 --pic-executable.
7152 (General_options::output_is_position_independent): Test -pie.
7153 (General_options::output_is_executable): Return true if not shared
7154 and not relocatable.
7155 (General_options::output_is_pie): Remove.
7156 * options.cc (General_options::finalize): Reject incompatible uses
7157 of -pie.
7158 * gold.cc (queue_middle_tasks): A -pie link is not static.
7159 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
7160 * symtab.cc (Symbol::final_value_is_known): Return false if
7161 output_is_position_independent.
7162 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
7163 output_is_position_independent.
7164 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
7165 output_is_position_independent.
7166 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
7167 output_is_position_independent.
7168 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
7169 two_file_pie_test.
7170 (basic_pie_test.o, basic_pie_test): New targets.
7171 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
7172 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
7173 (two_file_pie_test): New target.
7174 * testsuite/Makefile.in: Rebuild.
7175 * README: Remove note saying that -pie is not supported.
7176
7177 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
7178
7179 * options.h (class General_options): Add -init and -fini.
7180 * layout.cc (Layout::finish_dynamic_section): Emit
7181 given init and fini functions.
7182
7183 2009-10-13 Sriraman Tallam <tmsriram@google.com>
7184
7185 * gc.h (gc_process_relocs): Check if icf is enabled using new
7186 function.
7187 * gold.cc (queue_initial_tasks): Likewise.
7188 (queue_middle_tasks): Likewise.
7189 * object.cc (do_layout): Likewise.
7190 * symtab.cc (is_section_folded): Likewise.
7191 * main.cc (main): Likewise.
7192 * reloc.cc (Read_relocs::run): Likewise.
7193 (Sized_relobj::do_scan_relocs): Likewise.
7194 * icf.cc (is_function_ctor_or_dtor): New function.
7195 (Icf::find_identical_sections): Check if function is ctor or dtor when
7196 safe icf is chosen.
7197 * options.h (General_options::icf): Change option to be an enum.
7198 (Icf_status): New enum.
7199 (icf_enabled): New method.
7200 (icf_safe_folding): New method.
7201 (set_icf_status): New method.
7202 (icf_status_): New variable.
7203 * (options.cc) (General_options::finalize): Set icf_status_.
7204 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7205 icf_test and icf_keep_unique_test to use the --icf enum flag.
7206 * testsuite/icf_safe_test.sh: New file.
7207 * testsuite/icf_safe_test.cc: New file.
7208
7209 2009-10-12 Sriraman Tallam <tmsriram@google.com>
7210
7211 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7212 includes to gc.h and icf.h.
7213 * arm.cc: Include gc.h.
7214 * gold.cc: Likewise.
7215 * i386.cc: Likewise.
7216 * powerpc.cc: Likewise.
7217 * sparc.cc: Likewise.
7218 * x86_64.cc: Likewise.
7219 * gc.h: Include icf.h.
7220
7221 2009-10-11 Ian Lance Taylor <iant@google.com>
7222
7223 * plugin.cc: Include "gold.h" before other header files.
7224
7225 2009-10-10 Chris Demetriou <cgd@google.com>
7226
7227 * options.h (Input_file_argument::Input_file_type): New enum.
7228 (Input_file_argument::is_lib_): Replace with...
7229 (Input_file_argument::type_): New member.
7230 (Input_file_argument::Input_file_argument): Take Input_file_type
7231 'type' rather than boolean 'is_lib' as second argument.
7232 (Input_file_argument::is_lib): Use type_.
7233 (Input_file_argument::is_searched_file): New function.
7234 (Input_file_argument::may_need_search): Handle is_searched_file.
7235 * options.cc (General_options::parse_library): Support -l:filename.
7236 (General_options::parse_just_symbols): Update for Input_file_argument
7237 changes.
7238 (Command_line::process): Likewise.
7239 * archive.cc (Archive::get_file_and_offset): Likewise.
7240 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7241 * script.cc (read_script_file, script_add_file): Likewise.
7242 * fileread.cc (Input_file::Input_file): Likewise.
7243 (Input_file::will_search_for): Handle is_searched_file.
7244 (Input_file::open): Likewise.
7245 * readsyms.cc (Read_symbols::get_name): Likewise.
7246 * testsuite/Makefile.am (searched_file_test): New test.
7247 * testsuite/Makefile.in: Regenerate.
7248 * testsuite/searched_file_test.cc: New file.
7249 * testsuite/searched_file_test_lib.cc: New file.
7250
7251 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7252 Ian Lance Taylor <iant@google.com>
7253
7254 * descriptor.cc: Include <cstdio> and "binary-io.h".
7255 (Descriptors::open): Open the files in binary mode always.
7256 * script.cc (Lex::get_token): Treat \r as whitespace.
7257
7258 2009-10-09 Ian Lance Taylor <iant@google.com>
7259
7260 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7261
7262 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7263 Ian Lance Taylor <iant@google.com>
7264
7265 * configure.ac: Check for readv function also.
7266 * fileread.cc (readv): Define if not HAVE_READV.
7267 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7268 does not exist.
7269 * config.in: Regenerate.
7270 * configure: Regenerate.
7271
7272 2009-10-09 Doug Kwan <dougkwan@google.com>
7273
7274 * layout.cc (Layout::make_output_section): Call target hook to make
7275 ordinary output section.
7276 (Layout::finalize): Adjust parameter list of call the
7277 Target::may_relax().
7278 * layout.h (class Layout::section_list): New method.
7279 * merge.h (Output_merge_base::entsize): Change visibility to public.
7280 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7281 New methods.
7282 (Output_merge_string::do_is_string): New method.
7283 * object.cc (Sized_relobj::do_setup): renamed from
7284 Sized_relobj::set_up.
7285 * object.h (Sized_relobj::adjust_shndx,
7286 Sized_relobj::initializ_input_to_output_maps,
7287 Sized_relobj::free_input_to_output_maps): Change visibilities to
7288 protected.
7289 (Sized_relobj::setup): Virtualize.
7290 (Sized_relobj::do_setup): New method declaration.
7291 (Sized_relobj::invalidate_section_offset,
7292 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7293 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7294 * options.cc (parse_int): New function.
7295 * options.h (parse_int): New declaration.
7296 (DEFINE_int): New macro.
7297 (stub_group_size): New option.
7298 * output.cc (Output_section::Output_section): Initialize memebers
7299 merge_section_map_, merge_section_by_properties_map_,
7300 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7301 (Output_section::add_input_section): Handled deferred code-fill
7302 generation and remove an old comment.
7303 (Output_section::add_relaxed_input_section): New method definition.
7304 (Output_section::add_merge_input_section): Use merge section by
7305 properties map to speed to search. Update merge section maps
7306 as appropriate.
7307 (Output_section::build_relaxation_map): New method definition.
7308 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7309 Same.
7310 (Output_section::relax_input_section): Renamed to
7311 Output_section::convert_input_sections_to_relaxed_sections and change
7312 interface to take a vector of pointers to relaxed sections.
7313 (Output_section::find_merge_section,
7314 Output_section::find_relaxed_input_section): New method definitions.
7315 (Output_section::is_input_address_mapped,
7316 Output_section::output_offset, Output_section::output_address):
7317 Use output section data maps to speed up searching.
7318 (Output_section::find_starting_output_address): Add comments.
7319 (Output_section::do_write,
7320 Output_section::write_to_postprocessing_buffer): Do code-fill
7321 generation as appropriate.
7322 (Output_section::get_input_sections): Invalidate relaxed input section
7323 map.
7324 (Output_section::restore_states): Adjust type of checkpoint .
7325 Invalidate relaxed input section map.
7326 * output.h (Output_merge_base): New class declaration.
7327 (Input_section_specifier): New class defintion.
7328 (class Output_relaxed_input_section) Change base class to
7329 Output_section_data_build.
7330 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7331 base class initializer.
7332 (Output_section::add_relaxed_input_section): New method declaration.
7333 (Output_section::Input_section): Change visibility to protected.
7334 (Output_section::Input_section::relobj,
7335 Output_section::Input_section::shndx): Handle relaxed input sections.
7336 Output_section::input_sections) Change visibility to protected. Also
7337 define overload to return a non-const pointer.
7338 (Output_section::Merge_section_properties): New class defintion.
7339 (Output_section::Merge_section_by_properties_map,
7340 Output_section::Output_section_data_by_input_section_map,
7341 Output_section::Relaxation_map): New types.
7342 (Output_section::relax_input_section): Rename method to
7343 Output_section::convert_input_sections_to_relaxed_sections and change
7344 interface to take a vector of relaxed section pointers.
7345 (Output_section::find_merge_section,
7346 Output_section::find_relaxed_input_section,
7347 Output_section::build_relaxation_map,
7348 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7349 New method declarations.
7350 (Output_section::merge_section_map_
7351 Output_section::merge_section_by_properties_map_,
7352 Output_section::relaxed_input_section_map_,
7353 Output_section::is_relaxed_input_section_map_valid_,
7354 Output_section::generate_code_fills_at_write_): New data members.
7355 * script-sections.cc
7356 (Output_section_element_input::set_section_addresses): Call
7357 current_data_size and addralign methods of relaxed input sections.
7358 (Orphan_output_section::set_section_addresses): Call current_data_size
7359 and addralign methods of relaxed input sections.
7360 * symtab.cc (Symbol_table::compute_final_value): Extract template
7361 from the body of Symbol_table::sized_finalize_symbol.
7362 (Symbol_table::sized_finalized_symbol): Call
7363 Symbol_table::compute_final_value.
7364 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7365 (Symbol_table::compute_final_value): New templated method declaration.
7366 * target.cc (Target::do_make_output_section): New method defintion.
7367 * target.h (Target::make_output_section): New method declaration.
7368 (Target::relax): Add more parameters for input objects, symbol table
7369 and layout. Adjust call to do_relax.
7370 (Target::do_make_output_section): New method declaration.
7371 (Target::do_relax): Add parameters for input objects, symbol table
7372 and layout.
7373
7374 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7375
7376 * pread.c: Include stdio.h.
7377
7378 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7379
7380 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7381 defined.
7382
7383 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7384
7385 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7386 Change read_shndx type to unsigned int.
7387 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7388 int.
7389 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7390 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7391 Change read_shndx type to unsigned int.
7392 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7393 int.
7394 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7395 * layout.cc (Layout::create_symtab_sections): Cast the result of
7396 local_symcount * symsize to off_t in the gold_assert.
7397
7398 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7399
7400 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7401 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7402 R_ARM_BASE_ABS.
7403 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7404 (Arm_relocate_functions::thm_abs5): New function.
7405 (Arm_relocate_functions::abs12): New function.
7406 (Arm_relocate_functions::abs16): New function.
7407 (Arm_relocate_functions::base_abs): New function.
7408 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7409 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7410 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7411 R_ARM_BASE_ABS.
7412 (Scan::global): Likewise.
7413 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7414 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7415 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7416 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7417 R_ARM_BASE_ABS.
7418
7419 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7420
7421 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7422 (Arm_relocate_functions::movt_prel): New function.
7423 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7424 (Arm_relocate_functions::thm_movt_prel): New function.
7425 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7426 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7427 (Scan::global, Relocate::relocate): Likewise.
7428 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7429
7430 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7431
7432 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7433 Incremental_checker.
7434 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7435 unsigned int.
7436 (class Incremental_inputs_header): New class.
7437 (Incremental_inputs_header_writer): Edit comment.
7438 (Incremental_inputs_entry): New class.
7439 (Incremental_inputs_entry_writer): Edit comment.
7440 (Sized_incremental_binary::do_find_incremental_inputs_section):
7441 Add *strtab_shndx parameter, fill it.
7442 (Sized_incremental_binary::do_check_inputs): New method.
7443 (Incremental_checker::can_incrementally_link_output_file): Use
7444 Sized_incremental_binary::check_inputs.
7445 (Incremental_inputs::report_command_line): Save command line in
7446 command_line_.
7447 * incremental.h:
7448 (Incremental_binary::find_incremental_inputs_section): New
7449 method.
7450 (Incremental_binary::do_find_incremental_inputs_section): Add
7451 strtab_shndx parameter.
7452 (Incremental_binary::do_check_inputs): New pure virtual method.
7453 (Sized_incremental_binary::do_check_inputs): Declare.
7454 (Incremental_checker::Incremental_checker): Add incremental_inputs
7455 parameter, use it to initialize incremental_inputs_.
7456 (Incremental_checker::incremental_inputs_): New field.
7457 (Incremental_checker::command_line): New method.
7458 (Incremental_checker::inputs): New method.
7459 (Incremental_checker::command_line_): New field.
7460
7461 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7462
7463 * incremental.cc: Include <cstdarg> and "target-select.h".
7464 (vexplain_no_incremental): New function.
7465 (explain_no_incremental): New function.
7466 (Incremental_binary::error): New method.
7467 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7468 method.
7469 (make_sized_incremental_binary): New function.
7470 (open_incremental_binary): New function.
7471 (can_incrementally_link_file): Add checks if output is ELF and has
7472 inputs section.
7473 * incremental.h: Include "elfcpp_file.h" and "output.h".
7474 (Incremental_binary): New class.
7475 (Sized_incremental_binary): New class.
7476 (open_incremental_binary): Declare.
7477 * object.cc (is_elf_object): Use
7478 elfcpp::Elf_recognizer::is_elf_file.
7479 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7480 * output.h (Output_file::filesize): New method.
7481
7482 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7483
7484 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7485 New function.
7486 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7487 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7488 function.
7489 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7490 function.
7491 (Arm_relocate_functions::movw_abs_nc): New function.
7492 (Arm_relocate_functions::movt_abs): New function.
7493 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7494 (Arm_relocate_functions::thm_movt_abs): New function.
7495 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7496 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7497 (Scan::global): Likewise.
7498 (Relocate::relocate): Likewise.
7499 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7500
7501 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7502
7503 * arm.cc (Arm_relocate_functions::got_prel) New function.
7504 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7505 (Relocate::relocate): Likewise.
7506 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7507
7508 2009-10-06 Ian Lance Taylor <iant@google.com>
7509
7510 * options.h (class General_options): Define
7511 split_stack_adjust_size parameter.
7512 * object.h (class Object): Add uses_split_stack_ and
7513 has_no_split_stack_ fields. Add uses_split_stack and
7514 has_no_split_stack accessor functions. Declare
7515 handle_split_stack_section.
7516 (class Reloc_symbol_changes): Define.
7517 (class Sized_relobj): Define Function_offsets. Declare
7518 split_stack_adjust, split_stack_adjust_reltype, and
7519 find_functions.
7520 * object.cc (Object::handle_split_stack_section): New function.
7521 (Sized_relobj::do_layout): Call handle_split_stack_section.
7522 * dynobj.cc (Sized_dynobj::do_layout): Call
7523 handle_split_stack_section.
7524 * reloc.cc (Sized_relobj::relocate_sections): Call
7525 split_stack_adjust for executable sections in split_stack
7526 objects. Pass reloc_map to relocate_section.
7527 (Sized_relobj::split_stack_adjust): New function.
7528 (Sized_relobj::split_stack_adjust_reltype): New function.
7529 (Sized_relobj::find_functions): New function.
7530 * target-reloc.h: Include "object.h".
7531 (relocate_section): Add reloc_symbol_changes parameter. Change
7532 all callers.
7533 * target.h (class Target): Add calls_non_split method. Declare
7534 do_calls_non_split virtual method. Declare match_view and
7535 set_view_to_nop.
7536 * target.cc: Include "elfcpp.h".
7537 (Target::do_calls_non_split): New function.
7538 (Target::match_view): New function.
7539 (Target::set_view_to_nop): New function.
7540 * gold.cc (queue_middle_tasks): Give an error if mixing
7541 split-stack and non-split-stack objects with -r.
7542 * i386.cc (Target_i386::relocate_section): Add
7543 reloc_symbol_changes parameter.
7544 (Target_i386::do_calls_non_split): New function.
7545 * x86_64.cc (Target_x86_64::relocate_section): Add
7546 reloc_symbol_changes parameter.
7547 (Target_x86_64::do_calls_non_split): New function.
7548 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7549 parameter.
7550 * powerpc.cc (Target_powerpc::relocate_section): Add
7551 reloc_symbol_changes parameter.
7552 * sparc.cc (Target_sparc::relocate_section): Add
7553 reloc_symbol_changes parameter.
7554 * configure.ac: Call AM_CONDITIONAL for the default target.
7555 * configure: Rebuild.
7556 * testsuite/Makefile.am (TEST_AS): New variable.
7557 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7558 (check_DATA): Add split_i386 and split_x86_64 files.
7559 (SPLIT_DEFSYMS): Define.
7560 (split_i386_[1234n].o): New targets.
7561 (split_i386_[124]): New targets.
7562 (split_i386_[1234r].stdout): New targets.
7563 (split_x86_64_[1234n].o): New targets.
7564 (split_x86_64_[124]): New targets.
7565 (split_x86_64_[1234r].stdout): New targets.
7566 (MOSTLYCLEANFILES): Add new executables.
7567 * testsuite/split_i386.sh: New file.
7568 * testsuite/split_x86_64.sh: New file.
7569 * testsuite/split_i386_1.s: New file.
7570 * testsuite/split_i386_2.s: New file.
7571 * testsuite/split_i386_3.s: New file.
7572 * testsuite/split_i386_4.s: New file.
7573 * testsuite/split_i386_n.s: New file.
7574 * testsuite/split_x86_64_1.s: New file.
7575 * testsuite/split_x86_64_2.s: New file.
7576 * testsuite/split_x86_64_3.s: New file.
7577 * testsuite/split_x86_64_4.s: New file.
7578 * testsuite/split_x86_64_n.s: New file.
7579 * testsuite/testfile.cc (Target_test): Update relocation_section
7580 function.
7581 * testsuite/Makefile.in: Rebuild.
7582
7583 2009-10-06 Ian Lance Taylor <iant@google.com>
7584
7585 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7586 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7587 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7588 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7589 the address on ldo_addrs_.
7590 (Target_i386::Relocate::fix_up_ldo): New function.
7591
7592 2009-10-06 Rafael Espindola <espindola@google.com>
7593
7594 * plugin.cc (add_input_library): New.
7595 (Plugin::load): Add add_input_library to tv.
7596 (Plugin_manager::add_input_file): Add the is_lib argument.
7597 (add_input_file): Update call to Plugin_manager::add_input_file.
7598 (add_input_library): New.
7599 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7600
7601 2009-09-30 Doug Kwan <dougkwan@google.com>
7602
7603 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7604 symbol and call Symbol::may_need_copy_reloc to determine if
7605 a copy reloc is needed.
7606 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7607 nocopyreloc is given in command line.
7608 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7609 given in command line.
7610 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7611 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7612 of the removed Target_i386::may_need_copy_reloc.
7613 * options.h (copyreloc): New option with default value false.
7614 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7615 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7616 instead of the removed Target_powerpc::may_need_copy_reloc.
7617 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7618 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7619 instead of the removed Target_sparc::may_need_copy_reloc.
7620 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7621 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7622 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7623 instead of the removed Target_x86_64::may_need_copy_reloc.
7624
7625 2009-09-30 Ian Lance Taylor <iant@google.com>
7626
7627 * object.h (class Object): Remove target_ field, and target,
7628 sized_target, and set_target methods.
7629 (Object::sized_target): Remove.
7630 (class Sized_relobj): Update declarations. Remove sized_target.
7631 * object.cc (Sized_relobj::setup): Remove target parameter.
7632 Change all callers.
7633 (Input_objects::add_object): Don't do anything with the target.
7634 (make_elf_sized_object): Add punconfigured parameter. Change all
7635 callers. Set or test parameter target.
7636 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7637 Change all callers.
7638 * parameters.cc (Parameters::set_target): Change parameter type to
7639 be non-const.
7640 (Parameters::default_target): Remove.
7641 (set_parameters_target): Change parameter type to be non-const.
7642 (parameters_force_valid_target): New function.
7643 (parameters_clear_target): New function.
7644 * parameters.h (class Parameters): Update declarations. Remove
7645 default_target method. Add sized_target and clear_target
7646 methods. Change target_ to be non-const.
7647 (set_parameters_target): Update declaration.
7648 (parameters_force_valid_target): Declare.
7649 (parameters_clear_target): Declare.
7650 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7651 as NULL if we aren't searching.
7652 (Add_symbols::run): Don't check for compatible target.
7653 * fileread.cc (Input_file::open_binary): Call
7654 parameters_force_valid_target.
7655 * gold.cc (queue_middle_tasks): Likewise.
7656 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7657 set_target on object.
7658 * dynobj.h (class Sized_dynobj): Update declarations.
7659 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7660 make_elf_object returns NULL.
7661 (Archive::include_member): Don't check whether object target is
7662 compatible.
7663 * output.cc (Output_section::add_input_section): Get target from
7664 parameters.
7665 (Output_section::relax_input_section): Likewise.
7666 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7667 parameters.
7668 (Sized_relobj::do_scan_relocs): Likewise.
7669 (Sized_relobj::relocate_sections): Likewise.
7670 * resolve.cc (Symbol_table::resolve): Likewise.
7671 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7672 parameter. Change all callers.
7673 (Symbol_table::add_from_object): Get target from parameters.
7674 (Symbol_table::add_from_relobj): Don't check object target.
7675 (Symbol_table::add_from_dynobj): Likewise.
7676 (Symbol_table::define_special_symbol): Get target from
7677 parameters.
7678 * symtab.h (class Symbol_table): Update declaration.
7679 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7680 parameter. Change all callers. Clear parameter target.
7681 (Binary_test): Test target here.
7682 * testsuite/object_unittest.cc (gold_testsuite): Remove
7683 target_test_pointer parameter. Change all callers.
7684 (Object_test): Test target here.
7685
7686 2009-09-26 Ian Lance Taylor <iant@google.com>
7687
7688 * testsuite/initpri1.c: Don't try to use constructor priorities if
7689 compiling with gcc before 4.3.
7690
7691 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7692
7693 * testsuite/retain_symbols_file_test.sh (check_present): Change
7694 output file name to retain_symbols_file_test.stdout.
7695 (check_absent): Likewise.
7696
7697 2009-09-18 Craig Silverstein <csilvers@google.com>
7698
7699 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7700 * options.cc: Include <cerrno> and <fstream>.
7701 (General_options::finalize): Parse -retain-symbols-file tag.
7702 * options.h: New flag.
7703 (General_options): New method should_retain_symbol, new
7704 variable symbols_to_retain.
7705 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7706 should_retain_symbol map.
7707 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7708 * testsuite/Makefile.in: Regenerate.
7709 * testsuite/retain_symbols_file_test.sh: New file.
7710
7711 2009-09-18 Nick Clifton <nickc@redhat.com>
7712
7713 * po/es.po: Updated Spanish translation.
7714
7715 2009-09-17 Doug Kwan <dougkwan@google.com>
7716
7717 * debug.h (DEBUG_RELAXATION): New constant.
7718 (DEBUG_ALL): Add DEBUG_RELAXATION.
7719 (debug_string_to_enum): Add relaxation debug option.
7720 * layout.cc
7721 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7722 Layout::Relaxation_debug_check::read_sections,
7723 Layout::Relaxation_debug_check::read_sections): New method definitions.
7724 (Layout::Layout): Initialize data members
7725 record_output_section_data_from_scrips_,
7726 script_output_section_data_list_ and relaxation_debug_check_.
7727 (Layout::save_segments, Layout::restore_segments,
7728 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7729 Layout::relaxation_loop_body): New method definitions.
7730 (Layout::finalize): Support relaxation. Move section layout code to
7731 Layout::relaxation_loop_body.
7732 (Layout::set_asection_address_from_script): Move code for orphan
7733 section placement out.
7734 (Layout::place_orphan_sections_in_script): New method definition.
7735 * layout.h (Output_segment_headers, Output_file_header):
7736 New forward class declarations.
7737 (Layout::~Layout): Define.
7738 (Layout::new_output_section_data_from_script): New method definition.
7739 (Layout::place_orphan_sections_in_script): New method declaration.
7740 (Layout::Segment_states): New type declaration.
7741 (Layout::save_segments, Layout::restore_segments,
7742 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7743 Layout::relaxation_loop_body): New method declarations.
7744 (Layout::Output_section_data_list): New type declaration.
7745 (Layout::Relaxation_debug_check): New class definition.
7746 (Layout::record_output_section_data_from_script_,
7747 Layout::script_output_section_data_list_, Layout::segment_states_,
7748 Layout::relaxation_debug_check_): New data members.
7749 * output.cc: (Output_section_headers::do_size): New method definition.
7750 (Output_section_headers::Output_section_headers): Move size
7751 computation to Output_section_headers::do_size.
7752 (Output_segment_headers::do_size): New method definition.
7753 (Output_file_header::Output_file_header): Move size computation to
7754 Output_file_header::do_size and call it.
7755 (Output_file_header::do_size): New method definition.
7756 (Output_data_group::Output_data_group): Adjust call to
7757 Output_section_data.
7758 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7759 (Output_symtab_xindex::do_write): Add array bound check.
7760 (Output_section::Input_section::print_to_mapfile): Handle
7761 RELAXED_INPUT_SECTION_CODE.
7762 (Output_section::Output_section): Initialize data member checkpoint_.
7763 (Output_section::~Output_section): Delete checkpoint object pointed
7764 by checkpoint_.
7765 (Output_section::add_input_section): Always add an Input_section if
7766 relaxing.
7767 (Output_section::add_merge_input_section): Add assert.
7768 (Output_section::relax_input_section): New method definition.
7769 (Output_section::set_final_data_size): Set load address to zero for
7770 an unallocated section.
7771 (Output_section::do_address_and_file_offset_have_reset_values):
7772 New method definition.
7773 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7774 Handle relaxed input section.
7775 (Output_section::sort_attached_input_sections): Checkpoint input
7776 section list lazily.
7777 (Output_section::get_input_sections): Change type of input_sections to
7778 list of Simple_input_section pointers. Checkpoint input section list
7779 lazily. Also handle relaxed input sections.
7780 (Output_section::add_input_section_for_script): Take a reference to
7781 a Simple_input_section object instead of Relobj pointer and section
7782 index as parameter. Handle relaxed input sections.
7783 (Output_section::save_states, Output_section::restore_states): New
7784 method definitions.
7785 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7786 (Output_data::is_data_size_fixed): New method definition.
7787 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7788 if it is fixed.
7789 (Output_data::address_and_file_offset_have_reset_values): New method
7790 definition.
7791 (Output_data::do_address_and_file_offset_have_reset_values): New method
7792 definition.
7793 (Output_data::set_data_size): Check that data size is not fixed.
7794 (Output_data::fix_data_size): New method definition.
7795 (Output_data::is_data_size_fixed_): New data member.
7796 (Output_section_headers::set_final_data_size): New method definition.
7797 (Output_section_headers::do_size): New method declaration.
7798 (Output_segment_headers::set_final_data_size): New method definition.
7799 (Output_segment_headers::do_size): New method declaration.
7800 (Output_file_header::set_final_data_size)::New method definition.
7801 (Output_file_header::do_size)::New method declaration.
7802 (Output_section_data::Output_section_data): Add new parameter
7803 is_data_size_fixed and use it to fix data size.
7804 (Output_data_const::Output_data_const): Adjust call to base class
7805 constructor and fix data size.
7806 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7807 base class constructor and fix data size.
7808 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7809 base class constructor and fix data size.
7810 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7811 class constructor and fix data size.
7812 (Output_data_group::set_final_data_size): New method definition.
7813 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7814 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7815 class constructor and fix data size.
7816 (Output_relaxed_input_section): New class definition.
7817 (Output_section::Simple_input_section): New class definition.
7818 (Output_section::get_input_sections): Adjust parameter list.
7819 (Output_section::add_input_section_for_script): Same.
7820 (Output_section::save_states, Output_section::restore_states,
7821 Output_section::do_address_and_file_offset_have_reset_values,
7822 (Output_section::Input_section::Input_section): Handle
7823 RELAXED_INPUT_SECTION_CODE. Add new overload for
7824 Output_relaxed_input_section.
7825 (Output_section::Input_section::is_input_section,
7826 Output_section::Input_section::set_output_section): Handle relaxed
7827 input section.
7828 (Output_section::Input_section::is_relaxed_input_section,
7829 Output_section::Input_section::output_section_data,
7830 Output_section::Input_section::relaxed_input_section): New method
7831 definitions.
7832 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7833 value.
7834 (Output_section::Input_section::u1_): Update comments.
7835 (Output_section::Input_section::u2_): Add new union member poris.
7836 (Output_section::Checkpoint_output_section): New classs definition.
7837 (Output_section::relax_input_section): New method declaration.
7838 (Output_section::checkpoint_): New data member.
7839 (Output_segment): Update comments.
7840 (Output_segment::Output_segment): Un-privatize copy constructor.
7841 (Output_segment::operator=): Un-privatize.
7842 * script-sections.cc (Output_section_element::Input_section_list):
7843 Change element type to Output_section::Simple_input_section.
7844 (Output_section_element_dot_assignment::set_section_addresses):
7845 Register output section data for relaxation clean up.
7846 (Output_data_exression::Output_data_expression): Adjust call to base
7847 constructor to fix data size.
7848 (Output_section_element_data::set_section_addresses): Register
7849 Output_data_expression object for relaxation clean up.
7850 (struct Input_section_info): Replace Relobj pointer and section index
7851 pair with Output_section::Simple_input_section and Convert struct to a
7852 class.
7853 (Input_section_sorter::operator()): Adjust access to
7854 Input_section_info data member to use accessors.
7855 (Output_section_element_input::set_section_addresses): Use layout
7856 parameter. Adjust code to use Output_section::Simple_input_section
7857 and Input_secction_info classes. Register filler for relaxation
7858 clean up.
7859 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7860 and section index pair with Output_section::Simple_input_section
7861 class. Adjust code accordingly.
7862 (Phdrs_element::release_segment): New method definition.
7863 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7864 segment list.
7865 (Script_sections::release_segments): New method definition.
7866 * gold/script-sections.h (Script_sections::release_segments): New
7867 method declaration.
7868 * gold/target.h (Target::may_relax, Target::relax,
7869 Target::do_may_relax, Target::do_relax): New method definitions.
7870
7871 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7872
7873 * arm.cc (has_signed_unsigned_overflow): New function.
7874 (Arm_relocate_functions::abs8): New function.
7875 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7876 (Target_arm::Scan::global): Likewise.
7877 (Target_arm::relocate::relocate): Likewise.
7878 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7879 Likewise.
7880
7881 2009-09-16 Cary Coutant <ccoutant@google.com>
7882
7883 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7884 * testsuite/Makefile.in: Regenerate.
7885
7886 2009-09-11 Nick Clifton <nickc@redhat.com>
7887
7888 * po/gold.pot: Updated by the Translation project.
7889
7890 2009-09-08 Cary Coutant <ccoutant@google.com>
7891
7892 * output.cc (Output_file::open): Add execute permission to empty file.
7893 * testsuite/Makefile.am (permission_test): New test.
7894 * testsuite/Makefile.in: Regenerate.
7895
7896 2009-09-02 Ian Lance Taylor <iant@google.com>
7897
7898 * output.cc (Output_file::resize): Call map_no_anonymous rather
7899 than map.
7900
7901 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7902
7903 * gold.cc: Include "incremental.h".
7904 (queue_initial_tasks): Call Incremental_checker methods.
7905 * incremental.cc: Include "output.h".
7906 (Incremental_checker::can_incrementally_link_output_file): New
7907 method.
7908 * incremental.h (Incremental_checker): New class.
7909
7910 * output.cc (Output_file::open_for_modification): New method.
7911 (Output_file::map_anonymous): Changed return type to bool. Record
7912 map in base_ field.
7913 (Output_file::map_no_anonymous): New method, broken out of map.
7914 (Output_file::map): Use map_no_anonymous and map_anonymous.
7915 * output.h (class Output_file): Update declarations.
7916
7917 2009-08-24 Cary Coutant <ccoutant@google.com>
7918
7919 * options.h (Command_line::Pre_options): New class.
7920 (Command_line::pre_options): New member.
7921 * options.cc (gold::options::ready_to_register): New variable.
7922 (One_option::register_option): Do nothing if not registering options.
7923 Assert if same short option registered twice.
7924 (General_options::General_options): Turn off option registration when
7925 done constructing.
7926 (Command_line::Pre_options::Pre_options): New constructor.
7927
7928 2009-08-24 Cary Coutant <ccoutant@google.com>
7929
7930 * options.h (General_options::no_keep_memory): Remove incorrect
7931 short option.
7932
7933 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7934
7935 * Makefile.am (am__skiplex, am__skipyacc): New.
7936 * Makefile.in: Regenerate.
7937
7938 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7939
7940 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7941 (INCLUDES): ... this.
7942 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7943 (AM_CPPFLAGS): Renamed from ...
7944 (INCLUDE): ... this.
7945 * Makefile.in, testsuite/Makefile.in: Regenerate.
7946
7947 * Makefile.in: Regenerate.
7948 * aclocal.m4: Likewise.
7949 * config.in: Likewise.
7950 * configure: Likewise.
7951 * testsuite/Makefile.in: Likewise.
7952
7953 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7954 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7955 * Makefile.in: Regenerate.
7956 * testsuite/Makefile.in: Regenerate.
7957
7958 2009-08-19 Cary Coutant <ccoutant@google.com>
7959
7960 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7961 symbols in shared libraries overridden by hidden or internal symbols
7962 in the main program.
7963
7964 2009-08-19 Chris Demetriou <cgd@google.com>
7965
7966 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7967 checking source file names in error messages.
7968
7969 2009-08-18 Doug Kwan <dougkwan@google.com>
7970
7971 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7972 an elcpp::Ehdr as parameter. Adjust call to set_target.
7973 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7974 an elfcpp::Ehdr as parameter.
7975 * object.cc (Object::set_target): Remove the version that looks up
7976 a target and sets it.
7977 (Sized_relobj::setup): Take a Target object instead of
7978 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7979 (make_elf_sized_object): Find target and ask target to
7980 make an ELF object.
7981 * object.h: (Object::set_target): Remove the version that looks up
7982 a target and sets it.
7983 (Sized_relobj::setup): Take a Target object instead of
7984 an elfcpp:Ehdr as parameter.
7985 * target.cc: Include dynobj.h.
7986 (Target::do_make_elf_object_implementation): New.
7987 (Target::do_make_elf_object): New.
7988 * target.h (Target::make_elf_object): New template declaration.
7989 (Target::do_make_elf_object): New method declarations.
7990 (Target::do_make_elf_object_implementation): New template declaration.
7991
7992 2009-08-14 Ian Lance Taylor <iant@google.com>
7993
7994 * gold.h (FUNCTION_NAME): Define.
7995 (gold_unreachable): Use FUNCTION_NAME.
7996
7997 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7998
7999 * icf.cc (Icf::find_identical_sections): Issue a warning when a
8000 symbol in the --keep-unique list is not found.
8001
8002 2009-08-12 Sriraman Tallam <tmsriram@google.com>
8003
8004 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
8005 been maked as --keep-unique.
8006 (Icf::unfold_section): New function.
8007 * icf.h (Icf::unfold_section): New function.
8008 * options.h (General_options::keep_unique): New option.
8009 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
8010 * testsuite/Makefile.in: Regenerate.
8011 * testsuite/icf_keep_unique_test.sh: New file.
8012 * testsuite/icf_keep_unique_test.cc: New file.
8013
8014 2009-08-12 Cary Coutant <ccoutant@google.com>
8015
8016 PR 10471
8017 * resolve.cc (Symbol_table::resolve): Check for references from
8018 dynamic objects to hidden and internal symbols.
8019 * testsuite/Makefile.am (hidden_test.sh): New test.
8020 * testsuite/Makefile.in: Regenerate.
8021 * testsuite/hidden_test.sh: New script.
8022 * testsuite/hidden_test_1.c: New test source.
8023 * testsuite/hidden_test_main.c: New test source.
8024
8025 2009-08-11 Doug Kwan <dougkwan@google.com>
8026
8027 * arm.cc: Update comments.
8028 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
8029 segment to locate the .ARM.exidx section if present.
8030
8031 2009-08-09 Doug Kwan <dougkwan@google.com>
8032
8033 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
8034 patch.
8035
8036 2009-08-07 Sriraman Tallam <tmsriram@google.com>
8037 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
8038 compiler warnings.
8039
8040 2009-08-06 Sriraman Tallam <tmsriram@google.com>
8041
8042 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
8043 valid tls_segment only for non-debug-section relocations.
8044 * testsuite/Makefile.am: Add gc_tls_test.
8045 * testsuite/Makefile.in: Regenerate.
8046 * testsuite/gc_tls_test.cc: New file.
8047 * testsuite/gc_tls_test.sh: New file.
8048
8049 2009-08-05 Sriraman Tallam <tmsriram@google.com>
8050
8051 * icf.cc: New file.
8052 * icf.h: New file.
8053 * Makefile.am (CCFILES): Add icf.cc.
8054 (HFILES): Add icf.h
8055 * Makefile.in: Regenerate.
8056 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
8057 * gc.h (gc_process_relocs): Populate lists used by icf to contain
8058 section, symbol and addend information for the relocs.
8059 * gold.cc (queue_middle_tasks): Call identical code folding.
8060 * gold.h: Add defines for multimap.
8061 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
8062 to the call of finalize_local_symbols.
8063 * main.cc (main): Create object of class Icf.
8064 * object.cc (Sized_relobj::do_layout): Allow this function to be
8065 called twice during icf.
8066 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
8067 to sections marked as identical by icf.
8068 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
8069 when available.
8070 (Sized_relobj::do_section_entsize): New function.
8071 * object.h (Object::section_entsize): New function.
8072 (Object::do_section_entsize): New pure virtual function.
8073 (Relobj::finalize_local_symbols): Add new parameter.
8074 (Relobj::do_section_entsize): New function.
8075 * options.h (General_options::icf): New option.
8076 (General_options::icf_iterations): New option.
8077 (General_options::print_icf_sections): New option.
8078 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
8079 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
8080 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
8081 icf.
8082 * symtab.cc (Symbol_table::is_section_folded): New function.
8083 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
8084 to sections marked as identical by icf.
8085 * symtab.h (Symbol_table::set_icf): New function.
8086 (Symbol_table::icf): New function.
8087 (Symbol_table::is_section_folded): New function.
8088 (Symbol_table::icf_): New data member.
8089 * target-reloc.h (relocate_section): Ignore sections folded by icf.
8090 * testsuite/Makefile.am: Add commands to build icf_test.
8091 * testsuite/Makefile.in: Regenerate.
8092 * testsuite/icf_test.sh: New file.
8093 * testsuite/icf_test.cc: New file.
8094
8095 2009-07-24 Chris Demetriou <cgd@google.com>
8096
8097 * layout.cc (is_compressible_debug_section): Fix incorrect
8098 comment about compressed section names.
8099
8100 2009-07-20 Ian Lance Taylor <ian@airs.com>
8101
8102 PR 10419
8103 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
8104
8105 2009-07-16 Ian Lance Taylor <iant@google.com>
8106
8107 PR 10400
8108 * layout.h: #include <map>.
8109 (class Kept_section): Change from struct to class. Add accessors
8110 and setters. Add section size to Comdat_group mapping. Change
8111 Comdat_group to std::map. Add is_comdat_ field. Add
8112 linkonce_size field in union.
8113 (class Layout): Update declaration of find_or_add_kept_section.
8114 Don't declare find_kept_object.
8115 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
8116 parameter. Add object, shndx, is_comdat, and is_group_name
8117 parameters. Change all callers. Adjust for new Kept_section.
8118 (Layout::find_kept_object): Remove.
8119 * object.cc (Sized_relobj::include_section_group): Update use of
8120 Kept_section. Rename secnum to shndx. Only record
8121 Kept_comdat_section if sections are the same size.
8122 (Sized_relobj::include_linkonce_section): Update use of
8123 Kept_section. Only record Kept_comdat_section if sections are the
8124 same size. Set size of linkonce section.
8125 (Sized_relobj::map_to_kept_section): Update call to
8126 get_kept_comdat_section.
8127 * object.h (class Sized_relobj): Rename fields in
8128 Kept_comdat_section to drop trailing underscores; change object
8129 field to Relobj*. Change Kept_comdat_section_table to store
8130 struct rather than pointer.
8131 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
8132 Add kept_object and kept_shndx parameters. Change all callers.
8133 (Sized_relobj::get_kept_comdat_section): Change return type to
8134 bool. Add kept_object and kept_shndx parameters. Change all
8135 callers.
8136 * plugin.cc (Pluginobj::include_comdat_group): Update call to
8137 Layout::find_or_add_kept_section.
8138
8139 2009-07-09 Ian Lance Taylor <iant@google.com>
8140
8141 * merge.cc (Object_merge_map::initialize_input_to_output_map):
8142 Reserve space in the hash table.
8143
8144 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
8145
8146 * fileread.cc (File_read::get_mtime): New method.
8147 * fileread.h (Timespec): New structure.
8148 (File_read::get_mtime): New method.
8149 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
8150 Renamed from timestamp_nsec.
8151 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
8152 Elf_Xword.
8153 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
8154 timestamp_nsec.
8155 (Incremental_inputs::report_archive): Save mtime; style fix.
8156 (Incremental_inputs::report_obejct): Save mtime; style fix.
8157 (Incremental_inputs::report_script): Save mtime; style fix.
8158 (Incremental_inputs::finalize_inputs): Style fix.
8159 (Incremental_inputs::finalize): Style fix.
8160 (Incremental_inputs::create_input_section_data): Store inputs
8161 mtime.
8162 * incremental.h (Incremental_inputs::report_script): Add mtime
8163 argument.
8164 (Incremental_inputs::Input_info::Input_info): Intialize only one
8165 union member.
8166 (Incremental_inputs::Input_info::archive): Move to nameless
8167 union.
8168 (Incremental_inputs::Input_info::obejct): Move to nameless union.
8169 (Incremental_inputs::Input_info::script): Move to nameless union.
8170 (Incremental_inputs::mtime): New field.
8171 * script.cc (read_input_script): Pass file mtime to
8172 Incremental_input.
8173 * script.h (Script_info::inputs): Style fix.
8174
8175 2009-07-01 Ian Lance Taylor <ian@airs.com>
8176
8177 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
8178 instead of 32.
8179
8180 2009-06-24 Ian Lance Taylor <iant@google.com>
8181
8182 PR 10156
8183 * layout.cc (Layout::choose_output_section): If we find an
8184 existing section, update the flags.
8185 (Layout::create_notes): New function, broken out of
8186 Layout::finalize.
8187 (Layout::finalize): Don't create note sections.
8188 (Layout::create_note): Don't crash if linker script discards
8189 section.
8190 (Layout::create_gold_note): Likewise.
8191 (Layout::create_build_id): Likewise. Don't set
8192 after_input_sections on the section.
8193 (Layout::create_executable_stack_info): Remove target parameter.
8194 Change caller.
8195 * layout.h (class Layout): Declare create_notes. Update
8196 declaration of create_executable_stack_info.
8197 * gold.cc (queue_middle_tasks): Call create_notes.
8198 * output.cc (Output_section::update_flags_for_input_section): Move
8199 here from output.h. If SHF_ALLOC flag is newly set, mark address
8200 invalid.
8201 * output.h (Output_data::mark_address_invalid): New function.
8202 (class Output_section): Only declare, not define,
8203 update_flags_for_input_section. Remove set_flags.
8204
8205 2009-06-24 Ian Lance Taylor <iant@google.com>
8206
8207 * script-sections.cc (Output_section_definition::
8208 set_section_addresses): Rename shadowing local load_address to
8209 laddr.
8210
8211 2009-06-24 Ian Lance Taylor <iant@google.com>
8212
8213 PR 10244
8214 * reloc.cc (relocate_sections): Skip empty relocation sections.
8215
8216 2009-06-23 Ian Lance Taylor <iant@google.com>
8217
8218 PR 10156
8219 * layout.cc (Layout::create_note): Use choose_output_section
8220 rather than make_output_section.
8221
8222 2009-06-23 Ian Lance Taylor <iant@google.com>
8223
8224 PR 10237
8225 * options.cc (General_options::parse_V): Set printed_version_.
8226 (General_options::General_options): Initialize printed_version_.
8227 * options.h (class General_options): Add printed_version_ field.
8228 * gold.cc (queue_initial_tasks): If there are no input files,
8229 don't give a fatal error if we printed the version information.
8230 (queue_middle_tasks): If using -r with a shared object, give a
8231 fatal error rather than an ordinary error.
8232
8233 2009-06-23 Ian Lance Taylor <iant@google.com>
8234
8235 PR 10219
8236 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8237 (Layout::make_output_section): Set have_stabstr_section_ if we see
8238 a .stab*str section.
8239 (Layout::finalize): Call link_stabs_sections.
8240 (Layout::link_stabs_sections): New file.
8241 * layout.h (class Layout): Add have_stabstr_section_ field.
8242 Declare link_stabs_sections.
8243
8244 2009-06-23 Doug Kwan <dougkwan@google.com>
8245
8246 * Makefile.am (libgold_a_LIBADD): New.
8247 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8248 * Makefile.in: Regenerate.
8249 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8250 * configure: Regenerate.
8251 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8252 * fileread.cc: Include sys/state.h
8253 * gold.h: Declare memmem and strndup if found missing.
8254 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8255
8256 2009-06-23 Ian Lance Taylor <iant@google.com>
8257
8258 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8259 * configure: Rebuild.
8260
8261 2009-06-23 Ian Lance Taylor <iant@google.com>
8262
8263 PR 10147
8264 * object.cc (Object::section_contents): Don't try to get a view if
8265 the section has length zero.
8266 (Object::handle_gnu_warning_section): If the section is empty, use
8267 the name of the section as the warning.
8268
8269 2009-06-23 Ian Lance Taylor <iant@google.com>
8270
8271 PR 10133
8272 * stringpool.h (class Stringpool_template): Add optimize_ field.
8273 (Stringpool_template::set_optimize): New function.
8274 * stringpool.cc (Stringpool_template::Stringpool_template):
8275 Initialize optimize_ field.
8276 (Stringpool_template::set_string_offsets): Test local optimize
8277 fild rather than parameter.
8278 * layout.cc (Layout::Layout): Call set_optimize on the section
8279 name stringpool.
8280
8281 2009-06-22 Ian Lance Taylor <iant@google.com>
8282
8283 PR 10030
8284 * yyscript.y: Parse TARGET.
8285 * script.cc (script_set_target): New function.
8286 * script-c.h (script_set_target): Declare.
8287 * options.cc (General_options::string_to_object_format): Rename
8288 from string_to_object_format in anonymous namespace. Change
8289 callers.
8290 * options.h (class General_options): Declare
8291 string_to_object_format.
8292
8293 2009-06-22 Ian Lance Taylor <iant@google.com>
8294
8295 * script-sections.cc (Script_sections::create_segments): Don't put
8296 program headers in a PT_LOAD segment if -n or -N.
8297
8298 2009-06-22 Ian Lance Taylor <iant@google.com>
8299
8300 PR 10141
8301 * options.h (class General_options): Add -z lazy and -z now. Sort
8302 -z options into alphabetical order.
8303 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8304
8305 2009-06-21 Ian Lance Taylor <iant@google.com>
8306
8307 * layout.cc (Layout::make_output_section): Call
8308 Target::new_output_section.
8309 (Layout::attach_allocated_section_to_segment): Put large section
8310 sections in a separate load segment with the large segment flag
8311 set.
8312 (Layout::segment_precedes): Sort large data segments after other
8313 load segments.
8314 (align_file_offset): New static function.
8315 (Layout::set_segment_offsets): Use align_file_offset.
8316 * output.h (class Output_section): Add is_small_section_ and
8317 is_large_section_ fields.
8318 (Output_section::is_small_section): New function.
8319 (Output_section::set_is_small_section): New function.
8320 (Output_section::is_large_section): New function.
8321 (Output_section::set_is_large_section): New function.
8322 (Output_section::is_large_data_section): New function.
8323 (class Output_segment): Add is_large_data_segment_ field.
8324 (Output_segment::is_large_data_segment): New function.
8325 (Output_segment::set_is_large_data_segment): New function.
8326 * output.cc (Output_section::Output_section): Initialize new
8327 fields.
8328 (Output_segment::Output_segment): Likewise.
8329 (Output_segment::add_output_section): Add assertion that large
8330 data sections always go in large data segments. Force small data
8331 sections to the end of the list of data sections. Force small BSS
8332 sections to the start of the list of BSS sections. For large BSS
8333 sections to the end of the list of BSS sections.
8334 * symtab.h (class Symbol): Declare is_common_shndx.
8335 (Symbol::is_defined): Check Symbol::is_common_shndx.
8336 (Symbol::is_common): Likewise.
8337 (class Symbol_table): Define enum Commons_section_type. Update
8338 declarations. Add small_commons_ and large_commons_ fields.
8339 * symtab.cc (Symbol::is_common_shndx): New function.
8340 (Symbol_table::Symbol_table): Initialize new fields.
8341 (Symbol_table::add_from_object): Put small and large common
8342 symbols in the right list.
8343 (Symbol_table::sized_finalized_symbol): Check
8344 Symbol::is_common_shndx.
8345 (Symbol_table::sized_write_globals): Likewise.
8346 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8347 common symbol lists. Don't call do_allocate_commons_list if the
8348 list is empty.
8349 (Symbol_table::do_allocate_commons_list): Remove is_tls
8350 parameter. Add comons_section_type parameter. Change all
8351 callers. Handle small and large common symbols.
8352 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8353 Symbol::is_common_shndx.
8354 * resolve.cc (symbol_to_bits): Likewise.
8355 * target.h (Target::small_common_shndx): New function.
8356 (Target::small_common_section_flags): New function.
8357 (Target::large_common_shndx): New function.
8358 (Target::large_common_section_flags): New function.
8359 (Target::new_output_section): New function.
8360 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8361 small_common_section_flags, and large_common_section_flags
8362 fields.
8363 (Target::do_new_output_section): New virtual function.
8364 * arm.cc (Target_arm::arm_info): Initialize new fields.
8365 * i386.cc (Target_i386::i386_info): Likewise.
8366 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8367 Likewise.
8368 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8369 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8370 (Target_x86_64::do_new_output_section): New function.
8371 * configure.ac: Define conditional MCMODEL_MEDIUM.
8372 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8373 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8374 (large_LDFLAGS): Define.
8375 * testsuite/large.c: New file.
8376 * testsuite/testfile.cc (Target_test::test_target_info):
8377 Initialize new fields.
8378 * configure, testsuite/Makefile.in: Rebuild.
8379
8380 2009-06-05 Doug Kwan <dougkwan@google.com>
8381
8382 * Makefile.am (CCFILES): Add target.cc.
8383 * Makefile.in: Regenerate.
8384 * i386.cc (class Target_i386): Define new virtual method to
8385 override do_is_local_label_name in parent.
8386 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8387 local symbols if --discard-locals or -X is given.
8388 * options.h (class General_options): Declare new options
8389 '--discard-locals' and '-X' for discarding locals.
8390 * target.h (class Target): Define new methods is_local_label_name.
8391 Declare new virtual method do_is_local_label_name.
8392 * target.cc: New file.
8393 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8394 (check_SCRIPTS): Add discard_locals_test.sh.
8395 (check_DATA): Add discard_local_tests.syms.
8396 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8397 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8398 * testsuite/Makefile.in: Regenerate.
8399 * testsuite/discard_locals_test.c: New file.
8400 * testsuite/discard_locals_test.sh: Same.
8401
8402 2009-06-05 Doug Kwan <dougkwan@google.com>
8403
8404 * object.cc (Sized_relobj::Sized_relobj): Initialize
8405 discarded_eh_frame_shndx_ to -1U.
8406 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8407 section.
8408 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8409 a discarded .eh_frame section.
8410 (Sized_relobj::do_finalize_local_symbols): Ditto.
8411 * object.h (class Sized_relobj): Declare new member
8412 discarded_eh_frame_shndx_.
8413 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8414 (local_labels_test.o, local_labels_test): New rules.
8415 * testsuite/Makefile.in: Regenerate.
8416
8417 2009-06-04 Doug Kwan <dougkwan@google.com>
8418
8419 * layout.cc (Layout::section_name_mapping): Add mapping for
8420 special ARM sections.
8421
8422 2009-06-03 Doug Kwan <dougkwan@google.com>
8423
8424 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8425 (utils::has_overflow): Same.
8426
8427 2009-06-03 Ian Lance Taylor <iant@google.com>
8428
8429 * layout.cc (Layout::section_name_mapping): New array, replacing
8430 Layout::linkonce_mapping.
8431 (Layout::section_name_mapping_count): New variable, replacing
8432 Layout::linkonce_mapping_count.
8433 (Layout::linkonce_output_name): Remove.
8434 (Layout::output_section_name): Rewrite.
8435 * layout.h (class Layout): Rename Linkonce_mapping to
8436 Section_name_mapping, linkonce_mapping to section_name_mapping,
8437 linkonce_mapping_count to section_name_mapping_count. Don't
8438 declare linkonce_output_name.
8439
8440 2009-06-03 Doug Kwan <dougkwan@google.com>
8441
8442 * gold/arm.cc (namespace utils): New.
8443 (Target_arm::reloc_is_non_pic): Define new method.
8444 (class Arm_relocate_functions): New.
8445 (Target_arm::Relocate::relocate): Handle relocation types used by
8446 Android.
8447
8448 2009-06-03 Ian Lance Taylor <iant@google.com>
8449
8450 * arm.cc (Target_arm::scan::global): Use || instead of |.
8451
8452 2009-06-02 Doug Kwan <dougkwan@google.com>
8453
8454 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8455 issued_non_pic_error_.
8456 (class Target_arm::Scan): Declare new method check_non_pic.
8457 Define new method symbol_needs_plt_entry.
8458 Declare new data member issued_non_pic_error_.
8459 (class Target_arm::Relocate): Declare new method
8460 should_apply_static_reloc.
8461 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8462 (Target_arm::Scan::check_non_pic): Define new method.
8463 (Target_arm::Scan::local): Handle a small subset of reloc types used
8464 by Android.
8465 (Target_arm::Scan::local): Same.
8466 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8467
8468 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8469
8470 * incremental.cc (Incremental_inputs::report_command_line): Filter
8471 out --incremental-* options.
8472
8473 2009-05-29 Doug Kwan <dougkwan@google.com>
8474
8475 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8476 template class.
8477 (class Target_arm): Update comment.
8478 (Target_arm::Target_arm): Initialize new data members GOT_,
8479 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8480 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8481 and Target_arm::rel_dyn_section.
8482 Declare new_enum Target_arm::Got_type.
8483 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8484 and DYNBSS_.
8485 Update commments for member do_dynsym_value.
8486 (Target_arm::got_size, Target_arm::plt_section,
8487 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8488 new methods inside class defintion.
8489 (Target_arm::got_section): Define new method.
8490 (Target_arm::rel_dyn_section): Same.
8491 (Output_data_plt_arm): New template class.
8492 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8493 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8494 (Output_data_plt_arm::add_entry): Same.
8495 (Output_data_plt_arm::first_plt_entry): Define new
8496 static data member for PLT instruction template.
8497 (Output_data_plt_arm::plt_entry): Same.
8498 (Output_data_plt_arm::do_write): Define new method.
8499 (Target_arm::make_plt_entry): Same.
8500 (Target_arm::do_finalize_sections): Same.
8501 (Target_arm::do_dynsym_value): Same.
8502
8503 2009-05-28 Doug Kwan <dougkwan@google.com>
8504
8505 * Makefile.am (TARGETSOURCES): Add arm.cc.
8506 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8507 * Makefile.in: Regenerate.
8508 * arm.cc: New file.
8509 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8510
8511 2009-05-26 Doug Kwan <dougkwan@google.com>
8512
8513 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8514 (General_options::check_excluded_libs): Strip off directories in
8515 archive name before matching like GNU ld does.
8516 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8517 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8518 (exclude_libs_test_LDFLAGS): Add linker option
8519 -Wl,--exclude-libs,libexclude_libs_test_3
8520 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8521 an explicit archive without using -l.
8522 (alt/libexclude_libs_test_3.a): New make rule.
8523 * testsuite/Makefile.in: Regenerate.
8524 * testsuite/exclude_libs_test.c : Declare lib3_default().
8525 (main): Call it.
8526 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8527 * exclude_libs_test_3.c: New file.
8528
8529 2009-05-26 Nick Clifton <nickc@redhat.com>
8530
8531 * po/id.po: New Indonesian translation.
8532 * po/gold.pot: Updated template file.
8533
8534 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8535
8536 * testsuite/Makefile.am: Add -ffunction-sections to compile
8537 gc_comdat_test files. Add -Wl,--gc-sections to build
8538 gc_comdat_test.
8539 * testsuite/Makefile.in: Regenerate.
8540 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8541
8542 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8543
8544 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8545 kept comdat section was garbage collected.
8546 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8547 * testsuite/Makefile.in: Regenerate.
8548 * testsuite/gc_comdat_test.sh: New file.
8549 * testsuite/gc_comdat_test_1.cc: New file.
8550 * testsuite/gc_comdat_test_2.cc: New file.
8551
8552 2009-05-19 Doug Kwan <dougkwan@google.com>
8553
8554 * archive.cc (Archive::Archive): Move constructor from archive.h
8555 to here. Initialize no_export_.
8556 (Archive::get_elf_object_for_member): Set no_export flag of object.
8557 * archive.h (Archive::Archive): Move constructor body to
8558 archive.cc.
8559 (Archive::no_export): New method.
8560 (Archive::no_export_): New field.
8561 * object.h (Object::Object): Initialize no_export_ to false.
8562 (Object::no_export, Object::set_no_export): New methods.
8563 (Object::no_export_): New field.
8564 * options.cc (General_options::parse_exclude_libs): New method.
8565 (General_options::check_excluded_libs) Same.
8566 * options.h (exclude_libs): New option.
8567 (General_options::check_excluded_libs): New method declaration.
8568 (General_options::excluded_libs_): New field.
8569 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8570 default or protected visibility if an object has no-export flag set.
8571 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8572 (check_SCRIPTS): Add exclude_libs_test.sh.
8573 (check_DATA): Add exclude_libs_test.syms.
8574 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8575 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8576 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8577 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8578 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8579 libexclude_libs_test_2.a): New rules.
8580 * testsuite/Makefile.in: Regenerate.
8581 * testsuite/exclude_libs_test.c: New file.
8582 * testsuite/exclude_libs_test.sh: Ditto.
8583 * testsuite/exclude_libs_test_1.c: Ditto.
8584 * testsuite/exclude_libs_test_2.c: Ditto.
8585
8586 2009-05-15 Ian Lance Taylor <iant@google.com>
8587
8588 * configure.ac: Check for declarations for cases where libiberty.h
8589 checks HAVE_DECL_xxx.
8590 * configure, config.in: Rebuild.
8591
8592 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8593
8594 * gold.h (Incremental_argument_list): Remove (invalid) forward
8595 declaration.
8596 * incremental.cc (Incremental_inputs::report_achive): New method.
8597 (Incremental_inputs::report_object): New method.
8598 (Incremental_inputs::report_script): New method.
8599 (Incremental_inputs::finalize_inputs): New method.
8600 (Incremental_inputs::finalize): Call finalize_inputs().
8601 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8602 Create inputs entries.
8603 * incremental.h (Incremental_input_type): New enum.
8604 (Incremental_inputs::Incremental_input): Initialize new fields.
8605 (Incremental_inputs::report_inputs): New method.
8606 (Incremental_inputs::report_achive): New method.
8607 (Incremental_inputs::report_object): New method.
8608 (Incremental_inputs::report_script): New method.
8609 (Incremental_inputs::finalize_inputs): New method.
8610 (Incremental_inputs::Input_info): New struct.
8611 (Incremental_inputs::Input_info_map): New typedef.
8612 (Incremental_inputs::lock_): New field.
8613 (Incremental_inputs::Inputs_): New field.
8614 (Incremental_inputs::Inputs_map): New field.
8615 * main.cc (main): Call Incremental_input::report_inputs.
8616 * options.h (Input_argument_list): Typedef moved from
8617 Input_arguments.
8618 (Input_file_group::Files): Remove, use ::Input_argument_list.
8619 (Input_file_group::Input_argument_list): Remove, use
8620 ::Input_argument_list.
8621 * plugin.cc (Plugin_manager::add_input_file): Add error in
8622 incremental build.
8623 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8624 functions.
8625 * script.cc (read_input_script): Call
8626 Incremental_input::report_script.
8627 * script.h (Script_info): New class.
8628
8629 2009-04-27 Ian Lance Taylor <iant@google.com>
8630
8631 * x86_64.cc (do_adjust_output_section): Set entsize to
8632 plt_entry_size.
8633
8634 2009-04-23 Elliott Hughes <enh@google.com>
8635
8636 * output.cc (Output_file::close): After short writes, continue
8637 writing from the correct offset in the buffer being written.
8638
8639 2009-04-23 Chris Demetriou <cgd@google.com>
8640
8641 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8642 * configure: Regenerate.
8643 * config.in: Regenerate.
8644 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8645 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8646
8647 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8648
8649 * incremental.cc (Incremental_inputs_header_data): Renamed from
8650 Incremental_input_header_data.
8651 (Incremental_inputs_header_data::data_size): New field.
8652 (Incremental_inputs_header_data::put_input_file_count): Renamed
8653 from input_file_count.
8654 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8655 from command_line_offset.
8656 (Incremental_inputs_header_data::put_reserved): Renamed from
8657 put_reserved.
8658 (Incremental_inputs_entry_data): Renamed from
8659 Incremental_input_entry_data.
8660 (Incremental_inputs_entry_data::data_size): New field.
8661 (Incremental_inputs::report_command_line): New method.
8662 (Incremental_inputs::finalize): New method.
8663 (Incremental_inputs::create_incremental_inputs_data): New method.
8664 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8665 * incremental.h: New file.
8666 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8667 (Layout::finalize): Create incremental inputs section in
8668 incremental builds.
8669 (Layout::create_incremental_info_sections): New method.
8670 * layout.h (Layout::incremental_inputs): New method.
8671 (Layout::create_incremental_info_sections): New method.
8672 (Layout::incremental_inputs_): New field.
8673 * main.cc (main): Notify Incremental_input of the command line.
8674
8675 2009-04-01 Ian Lance Taylor <iant@google.com>
8676 Mikolaj Zalewski <mikolajz@google.com>
8677
8678 * gold.h (reserve_unordered_map): Define, three versions, one for
8679 each version of Unordered_map.
8680 * layout.cc (Layout::Layout): Remove options parameter. Add
8681 number_of_input_files parameter. Don't initialize options_.
8682 Initialize number_of_input_files_ and resized_signatures_. Move
8683 sections_are_attached_.
8684 (Layout::layout_group): Reserve space for group_signatures_.
8685 (Layout::find_or_add_kept_section): Change name parameter to be a
8686 reference. Resize signatures_ map when it gets large enough.
8687 (Layout::layout_eh_frame): Use parameters->options() instead of
8688 this->options_.
8689 (Layout::make_output_section): Likewise.
8690 (Layout::attach_allocated_section_to_segment): Likewise.
8691 (Layout::finalize, Layout::create_executable_stack): Likewise.
8692 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8693 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8694 * layout.h (class Layout): Update declarations. Remove options_
8695 field. Add number_of_input_files_ and resized_signatures_
8696 fields. Move sections_are_attached_ field.
8697 * main.cc (main): Pass number of input files to Layout
8698 constructor. Don't pass options.
8699
8700 2009-03-30 Ian Lance Taylor <iant@google.com>
8701
8702 * ffsll.c (ffsll): Correct implementation.
8703
8704 2009-03-27 Ian Lance Taylor <iant@google.com>
8705
8706 * ffsll.c: New file.
8707 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8708 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8709 * ftruncate.c (ftruncate): Declare before definition.
8710 * mremap.c (mremap): Likewise.
8711 * pread.c (pread): Likewise.
8712 * configure, Makefile.in, config.in: Rebuild.
8713
8714 * mremap.c: New file.
8715 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8716 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8717 (mremap): Declare if HAVE_MREMAP is not defined.
8718 * configure, Makefile.in, config.in: Rebuild.
8719
8720 2009-03-27 Cary Coutant <ccoutant@google.com>
8721
8722 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8723 position independent.
8724 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8725 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8726
8727 2009-03-24 Cary Coutant <ccoutant@google.com>
8728
8729 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8730 an executable.
8731 (needs_dynamic_reloc): Likewise.
8732
8733 2009-03-24 Ian Lance Taylor <iant@google.com>
8734
8735 * yyscript.y (file_cmd): Recognize EXTERN.
8736 (extern_name_list, extern_name_list_body): New nonterminals.
8737 * script.cc (script_add_extern): Define.
8738 * script-c.h (script_add_extern): Declare.
8739
8740 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8741
8742 * object.cc (is_elf_object): Define.
8743 * object.h (is_elf_object): Declare.
8744 * archive.cc (Archive::get_elf_object_for_member): Call
8745 is_elf_object.
8746 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8747
8748 2009-03-24 Elliott Hughes <enh@google.com>
8749
8750 * output.cc (Output_file::map_anonymous): Define.
8751 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8752 try an anonymous one. Report the size if the mmap fails.
8753 * output.h (class Output_file): Declare map_anonymous.
8754
8755 2009-03-24 Ian Lance Taylor <iant@google.com>
8756
8757 * target-select.cc (instantiate_target): Don't acquire the lock if
8758 the instantiated_target_ field has already been set.
8759
8760 2009-03-23 Ian Lance Taylor <iant@google.com>
8761
8762 * gold-threads.h (class Initialize_lock): Define.
8763 * gold-threads.cc (class Initialize_lock_once): Define.
8764 (initialize_lock_control): New static variable.
8765 (initialize_lock_pointer): New static variable.
8766 (initialize_lock_once): New static function.
8767 (Initialize_lock::Initialize_lock): Define.
8768 (Initialize_lock::initialize): Define.
8769 * target-select.h: Include "gold-threads.h".
8770 (class Target_selector): Add lock_ and initialize_lock_ fields.
8771 Don't define instantiate_target, just declare it.
8772 * target-select.cc (Target_selector::Target_selector): Initialize
8773 new fields.
8774 (Target_selector::instantiate_target): Define.
8775 * descriptors.h: Include "gold-threads.h".
8776 (class Descriptors): Add initialize_lock_ field.
8777 * descriptors.cc (Descriptors::Descriptors): Initialize new
8778 field.
8779 (Descriptors::open): Use initialize_lock_ field
8780 * errors.h (class Errors): Add initialize_lock_ field.
8781 * errors.cc (Errors::Errors): Initialize new field.
8782 (Errors::initialize_lock): Use initialize_lock_ field.
8783 * powerpc.cc (class Target_selector_powerpc): Remove
8784 instantiated_target_ field. In do_recognize call
8785 instantiate_target rather than do_instantiate_target. In
8786 do_instantiate_target just allocate a new target.
8787 * sparc.cc (class Target_selector_sparc): Likewise.
8788
8789 * freebsd.h: New file.
8790 * i386.cc: Include "freebsd.h".
8791 (Target_i386): Derive from Target_freebsd rather than
8792 Sized_target.
8793 (Target_selector_i386): Derive from Target_selector_freebsd rather
8794 than Target_selector.
8795 * x86_64.cc: Include "freebsd.h".
8796 (Target_x86_64): Derive from Target_freebsd rather than
8797 Sized_target.
8798 (Target_selector_x86_64): Derive from Target_selector_freebsd
8799 rather than Target_selector.
8800 * target.h (class Target): Add adjust_elf_header and
8801 do_adjust_elf_header.
8802 * output.cc (Output_file_header:: do_sized_write): Call target
8803 adjust_elf_header routine.
8804 * configure.tgt: Set targ_osabi.
8805 * configure.ac: Define GOLD_DEFAULT_OSABI.
8806 * parameters.cc (Parameters::default_target): Pass
8807 GOLD_DEFAULT_OSABI to select_target.
8808 * target-select.h (class Target_selector): Make instantiate_target
8809 protected rather than private.
8810 * Makefile.am (HFILES): Add freebsd.h.
8811 * configure, Makefile.in, config.in: Rebuild.
8812
8813 * merge.cc (do_add_input_section): Correct pend value. Change
8814 message about last entry not being null terminated from error to
8815 warning.
8816
8817 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8818
8819 * incremental.cc: New file.
8820 * Makefile.am (CCFILES): Add incremental.cc.
8821 * Makefile.in: Rebuild.
8822
8823 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8824
8825 * layout.cc (Layout::output_section_name): Preserve names
8826 of '.note.' sections.
8827
8828 2009-03-19 Ian Lance Taylor <iant@google.com>
8829
8830 * descriptors.cc (Descriptors::open): Check that the options are
8831 valid before using them.
8832
8833 2009-03-18 Ian Lance Taylor <iant@google.com>
8834
8835 * script-sections.h: Include <list>.
8836 (class Script_sections): Change Sections_elements from std::vector
8837 to std::list. Typedef public Elements_iterator. Add
8838 orphan_section_placement_, data_segment_align_start_, and
8839 saw_data_segment_align_ fields. Remove data_segment_align_index_
8840 field.
8841 * script-sections.cc (class Orphan_section_placement): New class.
8842 (class Sections_element): Add virtual functions is_relro and
8843 orphan_section_init. Remove virtual function place_orphan_here.
8844 (class Output_section_definition): Add is_relro and
8845 orphan_section_init. Remove place_orphan_here.
8846 (class Orphan_output_section): Likewise.
8847 (Script_sections::Script_sections): Update for field changes.
8848 (Script_sections::data_segment_align): Set saw_data_segment_align_
8849 and data_segment_align_start_, not data_segment_align_index.
8850 (Script_sections::data_segment_relro_end): Check
8851 saw_data_segment_align_. Use data_segment_align_start_ rather
8852 than data_segment_align_index_.
8853 (Script_sections::place_orphan): Rewrite to use
8854 Orphan_section_placement.
8855
8856 2009-03-17 Ian Lance Taylor <iant@google.com>
8857
8858 * archive.cc (Archive::add_symbols): Check for a version attached
8859 to the symbol name in the archive map.
8860 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8861 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8862 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8863 (ver_test_11.a): New target.
8864 * testsuite/Makefile.in: Rebuild.
8865
8866 * configure.ac: Check for chsize and posix_fallocate. Replace
8867 ftruncate.
8868 * ftruncate.c: New file, from gnulib.
8869 * output.cc (posix_fallocate): Define dummy version if not
8870 HAVE_POSIX_FALLOCATE.
8871 (Output_file::map): Call posix_fallocate rather than lseek and
8872 write.
8873 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8874 * configure, Makefile.in, config.in: Rebuild.
8875
8876 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8877
8878 * layout.h (Layout::create_note): Add section_name parameter.
8879 * layout.cc (Layout::create_note): Likewise.
8880 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8881
8882 2009-03-17 Ian Lance Taylor <iant@google.com>
8883
8884 * descriptors.cc: Include "options.h".
8885 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8886 (Descriptors::open): Always use O_CLOEXEC when opening a new
8887 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8888 then set FD_CLOEXEC.
8889
8890 * sparc.cc (class Target_sparc): Add has_got_section.
8891 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8892 make sure we have a GOT section.
8893
8894 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8895 (Target_sparc::Scan::local): Likewise.
8896 (Target_sparc::Scan::global): Likewise.
8897 (Target_sparc::Relocate::relocate): Likewise.
8898 (Target_sparc::Relocate::relocate_tls): Likewise.
8899
8900 * symtab.cc (Symbol_table::define_default_version): New function,
8901 broken out of add_from_object.
8902 (Symbol_table::add_from_object): Call define_default_version.
8903 (Symbol_table::define_special_symbol): Add resolve_oldsym
8904 parameter. Change all callers. If the version for a symbol comes
8905 from a version script, resolve it with the symbol with the same
8906 name with no version. Also add the symbol without a version if
8907 appropriate.
8908 (do_define_in_output_data): If resolving with oldsym, don't delete
8909 sym.
8910 (do_define_in_output_segment): Likewise.
8911 (do_define_as_constant): Likewise.
8912 * symtab.h (class Symbol_table): Update declarations.
8913
8914 2009-03-13 Ian Lance Taylor <iant@google.com>
8915
8916 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8917 (Read_symbols::requeue): New function.
8918 (Read_symbols::do_read_symbols): If make_elf_object fails because
8919 the target type is not configured, and the file was searched for,
8920 issue a warning and retry with the next directory.
8921 (Add_symbols::run): If the file has an incompatible format, and
8922 it was searched for, requeue the Read_symbols task. On error,
8923 release the object.
8924 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8925 dirindex parameter to constructor. Change all callers. Declare
8926 incompatible_warning and requeue.
8927 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8928 input_argument_ and input_group_ fields. Add them to
8929 constructor. Change all callers.
8930 (class Read_script): Add dirindex_ field. Add it to constructor.
8931 Change all callers.
8932 * archive.cc (Archive::setup): Remove input_objects parameter.
8933 Change all callers.
8934 (Archive::get_file_and_offset): Likewise.
8935 (Archive::read_all_symbols): Likewise.
8936 (Archive::read_symbols): Likewise.
8937 (Archive::get_elf_object_for_member): Remove input_objects
8938 parameter. Add punconfigured parameter. Change all callers.
8939 (Archive::add_symbols): Change return type to bool. Check return
8940 value of include_member.
8941 (Archive::include_all_members): Likewise.
8942 (Archive::include_member): Change return type to bool. Return
8943 false if first included object has incompatible target. Set
8944 included_member_ field.
8945 (Add_archive_symbols::run): If add_symbols returns false, requeue
8946 Read_symbols task.
8947 * archive.h (class Archive): Add included_member_ field.
8948 Initialize it in constructor. Add input_file and searched_for
8949 methods. Update declarations.
8950 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8951 input_argument_ fields. Add them to constructor. Change all
8952 callers.
8953 * script.cc: Include "target-select.h".
8954 (class Parser_closure): Add skip_on_incompatible_target_ and
8955 found_incompatible_target_ fields. Add
8956 skip_on_incompatible_target parameter to constructor. Change all
8957 callers. Add methods skip_on_incompatible_target,
8958 clear_skip_on_incompatible_target, found_incompatible_target, and
8959 set_found_incompatible_target.
8960 (read_input_script): Add dirindex parameter. Change all callers.
8961 If parser finds an incompatible target, requeue Read_symbols
8962 task.
8963 (script_set_symbol): Clear skip_on_incompatible_target in
8964 closure.
8965 (script_add_assertion, script_parse_option): Likewise.
8966 (script_start_sections, script_add_phdr): Likewise.
8967 (script_check_output_format): New function.
8968 * script.h (read_input_script): Update declaration.
8969 * script-c.h (script_check_output_format): Declare.
8970 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8971 (ignore_cmd): Remove OUTPUT_FORMAT.
8972 * fileread.cc (Input_file::Input_file): Add explicit this.
8973 (Input_file::will_search_for): New function.
8974 (Input_file::open): Add pindex parameter. Change all callers.
8975 * fileread.h (class Input_file): Add input_file_argument method.
8976 Declare will_search_for. Update declarations.
8977 * object.cc (make_elf_object): Add punconfigured parameter.
8978 Change all callers.
8979 * object.h (class Object): Make input_file public. Add
8980 searched_for method.
8981 (make_elf_object): Update declaration.
8982 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8983 restart search.
8984 * dirsearch.h (class Dirsearch): Update declaration.
8985 * options.h (class General_options): Add --warn-search-mismatch.
8986 * parameters.cc (Parameters::is_compatible_target): New function.
8987 * parameters.h (class Parameters): Declare is_compatible_target.
8988 * workqueue.cc (Workqueue::add_blocker): New function.
8989 * workqueue.h (class Workqueue): Declare add_blocker.
8990
8991 * fileread.cc (Input_file::open): Remove options parameter.
8992 Change all callers.
8993 (Input_file::open_binary): Likewise.
8994 * script.cc (read_input_script): Likewise.
8995 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8996 options parameter from constructor. Change all callers.
8997 (class Read_script): Likewise.
8998 * fileread.h (class Input_file): Update declarations.
8999 * script.h (read_input_script): Update declaration.
9000
9001 2009-03-10 Nick Clifton <nickc@redhat.com>
9002
9003 * po/es.po: New Spanish translation.
9004
9005 2009-03-06 Cary Coutant <ccoutant@google.com>
9006
9007 * options.cc (parse_short_option): Keep dash_z from registering itself.
9008
9009 2009-03-03 Ian Lance Taylor <iant@google.com>
9010
9011 PR 9918
9012 * target-reloc.h (relocate_section): Pass output_section to
9013 relocate.
9014 * i386.cc (Target_i386::should_apply_static_reloc): Add
9015 output_section parameter. Change all callers.
9016 (Target_i386::Relocate::relocate): Add output_section parameter.
9017 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9018 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
9019 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
9020 * testsuite/two_file_shared.sh: New script.
9021 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
9022 (check_DATA): Add two_file_shared.dbg.
9023 (two_file_shared.dbg): New target.
9024 * testsuite/Makefile.in: Rebuild.
9025
9026 2009-03-01 Ian Lance Taylor <iant@google.com>
9027
9028 * configure.ac: Check for byteswap.h.
9029 * configure: Rebuild.
9030 * config.in: Rebuild.
9031
9032 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
9033
9034 * layout.cc (Layout::find_or_add_kept_section): New function.
9035 (Layout::add_comdat): Removed.
9036 * layout.h (struct Kept_section): Move out of class Layout.
9037 Remove trailing underscores from field names. Add group_sections
9038 field. Rename group_ field to is_group. Change all uses.
9039 (class Layout): Declare find_or_add_kept_section, not add_comdat.
9040 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
9041 comdat_groups_ field.
9042 (Sized_relobj::include_section_group): Use
9043 find_or_add_kept_section and Kept_section::group_sections.
9044 (Sized_relobj::include_linkonce_section): Likewise.
9045 * object.cc (class Sized_relobj): Don't define Comdat_group or
9046 Comdat_group_table. Remove find_comdat_group and
9047 add_comdat_group. Remove comdat_groups_ field.
9048 * plugin.cc (include_comdat_group): Use
9049 Layout::find_or_add_kept_section.
9050
9051 2009-02-28 Ian Lance Taylor <iant@google.com>
9052
9053 * README: --gc-sections and map files are now supported. Document
9054 some build requirements.
9055
9056 PR 6992
9057 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
9058 relocatable link set the value of the section symbol to zero.
9059 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
9060 relocatable link don't include the section address in the local
9061 symbol value.
9062
9063 2009-02-27 Ian Lance Taylor <iant@google.com>
9064
9065 PR 6811
9066 * options.h (class Search_directory): Add is_system_directory.
9067 (class General_options): Declare is_in_system_directory.
9068 * options.cc (get_relative_sysroot): Make static.
9069 (get_default_sysroot): Make static.
9070 (General_optoins::is_in_system_directory): New function.
9071 * fileread.cc (Input_file::is_in_system_directory): New function.
9072 * fileread.h (class Input_file): Declare is_in_system_directory.
9073 * object.h (class Object): Add is_in_system_directory.
9074 (class Input_objects): Remove system_library_directory_ field.
9075 * object.cc (Input_objects::add_object): Don't set
9076 system_library_directory_.
9077 (input_objects::found_in_system_library_directory): Remove.
9078 * symtab.cc (Symbol_table::write_globals): Remove input_objects
9079 parameter. Change all callers.
9080 (Symbol_table::sized_write_globals): Likewise.
9081 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
9082 Call Object::is_in_system_directory.
9083 * symtab.h (class Symbol_table): Update declarations.
9084
9085 PR 5990
9086 * descriptors.h (Open_descriptor): Add is_on_stack field.
9087 * descriptors.cc (Descriptors::open): If the descriptor is on the
9088 top of the stack, remove it. Initialize is_on_stack field.
9089 (Descriptors::release): Only add pod to stack if it is not on the
9090 stack already.
9091 (Descriptors::close_some_descriptor): Clear stack_next and
9092 is_on_stack fields.
9093
9094 PR 7091
9095 * output.cc (Output_section::find_starting_output_address): Rename
9096 from starting_output_address; add PADDR parameter; change return
9097 type.
9098 * output.h (class Output_section): Declare
9099 find_starting_output_address instead of starting_output_address.
9100 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
9101 section symbol for which we can't find a merge section.
9102
9103 PR 9836
9104 * symtab.cc (Symbol_table::add_from_object): If the visibility is
9105 hidden or internal, force the symbol to be local.
9106 * resolve.cc (Symbol::override_visibility): Define.
9107 (Symbol::override_base): Use override_visibility.
9108 (Symbol_table::resolve): Likewise.
9109 (Symbol::override_base_with_special): Likewise.
9110 (Symbol_table::override_with_special): If the visibility is hidden
9111 or internal, force the symbol to be local.
9112 * symtab.h (class Symbol): Add set_visibility and
9113 override_visibility.
9114 * testsuite/ver_test_1.sh: New file.
9115 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
9116 (check_DATA): Add ver_test_1.syms.
9117 (ver_test_1.syms): New target.
9118 * testsuite/Makefile.in: Rebuild.
9119
9120 2009-02-25 Cary Coutant <ccoutant@google.com>
9121
9122 * layout.cc (Layout::choose_output_section): Don't rename sections
9123 when using a linker script that has a SECTIONS clause.
9124 * Makefile.in: Regenerate.
9125
9126 * testsuite/Makefile.am (script_test_5.sh): New test case.
9127 * testsuite/Makefile.in: Regenerate.
9128 * testsuite/script_test_5.cc: New file.
9129 * testsuite/script_test_5.sh: New file.
9130 * testsuite/script_test_5.t: New file.
9131
9132 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
9133
9134 * archive.cc (Archive::include_member): Update calls to add_symbols.
9135 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
9136 the Layout argument.
9137 * dynobj.h (do_add_symbols): Add the Layout argument.
9138 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
9139 Layout argument.
9140 * object.h (Object::add_symbols): Add the Layout argument.
9141 (Object::do_add_symbols): Add the Layout argument.
9142 (Sized_relobj::do_add_symbols): Add the Layout argument.
9143 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
9144 Unify the two versions.
9145 (Add_plugin_symbols): Remove.
9146 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
9147 (Sized_pluginobj::do_add_symbols): Unify the two versions.
9148 (Add_plugin_symbols): Remove.
9149 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
9150 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
9151 (Add_symbols::run): Make it work with Pulginobj.
9152
9153 2009-02-06 Ian Lance Taylor <iant@google.com>
9154
9155 * object.cc (Sized_relobj::do_layout): Make info message start
9156 with lower case letter.
9157
9158 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
9159
9160 * binary.cc: Fix file comment.
9161
9162 * options.h (enum Incremental_disposition): Define.
9163 (class General_options): Add new options: --incremental,
9164 --incremental_changed, --incremental_unchanged,
9165 --incremental_unknown. Add incremental_disposition_ and
9166 implicit_incremental_ fields.
9167 (General_options::incremental_disposition): New function.
9168 (class Position_dependent_options): Add incremental_disposition
9169 option.
9170 (Position_dependent_options::copy_from_options): Set incremental
9171 dispositions.
9172 * options.cc (General_options::parse_incremental_changed): New
9173 function.
9174 (General_options::parse_incremental_unchanged): New function.
9175 (General_options::parse_incremental_unknown): New function.
9176 (General_options::General_options): Initialize new fields
9177 incremental_disposition_ and implicit_incremental_.
9178 (General_options::finalize): Check for uasge of --incremental-*
9179 without --incremental.
9180
9181 2009-02-06 Chris Demetriou <cgd@google.com>
9182
9183 * gold.h (gold_undefined_symbol): Change to take only a Symbol
9184 pointer and to report location as the file name associated with
9185 the symbol.
9186 (gold_undefined_symbol_at_location): New function to replace the
9187 old gold_undefined_symbol functionality.
9188 * target-reloc.h (relocate_section): Update to use
9189 gold_undefined_symbol_at_location.
9190 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9191 Call gold_undefined_symbol function rather than gold_error.
9192 * errors.h (Errors::undefined_symbol): Take location as a
9193 string, rather than calculating it from a relocation.
9194 * errors.cc (Errors::fatal): Print "fatal error:" before the
9195 formatted message.
9196 (Errors::error, Errors::error_at_location): Print "error: "
9197 before the formatted message.
9198 (Errors::undefined_symbol): Take location as a string, rather
9199 than calculating it from a relocation.
9200 (gold_undefined_symbol_at_location): New function akin to
9201 old gold_undefined_symbol, calculates location from relocation.
9202 (gold_undefined_symbol): Change to take only a Symbol pointer
9203 and to report location as the file name associated with the symbol.
9204 * testsuite/debug_msg.sh: Update for changed error messages.
9205 * testsuite/undef_symbol.sh: Likewise.
9206
9207 2009-02-04 Duncan Sands <baldrick@free.fr>
9208
9209 PR 9812
9210 * reduced_debug_output.h
9211 (Output_reduced_debug_abbrev_section::failed): Use format for
9212 gold_warning.
9213 (Output_reduced_debug_info_section::faild): Likewise.
9214
9215 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9216
9217 * script.cc (Lazy_demangler): New class.
9218 (Version_script_info::get_symbol_version_helper): Demangle a
9219 symbol only once.
9220
9221 2009-01-29 Cary Coutant <ccoutant@google.com>
9222
9223 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9224 to __tls_get_addr.
9225 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9226
9227 2009-01-28 Ian Lance Taylor <iant@google.com>
9228
9229 * version.cc (version_string): Bump to 1.9.
9230
9231 * gold.h: Include <cstring> and <stdint.h>.
9232 * version.cc: Include <cstdio>.
9233 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9234 warning.
9235 * reduced_debug_output.cc (insert_into_vector): Rename from
9236 Insert_into_vector; change all callers. Use Swap_unaligned to
9237 avoid aliasing issue; remove union since it is unnecessary.
9238
9239 2009-01-27 Sriraman Tallam <tmsriram@google.com>
9240
9241 * Makefile.am (CCFILES): Add gc.cc.
9242 (HFILES): Add gc.h.
9243 * Makefile.in: Regenerate.
9244 * gold.cc (Gc_runner): New class.
9245 (queue_initial_tasks): Call garbage collection related tasks
9246 when corresponding options are invoked.
9247 (queue_middle_gc_tasks): New function.
9248 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9249 processed early before laying out sections during garbage collection.
9250 * gold.h (queue_middle_gc_tasks): New function.
9251 (is_prefix_of): Move from "layout.cc".
9252 * i386.cc (Target_i386::gc_process_relocs): New function.
9253 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9254 * main.cc (main): Create object of class "Garbage_collection".
9255 * object.cc (Relobj::copy_symbols_data): New function.
9256 (Relobj::is_section_name_included): New function.
9257 (Sized_relobj::do_layout): Allow this function to be called twice
9258 during garbage collection and defer layout of section during the
9259 first call.
9260 * object.h (Relobj::get_symbols_data): New function.
9261 (Relobj::is_section_name_included): New function.
9262 (Relobj::copy_symbols_data): New function.
9263 (Relobj::set_symbols_data): New function.
9264 (Relobj::get_relocs_data): New function.
9265 (Relobj::set_relocs_data): New function.
9266 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9267 (Relobj::gc_process_relocs): New function.
9268 (Relobj::do_gc_process_relocs): New pure virtual function.
9269 (Relobj::sd_): New data member.
9270 (Sized_relobj::is_output_section_offset_invalid): New function.
9271 (Sized_relobj::do_gc_process_relocs): New function.
9272 * options.h (General_options::gc_sections): Modify to not be a no-op.
9273 (General_options::print_gc_sections): New option.
9274 * plugin.cc (Plugin_finish::run): Remove function call to
9275 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9276 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9277 * reloc.cc (Read_relocs::run): Add task to process relocs and
9278 determine unreferenced sections when doing garbage collection.
9279 (Gc_process_relocs): New class.
9280 (Sized_relobj::do_gc_process_relocs): New function.
9281 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9282 sections that are garbage collected.
9283 * reloc.h (Gc_process_relocs): New class.
9284 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9285 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9286 symbols whose corresponding sections are garbage collected.
9287 (Symbol_table::Symbol_table): Add new parameter for the garbage
9288 collection object.
9289 (Symbol_table::gc_mark_undef_symbols): New function.
9290 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9291 (Symbol_table::gc_mark_dyn_syms): New function.
9292 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9293 as garbage.
9294 (Symbol_table::add_from_object): Likewise.
9295 (Symbol_table::add_from_relobj): When building shared objects, do not
9296 treat externally visible symbols as garbage.
9297 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9298 table information for static and relocatable links.
9299 * symtab.h (Symbol_table::set_gc): New function.
9300 (Symbol_table::gc): New function.
9301 (Symbol_table::gc_mark_undef_symbols): New function.
9302 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9303 (Symbol_table::gc_mark_dyn_syms): New function.
9304 (Symbol_table::gc_): New data member.
9305 * target.h (Sized_target::gc_process_relocs): New pure virtual
9306 function.
9307 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9308 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9309
9310 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9311
9312 * options.h (General_options::gc_sections): Define as a no-op for now.
9313 (General_options::no_keep_memory): Ditto.
9314 (General_options::Bshareable): Define.
9315 * options.cc (General_options::finalize): Honor -Bshareable.
9316
9317 2009-01-20 Andreas Schwab <schwab@suse.de>
9318
9319 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9320 read the value in the contents, since we don't use it. Use the
9321 template endianness when writing.
9322 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9323
9324 2009-01-19 Andreas Schwab <schwab@suse.de>
9325
9326 * configure.tgt (powerpc64-*): Fix targ_obj.
9327
9328 2009-01-15 Ian Lance Taylor <iant@google.com>
9329
9330 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9331 local symbols when stripping all symbols.
9332
9333 2009-01-14 Cary Coutant <ccoutant@google.com>
9334
9335 * output.cc (Output_reloc): Add explicit instantiations.
9336
9337 2009-01-14 Cary Coutant <ccoutant@google.com>
9338
9339 * archive.cc (Archive::get_elf_object_for_member): Remove call
9340 to File_read::claim_for_plugin.
9341 * descriptors.cc (Descriptors::open): Remove reference to
9342 is_claimed.
9343 (Descriptors::claim_for_plugin): Remove.
9344 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9345 (Descriptors::is_claimed): Remove.
9346 (claim_descriptor_for_plugin): Remove.
9347 * fileread.cc (File_read::claim_for_plugin): Remove.
9348 * fileread.h (File_read::claim_for_plugin): Remove.
9349 (File_read::descriptor): Reopen descriptor if necessary.
9350 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9351 (Plugin_manager::all_symbols_read): Add task parameter. Change
9352 all callers.
9353 (Plugin_manager::get_input_file): New function.
9354 (Plugin_manager::release_input_file): New function.
9355 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9356 corresponding data member.
9357 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9358 and pass to base constructor. Change all callers.
9359 (get_input_file, release_input_file): New functions.
9360 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9361 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9362 (Plugin_manager::all_symbols_read): Add task parameter.
9363 (Plugin_manager::get_input_file): New function.
9364 (Plugin_manager::release_input_file): New function.
9365 (Plugin_manager::task_): New data member.
9366 (Pluginobj::Pluginobj): Add filesize parameter.
9367 (Pluginobj::filename): New function.
9368 (Pluginobj::descriptor): New function.
9369 (Pluginobj::filesize): New function.
9370 (Pluginobj::filesize_): New data member.
9371 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9372 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9373 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9374
9375 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9376 with archive libraries.
9377 * testsuite/Makefile.in: Regenerate.
9378 * testsuite/plugin_test.c (struct sym_info): New type.
9379 (get_input_file, release_input_file): New static variables.
9380 (onload): Capture new transfer vector entries.
9381 (claim_file_hook): Stop reading at end of file according to filesize.
9382 Factor out parsing of readelf output into separate function.
9383 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9384 APIs and get the source file name from the symbol table. Convert
9385 source file name to corresponding object file name. Print info
9386 message when adding new input files.
9387 (parse_readelf_line): New function.
9388 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9389 * testsuite/plugin_test_2.sh: Likewise.
9390 * testsuite/plugin_test_3.sh: Likewise.
9391 * testsuite/plugin_test_4.sh: New test case.
9392
9393 2009-01-07 Ian Lance Taylor <iant@google.com>
9394
9395 * version.cc (version_string): Bump to 1.8.
9396
9397 2008-12-23 Cary Coutant <ccoutant@google.com>
9398
9399 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9400 * plugin.cc (Plugin_manager::finish): Rename as
9401 layout_deferred_objects. Move cleanup to separate function.
9402 (Plugin_manager::cleanup): New function.
9403 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9404 separately.
9405 * plugin.h (Plugin_manager::finish): Rename as
9406 layout_deferred_objects.
9407 (Plugin_manager::cleanup): New function.
9408 (Plugin_manager::cleanup_done): New field.
9409
9410 2008-12-23 Cary Coutant <ccoutant@google.com>
9411
9412 * plugin.cc (is_visible_from_outside): New function.
9413 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9414 so we don't return "IR only" status for exported symbols or -r links.
9415
9416 * testsuite/Makefile.am (plugin_test_3): New test case.
9417 * testsuite/Makefile.in: Regenerate.
9418 * testsuite/plugin_test_3.sh: New file.
9419
9420 2008-12-22 Cary Coutant <ccoutant@google.com>
9421
9422 * object.cc (Sized_relobj::layout_section): New function.
9423 (Sized_relobj::do_layout): Defer layout of input sections until after
9424 plugin has provided replacement files.
9425 (Sized_relobj::do_layout_deferred_sections): New function.
9426 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9427 (Relobj::layout_deferred_sections): New function.
9428 (Relobj::do_layout_deferred_sections): New function.
9429 (Sized_relobj::do_layout_deferred_sections): New function.
9430 (Sized_relobj::layout_section): New function.
9431 (Sized_relobj::Deferred_layout): New structure.
9432 (Sized_relobj::deferred_layout_): New field.
9433 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9434 Change all callers. Layout deferred sections.
9435 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9436 references.
9437 (Plugin_hook::run): Move code from do_plugin_hook inline.
9438 (Plugin_hook::do_plugin_hook): Remove.
9439 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9440 (Plugin_manager::finish): Renamed, was cleanup.
9441 (Plugin_manager::should_defer_layout): New function.
9442 (Plugin_manager::add_deferred_layout_object): New function.
9443 (Plugin_manager::Deferred_layout_list): New type.
9444 (Plugin_manager::deferred_layout_objects_): New field.
9445 (Plugin_hook::do_plugin_hook): Remove.
9446
9447 2008-12-17 Ian Lance Taylor <iant@google.com>
9448
9449 * options.h (class General_options): Add --no case for
9450 --export-dynamic.
9451
9452 2008-12-16 Cary Coutant <ccoutant@google.com>
9453
9454 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9455 vector.
9456 (Plugin_manager::claim_file): Create plugin object even if
9457 plugin did not call the add_symbols callback.
9458 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9459 asking for more symbols than were added.
9460 * testsuite/Makefile.am (plugin_test_1): Add test case with
9461 no global symbols.
9462 (empty.syms): New target.
9463 * testsuite/Makefile.in: Regenerate.
9464 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9465 message. Don't call add_symbols if no globals.
9466 (all_symbols_read_hook): Don't provide replacement for empty
9467 claimed file.
9468
9469 2008-12-12 Ian Lance Taylor <iant@google.com>
9470
9471 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9472 r_type == 0 for a local symbol with r_sym == 0.
9473 (scan_relocatable_relocs): Pass r_sym to
9474 local_non_section_strategy.
9475 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9476 r_sym parameter.
9477
9478 * configure.ac: Update test for TLS descriptors: they are
9479 supported as of glibc 2.9.
9480 * configure: Rebuild.
9481
9482 2008-12-11 Ian Lance Taylor <iant@google.com>
9483
9484 PR 7091
9485 * target-reloc.h (Default_scan_relocatable_relocs): For each
9486 function, map r_type == 0 to RELOC_DISCARD.
9487
9488 2008-12-10 Cary Coutant <ccoutant@google.com>
9489
9490 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9491 object to override a kept COMDAT group from a plugin object.
9492
9493 2008-12-09 Ian Lance Taylor <iant@google.com>
9494
9495 PR 7088
9496 * yyscript.y (file_cmd): Handle INPUT.
9497
9498 * testsuite/initpri1.c: Change all declarations to be full
9499 prototypes by adding void, to avoid compiler warnings.
9500
9501 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9502
9503 * options.cc (General_options::parse_plugin_opt): New.
9504 (General_options::add_plugin): The argument now is just the filename.
9505 (General_options::add_plugin_option): New.
9506 * options.h (plugin_opt): New.
9507 (add_plugin): Change argument name.
9508 (add_plugin_option): New.
9509 * plugin.cc (Plugin::load): Don't parse the plugin option.
9510 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9511 (Plugin::add_option): New.
9512 (Plugin::args_): Change type.
9513 (Plugin::filename_): New.
9514 (Plugin_manager::add_plugin_option): New.
9515 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9516 * testsuite/Makefile.in: Regenerate.
9517
9518 2008-12-05 Cary Coutant <ccoutant@google.com>
9519
9520 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9521 Handle --strip-lto-sections option.
9522 * options.h (strip_lto_sections): New option.
9523
9524 2008-12-01 Cary Coutant <ccoutant@google.com>
9525
9526 * plugin.cc (ld_plugin_message): Change format parameter to const.
9527 Fix mismatch between new[] and delete.
9528
9529 2008-11-14 Cary Coutant <ccoutant@google.com>
9530
9531 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9532 instead of -1U.
9533
9534 2008-11-05 Craig Silverstein <csilvers@google.com>
9535
9536 * options.cc (General_options::parse_dynamic_list): New function.
9537 * options.h (General_options): New flags dynamic_list,
9538 dynamic_list_data, dynamic_list_cpp_new, and
9539 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9540 (General_options::in_dynamic_list): New function.
9541 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9542 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9543 (Lex::can_continue_name): Likewise.
9544 (yylex): Likewise.
9545 (read_script_file): New parameter script_options.
9546 (read_dynamic_list): New function.
9547 (Script_options::define_dynamic_list): New function.
9548 (dynamic_list_keyword_parsecodes): New variable.
9549 (dynamic_list_keywords): New variable.
9550 * script.h (Script_options::define_dynamic_list): New function
9551 prototype.
9552 (read_dynamic_list): New function prototype.
9553 * symtab.cc (strprefix): New macro.
9554 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9555 dynamic_list_data, dynamic_list_cpp_new, and
9556 dynamic_list_cpp_typeinfo.
9557 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9558 (dynamic_list_expr): New rule.
9559 (dynamic_list_nodes): Likewise.
9560 (dynamic_list_node): Likewise.
9561 * testsuite/Makefile.am (dynamic_list): New test.
9562 * testsuite/Makefile.in: Regenerated.
9563 * testsuite/dynamic_list.t: New file.
9564 * testsuite/dynamic_list.sh: New file.
9565
9566 2008-11-05 Craig Silverstein <csilvers@google.com>
9567
9568 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9569 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9570 (t11_last): Likewise.
9571 * testsuite/ver_test_6.c (main): Likewise.
9572
9573 2008-10-07 Cary Coutant <ccoutant@google.com>
9574
9575 * options.c (General_options::finalize): Add check for -static and
9576 -shared.
9577 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9578 is not empty.
9579
9580 2008-10-02 Cary Coutant <ccoutant@google.com>
9581
9582 * plugin.cc (make_sized_plugin_object): Fix conditional
9583 compilation to work when not all targets are enabled.
9584
9585 2008-09-29 Cary Coutant <ccoutant@google.com>
9586
9587 * archive.cc (Archive::get_file_and_offset): Use filename instead
9588 of name to get library path.
9589 (Archive::include_member): Unlock external member of a thin archive.
9590
9591 * testsuite/Makefile.am (TEST_AR): New variable.
9592 (thin_archive_test_1): New test.
9593 (thin_archive_test_2): New test.
9594 * testsuite/Makefile.in: Regenerate.
9595 * testsuite/thin_archive_main.cc: New file.
9596 * testsuite/thin_archive_test_1.cc: New file.
9597 * testsuite/thin_archive_test_2.cc: New file.
9598 * testsuite/thin_archive_test_3.cc: New file.
9599 * testsuite/thin_archive_test_4.cc: New file.
9600
9601 2008-09-29 Cary Coutant <ccoutant@google.com>
9602
9603 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9604 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9605 instead of -1U.
9606 (Sized_relobj::do_finalize_local_symbols): Likewise.
9607 (Sized_relobj::map_to_kept_section): Likewise.
9608 * object.h (Sized_relobj::invalid_address): New constant.
9609 (Sized_relobj::do_output_section_offset): Check for invalid_address
9610 and return -1ULL.
9611 * output.cc (Output_reloc::local_section_offset): Use constant
9612 invalid_address instead of -1U.
9613 (Output_reloc::get_address): Likewise.
9614 (Output_section::output_address): Change -1U to -1ULL.
9615 * output.h (Output_reloc::invalid_address): New constant.
9616 * reloc.cc (Sized_relobj::write_sections): Use constant
9617 invalid_address instead of -1U.
9618 (Sized_relobj::relocate_sections): Likewise.
9619 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9620 values for merge sections.
9621 * target-reloc.h (relocate_for_relocatable): Use constant
9622 invalid_address instead of -1U.
9623
9624 2008-09-19 Cary Coutant <ccoutant@google.com>
9625
9626 Add plugin functionality for link-time optimization (LTO).
9627 * configure.ac (plugins): Add --enable-plugins option.
9628 * configure: Regenerate.
9629 * config.in: Regenerate.
9630 * Makefile.am (LIBDL): New variable.
9631 (CCFILES): Add plugin.cc.
9632 (HFILES): Add plugin.h.
9633 (ldadd_var): Add LIBDL.
9634 * Makefile.in: Regenerate.
9635
9636 * archive.cc: Include "plugin.h".
9637 (Archive::setup): Don't preread archive symbols when using a plugin.
9638 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9639 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9640 files.
9641 (Archive::include_member): Add symbols from plugin objects.
9642 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9643 * descriptors.cc (Descriptors::open): Check for file descriptors
9644 abandoned by plugins.
9645 (Descriptors::claim_for_plugin): New function.
9646 * descriptors.h (Descriptors::claim_for_plugin): New function.
9647 (Open_descriptor::is_claimed): New field.
9648 (claim_descriptor_for_plugin): New function.
9649 * fileread.cc (File_read::claim_for_plugin): New function.
9650 * fileread.h (File_read::claim_for_plugin): New function.
9651 (File_read::descriptor): New function.
9652 * gold.cc: Include "plugin.h".
9653 (queue_initial_tasks): Add task to call plugin hooks for generating
9654 new object files.
9655 * main.cc: Include "plugin.h".
9656 (main): Load plugin libraries.
9657 * object.h (Pluginobj): Declare.
9658 (Object::pluginobj): New function.
9659 (Object::do_pluginobj): New function.
9660 (Object::set_target): New function.
9661 * options.cc: Include "plugin.h".
9662 (General_options::parse_plugin): New function.
9663 (General_options::General_options): Initialize plugins_ field.
9664 (General_options::add_plugin): New function.
9665 * options.h (Plugin_manager): Declare.
9666 (General_options): Add --plugin option.
9667 (General_options::has_plugins): New function.
9668 (General_options::plugins): New function.
9669 (General_options::add_plugin): New function.
9670 (General_options::plugins_): New field.
9671 * plugin.cc: New file.
9672 * plugin.h: New file.
9673 * readsyms.cc: Include "plugin.h".
9674 (Read_symbols::do_read_symbols): Check for archive before checking
9675 for ELF file. Call plugin hooks to claim files.
9676 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9677 from a real object file; force override when processing replacement
9678 files.
9679 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9680 (Symbol::init_base_object): Likewise.
9681 (Symbol::init_base_output_data): Likewise.
9682 (Symbol::init_base_output_segment): Likewise.
9683 (Symbol::init_base_constant): Likewise.
9684 (Symbol::init_base_undefined): Likewise.
9685 (Symbol::output_section): Assert that object is not a plugin.
9686 (Symbol_table::add_from_pluginobj): New function.
9687 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9688 undefined.
9689 (Symbol_table::sized_write_globals): Likewise.
9690 (Symbol_table::add_from_pluginobj): Instantiate template.
9691 * symtab.h (Sized_pluginobj): Declare.
9692 (Symbol::in_real_elf): New function.
9693 (Symbol::set_in_real_elf): New function.
9694 (Symbol::in_real_elf_): New field.
9695 (Symbol_table::add_from_pluginobj): New function.
9696
9697 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9698 (LIBDL): New variable.
9699 (LDADD): Add LIBDL.
9700 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9701 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9702 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9703 (MOSTLYCLEANFILES): Likewise.
9704 * testsuite/Makefile.in: Regenerate.
9705 * testsuite/plugin_test.c: New file.
9706 * testsuite/plugin_test_1.sh: New file.
9707 * testsuite/plugin_test_2.sh: New file.
9708
9709 2008-09-16 Ian Lance Taylor <iant@google.com>
9710
9711 * target-reloc.h (relocate_section): Check whether a symbol is
9712 defined by the ABI before reporting an undefined symbol error.
9713 * target.h (Target::is_defined_by_abi): Make parameter const.
9714 (Target::do_is_defined_by_abi): Likewise.
9715 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9716 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9717 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9718 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9719 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9720 * testsuite/Makefile.in: Rebuild.
9721
9722 * fileread.cc (make_view): Add casts to avoid warning.
9723
9724 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9725
9726 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9727 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9728
9729 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9730
9731 * options.h (General_options::output_is_executable): New.
9732 (General_options::output_is_pie): New.
9733 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9734 for shared libraries.
9735 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9736
9737 2008-09-11 Chris Demetriou <cgd@google.com>
9738
9739 * options.h (origin): New -z option.
9740 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9741 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9742 in DT_FLAGS_1.
9743
9744 2008-09-05 Cary Coutant <ccoutant@google.com>
9745
9746 * fileread.cc (File_read::make_view): Add check for attempt to map
9747 beyond end of file.
9748
9749 2008-09-05 Cary Coutant <ccoutant@google.com>
9750
9751 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9752 explicit instantiations.
9753
9754 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9755
9756 PR gold/6858
9757 * options.cc (General_options::finalize): Allow undefined symbols
9758 in shlibs if linking -shared.
9759
9760 PR gold/6859
9761 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9762 symbols as not needing a dynsym entry.
9763
9764 2008-08-20 Craig Silverstein <csilvers@google.com>
9765
9766 * fileread.cc (File_read::open): Do not lock the file unless it
9767 was successfully opened.
9768
9769 2008-08-14 Cary Coutant <ccoutant@google.com>
9770
9771 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9772 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9773 * testsuite/tls_test.cc (struct int128): 128-bit struct
9774 for testing TLS relocs with non-zero addend.
9775 (v12): New TLS variable.
9776 (t12): New test.
9777 (t_last): Add check for v12.
9778 * testsuite/tls_test.h (t12): New function.
9779 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9780
9781 2008-08-13 Ian Lance Taylor <iant@google.com>
9782
9783 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9784 set tls_segment_ or relro_segment_.
9785 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9786 when appropriate.
9787 * output.h (Output_section::clear_is_relro): New function.
9788 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9789 sections specially even when output_data_ is empty.
9790 (Output_segment::maximum_alignment): When first section is relro,
9791 only force alignment for PT_LOAD segments.
9792 * script.cc (script_data_segment_align): New function.
9793 (script_data_segment_relro_end): New function.
9794 * script-c.h (script_data_segment_align): Declare.
9795 (script_data_segment_relro_end): Declare.
9796 * script-sections.h (class Script_sections): Declare
9797 data_segment_align and data_segment_relro_end. Add fields
9798 segment_align_index_ and saw_relro_end_.
9799 * script-sections.cc (class Sections_element): Add set_is_relro
9800 virtual function. Add new bool* parameter to place_orphan_here.
9801 Add get_output_section virtual function.
9802 (class Output_section_definition): Add set_is_relro. Add new
9803 bool* parameter to place_orphan_here. Add get_output_section.
9804 Add is_relro_ field.
9805 (Output_section_definition::Output_section_definition): Initialize
9806 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9807 and is_relro_ fields.
9808 (Output_section_definition::place_orphan_here): Add is_relro
9809 parameter.
9810 (Output_section_definition::set_section_addresses): Set relro for
9811 output section.
9812 (Output_section_definition::alternate_constraint): Likewise.
9813 (class Orphan_output_section): Add new bool* parameter to
9814 place_orphan_here. Add get_output_section.
9815 (Orphan_output_section::place_orphan_here): Add is_relro
9816 parameter.
9817 (Script_sections::Script_sections): Initialize
9818 data_segment_align_index_ and saw_relro_end_.
9819 (Script_sections::data_segment_align): New function.
9820 (Script_sections::data_segment_relro_end): New function.
9821 (Script_sections::place_orphan): Set or clear is_relro.
9822 (Script_sections::set_section_addresses): Force alignment of first
9823 TLS section.
9824 * yyscript.y (exp): Call script_data_segment_align and
9825 script_data_segment_relro_end.
9826 * testsuite/relro_script_test.t: New file.
9827 * testsuite/relro_test.cc (using_script): Declare.
9828 (t1, t2): Test using_script.
9829 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9830 (relro_script_test_SOURCES): Define.
9831 (relro_script_test_DEPENDENCIES): Define.
9832 (relro_script_test_LDFLAGS): Define.
9833 (relro_script_test_LDADD): Define.
9834 (relro_script_test.so): New target.
9835 * testsuite/Makefile.in: Rebuild.
9836
9837 2008-08-06 Cary Coutant <ccoutant@google.com>
9838
9839 * archive.cc (Archive::total_archives, Archive::total_members)
9840 (Archive::total_members_loaded): New variables.
9841 (Archive::setup): Add parameter. Add option to preread
9842 archive symbols.
9843 (Archive::read_armap): Add counter.
9844 (Archive::get_file_and_offset): New function.
9845 (Archive::get_elf_object_for_member): New function.
9846 (Archive::read_all_symbols): New function.
9847 (Archive::read_symbols): New function.
9848 (Archive::add_symbols): Add counters.
9849 (Archive::include_all_members): Use armap to find members if it's
9850 already built.
9851 (Archive::include_member): Skip reading symbols if already read.
9852 Factored code into Archive::get_file_and_offset and
9853 Archive::get_elf_object_for_member. Changed call to
9854 Mapfile::report_include_archive_member.
9855 (Archive::print_stats): New function.
9856 * archive.h: Declare Object and Read_symbols_data classes.
9857 (Archive::Archive): Add initializers for new members.
9858 (Archive::setup): Add parameter.
9859 (Archive::print_stats): New function.
9860 (Archive::total_archives, Archive::total_members)
9861 (Archive::total_members_loaded): New variables.
9862 (Archive::get_file_and_offset): New function.
9863 (Archive::get_elf_object_for_member): New function.
9864 (Archive::read_all_symbols): New function.
9865 (Archive::read_symbols): New function.
9866 (Archive::Archive_member): New class.
9867 (Archive::members_): New member.
9868 (Archive::num_members_): New member.
9869 * main.cc: Include archive.h.
9870 (main): Call Archive::print_stats.
9871 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9872 archive parameter; member_name is now the fully-decorated name.
9873 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9874 * options.h: (General_options): Add --preread-archive-symbols option.
9875 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9876 Archive::setup.
9877
9878 2008-08-04 Ian Lance Taylor <iant@google.com>
9879
9880 * symtab.h (Symbol::use_plt_offset): New function.
9881 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9882 * powerpc.cc (Relocate::relocate): Likewise.
9883 * sparc.cc (Relocate::relocate): Likewise.
9884 * x86_64.cc (Relocate::relocate): Likewise.
9885 * testsuite/weak_plt.sh: New test.
9886 * testsuite/weak_plt_main.cc: New test.
9887 * testsuite/weak_plt_shared.cc: New test.
9888 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9889 (check_PROGRAMS): Add weak_plt.
9890 (check_DATA): Add weak_plt_shared.so.
9891 (weak_plt_main_pic.o, weak_plt): New targets.
9892 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9893 * testsuite/Makefile.in: Rebuild.
9894
9895 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9896 gcctestdir/ld.
9897 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9898 * testsuite/Makefile.in: Rebuild.
9899
9900 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9901
9902 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9903 * Makefile.in: Regenerate.
9904 * po/POTFILES.in: Regenerate.
9905
9906 2008-07-29 Ian Lance Taylor <iant@google.com>
9907
9908 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9909 symbols before other symbols.
9910 * testsuite/script_test_2.cc (test_addr): Declare.
9911 (test_addr_alias): Declare.
9912 (main): Check that test_addr and test_addr_alias have the right
9913 values.
9914 * testsuite/script_test_2.t: Define test_addr_alias and
9915 test_addr.
9916
9917 2008-07-24 Ian Lance Taylor <iant@google.com>
9918
9919 PR 5990
9920 * descriptors.cc: New file.
9921 * descriptors.h: New file.
9922 * gold-threads.h (class Hold_optional_lock): New class.
9923 * fileread.cc: Include "descriptors.h".
9924 (File_read::~File_read): Release descriptor rather than closing
9925 it.
9926 (File_read::open) [file]: Call open_descriptor rather than open.
9927 Set is_descriptor_opened_.
9928 (File_read::open) [memory]: Assert that descriptor is not open.
9929 (File_read::reopen_descriptor): New function.
9930 (File_read::release): Release descriptor.
9931 (File_read::do_read): Make non-const. Reopen descriptor.
9932 (File_read::read): Make non-const.
9933 (File_read::make_view): Reopen descriptor.
9934 (File_read::do_readv): Likewise.
9935 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9936 Update declarations.
9937 * layout.cc: Include "descriptors.h".
9938 (Layout::create_build_id): Use open_descriptor rather than open.
9939 * output.cc: Include "descriptors.h".
9940 (Output_file::open): Use open_descriptor rather than open.
9941 * archive.cc (Archive::const_iterator): Change Archive to be
9942 non-const.
9943 (Archive::begin, Archive::end): Make non-const.
9944 (Archive::count_members): Likewise.
9945 * archive.h (class Archive): Update declarations.
9946 * object.h (Object::read): Make non-const.
9947 * Makefile.am (CCFILES): Add descriptors.cc.
9948 (HFILES): Add descriptors.h.
9949 * Makefile.in: Rebuild.
9950
9951 PR 6716
9952 * gold.h: Always include <clocale>. Add Solaris workarounds
9953 following code in binutils/sysdep.h.
9954
9955 PR 6048
9956 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9957 this->eh_frame_hdr_ is NULL before using it.
9958
9959 * dynobj.cc (Versions::Versions): Update comment.
9960
9961 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9962 the base version name.
9963
9964 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9965 array size plus one.
9966 (Stringpool_template::set_string_offsets): Subtract one from key
9967 before using it as an array index.
9968 (Stringpool_template::get_offset_with_length): Likewise.
9969 (Stringpool_template::write_to_buffer): Likewise.
9970 * stringpool.h (Stringpool_template::get_offset_from_key):
9971 Likewise.
9972
9973 2008-07-23 Ian Lance Taylor <iant@google.com>
9974
9975 PR 6658
9976 * object.h (Merged_symbol_value::value): Do our best to handle a
9977 negative addend.
9978
9979 PR 6647
9980 * script.cc (Version_script_info::get_versions): Don't add empty
9981 version tag to return value.
9982 (Version_script_info::get_symbol_version_helper): Change return
9983 type to bool. Add pversion parameter. Change all callers.
9984 (script_register_vers_node): Don't require a non-NULL tag.
9985 * script.h (class Version_script_info): Update declarations.
9986 (Version_script_info::get_symbol_version): Change return type to
9987 bool. Add version parameter. Change all callers.
9988 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9989 handling. Handle an empty version from a version script.
9990 (Symbol_table::define_special_symbol): Likewise.
9991 * testsuite/ver_test_10.script: New file.
9992 * testsuite/ver_test_10.sh: New file.
9993 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9994 (check_DATA): Add ver_test_10.syms.
9995 (ver_test_10.syms, ver_test_10.so): New target.
9996 * testsuite/Makefile.in: Rebuild.
9997
9998 2008-07-23 Simon Baldwin <simonb@google.com>
9999
10000 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
10001 to zero for undefined symbols from dynamic libraries.
10002
10003 2008-07-23 Ian Lance Taylor <iant@google.com>
10004
10005 * symtab.cc (Symbol_table::resolve): Remove version parameter.
10006 Change all callers.
10007 * symtab.h (class Symbol_table): Update declaration.
10008 * testsuite/ver_test_9.cc: New file.
10009 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
10010 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
10011 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
10012 (ver_test_9.so, ver_test_9.o): New targets.
10013 * testsuite/Makefile.in: Rebuild.
10014
10015 2008-07-22 Ian Lance Taylor <iant@google.com>
10016
10017 * options.h (class General_options): Define --check-sections.
10018 * layout.cc (Layout::set_segment_offsets): Handle
10019 --check-sections.
10020
10021 * options.h (class General_options): Define -n/--nmagic and
10022 -N/--omagic.
10023 * options.cc (General_options::finalize): For -n/--nmagic or
10024 -N/--omagic, set -static.
10025 * layout.cc (Layout::attach_allocated_section_to_segment): If
10026 -N/--omagic, don't put read-only and read-write sections in
10027 different segments.
10028 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
10029 finding a read-only segment.
10030 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
10031 don't set the minimum segment alignment to the common page size,
10032 and don't set the file offset to the address modulo the page size.
10033 * script-sections.cc (Script_sections::create_segments): If
10034 -n/--omagic, don't put read-only and read-write sections in
10035 different segments.
10036
10037 * cref.cc: New file.
10038 * cref.h: New file.
10039 * options.h (class General_options): Add --print-symbol-counts.
10040 * main.cc (main): Issue defined symbol report if requested.
10041 * archive.cc (Archive::interpret_header): Make into a const member
10042 function.
10043 (Archive::add_symbols): Call Input_objects::archive_start and
10044 archive_stop.
10045 (Archive::const_iterator): Define new class.
10046 (Archive::begin, Archive::end): New functions.
10047 (Archive::include_all_members): Rewrite to use iterator.
10048 (Archive::count_members): New function.
10049 * archive.h (class Archive): Update declarations.
10050 (Archive::filename): New function.
10051 * object.cc: Include "cref.h".
10052 (Sized_relobj::Sized_relobj): Initialize defined_count_.
10053 (Sized_relobj::do_get_global_symbol_counts): New function.
10054 (Input_objects::add_object): Add object to cross-referencer.
10055 (Input_objects::archive_start): New function.
10056 (Input_objects::archive_stop): New function.
10057 (Input_objects::print_symbol_counts): New function.
10058 * object.h: Declare Cref and Archive.
10059 (Object::get_global_symbol_counts): New function.
10060 (Object::do_get_global_symbol_counts): New pure virtual function.
10061 (class Sized_relobj): Add defined_count_ field. Update
10062 declarations.
10063 (class Input_objects): Add cref_ field. Update constructor.
10064 Update declarations.
10065 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
10066 defined_count_.
10067 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
10068 symbol counts.
10069 (Sized_dynobj::do_get_global_symbol_counts): New function.
10070 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
10071 defined_count_. Update declarations. Define Symbols typedef.
10072 * symtab.cc (Symbol_table::add_from_relobj): Add defined
10073 parameter. Change all callers.
10074 (Symbol_table::add_from_dynobj): Add sympointers and defined
10075 parameters. Change all callers.
10076 * symtab.h (class Symbol_table): Update declarations.
10077 * Makefile.am (CCFILES): Add cref.cc.
10078 (HFILES): Add cref.h.
10079 * Makefile.in: Rebuild.
10080
10081 2008-07-22 Simon Baldwin <simonb@google.com>
10082
10083 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
10084 to zero when writing undefined symbols.
10085
10086 2008-07-22 Ian Lance Taylor <iant@google.com>
10087
10088 * output.cc (Output_section::add_input_section): Don't try to
10089 merge empty merge sections.
10090
10091 2008-07-21 Craig Silverstein <csilvers@google.com>
10092
10093 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10094 Include symbol version in error message.
10095
10096 2008-07-20 Chris Demetriou <cgd@google.com>
10097
10098 * configure.ac (gold_cv_c_random_seed): New configured variable.
10099 (RANDOM_SEED_CFLAGS): New substituted variable.
10100 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
10101 * configure: Rebuild.
10102 * Makefile.in: Likewise.
10103 * testsuite/Makefile.in: Likewise.
10104
10105 2008-07-18 Ian Lance Taylor <iant@google.com>
10106
10107 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
10108 where we see NAME/NULL and NAME/VERSION as separate symbols.
10109 * testsuite/ver_test_main.cc (main): Call t4.
10110 (t4, t4_2a): Define.
10111 * testsuite/ver_test_2.cc (t4_2): Define.
10112 * testsuite/ver_test_2.script: Put t4_2a in VER2.
10113 * testsuite/ver_test_4.cc (t4_2a): Define.
10114 * testsuite/ver_test_4.script: Put t4_2a in VER2.
10115 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
10116
10117 2008-07-17 Ian Lance Taylor <iant@google.com>
10118
10119 * dynobj.cc (Versions::add_def): If we give an error about a
10120 missing version, go ahead and create the version anyhow.
10121
10122 2008-07-10 Ian Lance Taylor <iant@google.com>
10123
10124 Handle output sections with more than 0x7fffffff bytes.
10125 * object.h (class Relobj): Change map_to_output_ to
10126 output_sections_, and just keep a section pointer. Change all
10127 uses. Move comdat group support to Sized_relobj.
10128 (Relobj::is_section_specially_mapped): Remove.
10129 (Relobj::output_section): Remove poff parameter. Change all
10130 callers.
10131 (Relobj::output_section_offset): New function.
10132 (Relobj::set_section_offset): Rewrite.
10133 (Relobj::map_to_output): Remove.
10134 (Relobj::output_sections): New function.
10135 (Relobj::do_output_section_offset): New pure virtual function.
10136 (Relobj::do_set_section_offset): Likewise.
10137 (class Sized_relobj): Add section_offsets_ field. Add comdat
10138 group support from Relobj. Update declarations.
10139 (Sized_relobj::get_output_section_offset): New function.
10140 (Sized_relobj::do_output_section_offset): New function.
10141 (Sized_relobj::do_set_section_offset): New function.
10142 * object.cc (Relobj::output_section_address): Remove.
10143 (Sized_relobj::Sized_relobj): Initialize new fields.
10144 (Sized_relobj::include_section_group): Cast find_kept_object to
10145 Sized_relobj.
10146 (Sized_relobj::include_linkonce_section): Likewise.
10147 (Sized_relobj::do_layout): Use separate arrays for output section
10148 and output offset.
10149 (Sized_relobj::do_count_local_symbols): Change map_to_output to
10150 output_sections.
10151 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
10152 output_sections and section_offsets.
10153 (Sized_relobj::write_local_symbols): Likewise.
10154 (map_to_kept_section): Compute output address directly.
10155 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
10156 output_sections and section_offsets.
10157 (Sized_relobj::write_sections): Likewise.
10158 (Sized_relobj::relocate_sections): Likewise.
10159 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
10160 * output.h (class Output_reloc): Update declarations. Change
10161 u2_.relobj to Sized_relobj*.
10162 (class Output_data_reloc): Change add functions to use
10163 Sized_relobj*.
10164 * output.cc (Output_reloc::Output_reloc): Change relobj to
10165 Sized_relobj*.
10166 (Output_reloc::local_section_offset): Change return type to
10167 Elf_Addr. Use get_output_section_offset.
10168 (Output_reloc::get_address): Likewise.
10169 (Output_section::is_input_address_mapped): Don't call
10170 is_section_specially_mapped.
10171 (Output_section::output_offset): Likewise.
10172 (Output_section::output_address): Likewise.
10173 (Output_section::starting_output_address): Likewise.
10174 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
10175 parameter to Sized_relobj*.
10176 (Copy_relocs::need_copy_reloc): Likewise.
10177 (Copy_relocs::save): Likewise.
10178 * copy-relocs.h (class Copy_relocs): Update declarations.
10179 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
10180 Sized_relobj*. Change relobj_ field to Sized_relobj*.
10181 * target-reloc.h (relocate_for_relocatable): Change
10182 offset_in_output_section type to Elf_Addr. Change code that uses
10183 it as well.
10184 * layout.cc (Layout::layout): Always set *off.
10185 * mapfile.cc (Mapfile::print_input_section): Use
10186 output_section_offset.
10187 * i386.cc (Target_i386::copy_reloc): Change object parameter to
10188 Sized_relobj*.
10189 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10190 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10191 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10192
10193 2008-07-03 Ian Lance Taylor <iant@google.com>
10194
10195 * layout.cc (Layout::include_section): Do not discard unrecognized
10196 SHT_STRTAB sections.
10197
10198 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10199
10200 * script.cc (Lex::can_continue_name): Make '?' allowable in
10201 version-script names.
10202 * testsuite/version_script.map: Change glob pattern to use '?'
10203
10204 2008-06-30 Manish Singh <yosh@gimp.org>
10205
10206 PR 6585
10207 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10208 Correct typo.
10209
10210 2008-06-30 Ian Lance Taylor <iant@google.com>
10211
10212 PR 6660
10213 PR 6682
10214 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10215 versions]: Don't try to read the value in the contents, since we
10216 don't use it. Use the template endianness when writing.
10217
10218 2008-06-25 Cary Coutant <ccoutant@google.com>
10219
10220 * fileread.cc (File_read::make_view): Assert on zero-length view.
10221 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10222 symbol table when there are no symbols to read.
10223
10224 2008-06-23 Craig Silverstein <csilvers@google.com>
10225
10226 * version.cc (version_string): Bump to 1.7
10227
10228 2008-06-18 Craig Silverstein <csilvers@google.com>
10229
10230 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10231 constant 0xFFFF to type Valtype.
10232 (Powerpc_relocate_functions::rel16_ha): Likewise.
10233
10234 2008-06-17 Ian Lance Taylor <iant@google.com>
10235
10236 * output.h (Output_section::Input_section): Initialize p2align_ to
10237 zero for Output_section_data constructors.
10238 (Output_section::Input_section::addralign): If not an input
10239 section, return the alignment of the Output_section_data.
10240 * testsuite/copy_test.cc: New file.
10241 * testsuite/copy_test_1.cc: New file.
10242 * testsuite/copy_test_2.cc: New file.
10243 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10244 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10245 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10246 (copy_test_1_pic.o, copy_test_1.so): New targets.
10247 (copy_test_2_pic.o, copy_test_2.so): New targets.
10248 * testsuite/Makefile.in: Rebuild.
10249
10250 * script-sections.cc (Script_sections::place_orphan): Initialize
10251 local variable exact.
10252
10253 2008-06-13 David Edelsohn <edelsohn@gnu.org>
10254
10255 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10256
10257 2008-06-12 David Edelsohn <edelsohn@gnu.org>
10258 David S. Miller <davem@davemloft.net>
10259
10260 * powerpc.cc: New file.
10261 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10262 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10263 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10264 * Makefile.in: Rebuild.
10265
10266 2008-06-09 Ian Lance Taylor <iant@google.com>
10267
10268 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10269 <exception>.
10270 (throwing, orig_terminate): New static variables.
10271 (terminate_handler): New static function.
10272 (t2): Set terminate handler.
10273
10274 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10275
10276 PR 6584
10277 * binary.cc (Binary_to_elf::sized_convert): Fix .data
10278 alignment.
10279
10280 2008-05-30 Cary Coutant <ccoutant@google.com>
10281
10282 * archive.cc (Archive::include_all_members) Correct to step
10283 over symbol table and extended name table in thin archives.
10284
10285 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10286
10287 PR 6407
10288 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10289 calculation.
10290
10291 2008-05-28 Caleb Howe <cshowe@google.com>
10292
10293 * reduced_debug_output.cc: New file.
10294 * reduced_debug_output.h: New file.
10295 * options.h (class General_options): Add --strip-debug-non-line.
10296 * options.cc (General_options::finalize): Add strip_debug_non_line
10297 to the strip heirarchy.
10298 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10299 fields.
10300 * layout.cc: Include "reduced_debug_output.h".
10301 (Layout::Layout): Initialize new fields.
10302 (line_only_debug_sections): New static array.
10303 (is_lines_only_debug_sections): New static inline function.
10304 (Layout::include_section): Handle --strip-debug-non-line.
10305 (Layout::make_output_section): If --strip-debug-non-line, build
10306 new output sections for .debug_abbrev and .debug_info.
10307 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10308 gold. Warn about possible overflow.
10309 (read_signed_LEB_128): Likewise.
10310 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10311 (read_signed_LEB_128): Declare.
10312 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10313 (HFILES): Add reduced_debug_output.h.
10314 * Makefile.in: Rebuild.
10315
10316 2008-05-21 Ian Lance Taylor <iant@google.com>
10317
10318 * mapfile.cc: New file.
10319 * mapfile.h: New file.
10320 * options.h (class General_options): Add -M/--print-map and -Map.
10321 * options.cc (General_options::finalize): Make -M equivalent to
10322 -Map -.
10323 * main.cc: Include <cstdio> and "mapfile.h".
10324 (main): Open mapfile if requested.
10325 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10326 constructor. Change caller.
10327 (queue_initial_tasks): Add mapfile parameter. Change caller.
10328 (queue_middle_tasks): Likewise.
10329 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10330 declarations.
10331 * archive.cc: Include "mapfile.h".
10332 (Archive::add_symbols): Add mapfile parameter. Change all
10333 callers. Pass mapfile, symbol, and reason to include_member.
10334 (Archive::include_all_members): Add mapfile parameter. Change all
10335 callers.
10336 (Archive::include_member): Add mapfile, sym, and why parameters.
10337 Change all callers. Report inclusion to map file.
10338 * archive.h: Include "fileread.h".
10339 (class Archive): Update declarations.
10340 (Archive::file): New const method.
10341 (class Add_archive_symbols): Add mapfile_ field. Update
10342 constructor. Change all callers.
10343 * readsyms.h (class Read_symbols): Likewise.
10344 (class Finish_group): Likewise.
10345 (class Read_script): Likewise.
10346 * common.cc: Include "mapfile.h".
10347 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10348 all callers.
10349 (Symbol_table::do_allocate_commons): Likewise.
10350 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10351 symbol allocation to mapfile.
10352 * common.h (class Allocate_commons_task): Add mapfile_ field.
10353 Update constructor. Change all callers.
10354 * symtab.h (class Symbol_table): Update declarations.
10355 * layout.cc: Include "mapfile.h".
10356 (Layout_task_runner::run): Print information to mapfile.
10357 (Layout::create_gold_note): Change Output_data_fixed_space to
10358 Output_data_zero_fill.
10359 (Layout::create_build_id): Likewise.
10360 (Layout::print_to_mapfile): New function.
10361 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10362 constructor. Change caller.
10363 (class Layout): Declare print_to_mapfile.
10364 * output.cc (Output_section::Input_section::print_to_mapfile): New
10365 function.
10366 (Output_section::add_input_section): If producing a map, always
10367 add to input_sections_ list.
10368 (Output_section::do_print_to_mapfile): New function.
10369 (Output_segment::print_sections_to_mapfile): New function.
10370 (Output_segment::print_section_list_to_mapfile): New function.
10371 * output.h: Include "mapfile.h".
10372 (Output_data::print_to_mapfile): New function.
10373 (Output_data::do_print_to_mapfile): New virtual function.
10374 (Output_segment_headers::do_print_to_mapfile): New function.
10375 (Output_file_header::do_print_to_mapfile): New function.
10376 (Output_data_const::do_print_to_mapfile): New function.
10377 (class Output_data_const_buffer): Add map_name_ field. Update
10378 constructor. Change all callers. Add do_print_to_mapfile
10379 function.
10380 (class Output_data_fixed_space): Likewise.
10381 (class Output_data_space): Likewise.
10382 (class Output_data_zero_fill): New class.
10383 (Output_data_strtab::do_print_to_mapfile): New function.
10384 (Output_data_reloc_base::do_print_to_mapfile): New function.
10385 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10386 (Output_data_group::do_print_to_mapfile): New function.
10387 (Output_data_got::do_print_to_mapfile): New function.
10388 (Output_data_dynamic::do_print_to_mapfile): New function.
10389 (Output_symtab_xindex::do_print_to_mapfile): New function.
10390 (class Output_section): Declare do_print_to_mapflie. Declare
10391 print_to_mapfile in Input_section.
10392 (class Output_segment): Declare new functions.
10393 * object.h (Sized_relobj::symbol_count): New function.
10394 * script-sections.cc
10395 (Output_section_element_dot_assignment::set_section_addresses):
10396 Change Output_data_fixed_space to Output_data_zero_fill.
10397 (Output_data_expression::do_print_to_mapfile): New function.
10398 * script.cc (read_input_script): Add mapfile parameter. Change
10399 all callers.
10400 * script.h (read_input_script): Update declaration.
10401 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10402 (Eh_frame::do_print_to_mapfile): New function.
10403 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10404 (Output_merge_string::do_print_to_mapfile): New function.
10405 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10406 function.
10407 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10408 function.
10409 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10410 function.
10411 * Makefile.am (CCFILES): Add mapfile.cc.
10412 (HFILES): Add mapfile.h.
10413 * Makefile.in: Rebuild.
10414
10415 2008-05-19 Ian Lance Taylor <iant@google.com>
10416
10417 * options.h (class General_options): Add -z relro.
10418 * layout.cc (Layout::Layout): Initialize relro_segment_.
10419 (Layout::add_output_section_data): Return the output section.
10420 (Layout::make_output_section): Rcognize relro sections and mark
10421 them appropriately.
10422 (Layout::attach_allocated_section_to_segment): Put relro sections
10423 in a PT_GNU_RELRO segment.
10424 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10425 section as relro.
10426 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10427 PT_TLS segments.
10428 (Layout::linkonce_mapping): Map d.rel.ro.local to
10429 .data.rel.ro.local.
10430 (Layout::output_section_name): Us .data.rel.ro.local for any
10431 section which begins with that.
10432 * layout.h (class Layout): Update add_output_section_data
10433 declaration. Add relro_segment_ field.
10434 * output.cc (Output_section::Output_section): Initialize is_relro_
10435 and is_relro_local_ fields.
10436 (Output_segment::add_output_section): Group relro sections.
10437 (Output_segment::is_first_section_relro): New function.
10438 (Output_segment::maximum_alignment): If there is a relro section,
10439 align the segment to the common page size.
10440 (Output_segment::set_section_addresses): Track whether we are
10441 looking at relro sections. If the last section is a relro
10442 section, align to the common page size.
10443 (Output_segment::set_section_list_addresses): Add in_relro
10444 parameter. Change all callers. Align to the page size when
10445 moving from relro to non-relro section.
10446 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10447 segment.
10448 * output.h (class Output_section): Add is_relro_ and
10449 is_relro_local_ fields.
10450 (Output_section::is_relro): New function.
10451 (Output_section::set_is_relro): New function.
10452 (Output_section::is_relro_local): New function.
10453 (Output_section::set_is_relro_local): New function.
10454 (class Output_segment): Update declarations.
10455 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10456 * sparc.cc (Target_sparc::got_section): Likewise.
10457 * x86_64.cc (Target_x86_64::got_section): Likewise.
10458 * testsuite/relro_test_main.cc: New file.
10459 * testsuite/relro_test.cc: New file.
10460 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10461 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10462 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10463 (relro_test.so, relro_test_pic.o): New targets.
10464 * testsuite/Makefile.in: Rebuild.
10465
10466 2008-05-16 Ian Lance Taylor <iant@google.com>
10467
10468 * output.cc (Output_segment::add_output_section): Remove front
10469 parameter.
10470 * output.h (class Output_segment): Remove
10471 add_initial_output_section and overloaded add_output_section.
10472 Update declaration of remaining add_output_section.
10473 * layout.cc (Layout::create_interp): Call add_output_section
10474 rather than add_initial_output_section.
10475 (Layout::finish_dynamic_section): Likewise.
10476
10477 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10478 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10479 know the dynamic type.
10480 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10481 field. Initialize it in constructor.
10482 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10483 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10484 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10485 reloc.
10486
10487 * output.cc (Output_reloc::get_address): Change return type to
10488 Elf_Addr.
10489 * output.h (class Output_reloc): Update get_address declaration.
10490 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10491 for section addresses.
10492
10493 2008-05-09 Ian Lance Taylor <iant@google.com>
10494
10495 PR 6493
10496 * gold.cc (gold_nomem): Use return value of write.
10497
10498 2008-05-08 Ian Lance Taylor <iant@google.com>
10499
10500 * symtab.c (Symbol::init_base_output_data): Add version
10501 parameter. Change all callers.
10502 (Symbol::init_base_output_segment): Likewise.
10503 (Symbol::init_base_constant): Likewise.
10504 (Symbol::init_base_undefined): Likewise.
10505 (Sized_symbol::init_output_data): Likewise.
10506 (Sized_symbol::init_output_segment): Likewise.
10507 (Sized_symbol::init_constant): Likewise.
10508 (Sized_symbol::init_undefined): Likewise.
10509 (Symbol_table::do_define_in_output_data): If the new symbol has a
10510 version, mark it as the default.
10511 (Symbol_table::do_define_in_output_segment): Likewise.
10512 (Symbol_table::do_define_as_constant): Likewise.
10513 * symtab.h (class Symbol): Update declarations.
10514 (class Sized_symbol): Likewise.
10515 * resolve.cc (Symbol::override_version): New function.
10516 (Symbol::override_base): Call override_version.
10517 (Symbol::override_base_with_special): Likewise.
10518 * testsuite/ver_script_8.script: New file.
10519 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10520 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10521 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10522 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10523
10524 2008-05-06 Ian Lance Taylor <iant@google.com>
10525
10526 PR 6049
10527 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10528 functions.
10529 (class General_options): Remove existing --undefined, and add
10530 --no-undefined instead. Add new --undefined as synonym for -u.
10531 * archive.cc (Archive::add_symbols): Check whether symbol was
10532 named with -u.
10533 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10534 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10535 all uses. Add IS_UNDEFINED. Update declarations to split
10536 different versions of init_base. Declare init_base_undefined.
10537 (Symbol::is_defined): Handle IS_UNDEFINED.
10538 (Symbol::is_undefined): Likewise.
10539 (Symbol::is_weak_undefined): Call is_undefined.
10540 (Symbol::is_absolute): Handle IS_CONSTANT.
10541 (class Sized_symbol): Update declarations to split different
10542 versions of init. Declare init_undefined.
10543 (class Symbol_table): Declare new functions.
10544 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10545 Change all callers.
10546 (Symbol::init_base_output_data): Likewise.
10547 (Symbol::init_base_output_segment): Likewise.
10548 (Symbol::init_base_constant): Likewise.
10549 (Symbol::init_base_undefined): New function.
10550 (Sized_symbol::init_object): Rename from init. Change all
10551 callers.
10552 (Sized_symbol::init_output_data): Likewise.
10553 (Sized_symbol::init_output_segment): Likewise.
10554 (Sized_symbol::init_constant): Likewise.
10555 (Sized_symbol::init_undefined): New function.
10556 (Symbol_table::add_undefined_symbols_from_command_line): New
10557 function.
10558 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10559 function.
10560 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10561 (Symbol::output_section): Likewise.
10562 (Symbol::set_output_section): Likewise.
10563 (Symbol_table::sized_finalize_symbol): Likewise.
10564 (Symbol_table::sized_write_globals): Likewise.
10565 * resolve.cc (Symbol_table::should_override): Likewise.
10566 (Symbol::override_base_with_special): Likewise.
10567
10568 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10569 symbol, change it to have default visibility.
10570 * testsuite/protected_1.cc: New file.
10571 * testsuite/protected_2.cc: New file.
10572 * testsuite/protected_3.cc: New file.
10573 * testsuite/protected_main_1.cc: New file.
10574 * testsuite/protected_main_2.cc: New file.
10575 * testsuite/protected_main_3.cc: New file.
10576 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10577 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10578 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10579 (protected_1.so): New target.
10580 (protected_1_pic.o, protected_2_pic.o): New targets.
10581 (protected_3_pic.o): New target.
10582 (check_PROGRAMS): Add protected_2.
10583 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10584 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10585 * testsuite/Makefile.in: Rebuild.
10586
10587 * options.h (DEFINE_var): Add set_user_set_##varname__.
10588 (DEFINE_bool_alias): New macro.
10589 (class General_options): Define -Bstatic using DEFINE_bool_alias
10590 rather than DEFINE_special. Add --undefined as an alias for -z
10591 defs.
10592 * options.cc (General_options::parse_Bstatic): Remove.
10593
10594 * options.h (class General_options): Add --fatal-warnings.
10595 * main.cc (main): Implement --fatal-warnings.
10596 * errors.h (Errors::warning_count): New function.
10597
10598 * options.h (class General_options): Add -Bsymbolic-functions.
10599 * symtab.h (Symbol::is_preemptible): Check for
10600 -Bsymbolic-functions.
10601
10602 2008-05-05 Ian Lance Taylor <iant@google.com>
10603
10604 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10605 as noVARNAME rather than no-VARNAME.
10606 (class General_options): Add option -z combreloc.
10607 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10608 get_address.
10609 (Output_reloc::sort_before) [SHT_REL]: New function.
10610 (Output_reloc::sort_before) [SHT_RELA]: New function.
10611 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10612 Sort_relocs_comparison.
10613 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10614 parameter. Change all callers.
10615 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10616 sort_relocs parameter. Change all callers.
10617 * output.cc (Output_reloc::get_address): New function, broken out
10618 of write_rel.
10619 (Output_reloc::write_rel): Call it.
10620 (Output_reloc::compare): New function.
10621 (Output_data_reloc_base::do_write): Optionally sort relocs.
10622
10623 * configure.ac: If targ_extra_obj is set, link it in.
10624 * configure.tgt: Initialize all variables.
10625 (x86_64*): Set targ_extra_obj and targ_extra_size.
10626 * configure: Rebuild.
10627
10628 * object.cc (Sized_relobj::include_section_group): Adjust section
10629 indexes read from group data. Build vector to pass to
10630 layout_group.
10631 * layout.cc (Layout::layout_group): Add flags and shndxes
10632 parameters. Remove contents parameter. Change caller. Update
10633 explicit instantiations.
10634 * layout.h (class Layout): Update layout_group declaration.
10635 * output.cc (Output_data_group::Output_data_group): Add flags and
10636 input_shndxes parameters. Remove contents parameter. Change
10637 caller.
10638 (Output_data_group::do_write): Change input_sections_ to
10639 input_shndxes_.
10640 * output.h (class Output_data_group): Update constructor
10641 declaration. Rename input_sections_ to input_shndxes_.
10642 * testsuite/many_sections_test.cc: Add template.
10643
10644 2008-04-30 Cary Coutant <ccoutant@google.com>
10645
10646 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10647
10648 * layout.cc (Layout::include_section): Refactored check for debug
10649 info section.
10650 (Layout::add_comdat): Add new parameters. Change type
10651 of signature parameter. Add object and shndx to signatures table.
10652 (Layout::find_kept_object): New function.
10653 * layout.h: Include <cstring>.
10654 (Layout::is_debug_info_section): New function.
10655 (Layout::add_comdat): Add new parameters.
10656 (Layout::find_kept_object): New function.
10657 (Layout::Kept_section): New struct.
10658 (Layout::Signatures): Change type of map range.
10659 * object.cc (Relobj::output_section_address): New function.
10660 (Sized_relobj::include_section_group): Add new parameters. Change
10661 calls to Layout::add_comdat. Change to build table of kept comdat
10662 groups and table mapping discarded sections to kept sections.
10663 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10664 (Sized_relobj::do_layout): Change calls to include_section_group and
10665 include_linkonce_section.
10666 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10667 value to zero when section is discarded.
10668 (Sized_relobj::map_to_kept_section): New function.
10669 * object.h (Relobj::output_section_address): New function.
10670 (Relobj::Comdat_group): New type.
10671 (Relobj::find_comdat_group): New function.
10672 (Relobj::Comdat_group_table): New type.
10673 (Relobj::Kept_comdat_section): New type.
10674 (Relobj::Kept_comdat_section_table): New type.
10675 (Relobj::add_comdat_group): New function.
10676 (Relobj::set_kept_comdat_section): New function.
10677 (Relobj::get_kept_comdat_section): New function.
10678 (Relobj::comdat_groups_): New field.
10679 (Relobj::kept_comdat_sections_): New field.
10680 (Symbol_value::input_value): Update comment.
10681 (Sized_relobj::map_to_kept_section) New function.
10682 (Sized_relobj::include_linkonce_section): Add new parameter.
10683 * target-reloc.h (Comdat_behavior): New type.
10684 (get_comdat_behavior): New function.
10685 (relocate_section): Add code to map a discarded section to the
10686 corresponding kept section when applying a relocation.
10687
10688 2008-04-30 Craig Silverstein <csilvers@google.com>
10689
10690 * dwarf_reader.cc (next_generation_count): New static var.
10691 (Addr2line_cache_entry): New struct.
10692 (addr2line_cache): New static var.
10693 (Dwarf_line_info::one_addr2line): Added caching.
10694 (Dwarf_line_info::clear_addr2line_cache): New function.
10695 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10696 cache-size parameter.
10697 (Dwarf_line_info::one_addr2line_cache): New function.
10698 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10699 new cache-size argument to one_addr2line(), and clear cache.
10700
10701 2008-04-28 Cary Coutant <ccoutant@google.com>
10702
10703 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10704 R_386_PC8 relocations.
10705
10706 2008-04-23 Ian Lance Taylor <iant@google.com>
10707
10708 * object.cc (Sized_relobj::include_section_group): Check for
10709 invalid section group.
10710
10711 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10712 header size.
10713
10714 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10715 than read for file header.
10716 * archive.cc (Archive::include_member): Likewise.
10717
10718 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10719
10720 * aclocal.m4: Regenerate.
10721 * configure: Regenerate.
10722
10723 2008-04-19 Ian Lance Taylor <iant@google.com>
10724
10725 * version.cc (version_string): Bump to 1.6.
10726
10727 * testsuite/Makefile.am (many_sections_r_test): New target.
10728 (many_sections_r_test_SOURCES): Remove.
10729 (many_sections_r_test_DEPENDENCIES): Remove.
10730 (many_sections_r_test_LDFLAGS): Remove.
10731 (many_sections_r_test_LDADD): Remove.
10732
10733 * object.cc (Sized_relobj::do_add_symbols): Always pass
10734 local_symbol_count_ to add_from_relobj.
10735
10736 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10737 every thousand variables.
10738 * testsuite/Makefile.in: Rebuild.
10739
10740 * object.cc (Xindex::initialize_symtab_xindex): New function.
10741 (Xindex::read_symtab_xindex): New function.
10742 (Xindex::sym_xindex_to_shndx): New function.
10743 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10744 available.
10745 (Sized_relobj::do_initialize_xindex): New function.
10746 (Sized_relobj::do_read_symbols): Adjust section links.
10747 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10748 parameter. Change all callers.
10749 (Sized_relobj::include_section_group): Adjust section links and
10750 symbol section indexes.
10751 (Sized_relobj::do_layout): Adjust section links.
10752 (Sized_relobj::do_count_local_symbols): Adjust section links and
10753 symbol section indexes.
10754 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10755 ordinary and special symbols.
10756 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10757 dynsym_xindex parameters. Change all callers. Adjust section
10758 links. Use SHN_XINDEX when needed.
10759 (Sized_relobj::get_symbol_location_info): Adjust section links.
10760 Don't get fooled by special symbols.
10761 * object.h (class Xindex): Define.
10762 (class Object): Add xindex_ parameter. Declare virtual functoin
10763 do_initialize_xindex.
10764 (Object::adjust_sym_shndx): New function.
10765 (Object::set_xindex): New protected function.
10766 (class Symbol_value): Add is_ordinary_shndx_ field.
10767 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10768 (Symbol_value::value): Assert ordinary section.
10769 (Symbol_value::initialize_input_to_output_map): Likewise.
10770 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10771 Change all callers.
10772 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10773 all callers.
10774 (class Sized_relobj): Update declarations.
10775 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10776 parameter. Change all callers.
10777 (Sized_relobj::adjust_shndx): New function.
10778 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10779 field.
10780 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10781 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10782 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10783 (Sized_dynobj::read_dynsym_section): Adjust section links.
10784 (Sized_dynobj::read_dynamic): Likewise.
10785 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10786 section links.
10787 (Sized_dynobj::do_initialize_xindex): New function.
10788 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10789 do_initialize_xindex.
10790 (Sized_dynobj::adjust_shndx): New function.
10791 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10792 dynsym_xindex_ fields.
10793 (Layout::finalize): Add a call to set_section_indexes before
10794 creating the symtab sections.
10795 (Layout::set_section_indexes): Don't do anything if the section
10796 already has a section index.
10797 (Layout::create_symtab_sections): Add shnum parameter. Change
10798 caller. Create .symtab_shndx section if needed.
10799 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10800 caller.
10801 (Layout::allocated_output_section_count): New function.
10802 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10803 needed.
10804 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10805 fields. Update declarations.
10806 (Layout::symtab_xindex): New function.
10807 (Layout::dynsym_xindex): New function.
10808 (class Write_symbols_task): Add layout_ field.
10809 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10810 Change caller.
10811 * output.cc (Output_section_headers::Output_section_headers): Add
10812 shstrtab_section parameter. Change all callers.
10813 (Output_section_headers::do_sized_write): Store overflow values
10814 for section count and section string table section index in
10815 section header zero.
10816 (Output_file_header::do_sized_write): Check for overflow of
10817 section count and section string table section index.
10818 (Output_symtab_xindex::do_write): New function.
10819 (Output_symtab_xindex::endian_do_write): New function.
10820 * output.h (class Output_section_headers): Add shstrtab_section_.
10821 Update declarations.
10822 (class Output_symtab_xindex): Define.
10823 (Output_section::has_out_shndx): New function.
10824 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10825 field.
10826 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10827 Change all callers.
10828 (Sized_symbol::init): Likewise.
10829 (Symbol::output_section): Check for ordinary symbol.
10830 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10831 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10832 callers.
10833 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10834 Change all callers. Simplify handling of symbols from sections
10835 not included in the link.
10836 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10837 distinction.
10838 (Weak_alias_sorter::operator()): Assert that symbols are
10839 ordinary.
10840 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10841 distinction.
10842 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10843 parameters. Change all callers.
10844 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10845 symbol distinction. Use SHN_XINDEX when needed.
10846 (Symbol_table::write_section_symbol): Add symtab_xindex
10847 parameter. Change all callers.
10848 (Symbol_table::sized_write_section_symbol): Likewise. Use
10849 SHN_XINDEX when needed.
10850 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10851 declarations.
10852 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10853 (Symbol::is_defined): Check is_ordinary.
10854 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10855 (Symbol::is_absolute, Symbol::is_common): Likewise.
10856 (class Sized_symbol): Update declarations.
10857 (class Symbol_table): Update declarations.
10858 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10859 parameters. Change all callers.
10860 (Sized_symbol::override): Likewise.
10861 (Symbol_table::override): Likewise.
10862 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10863 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10864 is_ordinary, and orig_st_shndx parameters. Change all callers.
10865 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10866 to be in an ordinary section.
10867 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10868 object and is_ordinary parameters. Change all callers.
10869 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10870 Change all callers. Don't add undefined or non-ordinary symbols
10871 to reloc_map_.
10872 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10873 Change all callers.
10874 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10875 declarations.
10876 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10877 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10878 (Sized_relobj::relocate_sections): Likewise.
10879 * target-reloc.h (scan_relocs): Adjust section symbol index.
10880 (scan_relocatable_relocs): Likewise.
10881 * i386.cc (Scan::local): Check for ordinary symbols.
10882 * sparc.cc (Scan::local): Likewise.
10883 * x86_64.cc (Scan::local): Likewise.
10884 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10885 to symbol_section_and_value.
10886 * testsuite/many_sections_test.cc: New file.
10887 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10888 (check_PROGRAMS): Add many_sections_test.
10889 (many_sections_test_SOURCES): Define.
10890 (many_sections_test_DEPENDENCIES): Define.
10891 (many_sections_test_LDFLAGS): Define.
10892 (BUILT_SOURCES): Add many_sections_define.h.
10893 (many_sections_define.h): New target.
10894 (BUILT_SOURCES): Add many_sections_check.h.
10895 (many_sections_check.h): New target.
10896 (check_PROGRAMS): Add many_sections_r_test.
10897 (many_sections_r_test_SOURCES): Define.
10898 (many_sections_r_test_DEPENDENCIES): Define.
10899 (many_sections_r_test_LDFLAGS): Define.
10900 (many_sections_r_test_LDADD): Define.
10901 (many_sections_r_test.o): New target.
10902 * testsuite/Makefile.in: Rebuild.
10903
10904 2008-04-17 Cary Coutant <ccoutant@google.com>
10905
10906 * errors.cc (Errors::info): New function.
10907 (gold_info): New function.
10908 * errors.h (Errors::info): New function.
10909 * gold.h (gold_info): New function.
10910 * object.cc (Input_objects::add_object): Print trace output.
10911 * options.cc (options::parse_set): New function.
10912 (General_options::parse_wrap): Deleted.
10913 (General_options::General_options): Deleted initializer.
10914 * options.h (options::String_set): New typedef.
10915 (options::parse_set): New function.
10916 (DEFINE_set): New macro.
10917 (General_options::wrap): Changed to use DEFINE_set. Changed
10918 callers of any_wrap_symbols and is_wrap_symbol.
10919 (General_options::trace, General_options::trace_symbol):
10920 New options.
10921 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10922 (General_options::wrap_symbols_): Deleted.
10923 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10924
10925 2008-04-17 David S. Miller <davem@davemloft.net>
10926
10927 * options.cc (General_options::parse_V): New function.
10928 * options.h: Add entries for -V and -Qy.
10929
10930 2008-04-17 Ian Lance Taylor <iant@google.com>
10931
10932 * common.cc (Symbol_table::allocate_commons): Remove options
10933 parameter. Change caller.
10934 (Symbol_table::do_allocate_commons): Remove options parameter.
10935 Change caller. Just call do_allocate_commons_list twice.
10936 (Symbol_table::do_allocate_commons_list): New function, broken out
10937 of do_allocate_commons.
10938 * common.h (class Allocate_commons_task): Remove options_ field.
10939 Update constructor.
10940 * symtab.cc (Symbol_table::Symbol_table): Initialize
10941 tls_commons_.
10942 (Symbol_table::add_from_object): Put TLS common symbols on
10943 tls_commons_ list.
10944 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10945 which are IN_OUTPUT_DATA.
10946 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10947 allocate_commons and do_allocate_commons declarations. Declare
10948 do_allocate_commons_list.
10949 * gold.cc (queue_middle_tasks): Update creation of
10950 Allocate_commons_task to not pass options.
10951 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10952 (TLS_TEST_C_FLAGS): New variable.
10953 (tls_test_c_pic.o): New target.
10954 (tls_test_shared.so): Link in tls_test_c_pic.o.
10955 (tls_test_c_pic_ie.o): New target.
10956 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10957 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10958 (tls_test_c.o): New target.
10959 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10960 (tls_pic_test_LDADD): Likewise.
10961 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10962 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10963 (tls_test_c_gnu2.o): New target.
10964 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10965 tls_test_c_gnu2.o.
10966 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10967 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10968 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10969 * testsuite/tls_test.cc: Include "config.h".
10970 (t_last): Call t11_last.
10971 * testsuite/tls_test.h (t11, t11_last): Declare.
10972 * testsuite/tls_test_c.c: New file.
10973 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10974 * configure.ac: Check for OpenMP support.
10975 * configure, config.in, Makefile.in: Rebuild.
10976 * testsuite/Makefile.in: Rebuild.
10977
10978 2008-04-16 Cary Coutant <ccoutant@google.com>
10979
10980 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10981 (Target_i386::tls_base_symbol_defined_): New field.
10982 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10983 (Target_i386::Scan::global): Likewise.
10984 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10985 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10986 (Target_x86_64::tls_base_symbol_defined_): New field.
10987 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10988 (Target_x86_64::Scan::global): Likewise.
10989
10990 2008-04-16 Cary Coutant <ccoutant@google.com>
10991
10992 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10993 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10994 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10995 building shared libraries.
10996 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10997 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10998 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10999 * testsuite/Makefile.in: Rebuild.
11000 * testsuite/weak_undef.h: New file.
11001 * testsuite/weak_undef_file1.cc: Add extra test cases.
11002 * testsuite/weak_undef_file2.cc: Likewise.
11003 * testsuite/weak_undef_test.cc: Likewise.
11004
11005 2008-04-16 David S. Miller <davem@davemloft.net>
11006
11007 * sparc.cc (Target_sparc::Scan): Change from struct to class.
11008 Add issued_non_pic_error_ field. Declare check_non_pic.
11009 (Target_sparc::Scan::check_non_pic): New function.
11010 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
11011 (Target_sparc::Scan::global): Likewise.
11012
11013 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
11014 * configure: Rebuild.
11015
11016 * options.h (DEFINE_enable): New macro.
11017 (new_dtags): New enable option.
11018 (initfirst, interpose, loadfltr, nodefaultlib,
11019 nodelete, nodlopen, nodump): New -z options.
11020 * layout.cc (Layout:finish_dynamic_section): If new
11021 dtags enabled, emit DT_RUNPATH. Also, emit a
11022 DT_FLAGS_1 containing any specified -z flags.
11023
11024 2008-04-16 Ian Lance Taylor <iant@google.com>
11025
11026 * copy-relocs.cc: New file.
11027 * copy-relocs.h: New file.
11028 * reloc.cc: Remove Copy_relocs code.
11029 * reloc.h: Likewise.
11030 * reloc-types.h (struct Reloc_types) [both versions]: Add
11031 get_reloc_addend_noerror.
11032 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
11033 variants of add_global which take an addend which must be zero.
11034 * i386.cc: Include "copy-relocs.h".
11035 (class Target_i386): Change type of copy_relocs_ to variable,
11036 update initializer.
11037 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
11038 Change all callers.
11039 (Target_i386::do_finalize_sections): Change handling of
11040 copy_relocs_.
11041 * sparc.cc: Include "copy-relocs.h".
11042 (class Target_sparc): Change type of copy_relocs_ to variable,
11043 update initializer.
11044 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
11045 Change all callers.
11046 (Target_sparc::do_finalize_sections): Change handling of
11047 copy_relocs_.
11048 * x86_64.cc: Include "copy-relocs.h".
11049 (class Target_x86_64): Change type of copy_relocs_ to variable,
11050 update initializer.
11051 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
11052 class. Change all callers.
11053 (Target_x86_64::do_finalize_sections): Change handling of
11054 copy_relocs_.
11055 * Makefile.am (CCFILES): Add copy-relocs.cc.
11056 (HFILES): Add copy-relocs.h.
11057
11058 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
11059
11060 * testsuite/script_test_4.sh: Permit leading zeroes.
11061
11062 2008-04-15 Ian Lance Taylor <iant@google.com>
11063
11064 * script-sections.cc (Script_sections::create_segments): Use
11065 header_size_adjustment even when there is enough room for the
11066 headers.
11067 * testsuite/script_test_4.sh: New file.
11068 * testsuite/script_test_4.t: New file.
11069 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
11070 (check_DATA): Add script_test_4.stdout.
11071 (MOSTLYCLEANFILES): Likewise.
11072 (script_test_4): New target.
11073 (script_test_4.stdout): New target.
11074 * testsuite/Makefile.in: Rebuild.
11075
11076 * sparc.cc: Add definitions for Output_data_plt_sparc class
11077 constants.
11078
11079 2008-04-14 David S. Miller <davem@davemloft.net>
11080
11081 * sparc.cc: New file.
11082 * Makefile.am (TARGETSOURCES): Add sparc.cc
11083 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
11084 * configure.tgt: Document targ_extra_size and
11085 targ_extra_big_endian. Add entries for sparc-* and
11086 sparc64-*.
11087 * configure.ac: Handle targ_extra_size and
11088 targ_extra_big_endian.
11089 * Makefile.in: Rebuild.
11090 * configure: Likewise.
11091 * po/POTFILES.in: Likewise.
11092 * po/gold.pot: Likewise.
11093
11094 2008-04-14 Ian Lance Taylor <iant@google.com>
11095
11096 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
11097 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
11098 in the name/type/flags to section mapping. Don't call
11099 allocate_output_section.
11100 (Layout::choose_output_section): Change parameter from adjust_name
11101 to is_input_section. Don't permit input sections after sections
11102 are attached to segments. Don't call allocate_output_section.
11103 (Layout::layout_eh_frame): Call update_flags_for_input_section,
11104 not write_enable_output_section.
11105 (Layout::make_output_section): Don't push to
11106 unattached_section_list_ nor call attach_to_segment. Call
11107 attach_section_to_segment if sections are attached.
11108 (Layout::attach_sections_to_segments): New function.
11109 (Layout::attach_section_to_segment): New function.
11110 (Layout::attach_allocated_section_to_segment): Rename from
11111 attach_to_segment. Remove flags parameter.
11112 (Layout::allocate_output_section): Remove function.
11113 (Layout::write_enable_output_section): Remove function.
11114 * layout.h (class Layout): Update for above changes. Add new
11115 field sections_are_attached_.
11116 * output.h (Output_section::update_flags_for_input_section): New
11117 function.
11118 * output.cc (Output_section::add_input_section): Call
11119 update_flags_for_input_section.
11120 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
11121
11122 2008-04-11 Cary Coutant <ccoutant@google.com>
11123
11124 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
11125 thought unnecessary.
11126 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
11127
11128 2008-04-11 Ian Lance Taylor <iant@google.com>
11129
11130 * output.h (class Output_section_data): Remove inline definition
11131 of set_addralign.
11132 * output.cc (Output_section_data::set_addralign): New function.
11133
11134 2008-04-11 Cary Coutant <ccoutant@google.com>
11135
11136 Add support for TLS descriptors for i386 and x86_64.
11137 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
11138 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
11139 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
11140 GOT_TYPE_TLS_DESC.
11141 (Target_i386::got_mod_index_entry): Remove unnecessary code.
11142 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
11143 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
11144 relocations.
11145 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
11146 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
11147 Fix problem with initial-exec relocations.
11148 (Target_i386::Relocate::relocate_tls): Likewise.
11149 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
11150 relaxation.
11151 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
11152 support for section-plus-offset dynamic table entries.
11153 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
11154 (Output_data_dynamic::Dynamic_entry): Add support for
11155 section-plus-offset dynamic table entries.
11156 (Output_data_dynamic::Classification): Likewise.
11157 (Output_data_dynamic::classification_): Renamed offset_.
11158 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
11159 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
11160 (Target_x86_64::make_plt_section): New function.
11161 (Target_x86_64::reserve_tlsdesc_entries): New function.
11162 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
11163 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
11164 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
11165 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
11166 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
11167 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
11168 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
11169 add extra PLT entry for TLS descriptors.
11170 (Output_data_plt_x86_64::got_): New field.
11171 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
11172 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
11173 fields.
11174 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
11175 descriptors.
11176 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
11177 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
11178 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
11179 R_386_TLS_DESC_CALL relocations.
11180 (Target_x86_64::Scan::global): Likewise.
11181 (Target_x86_64::do_finalize_sections): Add dynamic table entries
11182 for TLS descriptors.
11183 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
11184 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
11185 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
11186 GD-to-IE relaxation.
11187 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
11188 and TLS_DESCRIPTORS.
11189 * Makefile.in: Rebuild.
11190 * configure: Rebuild.
11191 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11192 (tls_test_shared2.so): New target.
11193 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11194 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11195 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11196 (tls_shared_gd_to_ie_test_LDADD): New variable.
11197 (tls_shared_gnu2_gd_to_ie_test): New target.
11198 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11199 New targets.
11200 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11201 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11202 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11203 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11204 (tls_shared_gnu2_test): New target.
11205 (tls_test_gnu2_shared.so): New target.
11206 (tls_shared_gnu2_test_SOURCES): New variable.
11207 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11208 (tls_shared_gnu2_test_LDFLAGS): New variable.
11209 (tls_shared_gnu2_test_LDADD): New variable.
11210 * testsuite/Makefile.in: Rebuild.
11211 * testsuite/Makefile.
11212
11213 2008-04-11 Ian Lance Taylor <iant@google.com>
11214
11215 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11216 justsyms.t.
11217 * testsuite/Makefile.in: Rebuild.
11218
11219 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11220 long.
11221 * testsuite/script_test_2.cc (main): Adjust test.
11222
11223 2008-04-11 David S. Miller <davem@davemloft.net>
11224 Ian Lance Taylor <iant@google.com>
11225
11226 * options.h (General_options): Add entries for '-Y' and
11227 '-relax'.
11228 * options.cc (General_options:finalize): If -Y was used, add those
11229 entries to the library path instead of the default "/lib" and
11230 "/usr/lib".
11231
11232 2008-04-11 David S. Miller <davem@davemloft.net>
11233
11234 * testsuite/justsyms.t: Start at 0x100.
11235 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
11236 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11237 long.
11238 * testsuite/script_test_2.cc: Adjust string and section length
11239 checks.
11240
11241 2008-04-09 Ian Lance Taylor <iant@google.com>
11242
11243 PR gold/5996
11244 * script-sections.cc (Sections_element::allocate_to_segment): Add
11245 orphan parameter.
11246 (Output_section_definition::allocate_to_segment): Likewise.
11247 (Orphan_output_section::allocate_to_segment): Likewise.
11248 (Script_sections::attach_sections_using_phdrs_clause): Don't
11249 propagate non-PT_LOAD segments to orphan sections.
11250 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11251 readelf rather than objdump.
11252 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11253 .interp section and PT_INTERP segment are the same size.
11254 * testsuite/Makefile.in: Rebuild.
11255
11256 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11257 aliases for symbols defined in the same object.
11258 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11259 (weak_alias_test_SOURCES): New variable.
11260 (weak_alias_test_DEPENDENCIES): New variable.
11261 (weak_alias_test_LDFLAGS): New variable.
11262 (weak_alias_test_LDADD): New variable.
11263 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11264 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11265 (weak_alias_test_3.o): New target.
11266 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11267 * testsuite/weak_alias_test_main.cc: New file.
11268 * testsuite/weak_alias_test_1.cc: New file.
11269 * testsuite/weak_alias_test_2.cc: New file.
11270 * testsuite/weak_alias_test_3.cc: New file.
11271
11272 2008-04-08 Ian Lance Taylor <iant@google.com>
11273
11274 * options.h (class General_options): Add --noinhibit-exec option.
11275 * main.cc (main): Check --noinhibit-exec.
11276
11277 * options.h (class General_options): Define --wrap as a special
11278 option. Add wrap_symbols_ field.
11279 (General_options::any_wrap_symbols): New function.
11280 (General_options::is_wrap_symbol): New function.
11281 * options.cc (General_options::parse_wrap): New function.
11282 (General_options::General_options): Initialize wrap_symbols_.
11283 * symtab.cc (Symbol_table::wrap_symbol): New function.
11284 (Symbol_table::add_from_object): Handle --wrap.
11285 * symtab.h (class Symbol_table): Declare wrap_symbol.
11286 * target.h (Target::wrap_char): New function.
11287 (Target::Target_info): Add wrap_char field.
11288 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11289 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11290 * testsuite/testfile.cc (Target_test::test_target_info):
11291 Likewise.
11292
11293 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11294 there is one.
11295
11296 * layout.h (class Layout): Add added_eh_frame_data_ field.
11297 * layout.cc (Layout::Layout): Initialize new field.
11298 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11299 output section until we find a section we merged successfully.
11300 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11301 that the size be non-zero.
11302
11303 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11304 qualifier.
11305
11306 2008-04-08 Craig Silverstein <csilvers@google.com>
11307
11308 * configure.ac: Export new conditional variable HAVE_ZLIB.
11309 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11310 on HAVE_ZLIB.
11311 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11312 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11313
11314 2008-04-07 Ian Lance Taylor <iant@google.com>
11315
11316 * version.cc (version_string): Set to "1.5".
11317
11318 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11319 Add issued_non_pic_error_ field. Declare check_non_pic.
11320 (Target_x86_64::Scan::check_non_pic): New function.
11321 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11322 (Target_x86_64::Scan::global): Likewise.
11323
11324 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11325 addend parameter. Change caller. Handle merge sections.
11326 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11327 Address to Addend. Don't add in the result of
11328 local_section_offset, pass down the addend and use the returned
11329 value.
11330 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11331 Update declarations of local_section_offset and symbol_value.
11332 * testsuite/two_file_test_1.cc (t18): New function.
11333 * testsuite/two_file_test_2.cc (f18): New function.
11334 * testsuite/two_file_test_main.cc (main): Call t18.
11335 * testsuite/two_file_test.h (t18, f18): Declare.
11336
11337 * configure.ac: Don't test for objdump, c++filt, or readelf.
11338 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11339 conditionals.
11340 (TEST_READELF): New variable.
11341 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11342 (check_PROGRAMS): Add two_file_strip_test.
11343 (two_file_strip_test): New target.
11344 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11345 (two_file_same_shared_strip_test_SOURCES): New variable.
11346 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11347 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11348 (two_file_same_shared_strip_test_LDADD): New variable.
11349 (two_file_shared_strip.so): New target.
11350 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11351 (ver_test_5.syms, ver_test_7.syms): Likewise.
11352 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11353 (strip_test_3.stdout): Use TEST_OBJDUMP.
11354 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11355
11356 2008-04-04 Cary Coutant <ccoutant@google.com>
11357
11358 * symtab.h (Symbol::is_weak_undefined): New function.
11359 (Symbol::is_strong_undefined): New function.
11360 (Symbol::is_absolute): New function.
11361 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11362 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11363 absolute symbols.
11364 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11365 (weak_undef_test): New target.
11366 * testsuite/Makefile.in: Rebuild.
11367 * testsuite/weak_undef_file1.cc: New file.
11368 * testsuite/weak_undef_file2.cc: New file.
11369 * testsuite/weak_undef_test.cc: New file.
11370
11371 2008-04-03 Craig Silverstein <csilvers@google.com>
11372
11373 * compressed_output.h (class Output_compressed_section): Use
11374 unsigned buffer.
11375 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11376 add zlib header.
11377 (zlib_compressed_suffix): Removed.
11378 (Output_compressed_section::set_final_data_size): Use unsigned
11379 buffers.
11380 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11381 Fix linker invocation.
11382 (flagstest_o_specialfile_and_compress_debug_sections):
11383 Likewise.
11384 * testsuite/Makefile.in: Regenerated.
11385
11386 2008-04-02 David S. Miller <davem@davemloft.net>
11387
11388 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11389 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11390
11391 2008-04-02 Craig Silverstein <csilvers@google.com>
11392
11393 * TODO: New file.
11394
11395 2008-04-02 Ian Lance Taylor <iant@google.com>
11396
11397 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11398 parameters. Update for new key type to views_. Change all
11399 callers.
11400 (File_read::read): Adjust for byteshift in returned view.
11401 (File_read::add_view): New function, broken out of
11402 find_and_make_view.
11403 (File_read::make_view): New function, broken out of
11404 find_and_make_view.
11405 (File_read::find_or_make_view): Add offset and aligned
11406 parameters. Rewrite accordingly. Change all callers.
11407 (File_read::get_view): Add offset and aligned parameters. Adjust
11408 for byteshift in return value.
11409 (File_read::get_lasting_view): Likewise.
11410 * fileread.h (class File_read): Update declarations.
11411 (class File_read::View): Add byteshift_ field. Add byteshift to
11412 constructor. Add byteshift method.
11413 * archive.h (Archive::clear_uncached_views): New function.
11414 (Archive::get_view): Add aligned parameter. Change all callers.
11415 * object.h (Object::get_view): Add aligned parameter. Change all
11416 callers.
11417 (Object::get_lasting_view): Likewise.
11418
11419 * fileread.cc (File_read::release): Don't call clear_views if
11420 there are multiple objects.
11421 * fileread.h (File_read::clear_uncached_views): New function.
11422 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11423 on the archive.
11424
11425 2008-03-31 Cary Coutant <ccoutant@google.com>
11426
11427 Add thin archive support.
11428 * archive.cc (Archive::armagt): New const.
11429 (Archive::setup): Remove task parameter and calls to unlock.
11430 (Archive::unlock_nested_archives): New function.
11431 (Archive::read_header): Add nested_off parameter. Change
11432 all callers.
11433 (Archive::interpret_header): Likewise.
11434 (Archive::include_all_members): Change to handle thin
11435 archives.
11436 (Archive::include_member): Likewise.
11437 * archive.h (Archive::Archive): Add new parameters and
11438 initializers.
11439 (Archive::armagt): New const.
11440 (Archive::setup): Remove task parameter.
11441 (Archive::unlock_nested_archives): New function.
11442 (Archive::read_header): Add nested_off parameter.
11443 (Archive::interpret_header): Likewise.
11444 (Archive::Nested_archive_table): New typedef.
11445 (Archive::is_thin_archive_): New field.
11446 (Archive::nested_archives_): New field.
11447 (Archive::options_): New field.
11448 (Archive::dirpath_): New field.
11449 (Archive::task_): New field.
11450 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11451 for thin archives. Pass additional parameters to
11452 Archive::Archive. Unlock the archive file after calling
11453 Archive::setup.
11454
11455 2008-03-29 Ian Lance Taylor <iant@google.com>
11456
11457 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11458 version symbol to be local.
11459 * testsuite/ver_test_4.sh: New file.
11460 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11461 (check_DATA): Add ver_test_4.syms.
11462 (ver_test_4.syms): New target.
11463 * testsuite/Makefile.in: Rebuild.
11464
11465 * output.cc
11466 (Output_section::Input_section_sort_entry::has_priority): New
11467 function.
11468 (Output_section::Input_section_sort_entry::match_file_name): New
11469 function.
11470 (Output_section::Input_section_sort_entry::match_section_name):
11471 Remove.
11472 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11473 Remove.
11474 (Output_section::Input_section_sort_entry::match_section_file):
11475 Remove.
11476 (Output_section::Input_section_sort_compare::operator()): Rewrite
11477 using new Input_section_sort_entry functions. Sort crtbegin and
11478 crtend first. Sort sections with no priority before sections with
11479 a priority.
11480 * testsuite/initpri1.c (d3): Check j != 4.
11481 (cd5): New constructor/destructor function.
11482 (main): Check j != 2.
11483
11484 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11485 new symbol when resolving, don't call set_is_default.
11486 * testsuite/ver_test_7.cc: New file.
11487 * testsuite/ver_test_7.sh: New file.
11488 * testsuite/Makefile.am (ver_test_7.so): New target.
11489 (ver_test_7.o): New target.
11490 (check_SCRIPTS): Add ver_test_7.sh.
11491 (check_DATA): Add ver_test_7.syms.
11492 (ver_test_7.syms): New target.
11493
11494 2008-03-28 Ian Lance Taylor <iant@google.com>
11495
11496 * layout.cc (Layout::layout): If we see an input section with a
11497 name that needs sorting, set the must_sort flag for the output
11498 section.
11499 (Layout::make_output_section): If the name of the output section
11500 indicates that it might require sorting, set the may_sort flag.
11501 * output.h (Output_section::may_sort_attached_input_sections): New
11502 function.
11503 (Output_section::set_may_sort_attached_input_sections): New
11504 function.
11505 (Output_section::must_sort_attached_input_sections): New
11506 function.
11507 (Output_section::set_must_sort_attached_input_sections): New
11508 function.
11509 (class Output_section): Declare Input_section_sort_entry. Define
11510 Input_section_sort_compare. Declare
11511 sort_attached_input_sections. Add new fields:
11512 may_sort_attached_input_sections_,
11513 must_sort_attached_input_sections_,
11514 attached_input_sections_are_sorted_.
11515 * output.cc (Output_section::Output_section): Initialize new
11516 fields.
11517 (Output_section::add_input_section): Add an entry to
11518 input_sections_ if may_sort or must_sort are true.
11519 (Output_section::set_final_data_size): Call
11520 sort_attached_input_sections if necessary.
11521 (Output_section::Input_section_sort_entry): Define new class.
11522 (Output_section::Input_section_sort_compare::operator()): New
11523 function.
11524 (Output_section::sort_attached_input_sections): New function.
11525 * configure.ac: Check whether the compiler supports constructor
11526 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11527 * testsuite/initpri1.c: New file.
11528 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11529 CONSTRUCTOR_PRIORITY.
11530 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11531 (initpri1_LDFLAGS): New variable.
11532 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11533
11534 2008-03-27 Ian Lance Taylor <iant@google.com>
11535
11536 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11537 * testsuite/common_test_1.c: New file.
11538 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11539 (common_test_1_SOURCES): New variable.
11540 (common_test_1_DEPENDENCIES): New variable.
11541 (common_test_1_LDFLAGS): New variable.
11542
11543 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11544 and commons_ correctly when NAME/VERSION does not override
11545 NAME/NULL.
11546 * testsuite/ver_test_6.c: New file.
11547 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11548 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11549 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11550
11551 2008-03-26 Ian Lance Taylor <iant@google.com>
11552
11553 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11554 of an undefined symbol from a version script.
11555 * testsuite/Makefile.am (ver_test_5.so): New target.
11556 (ver_test_5.o): New target.
11557 (check_SCRIPTS): Add ver_test_5.sh.
11558 (check_DATA): Add ver_test_5.syms.
11559 (ver_test_5.syms): New target.
11560 * testsuite/ver_test_5.cc: New file.
11561 * testsuite/ver_test_5.script: New file.
11562 * testsuite/ver_test_5.sh: New file.
11563 * Makefile.in, testsuite/Makefile.in: Rebuild.
11564
11565 PR gold/5986
11566 Fix problems building gold with gcc 4.3.0.
11567 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11568 (gold_error_at_location, gold_warning_at_location): Use it.
11569 * configure.ac: Check whether we can compile and use a template
11570 function with a printf attribute.
11571 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11572 when jumping over bytes.
11573 * object.cc: Instantiate Object::read_section_data.
11574 * debug.h: Include <cstring>
11575 * dwarf_reader.cc: Include <algorithm>
11576 * main.cc: Include <cstring>.
11577 * options.cc: Include <cstring>.
11578 * output.cc: Include <cstring>.
11579 * script.cc: Include <cstring>.
11580 * script.h: Include <string>.
11581 * symtab.cc: Include <cstring> and <algorithm>.
11582 * target-select.cc: Include <cstring>.
11583 * version.cc: Include <string>.
11584 * testsuite/testmain.cc: Include <cstdlib>.
11585 * configure, config.in: Rebuild.
11586
11587 2008-03-25 Ian Lance Taylor <iant@google.com>
11588
11589 * options.cc: Include "../bfd/bfdver.h".
11590 (options::help): Print bug reporting address.
11591
11592 * version.cc (print_version): Adjust output for current value of
11593 BFD_VERSION_STRING.
11594
11595 * NEWS: New file.
11596
11597 * options.cc (options::help): Print list of supported targets.
11598 * target-select.h: Include <vector>.
11599 (class Target_selector): Make machine_, size_, and is_big_endian_
11600 fields const. Add bfd_name_ and instantiated_target_ fields.
11601 (Target_selector::Target_selector): Add bfd_name parameter.
11602 (Target_selector::recognize): Make non-virtual, call
11603 do_recognize.
11604 (Target_selector::recognize_by_name): Make non-virtual, call
11605 do_recognize_by_name.
11606 (Target_selector::supported_names): New function.
11607 (Target_selector::bfd_name): New function.
11608 (Target_selector::do_instantiate_target): New pure virtual
11609 function.
11610 (Target_selector::do_recognize): New virtual function.
11611 (Target_selector::do_recognize_by_name): New virtual function.
11612 (Target_selector::instantiate_target): New private function.
11613 (supported_target_names): Declare.
11614 * target-select.cc (Target_selector::Target_selector): Update for
11615 new parameter and fields.
11616 (select_target_by_name): Check that the name matches before
11617 calling recognize_by_name.
11618 (supported_target_names): New function.
11619 * i386.cc (class Target_selector_i386): Update Target_selector
11620 constructor call. Remove recognize and recognize_by_name. Add
11621 do_instantiate_target.
11622 * x86_64.cc (class Target_selector_x86_64): Likewise.
11623 * testsuite/testfile.cc (class Target_selector_test): Update for
11624 changes to Target_selector.
11625
11626 * README: Rewrite, with some notes on unsupported features.
11627
11628 2008-03-24 Cary Coutant <ccoutant@google.com>
11629
11630 * i386.cc (Target_i386::Got_type): New enum declaration.
11631 (Target_i386::Scan::local): Updated callers of Output_data_got
11632 member functions.
11633 (Target_i386::Scan::global): Likewise.
11634 (Target_i386::Relocate::relocate): Likewise.
11635 (Target_i386::Relocate::relocate_tls): Likewise.
11636 * object.h (Got_offset_list): New class.
11637 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11638 (Sized_relobj::local_got_offset): Likewise.
11639 (Sized_relobj::set_local_got_offset): Likewise.
11640 (Sized_relobj::local_has_tls_got_offset): Removed.
11641 (Sized_relobj::local_tls_got_offset): Removed.
11642 (Sized_relobj::set_local_tls_got_offset): Removed.
11643 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11644 * output.cc (Output_data_got::add_global): Added got_type parameter.
11645 (Output_data_got::add_global_with_rel): Likewise.
11646 (Output_data_got::add_global_with_rela): Likewise.
11647 (Output_data_got::add_global_pair_with_rel): New function.
11648 (Output_data_got::add_global_pair_with_rela): New function.
11649 (Output_data_got::add_local): Added got_type parameter.
11650 (Output_data_got::add_local_with_rel): Likewise.
11651 (Output_data_got::add_local_with_rela): Likewise.
11652 (Output_data_got::add_local_pair_with_rel): New function.
11653 (Output_data_got::add_local_pair_with_rela): New function.
11654 (Output_data_got::add_global_tls): Removed.
11655 (Output_data_got::add_global_tls_with_rel): Removed.
11656 (Output_data_got::add_global_tls_with_rela): Removed.
11657 (Output_data_got::add_local_tls): Removed.
11658 (Output_data_got::add_local_tls_with_rel): Removed.
11659 (Output_data_got::add_local_tls_with_rela): Removed.
11660 * output.h (Output_data_got::add_global): Added got_type parameter.
11661 (Output_data_got::add_global_with_rel): Likewise.
11662 (Output_data_got::add_global_with_rela): Likewise.
11663 (Output_data_got::add_global_pair_with_rel): New function.
11664 (Output_data_got::add_global_pair_with_rela): New function.
11665 (Output_data_got::add_local): Added got_type parameter.
11666 (Output_data_got::add_local_with_rel): Likewise.
11667 (Output_data_got::add_local_with_rela): Likewise.
11668 (Output_data_got::add_local_pair_with_rel): New function.
11669 (Output_data_got::add_local_pair_with_rela): New function.
11670 (Output_data_got::add_global_tls): Removed.
11671 (Output_data_got::add_global_tls_with_rel): Removed.
11672 (Output_data_got::add_global_tls_with_rela): Removed.
11673 (Output_data_got::add_local_tls): Removed.
11674 (Output_data_got::add_local_tls_with_rel): Removed.
11675 (Output_data_got::add_local_tls_with_rela): Removed.
11676 * resolve.cc (Symbol::override_base_with_special): Removed
11677 reference to has_got_offset_ field.
11678 * symtab.cc (Symbol::init_fields): Replaced initialization
11679 of got_offset_ with got_offsets_. Removed initialization
11680 of has_got_offset_
11681 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11682 (Symbol::got_offset): Likewise.
11683 (Symbol::set_got_offset): Likewise.
11684 (Symbol::has_tls_got_offset): Removed.
11685 (Symbol::tls_got_offset): Removed.
11686 (Symbol::set_tls_got_offset): Removed.
11687 (Symbol::got_offset_): Removed.
11688 (Symbol::tls_mod_got_offset_): Removed.
11689 (Symbol::tls_pair_got_offset_): Removed.
11690 (Symbol::got_offsets_): New field.
11691 (Symbol::has_got_offset): Removed.
11692 (Symbol::has_tls_mod_got_offset): Removed.
11693 (Symbol::has_tls_pair_got_offset): Removed.
11694 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11695 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11696 member functions.
11697 (Target_x86_64::Scan::global): Likewise.
11698 (Target_x86_64::Relocate::relocate): Likewise.
11699 (Target_x86_64::Relocate::relocate_tls): Likewise.
11700
11701 2008-03-25 Ben Elliston <bje@au.ibm.com>
11702
11703 * yyscript.y: Fix spelling error in comment.
11704
11705 2008-03-24 Ian Lance Taylor <iant@google.com>
11706
11707 * options.h (class General_options): Define build_id option.
11708 * layout.h (class Layout): Declare write_build_id, create_note,
11709 create_build_id. Add build_id_note_ member.
11710 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11711 "libiberty.h", "md5.h", "sha1.h".
11712 (Layout::Layout): Initialize eh_frame_data_,
11713 eh_frame_hdr_section_, and build_id_note_.
11714 (Layout::finalize): Call create_build_id.
11715 (Layout::create_note): New function, broken out of
11716 Layout::create_gold_note.
11717 (Layout::create_gold_note): Call create_note.
11718 (Layout::create_build_id): New function.
11719 (Layout::write_build_id): New function.
11720 (Close_task_runner::run): Call write_build_id.
11721
11722 * x86_64.cc: Correct license to GPLv3.
11723
11724 2008-03-23 Ian Lance Taylor <iant@google.com>
11725
11726 * options.cc: Include "demangle.h".
11727 (parse_optional_string): New function.
11728 (parse_long_option): Handle takes_optional_argument.
11729 (parse_short_option): Update dash_z initializer. Handle
11730 takes_optional_argument.
11731 (General_options::General_options): Initialize do_demangle_.
11732 (General_options::finalize): Set do_demangle_. Handle demangling
11733 style.
11734 * options.h (parse_optional_string): Declare.
11735 (struct One_option): Add optional_arg field. Update constructor.
11736 Update call constructor calls. Add takes_optional_argument
11737 function.
11738 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11739 (DEFINE_optional_string): Define.
11740 (General_options::demangle): Change from DEFINE_bool to
11741 DEFINE_optional_string.
11742 (General_options::no_demangle): New function.
11743 (General_options::do_demangle): New function.
11744 (General_options::set_do_demangle): New function.
11745 (General_options::execstack_status_): Move definition to end of
11746 class definition.
11747 (General_options::static_): Likewise.
11748 (General_options::do_demangle_): New field.
11749 * object.cc (big_endian>::get_symbol_location_info): Call
11750 Options::do_demangle, not Options::demangle.
11751 * symtab.cc (demangle): Likewise.
11752
11753 2008-03-22 Ian Lance Taylor <iant@google.com>
11754
11755 * gold.h: Include <cstddef> and <sys/types.h>
11756 * options.h: Include <cstring>.
11757
11758 2008-03-21 Ian Lance Taylor <iant@google.com>
11759
11760 * Added source code to GNU binutils.
This page took 0.325285 seconds and 5 git commands to generate.