Fix JIT clang-lli regression (unable to read JIT descriptor from memory)
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
8f7c81e8
CC
12011-07-06 Cary Coutant <ccoutant@google.com>
2
3 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4 debug output when command lines differ.
5
9fbd3822
CC
62011-07-06 Cary Coutant <ccoutant@google.com>
7
8 * incremental.cc (Incremental_inputs::report_command_line): Ignore
9 --incremental-patch option.
10 * layout.cc (Free_list::allocate): Extend allocation beyond original
11 end if enabled.
12 (Layout::make_output_section): Mark sections that should get
13 patch space.
14 * options.cc (parse_percent): New function.
15 * options.h (parse_percent): New function.
16 (DEFINE_percent): New macro.
17 (General_options): Add --incremental-patch option.
18 * output.cc (Output_section::Output_section): Initialize new data
19 members.
20 (Output_section::add_input_section): Print section name when out
21 of patch space.
22 (Output_section::add_output_section_data): Likewise.
23 (Output_section::set_final_data_size): Add patch space when
24 doing --incremental-full.
25 (Output_section::do_reset_address_and_file_offset): Remove patch
26 space.
27 (Output_segment::set_section_list_addresses): Print debug output
28 only if --incremental-update.
29 * output.h (Output_section::set_is_patch_space_allowed): New function.
30 (Output_section::is_patch_space_allowed_): New data member.
31 (Output_section::patch_space_): New data member.
32 * parameters.cc (Parameters::incremental_full): New function.
33 * parameters.h (Parameters::incremental_full): New function
34 * testsuite/Makefile.am (incremental_test_2): Add test for
35 --incremental-patch option.
36 * testsuite/Makefile.in: Regenerate.
37 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
38 (t18): Remove function body.
39
f6cccc2c
DK
402011-07-05 Doug Kwan <dougkwan@google.com>
41
42 PR gold/12771
43 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
44 Arm_Address type for relocation result.
45 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
46 overflow check.
47 (Arm_relocate_functions::abs32): Use unaligned access.
48 (Arm_relocate_functions::rel32): Ditto.
49 (Arm_relocate_functions::prel31): Ditto.
50 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
51 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
52 static data relocations.
53 * testsuite/Makefile.in: Regnerate.
54 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
55
28a13fec
ILT
562011-07-05 Ian Lance Taylor <iant@google.com>
57
58 PR gold/12392
59 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
60 symbols if necessary.
61 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
62
24d47b34
ILT
632011-07-05 Ian Lance Taylor <iant@google.com>
64
65 PR gold/12952
66 * resolve.cc (Symbol::override_base_with_special): Simply override
67 version with special symbol version, ignoring previous version.
68
41f9cbbe
ILT
692011-07-05 Ian Lance Taylor <iant@google.com>
70
71 * object.cc (Sized_relobj_file::include_section_group): Add
72 information to comment about signature location.
73
886288f1
ILT
742011-07-02 Ian Lance Taylor <iant@google.com>
75
76 PR gold/12957
77 * options.h (class General_options): Add -f and -F.
78 * options.cc (General_options::finalize): Fatal error if -f/-F
79 are used without -shared.
80 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
81
ae3a6d4f
ILT
822011-07-02 Ian Lance Taylor <iant@google.com>
83
84 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
85
21131061
ILT
862011-07-01 Ian Lance Taylor <iant@google.com>
87
88 PR gold/12525
89 PR gold/12952
90 * resolve.cc (Symbol::override_base_with_special): Don't override
91 the version if the overriding symbol has a different name.
92 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
93 all callers. If we give an error about an undefined version,
94 define the base version if necessary.
95 * dynobj.h (class Versions): Update declaration.
96 * testsuite/weak_alias_test_5.cc: New file.
97 * testsuite/weak_alias_test.script: New file.
98 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
99 and versioned_alias have the right value, and call t2.
100 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
101 weak_alias_test_5.so.
102 (weak_alias_test_LDADD): Likewise.
103 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
104 * testsuite/Makefile.in: Rebuild.
105
611062c0
ILT
1062011-07-01 Ian Lance Taylor <iant@google.com>
107
108 PR gold/12525
109 * options.h (class General_options): Support -z notext.
110 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
111 -Wl,-z,notext.
112 (two_file_shared_nonpic.so): Likewise.
113 (two_file_shared_mixed.so): Likewise.
114 (two_file_shared_mixed_1.so): Likewise.
115 (weak_undef_lib_nonpic.so): Likewise.
116 (alt/weak_undef_lib_nonpic.so): Likewise.
117 (tls_test_shared_nonpic.so): Likewise.
118 * testsuite/Makefile.in: Rebuild.
119
328c7c2f
ILT
1202011-07-01 Ian Lance Taylor <iant@google.com>
121
122 PR gold/12525
123 * configure.ac: Test whether static linking works, setting
124 the automake conditional HAVE_STATIC.
125 * testsuite/Makefile.am: Disable tests using -static if
126 HAVE_STATIC is not true.
127 * configure, testsuite/Makefile.in: Rebuild.
128
02d7cd44
ILT
1292011-07-01 Ian Lance Taylor <iant@google.com>
130
131 PR gold/12525
132 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
133 Assert if we see DW_EH_PE_indirect.
134 * target.h (Target::ehframe_datarel_base): New function.
135 (Target::do_ehframe_datarel_base): New target function.
136 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
137 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
138 function.
139
07a60597
ILT
1402011-07-01 Ian Lance Taylor <iant@google.com>
141
142 PR gold/12571
143 * options.h (class General_options): Add
144 --ld-generated-unwind-info.
145 * ehframe.cc (Fde::write): Add address parameter. Change all
146 callers. If associated with PLT, fill in address and size.
147 (Cie::set_output_offset): Only add merge mapping if there is an
148 object.
149 (Cie::write): Add address parameter. Change all callers.
150 (Eh_frame::add_ehframe_for_plt): New function.
151 * ehframe.h (class Fde): Update declarations. Move shndx_ and
152 input_offset_ fields into union u_, with new plt field.
153 (Fde::Fde): Adjust for new union field.
154 (Fde::Fde) [Output_data version]: New constructor.
155 (Fde::add_mapping): Only add merge mapping if there is an object.
156 (class Cie): Update declarations.
157 (class Eh_frame): Declare add_ehframe_for_plt.
158 * layout.cc (Layout::layout_eh_frame): Break out code into
159 make_eh_frame_section, and call it.
160 (Layout::make_eh_frame_section): New function.
161 (Layout::add_eh_frame_for_plt): New function.
162 * layout.h (class Layout): Update declarations.
163 * merge.cc (Merge_map::add_mapping): Add assertion.
164 * i386.cc: Include "dwarf.h".
165 (class Output_data_plt_i386): Make first_plt_entry,
166 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
167 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
168 and plt_eh_frame_fde.
169 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
170 boundary. Call add_eh_frame_for_plt if appropriate.
171 * x86_64.cc: Include "dwarf.h".
172 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
173 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
174 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
175 and plt_eh_frame_fde.
176 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
177 appropriate.
178
14788a3f
ILT
1792011-06-29 Ian Lance Taylor <iant@google.com>
180
181 PR gold/12629
182 * object.cc (Sized_relobj_file::layout_section): Change shdr
183 parameter to be const.
184 (Sized_relobj_file::layout_eh_frame_section): New function, broken
185 out of do_layout.
186 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
187 appropriate. Call layout_eh_frame_section.
188 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
189 sections.
190 * object.h (class Sized_relobj_file): Update declarations.
191
6c21fce1
ILT
1922011-06-29 Ian Lance Taylor <iant@google.com>
193
37e41b03 194 PR gold/12652
6c21fce1
ILT
195 * script.cc (Token::integer_value): Accept trailing M/m/K/k
196 modifier.
197 (Lex::gather_token): Accept trailing M/m/K/k for integers.
198
4d5e4e62
ILT
1992011-06-29 Ian Lance Taylor <iant@google.com>
200
201 PR gold/12675
202 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
203 SHT_X86_64_UNWIND.
204 * layout.cc (Layout::layout_eh_frame): Likewise.
205
886f533a
ILT
2062011-06-29 Ian Lance Taylor <iant@google.com>
207
208 PR gold/12695
209 * layout.cc (Layout::symtab_section_shndx): New function.
210 * layout.h (class Layout): Declare symtab_section_shndx.
211 * output.cc (Output_section::write_header): Call it.
212
f3ae1b28
ILT
2132011-06-29 Ian Lance Taylor <iant@google.com>
214
215 PR gold/12818
216 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
217 symbols which are not used in a relocation.
218
aecf301f
ILT
2192011-06-28 Ian Lance Taylor <iant@google.com>
220
221 PR gold/12898
222 * layout.cc (Layout::segment_precedes): Don't crash if a linker
223 script create indistinguishable segments.
224 (Layout::set_segment_offsets): Use stable_sort when sorting
225 segments. Pass this to Compare_segments constructor.
226 * layout.h (class Layout): Make segment_precedes non-static.
227 (class Compare_segments): Change from struct to class. Add
228 layout_ field. Add constructor.
229 * script-sections.cc
230 (Script_sections::attach_sections_using_phdrs_clause): Rename
231 local orphan to is_orphan. Don't report failure to put empty
232 section in segment. On attachment failure, report name of
233 section, and attach to first PT_LOAD segment.
234
03ef7571
ILT
2352011-06-28 Ian Lance Taylor <iant@google.com>
236
237 PR gold/12934
238 * target-select.cc (Target_selector::Target_selector): Add
239 emulation parameter. Change all callers.
240 (select_target_by_bfd_name): Rename from select_target_by_name.
241 Change all callers.
242 (select_target_by_emulation): New function.
243 (supported_emulation_names): New function.
244 * target-select.h (class Target_selector): Add emulation_ field.
245 Update declarations.
246 (Target_selector::recognize_by_bfd_name): Rename from
247 recognize_by_name. Change all callers.
248 (Target_selector::supported_bfd_names): Rename from
249 supported_names. Change all callers.
250 (Target_selector::recognize_by_emulation): New function.
251 (Target_selector::supported_emulations): New function.
252 (Target_selector::emulation): New function.
253 (Target_selector::do_recognize_by_bfd_name): Rename from
254 do_recognize_by_name. Change all callers.
255 (Target_selector::do_supported_bfd_names): Rename from
256 do_supported_names. Change all callers.
257 (Target_selector::do_recognize_by_emulation): New function.
258 (Target_selector::do_supported_emulations): New function.
259 (select_target_by_bfd_name): Change name in declaration.
260 (select_target_by_emulation): Declare.
261 (supported_emulation_names): Declare.
262 * parameters.cc (parameters_force_valid_target): Try to find
263 target based on emulation from -m option.
264 * options.h (class General_options): Change doc string for -m.
265 * options.cc (help): Print emulations.
266 (General_options::parse_V): Likewise.
267 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
268 Add emulation parameter. Change all callers.
269
200b2bb9
ILT
2702011-06-28 Ian Lance Taylor <iant@google.com>
271
272 * target.h (class Target): Add osabi_ field.
273 (Target::osabi): New function.
274 (Target::set_osabi): New function.
275 (Target::Target): Initialize osabi_.
276 (Target::do_adjust_elf_header): Make pure virtual.
277 (Sized_target::do_adjust_elf_header): Declare.
278 * target.cc (Sized_target::do_adjust_elf_header): New function.
279 (class Sized_target): Instantiate all versions.
280 * freebsd.h (class Target_freebsd): Remove.
281 (Target_selector_freebsd::do_recognize): Call set_osabi on
282 Target.
283 (Target_selector_freebsd::do_recognize_by_name): Likewise.
284 (Target_selector_freebsd::set_osabi): Remove.
285 * i386.cc (class Target_i386): Inherit from Sized_target rather
286 than Target_freebsd.
287 * x86_64.cc (class Target_x86_64): Likewise.
288
b3ce541e
ILT
2892011-06-28 Ian Lance Taylor <iant@google.com>
290
291 * target.h (Target::can_check_for_function_pointers): Rewrite.
292 Make non-virtual.
293 (Target::can_icf_inline_merge_sections): Likewise.
294 (Target::section_may_have_icf_unsafe_poineters): Likewise.
295 (Target::Target_info): Add can_icf_inline_merge_sections field.
296 (Target::do_can_check_for_function_pointers): New virtual
297 function.
298 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
299 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
300 from can_check_for_function_pointers, move in file.
301 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
302 section_may_have_icf_unsafe_poineters, move in file.
303 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
304 * i386.cc (Target_i386::do_can_check_for_function_pointers):
305 Rename from can_check_for_function_pointers, move in file.
306 (Target_i386::can_icf_inline_merge_sections): Remove.
307 (Target_i386::i386_info): Initialize
308 can_icf_inline_merge_sections.
309 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
310 Initialize can_icf_inline_merge_sections.
311 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
312 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
313 Rename from can_check_for_function_pointers, move in file.
314 (Target_x86_64::can_icf_inline_merge_sections): Remove.
315 (Target_x86_64::x86_64_info): Initialize
316 can_icf_inline_merge_sections.
317 * testsuite/testfile.cc (Target_test::test_target_info):
318 Likewise.
319 * icf.cc (get_section_contents): Correct formatting.
320
6d1c4efb
ILT
3212011-06-27 Ian Lance Taylor <iant@google.com>
322
323 * symtab.cc (Symbol::versioned_name): New function.
324 (Symbol_table::add_to_final_symtab): Use versioned_name when
325 appropriate.
326 (Symbol_table::sized_write_symbol): Likewise.
327 * symtab.h (class Symbol): Declare versioned_name.
328 * stringpool.h (class Stringpool_template): Add variant of add
329 which takes a std::basic_string.
330 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
331 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
332 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
333 (ver_test_12.o): New target.
334 * testsuite/Makefile.in: Rebuild.
335
57eb9b50
DK
3362011-06-27 Doug Kwan <dougkwan@google.com>
337
338 * arm.cc (Arm_relocate_functions::thm_jump8,
339 Arm_relocate_functions::thm_jump11): Use a wider signed
340 type to compute offset.
341 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
342 arm_thm_jump8.
343 * testsuite/Makefile.in: Regenerate.
344 * testsuite/arm_branch_in_range.sh: Check test results of
345 arm_thm_jump11 and arm_thm_jump8.
346 * testsuite/arm_thm_jump11.s: New test source file.
347 * testsuite/arm_thm_jump11.t: New linker script.
348 * testsuite/arm_thm_jump8.s: New test source file.
349 * testsuite/arm_thm_jump8.t: New linker script.
350
487b39df
ILT
3512011-06-24 Ian Lance Taylor <iant@google.com>
352
353 * layout.cc: Include "object.h".
354 (ctors_sections_in_init_array): New static variable.
355 (Layout::is_ctors_in_init_array): New function.
356 (Layout::layout): Add entry to ctors_sections_in_init_array if
357 appropriate.
358 * layout.h (class Layout): Declare is_ctors_in_init_array.
359 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
360 is_ctors_reverse_view is set.
361 (Sized_relobj_file::write_sections): Add layout parameter. Change
362 all callers. Set is_ctors_reverse_view field of View_size.
363 (Sized_relobj_file::reverse_words): New function.
364 * object.h (Sized_relobj_file::View_size): Add
365 is_ctors_reverse_view field.
366 (class Sized_relobj_file): Update declarations.
367 * testsuite/initpri3.c: New test.
368 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
369 initpri3b.
370 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
371 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
372 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
373 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
374 * testsuite/Makefile.in: Rebuild.
375
472076e4
CC
3762011-06-24 Cary Coutant <ccoutant@google.com>
377
378 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
379 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
380 (debug_msg_cdebug.err): New targets.
381 * testsuite/Makefile.in: Regenerate.
382 * testsuite/debug_msg.sh: Check output of link with compressed debug.
383 Fix checks for link with shared library.
384
a60af0db
DK
3852011-06-24 Doug Kwan <dougkwan@google.com>
386
387 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
388 skip empty text sections.
389 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
390
5393d741
ILT
3912011-06-22 Ian Lance Taylor <iant@google.com>
392
393 PR gold/12910
394 * options.h (class General_options): Add --ctors-in-init-array.
395 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
396 friends as SHT_PROGBITS for merging sections.
397 (Layout::layout): Remove special handling of .init_array and
398 friends. Don't sort if doing relocatable link. Sort for .ctors
399 and .dtors if ctors_in_init_array.
400 (Layout::make_output_section): Force correct section types for
401 .init_array and friends. Don't sort if doing relocatable link,
402 Don't sort .ctors and .dtors if ctors_in_init_array.
403 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
404 (Layout::output_section_name): Add relobj parameter. Change all
405 callers. Handle .ctors. and .dtors. in code rather than table.
406 Handle .ctors and .dtors if ctors_in_init_array.
407 (Layout::match_file_name): New function, moved from output.cc.
408 * layout.h (class Layout): Update declarations.
409 * output.cc: Include "layout.h".
410 (Input_section_sort_entry::get_priority): New function.
411 (Input_section_sort_entry::match_file_name): Just call
412 Layout::match_file_name.
413 (Output_section::Input_section_sort_init_fini_compare::operator()):
414 Handle .ctors and .dtors. Sort by explicit priority rather than
415 by name.
416 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
417 * testsuite/initpri2.c: New test.
418 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
419 (check_PROGRAMS): Add initpri2.
420 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
421 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
422 * configure, testsuite/Makefile.in: Rebuild.
423
e1f74f98
ILT
4242011-06-19 Ian Lance Taylor <iant@google.com>
425
426 PR gold/12880
427 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
428 .interp section to a PT_INTERP segment even if we have seen a
429 --dynamic-linker option. Don't do it if we have seen a PHDRS
430 clause in a linker script.
431 (Layout::finalize): Don't create a .interp section if we've
432 already create a PT_INTERP segment.
433 (Layout::create_interp): Always call choose_output_section (revert
434 patch of 2011-06-17). Don't create PT_INTERP segment.
435 * script-sections.cc
436 (Script_sections::create_note_and_tls_segments): Add a .interp
437 section to a PT_INTERP segment even if we have seen a
438 --dynamic-linker option.
439
766f91bb
ILT
4402011-06-18 Ian Lance Taylor <iant@google.com>
441
442 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
443 merely because a non-PT_LOAD segment has a dynamic reloc.
444
0d212c3a
ILT
4452011-06-18 Ian Lance Taylor <iant@google.com>
446
447 * layout.cc (Layout::finish_dynamic_section): Don't create
448 DT_FLAGS entry if not needed.
449
911a5072
ILT
4502011-06-18 Ian Lance Taylor <iant@google.com>
451
452 PR gold/12745
453 * layout.cc (Layout::layout_eh_frame): Correct handling of
454 writable .eh_frame section.
455
534b4e5f
ILT
4562011-06-17 Ian Lance Taylor <iant@google.com>
457
458 PR gold/12893
459 * resolve.cc (Symbol_table::resolve): Don't give an error if a
460 symbol is redefined with the exact same object and value.
461
10b4f102
ILT
4622011-06-17 Ian Lance Taylor <iant@google.com>
463
464 PR gold/12880
465 * layout.h (class Layout): Add interp_segment_ field.
466 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
467 (Layout::attach_allocated_section_to_segment): If making shared
468 library, put .interp section in PT_INTERP segment.
469 (Layout::finalize): Also call create_interp if -dynamic-linker
470 option was used.
471 (Layout::create_interp): Assert that there is no PT_INTERP
472 segment. If not using a SECTIONS clause, use make_output_section.
473 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
474 * script-sections.cc
475 (Script_sections::create_note_and_tls_segments): If making shared
476 library, put .interp section in PT_INTERP segment.
477
a29b0dad
ILT
4782011-06-17 Ian Lance Taylor <iant@google.com>
479
e588ea8d
ILT
480 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
481 when making a shared library.
482
4832011-06-17 Ian Lance Taylor <iant@google.com>
484
485 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
486 parameter. Change all callers. Don't issue warning about PC32
487 against locally defined symbol.
a29b0dad 488
9d3b0698
ILT
4892011-06-16 Ian Lance Taylor <iant@google.com>
490
491 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
492 occurs in same object.
493
85b0f90c
AM
4942011-06-14 Alan Modra <amodra@gmail.com>
495
496 * po/POTFILES.in: Regenerate.
497
a94907d9
ILT
4982011-06-09 Ian Lance Taylor <iant@google.com>
499
500 * script-sections.cc
501 (Orphan_output_section::set_section_addresses): For a relocatable
502 link set address to 0.
503
4fb3a1c3
CC
5042011-06-09 Cary Coutant <ccoutant@google.com>
505
506 PR gold/12804
507 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
508 used with --compress-debug-sections.
509 * gold/object.cc (Sized_relobj_file::do_layout): Report
510 uncompressed size of compressed input sections.
511
61220854
CC
5122011-06-08 Cary Coutant <ccoutant@google.com>
513
514 PR gold/12804
515 * testsuite/two_file_test_2_v1.cc: Change initialization of
516 v2 to keep it in .data.
517
e6455dfb
CC
5182011-06-07 Cary Coutant <ccoutant@google.com>
519
520 * common.cc (Symbol_table::do_allocate_commons_list): Call
521 gold_fallback.
522 * errors.cc (Errors::fatal): Adjust call to gold_exit.
523 (Errors::fallback): New function.
524 (gold_fallback): New function.
525 * errors.h (Errors::fallback): New function.
526 * gold.cc (gold_exit): Change status parameter to enum; adjust
527 all callers.
528 (queue_initial_tasks): Call gold_fallback.
529 * gold.h: Include cstdlib.
530 (Exit_status): New enum type.
531 (gold_exit): Change status parameter to enum.
532 (gold_fallback): New function.
533 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
534 (Layout::create_symtab_sections): Likewise.
535 (Layout::create_shdrs): Likewise.
536 * main.cc (main): Adjust call to gold_exit.
537 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
538 (Output_data_got::add_got_entry_pair): Likewise.
539 (Output_section::add_input_section): Likewise.
540 (Output_section::add_output_section_data): Likewise.
541 (Output_segment::set_section_list_addresses): Likewise.
542 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
543
fb0e076f
CC
5442011-06-07 Cary Coutant <ccoutant@google.com>
545
546 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
547 for incremental links.
548 * output.cc (Output_segment::set_section_list_addresses): Remove
549 FIXME and test for TLS or BSS.
550
a5ee4d5d
CC
5512011-06-07 Cary Coutant <ccoutant@google.com>
552
553 * testsuite/Makefile.am: Add incremental_copy_test,
554 incremental_common_test_1.
555 * testsuite/Makefile.in: Regenerate.
556 * testsuite/common_test_1_v1.c: New source file.
557 * testsuite/common_test_1_v2.c: New source file.
558 * testsuite/copy_test_v1.cc: New source file.
559
5146f448
CC
5602011-06-07 Cary Coutant <ccoutant@google.com>
561
562 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
563 update, allocate common from bss section's free list.
564 * incremental-dump.cc (dump_incremental_inputs): Print flag for
565 linker-defined symbols.
566 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
567 Skip GOT and PLT entries that are no longer referenced.
568 (Output_section_incremental_inputs::write_info_blocks): Mark
569 linker-defined symbols.
570 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
571 * output.cc (Output_section::allocate): New function.
572 * output.h (Output_section::allocate): New function.
573 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
574 linker-defined symbols.
575 (Symbol::override_base_with_special): Copy is_predefined_ flag.
576 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
577 (Symbol::init_base_output_data): Likewise.
578 (Symbol::init_base_output_segment): Likewise.
579 (Symbol::init_base_constant): Likewise.
580 (Sized_symbol::init_output_data): Likewise.
581 (Sized_symbol::init_output_segment): Likewise.
582 (Sized_symbol::init_constant): Likewise.
583 (Symbol_table::do_define_in_output_data): Likewise.
584 (Symbol_table::do_define_in_output_segment): Likewise.
585 (Symbol_table::do_define_as_constant): Likewise.
586 * symtab.h (Symbol::is_predefined): New function.
587 (Symbol::init_base_output_data): Add is_predefined parameter.
588 (Symbol::init_base_output_segment): Likewise.
589 (Symbol::init_base_constant): Likewise.
590 (Symbol::is_predefined_): New data member.
591 (Sized_symbol::init_output_data): Add is_predefined parameter.
592 (Sized_symbol::init_output_segment): Likewise.
593 (Sized_symbol::init_constant): Likewise.
594 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
595
26d3c67d
CC
5962011-06-07 Cary Coutant <ccoutant@google.com>
597
598 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
599 instead of emit_copy_reloc.
600 (Copy_relocs::emit_copy_reloc): Refactor.
601 (Copy_relocs::make_copy_reloc): New function.
602 (Copy_relocs::add_copy_reloc): Remove.
603 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
604 section.
605 (Copy_relocs::make_copy_reloc): New function.
606 (Copy_relocs::add_copy_reloc): Remove.
607 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
608 unchanged input files.
609 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
610 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
611 Reserve BSS space for COPY relocations.
612 (Sized_incremental_binary::do_emit_copy_relocs): New function.
613 (Output_section_incremental_inputs::write_info_blocks): Record
614 whether a symbol is copied from a shared object.
615 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
616 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
617 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
618 (Incremental_input_entry_reader::get_output_symbol_index): Add
619 is_copy parameter.
620 (Incremental_binary::emit_copy_relocs): New function.
621 (Incremental_binary::do_emit_copy_relocs): New function.
622 (Sized_incremental_binary::Sized_incremental_binary): Initialize
623 new data member.
624 (Sized_incremental_binary::add_copy_reloc): New function.
625 (Sized_incremental_binary::do_emit_copy_relocs): New function.
626 (Sized_incremental_binary::Copy_reloc): New struct.
627 (Sized_incremental_binary::Copy_relocs): New typedef.
628 (Sized_incremental_binary::copy_relocs_): New data member.
629 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
630 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
631 * target.h (Sized_target::emit_copy_reloc): New function.
632 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
633
7cdb37d9
CC
6342011-06-02 Cary Coutant <ccoutant@google.com>
635
636 PR gold/12163
637 * gold/archive.cc (Archive::Archive): Initialize new data member.
638 (Archive::include_all_members): Return if archive has already been
639 included.
640 * gold/archive.h (Archive::include_all_members_): New data member.
641
cc643b88
NC
6422011-06-02 Nick Clifton <nickc@redhat.com>
643
644 * dynobj.h: Fix spelling mistake in comment.
645 * output.cc: Likewise.
646
f62a3ca7
DK
6472011-05-31 Doug Kwan <dougkwan@google.com>
648 Asier Llano
649
650 PR gold/12826
cc643b88 651 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
652 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
653 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
654 redundant arm_exidx_test.so.
655 * testsuite/Makefile.in: Regenerate.
656 (check_SCRIPTS): Add pr12826.sh
657 (check_DATA): Add pr12826.stdout
658 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
659 * testsuite/pr12826.sh: New file.
660 * testsuite/pr12826_1.s: Ditto.
661 * testsuite/pr12826_1.s: Ditto.
662
8dbe1edc
ILT
6632011-05-30 Ian Lance Taylor <iant@google.com>
664
665 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
666 sections.
667
c49875be
ILT
6682011-05-29 Ian Lance Taylor <iant@google.com>
669
670 PR gold/12804
671 * testsuite/Makefile.am: Use different file name for two_file_test
672 temporary file for each incremental test.
673 * testsuite/Makefile.in: Rebuild.
674
69d53f7a
ILT
6752011-05-29 Ian Lance Taylor <iant@google.com>
676
677 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
678 binary input file is empty.
679
41d0ab5f
ILT
6802011-05-27 Ian Lance Taylor <iant@google.com>
681
682 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
683 (ver_test_9.so): Likewise.
684 * testsuite/Makefile.in: Rebuild.
685
89d8a36b
CC
6862011-05-26 Cary Coutant <ccoutant@google.com>
687
688 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
689 * incremental.cc (Incremental_inputs::report_input_section): Fix
690 comment, indentation.
691 (Incremental_inputs::report_comdat_group): New function.
692 (Output_section_incremental_inputs::set_final_data_size): Adjust size
693 of data for incremental input file entry.
694 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
695 group count, COMDAT group signatures.
696 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
697 an unchanged input file.
698 * incremental.h (Incremental_object_entry::Incremental_object_entry):
699 Initialize new data member.
700 (Incremental_object_entry::add_comdat_group): New function.
701 (Incremental_object_entry::get_comdat_group_count): New function.
702 (Incremental_object_entry::get_comdat_signature_key): New function.
703 (Incremental_object_entry::groups_): New data member.
704 (Incremental_inputs::report_comdat_group): New function.
705 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
706 data for incremental input file entry.
707 (Incremental_input_entry_reader::get_comdat_group_count): New function.
708 (Incremental_input_entry_reader::get_input_section): Adjust size of
709 data for incremental input file entry.
710 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
711 (Incremental_input_entry_reader::get_comdat_group_signature): New
712 function.
713 * object.cc (Sized_relobj::include_section_group): Report kept
714 COMDAT groups for incremental links.
715
1706a06f
ILT
7162011-05-24 David Meyer <pdox@google.com>
717
718 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
719 with name parameter. Add found_name parameter.
720 * fileread.cc (Input_file::find_file): Adjust code accordingly.
721 * dirsearch.h (class Dirsearch): Update declaration.
722
a10ae760
ILT
7232011-05-24 Ian Lance Taylor <iant@google.com>
724
725 * archive.cc (Library_base::should_include_member): Pull in object
726 from archive if it defines the entry symbol.
727 * parameters.cc (Parameters::entry): New function.
728 * parameters.h (class Parameters): Declare entry.
729 * output.h (class Output_file_header): Remove entry_ field.
730 * output.cc (Output_file_header::Output_file_header): Remove entry
731 parameter. Change all callers.
732 (Output_file_header::entry): Use parameters->entry.
733 * gold.cc (queue_middle_tasks): Likewise.
734 * plugin.cc (Plugin_hook::run): Likewise.
735
aa92d6ed
CC
7362011-05-24 Cary Coutant <ccoutant@google.com>
737
738 * gold.cc (queue_initial_tasks): Pass incremental base filename
739 to Output_file::open_base_file; don't print error message.
740 * incremental-dump.cc (main): Adjust call to
741 Output_file::open_for_modification.
742 * incremental-dump.cc (main): Likewise.
743 * incremental.cc (Incremental_inputs::report_command_line):
744 Ignore --incremental-base option when comparing command lines.
745 Ignore parameter when given as separate argument.
746 * options.h (class General_options): Add --incremental-base.
747 * output.cc (Output_file::Output_file):
748 (Output_file::open_base_file): Add base_name and writable parameters;
749 read base file into new file; print error message here.
750 (Output_file::map_no_anonymous): Add writable parameter; adjust all
751 callers.
752 * output.h (Output_file::open_for_modification): Rename to...
753 (Output_file::open_base_file): ...this; add base_name and
754 writable parameters; adjust all callers.
755 (Output_file::map_no_anonymous): Add writable parameter; adjust all
756 callers.
757 * testsuite/Makefile.am (incremental_test_4): Test
758 --incremental-base.
759 * testsuite/Makefile.in: Regenerate.
760
2eedd706
CC
7612011-05-24 Cary Coutant <ccoutant@google.com>
762
763 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
764 incremental_test_4.
765 * testsuite/Makefile.in: Regenerate.
766 * testsuite/two_file_test_1_v1.cc: New test source file.
767 * testsuite/two_file_test_1b_v1.cc: New test source file.
768 * testsuite/two_file_test_2_v1.cc: New test source file.
769
0f1c85a6
CC
7702011-05-24 Cary Coutant <ccoutant@google.com>
771
772 * dynobj.h (Dynobj::do_dynobj): New function.
773 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
774 flag and soname for shared objects.
775 * incremental.cc (Incremental_inputs::report_object): Make
776 either Incremental_object_entry or Incremental_dynobj_entry; add
777 soname to string table.
778 (Incremental_inputs::report_input_section): Add assertion.
779 (Output_section_incremental_inputs::set_final_data_size): Adjust
780 type of input file entry for shared libraries; adjust size of
781 shared library info entry.
782 (Output_section_incremental_inputs::write_input_files): Write
783 as_needed flag for shared libraries.
784 (Output_section_incremental_inputs::write_info_blocks): Adjust type
785 of input file entry for shared libraries; write soname.
786 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
787 soname from incremental info.
788 * incremental.h (enum Incremental_input_flags): Add
789 INCREMENTAL_INPUT_AS_NEEDED.
790 (Incremental_input_entry::Incremental_input_entry): Initialize new
791 data member.
792 (Incremental_input_entry::set_as_needed): New function.
793 (Incremental_input_entry::as_needed): New function.
794 (Incremental_input_entry::do_dynobj_entry): New function.
795 (Incremental_input_entry::as_needed_): New data member.
796 (Incremental_object_entry::Incremental_object_entry): Don't check
797 for shared library.
798 (Incremental_object_entry::do_type): Likewise.
799 (class Incremental_dynobj_entry): New class.
800 (Incremental_input_entry_reader::as_needed): New function.
801 (Incremental_input_entry_reader::get_soname): New function.
802 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
803 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
804 size of shared library info entry.
805 * layout.cc (Layout::finish_dynamic_section): Don't test for
806 incremental link when adding DT_NEEDED entries.
807 * object.h (Object::Object): Initialize new data member.
808 (Object::dynobj): New function.
809 (Object::set_as_needed): New function.
810 (Object::as_needed): New function.
811 (Object::do_dynobj): New function.
812 (Object::as_needed_): New data member.
813
6fa2a40b
CC
8142011-05-24 Cary Coutant <ccoutant@google.com>
815
816 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
817 info; adjust display of GOT entries.
818 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
819 vector of input objects; remove file_status_.
820 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
821 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
822 got_plt reader; call target hooks to reserve GOT entries.
823 (Output_section_incremental_inputs::set_final_data_size): Adjust size
824 of input file info header and GOT info entry.
825 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
826 relocation info.
827 (Got_plt_view_info::got_descriptor): Remove.
828 (Got_plt_view_info::sym_index): New data member.
829 (Got_plt_view_info::input_index): New data member.
830 (Local_got_offset_visitor::visit): Write input file index.
831 (Global_got_offset_visitor::visit): Write 0 for input file index.
832 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
833 with sym_index and input_index.
834 (Output_section_incremental_inputs::write_got_plt): Adjust size of
835 incremental info GOT entry; replace got_descriptor with input_index.
836 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
837 map from input file index to object.
838 (Sized_relobj_incr::do_layout): Replace direct data member reference
839 with accessor function.
840 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
841 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
842 Adjust size of input file info header.
843 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
844 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
845 (Incremental_input_entry_reader::get_input_section): Adjust size of
846 input file info header.
847 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
848 of incremental info GOT entry.
849 (Incremental_got_plt_reader::get_got_desc): Remove.
850 (Incremental_got_plt_reader::get_got_symndx): New function.
851 (Incremental_got_plt_reader::get_got_input_index): New function.
852 (Sized_incremental_binary::Sized_incremental_binary): Remove
853 file_status_; add input_objects_.
854 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
855 (Sized_incremental_binary::set_file_is_unchanged): Remove.
856 (Sized_incremental_binary::file_is_unchanged): Remove.
857 (Sized_incremental_binary::set_input_object): New function.
858 (Sized_incremental_binary::input_object): New function.
859 (Sized_incremental_binary::file_status_): Remove.
860 (Sized_incremental_binary::input_objects_): New data member.
861 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
862 references.
863 (Sized_relobj_incr::invalid_address): Move to base class.
864 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
865 class.
866 (Sized_relobj_incr::do_output_section_offset): Likewise.
867 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
868 (Sized_relobj_incr::section_offsets_): Likewise.
869 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
870 function.
871 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
872 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
873 with accessor function.
874 (Sized_relobj_file::do_layout): Likewise.
875 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
876 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
877 (Sized_relobj_file::compute_final_local_value): Replace refs to
878 section_offsets_ with accessor function.
879 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
880 * object.h (Relobj::Relobj): Initialize new data members.
881 (Relobj::add_dyn_reloc): New function.
882 (Relobj::first_dyn_reloc): New function.
883 (Relobj::dyn_reloc_count): New function.
884 (Relobj::first_dyn_reloc_): New data member.
885 (Relobj::dyn_reloc_count_): New data member.
886 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
887 references.
888 (Sized_relobj::Address): New typedef.
889 (Sized_relobj::invalid_address): Move here from child class.
890 (Sized_relobj::Sized_relobj): Initialize new data members.
891 (Sized_relobj::sized_relobj): New function.
892 (Sized_relobj::is_output_section_offset_invalid): Move here from
893 child class.
894 (Sized_relobj::get_output_section_offset): Likewise.
895 (Sized_relobj::local_has_got_offset): Likewise.
896 (Sized_relobj::local_got_offset): Likewise.
897 (Sized_relobj::set_local_got_offset): Likewise.
898 (Sized_relobj::do_for_all_local_got_entries): Likewise.
899 (Sized_relobj::clear_got_offsets): New function.
900 (Sized_relobj::section_offsets): Move here from child class.
901 (Sized_relobj::do_output_section_offset): Likewise.
902 (Sized_relobj::do_set_section_offset): Likewise.
903 (Sized_relobj::Local_got_offsets): Likewise.
904 (Sized_relobj::local_got_offsets_): Likewise.
905 (Sized_relobj::section_offsets_): Likewise.
906 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
907 references.
908 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
909 class.
910 (Sized_relobj_file::sized_relobj): New function
911 (Sized_relobj_file::local_has_got_offset): Move to base class.
912 (Sized_relobj_file::local_got_offset): Likewise.
913 (Sized_relobj_file::set_local_got_offset): Likewise.
914 (Sized_relobj_file::get_output_section_offset): Likewise.
915 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
916 (Sized_relobj_file::do_output_section_offset): Likewise.
917 (Sized_relobj_file::do_set_section_offset): Likewise.
918 (Sized_relobj_file::Local_got_offsets): Likewise.
919 (Sized_relobj_file::local_got_offsets_): Likewise.
920 (Sized_relobj_file::section_offsets_): Likewise.
921 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
922 (all constructors).
923 (set_needs_dynsym_index): Convert relobj to derived class pointer.
924 (Output_reloc::get_symbol_index): Likewise.
925 (Output_reloc::local_section_offset): Likewise.
926 (Output_reloc::get_address): Likewise.
927 (Output_reloc::symbol_value): Likewise.
928 (Output_data_got::reserve_slot): Move to class definition.
929 (Output_data_got::reserve_local): New function.
930 (Output_data_got::reserve_slot_for_global): Remove.
931 (Output_data_got::reserve_global): New function.
932 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
933 (all constructors, two instantiations).
934 (Output_reloc::get_relobj): New function (two instantiations).
935 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
936 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
937 (Output_data_reloc::add_global): Adjust type of relobj.
938 (Output_data_reloc::add_global_relative): Likewise.
939 (Output_data_reloc::add_symbolless_global_addend): Likewise.
940 (Output_data_reloc::add_local): Likewise.
941 (Output_data_reloc::add_local_relative): Likewise.
942 (Output_data_reloc::add_symbolless_local_addend): Likewise.
943 (Output_data_reloc::add_local_section): Likewise.
944 (Output_data_reloc::add_output_section): Likewise.
945 (Output_data_reloc::add_absolute): Likewise.
946 (Output_data_reloc::add_target_specific): Likewise.
947 (Output_data_got::reserve_slot): Move definition here.
948 (Output_data_got::reserve_local): New function.
949 (Output_data_got::reserve_global): New function.
950 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
951 section_offsets_ with accessor function.
952 (Sized_relobj_file::write_sections): Likewise.
953 (Sized_relobj_file::do_relocate_sections): Likewise.
954 * target.h (Sized_target::reserve_local_got_entry): New function.
955 (Sized_target::reserve_global_got_entry): New function.
956 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
957 (Target_x86_64::reserve_global_got_entry): New function.
958 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
959
4829d394
CC
9602011-05-23 Cary Coutant <ccoutant@google.com>
961
962 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
963 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
964 bit when checking got_type.
965 * incremental.cc (Sized_incremental_binary::setup_readers):
966 Store symbol table and string table locations; initialize bit vector
967 of file status flags.
968 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
969 unchanged files.
970 (Sized_incremental_binary::do_process_got_plt): New function.
971 (Sized_incremental_binary::get_symtab_view): Use stored locations.
972 (Output_section_incremental_inputs::set_final_data_size): Record
973 file index for each input file.
974 (Output_section_incremental_inputs::write_got_plt): Store file index
975 instead of input entry offset for each GOT entry.
976 * incremental.h
977 (Incremental_input_entry::Incremental_input_entry): Initialize new
978 data member.
979 (Incremental_input_entry::set_offset): Store file index.
980 (Incremental_input_entry::get_file_index): New function.
981 (Incremental_input_entry::file_index_): New data member.
982 (Incremental_binary::process_got_plt): New function.
983 (Incremental_binary::do_process_got_plt): New function.
984 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
985 data members.
986 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
987 (Sized_incremental_binary::set_file_is_unchanged): New function.
988 (Sized_incremental_binary::file_is_unchanged): New function.
989 (Sized_incremental_binary::do_process_got_plt): New function.
990 (Sized_incremental_binary::file_status_): New data member.
991 (Sized_incremental_binary::main_symtab_loc_): New data member.
992 (Sized_incremental_binary::main_strtab_loc_): New data member.
993 * output.cc (Output_data_got::Got_entry::write): Add case
994 RESERVED_CODE.
995 (Output_data_got::add_global): Call add_got_entry.
996 (Output_data_got::add_global_plt): Likewise.
997 (Output_data_got::add_global_with_rel): Likewise.
998 (Output_data_got::add_global_with_rela): Likewise.
999 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
1000 (Output_data_got::add_global_pair_with_rela): Likewise.
1001 (Output_data_got::add_local): Call add_got_entry.
1002 (Output_data_got::add_local_plt): Likewise.
1003 (Output_data_got::add_local_with_rel): Likewise.
1004 (Output_data_got::add_local_with_rela): Likewise.
1005 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
1006 (Output_data_got::add_local_pair_with_rela): Likewise.
1007 (Output_data_got::reserve_slot): New function.
1008 (Output_data_got::reserve_slot_for_global): New function.
1009 (Output_data_got::add_got_entry): New function.
1010 (Output_data_got::add_got_entry_pair): New function.
1011 (Output_section::add_output_section_data): Edit FIXME.
1012 * output.h
1013 (Output_section_data_build::Output_section_data_build): New
1014 constructor with size parameter.
1015 (Output_data_space::Output_data_space): Likewise.
1016 (Output_data_got::Output_data_got): Initialize new data member; new
1017 constructor with size parameter.
1018 (Output_data_got::add_constant): Call add_got_entry.
1019 (Output_data_got::reserve_slot): New function.
1020 (Output_data_got::reserve_slot_for_global): New function.
1021 (class Output_data_got::Got_entry): Add RESERVED_CODE.
1022 (Output_data_got::add_got_entry): New function.
1023 (Output_data_got::add_got_entry_pair): New function.
1024 (Output_data_got::free_list_): New data member.
1025 * target.h (Sized_target::init_got_plt_for_update): New function.
1026 (Sized_target::register_global_plt_entry): New function.
1027 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1028 Initialize new data member; call init; add constructor with PLT count.
1029 (Output_data_plt_x86_64::init): New function.
1030 (Output_data_plt_x86_64::add_relocation): New function.
1031 (Output_data_plt_x86_64::reserve_slot): New function.
1032 (Output_data_plt_x86_64::free_list_): New data member.
1033 (Target_x86_64::init_got_plt_for_update): New function.
1034 (Target_x86_64::register_global_plt_entry): New function.
1035 (Output_data_plt_x86_64::add_entry): Allocate from free list for
1036 incremental updates.
1037 (Output_data_plt_x86_64::add_relocation): New function.
1038 * testsuite/object_unittest.cc (Object_test): Set default options.
1039
ec69d6da
ILT
10402011-05-16 Ian Lance Taylor <iant@google.com>
1041
1042 * options.h (class General_options): Make -i a synonym for -r.
1043
732e31de
ILT
10442011-05-16 Ian Lance Taylor <iant@google.com>
1045
1046 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
1047
403676b5
CC
10482011-05-10 Cary Coutant <ccoutant@google.com>
1049
1050 * object.cc (Sized_relobj::do_count_local_symbols): Check for
1051 strip_all (-s).
1052
5b7b7d6e
ILT
10532011-05-06 Ian Lance Taylor <iant@google.com>
1054
1055 * layout.cc (Layout::layout): If the output section flags change,
1056 update the ordering.
1057
f0f9babf
CC
10582011-04-25 Cary Coutant <ccoutant@google.com>
1059
1060 * incremental-dump.cc (dump_incremental_inputs): Print local
1061 symbol info for each input file.
1062 * incremental.cc
1063 (Output_section_incremental_inputs::set_final_data_size): Add local
1064 symbol info to input file entries in incremental info.
1065 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1066 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
1067 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
1068 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
1069 implementation.
1070 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
1071 (Sized_incr_relobj::do_relocate): Write the local symbols.
1072 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1073 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1074 Adjust size of input file header.
1075 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1076 (Incremental_inputs_reader::get_local_symbol_count): New function.
1077 (Incremental_inputs_reader::get_input_section): Adjust size of input
1078 file header.
1079 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1080 (Sized_incr_relobj::This): New typedef.
1081 (Sized_incr_relobj::sym_size): New const data member.
1082 (Sized_incr_relobj::Local_symbol): New struct.
1083 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1084 (Sized_incr_relobj::do_local_symbol_offset): New function.
1085 (Sized_incr_relobj::local_symbol_count_): New data member.
1086 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1087 (Sized_incr_relobj::local_symbol_index_): New data member.
1088 (Sized_incr_relobj::local_symbol_offset_): New data member.
1089 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1090 (Sized_incr_relobj::local_symbols_): New data member.
1091 * object.h (Relobj::output_local_symbol_count): New function.
1092 (Relobj::local_symbol_offset): New function.
1093 (Relobj::do_output_local_symbol_count): New function.
1094 (Relobj::do_local_symbol_offset): New function.
1095 (Sized_relobj::do_output_local_symbol_count): New function.
1096 (Sized_relobj::do_local_symbol_offset): New function.
1097
d0a9ace3
ILT
10982011-04-22 Vladimir Simonov <sv@sw.ru>
1099
1100 * descriptors.cc (set_close_on_exec): New function.
1101 (Descriptors::open): Use set_close_on_exec.
1102 * output.cc (S_ISLNK): Define if not defined.
1103
94a3fc8b
CC
11042011-04-22 Cary Coutant <ccoutant@google.com>
1105
1106 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1107 global symbol map.
1108 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1109 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1110 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1111 relocations.
1112 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1113 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1114 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1115 * incremental.h
1116 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1117 function.
1118 (Incremental_binary::apply_incremental_relocs): New function.
1119 (Incremental_binary::do_apply_incremental_relocs): New function.
1120 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1121 data member.
1122 (Sized_incremental_binary::add_global_symbol): New function.
1123 (Sized_incremental_binary::global_symbol): New function.
1124 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1125 (Sized_incremental_binary::symbol_map_): New data member.
1126 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1127 * target.h (Sized_target::apply_relocation): New function.
1128 * target-reloc.h (apply_relocation): New function.
1129 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1130
c87e4302
DK
11312011-04-22 Doug Kwan <dougkwan@google.com>
1132
1133 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1134 flag of a SHT_ARM_EXIDX section.
1135 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1136 * testsuite/Makefile.in: Regenerate.
1137 * testsuite/arm_exidx_test.s: New file.
1138 * testsuite/arm_exidx_test.sh: Same.
1139
e7782cf6
CC
11402011-04-20 Cary Coutant <ccoutant@google.com>
1141
1142 PR gold/12689
1143 * archive.h (Incremental_archive_entry::Archive_member):
1144 Initialize arg_serial_ (second constructor).
1145
308ecdc7
ILT
11462011-04-17 Ian Lance Taylor <iant@google.com>
1147
1148 * object.cc (Relocate_info::location): Simplify location string.
1149 * errors.cc (Errors::error_at_location): Don't print program
1150 name.
1151 (Errors::warning_at_location): Likewise.
1152 (Errors::undefined_symbol): Likewise.
1153 * testsuite/debug_msg.sh: Update accordingly.
1154
bec5b579
CC
11552011-04-14 Cary Coutant <ccoutant@google.com>
1156
1157 * gold/layout.cc (Layout::symtab_section_offset): New function.
1158 * gold/layout.h (Layout::symtab_section_offset): New function.
1159 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1160
88597d34
ILT
11612011-04-12 Ian Lance Taylor <iant@google.com>
1162
1163 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1164 with MREMAP_MAYMOVE.
1165 * output.h (class Output_file): Add map_is_allocated_ field.
1166 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1167 not available, provide stubs. If mremap is not available, #define
1168 it to gold_mremap.
1169 (MREMAP_MAYMOVE): Define if not defined.
1170 (Output_file::Output_file): Initialize map_is_allocated_.
1171 (Output_file::resize): Check map_is_allocated_.
1172 (Output_file::map_anonymous): If mmap fails, use malloc.
1173 (Output_file::unmap): Don't do anything for an anonymous map.
1174 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1175 is not available, provide stubs.
1176 (File_read::View::~View): Use free rather than delete[].
1177 (File_read::make_view): Use malloc rather than new[]. If mmap
1178 fails, use malloc.
1179 (File_read::find_or_make_view): Use malloc rather than new[].
1180 * gold.h: Remove HAVE_REMAP code.
1181 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1182 exists. Rename mremap to gold_mremap. If mmap is not available
1183 don't do anything.
1184 * configure, config.in: Rebuild.
1185
11e361bc
ILT
11862011-04-11 Ian Lance Taylor <iant@google.com>
1187
1188 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1189 initialize local variable v.
1190
cdc29364
CC
11912011-04-11 Cary Coutant <ccoutant@google.com>
1192
1193 * archive.cc (Archive::include_member): Adjust call to
1194 report_object.
1195 (Add_archive_symbols::run): Track argument serial numbers.
1196 (Lib_group::include_member): Likewise.
1197 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1198 * archive.h (Incremental_archive_entry::Archive_member):
1199 Initialize arg_serial_.
1200 (Archive_member::arg_serial_): New data member.
1201 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1202 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1203 incremental link.
1204 (Sized_dynobj::do_for_all_local_got_entries): New function.
1205 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1206 function.
1207 * fileread.cc (get_mtime): New function.
1208 * fileread.h (get_mtime): New function.
1209 * gold.cc (queue_initial_tasks): Check for incremental update.
1210 (process_incremental_input): New function.
1211 (queue_middle_tasks): Don't force valid target for incremental
1212 update.
1213 * incremental-dump.cc (find_input_containing_global): Adjust
1214 size of symbol info entry.
1215 (dump_incremental_inputs): Dump argument serial number and
1216 in_system_directory flag; bias shndx by 1; print symbol names
1217 when dumping per-file symbol lists; use new symbol info readers.
1218 * incremental.cc
1219 (Output_section_incremental_inputs:update_data_size): New function.
1220 (Sized_incremental_binary::setup_readers): Setup input readers
1221 for each input file; build maps for files added from libraries
1222 and scripts.
1223 (Sized_incremental_binary::check_input_args): New function.
1224 (Sized_incremental_binary::do_check_inputs): Build map of argument
1225 serial numbers to input arguments.
1226 (Sized_incremental_binary::do_file_has_changed): Rename
1227 do_file_is_unchanged to this; compare file modification times.
1228 (Sized_incremental_binary::do_init_layout): New function.
1229 (Sized_incremental_binary::do_reserve_layout): New function.
1230 (Sized_incremental_binary::do_get_input_reader): Remove.
1231 (Sized_incremental_binary::get_symtab_view): New function.
1232 (Incremental_checker::can_incrementally_link_output_file): Remove.
1233 (Incremental_inputs::report_command_line): Exclude --debug options.
1234 (Incremental_inputs::report_archive_begin): Add parameter; track
1235 argument serial numbers; don't put input file entry for archive
1236 before archive members.
1237 (Incremental_inputs::report_archive_end): Put input file entry
1238 for archive after archive members.
1239 (Incremental_inputs::report_object): Add parameter; track argument
1240 serial numbers and in_system_directory flag.
1241 (Incremental_inputs::report_script): Add parameter; track argument
1242 serial numbers.
1243 (Output_section_incremental_inputs::set_final_data_size): Adjust
1244 size of symbol info entry; check for forwarding symbols.
1245 (Output_section_incremental_inputs::write_input_files): Write
1246 in_system_directory flag and argument serial number.
1247 (Output_section_incremental_inputs::write_info_blocks): Map section
1248 indices between incremental info and original input file; store
1249 input section index for each symbol.
1250 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1251 change operator() to visit().
1252 (class Global_got_offset_visitor): Likewise.
1253 (class Global_symbol_visitor_got_plt):
1254 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1255 classes.
1256 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1257 (Sized_incr_relobj::do_read_symbols): New function.
1258 (Sized_incr_relobj::do_layout): New function.
1259 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1260 (Sized_incr_relobj::do_add_symbols): New function.
1261 (Sized_incr_relobj::do_should_include_member): New function.
1262 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1263 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1264 (Sized_incr_relobj::do_section_size): New function.
1265 (Sized_incr_relobj::do_section_name): New function.
1266 (Sized_incr_relobj::do_section_contents): New function.
1267 (Sized_incr_relobj::do_section_flags): New function.
1268 (Sized_incr_relobj::do_section_entsize): New function.
1269 (Sized_incr_relobj::do_section_address): New function.
1270 (Sized_incr_relobj::do_section_type): New function.
1271 (Sized_incr_relobj::do_section_link): New function.
1272 (Sized_incr_relobj::do_section_info): New function.
1273 (Sized_incr_relobj::do_section_addralign): New function.
1274 (Sized_incr_relobj::do_initialize_xindex): New function.
1275 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1276 (Sized_incr_relobj::do_read_relocs): New function.
1277 (Sized_incr_relobj::do_gc_process_relocs): New function.
1278 (Sized_incr_relobj::do_scan_relocs): New function.
1279 (Sized_incr_relobj::do_count_local_symbols): New function.
1280 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1281 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1282 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1283 (Sized_incr_relobj::do_relocate): New function.
1284 (Sized_incr_relobj::do_set_section_offset): New function.
1285 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1286 (Sized_incr_dynobj::do_read_symbols): New function.
1287 (Sized_incr_dynobj::do_layout): New function.
1288 (Sized_incr_dynobj::do_add_symbols): New function.
1289 (Sized_incr_dynobj::do_should_include_member): New function.
1290 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1291 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1292 (Sized_incr_dynobj::do_section_size): New function.
1293 (Sized_incr_dynobj::do_section_name): New function.
1294 (Sized_incr_dynobj::do_section_contents): New function.
1295 (Sized_incr_dynobj::do_section_flags): New function.
1296 (Sized_incr_dynobj::do_section_entsize): New function.
1297 (Sized_incr_dynobj::do_section_address): New function.
1298 (Sized_incr_dynobj::do_section_type): New function.
1299 (Sized_incr_dynobj::do_section_link): New function.
1300 (Sized_incr_dynobj::do_section_info): New function.
1301 (Sized_incr_dynobj::do_section_addralign): New function.
1302 (Sized_incr_dynobj::do_initialize_xindex): New function.
1303 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1304 (make_sized_incremental_object): New function.
1305 (Incremental_library::copy_unused_symbols): New function.
1306 (Incremental_library::do_for_all_unused_symbols): New function.
1307 * incremental.h (enum Incremental_input_flags): New type.
1308 (class Incremental_checker): Remove.
1309 (Incremental_input_entry::Incremental_input_entry): Add argument
1310 serial number.
1311 (Incremental_input_entry::arg_serial): New function.
1312 (Incremental_input_entry::set_is_in_system_directory): New function.
1313 (Incremental_input_entry::is_in_system_directory): New function.
1314 (Incremental_input_entry::arg_serial_): New data member.
1315 (Incremental_input_entry::is_in_system_directory_): New data member.
1316 (class Script_info): Move here from script.h.
1317 (Script_info::Script_info): Add filename parameter.
1318 (Script_info::filename): New function.
1319 (Script_info::filename_): New data member.
1320 (Incremental_script_entry::Incremental_script_entry): Add argument
1321 serial number.
1322 (Incremental_object_entry::Incremental_object_entry): Likewise.
1323 (Incremental_object_entry::add_input_section): Build list of input
1324 sections with map to original shndx.
1325 (Incremental_object_entry::get_input_section_index): New function.
1326 (Incremental_object_entry::shndx_): New data member.
1327 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1328 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1329 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1330 serial number.
1331 (Incremental_inputs::report_archive_begin): Likewise.
1332 (Incremental_inputs::report_object): Likewise.
1333 (Incremental_inputs::report_script): Likewise.
1334 (class Incremental_global_symbol_reader): New class.
1335 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1336 and store flags and input file type.
1337 (Incremental_input_entry_reader::arg_serial): New function.
1338 (Incremental_input_entry_reader::type): Extract type from flags.
1339 (Incremental_input_entry_reader::is_in_system_directory): New function.
1340 (Incremental_input_entry_reader::get_input_section_count): Call
1341 accessor function for type.
1342 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1343 function for type; adjust size of global symbol entry.
1344 (Incremental_input_entry_reader::get_global_symbol_count): Call
1345 accessor function for type.
1346 (Incremental_input_entry_reader::get_object_count): Likewise.
1347 (Incremental_input_entry_reader::get_object_offset): Likewise.
1348 (Incremental_input_entry_reader::get_member_count): Likewise.
1349 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1350 (Incremental_input_entry_reader::get_member_offset): Likewise.
1351 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1352 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1353 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1354 (Incremental_input_entry_reader::get_global_symbol_reader): New
1355 function.
1356 (Incremental_input_entry_reader::get_output_symbol_index): New
1357 function.
1358 (Incremental_input_entry_reader::type_): Remove.
1359 (Incremental_input_entry_reader::flags_): New data member.
1360 (Incremental_inputs_reader::input_file_offset): New function.
1361 (Incremental_inputs_reader::input_file_index): New function.
1362 (Incremental_inputs_reader::input_file): Call input_file_offset.
1363 (Incremental_inputs_reader::input_file_at_offset): New function.
1364 (Incremental_relocs_reader::get_r_type): Reformat.
1365 (Incremental_relocs_reader::get_r_shndx): Reformat.
1366 (Incremental_relocs_reader::get_r_offset): Reformat.
1367 (Incremental_relocs_reader::data): New function.
1368 (Incremental_binary::Incremental_binary): Initialize new data members.
1369 (Incremental_binary::check_inputs): Add cmdline parameter.
1370 (Incremental_binary::file_is_unchanged): Remove.
1371 (Input_reader::arg_serial): New function.
1372 (Input_reader::get_unused_symbol_count): New function.
1373 (Input_reader::get_unused_symbol): New function.
1374 (Input_reader::do_arg_serial): New function.
1375 (Input_reader::do_get_unused_symbol_count): New function.
1376 (Input_reader::do_get_unused_symbol): New function.
1377 (Incremental_binary::input_file_count): New function.
1378 (Incremental_binary::get_input_reader): Change signature to use
1379 index instead of filename.
1380 (Incremental_binary::file_has_changed): New function.
1381 (Incremental_binary::get_input_argument): New function.
1382 (Incremental_binary::get_library): New function.
1383 (Incremental_binary::get_script_info): New function.
1384 (Incremental_binary::init_layout): New function.
1385 (Incremental_binary::reserve_layout): New function.
1386 (Incremental_binary::output_file): New function.
1387 (Incremental_binary::do_check_inputs): New function.
1388 (Incremental_binary::do_file_is_unchanged): Remove.
1389 (Incremental_binary::do_file_has_changed): New function.
1390 (Incremental_binary::do_init_layout): New function.
1391 (Incremental_binary::do_reserve_layout): New function.
1392 (Incremental_binary::do_input_file_count): New function.
1393 (Incremental_binary::do_get_input_reader): Change signature.
1394 (Incremental_binary::input_args_map_): New data member.
1395 (Incremental_binary::library_map_): New data member.
1396 (Incremental_binary::script_map_): New data member.
1397 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1398 new data members.
1399 (Sized_incremental_binary::output_section): New function.
1400 (Sized_incremental_binary::inputs_reader): Add const.
1401 (Sized_incremental_binary::symtab_reader): Add const.
1402 (Sized_incremental_binary::relocs_reader): Add const.
1403 (Sized_incremental_binary::got_plt_reader): Add const.
1404 (Sized_incremental_binary::get_symtab_view): New function.
1405 (Sized_incremental_binary::Inputs_reader): New typedef.
1406 (Sized_incremental_binary::Input_entry_reader): New typedef.
1407 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1408 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1409 (Sized_incremental_binary::do_file_has_changed): New function.
1410 (Sized_incremental_binary::do_init_layout): New function.
1411 (Sized_incremental_binary::do_reserve_layout): New function.
1412 (Sized_input_reader::Inputs_reader): Remove.
1413 (Sized_input_reader::Input_entry_reader): Remove.
1414 (Sized_input_reader::do_arg_serial): New function.
1415 (Sized_input_reader::do_get_unused_symbol_count): New function.
1416 (Sized_input_reader::do_get_unused_symbol): New function.
1417 (Sized_incremental_binary::do_input_file_count): New function.
1418 (Sized_incremental_binary::do_get_input_reader): Change signature;
1419 use index instead of filename.
1420 (Sized_incremental_binary::section_map_): New data member.
1421 (Sized_incremental_binary::input_entry_readers_): New data member.
1422 (class Sized_incr_relobj): New class.
1423 (class Sized_incr_dynobj): New class.
1424 (make_sized_incremental_object): New function.
1425 (class Incremental_library): New class.
1426 * layout.cc (Free_list::num_lists): New static data member.
1427 (Free_list::num_nodes): New static data member.
1428 (Free_list::num_removes): New static data member.
1429 (Free_list::num_remove_visits): New static data member.
1430 (Free_list::num_allocates): New static data member.
1431 (Free_list::num_allocate_visits): New static data member.
1432 (Free_list::init): New function.
1433 (Free_list::remove): New function.
1434 (Free_list::allocate): New function.
1435 (Free_list::dump): New function.
1436 (Free_list::print_stats): New function.
1437 (Layout_task_runner::run): Resize output file for incremental updates.
1438 (Layout::Layout): Initialize new data members.
1439 (Layout::set_incremental_base): New function.
1440 (Layout::init_fixed_output_section): New function.
1441 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1442 incremental updates.
1443 (Layout::create_gold_note): Do not create gold note section for
1444 incremental updates.
1445 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1446 for incremental updates.
1447 (Layout::set_section_offsets): For incremental updates, allocate space
1448 from free list.
1449 (Layout::create_symtab_sections): Layout with offsets relative to
1450 start of section; for incremental updates, allocate space from free
1451 list.
1452 (Layout::create_shdrs): For incremental updates, allocate space from
1453 free list.
1454 (Layout::finish_dynamic_section): For incremental updates, do not
1455 check --as-needed (fixed in subsequent patch).
1456 * layout.h (class Free_list): New class.
1457 (Layout::set_incremental_base): New function.
1458 (Layout::incremental_base): New function.
1459 (Layout::init_fixed_output_section): New function.
1460 (Layout::allocate): New function.
1461 (Layout::incremental_base_): New data member.
1462 (Layout::free_list_): New data member.
1463 * main.cc (main): Print Free_list statistics.
1464 * object.cc (Relobj::finalize_incremental_relocs): Add
1465 clear_counts parameter; clear counts only when clear_counts is set.
1466 (Sized_relobj::Sized_relobj): Initialize new base class.
1467 (Sized_relobj::do_layout): Don't report special sections.
1468 (Sized_relobj::do_for_all_local_got_entries): New function.
1469 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1470 symtab_off to all symbol table offsets.
1471 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1472 * object.h (class Got_offset_list): Move to top of file.
1473 (Object::Object): Allow case where input_file == NULL.
1474 (Object::~Object): Likewise.
1475 (Object::input_file): Assert that input_file != NULL.
1476 (Object::lock): Allow case where input_file == NULL.
1477 (Object::unlock): Likewise.
1478 (Object::is_locked): Likewise.
1479 (Object::token): Likewise.
1480 (Object::release): Likewise.
1481 (Object::is_incremental): New function.
1482 (Object::get_mtime): New function.
1483 (Object::for_all_local_got_entries): New function.
1484 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1485 (Object::set_is_in_system_directory): New function.
1486 (Object::is_in_system_directory): New function.
1487 (Object::do_is_incremental): New function.
1488 (Object::do_get_mtime): New function.
1489 (Object::do_for_all_local_got_entries): New function.
1490 (Object::is_in_system_directory_): New data member.
1491 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1492 (class Sized_relobj_base): New class.
1493 (class Sized_relobj): Derive from Sized_relobj_base.
1494 (class Sized_relobj::Symbols): Redeclare from base class.
1495 (class Sized_relobj::local_got_offset_list): Remove.
1496 (class Sized_relobj::Output_sections): Redeclare from base class.
1497 (class Sized_relobj::do_for_all_local_got_entries): New function.
1498 (class Sized_relobj::write_local_symbols): Add offset parameter.
1499 (class Sized_relobj::local_symbol_offset_): Update comment.
1500 (class Sized_relobj::local_dynsym_offset_): Update comment.
1501 * options.cc (Input_arguments::add_file): Remove const.
1502 * options.h (Input_file_argument::Input_file_argument):
1503 Initialize arg_serial_ (all constructors).
1504 (Input_file_argument::set_arg_serial): New function.
1505 (Input_file_argument::arg_serial): New function.
1506 (Input_file_argument::arg_serial_): New data member.
1507 (Input_arguments::Input_arguments): Initialize file_count_.
1508 (Input_arguments::add_file): Remove const.
1509 (Input_arguments::number_of_input_files): New function.
1510 (Input_arguments::file_count_): New data member.
1511 (Command_line::number_of_input_files): Call
1512 Input_arguments::number_of_input_files.
1513 * output.cc (Output_segment_headers::Output_segment_headers):
1514 Set current size.
1515 (Output_section::Input_section::current_data_size): New function.
1516 (Output_section::Output_section): Initialize new data members.
1517 (Output_section::add_input_section): Don't do merge sections for
1518 an incremental link; allocate space from free list for an
1519 incremental update.
1520 (Output_section::add_output_section_data): Allocate space from
1521 free list for an incremental update.
1522 (Output_section::update_data_size): New function.
1523 (Output_section::set_fixed_layout): New function.
1524 (Output_section::reserve): New function.
1525 (Output_segment::set_section_addresses): Remove const.
1526 (Output_segment::set_section_list_addresses): Remove const; allocate
1527 space from free list for an incremental update.
1528 (Output_segment::set_offset): Adjust size of RELRO segment for an
1529 incremental update.
1530 * output.h (Output_data::current_data_size): Move here from
1531 child classes.
1532 (Output_data::pre_finalize_data_size): New function.
1533 (Output_data::update_data_size): New function.
1534 (Output_section_headers::update_data_size): new function.
1535 (Output_section_data_build::current_data_size): Move to Output_data.
1536 (Output_data_strtab::update_data_size): New function.
1537 (Output_section::current_data_size): Move to Output_data.
1538 (Output_section::set_fixed_layout): New function.
1539 (Output_section::has_fixed_layout): New function.
1540 (Output_section::reserve): New function.
1541 (Output_section::update_data_size): New function.
1542 (Output_section::has_fixed_layout_): New data member.
1543 (Output_section::free_list_): New data member.
1544 (Output_segment::set_section_addresses): Remove const.
1545 (Output_segment::set_section_list_addresses): Remove const.
1546 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1547 New function.
1548 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1549 New function.
1550 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1551 parameter when calling Add_symbols constructor; store argument
1552 serial number for members of a lib group.
1553 (Add_symbols::locks): Allow case where token == NULL.
1554 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1555 (Read_member::~Read_member): New function.
1556 (Read_member::is_runnable): New function.
1557 (Read_member::locks): New function.
1558 (Read_member::run): New function.
1559 (Check_script::~Check_script): New function.
1560 (Check_script::is_runnable): New function.
1561 (Check_script::locks): New function.
1562 (Check_script::run): New function.
1563 (Check_library::~Check_library): New function.
1564 (Check_library::is_runnable): New function.
1565 (Check_library::locks): New function.
1566 (Check_library::run): New function.
1567 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1568 (Add_symbols::library_): New data member.
1569 (class Read_member): New class.
1570 (class Check_script): New class.
1571 (class Check_library): New class.
1572 * reloc.cc (Read_relocs::is_runnable): Allow case where
1573 token == NULL.
1574 (Read_relocs::locks): Likewise.
1575 (Scan_relocs::locks): Likewise.
1576 (Relocate_task::locks): Likewise.
1577 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1578 to clear counters.
1579 (Sized_relobj::incremental_relocs_scan): Fix comment.
1580 (Sized_relobj::do_relocate): Pass output file offset to
1581 write_local_symbols.
1582 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1583 from class declaration.
1584 * script.cc (read_input_script): Allocate Script_info; pass
1585 argument serial number to report_script.
1586 * script.h (class Script_info): Move to incremental.h.
1587 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1588 * symtab.h (Symbol_table::add_from_incrobj): New function.
1589 (Symbol_table::set_file_offset): New function.
1590
b961d0d7
CC
15912011-04-05 Cary Coutant <ccoutant@google.com>
1592
1593 * incremental-dump.cc (dump_incremental_inputs): Change signature
1594 to take a Sized_incremental_binary; change caller. Use readers
1595 in Sized_incremental_binary.
1596 * incremental.cc
1597 (Sized_incremental_binary::find_incremental_inputs_sections):
1598 Rename do_find_incremental_inputs_sections to this.
1599 (Sized_incremental_binary::setup_readers): New function.
1600 (Sized_incremental_binary::do_check_inputs): Check
1601 has_incremental_info_ flag; move setup code to setup_readers;
1602 use input readers.
1603 (Sized_incremental_binary::do_file_is_unchanged): New function.
1604 (Sized_incremental_binary::do_get_input_reader): New function.
1605 * incremental.h (class Incremental_binary): Move to end of file.
1606 (Incremental_binary::file_is_unchanged): New function.
1607 (Incremental_binary::do_file_is_unchanged): New function.
1608 (Incremental_binary::Input_reader): New class.
1609 (Incremental_binary::get_input_reader): New function.
1610 (class Sized_incremental_binary): Move to end of file.
1611 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1612 input section reader classes.
1613 (Sized_incremental_binary::has_incremental_info): New function.
1614 (Sized_incremental_binary::inputs_reader): New function.
1615 (Sized_incremental_binary::symtab_reader): New function.
1616 (Sized_incremental_binary::relocs_reader): New function.
1617 (Sized_incremental_binary::got_plt_reader): New function.
1618 (Sized_incremental_binary::do_file_is_unchanged): New function.
1619 (Sized_incremental_binary::Sized_input_reader): New class.
1620 (Sized_incremental_binary::get_input_reader): New function.
1621 (Sized_incremental_binary::find_incremental_inputs_sections):
1622 Rename do_find_incremental_inputs_sections to this.
1623 (Sized_incremental_binary::setup_readers): New function.
1624 (Sized_incremental_binary::has_incremental_info_): New data member.
1625 (Sized_incremental_binary::inputs_reader_): New data member.
1626 (Sized_incremental_binary::symtab_reader_): New data member.
1627 (Sized_incremental_binary::relocs_reader_): New data member.
1628 (Sized_incremental_binary::got_plt_reader_): New data member.
1629 (Sized_incremental_binary::current_input_file_): New data member.
1630
a869183f
PP
16312011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1632
1633 PR gold/12640
1634 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1635 violation.
1636
16372011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
1638
1639 * archive.cc (Archive::include_member): Adjust call to report_object.
1640 (Add_archive_symbols::run): Add script_info to call to
1641 report_archive_begin.
1642 (Lib_group::include_member): Adjust call to report_object.
1643 (Add_lib_group_symbols::run): Adjust call to report_object.
1644 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1645 blocks. Add object count for script input files.
1646 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1647 script_info parameter; change all callers.
1648 (Incremental_inputs::report_object): Add script_info parameter;
1649 change all callers.
1650 (Incremental_inputs::report_script): Store backpointer to
1651 incremental info entry.
1652 (Output_section_incremental_inputs::set_final_data_size): Record
1653 additional information for scripts.
1654 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1655 * incremental.h (Incremental_script_entry::add_object): New function.
1656 (Incremental_script_entry::get_object_count): New function.
1657 (Incremental_script_entry::get_object): New function.
1658 (Incremental_script_entry::objects_): New data member; adjust
1659 constructor.
1660 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1661 (Incremental_inputs::report_object): Add script_info parameter.
1662 (Incremental_inputs_reader::get_object_count): New function.
1663 (Incremental_inputs_reader::get_object_offset): New function.
1664 * options.cc (Input_arguments::add_file): Return reference to
1665 new input argument.
1666 * options.h (Input_argument::set_script_info): New function.
1667 (Input_argument::script_info): New function.
1668 (Input_argument::script_info_): New data member; adjust all
1669 constructors.
1670 (Input_file_group::add_file): Return reference to new input argument.
1671 (Input_file_lib::add_file): Likewise.
1672 (Input_arguments::add_file): Likewise.
1673 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1674 * script.cc (Parser_closure::Parser_closure): Add script_info
1675 parameter; adjust all callers.
1676 (Parser_closure::script_info): New function.
1677 (Parser_closure::script_info_): New data member.
1678 (read_input_script): Report scripts earlier to incremental info.
1679 (script_add_file): Set script_info in Input_argument.
1680 (script_add_library): Likewise.
1681 * script.h (Script_options::Script_info): Rewrite class.
1682
a869183f 16832011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
1684
1685 * archive.cc (Library_base::should_include_member): Move
1686 method here from class Archive.
1687 (Archive::Archive): Initialize base class.
1688 (Archive::should_include_member): Move to base class.
1689 (Archive::do_for_all_unused_symbols): New function.
1690 (Add_archive_symbols::run): Remove redundant access to
1691 incremental_inputs.
1692 (Lib_group::Lib_group): Initialize base class.
1693 (Lib_group::do_filename): New function.
1694 (Lib_group::include_member): Pass pointer to Lib_group to
1695 report_object.
1696 (Lib_group::do_for_all_unused_symbols): New function.
1697 (Add_lib_group_symbols::run): Report archive information for
1698 incremental links.
1699 * archive.h (class Library_base): New base class.
1700 (class Archive): Derive from Library_base.
1701 (Archive::filename): Move to base class.
1702 (Archive::set_incremental_info): Likewise.
1703 (Archive::incremental_info): Likewise.
1704 (Archive::Should_include): Likewise.
1705 (Archive::should_include_member): Likewise.
1706 (Archive::Armap_entry): Remove.
1707 (Archive::Unused_symbol_iterator): Remove.
1708 (Archive::unused_symbols_begin): Remove.
1709 (Archive::unused_symbols_end): Remove.
1710 (Archive::do_filename): New function.
1711 (Archive::do_get_mtime): New function.
1712 (Archive::do_for_all_unused_symbols): New function.
1713 (Archive::task_): Move to base class.
1714 (Archive::incremental_info_): Likewise.
1715 (class Lib_group): Derive from Library_base.
1716 (Lib_group::do_filename): New function.
1717 (Lib_group::do_get_mtime): New function.
1718 (Lib_group::do_for_all_unused_symbols): New function.
1719 (Lib_group::task_): Move to base class.
1720 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1721 function.
1722 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1723 function.
1724 * incremental.cc (Incremental_inputs::report_archive_begin):
1725 Use Library_base; call library's get_mtime; add incremental inputs
1726 entry before members.
1727 (class Unused_symbol_visitor): New class.
1728 (Incremental_inputs::report_archive_end): Use Library_base; use
1729 visitor class to record unused symbols; don't add incremental inputs
1730 entry after members.
1731 (Incremental_inputs::report_object): Use Library_base.
1732 * incremental.h
1733 (Incremental_archive_entry::Incremental_archive_entry): Remove
1734 unused Archive parameter.
1735 (Incremental_inputs::report_archive_begin): Use Library_base.
1736 (Incremental_inputs::report_archive_end): Likewise.
1737 (Incremental_inputs::report_object): Likewise.
1738 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1739 function.
1740 * object.h (Object::for_all_global_symbols): New function.
1741 (Object::do_for_all_global_symbols): New function.
1742 (Sized_relobj::do_for_all_global_symbols): New function.
1743 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1744 function.
1745 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1746 function.
1747
61ab3e40
ILT
17482011-03-27 Ian Lance Taylor <iant@google.com>
1749
1750 * archive.cc (Archive::interpret_header): Return -1 if something
1751 goes wrong. Change callers accordingly.
1752
30e1f9e6
CC
17532011-03-25 Cary Coutant <ccoutant@google.com>
1754
1755 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1756 * testsuite/Makefile.in: Regenerate.
1757
9c793f14
RÁE
17582010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1759
1760 * plugin.cc (get_view): New.
1761 (Plugin::load): Pass get_view to the plugin.
1762 (Plugin_manager::get_view): New.
1763
9312bb0a
ILT
17642011-03-21 Ian Lance Taylor <iant@google.com>
1765
1766 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 1767 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 1768
7e12ba9e
ST
17692011-03-21 Sriraman Tallam <tmsriram@google.com>
1770
1771 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1772 Change == to -eq.
1773 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1774 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1775 Change == to -eq.
1776 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1777 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1778
fd7a005d
ILT
17792011-03-14 Ian Lance Taylor <iant@google.com>
1780
1781 * script-sections.cc (Sort_output_sections::script_compare):
1782 Rename from is_before, change return type.
1783 (Sort_output_sections::operator()): Adjust accordingly.
1784
ed16fd1b
ILT
17852011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1786
1787 PR gold/12572
1788 * testsuite/odr_violation2.cc: Add comment to make all error line
1789 numbers double digits.
1790 * testsuite/debug_msg.sh: Adjust expected errors.
1791
71ff8986
ILT
17922011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1793
1794 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1795 but mark earlier ones as non-canonical
1796 (offset_to_iterator): Update search target and example
1797 (do_addr2line): Return extra lines in a vector*
1798 (format_file_lineno): Extract from do_addr2line
1799 (one_addr2line): Add vector* out-param
1800 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1801 when a lineno entry appeared last for its instruction
1802 (Dwarf_line_info): Add vector* out-param
1803 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1804 * symtab.cc (Odr_violation_compare): Include the lineno in the
1805 comparison again.
1806 (linenos_from_loc): New. Combine the canonical line for an
1807 address with its other lines.
1808 (True_if_intersect): New. Helper functor to make
1809 std::set_intersection a query.
1810 (detect_odr_violations): Compare sets of lines instead of just
1811 one line for each function. This became less deterministic, but
1812 has fewer false positives.
1813 * symtab.h: Declarations.
1814 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1815 mix an optimized and non-optimized object in the same binary
1816 (odr_violation2.so): Same.
1817 * testsuite/Makefile.in: Regenerate from Makefile.am.
1818 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1819 * testsuite/debug_msg.sh: Update line numbers and add
1820 assertions.
1821 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1822 non-optimized context.
1823 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1824 isn't inlined, and use OdrDerived in an optimized context.
1825 * testsuite/odr_header1.h: Defines OdrDerived, where
1826 optimization will change the
1827 first-instruction-in-the-destructor's file and line number.
1828 * testsuite/odr_header2.h: Defines OdrBase.
1829
a19fefdc
ILT
18302011-03-09 Ian Lance Taylor <iant@google.com>
1831
1832 * fileread.cc (File_read::clear_views): Don't delete the whole
1833 file view.
1834
ecb351e9
ILT
18352011-03-08 Ian Lance Taylor <iant@google.com>
1836
1837 PR gold/12525
1838 * fileread.cc: #include <climits>.
1839 (GOLD_IOV_MAX): Define.
1840 (File_read::read_multiple): Limit number of entries by iov_max.
1841 * fileread.h (class File_read): Always set max_readv_entries to
1842 128.
1843
b821d13c
ILT
18442011-03-07 Ian Lance Taylor <iant@google.com>
1845
1846 PR gold/12525
1847 * options.h (class General_options): Add -dy and -dn.
1848
89243142
CC
18492011-03-02 Cary Coutant <ccoutant@google.com>
1850
1851 * testsuite/script_test_9.t: Add TLS segment.
1852
d0773f31
ILT
18532011-03-02 Simon Baldwin <simonb@google.com>
1854
1855 * configure.ac: Add check for gnu_indirect_function support in
1856 the toolchain building binutils.
1857 * configure: Rebuild.
1858
badc8139
RÁE
18592010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1860
1861 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1862 plugin only symbols.
1863 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1864 in plugin files as not needed in the symbol table.
1865
4cf7a849
ST
18662011-02-11 Sriraman Tallam <tmsriram@google.com>
1867
1868 * output.cc (Output_section::add_input_section): Delay fill
1869 generation for section ordering.
1870
b578bd7d
ILT
18712011-02-09 Ian Lance Taylor <iant@google.com>
1872
1873 PR gold/12316
1874 * object.h (class Sized_relobj): Remove clear_local_symbols.
1875 * reloc.cc (Sized_relobj::do_relocate): Don't call
1876 clear_local_symbols.
1877
84ced98a
RÁE
18782010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1879
1880 * plugin.cc (is_visible_from_outside): Return true for symbols
1881 in the -u option.
1882
55382fb7
ILT
18832011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1884
1885 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1886 filename.
1887
4e271fff
ST
18882011-02-02 Sriraman Tallam <tmsriram@google.com>
1889
1890 * icf.h (is_section_foldable_candidate): Change type of parameter
1891 to std::string.
1892 * icf.cc (Icf::find_identical_sections): Change type of local variable
1893 section_name to be std::string.
1894 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1895
d433c3ac
ILT
18962011-01-25 Ian Lance Taylor <iant@google.com>
1897
1898 * script.cc (script_add_extern): Rewrite to use
1899 add_symbol_reference.
1900
880473a6
DK
19012011-01-25 Doug Kwan <dougkwan@google.com>
1902
d433c3ac 1903 * icf.cc (get_section_contents): Always lock section's object.
880473a6 1904
f30f86fa
ILT
19052011-01-24 Ian Lance Taylor <iant@google.com>
1906
1907 * options.h (class General_options): Accept
1908 --no-detect-odr-violations.
1909
8e51a0b9
ILT
19102011-01-24 Ian Lance Taylor <iant@google.com>
1911
1912 * version.cc (version_string): Bump to 1.11.
1913
0f3b89d8
ILT
19142011-01-24 Ian Lance Taylor <iant@google.com>
1915
1916 * plugin.cc (class Plugin_rescan): Define new class.
1917 (Plugin_manager::claim_file): Set any_claimed_.
1918 (Plugin_manager::save_archive): New function.
1919 (Plugin_manager::save_input_group): New function.
1920 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1921 necessary.
1922 (Plugin_manager::new_undefined_symbol): New function.
1923 (Plugin_manager::rescan): New function.
1924 (Plugin_manager::rescannable_defines): New function.
1925 (Plugin_manager::add_input_file): Set any_added_.
1926 * plugin.h (class Plugin_manager): define new fields rescannable_,
1927 undefined_symbols_, any_claimed_, and any_added_. Declare
1928 Plugin_rescan as friend. Declare new functions.
1929 (Plugin_manager::Rescannable): Define type.
1930 (Plugin_manager::Rescannable_list): Define type.
1931 (Plugin_manager::Undefined_symbol_list): Define type.
1932 (Plugin_manager::Plugin_manager): Initialize new fields.
1933 * archive.cc (Archive::defines_symbol): New function.
1934 (Add_archive_symbols::run): Pass archive to plugins if any.
1935 * archive.h (class Archive): Declare defines_symbol.
1936 * readsyms.cc (Input_group::~Input_group): New function.
1937 (Finish_group::run): Pass input_group to plugins if any.
1938 * readsyms.h (class Input_group): Declare destructor.
1939 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1940 any.
1941
3bb951e5
ILT
19422011-01-10 Ian Lance Taylor <iant@google.com>
1943
1944 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1945 section as relro.
1946 (Layout::set_segment_offsets): Reset increase_relro before calling
1947 set_section_addresses a second time.
1948
0aa45fac
CC
19492011-01-04 Cary Coutant <ccoutant@google.com>
1950
1951 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1952 sections before NOBITS sections.
1953
0db46eb4
L
19542011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1955
1956 * version.cc (print_version): Update copyright to 2011.
1957
829c9745
CC
19582010-12-23 Cary Coutant <ccoutant@google.com>
1959
1960 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1961 of OS to this->add. Add OD parameter to second form of the function.
1962
7500420b
ILT
19632010-12-20 Ian Lance Taylor <iant@google.com>
1964
1965 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1966 second of two consecutive entries with same offset.
1967
f8e9a930
RW
19682010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1969
1970 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1971 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1972 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1973 to avoid unneeded links against $(LDADD).
1974 * testsuite/Makefile.in: Regenerate.
1975
2fbb4320
ILT
19762010-12-15 Ian Lance Taylor <iant@google.com>
1977
1978 PR gold/12324
1979 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1980 for R_X86_64_32 and R_X86_64_PC32.
1981 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1982 ver_matching_def_pic.o.
1983 (ver_matching_def_pic.o): New target.
1984
fedb228d
RW
19852010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1986
1987 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1988 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1989 Move definition before File_read::View member definitions.
1990 (File_read::View::~View): Initialize and hold lock before
1991 updating current_mapped_bytes.
1992
9b547ce6
RW
19932010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1994
1995 * dwarf_reader.cc: Remove outdated comment.
1996 * gold-threads.cc: Fix typo in error message.
1997 * archive.cc: Fix typos in comments.
1998 * archive.h: Likewise.
1999 * arm-reloc-property.cc: Likewise.
2000 * arm-reloc-property.h: Likewise.
2001 * arm-reloc.def: Likewise.
2002 * arm.cc: Likewise.
2003 * attributes.h: Likewise.
2004 * cref.cc: Likewise.
2005 * ehframe.cc: Likewise.
2006 * fileread.h: Likewise.
2007 * gold.h: Likewise.
2008 * i386.cc: Likewise.
2009 * icf.cc: Likewise.
2010 * incremental.h: Likewise.
2011 * int_encoding.cc: Likewise.
2012 * layout.h: Likewise.
2013 * main.cc: Likewise.
2014 * merge.h: Likewise.
2015 * object.cc: Likewise.
2016 * object.h: Likewise.
2017 * options.cc: Likewise.
2018 * readsyms.cc: Likewise.
2019 * reduced_debug_output.cc: Likewise.
2020 * reloc.cc: Likewise.
2021 * script-sections.cc: Likewise.
2022 * sparc.cc: Likewise.
2023 * symtab.h: Likewise.
2024 * target-reloc.h: Likewise.
2025 * target.cc: Likewise.
2026 * target.h: Likewise.
2027 * timer.cc: Likewise.
2028 * timer.h: Likewise.
2029 * x86_64.cc: Likewise.
2030
83e17bd5
CC
20312010-12-09 Cary Coutant <ccoutant@google.com>
2032
2033 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
2034 stack.
2035 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
2036 parameter; change all callers.
2037 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
2038 * options.h (warn_execstack): New option.
2039
017257f8
DK
20402010-12-07 Doug Kwan <dougkwan@google.com>
2041
2042 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
2043 like function call relocations.
2044
c20cbc06
ILT
20452010-12-07 Ian Lance Taylor <iant@google.com>
2046
2047 * archive.cc (Archive::get_elf_object_for_member): Permit
2048 punconfigured to be NULL.
2049 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
2050 (Archive::include_member): Pass NULL to get_elf_object_for_member
2051 if we searched for the archive and this is the first included
2052 object.
2053
4dbfafcc
ILT
20542010-12-01 Ian Lance Taylor <iant@google.com>
2055
2056 * dwarf_reader.h (class Sized_dwarf_line_info): Add
2057 track_relocs_type_ field.
2058 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2059 Set track_relocs_type_.
2060 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
2061 contents when using RELA relocs.
2062 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
2063 reloc_map_.
2064 * reloc.cc (Track_relocs::next_addend): New function.
2065 * reloc.h (class Track_relocs): Declare next_addend.
2066
e5e19edd
ILT
20672010-12-01 Ian Lance Taylor <iant@google.com>
2068
2069 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
2070 virtual destructor.
2071
9a5ce24c
ILT
20722010-12-01 Ian Lance Taylor <iant@google.com>
2073
2074 * README: Update compilers known to work and fail.
2075
c7791212
NC
20762010-11-23 Matthias Klose <doko@ubuntu.com>
2077
2078 * configure.in: For --enable-gold, handle value `default' instead of
2079 `both*'. Always install ld as ld.bfd, install as ld if gold is
2080 not the default.
2081 * configure: Regenerate.
2082
0ad220c9
DK
20832010-11-18 Doug Kwan <dougkwan@google.com>
2084
2085 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2086 and right_alignment to be zero. Store result alignment only if it is
2087 greater than existing alignment.
2088
ab8056e0
CC
20892010-11-16 Cary Coutant <ccoutant@google.com>
2090
2091 PR gold/12220
2092 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2093 Check for ".zdebug_line".
2094
fd064a5b
CC
20952010-11-16 Doug Kwan <dougkwan@google.com>
2096 Cary Coutant <ccoutant@google.com>
2097
2098 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2099 by reference; adjust all callers.
2100 * output.cc (Output_segment::set_section_addresses): Adjust references
2101 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2102 list is empty.
2103 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2104 end at page boundary.
2105
6fc6ea19
CC
21062010-11-16 Cary Coutant <ccoutant@google.com>
2107
2108 PR gold/12220
2109 * layout.cc (Layout::choose_output_section): Transform names of
2110 compressed sections even when using a script with a SECTIONS clause.
2111 (Layout::output_section_name): Remove code to transform
2112 compressed debug section names.
2113 * output.cc (Output_section::add_input_section): Use uncompressed
2114 section size when tracking input sections.
2115
95a2c8d6
RS
21162010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2117
2118 * symtab.h (Symbol::NON_PIC_REF): Remove.
2119 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2120 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2121 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2122 (Symbol::use_plt_offset): Take a flags argument and pass it
2123 directly to needs_dynamic_reloc. Restrict check for undefined
2124 weak symbols to function calls.
2125 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2126 (Target_arm::Scan::global): Use it.
2127 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2128 (Target_arm::Relocate::relocate): Likewise.
2129 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2130 parameter with an r_type parameter. Use get_reference_flags
2131 to get the flags.
2132 (Target_arm::Relocate::relocate): Update accordingly.
2133 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2134 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2135 (Target_i386::Scan::global): Likewise.
2136 (Target_i386::Relocate::relocate): Likewise.
2137 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2138 parameter with an r_type parameter. Use get_reference_flags
2139 to get the flags.
2140 (Target_i386::Relocate::relocate): Update accordingly.
2141 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2142 (Target_powerpc::Scan::global): Use it.
2143 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2144 (Target_powerpc::Relocate::relocate): Likewise.
2145 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2146 (Target_sparc::Scan::global): Use it.
2147 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2148 (Target_sparc::Relocate::relocate): Likewise.
2149 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2150 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2151 (Target_x86_64::Scan::global): Likewise.
2152 (Target_x86_64::Relocate::relocate): Likewise.
2153
f625ae50
DK
21542010-11-08 Doug Kwan <dougkwan@google.com>
2155 Cary Coutant <ccoutant@google.com>
2156
2157 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2158 (Arm_exidx_merge_section::section_contents_): New data member.
2159 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2160 (Arm_input_section::~Arm_input_section): De-allocate memory.
2161 (Arm_input_section::original_contents_): New data member.
2162 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2163 in parameters instead of calling Object::section_contents without
2164 locking.
2165 (Arm_output_section::group_section): New parameter TASK. Pass it
2166 to callees that need locking objects.
2167 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2168 to lock EXIDX input sections. Fix a formatting issue. Call
2169 Arm_exidx_merged_section::build_contents to create merged section
2170 contents.
2171 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2172 to lock object of stub table owner.
2173 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2174 TEXT_SIZE to initialize data member TEXT_SIZE_.
2175 (Arm_exidx_input_section::addralign): Fix typo in comment.
2176 (Arm_exidx_input_section::text_size): New method.
2177 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2178 that require locking objects. Lock objects before scanning for stubs
2179 and updating local symbols.
2180 (Arm_input_section<big_endian>::init): Copy contents of original
2181 input section.
2182 (Arm_input_section<big_endian>::do_write): Use saved contents of
2183 original input section instead of calling Object::section_contents
2184 without locking.
2185 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2186 size without calling Object::section_size().
2187 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2188 for size. Allocate a buffer for merged EXIDX entries.
2189 (Arm_exidx_merged_section::build_contents): New method.
2190 (Arm_exidx_merged_section::do_write): Move merge section contents
2191 building code to Arm_exidx_merged_section::build_contetns. Write
2192 out contetns in buffer instead of building it on the fly.
2193 (Arm_relobj::make_exidx_input_section): Also pass text section size
2194 to Arm_exidx_input_section constructor.
2195 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2196 (Arm_dynobj::do_read_symbols): Fix memory leak.
2197 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2198 * target.h: (class Task): Add forward declaration.
2199 (Target::relax): Add new parameter TASK and pass it to
2200 Target::do_relax().
2201 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2202
5f9bcf58
CC
22032010-11-05 Cary Coutant <ccoutant@google.com>
2204
2205 PR gold/10708
2206 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2207 object when reading from the file.
2208 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2209 second layout pass.
2210 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2211 when reading section contents.
2212 (get_section_contents): Likewise.
2213 (icf::find_identical_sections): Likewise.
2214 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2215 object when reading from the file.
2216 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2217 the object when doing deferred section layout.
2218
e597fa08
NC
22192010-11-03 Nick Clifton <nickc@redhat.com>
2220
2221 PR gold/12001
2222 * script.h (class Symbol_assignment: name): New member. Returns
2223 the name of the symbol.
2224 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2225 Returns true if the given symbol name is on the list of
2226 assignments wating to be processed.
2227 * archive.cc (should_incldue_member): If the symbol is undefined,
2228 check to see if it is on the list of symbols pending assignment.
2229
3f9a3278
ILT
22302010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2231
2232 * script-sections.cc (Script_sections::find_memory_region): Check
2233 for a NULL output section pointer.
2234
d06fb4d1
DK
22352010-10-29 Doug Kwan <dougkwan@google.com>
2236
2237 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2238 Output_section::add_relaxed_input_section.
2239 * output.cc (Output_section::add_relaxed_input_section): Add new
2240 arguments LAYOUT and NAME. Set section order index.
2241 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2242 Copy section order index.
2243 * output.h (Output_section::add_relaxed_input_section): Add new
2244 arguments LAYOUT and NAME.
2245
90e24de5
ILT
22462010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2247
2248 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2249 NATIVE_OR_CROSS_LINKER.
2250 * testsuite/Makefile.in: Regenerate.
2251
c9484ea5
DK
22522010-10-20 Doug Kwan <dougkwan@google.com>
2253
2254 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2255 without SHF_LINK_ORDER flags.
2256 * layout.cc (Layout::choose_output_section): Do not filter
2257 SHF_LINK_ORDER flag in a relocatable link.
2258
5bc2f5be
CC
22592010-10-17 Cary Coutant <ccoutant@google.com>
2260
2261 * output.h (Output_segment::set_section_addresses): Change function
2262 signature. Update all callers.
2263 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2264 sections.
2265 (Output_segment::set_section_addresses): Align after last TLS
2266 section. Add padding before last relro section instead of after.
2267
0c91cf04
DK
22682010-10-17 Doug Kwan <dougkwan@google.com>
2269
2270 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2271 GOT output section to be writable.
2272
8c21d9d3
CC
22732010-10-14 Cary Coutant <ccoutant@google.com>
2274
2275 * debug.h (DEBUG_INCREMENTAL): New flag.
2276 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2277 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2278 mode.
2279 * incremental.cc (report_command_line): Ignore all forms of
2280 --incremental.
2281 * layout.cc (Layout::Layout): Check parameters for incremental link
2282 mode.
2283 * options.cc (General_options::parse_incremental): New function.
2284 (General_options::parse_no_incremental): New function.
2285 (General_options::parse_incremental_full): New function.
2286 (General_options::parse_incremental_update): New function.
2287 (General_options::incremental_mode_): New data member.
2288 (General_options::finalize): Check incremental_mode_.
2289 * options.h (General_options): Update help text for --incremental.
2290 Add --no-incremental, --incremental-full, --incremental-update.
2291 (General_options::Incremental_mode): New enum type.
2292 (General_options::incremental_mode): New function.
2293 (General_options::incremental_mode_): New data member.
2294 * parameters.cc (Parameters::incremental_mode_): New data member.
2295 (Parameters::set_options): Set incremental_mode_.
2296 (Parameters::set_incremental_full): New function.
2297 (Parameters::incremental): New function.
2298 (Parameters::incremental_update): New function.
2299 (set_parameters_incremental_full): New function.
2300 * parameters.h (Parameters::set_incremental_full): New function.
2301 (Parameters::incremental): New function.
2302 (Parameters::incremental_update): New function.
2303 (Parameters::incremental_mode_): New data member.
2304 (set_parameters_incremental_full): New function.
2305 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2306 incremental link mode.
2307 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2308 (Sized_relobj::do_relocate_sections): Likewise.
2309 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2310 option.
2311 * testsuite/Makefile.in: Regenerate.
2312 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2313
bb32aa18 23142010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
2315
2316 * script-sections.h (class Script_sections): Make
2317 Sections_elements typedef public.
2318 * script-sections.cc (class Sort_output_sections): Add elements_
2319 field. Add constructor which sets it; change all callers.
2320 (Sort_output_sections::is_before): New function.
2321 (Sort_output_sections::operator()): Call is_before.
2322 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2323 conditional.
2324 * testsuite/script_test_10.sh: New test. Test script section
2325 order.
2326 * testsuite/script_test_10.t: Likewise.
2327 * testsuite/script_test_10.s: Likewise.
2328 * testsuite/Makefile.am: Wrap the cross linker tests and the
2329 common tests into NATIVE_OR_CROSS_LINKER.
2330 (check_SCRIPTS): Add script_test_10.sh.
2331 (check_DATA): Add script_test_10.stdout.
2332 (script_test_10.o, script_test_10): New targets.
2333 (script_test_10.stdout): New target.
2334 * configure, testsuite/Makefile.in: Regenerate.
2335
3cef7179
ILT
23362010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2337
2338 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2339 error for the deprecated relocations.
2340 (Target_arm::Scan::global): Likewise.
2341 (Target_arm::Relocate::relocate): Likewise.
2342
7411e9a8
RS
23432010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2344
2345 * fileread.cc (Input_file::find_file): Initialize *found_name
2346 and *namep when using the fallback search for case 4.
2347
6a9da32a
CC
23482010-10-11 Cary Coutant <ccoutant@google.com>
2349
2350 * options.h (class General_options): Redefine -z lazy as an alias for
2351 the negation of -z now.
2352
ac897c20
ILT
23532010-10-11 Ian Lance Taylor <iant@google.com>
2354
2355 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2356 binding.
2357
ea5cae92
NC
23582010-10-06 Nick Clifton <nickc@redhat.com>
2359
2360 * script-sections.cc(class Memory_region): Remove
2361 current_lma_offset_ field. Rename current_vma_offset_ to
2362 current_offset_. Add last_section_ field.
2363 (Memory_region::get_current_vma_address): Rename to
2364 get_current_address.
2365 (Memory_region::get_current_lma_address): Delete.
2366 (Memory_region::increment_vma_offset): Rename to
2367 increment_offset.
2368 (Memory_region::increment_lma_offset): Delete.
2369 (Memory_region::attributes_compatible): New method. Returns
2370 true if the provided section is compatible with the region.
2371 (Memory_region::get_last_section): New method. Returns the last
2372 section to use the region.
2373 (Memory_region::set_last_section): New method. Stores the last
2374 section to use the region.
2375 (Script_sections::block_in_region): New method. Returns true if
2376 a block of memory is contained within a region.
2377 (Script_sections::find_memory_region): New method. Locates a
2378 memory region to be used to set a VMA or LMA address.
2379 (Output_section_definition::set_section_addresses): Add code to
2380 check for addresses set by memory regions.
2381 (Output_segment::set_section_addresses): Remove memory region
2382 walking code.
2383 (Script_sections::create_segment): Add a warning if a header
2384 segment is created outside of any region.
2385 * script-sections.h (class Script_sections): Add prototypes for
2386 find_memory_region and block_in_region methods.
2387 * testsuite/memory_test.s: Use .long instead of .word.
2388 * testsuite/memory_test.t: Add some more output sections.
2389 * testsuite/memory_test.sh: Update expected output.
2390
a9bfd952
DK
23912010-10-02 Doug Kwan <dougkwan@google.com>
2392
2393 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2394 defintion to symtab.h
2395 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2396 declaration to defintion.
2397
bacff3ab
NC
23982010-10-01 Nick Clifton <nickc@redhat.com>
2399
2400 * expression.cc (eval): Replace dummy argument with NULL.
2401 (eval_maybe_dot): Check for a NULL result section pointer.
2402 (Symbol_expression::value): Likewise.
2403 (Dot_expression::value): Likewise.
2404 (BINARY_EXPRESSION): Likewise.
2405 (Max_expression::value): Likewise.
2406 (Min_expression::value): Likewise.
2407 (Absolute_expression::value): Likewise.
2408 (Addr_expression::value_from_output_section): Likewise.
2409 (Loaddddr_expression::value_from_output_section): Likewise.
2410 (Segment_start_expression::value): Likewise.
2411 * script-sections.cc
2412 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2413 argument with NULL.
2414 (Sections_elememt_dot_assignment::set_section_addresses):
2415 Likewise.
2416 (Output_data_expression::do_write_to_buffer): Likewise.
2417 (Output_section_definition::finalize_symbols): Likewise.
2418 (Output_section_definition::set_section_addresses): Likewise.
2419
f81bc8b5
DK
24202010-09-30 Doug Kwan <dougkwan@google.com>
2421
2422 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2423
c95e9f27
ST
24242010-09-28 Sriraman Tallam <tmsriram@google.com>
2425
2426 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 2427 function.
c95e9f27
ST
2428 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2429 virtual function.
2430 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2431 virtual function.
2432 * icf.cc (get_section_contents): Inline merge sections only when
2433 target allows it.
2434
3cac54d2
RW
24352010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2436
2437 * configure: Regenerate.
2438
2904037a
ILT
24392010-09-17 Ian Lance Taylor <iant@google.com>
2440
2441 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
2442 * testsuite/Makefile.am (memory_test.o): New target.
2443 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2444 memory_test.t.
2445 * testsuite/Makefile.in: Rebuild.
2904037a 2446
bca7fb63
DK
24472010-09-17 Doug Kwan <dougkwan@google.com>
2448
2449 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2450 defintion if relocation uses GOT entries of the symbol.
2451 * testsuite/icf_safe_test.sh: Fix test.
2452 * testsuite/icf_safe_so_test.sh: Fix test.
2453
4ef28648
CC
24542010-09-16 Cary Coutant <ccoutant@google.com>
2455
2456 * script_sections.cc (class Memory_region): Remove "NULL" from
2457 vector initializations.
2458
793990de
CC
24592010-09-15 Cary Coutant <ccoutant@google.com>
2460
2461 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2462 Resolve forwarding symbols.
2463
81e015e2
DK
24642010-09-15 Doug Kwan <dougkwan@google.com>
2465
2466 * gold/testsuite/script_test_3.t: Add ARM special sections.
2467 * gold/testsuite/script_test_4.t: Same.
2468 * gold/testsuite/script_test_5.t: Same.
2469 * gold/testsuite/script_test_6.t: Same.
2470 * gold/testsuite/script_test_7.t: Same.
2471 * gold/testsuite/script_test_7.t: Same.
2472 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2473
36171d64
CC
24742010-09-14 Cary Coutant <ccoutant@google.com>
2475
2476 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2477 (Target_x86_64::Relocate::relocate_tls): Replace check for
2478 saw_tls_block_reloc_ with test for executable section.
2479
d89051bd
CC
24802010-09-12 Cary Coutant <ccoutant@google.com>
2481
2482 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2483 position-independent executables to shared libraries need dynamic
2484 relocations.
2485 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2486 position-independent executables.
2487 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2488 * testsuite/Makefile.in: Regenerate.
2489
fca41f0f
NC
24902010-09-10 Nick Clifton <nickc@redhat.com>
2491
2492 PR gold/11997
2493 * testsuite/memory_test.t: Discard any sections that are not
2494 needed.
2495
6695e4b3
L
24962010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2497
2498 PR gold/11996
2499 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2500 "This::" to work around a bug in gcc 4.2.
2501
2502 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2503
0f72bf6f
RÁE
25042010-09-09 Rafael Espindola <espindola@google.com>
2505
2506 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2507 sections with different PF_X flags in the same segment.
2508 (Layout::find_first_load_seg): Search all segments to find the first
2509 one.
2510 * options.h (rosegment): New.
2511
25122010-09-08 Rafael Espindola <espindola@google.com>
a6577478 2513
05a79166 2514 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 2515
aa98ff75
DK
25162010-09-08 Doug Kwan <dougkwan@google.com>
2517
2518 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2519 (Arm_relobj::do_relocate_sections): Add new parameter for output
2520 file to match the parent.
2521 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2522 of local symbols instead of input values. Update code to track
2523 changes in gold::relocate_section.
2524 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2525 (Sized_relobj::compute_final_local_value_internal): New methods.
2526 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2527 body into private version of Sized_relobj::compute_final_local_value.
2528 Call the inline method.
2529 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2530 merged symbol value if there is one.
2531 (Symbol_value::has_output_value): New method defintiion.
2532 (Sized_relobj::Compute_final_local_value_status): New enum type.
2533 (Sized_relobj::compute_final_local_value): New methods.
2534 (Sized_relobj::compute_final_local_value_internal): New methods.
2535 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2536 and arm_cortex_a8.sh.
2537 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2538 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2539 New tests.
2540 * Makefile.in: Regenerate.
2541 * testsuite/arm_bl_out_of_range.s: Update test.
2542 * testsuite/thumb_bl_out_of_range.s: Ditto.
2543 * testsuite/thumb_blx_out_of_range.s: Ditto.
2544 * testsuite/arm_branch_out_of_range.sh: New file.
2545 * testsuite/arm_cortex_a8.sh: Ditto.
2546 * testsuite/arm_cortex_a8_b.s: Ditto.
2547 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2548 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2549 * testsuite/arm_cortex_a8_bl.s: Ditto.
2550 * testsuite/arm_cortex_a8_blx.s: Ditto.
2551 * testsuite/arm_cortex_a8_local.s: Ditto.
2552 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2553 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2554
05a79166
L
25552010-09-08 Rafael Espindola <espindola@google.com>
2556
2557 * Makefile.am (memory_test.stdout): Run readelf with -W.
2558 * Makefile.in: Regenerate.
2559 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2560 64 bit output.
2561
33dbc701
RÁE
25622010-09-08 Rafael Espindola <espindola@google.com>
2563
2564 * script-sections.cc (Script_sections::add_memory_region): Convert
2565 field precision to int.
2566 * script.cc (script_set_section_region, script_set_section_region):
2567 Convert field precision to int.
2568
731ca54a
RÁE
25692010-09-08 Rafael Espindola <espindola@google.com>
2570
2571 * arm.cc (do_finalize_sections): Create the __exidx_start and
2572 __exdix_end symbols even when the section is missing.
2573
7f8cd844
NC
25742010-09-08 Nick Clifton <nickc@redhat.com>
2575
2576 * README: Remove claim that MEMORY is not supported.
2577 * expression.cc (script_exp_function_origin)
2578 (script_exp_function_length): Move from here to ...
2579 * script.cc: ... here.
2580 (script_set_section_region, script_add_memory)
2581 (script_parse_memory_attr, script_include_directive): New
2582 functions.
2583 * script-sections.cc
2584 (class Memory_region): New class.
2585 (class Output_section_definition): Add set_memory_region,
2586 set_section_vma, set_section_lma and get_section_name methods.
2587 (class Script_Sections): Add add_memory_region,
2588 find_memory_region, find_memory_region_origin,
2589 find_memory_region_length and set_memory_region methods.
2590 Have set_section_addresses method walk the list of set memory
2591 regions.
2592 Extend the print methos to display memory regions.
2593 * script-sections.h: Add prototypes for new methods.
2594 Add enum for MEMORY region attributes.
2595 * yyscript.y: Add support for parsing MEMORY regions.
2596 * script-c.h: Add prototypes for new functions.
2597 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2598 * testsuite/Makefile.in: Regenerate.
2599 * testsuite/memory_test.sh: New script.
2600 * testsuite/memory_test.s: New assembler source file.
2601 * testsuite/memory_test.t: New linker script.
2602
a4649286
DK
26032010-08-27 Doug Kwan <dougkwan@google.com>
2604
2605 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2606 reference override an existing dynamic weak reference.
2607 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2608 * testsuite/Makefile.in: Regenerate.
2609 * testsuite/dyn_weak_ref.sh: New file.
2610 * testsuite/dyn_weak_ref_1.c: Ditto.
2611 * testsuite/dyn_weak_ref_2.c: Ditto.
2612
b56648ad
ILT
26132010-08-27 Ian Lance Taylor <iant@google.com>
2614
2615 * incremental.h (class Incremental_input_entry): Add virtual
2616 destructor.
2617
809313cb
ILT
26182010-08-27 Ian Lance Taylor <iant@google.com>
2619
2620 * testsuite/start_lib_test_3.c: Mark t3 as used.
2621
11e32464
NC
26222010-08-27 Nick Clifton <nickc@redhat.com>
2623
2624 * options.cc (version_script): Fix small typo in previous
2625 whitespace tidyup.
2626
ca09d69a
NC
26272010-08-25 Nick Clifton <nickc@redhat.com>
2628
2629 * archive.cc: Formatting fixes: Remove whitespace between
2630 typename and following asterisk. Remove whitespace between
2631 function name and opening parenthesis.
2632 * archive.h: Likewise.
2633 * arm.cc: Likewise.
2634 * attributes.cc: Likewise.
2635 * attributes.h: Likewise.
2636 * common.cc: Likewise.
2637 * copy-relocs.cc: Likewise.
2638 * dirsearch.h: Likewise.
2639 * dynobj.cc: Likewise.
2640 * ehframe.cc: Likewise.
2641 * ehframe.h: Likewise.
2642 * expression.cc: Likewise.
2643 * fileread.cc: Likewise.
2644 * fileread.h: Likewise.
2645 * gc.h: Likewise.
2646 * gold-threads.cc: Likewise.
2647 * gold.cc: Likewise.
2648 * i386.cc: Likewise.
2649 * icf.h: Likewise.
2650 * incremental-dump.cc: Likewise.
2651 * incremental.cc: Likewise.
2652 * layout.cc: Likewise.
2653 * layout.h: Likewise.
2654 * main.cc: Likewise.
2655 * merge.cc: Likewise.
2656 * merge.h: Likewise.
2657 * object.cc: Likewise.
2658 * object.h: Likewise.
2659 * options.cc: Likewise.
2660 * options.h: Likewise.
2661 * output.cc: Likewise.
2662 * output.h: Likewise.
2663 * plugin.cc: Likewise.
2664 * plugin.h: Likewise.
2665 * powerpc.cc: Likewise.
2666 * reloc.cc: Likewise.
2667 * script-c.h: Likewise.
2668 * script-sections.cc: Likewise.
2669 * script.cc: Likewise.
2670 * stringpool.cc: Likewise.
2671 * symtab.cc: Likewise.
2672 * symtab.h: Likewise.
2673 * target.cc: Likewise.
2674 * timer.cc: Likewise.
2675 * timer.h: Likewise.
2676 * version.cc: Likewise.
2677 * x86_64.cc: Likewise.
2678
b8fa8750
NC
26792010-08-24 Nick Clifton <nickc@redhat.com>
2680
2681 PR 11899
2682 * layout.cc (segment_precedes): Sort segments by their physical
2683 addresses, if they have been set.
2684
9919d93b
CC
26852010-08-23 Cary Coutant <ccoutant@google.com>
2686
2687 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2688 symbols data.
2689 (Lib_group::include_member): Unlock object after deleting its
2690 symbols data.
2691 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2692 the bug fixed here.
2693
97b4be1c
CC
26942010-08-19 Neil Vachharajani <nvachhar@google.com>
2695 Cary Coutant <ccoutant@google.com>
2696
2697 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2698 constructor, and set_blocker.
2699 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2700 readsyms_blocker_.
2701 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2702 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2703 * testsuite/Makefile.am (start_lib_test): New test case.
2704 * testsuite/Makefile.in: Regenerate.
2705 * testsuite/start_lib_test_main.c: New file.
2706 * testsuite/start_lib_test_1.c: New file.
2707 * testsuite/start_lib_test_2.c: New file.
2708 * testsuite/start_lib_test_3.c: New file.
2709
dd0b1884
ILT
27102010-08-19 Ian Lance Taylor <iant@google.com>
2711
2712 * Makefile.in: Rebuild with automake 1.11.1.
2713 * aclocal.m4: Likewise.
2714 * testsuite/Makefile.in: Likewise.
2715
7223e9ca
ILT
27162010-08-19 Ian Lance Taylor <iant@google.com>
2717
2718 PR 10893
2719 * i386.cc (class Output_data_plt_i386): Update declarations.
2720 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2721 local_ifuncs_ fields.
2722 (Target_i386::do_plt_section_for_global): New function.
2723 (Target_i386::do_plt_section_for_local): New function.
2724 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2725 parameter; change all callers. Initialize global_ifuncs_ and
2726 local_ifuncs_. If doing a static link define __rel_iplt_start and
2727 __rel_iplt_end.
2728 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2729 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2730 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2731 symbols.
2732 (Target_i386::make_plt_section): New function, broken out of
2733 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2734 (Target_i386::make_plt_entry): Call make_plt_section.
2735 (Target_i386::make_local_ifunc_plt_entry): New function.
2736 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2737 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2738 R_386_IRELATIVE to switch.
2739 (Target_i386::Scan::global): Likewise.
2740 (Target_i386::Relocate::relocate): Likewise.
2741 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2742 switch.
2743 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2744 (Target_x86_64::do_plt_section_for_global): New function.
2745 (Target_x86_64::do_plt_section_for_local): New function.
2746 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2747 parameter; change all callers. If doing a static link define
2748 __rela_iplt_start and __rela_iplt_end.
2749 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2750 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2751 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2752 to point to .plt.
2753 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2754 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2755 switch.
2756 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2757 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2758 R_X86_64_IRELATIVE to switch.
2759 (Target_x86_64::Scan::global): Likewise.
2760 (Target_x86_64::Relocate::relocate): Likewise.
2761 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2762 switch.
2763 * target.h (class Target): Add plt_section_for_global and
2764 plt_section_for_local functions. Add do_plt_section_for_global
2765 and do_plt_section_for_local virtual functions.
2766 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2767 clarifying comments.
2768 (Symbol::use_plt_offset): Handle IFUNC symbol.
2769 * object.cc (Sized_relobj::Sized_relobj): Initialize
2770 local_plt_offsets_.
2771 (Sized_relobj::local_has_plt_offset): New function.
2772 (Sized_relobj::local_plt_offset): New function.
2773 (Sized_relobj::set_local_plt_offset): New function.
2774 (Sized_relobj::do_count): Handle IFUNC symbol.
2775 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2776 a bit away from input_shndx_ field. Add set_is_func_symbol and
2777 is_ifunc_symbol functions.
2778 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2779 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2780 local_plt_offsets_ field.
2781 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2782 * output.h (class Output_section_data): Add non-const
2783 output_section function.
2784 (class Output_data_got): Update declarations.
2785 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2786 Add use_plt_offset parameter to global and local constructors.
2787 Change all callers. Change local_sym_index_ field to 31 bits.
2788 Change GSYM_CODE and CONSTANT_CODE accordingly.
2789 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2790 doing a static link don't set sh_link field.
2791 (Output_data_got::Got_entry::write): Use PLT offset if
2792 appropriate.
2793 (Output_data_got::add_global_plt): New function.
2794 (Output_data_got::add_local_plt): New function.
2795 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2796 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2797 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2798 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2799 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2800 IFUNC conditional.
2801 * testsuite/ifunc-sel.h: New file.
2802 * testsuite/ifuncmain1.c: New file.
2803 * testsuite/ifuncmain1vis.c: New file.
2804 * testsuite/ifuncmod1.c: New file.
2805 * testsuite/ifuncdep2.c: New file.
2806 * testsuite/ifuncmain2.c: New file.
2807 * testsuite/ifuncmain3.c: New file.
2808 * testsuite/ifuncmod3.c: New file.
2809 * testsuite/ifuncmain4.c: New file.
2810 * testsuite/ifuncmain5.c: New file.
2811 * testsuite/ifuncmod5.c: New file.
2812 * testsuite/ifuncmain6pie.c: New file.
2813 * testsuite/ifuncmod6.c: New file.
2814 * testsuite/ifuncmain7.c: New file.
2815 * configure, testsuite/Makefile.in: Rebuild.
2816
56f75c03
ILT
28172010-08-18 Ian Lance Taylor <iant@google.com>
2818
2819 * incremental.cc
2820 (Output_section_incremental_inputs::write_input_files): Add cast
2821 to avoid signed/unsigned comparison warning.
2822 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2823
55455f89
CC
28242010-08-12 Cary Coutant <ccoutant@google.com>
2825
2826 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2827
e2054bcb
ILT
28282010-08-13 Ian Lance Taylor <iant@google.com>
2829
2830 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2831
74f67560
DK
28322010-08-12 Cary Coutant <ccoutant@google.com>
2833 Doug Kwan <dougkwan@google.com>
2834
2835 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2836 defintion overrides non-weak undef, remember that the original undef
2837 is not weak.
2838 * symtab.cc (Symbol_table::sized_write_global): For undef without
2839 an original weak binding, set binding to global in output.
2840 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2841 * testsuite/Makefile.in: Regenerate.
2842 * testsuite/strong_ref_weak_def.sh: New file.
2843 * testsuite/strong_ref_weak_def_1.c: Ditto.
2844 * testsuite/strong_ref_weak_def_2.c: Ditto.
2845
d1238d12
CC
28462010-08-12 Cary Coutant <ccoutant@google.com>
2847
2848 * testsuite/incremental_test.sh: Rewrite.
2849 * testsuite/incremental_test_1.c: Rewrite.
2850 * testsuite/incremental_test_2.c: Rewrite.
2851
0e70b911
CC
28522010-08-12 Cary Coutant <ccoutant@google.com>
2853
2854 * arm.cc (Target_arm::got_size): Add const.
2855 (Target_arm::got_entry_count): New function.
2856 (Target_arm::plt_entry_count): New function.
2857 (Target_arm::first_plt_entry_offset): New function.
2858 (Target_arm::plt_entry_size): New function.
2859 (Output_data_plt_arm::entry_count): New function.
2860 (Output_data_plt_arm::first_plt_entry_offset): New function.
2861 (Output_data_plt_arm::get_plt_entry_size): New function.
2862 * i386.cc (Target_i386::got_size): Add const.
2863 (Target_i386::got_entry_count): New function.
2864 (Target_i386::plt_entry_count): New function.
2865 (Target_i386::first_plt_entry_offset): New function.
2866 (Target_i386::plt_entry_size): New function.
2867 (Output_data_plt_i386::entry_count): New function.
2868 (Output_data_plt_i386::first_plt_entry_offset): New function.
2869 (Output_data_plt_i386::get_plt_entry_size): New function.
2870 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2871 find_incremental_inputs_sections. Dump incremental_got_plt section.
2872 * incremental.cc: Include target.h.
2873 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2874 parameter. Adjust all callers. Find incremental_got_plt section.
2875 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2876 section.
2877 (Output_section_incremental_inputs::set_final_data_size): Calculate
2878 size of incremental_got_plt section.
2879 (Output_section_incremental_inputs::do_write): Write the
2880 incremental_got_plt section.
2881 (Got_plt_view_info): New struct.
2882 (Local_got_offset_visitor): New class.
2883 (Global_got_offset_visitor): New class.
2884 (Global_symbol_visitor_got_plt): New class.
2885 (Output_section_incremental_inputs::write_got_plt): New function.
2886 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2887 Add parameter. Adjust all callers.
2888 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2889 (Incremental_inputs::got_plt_section): New function.
2890 (Incremental_inputs::got_plt_section_): New data member.
2891 (Incremental_got_plt_reader): New class.
2892 * layout.cc (Layout::create_incremental_info_sections): Add the
2893 incremental_got_plt section.
2894 * object.h (Got_offset_list::get_list): New function.
2895 (Got offset_list::for_all_got_offsets): New function.
2896 (Sized_relobj::local_got_offset_list): New function.
2897 * powerpc.cc (Target_powerpc::got_size): Add const.
2898 (Target_powerpc::got_entry_count): New function.
2899 (Target_powerpc::plt_entry_count): New function.
2900 (Target_powerpc::first_plt_entry_offset): New function.
2901 (Target_powerpc::plt_entry_size): New function.
2902 (Output_data_plt_powerpc::entry_count): New function.
2903 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2904 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2905 * sparc.cc (Target_sparc::got_size): Add const.
2906 (Target_sparc::got_entry_count): New function.
2907 (Target_sparc::plt_entry_count): New function.
2908 (Target_sparc::first_plt_entry_offset): New function.
2909 (Target_sparc::plt_entry_size): New function.
2910 (Output_data_plt_sparc::entry_count): New function.
2911 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2912 (Output_data_plt_sparc::get_plt_entry_size): New function.
2913 * symtab.h (Symbol::got_offset_list): New function.
2914 (Symbol_table::for_all_symbols): New function.
2915 * target.h (Sized_target::got_entry_count): New function.
2916 (Sized_target::plt_entry_count): New function.
2917 (Sized_target::plt_entry_size): New function.
2918 * x86_64.cc (Target_x86_64::got_size): Add const.
2919 (Target_x86_64::got_entry_count): New function.
2920 (Target_x86_64::plt_entry_count): New function.
2921 (Target_x86_64::first_plt_entry_offset): New function.
2922 (Target_x86_64::plt_entry_size): New function.
2923 (Output_data_plt_x86_64::entry_count): New function.
2924 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2925 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2926
09ec0418
CC
29272010-08-12 Cary Coutant <ccoutant@google.com>
2928
2929 * archive.cc: Include incremental.h.
2930 (Archive::Archive): Initialize incremental_info_.
2931 (Archive::include_member): Record archive members in incremental info.
2932 (Add_archive_symbols::run): Record begin and end of an archive in
2933 incremental info.
2934 (Lib_group::include_member): Record objects in incremental info.
2935 * archive.h (Incremental_archive_entry): Forward declaration.
2936 (Archive::set_incremental_info): New member function.
2937 (Archive::incremental_info): New member function.
2938 (Archive::Unused_symbol_iterator): New class.
2939 (Archive::unused_symbols_begin): New member function.
2940 (Archive::unused_symbols_end): New member function.
2941 (Archive::incremental_info_): New data member.
2942 * incremental-dump.cc (find_input_containing_global): New function.
2943 (dump_incremental_inputs): Dump new incremental info sections.
2944 * incremental.cc: Include symtab.h.
2945 (Output_section_incremental_inputs): New class.
2946 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2947 new incremental info sections.
2948 (Sized_incremental_binary::do_check_inputs): Likewise.
2949 (Incremental_inputs::report_archive): Remove.
2950 (Incremental_inputs::report_archive_begin): New function.
2951 (Incremental_inputs::report_archive_end): New function.
2952 (Incremental_inputs::report_object): New function.
2953 (Incremental_inputs::finalize_inputs): Remove.
2954 (Incremental_inputs::report_input_section): New function.
2955 (Incremental_inputs::report_script): Rewrite.
2956 (Incremental_inputs::finalize): Do nothing but finalize string table.
2957 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2958 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2959 (Incremental_inputs::create_data_sections): New function.
2960 (Incremental_inputs::relocs_entsize): New function.
2961 (Output_section_incremental_inputs::set_final_data_size): New function.
2962 (Output_section_incremental_inputs::do_write): New function.
2963 (Output_section_incremental_inputs::write_header): New function.
2964 (Output_section_incremental_inputs::write_input_files): New function.
2965 (Output_section_incremental_inputs::write_info_blocks): New function.
2966 (Output_section_incremental_inputs::write_symtab): New function.
2967 * incremental.h (Incremental_script_entry): Forward declaration.
2968 (Incremental_object_entry): Forward declaration.
2969 (Incremental_archive_entry): Forward declaration.
2970 (Incremental_inputs): Forward declaration.
2971 (Incremental_inputs_header_data): Remove.
2972 (Incremental_inputs_header): Remove.
2973 (Incremental_inputs_header_write): Remove.
2974 (Incremental_inputs_entry_data): Remove.
2975 (Incremental_inputs_entry): Remove.
2976 (Incremental_inputs_entry_write): Remove.
2977 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2978 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2979 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2980 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2981 Likewise.
2982 (Incremental_input_entry): New class.
2983 (Incremental_script_entry): New class.
2984 (Incremental_object_entry): New class.
2985 (Incremental_archive_entry): New class.
2986 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2987 (Incremental_inputs::report_inputs): Remove.
2988 (Incremental_inputs::report_archive): Remove.
2989 (Incremental_inputs::report_archive_begin): New function.
2990 (Incremental_inputs::report_archive_end): New function.
2991 (Incremental_inputs::report_object): Change prototype.
2992 (Incremental_inputs::report_input_section): New function.
2993 (Incremental_inputs::report_script): Change prototype.
2994 (Incremental_inputs::get_reloc_count): New function.
2995 (Incremental_inputs::set_reloc_count): New function.
2996 (Incremental_inputs::create_data_sections): New function.
2997 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2998 (Incremental_inputs::inputs_section): New function.
2999 (Incremental_inputs::symtab_section): New function.
3000 (Incremental_inputs::relocs_section): New function.
3001 (Incremental_inputs::get_stringpool): Add const.
3002 (Incremental_inputs::command_line): Add const.
3003 (Incremental_inputs::inputs): Remove.
3004 (Incremental_inputs::command_line_key): New function.
3005 (Incremental_inputs::input_file_count): New function.
3006 (Incremental_inputs::input_files): New function.
3007 (Incremental_inputs::relocs_entsize): New function.
3008 (Incremental_inputs::sized_create_inputs_section_data): Remove.
3009 (Incremental_inputs::finalize_inputs): Remove.
3010 (Incremental_inputs::Input_info): Remove.
3011 (Incremental_inputs::lock_): Remove.
3012 (Incremental_inputs::inputs_): Change type.
3013 (Incremental_inputs::inputs_map_): Remove.
3014 (Incremental_inputs::current_object_entry_): New data member.
3015 (Incremental_inputs::inputs_section_): New data member.
3016 (Incremental_inputs::symtab_section_): New data member.
3017 (Incremental_inputs::relocs_section_): New data member.
3018 (Incremental_inputs::reloc_count_): New data member.
3019 (Incremental_inputs_reader): New class.
3020 (Incremental_symtab_reader): New class.
3021 (Incremental_relocs_reader): New class.
3022 * layout.cc (Layout::finalize): Move finalization of incremental info
3023 and creation of incremental info sections to follow finalization of
3024 symbol table. Set offsets for postprocessing sections.
3025 (Layout::create_incremental_info_sections): Call
3026 Incremental_inputs::create_data_sections. Add incremental symtab
3027 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
3028 sections to layout after input sections.
3029 * layout.h (struct Timespec): Forward declaration.
3030 (Layout::incremental_inputs): Add const.
3031 (Layout::create_incremental_info_sections): Add parameter.
3032 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
3033 * object.cc: Include incremental.h.
3034 (Relobj::finalize_incremental_relocs): New function.
3035 (Sized_relobj::do_layout): Record input sections in incremental info.
3036 * object.h (Object::output_section): New function.
3037 (Object::output_section_offset): Moved from Relobj.
3038 (Object::get_incremental_reloc_base): New function.
3039 (Object::get_incremental_reloc_count): New function.
3040 (Object::do_output_section): New function.
3041 (Object::do_output_section_offset): Moved from Relobj.
3042 (Object::do_get_incremental_reloc_base): New function.
3043 (Object::do_get_incremental_reloc_count): New function.
3044 (Object::Object): Initialize new data members.
3045 (Relobj::output_section): Renamed do_output_section and moved to
3046 protected.
3047 (Relobj::output_section_offset): Moved to Object.
3048 (Relobj::do_get_incremental_reloc_base): New function.
3049 (Relobj::do_get_incremental_reloc_count): New function.
3050 (Relobj::allocate_incremental_reloc_counts): New function.
3051 (Relobj::count_incremental_reloc): New function.
3052 (Relobj::finalize_incremental_relocs): New function.
3053 (Relobj::next_incremental_reloc_index): New function.
3054 (Relobj::reloc_counts_): New data member.
3055 (Relobj::reloc_bases_): New data member.
3056 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
3057 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
3058 (Sized_relobj::incremental_relocs_scan): New function.
3059 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3060 (Sized_relobj::incremental_relocs_write): New function.
3061 (Sized_relobj::incremental_relocs_write_reltype): New function.
3062 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
3063 incremental link.
3064 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
3065 archives and object files elsewhere.
3066 (Add_symbols::run): Report object files here.
3067 (Finish_group::run): Report end of archive at end of group.
3068 * reloc.cc: Include layout.h, incremental.h.
3069 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
3070 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
3071 (Sized_relobj::incremental_relocs_scan): New function.
3072 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3073 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3074 (Sized_relobj::incremental_relocs_write): New function.
3075 (Sized_relobj::incremental_relocs_write_reltype): New function.
3076 * script.cc (read_input_script): Rewrite test for incremental link.
3077 Change call to Incremental_inputs::report_script.
3078 * symtab.h (Symbol_table::first_global_index): New function.
3079 (Symbol_table::output_count): New function.
3080
ce0d1972
DK
30812010-08-12 Doug Kwan <dougkwan@google.com>
3082
3083 * arm.cc (Target_arm::merge_object_attributes): Check command line
3084 options --no-wchar-size-warning and --no-enum-size-warning.
3085 * options.h (General_options): Add ld-compatible options
3086 --no-enum-size-warning and --no-wchar-size-warning.
3087
6e5710ce
ILT
30882010-08-04 Ian Lance Taylor <iant@google.com>
3089
3090 * x86_64.cc (Target_x86_64::Scan::local): Use
3091 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3092 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3093 (Target_x86_64::Scan::global): Likewise.
3094 (Target_x86_64::Relocate::relocate): Likewise.
3095 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3096 Likewise.
3097
fef830db
CC
30982010-08-03 Cary Coutant <ccoutant@google.com>
3099
3100 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3101 to reserve space in merged_strings vector. Keep total input size
3102 for stats.
3103 (Output_merge_string::do_print_merge_stats): Print total input size.
3104 * merge.h (Output_merge_string): Add input_size_ field.
3105 * stringpool.cc (Stringpool_template::string_length): Move
3106 implementations out of Stringpool_template class and place in
3107 stringpool.h.
3108 * stringpool.h (string_length): Move out of Stringpool_template.
3109
1e3811b0
ILT
31102010-08-03 Ian Lance Taylor <iant@google.com>
3111
3112 PR 11712
3113 * layout.cc (relaxation_loop_body): If address of load segment is
3114 set, adjust address to include headers if possible.
3115
7af0c620
ILT
31162010-08-03 Ian Lance Taylor <iant@google.com>
3117
3118 * version.cc (version_string): Bump to 1.10.
3119
22f0da72
ILT
31202010-08-03 Ian Lance Taylor <iant@google.com>
3121
3122 PR 11805
3123 * layout.h (enum Output_section_order): Define.
3124 (class Layout): Update declarations.
3125 * layout.cc (Layout::get_output_section): Add order parameter.
3126 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3127 is_first_non_relro parameters. Change all callers.
3128 (Layout::choose_output_section): Likewise.
3129 (Layout::add_output_section_data): Likewise.
3130 (Layout::make_output_section): Likewise. Set order.
3131 (Layout::default_section_order): New function.
3132 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3133 * output.cc (Output_section::Output_section): Initialize order_.
3134 Don't initialize deleted fields.
3135 (Output_segment::Output_segment): Don't initialize deleted
3136 fields.
3137 (Output_segment::add_output_section_to_load): New function
3138 replacing add_output_section. Change all callers to call this or
3139 add_output_section_to_nonload.
3140 (Output_segment::add_output_section_to_nonload): New function.
3141 (Output_segment::remove_output_section): Rewrite.
3142 (Output_segment::add_initial_output_data): Likewise.
3143 (Output_segment::has_any_data_sections): Likewise.
3144 (Output_segment::is_first_section_relro): Likewise.
3145 (Output_segment::maximum_alignment): Likewise.
3146 (Output_segment::has_dynamic_reloc): New function replacing
3147 dynamic_reloc_count. Change all callers.
3148 (Output_segment::has_dynamic_reloc_list): New function replacing
3149 dynamic_reloc_count_list. Change all callers.
3150 (Output_segment::set_section_addresses): Rewrite.
3151 (Output_segment::set_offset): Rewrite.
3152 (Output_segment::find_first_and_last_list): Remove.
3153 (Output_segment::set_tls_offsets): Rewrite.
3154 (Output_segment::first_section_load_address): Likewise.
3155 (Output_segment::output_section_count): Likewise.
3156 (Output_segment::section_with_lowest_load_address): Likewise.
3157 (Output_segment::write_section_headers): Likewise.
3158 (Output_segment::print_sections_to_map): Likewise.
3159 * output.h (class Output_data): Remove dynamic_reloc_count_
3160 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3161 (Output_data::add_dynamic_reloc): Rewrite.
3162 (Output_data::has_dynamic_reloc): New function.
3163 (Output_data::dynamic_reloc_count): Remove.
3164 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3165 is_last_relro_, is_first_non_relro_, is_interp_,
3166 is_dynamic_linker_section_ fields. Add order and set_order
3167 functions. Remove is_relro_local, set_is_relro_local,
3168 is_last_relro, set_is_last_relro, is_first_non_relro,
3169 set_is_first_non_relro functions, is_interp, set_is_interp,
3170 is_dynamic_linker_section, and set_is_dynamic_linker_section
3171 functions.
3172 (class Output_segment): Change Output_data_list from std::list to
3173 std:;vector. Add output_lists_ field. Remove output_data_ and
3174 output_bss_ fields. Update declarations.
3175
3ff2ccb0
ILT
31762010-08-02 Ian Lance Taylor <iant@google.com>
3177
3178 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3179 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3180 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3181
88a4108b
ILT
31822010-08-02 Ian Lance Taylor <iant@google.com>
3183
3184 PR 11855
3185 * script.cc (Script_options::Script_options): Initialize
3186 symbol_definitions_ and symbol_references_.
3187 (Script_options::add_symbol_assignment): Update
3188 symbol_definitions_ and symbol_references_.
3189 (Script_options::add_symbol_reference): New function.
3190 (script_symbol): New function.
3191 * script.h (class Script_options): Add symbol_definitions_ and
3192 symbol_references_ fields.
3193 (Script_options::referenced_const_iterator): New type.
3194 (Script_options::referenced_begin): New function.
3195 (Script_options::referenced_end): New function.
3196 (Script_options::is_referenced): New function.
3197 (Script_options::any_unreferenced): New function.
3198 * script-c.h (script_symbol): Declare.
3199 * yyscript.y (exp): Call script_symbol.
3200 * symtab.cc: Include "script.h".
3201 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3202 Change all callers. Check symbols referenced by scripts.
3203 (Symbol_table::add_undefined_symbols_from_command_line): Add
3204 layout parameter. Change all callers.
3205 (Symbol_table::do_add_undefined_symbols_from_command_line):
3206 Likewise. Break out loop body. Check symbols referenced by
3207 scripts.
3208 (Symbol_table::add_undefined_symbol_from_command_line): New
3209 function broken out of
3210 do_add_undefined_symbols_from_command_line.
3211 * symtab.h (class Symbol_table): Update declarations.
3212 * archive.cc: Include "layout.h".
3213 (Archive::should_include_member): Add layout parameter. Change
3214 all callers. Check for symbol mentioned in expression.
3215 * archive.h (class Archive): Update declaration.
3216 * object.cc (Sized_relobj::do_should_include_member): Add layout
3217 parameter.
3218 * object.h (Object::should_include_member): Add layout parameter.
3219 Change all callers.
3220 (Object::do_should_include_member): Add layout parameter.
3221 (class Sized_relobj): Update declaration.
3222 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3223 parameter.
3224 * dynobj.h (class Sized_dynobj): Update declaration.
3225 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3226 layout parameter.
3227 * plugin.h (class Sized_pluginobj): Update declaration.
3228
5f1ab67a
ILT
32292010-08-02 Ian Lance Taylor <iant@google.com>
3230
3231 PR 11866
3232 * output.cc (Output_segment::set_offset): Search for the first and
3233 last sections rather than assuming that the list is in order.
3234 (Output_segment::find_first_and_last_list): New function.
3235 * output.h (class Output_segment): Update declarations.
3236 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3237 (relro_strip_test_SOURCES): New variable.
3238 (relro_strip_test_DEPENDENCIES): New variable.
3239 (relro_strip_test_LDFLAGS): New variable.
3240 (relro_strip_test_LDADD): New variable.
3241 (relro_strip_test.so): New target.
3242
a8df5856
ILT
32432010-08-02 Ian Lance Taylor <iant@google.com>
3244
3245 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3246 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3247 (Target_i386::got_tlsdesc_section): New function.
3248 (Target_i386::got_section): Create space for GOT entries for
3249 TLSDESC relocations.
3250 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3251 R_386_TLS_GOTDESC.
3252 (Target_i386::Scan::global): Likewise.
3253 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3254 using TLSDESC GOT.
3255 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3256 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3257 (Target_x86_64::got_tlsdesc_section): New function.
3258 (Target_x86_64::got_section): Create space for GOT entries for
3259 TLSDESC relocations.
3260 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3261 R_386_TLS_GOTDESC.
3262 (Target_x86_64::Scan::global): Likewise.
3263 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3264 using TLSDESC GOT.
3265
0c10a0a6
ILT
32662010-08-02 Ian Lance Taylor <iant@google.com>
3267
3268 * testsuite/final_layout.sh: Use dc to convert from hex to
3269 decimal.
3270
41cbeecc
ST
32712010-07-29 Sriraman Tallam <tmsriram@google.com>
3272
3273 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3274 paramter to the call to gold::gc_process_relocs.
3275 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3276 paramter to the call to gold::gc_process_relocs.
3277 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3278 parameter to the call to gold::gc_process_relocs.
3279 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3280 template parameter to the call to gold::gc_process_relocs.
3281 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3282 paramter to the call to gold::gc_process_relocs.
3283 * gc.h (get_embedded_addend_size): New function.
3284 (gc_process_relocs): Save the size of the reloc for use by ICF.
3285 * icf.cc (get_section_contents): Get the addend from the text section
3286 for SHT_REL relocation sections.
3287 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3288 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3289 * int_encoding.h (read_from_pointer): New overloaded function.
3290 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3291 * testsuite/icf_sht_rel_addend_test.sh: New file.
3292 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3293 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3294
6ea55b82
RW
32952010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3296
3297 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3298 * Makefile.in: Regenerate.
3299 * testsuite/Makefile.in: Regenerate.
3300
9691462b
ILT
33012010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3302
3303 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3304 * gold/testsuite/debug_msg.cc: Likewise.
3305 * gold/testsuite/odr_violation1.cc
3306 * gold/testsuite/odr_violation2.cc
3307
76897331
CC
33082010-07-21 Cary Coutant <ccoutant@google.com>
3309
3310 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3311 string, and length fields.
3312 (Output_merge_string::Merged_strings_list): New type.
3313 (Output_merge_string::Merged_strings_lists): New typedef.
3314 (Output_merge_string): Replace merged_strings_ with
3315 merged_strings_lists_.
3316 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3317 Merged_strings_list per input object and section. Don't store pointer
3318 to the string. Don't store length with each merged string entry.
3319 (Output_merge_string::finalize_merged_data): Loop over list of merged
3320 strings lists. Recompute length of each merged string.
3321
78384e8f
CC
33222010-07-15 Cary Coutant <ccoutant@google.com>
3323
3324 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3325 here.
3326
783659f9
ILT
33272010-07-14 Ian Lance Taylor <iant@google.com>
3328
3329 * descriptors.cc (Descriptors::open): Report correct name in error
3330 message.
3331
131687b4
DK
33322010-07-13 Doug Kwan <dougkwan@google.com>
3333
3334 * arm.cc (Arm_input_section::Arm_input_section): For a
3335 SHT_ARM_EXIDX section, always keeps the input sections.
3336 (Arm_input_section::set_exidx_section_link): New method.
3337 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3338 has_errors_ to false.
3339 (Arm_exidx_input_section::has_errors,
3340 Arm_exidx_input_section::set_has_errors): New methods.
3341 (Arm_exidx_input_section::has_errors_): New data member.
3342 (Arm_relobj::get_exidx_shndx_list): New method.
3343 (Arm_output_section::append_text_sections_to_list): Do not skip
3344 section without SHF_EXECINSTR.
3345 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3346 errors.
3347 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3348 section header. Make error messages more verbose. Check for
3349 a non-executable section linked to an EXIDX section.
3350 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3351 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3352 check that there is no deferred EXIDX section if we exit early.
3353 Instead of not making an EXIDX section in case of an error, make one
3354 and set the has_errors flag of it.
3355 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3356 in a relocatable link.
3357 (Target_arm::do_relax): Look for the EXIDX output section instead of
3358 assuming that it is called .ARM.exidx.
3359 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3360 section list. Do not check for SHF_EXECINSTR section flags but
3361 skip any input section with errors.
3362 * output.cc (Output_section::Output_section): Initialize
3363 always_keeps_input_sections_ to false.
3364 (Output_section::add_input_section): Check for
3365 always_keeps_input_sections_.
3366 * output.h (Output_section::always_keeps_input_sections,
3367 Output_section::set_always_keeps_input_sections): New methods.
3368 (Output_section::always_keeps_input_sections): New data member.
3369
69517287
RÁE
33702010-07-13 Rafael Espindola <espindola@google.com>
3371
3372 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3373 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3374
82742395
ILT
33752010-07-13 Philip Herron <herron.philip@googlemail.com>
3376 Ian Lance Taylor <iant@google.com>
3377
3378 * output.h (Output_section_lookup_maps::add_merge_section):
3379 Correct check of whether value was inserted.
3380 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3381 (Output_section_lookup_maps::add_relaxed_input_section):
3382 Likewise.
3383 * arm.cc (Target_arm::got_section): Remove used local os.
3384 * i386.cc (Target_i386::got_section): Likewise.
3385 * x86_64.cc (Target_x86_64::got_section): Likewise.
3386 * sparc.cc (Target_sparc::got_section): Likewise.
3387 (Target_sparc::relocate): Remove unused local have_got_offset.
3388 * powerpc.cc (Target_powerpc::relocate): Likewise.
3389
f2d707b5
ILT
33902010-07-13 Ian Lance Taylor <iant@google.com>
3391
241531d6
ILT
3392 * compressed_output.cc (zlib_decompress): Fix signature in
3393 !HAVE_ZLIB_H case.
3394
f2d707b5
ILT
3395 * archive.cc (Archive::include_member): Unlock an external member
3396 of a thin archive. Don't bother to delete an object we know is
3397 NULL.
3398
a2e47362
CC
33992010-07-12 Cary Coutant <ccoutant@google.com>
3400
3401 * compressed_output.cc (zlib_decompress): New function.
3402 (get_uncompressed_size): New function.
3403 (decompress_input_section): New function.
3404 * compressed_output.h (get_uncompressed_size): New function.
3405 (decompress_input_section): New function.
3406 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3407 Handle compressed debug sections.
3408 * layout.cc (is_compressed_debug_section): New function.
3409 (Layout::output_section_name): Map compressed section names to
3410 canonical names.
3411 * layout.h (is_compressed_debug_section): New function.
3412 (is_debug_info_section): Recognize compressed debug sections.
3413 * merge.cc: Include compressed_output.h.
3414 (Output_merge_data::do_add_input_section): Handle compressed
3415 debug sections.
3416 (Output_merge_string::do_add_input_section): Handle compressed
3417 debug sections.
3418 * object.cc: Include compressed_output.h.
3419 (Sized_relobj::Sized_relobj): Initialize new data members.
3420 (build_compressed_section_map): New function.
3421 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3422 * object.h (Object::section_is_compressed): New method.
3423 (Object::do_section_is_compressed): New method.
3424 (Sized_relobj::Compressed_section_map): New type.
3425 (Sized_relobj::do_section_is_compressed): New method.
3426 (Sized_relobj::compressed_sections_): New data member.
3427 * output.cc (Output_section::add_input_section): Handle compressed
3428 debug sections.
3429 * reloc.cc: Include compressed_output.h.
3430 (Sized_relobj::write_sections): Handle compressed debug sections.
3431
ce279a62
CC
34322010-07-08 Cary Coutant <ccoutant@google.com>
3433
3434 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3435 weak when resolving to a dynamic def.
3436 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3437 for weak undef/dynamic def cases. Adjust callers.
3438 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3439 undef_binding_weak_.
3440 (Symbol_table::sized_write_globals): Adjust symbol binding.
3441 (Symbol_table::sized_write_symbol): Add binding parameter.
3442 * symtab.h (Symbol::set_undef_binding): New method.
3443 (Symbol::is_undef_binding_weak): New method.
3444 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3445 (Symbol_table::should_override): Add new parameter.
3446 (Symbol_table::sized_write_symbol): Add new parameter.
3447
3448 * testsuite/weak_undef_file1.cc: Add new test case.
3449 * testsuite/weak_undef_file2.cc: Fix header comment.
3450 * testsuite/weak_undef_test.cc: Add new test case.
3451
b2286c10
DK
34522010-06-29 Doug Kwan <dougkwan@google.com>
3453
3454 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3455 Initialize USE_SYMBOL_.
3456 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3457 definition.
3458 (Arm_reloc_property::uses_symbol_): New data member declaration.
3459 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3460 uses symbol value and symbol is undefined but not weakly undefined.
3461
4802450a
RÁE
34622010-06-28 Rafael Espindola <espindola@google.com>
3463
3464 * plugin.cc (Plugin::load): Use dlerror.
3465
e5ca47ba
ILT
34662010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3467
3468 * symtab.cc (detect_odr_violations): When reporting an ODR
3469 violation, report an object where the symbol is defined.
3470
8a75a161
DK
34712010-06-25 Doug Kwan <dougkwan@google.com>
3472
3473 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3474 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3475 definition.
3476 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3477 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3478 target hook to detect function points.
3479 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3480 * icf.h (Icf::check_section_for_function_pointers): Change type of
3481 parameter SECTION_NAME to const reference to std::string. Use
3482 target hook to determine if section may have unsafe pointers.
3483 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3484 method definition.
3485
42218b9f
RÁE
34862010-06-21 Rafael Espindola <espindola@google.com>
3487
3488 * fileread.cc (Input_file::find_fie): New
3489 (Input_file::open): Use Input_file::find_fie.
3490 * fileread.h (Input_file::find_fie): New
3491 * plugin.cc (set_extra_library_path): New.
3492 (Plugin::load): Add set_extra_library_path to the transfer vector.
3493 (Plugin_manager::set_extra_library_path): New.
3494 (Plugin_manager::add_input_file): Use the extra search path if set.
3495 (set_extra_library_path(): New.
3496 * plugin.h (Plugin_manager): Add set_extra_library_path and
3497 extra_search_path_.
3498
a0506cca
CC
34992010-06-19 Cary Coutant <ccoutant@google.com>
3500
3501 * layout.cc (gdb_sections): Add .debug_types.
3502 (lines_only_debug_sections): Likewise.
3503
6508b958
RÁE
35042010-06-18 Rafael Espindola <espindola@google.com>
3505
3506 * plugin.cc (add_input_file,add_input_library)
3507 (Plugin_manager::add_input_file): Make filename arguments const.
3508 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3509 const.
3510
3e235302
DK
35112010-06-16 Doug Kwan <dougkwan@google.com>
3512
3513 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3514 .ARM.attributes section if we have not merged any input
3515 attributes sections.
3516
106e8a6c
DK
35172010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3518
3519 * arm.cc: Allow combining objects with no EABI version
3520 information.
3521
91ff43fe
RÁE
35222010-06-15 Rafael Espindola <espindola@google.com>
3523
3524 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3525
68ed838c
ILT
35262010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3527
3528 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3529 (struct iovec): Correct !HAVE_READV definition.
3530
f3a2388f
CC
35312010-06-10 Cary Coutant <ccoutant@google.com>
3532
3533 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3534 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3535 reloc sections.
3536 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3537
3538 PR 11683
3539 * symtab.h (Symbol::is_placeholder): New member function.
3540 * target-reloc.h (relocate_section): Check for placeholder symbols.
3541
3542 * testsuite/Makefile.am (plugin_test_8): New test.
3543 (plugin_test_9): New test.
3544 * testsuite/Makefile.in: Regenerate.
3545
e1df38aa
NC
35462010-06-09 Nick Clifton <nickc@redhat.com>
3547
3548 * yyscript.y (input_list_element): Allow strings prefixed with
3549 the '-' character. Treat these as libraries.
3550 * script.cc (script_add_library): New function. Adds a library
3551 specified by "-l<name>" found in an input script.
3552 * script-c.h: Add prototype for script_add_library.
3553
25bbe950
DK
35542010-06-07 Doug Kwan <dougkwan@google.com>
3555
3556 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3557 Restrict stub-group size to be within long conditional branch
3558 range when working around cortex-A8 erratum.
3559
0f32ea4c
ILT
35602010-06-07 Damien Diederen <dd@crosstwine.com>
3561
3562 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3563 #ifdef typo.
3564
8fe2a369
ST
35652010-06-03 Sriraman Tallam <tmsriram@google.com>
3566
3567 PR gold/11658
3568 * output.cc
3569 (Output_section::Input_section_sort_entry::compare_section_ordering):
3570 Change to return non-zero correctly.
3571 (Output_section::Input_section_sort_section_order_index_compare
3572 ::operator()): Change to fix ambiguity in comparisons.
3573
6e9ba2ca
ST
35742010-06-01 Sriraman Tallam <tmsriram@google.com>
3575
3576 * gold.h (is_wildcard_string): New function.
3577 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3578 (Layout::layout_eh_frame): Ditto.
3579 (Layout::find_section_order_index): New method.
3580 (Layout::read_layout_from_file): New method.
3581 * layout.h (Layout::find_section_order_index): New method.
3582 (Layout::read_layout_from_file): New method.
3583 (Layout::input_section_position_): New private member.
3584 (Layout::input_section_glob_): New private member.
3585 * main.cc (main): Call read_layout_from_file here.
3586 * options.h (--section-ordering-file): New option.
3587 * output.cc (Output_section::input_section_order_specified_): New
3588 member.
3589 (Output_section::Output_section): Initialize new member.
3590 (Output_section::add_input_section): Add new parameter.
3591 Keep input sections when --section-ordering-file is used.
3592 (Output_section::set_final_data_size): Sort input sections when
3593 section ordering file is specified.
3594 (Output_section::Input_section_sort_entry): Add new parameter.
3595 Check sorting type.
3596 (Output_section::Input_section_sort_entry::compare_section_ordering):
3597 New method.
3598 (Output_section::Input_section_sort_compare::operator()): Change to
3599 consider section_order_index.
3600 (Output_section::Input_section_sort_init_fini_compare::operator()):
3601 Change to consider section_order_index.
3602 (Output_section::Input_section_sort_section_order_index_compare
3603 ::operator()): New method.
3604 (Output_section::sort_attached_input_sections): Change to sort
3605 according to section order when specified.
e1df38aa
NC
3606 (Output_section::add_input_section<32, true>): Add new parameter.
3607 (Output_section::add_input_section<64, true>): Add new parameter.
3608 (Output_section::add_input_section<32, false>): Add new parameter.
3609 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
3610 * output.h (Output_section::add_input_section): Add new parameter.
3611 (Output_section::input_section_order_specified): New
3612 method.
3613 (Output_section::set_input_section_order_specified): New method.
3614 (Input_section::Input_section): Initialize section_order_index_.
3615 (Input_section::section_order_index): New method.
3616 (Input_section::set_section_order_index): New method.
3617 (Input_section::section_order_index_): New member.
3618 (Input_section::Input_section_sort_section_order_index_compare): New
3619 struct.
3620 (Output_section::input_section_order_specified_): New member.
3621 * script-sections.cc (is_wildcard_string): Delete and move modified
3622 method to gold.h.
3623 (Output_section_element_input::Output_section_element_input): Modify
3624 call to is_wildcard_string.
3625 (Output_section_element_input::Input_section_pattern
3626 ::Input_section_pattern): Ditto.
3627 (Output_section_element_input::Output_section_element_input): Ditto.
3628 * testsuite/Makefile.am (final_layout): New test case.
3629 * testsuite/Makefile.in: Regenerate.
3630 * testsuite/final_layout.cc: New file.
3631 * testsuite/final_layout.sh: New file.
3632
3537c84b
RÁE
36332010-06-01 Rafael Espindola <espindola@google.com>
3634
3635 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3636
105b6afd
RÁE
36372010-06-01 Rafael Espindola <espindola@google.com>
3638
3639 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3640 visibility of symbols.
3641
29e11421
DK
36422010-05-27 Doug Kwan <dougkwan@google.com>
3643
3644 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3645 from start of output section instead of address for a local symbol
3646 in a merged or relaxed section when doing a relocatable link.
3647
5e0f337e
RÁE
36482010-05-26 Rafael Espindola <espindola@google.com>
3649
3650 PR 11604
3651 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3652 adding sections the garbage collector removed.
3653 * gold/testsuite/Makefile.am: Add test.
3654 * gold/testsuite/Makefile.in: Regenerate.
3655 * gold/testsuite/plugin_test_7.sh: New.
3656 * gold/testsuite/plugin_test_7_1.c: New.
3657 * gold/testsuite/plugin_test_7_2.c: New.
3658
f4187277
RÁE
36592010-05-26 Rafael Espindola <espindola@google.com>
3660
3661 * script-sections.cc (Output_section_definition::set_section_addresses):
3662 Check for --section-start.
3663
5c388529
DK
36642010-05-26 Doug Kwan <dougkwan@google.com>
3665
3666 * arm.cc (Arm_scan_relocatable_relocs): New class.
3667 (Target_arm::relocate_special_relocatable): New method.
3668 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3669 (Arm_relocate_functions::thumb_branch_common): Same.
3670 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3671 instead of Default_scan_relocatable_relocs.
3672 * target-reloc.h (relocate_for_relocatable): Let target handle
3673 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3674 * target.h (Sized_target::relocate_special_relocatable): New method.
3675
bca1c3ae
ILT
36762010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3677
3678 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3679
0439c796
DK
36802010-05-23 Doug Kwan <dougkwan@google.com>
3681
3682 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3683 instead of a cast.
3684 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3685 with a direct branch, not a conditional branch, to a stub.
3686 * merge.cc (Output_merge_base::record_input_section): New method
3687 defintion.
3688 (Output_merge_data::do_add_input_section): Record input section if
3689 keeps-input-sections flag is set.
3690 (Output_merge_string::do_add_input_section): Ditto.
3691 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3692 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3693 INPUT_SECTIONS_.
3694 (Output_merge_base::keeps_input_sections,
3695 Output_merge_base::set_keeps_input_sections,
3696 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3697 method definitions.
3698 (Output_merge_base::Input_sections): New type declaration.
3699 (Output_merge_base::input_sections_begin,
3700 Output_merge_base::input_sections_end,
3701 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3702 (Output_merge_base::bool keeps_input_sections_,
3703 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3704 Output_merge_base::input_sections_): New data members.
3705 (Output_merge_data::do_set_keeps_input_sections): New method
3706 defintion.
3707 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3708 * output.cc (Output_section::Input_section::relobj): Move method
3709 defintion from class declaration to here and handle merge sections.
3710 (Output_section::Input_section::shndx): Ditto.
3711 (Output_section::Output_section): Remove initializations of removed
3712 data members and initialize new data member LOOKUP_MAPS_.
3713 (Output_section::add_input_section): Set keeps-input-sections flag
3714 for a newly created merge output section as appropriate. Adjust code
3715 to use Output_section_lookup_maps class.
3716 (Output_section::add_relaxed_input_section): Adjst code for lookup
3717 maps code refactoring.
3718 (Output_section::add_merge_input_section): Add a new parameter
3719 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3720 class. If adding input section to a newly created merge output
3721 section fails, remove the new merge section.
3722 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 3723 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
3724 (Output_section::find_merge_section): Ditto.
3725 (Output_section::build_lookup_maps): New method defintion.
3726 (Output_section::find_relaxed_input_section): Adjust code to use
3727 Output_section_lookup_maps class.
3728 (Output_section::get_input_sections): Export merge sections. Adjust
3729 code to use Output_section_lookup_maps class.
3730 (Output_section:::add_script_input_section): Adjust code to use
3731 Output_section_lookup_maps class. Update lookup maps for merge
3732 sections also.
3733 (Output_section::discard_states): Use Output_section_lookup_maps.
3734 (Output_section::restore_states): Same.
3735 * output.h (Merge_section_properties): Move class defintion out of
3736 Output_section.
3737 (Output_section_lookup_maps): New class.
3738 (Output_section::Input_section::is_merge_section): New method
3739 defintion.
3740 (Output_section::Input_section::relobj): Move defintion out of class
3741 defintion. Declare method only.
3742 (Output_section::Input_section::shndx): Ditto.
3743 (Output_section::Input_section::output_merge_base): New method defintion.
3744 (Output_section::Input_section::u2_.pomb): New union field.
3745 (Output_section::Merge_section_by_properties_map,
3746 Output_section::Output_section_data_by_input_section_map,
3747 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3748 Remove types.
3749 (Output_section::add_merge_input_section): Add new parameter
3750 KEEPS_INPUT_SECTIONS.
3751 (Output_section::build_lookup_maps): New method declaration.
3752 (Output_section::merge_section_map_,
3753 Output_section::merge_section_by_properties_map_,
3754 Output_section::relaxed_input_section_map_,
3755 Output_section::is_relaxed_input_section_map_valid_): Remove data
3756 members.
3757 (Output_section::lookup_maps_): New data member.
3758
76295588
L
37592010-05-21 Doug Kwan <dougkwan@google.com>
3760
3761 PR gold/11619
3762 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3763 avoid a compilation error.
3764
d103a984
RÁE
37652010-05-19 Rafael Espindola <espindola@google.com>
3766
3767 * script-sections.cc (Output_section_definition::allocate_to_segment):
3768 Update the phdrs_list even when the output section is NULL.
3769 * testsuite/Makefile.am: Add test.
3770 * testsuite/Makefile.in: Regenerate.
3771 * testsuite/script_test_9.cc: New.
3772 * testsuite/script_test_9.sh: New.
3773 * testsuite/script_test_9.t: New.
3774
6625d24e
DK
37752010-05-19 Doug Kwan <dougkwan@google.com>
3776
3777 * arm.cc (Arm_input_section::original_size): New method.
3778 (Arm_input_section::do_addralign): Add a cast.
3779 (Arm_input_section::do_output_offset): Remove static cast.
3780 (Arm_input_section::original_addralign,
3781 Arm_input_section::original_size_): Change type to uint32_t.
3782 (Arm_input_section::init): Add safe casts for section alignment
3783 and size.
3784 (Arm_input_section::set_final_data_size): Do not set address and
3785 offset of stub table.
3786 (Arm_output_section::fix_exidx_coverage): Change use of of
3787 Output_section::Simple_input_section to that of
3788 Output_section::Input_section.
3789 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3790 except for the first pass.
3791 * output.cc (Output_section::get_input_sections): Change type of
3792 input_sections to std::list<Input_section>.
3793 (Output_section::add_script_input_section): Rename from
3794 Output_section::add_simple_input_section. Change type of SIS
3795 parameter from Simple_input_section to Input_section.
3796 * output.h (Output_section::Simple_input_section): Remove class.
3797 (Output_section::Input_section): Change class visibility to public.
3798 (Output_section::Input_section::addralign): Use stored alignments
3799 for special input sections if set.
3800 (Output_section::Input_section::set_addralign): New method.
3801 (Output_section::get_input_sections): Change parameter type from
3802 list of Simple_input_section to list of Input_section.
3803 (Output_section::add_script_input_section): Rename from
3804 Output_section::add_simple_input_section. Change first parameter's
3805 type from Simple_input_section to Input_section and remove the
3806 second and third parameters.
3807 * script-sections.cc (Input_section::Input_section_list): Change
3808 type to list of Output_section::Input_section/
3809 (Input_section_info::Input_section_info): Change parameter type of
3810 INPUT_SECTION to Output_section::Input_section.
3811 (Input_section_info::input_section): Change return type.
3812 (Input_section_info::input_section_): Change type to
3813 Output_section::Input_section.
3814 (Output_section_element_input::set_section_addresses): Adjust code
3815 to use Output_section::Input_section instead of
3816 Output_section::Simple_input_section. Adjust code for renaming
3817 of Output_section::add_simple_input_section.
3818 (Orphan_output_section::set_section_addresses): Ditto.
3819
e1e82ea4
RW
38202010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3821
3822 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3823 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3824
91e75c8a
RÁE
38252010-05-18 Rafael Espindola <espindola@google.com>
3826
3827 * options.cc (General_options::finalize): Handle -nostdlib.
3828 * options.h (nostdlib): New option.
3829 * script.cc (script_add_search_dir): Handle -nostdlib.
3830
da59ad79
DK
38312010-05-12 Doug Kwan <dougkwan@google.com>
3832
3833 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3834 attributes section only if there no attributes section after merging.
3835 (Target_arm::merge_object_attributes): Move value of
e1df38aa 3836 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
3837 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3838 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3839 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3840 and arm_attr_merge_7.stdout.
3841 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3842 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3843 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3844 arm_attr_merge_7b.o): New rules.
3845 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3846 arm_attr_merge_7
3847 * testsuite/Makefile.in: Regenerate.
3848 * testsuite/arm_attr_merge.sh: New file.
3849 * testsuite/arm_attr_merge_[67][ab].s: Same.
3850
3e01a7fd
NC
38512010-05-05 Nick Clifton <nickc@redhat.com>
3852
3853 * po/es.po: Updated Spanish translation.
3854
7ad2014a
L
38552010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3856
3857 * Makefile.am (install-exec-local): Properly install gold as
3858 default cross linker.
3859 * Makefile.in: Regenerated.
3860
4fda8867
NC
38612010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3862 Nick Clifton <nickc@redhat.com>
3863
3864 * configure.ac (install_as_default): Define and set to false
3865 unless --enable-gold or --enable-gold=both/gold has been
3866 specified.
3867 * configure: Regenerate.
3868
3869 * Makefile.am (install-exec-local): Install the executable as
3870 'ld.gold'. If install_as_default is true then also install it as
3871 'ld'.
3872 * Makefile.in: Regenerated.
3873
bd288ea2
ILT
38742010-04-24 Ian Lance Taylor <iant@google.com>
3875
3876 * layout.cc (Layout::layout_reloc): In relocatable link don't
3877 combine reloc sections for grouped sections.
3878
ef38fd8a
ST
38792010-04-23 Sriraman Tallam <tmsriram@google.com>
3880
3881 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3882 sections that are not ordinary to icf.
3883 * icf.cc (get_section_contents): Handle relocation pointing to section
3884 with no object or shndx information.
3885 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3886 * testsuite/Makefile.in: Regenerate.
3887 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3888 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3889
f6973bdc
ILT
38902010-04-22 Ian Lance Taylor <iant@google.com>
3891
3892 * expression.cc (Expression::Expression_eval_info): Add
3893 result_alignment_pointer field.
3894 (Expression::eval_with_dot): Add result_alignment_pointer
3895 parameter. Change all callers.
3896 (Expression::eval_maybe_dot): Likewise.
3897 (class Binary_expression): Add alignment_pointer parameter to
3898 left_value and right_value. Change all callers.
3899 (BINARY_EXPRESSION): Set result alignment.
3900 (class Trinary_expression): Add alignment_pointer parameter to
3901 arg2_value and arg3_value. Change all callers.
3902 (Trinary_cond::value): Set result alignment.
3903 (Max_expression::value, Min_expression::value): Likewise.
3904 (Align_expression::value): Likewise.
3905 * script-sections.cc (class Sections_element): Add dot_alignment
3906 parameter to set_section_addresses virtual function. Update
3907 instantiations.
3908 (class Output_section_element): Likewise.
3909 (Script_sections::create_segments): Add dot_alignment parameter.
3910 Change all callers.
3911 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3912 (Script_sections::set_phdrs_clause_addresses): Likewise.
3913 * script-sections.h: Update declarations.
3914 * script.h: Update declarations.
3915 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3916 min_p_align.
3917 * testsuite/script_test_3.t: Set large alignment.
3918 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3919 segment has expected alignment.
3920
9c9c98a5
NC
39212010-04-22 Nick Clifton <nickc@redhat.com>
3922
3923 * po/gold.pot: Updated by the Translation project.
3924 * po/vi.po: Updated Vietnamese translation.
3925
2253bfba
L
39262010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3927
3928 * testsuite/Makefile.am (check_PROGRAMS): Add
3929 icf_virtual_function_folding_test.
3930 * testsuite/Makefile.in: Regenerated.
3931
85fdf906
AH
39322010-04-15 Andrew Haley <aph@redhat.com>
3933
3934 * options.h (merge_exidx_entries): New option.
3935 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3936 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3937 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3938 (Target_arm::merge_exidx_entries): New function.
3939 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3940 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3941 to Arm_exidx_fixup constructor.
3942 Add new arg, merge_exidx_entries.
3943 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3944 Arm_output_section::fix_exidx_coverage.
3945
ce97fa81
ST
39462010-04-18 Sriraman Tallam <tmsriram@google.com>
3947
3948 * icf.cc (get_section_contents): Check for preemptible functions.
3949 Ignore addend when appropriate.
3950 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3951 section folded.
3952 (add_from_relobj): Check for section folded.
3953 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3954 * symtab.h (should_add_dynsym_entry): Add new parameter.
3955 * target-reloc.h (scan_relocs): Check for section folded.
3956 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3957 Check reloc types for function pointers in shared objects.
3958 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3959 case.
3960 (icf_preemptible_functions_test): New test case.
3961 (icf_string_merge_test): New test case.
3962 * testsuite.Makefile.in: Regenerate.
3963 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3964 bar_glob. Refactor code.
3965 * testsuite/icf_preemptible_functions_test.cc: New file.
3966 * testsuite/icf_preemptible_functions_test.sh: New file.
3967 * testsuite/icf_string_merge_test.cc: New file.
3968 * testsuite/icf_string_merge_test.sh: New file.
3969 * testsuite/icf_virtual_function_folding_test.cc: New file.
3970 * testsuite/icf_virtual_function_folding_test.sh: New file.
3971
04ceb17c
DK
39722010-04-14 Doug Kwan <dougkwan@google.com>
3973
3974 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3975 for local symbol recounting if we remove a section due to ICF.
3976 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3977 there are no regular objects in input.
3978
153e7da4
DK
39792010-04-13 Doug Kwan <dougkwan@google.com>
3980
3981 * arm.cc (Arm_input_section::set_final_data_size): Compute
3982 accurate final data size instead of using current data size.
3983
4dbd9faf
DK
39842010-04-09 Doug Kwan <dougkwan@google.com>
3985
3986 * layout.cc (Layout::choose_output_section): Handle script section
3987 types.
3988 (Layout::make_output_section_for_script): Add section type parameter.
3989 Handle script section types.
3990 * layout.h (Layout::make_output_section_for_script): Add section
3991 type parameter.
3992 * output.cc (Output_section::Output_section): Initialize data member
3993 is_noload_.
3994 (Output_section::do_reset_address_and_file_offset): Do not set address
3995 to 0 if section is a NOLOAD section.
3996 * output.h (Output_section::is_noload): New method.
3997 (Output_section::set_is_noload): Ditto.
3998 (Output_section::is_noload_): New data member.
3999 * script-c.h (Script_section_type): New enum type.
4000 (struct Parser_output_section_header): Add new file section_type.
4001 * script-sections.cc (Sections_element::output_section_name): Add
4002 parameter for returning script section type.
4003 (Output_section_definition::output_section_name): Ditto.
4004 (Output_section_definition::section_type)P; New method.
4005 (Output_section_definiton::script_section_type_name): Ditto.
4006 (Output_section_definition::script_section_type_): New data member.
4007 (Output_section_definition::Output_section_definition): Initialize
4008 data member Output_section_definition::script_section_type_.
4009 (Output_section_definition::create_sections): Pass script section type
4010 to Layout::make_output_section_for_script.
4011 (Output_section_definition::output_section_name): Return script
4012 section type to caller.
4013 (Output_section_definition::set_section_address): Do not advance
4014 dot value and load address if section type is NOLOAD. Set address
4015 of NOLOAD sections regardless of section flags.
4016 (Output_section_definition::print): Print section type if it is
4017 not SCRIPT_SECTION_TYPE_NONE.
4018 (Output_section_definition::section_type): New method.
4019 (Output_section_definition::script_section_type_name): Ditto.
4020 (Script_sections::output_section_name): Add new parameter
4021 PSECTION_TYPE for returning script section type. Pass it to
4022 section elements. Handle discard sections.
4023 (Sort_output_sections::operator()): Handle NOLOAD sections.
4024 * script-sections.h (Script_sections::Section_type): New enum type.
4025 (Script_sections::output_section_name): Add a new parameter for
4026 returning script section type.
4027 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
4028 INFO and NOLOAD.
4029 * yyscript.y (union): Add new field SECTION_TYPE.
4030 (COPY, DSECT, INFO, NOLOAD): New tokens.
4031 (opt_address_and_section_type): Change type to output_section_header.
4032 (section_type): New non-terminal
4033 (section_header): Handle section type.
2253bfba 4034 (opt_address_and_section_type): Return section type value.
4dbd9faf 4035
721ea635
L
40362010-04-09 H.J. Lu <hongjiu.lu@intel.com>
4037
4038 * testsuite/plugin_common_test_1.c (foo): Add prototype.
4039 * testsuite/plugin_common_test_2.c (foo): Likewise.
4040
6bf924b0
DK
40412010-04-08 Doug Kwan <dougkwan@google.com>
4042
4043 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
4044 Output_merge_data.
4045 * output.cc (Output_section::add_merge_input_section): Simplify
4046 code and return status of Output_merge_base::add_input_section.
e1df38aa 4047 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
4048 returns true.
4049
24af6f92
DK
40502010-04-07 Doug Kwan <dougkwan@google.com>
4051
4052 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
4053 if section is marked as containing instructions but has no mapping
4054 symbols.
4055 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
4056 correct section index.
4057 (Arm_relobj::find_linked_text_section): Ditto.
4058
00698fc5
CC
40592010-04-07 Cary Coutant <ccoutant@google.com>
4060
4061 * archive.cc (include_member): Destroy Read_symbols_data object before
4062 releasing file.
4063 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
4064 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
4065 (Read_symbols_data::~Read_symbols_data) New destructor.
4066 (Section_relocs::Section_relocs) New constructor.
4067 (Section_relocs::~Section_relocs) New destructor.
4068 (Read_relocs_data::Read_relocs_data) New constructor.
4069 (Read_relocs_data::~Read_relocs_data) New destructor.
4070 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
4071 pointers to NULL after deleting.
4072
7296d933
DK
40732010-04-07 Doug Kwan <dougkwan@google.com>
4074
4075 * arm.cc: Replace "endianity" with "endianness" in comments.
4076 (Arm_exidx_cantunwind): Ditto.
4077 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4078 (Arm_relobj::merge_flags_and_attributes): New method.
4079 (Arm_relobj::merge_flags_and_attributes_): New data member.
4080 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4081 (Arm_relobj::scan_sections_for_stubs): Ditto.
4082 (Arm_relobj::do_read_symbols): Check to see if we really want to
4083 merge processor-specific flags and attributes. Exit early if
4084 an object is empty except for section names and the undefined symbol.
4085 (Target_arm::do_finalize_sections): Move check for ELF format to
4086 Arm_relobj::do_read_symbols. Merge processor specific flags and
4087 attributes from a regular object only when we have determined that
4088 it is aapropriate. Do not create an .ARM.attributes section in
4089 output if there is no regular input object.
4090 (Target_arm::merge_processor_specific_flags): Check
4091 --warn-mismatch before printing any error.
4092 (Target_arm::merge_object_attributes): Ditto.
4093 * gold.cc (queue_middle_tasks): Handle the case in which there is
4094 no regular object in input.
4095 * options.cc (General_options::parse_EB): New method.
4096 (General_options::parse_EL): Same.
4097 (General_options::General_options): Initialize endianness_.
4098 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4099 New options.
4100 (General_options::Endianness): New enum.
4101 (General_options::endianness): New method.
4102 (General_options::endianness_): New data member.
4103 * parameters.cc (Parameters::set_options): Check target endianness.
4104 (Parameters::set_target_once): Ditto.
4105 (Parameters::check_target_endianness): New method.
4106 (parameters_force_valid_target): If either -EL or -EB is specified,
4107 use it to define endianness of default target.
4108 * parameters.h (Parameters::check_target_endianness): New method
4109 declaration.
4110 * target.h (class Target): Change "endianity" to "endianness"
4111 in comments.
4112
efc8d4f2
RW
41132010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4114
4115 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4116 * configure: Regenerate.
4117 * Makefile.in: Regenerate.
4118 * testsuite/Makefile.in: Regenerate.
4119
be234d88
CC
41202010-04-06 Cary Coutant <ccoutant@google.com>
4121
4122 gcc PR lto/42757
4123 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4124 prevailing definitions of common symbols.
4125 * testsuite/plugin_test_6.sh: New test case.
4126 * testsuite/plugin_common_test_1.c: New test case.
4127 * testsuite/plugin_common_test_2.c: New test case.
4128 * testsuite/Makefile.am (plugin_test_6): New test case.
4129 * testsuite/Makefile.in: Regenerate.
4130
bd32c6bd
NC
41312010-04-06 Nick Clifton <nickc@redhat.com>
4132
4133 * po/vi.po: New Vietnamese translation.
4134
323c532f
DK
41352010-03-30 Doug Kwan <dougkwan@google.com>
4136
4137 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4138
4fcd97eb
DK
41392010-03-25 Doug Kwan <dougkwan@google.com>
4140
4141 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4142 to avoid a conversion warning on a 32-bit host.
4143
4ebf39db
ILT
41442010-03-24 Ian Lance Taylor <iant@google.com>
4145
4146 * testsuite/script_test_3.t: Add a TLS segment.
4147 * testsuite/Makefile.am (check_PROGRAMS): Add
4148 tls_phdrs_script_test.
4149 (tls_phdrs_script_test_SOURCES): Define.
4150 (tls_phdrs_script_test_DEPENDENCIES): Define.
4151 (tls_phdrs_script_test_LDFLAGS): Define.
4152 (tls_phdrs_script_test_LDADD): Define.
4153 * testsuite/Makefile.in: Rebuild.
4154
4a599bdd
CC
41552010-03-23 Cary Coutant <ccoutant@google.com>
4156
4157 * fileread.cc (find_or_make_view): Fix comment.
4158
6c93b22c
ILT
41592010-03-23 Ian Lance Taylor <iant@google.com>
4160
4161 * script-sections.cc (class Orphan_section_placement): Define
4162 PLACE_TLS and PLACE_TLS_BSS.
4163 (Orphan_section_placement::Orphan_section_placement): Initialize
4164 new places.
4165 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4166 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4167 (tls_script_test_SOURCES): Define.
4168 (tls_script_test_DEPENDENCIES): Define.
4169 (tls_script_test_LDFLAGS): Define.
4170 (tls_script_test_LDADD): Define.
4171 * testsuite/Makefile.in: Rebuild.
4172
a2c7281b
DK
41732010-03-22 Doug Kwan <dougkwan@google.com>
4174
4175 * arm.cc (Arm_relocate_functions::abs8,
4176 Arm_relocate_functions::abs16): Use correct check for overflow
4177 specified in the ARM ELF specs.
4178 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4179 target of a BLX instruction specially.
4180 (Reloc_stub::stub_type_for_reloc): Ditto.
4181 (Relocate::relocate): Use symbolic names instead of numeric relocation
4182 codes to report error.
4183 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4184 workaround.
4185 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4186 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4187 thumb2_blx_out_of_range.stdout
4188 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4189 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4190 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4191 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4192 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4193 thumb2_blx_in_range, thumb2_blx_in_range.o,
4194 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4195 thumb2_blx_out_of_range.o): New rules.
4196 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4197 thumb2_blx_in_range and thumb2_blx_out_of_range.
4198 * testsuite/Makefile.in: Regenerate.
4199 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4200 * testsuite/thumb_blx_in_range.s: New file.
4201 * testsuite/thumb_blx_out_of_range.s: New file.
4202
b0193076
RÁE
42032010-03-22 Rafael Espindola <espindola@google.com>
4204
4205 * archive.cc (Should_include): Move to archive.h.
4206 (should_include_member): Make it a member of Archive.
4207 (Lib_group): New.
4208 (Add_lib_group_symbols): New.
4209 * archive.h: Include options.h.
4210 (Archive_member): Moved from Archive.
4211 (Should_include): Moved from archive.cc.
4212 (Lib_group): New.
4213 (Add_lib_group_symbols): New.
4214 * dynobj.cc (do_should_include_member): New.
4215 * dynobj.h (do_should_include_member): New.
4216 * gold.cc (queue_initial_tasks): Update call to queue.
4217 * main.cc (main): Print lib group stats.
4218 * object.cc (do_should_include_member): New.
4219 * object.h: Include archive.h.
4220 (Object::should_include_member): New.
4221 (Object::do_should_include_member): New.
4222 (Sized_relobj::do_should_include_member): New.
4223 * options.cc (General_options::parse_start_lib): New.
4224 (General_options::parse_end_lib): New.
4225 (Input_arguments::add_file): Handle lib groups.
4226 (Input_arguments::start_group): Check we are not in a lib.
4227 (Input_arguments::start_lib): New.
4228 (Input_arguments::end_lib): New.
4229 * options.h (General_options): Add start_lib and end_lib.
4230 (Input_argument::lib_): New.
4231 (Input_argument::lib): New.
4232 (Input_argument::is_lib): New.
4233 (Input_file_lib): New.
4234 (Input_arguments::in_lib_): New.
4235 (Input_arguments::in_lib): New.
4236 (Input_arguments::start_lib): New.
4237 (Input_arguments::end_lib_): New.
4238 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4239 in unused members as preempted.
4240 (Sized_pluginobj::do_should_include_member): New.
4241 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4242 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4243 return the blocker.
4244 (Read_symbols::do_whole_lib_group): New.
4245 (Read_symbols::do_lib_group): New.
4246 (Read_symbols::do_read_symbols): Handle lib groups.
4247 (Read_symbols::get_name): Handle lib groups.
4248 * readsyms.h (Read_symbols): Add an archive member pointer.
4249 (Read_symbols::do_whole_lib_group): New.
4250 (Read_symbols::do_lib_group): New.
4251 (Read_symbols::member_): New.
4252 * script.cc (read_input_script): Update call to queue_soon.
4253
d099120c
DK
42542010-03-19 Doug Kwan <dougkwan@google.com>
4255
4256 * arm.cc (Stub_table::Stub_table): Initialize new data members
4257 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4258 (Stub_table::add_reloc_stub): Assign stub offset and update
4259 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4260 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4261 New data members.
4262 (Stub_table::update_data_size_and_addralign): Use
4263 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4264 instead of going over all reloc stubs.
4265 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4266 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4267 Stringpool_template::offset_ to size of Stringpool_char.
4268 (Stringpool_template::new_key_offset): Remove code to initialize
4269 Stringpool_template::offset_.
4270 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4271 Stringpool_template::offset_ to zero.
4272
1aa37384
DK
42732010-03-15 Doug Kwan <dougkwan@google.com>
4274
4275 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4276 offset_.
4277 (Stringpool_template::new_key_offset): New method.
4278 (Stringpool_template::add_string): Assign offsets when adding new
4279 strings.
4280 (Stringpool_template::set_string_offsets): Do not set string offsets
4281 when not optimizing.
4282 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4283 member size_.
4284 (Chunked_vector::clear): Clear size_.
4285 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4286 (Chunked_vector::size): Return size_.
4287 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 4288 (Chunked_vector::size_): New data member.
1aa37384
DK
4289 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4290 (Stringpool_template::new_key_offset): New method declaration.
4291 (Stringpool_template::offset_): New data member.
4292
b672b057
RÁE
42932010-03-15 Rafael Espindola <espindola@google.com>
4294
4295 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4296 Add_symbols' constructor.
4297 * readsyms.h (Add_symbols): Remove the input_group member.
4298
b6848d3c
ILT
42992010-03-10 Ian Lance Taylor <iant@google.com>
4300
4301 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4302 target to ask whether a reference to a symbol requires a stack
4303 split.
4304 * target.h (Target::is_call_to_non_split): New function.
4305 (Target::do_is_call_to_non_split): Declare virtual function.
4306 * target.cc: Include "symtab.h".
4307 (Target::do_is_call_to_non_split): New function.
4308 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4309
a2a5469e
CC
43102010-03-10 Cary Coutant <ccoutant@google.com>
4311
4312 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4313 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4314 (File_read::open[2]): Add whole_file_view_ to list of views.
4315 (File_read::make_view): Remove test of whole_file_view_.
4316 (File_read::find_or_make_view): Create whole_file_view_ if
4317 necessary.
4318 (File_read::clear_views): Replace bool parameter with enum;
4319 adjust all callers. Don't delete views with permanent data;
4320 do delete cached views and views from archives if
4321 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4322 if clearing the corresponding view.
4323 * fileread.h (File_read::Clear_views_mode): New enum.
4324 (File_read::View::is_permanent_view): New method.
4325 (File_read::clear_views): Replace bool parameter
4326 with enum; adjust all callers.
4327 * options.h (General_options): Change keep_files_mapped option;
4328 add map_whole_files.
4329 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4330 releasing the file.
4331 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4332 the file.
4333
8861f32b
DM
43342010-03-10 David S. Miller <davem@davemloft.net>
4335
4336 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4337
d62d0f5f
ST
43382010-03-09 Sriraman Tallam <tmsriram@google.com>
4339
4340 * icf.cc (get_section_contents): Add '@' marker after processing the
4341 merge reloc.
4342
9177756d
DK
43432010-03-08 Doug Kwan <dougkwan@google.com>
4344
4345 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4346 due to a conversion warning.
4347 (Arm_relobj::update_output_local_symbol_count): Check for local
4348 symbol with unset output index.
4349
9e9e071b
ILT
43502010-03-05 Ian Lance Taylor <iant@google.com>
4351
4352 * options.h (class General_options): Add --spare-dynamic-tags.
4353 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4354 --spare-dynamic-tags.
4355
a81ee015
ILT
43562010-03-05 Ian Lance Taylor <iant@google.com>
4357
4358 * incremental.cc: Include "libiberty.h".
4359
44ec90b9
RO
43602010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4361
4362 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4363 function, is_info_ member.
4364 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4365 (Versions::Versions): Update caller.
4366 (Versions::define_base_version): Likewise.
4367 (Versions::add_def): Likewise.
4368
0897ed3b
ST
43692010-03-03 Sriraman Tallam <tmsriram@google.com>
4370
4371 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4372 (Scan::possible_function_pointer_reloc): New function.
4373 (Scan::local_reloc_may_be_function_pointer): Change to call
4374 possible_function_pointer_reloc.
4375 (Scan::global_reloc_may_be_function_pointer): Ditto.
4376 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4377 relocations in ".data.rel.ro._ZTV" section.
4378 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4379 * testsuite/icf_safe_so_test.cc: Ditto.
4380 * testsuite/icf_safe_test.cc: Ditto.
4381 * testsuite/icf_safe_test.sh: Ditto.
4382
d3bbad62
ILT
43832010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4384 Ian Lance Taylor <iant@google.com>
4385
4386 * target-reloc.h (relocate_section): Check the symbol table index
4387 for -1U before setting the local symbol index.
4388 (scan_relocatable_relocs): If copying the relocation, record that
4389 the local symbol is required.
4390 * object.h (Symbol_value::is_output_symtab_index_set): New
4391 function.
4392 (Symbol_value::may_be_discarded_from_output_symtab): New
4393 function.
4394 (Symbol_value::has_output_symtab_entry): New function.
4395 (Symbol_value::needs_output_symtab_entry): Remove.
4396 (Symbol_value::output_symtab_index): Make sure the symbol index is
4397 set.
4398 (Symbol_value::set_output_symtab_index): Make sure the symbol
4399 index is not set. Make sure the new index is valid.
4400 (Symbol_value::set_must_have_output_symtab_entry): New function.
4401 (Symbol_value::has_output_dynsym_entry): New function.
4402 (Symbol_value::set_output_dynsym_index): Make sure the new index
4403 is valid.
4404 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4405 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4406 local symbol if permitted.
4407 (Sized_relobj::do_finalize_local_symbols): Call
4408 is_output_symtab_index_set rather than needs_output_symtab_entry.
4409 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4410 rather than needs_output_symtab_entry. Call
4411 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4412 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4413 is_output_symtab_index_set rather than needs_output_symtab_entry.
4414 * testsuite/discard_locals_relocatable_test.c: New file.
4415 * testsuite/discard_locals_test.sh: Test -r.
4416 * testsuite/Makefile.am (check_DATA): Add
4417 discard_locals_relocatable_test1.syms,
4418 discard_local_relocatable_test2.syms.
4419 (MOSTLYCLEANFILES): Likewise. Also add
4420 discard_locals_relocatable_test1.lout and
4421 discard_locals_relocatable_test2.out.
4422 (discard_locals_relocatable_test1.syms): New target.
4423 (discard_locals_relocatable_test.o): New target.
4424 (discard_locals_relocatable_test1.out): New target.
4425 (discard_locals_relocatable_test2.syms): New target.
4426 (discard_locals_relocatable_test2.out): New target.
4427 (various): Add missing ../ld-new dependencies.
4428 * testsuite/Makefile.in: Rebuild.
4429
7e8ccf26
NC
44302010-03-03 Nick Clifton <nickc@redhat.com>
4431
4432 * po/fi.po: New Finnish translation.
4433
2a0ff005
DK
44342010-03-01 Doug Kwan <dougkwan@google.com>
4435
4436 * layout.cc (Layout::Layout): Force section types of .init_array*,
4437 .preinit_array* and .fini_array* sections.
4438 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4439 Fix check of return value of std::string::find.().
4440 (Output_section::Input_section_sort_compare::operator()): Remove
4441 comment about .init_array.
4442 (Output_section::Input_section_sort_init_fini_compare::operator()):
4443 New method.
4444 (Output_section::sort_attached_input_sections): Handle .init_array
4445 and .fini_array specially.
4446 * output.h (Output_section::Inut_section_sort_compare): Update
4447 comment.
4448 (Output_section::Input_section_sort_init_fini_compare): New struct.
4449
c3e4ae29
DK
44502010-02-26 Doug Kwan <dougkwan@google.com>
4451
4452 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4453 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4454 * testsuite/debug_msg.sh: Avoid matching source line number for
4455 use of global variable undef_int.
4456
2fd9ae7a
DK
44572010-02-26 Doug Kwan <dougkwan@google.com>
4458
4459 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4460 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4461 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4462 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4463 * options.cc (General_options::General_options): Initialize member
4464 fix_v4bx_.
4465 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4466 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4467 and rm_no_fix_v4bx.stdout
4468 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4469 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4470 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4471 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4472 and arm_no_fix_v4bx.
4473 * Makefile.in: Regenerate.
4474 * testsuite/arm_fix_v4bx.s: New file.
4475 * testsuite/arm_fix_v4bx.sh: Ditto.
4476
67ec7d0b
DK
44772010-02-24 Doug Kwan <dougkwan@google.com>
4478
4479 * arm.cc (Target_arm::got_section): Make the .got section the first
4480 non RELRO section in the data segment.
4481 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4482 suffixes of section names.
4483
10165461
DK
44842010-02-24 Doug Kwan <dougkwan@google.com>
4485
4486 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4487 flags and attributes merging if an input file is a binary file.
4488 * fileread.cc (Input_file::open): Record format of original file.
4489 * fileread.h (Input_file::Format): New enum type.
4490 (Input_file::Input_file): Initialize data member format_.
4491 (Input_file::format): New method definition.
4492 (Input_file::format_):: New data member.
4493
4a54abbb
DK
44942010-02-24 Doug Kwan <dougkwan@google.com>
4495
4496 * arm.cc (Arm_output_data_got): New class.
4497 (ARM_TCB_SIZE): New constant
4498 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4499 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4500 If user uses a script with a SECTIONS clause, issue only a warning
4501 for a misplaced EXIDX input section. Otherwise, issue an error.
4502 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4503 garbage collection.
4504 (Target_arm::got_mode_index_entry): Handle static linking.
4505 (Target_arm::Scan::local): Ditto.
4506 (Target_arm::Scan::global): Ditto.
4507 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4508 all incorrectly implemented relocations.
e1df38aa 4509 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
4510 Arm_output_section::fix_exidx_coverage.
4511 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4512 from ".ARM.exidx." and ".ARM.extab.".
4513
ca419a6f
ILT
45142010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4515
4516 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4517 section if it does not already exist.
4518 * attributes.cc (Attributes_section_data::Attributes_section_data):
4519 Don't crash if size is zero.
4520
135b9c78
ILT
45212010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4522 Ian Lance Taylor <iant@google.com>
4523
4524 * gold.cc (queue_middle_tasks): If no input files were opened,
4525 exit.
4526 * workqueue.h (Task_function::Task_function): Assert that there is
4527 a blocker.
4528
bb0bfe4f
DK
45292010-02-22 Doug Kwan <dougkwan@google.com>
4530
4531 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4532 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4533 types to avoid warnings due to different uint64_t implementations
4534 on different hosts.
4535
2a2b6d42
DK
45362010-02-21 Doug Kwan <dougkwan@google.com>
4537
4538 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4539 handling of the maximum backward branch offset.
4540 (Arm_relocate_functions::thumb_branch_common): Ditto.
4541 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4542 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 4543 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
4544 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4545 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4546 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4547 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4548 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4549 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4550 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4551 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4552 thumb2_bl_out_of_range.o): New rules.
4553 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4554 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4555 thumb2_bl_out_of_range
4556 * testsuite/Makefile.in: Regenerate.
4557 * testsuite/arm_bl_in_range.s: New file.
4558 * testsuite/arm_bl_out_of_range.s: Ditto.
4559 * testsuite/arm_branch_in_range.sh: Ditto.
4560 * testsuite/arm_branch_range.t: Ditto.
4561 * testsuite/thumb2_branch_range.t: Ditto.
4562 * testsuite/thumb_bl_in_range.s: Ditto.
4563 * testsuite/thumb_bl_out_of_range.s: Ditto.
4564 * testsuite/thumb_branch_range.t: Ditto.
4565
b487ad64
ST
45662010-02-20 Sriraman Tallam <tmsriram@google.com>
4567
4568 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4569 Add reloc offset information.
4570 * icf.cc (get_section_contents): Change iterators to point to the new
4571 vectors. Add reloc offset information to the contents.
4572 * icf.h (Icf::Sections_reachable_info): New typedef.
4573 (Icf::Sections_reachable_list): New typedef.
4574 (Icf::Offset_info): New typedef.
4575 (Icf::Reloc_info): New struct typedef.
4576 (Icf::Reloc_info_list): New typedef.
4577 (Icf::symbol_reloc_list): Delete method.
4578 (Icf::addend_reloc_list): Delete method.
4579 (Icf::section_reloc_list): Delete method.
4580 (Icf::reloc_info_list): New method.
4581 (Icf::reloc_info_list_): New member.
4582
f96accdf
DK
45832010-02-19 Doug Kwan <dougkwan@google.com>
4584
4585 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4586 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4587 * arm.cc (Arm_relocation_functions): New forward declaration.
4588 (Target_arm::Target_arm): Initialize new data members
4589 got_mod_index_offset_ and tls_base_symbol_defined_.
4590 (Target_arm::Relocate::relocate_tls): New method.
4591 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4592 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4593 New methods.
4594 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4595 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4596 (Target_arm::got_mod_index_offset_,
4597 Target_arm::tls_base_symbol_defined_): New data members.
4598 (Target_arm::Scan::local, Target::Scan::global,
4599 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4600 relocations.
4601
c8761b9a
DK
46022010-02-18 Doug Kwan <dougkwan@google.com>
4603
4604 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4605 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4606 text section as a parameter becuase some broken tools may not set
4607 the link in section header.
4608 (Target_arm::has_got_section): New method.
4609 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4610 without any mapping symbol as data only. Remove warning.
4611 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4612 link in its section header, try to discover the link by inspecting the
4613 REL31 relocation at the beginning of the section.
4614 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4615 in error message.
4616 (Target_arm::Scan::global): Treat any reference to the symbol
4617 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4618
21bb3914
ST
46192010-02-12 Sriraman Tallam <tmsriram@google.com>
4620
4621 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4622 (Scan::global_reloc_may_be_function_pointer): New function.
4623 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4624 (Scan::global_reloc_may_be_function_pointer): New function.
4625 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4626 (Scan::global_reloc_may_be_function_pointer): New function.
4627 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4628 (Scan::global_reloc_may_be_function_pointer): New function.
4629 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4630 (Scan::global_reloc_may_be_function_pointer): New function.
4631 (Scan::possible_function_pointer_reloc): New function.
4632 (Target_x86_64::can_check_for_function_pointers): New function.
4633 * gc.h (gc_process_relocs): Scan relocation types to determine if
4634 function pointers were taken for targets that support it.
4635 * icf.cc (Icf::find_identical_sections): Include functions for
4636 folding in safe ICF whose pointer is not taken.
4637 * icf.h (Secn_fptr_taken_set): New typedef.
4638 (fptr_section_id_): New member.
4639 (section_has_function_pointers): New function.
4640 (set_section_has_function_pointers): New function.
4641 (check_section_for_function_pointers): New function.
4642 * options.h: Fix comment for safe ICF option.
4643 * target.h (can_check_for_function_pointers): New function.
4644 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4645 Modify icf_safe_test for X86-64.
4646 * testsuite/Makefile.in: Regenerate.
4647 * testsuite/icf_safe_so_test.cc: New file.
4648 * testsuite/icf_safe_so_test.sh: New file.
4649 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4650 (main): Change to take pointer to function kept_func_3.
4651 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4652 folding is done correctly for X86-64.
4653
0da6fa6c
DM
46542010-02-12 David S. Miller <davem@davemloft.net>
4655
4656 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4657 is_symbolless parameter.
4658 (Output_reloc<SHT_REL>::is_symbolless): New.
4659 (Output_reloc<SHT_REL>::is_symbolless_): New.
4660 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4661 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4662 (Output_reloc<SHT_RELA>::is_symbolless): New.
4663 (Output_data_reloc::add_global): Handle is_symbolless.
4664 (Output_data_reloc::add_global_relative): Likewise.
4665 (Output_data_reloc::add_local): Likewise.
4666 (Output_data_reloc::add_local_relative): Likewise.
4667 (Output_data_reloc::add_symbolless_global_addend): New.
4668 (Output_data_reloc::add_symbolless_local_addend): New.
4669 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4670 is_symbolless.
4671 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4672 instead of ->is_relative_
4673 (Output_reloc::write): Likewise.
4674 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4675 (Output_reloc::write_rel): Simplify.
4676
4677 * sparc.cc (Target_sparc::Scan::local): Use
4678 ->add_symbolless_local_addend as needed.
4679 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4680 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4681 based upon relocation offset.
4682
e4782e83
DK
46832010-02-11 Doug Kwan <dougkwan@google.com>
4684
4685 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4686 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4687 beginning of function.
4688 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4689 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4690 parameter is_32bit in calls to should_apply_static_reloc.
4691 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4692 (check_DATA): Add arm_abs_global.stdout.
4693 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4694 arm_abs_global.stdout): New rules.
4695 (MOSTLLYCLEANFILES): Add arm_abs_global
4696 * Makefile.in: Regenerate.
4697 * testsuite/arm_abs_global.s: New file.
4698 * testsuite/arm_abs_global.sh: Ditto.
4699 * testsuite/arm_abs_lib.s: Ditto.
4700
93ceb764
ILT
47012010-02-11 Ian Lance Taylor <iant@google.com>
4702
4703 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4704 Read_relocs task.
4705 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4706 Allocate_commons_task first.
4707 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4708 task, rather than symtab_lock_.
4709 (Gc_process_relocs::~Gc_process_relocs): New function.
4710 (Gc_process_relocs::is_runnable): Check this_blocker_.
4711 (Gc_process_relocs::locks): Use next_blocker_ rather than
4712 blocker_.
4713 (Scan_relocs::~Scan_relocs): New function.
4714 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4715 symtab_lock_.
4716 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4717 next_blocker_.
4718 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4719 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4720 constructor accordingly.
4721 (class Gc_process_relocs): Likewise.
4722 (class Scan_relocs): Likewise.
4723 * common.h (class Allocate_commons_task): Remove symtab_lock_
4724 field, and corresponding constructor parameter.
4725 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4726 symtab_lock_.
4727 (Allocate_commons_task::locks): Likewise.
4728
114dfbe1
ILT
47292010-02-11 Ian Lance Taylor <iant@google.com>
4730
4731 * gold-threads.h (class Once): Define.
4732 (class Initialize_lock): Rewrite as child of Once.
4733 * gold-threads.cc (class Once_initialize): Define.
4734 (once_pointer_control): New static variable.
4735 (once_pointer, once_arg): New static variables.
4736 (c_run_once): New static function.
4737 (Once::Once, Once::run_once, Once::internal_run): New functions.
4738 (class Initialize_lock_once): Remove.
4739 (initialize_lock_control): Remove.
4740 (initialize_lock_pointer): Remove.
4741 (initialize_lock_once): Remove.
4742 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4743 (Initialize_lock::initialize): Rewrite.
4744 (Initialize_lock::do_run_once): New function.
4745 * archive.cc (Archive::interpret_header): Only clear name if it is
4746 not already empty.
4747 * fileread.cc: Include "gold-threads.h"
4748 (file_counts_lock): New static variable.
4749 (file_counts_initialize_lock): Likewise.
4750 (File_read::release): Only increment counts when using --stats.
4751 Use a lock around the increment.
4752 * parameters.cc (class Set_parameters_target_once): Define.
4753 (set_parameters_target_once): New static variable.
4754 (Parameters::Parameters): Move here from parameters.h.
4755 (Parameters::set_target): Rewrite.
4756 (Parameters::set_target_once): New function.
4757 (Parameters::clear_target): Move here and rewrite.
4758 * parameters.h (class Parameters): Update declarations. Add
4759 set_parameters_target_once_ field.
4760 (Parameters::Parameters): Move to parameters.cc.
4761 (Parameters::clear_target): Likewise.
4762 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4763 task.
4764 (Start_group::~Start_group): New function.
4765 (Start_group::is_runnable): New function.
4766 (Start_group::locks, Start_group::run): New functions.
4767 (Finish_group::run): Change saw_undefined to size_t.
4768 * readsyms.h (class Start_group): Define.
4769 (class Finish_group): Change saw_undefined_ field to size_t.
4770 (Finish_group::Finish_group): Remove saw_undefined and
4771 this_blocker parameters. Change all callers.
4772 (Finish_group::set_saw_undefined): New function.
4773 (Finish_group::set_blocker): New function.
4774 * symtab.h (class Symbol_table): Change saw_undefined to return
4775 size_t. Change saw_undefined_ field to size_t.
4776 * target-select.cc (Set_target_once::do_run_once): New function.
4777 (Target_selector::Target_selector): Initialize set_target_once_
4778 field. Don't initialize lock_ and initialize_lock_ fields.
4779 (Target_selector::instantiate_target): Rewrite.
4780 (Target_selector::set_target): New function.
4781 * target-select.h (class Set_target_once): Define.
4782 (class Target_selector): Update declarations. Make
4783 Set_target_once a friend. Remove lock_ and initialize_lock_
4784 fields. Add set_target_once_ field.
4785
fa17a3f4
ILT
47862010-02-10 Ian Lance Taylor <iant@google.com>
4787
4788 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4789 queueing any tasks.
4790 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4791 (queue_middle_tasks): Add all blockers before queueing any tasks.
4792 (queue_final_tasks): Likewise.
4793 * token.h (Task_token::add_blockers): New function.
4794 * object.h (Input_objects::number_of_relobjs): New function.
4795
c7177d31
ILT
47962010-02-10 Ian Lance Taylor <iant@google.com>
4797
5de0e392
ILT
4798 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4799 shared, not if not position independent.
4800 * x86_64.cc (Relocate::relocate_tls): Likewise.
4801 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4802 (tls_pie_pic_test): New target.
4803 * testsuite/Makefile.in: Rebuild.
4804
c7177d31
ILT
4805 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4806 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4807 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4808 * testsuite/Makefile.in: Rebuild.
4809
684b268a
DM
48102010-02-09 David S. Miller <davem@davemloft.net>
4811
4812 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4813 R_SPARC_RELATIVE using ->add_local_relative().
4814 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4815
612a8d3d
DM
4816 * output.h (Output_data_dynamic::add_section_size): New method
4817 that takes two Output_data objects.
4818 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4819 entry param. Handle it in initializers.
4820 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4821 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4822 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4823 arg.
4824 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4825 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4826 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4827 for dynrel_includes_plt.
4828 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4829 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4830 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4831 before .rela.plt
4832 (Target_sparc::do_finalize_sections): Update to pass true for
4833 dynrel_includes_plt.
4834 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4835 output before .rela.plt
4836 (Target_powerpc::do_finalize_sections): Update to pass true for
4837 dynrel_includes_plt when 32-bit.
4838
cb1be87e
DK
48392010-02-08 Doug Kwan <dougkwan@google.com>
4840
4841 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4842 method.
4843 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4844 Arm_relobj::scan_section_for_cortex_a8_stubs,
4845 Arm_relobj::do_relocation_section): Instead of calling
4846 Output_section::output_address, use faster
4847 Arm_relobj::simple_input_section_output_address.
4848
705b5121
DM
48492010-02-08 David S. Miller <davem@davemloft.net>
4850
4851 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4852 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4853 relocation helper function.
4854
024c4466
DM
4855 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4856 just like R_SPARC_GOT{10,13,22}.
4857 (Target_sparc::Scan::local): Likewise.
4858 (Target_sparc::Relocate:relocate): Likewise.
4859
9109c078
ILT
48602010-02-06 Ian Lance Taylor <iant@google.com>
4861
4862 * configure.ac: Rewrite targetobjs duplicate removal code to use
4863 only shell constructs.
4864 * configure: Rebuild.
4865
cf846138
DK
48662010-02-05 Doug Kwan <dougkwan@google.com>
4867
4868 PR 11247
4869 * arm.cc (Arm_relobj::section_is_scannable): New method.
4870 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4871 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4872
6cfaf60b
DK
48732010-02-04 Doug Kwan <dougkwan@google.com>
4874
4875 PR 11247
4876 * arm-reloc-property.cc (cstdio): Include.
4877 * configure.ac (targetobjs): Remove duplicates.
4878 * configure: Regenerate.
4879 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4880 big and little endian version for a given address size.
4881
5c57f1be
DK
48822010-02-03 Doug Kwan <dougkwan@google.com>
4883
4884 * arm-reloc-property.cc
4885 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4886 definition.
4887 * arm-reloc-property.h
4888 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4889 New method definition.
4890 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4891 declaration.
4892 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4893 overflow to N.
4894 (GOT_PREL): Change implemented to Y.
4895 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4896 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4897 (Arm_relocate_functions::movw_abs_nc): Remove method.
4898 (Arm_relocate_functions::movt_abs): Ditto.
4899 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4900 (Arm_relocate_functions::thm_movt_abs): Ditto.
4901 (Arm_relocate_functions::movw_rel_nc): Ditto.
4902 (Arm_relocate_functions::movw_rel): Ditto.
4903 (Arm_relocate_functions::movt_rel): Ditto.
4904 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4905 (Arm_relocate_functions:thm_movw_rel): Ditto.
4906 (Arm_relocate_functions:thm_movt_rel): Ditto.
4907 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4908 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4909 New method definitions.
4910 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4911 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4912 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4913 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4914 (Target_arm::Relocate::relocate): Check for non-static or
4915 unimplemented relocation code and exit early. Change calls to
4916 Target_arm::reloc_uses_thumb_bit and
4917 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4918 instead. Refactor code to handle similar relocations to increase
4919 code sharing. Remove check for unsupported relocation code in switch
4920 statement.
4921 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4922 relocation property table to find out size. Change error message to
4923 print out the name of a relocation code instead of the numeric value.
4924 (Target_arm::scan_reloc_for_stub): Use relocation property table
4925 instead of calling Target_arm::reloc_uses_thumb_bit().
4926
218c5831
DK
49272010-02-02 Doug Kwan <dougkwan@google.com>
4928
4929 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4930 types of relaxed input section.
4931
0d31c79d
DK
49322010-02-02 Doug Kwan <dougkwan@google.com>
4933
4934 * Makefile.am (HFILES): Add arm-reloc-property.h.
4935 (DEFFILES): New.
4936 (TARGETSOURCES): Add arm-reloc-property.cc
4937 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4938 (libgold_a_SOURCES): $(DEFFILES)
4939 * Makefile.in: Regenerate.
4940 * arm-reloc-property.cc: New file.
4941 * arm-reloc-property.h: New file.
4942 * arm-reloc.def: New file.
4943 * arm.cc: Update comments.
4944 (arm-reloc-property.h): New included header.
4945 (arm_reloc_property_table): New global variable.
4946 (Target_arm::do_select_as_default_target): New method definition.
4947 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4948 arm-reloc-property to targ_extra_obj.
4949 * parameters.cc (set_parameters_target): Call
4950 Target::select_as_default_target().
4951 * target.h (Target::select_as_default_target): New method definition.
4952 (Target::do_select_as_default_target): Same.
4953
546c7457
DK
49542010-02-01 Doug Kwan <dougkwan@google.com>
4955
4956 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4957 first_output_text_section_.
4958 (Arm_exidx_fixup::first_output_text_section): New method definition.
4959 (Arm_exidx_fixup::first_output_text_section_): New data member.
4960 (Arm_exidx_fixup::process_exidx_section): Record the first text
4961 output section seen.
4962 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4963 and entsize in output section header.
4964
11b861d5
DK
49652010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4966
4967 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4968 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4969 (Arm_relocate_functions::thm_alu11): New Method.
4970 (Arm_relocate_functions::thm_pc8): New Method.
4971 (Arm_relocate_functions::thm_pc12): New Method.
4972 (Target_arm::Scan::local): Handle the relocations.
4973 (Target_arm::Scan::global): Likewise.
4974 (Target_arm::Relocate::relocate): Likewise.
4975 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4976
c9a2c125
DK
49772010-01-29 Doug Kwan <dougkwan@google.com>
4978
4979 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4980 of relocation types as ld.
4981
1521477a
DK
49822010-01-29 Doug Kwan <dougkwan@google.com>
4983
4984 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4985 to public.
4986 (Arm_relocate_functions::thumb_branch_common): Ditto.
4987 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4988 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4989 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4990 Arm_relocate_functions::jump24): Remove.
4991 (Target_arm::Relocate::relocate): Adjust code to call
4992 Arm_relocation_functions::arm_branch_common and
4993 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 4994 wrappers. Merge switch-cases together to reduce source code size.
1521477a 4995
e7eca48c
DK
49962010-01-29 Doug Kwan <dougkwan@google.com>
4997
4998 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4999 output_local_symbol_count_needs_update_.
5000 (Arm_relobj::output_local_symbol_count_needs_update,
5001 Arm_relobj::set_output_local_symbol_count_needs_update,
5002 Arm_relobj::update_output_local_symbol_count): New methods.
5003 (Arm_relobj::output_local_symbol_count_needs_update_): New data
5004 member.
5005 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
5006 of pointed function as in a R_ARM_PREL31 relocation.
5007 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
5008 for output local symbol count updating.
5009 (Target_arm::do_relax): Update output local symbol counts in objects
5010 if necessary.
5011 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
5012
02961d7e
ILT
50132010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5014
5015 * arm.cc: Added support for the ARM relocations:
5016 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
5017 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
5018 (Arm_relocate_functions::movw_rel_nc): Renamed (was
5019 movw_prel_nc).
5020 (Arm_relocate_functions::movw_rel): New method.
5021 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
5022 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
5023 thm_movw_prel_nc).
5024 (Arm_relocate_functions::thm_movw_rel): New method.
5025 (Arm_relocate_functions::thm_movt_rel): Renamed (was
5026 thm_movt_prel).
5027 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
5028 relocations.
5029 (Target_arm::Scan::global): Likewise.
5030 (Target_arm::Relocate::relocate): Likewise.
5031 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5032 Likewise.
5033
b10d2873
ILT
50342010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5035
5036 * arm.cc: Added support for ARM group relocations.
5037 (Target_arm::reloc_needs_sym_origin): New method.
5038 (Arm_relocate_functions::calc_grp_kn): New method.
5039 (Arm_relocate_functions::calc_grp_residual): New method.
5040 (Arm_relocate_functions::calc_grp_gn): New method.
5041 (Arm_relocate_functions::arm_grp_alu): New Method.
5042 (Arm_relocate_functions::arm_grp_ldr): New Method.
5043 (Arm_relocate_functions::arm_grp_ldrs): New Method.
5044 (Arm_relocate_functions::arm_grp_ldc): New Method.
5045 (Target_arm::Scan::local): Handle the ARM group relocations.
5046 (Target_arm::Scan::global): Likewise.
5047 (Target_arm::Relocate::relocate): Likewise.
5048 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5049 Likewise.
5050
2b328d4e
DK
50512010-01-26 Doug Kwan <dougkwan@google.com>
5052
5053 * arm.cc (set): Include.
5054 (class Arm_exidx_fixup): Change type of last_input_section_ to const
5055 pointer type.
5056 (Arm_output_section::Text_section_list): New type.
5057 (Arm_output_section::append_text_sections_to_list): New method.
5058 (Arm_output_section::fix_exidx_coverage): Ditto.
5059 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
5060 (Arm_relobj::convert_input_section_to_relaxed_section): Use
5061 Relobj::set_section_offset() instead of
5062 Sized_relobj::invalidate_section_offset().
5063 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
5064 parameter for section headers. Ignore relocation sections for
5065 unallocated sections and EXIDX sections.
5066 (Target_arm::fix_exidx_coverage): New method.
5067 (Target_arm::output_section_address_less_than): New type.
5068 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
5069 linked text section instead of the EXIDX section.
5070 (Arm_output_section::create_stub_group): Add an assertion to check
5071 that this is not an EXIDX output section.
5072 (Arm_output_section::append_text_sections_to_list): New method.
5073 (Arm_output_section::fix_exidx_coverage): Ditto.
5074 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5075 Arm_relobj::section_needs_reloc_stub_scanning.
5076 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5077 first pass.
5078 (Target_arm::fix_exidx_coverage): New method.
5079 * object.h (Relobj::set_output_section): New method.
5080 (Sized_relobj::invalidate_section_offset): Remove method.
5081 (Sized_relobj::do_invalidate_section_offset): Remove method.
5082 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5083
c7f3c371
DK
50842010-01-25 Doug Kwan <dougkwan@google.com>
5085
5086 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5087 Fix warning due to signed and unsigned comparison on a 32-bit host.
5088
8923b24c
DK
50892010-01-22 Doug Kwan <dougkwan@google.com>
5090
5091 * arm.cc (Target_arm::do_relax): Record an output section for section
5092 offset adjustment it contains any stub table that has changed.
5093 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5094 offsets in an output section if necessary.
5095 * output.cc (Output_section::Output_section): Initialize
5096 section_offsets_need_adjustments_.
5097 (Output_section::add_input_section_for_script): Renamed to
5098 Output_section::add_simple_input_section.
5099 (Output_section::save_states): Add a comment.
5100 (Output_section::discard_states): New method defintion.
5101 (Output_section::adjust_section_offsets): Same.
5102 * output.h (Output_section::add_input_section_for_script): Renamed to
5103 Output_section::add_simple_input_section.
5104 (Output_section::discard_states): New method declaration.
5105 (Output_section::adjust_section_offsets): Same.
5106 (Output_section::section_offsets_need_adjustment,
5107 Output_section::set_section_offsets_need_adjustment): New method
5108 definitions.
5109 (Output_section::section_offsets_need_adjustment_): New data member.
5110 * script-sections.cc
5111 (Output_section_element_input::set_section_address): Adjust code for
5112 renaming of Output_section::add_input_section_for_script.
5113 (Orphan_output_section::set_section_address): Same.
5114
9b2fd367
DK
51152010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5116
5117 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5118 Fix_v4bx enum values .
5119 * gold/options.h (General_options): New option definitions.
5120 (General_options::fix_v4bx): New method.
5121 (General_options::Fix_v4bx): New enum.
5122 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5123 (General_options::parse_fix_v4bx_interworking): New method.
5124
80d0d023
DK
51252010-01-22 Doug Kwan <dougkwan@google.com>
5126
5127 * arm.cc (Arm_exidx_fixup): New class.
5128
af2cdeae
DK
51292010-01-21 Doug Kwan <dougkwan@google.com>
5130
5131 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5132 classes.
5133 (Arm_exidx_section_offset_map): New type.
5134
993d07c1
DK
51352010-01-21 Doug Kwan <dougkwan@google.com>
5136
5137 * arm.cc (Arm_exidx_input_section): New class.
5138 (Arm_relobj::exidx_input_section_by_link,
5139 Arm_relobj::exidx_input_section_by_shndx,
5140 Arm_relobj::make_exidx_input_section): New methods.
5141 (read_arm_attributes_section): Remove.
5142 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5143 information about them.
5144 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5145 to here.
5146
5ac169d4
DK
51472010-01-20 Doug Kwan <dougkwan@google.com>
5148
5149 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5150 Input_section_specifier to Section_id.
5151 (Target_arm::new_arm_input_section: Adjust code for change of key
5152 type.
5153 (Target_arm::find_arm_input_section): Ditto.
5154 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5155 (Section_id): Remove.
5156 (Garbage_collection::Section_id_hash): Remove.
5157 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5158 (Section_id): Remove.
5159 (Icf::Section_id_hash): Remove.
5160 * object.h (Section_id, Const_section_id, Section_id_hash,
5161 Const_section_id_hash): New type definitions.
5162 * output.cc (Output_section::add_relaxed_input_section): Change to
5163 use Const_section_id instead of Input_section_specifier as key type.
5164 (Output_section::add_merge_input_section): Ditto.
5165 (Output_section::build_relaxation_map): Change to use Section_id
5166 instead of Input_section_specifier as key type.
5167 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5168 Ditto.
5169 (Output_section::convert_input_sections_to_relaxed_sections): Change
5170 to use Const_section_id instead of Input_section_specifier as key type.
5171 (Output_section::find_merge_section): Ditto.
5172 (Output_section::find_relaxed_input_section): Ditto.
5173 * output.h (Input_section_specifier): Remove class.
5174 (Output_section::Output_section_data_by_input_section_map): Change
5175 key type to Const_section_id.
5176 (Output_section::Output_relaxed_input_section_by_input_section_map):
5177 Ditto.
5178 (Output_section::Relaxation_map): Change key type to Section_id.
5179
a2162063
ILT
51802010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5181
5182 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5183 (class Arm_v4bx_stub): New class.
5184 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5185 (Stub_factory::make_arm_v4bx_stub): New method.
5186 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5187 (Stub_table::empty): Handle v4bx stubs.
5188 (Stub_table::add_arm_v4bx_stub): New method.
5189 (Stub_table::find_arm_v4bx_stub): New method.
5190 (Arm_relocate_functions::v4bx): New method.
5191 (Target_arm::fix_v4bx): New method.
5192 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5193 (Stub_table::relocate_stubs): Likewise.
5194 (Stub_table::do_write): Likewise.
5195 (Stub_table::update_data_size_and_addralign): Likewise.
5196 (Stub_table::finalize_stubs): Likewise.
5197 (Target_arm::Scan::local): Likewise.
5198 (Target_arm::Scan::global): Likewise.
5199 (Target_arm::do_finalize_sections): Likewise.
5200 (Target_arm::Relocate::relocate): Likewise.
5201 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5202 Likewise.
5203 (Target_arm::scan_reloc_for_stub): Likewise.
5204 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5205
5696ab0b
ILT
52062010-01-19 Ian Lance Taylor <iant@google.com>
5207
5208 * output.cc (Output_section_headers::do_sized_write): Write large
5209 segment count to sh_info field.
5210 (Output_file_header::do_sized_write): For large segment count,
5211 write PN_XNUM to e_phnum field.
5212
800d0f56
ILT
52132010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5214
5215 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5216 (Arm_relocate_functions::thm_jump8): New function.
5217 (Arm_relocate_functions::thm_jump11): New function.
5218 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5219 R_ARM_THM_JUMP11.
5220 (Target_arm::Scan::global): Likewise.
5221 (Target_arm::Relocate::relocate): Likewise.
5222 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5223 Likewise.
5224
41263c05
DK
52252010-01-14 Doug Kwan <dougkwan@google.com>
5226
5227 * arm.cc (map, utility): Include headers.
5228 (Target_arm::apply_cortex_a8_workaround): New method.
5229 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5230 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5231 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5232 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5233 the --[no-]fix-cortex-a8 command line options.
5234 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5235 (Target_arm::relocate_stub): Use addend in instruction template.
5236 * options.h (DEFINE_bool): Set the user-set flag.
5237 (General_options): Add --[no-]-fix-cortex options.
5238 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 5239 : Update fast look-up map after conversion.
41263c05 5240
459e9b03
ST
52412010-01-14 Sriraman Tallam <tmsriram@google.com>
5242
5243 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5244 in the first pass of do_layout.
5245
b521dfe4
DK
52462010-01-13 Doug Kwan <dougkwan@google.com>
5247
5248 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5249 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5250 apparent compiler problem of not folding static constant integral
5251 data members of elfcpp::Elf_sizes<32>.
5252
44272192
DK
52532010-01-13 Doug Kwan <dougkwan@google.com>
5254
5255 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5256 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5257 Arm_relobj::scan_section_for_cortex_a8_erratum,
5258 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5259 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5260 sections to scan for relocation stubs into a new method
5261 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5262 relocation and Cortex-A8 stub scanning.
5263 (Target_arm::do_relax): Force stubs to be after stubbed sections
5264 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 5265 the beginning of a new relaxation pass. Update a comment.
44272192
DK
5266 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5267
44b71ece
ILT
52682010-01-12 Ian Lance Taylor <iant@google.com>
5269
5270 * target-reloc.h (visibility_error): New inline function.
5271 (relocate_section): Call visibility_error.
5272 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5273 (MOSTLYCLEANFILES): Likewise.
5274 (protected_4_pic.o, protected_3.err): New targets.
5275 * testsuite/protected_4.cc: New file.
5276
a120bc7f
DK
52772010-01-12 Doug Kwan <dougkwan@google.com>
5278
5279 * arm.cc (Cortex_a8_reloc): New class.
5280 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5281 and cortex_a8_relocs_info_.
5282 (Target_arm::fix_cortex_a8): New method definition.
5283 (Target_arm::Cortex_a8_relocs_info): New type.
5284 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5285 New data member declarations.
5286 (Target_arm::scan_reloc_for_stub): Record information about
5287 relocations for THUMB branches that might be exempted from the
5288 Cortex-A8 workaround.
5289 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5290 at the beginning of a relaxation pass.
5291
20138696
DK
52922010-01-12 Doug Kwan <dougkwan@google.com>
5293
5294 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5295 (Arm_relobj::Mapping_symbol_position,
5296 Arm_reloj::Mapping_symbol_position_less,
5297 Arm_relobj::Mapping_symbols_info): New types.
5298 (Target_arm::is_mapping_symbol_name): New method definition.
5299 (Arm_relobj::do_count_local_symbols): Save information about mapping
5300 symbols.
5301
089d69dc
DK
53022010-01-11 Doug Kwan <dougkwan@google.com>
5303
5304 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5305 Arm_relocate_functions::thumb32_branch_upper,
5306 Arm_relocate_functions::thumb32_branch_lower,
5307 Arm_relocate_functions::thumb32_cond_branch_offset,
5308 Arm_relocate_functions::thumb32_cond_branch_upper,
5309 Arm_relocate_functions::thumb32_cond_branch_lower,
5310 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5311 branch offset encoding.
5312 (Arm_relocate_functions::thumb_branch_common): Use new branch
5313 offset encoding methods to avoid code duplication.
5314 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5315 (Stub_addend_reader::operator()): Use new branch encoding method
5316 to avoid code duplication.
5317
99e5bff2
DK
53182010-01-11 Doug Kwan <dougkwan@google.com>
5319
5320 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5321 (Target_arm::do_finalize_sections): Define special EXIDX section
5322 symbols only if referenced.
5323 * gc.h (Garbage_collection::add_reference): New method.
5324 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5325 code duplication.
5326
98e090bd
ILT
53272010-01-11 Ian Lance Taylor <iant@google.com>
5328
d0a91bd8
ILT
5329 * script.cc (Version_script_info::build_expression_list_lookup):
5330 Change complaing about duplicate wildcard match from error to
5331 warning.
5332
98e090bd
ILT
5333 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5334 of 2009-12-30.
5335 (Version_script_info::Version_script_info): Initialize globs_,
5336 default_version_, default_is_global_, and exact_. Don't
5337 initialize globals_ or locals_.
5338 (Version_script_info::build_lookup_tables): Build local symbols
5339 first.
5340 (Version_script_info::unquote): New function.
5341 (Version_script_info::add_exact_match): New function.
5342 (Version_script_info::build_expression_list_lookup): Remove lookup
5343 parameter. Add is_global parameter. Change all callers. Handle
5344 wildcard pattern specially. Unquote pattern. Call
5345 add_exact_match.
5346 (Version_script_info::get_name_to_match): New function.
5347 (Version_script_info::get_symbol_version): New function.
5348 (Version_script_info::get_symbol_version_helper): Remove.
5349 (Version_script_info::check_unmatched_names): Call unquote.
5350 * script.h (class Version_script_info): Change get_symbol_version
5351 to be non-inline and add is_global parameter; change all callers.
5352 Rewrite symbol_is_local. Update declarations. Define struct
5353 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5354 Remove globals_ and locals_ members. Add exact_, globs_,
5355 default_version_, is_global_.
5356 (Version_script_info::Glob): Remove pattern, add expression and
5357 is_global. Update constructor. Change all callers.
5358 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5359 default version.
5360 (Versions::symbol_section_contents): If a symbol is undefined, or
5361 defined in a dynamic object, set the version index to
5362 VER_NDX_LOCAL.
5363 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5364 symbol_is_local.
5365 (Symbol_table::add_from_pluginobj): Likewise.
5366 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5367
d56962d3
DK
53682010-01-11 Doug Kwan <dougkwan@google.com>
5369
5370 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5371 (incremental_dump_LDADD): Add linking option for libintl.
5372 * Makefile.in: Regenerate.
5373
94e6ee91
L
53742010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5375
5376 PR gold/11144
5377 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5378 instead of -Ds.
5379 * testsuite/Makefile.in: Regenerated.
5380
e96c574b
DK
53812010-01-10 Doug Kwan <dougkwan@google.com>
5382
5383 * options.h (DEFINE_var): Use parentheses around argument varname__
5384 in macro body to avoid any unintended subsequent substitutions.
5385
7198066b
ILT
53862010-01-10 Ian Lance Taylor <iant@google.com>
5387
ba4d53bf
ILT
5388 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5389 candidates before doing symbol resolution.
5390
7198066b
ILT
5391 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5392 ODR candidates if only one is weak.
5393
a2beed37
ILT
53942010-01-08 Ian Lance Taylor <iant@google.com>
5395
5396 * script.cc (Version_script_info::build_expression_list_lookup):
5397 Don't warn about ambiguous version, just record the ambiguity.
5398 (Version_script_info::get_symbol_version_helper): Give error if
5399 version is ambiguous.
5400
2fb7225c
DK
54012010-01-08 Doug Kwan <dougkwan@google.com>
5402
5403 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5404 prev_data_size_ and prev_addralign_. Remove initializer for
5405 deleted data member has_been_changed_.
5406 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5407 to determine if the table is empty.
5408 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5409 Remove.
5410 (Stub_table::add_reloc_stub): Define method in class definition
5411 instead of just declaring it there.
5412 (Stub_table::add_cortex_a8_stub): New method definition.
5413 (Stub_table::update_data_size_and_addralign): Ditto.
5414 (Stub_table::finalize_stubs): Ditto.
5415 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5416 (Stub_table::do_addralign_): Return address alignment in the
5417 (Stub_table::do_reset_address_and_file_offset): Define method in
5418 class definition instead of declaring it there. Set current data
5419 size to be the data size of the previous pass.
5420 (Stub_table::set_final_data_size): Use current data size as the
5421 final data size.
5422 (Stub_table::relocate_stub): Change parameter type of stub from
5423 Reloc_stub pointer to Stub pointer.
5424 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5425 (Stub_table::Cortex_a8_stub_list): New typedef.
5426 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5427 Stub_table::prev_addralign_): New data member.
5428 (Arm_relobj::Arm_relobj): Initialize data member
5429 section_has_cortex_a8_workaround_.
5430 (Arm_relobj::section_has_cortex_a8_workaround,
5431 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5432 definitions.
5433 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5434 declarations.
5435 (Target_arm::relocate_stub): Change parameter type of stub from
5436 Reloc_stub pointer to Stub pointer.
5437 (Insn_template::size, Insn_template::alignment): Handle
5438 THUMB16_SPECIAL_TYPE.
5439 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5440 Stub_table::update_data_size_and_addralign,
5441 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5442 definitions.
5443 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5444 (Stub_table::do_write): Ditto.
5445 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5446
880cd20d
ILT
54472010-01-08 Ian Lance Taylor <iant@google.com>
5448
5449 PR 11108
5450 * symtab.h (class Symbol): Remove fields is_target_special_ and
5451 has_plt_offset_. Add field is_defined_in_discarded_section_.
5452 (Symbol::is_defined_in_discarded_section): New function.
5453 (Symbol::set_is_defined_in_discarded_section): New function.
5454 (Symbol::has_plt_offset): Rewrite.
5455 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5456 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5457 Don't initialize is_target_special_ or has_plt_offset_.
5458 Initialize is_defined_in_discarded_section_.
5459 (Symbol_table::add_from_relobj): If appropriate, set
5460 is_defined_in_discarded_section.
5461 * resolve.cc (Symbol::override_base_with_special): Don't test
5462 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5463 * target-reloc.h (relocate_section): Do special handling for
5464 symbols defined in discarded sections for global symbols as well
5465 as local symbols.
5466
2703e3eb
ILT
54672010-01-08 Ian Lance Taylor <iant@google.com>
5468
5469 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5470 the SHT_SYMTAB case.
5471
339d40a3
ILT
54722010-01-08 Ian Lance Taylor <iant@google.com>
5473
5474 * object.cc (Sized_relobj::do_layout): Don't get confused if
5475 layout_eh_frame returns NULL.
5476
abecea76
ILT
54772010-01-08 Ian Lance Taylor <iant@google.com>
5478
5479 PR 11084
5480 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5481 dynamic symbol table, use the normal symbol table.
5482 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5483 symbol table.
5484
6b7dd3f3
ILT
54852010-01-08 Ian Lance Taylor <iant@google.com>
5486
5487 PR 11072
5488 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5489 sections.
5490
36c50e63
L
54912010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5492
5493 * version.cc (print_version): Change to "Copyright 2010".
5494
e291e7b9
ILT
54952010-01-08 Ian Lance Taylor <iant@google.com>
5496
5497 PR 10287
5498 PR 11063
5499 * i386.cc (class Target_i386): Change return type of plt_section
5500 to be non-const.
5501 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5502 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5503 tls_desc_rel_ field.
5504 (Output_data_plt_i386::rel_tls_desc): New function.
5505 (Target_i386::rel_tls_desc_section): New function.
5506 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5507 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5508 R_386_TLS_DESC reloc in rel_tls_desc_section.
5509 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5510 Define struct Tlsdesc_info.
5511 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5512 (Target_x86_64::do_reloc_symbol_index): New function.
5513 (Target_x86_64::add_tlsdesc_info): New function.
5514 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5515 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5516 tlsdesc_rel_ field.
5517 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5518 all callers.
5519 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5520 (Target_x86_64::rela_tlsdesc_section): New function.
5521 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5522 handling.
5523 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5524 (Target_x86_64::do_reloc_addend): New function.
5525 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5526 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5527 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5528 (Output_reloc::type): New function.
5529 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5530 (Output_reloc::is_target_specific): New function.
5531 (Output_reloc::target_arg): New function.
5532 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5533 absolute relocs and target specific relocs.
5534 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5535 add_target_specific.
5536 (class Output_data_reloc) [SHT_RELA]: Likewise.
5537 * output.cc (Output_reloc::Output_reloc): Add four new versions
5538 for absolute relocs and target specific relocs.
5539 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5540 (Output_reloc::get_symbol_index): Likewise.
5541 (Output_reloc::local_section_offset): Check that local_sym_index_
5542 is not TARGET_CODE or 0.
5543 (Output_reloc::symbol_value): Likewise.
5544 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5545 reloc.
5546 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5547 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5548 functions.
5549 * layout.cc (add_target_dynamic_tags): Use output section for
5550 DT_PLTRELSZ and DT_JMPREL.
5551
3a44184e
ILT
55522010-01-07 Ian Lance Taylor <iant@google.com>
5553
5554 PR 11061
5555 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5556 function.
5557 (class Output_data_reloc_generic): Define.
5558 (class Output_data_reloc_base): Change base class to
5559 Output_data_reloc_generic. Change add() method to call
5560 bump_relative_reloc_count for a relative reloc. Remove
5561 sort_relocs_ field.
5562 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5563 to sort_relocs().
5564 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5565 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5566 appropriate.
5567 * layout.h (class Layout): Update declaration.
5568
ea715a34
ILT
55692010-01-07 Ian Lance Taylor <iant@google.com>
5570
5571 * output.h (class Output_data): Add const version of
5572 output_section and do_output_section.
5573 (class Output_section_data): Add const version of
5574 do_output_section.
5575 (class Output_section): Likewise.
5576 * layout.cc (Layout::add_target_dynamic_tags): New function.
5577 * layout.h (class Layout): Update declarations.
5578 * arm.cc (Target_arm::do_finalize_sections): Use
5579 add_target_dynamic_tags.
5580 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5581 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5582 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5583 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5584
659948a4
ILT
55852010-01-07 Ian Lance Taylor <iant@google.com>
5586
5587 PR 11042
5588 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5589 object as needed.
5590
9d3b86f6
ILT
55912010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5592 Ian Lance Taylor <iant@google.com>
5593
5594 PR 11019
5595 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5596 Xindex::read_symtab_xindex.
5597
bb0d3eb0
DK
55982010-01-07 Doug Kwan <dougkwan@google.com>
5599
5600 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5601 (Insn_template::thumb16_bcond_insn): New method declaration.
5602 (Insn_template): Fix spelling.
5603 (Stub::thumb16_special): New method declaration.
5604 (Stub::do_write): Define virtual method which was previously pure
5605 virtual.
5606 (Stub::do_thumb16_special): New method declaration.
5607 (Stub::do_fixed_endian_write): New template member.
5608 (Reloc_stub::do_write): Remove.
5609 (Reloc_stub::do_fixed_endian_write): Remove.
5610 (Cortex_a8_stub): New class definition.
5611 (Stub_factory::make_cortex_a8_stub): New method definition.
5612 (Stub_factory::Stub_factory): Add missing static storage class
5613 qualifier for elf32_arm_stub_a8_veneer_blx.
5614
ffeef7df
ILT
56152010-01-07 Ian Lance Taylor <iant@google.com>
5616
dc3f80fe
ILT
5617 PR 10980
5618 * options.h (class General_options): Add --warn-unresolved-symbols
5619 and --error-unresolved-symbols.
5620 * errors.cc (Errors::undefined_symbol): Implement
5621 --warn-unresolved-symbols.
5622
ffeef7df
ILT
5623 * options.h (class General_options): Add -z text and -z textoff.
5624 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5625
f1ec9ded
ST
56262010-01-06 Sriraman Tallam <tmsriram@google.com>
5627
5628 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5629 (Garbage_collection::cident_sections): New function.
5630 (Garbage_collection::add_cident_section): New function.
5631 (Garbage_collection::cident_sections_): New member.
5632 (gc_process_relocs): Add references to sections whose names are C
5633 identifiers.
5634 * gold.h (cident_section_start_prefix): New constant.
5635 (cident_section_stop_prefix): New constant.
5636 (is_cident): New function.
5637 * layout.cc (Layout::define_section_symbols): Replace string constants
5638 with the newly defined constants.
5639 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5640 C identifiers.
5641 * testsuite/Makefile.am: Add gc_orphan_section_test.
5642 * testsuite/Makefile.in: Regenerate.
5643 * testsuite/gc_orphan_section_test.cc: New file.
5644 * testsuite/gc_orphan_section_test.sh: New file.
5645
6eda8c29
ILT
56462010-01-06 Ian Lance Taylor <iant@google.com>
5647
b9674e17
ILT
5648 PR 10980
5649 * options.h (class General_options): Add --warn-shared-textrel.
5650 * layout.cc (Layout::finish_dynamic_section): Implement
5651 --warn-shared-textrel.
5652
6eda8c29
ILT
5653 PR 10980
5654 * options.h (class General_options): Add --warn-multiple-gp.
5655
32dcd44e
ILT
56562010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5657
5658 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5659 $(THREADSLIB) and $(LIBDL).
5660 * Makefile.in: Rebuild.
5661
a192ba05
ILT
56622010-01-06 Ian Lance Taylor <iant@google.com>
5663
5664 PR 10980
5665 * options.cc (General_options::parse_section_start): New function.
5666 (General_options::section_start): New function.
5667 (General_options::General_options): Initialize all members.
5668 * options.h: Include <map>
5669 (class General_options): Add --section-start. Add section_starts_
5670 member.
5671 * layout.cc (Layout::attach_allocated_section_to_segment): If
5672 --section-start was used, set the address of the segment. Remove
5673 local sort_sections.
5674 (Layout::relaxation_loop_body): If the address of the load segment
5675 has been set by --section-start, don't use it.
5676 * output.h (Output_segment::update_flags_for_output_section): New
5677 function.
5678 * output.cc (Output_segment::add_output_section): Call
5679 update_flags_for_output_section.
5680
dde3f402
ILT
56812010-01-05 Ian Lance Taylor <iant@google.com>
5682
62dfdd4d
ILT
5683 PR 10980
5684 * options.h (class General_options): Add --undefined-version.
5685 * script.cc (struct Version_expression): Add was_matched_by_symbol
5686 field.
5687 (Version_script_info::matched_symbol): New function.
5688 (Version_script_info::get_symbol_version_helper): Call
5689 matched_symbol.
5690 (Version_script_info::check_unmatched_names): New function.
5691 * script.h (class Version_script_info): Update declarations.
5692 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5693
9c4ae156
ILT
5694 * options.h (class General_options): Use DEFINE_bool_alias for
5695 allow_multiple_definition.
5696 * resolve.cc (Symbol_table::should_override): Don't test
5697 allow_multiple_definition.
5698
dde3f402
ILT
5699 PR 10980
5700 * options.h (class General_options): Add --cref.
5701 * main.cc (main): Print cref table if --cref. Don't close mapfile
5702 until after printing cref table.
5703 * cref.cc: Include "symtab.h".
5704 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5705 (Cref_table_compare::operator()): New function.
5706 (Cref_inputs::gather_cref): New function.
5707 (filecol): New static const.
5708 (Cref_inputs::print_cref): New function.
5709 (Cref::print_cref): New function.
5710 * cref.h: Include <cstdio>.
5711 (class Cref): Update declarations.
5712 * mapfile.h (Mapfile::file): New function.
5713 * object.h (class Object): Define Symbols. Declare virtual
5714 do_get_global_symbols.
5715 (Object::get_global_symbols): New function.
5716 * object.cc (Input_objects::add_object): Pass object to cref_ if
5717 --cref.
5718 (Input_objects::archive_start): Likewise.
5719 (Input_objects::archive_stop): Likewise.
5720 (Input_objects::print_cref): New function.
5721 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5722 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5723 --cref.
5724 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5725 function.
5726 * plugin.h (class Sized_pluginobj): Update declarations.
5727
8781f709
ILT
57282010-01-05 Ian Lance Taylor <iant@google.com>
5729
5730 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5731 to is_default_version. Rename insdef to insdefault.
5732 (Symbol_table::add_from_relobj): Rename def to is_default_version
5733 and local to is_forced_local.
5734 (Symbol_table::add_from_pluginobj): Likewise.
5735 (Symbol_table::add_from_dynobj): Likewise.
5736 (Symbol_table::define_special_symbol): Rename insdef to
5737 insdefault.
5738
fe35d28d
ILT
57392010-01-04 Ian Lance Taylor <iant@google.com>
5740
30bc8c46
ILT
5741 PR 10980
5742 * options.h (class General_options): Add
5743 --allow-multiple-definition and -z muldefs.
5744 * resolve.cc (Symbol_table::should_override): Don't warn about a
5745 multiple symbol definition if --allow-multiple-definition or -z
5746 muldefs.
5747
7eaea549
ILT
5748 PR 10980
5749 * options.h (class General_options): Add --add-needed and
5750 --copy-dt-needed-entries. Tweak --as-needed help entry.
5751 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5752 error if --copy-dt-needed-entries aka --add-needed is used and
5753 would cause a change in behaviour.
5754
fe35d28d
ILT
5755 PR 10980
5756 * options.h (class General_options): Add -G as a short version of
5757 --shared. Add no-op options -assert, -g, and -i.
5758
55a2bb35
ST
57592010-01-04 Sriraman Tallam <tmsriram@google.com>
5760
5761 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5762 check for .text or .gnu.linkonce.t sections.
5763 * icf.cc (Icf::find_identical_sections): Ditto.
5764 Change the detection for mangled function name within the section
5765 name.
5766 * icf.h (is_section_foldable_candidate): New function.
5767
719328e1
ILT
57682009-12-30 Ian Lance Taylor <iant@google.com>
5769
5770 PR 10980
5771 * options.h (class General_options): Permit two dashes with
5772 --retain-symbols-file.
5773
d7bb5745
ILT
57742009-12-30 Ian Lance Taylor <iant@google.com>
5775
403a15dd
ILT
5776 PR 10979
5777 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5778 don't put the file header and segment headers in the text
5779 segment.
5780
eda294df
ILT
5781 PR 10979
5782 * common.cc (Sort_commons::operator()): Stabilize sort when both
5783 entries are NULL.
5784 (Symbol_table::do_allocate_commons_list): When allocating common
5785 symbols, skip a symbol which is no longer common.
5786 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5787 an object before checking its type.
5788 * testsuite/common_test_2.c: New file.
5789 * testsuite/common_test_3.c: New file.
5790 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5791 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5792 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5793 (common_test_2_pic.o, common_test_2.so): New targets.
5794 (common_test_3_pic.o, common_test_3.so): New targets.
5795 * testsuite/Makefile.in: Rebuild.
5796
d7bb5745
ILT
5797 PR 10979
5798 * script.cc (read_input_script): If we see a new SECTIONS clause,
5799 and we have added an input section, give an error.
5800 * layout.h (class Layout): Add have_added_input_section function.
5801 Add have_added_input_section_ field.
5802 * layout.cc (Layout::Layout): Initialize
5803 have_added_input_section_.
5804 (Layout::layout): Set have_added_input_section_.
5805 (Layout::layout_eh_frame): Likewise.
5806
fc59c572
ILT
58072009-12-30 Ian Lance Taylor <iant@google.com>
5808
5809 PR 10931
5810 * options.h (class General_options): Add --sort-common option.
5811 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5812 * common.cc (Sort_common): Add sort_order parameter to
5813 constructor. Add sort_order_ field.
5814 (Sort_commons::operator): Check sort_order_.
5815 (Symbol_table::allocate_commons): Determine the sort order.
5816 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5817 Change all callers.
5818 (Symbol_table::do_allocate_commons_list): Likewise.
5819
1c74fab0
ILT
58202009-12-30 Ian Lance Taylor <iant@google.com>
5821
5822 PR 10916
5823 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5824 symbols from this object, don't change the visibility of an
5825 undefined symbol.
5826 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5827
6affe781
ILT
58282009-12-30 Ian Lance Taylor <iant@google.com>
5829
5830 PR 10861
5831 * script.h (class Version_script_info): Define Language enum.
5832 Update declarations. Define Glob, Exact, and Lookup types. Add
5833 new fields globals_, locals_, and is_finalized_.
5834 * script.cc: Various formatting fixes.
5835 (class Parser_closure): Change language_stack_ from a vector of
5836 std::string to one of Version_script_info::Language. Adjust all
5837 uses accordingly.
5838 (class Lazy_demangler): Remove.
5839 (struct Version_expression): Change language from std::string to
5840 Version_script_info::Language.
5841 (Version_script_info::Version_script_info): New function.
5842 (Version_script_info::~Version_script_info): Don't call clear.
5843 (Version_script_info::finalize): New function.
5844 (Version_script_info::build_lookup_tables): New function.
5845 (Version_script_info::build_expression_list_lookup): New
5846 function.
5847 (Version_script_info::get_symbol_version_helper): Rewrite to use
5848 lookup tables.
5849 (Version_script_info::print_expression_list): Adjust to use
5850 Version_script_info::Language.
5851 (script_push_lex_into_version_mode): Check that the version script
5852 has not been finalized.
5853 (version_script_push_lang): Change language string to
5854 Version_script_info::Language.
5855 * options.cc (Command_line::version_script): New function.
5856 * options.h (class General_options): Add finalize_dynamic_list
5857 function. Change version_script from declaration to definition.
5858 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5859 * testsuite/version_script.map: Remove duplicate def of foo.
5860 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5861 version_script.map.
5862 * testsuite/Makefile.in: Rebuild.
5863
818bf354
ILT
58642009-12-30 Ian Lance Taylor <iant@google.com>
5865
5866 PR 10843
5867 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5868 if the input symbol index is 0, make the output symbol index 0.
5869
ebcc8304
ILT
58702009-12-30 Ian Lance Taylor <iant@google.com>
5871
5872 PR 10670
5873 * options.h (class General_options): Add -x/--discard-all.
5874 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5875 --discard-all. If the local symbol needs a dynamic entry, check
5876 that before handling --discard-locals.
5877
176fe33f
ILT
58782009-12-30 Ian Lance Taylor <iant@google.com>
5879
bb321bb1
ILT
5880 PR 10450
5881 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5882 flags to PF_R.
5883 (Output_segment::add_output_section): Don't change the flags if
5884 the type is PT_TLS.
5885
176fe33f
ILT
5886 PR 10450
5887 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5888 GNU hash table if they need a dynamic value. Otherwise, don't add
5889 them if they are defined in a dynamic object or are forced local.
5890
e8cd95c7
ILT
58912009-12-29 Ian Lance Taylor <iant@google.com>
5892
1b81fb71
ILT
5893 PR 10450
5894 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5895 .gnu.hash table for a 32-bit target.
5896
8d6d383d
ILT
5897 PR 10450
5898 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5899 regular and a dynamic object only needs a dynamic symbol table
5900 entry if it is externally visible.
5901
e785ec03
ILT
5902 PR 10450
5903 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5904 constructor. Add global_offset_table_ field.
5905 (Target_i386::got_section): Set global_offset_table_.
5906 (Target_i386::do_finalize_sections): Set global_offset_table_
5907 size.
5908 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5909 in constructor. Add global_offset_table_ field.
5910 (Target_x86_64::got_section): Set global_offset_table_.
5911 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5912 size.
5913
1a2dff53
ILT
5914 * layout.cc (Layout::Layout): Initialize increase_relro_.
5915 (Layout::get_output_section): Add is_relro, is_last_relro, and
5916 is_first_non_relro parameters. Change all callers.
5917 (Layout::choose_output_section): Likewise.
5918 (Layout::add_output_section_data): Likewise.
5919 (Layout::make_output_section): Likewise.
5920 (Layout::set_segment_offsets): Clear increase_relro when using a
5921 linker script.
5922 * layout.h (class Layout): Add increase_relro method. Add
5923 increase_relro_ field. Update declarations.
5924 * output.cc (Output_section::Output_section): Initialize
5925 is_last_relro_ and is_first_non_relro_.
5926 (Output_segment::add_output_section): Group relro sections is
5927 do_sort is true. Handle is_last_relro and is_first_non_relro.
5928 (Output_segment::maximum_alignment): Remove relro handling.
5929 (Output_segment::set_section_addresses): Add increase_relro
5930 parameter. Change all callers. Add initial alignment to align
5931 relro sections on separate page. Remove old relro handling.
5932 (Output_segment::set_section_list_addresses): Remove in_relro
5933 parameter. Change all callers.
5934 (Output_segment::set_offset): Add increase parameter. Change all
5935 callers. Remove old relro handling.
5936 * output.h (class Output_section): Add new methods: is_last_relro,
5937 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5938 Add is_last_relro_ and is_first_non_relro_ fields.
5939 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5940 Create separate .got.plt section. Call increase_relro.
5941 * x86_64.cc (Target_x86_64::got_section): Likewise.
5942 * testsuite/relro_script_test.t: Add .got.plt.
5943
f0ba79e2
ILT
5944 PR 10450
5945 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5946 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5947 (Layout::finalize): Call set_dynamic_symbol_size.
5948 (Layout::set_dynamic_symbol_size): New function.
5949 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5950 set_dynamic_symbol_size.
5951
e8cd95c7
ILT
5952 PR 10450
5953 * output.h (class Output_section): Add is_entsize_zero_ field.
5954 * output.cc (Output_section::Output_section): Initialize
5955 is_entsize_zero_.
5956 (Output_section::set_entsize): If two different entsizes are
5957 requested, force it to zero.
5958 (Output_section::add_input_section): Set flags for .debug_str
5959 before updating section flags. Set entsize.
5960 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5961 and SHF_STRING if all input sections have those flags.
5962
3e1b9a8a
RÁE
59632009-12-29 Rafael Espindola <espindola@google.com>
5964
5965 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
5966 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5967 reporting.
3e1b9a8a 5968
3dcad376
ST
59692009-12-29 Sriraman Tallam <tmsriram@google.com>
5970
5971 * options.cc (General_options::parse_version): Allow -v to exit
5972 without an error if there is nothing to link.
5973
084e2665
ILT
59742009-12-29 Ian Lance Taylor <iant@google.com>
5975
5976 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5977 using a version of gcc before 4.1.
5978 * configure: Rebuild.
5979
250acde3
CD
59802009-12-28 Chris Demetriou <cgd@google.com>
5981
5982 * attributes.cc (Output_attributes_section_data::do_write): Use
5983 std::vector::front rather than std::vector::data.
5984
99fff23b
ILT
59852009-12-28 Ian Lance Taylor <iant@google.com>
5986
5987 * symtab.h (class Symbol_table): Add enum Defined.
5988 * resolve.cc (Symbol_table::should_override): Add defined
5989 parameter. Change all callers. Test whether object is NULL
5990 before calling a method on it.
5991 (Symbol_table::report_resolve_problem): Add defined parameter.
5992 Change all callers.
5993 (Symbol_table::should_override_with_special): Likewise.
5994 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5995 parameter. Change all callers.
5996 (Symbol_table::do_define_in_output_data): Likewise.
5997 (Symbol_table::define_in_output_segment): Likewise.
5998 (Symbol_table::do_define_in_output_segment): Likewise.
5999 (Symbol_table::define_as_constant): Likewise.
6000 (Symbol_table::do_define_as_constant): Likewise.
6001 * script.h (class Symbol_assignment): Add is_defsym parameter to
6002 constructor; change all callers.
6003 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
6004 parameter. Change all callers. Add is_defsym_ field.
6005 (class Parser_closure): Add parsing_defsym parameter to
6006 constructor; change all callers. Add parsing_defsym accessor
6007 function. Add parsing_defsym_ field.
6008
556bd683
ILT
60092009-12-28 Ian Lance Taylor <iant@google.com>
6010
6011 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 6012 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 6013
1782c879
ILT
60142009-12-23 Ian Lance Taylor <iant@google.com>
6015
6016 * i386.cc (Target_i386::do_calls_non_split): Recognize
6017 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
6018 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
6019 -fsplit-stack prologue when using %r11.
1782c879 6020
329ca2b1
ST
60212009-12-21 Sriraman Tallam <tmsriram@google.com>
6022
6023 * options.cc (General_options::parse_version): Make -v continue and do
6024 the link like GNU ld does.
6025
d675ff46
RÁE
60262009-12-17 Rafael Avila de Espindola <espindola@google.com>
6027
6028 * Makefile.am (CCFILES): Add timer.cc.
6029 (HFILES): Add timer.h.
6030 * configure.ac: Check for sysconf and times.
6031 * main.cc: include timer.h.
6032 (main): Use Timer instead of get_run_time.
6033 * timer.cc: New.
6034 * timer.h: New.
6035 * workqueue.cc: include timer.h.
6036 (Workqueue::find_and_run_task):
6037 Report user, sys and wall time.
6038 * Makefile.in: Regenerate.
6039 * config.in: Regenerate.
6040 * configure: Regenerate.
6041
d6344fb5
DK
60422009-12-16 Doug Kwan <dougkwan@google.com>
6043
6044 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
6045 sections.
6046 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
6047 relaxed input sections.
6048 * output.cc (Output_section::find_relaxed_input_section): Change
6049 return type to Output_relaxed_input_section pointer. Adjust code
6050 for new type of relaxed_input_section_map_.
6051 * output.h (Output_section::find_relaxed_input_section): Change
6052 return type to Output_relaxed_input_section pointer.
6053 (Output_section::Output_relaxed_input_section_by_input_section_map):
6054 New type.
6055 (Output_section::relaxed_input_section_map_): Change type to
6056 Output_section::Output_relaxed_input_section_by_input_section_map.
6057 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
6058 input section.
6059
0e0d5469
ILT
60602009-12-15 Ian Lance Taylor <iant@google.com>
6061
6062 * layout.cc (Layout::create_shstrtab): Only write out after input
6063 sections if we are compressing debug sections.
6064
0649a889
ILT
60652009-12-15 Ian Lance Taylor <iant@google.com>
6066
6067 * archive.cc (Archive::add_symbols): Only look up a symbol without
6068 a version if there is, in fact, a version.
6069
2ea97941
ILT
60702009-12-14 Ian Lance Taylor <iant@google.com>
6071
6072 Revert -Wshadow changes, all changes from:
6073 2009-12-11 Doug Kwan <dougkwan@google.com>
6074 2009-12-11 Nick Clifton <nickc@redhat.com>
6075 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6076
b0eec2cc
DK
60772009-12-11 Doug Kwan <dougkwan@google.com>
6078
6079 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6080 due to -Wshadow.
6081 * attributes.cc (Object_attribute::size): Ditto.
6082 (Attributes_section_data::size): Ditto.
6083 (Attributes_section_data::Attributes_section_data): Ditto.
6084 (Output_attributes_section_data::do_write): Ditto.
6085 * attributes.h (Object_attribute::set_type): Ditto.
6086 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6087
91d6fa6a
NC
60882009-12-11 Nick Clifton <nickc@redhat.com>
6089
6090 * archive.cc: Fix shadowed variable warnings.
6091 * arm.cc: Likewise.
6092 * compressed_output.cc: Likewise.
6093 * compressed_output.h: Likewise.
6094 * configure: Likewise.
6095 * dwarf_reader.cc: Likewise.
6096 * dynobj.cc: Likewise.
6097 * dynobj.h: Likewise.
6098 * ehframe.cc: Likewise.
6099 * ehframe.h: Likewise.
6100 * errors.cc: Likewise.
6101 * expression.cc: Likewise.
6102 * fileread.cc: Likewise.
6103 * fileread.h: Likewise.
6104 * freebsd.h: Likewise.
6105 * i386.cc: Likewise.
6106 * icf.cc: Likewise.
6107 * incremental.h: Likewise.
6108 * layout.cc: Likewise.
6109 * layout.h: Likewise.
6110 * mapfile.cc: Likewise.
6111 * merge.cc: Likewise.
6112 * merge.h: Likewise.
6113 * object.cc: Likewise.
6114 * object.h: Likewise.
6115 * options.h: Likewise.
6116 * output.cc: Likewise.
6117 * output.h: Likewise.
6118 * parameters.cc: Likewise.
6119 * plugin.cc: Likewise.
6120 * powerpc.cc: Likewise.
6121 * reduced_debug_output.cc: Likewise.
6122 * reduced_debug_output.h: Likewise.
6123 * reloc.cc: Likewise.
6124 * reloc.h: Likewise.
6125 * resolve.cc: Likewise.
6126 * script-sections.cc: Likewise.
6127 * script.cc: Likewise.
6128 * script.h: Likewise.
6129 * sparc.cc: Likewise.
6130 * symtab.cc: Likewise.
6131 * symtab.h: Likewise.
6132 * target-select.cc: Likewise.
6133 * target-select.h: Likewise.
6134 * token.h: Likewise.
6135 * workqueue.cc: Likewise.
6136 * workqueue.h: Likewise.
6137 * x86_64.cc: Likewise.
6138
a0351a69
DK
61392009-12-10 Doug Kwan <dougkwan@google.com>
6140
6141 * arm.cc (attributes.h): New include.
6142 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6143 (Arm_relobj::~Arm_relobj): Delete object pointed by
6144 attributes_section_data_.
6145 (Arm_relobj::attributes_section_data): New method definition.
6146 (Arm_relobj::attributes_section_data_): New data member declaration.
6147 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6148 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6149 attributes_section_data_.
6150 (Arm_dynobj::attributes_section_data): New method definition.
6151 (Arm_dynobj::attributes_section_data_): New data member declaration.
6152 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6153 initialization value of may_use_blx_ to false.
6154 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6155 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6156 object attributes to compute results instead of hard-coding.
6157 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6158 Target_arm::get_secondary_compatible_arch,
6159 Target_arm::set_secondary_compatible_arch
6160 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6161 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6162 New method declarations.
6163 (Target_arm::get_aeabi_object_attribute): New method definition.
6164 (Target_arm::attributes_section_data_): New data member declaration.
6165 (read_arm_attributes_section): New template definition.
6166 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6167 (Arm_dynobj::do_read_symbols): Ditto.
6168 (Target_arm::do_finalize_sections): Merge attributes sections from
6169 input. Check for BLX use after attributes section merging.
6170 Fix __exidx_start and __exidx_end visibility. Create an
6171 .ARM.attributes section if necessary.
6172 (Target_arm::get_secondary_compatible_arch,
6173 Target_arm::set_secondary_compatible_arch,
6174 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6175 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 6176 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
6177 New method definitions.
6178
b59befec
ILT
61792009-12-09 Ian Lance Taylor <iant@google.com>
6180
6181 * plugin.cc (Plugin::load): Don't cast from void* to a function
6182 pointer.
6183
1276bc89
ILT
61842009-12-09 Ian Lance Taylor <iant@google.com>
6185
6186 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6187 information fields.
6188
2f2de248
L
61892009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6190
6191 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6192 Replace two_file_shared_1.so with two_file_shared_2.so.
6193 * testsuite/Makefile.in: Regenerated.
6194
4f787271
DK
61952009-12-08 Doug Kwan <dougkwan@google.com>
6196
6197 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6198 (HFILES): Add attributes.h and int_encoding.h.
6199 * Makefile.in: Regenerate.
6200 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6201 function definitions to int_encoding.cc
6202 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6203 prototypes to int_encoding.h
6204 * reduced_debug_output.cc (int_encoding.h): New include.
6205 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6206 function definitions to int_encoding.cc
6207 (insert_into_vector, read_from_pointer): Move template definitions to
6208 int_encoding.h
6209 * attributes.cc: New file.
6210 * attributes.h: New file.
6211 * int_encoding.cc: New file.
6212 * int_encoding.h: New file.
6213
20b52f1a
RÁE
62142009-12-07 Rafael Avila de Espindola <espindola@google.com>
6215
6216 PR gold/11055
6217 * incremental-dump.cc (dump_incremental_inputs): New.
6218 (main): Use dump_incremental_inputs.
6219
53d7974c
L
62202009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6221
6222 PR gold/10893
6223 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6224 checking elfcpp::STT_FUNC.
6225 (Target_i386::Relocate::relocate): Likewise.
6226 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6227
6228 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6229 symbols from shared libraries into normal FUNC symbols.
6230
6231 * symtab.h (Symbol): Add is_func and use it.
6232
05a352e6
DK
62332009-12-05 Doug Kwan <dougkwan@google.com>
6234
6235 * arm.cc (Target_arm::arm_info): Initialize new fields
6236 attributes_section and attributes_vendor.
6237 * i386.cc (Target_i386::i386_info): Same.
6238 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6239 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6240 fields attributes_section and attributes_vendor.
53d7974c 6241 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
6242 * target.h (Target::attributes_section, Target::attributes_vendor,
6243 Target::is_attributes_section, Target::attribute_arg_type,
6244 Target::attributes_order): New method definitions.
6245 (Target::Target_info::attributes_section,
6246 Target::Target_info::attributes_vendor): New fields.
6247 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6248 virtual method definitions.
6249 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6250 attributes_section and attributes_vendor.
6251 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6252
f4e5969c
DK
62532009-12-05 Doug Kwan <dougkwan@google.com>
6254
6255 * arm.cc: Update comments about interworking and stub generation.
6256 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6257 considered as non-PIC.
6258 (Arm_relocate_functions::base_abs): Fix formatting.
6259 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6260 of function to use GOT entry address instead of offset.
6261 (Target_arm::Scan::global): Issue an error if a symbol would need a
6262 PLT does not get one because it is untyped. Remove code to create
6263 dynamic symbols for relative branches.
6264 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6265 takes unsigned integer instead of boolean.
6266
1abce4a6
L
62672009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6268
6269 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6270 (two_file_test_LDADD): Likewise.
6271 (common_test_1_LDADD): Likewise.
6272 (exception_test_LDADD) Likewise.
6273 (weak_test_LDADD): Likewise.
6274 (many_sections_test_LDADD): Likewise.
6275 (initpri1_LDADD): Likewise.
6276 (script_test_1_LDADD): Likewise.
6277 (script_test_2_LDADD): Likewise.
6278 (justsyms_LDADD): Likewise.
6279 (binary_test_LDADD): Likewise.
6280 (large_LDADD): Likewise.
6281 * testsuite/Makefile.in: Regenerated.
6282
adcf2816 62832009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 6284
adcf2816
L
6285 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6286 (Symbol_table::override_with_special): Likewise.
6287 (Symbol_table::add_from_object): Likewise.
6288
28e67f5d
RÁE
62892009-12-04 Rafael Avila de Espindola <espindola@google.com>
6290
6291 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6292 Don't set the data_offset twice.
6293
ae10a101
RÁE
62942009-12-04 Rafael Avila de Espindola <espindola@google.com>
6295
6296 * testsuite/Makefile.in: Regenerate.
6297
f59f41f3
DK
62982009-12-03 Doug Kwan <dougkwan@google.com>
6299
6300 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6301 (Target_arm::do_finalize_sections): Add parameter for symbol table
6302 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6303 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6304 parameter for symbol table pointer.
6305 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6306 an additional parameter for a pointer to symbol table.
6307 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6308 parameter for a symbol table pointer.
6309 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6310 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6311 Ditto.
6312 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6313 parameter for a symbol table pointer.
6314
ca55d848
RÁE
63152009-12-03 Rafael Avila de Espindola <espindola@google.com>
6316
6317 * incremental.cc (Incremental_inputs_header)
6318 (Incremental_inputs_header_write, Incremental_inputs_entry)
6319 (Incremental_inputs_entry_write): Move ...
6320 * incremental.h (Incremental_inputs_header)
6321 (Incremental_inputs_header_write, Incremental_inputs_entry)
6322 (Incremental_inputs_entry_write): here.
6323
3aec4f9c
RÁE
63242009-12-02 Rafael Avila de Espindola <espindola@google.com>
6325
6326 * incremental.cc (make_sized_incremental_binary): Set the target.
6327 Error if it is incompatible.
6328 * output.h (Output_file): Add filename method.
6329
9c0ae74d
RÁE
63302009-12-02 Rafael Avila de Espindola <espindola@google.com>
6331
6332 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6333 from the get_* methods.
6334
a45500ae
RÁE
63352009-12-02 Rafael Avila de Espindola <espindola@google.com>
6336
6337 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6338 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6339 Write 0 for the data_offset of scripts.
6340
325e6408
RÁE
63412009-12-02 Rafael Avila de Espindola <espindola@google.com>
6342
6343 * testsuite/Makefile.am: Add the incremental_test.sh test.
6344 * testsuite/incremental_test.sh: New.
6345 * testsuite/incremental_test_1.c: New.
6346 * testsuite/incremental_test_2.c: New.
6347
954c3e2e
RÁE
63482009-12-01 Rafael Avila de Espindola <espindola@google.com>
6349
6350 * incremental-dump.cc (main): Fix typos.
6351
f8086623
RÁE
63522009-11-27 Rafael Avila de Espindola <espindola@google.com>
6353
6354 PR gold/11025
6355 * incremental-dump.cc (main): Use llu to print 64 bit values.
6356
3b0dd6ac
L
63572009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6358 H.J. Lu <hongjiu.lu@intel.com>
6359
6360 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6361 $(LIBDL).
6362 (incremental_dump_LDADD): Likewise.
6363 * Makefile.in: Regenerated.
6364
a6d1ef57 63652009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 6366
a6d1ef57
DK
6367 Revert:
6368
6369 2009-11-25 Doug Kwan <dougkwan@google.com>
6370
6371 * arm.cc (Target_arm::Target_arm): Move method definition
6372 outside of class definition. Add code to handle
6373 --target1-rel, --target1-abs and --target2= options.
6374 (Target_arm::get_reloc_reloc_type): Change method to be
6375 non-static and const.
6376 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6377 New data member declaration.
6378 (Target_arm::Scan::local, Target_arm::Scan::global,
6379 Target_arm::Relocate::relocate,
6380 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6381 Adjust call to Target_arm::get_real_reloc_type.
6382 (Target_arm::get_real_reloc_type): Use command line options
6383 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6384 * options.h (--target1-rel, --target1-abs, --target2): New
6385 ARM-only options.
6386
50aeb7d4
DK
63872009-11-25 Doug Kwan <dougkwan@google.com>
6388
6389 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6390 class definition. Add code to handle --target1-rel, --target1-abs
6391 and --target2= options.
6392 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6393 and const.
6394 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6395 member declaration.
6396 (Target_arm::Scan::local, Target_arm::Scan::global,
6397 Target_arm::Relocate::relocate,
6398 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6399 call to Target_arm::get_real_reloc_type.
6400 (Target_arm::get_real_reloc_type): Use command line options to
6401 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6402 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6403 options.
6404
51938283
DK
64052009-11-25 Doug Kwan <dougkwan@google.com>
6406
6407 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6408 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6409 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6410 formatting.
6411 (Arm_relocate_functions::thm_call): Replace body with a call to
6412 Arm_relocate_functions::thumb_branch_common.
6413 (Arm_relocate_functions::thm_jump24,
6414 Arm_relocate_functions::thm_xpc22): New method definitions.
6415 (Arm_relocate_functions::thumb_branch_common): New method definition.
6416 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6417 operator.
6418 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6419 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6420
e2b8f3c4
RÁE
64212009-11-24 Rafael Avila de Espindola <espindola@google.com>
6422
6423 * Makefile.am: Build incremental-dump
6424 * Makefile.in: Regenerate.
6425 * incremental-dump.cc: New.
6426 * incremental.cc (Incremental_inputs_header_data,
6427 Incremental_inputs_entry_data): Move to incremental.h
6428 * incremental.h: (Incremental_inputs_header_data,
6429 Incremental_inputs_entry_data): Move from incremental.cc
6430
bcba9aec
RÁE
64312009-11-24 Rafael Avila de Espindola <espindola@google.com>
6432
6433 * incremental.cc (Incremental_inputs_header,
6434 Incremental_inputs_header_write, Incremental_inputs_entry,
6435 Incremental_inputs_entry_write): Add a typedef with the data type.
6436
7c3afe08
RÁE
64372009-11-24 Rafael Avila de Espindola <espindola@google.com>
6438
6439 * incremental.cc (Incremental_inputs_header,
6440 Incremental_inputs_header_write, Incremental_inputs_entry,
6441 Incremental_inputs_entry_write): Update comment about which
6442 type has the filed descriptions.
6443
d204b6e9
DK
64442009-11-15 Doug Kwan <dougkwan@google.com>
6445
6446 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6447 (Arm_relocate_functions::arm_branch_common): Change method defintion
6448 in class definition to a method declaration and update list of formal
6449 parameters.
6450 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6451 Arm_relocation_functions::jump24): Adjust call to
6452 Arm_relocate_functions::arm_branch_common. Update list of formal
6453 parameters.
6454 (Arm_relocate_functions::xpc25): New method definition.
6455 (Arm_relocate_functions::arm_branch_common): Move method defintion
6456 out from class definition. Use stubs for mode-switching and extending
6457 branch ranges.
6458 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6459 specially. Change code to enable use of stubs in ARM branches.
6460
43d12afe
DK
64612009-11-10 Doug Kwan <dougkwan@google.com>
6462
6463 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6464 in method declaration.
6465 (Target_arm::relocate_stub): New method declaration.
6466 (Target_arm::default_target): Change to return a pointer instead of
6467 a const reference.
6468 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6469 Target_arm::default_target.
6470 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6471 method definition.
6472 (Target_arm::relocate_section): Adjust view.
6473 (Target_arm::relocate_stub): New method definition.
6474
ac33a407
DK
64752009-11-10 Doug Kwan <dougkwan@google.com>
6476
6477 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6478 a format warning.
6479 * incremental.cc (open_incremental_binary): Initialized local
6480 variables to avoid warnings.
6481 * object.cc (make_elf_object): Ditto.
6482 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6483 a format warning.
e1df38aa 6484
88ee28e9
L
6485009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6486
6487 PR gold/10930
6488 * testsuite/plugin_test.c: Include "config.h".
6489
2daedcd6
DK
64902009-11-09 Doug Kwan <dougkwan@google.com>
6491
6492 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6493 (arm_symbol_value): Remove.
6494 (Arm_relocate_functions::arm_branch_common,
6495 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6496 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6497 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6498 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6499 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6500 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6501 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6502 Arm_relocate_functions::thm_mobw_abs_nc,
6503 Arm_relocate_functions::thm_mov_abs,
6504 Arm_relocate_functions::movw_prel_nc,
6505 Arm_relocate_functions::thm_movt_abs,
6506 Arm_relocate_functions::movt_prel,
6507 Arm_relocate_functions::thm_movw_prel_nc,
6508 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6509 (Target_arm::Relocate::relocate): Only decompose address into two
6510 parts if relocation type uses the thumb-bit and pass the actual
6511 bit instead of a flag indicating that the thumb-bit is used. Adjust
6512 calls to methods in Arm_relocate_functions for this change.
6513
1276bc89 65142009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
6515
6516 PR 10925
6517 * reloc.cc: Instantiate
6518 Sized_relobj::initialize_input_to_output_maps and
6519 Sized_relobj:free_input_to_output_maps.
6520
e53ad1b5
ILT
65212009-11-06 Ian Lance Taylor <iant@google.com>
6522
6523 PR 10876
6524 * defstd.cc (in_segment): Set only_if_ref true for "end".
6525
eb44217c
DK
65262009-11-06 Doug Kwan <dougkwan@google.com>
6527
6528 * arm.cc (class Reloc_stub): Correct a comment.
6529 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6530 (Target_arm::scan_section_for_stubs): New method declaration.
6531 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6532 Change methods from private to protected.
6533 (Target_arm::do_may_relax): New method definition.
6534 (Target_arm::do_relax, Target_arm::group_sections,
6535 Target_arm::scan_reloc_for_stub,
6536 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6537 (Target_arm::arm_input_section_map_): New data member declaration.
6538 (Target_arm::scan_reloc_for_stub,
6539 Target_arm::scan_reloc_section_for_stubs,
6540 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6541 Target_arm::do_relax): New method definitions.
6542
5d329b7d
ILT
65432009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6544
6545 * configure.ac: Check for (struct stat)::st_mtim
6546 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6547 * config.in: Regenerate.
6548 * configure: Regenerate.
6549
96a0d71b
ILT
65502009-11-05 Ian Lance Taylor <iant@google.com>
6551
6552 PR 10910
6553 * output.cc (Output_segment::add_output_section): Add missing
6554 return statement.
6555
594c8e5e
ILT
65562009-11-04 Ian Lance Taylor <iant@google.com>
6557
6558 PR 10880
6559 * object.h (class Object): Add is_needed and set_is_needed
6560 methods. Add is_needed_ field. Make bool fields into bitfields.
6561 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6562 defined in a dynamic object and referenced by a regular object,
6563 set is_needed for the dynamic object.
6564 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6565 if the file is marked with as_needed and it is not needed.
6566
22b127cc
ILT
65672009-11-04 Ian Lance Taylor <iant@google.com>
6568
6569 PR 10887
6570 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6571 tags if data is discarded by linker script.
6572 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6573 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6574 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6575 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6576
f5c870d2
ILT
65772009-11-04 Ian Lance Taylor <iant@google.com>
6578
6579 * layout.cc (Layout::get_output_section): Add is_interp and
6580 is_dynamic_linker_section parameters. Change all callers.
6581 (Layout::choose_output_section): Likewise.
6582 (Layout::make_output_section): Likewise.
6583 (Layout::add_output_section_data): Add is_dynamic_linker_section
6584 parameter. Change all callers.
6585 * layout.h (class Layout): Update declarations.
6586 * output.h (class Output_section): Add is_interp, set_is_interp,
6587 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6588 Add is_interp_, is_dynamic_linker_section_ fields. Change
6589 generate_code_fills_at_write_ to a bitfield.
6590 * output.cc (Output_section::Output_sections): Initialize new
6591 fields.
6592 (Output_segment::add_output_section): Add do_sort parameter.
6593 Change all callers.
6594
1ae4d23b
ILT
65952009-11-03 Ian Lance Taylor <iant@google.com>
6596
6597 PR 10860
6598 * options.h (class General_options): Add --warn-common.
6599 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6600 merging two common symbols.
6601 (Symbol_table::should_override): Handle --warn-common when merging
6602 a common symbol with a defined symbol. Use report_resolve_problem
6603 for multiple definitions.
6604 (Symbol_table::report_resolve_problem): New function.
6605 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6606
55da9579
DK
66072009-11-03 Doug Kwan <dougkwan@google.com>
6608
6609 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6610 stub_factory_.
6611 (Target_arm::stub_factory): New method definition.
6612 (Target_arm::new_arm_input_section,
6613 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6614 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 6615 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
6616 New type definitions.
6617 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6618 member declarations.
6619 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6620 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6621 New method definitions.
6622
37a9ac43
ILT
66232009-11-03 Ian Lance Taylor <iant@google.com>
6624
6625 * options.h (class General_options): Add --warn_constructors.
6626
b3d6a3d4
ILT
66272009-11-03 Ian Lance Taylor <iant@google.com>
6628
6629 PR 10893
6630 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6631 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6632
934b01dd
ILT
66332009-11-03 Ian Lance Taylor <iant@google.com>
6634
6635 PR 10895
6636 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6637 --msgid-bugs-address.
6638 (install-pdf): New target.
6639 (install-data_yes): Look up one directory to find mkinstalldirs.
6640
03c1939b
L
66412009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6642
6643 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6644 tree.
6645
ebd95253
DK
66462009-10-30 Doug Kwan <dougkwan@google.com>
6647
6648 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6649
e9bbb538
DK
66502009-10-30 Doug Kwan <dougkwan@google.com>
6651
6652 * arm.cc (Stub_addend_reader): New struct template definition
6653 and partial specializations.
6654 (Stub_addend_reader::operator()): New method definition for a
6655 partially specialized template.
6656
d5b40221
DK
66572009-10-30 Doug Kwan <dougkwan@google.com>
6658
6659 * arm.cc (Arm_relobj::processor_specific_flags): New method
6660 definition.
6661 (Arm_relobj::do_read_symbols): New method declaration.
6662 (Arm_relobj::processor_specific_flags_): New data member declaration.
6663 (Arm_dynobj): New class definition.
6664 (Target_arm::do_finalize_sections): Add input_objects parameter.
6665 (Target_arm::do_adjust_elf_header): New method declaration.
6666 (Target_arm::are_eabi_versions_compatible,
6667 (Target_arm::merge_processor_specific_flags): New method declaration.
6668 (Target_arm::do_make_elf_object): New overloaded method definitions
6669 and declaration.
6670 (Arm_relobj::do_read_symbols): New method definition.
6671 (Arm_dynobj::do_read_symbols): Ditto.
6672 (Target_arm::do_finalize_sections): Add input_objects parameters.
6673 Merge processor-specific flags from all input objects.
6674 (Target_arm::are_eabi_versions_compatible,
6675 Target_arm::merge_processor_specific_flags,
6676 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6677 New method definitions.
6678 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6679 Input_objects pointer type parameter.
6680 * layout.cc (Layout::finalize): Pass input objects to target's.
6681 finalize_sections function.
6682 * output.cc (Output_file_header::do_sized_write): Set ELF file
6683 header's processor-specific flags.
6684 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6685 Input_objects pointer type parameter.
6686 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6687 * target.h (Input_objects): New forward class declaration.
6688 (Target::processor_specific_flags,
6689 Target::are_processor_specific_flags_sect): New method definitions.
6690 (Target::finalize_sections): Add input_objects parameter.
6691 (Target::Target): Initialize processor_specific_flags_ and
6692 are_processor_specific_flags_set_.
6693 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6694 parameter.
6695 (Target::set_processor_specific_flags): New method definition.
6696 (Target::processor_specific_flags_,
6697 Target::are_processor_specific_flags_set_): New data member
6698 declarations.
6699 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6700 Input_objects pointer type parameter.
6701
ebabffbd
DK
67022009-10-30 Doug Kwan <dougkwan@google.com>
6703
6704 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6705
ad0f2072
ILT
67062009-10-28 Ian Lance Taylor <iant@google.com>
6707
6708 * object.h (class Relobj): Drop options parameter from
6709 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6710 do_scan_relocs, do_relocate. Change all callers.
6711 (class Sized_relobj): Drop options parameters from
6712 do_gc_process_relocs, do_scan_relocs, do_relocate,
6713 do_relocate_sections, relocate_sections, emit_relocs_scan,
6714 emit_relocs_scan_reltype. Change all callers.
6715 (struct Relocate_info): Remove options field and all references to
6716 it.
6717 * reloc.h (class Read_relocs): Remove options constructor
6718 parameter and options_ field. Change all callers.
6719 (class Gc_process_relocs, class Scan_relocs): Likewise.
6720 (class Relocate_task): Likewise.
6721 * target-reloc.h (scan_relocs): Remove options parameter. Change
6722 all callers.
6723 (scan_relocatable_relocs): Likewise.
6724 * target.h (class Sized_target): Remove options parameter from
6725 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6726 all callers.
6727 * gc.h (gc_process_relocs): Remove options parameter. Change all
6728 callers.
6729 * arm.cc: Update functions to remove options parameters.
6730 * i386.cc: Likewise.
6731 * powerpc.cc: Likewise.
6732 * sparc.cc: Likewise.
6733 * x86_64.cc: Likewise.
6734 * testsuite/testfile.cc: Likewise.
6735
8ffa3667
DK
67362009-10-28 Doug Kwan <dougkwan@google.com>
6737
6738 * arm.cc (Arm_relobj): New class definition.
e1df38aa 6739 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
6740 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6741 New method definitions.
6742
40f36857
CC
67432009-10-28 Cary Coutant <ccoutant@google.com>
6744
6745 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6746 (Plugin::cleanup_done_): New member.
6747 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6748 (Plugin_manager::cleanup_done_): Remove.
6749 (Plugin_manager::add_input_file): Edit error message.
6750 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6751 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6752
2c849493
ILT
67532009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6754
6755 * fileread.cc: (File_read::View::~View): Use the new
6756 data_ownership_ filed.
6757 (File_read::~File_read): Dispose the new whole_file_view_.
6758 (File_read::open): Mmap the whole file if needed.
6759 (File_read::open): Use whole_file_view_ instead of contents_.
6760 (File_read::find_view): Use whole_file_view_ if applicable.
6761 (File_read::do_read): Use whole_file_view_ instead of contents_.
6762 (File_read::make_view): Use whole_file_view_ instead of contents_,
6763 update File_read::View::View call.
6764 (File_read::find_or_make_view): Update File_read::View::View
6765 call.
6766 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6767 remove contents_
6768 (File_read::View::Data_ownership): New enum.
6769 (File_read::View::View): Replace bool mapped_ with Data_ownership
6770 argument.
6771 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6772 (File_read::View::data_ownership_): New field.
6773 (File_read::contents_): Remove (replaced by whole_file_view_).
6774 (File_read::whole_file_view_): New field.
6775 * options.h (class General_options): Add --keep-files-mapped.
6776
24998053
CC
67772009-10-27 Cary Coutant <ccoutant@google.com>
6778
6779 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6780 * testsuite/Makefile.am (plugin_test_5): New test case.
6781 * testsuite/Makefile.in: Regenerate.
6782
72adc4fa
DK
67832009-10-25 Doug Kwan <dougkwan@google.com>
6784
6785 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6786 from private to protected to allow access by child class.
6787 (Sized_relobj::do_relocate_sections): New method declaration.
6788 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 6789 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
6790 Sized_relobj::relocate_sections. Instantiate template explicitly
6791 for different target sizes and endianity.
6792
07f508a2
DK
67932009-10-24 Doug Kwan <dougkwan@google.com>
6794
6795 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6796 (Arm_input_section::as_arm_input_section): New method.
6797 (Arm_output_section): New class definition.
6798 (Arm_output_section::create_stub_group,
6799 Arm_output_section::group_sections): New method definitions.
6800
10ad9fe5
DK
68012009-10-22 Doug Kwan <dougkwan@google.com>
6802
6803 * arm.cc (Arm_input_section): New class definition.
6804 (Arm_input_section::init, Arm_input_section:do_write,
6805 Arm_input_section::set_final_data_size,
6806 Arm_input_section::do_reset_address_and_file_offset): New method
6807 definitions.
6808
56ee5e00
DK
68092009-10-21 Doug Kwan <dougkwan@google.com>
6810
6811 * arm.cc (Stub_table, Arm_input_section): New forward class
6812 declarations.
6813 (Stub_table): New class defintion.
6814 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6815 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6816 New method definition.
6817
b569affa
DK
68182009-10-21 Doug Kwan <dougkwan@google.com>
6819
6820 * arm.cc: Update copyright comments.
6821 (Target_arm): New forward class template declaration.
6822 (Arm_address): New type.
6823 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6824 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6825 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6826 constants.
6827 (Insn_template): Same.
6828 (DEF_STUBS): New macro.
6829 (Stub_type): New enum type.
6830 (Stub_template): New class definition.
6831 (Stub): Same.
6832 (Reloc_stub): Same.
6833 (Stub_factory): Same.
6834 (Target_arm::Target_arm): Initialize may_use_blx_ and
6835 should_force_pic_veneer_.
6836 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6837 Target_arm::should_force_pic_veneer,
6838 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6839 Target_arm::using_thumb_only, Target_arm:;default_target): New
6840 method defintions.
6841 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6842 New data member declarations.
6843 (Insn_template::size, Insn_template::alignment): New method defintions.
6844 (Stub_template::Stub_template): New method definition.
6845 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6846 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6847 (Stub_factory::Stub_factory): New method definition.
6848 * gold.h (string_hash): New template.
6849 * output.h (Input_section_specifier::hash_value): Use
6850 gold::string_hash.
6851 (Input_section_specifier::string_hash): Remove.
6852 * stringpool.cc (Stringpool_template::string_hash): Use
6853 gold::string_hash.
6854
6c172549
DK
68552009-10-20 Doug Kwan <dougkwan@google.com>
6856
6857 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6858 symbols of relaxed input sections.
6859 * output.h (Output_section::find_relaxed_input_section): Make
6860 method public.
6861
c5617f2f
DK
68622009-10-16 Doug Kwan <dougkwan@google.com>
6863
6864 * dynobj.cc (Versions::Versions): Initialize version_script_.
6865 Only insert base version symbol definition for a shared object
6866 if version script defines any version versions.
6867 (Versions::define_base_version): New method definition.
6868 (Versions::add_def): Check that base version is not needed.
6869 (Versions::add_need): Define base version lazily.
6870 * dynobj.h (Versions::define_base_version): New method declaration.
6871 (Versions::needs_base_version_): New data member declaration.
6872 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6873 (check_DATA): Add no_version_test.stdout.
6874 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6875 New make rules.
6876 * testsuite/Makefile.in: Regenerate.
6877 * testsuite/no_version_test.c: New file.
6878 * testsuite/no_version_test.sh: Ditto.
6879
3c12dcdb
DK
68802009-10-16 Doug Kwan <dougkwan@google.com>
6881
6882 * expression.cc (class Segment_start_expression): New class definition.
6883 (Segment_start_expression::value): New method definition.
6884 (script_exp_function_segment_start): Return a new
6885 Segment_start_expression.
6886 * gold/script-c.h (script_saw_segment_start_expression): New function
6887 prototype.
6888 * script-sections.cc (Script_sections::Script_sections): Initialize
6889 SAW_SEGMENT_START_EXPRESSION_ to false.
6890 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6891 and -Tbbs options to specify section addresses if given in
6892 command line and no SEGMENT_START expression is seen in a script.
6893 * script-sections.h (Script_sections::saw_segment_start_expression,
6894 Script_sections::set_saw_segment_start_expression): New method
6895 definition.
6896 (Script_sections::saw_segment_start_expression_): New data member
6897 declaration.
6898 * script.cc (script_saw_segment_start_expression): New function.
6899 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6900 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6901 script_test_7.sh and script_test_8.sh.
6902 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6903 script_test_8.stdout.
6904 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6905 (script_test_6, script_test_6.stdout, script_test_7,
6906 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6907 * Makefile.in: Regenerate.
6908 * testsuite/script_test_6.sh: New file.
6909 * testsuite/script_test_6.t: Same.
6910 * testsuite/script_test_7.sh: Same.
6911 * testsuite/script_test_7.t: Same.
6912 * testsuite/script_test_8.sh: Same.
6913
64b1ae37
DK
69142009-10-16 Doug Kwan <dougkwan@google.com>
6915
6916 * output.cc (Output_segment::set_section_list_address): Cast
6917 expressions to unsigned long long type to avoid format warnings.
6918
661be1e2
ILT
69192009-10-15 Ian Lance Taylor <iant@google.com>
6920
12edd763 6921 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 6922 dot assignment to script_sections_.
12edd763
ILT
6923 * script-sections.cc (Script_sections::add_dot_assignment):
6924 Initialize if necessary.
6925
68b6574b
ILT
6926 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6927 program headers with no load segment if there is a linker script.
6928
661be1e2
ILT
6929 * layout.cc (Layout::set_segment_offsets): Align the file offset
6930 to the segment aligment for -N or -n with no load segment.
6931 * output.cc (Output_segment::add_output_section): Don't crash if
6932 the first section is a TLS section.
6933 (Output_segment::set_section_list_addresses): Print an error
6934 message if the address moves backward in a linker script.
6935 * script-sections.cc
6936 (Output_section_element_input::set_section_addresses): Don't
6937 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6938 (Orphan_output_section::set_section_addresses): Likewise.
6939
f15f61a7
DK
69402009-10-15 Doug Kwan <dougkwan@google.com>
6941
6942 * layout.cc (Layout::finish_dynamic_section): Generate tags
6943 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6944 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6945 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6946
82bb573a
ILT
69472009-10-14 Ian Lance Taylor <iant@google.com>
6948
6949 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6950 fields.
6951 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6952 data_shdr fields of relinfo.
6953 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6954 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6955 R_386_TLS_LDO_32, adjust based on section flags.
6956 (Target_i386::Relocate::fix_up_ldo): Remove.
6957
374ad285
ILT
69582009-10-13 Ian Lance Taylor <iant@google.com>
6959
6960 Add support for -pie.
6961 * options.h (class General_options): Add -pie and
6962 --pic-executable.
6963 (General_options::output_is_position_independent): Test -pie.
6964 (General_options::output_is_executable): Return true if not shared
6965 and not relocatable.
6966 (General_options::output_is_pie): Remove.
6967 * options.cc (General_options::finalize): Reject incompatible uses
6968 of -pie.
6969 * gold.cc (queue_middle_tasks): A -pie link is not static.
6970 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6971 * symtab.cc (Symbol::final_value_is_known): Return false if
6972 output_is_position_independent.
6973 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6974 output_is_position_independent.
6975 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6976 output_is_position_independent.
6977 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6978 output_is_position_independent.
6979 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6980 two_file_pie_test.
6981 (basic_pie_test.o, basic_pie_test): New targets.
6982 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6983 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6984 (two_file_pie_test): New target.
6985 * testsuite/Makefile.in: Rebuild.
6986 * README: Remove note saying that -pie is not supported.
6987
c6585162
ILT
69882009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6989
6990 * options.h (class General_options): Add -init and -fini.
6991 * layout.cc (Layout::finish_dynamic_section): Emit
6992 given init and fini functions.
6993
032ce4e9
ST
69942009-10-13 Sriraman Tallam <tmsriram@google.com>
6995
6996 * gc.h (gc_process_relocs): Check if icf is enabled using new
6997 function.
6998 * gold.cc (queue_initial_tasks): Likewise.
6999 (queue_middle_tasks): Likewise.
7000 * object.cc (do_layout): Likewise.
7001 * symtab.cc (is_section_folded): Likewise.
7002 * main.cc (main): Likewise.
7003 * reloc.cc (Read_relocs::run): Likewise.
7004 (Sized_relobj::do_scan_relocs): Likewise.
7005 * icf.cc (is_function_ctor_or_dtor): New function.
7006 (Icf::find_identical_sections): Check if function is ctor or dtor when
7007 safe icf is chosen.
7008 * options.h (General_options::icf): Change option to be an enum.
7009 (Icf_status): New enum.
7010 (icf_enabled): New method.
7011 (icf_safe_folding): New method.
7012 (set_icf_status): New method.
7013 (icf_status_): New variable.
7014 * (options.cc) (General_options::finalize): Set icf_status_.
7015 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
7016 icf_test and icf_keep_unique_test to use the --icf enum flag.
7017 * testsuite/icf_safe_test.sh: New file.
e1df38aa 7018 * testsuite/icf_safe_test.cc: New file.
032ce4e9 7019
f345227a
ST
70202009-10-12 Sriraman Tallam <tmsriram@google.com>
7021
7022 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
7023 includes to gc.h and icf.h.
7024 * arm.cc: Include gc.h.
7025 * gold.cc: Likewise.
7026 * i386.cc: Likewise.
7027 * powerpc.cc: Likewise.
7028 * sparc.cc: Likewise.
7029 * x86_64.cc: Likewise.
7030 * gc.h: Include icf.h.
7031
1c7814ed
ILT
70322009-10-11 Ian Lance Taylor <iant@google.com>
7033
7034 * plugin.cc: Include "gold.h" before other header files.
7035
ae3b5189
CD
70362009-10-10 Chris Demetriou <cgd@google.com>
7037
7038 * options.h (Input_file_argument::Input_file_type): New enum.
7039 (Input_file_argument::is_lib_): Replace with...
7040 (Input_file_argument::type_): New member.
7041 (Input_file_argument::Input_file_argument): Take Input_file_type
7042 'type' rather than boolean 'is_lib' as second argument.
7043 (Input_file_argument::is_lib): Use type_.
7044 (Input_file_argument::is_searched_file): New function.
7045 (Input_file_argument::may_need_search): Handle is_searched_file.
7046 * options.cc (General_options::parse_library): Support -l:filename.
7047 (General_options::parse_just_symbols): Update for Input_file_argument
7048 changes.
7049 (Command_line::process): Likewise.
7050 * archive.cc (Archive::get_file_and_offset): Likewise.
7051 * plugin.cc (Plugin_manager::release_input_file): Likewise.
7052 * script.cc (read_script_file, script_add_file): Likewise.
7053 * fileread.cc (Input_file::Input_file): Likewise.
7054 (Input_file::will_search_for): Handle is_searched_file.
7055 (Input_file::open): Likewise.
7056 * readsyms.cc (Read_symbols::get_name): Likewise.
7057 * testsuite/Makefile.am (searched_file_test): New test.
7058 * testsuite/Makefile.in: Regenerate.
7059 * testsuite/searched_file_test.cc: New file.
7060 * testsuite/searched_file_test_lib.cc: New file.
7061
f3048a1d
ILT
70622009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7063 Ian Lance Taylor <iant@google.com>
7064
7065 * descriptor.cc: Include <cstdio> and "binary-io.h".
7066 (Descriptors::open): Open the files in binary mode always.
7067 * script.cc (Lex::get_token): Treat \r as whitespace.
7068
d4780e57
ILT
70692009-10-09 Ian Lance Taylor <iant@google.com>
7070
7071 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
7072
d9a893b8
ILT
70732009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7074 Ian Lance Taylor <iant@google.com>
7075
7076 * configure.ac: Check for readv function also.
7077 * fileread.cc (readv): Define if not HAVE_READV.
7078 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7079 does not exist.
7080 * config.in: Regenerate.
7081 * configure: Regenerate.
7082
c0a62865
DK
70832009-10-09 Doug Kwan <dougkwan@google.com>
7084
7085 * layout.cc (Layout::make_output_section): Call target hook to make
7086 ordinary output section.
7087 (Layout::finalize): Adjust parameter list of call the
7088 Target::may_relax().
7089 * layout.h (class Layout::section_list): New method.
7090 * merge.h (Output_merge_base::entsize): Change visibility to public.
7091 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7092 New methods.
7093 (Output_merge_string::do_is_string): New method.
7094 * object.cc (Sized_relobj::do_setup): renamed from
7095 Sized_relobj::set_up.
7096 * object.h (Sized_relobj::adjust_shndx,
7097 Sized_relobj::initializ_input_to_output_maps,
7098 Sized_relobj::free_input_to_output_maps): Change visibilities to
7099 protected.
7100 (Sized_relobj::setup): Virtualize.
7101 (Sized_relobj::do_setup): New method declaration.
7102 (Sized_relobj::invalidate_section_offset,
7103 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7104 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7105 * options.cc (parse_int): New function.
7106 * options.h (parse_int): New declaration.
7107 (DEFINE_int): New macro.
7108 (stub_group_size): New option.
7109 * output.cc (Output_section::Output_section): Initialize memebers
7110 merge_section_map_, merge_section_by_properties_map_,
7111 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7112 (Output_section::add_input_section): Handled deferred code-fill
7113 generation and remove an old comment.
7114 (Output_section::add_relaxed_input_section): New method definition.
7115 (Output_section::add_merge_input_section): Use merge section by
7116 properties map to speed to search. Update merge section maps
7117 as appropriate.
7118 (Output_section::build_relaxation_map): New method definition.
7119 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7120 Same.
7121 (Output_section::relax_input_section): Renamed to
7122 Output_section::convert_input_sections_to_relaxed_sections and change
7123 interface to take a vector of pointers to relaxed sections.
7124 (Output_section::find_merge_section,
7125 Output_section::find_relaxed_input_section): New method definitions.
7126 (Output_section::is_input_address_mapped,
7127 Output_section::output_offset, Output_section::output_address):
7128 Use output section data maps to speed up searching.
7129 (Output_section::find_starting_output_address): Add comments.
7130 (Output_section::do_write,
7131 Output_section::write_to_postprocessing_buffer): Do code-fill
7132 generation as appropriate.
7133 (Output_section::get_input_sections): Invalidate relaxed input section
7134 map.
7135 (Output_section::restore_states): Adjust type of checkpoint .
7136 Invalidate relaxed input section map.
7137 * output.h (Output_merge_base): New class declaration.
7138 (Input_section_specifier): New class defintion.
7139 (class Output_relaxed_input_section) Change base class to
7140 Output_section_data_build.
7141 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7142 base class initializer.
7143 (Output_section::add_relaxed_input_section): New method declaration.
7144 (Output_section::Input_section): Change visibility to protected.
7145 (Output_section::Input_section::relobj,
7146 Output_section::Input_section::shndx): Handle relaxed input sections.
7147 Output_section::input_sections) Change visibility to protected. Also
7148 define overload to return a non-const pointer.
7149 (Output_section::Merge_section_properties): New class defintion.
7150 (Output_section::Merge_section_by_properties_map,
7151 Output_section::Output_section_data_by_input_section_map,
7152 Output_section::Relaxation_map): New types.
7153 (Output_section::relax_input_section): Rename method to
7154 Output_section::convert_input_sections_to_relaxed_sections and change
7155 interface to take a vector of relaxed section pointers.
7156 (Output_section::find_merge_section,
7157 Output_section::find_relaxed_input_section,
7158 Output_section::build_relaxation_map,
7159 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7160 New method declarations.
7161 (Output_section::merge_section_map_
7162 Output_section::merge_section_by_properties_map_,
7163 Output_section::relaxed_input_section_map_,
7164 Output_section::is_relaxed_input_section_map_valid_,
7165 Output_section::generate_code_fills_at_write_): New data members.
7166 * script-sections.cc
7167 (Output_section_element_input::set_section_addresses): Call
7168 current_data_size and addralign methods of relaxed input sections.
7169 (Orphan_output_section::set_section_addresses): Call current_data_size
7170 and addralign methods of relaxed input sections.
7171 * symtab.cc (Symbol_table::compute_final_value): Extract template
7172 from the body of Symbol_table::sized_finalize_symbol.
7173 (Symbol_table::sized_finalized_symbol): Call
7174 Symbol_table::compute_final_value.
7175 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7176 (Symbol_table::compute_final_value): New templated method declaration.
7177 * target.cc (Target::do_make_output_section): New method defintion.
7178 * target.h (Target::make_output_section): New method declaration.
7179 (Target::relax): Add more parameters for input objects, symbol table
7180 and layout. Adjust call to do_relax.
7181 (Target::do_make_output_section): New method declaration.
7182 (Target::do_relax): Add parameters for input objects, symbol table
7183 and layout.
7184
d446d6c4
ILT
71852009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7186
7187 * pread.c: Include stdio.h.
7188
bc06c745
ILT
71892009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7190
7191 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7192 defined.
7193
75aea3d0
ILT
71942009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7195
7196 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7197 Change read_shndx type to unsigned int.
7198 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7199 int.
7200 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7201 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7202 Change read_shndx type to unsigned int.
7203 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7204 int.
7205 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7206 * layout.cc (Layout::create_symtab_sections): Cast the result of
7207 local_symcount * symsize to off_t in the gold_assert.
7208
be8fcb75
ILT
72092009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7210
7211 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7212 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7213 R_ARM_BASE_ABS.
7214 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7215 (Arm_relocate_functions::thm_abs5): New function.
7216 (Arm_relocate_functions::abs12): New function.
7217 (Arm_relocate_functions::abs16): New function.
7218 (Arm_relocate_functions::base_abs): New function.
7219 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7220 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7221 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7222 R_ARM_BASE_ABS.
7223 (Scan::global): Likewise.
7224 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7225 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7226 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7227 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7228 R_ARM_BASE_ABS.
7229
c2a122b6
ILT
72302009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7231
7232 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7233 (Arm_relocate_functions::movt_prel): New function.
7234 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7235 (Arm_relocate_functions::thm_movt_prel): New function.
7236 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7237 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7238 (Scan::global, Relocate::relocate): Likewise.
7239 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7240
c4aa1e2d
ILT
72412009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7242
7243 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7244 Incremental_checker.
7245 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7246 unsigned int.
7247 (class Incremental_inputs_header): New class.
7248 (Incremental_inputs_header_writer): Edit comment.
7249 (Incremental_inputs_entry): New class.
7250 (Incremental_inputs_entry_writer): Edit comment.
7251 (Sized_incremental_binary::do_find_incremental_inputs_section):
7252 Add *strtab_shndx parameter, fill it.
7253 (Sized_incremental_binary::do_check_inputs): New method.
7254 (Incremental_checker::can_incrementally_link_output_file): Use
7255 Sized_incremental_binary::check_inputs.
7256 (Incremental_inputs::report_command_line): Save command line in
7257 command_line_.
7258 * incremental.h:
7259 (Incremental_binary::find_incremental_inputs_section): New
7260 method.
7261 (Incremental_binary::do_find_incremental_inputs_section): Add
7262 strtab_shndx parameter.
7263 (Incremental_binary::do_check_inputs): New pure virtual method.
7264 (Sized_incremental_binary::do_check_inputs): Declare.
7265 (Incremental_checker::Incremental_checker): Add incremental_inputs
7266 parameter, use it to initialize incremental_inputs_.
7267 (Incremental_checker::incremental_inputs_): New field.
7268 (Incremental_checker::command_line): New method.
7269 (Incremental_checker::inputs): New method.
7270 (Incremental_checker::command_line_): New field.
7271
c549a694
ILT
72722009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7273
7274 * incremental.cc: Include <cstdarg> and "target-select.h".
7275 (vexplain_no_incremental): New function.
7276 (explain_no_incremental): New function.
7277 (Incremental_binary::error): New method.
7278 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7279 method.
7280 (make_sized_incremental_binary): New function.
7281 (open_incremental_binary): New function.
7282 (can_incrementally_link_file): Add checks if output is ELF and has
7283 inputs section.
7284 * incremental.h: Include "elfcpp_file.h" and "output.h".
7285 (Incremental_binary): New class.
7286 (Sized_incremental_binary): New class.
7287 (open_incremental_binary): Declare.
7288 * object.cc (is_elf_object): Use
7289 elfcpp::Elf_recognizer::is_elf_file.
7290 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7291 * output.h (Output_file::filesize): New method.
7292
fd3c5f0b
ILT
72932009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7294
7295 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7296 New function.
7297 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7298 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7299 function.
7300 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7301 function.
7302 (Arm_relocate_functions::movw_abs_nc): New function.
7303 (Arm_relocate_functions::movt_abs): New function.
7304 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7305 (Arm_relocate_functions::thm_movt_abs): New function.
7306 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7307 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7308 (Scan::global): Likewise.
7309 (Relocate::relocate): Likewise.
7310 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7311
7f5309a5
ILT
73122009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7313
7314 * arm.cc (Arm_relocate_functions::got_prel) New function.
7315 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7316 (Relocate::relocate): Likewise.
7317 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7318
364c7fa5
ILT
73192009-10-06 Ian Lance Taylor <iant@google.com>
7320
7321 * options.h (class General_options): Define
7322 split_stack_adjust_size parameter.
7323 * object.h (class Object): Add uses_split_stack_ and
7324 has_no_split_stack_ fields. Add uses_split_stack and
7325 has_no_split_stack accessor functions. Declare
7326 handle_split_stack_section.
7327 (class Reloc_symbol_changes): Define.
7328 (class Sized_relobj): Define Function_offsets. Declare
7329 split_stack_adjust, split_stack_adjust_reltype, and
7330 find_functions.
7331 * object.cc (Object::handle_split_stack_section): New function.
7332 (Sized_relobj::do_layout): Call handle_split_stack_section.
7333 * dynobj.cc (Sized_dynobj::do_layout): Call
7334 handle_split_stack_section.
7335 * reloc.cc (Sized_relobj::relocate_sections): Call
7336 split_stack_adjust for executable sections in split_stack
7337 objects. Pass reloc_map to relocate_section.
7338 (Sized_relobj::split_stack_adjust): New function.
7339 (Sized_relobj::split_stack_adjust_reltype): New function.
7340 (Sized_relobj::find_functions): New function.
7341 * target-reloc.h: Include "object.h".
7342 (relocate_section): Add reloc_symbol_changes parameter. Change
7343 all callers.
7344 * target.h (class Target): Add calls_non_split method. Declare
7345 do_calls_non_split virtual method. Declare match_view and
7346 set_view_to_nop.
7347 * target.cc: Include "elfcpp.h".
7348 (Target::do_calls_non_split): New function.
7349 (Target::match_view): New function.
7350 (Target::set_view_to_nop): New function.
7351 * gold.cc (queue_middle_tasks): Give an error if mixing
7352 split-stack and non-split-stack objects with -r.
7353 * i386.cc (Target_i386::relocate_section): Add
7354 reloc_symbol_changes parameter.
7355 (Target_i386::do_calls_non_split): New function.
7356 * x86_64.cc (Target_x86_64::relocate_section): Add
7357 reloc_symbol_changes parameter.
7358 (Target_x86_64::do_calls_non_split): New function.
7359 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7360 parameter.
7361 * powerpc.cc (Target_powerpc::relocate_section): Add
7362 reloc_symbol_changes parameter.
7363 * sparc.cc (Target_sparc::relocate_section): Add
7364 reloc_symbol_changes parameter.
7365 * configure.ac: Call AM_CONDITIONAL for the default target.
7366 * configure: Rebuild.
7367 * testsuite/Makefile.am (TEST_AS): New variable.
7368 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7369 (check_DATA): Add split_i386 and split_x86_64 files.
7370 (SPLIT_DEFSYMS): Define.
7371 (split_i386_[1234n].o): New targets.
7372 (split_i386_[124]): New targets.
7373 (split_i386_[1234r].stdout): New targets.
7374 (split_x86_64_[1234n].o): New targets.
7375 (split_x86_64_[124]): New targets.
7376 (split_x86_64_[1234r].stdout): New targets.
7377 (MOSTLYCLEANFILES): Add new executables.
7378 * testsuite/split_i386.sh: New file.
7379 * testsuite/split_x86_64.sh: New file.
7380 * testsuite/split_i386_1.s: New file.
7381 * testsuite/split_i386_2.s: New file.
7382 * testsuite/split_i386_3.s: New file.
7383 * testsuite/split_i386_4.s: New file.
7384 * testsuite/split_i386_n.s: New file.
7385 * testsuite/split_x86_64_1.s: New file.
7386 * testsuite/split_x86_64_2.s: New file.
7387 * testsuite/split_x86_64_3.s: New file.
7388 * testsuite/split_x86_64_4.s: New file.
7389 * testsuite/split_x86_64_n.s: New file.
7390 * testsuite/testfile.cc (Target_test): Update relocation_section
7391 function.
7392 * testsuite/Makefile.in: Rebuild.
7393
e8a9fcda
ILT
73942009-10-06 Ian Lance Taylor <iant@google.com>
7395
7396 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7397 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7398 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7399 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7400 the address on ldo_addrs_.
7401 (Target_i386::Relocate::fix_up_ldo): New function.
7402
e99daf92
ILT
74032009-10-06 Rafael Espindola <espindola@google.com>
7404
7405 * plugin.cc (add_input_library): New.
7406 (Plugin::load): Add add_input_library to tv.
7407 (Plugin_manager::add_input_file): Add the is_lib argument.
7408 (add_input_file): Update call to Plugin_manager::add_input_file.
7409 (add_input_library): New.
7410 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7411
966d4097
DK
74122009-09-30 Doug Kwan <dougkwan@google.com>
7413
7414 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7415 symbol and call Symbol::may_need_copy_reloc to determine if
7416 a copy reloc is needed.
7417 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7418 nocopyreloc is given in command line.
7419 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7420 given in command line.
7421 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7422 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7423 of the removed Target_i386::may_need_copy_reloc.
7424 * options.h (copyreloc): New option with default value false.
7425 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7426 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7427 instead of the removed Target_powerpc::may_need_copy_reloc.
7428 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7429 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7430 instead of the removed Target_sparc::may_need_copy_reloc.
7431 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7432 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7433 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7434 instead of the removed Target_x86_64::may_need_copy_reloc.
7435
029ba973
ILT
74362009-09-30 Ian Lance Taylor <iant@google.com>
7437
7438 * object.h (class Object): Remove target_ field, and target,
7439 sized_target, and set_target methods.
7440 (Object::sized_target): Remove.
7441 (class Sized_relobj): Update declarations. Remove sized_target.
7442 * object.cc (Sized_relobj::setup): Remove target parameter.
7443 Change all callers.
7444 (Input_objects::add_object): Don't do anything with the target.
7445 (make_elf_sized_object): Add punconfigured parameter. Change all
7446 callers. Set or test parameter target.
7447 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7448 Change all callers.
7449 * parameters.cc (Parameters::set_target): Change parameter type to
7450 be non-const.
7451 (Parameters::default_target): Remove.
7452 (set_parameters_target): Change parameter type to be non-const.
7453 (parameters_force_valid_target): New function.
7454 (parameters_clear_target): New function.
7455 * parameters.h (class Parameters): Update declarations. Remove
7456 default_target method. Add sized_target and clear_target
7457 methods. Change target_ to be non-const.
7458 (set_parameters_target): Update declaration.
7459 (parameters_force_valid_target): Declare.
7460 (parameters_clear_target): Declare.
7461 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7462 as NULL if we aren't searching.
7463 (Add_symbols::run): Don't check for compatible target.
7464 * fileread.cc (Input_file::open_binary): Call
7465 parameters_force_valid_target.
7466 * gold.cc (queue_middle_tasks): Likewise.
7467 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7468 set_target on object.
7469 * dynobj.h (class Sized_dynobj): Update declarations.
7470 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7471 make_elf_object returns NULL.
7472 (Archive::include_member): Don't check whether object target is
7473 compatible.
7474 * output.cc (Output_section::add_input_section): Get target from
7475 parameters.
7476 (Output_section::relax_input_section): Likewise.
7477 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7478 parameters.
7479 (Sized_relobj::do_scan_relocs): Likewise.
7480 (Sized_relobj::relocate_sections): Likewise.
7481 * resolve.cc (Symbol_table::resolve): Likewise.
7482 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7483 parameter. Change all callers.
7484 (Symbol_table::add_from_object): Get target from parameters.
7485 (Symbol_table::add_from_relobj): Don't check object target.
7486 (Symbol_table::add_from_dynobj): Likewise.
7487 (Symbol_table::define_special_symbol): Get target from
7488 parameters.
7489 * symtab.h (class Symbol_table): Update declaration.
7490 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7491 parameter. Change all callers. Clear parameter target.
7492 (Binary_test): Test target here.
7493 * testsuite/object_unittest.cc (gold_testsuite): Remove
7494 target_test_pointer parameter. Change all callers.
7495 (Object_test): Test target here.
7496
a6a22b83
ILT
74972009-09-26 Ian Lance Taylor <iant@google.com>
7498
7499 * testsuite/initpri1.c: Don't try to use constructor priorities if
7500 compiling with gcc before 4.3.
7501
6a8f49fe
ILT
75022009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7503
7504 * testsuite/retain_symbols_file_test.sh (check_present): Change
7505 output file name to retain_symbols_file_test.stdout.
7506 (check_absent): Likewise.
7507
8c604651
CS
75082009-09-18 Craig Silverstein <csilvers@google.com>
7509
7510 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7511 * options.cc: Include <cerrno> and <fstream>.
7512 (General_options::finalize): Parse -retain-symbols-file tag.
7513 * options.h: New flag.
7514 (General_options): New method should_retain_symbol, new
7515 variable symbols_to_retain.
7516 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7517 should_retain_symbol map.
7518 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7519 * testsuite/Makefile.in: Regenerate.
7520 * testsuite/retain_symbols_file_test.sh: New file.
7521
ca58b19f
NC
75222009-09-18 Nick Clifton <nickc@redhat.com>
7523
7524 * po/es.po: Updated Spanish translation.
7525
20e6d0d6
DK
75262009-09-17 Doug Kwan <dougkwan@google.com>
7527
7528 * debug.h (DEBUG_RELAXATION): New constant.
7529 (DEBUG_ALL): Add DEBUG_RELAXATION.
7530 (debug_string_to_enum): Add relaxation debug option.
7531 * layout.cc
7532 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7533 Layout::Relaxation_debug_check::read_sections,
7534 Layout::Relaxation_debug_check::read_sections): New method definitions.
7535 (Layout::Layout): Initialize data members
7536 record_output_section_data_from_scrips_,
7537 script_output_section_data_list_ and relaxation_debug_check_.
7538 (Layout::save_segments, Layout::restore_segments,
7539 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7540 Layout::relaxation_loop_body): New method definitions.
7541 (Layout::finalize): Support relaxation. Move section layout code to
7542 Layout::relaxation_loop_body.
7543 (Layout::set_asection_address_from_script): Move code for orphan
7544 section placement out.
7545 (Layout::place_orphan_sections_in_script): New method definition.
7546 * layout.h (Output_segment_headers, Output_file_header):
7547 New forward class declarations.
7548 (Layout::~Layout): Define.
7549 (Layout::new_output_section_data_from_script): New method definition.
7550 (Layout::place_orphan_sections_in_script): New method declaration.
7551 (Layout::Segment_states): New type declaration.
7552 (Layout::save_segments, Layout::restore_segments,
7553 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7554 Layout::relaxation_loop_body): New method declarations.
7555 (Layout::Output_section_data_list): New type declaration.
7556 (Layout::Relaxation_debug_check): New class definition.
7557 (Layout::record_output_section_data_from_script_,
7558 Layout::script_output_section_data_list_, Layout::segment_states_,
7559 Layout::relaxation_debug_check_): New data members.
7560 * output.cc: (Output_section_headers::do_size): New method definition.
7561 (Output_section_headers::Output_section_headers): Move size
7562 computation to Output_section_headers::do_size.
7563 (Output_segment_headers::do_size): New method definition.
e1df38aa 7564 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
7565 Output_file_header::do_size and call it.
7566 (Output_file_header::do_size): New method definition.
7567 (Output_data_group::Output_data_group): Adjust call to
7568 Output_section_data.
7569 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7570 (Output_symtab_xindex::do_write): Add array bound check.
7571 (Output_section::Input_section::print_to_mapfile): Handle
7572 RELAXED_INPUT_SECTION_CODE.
7573 (Output_section::Output_section): Initialize data member checkpoint_.
7574 (Output_section::~Output_section): Delete checkpoint object pointed
7575 by checkpoint_.
7576 (Output_section::add_input_section): Always add an Input_section if
7577 relaxing.
7578 (Output_section::add_merge_input_section): Add assert.
7579 (Output_section::relax_input_section): New method definition.
7580 (Output_section::set_final_data_size): Set load address to zero for
7581 an unallocated section.
7582 (Output_section::do_address_and_file_offset_have_reset_values):
7583 New method definition.
7584 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7585 Handle relaxed input section.
7586 (Output_section::sort_attached_input_sections): Checkpoint input
7587 section list lazily.
7588 (Output_section::get_input_sections): Change type of input_sections to
7589 list of Simple_input_section pointers. Checkpoint input section list
7590 lazily. Also handle relaxed input sections.
7591 (Output_section::add_input_section_for_script): Take a reference to
7592 a Simple_input_section object instead of Relobj pointer and section
7593 index as parameter. Handle relaxed input sections.
7594 (Output_section::save_states, Output_section::restore_states): New
7595 method definitions.
7596 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7597 (Output_data::is_data_size_fixed): New method definition.
7598 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7599 if it is fixed.
7600 (Output_data::address_and_file_offset_have_reset_values): New method
7601 definition.
7602 (Output_data::do_address_and_file_offset_have_reset_values): New method
7603 definition.
7604 (Output_data::set_data_size): Check that data size is not fixed.
7605 (Output_data::fix_data_size): New method definition.
7606 (Output_data::is_data_size_fixed_): New data member.
7607 (Output_section_headers::set_final_data_size): New method definition.
7608 (Output_section_headers::do_size): New method declaration.
7609 (Output_segment_headers::set_final_data_size): New method definition.
7610 (Output_segment_headers::do_size): New method declaration.
7611 (Output_file_header::set_final_data_size)::New method definition.
7612 (Output_file_header::do_size)::New method declaration.
7613 (Output_section_data::Output_section_data): Add new parameter
7614 is_data_size_fixed and use it to fix data size.
7615 (Output_data_const::Output_data_const): Adjust call to base class
7616 constructor and fix data size.
7617 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7618 base class constructor and fix data size.
7619 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7620 base class constructor and fix data size.
7621 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7622 class constructor and fix data size.
7623 (Output_data_group::set_final_data_size): New method definition.
7624 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7625 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7626 class constructor and fix data size.
7627 (Output_relaxed_input_section): New class definition.
7628 (Output_section::Simple_input_section): New class definition.
7629 (Output_section::get_input_sections): Adjust parameter list.
7630 (Output_section::add_input_section_for_script): Same.
7631 (Output_section::save_states, Output_section::restore_states,
7632 Output_section::do_address_and_file_offset_have_reset_values,
7633 (Output_section::Input_section::Input_section): Handle
7634 RELAXED_INPUT_SECTION_CODE. Add new overload for
7635 Output_relaxed_input_section.
7636 (Output_section::Input_section::is_input_section,
7637 Output_section::Input_section::set_output_section): Handle relaxed
7638 input section.
7639 (Output_section::Input_section::is_relaxed_input_section,
7640 Output_section::Input_section::output_section_data,
7641 Output_section::Input_section::relaxed_input_section): New method
7642 definitions.
7643 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7644 value.
7645 (Output_section::Input_section::u1_): Update comments.
7646 (Output_section::Input_section::u2_): Add new union member poris.
7647 (Output_section::Checkpoint_output_section): New classs definition.
7648 (Output_section::relax_input_section): New method declaration.
7649 (Output_section::checkpoint_): New data member.
7650 (Output_segment): Update comments.
7651 (Output_segment::Output_segment): Un-privatize copy constructor.
7652 (Output_segment::operator=): Un-privatize.
7653 * script-sections.cc (Output_section_element::Input_section_list):
7654 Change element type to Output_section::Simple_input_section.
7655 (Output_section_element_dot_assignment::set_section_addresses):
7656 Register output section data for relaxation clean up.
7657 (Output_data_exression::Output_data_expression): Adjust call to base
7658 constructor to fix data size.
7659 (Output_section_element_data::set_section_addresses): Register
7660 Output_data_expression object for relaxation clean up.
7661 (struct Input_section_info): Replace Relobj pointer and section index
7662 pair with Output_section::Simple_input_section and Convert struct to a
7663 class.
7664 (Input_section_sorter::operator()): Adjust access to
e1df38aa 7665 Input_section_info data member to use accessors.
20e6d0d6
DK
7666 (Output_section_element_input::set_section_addresses): Use layout
7667 parameter. Adjust code to use Output_section::Simple_input_section
7668 and Input_secction_info classes. Register filler for relaxation
7669 clean up.
7670 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7671 and section index pair with Output_section::Simple_input_section
7672 class. Adjust code accordingly.
7673 (Phdrs_element::release_segment): New method definition.
7674 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7675 segment list.
7676 (Script_sections::release_segments): New method definition.
7677 * gold/script-sections.h (Script_sections::release_segments): New
7678 method declaration.
7679 * gold/target.h (Target::may_relax, Target::relax,
7680 Target::do_may_relax, Target::do_relax): New method definitions.
7681
5e445df6
ILT
76822009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7683
7684 * arm.cc (has_signed_unsigned_overflow): New function.
7685 (Arm_relocate_functions::abs8): New function.
7686 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7687 (Target_arm::Scan::global): Likewise.
7688 (Target_arm::relocate::relocate): Likewise.
7689 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7690 Likewise.
7691
8c604651 76922009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
7693
7694 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7695 * testsuite/Makefile.in: Regenerate.
7696
1e9cc1c2
NC
76972009-09-11 Nick Clifton <nickc@redhat.com>
7698
7699 * po/gold.pot: Updated by the Translation project.
7700
6a89f575
CC
77012009-09-08 Cary Coutant <ccoutant@google.com>
7702
7703 * output.cc (Output_file::open): Add execute permission to empty file.
7704 * testsuite/Makefile.am (permission_test): New test.
7705 * testsuite/Makefile.in: Regenerate.
7706
fdcac5af
ILT
77072009-09-02 Ian Lance Taylor <iant@google.com>
7708
7709 * output.cc (Output_file::resize): Call map_no_anonymous rather
7710 than map.
7711
44453f85
ILT
77122009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7713
7714 * gold.cc: Include "incremental.h".
7715 (queue_initial_tasks): Call Incremental_checker methods.
7716 * incremental.cc: Include "output.h".
7717 (Incremental_checker::can_incrementally_link_output_file): New
7718 method.
7719 * incremental.h (Incremental_checker): New class.
7720
7721 * output.cc (Output_file::open_for_modification): New method.
7722 (Output_file::map_anonymous): Changed return type to bool. Record
7723 map in base_ field.
7724 (Output_file::map_no_anonymous): New method, broken out of map.
7725 (Output_file::map): Use map_no_anonymous and map_anonymous.
7726 * output.h (class Output_file): Update declarations.
7727
293c1386
CC
77282009-08-24 Cary Coutant <ccoutant@google.com>
7729
7730 * options.h (Command_line::Pre_options): New class.
7731 (Command_line::pre_options): New member.
7732 * options.cc (gold::options::ready_to_register): New variable.
7733 (One_option::register_option): Do nothing if not registering options.
7734 Assert if same short option registered twice.
7735 (General_options::General_options): Turn off option registration when
7736 done constructing.
7737 (Command_line::Pre_options::Pre_options): New constructor.
7738
f773f3d2
CC
77392009-08-24 Cary Coutant <ccoutant@google.com>
7740
06a73cfe
CC
7741 * options.h (General_options::no_keep_memory): Remove incorrect
7742 short option.
f773f3d2 7743
a15af8e2
RW
77442009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7745
7746 * Makefile.am (am__skiplex, am__skipyacc): New.
7747 * Makefile.in: Regenerate.
7748
c462b41b
RW
77492009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7750
14ec8efd
RW
7751 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7752 (INCLUDES): ... this.
7753 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7754 (AM_CPPFLAGS): Renamed from ...
7755 (INCLUDE): ... this.
7756 * Makefile.in, testsuite/Makefile.in: Regenerate.
7757
81ecdfbb
RW
7758 * Makefile.in: Regenerate.
7759 * aclocal.m4: Likewise.
7760 * config.in: Likewise.
7761 * configure: Likewise.
7762 * testsuite/Makefile.in: Likewise.
7763
c462b41b
RW
7764 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7765 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7766 * Makefile.in: Regenerate.
7767 * testsuite/Makefile.in: Regenerate.
7768
2da73f13
CC
77692009-08-19 Cary Coutant <ccoutant@google.com>
7770
7771 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7772 symbols in shared libraries overridden by hidden or internal symbols
7773 in the main program.
7774
2db70501
CD
77752009-08-19 Chris Demetriou <cgd@google.com>
7776
7777 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7778 checking source file names in error messages.
7779
f733487b
DK
77802009-08-18 Doug Kwan <dougkwan@google.com>
7781
7782 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7783 an elcpp::Ehdr as parameter. Adjust call to set_target.
7784 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7785 an elfcpp::Ehdr as parameter.
7786 * object.cc (Object::set_target): Remove the version that looks up
7787 a target and sets it.
7788 (Sized_relobj::setup): Take a Target object instead of
7789 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7790 (make_elf_sized_object): Find target and ask target to
7791 make an ELF object.
7792 * object.h: (Object::set_target): Remove the version that looks up
7793 a target and sets it.
7794 (Sized_relobj::setup): Take a Target object instead of
7795 an elfcpp:Ehdr as parameter.
7796 * target.cc: Include dynobj.h.
7797 (Target::do_make_elf_object_implementation): New.
7798 (Target::do_make_elf_object): New.
7799 * target.h (Target::make_elf_object): New template declaration.
7800 (Target::do_make_elf_object): New method declarations.
7801 (Target::do_make_elf_object_implementation): New template declaration.
7802
cc70f101
ILT
78032009-08-14 Ian Lance Taylor <iant@google.com>
7804
7805 * gold.h (FUNCTION_NAME): Define.
7806 (gold_unreachable): Use FUNCTION_NAME.
7807
ef5e0cb1
ST
78082009-08-12 Sriraman Tallam <tmsriram@google.com>
7809
7810 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7811 symbol in the --keep-unique list is not found.
7812
48c187ce
ST
78132009-08-12 Sriraman Tallam <tmsriram@google.com>
7814
7815 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7816 been maked as --keep-unique.
7817 (Icf::unfold_section): New function.
7818 * icf.h (Icf::unfold_section): New function.
7819 * options.h (General_options::keep_unique): New option.
7820 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7821 * testsuite/Makefile.in: Regenerate.
7822 * testsuite/icf_keep_unique_test.sh: New file.
7823 * testsuite/icf_keep_unique_test.cc: New file.
7824
645afe0c
CC
78252009-08-12 Cary Coutant <ccoutant@google.com>
7826
7827 PR 10471
7828 * resolve.cc (Symbol_table::resolve): Check for references from
7829 dynamic objects to hidden and internal symbols.
7830 * testsuite/Makefile.am (hidden_test.sh): New test.
7831 * testsuite/Makefile.in: Regenerate.
7832 * testsuite/hidden_test.sh: New script.
7833 * testsuite/hidden_test_1.c: New test source.
7834 * testsuite/hidden_test_main.c: New test source.
7835
11af873f
DK
78362009-08-11 Doug Kwan <dougkwan@google.com>
7837
7838 * arm.cc: Update comments.
7839 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7840 segment to locate the .ARM.exidx section if present.
7841
b9f7d72d
DK
78422009-08-09 Doug Kwan <dougkwan@google.com>
7843
7844 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7845 patch.
7846
ddd3c53c
ST
78472009-08-07 Sriraman Tallam <tmsriram@google.com>
7848 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7849 compiler warnings.
7850
27721062
ST
78512009-08-06 Sriraman Tallam <tmsriram@google.com>
7852
7853 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7854 valid tls_segment only for non-debug-section relocations.
7855 * testsuite/Makefile.am: Add gc_tls_test.
7856 * testsuite/Makefile.in: Regenerate.
7857 * testsuite/gc_tls_test.cc: New file.
7858 * testsuite/gc_tls_test.sh: New file.
7859
ef15dade 78602009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 7861
ef15dade
ST
7862 * icf.cc: New file.
7863 * icf.h: New file.
7864 * Makefile.am (CCFILES): Add icf.cc.
7865 (HFILES): Add icf.h
7866 * Makefile.in: Regenerate.
7867 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7868 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7869 section, symbol and addend information for the relocs.
7870 * gold.cc (queue_middle_tasks): Call identical code folding.
7871 * gold.h: Add defines for multimap.
7872 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7873 to the call of finalize_local_symbols.
7874 * main.cc (main): Create object of class Icf.
7875 * object.cc (Sized_relobj::do_layout): Allow this function to be
7876 called twice during icf.
7877 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7878 to sections marked as identical by icf.
7879 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7880 when available.
7881 (Sized_relobj::do_section_entsize): New function.
7882 * object.h (Object::section_entsize): New function.
7883 (Object::do_section_entsize): New pure virtual function.
7884 (Relobj::finalize_local_symbols): Add new parameter.
7885 (Relobj::do_section_entsize): New function.
7886 * options.h (General_options::icf): New option.
7887 (General_options::icf_iterations): New option.
7888 (General_options::print_icf_sections): New option.
7889 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7890 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7891 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7892 icf.
7893 * symtab.cc (Symbol_table::is_section_folded): New function.
7894 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7895 to sections marked as identical by icf.
7896 * symtab.h (Symbol_table::set_icf): New function.
7897 (Symbol_table::icf): New function.
7898 (Symbol_table::is_section_folded): New function.
7899 (Symbol_table::icf_): New data member.
7900 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7901 * testsuite/Makefile.am: Add commands to build icf_test.
7902 * testsuite/Makefile.in: Regenerate.
7903 * testsuite/icf_test.sh: New file.
7904 * testsuite/icf_test.cc: New file.
7905
c3b65ac4
CD
79062009-07-24 Chris Demetriou <cgd@google.com>
7907
7908 * layout.cc (is_compressible_debug_section): Fix incorrect
7909 comment about compressed section names.
7910
1caf2c51
ILT
79112009-07-20 Ian Lance Taylor <ian@airs.com>
7912
7913 PR 10419
7914 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7915
1ef4d87f
ILT
79162009-07-16 Ian Lance Taylor <iant@google.com>
7917
7918 PR 10400
7919 * layout.h: #include <map>.
7920 (class Kept_section): Change from struct to class. Add accessors
7921 and setters. Add section size to Comdat_group mapping. Change
7922 Comdat_group to std::map. Add is_comdat_ field. Add
7923 linkonce_size field in union.
7924 (class Layout): Update declaration of find_or_add_kept_section.
7925 Don't declare find_kept_object.
7926 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7927 parameter. Add object, shndx, is_comdat, and is_group_name
7928 parameters. Change all callers. Adjust for new Kept_section.
7929 (Layout::find_kept_object): Remove.
7930 * object.cc (Sized_relobj::include_section_group): Update use of
7931 Kept_section. Rename secnum to shndx. Only record
7932 Kept_comdat_section if sections are the same size.
7933 (Sized_relobj::include_linkonce_section): Update use of
7934 Kept_section. Only record Kept_comdat_section if sections are the
7935 same size. Set size of linkonce section.
7936 (Sized_relobj::map_to_kept_section): Update call to
7937 get_kept_comdat_section.
7938 * object.h (class Sized_relobj): Rename fields in
7939 Kept_comdat_section to drop trailing underscores; change object
7940 field to Relobj*. Change Kept_comdat_section_table to store
7941 struct rather than pointer.
7942 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7943 Add kept_object and kept_shndx parameters. Change all callers.
7944 (Sized_relobj::get_kept_comdat_section): Change return type to
7945 bool. Add kept_object and kept_shndx parameters. Change all
7946 callers.
7947 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7948 Layout::find_or_add_kept_section.
7949
37c3b7b0
ILT
79502009-07-09 Ian Lance Taylor <iant@google.com>
7951
7952 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7953 Reserve space in the hash table.
7954
98fa85cb
ILT
79552009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7956
7957 * fileread.cc (File_read::get_mtime): New method.
7958 * fileread.h (Timespec): New structure.
7959 (File_read::get_mtime): New method.
7960 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7961 Renamed from timestamp_nsec.
7962 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7963 Elf_Xword.
e1df38aa 7964 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 7965 timestamp_nsec.
e1df38aa 7966 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
7967 (Incremental_inputs::report_obejct): Save mtime; style fix.
7968 (Incremental_inputs::report_script): Save mtime; style fix.
7969 (Incremental_inputs::finalize_inputs): Style fix.
7970 (Incremental_inputs::finalize): Style fix.
7971 (Incremental_inputs::create_input_section_data): Store inputs
7972 mtime.
7973 * incremental.h (Incremental_inputs::report_script): Add mtime
7974 argument.
7975 (Incremental_inputs::Input_info::Input_info): Intialize only one
7976 union member.
7977 (Incremental_inputs::Input_info::archive): Move to nameless
7978 union.
7979 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7980 (Incremental_inputs::Input_info::script): Move to nameless union.
7981 (Incremental_inputs::mtime): New field.
7982 * script.cc (read_input_script): Pass file mtime to
7983 Incremental_input.
7984 * script.h (Script_info::inputs): Style fix.
7985
c9d70757
ILT
79862009-07-01 Ian Lance Taylor <ian@airs.com>
7987
7988 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7989 instead of 32.
7990
9c547ec3
ILT
79912009-06-24 Ian Lance Taylor <iant@google.com>
7992
7993 PR 10156
7994 * layout.cc (Layout::choose_output_section): If we find an
7995 existing section, update the flags.
7996 (Layout::create_notes): New function, broken out of
7997 Layout::finalize.
7998 (Layout::finalize): Don't create note sections.
7999 (Layout::create_note): Don't crash if linker script discards
8000 section.
8001 (Layout::create_gold_note): Likewise.
8002 (Layout::create_build_id): Likewise. Don't set
8003 after_input_sections on the section.
8004 (Layout::create_executable_stack_info): Remove target parameter.
8005 Change caller.
8006 * layout.h (class Layout): Declare create_notes. Update
8007 declaration of create_executable_stack_info.
8008 * gold.cc (queue_middle_tasks): Call create_notes.
8009 * output.cc (Output_section::update_flags_for_input_section): Move
8010 here from output.h. If SHF_ALLOC flag is newly set, mark address
8011 invalid.
8012 * output.h (Output_data::mark_address_invalid): New function.
8013 (class Output_section): Only declare, not define,
8014 update_flags_for_input_section. Remove set_flags.
8015
55458500
ILT
80162009-06-24 Ian Lance Taylor <iant@google.com>
8017
8018 * script-sections.cc (Output_section_definition::
8019 set_section_addresses): Rename shadowing local load_address to
8020 laddr.
8021
1307d6cd
ILT
80222009-06-24 Ian Lance Taylor <iant@google.com>
8023
8024 PR 10244
8025 * reloc.cc (relocate_sections): Skip empty relocation sections.
8026
ec3f783e
ILT
80272009-06-23 Ian Lance Taylor <iant@google.com>
8028
8029 PR 10156
8030 * layout.cc (Layout::create_note): Use choose_output_section
8031 rather than make_output_section.
8032
459c9f1c
ILT
80332009-06-23 Ian Lance Taylor <iant@google.com>
8034
8035 PR 10237
8036 * options.cc (General_options::parse_V): Set printed_version_.
8037 (General_options::General_options): Initialize printed_version_.
8038 * options.h (class General_options): Add printed_version_ field.
8039 * gold.cc (queue_initial_tasks): If there are no input files,
8040 don't give a fatal error if we printed the version information.
8041 (queue_middle_tasks): If using -r with a shared object, give a
8042 fatal error rather than an ordinary error.
8043
1518dc8f
ILT
80442009-06-23 Ian Lance Taylor <iant@google.com>
8045
8046 PR 10219
8047 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
8048 (Layout::make_output_section): Set have_stabstr_section_ if we see
8049 a .stab*str section.
8050 (Layout::finalize): Call link_stabs_sections.
8051 (Layout::link_stabs_sections): New file.
8052 * layout.h (class Layout): Add have_stabstr_section_ field.
8053 Declare link_stabs_sections.
8054
3d857b98
DK
80552009-06-23 Doug Kwan <dougkwan@google.com>
8056
8057 * Makefile.am (libgold_a_LIBADD): New.
8058 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
8059 * Makefile.in: Regenerate.
8060 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
8061 * configure: Regenerate.
8062 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
8063 * fileread.cc: Include sys/state.h
8064 * gold.h: Declare memmem and strndup if found missing.
8065 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
8066
0639a6f6
ILT
80672009-06-23 Ian Lance Taylor <iant@google.com>
8068
8069 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
8070 * configure: Rebuild.
8071
8d63875c
ILT
80722009-06-23 Ian Lance Taylor <iant@google.com>
8073
8074 PR 10147
8075 * object.cc (Object::section_contents): Don't try to get a view if
8076 the section has length zero.
8077 (Object::handle_gnu_warning_section): If the section is empty, use
8078 the name of the section as the warning.
8079
f7c8a183
ILT
80802009-06-23 Ian Lance Taylor <iant@google.com>
8081
8082 PR 10133
8083 * stringpool.h (class Stringpool_template): Add optimize_ field.
8084 (Stringpool_template::set_optimize): New function.
8085 * stringpool.cc (Stringpool_template::Stringpool_template):
8086 Initialize optimize_ field.
8087 (Stringpool_template::set_string_offsets): Test local optimize
8088 fild rather than parameter.
8089 * layout.cc (Layout::Layout): Call set_optimize on the section
8090 name stringpool.
8091
e6a307ba
ILT
80922009-06-22 Ian Lance Taylor <iant@google.com>
8093
8094 PR 10030
8095 * yyscript.y: Parse TARGET.
8096 * script.cc (script_set_target): New function.
8097 * script-c.h (script_set_target): Declare.
8098 * options.cc (General_options::string_to_object_format): Rename
8099 from string_to_object_format in anonymous namespace. Change
8100 callers.
8101 * options.h (class General_options): Declare
8102 string_to_object_format.
8103
3ee173de
ILT
81042009-06-22 Ian Lance Taylor <iant@google.com>
8105
8106 * script-sections.cc (Script_sections::create_segments): Don't put
8107 program headers in a PT_LOAD segment if -n or -N.
8108
81092009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
8110
8111 PR 10141
8112 * options.h (class General_options): Add -z lazy and -z now. Sort
8113 -z options into alphabetical order.
8114 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8115
cd6739a1 81162009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
8117
8118 * layout.cc (Layout::make_output_section): Call
8119 Target::new_output_section.
8120 (Layout::attach_allocated_section_to_segment): Put large section
8121 sections in a separate load segment with the large segment flag
8122 set.
8123 (Layout::segment_precedes): Sort large data segments after other
8124 load segments.
8125 (align_file_offset): New static function.
8126 (Layout::set_segment_offsets): Use align_file_offset.
8127 * output.h (class Output_section): Add is_small_section_ and
8128 is_large_section_ fields.
8129 (Output_section::is_small_section): New function.
8130 (Output_section::set_is_small_section): New function.
8131 (Output_section::is_large_section): New function.
8132 (Output_section::set_is_large_section): New function.
8133 (Output_section::is_large_data_section): New function.
8134 (class Output_segment): Add is_large_data_segment_ field.
8135 (Output_segment::is_large_data_segment): New function.
8136 (Output_segment::set_is_large_data_segment): New function.
8137 * output.cc (Output_section::Output_section): Initialize new
8138 fields.
8139 (Output_segment::Output_segment): Likewise.
8140 (Output_segment::add_output_section): Add assertion that large
8141 data sections always go in large data segments. Force small data
8142 sections to the end of the list of data sections. Force small BSS
8143 sections to the start of the list of BSS sections. For large BSS
8144 sections to the end of the list of BSS sections.
8145 * symtab.h (class Symbol): Declare is_common_shndx.
8146 (Symbol::is_defined): Check Symbol::is_common_shndx.
8147 (Symbol::is_common): Likewise.
8148 (class Symbol_table): Define enum Commons_section_type. Update
8149 declarations. Add small_commons_ and large_commons_ fields.
8150 * symtab.cc (Symbol::is_common_shndx): New function.
8151 (Symbol_table::Symbol_table): Initialize new fields.
8152 (Symbol_table::add_from_object): Put small and large common
8153 symbols in the right list.
8154 (Symbol_table::sized_finalized_symbol): Check
8155 Symbol::is_common_shndx.
8156 (Symbol_table::sized_write_globals): Likewise.
8157 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8158 common symbol lists. Don't call do_allocate_commons_list if the
8159 list is empty.
8160 (Symbol_table::do_allocate_commons_list): Remove is_tls
8161 parameter. Add comons_section_type parameter. Change all
8162 callers. Handle small and large common symbols.
8163 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8164 Symbol::is_common_shndx.
8165 * resolve.cc (symbol_to_bits): Likewise.
8166 * target.h (Target::small_common_shndx): New function.
8167 (Target::small_common_section_flags): New function.
8168 (Target::large_common_shndx): New function.
8169 (Target::large_common_section_flags): New function.
8170 (Target::new_output_section): New function.
8171 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8172 small_common_section_flags, and large_common_section_flags
8173 fields.
8174 (Target::do_new_output_section): New virtual function.
8175 * arm.cc (Target_arm::arm_info): Initialize new fields.
8176 * i386.cc (Target_i386::i386_info): Likewise.
8177 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8178 Likewise.
8179 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8180 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8181 (Target_x86_64::do_new_output_section): New function.
8182 * configure.ac: Define conditional MCMODEL_MEDIUM.
8183 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8184 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8185 (large_LDFLAGS): Define.
8186 * testsuite/large.c: New file.
8187 * testsuite/testfile.cc (Target_test::test_target_info):
8188 Initialize new fields.
8189 * configure, testsuite/Makefile.in: Rebuild.
8190
bb04269c
DK
81912009-06-05 Doug Kwan <dougkwan@google.com>
8192
8193 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 8194 * Makefile.in: Regenerate.
bb04269c
DK
8195 * i386.cc (class Target_i386): Define new virtual method to
8196 override do_is_local_label_name in parent.
8197 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8198 local symbols if --discard-locals or -X is given.
8199 * options.h (class General_options): Declare new options
8200 '--discard-locals' and '-X' for discarding locals.
8201 * target.h (class Target): Define new methods is_local_label_name.
8202 Declare new virtual method do_is_local_label_name.
8203 * target.cc: New file.
8204 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8205 (check_SCRIPTS): Add discard_locals_test.sh.
8206 (check_DATA): Add discard_local_tests.syms.
8207 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8208 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8209 * testsuite/Makefile.in: Regenerate.
8210 * testsuite/discard_locals_test.c: New file.
8211 * testsuite/discard_locals_test.sh: Same.
8212
805bb01c
DK
82132009-06-05 Doug Kwan <dougkwan@google.com>
8214
8215 * object.cc (Sized_relobj::Sized_relobj): Initialize
8216 discarded_eh_frame_shndx_ to -1U.
8217 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8218 section.
8219 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8220 a discarded .eh_frame section.
8221 (Sized_relobj::do_finalize_local_symbols): Ditto.
8222 * object.h (class Sized_relobj): Declare new member
8223 discarded_eh_frame_shndx_.
8224 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8225 (local_labels_test.o, local_labels_test): New rules.
8226 * testsuite/Makefile.in: Regenerate.
8227
1dcd334d
DK
82282009-06-04 Doug Kwan <dougkwan@google.com>
8229
8230 * layout.cc (Layout::section_name_mapping): Add mapping for
8231 special ARM sections.
8232
96d49306
DK
82332009-06-03 Doug Kwan <dougkwan@google.com>
8234
8235 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8236 (utils::has_overflow): Same.
8237
dff16297
ILT
82382009-06-03 Ian Lance Taylor <iant@google.com>
8239
8240 * layout.cc (Layout::section_name_mapping): New array, replacing
8241 Layout::linkonce_mapping.
8242 (Layout::section_name_mapping_count): New variable, replacing
8243 Layout::linkonce_mapping_count.
8244 (Layout::linkonce_output_name): Remove.
8245 (Layout::output_section_name): Rewrite.
8246 * layout.h (class Layout): Rename Linkonce_mapping to
8247 Section_name_mapping, linkonce_mapping to section_name_mapping,
8248 linkonce_mapping_count to section_name_mapping_count. Don't
8249 declare linkonce_output_name.
8250
c121c671
DK
82512009-06-03 Doug Kwan <dougkwan@google.com>
8252
8253 * gold/arm.cc (namespace utils): New.
8254 (Target_arm::reloc_is_non_pic): Define new method.
8255 (class Arm_relocate_functions): New.
8256 (Target_arm::Relocate::relocate): Handle relocation types used by
8257 Android.
8258
07800fab
ILT
82592009-06-03 Ian Lance Taylor <iant@google.com>
8260
8261 * arm.cc (Target_arm::scan::global): Use || instead of |.
8262
c121c671
DK
82632009-06-02 Doug Kwan <dougkwan@google.com>
8264
8265 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8266 issued_non_pic_error_.
8267 (class Target_arm::Scan): Declare new method check_non_pic.
8268 Define new method symbol_needs_plt_entry.
8269 Declare new data member issued_non_pic_error_.
8270 (class Target_arm::Relocate): Declare new method
8271 should_apply_static_reloc.
8272 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8273 (Target_arm::Scan::check_non_pic): Define new method.
8274 (Target_arm::Scan::local): Handle a small subset of reloc types used
8275 by Android.
8276 (Target_arm::Scan::local): Same.
8277 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8278
b19b0c6d
ILT
82792009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8280
8281 * incremental.cc (Incremental_inputs::report_command_line): Filter
8282 out --incremental-* options.
8283
94cdfcff
DK
82842009-05-29 Doug Kwan <dougkwan@google.com>
8285
8286 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8287 template class.
8288 (class Target_arm): Update comment.
8289 (Target_arm::Target_arm): Initialize new data members GOT_,
8290 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8291 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8292 and Target_arm::rel_dyn_section.
8293 Declare new_enum Target_arm::Got_type.
8294 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8295 and DYNBSS_.
8296 Update commments for member do_dynsym_value.
8297 (Target_arm::got_size, Target_arm::plt_section,
8298 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8299 new methods inside class defintion.
8300 (Target_arm::got_section): Define new method.
8301 (Target_arm::rel_dyn_section): Same.
8302 (Output_data_plt_arm): New template class.
8303 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8304 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8305 (Output_data_plt_arm::add_entry): Same.
8306 (Output_data_plt_arm::first_plt_entry): Define new
8307 static data member for PLT instruction template.
8308 (Output_data_plt_arm::plt_entry): Same.
8309 (Output_data_plt_arm::do_write): Define new method.
8310 (Target_arm::make_plt_entry): Same.
8311 (Target_arm::do_finalize_sections): Same.
8312 (Target_arm::do_dynsym_value): Same.
8313
4a657b0d
DK
83142009-05-28 Doug Kwan <dougkwan@google.com>
8315
8316 * Makefile.am (TARGETSOURCES): Add arm.cc.
8317 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8318 * Makefile.in: Regenerate.
8319 * arm.cc: New file.
8320 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8321
e7ae8c36
DK
83222009-05-26 Doug Kwan <dougkwan@google.com>
8323
8324 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8325 (General_options::check_excluded_libs): Strip off directories in
8326 archive name before matching like GNU ld does.
8327 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8328 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8329 (exclude_libs_test_LDFLAGS): Add linker option
8330 -Wl,--exclude-libs,libexclude_libs_test_3
8331 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8332 an explicit archive without using -l.
8333 (alt/libexclude_libs_test_3.a): New make rule.
8334 * testsuite/Makefile.in: Regenerate.
8335 * testsuite/exclude_libs_test.c : Declare lib3_default().
8336 (main): Call it.
8337 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8338 * exclude_libs_test_3.c: New file.
8339
f12e7348
NC
83402009-05-26 Nick Clifton <nickc@redhat.com>
8341
8342 * po/id.po: New Indonesian translation.
8343 * po/gold.pot: Updated template file.
8344
4daadc0d
ST
83452009-05-22 Sriraman Tallam <tmsriram@google.com>
8346
e1df38aa 8347 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
8348 gc_comdat_test files. Add -Wl,--gc-sections to build
8349 gc_comdat_test.
8350 * testsuite/Makefile.in: Regenerate.
8351 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8352
531813ad
ST
83532009-05-21 Sriraman Tallam <tmsriram@google.com>
8354
8355 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8356 kept comdat section was garbage collected.
8357 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8358 * testsuite/Makefile.in: Regenerate.
8359 * testsuite/gc_comdat_test.sh: New file.
8360 * testsuite/gc_comdat_test_1.cc: New file.
8361 * testsuite/gc_comdat_test_2.cc: New file.
8362
65514900
CC
83632009-05-19 Doug Kwan <dougkwan@google.com>
8364
8365 * archive.cc (Archive::Archive): Move constructor from archive.h
8366 to here. Initialize no_export_.
8367 (Archive::get_elf_object_for_member): Set no_export flag of object.
8368 * archive.h (Archive::Archive): Move constructor body to
8369 archive.cc.
8370 (Archive::no_export): New method.
8371 (Archive::no_export_): New field.
8372 * object.h (Object::Object): Initialize no_export_ to false.
8373 (Object::no_export, Object::set_no_export): New methods.
8374 (Object::no_export_): New field.
8375 * options.cc (General_options::parse_exclude_libs): New method.
8376 (General_options::check_excluded_libs) Same.
8377 * options.h (exclude_libs): New option.
8378 (General_options::check_excluded_libs): New method declaration.
8379 (General_options::excluded_libs_): New field.
8380 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8381 default or protected visibility if an object has no-export flag set.
8382 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8383 (check_SCRIPTS): Add exclude_libs_test.sh.
8384 (check_DATA): Add exclude_libs_test.syms.
8385 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8386 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8387 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8388 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8389 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8390 libexclude_libs_test_2.a): New rules.
8391 * testsuite/Makefile.in: Regenerate.
8392 * testsuite/exclude_libs_test.c: New file.
8393 * testsuite/exclude_libs_test.sh: Ditto.
8394 * testsuite/exclude_libs_test_1.c: Ditto.
8395 * testsuite/exclude_libs_test_2.c: Ditto.
8396
1b77ea50
ILT
83972009-05-15 Ian Lance Taylor <iant@google.com>
8398
8399 * configure.ac: Check for declarations for cases where libiberty.h
8400 checks HAVE_DECL_xxx.
8401 * configure, config.in: Rebuild.
8402
072fe7ce
ILT
84032009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8404
8405 * gold.h (Incremental_argument_list): Remove (invalid) forward
8406 declaration.
8407 * incremental.cc (Incremental_inputs::report_achive): New method.
8408 (Incremental_inputs::report_object): New method.
8409 (Incremental_inputs::report_script): New method.
8410 (Incremental_inputs::finalize_inputs): New method.
8411 (Incremental_inputs::finalize): Call finalize_inputs().
8412 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8413 Create inputs entries.
8414 * incremental.h (Incremental_input_type): New enum.
8415 (Incremental_inputs::Incremental_input): Initialize new fields.
8416 (Incremental_inputs::report_inputs): New method.
8417 (Incremental_inputs::report_achive): New method.
8418 (Incremental_inputs::report_object): New method.
8419 (Incremental_inputs::report_script): New method.
8420 (Incremental_inputs::finalize_inputs): New method.
8421 (Incremental_inputs::Input_info): New struct.
8422 (Incremental_inputs::Input_info_map): New typedef.
8423 (Incremental_inputs::lock_): New field.
8424 (Incremental_inputs::Inputs_): New field.
8425 (Incremental_inputs::Inputs_map): New field.
8426 * main.cc (main): Call Incremental_input::report_inputs.
8427 * options.h (Input_argument_list): Typedef moved from
8428 Input_arguments.
8429 (Input_file_group::Files): Remove, use ::Input_argument_list.
8430 (Input_file_group::Input_argument_list): Remove, use
8431 ::Input_argument_list.
8432 * plugin.cc (Plugin_manager::add_input_file): Add error in
8433 incremental build.
8434 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8435 functions.
8436 * script.cc (read_input_script): Call
8437 Incremental_input::report_script.
8438 * script.h (Script_info): New class.
8439
b0481b0b
ILT
84402009-04-27 Ian Lance Taylor <iant@google.com>
8441
8442 * x86_64.cc (do_adjust_output_section): Set entsize to
8443 plt_entry_size.
8444
b22a5a41 84452009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
8446
8447 * output.cc (Output_file::close): After short writes, continue
8448 writing from the correct offset in the buffer being written.
8449
40fde488
CD
84502009-04-23 Chris Demetriou <cgd@google.com>
8451
8452 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8453 * configure: Regenerate.
8454 * config.in: Regenerate.
8455 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8456 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8457
3ce2c28e
ILT
84582009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8459
8460 * incremental.cc (Incremental_inputs_header_data): Renamed from
8461 Incremental_input_header_data.
8462 (Incremental_inputs_header_data::data_size): New field.
8463 (Incremental_inputs_header_data::put_input_file_count): Renamed
8464 from input_file_count.
8465 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8466 from command_line_offset.
8467 (Incremental_inputs_header_data::put_reserved): Renamed from
8468 put_reserved.
8469 (Incremental_inputs_entry_data): Renamed from
8470 Incremental_input_entry_data.
8471 (Incremental_inputs_entry_data::data_size): New field.
8472 (Incremental_inputs::report_command_line): New method.
8473 (Incremental_inputs::finalize): New method.
8474 (Incremental_inputs::create_incremental_inputs_data): New method.
8475 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8476 * incremental.h: New file.
8477 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8478 (Layout::finalize): Create incremental inputs section in
8479 incremental builds.
8480 (Layout::create_incremental_info_sections): New method.
8481 * layout.h (Layout::incremental_inputs): New method.
8482 (Layout::create_incremental_info_sections): New method.
8483 (Layout::incremental_inputs_): New field.
8484 * main.cc (main): Notify Incremental_input of the command line.
8485
e55bde5e
ILT
84862009-04-01 Ian Lance Taylor <iant@google.com>
8487 Mikolaj Zalewski <mikolajz@google.com>
8488
8489 * gold.h (reserve_unordered_map): Define, three versions, one for
8490 each version of Unordered_map.
8491 * layout.cc (Layout::Layout): Remove options parameter. Add
8492 number_of_input_files parameter. Don't initialize options_.
8493 Initialize number_of_input_files_ and resized_signatures_. Move
8494 sections_are_attached_.
8495 (Layout::layout_group): Reserve space for group_signatures_.
8496 (Layout::find_or_add_kept_section): Change name parameter to be a
8497 reference. Resize signatures_ map when it gets large enough.
8498 (Layout::layout_eh_frame): Use parameters->options() instead of
8499 this->options_.
8500 (Layout::make_output_section): Likewise.
8501 (Layout::attach_allocated_section_to_segment): Likewise.
8502 (Layout::finalize, Layout::create_executable_stack): Likewise.
8503 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8504 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8505 * layout.h (class Layout): Update declarations. Remove options_
8506 field. Add number_of_input_files_ and resized_signatures_
8507 fields. Move sections_are_attached_ field.
8508 * main.cc (main): Pass number of input files to Layout
8509 constructor. Don't pass options.
8510
154b857c
ILT
85112009-03-30 Ian Lance Taylor <iant@google.com>
8512
8513 * ffsll.c (ffsll): Correct implementation.
8514
2f35ab9b
ILT
85152009-03-27 Ian Lance Taylor <iant@google.com>
8516
fd03461a
ILT
8517 * ffsll.c: New file.
8518 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8519 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8520 * ftruncate.c (ftruncate): Declare before definition.
8521 * mremap.c (mremap): Likewise.
8522 * pread.c (pread): Likewise.
8523 * configure, Makefile.in, config.in: Rebuild.
8524
2f35ab9b
ILT
8525 * mremap.c: New file.
8526 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8527 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8528 (mremap): Declare if HAVE_MREMAP is not defined.
8529 * configure, Makefile.in, config.in: Rebuild.
8530
33aea2fd
CC
85312009-03-27 Cary Coutant <ccoutant@google.com>
8532
8533 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8534 position independent.
8535 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8536 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8537
6d479619
CC
85382009-03-24 Cary Coutant <ccoutant@google.com>
8539
8540 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8541 an executable.
8542 (needs_dynamic_reloc): Likewise.
8543
afc06bb8
ILT
85442009-03-24 Ian Lance Taylor <iant@google.com>
8545
8546 * yyscript.y (file_cmd): Recognize EXTERN.
8547 (extern_name_list, extern_name_list_body): New nonterminals.
8548 * script.cc (script_add_extern): Define.
8549 * script-c.h (script_add_extern): Declare.
8550
f6060a4d
ILT
85512009-03-24 Rafael Avila de Espindola <espindola@google.com>
8552
8553 * object.cc (is_elf_object): Define.
8554 * object.h (is_elf_object): Declare.
8555 * archive.cc (Archive::get_elf_object_for_member): Call
8556 is_elf_object.
33aea2fd 8557 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 8558
26736d8e
ILT
85592009-03-24 Elliott Hughes <enh@google.com>
8560
8561 * output.cc (Output_file::map_anonymous): Define.
8562 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8563 try an anonymous one. Report the size if the mmap fails.
8564 * output.h (class Output_file): Declare map_anonymous.
8565
22fd9730
ILT
85662009-03-24 Ian Lance Taylor <iant@google.com>
8567
8568 * target-select.cc (instantiate_target): Don't acquire the lock if
8569 the instantiated_target_ field has already been set.
8570
cb010894
ILT
85712009-03-23 Ian Lance Taylor <iant@google.com>
8572
7f055c20
ILT
8573 * gold-threads.h (class Initialize_lock): Define.
8574 * gold-threads.cc (class Initialize_lock_once): Define.
8575 (initialize_lock_control): New static variable.
8576 (initialize_lock_pointer): New static variable.
8577 (initialize_lock_once): New static function.
8578 (Initialize_lock::Initialize_lock): Define.
8579 (Initialize_lock::initialize): Define.
8580 * target-select.h: Include "gold-threads.h".
8581 (class Target_selector): Add lock_ and initialize_lock_ fields.
8582 Don't define instantiate_target, just declare it.
8583 * target-select.cc (Target_selector::Target_selector): Initialize
8584 new fields.
8585 (Target_selector::instantiate_target): Define.
8586 * descriptors.h: Include "gold-threads.h".
8587 (class Descriptors): Add initialize_lock_ field.
8588 * descriptors.cc (Descriptors::Descriptors): Initialize new
8589 field.
8590 (Descriptors::open): Use initialize_lock_ field
8591 * errors.h (class Errors): Add initialize_lock_ field.
8592 * errors.cc (Errors::Errors): Initialize new field.
8593 (Errors::initialize_lock): Use initialize_lock_ field.
8594 * powerpc.cc (class Target_selector_powerpc): Remove
8595 instantiated_target_ field. In do_recognize call
8596 instantiate_target rather than do_instantiate_target. In
8597 do_instantiate_target just allocate a new target.
8598 * sparc.cc (class Target_selector_sparc): Likewise.
8599
36959681
ILT
8600 * freebsd.h: New file.
8601 * i386.cc: Include "freebsd.h".
8602 (Target_i386): Derive from Target_freebsd rather than
8603 Sized_target.
8604 (Target_selector_i386): Derive from Target_selector_freebsd rather
8605 than Target_selector.
8606 * x86_64.cc: Include "freebsd.h".
8607 (Target_x86_64): Derive from Target_freebsd rather than
8608 Sized_target.
8609 (Target_selector_x86_64): Derive from Target_selector_freebsd
8610 rather than Target_selector.
8611 * target.h (class Target): Add adjust_elf_header and
8612 do_adjust_elf_header.
8613 * output.cc (Output_file_header:: do_sized_write): Call target
8614 adjust_elf_header routine.
8615 * configure.tgt: Set targ_osabi.
8616 * configure.ac: Define GOLD_DEFAULT_OSABI.
8617 * parameters.cc (Parameters::default_target): Pass
8618 GOLD_DEFAULT_OSABI to select_target.
8619 * target-select.h (class Target_selector): Make instantiate_target
8620 protected rather than private.
8621 * Makefile.am (HFILES): Add freebsd.h.
8622 * configure, Makefile.in, config.in: Rebuild.
8623
cb010894
ILT
8624 * merge.cc (do_add_input_section): Correct pend value. Change
8625 message about last entry not being null terminated from error to
8626 warning.
8627
0e879927
ILT
86282009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8629
8630 * incremental.cc: New file.
8631 * Makefile.am (CCFILES): Add incremental.cc.
8632 * Makefile.in: Rebuild.
8633
41105937
PP
86342009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8635
8636 * layout.cc (Layout::output_section_name): Preserve names
8637 of '.note.' sections.
e1df38aa 8638
60439920
ILT
86392009-03-19 Ian Lance Taylor <iant@google.com>
8640
8641 * descriptors.cc (Descriptors::open): Check that the options are
8642 valid before using them.
8643
0d371ad3
ILT
86442009-03-18 Ian Lance Taylor <iant@google.com>
8645
8646 * script-sections.h: Include <list>.
8647 (class Script_sections): Change Sections_elements from std::vector
8648 to std::list. Typedef public Elements_iterator. Add
8649 orphan_section_placement_, data_segment_align_start_, and
8650 saw_data_segment_align_ fields. Remove data_segment_align_index_
8651 field.
8652 * script-sections.cc (class Orphan_section_placement): New class.
8653 (class Sections_element): Add virtual functions is_relro and
8654 orphan_section_init. Remove virtual function place_orphan_here.
8655 (class Output_section_definition): Add is_relro and
8656 orphan_section_init. Remove place_orphan_here.
8657 (class Orphan_output_section): Likewise.
8658 (Script_sections::Script_sections): Update for field changes.
8659 (Script_sections::data_segment_align): Set saw_data_segment_align_
8660 and data_segment_align_start_, not data_segment_align_index.
8661 (Script_sections::data_segment_relro_end): Check
8662 saw_data_segment_align_. Use data_segment_align_start_ rather
8663 than data_segment_align_index_.
8664 (Script_sections::place_orphan): Rewrite to use
8665 Orphan_section_placement.
8666
9201d894
ILT
86672009-03-17 Ian Lance Taylor <iant@google.com>
8668
9c5b8369
ILT
8669 * archive.cc (Archive::add_symbols): Check for a version attached
8670 to the symbol name in the archive map.
8671 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8672 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8673 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8674 (ver_test_11.a): New target.
8675 * testsuite/Makefile.in: Rebuild.
8676
9201d894
ILT
8677 * configure.ac: Check for chsize and posix_fallocate. Replace
8678 ftruncate.
8679 * ftruncate.c: New file, from gnulib.
8680 * output.cc (posix_fallocate): Define dummy version if not
8681 HAVE_POSIX_FALLOCATE.
8682 (Output_file::map): Call posix_fallocate rather than lseek and
8683 write.
8684 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8685 * configure, Makefile.in, config.in: Rebuild.
8686
ef4ab7a8 86872009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 8688
ef4ab7a8
PP
8689 * layout.h (Layout::create_note): Add section_name parameter.
8690 * layout.cc (Layout::create_note): Likewise.
8691 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 8692
8c500701
ILT
86932009-03-17 Ian Lance Taylor <iant@google.com>
8694
e85b18e1
ILT
8695 * descriptors.cc: Include "options.h".
8696 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8697 (Descriptors::open): Always use O_CLOEXEC when opening a new
8698 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8699 then set FD_CLOEXEC.
8700
9efe6174
ILT
8701 * sparc.cc (class Target_sparc): Add has_got_section.
8702 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8703 make sure we have a GOT section.
8704
8705 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8706 (Target_sparc::Scan::local): Likewise.
8707 (Target_sparc::Scan::global): Likewise.
8708 (Target_sparc::Relocate::relocate): Likewise.
8709 (Target_sparc::Relocate::relocate_tls): Likewise.
8710
8c500701
ILT
8711 * symtab.cc (Symbol_table::define_default_version): New function,
8712 broken out of add_from_object.
8713 (Symbol_table::add_from_object): Call define_default_version.
8714 (Symbol_table::define_special_symbol): Add resolve_oldsym
8715 parameter. Change all callers. If the version for a symbol comes
8716 from a version script, resolve it with the symbol with the same
8717 name with no version. Also add the symbol without a version if
8718 appropriate.
8719 (do_define_in_output_data): If resolving with oldsym, don't delete
8720 sym.
8721 (do_define_in_output_segment): Likewise.
8722 (do_define_as_constant): Likewise.
8723 * symtab.h (class Symbol_table): Update declarations.
8724
f1ed28fb
ILT
87252009-03-13 Ian Lance Taylor <iant@google.com>
8726
15f8229b
ILT
8727 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8728 (Read_symbols::requeue): New function.
8729 (Read_symbols::do_read_symbols): If make_elf_object fails because
8730 the target type is not configured, and the file was searched for,
8731 issue a warning and retry with the next directory.
8732 (Add_symbols::run): If the file has an incompatible format, and
8733 it was searched for, requeue the Read_symbols task. On error,
8734 release the object.
8735 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8736 dirindex parameter to constructor. Change all callers. Declare
8737 incompatible_warning and requeue.
8738 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8739 input_argument_ and input_group_ fields. Add them to
8740 constructor. Change all callers.
8741 (class Read_script): Add dirindex_ field. Add it to constructor.
8742 Change all callers.
8743 * archive.cc (Archive::setup): Remove input_objects parameter.
8744 Change all callers.
8745 (Archive::get_file_and_offset): Likewise.
8746 (Archive::read_all_symbols): Likewise.
8747 (Archive::read_symbols): Likewise.
8748 (Archive::get_elf_object_for_member): Remove input_objects
8749 parameter. Add punconfigured parameter. Change all callers.
8750 (Archive::add_symbols): Change return type to bool. Check return
8751 value of include_member.
8752 (Archive::include_all_members): Likewise.
8753 (Archive::include_member): Change return type to bool. Return
8754 false if first included object has incompatible target. Set
8755 included_member_ field.
8756 (Add_archive_symbols::run): If add_symbols returns false, requeue
8757 Read_symbols task.
8758 * archive.h (class Archive): Add included_member_ field.
8759 Initialize it in constructor. Add input_file and searched_for
8760 methods. Update declarations.
8761 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8762 input_argument_ fields. Add them to constructor. Change all
8763 callers.
8764 * script.cc: Include "target-select.h".
8765 (class Parser_closure): Add skip_on_incompatible_target_ and
8766 found_incompatible_target_ fields. Add
8767 skip_on_incompatible_target parameter to constructor. Change all
8768 callers. Add methods skip_on_incompatible_target,
8769 clear_skip_on_incompatible_target, found_incompatible_target, and
8770 set_found_incompatible_target.
8771 (read_input_script): Add dirindex parameter. Change all callers.
8772 If parser finds an incompatible target, requeue Read_symbols
8773 task.
8774 (script_set_symbol): Clear skip_on_incompatible_target in
8775 closure.
8776 (script_add_assertion, script_parse_option): Likewise.
8777 (script_start_sections, script_add_phdr): Likewise.
8778 (script_check_output_format): New function.
8779 * script.h (read_input_script): Update declaration.
8780 * script-c.h (script_check_output_format): Declare.
8781 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8782 (ignore_cmd): Remove OUTPUT_FORMAT.
8783 * fileread.cc (Input_file::Input_file): Add explicit this.
8784 (Input_file::will_search_for): New function.
8785 (Input_file::open): Add pindex parameter. Change all callers.
8786 * fileread.h (class Input_file): Add input_file_argument method.
8787 Declare will_search_for. Update declarations.
8788 * object.cc (make_elf_object): Add punconfigured parameter.
8789 Change all callers.
8790 * object.h (class Object): Make input_file public. Add
8791 searched_for method.
8792 (make_elf_object): Update declaration.
8793 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8794 restart search.
8795 * dirsearch.h (class Dirsearch): Update declaration.
8796 * options.h (class General_options): Add --warn-search-mismatch.
8797 * parameters.cc (Parameters::is_compatible_target): New function.
8798 * parameters.h (class Parameters): Declare is_compatible_target.
8799 * workqueue.cc (Workqueue::add_blocker): New function.
8800 * workqueue.h (class Workqueue): Declare add_blocker.
8801
f1ed28fb
ILT
8802 * fileread.cc (Input_file::open): Remove options parameter.
8803 Change all callers.
8804 (Input_file::open_binary): Likewise.
8805 * script.cc (read_input_script): Likewise.
8806 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8807 options parameter from constructor. Change all callers.
8808 (class Read_script): Likewise.
8809 * fileread.h (class Input_file): Update declarations.
8810 * script.h (read_input_script): Update declaration.
8811
34dd024a
NC
88122009-03-10 Nick Clifton <nickc@redhat.com>
8813
8814 * po/es.po: New Spanish translation.
8815
6d71b17c
CC
88162009-03-06 Cary Coutant <ccoutant@google.com>
8817
8818 * options.cc (parse_short_option): Keep dash_z from registering itself.
8819
031cdbed
ILT
88202009-03-03 Ian Lance Taylor <iant@google.com>
8821
8822 PR 9918
8823 * target-reloc.h (relocate_section): Pass output_section to
8824 relocate.
8825 * i386.cc (Target_i386::should_apply_static_reloc): Add
8826 output_section parameter. Change all callers.
8827 (Target_i386::Relocate::relocate): Add output_section parameter.
8828 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8829 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8830 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8831 * testsuite/two_file_shared.sh: New script.
8832 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8833 (check_DATA): Add two_file_shared.dbg.
8834 (two_file_shared.dbg): New target.
8835 * testsuite/Makefile.in: Rebuild.
8836
15d5fa16
ILT
88372009-03-01 Ian Lance Taylor <iant@google.com>
8838
8839 * configure.ac: Check for byteswap.h.
8840 * configure: Rebuild.
8841 * config.in: Rebuild.
8842
8a4c0b0d
ILT
88432009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8844
8845 * layout.cc (Layout::find_or_add_kept_section): New function.
8846 (Layout::add_comdat): Removed.
8847 * layout.h (struct Kept_section): Move out of class Layout.
8848 Remove trailing underscores from field names. Add group_sections
8849 field. Rename group_ field to is_group. Change all uses.
8850 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8851 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8852 comdat_groups_ field.
8853 (Sized_relobj::include_section_group): Use
8854 find_or_add_kept_section and Kept_section::group_sections.
8855 (Sized_relobj::include_linkonce_section): Likewise.
8856 * object.cc (class Sized_relobj): Don't define Comdat_group or
8857 Comdat_group_table. Remove find_comdat_group and
8858 add_comdat_group. Remove comdat_groups_ field.
8859 * plugin.cc (include_comdat_group): Use
8860 Layout::find_or_add_kept_section.
8861
b4ecf66b
ILT
88622009-02-28 Ian Lance Taylor <iant@google.com>
8863
14359ca0
ILT
8864 * README: --gc-sections and map files are now supported. Document
8865 some build requirements.
8866
b4ecf66b
ILT
8867 PR 6992
8868 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8869 relocatable link set the value of the section symbol to zero.
8870 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8871 relocatable link don't include the section address in the local
8872 symbol value.
8873
0602e05a
ILT
88742009-02-27 Ian Lance Taylor <iant@google.com>
8875
fd9d194f
ILT
8876 PR 6811
8877 * options.h (class Search_directory): Add is_system_directory.
8878 (class General_options): Declare is_in_system_directory.
8879 * options.cc (get_relative_sysroot): Make static.
8880 (get_default_sysroot): Make static.
8881 (General_optoins::is_in_system_directory): New function.
8882 * fileread.cc (Input_file::is_in_system_directory): New function.
8883 * fileread.h (class Input_file): Declare is_in_system_directory.
8884 * object.h (class Object): Add is_in_system_directory.
8885 (class Input_objects): Remove system_library_directory_ field.
8886 * object.cc (Input_objects::add_object): Don't set
8887 system_library_directory_.
8888 (input_objects::found_in_system_library_directory): Remove.
8889 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8890 parameter. Change all callers.
8891 (Symbol_table::sized_write_globals): Likewise.
8892 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8893 Call Object::is_in_system_directory.
8894 * symtab.h (class Symbol_table): Update declarations.
8895
61edd21f
ILT
8896 PR 5990
8897 * descriptors.h (Open_descriptor): Add is_on_stack field.
8898 * descriptors.cc (Descriptors::open): If the descriptor is on the
8899 top of the stack, remove it. Initialize is_on_stack field.
8900 (Descriptors::release): Only add pod to stack if it is not on the
8901 stack already.
8902 (Descriptors::close_some_descriptor): Clear stack_next and
8903 is_on_stack fields.
8904
e29e076a
ILT
8905 PR 7091
8906 * output.cc (Output_section::find_starting_output_address): Rename
8907 from starting_output_address; add PADDR parameter; change return
8908 type.
8909 * output.h (class Output_section): Declare
8910 find_starting_output_address instead of starting_output_address.
8911 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8912 section symbol for which we can't find a merge section.
8913
0602e05a
ILT
8914 PR 9836
8915 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8916 hidden or internal, force the symbol to be local.
8917 * resolve.cc (Symbol::override_visibility): Define.
8918 (Symbol::override_base): Use override_visibility.
8919 (Symbol_table::resolve): Likewise.
8920 (Symbol::override_base_with_special): Likewise.
8921 (Symbol_table::override_with_special): If the visibility is hidden
8922 or internal, force the symbol to be local.
8923 * symtab.h (class Symbol): Add set_visibility and
8924 override_visibility.
8925 * testsuite/ver_test_1.sh: New file.
8926 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8927 (check_DATA): Add ver_test_1.syms.
8928 (ver_test_1.syms): New target.
8929 * testsuite/Makefile.in: Rebuild.
8930
401a9a73
CC
89312009-02-25 Cary Coutant <ccoutant@google.com>
8932
8933 * layout.cc (Layout::choose_output_section): Don't rename sections
8934 when using a linker script that has a SECTIONS clause.
8935 * Makefile.in: Regenerate.
8936
8937 * testsuite/Makefile.am (script_test_5.sh): New test case.
8938 * testsuite/Makefile.in: Regenerate.
8939 * testsuite/script_test_5.cc: New file.
8940 * testsuite/script_test_5.sh: New file.
8941 * testsuite/script_test_5.t: New file.
8942
f488e4b0
CC
89432009-02-13 Rafael Avila de Espindola <espindola@google.com>
8944
8945 * archive.cc (Archive::include_member): Update calls to add_symbols.
8946 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8947 the Layout argument.
8948 * dynobj.h (do_add_symbols): Add the Layout argument.
8949 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8950 Layout argument.
8951 * object.h (Object::add_symbols): Add the Layout argument.
8952 (Object::do_add_symbols): Add the Layout argument.
8953 (Sized_relobj::do_add_symbols): Add the Layout argument.
8954 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8955 Unify the two versions.
8956 (Add_plugin_symbols): Remove.
8957 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8958 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8959 (Add_plugin_symbols): Remove.
8960 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8961 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8962 (Add_symbols::run): Make it work with Pulginobj.
8963
89dd1680
ILT
89642009-02-06 Ian Lance Taylor <iant@google.com>
8965
8966 * object.cc (Sized_relobj::do_layout): Make info message start
8967 with lower case letter.
8968
266d0a74
ILT
89692009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8970
602b464e
ILT
8971 * binary.cc: Fix file comment.
8972
266d0a74
ILT
8973 * options.h (enum Incremental_disposition): Define.
8974 (class General_options): Add new options: --incremental,
8975 --incremental_changed, --incremental_unchanged,
8976 --incremental_unknown. Add incremental_disposition_ and
8977 implicit_incremental_ fields.
8978 (General_options::incremental_disposition): New function.
8979 (class Position_dependent_options): Add incremental_disposition
8980 option.
8981 (Position_dependent_options::copy_from_options): Set incremental
8982 dispositions.
8983 * options.cc (General_options::parse_incremental_changed): New
8984 function.
8985 (General_options::parse_incremental_unchanged): New function.
8986 (General_options::parse_incremental_unknown): New function.
8987 (General_options::General_options): Initialize new fields
8988 incremental_disposition_ and implicit_incremental_.
8989 (General_options::finalize): Check for uasge of --incremental-*
8990 without --incremental.
8991
f073bbf7
CD
89922009-02-06 Chris Demetriou <cgd@google.com>
8993
8994 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8995 pointer and to report location as the file name associated with
8996 the symbol.
8997 (gold_undefined_symbol_at_location): New function to replace the
8998 old gold_undefined_symbol functionality.
8999 * target-reloc.h (relocate_section): Update to use
9000 gold_undefined_symbol_at_location.
9001 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9002 Call gold_undefined_symbol function rather than gold_error.
9003 * errors.h (Errors::undefined_symbol): Take location as a
9004 string, rather than calculating it from a relocation.
9005 * errors.cc (Errors::fatal): Print "fatal error:" before the
9006 formatted message.
9007 (Errors::error, Errors::error_at_location): Print "error: "
9008 before the formatted message.
9009 (Errors::undefined_symbol): Take location as a string, rather
9010 than calculating it from a relocation.
9011 (gold_undefined_symbol_at_location): New function akin to
9012 old gold_undefined_symbol, calculates location from relocation.
9013 (gold_undefined_symbol): Change to take only a Symbol pointer
9014 and to report location as the file name associated with the symbol.
9015 * testsuite/debug_msg.sh: Update for changed error messages.
9016 * testsuite/undef_symbol.sh: Likewise.
9017
8e94a90c
ILT
90182009-02-04 Duncan Sands <baldrick@free.fr>
9019
9020 PR 9812
9021 * reduced_debug_output.h
9022 (Output_reduced_debug_abbrev_section::failed): Use format for
9023 gold_warning.
9024 (Output_reduced_debug_info_section::faild): Likewise.
9025
88a0e15b
ILT
90262009-01-31 Mikolaj Zalewski <mikolajz@google.com>
9027
9028 * script.cc (Lazy_demangler): New class.
9029 (Version_script_info::get_symbol_version_helper): Demangle a
9030 symbol only once.
9031
5efc7cd2
CC
90322009-01-29 Cary Coutant <ccoutant@google.com>
9033
9034 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
9035 to __tls_get_addr.
9036 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
9037
e0ebcf42
ILT
90382009-01-28 Ian Lance Taylor <iant@google.com>
9039
5efc7cd2 9040 * version.cc (version_string): Bump to 1.9.
75fe7426 9041
e0ebcf42
ILT
9042 * gold.h: Include <cstring> and <stdint.h>.
9043 * version.cc: Include <cstdio>.
9044 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
9045 warning.
9046 * reduced_debug_output.cc (insert_into_vector): Rename from
9047 Insert_into_vector; change all callers. Use Swap_unaligned to
9048 avoid aliasing issue; remove union since it is unnecessary.
9049
8e2813be 90502009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
9051
9052 * Makefile.am (CCFILES): Add gc.cc.
9053 (HFILES): Add gc.h.
9054 * Makefile.in: Regenerate.
9055 * gold.cc (Gc_runner): New class.
9056 (queue_initial_tasks): Call garbage collection related tasks
9057 when corresponding options are invoked.
9058 (queue_middle_gc_tasks): New function.
9059 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
9060 processed early before laying out sections during garbage collection.
9061 * gold.h (queue_middle_gc_tasks): New function.
9062 (is_prefix_of): Move from "layout.cc".
9063 * i386.cc (Target_i386::gc_process_relocs): New function.
9064 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
9065 * main.cc (main): Create object of class "Garbage_collection".
9066 * object.cc (Relobj::copy_symbols_data): New function.
9067 (Relobj::is_section_name_included): New function.
e1df38aa
NC
9068 (Sized_relobj::do_layout): Allow this function to be called twice
9069 during garbage collection and defer layout of section during the
6d03d481
ST
9070 first call.
9071 * object.h (Relobj::get_symbols_data): New function.
9072 (Relobj::is_section_name_included): New function.
9073 (Relobj::copy_symbols_data): New function.
9074 (Relobj::set_symbols_data): New function.
9075 (Relobj::get_relocs_data): New function.
9076 (Relobj::set_relocs_data): New function.
9077 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9078 (Relobj::gc_process_relocs): New function.
9079 (Relobj::do_gc_process_relocs): New pure virtual function.
9080 (Relobj::sd_): New data member.
9081 (Sized_relobj::is_output_section_offset_invalid): New function.
9082 (Sized_relobj::do_gc_process_relocs): New function.
9083 * options.h (General_options::gc_sections): Modify to not be a no-op.
9084 (General_options::print_gc_sections): New option.
9085 * plugin.cc (Plugin_finish::run): Remove function call to
9086 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9087 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9088 * reloc.cc (Read_relocs::run): Add task to process relocs and
9089 determine unreferenced sections when doing garbage collection.
9090 (Gc_process_relocs): New class.
9091 (Sized_relobj::do_gc_process_relocs): New function.
9092 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9093 sections that are garbage collected.
9094 * reloc.h (Gc_process_relocs): New class.
9095 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9096 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9097 symbols whose corresponding sections are garbage collected.
9098 (Symbol_table::Symbol_table): Add new parameter for the garbage
9099 collection object.
9100 (Symbol_table::gc_mark_undef_symbols): New function.
9101 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9102 (Symbol_table::gc_mark_dyn_syms): New function.
9103 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9104 as garbage.
9105 (Symbol_table::add_from_object): Likewise.
9106 (Symbol_table::add_from_relobj): When building shared objects, do not
9107 treat externally visible symbols as garbage.
9108 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9109 table information for static and relocatable links.
9110 * symtab.h (Symbol_table::set_gc): New function.
9111 (Symbol_table::gc): New function.
9112 (Symbol_table::gc_mark_undef_symbols): New function.
9113 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9114 (Symbol_table::gc_mark_dyn_syms): New function.
9115 (Symbol_table::gc_): New data member.
e1df38aa 9116 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
9117 function.
9118 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9119 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9120
3b293544
CF
91212009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9122
9123 * options.h (General_options::gc_sections): Define as a no-op for now.
9124 (General_options::no_keep_memory): Ditto.
9125 (General_options::Bshareable): Define.
9126 * options.cc (General_options::finalize): Honor -Bshareable.
9127
83d22aa8
AS
91282009-01-20 Andreas Schwab <schwab@suse.de>
9129
9130 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9131 read the value in the contents, since we don't use it. Use the
9132 template endianness when writing.
9133 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9134
cd536b21
AS
91352009-01-19 Andreas Schwab <schwab@suse.de>
9136
9137 * configure.tgt (powerpc64-*): Fix targ_obj.
9138
99e9a495
ILT
91392009-01-15 Ian Lance Taylor <iant@google.com>
9140
9141 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9142 local symbols when stripping all symbols.
9143
bbbfea06
CC
91442009-01-14 Cary Coutant <ccoutant@google.com>
9145
99e9a495 9146 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 9147
0f7c0701
CC
91482009-01-14 Cary Coutant <ccoutant@google.com>
9149
9150 * archive.cc (Archive::get_elf_object_for_member): Remove call
9151 to File_read::claim_for_plugin.
9152 * descriptors.cc (Descriptors::open): Remove reference to
9153 is_claimed.
9154 (Descriptors::claim_for_plugin): Remove.
9155 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9156 (Descriptors::is_claimed): Remove.
9157 (claim_descriptor_for_plugin): Remove.
9158 * fileread.cc (File_read::claim_for_plugin): Remove.
9159 * fileread.h (File_read::claim_for_plugin): Remove.
9160 (File_read::descriptor): Reopen descriptor if necessary.
9161 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9162 (Plugin_manager::all_symbols_read): Add task parameter. Change
9163 all callers.
9164 (Plugin_manager::get_input_file): New function.
9165 (Plugin_manager::release_input_file): New function.
9166 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9167 corresponding data member.
9168 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9169 and pass to base constructor. Change all callers.
9170 (get_input_file, release_input_file): New functions.
9171 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9172 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9173 (Plugin_manager::all_symbols_read): Add task parameter.
9174 (Plugin_manager::get_input_file): New function.
9175 (Plugin_manager::release_input_file): New function.
9176 (Plugin_manager::task_): New data member.
9177 (Pluginobj::Pluginobj): Add filesize parameter.
9178 (Pluginobj::filename): New function.
9179 (Pluginobj::descriptor): New function.
9180 (Pluginobj::filesize): New function.
9181 (Pluginobj::filesize_): New data member.
9182 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9183 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9184 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9185
9186 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9187 with archive libraries.
9188 * testsuite/Makefile.in: Regenerate.
9189 * testsuite/plugin_test.c (struct sym_info): New type.
9190 (get_input_file, release_input_file): New static variables.
9191 (onload): Capture new transfer vector entries.
9192 (claim_file_hook): Stop reading at end of file according to filesize.
9193 Factor out parsing of readelf output into separate function.
9194 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9195 APIs and get the source file name from the symbol table. Convert
9196 source file name to corresponding object file name. Print info
9197 message when adding new input files.
9198 (parse_readelf_line): New function.
9199 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9200 * testsuite/plugin_test_2.sh: Likewise.
9201 * testsuite/plugin_test_3.sh: Likewise.
9202 * testsuite/plugin_test_4.sh: New test case.
9203
62a6d109
ILT
92042009-01-07 Ian Lance Taylor <iant@google.com>
9205
9206 * version.cc (version_string): Bump to 1.8.
9207
483620e8
CC
92082008-12-23 Cary Coutant <ccoutant@google.com>
9209
9210 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9211 * plugin.cc (Plugin_manager::finish): Rename as
9212 layout_deferred_objects. Move cleanup to separate function.
9213 (Plugin_manager::cleanup): New function.
9214 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9215 separately.
9216 * plugin.h (Plugin_manager::finish): Rename as
9217 layout_deferred_objects.
9218 (Plugin_manager::cleanup): New function.
9219 (Plugin_manager::cleanup_done): New field.
9220
d66a9eb3
CC
92212008-12-23 Cary Coutant <ccoutant@google.com>
9222
9223 * plugin.cc (is_visible_from_outside): New function.
9224 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9225 so we don't return "IR only" status for exported symbols or -r links.
9226
9227 * testsuite/Makefile.am (plugin_test_3): New test case.
9228 * testsuite/Makefile.in: Regenerate.
9229 * testsuite/plugin_test_3.sh: New file.
9230
5995b570
CC
92312008-12-22 Cary Coutant <ccoutant@google.com>
9232
9233 * object.cc (Sized_relobj::layout_section): New function.
9234 (Sized_relobj::do_layout): Defer layout of input sections until after
9235 plugin has provided replacement files.
9236 (Sized_relobj::do_layout_deferred_sections): New function.
9237 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9238 (Relobj::layout_deferred_sections): New function.
9239 (Relobj::do_layout_deferred_sections): New function.
9240 (Sized_relobj::do_layout_deferred_sections): New function.
9241 (Sized_relobj::layout_section): New function.
9242 (Sized_relobj::Deferred_layout): New structure.
9243 (Sized_relobj::deferred_layout_): New field.
9244 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9245 Change all callers. Layout deferred sections.
9246 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9247 references.
9248 (Plugin_hook::run): Move code from do_plugin_hook inline.
9249 (Plugin_hook::do_plugin_hook): Remove.
9250 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9251 (Plugin_manager::finish): Renamed, was cleanup.
9252 (Plugin_manager::should_defer_layout): New function.
9253 (Plugin_manager::add_deferred_layout_object): New function.
9254 (Plugin_manager::Deferred_layout_list): New type.
9255 (Plugin_manager::deferred_layout_objects_): New field.
9256 (Plugin_hook::do_plugin_hook): Remove.
9257
ee769c88
ILT
92582008-12-17 Ian Lance Taylor <iant@google.com>
9259
9260 * options.h (class General_options): Add --no case for
9261 --export-dynamic.
9262
abc8dcba
CC
92632008-12-16 Cary Coutant <ccoutant@google.com>
9264
9265 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9266 vector.
9267 (Plugin_manager::claim_file): Create plugin object even if
9268 plugin did not call the add_symbols callback.
9269 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9270 asking for more symbols than were added.
9271 * testsuite/Makefile.am (plugin_test_1): Add test case with
9272 no global symbols.
9273 (empty.syms): New target.
9274 * testsuite/Makefile.in: Regenerate.
9275 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9276 message. Don't call add_symbols if no globals.
9277 (all_symbols_read_hook): Don't provide replacement for empty
9278 claimed file.
9279
b0074644
ILT
92802008-12-12 Ian Lance Taylor <iant@google.com>
9281
68943102
ILT
9282 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9283 r_type == 0 for a local symbol with r_sym == 0.
9284 (scan_relocatable_relocs): Pass r_sym to
9285 local_non_section_strategy.
9286 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9287 r_sym parameter.
9288
b0074644
ILT
9289 * configure.ac: Update test for TLS descriptors: they are
9290 supported as of glibc 2.9.
9291 * configure: Rebuild.
9292
c2508178
ILT
92932008-12-11 Ian Lance Taylor <iant@google.com>
9294
9295 PR 7091
9296 * target-reloc.h (Default_scan_relocatable_relocs): For each
9297 function, map r_type == 0 to RELOC_DISCARD.
9298
2756a258
CC
92992008-12-10 Cary Coutant <ccoutant@google.com>
9300
9301 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9302 object to override a kept COMDAT group from a plugin object.
9303
bb6f53d3
ILT
93042008-12-09 Ian Lance Taylor <iant@google.com>
9305
fbc558e1
ILT
9306 PR 7088
9307 * yyscript.y (file_cmd): Handle INPUT.
9308
bb6f53d3
ILT
9309 * testsuite/initpri1.c: Change all declarations to be full
9310 prototypes by adding void, to avoid compiler warnings.
9311
4674ecfc
CC
93122008-12-05 Rafael Avila de Espindola <espindola@google.com>
9313
9314 * options.cc (General_options::parse_plugin_opt): New.
9315 (General_options::add_plugin): The argument now is just the filename.
9316 (General_options::add_plugin_option): New.
9317 * options.h (plugin_opt): New.
9318 (add_plugin): Change argument name.
9319 (add_plugin_option): New.
9320 * plugin.cc (Plugin::load): Don't parse the plugin option.
9321 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9322 (Plugin::add_option): New.
9323 (Plugin::args_): Change type.
9324 (Plugin::filename_): New.
9325 (Plugin_manager::add_plugin_option): New.
9326 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9327 * testsuite/Makefile.in: Regenerate.
9328
fd06b4aa
CC
93292008-12-05 Cary Coutant <ccoutant@google.com>
9330
9331 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9332 Handle --strip-lto-sections option.
9333 * options.h (strip_lto_sections): New option.
9334
6c52134c
CC
93352008-12-01 Cary Coutant <ccoutant@google.com>
9336
9337 * plugin.cc (ld_plugin_message): Change format parameter to const.
9338 Fix mismatch between new[] and delete.
9339
a45248e0
CC
93402008-11-14 Cary Coutant <ccoutant@google.com>
9341
9342 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9343 instead of -1U.
9344
c82fbeee
CS
93452008-11-05 Craig Silverstein <csilvers@google.com>
9346
9347 * options.cc (General_options::parse_dynamic_list): New function.
9348 * options.h (General_options): New flags dynamic_list,
9349 dynamic_list_data, dynamic_list_cpp_new, and
9350 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9351 (General_options::in_dynamic_list): New function.
9352 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9353 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9354 (Lex::can_continue_name): Likewise.
9355 (yylex): Likewise.
9356 (read_script_file): New parameter script_options.
9357 (read_dynamic_list): New function.
9358 (Script_options::define_dynamic_list): New function.
9359 (dynamic_list_keyword_parsecodes): New variable.
9360 (dynamic_list_keywords): New variable.
9361 * script.h (Script_options::define_dynamic_list): New function
9362 prototype.
9363 (read_dynamic_list): New function prototype.
9364 * symtab.cc (strprefix): New macro.
9365 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9366 dynamic_list_data, dynamic_list_cpp_new, and
9367 dynamic_list_cpp_typeinfo.
9368 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9369 (dynamic_list_expr): New rule.
9370 (dynamic_list_nodes): Likewise.
9371 (dynamic_list_node): Likewise.
9372 * testsuite/Makefile.am (dynamic_list): New test.
9373 * testsuite/Makefile.in: Regenerated.
9374 * testsuite/dynamic_list.t: New file.
9375 * testsuite/dynamic_list.sh: New file.
9376
e0bb29a5
CS
93772008-11-05 Craig Silverstein <csilvers@google.com>
9378
9379 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9380 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9381 (t11_last): Likewise.
9382 * testsuite/ver_test_6.c (main): Likewise.
9383
4e1e25e0
CC
93842008-10-07 Cary Coutant <ccoutant@google.com>
9385
9386 * options.c (General_options::finalize): Add check for -static and
9387 -shared.
9388 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9389 is not empty.
9390
92f03fcb
CC
93912008-10-02 Cary Coutant <ccoutant@google.com>
9392
9393 * plugin.cc (make_sized_plugin_object): Fix conditional
9394 compilation to work when not all targets are enabled.
9395
fbd8a257
CC
93962008-09-29 Cary Coutant <ccoutant@google.com>
9397
9398 * archive.cc (Archive::get_file_and_offset): Use filename instead
9399 of name to get library path.
9400 (Archive::include_member): Unlock external member of a thin archive.
9401
9402 * testsuite/Makefile.am (TEST_AR): New variable.
9403 (thin_archive_test_1): New test.
9404 (thin_archive_test_2): New test.
81636b3f
CC
9405 * testsuite/Makefile.in: Regenerate.
9406 * testsuite/thin_archive_main.cc: New file.
9407 * testsuite/thin_archive_test_1.cc: New file.
9408 * testsuite/thin_archive_test_2.cc: New file.
9409 * testsuite/thin_archive_test_3.cc: New file.
9410 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 9411
eff45813
CC
94122008-09-29 Cary Coutant <ccoutant@google.com>
9413
9414 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9415 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9416 instead of -1U.
9417 (Sized_relobj::do_finalize_local_symbols): Likewise.
9418 (Sized_relobj::map_to_kept_section): Likewise.
9419 * object.h (Sized_relobj::invalid_address): New constant.
9420 (Sized_relobj::do_output_section_offset): Check for invalid_address
9421 and return -1ULL.
9422 * output.cc (Output_reloc::local_section_offset): Use constant
9423 invalid_address instead of -1U.
9424 (Output_reloc::get_address): Likewise.
9425 (Output_section::output_address): Change -1U to -1ULL.
9426 * output.h (Output_reloc::invalid_address): New constant.
9427 * reloc.cc (Sized_relobj::write_sections): Use constant
9428 invalid_address instead of -1U.
9429 (Sized_relobj::relocate_sections): Likewise.
9430 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9431 values for merge sections.
9432 * target-reloc.h (relocate_for_relocatable): Use constant
9433 invalid_address instead of -1U.
9434
89fc3421
CC
94352008-09-19 Cary Coutant <ccoutant@google.com>
9436
9437 Add plugin functionality for link-time optimization (LTO).
9438 * configure.ac (plugins): Add --enable-plugins option.
9439 * configure: Regenerate.
9440 * config.in: Regenerate.
9441 * Makefile.am (LIBDL): New variable.
9442 (CCFILES): Add plugin.cc.
9443 (HFILES): Add plugin.h.
9444 (ldadd_var): Add LIBDL.
9445 * Makefile.in: Regenerate.
9446
9447 * archive.cc: Include "plugin.h".
9448 (Archive::setup): Don't preread archive symbols when using a plugin.
9449 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9450 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9451 files.
9452 (Archive::include_member): Add symbols from plugin objects.
9453 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9454 * descriptors.cc (Descriptors::open): Check for file descriptors
9455 abandoned by plugins.
9456 (Descriptors::claim_for_plugin): New function.
9457 * descriptors.h (Descriptors::claim_for_plugin): New function.
9458 (Open_descriptor::is_claimed): New field.
9459 (claim_descriptor_for_plugin): New function.
9460 * fileread.cc (File_read::claim_for_plugin): New function.
9461 * fileread.h (File_read::claim_for_plugin): New function.
9462 (File_read::descriptor): New function.
9463 * gold.cc: Include "plugin.h".
9464 (queue_initial_tasks): Add task to call plugin hooks for generating
9465 new object files.
9466 * main.cc: Include "plugin.h".
9467 (main): Load plugin libraries.
9468 * object.h (Pluginobj): Declare.
9469 (Object::pluginobj): New function.
9470 (Object::do_pluginobj): New function.
9471 (Object::set_target): New function.
9472 * options.cc: Include "plugin.h".
9473 (General_options::parse_plugin): New function.
9474 (General_options::General_options): Initialize plugins_ field.
9475 (General_options::add_plugin): New function.
9476 * options.h (Plugin_manager): Declare.
9477 (General_options): Add --plugin option.
9478 (General_options::has_plugins): New function.
9479 (General_options::plugins): New function.
9480 (General_options::add_plugin): New function.
9481 (General_options::plugins_): New field.
9482 * plugin.cc: New file.
9483 * plugin.h: New file.
9484 * readsyms.cc: Include "plugin.h".
9485 (Read_symbols::do_read_symbols): Check for archive before checking
9486 for ELF file. Call plugin hooks to claim files.
9487 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9488 from a real object file; force override when processing replacement
9489 files.
9490 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9491 (Symbol::init_base_object): Likewise.
9492 (Symbol::init_base_output_data): Likewise.
9493 (Symbol::init_base_output_segment): Likewise.
9494 (Symbol::init_base_constant): Likewise.
9495 (Symbol::init_base_undefined): Likewise.
9496 (Symbol::output_section): Assert that object is not a plugin.
9497 (Symbol_table::add_from_pluginobj): New function.
9498 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9499 undefined.
9500 (Symbol_table::sized_write_globals): Likewise.
9501 (Symbol_table::add_from_pluginobj): Instantiate template.
9502 * symtab.h (Sized_pluginobj): Declare.
9503 (Symbol::in_real_elf): New function.
9504 (Symbol::set_in_real_elf): New function.
9505 (Symbol::in_real_elf_): New field.
9506 (Symbol_table::add_from_pluginobj): New function.
9507
9508 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9509 (LIBDL): New variable.
9510 (LDADD): Add LIBDL.
9511 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9512 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9513 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9514 (MOSTLYCLEANFILES): Likewise.
9515 * testsuite/Makefile.in: Regenerate.
9516 * testsuite/plugin_test.c: New file.
9517 * testsuite/plugin_test_1.sh: New file.
9518 * testsuite/plugin_test_2.sh: New file.
9519
de31bda5
ILT
95202008-09-16 Ian Lance Taylor <iant@google.com>
9521
9c2d0ef9
ILT
9522 * target-reloc.h (relocate_section): Check whether a symbol is
9523 defined by the ABI before reporting an undefined symbol error.
9524 * target.h (Target::is_defined_by_abi): Make parameter const.
9525 (Target::do_is_defined_by_abi): Likewise.
9526 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9527 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9528 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9529 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9530 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9531 * testsuite/Makefile.in: Rebuild.
9532
de31bda5
ILT
9533 * fileread.cc (make_view): Add casts to avoid warning.
9534
9fa33bee
AO
95352008-09-16 Alexandre Oliva <aoliva@redhat.com>
9536
9537 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9538 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9539
183fd0e3
AO
95402008-09-16 Alexandre Oliva <aoliva@redhat.com>
9541
9542 * options.h (General_options::output_is_executable): New.
9543 (General_options::output_is_pie): New.
9544 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9545 for shared libraries.
9546 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9547
7be8330a
CD
95482008-09-11 Chris Demetriou <cgd@google.com>
9549
9550 * options.h (origin): New -z option.
9551 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9552 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9553 in DT_FLAGS_1.
9554
a9caad02
CC
95552008-09-05 Cary Coutant <ccoutant@google.com>
9556
9557 * fileread.cc (File_read::make_view): Add check for attempt to map
9558 beyond end of file.
9559
ae6dce4d
CC
95602008-09-05 Cary Coutant <ccoutant@google.com>
9561
9562 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9563 explicit instantiations.
9564
d7ab2a47
KVH
95652008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9566
9567 PR gold/6858
9568 * options.cc (General_options::finalize): Allow undefined symbols
9569 in shlibs if linking -shared.
9570
9571 PR gold/6859
9572 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9573 symbols as not needing a dynsym entry.
9574
1e52a9c1
CS
95752008-08-20 Craig Silverstein <csilvers@google.com>
9576
9577 * fileread.cc (File_read::open): Do not lock the file unless it
9578 was successfully opened.
9579
d85c80a3
CC
95802008-08-14 Cary Coutant <ccoutant@google.com>
9581
9582 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9583 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9584 * testsuite/tls_test.cc (struct int128): 128-bit struct
9585 for testing TLS relocs with non-zero addend.
9586 (v12): New TLS variable.
9587 (t12): New test.
9588 (t_last): Add check for v12.
9589 * testsuite/tls_test.h (t12): New function.
9590 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9591
2d924fd9
ILT
95922008-08-13 Ian Lance Taylor <iant@google.com>
9593
9594 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9595 set tls_segment_ or relro_segment_.
9596 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9597 when appropriate.
9598 * output.h (Output_section::clear_is_relro): New function.
9599 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9600 sections specially even when output_data_ is empty.
9601 (Output_segment::maximum_alignment): When first section is relro,
9602 only force alignment for PT_LOAD segments.
9603 * script.cc (script_data_segment_align): New function.
9604 (script_data_segment_relro_end): New function.
9605 * script-c.h (script_data_segment_align): Declare.
9606 (script_data_segment_relro_end): Declare.
9607 * script-sections.h (class Script_sections): Declare
9608 data_segment_align and data_segment_relro_end. Add fields
9609 segment_align_index_ and saw_relro_end_.
9610 * script-sections.cc (class Sections_element): Add set_is_relro
9611 virtual function. Add new bool* parameter to place_orphan_here.
9612 Add get_output_section virtual function.
9613 (class Output_section_definition): Add set_is_relro. Add new
9614 bool* parameter to place_orphan_here. Add get_output_section.
9615 Add is_relro_ field.
9616 (Output_section_definition::Output_section_definition): Initialize
9617 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9618 and is_relro_ fields.
9619 (Output_section_definition::place_orphan_here): Add is_relro
9620 parameter.
9621 (Output_section_definition::set_section_addresses): Set relro for
9622 output section.
9623 (Output_section_definition::alternate_constraint): Likewise.
9624 (class Orphan_output_section): Add new bool* parameter to
9625 place_orphan_here. Add get_output_section.
9626 (Orphan_output_section::place_orphan_here): Add is_relro
9627 parameter.
9628 (Script_sections::Script_sections): Initialize
9629 data_segment_align_index_ and saw_relro_end_.
9630 (Script_sections::data_segment_align): New function.
9631 (Script_sections::data_segment_relro_end): New function.
9632 (Script_sections::place_orphan): Set or clear is_relro.
9633 (Script_sections::set_section_addresses): Force alignment of first
9634 TLS section.
9635 * yyscript.y (exp): Call script_data_segment_align and
9636 script_data_segment_relro_end.
9637 * testsuite/relro_script_test.t: New file.
9638 * testsuite/relro_test.cc (using_script): Declare.
9639 (t1, t2): Test using_script.
9640 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9641 (relro_script_test_SOURCES): Define.
9642 (relro_script_test_DEPENDENCIES): Define.
9643 (relro_script_test_LDFLAGS): Define.
9644 (relro_script_test_LDADD): Define.
9645 (relro_script_test.so): New target.
9646 * testsuite/Makefile.in: Rebuild.
9647
f827c9a9
CC
96482008-08-06 Cary Coutant <ccoutant@google.com>
9649
9650 * archive.cc (Archive::total_archives, Archive::total_members)
9651 (Archive::total_members_loaded): New variables.
9652 (Archive::setup): Add parameter. Add option to preread
9653 archive symbols.
9654 (Archive::read_armap): Add counter.
9655 (Archive::get_file_and_offset): New function.
9656 (Archive::get_elf_object_for_member): New function.
9657 (Archive::read_all_symbols): New function.
9658 (Archive::read_symbols): New function.
9659 (Archive::add_symbols): Add counters.
9660 (Archive::include_all_members): Use armap to find members if it's
9661 already built.
9662 (Archive::include_member): Skip reading symbols if already read.
9663 Factored code into Archive::get_file_and_offset and
9664 Archive::get_elf_object_for_member. Changed call to
9665 Mapfile::report_include_archive_member.
9666 (Archive::print_stats): New function.
9667 * archive.h: Declare Object and Read_symbols_data classes.
9668 (Archive::Archive): Add initializers for new members.
9669 (Archive::setup): Add parameter.
9670 (Archive::print_stats): New function.
9671 (Archive::total_archives, Archive::total_members)
9672 (Archive::total_members_loaded): New variables.
9673 (Archive::get_file_and_offset): New function.
9674 (Archive::get_elf_object_for_member): New function.
9675 (Archive::read_all_symbols): New function.
9676 (Archive::read_symbols): New function.
9677 (Archive::Archive_member): New class.
9678 (Archive::members_): New member.
9679 (Archive::num_members_): New member.
9680 * main.cc: Include archive.h.
9681 (main): Call Archive::print_stats.
9682 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9683 archive parameter; member_name is now the fully-decorated name.
9684 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9685 * options.h: (General_options): Add --preread-archive-symbols option.
9686 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9687 Archive::setup.
9688
de4c45bd
ILT
96892008-08-04 Ian Lance Taylor <iant@google.com>
9690
9691 * symtab.h (Symbol::use_plt_offset): New function.
9692 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9693 * powerpc.cc (Relocate::relocate): Likewise.
9694 * sparc.cc (Relocate::relocate): Likewise.
9695 * x86_64.cc (Relocate::relocate): Likewise.
9696 * testsuite/weak_plt.sh: New test.
9697 * testsuite/weak_plt_main.cc: New test.
9698 * testsuite/weak_plt_shared.cc: New test.
9699 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9700 (check_PROGRAMS): Add weak_plt.
9701 (check_DATA): Add weak_plt_shared.so.
9702 (weak_plt_main_pic.o, weak_plt): New targets.
9703 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9704 * testsuite/Makefile.in: Rebuild.
9705
9706 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9707 gcctestdir/ld.
9708 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9709 * testsuite/Makefile.in: Rebuild.
9710
323ee3f4
AM
97112008-08-04 Alan Modra <amodra@bigpond.net.au>
9712
9713 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9714 * Makefile.in: Regenerate.
9715 * po/POTFILES.in: Regenerate.
9716
7c07ecec
ILT
97172008-07-29 Ian Lance Taylor <iant@google.com>
9718
9719 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9720 symbols before other symbols.
9721 * testsuite/script_test_2.cc (test_addr): Declare.
9722 (test_addr_alias): Declare.
9723 (main): Check that test_addr and test_addr_alias have the right
cd536b21 9724 values.
7c07ecec
ILT
9725 * testsuite/script_test_2.t: Define test_addr_alias and
9726 test_addr.
9727
5778530e
ILT
97282008-07-24 Ian Lance Taylor <iant@google.com>
9729
2a00e4fb
ILT
9730 PR 5990
9731 * descriptors.cc: New file.
9732 * descriptors.h: New file.
9733 * gold-threads.h (class Hold_optional_lock): New class.
9734 * fileread.cc: Include "descriptors.h".
9735 (File_read::~File_read): Release descriptor rather than closing
9736 it.
9737 (File_read::open) [file]: Call open_descriptor rather than open.
9738 Set is_descriptor_opened_.
9739 (File_read::open) [memory]: Assert that descriptor is not open.
9740 (File_read::reopen_descriptor): New function.
9741 (File_read::release): Release descriptor.
9742 (File_read::do_read): Make non-const. Reopen descriptor.
9743 (File_read::read): Make non-const.
9744 (File_read::make_view): Reopen descriptor.
9745 (File_read::do_readv): Likewise.
9746 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9747 Update declarations.
9748 * layout.cc: Include "descriptors.h".
9749 (Layout::create_build_id): Use open_descriptor rather than open.
9750 * output.cc: Include "descriptors.h".
9751 (Output_file::open): Use open_descriptor rather than open.
9752 * archive.cc (Archive::const_iterator): Change Archive to be
9753 non-const.
9754 (Archive::begin, Archive::end): Make non-const.
9755 (Archive::count_members): Likewise.
9756 * archive.h (class Archive): Update declarations.
9757 * object.h (Object::read): Make non-const.
9758 * Makefile.am (CCFILES): Add descriptors.cc.
9759 (HFILES): Add descriptors.h.
9760 * Makefile.in: Rebuild.
9761
801647d1
ILT
9762 PR 6716
9763 * gold.h: Always include <clocale>. Add Solaris workarounds
9764 following code in binutils/sysdep.h.
9765
5edd166e
ILT
9766 PR 6048
9767 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9768 this->eh_frame_hdr_ is NULL before using it.
9769
c89ad728
ILT
9770 * dynobj.cc (Versions::Versions): Update comment.
9771
aa86f06b
ILT
9772 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9773 the base version name.
9774
5778530e
ILT
9775 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9776 array size plus one.
9777 (Stringpool_template::set_string_offsets): Subtract one from key
9778 before using it as an array index.
9779 (Stringpool_template::get_offset_with_length): Likewise.
9780 (Stringpool_template::write_to_buffer): Likewise.
9781 * stringpool.h (Stringpool_template::get_offset_from_key):
9782 Likewise.
9783
057ead22
ILT
97842008-07-23 Ian Lance Taylor <iant@google.com>
9785
7f649c59
ILT
9786 PR 6658
9787 * object.h (Merged_symbol_value::value): Do our best to handle a
9788 negative addend.
9789
057ead22
ILT
9790 PR 6647
9791 * script.cc (Version_script_info::get_versions): Don't add empty
9792 version tag to return value.
9793 (Version_script_info::get_symbol_version_helper): Change return
9794 type to bool. Add pversion parameter. Change all callers.
9795 (script_register_vers_node): Don't require a non-NULL tag.
9796 * script.h (class Version_script_info): Update declarations.
9797 (Version_script_info::get_symbol_version): Change return type to
9798 bool. Add version parameter. Change all callers.
9799 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9800 handling. Handle an empty version from a version script.
9801 (Symbol_table::define_special_symbol): Likewise.
9802 * testsuite/ver_test_10.script: New file.
9803 * testsuite/ver_test_10.sh: New file.
9804 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9805 (check_DATA): Add ver_test_10.syms.
9806 (ver_test_10.syms, ver_test_10.so): New target.
9807 * testsuite/Makefile.in: Rebuild.
9808
58e54ac2
CD
98092008-07-23 Simon Baldwin <simonb@google.com>
9810
9811 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9812 to zero for undefined symbols from dynamic libraries.
9813
95d14cd3
ILT
98142008-07-23 Ian Lance Taylor <iant@google.com>
9815
9816 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9817 Change all callers.
9818 * symtab.h (class Symbol_table): Update declaration.
9819 * testsuite/ver_test_9.cc: New file.
9820 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9821 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9822 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9823 (ver_test_9.so, ver_test_9.o): New targets.
9824 * testsuite/Makefile.in: Rebuild.
9825
92de84a6
ILT
98262008-07-22 Ian Lance Taylor <iant@google.com>
9827
34810851
ILT
9828 * options.h (class General_options): Define --check-sections.
9829 * layout.cc (Layout::set_segment_offsets): Handle
9830 --check-sections.
9831
af6156ef
ILT
9832 * options.h (class General_options): Define -n/--nmagic and
9833 -N/--omagic.
9834 * options.cc (General_options::finalize): For -n/--nmagic or
9835 -N/--omagic, set -static.
9836 * layout.cc (Layout::attach_allocated_section_to_segment): If
9837 -N/--omagic, don't put read-only and read-write sections in
9838 different segments.
9839 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9840 finding a read-only segment.
9841 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9842 don't set the minimum segment alignment to the common page size,
9843 and don't set the file offset to the address modulo the page size.
9844 * script-sections.cc (Script_sections::create_segments): If
9845 -n/--omagic, don't put read-only and read-write sections in
9846 different segments.
9847
92de84a6
ILT
9848 * cref.cc: New file.
9849 * cref.h: New file.
9850 * options.h (class General_options): Add --print-symbol-counts.
9851 * main.cc (main): Issue defined symbol report if requested.
9852 * archive.cc (Archive::interpret_header): Make into a const member
9853 function.
9854 (Archive::add_symbols): Call Input_objects::archive_start and
9855 archive_stop.
9856 (Archive::const_iterator): Define new class.
9857 (Archive::begin, Archive::end): New functions.
9858 (Archive::include_all_members): Rewrite to use iterator.
9859 (Archive::count_members): New function.
9860 * archive.h (class Archive): Update declarations.
9861 (Archive::filename): New function.
9862 * object.cc: Include "cref.h".
9863 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9864 (Sized_relobj::do_get_global_symbol_counts): New function.
9865 (Input_objects::add_object): Add object to cross-referencer.
9866 (Input_objects::archive_start): New function.
9867 (Input_objects::archive_stop): New function.
9868 (Input_objects::print_symbol_counts): New function.
9869 * object.h: Declare Cref and Archive.
9870 (Object::get_global_symbol_counts): New function.
9871 (Object::do_get_global_symbol_counts): New pure virtual function.
9872 (class Sized_relobj): Add defined_count_ field. Update
9873 declarations.
9874 (class Input_objects): Add cref_ field. Update constructor.
9875 Update declarations.
9876 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9877 defined_count_.
9878 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9879 symbol counts.
9880 (Sized_dynobj::do_get_global_symbol_counts): New function.
9881 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9882 defined_count_. Update declarations. Define Symbols typedef.
9883 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9884 parameter. Change all callers.
9885 (Symbol_table::add_from_dynobj): Add sympointers and defined
9886 parameters. Change all callers.
9887 * symtab.h (class Symbol_table): Update declarations.
9888 * Makefile.am (CCFILES): Add cref.cc.
9889 (HFILES): Add cref.h.
9890 * Makefile.in: Rebuild.
9891
3f7c5e1d
CD
98922008-07-22 Simon Baldwin <simonb@google.com>
9893
9894 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9895 to zero when writing undefined symbols.
9896
e0b64032
ILT
98972008-07-22 Ian Lance Taylor <iant@google.com>
9898
9899 * output.cc (Output_section::add_input_section): Don't try to
9900 merge empty merge sections.
9901
096b02cf
CS
99022008-07-21 Craig Silverstein <csilvers@google.com>
9903
9904 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9905 Include symbol version in error message.
cd536b21 9906
1d1f116d
CD
99072008-07-20 Chris Demetriou <cgd@google.com>
9908
cd536b21 9909 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
9910 (RANDOM_SEED_CFLAGS): New substituted variable.
9911 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9912 * configure: Rebuild.
9913 * Makefile.in: Likewise.
9914 * testsuite/Makefile.in: Likewise.
9915
a18f591e
ILT
99162008-07-18 Ian Lance Taylor <iant@google.com>
9917
9918 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9919 where we see NAME/NULL and NAME/VERSION as separate symbols.
9920 * testsuite/ver_test_main.cc (main): Call t4.
9921 (t4, t4_2a): Define.
9922 * testsuite/ver_test_2.cc (t4_2): Define.
9923 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9924 * testsuite/ver_test_4.cc (t4_2a): Define.
9925 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9926 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9927
c6e3f6ed
ILT
99282008-07-17 Ian Lance Taylor <iant@google.com>
9929
9930 * dynobj.cc (Versions::add_def): If we give an error about a
9931 missing version, go ahead and create the version anyhow.
9932
ef9beddf
ILT
99332008-07-10 Ian Lance Taylor <iant@google.com>
9934
9935 Handle output sections with more than 0x7fffffff bytes.
9936 * object.h (class Relobj): Change map_to_output_ to
9937 output_sections_, and just keep a section pointer. Change all
9938 uses. Move comdat group support to Sized_relobj.
9939 (Relobj::is_section_specially_mapped): Remove.
9940 (Relobj::output_section): Remove poff parameter. Change all
9941 callers.
9942 (Relobj::output_section_offset): New function.
9943 (Relobj::set_section_offset): Rewrite.
9944 (Relobj::map_to_output): Remove.
9945 (Relobj::output_sections): New function.
9946 (Relobj::do_output_section_offset): New pure virtual function.
9947 (Relobj::do_set_section_offset): Likewise.
9948 (class Sized_relobj): Add section_offsets_ field. Add comdat
9949 group support from Relobj. Update declarations.
9950 (Sized_relobj::get_output_section_offset): New function.
9951 (Sized_relobj::do_output_section_offset): New function.
9952 (Sized_relobj::do_set_section_offset): New function.
9953 * object.cc (Relobj::output_section_address): Remove.
9954 (Sized_relobj::Sized_relobj): Initialize new fields.
9955 (Sized_relobj::include_section_group): Cast find_kept_object to
9956 Sized_relobj.
9957 (Sized_relobj::include_linkonce_section): Likewise.
9958 (Sized_relobj::do_layout): Use separate arrays for output section
9959 and output offset.
9960 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9961 output_sections.
9962 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9963 output_sections and section_offsets.
9964 (Sized_relobj::write_local_symbols): Likewise.
9965 (map_to_kept_section): Compute output address directly.
9966 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9967 output_sections and section_offsets.
9968 (Sized_relobj::write_sections): Likewise.
9969 (Sized_relobj::relocate_sections): Likewise.
9970 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9971 * output.h (class Output_reloc): Update declarations. Change
9972 u2_.relobj to Sized_relobj*.
9973 (class Output_data_reloc): Change add functions to use
9974 Sized_relobj*.
9975 * output.cc (Output_reloc::Output_reloc): Change relobj to
9976 Sized_relobj*.
9977 (Output_reloc::local_section_offset): Change return type to
9978 Elf_Addr. Use get_output_section_offset.
9979 (Output_reloc::get_address): Likewise.
9980 (Output_section::is_input_address_mapped): Don't call
9981 is_section_specially_mapped.
9982 (Output_section::output_offset): Likewise.
9983 (Output_section::output_address): Likewise.
9984 (Output_section::starting_output_address): Likewise.
9985 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9986 parameter to Sized_relobj*.
9987 (Copy_relocs::need_copy_reloc): Likewise.
9988 (Copy_relocs::save): Likewise.
9989 * copy-relocs.h (class Copy_relocs): Update declarations.
9990 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9991 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9992 * target-reloc.h (relocate_for_relocatable): Change
9993 offset_in_output_section type to Elf_Addr. Change code that uses
9994 it as well.
9995 * layout.cc (Layout::layout): Always set *off.
9996 * mapfile.cc (Mapfile::print_input_section): Use
9997 output_section_offset.
9998 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9999 Sized_relobj*.
10000 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
10001 * sparc.cc (Target_sparc::copy_reloc): Likewise.
10002 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
10003
5cb66f97
ILT
100042008-07-03 Ian Lance Taylor <iant@google.com>
10005
10006 * layout.cc (Layout::include_section): Do not discard unrecognized
10007 SHT_STRTAB sections.
10008
afe47622
CS
100092008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
10010
10011 * script.cc (Lex::can_continue_name): Make '?' allowable in
10012 version-script names.
10013 * testsuite/version_script.map: Change glob pattern to use '?'
10014
5adf9721
ILT
100152008-06-30 Manish Singh <yosh@gimp.org>
10016
10017 PR 6585
10018 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
10019 Correct typo.
10020
e6fde208
ILT
100212008-06-30 Ian Lance Taylor <iant@google.com>
10022
10023 PR 6660
10024 PR 6682
10025 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
10026 versions]: Don't try to read the value in the contents, since we
10027 don't use it. Use the template endianness when writing.
10028
3f2e6a2d
CC
100292008-06-25 Cary Coutant <ccoutant@google.com>
10030
10031 * fileread.cc (File_read::make_view): Assert on zero-length view.
10032 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
10033 symbol table when there are no symbols to read.
10034
c43d3a48
CS
100352008-06-23 Craig Silverstein <csilvers@google.com>
10036
10037 * version.cc (version_string): Bump to 1.7
10038
5f494ea0
CS
100392008-06-18 Craig Silverstein <csilvers@google.com>
10040
10041 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
10042 constant 0xFFFF to type Valtype.
10043 (Powerpc_relocate_functions::rel16_ha): Likewise.
10044
c42e122e
ILT
100452008-06-17 Ian Lance Taylor <iant@google.com>
10046
f34787f8
ILT
10047 * output.h (Output_section::Input_section): Initialize p2align_ to
10048 zero for Output_section_data constructors.
10049 (Output_section::Input_section::addralign): If not an input
10050 section, return the alignment of the Output_section_data.
10051 * testsuite/copy_test.cc: New file.
10052 * testsuite/copy_test_1.cc: New file.
10053 * testsuite/copy_test_2.cc: New file.
10054 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
10055 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
10056 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
10057 (copy_test_1_pic.o, copy_test_1.so): New targets.
10058 (copy_test_2_pic.o, copy_test_2.so): New targets.
10059 * testsuite/Makefile.in: Rebuild.
10060
c42e122e
ILT
10061 * script-sections.cc (Script_sections::place_orphan): Initialize
10062 local variable exact.
10063
ce3ac18a
DE
100642008-06-13 David Edelsohn <edelsohn@gnu.org>
10065
10066 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
10067
42cacb20
DE
100682008-06-12 David Edelsohn <edelsohn@gnu.org>
10069 David S. Miller <davem@davemloft.net>
10070
10071 * powerpc.cc: New file.
10072 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10073 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10074 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10075 * Makefile.in: Rebuild.
10076
7b308235
ILT
100772008-06-09 Ian Lance Taylor <iant@google.com>
10078
10079 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10080 <exception>.
10081 (throwing, orig_terminate): New static variables.
10082 (terminate_handler): New static function.
10083 (t2): Set terminate handler.
10084
f0b886e3
ILT
100852008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10086
10087 PR 6584
cd536b21 10088 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
10089 alignment.
10090
3e90f135
CC
100912008-05-30 Cary Coutant <ccoutant@google.com>
10092
10093 * archive.cc (Archive::include_all_members) Correct to step
10094 over symbol table and extended name table in thin archives.
10095
e09ad04a
ILT
100962008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10097
10098 PR 6407
10099 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10100 calculation.
10101
62b01cb5
ILT
101022008-05-28 Caleb Howe <cshowe@google.com>
10103
10104 * reduced_debug_output.cc: New file.
10105 * reduced_debug_output.h: New file.
92de84a6 10106 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
10107 * options.cc (General_options::finalize): Add strip_debug_non_line
10108 to the strip heirarchy.
10109 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10110 fields.
10111 * layout.cc: Include "reduced_debug_output.h".
10112 (Layout::Layout): Initialize new fields.
10113 (line_only_debug_sections): New static array.
10114 (is_lines_only_debug_sections): New static inline function.
10115 (Layout::include_section): Handle --strip-debug-non-line.
10116 (Layout::make_output_section): If --strip-debug-non-line, build
10117 new output sections for .debug_abbrev and .debug_info.
10118 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10119 gold. Warn about possible overflow.
10120 (read_signed_LEB_128): Likewise.
10121 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10122 (read_signed_LEB_128): Declare.
10123 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10124 (HFILES): Add reduced_debug_output.h.
10125 * Makefile.in: Rebuild.
10126
7d9e3d98
ILT
101272008-05-21 Ian Lance Taylor <iant@google.com>
10128
10129 * mapfile.cc: New file.
10130 * mapfile.h: New file.
10131 * options.h (class General_options): Add -M/--print-map and -Map.
10132 * options.cc (General_options::finalize): Make -M equivalent to
10133 -Map -.
10134 * main.cc: Include <cstdio> and "mapfile.h".
10135 (main): Open mapfile if requested.
10136 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10137 constructor. Change caller.
10138 (queue_initial_tasks): Add mapfile parameter. Change caller.
10139 (queue_middle_tasks): Likewise.
10140 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10141 declarations.
10142 * archive.cc: Include "mapfile.h".
10143 (Archive::add_symbols): Add mapfile parameter. Change all
10144 callers. Pass mapfile, symbol, and reason to include_member.
10145 (Archive::include_all_members): Add mapfile parameter. Change all
10146 callers.
10147 (Archive::include_member): Add mapfile, sym, and why parameters.
10148 Change all callers. Report inclusion to map file.
10149 * archive.h: Include "fileread.h".
10150 (class Archive): Update declarations.
10151 (Archive::file): New const method.
10152 (class Add_archive_symbols): Add mapfile_ field. Update
10153 constructor. Change all callers.
10154 * readsyms.h (class Read_symbols): Likewise.
10155 (class Finish_group): Likewise.
10156 (class Read_script): Likewise.
10157 * common.cc: Include "mapfile.h".
10158 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10159 all callers.
10160 (Symbol_table::do_allocate_commons): Likewise.
10161 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10162 symbol allocation to mapfile.
10163 * common.h (class Allocate_commons_task): Add mapfile_ field.
10164 Update constructor. Change all callers.
10165 * symtab.h (class Symbol_table): Update declarations.
10166 * layout.cc: Include "mapfile.h".
10167 (Layout_task_runner::run): Print information to mapfile.
10168 (Layout::create_gold_note): Change Output_data_fixed_space to
10169 Output_data_zero_fill.
10170 (Layout::create_build_id): Likewise.
10171 (Layout::print_to_mapfile): New function.
10172 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10173 constructor. Change caller.
10174 (class Layout): Declare print_to_mapfile.
10175 * output.cc (Output_section::Input_section::print_to_mapfile): New
10176 function.
10177 (Output_section::add_input_section): If producing a map, always
10178 add to input_sections_ list.
10179 (Output_section::do_print_to_mapfile): New function.
10180 (Output_segment::print_sections_to_mapfile): New function.
10181 (Output_segment::print_section_list_to_mapfile): New function.
10182 * output.h: Include "mapfile.h".
10183 (Output_data::print_to_mapfile): New function.
10184 (Output_data::do_print_to_mapfile): New virtual function.
10185 (Output_segment_headers::do_print_to_mapfile): New function.
10186 (Output_file_header::do_print_to_mapfile): New function.
10187 (Output_data_const::do_print_to_mapfile): New function.
10188 (class Output_data_const_buffer): Add map_name_ field. Update
10189 constructor. Change all callers. Add do_print_to_mapfile
10190 function.
10191 (class Output_data_fixed_space): Likewise.
10192 (class Output_data_space): Likewise.
10193 (class Output_data_zero_fill): New class.
10194 (Output_data_strtab::do_print_to_mapfile): New function.
10195 (Output_data_reloc_base::do_print_to_mapfile): New function.
10196 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10197 (Output_data_group::do_print_to_mapfile): New function.
10198 (Output_data_got::do_print_to_mapfile): New function.
10199 (Output_data_dynamic::do_print_to_mapfile): New function.
10200 (Output_symtab_xindex::do_print_to_mapfile): New function.
10201 (class Output_section): Declare do_print_to_mapflie. Declare
10202 print_to_mapfile in Input_section.
10203 (class Output_segment): Declare new functions.
10204 * object.h (Sized_relobj::symbol_count): New function.
10205 * script-sections.cc
10206 (Output_section_element_dot_assignment::set_section_addresses):
10207 Change Output_data_fixed_space to Output_data_zero_fill.
10208 (Output_data_expression::do_print_to_mapfile): New function.
10209 * script.cc (read_input_script): Add mapfile parameter. Change
10210 all callers.
10211 * script.h (read_input_script): Update declaration.
10212 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10213 (Eh_frame::do_print_to_mapfile): New function.
10214 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10215 (Output_merge_string::do_print_to_mapfile): New function.
10216 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10217 function.
10218 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10219 function.
10220 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10221 function.
10222 * Makefile.am (CCFILES): Add mapfile.cc.
10223 (HFILES): Add mapfile.h.
10224 * Makefile.in: Rebuild.
10225
9f1d377b
ILT
102262008-05-19 Ian Lance Taylor <iant@google.com>
10227
10228 * options.h (class General_options): Add -z relro.
10229 * layout.cc (Layout::Layout): Initialize relro_segment_.
10230 (Layout::add_output_section_data): Return the output section.
10231 (Layout::make_output_section): Rcognize relro sections and mark
10232 them appropriately.
10233 (Layout::attach_allocated_section_to_segment): Put relro sections
10234 in a PT_GNU_RELRO segment.
10235 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10236 section as relro.
10237 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10238 PT_TLS segments.
10239 (Layout::linkonce_mapping): Map d.rel.ro.local to
10240 .data.rel.ro.local.
10241 (Layout::output_section_name): Us .data.rel.ro.local for any
10242 section which begins with that.
10243 * layout.h (class Layout): Update add_output_section_data
10244 declaration. Add relro_segment_ field.
10245 * output.cc (Output_section::Output_section): Initialize is_relro_
10246 and is_relro_local_ fields.
10247 (Output_segment::add_output_section): Group relro sections.
10248 (Output_segment::is_first_section_relro): New function.
10249 (Output_segment::maximum_alignment): If there is a relro section,
10250 align the segment to the common page size.
10251 (Output_segment::set_section_addresses): Track whether we are
10252 looking at relro sections. If the last section is a relro
10253 section, align to the common page size.
10254 (Output_segment::set_section_list_addresses): Add in_relro
10255 parameter. Change all callers. Align to the page size when
10256 moving from relro to non-relro section.
10257 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10258 segment.
10259 * output.h (class Output_section): Add is_relro_ and
10260 is_relro_local_ fields.
10261 (Output_section::is_relro): New function.
10262 (Output_section::set_is_relro): New function.
10263 (Output_section::is_relro_local): New function.
10264 (Output_section::set_is_relro_local): New function.
10265 (class Output_segment): Update declarations.
10266 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10267 * sparc.cc (Target_sparc::got_section): Likewise.
10268 * x86_64.cc (Target_x86_64::got_section): Likewise.
10269 * testsuite/relro_test_main.cc: New file.
10270 * testsuite/relro_test.cc: New file.
10271 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10272 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10273 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10274 (relro_test.so, relro_test_pic.o): New targets.
10275 * testsuite/Makefile.in: Rebuild.
10276
a984ee1d
ILT
102772008-05-16 Ian Lance Taylor <iant@google.com>
10278
01676dcd
ILT
10279 * output.cc (Output_segment::add_output_section): Remove front
10280 parameter.
10281 * output.h (class Output_segment): Remove
10282 add_initial_output_section and overloaded add_output_section.
10283 Update declaration of remaining add_output_section.
10284 * layout.cc (Layout::create_interp): Call add_output_section
10285 rather than add_initial_output_section.
10286 (Layout::finish_dynamic_section): Likewise.
10287
497897f9
ILT
10288 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10289 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10290 know the dynamic type.
10291 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10292 field. Initialize it in constructor.
10293 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10294 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10295 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10296 reloc.
10297
a984ee1d
ILT
10298 * output.cc (Output_reloc::get_address): Change return type to
10299 Elf_Addr.
10300 * output.h (class Output_reloc): Update get_address declaration.
10301 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10302 for section addresses.
10303
55ba0940
ILT
103042008-05-09 Ian Lance Taylor <iant@google.com>
10305
10306 PR 6493
10307 * gold.cc (gold_nomem): Use return value of write.
10308
75517b77
ILT
103092008-05-08 Ian Lance Taylor <iant@google.com>
10310
10311 * symtab.c (Symbol::init_base_output_data): Add version
10312 parameter. Change all callers.
10313 (Symbol::init_base_output_segment): Likewise.
10314 (Symbol::init_base_constant): Likewise.
10315 (Symbol::init_base_undefined): Likewise.
10316 (Sized_symbol::init_output_data): Likewise.
10317 (Sized_symbol::init_output_segment): Likewise.
10318 (Sized_symbol::init_constant): Likewise.
10319 (Sized_symbol::init_undefined): Likewise.
10320 (Symbol_table::do_define_in_output_data): If the new symbol has a
10321 version, mark it as the default.
10322 (Symbol_table::do_define_in_output_segment): Likewise.
10323 (Symbol_table::do_define_as_constant): Likewise.
10324 * symtab.h (class Symbol): Update declarations.
10325 (class Sized_symbol): Likewise.
10326 * resolve.cc (Symbol::override_version): New function.
c42e122e 10327 (Symbol::override_base): Call override_version.
75517b77
ILT
10328 (Symbol::override_base_with_special): Likewise.
10329 * testsuite/ver_script_8.script: New file.
10330 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10331 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10332 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10333 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10334
f1f70eae
ILT
103352008-05-06 Ian Lance Taylor <iant@google.com>
10336
f3e9c5c5
ILT
10337 PR 6049
10338 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10339 functions.
10340 (class General_options): Remove existing --undefined, and add
10341 --no-undefined instead. Add new --undefined as synonym for -u.
10342 * archive.cc (Archive::add_symbols): Check whether symbol was
10343 named with -u.
10344 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10345 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10346 all uses. Add IS_UNDEFINED. Update declarations to split
10347 different versions of init_base. Declare init_base_undefined.
10348 (Symbol::is_defined): Handle IS_UNDEFINED.
10349 (Symbol::is_undefined): Likewise.
10350 (Symbol::is_weak_undefined): Call is_undefined.
10351 (Symbol::is_absolute): Handle IS_CONSTANT.
10352 (class Sized_symbol): Update declarations to split different
10353 versions of init. Declare init_undefined.
10354 (class Symbol_table): Declare new functions.
10355 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10356 Change all callers.
10357 (Symbol::init_base_output_data): Likewise.
10358 (Symbol::init_base_output_segment): Likewise.
10359 (Symbol::init_base_constant): Likewise.
10360 (Symbol::init_base_undefined): New function.
10361 (Sized_symbol::init_object): Rename from init. Change all
10362 callers.
10363 (Sized_symbol::init_output_data): Likewise.
10364 (Sized_symbol::init_output_segment): Likewise.
10365 (Sized_symbol::init_constant): Likewise.
10366 (Sized_symbol::init_undefined): New function.
10367 (Symbol_table::add_undefined_symbols_from_command_line): New
10368 function.
10369 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10370 function.
10371 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10372 (Symbol::output_section): Likewise.
10373 (Symbol::set_output_section): Likewise.
10374 (Symbol_table::sized_finalize_symbol): Likewise.
10375 (Symbol_table::sized_write_globals): Likewise.
10376 * resolve.cc (Symbol_table::should_override): Likewise.
10377 (Symbol::override_base_with_special): Likewise.
10378
8bdcdf2c
ILT
10379 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10380 symbol, change it to have default visibility.
10381 * testsuite/protected_1.cc: New file.
10382 * testsuite/protected_2.cc: New file.
10383 * testsuite/protected_3.cc: New file.
10384 * testsuite/protected_main_1.cc: New file.
10385 * testsuite/protected_main_2.cc: New file.
10386 * testsuite/protected_main_3.cc: New file.
10387 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10388 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10389 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10390 (protected_1.so): New target.
10391 (protected_1_pic.o, protected_2_pic.o): New targets.
10392 (protected_3_pic.o): New target.
10393 (check_PROGRAMS): Add protected_2.
10394 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10395 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10396 * testsuite/Makefile.in: Rebuild.
10397
2b706932
ILT
10398 * options.h (DEFINE_var): Add set_user_set_##varname__.
10399 (DEFINE_bool_alias): New macro.
10400 (class General_options): Define -Bstatic using DEFINE_bool_alias
10401 rather than DEFINE_special. Add --undefined as an alias for -z
10402 defs.
10403 * options.cc (General_options::parse_Bstatic): Remove.
10404
d82a5bcc
ILT
10405 * options.h (class General_options): Add --fatal-warnings.
10406 * main.cc (main): Implement --fatal-warnings.
10407 * errors.h (Errors::warning_count): New function.
10408
f1f70eae
ILT
10409 * options.h (class General_options): Add -Bsymbolic-functions.
10410 * symtab.h (Symbol::is_preemptible): Check for
10411 -Bsymbolic-functions.
10412
8825ac63
ILT
104132008-05-05 Ian Lance Taylor <iant@google.com>
10414
d98bc257
ILT
10415 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10416 as noVARNAME rather than no-VARNAME.
10417 (class General_options): Add option -z combreloc.
10418 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10419 get_address.
10420 (Output_reloc::sort_before) [SHT_REL]: New function.
10421 (Output_reloc::sort_before) [SHT_RELA]: New function.
10422 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10423 Sort_relocs_comparison.
10424 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10425 parameter. Change all callers.
10426 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10427 sort_relocs parameter. Change all callers.
10428 * output.cc (Output_reloc::get_address): New function, broken out
10429 of write_rel.
10430 (Output_reloc::write_rel): Call it.
10431 (Output_reloc::compare): New function.
10432 (Output_data_reloc_base::do_write): Optionally sort relocs.
10433
60b2b4e7
ILT
10434 * configure.ac: If targ_extra_obj is set, link it in.
10435 * configure.tgt: Initialize all variables.
10436 (x86_64*): Set targ_extra_obj and targ_extra_size.
10437 * configure: Rebuild.
10438
8825ac63
ILT
10439 * object.cc (Sized_relobj::include_section_group): Adjust section
10440 indexes read from group data. Build vector to pass to
10441 layout_group.
10442 * layout.cc (Layout::layout_group): Add flags and shndxes
10443 parameters. Remove contents parameter. Change caller. Update
10444 explicit instantiations.
10445 * layout.h (class Layout): Update layout_group declaration.
10446 * output.cc (Output_data_group::Output_data_group): Add flags and
10447 input_shndxes parameters. Remove contents parameter. Change
10448 caller.
10449 (Output_data_group::do_write): Change input_sections_ to
10450 input_shndxes_.
10451 * output.h (class Output_data_group): Update constructor
10452 declaration. Rename input_sections_ to input_shndxes_.
10453 * testsuite/many_sections_test.cc: Add template.
10454
e94cf127
CC
104552008-04-30 Cary Coutant <ccoutant@google.com>
10456
4418b2d5
CC
10457 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10458
e94cf127
CC
10459 * layout.cc (Layout::include_section): Refactored check for debug
10460 info section.
10461 (Layout::add_comdat): Add new parameters. Change type
10462 of signature parameter. Add object and shndx to signatures table.
10463 (Layout::find_kept_object): New function.
10464 * layout.h: Include <cstring>.
10465 (Layout::is_debug_info_section): New function.
10466 (Layout::add_comdat): Add new parameters.
10467 (Layout::find_kept_object): New function.
10468 (Layout::Kept_section): New struct.
10469 (Layout::Signatures): Change type of map range.
10470 * object.cc (Relobj::output_section_address): New function.
10471 (Sized_relobj::include_section_group): Add new parameters. Change
10472 calls to Layout::add_comdat. Change to build table of kept comdat
10473 groups and table mapping discarded sections to kept sections.
10474 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10475 (Sized_relobj::do_layout): Change calls to include_section_group and
10476 include_linkonce_section.
10477 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10478 value to zero when section is discarded.
10479 (Sized_relobj::map_to_kept_section): New function.
10480 * object.h (Relobj::output_section_address): New function.
10481 (Relobj::Comdat_group): New type.
10482 (Relobj::find_comdat_group): New function.
10483 (Relobj::Comdat_group_table): New type.
10484 (Relobj::Kept_comdat_section): New type.
10485 (Relobj::Kept_comdat_section_table): New type.
10486 (Relobj::add_comdat_group): New function.
10487 (Relobj::set_kept_comdat_section): New function.
10488 (Relobj::get_kept_comdat_section): New function.
10489 (Relobj::comdat_groups_): New field.
10490 (Relobj::kept_comdat_sections_): New field.
10491 (Symbol_value::input_value): Update comment.
10492 (Sized_relobj::map_to_kept_section) New function.
10493 (Sized_relobj::include_linkonce_section): Add new parameter.
10494 * target-reloc.h (Comdat_behavior): New type.
10495 (get_comdat_behavior): New function.
10496 (relocate_section): Add code to map a discarded section to the
10497 corresponding kept section when applying a relocation.
10498
e4e5049b
CS
104992008-04-30 Craig Silverstein <csilvers@google.com>
10500
10501 * dwarf_reader.cc (next_generation_count): New static var.
10502 (Addr2line_cache_entry): New struct.
10503 (addr2line_cache): New static var.
10504 (Dwarf_line_info::one_addr2line): Added caching.
10505 (Dwarf_line_info::clear_addr2line_cache): New function.
10506 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10507 cache-size parameter.
10508 (Dwarf_line_info::one_addr2line_cache): New function.
10509 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10510 new cache-size argument to one_addr2line(), and clear cache.
10511
d09e9154
CC
105122008-04-28 Cary Coutant <ccoutant@google.com>
10513
10514 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10515 R_386_PC8 relocations.
10516
7ef73768
ILT
105172008-04-23 Ian Lance Taylor <iant@google.com>
10518
55438702
ILT
10519 * object.cc (Sized_relobj::include_section_group): Check for
10520 invalid section group.
10521
c165fb93
ILT
10522 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10523 header size.
10524
7ef73768
ILT
10525 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10526 than read for file header.
10527 * archive.cc (Archive::include_member): Likewise.
10528
6194aaab
L
105292008-04-23 Paolo Bonzini <bonzini@gnu.org>
10530
10531 * aclocal.m4: Regenerate.
10532 * configure: Regenerate.
10533
d491d34e
ILT
105342008-04-19 Ian Lance Taylor <iant@google.com>
10535
5ea2bac6
ILT
10536 * version.cc (version_string): Bump to 1.6.
10537
7bc3e21a
ILT
10538 * testsuite/Makefile.am (many_sections_r_test): New target.
10539 (many_sections_r_test_SOURCES): Remove.
10540 (many_sections_r_test_DEPENDENCIES): Remove.
10541 (many_sections_r_test_LDFLAGS): Remove.
10542 (many_sections_r_test_LDADD): Remove.
10543
7fcd3aa9
ILT
10544 * object.cc (Sized_relobj::do_add_symbols): Always pass
10545 local_symbol_count_ to add_from_relobj.
10546
4c94d6ae
ILT
10547 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10548 every thousand variables.
10549 * testsuite/Makefile.in: Rebuild.
10550
d491d34e
ILT
10551 * object.cc (Xindex::initialize_symtab_xindex): New function.
10552 (Xindex::read_symtab_xindex): New function.
10553 (Xindex::sym_xindex_to_shndx): New function.
10554 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10555 available.
10556 (Sized_relobj::do_initialize_xindex): New function.
10557 (Sized_relobj::do_read_symbols): Adjust section links.
10558 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10559 parameter. Change all callers.
10560 (Sized_relobj::include_section_group): Adjust section links and
10561 symbol section indexes.
10562 (Sized_relobj::do_layout): Adjust section links.
10563 (Sized_relobj::do_count_local_symbols): Adjust section links and
10564 symbol section indexes.
10565 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10566 ordinary and special symbols.
10567 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10568 dynsym_xindex parameters. Change all callers. Adjust section
10569 links. Use SHN_XINDEX when needed.
10570 (Sized_relobj::get_symbol_location_info): Adjust section links.
10571 Don't get fooled by special symbols.
10572 * object.h (class Xindex): Define.
10573 (class Object): Add xindex_ parameter. Declare virtual functoin
10574 do_initialize_xindex.
10575 (Object::adjust_sym_shndx): New function.
10576 (Object::set_xindex): New protected function.
10577 (class Symbol_value): Add is_ordinary_shndx_ field.
10578 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10579 (Symbol_value::value): Assert ordinary section.
10580 (Symbol_value::initialize_input_to_output_map): Likewise.
10581 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10582 Change all callers.
10583 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10584 all callers.
10585 (class Sized_relobj): Update declarations.
10586 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10587 parameter. Change all callers.
10588 (Sized_relobj::adjust_shndx): New function.
10589 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10590 field.
10591 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10592 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10593 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10594 (Sized_dynobj::read_dynsym_section): Adjust section links.
10595 (Sized_dynobj::read_dynamic): Likewise.
10596 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10597 section links.
10598 (Sized_dynobj::do_initialize_xindex): New function.
10599 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10600 do_initialize_xindex.
10601 (Sized_dynobj::adjust_shndx): New function.
10602 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10603 dynsym_xindex_ fields.
10604 (Layout::finalize): Add a call to set_section_indexes before
10605 creating the symtab sections.
10606 (Layout::set_section_indexes): Don't do anything if the section
10607 already has a section index.
10608 (Layout::create_symtab_sections): Add shnum parameter. Change
10609 caller. Create .symtab_shndx section if needed.
10610 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10611 caller.
10612 (Layout::allocated_output_section_count): New function.
10613 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10614 needed.
10615 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10616 fields. Update declarations.
10617 (Layout::symtab_xindex): New function.
10618 (Layout::dynsym_xindex): New function.
10619 (class Write_symbols_task): Add layout_ field.
10620 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10621 Change caller.
10622 * output.cc (Output_section_headers::Output_section_headers): Add
10623 shstrtab_section parameter. Change all callers.
10624 (Output_section_headers::do_sized_write): Store overflow values
10625 for section count and section string table section index in
10626 section header zero.
10627 (Output_file_header::do_sized_write): Check for overflow of
10628 section count and section string table section index.
10629 (Output_symtab_xindex::do_write): New function.
10630 (Output_symtab_xindex::endian_do_write): New function.
10631 * output.h (class Output_section_headers): Add shstrtab_section_.
10632 Update declarations.
10633 (class Output_symtab_xindex): Define.
10634 (Output_section::has_out_shndx): New function.
10635 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10636 field.
10637 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10638 Change all callers.
10639 (Sized_symbol::init): Likewise.
10640 (Symbol::output_section): Check for ordinary symbol.
10641 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10642 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10643 callers.
10644 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10645 Change all callers. Simplify handling of symbols from sections
10646 not included in the link.
10647 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10648 distinction.
10649 (Weak_alias_sorter::operator()): Assert that symbols are
10650 ordinary.
10651 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10652 distinction.
10653 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10654 parameters. Change all callers.
10655 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10656 symbol distinction. Use SHN_XINDEX when needed.
10657 (Symbol_table::write_section_symbol): Add symtab_xindex
10658 parameter. Change all callers.
10659 (Symbol_table::sized_write_section_symbol): Likewise. Use
10660 SHN_XINDEX when needed.
10661 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10662 declarations.
10663 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10664 (Symbol::is_defined): Check is_ordinary.
10665 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10666 (Symbol::is_absolute, Symbol::is_common): Likewise.
10667 (class Sized_symbol): Update declarations.
10668 (class Symbol_table): Update declarations.
10669 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10670 parameters. Change all callers.
10671 (Sized_symbol::override): Likewise.
10672 (Symbol_table::override): Likewise.
10673 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10674 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10675 is_ordinary, and orig_st_shndx parameters. Change all callers.
10676 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10677 to be in an ordinary section.
10678 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10679 object and is_ordinary parameters. Change all callers.
10680 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10681 Change all callers. Don't add undefined or non-ordinary symbols
10682 to reloc_map_.
10683 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10684 Change all callers.
10685 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10686 declarations.
10687 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10688 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10689 (Sized_relobj::relocate_sections): Likewise.
10690 * target-reloc.h (scan_relocs): Adjust section symbol index.
10691 (scan_relocatable_relocs): Likewise.
10692 * i386.cc (Scan::local): Check for ordinary symbols.
10693 * sparc.cc (Scan::local): Likewise.
10694 * x86_64.cc (Scan::local): Likewise.
10695 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10696 to symbol_section_and_value.
10697 * testsuite/many_sections_test.cc: New file.
10698 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10699 (check_PROGRAMS): Add many_sections_test.
10700 (many_sections_test_SOURCES): Define.
10701 (many_sections_test_DEPENDENCIES): Define.
10702 (many_sections_test_LDFLAGS): Define.
10703 (BUILT_SOURCES): Add many_sections_define.h.
10704 (many_sections_define.h): New target.
10705 (BUILT_SOURCES): Add many_sections_check.h.
10706 (many_sections_check.h): New target.
10707 (check_PROGRAMS): Add many_sections_r_test.
10708 (many_sections_r_test_SOURCES): Define.
10709 (many_sections_r_test_DEPENDENCIES): Define.
10710 (many_sections_r_test_LDFLAGS): Define.
10711 (many_sections_r_test_LDADD): Define.
10712 (many_sections_r_test.o): New target.
10713 * testsuite/Makefile.in: Rebuild.
10714
c5818ff1
CC
107152008-04-17 Cary Coutant <ccoutant@google.com>
10716
10717 * errors.cc (Errors::info): New function.
10718 (gold_info): New function.
10719 * errors.h (Errors::info): New function.
10720 * gold.h (gold_info): New function.
10721 * object.cc (Input_objects::add_object): Print trace output.
10722 * options.cc (options::parse_set): New function.
10723 (General_options::parse_wrap): Deleted.
10724 (General_options::General_options): Deleted initializer.
10725 * options.h (options::String_set): New typedef.
10726 (options::parse_set): New function.
10727 (DEFINE_set): New macro.
10728 (General_options::wrap): Changed to use DEFINE_set. Changed
10729 callers of any_wrap_symbols and is_wrap_symbol.
10730 (General_options::trace, General_options::trace_symbol):
10731 New options.
10732 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10733 (General_options::wrap_symbols_): Deleted.
10734 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10735
b5be4a7c
DM
107362008-04-17 David S. Miller <davem@davemloft.net>
10737
10738 * options.cc (General_options::parse_V): New function.
10739 * options.h: Add entries for -V and -Qy.
10740
155a0dd7
ILT
107412008-04-17 Ian Lance Taylor <iant@google.com>
10742
10743 * common.cc (Symbol_table::allocate_commons): Remove options
10744 parameter. Change caller.
10745 (Symbol_table::do_allocate_commons): Remove options parameter.
10746 Change caller. Just call do_allocate_commons_list twice.
10747 (Symbol_table::do_allocate_commons_list): New function, broken out
10748 of do_allocate_commons.
10749 * common.h (class Allocate_commons_task): Remove options_ field.
10750 Update constructor.
10751 * symtab.cc (Symbol_table::Symbol_table): Initialize
10752 tls_commons_.
10753 (Symbol_table::add_from_object): Put TLS common symbols on
10754 tls_commons_ list.
10755 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10756 which are IN_OUTPUT_DATA.
10757 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10758 allocate_commons and do_allocate_commons declarations. Declare
10759 do_allocate_commons_list.
10760 * gold.cc (queue_middle_tasks): Update creation of
10761 Allocate_commons_task to not pass options.
10762 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10763 (TLS_TEST_C_FLAGS): New variable.
10764 (tls_test_c_pic.o): New target.
10765 (tls_test_shared.so): Link in tls_test_c_pic.o.
10766 (tls_test_c_pic_ie.o): New target.
10767 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10768 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10769 (tls_test_c.o): New target.
10770 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10771 (tls_pic_test_LDADD): Likewise.
10772 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10773 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10774 (tls_test_c_gnu2.o): New target.
10775 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10776 tls_test_c_gnu2.o.
10777 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10778 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10779 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10780 * testsuite/tls_test.cc: Include "config.h".
10781 (t_last): Call t11_last.
10782 * testsuite/tls_test.h (t11, t11_last): Declare.
10783 * testsuite/tls_test_c.c: New file.
10784 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10785 * configure.ac: Check for OpenMP support.
10786 * configure, config.in, Makefile.in: Rebuild.
10787 * testsuite/Makefile.in: Rebuild.
10788
edfbb029
CC
107892008-04-16 Cary Coutant <ccoutant@google.com>
10790
10791 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10792 (Target_i386::tls_base_symbol_defined_): New field.
10793 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10794 (Target_i386::Scan::global): Likewise.
10795 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10796 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10797 (Target_x86_64::tls_base_symbol_defined_): New field.
10798 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10799 (Target_x86_64::Scan::global): Likewise.
10800
f3c69fca
CC
108012008-04-16 Cary Coutant <ccoutant@google.com>
10802
10803 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10804 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10805 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10806 building shared libraries.
10807 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10808 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10809 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10810 * testsuite/Makefile.in: Rebuild.
10811 * testsuite/weak_undef.h: New file.
10812 * testsuite/weak_undef_file1.cc: Add extra test cases.
10813 * testsuite/weak_undef_file2.cc: Likewise.
10814 * testsuite/weak_undef_test.cc: Likewise.
10815
7c414435
DM
108162008-04-16 David S. Miller <davem@davemloft.net>
10817
32b769e1
DM
10818 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10819 Add issued_non_pic_error_ field. Declare check_non_pic.
10820 (Target_sparc::Scan::check_non_pic): New function.
10821 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10822 (Target_sparc::Scan::global): Likewise.
10823
11936fb1
DM
10824 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10825 * configure: Rebuild.
10826
7c414435
DM
10827 * options.h (DEFINE_enable): New macro.
10828 (new_dtags): New enable option.
10829 (initfirst, interpose, loadfltr, nodefaultlib,
10830 nodelete, nodlopen, nodump): New -z options.
10831 * layout.cc (Layout:finish_dynamic_section): If new
10832 dtags enabled, emit DT_RUNPATH. Also, emit a
10833 DT_FLAGS_1 containing any specified -z flags.
10834
85c7bf8b
ILT
108352008-04-16 Ian Lance Taylor <iant@google.com>
10836
12c0daef
ILT
10837 * copy-relocs.cc: New file.
10838 * copy-relocs.h: New file.
10839 * reloc.cc: Remove Copy_relocs code.
10840 * reloc.h: Likewise.
10841 * reloc-types.h (struct Reloc_types) [both versions]: Add
10842 get_reloc_addend_noerror.
10843 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10844 variants of add_global which take an addend which must be zero.
10845 * i386.cc: Include "copy-relocs.h".
10846 (class Target_i386): Change type of copy_relocs_ to variable,
10847 update initializer.
10848 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10849 Change all callers.
10850 (Target_i386::do_finalize_sections): Change handling of
10851 copy_relocs_.
10852 * sparc.cc: Include "copy-relocs.h".
10853 (class Target_sparc): Change type of copy_relocs_ to variable,
10854 update initializer.
10855 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10856 Change all callers.
10857 (Target_sparc::do_finalize_sections): Change handling of
10858 copy_relocs_.
10859 * x86_64.cc: Include "copy-relocs.h".
10860 (class Target_x86_64): Change type of copy_relocs_ to variable,
10861 update initializer.
10862 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10863 class. Change all callers.
10864 (Target_x86_64::do_finalize_sections): Change handling of
10865 copy_relocs_.
10866 * Makefile.am (CCFILES): Add copy-relocs.cc.
10867 (HFILES): Add copy-relocs.h.
10868
4f4995b6
ILT
10869 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10870
85c7bf8b
ILT
10871 * testsuite/script_test_4.sh: Permit leading zeroes.
10872
4f2a9edd
ILT
108732008-04-15 Ian Lance Taylor <iant@google.com>
10874
e6188289
ILT
10875 * script-sections.cc (Script_sections::create_segments): Use
10876 header_size_adjustment even when there is enough room for the
10877 headers.
10878 * testsuite/script_test_4.sh: New file.
10879 * testsuite/script_test_4.t: New file.
10880 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10881 (check_DATA): Add script_test_4.stdout.
10882 (MOSTLYCLEANFILES): Likewise.
10883 (script_test_4): New target.
10884 (script_test_4.stdout): New target.
10885 * testsuite/Makefile.in: Rebuild.
10886
4f2a9edd
ILT
10887 * sparc.cc: Add definitions for Output_data_plt_sparc class
10888 constants.
10889
f5314dd5
DM
108902008-04-14 David S. Miller <davem@davemloft.net>
10891
10892 * sparc.cc: New file.
10893 * Makefile.am (TARGETSOURCES): Add sparc.cc
10894 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10895 * configure.tgt: Document targ_extra_size and
10896 targ_extra_big_endian. Add entries for sparc-* and
10897 sparc64-*.
10898 * configure.ac: Handle targ_extra_size and
10899 targ_extra_big_endian.
10900 * Makefile.in: Rebuild.
10901 * configure: Likewise.
10902 * po/POTFILES.in: Likewise.
10903 * po/gold.pot: Likewise.
10904
154e0e9a
ILT
109052008-04-14 Ian Lance Taylor <iant@google.com>
10906
10907 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10908 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10909 in the name/type/flags to section mapping. Don't call
10910 allocate_output_section.
10911 (Layout::choose_output_section): Change parameter from adjust_name
10912 to is_input_section. Don't permit input sections after sections
10913 are attached to segments. Don't call allocate_output_section.
10914 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10915 not write_enable_output_section.
10916 (Layout::make_output_section): Don't push to
10917 unattached_section_list_ nor call attach_to_segment. Call
10918 attach_section_to_segment if sections are attached.
10919 (Layout::attach_sections_to_segments): New function.
10920 (Layout::attach_section_to_segment): New function.
10921 (Layout::attach_allocated_section_to_segment): Rename from
10922 attach_to_segment. Remove flags parameter.
10923 (Layout::allocate_output_section): Remove function.
10924 (Layout::write_enable_output_section): Remove function.
10925 * layout.h (class Layout): Update for above changes. Add new
10926 field sections_are_attached_.
10927 * output.h (Output_section::update_flags_for_input_section): New
10928 function.
10929 * output.cc (Output_section::add_input_section): Call
10930 update_flags_for_input_section.
10931 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10932
009a67a2
CC
109332008-04-11 Cary Coutant <ccoutant@google.com>
10934
10935 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10936 thought unnecessary.
10937 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10938
759b1a24
ILT
109392008-04-11 Ian Lance Taylor <iant@google.com>
10940
10941 * output.h (class Output_section_data): Remove inline definition
10942 of set_addralign.
10943 * output.cc (Output_section_data::set_addralign): New function.
10944
c2b45e22
CC
109452008-04-11 Cary Coutant <ccoutant@google.com>
10946
10947 Add support for TLS descriptors for i386 and x86_64.
10948 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10949 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10950 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10951 GOT_TYPE_TLS_DESC.
10952 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10953 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10954 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10955 relocations.
10956 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10957 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10958 Fix problem with initial-exec relocations.
10959 (Target_i386::Relocate::relocate_tls): Likewise.
10960 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10961 relaxation.
10962 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10963 support for section-plus-offset dynamic table entries.
10964 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10965 (Output_data_dynamic::Dynamic_entry): Add support for
10966 section-plus-offset dynamic table entries.
10967 (Output_data_dynamic::Classification): Likewise.
10968 (Output_data_dynamic::classification_): Renamed offset_.
10969 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10970 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10971 (Target_x86_64::make_plt_section): New function.
10972 (Target_x86_64::reserve_tlsdesc_entries): New function.
10973 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10974 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10975 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10976 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10977 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10978 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10979 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10980 add extra PLT entry for TLS descriptors.
10981 (Output_data_plt_x86_64::got_): New field.
10982 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10983 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10984 fields.
10985 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10986 descriptors.
10987 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10988 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10989 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10990 R_386_TLS_DESC_CALL relocations.
10991 (Target_x86_64::Scan::global): Likewise.
10992 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10993 for TLS descriptors.
10994 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10995 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10996 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10997 GD-to-IE relaxation.
10998 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10999 and TLS_DESCRIPTORS.
11000 * Makefile.in: Rebuild.
11001 * configure: Rebuild.
11002 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
11003 (tls_test_shared2.so): New target.
11004 (tls_shared_gd_to_ie_test_SOURCES): New variable.
11005 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
11006 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
11007 (tls_shared_gd_to_ie_test_LDADD): New variable.
11008 (tls_shared_gnu2_gd_to_ie_test): New target.
11009 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
11010 New targets.
11011 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
11012 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
11013 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
11014 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
11015 (tls_shared_gnu2_test): New target.
11016 (tls_test_gnu2_shared.so): New target.
11017 (tls_shared_gnu2_test_SOURCES): New variable.
11018 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
11019 (tls_shared_gnu2_test_LDFLAGS): New variable.
11020 (tls_shared_gnu2_test_LDADD): New variable.
11021 * testsuite/Makefile.in: Rebuild.
11022 * testsuite/Makefile.
11023
83bfb6b7
ILT
110242008-04-11 Ian Lance Taylor <iant@google.com>
11025
11026 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
11027 justsyms.t.
11028 * testsuite/Makefile.in: Rebuild.
11029
11030 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
11031 long.
11032 * testsuite/script_test_2.cc (main): Adjust test.
11033
706e1f5e
ILT
110342008-04-11 David S. Miller <davem@davemloft.net>
11035 Ian Lance Taylor <iant@google.com>
11036
11037 * options.h (General_options): Add entries for '-Y' and
11038 '-relax'.
11039 * options.cc (General_options:finalize): If -Y was used, add those
11040 entries to the library path instead of the default "/lib" and
11041 "/usr/lib".
11042
7c98e6bb
DM
110432008-04-11 David S. Miller <davem@davemloft.net>
11044
11045 * testsuite/justsyms.t: Start at 0x100.
11046 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
11047 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
11048 long.
11049 * testsuite/script_test_2.cc: Adjust string and section length
11050 checks.
7c98e6bb 11051
99a37bfd
ILT
110522008-04-09 Ian Lance Taylor <iant@google.com>
11053
2cefc357
ILT
11054 PR gold/5996
11055 * script-sections.cc (Sections_element::allocate_to_segment): Add
11056 orphan parameter.
11057 (Output_section_definition::allocate_to_segment): Likewise.
11058 (Orphan_output_section::allocate_to_segment): Likewise.
11059 (Script_sections::attach_sections_using_phdrs_clause): Don't
11060 propagate non-PT_LOAD segments to orphan sections.
11061 * testsuite/Makefile.am (script_test_3.stdout): Generate using
11062 readelf rather than objdump.
11063 * testsuite/script_test_3.sh: Adjust accordingly. Test that
11064 .interp section and PT_INTERP segment are the same size.
11065 * testsuite/Makefile.in: Rebuild.
11066
99a37bfd
ILT
11067 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
11068 aliases for symbols defined in the same object.
11069 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
11070 (weak_alias_test_SOURCES): New variable.
11071 (weak_alias_test_DEPENDENCIES): New variable.
11072 (weak_alias_test_LDFLAGS): New variable.
11073 (weak_alias_test_LDADD): New variable.
11074 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11075 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11076 (weak_alias_test_3.o): New target.
11077 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11078 * testsuite/weak_alias_test_main.cc: New file.
11079 * testsuite/weak_alias_test_1.cc: New file.
11080 * testsuite/weak_alias_test_2.cc: New file.
11081 * testsuite/weak_alias_test_3.cc: New file.
11082
780e49c5
ILT
110832008-04-08 Ian Lance Taylor <iant@google.com>
11084
cdb0b8f5
ILT
11085 * options.h (class General_options): Add --noinhibit-exec option.
11086 * main.cc (main): Check --noinhibit-exec.
11087
0864d551
ILT
11088 * options.h (class General_options): Define --wrap as a special
11089 option. Add wrap_symbols_ field.
11090 (General_options::any_wrap_symbols): New function.
11091 (General_options::is_wrap_symbol): New function.
11092 * options.cc (General_options::parse_wrap): New function.
11093 (General_options::General_options): Initialize wrap_symbols_.
11094 * symtab.cc (Symbol_table::wrap_symbol): New function.
11095 (Symbol_table::add_from_object): Handle --wrap.
11096 * symtab.h (class Symbol_table): Declare wrap_symbol.
11097 * target.h (Target::wrap_char): New function.
11098 (Target::Target_info): Add wrap_char field.
11099 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11100 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11101 * testsuite/testfile.cc (Target_test::test_target_info):
11102 Likewise.
11103
789aa6de
ILT
11104 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11105 there is one.
11106
2c38906f
ILT
11107 * layout.h (class Layout): Add added_eh_frame_data_ field.
11108 * layout.cc (Layout::Layout): Initialize new field.
11109 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11110 output section until we find a section we merged successfully.
11111 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11112 that the size be non-zero.
11113
780e49c5
ILT
11114 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11115 qualifier.
11116
7fcd0256
ILT
111172008-04-08 Craig Silverstein <csilvers@google.com>
11118
11119 * configure.ac: Export new conditional variable HAVE_ZLIB.
11120 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11121 on HAVE_ZLIB.
11122 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11123 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11124
6835af53
ILT
111252008-04-07 Ian Lance Taylor <iant@google.com>
11126
e24f324c
ILT
11127 * version.cc (version_string): Set to "1.5".
11128
a036edd8
ILT
11129 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11130 Add issued_non_pic_error_ field. Declare check_non_pic.
11131 (Target_x86_64::Scan::check_non_pic): New function.
11132 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11133 (Target_x86_64::Scan::global): Likewise.
11134
624f8810
ILT
11135 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11136 addend parameter. Change caller. Handle merge sections.
11137 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11138 Address to Addend. Don't add in the result of
11139 local_section_offset, pass down the addend and use the returned
11140 value.
11141 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11142 Update declarations of local_section_offset and symbol_value.
11143 * testsuite/two_file_test_1.cc (t18): New function.
11144 * testsuite/two_file_test_2.cc (f18): New function.
11145 * testsuite/two_file_test_main.cc (main): Call t18.
11146 * testsuite/two_file_test.h (t18, f18): Declare.
11147
6835af53
ILT
11148 * configure.ac: Don't test for objdump, c++filt, or readelf.
11149 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11150 conditionals.
11151 (TEST_READELF): New variable.
11152 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11153 (check_PROGRAMS): Add two_file_strip_test.
11154 (two_file_strip_test): New target.
11155 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11156 (two_file_same_shared_strip_test_SOURCES): New variable.
11157 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11158 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11159 (two_file_same_shared_strip_test_LDADD): New variable.
11160 (two_file_shared_strip.so): New target.
11161 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11162 (ver_test_5.syms, ver_test_7.syms): Likewise.
11163 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11164 (strip_test_3.stdout): Use TEST_OBJDUMP.
11165 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11166
86925eef
CC
111672008-04-04 Cary Coutant <ccoutant@google.com>
11168
11169 * symtab.h (Symbol::is_weak_undefined): New function.
11170 (Symbol::is_strong_undefined): New function.
11171 (Symbol::is_absolute): New function.
11172 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11173 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11174 absolute symbols.
11175 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11176 (weak_undef_test): New target.
11177 * testsuite/Makefile.in: Rebuild.
11178 * testsuite/weak_undef_file1.cc: New file.
11179 * testsuite/weak_undef_file2.cc: New file.
11180 * testsuite/weak_undef_test.cc: New file.
11181
126f3ece
ILT
111822008-04-03 Craig Silverstein <csilvers@google.com>
11183
11184 * compressed_output.h (class Output_compressed_section): Use
11185 unsigned buffer.
11186 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11187 add zlib header.
11188 (zlib_compressed_suffix): Removed.
11189 (Output_compressed_section::set_final_data_size): Use unsigned
11190 buffers.
11191 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11192 Fix linker invocation.
11193 (flagstest_o_specialfile_and_compress_debug_sections):
11194 Likewise.
11195 * testsuite/Makefile.in: Regenerated.
11196
deae2a14
DM
111972008-04-02 David S. Miller <davem@davemloft.net>
11198
11199 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11200 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11201
70752818
ILT
112022008-04-02 Craig Silverstein <csilvers@google.com>
11203
11204 * TODO: New file.
11205
39d0cb0e
ILT
112062008-04-02 Ian Lance Taylor <iant@google.com>
11207
11208 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11209 parameters. Update for new key type to views_. Change all
11210 callers.
11211 (File_read::read): Adjust for byteshift in returned view.
11212 (File_read::add_view): New function, broken out of
11213 find_and_make_view.
11214 (File_read::make_view): New function, broken out of
11215 find_and_make_view.
11216 (File_read::find_or_make_view): Add offset and aligned
11217 parameters. Rewrite accordingly. Change all callers.
11218 (File_read::get_view): Add offset and aligned parameters. Adjust
11219 for byteshift in return value.
11220 (File_read::get_lasting_view): Likewise.
11221 * fileread.h (class File_read): Update declarations.
11222 (class File_read::View): Add byteshift_ field. Add byteshift to
11223 constructor. Add byteshift method.
11224 * archive.h (Archive::clear_uncached_views): New function.
11225 (Archive::get_view): Add aligned parameter. Change all callers.
11226 * object.h (Object::get_view): Add aligned parameter. Change all
11227 callers.
11228 (Object::get_lasting_view): Likewise.
11229
11230 * fileread.cc (File_read::release): Don't call clear_views if
11231 there are multiple objects.
11232 * fileread.h (File_read::clear_uncached_views): New function.
11233 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11234 on the archive.
11235
a1207466
CC
112362008-03-31 Cary Coutant <ccoutant@google.com>
11237
11238 Add thin archive support.
11239 * archive.cc (Archive::armagt): New const.
11240 (Archive::setup): Remove task parameter and calls to unlock.
11241 (Archive::unlock_nested_archives): New function.
11242 (Archive::read_header): Add nested_off parameter. Change
11243 all callers.
11244 (Archive::interpret_header): Likewise.
11245 (Archive::include_all_members): Change to handle thin
11246 archives.
11247 (Archive::include_member): Likewise.
11248 * archive.h (Archive::Archive): Add new parameters and
11249 initializers.
11250 (Archive::armagt): New const.
11251 (Archive::setup): Remove task parameter.
11252 (Archive::unlock_nested_archives): New function.
11253 (Archive::read_header): Add nested_off parameter.
11254 (Archive::interpret_header): Likewise.
11255 (Archive::Nested_archive_table): New typedef.
11256 (Archive::is_thin_archive_): New field.
11257 (Archive::nested_archives_): New field.
11258 (Archive::options_): New field.
11259 (Archive::dirpath_): New field.
11260 (Archive::task_): New field.
11261 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11262 for thin archives. Pass additional parameters to
11263 Archive::Archive. Unlock the archive file after calling
11264 Archive::setup.
cd536b21 11265
479f6503
ILT
112662008-03-29 Ian Lance Taylor <iant@google.com>
11267
686c8caf
ILT
11268 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11269 version symbol to be local.
11270 * testsuite/ver_test_4.sh: New file.
11271 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11272 (check_DATA): Add ver_test_4.syms.
11273 (ver_test_4.syms): New target.
11274 * testsuite/Makefile.in: Rebuild.
11275
ab794b6b
ILT
11276 * output.cc
11277 (Output_section::Input_section_sort_entry::has_priority): New
11278 function.
11279 (Output_section::Input_section_sort_entry::match_file_name): New
11280 function.
11281 (Output_section::Input_section_sort_entry::match_section_name):
11282 Remove.
11283 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11284 Remove.
11285 (Output_section::Input_section_sort_entry::match_section_file):
11286 Remove.
11287 (Output_section::Input_section_sort_compare::operator()): Rewrite
11288 using new Input_section_sort_entry functions. Sort crtbegin and
11289 crtend first. Sort sections with no priority before sections with
11290 a priority.
11291 * testsuite/initpri1.c (d3): Check j != 4.
11292 (cd5): New constructor/destructor function.
11293 (main): Check j != 2.
11294
479f6503
ILT
11295 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11296 new symbol when resolving, don't call set_is_default.
11297 * testsuite/ver_test_7.cc: New file.
11298 * testsuite/ver_test_7.sh: New file.
11299 * testsuite/Makefile.am (ver_test_7.so): New target.
11300 (ver_test_7.o): New target.
11301 (check_SCRIPTS): Add ver_test_7.sh.
11302 (check_DATA): Add ver_test_7.syms.
11303 (ver_test_7.syms): New target.
11304
2fd32231
ILT
113052008-03-28 Ian Lance Taylor <iant@google.com>
11306
11307 * layout.cc (Layout::layout): If we see an input section with a
11308 name that needs sorting, set the must_sort flag for the output
11309 section.
11310 (Layout::make_output_section): If the name of the output section
11311 indicates that it might require sorting, set the may_sort flag.
11312 * output.h (Output_section::may_sort_attached_input_sections): New
11313 function.
11314 (Output_section::set_may_sort_attached_input_sections): New
11315 function.
11316 (Output_section::must_sort_attached_input_sections): New
11317 function.
11318 (Output_section::set_must_sort_attached_input_sections): New
11319 function.
11320 (class Output_section): Declare Input_section_sort_entry. Define
11321 Input_section_sort_compare. Declare
11322 sort_attached_input_sections. Add new fields:
11323 may_sort_attached_input_sections_,
11324 must_sort_attached_input_sections_,
11325 attached_input_sections_are_sorted_.
11326 * output.cc (Output_section::Output_section): Initialize new
11327 fields.
11328 (Output_section::add_input_section): Add an entry to
11329 input_sections_ if may_sort or must_sort are true.
11330 (Output_section::set_final_data_size): Call
11331 sort_attached_input_sections if necessary.
11332 (Output_section::Input_section_sort_entry): Define new class.
11333 (Output_section::Input_section_sort_compare::operator()): New
11334 function.
11335 (Output_section::sort_attached_input_sections): New function.
11336 * configure.ac: Check whether the compiler supports constructor
11337 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11338 * testsuite/initpri1.c: New file.
11339 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11340 CONSTRUCTOR_PRIORITY.
11341 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11342 (initpri1_LDFLAGS): New variable.
11343 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11344
18e6b24e
ILT
113452008-03-27 Ian Lance Taylor <iant@google.com>
11346
49bdd526
ILT
11347 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11348 * testsuite/common_test_1.c: New file.
11349 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11350 (common_test_1_SOURCES): New variable.
11351 (common_test_1_DEPENDENCIES): New variable.
11352 (common_test_1_LDFLAGS): New variable.
11353
18e6b24e
ILT
11354 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11355 and commons_ correctly when NAME/VERSION does not override
11356 NAME/NULL.
11357 * testsuite/ver_test_6.c: New file.
11358 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11359 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11360 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11361
04bf7072
ILT
113622008-03-26 Ian Lance Taylor <iant@google.com>
11363
5871526f
ILT
11364 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11365 of an undefined symbol from a version script.
11366 * testsuite/Makefile.am (ver_test_5.so): New target.
11367 (ver_test_5.o): New target.
11368 (check_SCRIPTS): Add ver_test_5.sh.
11369 (check_DATA): Add ver_test_5.syms.
11370 (ver_test_5.syms): New target.
11371 * testsuite/ver_test_5.cc: New file.
11372 * testsuite/ver_test_5.script: New file.
11373 * testsuite/ver_test_5.sh: New file.
11374 * Makefile.in, testsuite/Makefile.in: Rebuild.
11375
04bf7072
ILT
11376 PR gold/5986
11377 Fix problems building gold with gcc 4.3.0.
11378 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11379 (gold_error_at_location, gold_warning_at_location): Use it.
11380 * configure.ac: Check whether we can compile and use a template
11381 function with a printf attribute.
11382 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11383 when jumping over bytes.
11384 * object.cc: Instantiate Object::read_section_data.
11385 * debug.h: Include <cstring>
11386 * dwarf_reader.cc: Include <algorithm>
11387 * main.cc: Include <cstring>.
11388 * options.cc: Include <cstring>.
11389 * output.cc: Include <cstring>.
11390 * script.cc: Include <cstring>.
11391 * script.h: Include <string>.
11392 * symtab.cc: Include <cstring> and <algorithm>.
11393 * target-select.cc: Include <cstring>.
11394 * version.cc: Include <string>.
11395 * testsuite/testmain.cc: Include <cstdlib>.
11396 * configure, config.in: Rebuild.
11397
874c5b28
ILT
113982008-03-25 Ian Lance Taylor <iant@google.com>
11399
819d6c3a
ILT
11400 * options.cc: Include "../bfd/bfdver.h".
11401 (options::help): Print bug reporting address.
11402
f4b2c6f5
ILT
11403 * version.cc (print_version): Adjust output for current value of
11404 BFD_VERSION_STRING.
11405
11406 * NEWS: New file.
11407
e96caa79
ILT
11408 * options.cc (options::help): Print list of supported targets.
11409 * target-select.h: Include <vector>.
11410 (class Target_selector): Make machine_, size_, and is_big_endian_
11411 fields const. Add bfd_name_ and instantiated_target_ fields.
11412 (Target_selector::Target_selector): Add bfd_name parameter.
11413 (Target_selector::recognize): Make non-virtual, call
11414 do_recognize.
11415 (Target_selector::recognize_by_name): Make non-virtual, call
11416 do_recognize_by_name.
11417 (Target_selector::supported_names): New function.
11418 (Target_selector::bfd_name): New function.
11419 (Target_selector::do_instantiate_target): New pure virtual
11420 function.
11421 (Target_selector::do_recognize): New virtual function.
11422 (Target_selector::do_recognize_by_name): New virtual function.
11423 (Target_selector::instantiate_target): New private function.
11424 (supported_target_names): Declare.
11425 * target-select.cc (Target_selector::Target_selector): Update for
11426 new parameter and fields.
11427 (select_target_by_name): Check that the name matches before
11428 calling recognize_by_name.
11429 (supported_target_names): New function.
11430 * i386.cc (class Target_selector_i386): Update Target_selector
11431 constructor call. Remove recognize and recognize_by_name. Add
11432 do_instantiate_target.
11433 * x86_64.cc (class Target_selector_x86_64): Likewise.
11434 * testsuite/testfile.cc (class Target_selector_test): Update for
11435 changes to Target_selector.
11436
874c5b28
ILT
11437 * README: Rewrite, with some notes on unsupported features.
11438
0a65a3a7
CC
114392008-03-24 Cary Coutant <ccoutant@google.com>
11440
11441 * i386.cc (Target_i386::Got_type): New enum declaration.
11442 (Target_i386::Scan::local): Updated callers of Output_data_got
11443 member functions.
11444 (Target_i386::Scan::global): Likewise.
11445 (Target_i386::Relocate::relocate): Likewise.
11446 (Target_i386::Relocate::relocate_tls): Likewise.
11447 * object.h (Got_offset_list): New class.
11448 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11449 (Sized_relobj::local_got_offset): Likewise.
11450 (Sized_relobj::set_local_got_offset): Likewise.
11451 (Sized_relobj::local_has_tls_got_offset): Removed.
11452 (Sized_relobj::local_tls_got_offset): Removed.
11453 (Sized_relobj::set_local_tls_got_offset): Removed.
11454 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11455 * output.cc (Output_data_got::add_global): Added got_type parameter.
11456 (Output_data_got::add_global_with_rel): Likewise.
11457 (Output_data_got::add_global_with_rela): Likewise.
11458 (Output_data_got::add_global_pair_with_rel): New function.
11459 (Output_data_got::add_global_pair_with_rela): New function.
11460 (Output_data_got::add_local): Added got_type parameter.
11461 (Output_data_got::add_local_with_rel): Likewise.
11462 (Output_data_got::add_local_with_rela): Likewise.
11463 (Output_data_got::add_local_pair_with_rel): New function.
11464 (Output_data_got::add_local_pair_with_rela): New function.
11465 (Output_data_got::add_global_tls): Removed.
11466 (Output_data_got::add_global_tls_with_rel): Removed.
11467 (Output_data_got::add_global_tls_with_rela): Removed.
11468 (Output_data_got::add_local_tls): Removed.
11469 (Output_data_got::add_local_tls_with_rel): Removed.
11470 (Output_data_got::add_local_tls_with_rela): Removed.
11471 * output.h (Output_data_got::add_global): Added got_type parameter.
11472 (Output_data_got::add_global_with_rel): Likewise.
11473 (Output_data_got::add_global_with_rela): Likewise.
11474 (Output_data_got::add_global_pair_with_rel): New function.
11475 (Output_data_got::add_global_pair_with_rela): New function.
11476 (Output_data_got::add_local): Added got_type parameter.
11477 (Output_data_got::add_local_with_rel): Likewise.
11478 (Output_data_got::add_local_with_rela): Likewise.
11479 (Output_data_got::add_local_pair_with_rel): New function.
11480 (Output_data_got::add_local_pair_with_rela): New function.
11481 (Output_data_got::add_global_tls): Removed.
11482 (Output_data_got::add_global_tls_with_rel): Removed.
11483 (Output_data_got::add_global_tls_with_rela): Removed.
11484 (Output_data_got::add_local_tls): Removed.
11485 (Output_data_got::add_local_tls_with_rel): Removed.
11486 (Output_data_got::add_local_tls_with_rela): Removed.
11487 * resolve.cc (Symbol::override_base_with_special): Removed
11488 reference to has_got_offset_ field.
11489 * symtab.cc (Symbol::init_fields): Replaced initialization
11490 of got_offset_ with got_offsets_. Removed initialization
11491 of has_got_offset_
53fcba31 11492 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
11493 (Symbol::got_offset): Likewise.
11494 (Symbol::set_got_offset): Likewise.
11495 (Symbol::has_tls_got_offset): Removed.
11496 (Symbol::tls_got_offset): Removed.
11497 (Symbol::set_tls_got_offset): Removed.
11498 (Symbol::got_offset_): Removed.
11499 (Symbol::tls_mod_got_offset_): Removed.
11500 (Symbol::tls_pair_got_offset_): Removed.
11501 (Symbol::got_offsets_): New field.
11502 (Symbol::has_got_offset): Removed.
11503 (Symbol::has_tls_mod_got_offset): Removed.
11504 (Symbol::has_tls_pair_got_offset): Removed.
11505 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11506 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11507 member functions.
11508 (Target_x86_64::Scan::global): Likewise.
11509 (Target_x86_64::Relocate::relocate): Likewise.
11510 (Target_x86_64::Relocate::relocate_tls): Likewise.
11511
bd52eafb
BE
115122008-03-25 Ben Elliston <bje@au.ibm.com>
11513
11514 * yyscript.y: Fix spelling error in comment.
11515
8b105e34
ILT
115162008-03-24 Ian Lance Taylor <iant@google.com>
11517
8ed814a9
ILT
11518 * options.h (class General_options): Define build_id option.
11519 * layout.h (class Layout): Declare write_build_id, create_note,
11520 create_build_id. Add build_id_note_ member.
11521 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11522 "libiberty.h", "md5.h", "sha1.h".
11523 (Layout::Layout): Initialize eh_frame_data_,
11524 eh_frame_hdr_section_, and build_id_note_.
11525 (Layout::finalize): Call create_build_id.
11526 (Layout::create_note): New function, broken out of
11527 Layout::create_gold_note.
11528 (Layout::create_gold_note): Call create_note.
11529 (Layout::create_build_id): New function.
11530 (Layout::write_build_id): New function.
11531 (Close_task_runner::run): Call write_build_id.
11532
8b105e34
ILT
11533 * x86_64.cc: Correct license to GPLv3.
11534
086a1841
ILT
115352008-03-23 Ian Lance Taylor <iant@google.com>
11536
11537 * options.cc: Include "demangle.h".
11538 (parse_optional_string): New function.
11539 (parse_long_option): Handle takes_optional_argument.
11540 (parse_short_option): Update dash_z initializer. Handle
11541 takes_optional_argument.
11542 (General_options::General_options): Initialize do_demangle_.
11543 (General_options::finalize): Set do_demangle_. Handle demangling
11544 style.
11545 * options.h (parse_optional_string): Declare.
11546 (struct One_option): Add optional_arg field. Update constructor.
11547 Update call constructor calls. Add takes_optional_argument
11548 function.
11549 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11550 (DEFINE_optional_string): Define.
11551 (General_options::demangle): Change from DEFINE_bool to
11552 DEFINE_optional_string.
11553 (General_options::no_demangle): New function.
11554 (General_options::do_demangle): New function.
11555 (General_options::set_do_demangle): New function.
11556 (General_options::execstack_status_): Move definition to end of
11557 class definition.
11558 (General_options::static_): Likewise.
11559 (General_options::do_demangle_): New field.
11560 * object.cc (big_endian>::get_symbol_location_info): Call
11561 Options::do_demangle, not Options::demangle.
11562 * symtab.cc (demangle): Likewise.
11563
cbb93e63
ILT
115642008-03-22 Ian Lance Taylor <iant@google.com>
11565
11566 * gold.h: Include <cstddef> and <sys/types.h>
11567 * options.h: Include <cstring>.
11568
ec531623
ILT
115692008-03-21 Ian Lance Taylor <iant@google.com>
11570
11571 * Added source code to GNU binutils.
This page took 0.698867 seconds and 4 git commands to generate.