* symtab.c (operator_chars): Now static.
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
886288f1
ILT
12011-07-02 Ian Lance Taylor <iant@google.com>
2
3 PR gold/12957
4 * options.h (class General_options): Add -f and -F.
5 * options.cc (General_options::finalize): Fatal error if -f/-F
6 are used without -shared.
7 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
8
ae3a6d4f
ILT
92011-07-02 Ian Lance Taylor <iant@google.com>
10
11 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
12
21131061
ILT
132011-07-01 Ian Lance Taylor <iant@google.com>
14
15 PR gold/12525
16 PR gold/12952
17 * resolve.cc (Symbol::override_base_with_special): Don't override
18 the version if the overriding symbol has a different name.
19 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
20 all callers. If we give an error about an undefined version,
21 define the base version if necessary.
22 * dynobj.h (class Versions): Update declaration.
23 * testsuite/weak_alias_test_5.cc: New file.
24 * testsuite/weak_alias_test.script: New file.
25 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
26 and versioned_alias have the right value, and call t2.
27 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
28 weak_alias_test_5.so.
29 (weak_alias_test_LDADD): Likewise.
30 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
31 * testsuite/Makefile.in: Rebuild.
32
611062c0
ILT
332011-07-01 Ian Lance Taylor <iant@google.com>
34
35 PR gold/12525
36 * options.h (class General_options): Support -z notext.
37 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
38 -Wl,-z,notext.
39 (two_file_shared_nonpic.so): Likewise.
40 (two_file_shared_mixed.so): Likewise.
41 (two_file_shared_mixed_1.so): Likewise.
42 (weak_undef_lib_nonpic.so): Likewise.
43 (alt/weak_undef_lib_nonpic.so): Likewise.
44 (tls_test_shared_nonpic.so): Likewise.
45 * testsuite/Makefile.in: Rebuild.
46
328c7c2f
ILT
472011-07-01 Ian Lance Taylor <iant@google.com>
48
49 PR gold/12525
50 * configure.ac: Test whether static linking works, setting
51 the automake conditional HAVE_STATIC.
52 * testsuite/Makefile.am: Disable tests using -static if
53 HAVE_STATIC is not true.
54 * configure, testsuite/Makefile.in: Rebuild.
55
02d7cd44
ILT
562011-07-01 Ian Lance Taylor <iant@google.com>
57
58 PR gold/12525
59 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
60 Assert if we see DW_EH_PE_indirect.
61 * target.h (Target::ehframe_datarel_base): New function.
62 (Target::do_ehframe_datarel_base): New target function.
63 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
64 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
65 function.
66
07a60597
ILT
672011-07-01 Ian Lance Taylor <iant@google.com>
68
69 PR gold/12571
70 * options.h (class General_options): Add
71 --ld-generated-unwind-info.
72 * ehframe.cc (Fde::write): Add address parameter. Change all
73 callers. If associated with PLT, fill in address and size.
74 (Cie::set_output_offset): Only add merge mapping if there is an
75 object.
76 (Cie::write): Add address parameter. Change all callers.
77 (Eh_frame::add_ehframe_for_plt): New function.
78 * ehframe.h (class Fde): Update declarations. Move shndx_ and
79 input_offset_ fields into union u_, with new plt field.
80 (Fde::Fde): Adjust for new union field.
81 (Fde::Fde) [Output_data version]: New constructor.
82 (Fde::add_mapping): Only add merge mapping if there is an object.
83 (class Cie): Update declarations.
84 (class Eh_frame): Declare add_ehframe_for_plt.
85 * layout.cc (Layout::layout_eh_frame): Break out code into
86 make_eh_frame_section, and call it.
87 (Layout::make_eh_frame_section): New function.
88 (Layout::add_eh_frame_for_plt): New function.
89 * layout.h (class Layout): Update declarations.
90 * merge.cc (Merge_map::add_mapping): Add assertion.
91 * i386.cc: Include "dwarf.h".
92 (class Output_data_plt_i386): Make first_plt_entry,
93 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
94 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
95 and plt_eh_frame_fde.
96 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
97 boundary. Call add_eh_frame_for_plt if appropriate.
98 * x86_64.cc: Include "dwarf.h".
99 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
100 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
101 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
102 and plt_eh_frame_fde.
103 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
104 appropriate.
105
14788a3f
ILT
1062011-06-29 Ian Lance Taylor <iant@google.com>
107
108 PR gold/12629
109 * object.cc (Sized_relobj_file::layout_section): Change shdr
110 parameter to be const.
111 (Sized_relobj_file::layout_eh_frame_section): New function, broken
112 out of do_layout.
113 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
114 appropriate. Call layout_eh_frame_section.
115 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
116 sections.
117 * object.h (class Sized_relobj_file): Update declarations.
118
6c21fce1
ILT
1192011-06-29 Ian Lance Taylor <iant@google.com>
120
37e41b03 121 PR gold/12652
6c21fce1
ILT
122 * script.cc (Token::integer_value): Accept trailing M/m/K/k
123 modifier.
124 (Lex::gather_token): Accept trailing M/m/K/k for integers.
125
4d5e4e62
ILT
1262011-06-29 Ian Lance Taylor <iant@google.com>
127
128 PR gold/12675
129 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
130 SHT_X86_64_UNWIND.
131 * layout.cc (Layout::layout_eh_frame): Likewise.
132
886f533a
ILT
1332011-06-29 Ian Lance Taylor <iant@google.com>
134
135 PR gold/12695
136 * layout.cc (Layout::symtab_section_shndx): New function.
137 * layout.h (class Layout): Declare symtab_section_shndx.
138 * output.cc (Output_section::write_header): Call it.
139
f3ae1b28
ILT
1402011-06-29 Ian Lance Taylor <iant@google.com>
141
142 PR gold/12818
143 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
144 symbols which are not used in a relocation.
145
aecf301f
ILT
1462011-06-28 Ian Lance Taylor <iant@google.com>
147
148 PR gold/12898
149 * layout.cc (Layout::segment_precedes): Don't crash if a linker
150 script create indistinguishable segments.
151 (Layout::set_segment_offsets): Use stable_sort when sorting
152 segments. Pass this to Compare_segments constructor.
153 * layout.h (class Layout): Make segment_precedes non-static.
154 (class Compare_segments): Change from struct to class. Add
155 layout_ field. Add constructor.
156 * script-sections.cc
157 (Script_sections::attach_sections_using_phdrs_clause): Rename
158 local orphan to is_orphan. Don't report failure to put empty
159 section in segment. On attachment failure, report name of
160 section, and attach to first PT_LOAD segment.
161
03ef7571
ILT
1622011-06-28 Ian Lance Taylor <iant@google.com>
163
164 PR gold/12934
165 * target-select.cc (Target_selector::Target_selector): Add
166 emulation parameter. Change all callers.
167 (select_target_by_bfd_name): Rename from select_target_by_name.
168 Change all callers.
169 (select_target_by_emulation): New function.
170 (supported_emulation_names): New function.
171 * target-select.h (class Target_selector): Add emulation_ field.
172 Update declarations.
173 (Target_selector::recognize_by_bfd_name): Rename from
174 recognize_by_name. Change all callers.
175 (Target_selector::supported_bfd_names): Rename from
176 supported_names. Change all callers.
177 (Target_selector::recognize_by_emulation): New function.
178 (Target_selector::supported_emulations): New function.
179 (Target_selector::emulation): New function.
180 (Target_selector::do_recognize_by_bfd_name): Rename from
181 do_recognize_by_name. Change all callers.
182 (Target_selector::do_supported_bfd_names): Rename from
183 do_supported_names. Change all callers.
184 (Target_selector::do_recognize_by_emulation): New function.
185 (Target_selector::do_supported_emulations): New function.
186 (select_target_by_bfd_name): Change name in declaration.
187 (select_target_by_emulation): Declare.
188 (supported_emulation_names): Declare.
189 * parameters.cc (parameters_force_valid_target): Try to find
190 target based on emulation from -m option.
191 * options.h (class General_options): Change doc string for -m.
192 * options.cc (help): Print emulations.
193 (General_options::parse_V): Likewise.
194 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
195 Add emulation parameter. Change all callers.
196
200b2bb9
ILT
1972011-06-28 Ian Lance Taylor <iant@google.com>
198
199 * target.h (class Target): Add osabi_ field.
200 (Target::osabi): New function.
201 (Target::set_osabi): New function.
202 (Target::Target): Initialize osabi_.
203 (Target::do_adjust_elf_header): Make pure virtual.
204 (Sized_target::do_adjust_elf_header): Declare.
205 * target.cc (Sized_target::do_adjust_elf_header): New function.
206 (class Sized_target): Instantiate all versions.
207 * freebsd.h (class Target_freebsd): Remove.
208 (Target_selector_freebsd::do_recognize): Call set_osabi on
209 Target.
210 (Target_selector_freebsd::do_recognize_by_name): Likewise.
211 (Target_selector_freebsd::set_osabi): Remove.
212 * i386.cc (class Target_i386): Inherit from Sized_target rather
213 than Target_freebsd.
214 * x86_64.cc (class Target_x86_64): Likewise.
215
b3ce541e
ILT
2162011-06-28 Ian Lance Taylor <iant@google.com>
217
218 * target.h (Target::can_check_for_function_pointers): Rewrite.
219 Make non-virtual.
220 (Target::can_icf_inline_merge_sections): Likewise.
221 (Target::section_may_have_icf_unsafe_poineters): Likewise.
222 (Target::Target_info): Add can_icf_inline_merge_sections field.
223 (Target::do_can_check_for_function_pointers): New virtual
224 function.
225 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
226 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
227 from can_check_for_function_pointers, move in file.
228 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
229 section_may_have_icf_unsafe_poineters, move in file.
230 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
231 * i386.cc (Target_i386::do_can_check_for_function_pointers):
232 Rename from can_check_for_function_pointers, move in file.
233 (Target_i386::can_icf_inline_merge_sections): Remove.
234 (Target_i386::i386_info): Initialize
235 can_icf_inline_merge_sections.
236 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
237 Initialize can_icf_inline_merge_sections.
238 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
239 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
240 Rename from can_check_for_function_pointers, move in file.
241 (Target_x86_64::can_icf_inline_merge_sections): Remove.
242 (Target_x86_64::x86_64_info): Initialize
243 can_icf_inline_merge_sections.
244 * testsuite/testfile.cc (Target_test::test_target_info):
245 Likewise.
246 * icf.cc (get_section_contents): Correct formatting.
247
6d1c4efb
ILT
2482011-06-27 Ian Lance Taylor <iant@google.com>
249
250 * symtab.cc (Symbol::versioned_name): New function.
251 (Symbol_table::add_to_final_symtab): Use versioned_name when
252 appropriate.
253 (Symbol_table::sized_write_symbol): Likewise.
254 * symtab.h (class Symbol): Declare versioned_name.
255 * stringpool.h (class Stringpool_template): Add variant of add
256 which takes a std::basic_string.
257 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
258 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
259 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
260 (ver_test_12.o): New target.
261 * testsuite/Makefile.in: Rebuild.
262
57eb9b50
DK
2632011-06-27 Doug Kwan <dougkwan@google.com>
264
265 * arm.cc (Arm_relocate_functions::thm_jump8,
266 Arm_relocate_functions::thm_jump11): Use a wider signed
267 type to compute offset.
268 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
269 arm_thm_jump8.
270 * testsuite/Makefile.in: Regenerate.
271 * testsuite/arm_branch_in_range.sh: Check test results of
272 arm_thm_jump11 and arm_thm_jump8.
273 * testsuite/arm_thm_jump11.s: New test source file.
274 * testsuite/arm_thm_jump11.t: New linker script.
275 * testsuite/arm_thm_jump8.s: New test source file.
276 * testsuite/arm_thm_jump8.t: New linker script.
277
487b39df
ILT
2782011-06-24 Ian Lance Taylor <iant@google.com>
279
280 * layout.cc: Include "object.h".
281 (ctors_sections_in_init_array): New static variable.
282 (Layout::is_ctors_in_init_array): New function.
283 (Layout::layout): Add entry to ctors_sections_in_init_array if
284 appropriate.
285 * layout.h (class Layout): Declare is_ctors_in_init_array.
286 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
287 is_ctors_reverse_view is set.
288 (Sized_relobj_file::write_sections): Add layout parameter. Change
289 all callers. Set is_ctors_reverse_view field of View_size.
290 (Sized_relobj_file::reverse_words): New function.
291 * object.h (Sized_relobj_file::View_size): Add
292 is_ctors_reverse_view field.
293 (class Sized_relobj_file): Update declarations.
294 * testsuite/initpri3.c: New test.
295 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
296 initpri3b.
297 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
298 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
299 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
300 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
301 * testsuite/Makefile.in: Rebuild.
302
472076e4
CC
3032011-06-24 Cary Coutant <ccoutant@google.com>
304
305 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
306 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
307 (debug_msg_cdebug.err): New targets.
308 * testsuite/Makefile.in: Regenerate.
309 * testsuite/debug_msg.sh: Check output of link with compressed debug.
310 Fix checks for link with shared library.
311
a60af0db
DK
3122011-06-24 Doug Kwan <dougkwan@google.com>
313
314 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
315 skip empty text sections.
316 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
317
5393d741
ILT
3182011-06-22 Ian Lance Taylor <iant@google.com>
319
320 PR gold/12910
321 * options.h (class General_options): Add --ctors-in-init-array.
322 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
323 friends as SHT_PROGBITS for merging sections.
324 (Layout::layout): Remove special handling of .init_array and
325 friends. Don't sort if doing relocatable link. Sort for .ctors
326 and .dtors if ctors_in_init_array.
327 (Layout::make_output_section): Force correct section types for
328 .init_array and friends. Don't sort if doing relocatable link,
329 Don't sort .ctors and .dtors if ctors_in_init_array.
330 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
331 (Layout::output_section_name): Add relobj parameter. Change all
332 callers. Handle .ctors. and .dtors. in code rather than table.
333 Handle .ctors and .dtors if ctors_in_init_array.
334 (Layout::match_file_name): New function, moved from output.cc.
335 * layout.h (class Layout): Update declarations.
336 * output.cc: Include "layout.h".
337 (Input_section_sort_entry::get_priority): New function.
338 (Input_section_sort_entry::match_file_name): Just call
339 Layout::match_file_name.
340 (Output_section::Input_section_sort_init_fini_compare::operator()):
341 Handle .ctors and .dtors. Sort by explicit priority rather than
342 by name.
343 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
344 * testsuite/initpri2.c: New test.
345 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
346 (check_PROGRAMS): Add initpri2.
347 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
348 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
349 * configure, testsuite/Makefile.in: Rebuild.
350
e1f74f98
ILT
3512011-06-19 Ian Lance Taylor <iant@google.com>
352
353 PR gold/12880
354 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
355 .interp section to a PT_INTERP segment even if we have seen a
356 --dynamic-linker option. Don't do it if we have seen a PHDRS
357 clause in a linker script.
358 (Layout::finalize): Don't create a .interp section if we've
359 already create a PT_INTERP segment.
360 (Layout::create_interp): Always call choose_output_section (revert
361 patch of 2011-06-17). Don't create PT_INTERP segment.
362 * script-sections.cc
363 (Script_sections::create_note_and_tls_segments): Add a .interp
364 section to a PT_INTERP segment even if we have seen a
365 --dynamic-linker option.
366
766f91bb
ILT
3672011-06-18 Ian Lance Taylor <iant@google.com>
368
369 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
370 merely because a non-PT_LOAD segment has a dynamic reloc.
371
0d212c3a
ILT
3722011-06-18 Ian Lance Taylor <iant@google.com>
373
374 * layout.cc (Layout::finish_dynamic_section): Don't create
375 DT_FLAGS entry if not needed.
376
911a5072
ILT
3772011-06-18 Ian Lance Taylor <iant@google.com>
378
379 PR gold/12745
380 * layout.cc (Layout::layout_eh_frame): Correct handling of
381 writable .eh_frame section.
382
534b4e5f
ILT
3832011-06-17 Ian Lance Taylor <iant@google.com>
384
385 PR gold/12893
386 * resolve.cc (Symbol_table::resolve): Don't give an error if a
387 symbol is redefined with the exact same object and value.
388
10b4f102
ILT
3892011-06-17 Ian Lance Taylor <iant@google.com>
390
391 PR gold/12880
392 * layout.h (class Layout): Add interp_segment_ field.
393 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
394 (Layout::attach_allocated_section_to_segment): If making shared
395 library, put .interp section in PT_INTERP segment.
396 (Layout::finalize): Also call create_interp if -dynamic-linker
397 option was used.
398 (Layout::create_interp): Assert that there is no PT_INTERP
399 segment. If not using a SECTIONS clause, use make_output_section.
400 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
401 * script-sections.cc
402 (Script_sections::create_note_and_tls_segments): If making shared
403 library, put .interp section in PT_INTERP segment.
404
a29b0dad
ILT
4052011-06-17 Ian Lance Taylor <iant@google.com>
406
e588ea8d
ILT
407 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
408 when making a shared library.
409
4102011-06-17 Ian Lance Taylor <iant@google.com>
411
412 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
413 parameter. Change all callers. Don't issue warning about PC32
414 against locally defined symbol.
a29b0dad 415
9d3b0698
ILT
4162011-06-16 Ian Lance Taylor <iant@google.com>
417
418 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
419 occurs in same object.
420
85b0f90c
AM
4212011-06-14 Alan Modra <amodra@gmail.com>
422
423 * po/POTFILES.in: Regenerate.
424
a94907d9
ILT
4252011-06-09 Ian Lance Taylor <iant@google.com>
426
427 * script-sections.cc
428 (Orphan_output_section::set_section_addresses): For a relocatable
429 link set address to 0.
430
4fb3a1c3
CC
4312011-06-09 Cary Coutant <ccoutant@google.com>
432
433 PR gold/12804
434 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
435 used with --compress-debug-sections.
436 * gold/object.cc (Sized_relobj_file::do_layout): Report
437 uncompressed size of compressed input sections.
438
61220854
CC
4392011-06-08 Cary Coutant <ccoutant@google.com>
440
441 PR gold/12804
442 * testsuite/two_file_test_2_v1.cc: Change initialization of
443 v2 to keep it in .data.
444
e6455dfb
CC
4452011-06-07 Cary Coutant <ccoutant@google.com>
446
447 * common.cc (Symbol_table::do_allocate_commons_list): Call
448 gold_fallback.
449 * errors.cc (Errors::fatal): Adjust call to gold_exit.
450 (Errors::fallback): New function.
451 (gold_fallback): New function.
452 * errors.h (Errors::fallback): New function.
453 * gold.cc (gold_exit): Change status parameter to enum; adjust
454 all callers.
455 (queue_initial_tasks): Call gold_fallback.
456 * gold.h: Include cstdlib.
457 (Exit_status): New enum type.
458 (gold_exit): Change status parameter to enum.
459 (gold_fallback): New function.
460 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
461 (Layout::create_symtab_sections): Likewise.
462 (Layout::create_shdrs): Likewise.
463 * main.cc (main): Adjust call to gold_exit.
464 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
465 (Output_data_got::add_got_entry_pair): Likewise.
466 (Output_section::add_input_section): Likewise.
467 (Output_section::add_output_section_data): Likewise.
468 (Output_segment::set_section_list_addresses): Likewise.
469 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
470
fb0e076f
CC
4712011-06-07 Cary Coutant <ccoutant@google.com>
472
473 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
474 for incremental links.
475 * output.cc (Output_segment::set_section_list_addresses): Remove
476 FIXME and test for TLS or BSS.
477
a5ee4d5d
CC
4782011-06-07 Cary Coutant <ccoutant@google.com>
479
480 * testsuite/Makefile.am: Add incremental_copy_test,
481 incremental_common_test_1.
482 * testsuite/Makefile.in: Regenerate.
483 * testsuite/common_test_1_v1.c: New source file.
484 * testsuite/common_test_1_v2.c: New source file.
485 * testsuite/copy_test_v1.cc: New source file.
486
5146f448
CC
4872011-06-07 Cary Coutant <ccoutant@google.com>
488
489 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
490 update, allocate common from bss section's free list.
491 * incremental-dump.cc (dump_incremental_inputs): Print flag for
492 linker-defined symbols.
493 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
494 Skip GOT and PLT entries that are no longer referenced.
495 (Output_section_incremental_inputs::write_info_blocks): Mark
496 linker-defined symbols.
497 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
498 * output.cc (Output_section::allocate): New function.
499 * output.h (Output_section::allocate): New function.
500 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
501 linker-defined symbols.
502 (Symbol::override_base_with_special): Copy is_predefined_ flag.
503 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
504 (Symbol::init_base_output_data): Likewise.
505 (Symbol::init_base_output_segment): Likewise.
506 (Symbol::init_base_constant): Likewise.
507 (Sized_symbol::init_output_data): Likewise.
508 (Sized_symbol::init_output_segment): Likewise.
509 (Sized_symbol::init_constant): Likewise.
510 (Symbol_table::do_define_in_output_data): Likewise.
511 (Symbol_table::do_define_in_output_segment): Likewise.
512 (Symbol_table::do_define_as_constant): Likewise.
513 * symtab.h (Symbol::is_predefined): New function.
514 (Symbol::init_base_output_data): Add is_predefined parameter.
515 (Symbol::init_base_output_segment): Likewise.
516 (Symbol::init_base_constant): Likewise.
517 (Symbol::is_predefined_): New data member.
518 (Sized_symbol::init_output_data): Add is_predefined parameter.
519 (Sized_symbol::init_output_segment): Likewise.
520 (Sized_symbol::init_constant): Likewise.
521 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
522
26d3c67d
CC
5232011-06-07 Cary Coutant <ccoutant@google.com>
524
525 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
526 instead of emit_copy_reloc.
527 (Copy_relocs::emit_copy_reloc): Refactor.
528 (Copy_relocs::make_copy_reloc): New function.
529 (Copy_relocs::add_copy_reloc): Remove.
530 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
531 section.
532 (Copy_relocs::make_copy_reloc): New function.
533 (Copy_relocs::add_copy_reloc): Remove.
534 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
535 unchanged input files.
536 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
537 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
538 Reserve BSS space for COPY relocations.
539 (Sized_incremental_binary::do_emit_copy_relocs): New function.
540 (Output_section_incremental_inputs::write_info_blocks): Record
541 whether a symbol is copied from a shared object.
542 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
543 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
544 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
545 (Incremental_input_entry_reader::get_output_symbol_index): Add
546 is_copy parameter.
547 (Incremental_binary::emit_copy_relocs): New function.
548 (Incremental_binary::do_emit_copy_relocs): New function.
549 (Sized_incremental_binary::Sized_incremental_binary): Initialize
550 new data member.
551 (Sized_incremental_binary::add_copy_reloc): New function.
552 (Sized_incremental_binary::do_emit_copy_relocs): New function.
553 (Sized_incremental_binary::Copy_reloc): New struct.
554 (Sized_incremental_binary::Copy_relocs): New typedef.
555 (Sized_incremental_binary::copy_relocs_): New data member.
556 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
557 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
558 * target.h (Sized_target::emit_copy_reloc): New function.
559 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
560
7cdb37d9
CC
5612011-06-02 Cary Coutant <ccoutant@google.com>
562
563 PR gold/12163
564 * gold/archive.cc (Archive::Archive): Initialize new data member.
565 (Archive::include_all_members): Return if archive has already been
566 included.
567 * gold/archive.h (Archive::include_all_members_): New data member.
568
cc643b88
NC
5692011-06-02 Nick Clifton <nickc@redhat.com>
570
571 * dynobj.h: Fix spelling mistake in comment.
572 * output.cc: Likewise.
573
f62a3ca7
DK
5742011-05-31 Doug Kwan <dougkwan@google.com>
575 Asier Llano
576
577 PR gold/12826
cc643b88 578 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
579 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
580 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
581 redundant arm_exidx_test.so.
582 * testsuite/Makefile.in: Regenerate.
583 (check_SCRIPTS): Add pr12826.sh
584 (check_DATA): Add pr12826.stdout
585 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
586 * testsuite/pr12826.sh: New file.
587 * testsuite/pr12826_1.s: Ditto.
588 * testsuite/pr12826_1.s: Ditto.
589
8dbe1edc
ILT
5902011-05-30 Ian Lance Taylor <iant@google.com>
591
592 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
593 sections.
594
c49875be
ILT
5952011-05-29 Ian Lance Taylor <iant@google.com>
596
597 PR gold/12804
598 * testsuite/Makefile.am: Use different file name for two_file_test
599 temporary file for each incremental test.
600 * testsuite/Makefile.in: Rebuild.
601
69d53f7a
ILT
6022011-05-29 Ian Lance Taylor <iant@google.com>
603
604 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
605 binary input file is empty.
606
41d0ab5f
ILT
6072011-05-27 Ian Lance Taylor <iant@google.com>
608
609 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
610 (ver_test_9.so): Likewise.
611 * testsuite/Makefile.in: Rebuild.
612
89d8a36b
CC
6132011-05-26 Cary Coutant <ccoutant@google.com>
614
615 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
616 * incremental.cc (Incremental_inputs::report_input_section): Fix
617 comment, indentation.
618 (Incremental_inputs::report_comdat_group): New function.
619 (Output_section_incremental_inputs::set_final_data_size): Adjust size
620 of data for incremental input file entry.
621 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
622 group count, COMDAT group signatures.
623 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
624 an unchanged input file.
625 * incremental.h (Incremental_object_entry::Incremental_object_entry):
626 Initialize new data member.
627 (Incremental_object_entry::add_comdat_group): New function.
628 (Incremental_object_entry::get_comdat_group_count): New function.
629 (Incremental_object_entry::get_comdat_signature_key): New function.
630 (Incremental_object_entry::groups_): New data member.
631 (Incremental_inputs::report_comdat_group): New function.
632 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
633 data for incremental input file entry.
634 (Incremental_input_entry_reader::get_comdat_group_count): New function.
635 (Incremental_input_entry_reader::get_input_section): Adjust size of
636 data for incremental input file entry.
637 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
638 (Incremental_input_entry_reader::get_comdat_group_signature): New
639 function.
640 * object.cc (Sized_relobj::include_section_group): Report kept
641 COMDAT groups for incremental links.
642
1706a06f
ILT
6432011-05-24 David Meyer <pdox@google.com>
644
645 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
646 with name parameter. Add found_name parameter.
647 * fileread.cc (Input_file::find_file): Adjust code accordingly.
648 * dirsearch.h (class Dirsearch): Update declaration.
649
a10ae760
ILT
6502011-05-24 Ian Lance Taylor <iant@google.com>
651
652 * archive.cc (Library_base::should_include_member): Pull in object
653 from archive if it defines the entry symbol.
654 * parameters.cc (Parameters::entry): New function.
655 * parameters.h (class Parameters): Declare entry.
656 * output.h (class Output_file_header): Remove entry_ field.
657 * output.cc (Output_file_header::Output_file_header): Remove entry
658 parameter. Change all callers.
659 (Output_file_header::entry): Use parameters->entry.
660 * gold.cc (queue_middle_tasks): Likewise.
661 * plugin.cc (Plugin_hook::run): Likewise.
662
aa92d6ed
CC
6632011-05-24 Cary Coutant <ccoutant@google.com>
664
665 * gold.cc (queue_initial_tasks): Pass incremental base filename
666 to Output_file::open_base_file; don't print error message.
667 * incremental-dump.cc (main): Adjust call to
668 Output_file::open_for_modification.
669 * incremental-dump.cc (main): Likewise.
670 * incremental.cc (Incremental_inputs::report_command_line):
671 Ignore --incremental-base option when comparing command lines.
672 Ignore parameter when given as separate argument.
673 * options.h (class General_options): Add --incremental-base.
674 * output.cc (Output_file::Output_file):
675 (Output_file::open_base_file): Add base_name and writable parameters;
676 read base file into new file; print error message here.
677 (Output_file::map_no_anonymous): Add writable parameter; adjust all
678 callers.
679 * output.h (Output_file::open_for_modification): Rename to...
680 (Output_file::open_base_file): ...this; add base_name and
681 writable parameters; adjust all callers.
682 (Output_file::map_no_anonymous): Add writable parameter; adjust all
683 callers.
684 * testsuite/Makefile.am (incremental_test_4): Test
685 --incremental-base.
686 * testsuite/Makefile.in: Regenerate.
687
2eedd706
CC
6882011-05-24 Cary Coutant <ccoutant@google.com>
689
690 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
691 incremental_test_4.
692 * testsuite/Makefile.in: Regenerate.
693 * testsuite/two_file_test_1_v1.cc: New test source file.
694 * testsuite/two_file_test_1b_v1.cc: New test source file.
695 * testsuite/two_file_test_2_v1.cc: New test source file.
696
0f1c85a6
CC
6972011-05-24 Cary Coutant <ccoutant@google.com>
698
699 * dynobj.h (Dynobj::do_dynobj): New function.
700 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
701 flag and soname for shared objects.
702 * incremental.cc (Incremental_inputs::report_object): Make
703 either Incremental_object_entry or Incremental_dynobj_entry; add
704 soname to string table.
705 (Incremental_inputs::report_input_section): Add assertion.
706 (Output_section_incremental_inputs::set_final_data_size): Adjust
707 type of input file entry for shared libraries; adjust size of
708 shared library info entry.
709 (Output_section_incremental_inputs::write_input_files): Write
710 as_needed flag for shared libraries.
711 (Output_section_incremental_inputs::write_info_blocks): Adjust type
712 of input file entry for shared libraries; write soname.
713 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
714 soname from incremental info.
715 * incremental.h (enum Incremental_input_flags): Add
716 INCREMENTAL_INPUT_AS_NEEDED.
717 (Incremental_input_entry::Incremental_input_entry): Initialize new
718 data member.
719 (Incremental_input_entry::set_as_needed): New function.
720 (Incremental_input_entry::as_needed): New function.
721 (Incremental_input_entry::do_dynobj_entry): New function.
722 (Incremental_input_entry::as_needed_): New data member.
723 (Incremental_object_entry::Incremental_object_entry): Don't check
724 for shared library.
725 (Incremental_object_entry::do_type): Likewise.
726 (class Incremental_dynobj_entry): New class.
727 (Incremental_input_entry_reader::as_needed): New function.
728 (Incremental_input_entry_reader::get_soname): New function.
729 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
730 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
731 size of shared library info entry.
732 * layout.cc (Layout::finish_dynamic_section): Don't test for
733 incremental link when adding DT_NEEDED entries.
734 * object.h (Object::Object): Initialize new data member.
735 (Object::dynobj): New function.
736 (Object::set_as_needed): New function.
737 (Object::as_needed): New function.
738 (Object::do_dynobj): New function.
739 (Object::as_needed_): New data member.
740
6fa2a40b
CC
7412011-05-24 Cary Coutant <ccoutant@google.com>
742
743 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
744 info; adjust display of GOT entries.
745 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
746 vector of input objects; remove file_status_.
747 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
748 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
749 got_plt reader; call target hooks to reserve GOT entries.
750 (Output_section_incremental_inputs::set_final_data_size): Adjust size
751 of input file info header and GOT info entry.
752 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
753 relocation info.
754 (Got_plt_view_info::got_descriptor): Remove.
755 (Got_plt_view_info::sym_index): New data member.
756 (Got_plt_view_info::input_index): New data member.
757 (Local_got_offset_visitor::visit): Write input file index.
758 (Global_got_offset_visitor::visit): Write 0 for input file index.
759 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
760 with sym_index and input_index.
761 (Output_section_incremental_inputs::write_got_plt): Adjust size of
762 incremental info GOT entry; replace got_descriptor with input_index.
763 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
764 map from input file index to object.
765 (Sized_relobj_incr::do_layout): Replace direct data member reference
766 with accessor function.
767 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
768 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
769 Adjust size of input file info header.
770 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
771 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
772 (Incremental_input_entry_reader::get_input_section): Adjust size of
773 input file info header.
774 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
775 of incremental info GOT entry.
776 (Incremental_got_plt_reader::get_got_desc): Remove.
777 (Incremental_got_plt_reader::get_got_symndx): New function.
778 (Incremental_got_plt_reader::get_got_input_index): New function.
779 (Sized_incremental_binary::Sized_incremental_binary): Remove
780 file_status_; add input_objects_.
781 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
782 (Sized_incremental_binary::set_file_is_unchanged): Remove.
783 (Sized_incremental_binary::file_is_unchanged): Remove.
784 (Sized_incremental_binary::set_input_object): New function.
785 (Sized_incremental_binary::input_object): New function.
786 (Sized_incremental_binary::file_status_): Remove.
787 (Sized_incremental_binary::input_objects_): New data member.
788 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
789 references.
790 (Sized_relobj_incr::invalid_address): Move to base class.
791 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
792 class.
793 (Sized_relobj_incr::do_output_section_offset): Likewise.
794 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
795 (Sized_relobj_incr::section_offsets_): Likewise.
796 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
797 function.
798 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
799 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
800 with accessor function.
801 (Sized_relobj_file::do_layout): Likewise.
802 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
803 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
804 (Sized_relobj_file::compute_final_local_value): Replace refs to
805 section_offsets_ with accessor function.
806 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
807 * object.h (Relobj::Relobj): Initialize new data members.
808 (Relobj::add_dyn_reloc): New function.
809 (Relobj::first_dyn_reloc): New function.
810 (Relobj::dyn_reloc_count): New function.
811 (Relobj::first_dyn_reloc_): New data member.
812 (Relobj::dyn_reloc_count_): New data member.
813 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
814 references.
815 (Sized_relobj::Address): New typedef.
816 (Sized_relobj::invalid_address): Move here from child class.
817 (Sized_relobj::Sized_relobj): Initialize new data members.
818 (Sized_relobj::sized_relobj): New function.
819 (Sized_relobj::is_output_section_offset_invalid): Move here from
820 child class.
821 (Sized_relobj::get_output_section_offset): Likewise.
822 (Sized_relobj::local_has_got_offset): Likewise.
823 (Sized_relobj::local_got_offset): Likewise.
824 (Sized_relobj::set_local_got_offset): Likewise.
825 (Sized_relobj::do_for_all_local_got_entries): Likewise.
826 (Sized_relobj::clear_got_offsets): New function.
827 (Sized_relobj::section_offsets): Move here from child class.
828 (Sized_relobj::do_output_section_offset): Likewise.
829 (Sized_relobj::do_set_section_offset): Likewise.
830 (Sized_relobj::Local_got_offsets): Likewise.
831 (Sized_relobj::local_got_offsets_): Likewise.
832 (Sized_relobj::section_offsets_): Likewise.
833 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
834 references.
835 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
836 class.
837 (Sized_relobj_file::sized_relobj): New function
838 (Sized_relobj_file::local_has_got_offset): Move to base class.
839 (Sized_relobj_file::local_got_offset): Likewise.
840 (Sized_relobj_file::set_local_got_offset): Likewise.
841 (Sized_relobj_file::get_output_section_offset): Likewise.
842 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
843 (Sized_relobj_file::do_output_section_offset): Likewise.
844 (Sized_relobj_file::do_set_section_offset): Likewise.
845 (Sized_relobj_file::Local_got_offsets): Likewise.
846 (Sized_relobj_file::local_got_offsets_): Likewise.
847 (Sized_relobj_file::section_offsets_): Likewise.
848 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
849 (all constructors).
850 (set_needs_dynsym_index): Convert relobj to derived class pointer.
851 (Output_reloc::get_symbol_index): Likewise.
852 (Output_reloc::local_section_offset): Likewise.
853 (Output_reloc::get_address): Likewise.
854 (Output_reloc::symbol_value): Likewise.
855 (Output_data_got::reserve_slot): Move to class definition.
856 (Output_data_got::reserve_local): New function.
857 (Output_data_got::reserve_slot_for_global): Remove.
858 (Output_data_got::reserve_global): New function.
859 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
860 (all constructors, two instantiations).
861 (Output_reloc::get_relobj): New function (two instantiations).
862 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
863 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
864 (Output_data_reloc::add_global): Adjust type of relobj.
865 (Output_data_reloc::add_global_relative): Likewise.
866 (Output_data_reloc::add_symbolless_global_addend): Likewise.
867 (Output_data_reloc::add_local): Likewise.
868 (Output_data_reloc::add_local_relative): Likewise.
869 (Output_data_reloc::add_symbolless_local_addend): Likewise.
870 (Output_data_reloc::add_local_section): Likewise.
871 (Output_data_reloc::add_output_section): Likewise.
872 (Output_data_reloc::add_absolute): Likewise.
873 (Output_data_reloc::add_target_specific): Likewise.
874 (Output_data_got::reserve_slot): Move definition here.
875 (Output_data_got::reserve_local): New function.
876 (Output_data_got::reserve_global): New function.
877 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
878 section_offsets_ with accessor function.
879 (Sized_relobj_file::write_sections): Likewise.
880 (Sized_relobj_file::do_relocate_sections): Likewise.
881 * target.h (Sized_target::reserve_local_got_entry): New function.
882 (Sized_target::reserve_global_got_entry): New function.
883 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
884 (Target_x86_64::reserve_global_got_entry): New function.
885 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
886
4829d394
CC
8872011-05-23 Cary Coutant <ccoutant@google.com>
888
889 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
890 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
891 bit when checking got_type.
892 * incremental.cc (Sized_incremental_binary::setup_readers):
893 Store symbol table and string table locations; initialize bit vector
894 of file status flags.
895 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
896 unchanged files.
897 (Sized_incremental_binary::do_process_got_plt): New function.
898 (Sized_incremental_binary::get_symtab_view): Use stored locations.
899 (Output_section_incremental_inputs::set_final_data_size): Record
900 file index for each input file.
901 (Output_section_incremental_inputs::write_got_plt): Store file index
902 instead of input entry offset for each GOT entry.
903 * incremental.h
904 (Incremental_input_entry::Incremental_input_entry): Initialize new
905 data member.
906 (Incremental_input_entry::set_offset): Store file index.
907 (Incremental_input_entry::get_file_index): New function.
908 (Incremental_input_entry::file_index_): New data member.
909 (Incremental_binary::process_got_plt): New function.
910 (Incremental_binary::do_process_got_plt): New function.
911 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
912 data members.
913 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
914 (Sized_incremental_binary::set_file_is_unchanged): New function.
915 (Sized_incremental_binary::file_is_unchanged): New function.
916 (Sized_incremental_binary::do_process_got_plt): New function.
917 (Sized_incremental_binary::file_status_): New data member.
918 (Sized_incremental_binary::main_symtab_loc_): New data member.
919 (Sized_incremental_binary::main_strtab_loc_): New data member.
920 * output.cc (Output_data_got::Got_entry::write): Add case
921 RESERVED_CODE.
922 (Output_data_got::add_global): Call add_got_entry.
923 (Output_data_got::add_global_plt): Likewise.
924 (Output_data_got::add_global_with_rel): Likewise.
925 (Output_data_got::add_global_with_rela): Likewise.
926 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
927 (Output_data_got::add_global_pair_with_rela): Likewise.
928 (Output_data_got::add_local): Call add_got_entry.
929 (Output_data_got::add_local_plt): Likewise.
930 (Output_data_got::add_local_with_rel): Likewise.
931 (Output_data_got::add_local_with_rela): Likewise.
932 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
933 (Output_data_got::add_local_pair_with_rela): Likewise.
934 (Output_data_got::reserve_slot): New function.
935 (Output_data_got::reserve_slot_for_global): New function.
936 (Output_data_got::add_got_entry): New function.
937 (Output_data_got::add_got_entry_pair): New function.
938 (Output_section::add_output_section_data): Edit FIXME.
939 * output.h
940 (Output_section_data_build::Output_section_data_build): New
941 constructor with size parameter.
942 (Output_data_space::Output_data_space): Likewise.
943 (Output_data_got::Output_data_got): Initialize new data member; new
944 constructor with size parameter.
945 (Output_data_got::add_constant): Call add_got_entry.
946 (Output_data_got::reserve_slot): New function.
947 (Output_data_got::reserve_slot_for_global): New function.
948 (class Output_data_got::Got_entry): Add RESERVED_CODE.
949 (Output_data_got::add_got_entry): New function.
950 (Output_data_got::add_got_entry_pair): New function.
951 (Output_data_got::free_list_): New data member.
952 * target.h (Sized_target::init_got_plt_for_update): New function.
953 (Sized_target::register_global_plt_entry): New function.
954 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
955 Initialize new data member; call init; add constructor with PLT count.
956 (Output_data_plt_x86_64::init): New function.
957 (Output_data_plt_x86_64::add_relocation): New function.
958 (Output_data_plt_x86_64::reserve_slot): New function.
959 (Output_data_plt_x86_64::free_list_): New data member.
960 (Target_x86_64::init_got_plt_for_update): New function.
961 (Target_x86_64::register_global_plt_entry): New function.
962 (Output_data_plt_x86_64::add_entry): Allocate from free list for
963 incremental updates.
964 (Output_data_plt_x86_64::add_relocation): New function.
965 * testsuite/object_unittest.cc (Object_test): Set default options.
966
ec69d6da
ILT
9672011-05-16 Ian Lance Taylor <iant@google.com>
968
969 * options.h (class General_options): Make -i a synonym for -r.
970
732e31de
ILT
9712011-05-16 Ian Lance Taylor <iant@google.com>
972
973 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
974
403676b5
CC
9752011-05-10 Cary Coutant <ccoutant@google.com>
976
977 * object.cc (Sized_relobj::do_count_local_symbols): Check for
978 strip_all (-s).
979
5b7b7d6e
ILT
9802011-05-06 Ian Lance Taylor <iant@google.com>
981
982 * layout.cc (Layout::layout): If the output section flags change,
983 update the ordering.
984
f0f9babf
CC
9852011-04-25 Cary Coutant <ccoutant@google.com>
986
987 * incremental-dump.cc (dump_incremental_inputs): Print local
988 symbol info for each input file.
989 * incremental.cc
990 (Output_section_incremental_inputs::set_final_data_size): Add local
991 symbol info to input file entries in incremental info.
992 (Output_section_incremental_inputs::write_info_blocks): Likewise.
993 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
994 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
995 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
996 implementation.
997 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
998 (Sized_incr_relobj::do_relocate): Write the local symbols.
999 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
1000 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
1001 Adjust size of input file header.
1002 (Incremental_inputs_reader::get_local_symbol_offset): New function.
1003 (Incremental_inputs_reader::get_local_symbol_count): New function.
1004 (Incremental_inputs_reader::get_input_section): Adjust size of input
1005 file header.
1006 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
1007 (Sized_incr_relobj::This): New typedef.
1008 (Sized_incr_relobj::sym_size): New const data member.
1009 (Sized_incr_relobj::Local_symbol): New struct.
1010 (Sized_incr_relobj::do_output_local_symbol_count): New function.
1011 (Sized_incr_relobj::do_local_symbol_offset): New function.
1012 (Sized_incr_relobj::local_symbol_count_): New data member.
1013 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
1014 (Sized_incr_relobj::local_symbol_index_): New data member.
1015 (Sized_incr_relobj::local_symbol_offset_): New data member.
1016 (Sized_incr_relobj::local_dynsym_offset_): New data member.
1017 (Sized_incr_relobj::local_symbols_): New data member.
1018 * object.h (Relobj::output_local_symbol_count): New function.
1019 (Relobj::local_symbol_offset): New function.
1020 (Relobj::do_output_local_symbol_count): New function.
1021 (Relobj::do_local_symbol_offset): New function.
1022 (Sized_relobj::do_output_local_symbol_count): New function.
1023 (Sized_relobj::do_local_symbol_offset): New function.
1024
d0a9ace3
ILT
10252011-04-22 Vladimir Simonov <sv@sw.ru>
1026
1027 * descriptors.cc (set_close_on_exec): New function.
1028 (Descriptors::open): Use set_close_on_exec.
1029 * output.cc (S_ISLNK): Define if not defined.
1030
94a3fc8b
CC
10312011-04-22 Cary Coutant <ccoutant@google.com>
1032
1033 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
1034 global symbol map.
1035 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1036 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
1037 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
1038 relocations.
1039 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
1040 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
1041 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
1042 * incremental.h
1043 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
1044 function.
1045 (Incremental_binary::apply_incremental_relocs): New function.
1046 (Incremental_binary::do_apply_incremental_relocs): New function.
1047 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
1048 data member.
1049 (Sized_incremental_binary::add_global_symbol): New function.
1050 (Sized_incremental_binary::global_symbol): New function.
1051 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
1052 (Sized_incremental_binary::symbol_map_): New data member.
1053 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
1054 * target.h (Sized_target::apply_relocation): New function.
1055 * target-reloc.h (apply_relocation): New function.
1056 * x86_64.cc (Target_x86_64::apply_relocation): New function.
1057
c87e4302
DK
10582011-04-22 Doug Kwan <dougkwan@google.com>
1059
1060 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
1061 flag of a SHT_ARM_EXIDX section.
1062 * testsuite/Makefile.am (arm_exidx_test): New test rules.
1063 * testsuite/Makefile.in: Regenerate.
1064 * testsuite/arm_exidx_test.s: New file.
1065 * testsuite/arm_exidx_test.sh: Same.
1066
e7782cf6
CC
10672011-04-20 Cary Coutant <ccoutant@google.com>
1068
1069 PR gold/12689
1070 * archive.h (Incremental_archive_entry::Archive_member):
1071 Initialize arg_serial_ (second constructor).
1072
308ecdc7
ILT
10732011-04-17 Ian Lance Taylor <iant@google.com>
1074
1075 * object.cc (Relocate_info::location): Simplify location string.
1076 * errors.cc (Errors::error_at_location): Don't print program
1077 name.
1078 (Errors::warning_at_location): Likewise.
1079 (Errors::undefined_symbol): Likewise.
1080 * testsuite/debug_msg.sh: Update accordingly.
1081
bec5b579
CC
10822011-04-14 Cary Coutant <ccoutant@google.com>
1083
1084 * gold/layout.cc (Layout::symtab_section_offset): New function.
1085 * gold/layout.h (Layout::symtab_section_offset): New function.
1086 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
1087
88597d34
ILT
10882011-04-12 Ian Lance Taylor <iant@google.com>
1089
1090 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
1091 with MREMAP_MAYMOVE.
1092 * output.h (class Output_file): Add map_is_allocated_ field.
1093 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
1094 not available, provide stubs. If mremap is not available, #define
1095 it to gold_mremap.
1096 (MREMAP_MAYMOVE): Define if not defined.
1097 (Output_file::Output_file): Initialize map_is_allocated_.
1098 (Output_file::resize): Check map_is_allocated_.
1099 (Output_file::map_anonymous): If mmap fails, use malloc.
1100 (Output_file::unmap): Don't do anything for an anonymous map.
1101 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
1102 is not available, provide stubs.
1103 (File_read::View::~View): Use free rather than delete[].
1104 (File_read::make_view): Use malloc rather than new[]. If mmap
1105 fails, use malloc.
1106 (File_read::find_or_make_view): Use malloc rather than new[].
1107 * gold.h: Remove HAVE_REMAP code.
1108 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1109 exists. Rename mremap to gold_mremap. If mmap is not available
1110 don't do anything.
1111 * configure, config.in: Rebuild.
1112
11e361bc
ILT
11132011-04-11 Ian Lance Taylor <iant@google.com>
1114
1115 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1116 initialize local variable v.
1117
cdc29364
CC
11182011-04-11 Cary Coutant <ccoutant@google.com>
1119
1120 * archive.cc (Archive::include_member): Adjust call to
1121 report_object.
1122 (Add_archive_symbols::run): Track argument serial numbers.
1123 (Lib_group::include_member): Likewise.
1124 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1125 * archive.h (Incremental_archive_entry::Archive_member):
1126 Initialize arg_serial_.
1127 (Archive_member::arg_serial_): New data member.
1128 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1129 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1130 incremental link.
1131 (Sized_dynobj::do_for_all_local_got_entries): New function.
1132 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1133 function.
1134 * fileread.cc (get_mtime): New function.
1135 * fileread.h (get_mtime): New function.
1136 * gold.cc (queue_initial_tasks): Check for incremental update.
1137 (process_incremental_input): New function.
1138 (queue_middle_tasks): Don't force valid target for incremental
1139 update.
1140 * incremental-dump.cc (find_input_containing_global): Adjust
1141 size of symbol info entry.
1142 (dump_incremental_inputs): Dump argument serial number and
1143 in_system_directory flag; bias shndx by 1; print symbol names
1144 when dumping per-file symbol lists; use new symbol info readers.
1145 * incremental.cc
1146 (Output_section_incremental_inputs:update_data_size): New function.
1147 (Sized_incremental_binary::setup_readers): Setup input readers
1148 for each input file; build maps for files added from libraries
1149 and scripts.
1150 (Sized_incremental_binary::check_input_args): New function.
1151 (Sized_incremental_binary::do_check_inputs): Build map of argument
1152 serial numbers to input arguments.
1153 (Sized_incremental_binary::do_file_has_changed): Rename
1154 do_file_is_unchanged to this; compare file modification times.
1155 (Sized_incremental_binary::do_init_layout): New function.
1156 (Sized_incremental_binary::do_reserve_layout): New function.
1157 (Sized_incremental_binary::do_get_input_reader): Remove.
1158 (Sized_incremental_binary::get_symtab_view): New function.
1159 (Incremental_checker::can_incrementally_link_output_file): Remove.
1160 (Incremental_inputs::report_command_line): Exclude --debug options.
1161 (Incremental_inputs::report_archive_begin): Add parameter; track
1162 argument serial numbers; don't put input file entry for archive
1163 before archive members.
1164 (Incremental_inputs::report_archive_end): Put input file entry
1165 for archive after archive members.
1166 (Incremental_inputs::report_object): Add parameter; track argument
1167 serial numbers and in_system_directory flag.
1168 (Incremental_inputs::report_script): Add parameter; track argument
1169 serial numbers.
1170 (Output_section_incremental_inputs::set_final_data_size): Adjust
1171 size of symbol info entry; check for forwarding symbols.
1172 (Output_section_incremental_inputs::write_input_files): Write
1173 in_system_directory flag and argument serial number.
1174 (Output_section_incremental_inputs::write_info_blocks): Map section
1175 indices between incremental info and original input file; store
1176 input section index for each symbol.
1177 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1178 change operator() to visit().
1179 (class Global_got_offset_visitor): Likewise.
1180 (class Global_symbol_visitor_got_plt):
1181 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1182 classes.
1183 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1184 (Sized_incr_relobj::do_read_symbols): New function.
1185 (Sized_incr_relobj::do_layout): New function.
1186 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1187 (Sized_incr_relobj::do_add_symbols): New function.
1188 (Sized_incr_relobj::do_should_include_member): New function.
1189 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1190 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1191 (Sized_incr_relobj::do_section_size): New function.
1192 (Sized_incr_relobj::do_section_name): New function.
1193 (Sized_incr_relobj::do_section_contents): New function.
1194 (Sized_incr_relobj::do_section_flags): New function.
1195 (Sized_incr_relobj::do_section_entsize): New function.
1196 (Sized_incr_relobj::do_section_address): New function.
1197 (Sized_incr_relobj::do_section_type): New function.
1198 (Sized_incr_relobj::do_section_link): New function.
1199 (Sized_incr_relobj::do_section_info): New function.
1200 (Sized_incr_relobj::do_section_addralign): New function.
1201 (Sized_incr_relobj::do_initialize_xindex): New function.
1202 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1203 (Sized_incr_relobj::do_read_relocs): New function.
1204 (Sized_incr_relobj::do_gc_process_relocs): New function.
1205 (Sized_incr_relobj::do_scan_relocs): New function.
1206 (Sized_incr_relobj::do_count_local_symbols): New function.
1207 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1208 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1209 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1210 (Sized_incr_relobj::do_relocate): New function.
1211 (Sized_incr_relobj::do_set_section_offset): New function.
1212 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1213 (Sized_incr_dynobj::do_read_symbols): New function.
1214 (Sized_incr_dynobj::do_layout): New function.
1215 (Sized_incr_dynobj::do_add_symbols): New function.
1216 (Sized_incr_dynobj::do_should_include_member): New function.
1217 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1218 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1219 (Sized_incr_dynobj::do_section_size): New function.
1220 (Sized_incr_dynobj::do_section_name): New function.
1221 (Sized_incr_dynobj::do_section_contents): New function.
1222 (Sized_incr_dynobj::do_section_flags): New function.
1223 (Sized_incr_dynobj::do_section_entsize): New function.
1224 (Sized_incr_dynobj::do_section_address): New function.
1225 (Sized_incr_dynobj::do_section_type): New function.
1226 (Sized_incr_dynobj::do_section_link): New function.
1227 (Sized_incr_dynobj::do_section_info): New function.
1228 (Sized_incr_dynobj::do_section_addralign): New function.
1229 (Sized_incr_dynobj::do_initialize_xindex): New function.
1230 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1231 (make_sized_incremental_object): New function.
1232 (Incremental_library::copy_unused_symbols): New function.
1233 (Incremental_library::do_for_all_unused_symbols): New function.
1234 * incremental.h (enum Incremental_input_flags): New type.
1235 (class Incremental_checker): Remove.
1236 (Incremental_input_entry::Incremental_input_entry): Add argument
1237 serial number.
1238 (Incremental_input_entry::arg_serial): New function.
1239 (Incremental_input_entry::set_is_in_system_directory): New function.
1240 (Incremental_input_entry::is_in_system_directory): New function.
1241 (Incremental_input_entry::arg_serial_): New data member.
1242 (Incremental_input_entry::is_in_system_directory_): New data member.
1243 (class Script_info): Move here from script.h.
1244 (Script_info::Script_info): Add filename parameter.
1245 (Script_info::filename): New function.
1246 (Script_info::filename_): New data member.
1247 (Incremental_script_entry::Incremental_script_entry): Add argument
1248 serial number.
1249 (Incremental_object_entry::Incremental_object_entry): Likewise.
1250 (Incremental_object_entry::add_input_section): Build list of input
1251 sections with map to original shndx.
1252 (Incremental_object_entry::get_input_section_index): New function.
1253 (Incremental_object_entry::shndx_): New data member.
1254 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1255 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1256 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1257 serial number.
1258 (Incremental_inputs::report_archive_begin): Likewise.
1259 (Incremental_inputs::report_object): Likewise.
1260 (Incremental_inputs::report_script): Likewise.
1261 (class Incremental_global_symbol_reader): New class.
1262 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1263 and store flags and input file type.
1264 (Incremental_input_entry_reader::arg_serial): New function.
1265 (Incremental_input_entry_reader::type): Extract type from flags.
1266 (Incremental_input_entry_reader::is_in_system_directory): New function.
1267 (Incremental_input_entry_reader::get_input_section_count): Call
1268 accessor function for type.
1269 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1270 function for type; adjust size of global symbol entry.
1271 (Incremental_input_entry_reader::get_global_symbol_count): Call
1272 accessor function for type.
1273 (Incremental_input_entry_reader::get_object_count): Likewise.
1274 (Incremental_input_entry_reader::get_object_offset): Likewise.
1275 (Incremental_input_entry_reader::get_member_count): Likewise.
1276 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1277 (Incremental_input_entry_reader::get_member_offset): Likewise.
1278 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1279 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1280 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1281 (Incremental_input_entry_reader::get_global_symbol_reader): New
1282 function.
1283 (Incremental_input_entry_reader::get_output_symbol_index): New
1284 function.
1285 (Incremental_input_entry_reader::type_): Remove.
1286 (Incremental_input_entry_reader::flags_): New data member.
1287 (Incremental_inputs_reader::input_file_offset): New function.
1288 (Incremental_inputs_reader::input_file_index): New function.
1289 (Incremental_inputs_reader::input_file): Call input_file_offset.
1290 (Incremental_inputs_reader::input_file_at_offset): New function.
1291 (Incremental_relocs_reader::get_r_type): Reformat.
1292 (Incremental_relocs_reader::get_r_shndx): Reformat.
1293 (Incremental_relocs_reader::get_r_offset): Reformat.
1294 (Incremental_relocs_reader::data): New function.
1295 (Incremental_binary::Incremental_binary): Initialize new data members.
1296 (Incremental_binary::check_inputs): Add cmdline parameter.
1297 (Incremental_binary::file_is_unchanged): Remove.
1298 (Input_reader::arg_serial): New function.
1299 (Input_reader::get_unused_symbol_count): New function.
1300 (Input_reader::get_unused_symbol): New function.
1301 (Input_reader::do_arg_serial): New function.
1302 (Input_reader::do_get_unused_symbol_count): New function.
1303 (Input_reader::do_get_unused_symbol): New function.
1304 (Incremental_binary::input_file_count): New function.
1305 (Incremental_binary::get_input_reader): Change signature to use
1306 index instead of filename.
1307 (Incremental_binary::file_has_changed): New function.
1308 (Incremental_binary::get_input_argument): New function.
1309 (Incremental_binary::get_library): New function.
1310 (Incremental_binary::get_script_info): New function.
1311 (Incremental_binary::init_layout): New function.
1312 (Incremental_binary::reserve_layout): New function.
1313 (Incremental_binary::output_file): New function.
1314 (Incremental_binary::do_check_inputs): New function.
1315 (Incremental_binary::do_file_is_unchanged): Remove.
1316 (Incremental_binary::do_file_has_changed): New function.
1317 (Incremental_binary::do_init_layout): New function.
1318 (Incremental_binary::do_reserve_layout): New function.
1319 (Incremental_binary::do_input_file_count): New function.
1320 (Incremental_binary::do_get_input_reader): Change signature.
1321 (Incremental_binary::input_args_map_): New data member.
1322 (Incremental_binary::library_map_): New data member.
1323 (Incremental_binary::script_map_): New data member.
1324 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1325 new data members.
1326 (Sized_incremental_binary::output_section): New function.
1327 (Sized_incremental_binary::inputs_reader): Add const.
1328 (Sized_incremental_binary::symtab_reader): Add const.
1329 (Sized_incremental_binary::relocs_reader): Add const.
1330 (Sized_incremental_binary::got_plt_reader): Add const.
1331 (Sized_incremental_binary::get_symtab_view): New function.
1332 (Sized_incremental_binary::Inputs_reader): New typedef.
1333 (Sized_incremental_binary::Input_entry_reader): New typedef.
1334 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1335 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1336 (Sized_incremental_binary::do_file_has_changed): New function.
1337 (Sized_incremental_binary::do_init_layout): New function.
1338 (Sized_incremental_binary::do_reserve_layout): New function.
1339 (Sized_input_reader::Inputs_reader): Remove.
1340 (Sized_input_reader::Input_entry_reader): Remove.
1341 (Sized_input_reader::do_arg_serial): New function.
1342 (Sized_input_reader::do_get_unused_symbol_count): New function.
1343 (Sized_input_reader::do_get_unused_symbol): New function.
1344 (Sized_incremental_binary::do_input_file_count): New function.
1345 (Sized_incremental_binary::do_get_input_reader): Change signature;
1346 use index instead of filename.
1347 (Sized_incremental_binary::section_map_): New data member.
1348 (Sized_incremental_binary::input_entry_readers_): New data member.
1349 (class Sized_incr_relobj): New class.
1350 (class Sized_incr_dynobj): New class.
1351 (make_sized_incremental_object): New function.
1352 (class Incremental_library): New class.
1353 * layout.cc (Free_list::num_lists): New static data member.
1354 (Free_list::num_nodes): New static data member.
1355 (Free_list::num_removes): New static data member.
1356 (Free_list::num_remove_visits): New static data member.
1357 (Free_list::num_allocates): New static data member.
1358 (Free_list::num_allocate_visits): New static data member.
1359 (Free_list::init): New function.
1360 (Free_list::remove): New function.
1361 (Free_list::allocate): New function.
1362 (Free_list::dump): New function.
1363 (Free_list::print_stats): New function.
1364 (Layout_task_runner::run): Resize output file for incremental updates.
1365 (Layout::Layout): Initialize new data members.
1366 (Layout::set_incremental_base): New function.
1367 (Layout::init_fixed_output_section): New function.
1368 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1369 incremental updates.
1370 (Layout::create_gold_note): Do not create gold note section for
1371 incremental updates.
1372 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1373 for incremental updates.
1374 (Layout::set_section_offsets): For incremental updates, allocate space
1375 from free list.
1376 (Layout::create_symtab_sections): Layout with offsets relative to
1377 start of section; for incremental updates, allocate space from free
1378 list.
1379 (Layout::create_shdrs): For incremental updates, allocate space from
1380 free list.
1381 (Layout::finish_dynamic_section): For incremental updates, do not
1382 check --as-needed (fixed in subsequent patch).
1383 * layout.h (class Free_list): New class.
1384 (Layout::set_incremental_base): New function.
1385 (Layout::incremental_base): New function.
1386 (Layout::init_fixed_output_section): New function.
1387 (Layout::allocate): New function.
1388 (Layout::incremental_base_): New data member.
1389 (Layout::free_list_): New data member.
1390 * main.cc (main): Print Free_list statistics.
1391 * object.cc (Relobj::finalize_incremental_relocs): Add
1392 clear_counts parameter; clear counts only when clear_counts is set.
1393 (Sized_relobj::Sized_relobj): Initialize new base class.
1394 (Sized_relobj::do_layout): Don't report special sections.
1395 (Sized_relobj::do_for_all_local_got_entries): New function.
1396 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1397 symtab_off to all symbol table offsets.
1398 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1399 * object.h (class Got_offset_list): Move to top of file.
1400 (Object::Object): Allow case where input_file == NULL.
1401 (Object::~Object): Likewise.
1402 (Object::input_file): Assert that input_file != NULL.
1403 (Object::lock): Allow case where input_file == NULL.
1404 (Object::unlock): Likewise.
1405 (Object::is_locked): Likewise.
1406 (Object::token): Likewise.
1407 (Object::release): Likewise.
1408 (Object::is_incremental): New function.
1409 (Object::get_mtime): New function.
1410 (Object::for_all_local_got_entries): New function.
1411 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1412 (Object::set_is_in_system_directory): New function.
1413 (Object::is_in_system_directory): New function.
1414 (Object::do_is_incremental): New function.
1415 (Object::do_get_mtime): New function.
1416 (Object::do_for_all_local_got_entries): New function.
1417 (Object::is_in_system_directory_): New data member.
1418 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1419 (class Sized_relobj_base): New class.
1420 (class Sized_relobj): Derive from Sized_relobj_base.
1421 (class Sized_relobj::Symbols): Redeclare from base class.
1422 (class Sized_relobj::local_got_offset_list): Remove.
1423 (class Sized_relobj::Output_sections): Redeclare from base class.
1424 (class Sized_relobj::do_for_all_local_got_entries): New function.
1425 (class Sized_relobj::write_local_symbols): Add offset parameter.
1426 (class Sized_relobj::local_symbol_offset_): Update comment.
1427 (class Sized_relobj::local_dynsym_offset_): Update comment.
1428 * options.cc (Input_arguments::add_file): Remove const.
1429 * options.h (Input_file_argument::Input_file_argument):
1430 Initialize arg_serial_ (all constructors).
1431 (Input_file_argument::set_arg_serial): New function.
1432 (Input_file_argument::arg_serial): New function.
1433 (Input_file_argument::arg_serial_): New data member.
1434 (Input_arguments::Input_arguments): Initialize file_count_.
1435 (Input_arguments::add_file): Remove const.
1436 (Input_arguments::number_of_input_files): New function.
1437 (Input_arguments::file_count_): New data member.
1438 (Command_line::number_of_input_files): Call
1439 Input_arguments::number_of_input_files.
1440 * output.cc (Output_segment_headers::Output_segment_headers):
1441 Set current size.
1442 (Output_section::Input_section::current_data_size): New function.
1443 (Output_section::Output_section): Initialize new data members.
1444 (Output_section::add_input_section): Don't do merge sections for
1445 an incremental link; allocate space from free list for an
1446 incremental update.
1447 (Output_section::add_output_section_data): Allocate space from
1448 free list for an incremental update.
1449 (Output_section::update_data_size): New function.
1450 (Output_section::set_fixed_layout): New function.
1451 (Output_section::reserve): New function.
1452 (Output_segment::set_section_addresses): Remove const.
1453 (Output_segment::set_section_list_addresses): Remove const; allocate
1454 space from free list for an incremental update.
1455 (Output_segment::set_offset): Adjust size of RELRO segment for an
1456 incremental update.
1457 * output.h (Output_data::current_data_size): Move here from
1458 child classes.
1459 (Output_data::pre_finalize_data_size): New function.
1460 (Output_data::update_data_size): New function.
1461 (Output_section_headers::update_data_size): new function.
1462 (Output_section_data_build::current_data_size): Move to Output_data.
1463 (Output_data_strtab::update_data_size): New function.
1464 (Output_section::current_data_size): Move to Output_data.
1465 (Output_section::set_fixed_layout): New function.
1466 (Output_section::has_fixed_layout): New function.
1467 (Output_section::reserve): New function.
1468 (Output_section::update_data_size): New function.
1469 (Output_section::has_fixed_layout_): New data member.
1470 (Output_section::free_list_): New data member.
1471 (Output_segment::set_section_addresses): Remove const.
1472 (Output_segment::set_section_list_addresses): Remove const.
1473 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1474 New function.
1475 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1476 New function.
1477 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1478 parameter when calling Add_symbols constructor; store argument
1479 serial number for members of a lib group.
1480 (Add_symbols::locks): Allow case where token == NULL.
1481 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1482 (Read_member::~Read_member): New function.
1483 (Read_member::is_runnable): New function.
1484 (Read_member::locks): New function.
1485 (Read_member::run): New function.
1486 (Check_script::~Check_script): New function.
1487 (Check_script::is_runnable): New function.
1488 (Check_script::locks): New function.
1489 (Check_script::run): New function.
1490 (Check_library::~Check_library): New function.
1491 (Check_library::is_runnable): New function.
1492 (Check_library::locks): New function.
1493 (Check_library::run): New function.
1494 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1495 (Add_symbols::library_): New data member.
1496 (class Read_member): New class.
1497 (class Check_script): New class.
1498 (class Check_library): New class.
1499 * reloc.cc (Read_relocs::is_runnable): Allow case where
1500 token == NULL.
1501 (Read_relocs::locks): Likewise.
1502 (Scan_relocs::locks): Likewise.
1503 (Relocate_task::locks): Likewise.
1504 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1505 to clear counters.
1506 (Sized_relobj::incremental_relocs_scan): Fix comment.
1507 (Sized_relobj::do_relocate): Pass output file offset to
1508 write_local_symbols.
1509 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1510 from class declaration.
1511 * script.cc (read_input_script): Allocate Script_info; pass
1512 argument serial number to report_script.
1513 * script.h (class Script_info): Move to incremental.h.
1514 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1515 * symtab.h (Symbol_table::add_from_incrobj): New function.
1516 (Symbol_table::set_file_offset): New function.
1517
b961d0d7
CC
15182011-04-05 Cary Coutant <ccoutant@google.com>
1519
1520 * incremental-dump.cc (dump_incremental_inputs): Change signature
1521 to take a Sized_incremental_binary; change caller. Use readers
1522 in Sized_incremental_binary.
1523 * incremental.cc
1524 (Sized_incremental_binary::find_incremental_inputs_sections):
1525 Rename do_find_incremental_inputs_sections to this.
1526 (Sized_incremental_binary::setup_readers): New function.
1527 (Sized_incremental_binary::do_check_inputs): Check
1528 has_incremental_info_ flag; move setup code to setup_readers;
1529 use input readers.
1530 (Sized_incremental_binary::do_file_is_unchanged): New function.
1531 (Sized_incremental_binary::do_get_input_reader): New function.
1532 * incremental.h (class Incremental_binary): Move to end of file.
1533 (Incremental_binary::file_is_unchanged): New function.
1534 (Incremental_binary::do_file_is_unchanged): New function.
1535 (Incremental_binary::Input_reader): New class.
1536 (Incremental_binary::get_input_reader): New function.
1537 (class Sized_incremental_binary): Move to end of file.
1538 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1539 input section reader classes.
1540 (Sized_incremental_binary::has_incremental_info): New function.
1541 (Sized_incremental_binary::inputs_reader): New function.
1542 (Sized_incremental_binary::symtab_reader): New function.
1543 (Sized_incremental_binary::relocs_reader): New function.
1544 (Sized_incremental_binary::got_plt_reader): New function.
1545 (Sized_incremental_binary::do_file_is_unchanged): New function.
1546 (Sized_incremental_binary::Sized_input_reader): New class.
1547 (Sized_incremental_binary::get_input_reader): New function.
1548 (Sized_incremental_binary::find_incremental_inputs_sections):
1549 Rename do_find_incremental_inputs_sections to this.
1550 (Sized_incremental_binary::setup_readers): New function.
1551 (Sized_incremental_binary::has_incremental_info_): New data member.
1552 (Sized_incremental_binary::inputs_reader_): New data member.
1553 (Sized_incremental_binary::symtab_reader_): New data member.
1554 (Sized_incremental_binary::relocs_reader_): New data member.
1555 (Sized_incremental_binary::got_plt_reader_): New data member.
1556 (Sized_incremental_binary::current_input_file_): New data member.
1557
a869183f
PP
15582011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1559
1560 PR gold/12640
1561 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1562 violation.
1563
15642011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
1565
1566 * archive.cc (Archive::include_member): Adjust call to report_object.
1567 (Add_archive_symbols::run): Add script_info to call to
1568 report_archive_begin.
1569 (Lib_group::include_member): Adjust call to report_object.
1570 (Add_lib_group_symbols::run): Adjust call to report_object.
1571 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1572 blocks. Add object count for script input files.
1573 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1574 script_info parameter; change all callers.
1575 (Incremental_inputs::report_object): Add script_info parameter;
1576 change all callers.
1577 (Incremental_inputs::report_script): Store backpointer to
1578 incremental info entry.
1579 (Output_section_incremental_inputs::set_final_data_size): Record
1580 additional information for scripts.
1581 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1582 * incremental.h (Incremental_script_entry::add_object): New function.
1583 (Incremental_script_entry::get_object_count): New function.
1584 (Incremental_script_entry::get_object): New function.
1585 (Incremental_script_entry::objects_): New data member; adjust
1586 constructor.
1587 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1588 (Incremental_inputs::report_object): Add script_info parameter.
1589 (Incremental_inputs_reader::get_object_count): New function.
1590 (Incremental_inputs_reader::get_object_offset): New function.
1591 * options.cc (Input_arguments::add_file): Return reference to
1592 new input argument.
1593 * options.h (Input_argument::set_script_info): New function.
1594 (Input_argument::script_info): New function.
1595 (Input_argument::script_info_): New data member; adjust all
1596 constructors.
1597 (Input_file_group::add_file): Return reference to new input argument.
1598 (Input_file_lib::add_file): Likewise.
1599 (Input_arguments::add_file): Likewise.
1600 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1601 * script.cc (Parser_closure::Parser_closure): Add script_info
1602 parameter; adjust all callers.
1603 (Parser_closure::script_info): New function.
1604 (Parser_closure::script_info_): New data member.
1605 (read_input_script): Report scripts earlier to incremental info.
1606 (script_add_file): Set script_info in Input_argument.
1607 (script_add_library): Likewise.
1608 * script.h (Script_options::Script_info): Rewrite class.
1609
a869183f 16102011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
1611
1612 * archive.cc (Library_base::should_include_member): Move
1613 method here from class Archive.
1614 (Archive::Archive): Initialize base class.
1615 (Archive::should_include_member): Move to base class.
1616 (Archive::do_for_all_unused_symbols): New function.
1617 (Add_archive_symbols::run): Remove redundant access to
1618 incremental_inputs.
1619 (Lib_group::Lib_group): Initialize base class.
1620 (Lib_group::do_filename): New function.
1621 (Lib_group::include_member): Pass pointer to Lib_group to
1622 report_object.
1623 (Lib_group::do_for_all_unused_symbols): New function.
1624 (Add_lib_group_symbols::run): Report archive information for
1625 incremental links.
1626 * archive.h (class Library_base): New base class.
1627 (class Archive): Derive from Library_base.
1628 (Archive::filename): Move to base class.
1629 (Archive::set_incremental_info): Likewise.
1630 (Archive::incremental_info): Likewise.
1631 (Archive::Should_include): Likewise.
1632 (Archive::should_include_member): Likewise.
1633 (Archive::Armap_entry): Remove.
1634 (Archive::Unused_symbol_iterator): Remove.
1635 (Archive::unused_symbols_begin): Remove.
1636 (Archive::unused_symbols_end): Remove.
1637 (Archive::do_filename): New function.
1638 (Archive::do_get_mtime): New function.
1639 (Archive::do_for_all_unused_symbols): New function.
1640 (Archive::task_): Move to base class.
1641 (Archive::incremental_info_): Likewise.
1642 (class Lib_group): Derive from Library_base.
1643 (Lib_group::do_filename): New function.
1644 (Lib_group::do_get_mtime): New function.
1645 (Lib_group::do_for_all_unused_symbols): New function.
1646 (Lib_group::task_): Move to base class.
1647 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1648 function.
1649 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1650 function.
1651 * incremental.cc (Incremental_inputs::report_archive_begin):
1652 Use Library_base; call library's get_mtime; add incremental inputs
1653 entry before members.
1654 (class Unused_symbol_visitor): New class.
1655 (Incremental_inputs::report_archive_end): Use Library_base; use
1656 visitor class to record unused symbols; don't add incremental inputs
1657 entry after members.
1658 (Incremental_inputs::report_object): Use Library_base.
1659 * incremental.h
1660 (Incremental_archive_entry::Incremental_archive_entry): Remove
1661 unused Archive parameter.
1662 (Incremental_inputs::report_archive_begin): Use Library_base.
1663 (Incremental_inputs::report_archive_end): Likewise.
1664 (Incremental_inputs::report_object): Likewise.
1665 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1666 function.
1667 * object.h (Object::for_all_global_symbols): New function.
1668 (Object::do_for_all_global_symbols): New function.
1669 (Sized_relobj::do_for_all_global_symbols): New function.
1670 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1671 function.
1672 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1673 function.
1674
61ab3e40
ILT
16752011-03-27 Ian Lance Taylor <iant@google.com>
1676
1677 * archive.cc (Archive::interpret_header): Return -1 if something
1678 goes wrong. Change callers accordingly.
1679
30e1f9e6
CC
16802011-03-25 Cary Coutant <ccoutant@google.com>
1681
1682 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1683 * testsuite/Makefile.in: Regenerate.
1684
9c793f14
RÁE
16852010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1686
1687 * plugin.cc (get_view): New.
1688 (Plugin::load): Pass get_view to the plugin.
1689 (Plugin_manager::get_view): New.
1690
9312bb0a
ILT
16912011-03-21 Ian Lance Taylor <iant@google.com>
1692
1693 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 1694 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 1695
7e12ba9e
ST
16962011-03-21 Sriraman Tallam <tmsriram@google.com>
1697
1698 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1699 Change == to -eq.
1700 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1701 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1702 Change == to -eq.
1703 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1704 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1705
fd7a005d
ILT
17062011-03-14 Ian Lance Taylor <iant@google.com>
1707
1708 * script-sections.cc (Sort_output_sections::script_compare):
1709 Rename from is_before, change return type.
1710 (Sort_output_sections::operator()): Adjust accordingly.
1711
ed16fd1b
ILT
17122011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1713
1714 PR gold/12572
1715 * testsuite/odr_violation2.cc: Add comment to make all error line
1716 numbers double digits.
1717 * testsuite/debug_msg.sh: Adjust expected errors.
1718
71ff8986
ILT
17192011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1720
1721 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1722 but mark earlier ones as non-canonical
1723 (offset_to_iterator): Update search target and example
1724 (do_addr2line): Return extra lines in a vector*
1725 (format_file_lineno): Extract from do_addr2line
1726 (one_addr2line): Add vector* out-param
1727 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1728 when a lineno entry appeared last for its instruction
1729 (Dwarf_line_info): Add vector* out-param
1730 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1731 * symtab.cc (Odr_violation_compare): Include the lineno in the
1732 comparison again.
1733 (linenos_from_loc): New. Combine the canonical line for an
1734 address with its other lines.
1735 (True_if_intersect): New. Helper functor to make
1736 std::set_intersection a query.
1737 (detect_odr_violations): Compare sets of lines instead of just
1738 one line for each function. This became less deterministic, but
1739 has fewer false positives.
1740 * symtab.h: Declarations.
1741 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1742 mix an optimized and non-optimized object in the same binary
1743 (odr_violation2.so): Same.
1744 * testsuite/Makefile.in: Regenerate from Makefile.am.
1745 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1746 * testsuite/debug_msg.sh: Update line numbers and add
1747 assertions.
1748 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1749 non-optimized context.
1750 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1751 isn't inlined, and use OdrDerived in an optimized context.
1752 * testsuite/odr_header1.h: Defines OdrDerived, where
1753 optimization will change the
1754 first-instruction-in-the-destructor's file and line number.
1755 * testsuite/odr_header2.h: Defines OdrBase.
1756
a19fefdc
ILT
17572011-03-09 Ian Lance Taylor <iant@google.com>
1758
1759 * fileread.cc (File_read::clear_views): Don't delete the whole
1760 file view.
1761
ecb351e9
ILT
17622011-03-08 Ian Lance Taylor <iant@google.com>
1763
1764 PR gold/12525
1765 * fileread.cc: #include <climits>.
1766 (GOLD_IOV_MAX): Define.
1767 (File_read::read_multiple): Limit number of entries by iov_max.
1768 * fileread.h (class File_read): Always set max_readv_entries to
1769 128.
1770
b821d13c
ILT
17712011-03-07 Ian Lance Taylor <iant@google.com>
1772
1773 PR gold/12525
1774 * options.h (class General_options): Add -dy and -dn.
1775
89243142
CC
17762011-03-02 Cary Coutant <ccoutant@google.com>
1777
1778 * testsuite/script_test_9.t: Add TLS segment.
1779
d0773f31
ILT
17802011-03-02 Simon Baldwin <simonb@google.com>
1781
1782 * configure.ac: Add check for gnu_indirect_function support in
1783 the toolchain building binutils.
1784 * configure: Rebuild.
1785
badc8139
RÁE
17862010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1787
1788 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1789 plugin only symbols.
1790 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1791 in plugin files as not needed in the symbol table.
1792
4cf7a849
ST
17932011-02-11 Sriraman Tallam <tmsriram@google.com>
1794
1795 * output.cc (Output_section::add_input_section): Delay fill
1796 generation for section ordering.
1797
b578bd7d
ILT
17982011-02-09 Ian Lance Taylor <iant@google.com>
1799
1800 PR gold/12316
1801 * object.h (class Sized_relobj): Remove clear_local_symbols.
1802 * reloc.cc (Sized_relobj::do_relocate): Don't call
1803 clear_local_symbols.
1804
84ced98a
RÁE
18052010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1806
1807 * plugin.cc (is_visible_from_outside): Return true for symbols
1808 in the -u option.
1809
55382fb7
ILT
18102011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1811
1812 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1813 filename.
1814
4e271fff
ST
18152011-02-02 Sriraman Tallam <tmsriram@google.com>
1816
1817 * icf.h (is_section_foldable_candidate): Change type of parameter
1818 to std::string.
1819 * icf.cc (Icf::find_identical_sections): Change type of local variable
1820 section_name to be std::string.
1821 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1822
d433c3ac
ILT
18232011-01-25 Ian Lance Taylor <iant@google.com>
1824
1825 * script.cc (script_add_extern): Rewrite to use
1826 add_symbol_reference.
1827
880473a6
DK
18282011-01-25 Doug Kwan <dougkwan@google.com>
1829
d433c3ac 1830 * icf.cc (get_section_contents): Always lock section's object.
880473a6 1831
f30f86fa
ILT
18322011-01-24 Ian Lance Taylor <iant@google.com>
1833
1834 * options.h (class General_options): Accept
1835 --no-detect-odr-violations.
1836
8e51a0b9
ILT
18372011-01-24 Ian Lance Taylor <iant@google.com>
1838
1839 * version.cc (version_string): Bump to 1.11.
1840
0f3b89d8
ILT
18412011-01-24 Ian Lance Taylor <iant@google.com>
1842
1843 * plugin.cc (class Plugin_rescan): Define new class.
1844 (Plugin_manager::claim_file): Set any_claimed_.
1845 (Plugin_manager::save_archive): New function.
1846 (Plugin_manager::save_input_group): New function.
1847 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1848 necessary.
1849 (Plugin_manager::new_undefined_symbol): New function.
1850 (Plugin_manager::rescan): New function.
1851 (Plugin_manager::rescannable_defines): New function.
1852 (Plugin_manager::add_input_file): Set any_added_.
1853 * plugin.h (class Plugin_manager): define new fields rescannable_,
1854 undefined_symbols_, any_claimed_, and any_added_. Declare
1855 Plugin_rescan as friend. Declare new functions.
1856 (Plugin_manager::Rescannable): Define type.
1857 (Plugin_manager::Rescannable_list): Define type.
1858 (Plugin_manager::Undefined_symbol_list): Define type.
1859 (Plugin_manager::Plugin_manager): Initialize new fields.
1860 * archive.cc (Archive::defines_symbol): New function.
1861 (Add_archive_symbols::run): Pass archive to plugins if any.
1862 * archive.h (class Archive): Declare defines_symbol.
1863 * readsyms.cc (Input_group::~Input_group): New function.
1864 (Finish_group::run): Pass input_group to plugins if any.
1865 * readsyms.h (class Input_group): Declare destructor.
1866 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1867 any.
1868
3bb951e5
ILT
18692011-01-10 Ian Lance Taylor <iant@google.com>
1870
1871 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1872 section as relro.
1873 (Layout::set_segment_offsets): Reset increase_relro before calling
1874 set_section_addresses a second time.
1875
0aa45fac
CC
18762011-01-04 Cary Coutant <ccoutant@google.com>
1877
1878 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1879 sections before NOBITS sections.
1880
0db46eb4
L
18812011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1882
1883 * version.cc (print_version): Update copyright to 2011.
1884
829c9745
CC
18852010-12-23 Cary Coutant <ccoutant@google.com>
1886
1887 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1888 of OS to this->add. Add OD parameter to second form of the function.
1889
7500420b
ILT
18902010-12-20 Ian Lance Taylor <iant@google.com>
1891
1892 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1893 second of two consecutive entries with same offset.
1894
f8e9a930
RW
18952010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1896
1897 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1898 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1899 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1900 to avoid unneeded links against $(LDADD).
1901 * testsuite/Makefile.in: Regenerate.
1902
2fbb4320
ILT
19032010-12-15 Ian Lance Taylor <iant@google.com>
1904
1905 PR gold/12324
1906 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1907 for R_X86_64_32 and R_X86_64_PC32.
1908 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1909 ver_matching_def_pic.o.
1910 (ver_matching_def_pic.o): New target.
1911
fedb228d
RW
19122010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1913
1914 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1915 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1916 Move definition before File_read::View member definitions.
1917 (File_read::View::~View): Initialize and hold lock before
1918 updating current_mapped_bytes.
1919
9b547ce6
RW
19202010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1921
1922 * dwarf_reader.cc: Remove outdated comment.
1923 * gold-threads.cc: Fix typo in error message.
1924 * archive.cc: Fix typos in comments.
1925 * archive.h: Likewise.
1926 * arm-reloc-property.cc: Likewise.
1927 * arm-reloc-property.h: Likewise.
1928 * arm-reloc.def: Likewise.
1929 * arm.cc: Likewise.
1930 * attributes.h: Likewise.
1931 * cref.cc: Likewise.
1932 * ehframe.cc: Likewise.
1933 * fileread.h: Likewise.
1934 * gold.h: Likewise.
1935 * i386.cc: Likewise.
1936 * icf.cc: Likewise.
1937 * incremental.h: Likewise.
1938 * int_encoding.cc: Likewise.
1939 * layout.h: Likewise.
1940 * main.cc: Likewise.
1941 * merge.h: Likewise.
1942 * object.cc: Likewise.
1943 * object.h: Likewise.
1944 * options.cc: Likewise.
1945 * readsyms.cc: Likewise.
1946 * reduced_debug_output.cc: Likewise.
1947 * reloc.cc: Likewise.
1948 * script-sections.cc: Likewise.
1949 * sparc.cc: Likewise.
1950 * symtab.h: Likewise.
1951 * target-reloc.h: Likewise.
1952 * target.cc: Likewise.
1953 * target.h: Likewise.
1954 * timer.cc: Likewise.
1955 * timer.h: Likewise.
1956 * x86_64.cc: Likewise.
1957
83e17bd5
CC
19582010-12-09 Cary Coutant <ccoutant@google.com>
1959
1960 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1961 stack.
1962 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1963 parameter; change all callers.
1964 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1965 * options.h (warn_execstack): New option.
1966
017257f8
DK
19672010-12-07 Doug Kwan <dougkwan@google.com>
1968
1969 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1970 like function call relocations.
1971
c20cbc06
ILT
19722010-12-07 Ian Lance Taylor <iant@google.com>
1973
1974 * archive.cc (Archive::get_elf_object_for_member): Permit
1975 punconfigured to be NULL.
1976 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1977 (Archive::include_member): Pass NULL to get_elf_object_for_member
1978 if we searched for the archive and this is the first included
1979 object.
1980
4dbfafcc
ILT
19812010-12-01 Ian Lance Taylor <iant@google.com>
1982
1983 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1984 track_relocs_type_ field.
1985 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1986 Set track_relocs_type_.
1987 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1988 contents when using RELA relocs.
1989 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1990 reloc_map_.
1991 * reloc.cc (Track_relocs::next_addend): New function.
1992 * reloc.h (class Track_relocs): Declare next_addend.
1993
e5e19edd
ILT
19942010-12-01 Ian Lance Taylor <iant@google.com>
1995
1996 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1997 virtual destructor.
1998
9a5ce24c
ILT
19992010-12-01 Ian Lance Taylor <iant@google.com>
2000
2001 * README: Update compilers known to work and fail.
2002
c7791212
NC
20032010-11-23 Matthias Klose <doko@ubuntu.com>
2004
2005 * configure.in: For --enable-gold, handle value `default' instead of
2006 `both*'. Always install ld as ld.bfd, install as ld if gold is
2007 not the default.
2008 * configure: Regenerate.
2009
0ad220c9
DK
20102010-11-18 Doug Kwan <dougkwan@google.com>
2011
2012 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
2013 and right_alignment to be zero. Store result alignment only if it is
2014 greater than existing alignment.
2015
ab8056e0
CC
20162010-11-16 Cary Coutant <ccoutant@google.com>
2017
2018 PR gold/12220
2019 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2020 Check for ".zdebug_line".
2021
fd064a5b
CC
20222010-11-16 Doug Kwan <dougkwan@google.com>
2023 Cary Coutant <ccoutant@google.com>
2024
2025 * output.h (Output_segment::set_section_addresses): Pass increase_relro
2026 by reference; adjust all callers.
2027 * output.cc (Output_segment::set_section_addresses): Adjust references
2028 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
2029 list is empty.
2030 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
2031 end at page boundary.
2032
6fc6ea19
CC
20332010-11-16 Cary Coutant <ccoutant@google.com>
2034
2035 PR gold/12220
2036 * layout.cc (Layout::choose_output_section): Transform names of
2037 compressed sections even when using a script with a SECTIONS clause.
2038 (Layout::output_section_name): Remove code to transform
2039 compressed debug section names.
2040 * output.cc (Output_section::add_input_section): Use uncompressed
2041 section size when tracking input sections.
2042
95a2c8d6
RS
20432010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
2044
2045 * symtab.h (Symbol::NON_PIC_REF): Remove.
2046 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
2047 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
2048 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
2049 (Symbol::use_plt_offset): Take a flags argument and pass it
2050 directly to needs_dynamic_reloc. Restrict check for undefined
2051 weak symbols to function calls.
2052 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
2053 (Target_arm::Scan::global): Use it.
2054 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
2055 (Target_arm::Relocate::relocate): Likewise.
2056 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
2057 parameter with an r_type parameter. Use get_reference_flags
2058 to get the flags.
2059 (Target_arm::Relocate::relocate): Update accordingly.
2060 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
2061 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
2062 (Target_i386::Scan::global): Likewise.
2063 (Target_i386::Relocate::relocate): Likewise.
2064 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
2065 parameter with an r_type parameter. Use get_reference_flags
2066 to get the flags.
2067 (Target_i386::Relocate::relocate): Update accordingly.
2068 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
2069 (Target_powerpc::Scan::global): Use it.
2070 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
2071 (Target_powerpc::Relocate::relocate): Likewise.
2072 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
2073 (Target_sparc::Scan::global): Use it.
2074 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
2075 (Target_sparc::Relocate::relocate): Likewise.
2076 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
2077 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
2078 (Target_x86_64::Scan::global): Likewise.
2079 (Target_x86_64::Relocate::relocate): Likewise.
2080
f625ae50
DK
20812010-11-08 Doug Kwan <dougkwan@google.com>
2082 Cary Coutant <ccoutant@google.com>
2083
2084 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
2085 (Arm_exidx_merge_section::section_contents_): New data member.
2086 (Arm_input_section::Arm_input_section): Initialize original_contents_.
2087 (Arm_input_section::~Arm_input_section): De-allocate memory.
2088 (Arm_input_section::original_contents_): New data member.
2089 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
2090 in parameters instead of calling Object::section_contents without
2091 locking.
2092 (Arm_output_section::group_section): New parameter TASK. Pass it
2093 to callees that need locking objects.
2094 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
2095 to lock EXIDX input sections. Fix a formatting issue. Call
2096 Arm_exidx_merged_section::build_contents to create merged section
2097 contents.
2098 (Arm_output_section::create_stub_group): New parameter TASK. Use it
2099 to lock object of stub table owner.
2100 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
2101 TEXT_SIZE to initialize data member TEXT_SIZE_.
2102 (Arm_exidx_input_section::addralign): Fix typo in comment.
2103 (Arm_exidx_input_section::text_size): New method.
2104 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2105 that require locking objects. Lock objects before scanning for stubs
2106 and updating local symbols.
2107 (Arm_input_section<big_endian>::init): Copy contents of original
2108 input section.
2109 (Arm_input_section<big_endian>::do_write): Use saved contents of
2110 original input section instead of calling Object::section_contents
2111 without locking.
2112 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2113 size without calling Object::section_size().
2114 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2115 for size. Allocate a buffer for merged EXIDX entries.
2116 (Arm_exidx_merged_section::build_contents): New method.
2117 (Arm_exidx_merged_section::do_write): Move merge section contents
2118 building code to Arm_exidx_merged_section::build_contetns. Write
2119 out contetns in buffer instead of building it on the fly.
2120 (Arm_relobj::make_exidx_input_section): Also pass text section size
2121 to Arm_exidx_input_section constructor.
2122 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2123 (Arm_dynobj::do_read_symbols): Fix memory leak.
2124 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2125 * target.h: (class Task): Add forward declaration.
2126 (Target::relax): Add new parameter TASK and pass it to
2127 Target::do_relax().
2128 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2129
5f9bcf58
CC
21302010-11-05 Cary Coutant <ccoutant@google.com>
2131
2132 PR gold/10708
2133 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2134 object when reading from the file.
2135 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2136 second layout pass.
2137 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2138 when reading section contents.
2139 (get_section_contents): Likewise.
2140 (icf::find_identical_sections): Likewise.
2141 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2142 object when reading from the file.
2143 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2144 the object when doing deferred section layout.
2145
e597fa08
NC
21462010-11-03 Nick Clifton <nickc@redhat.com>
2147
2148 PR gold/12001
2149 * script.h (class Symbol_assignment: name): New member. Returns
2150 the name of the symbol.
2151 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2152 Returns true if the given symbol name is on the list of
2153 assignments wating to be processed.
2154 * archive.cc (should_incldue_member): If the symbol is undefined,
2155 check to see if it is on the list of symbols pending assignment.
2156
3f9a3278
ILT
21572010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2158
2159 * script-sections.cc (Script_sections::find_memory_region): Check
2160 for a NULL output section pointer.
2161
d06fb4d1
DK
21622010-10-29 Doug Kwan <dougkwan@google.com>
2163
2164 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2165 Output_section::add_relaxed_input_section.
2166 * output.cc (Output_section::add_relaxed_input_section): Add new
2167 arguments LAYOUT and NAME. Set section order index.
2168 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2169 Copy section order index.
2170 * output.h (Output_section::add_relaxed_input_section): Add new
2171 arguments LAYOUT and NAME.
2172
90e24de5
ILT
21732010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2174
2175 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2176 NATIVE_OR_CROSS_LINKER.
2177 * testsuite/Makefile.in: Regenerate.
2178
c9484ea5
DK
21792010-10-20 Doug Kwan <dougkwan@google.com>
2180
2181 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2182 without SHF_LINK_ORDER flags.
2183 * layout.cc (Layout::choose_output_section): Do not filter
2184 SHF_LINK_ORDER flag in a relocatable link.
2185
5bc2f5be
CC
21862010-10-17 Cary Coutant <ccoutant@google.com>
2187
2188 * output.h (Output_segment::set_section_addresses): Change function
2189 signature. Update all callers.
2190 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2191 sections.
2192 (Output_segment::set_section_addresses): Align after last TLS
2193 section. Add padding before last relro section instead of after.
2194
0c91cf04
DK
21952010-10-17 Doug Kwan <dougkwan@google.com>
2196
2197 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2198 GOT output section to be writable.
2199
8c21d9d3
CC
22002010-10-14 Cary Coutant <ccoutant@google.com>
2201
2202 * debug.h (DEBUG_INCREMENTAL): New flag.
2203 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2204 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2205 mode.
2206 * incremental.cc (report_command_line): Ignore all forms of
2207 --incremental.
2208 * layout.cc (Layout::Layout): Check parameters for incremental link
2209 mode.
2210 * options.cc (General_options::parse_incremental): New function.
2211 (General_options::parse_no_incremental): New function.
2212 (General_options::parse_incremental_full): New function.
2213 (General_options::parse_incremental_update): New function.
2214 (General_options::incremental_mode_): New data member.
2215 (General_options::finalize): Check incremental_mode_.
2216 * options.h (General_options): Update help text for --incremental.
2217 Add --no-incremental, --incremental-full, --incremental-update.
2218 (General_options::Incremental_mode): New enum type.
2219 (General_options::incremental_mode): New function.
2220 (General_options::incremental_mode_): New data member.
2221 * parameters.cc (Parameters::incremental_mode_): New data member.
2222 (Parameters::set_options): Set incremental_mode_.
2223 (Parameters::set_incremental_full): New function.
2224 (Parameters::incremental): New function.
2225 (Parameters::incremental_update): New function.
2226 (set_parameters_incremental_full): New function.
2227 * parameters.h (Parameters::set_incremental_full): New function.
2228 (Parameters::incremental): New function.
2229 (Parameters::incremental_update): New function.
2230 (Parameters::incremental_mode_): New data member.
2231 (set_parameters_incremental_full): New function.
2232 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2233 incremental link mode.
2234 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2235 (Sized_relobj::do_relocate_sections): Likewise.
2236 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2237 option.
2238 * testsuite/Makefile.in: Regenerate.
2239 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2240
bb32aa18 22412010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
2242
2243 * script-sections.h (class Script_sections): Make
2244 Sections_elements typedef public.
2245 * script-sections.cc (class Sort_output_sections): Add elements_
2246 field. Add constructor which sets it; change all callers.
2247 (Sort_output_sections::is_before): New function.
2248 (Sort_output_sections::operator()): Call is_before.
2249 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2250 conditional.
2251 * testsuite/script_test_10.sh: New test. Test script section
2252 order.
2253 * testsuite/script_test_10.t: Likewise.
2254 * testsuite/script_test_10.s: Likewise.
2255 * testsuite/Makefile.am: Wrap the cross linker tests and the
2256 common tests into NATIVE_OR_CROSS_LINKER.
2257 (check_SCRIPTS): Add script_test_10.sh.
2258 (check_DATA): Add script_test_10.stdout.
2259 (script_test_10.o, script_test_10): New targets.
2260 (script_test_10.stdout): New target.
2261 * configure, testsuite/Makefile.in: Regenerate.
2262
3cef7179
ILT
22632010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2264
2265 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2266 error for the deprecated relocations.
2267 (Target_arm::Scan::global): Likewise.
2268 (Target_arm::Relocate::relocate): Likewise.
2269
7411e9a8
RS
22702010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2271
2272 * fileread.cc (Input_file::find_file): Initialize *found_name
2273 and *namep when using the fallback search for case 4.
2274
6a9da32a
CC
22752010-10-11 Cary Coutant <ccoutant@google.com>
2276
2277 * options.h (class General_options): Redefine -z lazy as an alias for
2278 the negation of -z now.
2279
ac897c20
ILT
22802010-10-11 Ian Lance Taylor <iant@google.com>
2281
2282 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2283 binding.
2284
ea5cae92
NC
22852010-10-06 Nick Clifton <nickc@redhat.com>
2286
2287 * script-sections.cc(class Memory_region): Remove
2288 current_lma_offset_ field. Rename current_vma_offset_ to
2289 current_offset_. Add last_section_ field.
2290 (Memory_region::get_current_vma_address): Rename to
2291 get_current_address.
2292 (Memory_region::get_current_lma_address): Delete.
2293 (Memory_region::increment_vma_offset): Rename to
2294 increment_offset.
2295 (Memory_region::increment_lma_offset): Delete.
2296 (Memory_region::attributes_compatible): New method. Returns
2297 true if the provided section is compatible with the region.
2298 (Memory_region::get_last_section): New method. Returns the last
2299 section to use the region.
2300 (Memory_region::set_last_section): New method. Stores the last
2301 section to use the region.
2302 (Script_sections::block_in_region): New method. Returns true if
2303 a block of memory is contained within a region.
2304 (Script_sections::find_memory_region): New method. Locates a
2305 memory region to be used to set a VMA or LMA address.
2306 (Output_section_definition::set_section_addresses): Add code to
2307 check for addresses set by memory regions.
2308 (Output_segment::set_section_addresses): Remove memory region
2309 walking code.
2310 (Script_sections::create_segment): Add a warning if a header
2311 segment is created outside of any region.
2312 * script-sections.h (class Script_sections): Add prototypes for
2313 find_memory_region and block_in_region methods.
2314 * testsuite/memory_test.s: Use .long instead of .word.
2315 * testsuite/memory_test.t: Add some more output sections.
2316 * testsuite/memory_test.sh: Update expected output.
2317
a9bfd952
DK
23182010-10-02 Doug Kwan <dougkwan@google.com>
2319
2320 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2321 defintion to symtab.h
2322 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2323 declaration to defintion.
2324
bacff3ab
NC
23252010-10-01 Nick Clifton <nickc@redhat.com>
2326
2327 * expression.cc (eval): Replace dummy argument with NULL.
2328 (eval_maybe_dot): Check for a NULL result section pointer.
2329 (Symbol_expression::value): Likewise.
2330 (Dot_expression::value): Likewise.
2331 (BINARY_EXPRESSION): Likewise.
2332 (Max_expression::value): Likewise.
2333 (Min_expression::value): Likewise.
2334 (Absolute_expression::value): Likewise.
2335 (Addr_expression::value_from_output_section): Likewise.
2336 (Loaddddr_expression::value_from_output_section): Likewise.
2337 (Segment_start_expression::value): Likewise.
2338 * script-sections.cc
2339 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2340 argument with NULL.
2341 (Sections_elememt_dot_assignment::set_section_addresses):
2342 Likewise.
2343 (Output_data_expression::do_write_to_buffer): Likewise.
2344 (Output_section_definition::finalize_symbols): Likewise.
2345 (Output_section_definition::set_section_addresses): Likewise.
2346
f81bc8b5
DK
23472010-09-30 Doug Kwan <dougkwan@google.com>
2348
2349 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2350
c95e9f27
ST
23512010-09-28 Sriraman Tallam <tmsriram@google.com>
2352
2353 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 2354 function.
c95e9f27
ST
2355 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2356 virtual function.
2357 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2358 virtual function.
2359 * icf.cc (get_section_contents): Inline merge sections only when
2360 target allows it.
2361
3cac54d2
RW
23622010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2363
2364 * configure: Regenerate.
2365
2904037a
ILT
23662010-09-17 Ian Lance Taylor <iant@google.com>
2367
2368 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
2369 * testsuite/Makefile.am (memory_test.o): New target.
2370 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2371 memory_test.t.
2372 * testsuite/Makefile.in: Rebuild.
2904037a 2373
bca7fb63
DK
23742010-09-17 Doug Kwan <dougkwan@google.com>
2375
2376 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2377 defintion if relocation uses GOT entries of the symbol.
2378 * testsuite/icf_safe_test.sh: Fix test.
2379 * testsuite/icf_safe_so_test.sh: Fix test.
2380
4ef28648
CC
23812010-09-16 Cary Coutant <ccoutant@google.com>
2382
2383 * script_sections.cc (class Memory_region): Remove "NULL" from
2384 vector initializations.
2385
793990de
CC
23862010-09-15 Cary Coutant <ccoutant@google.com>
2387
2388 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2389 Resolve forwarding symbols.
2390
81e015e2
DK
23912010-09-15 Doug Kwan <dougkwan@google.com>
2392
2393 * gold/testsuite/script_test_3.t: Add ARM special sections.
2394 * gold/testsuite/script_test_4.t: Same.
2395 * gold/testsuite/script_test_5.t: Same.
2396 * gold/testsuite/script_test_6.t: Same.
2397 * gold/testsuite/script_test_7.t: Same.
2398 * gold/testsuite/script_test_7.t: Same.
2399 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2400
36171d64
CC
24012010-09-14 Cary Coutant <ccoutant@google.com>
2402
2403 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2404 (Target_x86_64::Relocate::relocate_tls): Replace check for
2405 saw_tls_block_reloc_ with test for executable section.
2406
d89051bd
CC
24072010-09-12 Cary Coutant <ccoutant@google.com>
2408
2409 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2410 position-independent executables to shared libraries need dynamic
2411 relocations.
2412 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2413 position-independent executables.
2414 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2415 * testsuite/Makefile.in: Regenerate.
2416
fca41f0f
NC
24172010-09-10 Nick Clifton <nickc@redhat.com>
2418
2419 PR gold/11997
2420 * testsuite/memory_test.t: Discard any sections that are not
2421 needed.
2422
6695e4b3
L
24232010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2424
2425 PR gold/11996
2426 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2427 "This::" to work around a bug in gcc 4.2.
2428
2429 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2430
0f72bf6f
RÁE
24312010-09-09 Rafael Espindola <espindola@google.com>
2432
2433 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2434 sections with different PF_X flags in the same segment.
2435 (Layout::find_first_load_seg): Search all segments to find the first
2436 one.
2437 * options.h (rosegment): New.
2438
24392010-09-08 Rafael Espindola <espindola@google.com>
a6577478 2440
05a79166 2441 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 2442
aa98ff75
DK
24432010-09-08 Doug Kwan <dougkwan@google.com>
2444
2445 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2446 (Arm_relobj::do_relocate_sections): Add new parameter for output
2447 file to match the parent.
2448 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2449 of local symbols instead of input values. Update code to track
2450 changes in gold::relocate_section.
2451 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2452 (Sized_relobj::compute_final_local_value_internal): New methods.
2453 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2454 body into private version of Sized_relobj::compute_final_local_value.
2455 Call the inline method.
2456 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2457 merged symbol value if there is one.
2458 (Symbol_value::has_output_value): New method defintiion.
2459 (Sized_relobj::Compute_final_local_value_status): New enum type.
2460 (Sized_relobj::compute_final_local_value): New methods.
2461 (Sized_relobj::compute_final_local_value_internal): New methods.
2462 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2463 and arm_cortex_a8.sh.
2464 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2465 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2466 New tests.
2467 * Makefile.in: Regenerate.
2468 * testsuite/arm_bl_out_of_range.s: Update test.
2469 * testsuite/thumb_bl_out_of_range.s: Ditto.
2470 * testsuite/thumb_blx_out_of_range.s: Ditto.
2471 * testsuite/arm_branch_out_of_range.sh: New file.
2472 * testsuite/arm_cortex_a8.sh: Ditto.
2473 * testsuite/arm_cortex_a8_b.s: Ditto.
2474 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2475 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2476 * testsuite/arm_cortex_a8_bl.s: Ditto.
2477 * testsuite/arm_cortex_a8_blx.s: Ditto.
2478 * testsuite/arm_cortex_a8_local.s: Ditto.
2479 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2480 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2481
05a79166
L
24822010-09-08 Rafael Espindola <espindola@google.com>
2483
2484 * Makefile.am (memory_test.stdout): Run readelf with -W.
2485 * Makefile.in: Regenerate.
2486 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2487 64 bit output.
2488
33dbc701
RÁE
24892010-09-08 Rafael Espindola <espindola@google.com>
2490
2491 * script-sections.cc (Script_sections::add_memory_region): Convert
2492 field precision to int.
2493 * script.cc (script_set_section_region, script_set_section_region):
2494 Convert field precision to int.
2495
731ca54a
RÁE
24962010-09-08 Rafael Espindola <espindola@google.com>
2497
2498 * arm.cc (do_finalize_sections): Create the __exidx_start and
2499 __exdix_end symbols even when the section is missing.
2500
7f8cd844
NC
25012010-09-08 Nick Clifton <nickc@redhat.com>
2502
2503 * README: Remove claim that MEMORY is not supported.
2504 * expression.cc (script_exp_function_origin)
2505 (script_exp_function_length): Move from here to ...
2506 * script.cc: ... here.
2507 (script_set_section_region, script_add_memory)
2508 (script_parse_memory_attr, script_include_directive): New
2509 functions.
2510 * script-sections.cc
2511 (class Memory_region): New class.
2512 (class Output_section_definition): Add set_memory_region,
2513 set_section_vma, set_section_lma and get_section_name methods.
2514 (class Script_Sections): Add add_memory_region,
2515 find_memory_region, find_memory_region_origin,
2516 find_memory_region_length and set_memory_region methods.
2517 Have set_section_addresses method walk the list of set memory
2518 regions.
2519 Extend the print methos to display memory regions.
2520 * script-sections.h: Add prototypes for new methods.
2521 Add enum for MEMORY region attributes.
2522 * yyscript.y: Add support for parsing MEMORY regions.
2523 * script-c.h: Add prototypes for new functions.
2524 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2525 * testsuite/Makefile.in: Regenerate.
2526 * testsuite/memory_test.sh: New script.
2527 * testsuite/memory_test.s: New assembler source file.
2528 * testsuite/memory_test.t: New linker script.
2529
a4649286
DK
25302010-08-27 Doug Kwan <dougkwan@google.com>
2531
2532 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2533 reference override an existing dynamic weak reference.
2534 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2535 * testsuite/Makefile.in: Regenerate.
2536 * testsuite/dyn_weak_ref.sh: New file.
2537 * testsuite/dyn_weak_ref_1.c: Ditto.
2538 * testsuite/dyn_weak_ref_2.c: Ditto.
2539
b56648ad
ILT
25402010-08-27 Ian Lance Taylor <iant@google.com>
2541
2542 * incremental.h (class Incremental_input_entry): Add virtual
2543 destructor.
2544
809313cb
ILT
25452010-08-27 Ian Lance Taylor <iant@google.com>
2546
2547 * testsuite/start_lib_test_3.c: Mark t3 as used.
2548
11e32464
NC
25492010-08-27 Nick Clifton <nickc@redhat.com>
2550
2551 * options.cc (version_script): Fix small typo in previous
2552 whitespace tidyup.
2553
ca09d69a
NC
25542010-08-25 Nick Clifton <nickc@redhat.com>
2555
2556 * archive.cc: Formatting fixes: Remove whitespace between
2557 typename and following asterisk. Remove whitespace between
2558 function name and opening parenthesis.
2559 * archive.h: Likewise.
2560 * arm.cc: Likewise.
2561 * attributes.cc: Likewise.
2562 * attributes.h: Likewise.
2563 * common.cc: Likewise.
2564 * copy-relocs.cc: Likewise.
2565 * dirsearch.h: Likewise.
2566 * dynobj.cc: Likewise.
2567 * ehframe.cc: Likewise.
2568 * ehframe.h: Likewise.
2569 * expression.cc: Likewise.
2570 * fileread.cc: Likewise.
2571 * fileread.h: Likewise.
2572 * gc.h: Likewise.
2573 * gold-threads.cc: Likewise.
2574 * gold.cc: Likewise.
2575 * i386.cc: Likewise.
2576 * icf.h: Likewise.
2577 * incremental-dump.cc: Likewise.
2578 * incremental.cc: Likewise.
2579 * layout.cc: Likewise.
2580 * layout.h: Likewise.
2581 * main.cc: Likewise.
2582 * merge.cc: Likewise.
2583 * merge.h: Likewise.
2584 * object.cc: Likewise.
2585 * object.h: Likewise.
2586 * options.cc: Likewise.
2587 * options.h: Likewise.
2588 * output.cc: Likewise.
2589 * output.h: Likewise.
2590 * plugin.cc: Likewise.
2591 * plugin.h: Likewise.
2592 * powerpc.cc: Likewise.
2593 * reloc.cc: Likewise.
2594 * script-c.h: Likewise.
2595 * script-sections.cc: Likewise.
2596 * script.cc: Likewise.
2597 * stringpool.cc: Likewise.
2598 * symtab.cc: Likewise.
2599 * symtab.h: Likewise.
2600 * target.cc: Likewise.
2601 * timer.cc: Likewise.
2602 * timer.h: Likewise.
2603 * version.cc: Likewise.
2604 * x86_64.cc: Likewise.
2605
b8fa8750
NC
26062010-08-24 Nick Clifton <nickc@redhat.com>
2607
2608 PR 11899
2609 * layout.cc (segment_precedes): Sort segments by their physical
2610 addresses, if they have been set.
2611
9919d93b
CC
26122010-08-23 Cary Coutant <ccoutant@google.com>
2613
2614 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2615 symbols data.
2616 (Lib_group::include_member): Unlock object after deleting its
2617 symbols data.
2618 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2619 the bug fixed here.
2620
97b4be1c
CC
26212010-08-19 Neil Vachharajani <nvachhar@google.com>
2622 Cary Coutant <ccoutant@google.com>
2623
2624 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2625 constructor, and set_blocker.
2626 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2627 readsyms_blocker_.
2628 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2629 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2630 * testsuite/Makefile.am (start_lib_test): New test case.
2631 * testsuite/Makefile.in: Regenerate.
2632 * testsuite/start_lib_test_main.c: New file.
2633 * testsuite/start_lib_test_1.c: New file.
2634 * testsuite/start_lib_test_2.c: New file.
2635 * testsuite/start_lib_test_3.c: New file.
2636
dd0b1884
ILT
26372010-08-19 Ian Lance Taylor <iant@google.com>
2638
2639 * Makefile.in: Rebuild with automake 1.11.1.
2640 * aclocal.m4: Likewise.
2641 * testsuite/Makefile.in: Likewise.
2642
7223e9ca
ILT
26432010-08-19 Ian Lance Taylor <iant@google.com>
2644
2645 PR 10893
2646 * i386.cc (class Output_data_plt_i386): Update declarations.
2647 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2648 local_ifuncs_ fields.
2649 (Target_i386::do_plt_section_for_global): New function.
2650 (Target_i386::do_plt_section_for_local): New function.
2651 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2652 parameter; change all callers. Initialize global_ifuncs_ and
2653 local_ifuncs_. If doing a static link define __rel_iplt_start and
2654 __rel_iplt_end.
2655 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2656 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2657 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2658 symbols.
2659 (Target_i386::make_plt_section): New function, broken out of
2660 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2661 (Target_i386::make_plt_entry): Call make_plt_section.
2662 (Target_i386::make_local_ifunc_plt_entry): New function.
2663 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2664 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2665 R_386_IRELATIVE to switch.
2666 (Target_i386::Scan::global): Likewise.
2667 (Target_i386::Relocate::relocate): Likewise.
2668 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2669 switch.
2670 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2671 (Target_x86_64::do_plt_section_for_global): New function.
2672 (Target_x86_64::do_plt_section_for_local): New function.
2673 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2674 parameter; change all callers. If doing a static link define
2675 __rela_iplt_start and __rela_iplt_end.
2676 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2677 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2678 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2679 to point to .plt.
2680 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2681 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2682 switch.
2683 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2684 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2685 R_X86_64_IRELATIVE to switch.
2686 (Target_x86_64::Scan::global): Likewise.
2687 (Target_x86_64::Relocate::relocate): Likewise.
2688 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2689 switch.
2690 * target.h (class Target): Add plt_section_for_global and
2691 plt_section_for_local functions. Add do_plt_section_for_global
2692 and do_plt_section_for_local virtual functions.
2693 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2694 clarifying comments.
2695 (Symbol::use_plt_offset): Handle IFUNC symbol.
2696 * object.cc (Sized_relobj::Sized_relobj): Initialize
2697 local_plt_offsets_.
2698 (Sized_relobj::local_has_plt_offset): New function.
2699 (Sized_relobj::local_plt_offset): New function.
2700 (Sized_relobj::set_local_plt_offset): New function.
2701 (Sized_relobj::do_count): Handle IFUNC symbol.
2702 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2703 a bit away from input_shndx_ field. Add set_is_func_symbol and
2704 is_ifunc_symbol functions.
2705 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2706 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2707 local_plt_offsets_ field.
2708 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2709 * output.h (class Output_section_data): Add non-const
2710 output_section function.
2711 (class Output_data_got): Update declarations.
2712 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2713 Add use_plt_offset parameter to global and local constructors.
2714 Change all callers. Change local_sym_index_ field to 31 bits.
2715 Change GSYM_CODE and CONSTANT_CODE accordingly.
2716 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2717 doing a static link don't set sh_link field.
2718 (Output_data_got::Got_entry::write): Use PLT offset if
2719 appropriate.
2720 (Output_data_got::add_global_plt): New function.
2721 (Output_data_got::add_local_plt): New function.
2722 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2723 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2724 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2725 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2726 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2727 IFUNC conditional.
2728 * testsuite/ifunc-sel.h: New file.
2729 * testsuite/ifuncmain1.c: New file.
2730 * testsuite/ifuncmain1vis.c: New file.
2731 * testsuite/ifuncmod1.c: New file.
2732 * testsuite/ifuncdep2.c: New file.
2733 * testsuite/ifuncmain2.c: New file.
2734 * testsuite/ifuncmain3.c: New file.
2735 * testsuite/ifuncmod3.c: New file.
2736 * testsuite/ifuncmain4.c: New file.
2737 * testsuite/ifuncmain5.c: New file.
2738 * testsuite/ifuncmod5.c: New file.
2739 * testsuite/ifuncmain6pie.c: New file.
2740 * testsuite/ifuncmod6.c: New file.
2741 * testsuite/ifuncmain7.c: New file.
2742 * configure, testsuite/Makefile.in: Rebuild.
2743
56f75c03
ILT
27442010-08-18 Ian Lance Taylor <iant@google.com>
2745
2746 * incremental.cc
2747 (Output_section_incremental_inputs::write_input_files): Add cast
2748 to avoid signed/unsigned comparison warning.
2749 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2750
55455f89
CC
27512010-08-12 Cary Coutant <ccoutant@google.com>
2752
2753 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2754
e2054bcb
ILT
27552010-08-13 Ian Lance Taylor <iant@google.com>
2756
2757 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2758
74f67560
DK
27592010-08-12 Cary Coutant <ccoutant@google.com>
2760 Doug Kwan <dougkwan@google.com>
2761
2762 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2763 defintion overrides non-weak undef, remember that the original undef
2764 is not weak.
2765 * symtab.cc (Symbol_table::sized_write_global): For undef without
2766 an original weak binding, set binding to global in output.
2767 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2768 * testsuite/Makefile.in: Regenerate.
2769 * testsuite/strong_ref_weak_def.sh: New file.
2770 * testsuite/strong_ref_weak_def_1.c: Ditto.
2771 * testsuite/strong_ref_weak_def_2.c: Ditto.
2772
d1238d12
CC
27732010-08-12 Cary Coutant <ccoutant@google.com>
2774
2775 * testsuite/incremental_test.sh: Rewrite.
2776 * testsuite/incremental_test_1.c: Rewrite.
2777 * testsuite/incremental_test_2.c: Rewrite.
2778
0e70b911
CC
27792010-08-12 Cary Coutant <ccoutant@google.com>
2780
2781 * arm.cc (Target_arm::got_size): Add const.
2782 (Target_arm::got_entry_count): New function.
2783 (Target_arm::plt_entry_count): New function.
2784 (Target_arm::first_plt_entry_offset): New function.
2785 (Target_arm::plt_entry_size): New function.
2786 (Output_data_plt_arm::entry_count): New function.
2787 (Output_data_plt_arm::first_plt_entry_offset): New function.
2788 (Output_data_plt_arm::get_plt_entry_size): New function.
2789 * i386.cc (Target_i386::got_size): Add const.
2790 (Target_i386::got_entry_count): New function.
2791 (Target_i386::plt_entry_count): New function.
2792 (Target_i386::first_plt_entry_offset): New function.
2793 (Target_i386::plt_entry_size): New function.
2794 (Output_data_plt_i386::entry_count): New function.
2795 (Output_data_plt_i386::first_plt_entry_offset): New function.
2796 (Output_data_plt_i386::get_plt_entry_size): New function.
2797 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2798 find_incremental_inputs_sections. Dump incremental_got_plt section.
2799 * incremental.cc: Include target.h.
2800 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2801 parameter. Adjust all callers. Find incremental_got_plt section.
2802 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2803 section.
2804 (Output_section_incremental_inputs::set_final_data_size): Calculate
2805 size of incremental_got_plt section.
2806 (Output_section_incremental_inputs::do_write): Write the
2807 incremental_got_plt section.
2808 (Got_plt_view_info): New struct.
2809 (Local_got_offset_visitor): New class.
2810 (Global_got_offset_visitor): New class.
2811 (Global_symbol_visitor_got_plt): New class.
2812 (Output_section_incremental_inputs::write_got_plt): New function.
2813 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2814 Add parameter. Adjust all callers.
2815 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2816 (Incremental_inputs::got_plt_section): New function.
2817 (Incremental_inputs::got_plt_section_): New data member.
2818 (Incremental_got_plt_reader): New class.
2819 * layout.cc (Layout::create_incremental_info_sections): Add the
2820 incremental_got_plt section.
2821 * object.h (Got_offset_list::get_list): New function.
2822 (Got offset_list::for_all_got_offsets): New function.
2823 (Sized_relobj::local_got_offset_list): New function.
2824 * powerpc.cc (Target_powerpc::got_size): Add const.
2825 (Target_powerpc::got_entry_count): New function.
2826 (Target_powerpc::plt_entry_count): New function.
2827 (Target_powerpc::first_plt_entry_offset): New function.
2828 (Target_powerpc::plt_entry_size): New function.
2829 (Output_data_plt_powerpc::entry_count): New function.
2830 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2831 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2832 * sparc.cc (Target_sparc::got_size): Add const.
2833 (Target_sparc::got_entry_count): New function.
2834 (Target_sparc::plt_entry_count): New function.
2835 (Target_sparc::first_plt_entry_offset): New function.
2836 (Target_sparc::plt_entry_size): New function.
2837 (Output_data_plt_sparc::entry_count): New function.
2838 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2839 (Output_data_plt_sparc::get_plt_entry_size): New function.
2840 * symtab.h (Symbol::got_offset_list): New function.
2841 (Symbol_table::for_all_symbols): New function.
2842 * target.h (Sized_target::got_entry_count): New function.
2843 (Sized_target::plt_entry_count): New function.
2844 (Sized_target::plt_entry_size): New function.
2845 * x86_64.cc (Target_x86_64::got_size): Add const.
2846 (Target_x86_64::got_entry_count): New function.
2847 (Target_x86_64::plt_entry_count): New function.
2848 (Target_x86_64::first_plt_entry_offset): New function.
2849 (Target_x86_64::plt_entry_size): New function.
2850 (Output_data_plt_x86_64::entry_count): New function.
2851 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2852 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2853
09ec0418
CC
28542010-08-12 Cary Coutant <ccoutant@google.com>
2855
2856 * archive.cc: Include incremental.h.
2857 (Archive::Archive): Initialize incremental_info_.
2858 (Archive::include_member): Record archive members in incremental info.
2859 (Add_archive_symbols::run): Record begin and end of an archive in
2860 incremental info.
2861 (Lib_group::include_member): Record objects in incremental info.
2862 * archive.h (Incremental_archive_entry): Forward declaration.
2863 (Archive::set_incremental_info): New member function.
2864 (Archive::incremental_info): New member function.
2865 (Archive::Unused_symbol_iterator): New class.
2866 (Archive::unused_symbols_begin): New member function.
2867 (Archive::unused_symbols_end): New member function.
2868 (Archive::incremental_info_): New data member.
2869 * incremental-dump.cc (find_input_containing_global): New function.
2870 (dump_incremental_inputs): Dump new incremental info sections.
2871 * incremental.cc: Include symtab.h.
2872 (Output_section_incremental_inputs): New class.
2873 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2874 new incremental info sections.
2875 (Sized_incremental_binary::do_check_inputs): Likewise.
2876 (Incremental_inputs::report_archive): Remove.
2877 (Incremental_inputs::report_archive_begin): New function.
2878 (Incremental_inputs::report_archive_end): New function.
2879 (Incremental_inputs::report_object): New function.
2880 (Incremental_inputs::finalize_inputs): Remove.
2881 (Incremental_inputs::report_input_section): New function.
2882 (Incremental_inputs::report_script): Rewrite.
2883 (Incremental_inputs::finalize): Do nothing but finalize string table.
2884 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2885 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2886 (Incremental_inputs::create_data_sections): New function.
2887 (Incremental_inputs::relocs_entsize): New function.
2888 (Output_section_incremental_inputs::set_final_data_size): New function.
2889 (Output_section_incremental_inputs::do_write): New function.
2890 (Output_section_incremental_inputs::write_header): New function.
2891 (Output_section_incremental_inputs::write_input_files): New function.
2892 (Output_section_incremental_inputs::write_info_blocks): New function.
2893 (Output_section_incremental_inputs::write_symtab): New function.
2894 * incremental.h (Incremental_script_entry): Forward declaration.
2895 (Incremental_object_entry): Forward declaration.
2896 (Incremental_archive_entry): Forward declaration.
2897 (Incremental_inputs): Forward declaration.
2898 (Incremental_inputs_header_data): Remove.
2899 (Incremental_inputs_header): Remove.
2900 (Incremental_inputs_header_write): Remove.
2901 (Incremental_inputs_entry_data): Remove.
2902 (Incremental_inputs_entry): Remove.
2903 (Incremental_inputs_entry_write): Remove.
2904 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2905 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2906 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2907 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2908 Likewise.
2909 (Incremental_input_entry): New class.
2910 (Incremental_script_entry): New class.
2911 (Incremental_object_entry): New class.
2912 (Incremental_archive_entry): New class.
2913 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2914 (Incremental_inputs::report_inputs): Remove.
2915 (Incremental_inputs::report_archive): Remove.
2916 (Incremental_inputs::report_archive_begin): New function.
2917 (Incremental_inputs::report_archive_end): New function.
2918 (Incremental_inputs::report_object): Change prototype.
2919 (Incremental_inputs::report_input_section): New function.
2920 (Incremental_inputs::report_script): Change prototype.
2921 (Incremental_inputs::get_reloc_count): New function.
2922 (Incremental_inputs::set_reloc_count): New function.
2923 (Incremental_inputs::create_data_sections): New function.
2924 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2925 (Incremental_inputs::inputs_section): New function.
2926 (Incremental_inputs::symtab_section): New function.
2927 (Incremental_inputs::relocs_section): New function.
2928 (Incremental_inputs::get_stringpool): Add const.
2929 (Incremental_inputs::command_line): Add const.
2930 (Incremental_inputs::inputs): Remove.
2931 (Incremental_inputs::command_line_key): New function.
2932 (Incremental_inputs::input_file_count): New function.
2933 (Incremental_inputs::input_files): New function.
2934 (Incremental_inputs::relocs_entsize): New function.
2935 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2936 (Incremental_inputs::finalize_inputs): Remove.
2937 (Incremental_inputs::Input_info): Remove.
2938 (Incremental_inputs::lock_): Remove.
2939 (Incremental_inputs::inputs_): Change type.
2940 (Incremental_inputs::inputs_map_): Remove.
2941 (Incremental_inputs::current_object_entry_): New data member.
2942 (Incremental_inputs::inputs_section_): New data member.
2943 (Incremental_inputs::symtab_section_): New data member.
2944 (Incremental_inputs::relocs_section_): New data member.
2945 (Incremental_inputs::reloc_count_): New data member.
2946 (Incremental_inputs_reader): New class.
2947 (Incremental_symtab_reader): New class.
2948 (Incremental_relocs_reader): New class.
2949 * layout.cc (Layout::finalize): Move finalization of incremental info
2950 and creation of incremental info sections to follow finalization of
2951 symbol table. Set offsets for postprocessing sections.
2952 (Layout::create_incremental_info_sections): Call
2953 Incremental_inputs::create_data_sections. Add incremental symtab
2954 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2955 sections to layout after input sections.
2956 * layout.h (struct Timespec): Forward declaration.
2957 (Layout::incremental_inputs): Add const.
2958 (Layout::create_incremental_info_sections): Add parameter.
2959 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2960 * object.cc: Include incremental.h.
2961 (Relobj::finalize_incremental_relocs): New function.
2962 (Sized_relobj::do_layout): Record input sections in incremental info.
2963 * object.h (Object::output_section): New function.
2964 (Object::output_section_offset): Moved from Relobj.
2965 (Object::get_incremental_reloc_base): New function.
2966 (Object::get_incremental_reloc_count): New function.
2967 (Object::do_output_section): New function.
2968 (Object::do_output_section_offset): Moved from Relobj.
2969 (Object::do_get_incremental_reloc_base): New function.
2970 (Object::do_get_incremental_reloc_count): New function.
2971 (Object::Object): Initialize new data members.
2972 (Relobj::output_section): Renamed do_output_section and moved to
2973 protected.
2974 (Relobj::output_section_offset): Moved to Object.
2975 (Relobj::do_get_incremental_reloc_base): New function.
2976 (Relobj::do_get_incremental_reloc_count): New function.
2977 (Relobj::allocate_incremental_reloc_counts): New function.
2978 (Relobj::count_incremental_reloc): New function.
2979 (Relobj::finalize_incremental_relocs): New function.
2980 (Relobj::next_incremental_reloc_index): New function.
2981 (Relobj::reloc_counts_): New data member.
2982 (Relobj::reloc_bases_): New data member.
2983 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2984 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2985 (Sized_relobj::incremental_relocs_scan): New function.
2986 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2987 (Sized_relobj::incremental_relocs_write): New function.
2988 (Sized_relobj::incremental_relocs_write_reltype): New function.
2989 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2990 incremental link.
2991 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2992 archives and object files elsewhere.
2993 (Add_symbols::run): Report object files here.
2994 (Finish_group::run): Report end of archive at end of group.
2995 * reloc.cc: Include layout.h, incremental.h.
2996 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2997 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2998 (Sized_relobj::incremental_relocs_scan): New function.
2999 (Sized_relobj::incremental_relocs_scan_reltype): New function.
3000 (Sized_relobj::do_relocate_sections): Write incremental relocations.
3001 (Sized_relobj::incremental_relocs_write): New function.
3002 (Sized_relobj::incremental_relocs_write_reltype): New function.
3003 * script.cc (read_input_script): Rewrite test for incremental link.
3004 Change call to Incremental_inputs::report_script.
3005 * symtab.h (Symbol_table::first_global_index): New function.
3006 (Symbol_table::output_count): New function.
3007
ce0d1972
DK
30082010-08-12 Doug Kwan <dougkwan@google.com>
3009
3010 * arm.cc (Target_arm::merge_object_attributes): Check command line
3011 options --no-wchar-size-warning and --no-enum-size-warning.
3012 * options.h (General_options): Add ld-compatible options
3013 --no-enum-size-warning and --no-wchar-size-warning.
3014
6e5710ce
ILT
30152010-08-04 Ian Lance Taylor <iant@google.com>
3016
3017 * x86_64.cc (Target_x86_64::Scan::local): Use
3018 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
3019 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
3020 (Target_x86_64::Scan::global): Likewise.
3021 (Target_x86_64::Relocate::relocate): Likewise.
3022 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
3023 Likewise.
3024
fef830db
CC
30252010-08-03 Cary Coutant <ccoutant@google.com>
3026
3027 * merge.cc (Output_merge_string::do_add_input_section): Count strings
3028 to reserve space in merged_strings vector. Keep total input size
3029 for stats.
3030 (Output_merge_string::do_print_merge_stats): Print total input size.
3031 * merge.h (Output_merge_string): Add input_size_ field.
3032 * stringpool.cc (Stringpool_template::string_length): Move
3033 implementations out of Stringpool_template class and place in
3034 stringpool.h.
3035 * stringpool.h (string_length): Move out of Stringpool_template.
3036
1e3811b0
ILT
30372010-08-03 Ian Lance Taylor <iant@google.com>
3038
3039 PR 11712
3040 * layout.cc (relaxation_loop_body): If address of load segment is
3041 set, adjust address to include headers if possible.
3042
7af0c620
ILT
30432010-08-03 Ian Lance Taylor <iant@google.com>
3044
3045 * version.cc (version_string): Bump to 1.10.
3046
22f0da72
ILT
30472010-08-03 Ian Lance Taylor <iant@google.com>
3048
3049 PR 11805
3050 * layout.h (enum Output_section_order): Define.
3051 (class Layout): Update declarations.
3052 * layout.cc (Layout::get_output_section): Add order parameter.
3053 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
3054 is_first_non_relro parameters. Change all callers.
3055 (Layout::choose_output_section): Likewise.
3056 (Layout::add_output_section_data): Likewise.
3057 (Layout::make_output_section): Likewise. Set order.
3058 (Layout::default_section_order): New function.
3059 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
3060 * output.cc (Output_section::Output_section): Initialize order_.
3061 Don't initialize deleted fields.
3062 (Output_segment::Output_segment): Don't initialize deleted
3063 fields.
3064 (Output_segment::add_output_section_to_load): New function
3065 replacing add_output_section. Change all callers to call this or
3066 add_output_section_to_nonload.
3067 (Output_segment::add_output_section_to_nonload): New function.
3068 (Output_segment::remove_output_section): Rewrite.
3069 (Output_segment::add_initial_output_data): Likewise.
3070 (Output_segment::has_any_data_sections): Likewise.
3071 (Output_segment::is_first_section_relro): Likewise.
3072 (Output_segment::maximum_alignment): Likewise.
3073 (Output_segment::has_dynamic_reloc): New function replacing
3074 dynamic_reloc_count. Change all callers.
3075 (Output_segment::has_dynamic_reloc_list): New function replacing
3076 dynamic_reloc_count_list. Change all callers.
3077 (Output_segment::set_section_addresses): Rewrite.
3078 (Output_segment::set_offset): Rewrite.
3079 (Output_segment::find_first_and_last_list): Remove.
3080 (Output_segment::set_tls_offsets): Rewrite.
3081 (Output_segment::first_section_load_address): Likewise.
3082 (Output_segment::output_section_count): Likewise.
3083 (Output_segment::section_with_lowest_load_address): Likewise.
3084 (Output_segment::write_section_headers): Likewise.
3085 (Output_segment::print_sections_to_map): Likewise.
3086 * output.h (class Output_data): Remove dynamic_reloc_count_
3087 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
3088 (Output_data::add_dynamic_reloc): Rewrite.
3089 (Output_data::has_dynamic_reloc): New function.
3090 (Output_data::dynamic_reloc_count): Remove.
3091 (class Output_section): Add order_ field. Remvoe is_relro_local_,
3092 is_last_relro_, is_first_non_relro_, is_interp_,
3093 is_dynamic_linker_section_ fields. Add order and set_order
3094 functions. Remove is_relro_local, set_is_relro_local,
3095 is_last_relro, set_is_last_relro, is_first_non_relro,
3096 set_is_first_non_relro functions, is_interp, set_is_interp,
3097 is_dynamic_linker_section, and set_is_dynamic_linker_section
3098 functions.
3099 (class Output_segment): Change Output_data_list from std::list to
3100 std:;vector. Add output_lists_ field. Remove output_data_ and
3101 output_bss_ fields. Update declarations.
3102
3ff2ccb0
ILT
31032010-08-02 Ian Lance Taylor <iant@google.com>
3104
3105 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3106 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3107 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3108
88a4108b
ILT
31092010-08-02 Ian Lance Taylor <iant@google.com>
3110
3111 PR 11855
3112 * script.cc (Script_options::Script_options): Initialize
3113 symbol_definitions_ and symbol_references_.
3114 (Script_options::add_symbol_assignment): Update
3115 symbol_definitions_ and symbol_references_.
3116 (Script_options::add_symbol_reference): New function.
3117 (script_symbol): New function.
3118 * script.h (class Script_options): Add symbol_definitions_ and
3119 symbol_references_ fields.
3120 (Script_options::referenced_const_iterator): New type.
3121 (Script_options::referenced_begin): New function.
3122 (Script_options::referenced_end): New function.
3123 (Script_options::is_referenced): New function.
3124 (Script_options::any_unreferenced): New function.
3125 * script-c.h (script_symbol): Declare.
3126 * yyscript.y (exp): Call script_symbol.
3127 * symtab.cc: Include "script.h".
3128 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3129 Change all callers. Check symbols referenced by scripts.
3130 (Symbol_table::add_undefined_symbols_from_command_line): Add
3131 layout parameter. Change all callers.
3132 (Symbol_table::do_add_undefined_symbols_from_command_line):
3133 Likewise. Break out loop body. Check symbols referenced by
3134 scripts.
3135 (Symbol_table::add_undefined_symbol_from_command_line): New
3136 function broken out of
3137 do_add_undefined_symbols_from_command_line.
3138 * symtab.h (class Symbol_table): Update declarations.
3139 * archive.cc: Include "layout.h".
3140 (Archive::should_include_member): Add layout parameter. Change
3141 all callers. Check for symbol mentioned in expression.
3142 * archive.h (class Archive): Update declaration.
3143 * object.cc (Sized_relobj::do_should_include_member): Add layout
3144 parameter.
3145 * object.h (Object::should_include_member): Add layout parameter.
3146 Change all callers.
3147 (Object::do_should_include_member): Add layout parameter.
3148 (class Sized_relobj): Update declaration.
3149 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3150 parameter.
3151 * dynobj.h (class Sized_dynobj): Update declaration.
3152 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3153 layout parameter.
3154 * plugin.h (class Sized_pluginobj): Update declaration.
3155
5f1ab67a
ILT
31562010-08-02 Ian Lance Taylor <iant@google.com>
3157
3158 PR 11866
3159 * output.cc (Output_segment::set_offset): Search for the first and
3160 last sections rather than assuming that the list is in order.
3161 (Output_segment::find_first_and_last_list): New function.
3162 * output.h (class Output_segment): Update declarations.
3163 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3164 (relro_strip_test_SOURCES): New variable.
3165 (relro_strip_test_DEPENDENCIES): New variable.
3166 (relro_strip_test_LDFLAGS): New variable.
3167 (relro_strip_test_LDADD): New variable.
3168 (relro_strip_test.so): New target.
3169
a8df5856
ILT
31702010-08-02 Ian Lance Taylor <iant@google.com>
3171
3172 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3173 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3174 (Target_i386::got_tlsdesc_section): New function.
3175 (Target_i386::got_section): Create space for GOT entries for
3176 TLSDESC relocations.
3177 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3178 R_386_TLS_GOTDESC.
3179 (Target_i386::Scan::global): Likewise.
3180 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3181 using TLSDESC GOT.
3182 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3183 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3184 (Target_x86_64::got_tlsdesc_section): New function.
3185 (Target_x86_64::got_section): Create space for GOT entries for
3186 TLSDESC relocations.
3187 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3188 R_386_TLS_GOTDESC.
3189 (Target_x86_64::Scan::global): Likewise.
3190 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3191 using TLSDESC GOT.
3192
0c10a0a6
ILT
31932010-08-02 Ian Lance Taylor <iant@google.com>
3194
3195 * testsuite/final_layout.sh: Use dc to convert from hex to
3196 decimal.
3197
41cbeecc
ST
31982010-07-29 Sriraman Tallam <tmsriram@google.com>
3199
3200 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3201 paramter to the call to gold::gc_process_relocs.
3202 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3203 paramter to the call to gold::gc_process_relocs.
3204 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3205 parameter to the call to gold::gc_process_relocs.
3206 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3207 template parameter to the call to gold::gc_process_relocs.
3208 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3209 paramter to the call to gold::gc_process_relocs.
3210 * gc.h (get_embedded_addend_size): New function.
3211 (gc_process_relocs): Save the size of the reloc for use by ICF.
3212 * icf.cc (get_section_contents): Get the addend from the text section
3213 for SHT_REL relocation sections.
3214 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3215 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3216 * int_encoding.h (read_from_pointer): New overloaded function.
3217 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3218 * testsuite/icf_sht_rel_addend_test.sh: New file.
3219 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3220 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3221
6ea55b82
RW
32222010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3223
3224 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3225 * Makefile.in: Regenerate.
3226 * testsuite/Makefile.in: Regenerate.
3227
9691462b
ILT
32282010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3229
3230 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3231 * gold/testsuite/debug_msg.cc: Likewise.
3232 * gold/testsuite/odr_violation1.cc
3233 * gold/testsuite/odr_violation2.cc
3234
76897331
CC
32352010-07-21 Cary Coutant <ccoutant@google.com>
3236
3237 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3238 string, and length fields.
3239 (Output_merge_string::Merged_strings_list): New type.
3240 (Output_merge_string::Merged_strings_lists): New typedef.
3241 (Output_merge_string): Replace merged_strings_ with
3242 merged_strings_lists_.
3243 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3244 Merged_strings_list per input object and section. Don't store pointer
3245 to the string. Don't store length with each merged string entry.
3246 (Output_merge_string::finalize_merged_data): Loop over list of merged
3247 strings lists. Recompute length of each merged string.
3248
78384e8f
CC
32492010-07-15 Cary Coutant <ccoutant@google.com>
3250
3251 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3252 here.
3253
783659f9
ILT
32542010-07-14 Ian Lance Taylor <iant@google.com>
3255
3256 * descriptors.cc (Descriptors::open): Report correct name in error
3257 message.
3258
131687b4
DK
32592010-07-13 Doug Kwan <dougkwan@google.com>
3260
3261 * arm.cc (Arm_input_section::Arm_input_section): For a
3262 SHT_ARM_EXIDX section, always keeps the input sections.
3263 (Arm_input_section::set_exidx_section_link): New method.
3264 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3265 has_errors_ to false.
3266 (Arm_exidx_input_section::has_errors,
3267 Arm_exidx_input_section::set_has_errors): New methods.
3268 (Arm_exidx_input_section::has_errors_): New data member.
3269 (Arm_relobj::get_exidx_shndx_list): New method.
3270 (Arm_output_section::append_text_sections_to_list): Do not skip
3271 section without SHF_EXECINSTR.
3272 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3273 errors.
3274 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3275 section header. Make error messages more verbose. Check for
3276 a non-executable section linked to an EXIDX section.
3277 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3278 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3279 check that there is no deferred EXIDX section if we exit early.
3280 Instead of not making an EXIDX section in case of an error, make one
3281 and set the has_errors flag of it.
3282 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3283 in a relocatable link.
3284 (Target_arm::do_relax): Look for the EXIDX output section instead of
3285 assuming that it is called .ARM.exidx.
3286 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3287 section list. Do not check for SHF_EXECINSTR section flags but
3288 skip any input section with errors.
3289 * output.cc (Output_section::Output_section): Initialize
3290 always_keeps_input_sections_ to false.
3291 (Output_section::add_input_section): Check for
3292 always_keeps_input_sections_.
3293 * output.h (Output_section::always_keeps_input_sections,
3294 Output_section::set_always_keeps_input_sections): New methods.
3295 (Output_section::always_keeps_input_sections): New data member.
3296
69517287
RÁE
32972010-07-13 Rafael Espindola <espindola@google.com>
3298
3299 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3300 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3301
82742395
ILT
33022010-07-13 Philip Herron <herron.philip@googlemail.com>
3303 Ian Lance Taylor <iant@google.com>
3304
3305 * output.h (Output_section_lookup_maps::add_merge_section):
3306 Correct check of whether value was inserted.
3307 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3308 (Output_section_lookup_maps::add_relaxed_input_section):
3309 Likewise.
3310 * arm.cc (Target_arm::got_section): Remove used local os.
3311 * i386.cc (Target_i386::got_section): Likewise.
3312 * x86_64.cc (Target_x86_64::got_section): Likewise.
3313 * sparc.cc (Target_sparc::got_section): Likewise.
3314 (Target_sparc::relocate): Remove unused local have_got_offset.
3315 * powerpc.cc (Target_powerpc::relocate): Likewise.
3316
f2d707b5
ILT
33172010-07-13 Ian Lance Taylor <iant@google.com>
3318
241531d6
ILT
3319 * compressed_output.cc (zlib_decompress): Fix signature in
3320 !HAVE_ZLIB_H case.
3321
f2d707b5
ILT
3322 * archive.cc (Archive::include_member): Unlock an external member
3323 of a thin archive. Don't bother to delete an object we know is
3324 NULL.
3325
a2e47362
CC
33262010-07-12 Cary Coutant <ccoutant@google.com>
3327
3328 * compressed_output.cc (zlib_decompress): New function.
3329 (get_uncompressed_size): New function.
3330 (decompress_input_section): New function.
3331 * compressed_output.h (get_uncompressed_size): New function.
3332 (decompress_input_section): New function.
3333 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3334 Handle compressed debug sections.
3335 * layout.cc (is_compressed_debug_section): New function.
3336 (Layout::output_section_name): Map compressed section names to
3337 canonical names.
3338 * layout.h (is_compressed_debug_section): New function.
3339 (is_debug_info_section): Recognize compressed debug sections.
3340 * merge.cc: Include compressed_output.h.
3341 (Output_merge_data::do_add_input_section): Handle compressed
3342 debug sections.
3343 (Output_merge_string::do_add_input_section): Handle compressed
3344 debug sections.
3345 * object.cc: Include compressed_output.h.
3346 (Sized_relobj::Sized_relobj): Initialize new data members.
3347 (build_compressed_section_map): New function.
3348 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3349 * object.h (Object::section_is_compressed): New method.
3350 (Object::do_section_is_compressed): New method.
3351 (Sized_relobj::Compressed_section_map): New type.
3352 (Sized_relobj::do_section_is_compressed): New method.
3353 (Sized_relobj::compressed_sections_): New data member.
3354 * output.cc (Output_section::add_input_section): Handle compressed
3355 debug sections.
3356 * reloc.cc: Include compressed_output.h.
3357 (Sized_relobj::write_sections): Handle compressed debug sections.
3358
ce279a62
CC
33592010-07-08 Cary Coutant <ccoutant@google.com>
3360
3361 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3362 weak when resolving to a dynamic def.
3363 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3364 for weak undef/dynamic def cases. Adjust callers.
3365 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3366 undef_binding_weak_.
3367 (Symbol_table::sized_write_globals): Adjust symbol binding.
3368 (Symbol_table::sized_write_symbol): Add binding parameter.
3369 * symtab.h (Symbol::set_undef_binding): New method.
3370 (Symbol::is_undef_binding_weak): New method.
3371 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3372 (Symbol_table::should_override): Add new parameter.
3373 (Symbol_table::sized_write_symbol): Add new parameter.
3374
3375 * testsuite/weak_undef_file1.cc: Add new test case.
3376 * testsuite/weak_undef_file2.cc: Fix header comment.
3377 * testsuite/weak_undef_test.cc: Add new test case.
3378
b2286c10
DK
33792010-06-29 Doug Kwan <dougkwan@google.com>
3380
3381 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3382 Initialize USE_SYMBOL_.
3383 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3384 definition.
3385 (Arm_reloc_property::uses_symbol_): New data member declaration.
3386 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3387 uses symbol value and symbol is undefined but not weakly undefined.
3388
4802450a
RÁE
33892010-06-28 Rafael Espindola <espindola@google.com>
3390
3391 * plugin.cc (Plugin::load): Use dlerror.
3392
e5ca47ba
ILT
33932010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3394
3395 * symtab.cc (detect_odr_violations): When reporting an ODR
3396 violation, report an object where the symbol is defined.
3397
8a75a161
DK
33982010-06-25 Doug Kwan <dougkwan@google.com>
3399
3400 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3401 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3402 definition.
3403 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3404 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3405 target hook to detect function points.
3406 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3407 * icf.h (Icf::check_section_for_function_pointers): Change type of
3408 parameter SECTION_NAME to const reference to std::string. Use
3409 target hook to determine if section may have unsafe pointers.
3410 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3411 method definition.
3412
42218b9f
RÁE
34132010-06-21 Rafael Espindola <espindola@google.com>
3414
3415 * fileread.cc (Input_file::find_fie): New
3416 (Input_file::open): Use Input_file::find_fie.
3417 * fileread.h (Input_file::find_fie): New
3418 * plugin.cc (set_extra_library_path): New.
3419 (Plugin::load): Add set_extra_library_path to the transfer vector.
3420 (Plugin_manager::set_extra_library_path): New.
3421 (Plugin_manager::add_input_file): Use the extra search path if set.
3422 (set_extra_library_path(): New.
3423 * plugin.h (Plugin_manager): Add set_extra_library_path and
3424 extra_search_path_.
3425
a0506cca
CC
34262010-06-19 Cary Coutant <ccoutant@google.com>
3427
3428 * layout.cc (gdb_sections): Add .debug_types.
3429 (lines_only_debug_sections): Likewise.
3430
6508b958
RÁE
34312010-06-18 Rafael Espindola <espindola@google.com>
3432
3433 * plugin.cc (add_input_file,add_input_library)
3434 (Plugin_manager::add_input_file): Make filename arguments const.
3435 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3436 const.
3437
3e235302
DK
34382010-06-16 Doug Kwan <dougkwan@google.com>
3439
3440 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3441 .ARM.attributes section if we have not merged any input
3442 attributes sections.
3443
106e8a6c
DK
34442010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3445
3446 * arm.cc: Allow combining objects with no EABI version
3447 information.
3448
91ff43fe
RÁE
34492010-06-15 Rafael Espindola <espindola@google.com>
3450
3451 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3452
68ed838c
ILT
34532010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3454
3455 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3456 (struct iovec): Correct !HAVE_READV definition.
3457
f3a2388f
CC
34582010-06-10 Cary Coutant <ccoutant@google.com>
3459
3460 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3461 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3462 reloc sections.
3463 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3464
3465 PR 11683
3466 * symtab.h (Symbol::is_placeholder): New member function.
3467 * target-reloc.h (relocate_section): Check for placeholder symbols.
3468
3469 * testsuite/Makefile.am (plugin_test_8): New test.
3470 (plugin_test_9): New test.
3471 * testsuite/Makefile.in: Regenerate.
3472
e1df38aa
NC
34732010-06-09 Nick Clifton <nickc@redhat.com>
3474
3475 * yyscript.y (input_list_element): Allow strings prefixed with
3476 the '-' character. Treat these as libraries.
3477 * script.cc (script_add_library): New function. Adds a library
3478 specified by "-l<name>" found in an input script.
3479 * script-c.h: Add prototype for script_add_library.
3480
25bbe950
DK
34812010-06-07 Doug Kwan <dougkwan@google.com>
3482
3483 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3484 Restrict stub-group size to be within long conditional branch
3485 range when working around cortex-A8 erratum.
3486
0f32ea4c
ILT
34872010-06-07 Damien Diederen <dd@crosstwine.com>
3488
3489 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3490 #ifdef typo.
3491
8fe2a369
ST
34922010-06-03 Sriraman Tallam <tmsriram@google.com>
3493
3494 PR gold/11658
3495 * output.cc
3496 (Output_section::Input_section_sort_entry::compare_section_ordering):
3497 Change to return non-zero correctly.
3498 (Output_section::Input_section_sort_section_order_index_compare
3499 ::operator()): Change to fix ambiguity in comparisons.
3500
6e9ba2ca
ST
35012010-06-01 Sriraman Tallam <tmsriram@google.com>
3502
3503 * gold.h (is_wildcard_string): New function.
3504 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3505 (Layout::layout_eh_frame): Ditto.
3506 (Layout::find_section_order_index): New method.
3507 (Layout::read_layout_from_file): New method.
3508 * layout.h (Layout::find_section_order_index): New method.
3509 (Layout::read_layout_from_file): New method.
3510 (Layout::input_section_position_): New private member.
3511 (Layout::input_section_glob_): New private member.
3512 * main.cc (main): Call read_layout_from_file here.
3513 * options.h (--section-ordering-file): New option.
3514 * output.cc (Output_section::input_section_order_specified_): New
3515 member.
3516 (Output_section::Output_section): Initialize new member.
3517 (Output_section::add_input_section): Add new parameter.
3518 Keep input sections when --section-ordering-file is used.
3519 (Output_section::set_final_data_size): Sort input sections when
3520 section ordering file is specified.
3521 (Output_section::Input_section_sort_entry): Add new parameter.
3522 Check sorting type.
3523 (Output_section::Input_section_sort_entry::compare_section_ordering):
3524 New method.
3525 (Output_section::Input_section_sort_compare::operator()): Change to
3526 consider section_order_index.
3527 (Output_section::Input_section_sort_init_fini_compare::operator()):
3528 Change to consider section_order_index.
3529 (Output_section::Input_section_sort_section_order_index_compare
3530 ::operator()): New method.
3531 (Output_section::sort_attached_input_sections): Change to sort
3532 according to section order when specified.
e1df38aa
NC
3533 (Output_section::add_input_section<32, true>): Add new parameter.
3534 (Output_section::add_input_section<64, true>): Add new parameter.
3535 (Output_section::add_input_section<32, false>): Add new parameter.
3536 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
3537 * output.h (Output_section::add_input_section): Add new parameter.
3538 (Output_section::input_section_order_specified): New
3539 method.
3540 (Output_section::set_input_section_order_specified): New method.
3541 (Input_section::Input_section): Initialize section_order_index_.
3542 (Input_section::section_order_index): New method.
3543 (Input_section::set_section_order_index): New method.
3544 (Input_section::section_order_index_): New member.
3545 (Input_section::Input_section_sort_section_order_index_compare): New
3546 struct.
3547 (Output_section::input_section_order_specified_): New member.
3548 * script-sections.cc (is_wildcard_string): Delete and move modified
3549 method to gold.h.
3550 (Output_section_element_input::Output_section_element_input): Modify
3551 call to is_wildcard_string.
3552 (Output_section_element_input::Input_section_pattern
3553 ::Input_section_pattern): Ditto.
3554 (Output_section_element_input::Output_section_element_input): Ditto.
3555 * testsuite/Makefile.am (final_layout): New test case.
3556 * testsuite/Makefile.in: Regenerate.
3557 * testsuite/final_layout.cc: New file.
3558 * testsuite/final_layout.sh: New file.
3559
3537c84b
RÁE
35602010-06-01 Rafael Espindola <espindola@google.com>
3561
3562 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3563
105b6afd
RÁE
35642010-06-01 Rafael Espindola <espindola@google.com>
3565
3566 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3567 visibility of symbols.
3568
29e11421
DK
35692010-05-27 Doug Kwan <dougkwan@google.com>
3570
3571 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3572 from start of output section instead of address for a local symbol
3573 in a merged or relaxed section when doing a relocatable link.
3574
5e0f337e
RÁE
35752010-05-26 Rafael Espindola <espindola@google.com>
3576
3577 PR 11604
3578 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3579 adding sections the garbage collector removed.
3580 * gold/testsuite/Makefile.am: Add test.
3581 * gold/testsuite/Makefile.in: Regenerate.
3582 * gold/testsuite/plugin_test_7.sh: New.
3583 * gold/testsuite/plugin_test_7_1.c: New.
3584 * gold/testsuite/plugin_test_7_2.c: New.
3585
f4187277
RÁE
35862010-05-26 Rafael Espindola <espindola@google.com>
3587
3588 * script-sections.cc (Output_section_definition::set_section_addresses):
3589 Check for --section-start.
3590
5c388529
DK
35912010-05-26 Doug Kwan <dougkwan@google.com>
3592
3593 * arm.cc (Arm_scan_relocatable_relocs): New class.
3594 (Target_arm::relocate_special_relocatable): New method.
3595 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3596 (Arm_relocate_functions::thumb_branch_common): Same.
3597 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3598 instead of Default_scan_relocatable_relocs.
3599 * target-reloc.h (relocate_for_relocatable): Let target handle
3600 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3601 * target.h (Sized_target::relocate_special_relocatable): New method.
3602
bca1c3ae
ILT
36032010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3604
3605 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3606
0439c796
DK
36072010-05-23 Doug Kwan <dougkwan@google.com>
3608
3609 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3610 instead of a cast.
3611 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3612 with a direct branch, not a conditional branch, to a stub.
3613 * merge.cc (Output_merge_base::record_input_section): New method
3614 defintion.
3615 (Output_merge_data::do_add_input_section): Record input section if
3616 keeps-input-sections flag is set.
3617 (Output_merge_string::do_add_input_section): Ditto.
3618 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3619 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3620 INPUT_SECTIONS_.
3621 (Output_merge_base::keeps_input_sections,
3622 Output_merge_base::set_keeps_input_sections,
3623 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3624 method definitions.
3625 (Output_merge_base::Input_sections): New type declaration.
3626 (Output_merge_base::input_sections_begin,
3627 Output_merge_base::input_sections_end,
3628 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3629 (Output_merge_base::bool keeps_input_sections_,
3630 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3631 Output_merge_base::input_sections_): New data members.
3632 (Output_merge_data::do_set_keeps_input_sections): New method
3633 defintion.
3634 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3635 * output.cc (Output_section::Input_section::relobj): Move method
3636 defintion from class declaration to here and handle merge sections.
3637 (Output_section::Input_section::shndx): Ditto.
3638 (Output_section::Output_section): Remove initializations of removed
3639 data members and initialize new data member LOOKUP_MAPS_.
3640 (Output_section::add_input_section): Set keeps-input-sections flag
3641 for a newly created merge output section as appropriate. Adjust code
3642 to use Output_section_lookup_maps class.
3643 (Output_section::add_relaxed_input_section): Adjst code for lookup
3644 maps code refactoring.
3645 (Output_section::add_merge_input_section): Add a new parameter
3646 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3647 class. If adding input section to a newly created merge output
3648 section fails, remove the new merge section.
3649 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 3650 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
3651 (Output_section::find_merge_section): Ditto.
3652 (Output_section::build_lookup_maps): New method defintion.
3653 (Output_section::find_relaxed_input_section): Adjust code to use
3654 Output_section_lookup_maps class.
3655 (Output_section::get_input_sections): Export merge sections. Adjust
3656 code to use Output_section_lookup_maps class.
3657 (Output_section:::add_script_input_section): Adjust code to use
3658 Output_section_lookup_maps class. Update lookup maps for merge
3659 sections also.
3660 (Output_section::discard_states): Use Output_section_lookup_maps.
3661 (Output_section::restore_states): Same.
3662 * output.h (Merge_section_properties): Move class defintion out of
3663 Output_section.
3664 (Output_section_lookup_maps): New class.
3665 (Output_section::Input_section::is_merge_section): New method
3666 defintion.
3667 (Output_section::Input_section::relobj): Move defintion out of class
3668 defintion. Declare method only.
3669 (Output_section::Input_section::shndx): Ditto.
3670 (Output_section::Input_section::output_merge_base): New method defintion.
3671 (Output_section::Input_section::u2_.pomb): New union field.
3672 (Output_section::Merge_section_by_properties_map,
3673 Output_section::Output_section_data_by_input_section_map,
3674 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3675 Remove types.
3676 (Output_section::add_merge_input_section): Add new parameter
3677 KEEPS_INPUT_SECTIONS.
3678 (Output_section::build_lookup_maps): New method declaration.
3679 (Output_section::merge_section_map_,
3680 Output_section::merge_section_by_properties_map_,
3681 Output_section::relaxed_input_section_map_,
3682 Output_section::is_relaxed_input_section_map_valid_): Remove data
3683 members.
3684 (Output_section::lookup_maps_): New data member.
3685
76295588
L
36862010-05-21 Doug Kwan <dougkwan@google.com>
3687
3688 PR gold/11619
3689 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3690 avoid a compilation error.
3691
d103a984
RÁE
36922010-05-19 Rafael Espindola <espindola@google.com>
3693
3694 * script-sections.cc (Output_section_definition::allocate_to_segment):
3695 Update the phdrs_list even when the output section is NULL.
3696 * testsuite/Makefile.am: Add test.
3697 * testsuite/Makefile.in: Regenerate.
3698 * testsuite/script_test_9.cc: New.
3699 * testsuite/script_test_9.sh: New.
3700 * testsuite/script_test_9.t: New.
3701
6625d24e
DK
37022010-05-19 Doug Kwan <dougkwan@google.com>
3703
3704 * arm.cc (Arm_input_section::original_size): New method.
3705 (Arm_input_section::do_addralign): Add a cast.
3706 (Arm_input_section::do_output_offset): Remove static cast.
3707 (Arm_input_section::original_addralign,
3708 Arm_input_section::original_size_): Change type to uint32_t.
3709 (Arm_input_section::init): Add safe casts for section alignment
3710 and size.
3711 (Arm_input_section::set_final_data_size): Do not set address and
3712 offset of stub table.
3713 (Arm_output_section::fix_exidx_coverage): Change use of of
3714 Output_section::Simple_input_section to that of
3715 Output_section::Input_section.
3716 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3717 except for the first pass.
3718 * output.cc (Output_section::get_input_sections): Change type of
3719 input_sections to std::list<Input_section>.
3720 (Output_section::add_script_input_section): Rename from
3721 Output_section::add_simple_input_section. Change type of SIS
3722 parameter from Simple_input_section to Input_section.
3723 * output.h (Output_section::Simple_input_section): Remove class.
3724 (Output_section::Input_section): Change class visibility to public.
3725 (Output_section::Input_section::addralign): Use stored alignments
3726 for special input sections if set.
3727 (Output_section::Input_section::set_addralign): New method.
3728 (Output_section::get_input_sections): Change parameter type from
3729 list of Simple_input_section to list of Input_section.
3730 (Output_section::add_script_input_section): Rename from
3731 Output_section::add_simple_input_section. Change first parameter's
3732 type from Simple_input_section to Input_section and remove the
3733 second and third parameters.
3734 * script-sections.cc (Input_section::Input_section_list): Change
3735 type to list of Output_section::Input_section/
3736 (Input_section_info::Input_section_info): Change parameter type of
3737 INPUT_SECTION to Output_section::Input_section.
3738 (Input_section_info::input_section): Change return type.
3739 (Input_section_info::input_section_): Change type to
3740 Output_section::Input_section.
3741 (Output_section_element_input::set_section_addresses): Adjust code
3742 to use Output_section::Input_section instead of
3743 Output_section::Simple_input_section. Adjust code for renaming
3744 of Output_section::add_simple_input_section.
3745 (Orphan_output_section::set_section_addresses): Ditto.
3746
e1e82ea4
RW
37472010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3748
3749 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3750 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3751
91e75c8a
RÁE
37522010-05-18 Rafael Espindola <espindola@google.com>
3753
3754 * options.cc (General_options::finalize): Handle -nostdlib.
3755 * options.h (nostdlib): New option.
3756 * script.cc (script_add_search_dir): Handle -nostdlib.
3757
da59ad79
DK
37582010-05-12 Doug Kwan <dougkwan@google.com>
3759
3760 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3761 attributes section only if there no attributes section after merging.
3762 (Target_arm::merge_object_attributes): Move value of
e1df38aa 3763 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
3764 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3765 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3766 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3767 and arm_attr_merge_7.stdout.
3768 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3769 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3770 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3771 arm_attr_merge_7b.o): New rules.
3772 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3773 arm_attr_merge_7
3774 * testsuite/Makefile.in: Regenerate.
3775 * testsuite/arm_attr_merge.sh: New file.
3776 * testsuite/arm_attr_merge_[67][ab].s: Same.
3777
3e01a7fd
NC
37782010-05-05 Nick Clifton <nickc@redhat.com>
3779
3780 * po/es.po: Updated Spanish translation.
3781
7ad2014a
L
37822010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3783
3784 * Makefile.am (install-exec-local): Properly install gold as
3785 default cross linker.
3786 * Makefile.in: Regenerated.
3787
4fda8867
NC
37882010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3789 Nick Clifton <nickc@redhat.com>
3790
3791 * configure.ac (install_as_default): Define and set to false
3792 unless --enable-gold or --enable-gold=both/gold has been
3793 specified.
3794 * configure: Regenerate.
3795
3796 * Makefile.am (install-exec-local): Install the executable as
3797 'ld.gold'. If install_as_default is true then also install it as
3798 'ld'.
3799 * Makefile.in: Regenerated.
3800
bd288ea2
ILT
38012010-04-24 Ian Lance Taylor <iant@google.com>
3802
3803 * layout.cc (Layout::layout_reloc): In relocatable link don't
3804 combine reloc sections for grouped sections.
3805
ef38fd8a
ST
38062010-04-23 Sriraman Tallam <tmsriram@google.com>
3807
3808 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3809 sections that are not ordinary to icf.
3810 * icf.cc (get_section_contents): Handle relocation pointing to section
3811 with no object or shndx information.
3812 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3813 * testsuite/Makefile.in: Regenerate.
3814 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3815 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3816
f6973bdc
ILT
38172010-04-22 Ian Lance Taylor <iant@google.com>
3818
3819 * expression.cc (Expression::Expression_eval_info): Add
3820 result_alignment_pointer field.
3821 (Expression::eval_with_dot): Add result_alignment_pointer
3822 parameter. Change all callers.
3823 (Expression::eval_maybe_dot): Likewise.
3824 (class Binary_expression): Add alignment_pointer parameter to
3825 left_value and right_value. Change all callers.
3826 (BINARY_EXPRESSION): Set result alignment.
3827 (class Trinary_expression): Add alignment_pointer parameter to
3828 arg2_value and arg3_value. Change all callers.
3829 (Trinary_cond::value): Set result alignment.
3830 (Max_expression::value, Min_expression::value): Likewise.
3831 (Align_expression::value): Likewise.
3832 * script-sections.cc (class Sections_element): Add dot_alignment
3833 parameter to set_section_addresses virtual function. Update
3834 instantiations.
3835 (class Output_section_element): Likewise.
3836 (Script_sections::create_segments): Add dot_alignment parameter.
3837 Change all callers.
3838 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3839 (Script_sections::set_phdrs_clause_addresses): Likewise.
3840 * script-sections.h: Update declarations.
3841 * script.h: Update declarations.
3842 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3843 min_p_align.
3844 * testsuite/script_test_3.t: Set large alignment.
3845 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3846 segment has expected alignment.
3847
9c9c98a5
NC
38482010-04-22 Nick Clifton <nickc@redhat.com>
3849
3850 * po/gold.pot: Updated by the Translation project.
3851 * po/vi.po: Updated Vietnamese translation.
3852
2253bfba
L
38532010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3854
3855 * testsuite/Makefile.am (check_PROGRAMS): Add
3856 icf_virtual_function_folding_test.
3857 * testsuite/Makefile.in: Regenerated.
3858
85fdf906
AH
38592010-04-15 Andrew Haley <aph@redhat.com>
3860
3861 * options.h (merge_exidx_entries): New option.
3862 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3863 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3864 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3865 (Target_arm::merge_exidx_entries): New function.
3866 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3867 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3868 to Arm_exidx_fixup constructor.
3869 Add new arg, merge_exidx_entries.
3870 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3871 Arm_output_section::fix_exidx_coverage.
3872
ce97fa81
ST
38732010-04-18 Sriraman Tallam <tmsriram@google.com>
3874
3875 * icf.cc (get_section_contents): Check for preemptible functions.
3876 Ignore addend when appropriate.
3877 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3878 section folded.
3879 (add_from_relobj): Check for section folded.
3880 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3881 * symtab.h (should_add_dynsym_entry): Add new parameter.
3882 * target-reloc.h (scan_relocs): Check for section folded.
3883 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3884 Check reloc types for function pointers in shared objects.
3885 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3886 case.
3887 (icf_preemptible_functions_test): New test case.
3888 (icf_string_merge_test): New test case.
3889 * testsuite.Makefile.in: Regenerate.
3890 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3891 bar_glob. Refactor code.
3892 * testsuite/icf_preemptible_functions_test.cc: New file.
3893 * testsuite/icf_preemptible_functions_test.sh: New file.
3894 * testsuite/icf_string_merge_test.cc: New file.
3895 * testsuite/icf_string_merge_test.sh: New file.
3896 * testsuite/icf_virtual_function_folding_test.cc: New file.
3897 * testsuite/icf_virtual_function_folding_test.sh: New file.
3898
04ceb17c
DK
38992010-04-14 Doug Kwan <dougkwan@google.com>
3900
3901 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3902 for local symbol recounting if we remove a section due to ICF.
3903 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3904 there are no regular objects in input.
3905
153e7da4
DK
39062010-04-13 Doug Kwan <dougkwan@google.com>
3907
3908 * arm.cc (Arm_input_section::set_final_data_size): Compute
3909 accurate final data size instead of using current data size.
3910
4dbd9faf
DK
39112010-04-09 Doug Kwan <dougkwan@google.com>
3912
3913 * layout.cc (Layout::choose_output_section): Handle script section
3914 types.
3915 (Layout::make_output_section_for_script): Add section type parameter.
3916 Handle script section types.
3917 * layout.h (Layout::make_output_section_for_script): Add section
3918 type parameter.
3919 * output.cc (Output_section::Output_section): Initialize data member
3920 is_noload_.
3921 (Output_section::do_reset_address_and_file_offset): Do not set address
3922 to 0 if section is a NOLOAD section.
3923 * output.h (Output_section::is_noload): New method.
3924 (Output_section::set_is_noload): Ditto.
3925 (Output_section::is_noload_): New data member.
3926 * script-c.h (Script_section_type): New enum type.
3927 (struct Parser_output_section_header): Add new file section_type.
3928 * script-sections.cc (Sections_element::output_section_name): Add
3929 parameter for returning script section type.
3930 (Output_section_definition::output_section_name): Ditto.
3931 (Output_section_definition::section_type)P; New method.
3932 (Output_section_definiton::script_section_type_name): Ditto.
3933 (Output_section_definition::script_section_type_): New data member.
3934 (Output_section_definition::Output_section_definition): Initialize
3935 data member Output_section_definition::script_section_type_.
3936 (Output_section_definition::create_sections): Pass script section type
3937 to Layout::make_output_section_for_script.
3938 (Output_section_definition::output_section_name): Return script
3939 section type to caller.
3940 (Output_section_definition::set_section_address): Do not advance
3941 dot value and load address if section type is NOLOAD. Set address
3942 of NOLOAD sections regardless of section flags.
3943 (Output_section_definition::print): Print section type if it is
3944 not SCRIPT_SECTION_TYPE_NONE.
3945 (Output_section_definition::section_type): New method.
3946 (Output_section_definition::script_section_type_name): Ditto.
3947 (Script_sections::output_section_name): Add new parameter
3948 PSECTION_TYPE for returning script section type. Pass it to
3949 section elements. Handle discard sections.
3950 (Sort_output_sections::operator()): Handle NOLOAD sections.
3951 * script-sections.h (Script_sections::Section_type): New enum type.
3952 (Script_sections::output_section_name): Add a new parameter for
3953 returning script section type.
3954 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3955 INFO and NOLOAD.
3956 * yyscript.y (union): Add new field SECTION_TYPE.
3957 (COPY, DSECT, INFO, NOLOAD): New tokens.
3958 (opt_address_and_section_type): Change type to output_section_header.
3959 (section_type): New non-terminal
3960 (section_header): Handle section type.
2253bfba 3961 (opt_address_and_section_type): Return section type value.
4dbd9faf 3962
721ea635
L
39632010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3964
3965 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3966 * testsuite/plugin_common_test_2.c (foo): Likewise.
3967
6bf924b0
DK
39682010-04-08 Doug Kwan <dougkwan@google.com>
3969
3970 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3971 Output_merge_data.
3972 * output.cc (Output_section::add_merge_input_section): Simplify
3973 code and return status of Output_merge_base::add_input_section.
e1df38aa 3974 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
3975 returns true.
3976
24af6f92
DK
39772010-04-07 Doug Kwan <dougkwan@google.com>
3978
3979 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3980 if section is marked as containing instructions but has no mapping
3981 symbols.
3982 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3983 correct section index.
3984 (Arm_relobj::find_linked_text_section): Ditto.
3985
00698fc5
CC
39862010-04-07 Cary Coutant <ccoutant@google.com>
3987
3988 * archive.cc (include_member): Destroy Read_symbols_data object before
3989 releasing file.
3990 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3991 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3992 (Read_symbols_data::~Read_symbols_data) New destructor.
3993 (Section_relocs::Section_relocs) New constructor.
3994 (Section_relocs::~Section_relocs) New destructor.
3995 (Read_relocs_data::Read_relocs_data) New constructor.
3996 (Read_relocs_data::~Read_relocs_data) New destructor.
3997 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3998 pointers to NULL after deleting.
3999
7296d933
DK
40002010-04-07 Doug Kwan <dougkwan@google.com>
4001
4002 * arm.cc: Replace "endianity" with "endianness" in comments.
4003 (Arm_exidx_cantunwind): Ditto.
4004 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
4005 (Arm_relobj::merge_flags_and_attributes): New method.
4006 (Arm_relobj::merge_flags_and_attributes_): New data member.
4007 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
4008 (Arm_relobj::scan_sections_for_stubs): Ditto.
4009 (Arm_relobj::do_read_symbols): Check to see if we really want to
4010 merge processor-specific flags and attributes. Exit early if
4011 an object is empty except for section names and the undefined symbol.
4012 (Target_arm::do_finalize_sections): Move check for ELF format to
4013 Arm_relobj::do_read_symbols. Merge processor specific flags and
4014 attributes from a regular object only when we have determined that
4015 it is aapropriate. Do not create an .ARM.attributes section in
4016 output if there is no regular input object.
4017 (Target_arm::merge_processor_specific_flags): Check
4018 --warn-mismatch before printing any error.
4019 (Target_arm::merge_object_attributes): Ditto.
4020 * gold.cc (queue_middle_tasks): Handle the case in which there is
4021 no regular object in input.
4022 * options.cc (General_options::parse_EB): New method.
4023 (General_options::parse_EL): Same.
4024 (General_options::General_options): Initialize endianness_.
4025 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
4026 New options.
4027 (General_options::Endianness): New enum.
4028 (General_options::endianness): New method.
4029 (General_options::endianness_): New data member.
4030 * parameters.cc (Parameters::set_options): Check target endianness.
4031 (Parameters::set_target_once): Ditto.
4032 (Parameters::check_target_endianness): New method.
4033 (parameters_force_valid_target): If either -EL or -EB is specified,
4034 use it to define endianness of default target.
4035 * parameters.h (Parameters::check_target_endianness): New method
4036 declaration.
4037 * target.h (class Target): Change "endianity" to "endianness"
4038 in comments.
4039
efc8d4f2
RW
40402010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4041
4042 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
4043 * configure: Regenerate.
4044 * Makefile.in: Regenerate.
4045 * testsuite/Makefile.in: Regenerate.
4046
be234d88
CC
40472010-04-06 Cary Coutant <ccoutant@google.com>
4048
4049 gcc PR lto/42757
4050 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
4051 prevailing definitions of common symbols.
4052 * testsuite/plugin_test_6.sh: New test case.
4053 * testsuite/plugin_common_test_1.c: New test case.
4054 * testsuite/plugin_common_test_2.c: New test case.
4055 * testsuite/Makefile.am (plugin_test_6): New test case.
4056 * testsuite/Makefile.in: Regenerate.
4057
bd32c6bd
NC
40582010-04-06 Nick Clifton <nickc@redhat.com>
4059
4060 * po/vi.po: New Vietnamese translation.
4061
323c532f
DK
40622010-03-30 Doug Kwan <dougkwan@google.com>
4063
4064 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
4065
4fcd97eb
DK
40662010-03-25 Doug Kwan <dougkwan@google.com>
4067
4068 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
4069 to avoid a conversion warning on a 32-bit host.
4070
4ebf39db
ILT
40712010-03-24 Ian Lance Taylor <iant@google.com>
4072
4073 * testsuite/script_test_3.t: Add a TLS segment.
4074 * testsuite/Makefile.am (check_PROGRAMS): Add
4075 tls_phdrs_script_test.
4076 (tls_phdrs_script_test_SOURCES): Define.
4077 (tls_phdrs_script_test_DEPENDENCIES): Define.
4078 (tls_phdrs_script_test_LDFLAGS): Define.
4079 (tls_phdrs_script_test_LDADD): Define.
4080 * testsuite/Makefile.in: Rebuild.
4081
4a599bdd
CC
40822010-03-23 Cary Coutant <ccoutant@google.com>
4083
4084 * fileread.cc (find_or_make_view): Fix comment.
4085
6c93b22c
ILT
40862010-03-23 Ian Lance Taylor <iant@google.com>
4087
4088 * script-sections.cc (class Orphan_section_placement): Define
4089 PLACE_TLS and PLACE_TLS_BSS.
4090 (Orphan_section_placement::Orphan_section_placement): Initialize
4091 new places.
4092 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
4093 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
4094 (tls_script_test_SOURCES): Define.
4095 (tls_script_test_DEPENDENCIES): Define.
4096 (tls_script_test_LDFLAGS): Define.
4097 (tls_script_test_LDADD): Define.
4098 * testsuite/Makefile.in: Rebuild.
4099
a2c7281b
DK
41002010-03-22 Doug Kwan <dougkwan@google.com>
4101
4102 * arm.cc (Arm_relocate_functions::abs8,
4103 Arm_relocate_functions::abs16): Use correct check for overflow
4104 specified in the ARM ELF specs.
4105 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4106 target of a BLX instruction specially.
4107 (Reloc_stub::stub_type_for_reloc): Ditto.
4108 (Relocate::relocate): Use symbolic names instead of numeric relocation
4109 codes to report error.
4110 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4111 workaround.
4112 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4113 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4114 thumb2_blx_out_of_range.stdout
4115 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4116 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4117 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4118 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4119 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4120 thumb2_blx_in_range, thumb2_blx_in_range.o,
4121 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4122 thumb2_blx_out_of_range.o): New rules.
4123 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4124 thumb2_blx_in_range and thumb2_blx_out_of_range.
4125 * testsuite/Makefile.in: Regenerate.
4126 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4127 * testsuite/thumb_blx_in_range.s: New file.
4128 * testsuite/thumb_blx_out_of_range.s: New file.
4129
b0193076
RÁE
41302010-03-22 Rafael Espindola <espindola@google.com>
4131
4132 * archive.cc (Should_include): Move to archive.h.
4133 (should_include_member): Make it a member of Archive.
4134 (Lib_group): New.
4135 (Add_lib_group_symbols): New.
4136 * archive.h: Include options.h.
4137 (Archive_member): Moved from Archive.
4138 (Should_include): Moved from archive.cc.
4139 (Lib_group): New.
4140 (Add_lib_group_symbols): New.
4141 * dynobj.cc (do_should_include_member): New.
4142 * dynobj.h (do_should_include_member): New.
4143 * gold.cc (queue_initial_tasks): Update call to queue.
4144 * main.cc (main): Print lib group stats.
4145 * object.cc (do_should_include_member): New.
4146 * object.h: Include archive.h.
4147 (Object::should_include_member): New.
4148 (Object::do_should_include_member): New.
4149 (Sized_relobj::do_should_include_member): New.
4150 * options.cc (General_options::parse_start_lib): New.
4151 (General_options::parse_end_lib): New.
4152 (Input_arguments::add_file): Handle lib groups.
4153 (Input_arguments::start_group): Check we are not in a lib.
4154 (Input_arguments::start_lib): New.
4155 (Input_arguments::end_lib): New.
4156 * options.h (General_options): Add start_lib and end_lib.
4157 (Input_argument::lib_): New.
4158 (Input_argument::lib): New.
4159 (Input_argument::is_lib): New.
4160 (Input_file_lib): New.
4161 (Input_arguments::in_lib_): New.
4162 (Input_arguments::in_lib): New.
4163 (Input_arguments::start_lib): New.
4164 (Input_arguments::end_lib_): New.
4165 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4166 in unused members as preempted.
4167 (Sized_pluginobj::do_should_include_member): New.
4168 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4169 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4170 return the blocker.
4171 (Read_symbols::do_whole_lib_group): New.
4172 (Read_symbols::do_lib_group): New.
4173 (Read_symbols::do_read_symbols): Handle lib groups.
4174 (Read_symbols::get_name): Handle lib groups.
4175 * readsyms.h (Read_symbols): Add an archive member pointer.
4176 (Read_symbols::do_whole_lib_group): New.
4177 (Read_symbols::do_lib_group): New.
4178 (Read_symbols::member_): New.
4179 * script.cc (read_input_script): Update call to queue_soon.
4180
d099120c
DK
41812010-03-19 Doug Kwan <dougkwan@google.com>
4182
4183 * arm.cc (Stub_table::Stub_table): Initialize new data members
4184 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4185 (Stub_table::add_reloc_stub): Assign stub offset and update
4186 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4187 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4188 New data members.
4189 (Stub_table::update_data_size_and_addralign): Use
4190 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4191 instead of going over all reloc stubs.
4192 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4193 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4194 Stringpool_template::offset_ to size of Stringpool_char.
4195 (Stringpool_template::new_key_offset): Remove code to initialize
4196 Stringpool_template::offset_.
4197 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4198 Stringpool_template::offset_ to zero.
4199
1aa37384
DK
42002010-03-15 Doug Kwan <dougkwan@google.com>
4201
4202 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4203 offset_.
4204 (Stringpool_template::new_key_offset): New method.
4205 (Stringpool_template::add_string): Assign offsets when adding new
4206 strings.
4207 (Stringpool_template::set_string_offsets): Do not set string offsets
4208 when not optimizing.
4209 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4210 member size_.
4211 (Chunked_vector::clear): Clear size_.
4212 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4213 (Chunked_vector::size): Return size_.
4214 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 4215 (Chunked_vector::size_): New data member.
1aa37384
DK
4216 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4217 (Stringpool_template::new_key_offset): New method declaration.
4218 (Stringpool_template::offset_): New data member.
4219
b672b057
RÁE
42202010-03-15 Rafael Espindola <espindola@google.com>
4221
4222 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4223 Add_symbols' constructor.
4224 * readsyms.h (Add_symbols): Remove the input_group member.
4225
b6848d3c
ILT
42262010-03-10 Ian Lance Taylor <iant@google.com>
4227
4228 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4229 target to ask whether a reference to a symbol requires a stack
4230 split.
4231 * target.h (Target::is_call_to_non_split): New function.
4232 (Target::do_is_call_to_non_split): Declare virtual function.
4233 * target.cc: Include "symtab.h".
4234 (Target::do_is_call_to_non_split): New function.
4235 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4236
a2a5469e
CC
42372010-03-10 Cary Coutant <ccoutant@google.com>
4238
4239 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4240 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4241 (File_read::open[2]): Add whole_file_view_ to list of views.
4242 (File_read::make_view): Remove test of whole_file_view_.
4243 (File_read::find_or_make_view): Create whole_file_view_ if
4244 necessary.
4245 (File_read::clear_views): Replace bool parameter with enum;
4246 adjust all callers. Don't delete views with permanent data;
4247 do delete cached views and views from archives if
4248 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4249 if clearing the corresponding view.
4250 * fileread.h (File_read::Clear_views_mode): New enum.
4251 (File_read::View::is_permanent_view): New method.
4252 (File_read::clear_views): Replace bool parameter
4253 with enum; adjust all callers.
4254 * options.h (General_options): Change keep_files_mapped option;
4255 add map_whole_files.
4256 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4257 releasing the file.
4258 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4259 the file.
4260
8861f32b
DM
42612010-03-10 David S. Miller <davem@davemloft.net>
4262
4263 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4264
d62d0f5f
ST
42652010-03-09 Sriraman Tallam <tmsriram@google.com>
4266
4267 * icf.cc (get_section_contents): Add '@' marker after processing the
4268 merge reloc.
4269
9177756d
DK
42702010-03-08 Doug Kwan <dougkwan@google.com>
4271
4272 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4273 due to a conversion warning.
4274 (Arm_relobj::update_output_local_symbol_count): Check for local
4275 symbol with unset output index.
4276
9e9e071b
ILT
42772010-03-05 Ian Lance Taylor <iant@google.com>
4278
4279 * options.h (class General_options): Add --spare-dynamic-tags.
4280 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4281 --spare-dynamic-tags.
4282
a81ee015
ILT
42832010-03-05 Ian Lance Taylor <iant@google.com>
4284
4285 * incremental.cc: Include "libiberty.h".
4286
44ec90b9
RO
42872010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4288
4289 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4290 function, is_info_ member.
4291 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4292 (Versions::Versions): Update caller.
4293 (Versions::define_base_version): Likewise.
4294 (Versions::add_def): Likewise.
4295
0897ed3b
ST
42962010-03-03 Sriraman Tallam <tmsriram@google.com>
4297
4298 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4299 (Scan::possible_function_pointer_reloc): New function.
4300 (Scan::local_reloc_may_be_function_pointer): Change to call
4301 possible_function_pointer_reloc.
4302 (Scan::global_reloc_may_be_function_pointer): Ditto.
4303 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4304 relocations in ".data.rel.ro._ZTV" section.
4305 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4306 * testsuite/icf_safe_so_test.cc: Ditto.
4307 * testsuite/icf_safe_test.cc: Ditto.
4308 * testsuite/icf_safe_test.sh: Ditto.
4309
d3bbad62
ILT
43102010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4311 Ian Lance Taylor <iant@google.com>
4312
4313 * target-reloc.h (relocate_section): Check the symbol table index
4314 for -1U before setting the local symbol index.
4315 (scan_relocatable_relocs): If copying the relocation, record that
4316 the local symbol is required.
4317 * object.h (Symbol_value::is_output_symtab_index_set): New
4318 function.
4319 (Symbol_value::may_be_discarded_from_output_symtab): New
4320 function.
4321 (Symbol_value::has_output_symtab_entry): New function.
4322 (Symbol_value::needs_output_symtab_entry): Remove.
4323 (Symbol_value::output_symtab_index): Make sure the symbol index is
4324 set.
4325 (Symbol_value::set_output_symtab_index): Make sure the symbol
4326 index is not set. Make sure the new index is valid.
4327 (Symbol_value::set_must_have_output_symtab_entry): New function.
4328 (Symbol_value::has_output_dynsym_entry): New function.
4329 (Symbol_value::set_output_dynsym_index): Make sure the new index
4330 is valid.
4331 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4332 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4333 local symbol if permitted.
4334 (Sized_relobj::do_finalize_local_symbols): Call
4335 is_output_symtab_index_set rather than needs_output_symtab_entry.
4336 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4337 rather than needs_output_symtab_entry. Call
4338 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4339 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4340 is_output_symtab_index_set rather than needs_output_symtab_entry.
4341 * testsuite/discard_locals_relocatable_test.c: New file.
4342 * testsuite/discard_locals_test.sh: Test -r.
4343 * testsuite/Makefile.am (check_DATA): Add
4344 discard_locals_relocatable_test1.syms,
4345 discard_local_relocatable_test2.syms.
4346 (MOSTLYCLEANFILES): Likewise. Also add
4347 discard_locals_relocatable_test1.lout and
4348 discard_locals_relocatable_test2.out.
4349 (discard_locals_relocatable_test1.syms): New target.
4350 (discard_locals_relocatable_test.o): New target.
4351 (discard_locals_relocatable_test1.out): New target.
4352 (discard_locals_relocatable_test2.syms): New target.
4353 (discard_locals_relocatable_test2.out): New target.
4354 (various): Add missing ../ld-new dependencies.
4355 * testsuite/Makefile.in: Rebuild.
4356
7e8ccf26
NC
43572010-03-03 Nick Clifton <nickc@redhat.com>
4358
4359 * po/fi.po: New Finnish translation.
4360
2a0ff005
DK
43612010-03-01 Doug Kwan <dougkwan@google.com>
4362
4363 * layout.cc (Layout::Layout): Force section types of .init_array*,
4364 .preinit_array* and .fini_array* sections.
4365 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4366 Fix check of return value of std::string::find.().
4367 (Output_section::Input_section_sort_compare::operator()): Remove
4368 comment about .init_array.
4369 (Output_section::Input_section_sort_init_fini_compare::operator()):
4370 New method.
4371 (Output_section::sort_attached_input_sections): Handle .init_array
4372 and .fini_array specially.
4373 * output.h (Output_section::Inut_section_sort_compare): Update
4374 comment.
4375 (Output_section::Input_section_sort_init_fini_compare): New struct.
4376
c3e4ae29
DK
43772010-02-26 Doug Kwan <dougkwan@google.com>
4378
4379 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4380 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4381 * testsuite/debug_msg.sh: Avoid matching source line number for
4382 use of global variable undef_int.
4383
2fd9ae7a
DK
43842010-02-26 Doug Kwan <dougkwan@google.com>
4385
4386 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4387 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4388 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4389 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4390 * options.cc (General_options::General_options): Initialize member
4391 fix_v4bx_.
4392 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4393 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4394 and rm_no_fix_v4bx.stdout
4395 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4396 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4397 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4398 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4399 and arm_no_fix_v4bx.
4400 * Makefile.in: Regenerate.
4401 * testsuite/arm_fix_v4bx.s: New file.
4402 * testsuite/arm_fix_v4bx.sh: Ditto.
4403
67ec7d0b
DK
44042010-02-24 Doug Kwan <dougkwan@google.com>
4405
4406 * arm.cc (Target_arm::got_section): Make the .got section the first
4407 non RELRO section in the data segment.
4408 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4409 suffixes of section names.
4410
10165461
DK
44112010-02-24 Doug Kwan <dougkwan@google.com>
4412
4413 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4414 flags and attributes merging if an input file is a binary file.
4415 * fileread.cc (Input_file::open): Record format of original file.
4416 * fileread.h (Input_file::Format): New enum type.
4417 (Input_file::Input_file): Initialize data member format_.
4418 (Input_file::format): New method definition.
4419 (Input_file::format_):: New data member.
4420
4a54abbb
DK
44212010-02-24 Doug Kwan <dougkwan@google.com>
4422
4423 * arm.cc (Arm_output_data_got): New class.
4424 (ARM_TCB_SIZE): New constant
4425 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4426 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4427 If user uses a script with a SECTIONS clause, issue only a warning
4428 for a misplaced EXIDX input section. Otherwise, issue an error.
4429 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4430 garbage collection.
4431 (Target_arm::got_mode_index_entry): Handle static linking.
4432 (Target_arm::Scan::local): Ditto.
4433 (Target_arm::Scan::global): Ditto.
4434 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4435 all incorrectly implemented relocations.
e1df38aa 4436 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
4437 Arm_output_section::fix_exidx_coverage.
4438 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4439 from ".ARM.exidx." and ".ARM.extab.".
4440
ca419a6f
ILT
44412010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4442
4443 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4444 section if it does not already exist.
4445 * attributes.cc (Attributes_section_data::Attributes_section_data):
4446 Don't crash if size is zero.
4447
135b9c78
ILT
44482010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4449 Ian Lance Taylor <iant@google.com>
4450
4451 * gold.cc (queue_middle_tasks): If no input files were opened,
4452 exit.
4453 * workqueue.h (Task_function::Task_function): Assert that there is
4454 a blocker.
4455
bb0bfe4f
DK
44562010-02-22 Doug Kwan <dougkwan@google.com>
4457
4458 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4459 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4460 types to avoid warnings due to different uint64_t implementations
4461 on different hosts.
4462
2a2b6d42
DK
44632010-02-21 Doug Kwan <dougkwan@google.com>
4464
4465 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4466 handling of the maximum backward branch offset.
4467 (Arm_relocate_functions::thumb_branch_common): Ditto.
4468 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4469 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 4470 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
4471 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4472 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4473 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4474 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4475 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4476 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4477 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4478 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4479 thumb2_bl_out_of_range.o): New rules.
4480 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4481 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4482 thumb2_bl_out_of_range
4483 * testsuite/Makefile.in: Regenerate.
4484 * testsuite/arm_bl_in_range.s: New file.
4485 * testsuite/arm_bl_out_of_range.s: Ditto.
4486 * testsuite/arm_branch_in_range.sh: Ditto.
4487 * testsuite/arm_branch_range.t: Ditto.
4488 * testsuite/thumb2_branch_range.t: Ditto.
4489 * testsuite/thumb_bl_in_range.s: Ditto.
4490 * testsuite/thumb_bl_out_of_range.s: Ditto.
4491 * testsuite/thumb_branch_range.t: Ditto.
4492
b487ad64
ST
44932010-02-20 Sriraman Tallam <tmsriram@google.com>
4494
4495 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4496 Add reloc offset information.
4497 * icf.cc (get_section_contents): Change iterators to point to the new
4498 vectors. Add reloc offset information to the contents.
4499 * icf.h (Icf::Sections_reachable_info): New typedef.
4500 (Icf::Sections_reachable_list): New typedef.
4501 (Icf::Offset_info): New typedef.
4502 (Icf::Reloc_info): New struct typedef.
4503 (Icf::Reloc_info_list): New typedef.
4504 (Icf::symbol_reloc_list): Delete method.
4505 (Icf::addend_reloc_list): Delete method.
4506 (Icf::section_reloc_list): Delete method.
4507 (Icf::reloc_info_list): New method.
4508 (Icf::reloc_info_list_): New member.
4509
f96accdf
DK
45102010-02-19 Doug Kwan <dougkwan@google.com>
4511
4512 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4513 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4514 * arm.cc (Arm_relocation_functions): New forward declaration.
4515 (Target_arm::Target_arm): Initialize new data members
4516 got_mod_index_offset_ and tls_base_symbol_defined_.
4517 (Target_arm::Relocate::relocate_tls): New method.
4518 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4519 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4520 New methods.
4521 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4522 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4523 (Target_arm::got_mod_index_offset_,
4524 Target_arm::tls_base_symbol_defined_): New data members.
4525 (Target_arm::Scan::local, Target::Scan::global,
4526 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4527 relocations.
4528
c8761b9a
DK
45292010-02-18 Doug Kwan <dougkwan@google.com>
4530
4531 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4532 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4533 text section as a parameter becuase some broken tools may not set
4534 the link in section header.
4535 (Target_arm::has_got_section): New method.
4536 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4537 without any mapping symbol as data only. Remove warning.
4538 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4539 link in its section header, try to discover the link by inspecting the
4540 REL31 relocation at the beginning of the section.
4541 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4542 in error message.
4543 (Target_arm::Scan::global): Treat any reference to the symbol
4544 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4545
21bb3914
ST
45462010-02-12 Sriraman Tallam <tmsriram@google.com>
4547
4548 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4549 (Scan::global_reloc_may_be_function_pointer): New function.
4550 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4551 (Scan::global_reloc_may_be_function_pointer): New function.
4552 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4553 (Scan::global_reloc_may_be_function_pointer): New function.
4554 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4555 (Scan::global_reloc_may_be_function_pointer): New function.
4556 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4557 (Scan::global_reloc_may_be_function_pointer): New function.
4558 (Scan::possible_function_pointer_reloc): New function.
4559 (Target_x86_64::can_check_for_function_pointers): New function.
4560 * gc.h (gc_process_relocs): Scan relocation types to determine if
4561 function pointers were taken for targets that support it.
4562 * icf.cc (Icf::find_identical_sections): Include functions for
4563 folding in safe ICF whose pointer is not taken.
4564 * icf.h (Secn_fptr_taken_set): New typedef.
4565 (fptr_section_id_): New member.
4566 (section_has_function_pointers): New function.
4567 (set_section_has_function_pointers): New function.
4568 (check_section_for_function_pointers): New function.
4569 * options.h: Fix comment for safe ICF option.
4570 * target.h (can_check_for_function_pointers): New function.
4571 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4572 Modify icf_safe_test for X86-64.
4573 * testsuite/Makefile.in: Regenerate.
4574 * testsuite/icf_safe_so_test.cc: New file.
4575 * testsuite/icf_safe_so_test.sh: New file.
4576 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4577 (main): Change to take pointer to function kept_func_3.
4578 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4579 folding is done correctly for X86-64.
4580
0da6fa6c
DM
45812010-02-12 David S. Miller <davem@davemloft.net>
4582
4583 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4584 is_symbolless parameter.
4585 (Output_reloc<SHT_REL>::is_symbolless): New.
4586 (Output_reloc<SHT_REL>::is_symbolless_): New.
4587 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4588 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4589 (Output_reloc<SHT_RELA>::is_symbolless): New.
4590 (Output_data_reloc::add_global): Handle is_symbolless.
4591 (Output_data_reloc::add_global_relative): Likewise.
4592 (Output_data_reloc::add_local): Likewise.
4593 (Output_data_reloc::add_local_relative): Likewise.
4594 (Output_data_reloc::add_symbolless_global_addend): New.
4595 (Output_data_reloc::add_symbolless_local_addend): New.
4596 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4597 is_symbolless.
4598 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4599 instead of ->is_relative_
4600 (Output_reloc::write): Likewise.
4601 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4602 (Output_reloc::write_rel): Simplify.
4603
4604 * sparc.cc (Target_sparc::Scan::local): Use
4605 ->add_symbolless_local_addend as needed.
4606 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4607 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4608 based upon relocation offset.
4609
e4782e83
DK
46102010-02-11 Doug Kwan <dougkwan@google.com>
4611
4612 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4613 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4614 beginning of function.
4615 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4616 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4617 parameter is_32bit in calls to should_apply_static_reloc.
4618 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4619 (check_DATA): Add arm_abs_global.stdout.
4620 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4621 arm_abs_global.stdout): New rules.
4622 (MOSTLLYCLEANFILES): Add arm_abs_global
4623 * Makefile.in: Regenerate.
4624 * testsuite/arm_abs_global.s: New file.
4625 * testsuite/arm_abs_global.sh: Ditto.
4626 * testsuite/arm_abs_lib.s: Ditto.
4627
93ceb764
ILT
46282010-02-11 Ian Lance Taylor <iant@google.com>
4629
4630 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4631 Read_relocs task.
4632 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4633 Allocate_commons_task first.
4634 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4635 task, rather than symtab_lock_.
4636 (Gc_process_relocs::~Gc_process_relocs): New function.
4637 (Gc_process_relocs::is_runnable): Check this_blocker_.
4638 (Gc_process_relocs::locks): Use next_blocker_ rather than
4639 blocker_.
4640 (Scan_relocs::~Scan_relocs): New function.
4641 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4642 symtab_lock_.
4643 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4644 next_blocker_.
4645 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4646 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4647 constructor accordingly.
4648 (class Gc_process_relocs): Likewise.
4649 (class Scan_relocs): Likewise.
4650 * common.h (class Allocate_commons_task): Remove symtab_lock_
4651 field, and corresponding constructor parameter.
4652 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4653 symtab_lock_.
4654 (Allocate_commons_task::locks): Likewise.
4655
114dfbe1
ILT
46562010-02-11 Ian Lance Taylor <iant@google.com>
4657
4658 * gold-threads.h (class Once): Define.
4659 (class Initialize_lock): Rewrite as child of Once.
4660 * gold-threads.cc (class Once_initialize): Define.
4661 (once_pointer_control): New static variable.
4662 (once_pointer, once_arg): New static variables.
4663 (c_run_once): New static function.
4664 (Once::Once, Once::run_once, Once::internal_run): New functions.
4665 (class Initialize_lock_once): Remove.
4666 (initialize_lock_control): Remove.
4667 (initialize_lock_pointer): Remove.
4668 (initialize_lock_once): Remove.
4669 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4670 (Initialize_lock::initialize): Rewrite.
4671 (Initialize_lock::do_run_once): New function.
4672 * archive.cc (Archive::interpret_header): Only clear name if it is
4673 not already empty.
4674 * fileread.cc: Include "gold-threads.h"
4675 (file_counts_lock): New static variable.
4676 (file_counts_initialize_lock): Likewise.
4677 (File_read::release): Only increment counts when using --stats.
4678 Use a lock around the increment.
4679 * parameters.cc (class Set_parameters_target_once): Define.
4680 (set_parameters_target_once): New static variable.
4681 (Parameters::Parameters): Move here from parameters.h.
4682 (Parameters::set_target): Rewrite.
4683 (Parameters::set_target_once): New function.
4684 (Parameters::clear_target): Move here and rewrite.
4685 * parameters.h (class Parameters): Update declarations. Add
4686 set_parameters_target_once_ field.
4687 (Parameters::Parameters): Move to parameters.cc.
4688 (Parameters::clear_target): Likewise.
4689 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4690 task.
4691 (Start_group::~Start_group): New function.
4692 (Start_group::is_runnable): New function.
4693 (Start_group::locks, Start_group::run): New functions.
4694 (Finish_group::run): Change saw_undefined to size_t.
4695 * readsyms.h (class Start_group): Define.
4696 (class Finish_group): Change saw_undefined_ field to size_t.
4697 (Finish_group::Finish_group): Remove saw_undefined and
4698 this_blocker parameters. Change all callers.
4699 (Finish_group::set_saw_undefined): New function.
4700 (Finish_group::set_blocker): New function.
4701 * symtab.h (class Symbol_table): Change saw_undefined to return
4702 size_t. Change saw_undefined_ field to size_t.
4703 * target-select.cc (Set_target_once::do_run_once): New function.
4704 (Target_selector::Target_selector): Initialize set_target_once_
4705 field. Don't initialize lock_ and initialize_lock_ fields.
4706 (Target_selector::instantiate_target): Rewrite.
4707 (Target_selector::set_target): New function.
4708 * target-select.h (class Set_target_once): Define.
4709 (class Target_selector): Update declarations. Make
4710 Set_target_once a friend. Remove lock_ and initialize_lock_
4711 fields. Add set_target_once_ field.
4712
fa17a3f4
ILT
47132010-02-10 Ian Lance Taylor <iant@google.com>
4714
4715 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4716 queueing any tasks.
4717 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4718 (queue_middle_tasks): Add all blockers before queueing any tasks.
4719 (queue_final_tasks): Likewise.
4720 * token.h (Task_token::add_blockers): New function.
4721 * object.h (Input_objects::number_of_relobjs): New function.
4722
c7177d31
ILT
47232010-02-10 Ian Lance Taylor <iant@google.com>
4724
5de0e392
ILT
4725 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4726 shared, not if not position independent.
4727 * x86_64.cc (Relocate::relocate_tls): Likewise.
4728 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4729 (tls_pie_pic_test): New target.
4730 * testsuite/Makefile.in: Rebuild.
4731
c7177d31
ILT
4732 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4733 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4734 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4735 * testsuite/Makefile.in: Rebuild.
4736
684b268a
DM
47372010-02-09 David S. Miller <davem@davemloft.net>
4738
4739 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4740 R_SPARC_RELATIVE using ->add_local_relative().
4741 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4742
612a8d3d
DM
4743 * output.h (Output_data_dynamic::add_section_size): New method
4744 that takes two Output_data objects.
4745 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4746 entry param. Handle it in initializers.
4747 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4748 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4749 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4750 arg.
4751 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4752 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4753 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4754 for dynrel_includes_plt.
4755 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4756 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4757 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4758 before .rela.plt
4759 (Target_sparc::do_finalize_sections): Update to pass true for
4760 dynrel_includes_plt.
4761 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4762 output before .rela.plt
4763 (Target_powerpc::do_finalize_sections): Update to pass true for
4764 dynrel_includes_plt when 32-bit.
4765
cb1be87e
DK
47662010-02-08 Doug Kwan <dougkwan@google.com>
4767
4768 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4769 method.
4770 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4771 Arm_relobj::scan_section_for_cortex_a8_stubs,
4772 Arm_relobj::do_relocation_section): Instead of calling
4773 Output_section::output_address, use faster
4774 Arm_relobj::simple_input_section_output_address.
4775
705b5121
DM
47762010-02-08 David S. Miller <davem@davemloft.net>
4777
4778 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4779 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4780 relocation helper function.
4781
024c4466
DM
4782 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4783 just like R_SPARC_GOT{10,13,22}.
4784 (Target_sparc::Scan::local): Likewise.
4785 (Target_sparc::Relocate:relocate): Likewise.
4786
9109c078
ILT
47872010-02-06 Ian Lance Taylor <iant@google.com>
4788
4789 * configure.ac: Rewrite targetobjs duplicate removal code to use
4790 only shell constructs.
4791 * configure: Rebuild.
4792
cf846138
DK
47932010-02-05 Doug Kwan <dougkwan@google.com>
4794
4795 PR 11247
4796 * arm.cc (Arm_relobj::section_is_scannable): New method.
4797 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4798 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4799
6cfaf60b
DK
48002010-02-04 Doug Kwan <dougkwan@google.com>
4801
4802 PR 11247
4803 * arm-reloc-property.cc (cstdio): Include.
4804 * configure.ac (targetobjs): Remove duplicates.
4805 * configure: Regenerate.
4806 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4807 big and little endian version for a given address size.
4808
5c57f1be
DK
48092010-02-03 Doug Kwan <dougkwan@google.com>
4810
4811 * arm-reloc-property.cc
4812 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4813 definition.
4814 * arm-reloc-property.h
4815 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4816 New method definition.
4817 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4818 declaration.
4819 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4820 overflow to N.
4821 (GOT_PREL): Change implemented to Y.
4822 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4823 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4824 (Arm_relocate_functions::movw_abs_nc): Remove method.
4825 (Arm_relocate_functions::movt_abs): Ditto.
4826 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4827 (Arm_relocate_functions::thm_movt_abs): Ditto.
4828 (Arm_relocate_functions::movw_rel_nc): Ditto.
4829 (Arm_relocate_functions::movw_rel): Ditto.
4830 (Arm_relocate_functions::movt_rel): Ditto.
4831 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4832 (Arm_relocate_functions:thm_movw_rel): Ditto.
4833 (Arm_relocate_functions:thm_movt_rel): Ditto.
4834 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4835 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4836 New method definitions.
4837 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4838 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4839 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4840 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4841 (Target_arm::Relocate::relocate): Check for non-static or
4842 unimplemented relocation code and exit early. Change calls to
4843 Target_arm::reloc_uses_thumb_bit and
4844 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4845 instead. Refactor code to handle similar relocations to increase
4846 code sharing. Remove check for unsupported relocation code in switch
4847 statement.
4848 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4849 relocation property table to find out size. Change error message to
4850 print out the name of a relocation code instead of the numeric value.
4851 (Target_arm::scan_reloc_for_stub): Use relocation property table
4852 instead of calling Target_arm::reloc_uses_thumb_bit().
4853
218c5831
DK
48542010-02-02 Doug Kwan <dougkwan@google.com>
4855
4856 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4857 types of relaxed input section.
4858
0d31c79d
DK
48592010-02-02 Doug Kwan <dougkwan@google.com>
4860
4861 * Makefile.am (HFILES): Add arm-reloc-property.h.
4862 (DEFFILES): New.
4863 (TARGETSOURCES): Add arm-reloc-property.cc
4864 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4865 (libgold_a_SOURCES): $(DEFFILES)
4866 * Makefile.in: Regenerate.
4867 * arm-reloc-property.cc: New file.
4868 * arm-reloc-property.h: New file.
4869 * arm-reloc.def: New file.
4870 * arm.cc: Update comments.
4871 (arm-reloc-property.h): New included header.
4872 (arm_reloc_property_table): New global variable.
4873 (Target_arm::do_select_as_default_target): New method definition.
4874 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4875 arm-reloc-property to targ_extra_obj.
4876 * parameters.cc (set_parameters_target): Call
4877 Target::select_as_default_target().
4878 * target.h (Target::select_as_default_target): New method definition.
4879 (Target::do_select_as_default_target): Same.
4880
546c7457
DK
48812010-02-01 Doug Kwan <dougkwan@google.com>
4882
4883 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4884 first_output_text_section_.
4885 (Arm_exidx_fixup::first_output_text_section): New method definition.
4886 (Arm_exidx_fixup::first_output_text_section_): New data member.
4887 (Arm_exidx_fixup::process_exidx_section): Record the first text
4888 output section seen.
4889 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4890 and entsize in output section header.
4891
11b861d5
DK
48922010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4893
4894 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4895 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4896 (Arm_relocate_functions::thm_alu11): New Method.
4897 (Arm_relocate_functions::thm_pc8): New Method.
4898 (Arm_relocate_functions::thm_pc12): New Method.
4899 (Target_arm::Scan::local): Handle the relocations.
4900 (Target_arm::Scan::global): Likewise.
4901 (Target_arm::Relocate::relocate): Likewise.
4902 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4903
c9a2c125
DK
49042010-01-29 Doug Kwan <dougkwan@google.com>
4905
4906 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4907 of relocation types as ld.
4908
1521477a
DK
49092010-01-29 Doug Kwan <dougkwan@google.com>
4910
4911 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4912 to public.
4913 (Arm_relocate_functions::thumb_branch_common): Ditto.
4914 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4915 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4916 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4917 Arm_relocate_functions::jump24): Remove.
4918 (Target_arm::Relocate::relocate): Adjust code to call
4919 Arm_relocation_functions::arm_branch_common and
4920 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 4921 wrappers. Merge switch-cases together to reduce source code size.
1521477a 4922
e7eca48c
DK
49232010-01-29 Doug Kwan <dougkwan@google.com>
4924
4925 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4926 output_local_symbol_count_needs_update_.
4927 (Arm_relobj::output_local_symbol_count_needs_update,
4928 Arm_relobj::set_output_local_symbol_count_needs_update,
4929 Arm_relobj::update_output_local_symbol_count): New methods.
4930 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4931 member.
4932 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4933 of pointed function as in a R_ARM_PREL31 relocation.
4934 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4935 for output local symbol count updating.
4936 (Target_arm::do_relax): Update output local symbol counts in objects
4937 if necessary.
4938 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4939
02961d7e
ILT
49402010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4941
4942 * arm.cc: Added support for the ARM relocations:
4943 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4944 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4945 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4946 movw_prel_nc).
4947 (Arm_relocate_functions::movw_rel): New method.
4948 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4949 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4950 thm_movw_prel_nc).
4951 (Arm_relocate_functions::thm_movw_rel): New method.
4952 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4953 thm_movt_prel).
4954 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4955 relocations.
4956 (Target_arm::Scan::global): Likewise.
4957 (Target_arm::Relocate::relocate): Likewise.
4958 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4959 Likewise.
4960
b10d2873
ILT
49612010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4962
4963 * arm.cc: Added support for ARM group relocations.
4964 (Target_arm::reloc_needs_sym_origin): New method.
4965 (Arm_relocate_functions::calc_grp_kn): New method.
4966 (Arm_relocate_functions::calc_grp_residual): New method.
4967 (Arm_relocate_functions::calc_grp_gn): New method.
4968 (Arm_relocate_functions::arm_grp_alu): New Method.
4969 (Arm_relocate_functions::arm_grp_ldr): New Method.
4970 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4971 (Arm_relocate_functions::arm_grp_ldc): New Method.
4972 (Target_arm::Scan::local): Handle the ARM group relocations.
4973 (Target_arm::Scan::global): Likewise.
4974 (Target_arm::Relocate::relocate): Likewise.
4975 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4976 Likewise.
4977
2b328d4e
DK
49782010-01-26 Doug Kwan <dougkwan@google.com>
4979
4980 * arm.cc (set): Include.
4981 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4982 pointer type.
4983 (Arm_output_section::Text_section_list): New type.
4984 (Arm_output_section::append_text_sections_to_list): New method.
4985 (Arm_output_section::fix_exidx_coverage): Ditto.
4986 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4987 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4988 Relobj::set_section_offset() instead of
4989 Sized_relobj::invalidate_section_offset().
4990 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4991 parameter for section headers. Ignore relocation sections for
4992 unallocated sections and EXIDX sections.
4993 (Target_arm::fix_exidx_coverage): New method.
4994 (Target_arm::output_section_address_less_than): New type.
4995 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4996 linked text section instead of the EXIDX section.
4997 (Arm_output_section::create_stub_group): Add an assertion to check
4998 that this is not an EXIDX output section.
4999 (Arm_output_section::append_text_sections_to_list): New method.
5000 (Arm_output_section::fix_exidx_coverage): Ditto.
5001 (Arm_relobj::scan_sections_for_stubs): Adjust call to
5002 Arm_relobj::section_needs_reloc_stub_scanning.
5003 (Target_arm::do_relax): Fix EXIDX output section coverage in the
5004 first pass.
5005 (Target_arm::fix_exidx_coverage): New method.
5006 * object.h (Relobj::set_output_section): New method.
5007 (Sized_relobj::invalidate_section_offset): Remove method.
5008 (Sized_relobj::do_invalidate_section_offset): Remove method.
5009 (Sized_relobj::do_set_section_offset): Handle offset value -1.
5010
c7f3c371
DK
50112010-01-25 Doug Kwan <dougkwan@google.com>
5012
5013 * arm.cc (Arm_exidx_merged_section::do_output_offset):
5014 Fix warning due to signed and unsigned comparison on a 32-bit host.
5015
8923b24c
DK
50162010-01-22 Doug Kwan <dougkwan@google.com>
5017
5018 * arm.cc (Target_arm::do_relax): Record an output section for section
5019 offset adjustment it contains any stub table that has changed.
5020 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
5021 offsets in an output section if necessary.
5022 * output.cc (Output_section::Output_section): Initialize
5023 section_offsets_need_adjustments_.
5024 (Output_section::add_input_section_for_script): Renamed to
5025 Output_section::add_simple_input_section.
5026 (Output_section::save_states): Add a comment.
5027 (Output_section::discard_states): New method defintion.
5028 (Output_section::adjust_section_offsets): Same.
5029 * output.h (Output_section::add_input_section_for_script): Renamed to
5030 Output_section::add_simple_input_section.
5031 (Output_section::discard_states): New method declaration.
5032 (Output_section::adjust_section_offsets): Same.
5033 (Output_section::section_offsets_need_adjustment,
5034 Output_section::set_section_offsets_need_adjustment): New method
5035 definitions.
5036 (Output_section::section_offsets_need_adjustment_): New data member.
5037 * script-sections.cc
5038 (Output_section_element_input::set_section_address): Adjust code for
5039 renaming of Output_section::add_input_section_for_script.
5040 (Orphan_output_section::set_section_address): Same.
5041
9b2fd367
DK
50422010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5043
5044 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
5045 Fix_v4bx enum values .
5046 * gold/options.h (General_options): New option definitions.
5047 (General_options::fix_v4bx): New method.
5048 (General_options::Fix_v4bx): New enum.
5049 * gold/options.cc (General_options::parse_fix_v4bx): New method.
5050 (General_options::parse_fix_v4bx_interworking): New method.
5051
80d0d023
DK
50522010-01-22 Doug Kwan <dougkwan@google.com>
5053
5054 * arm.cc (Arm_exidx_fixup): New class.
5055
af2cdeae
DK
50562010-01-21 Doug Kwan <dougkwan@google.com>
5057
5058 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
5059 classes.
5060 (Arm_exidx_section_offset_map): New type.
5061
993d07c1
DK
50622010-01-21 Doug Kwan <dougkwan@google.com>
5063
5064 * arm.cc (Arm_exidx_input_section): New class.
5065 (Arm_relobj::exidx_input_section_by_link,
5066 Arm_relobj::exidx_input_section_by_shndx,
5067 Arm_relobj::make_exidx_input_section): New methods.
5068 (read_arm_attributes_section): Remove.
5069 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
5070 information about them.
5071 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
5072 to here.
5073
5ac169d4
DK
50742010-01-20 Doug Kwan <dougkwan@google.com>
5075
5076 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
5077 Input_section_specifier to Section_id.
5078 (Target_arm::new_arm_input_section: Adjust code for change of key
5079 type.
5080 (Target_arm::find_arm_input_section): Ditto.
5081 * gc.h (object.h): Include for Section_id nand Section_id_hash.
5082 (Section_id): Remove.
5083 (Garbage_collection::Section_id_hash): Remove.
5084 * icf.h (object.h): Include for Section_id nand Section_id_hash.
5085 (Section_id): Remove.
5086 (Icf::Section_id_hash): Remove.
5087 * object.h (Section_id, Const_section_id, Section_id_hash,
5088 Const_section_id_hash): New type definitions.
5089 * output.cc (Output_section::add_relaxed_input_section): Change to
5090 use Const_section_id instead of Input_section_specifier as key type.
5091 (Output_section::add_merge_input_section): Ditto.
5092 (Output_section::build_relaxation_map): Change to use Section_id
5093 instead of Input_section_specifier as key type.
5094 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5095 Ditto.
5096 (Output_section::convert_input_sections_to_relaxed_sections): Change
5097 to use Const_section_id instead of Input_section_specifier as key type.
5098 (Output_section::find_merge_section): Ditto.
5099 (Output_section::find_relaxed_input_section): Ditto.
5100 * output.h (Input_section_specifier): Remove class.
5101 (Output_section::Output_section_data_by_input_section_map): Change
5102 key type to Const_section_id.
5103 (Output_section::Output_relaxed_input_section_by_input_section_map):
5104 Ditto.
5105 (Output_section::Relaxation_map): Change key type to Section_id.
5106
a2162063
ILT
51072010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5108
5109 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5110 (class Arm_v4bx_stub): New class.
5111 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5112 (Stub_factory::make_arm_v4bx_stub): New method.
5113 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5114 (Stub_table::empty): Handle v4bx stubs.
5115 (Stub_table::add_arm_v4bx_stub): New method.
5116 (Stub_table::find_arm_v4bx_stub): New method.
5117 (Arm_relocate_functions::v4bx): New method.
5118 (Target_arm::fix_v4bx): New method.
5119 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5120 (Stub_table::relocate_stubs): Likewise.
5121 (Stub_table::do_write): Likewise.
5122 (Stub_table::update_data_size_and_addralign): Likewise.
5123 (Stub_table::finalize_stubs): Likewise.
5124 (Target_arm::Scan::local): Likewise.
5125 (Target_arm::Scan::global): Likewise.
5126 (Target_arm::do_finalize_sections): Likewise.
5127 (Target_arm::Relocate::relocate): Likewise.
5128 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5129 Likewise.
5130 (Target_arm::scan_reloc_for_stub): Likewise.
5131 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5132
5696ab0b
ILT
51332010-01-19 Ian Lance Taylor <iant@google.com>
5134
5135 * output.cc (Output_section_headers::do_sized_write): Write large
5136 segment count to sh_info field.
5137 (Output_file_header::do_sized_write): For large segment count,
5138 write PN_XNUM to e_phnum field.
5139
800d0f56
ILT
51402010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5141
5142 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5143 (Arm_relocate_functions::thm_jump8): New function.
5144 (Arm_relocate_functions::thm_jump11): New function.
5145 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5146 R_ARM_THM_JUMP11.
5147 (Target_arm::Scan::global): Likewise.
5148 (Target_arm::Relocate::relocate): Likewise.
5149 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5150 Likewise.
5151
41263c05
DK
51522010-01-14 Doug Kwan <dougkwan@google.com>
5153
5154 * arm.cc (map, utility): Include headers.
5155 (Target_arm::apply_cortex_a8_workaround): New method.
5156 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5157 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5158 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5159 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5160 the --[no-]fix-cortex-a8 command line options.
5161 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5162 (Target_arm::relocate_stub): Use addend in instruction template.
5163 * options.h (DEFINE_bool): Set the user-set flag.
5164 (General_options): Add --[no-]-fix-cortex options.
5165 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 5166 : Update fast look-up map after conversion.
41263c05 5167
459e9b03
ST
51682010-01-14 Sriraman Tallam <tmsriram@google.com>
5169
5170 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5171 in the first pass of do_layout.
5172
b521dfe4
DK
51732010-01-13 Doug Kwan <dougkwan@google.com>
5174
5175 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5176 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5177 apparent compiler problem of not folding static constant integral
5178 data members of elfcpp::Elf_sizes<32>.
5179
44272192
DK
51802010-01-13 Doug Kwan <dougkwan@google.com>
5181
5182 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5183 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5184 Arm_relobj::scan_section_for_cortex_a8_erratum,
5185 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5186 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5187 sections to scan for relocation stubs into a new method
5188 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5189 relocation and Cortex-A8 stub scanning.
5190 (Target_arm::do_relax): Force stubs to be after stubbed sections
5191 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 5192 the beginning of a new relaxation pass. Update a comment.
44272192
DK
5193 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5194
44b71ece
ILT
51952010-01-12 Ian Lance Taylor <iant@google.com>
5196
5197 * target-reloc.h (visibility_error): New inline function.
5198 (relocate_section): Call visibility_error.
5199 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5200 (MOSTLYCLEANFILES): Likewise.
5201 (protected_4_pic.o, protected_3.err): New targets.
5202 * testsuite/protected_4.cc: New file.
5203
a120bc7f
DK
52042010-01-12 Doug Kwan <dougkwan@google.com>
5205
5206 * arm.cc (Cortex_a8_reloc): New class.
5207 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5208 and cortex_a8_relocs_info_.
5209 (Target_arm::fix_cortex_a8): New method definition.
5210 (Target_arm::Cortex_a8_relocs_info): New type.
5211 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5212 New data member declarations.
5213 (Target_arm::scan_reloc_for_stub): Record information about
5214 relocations for THUMB branches that might be exempted from the
5215 Cortex-A8 workaround.
5216 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5217 at the beginning of a relaxation pass.
5218
20138696
DK
52192010-01-12 Doug Kwan <dougkwan@google.com>
5220
5221 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5222 (Arm_relobj::Mapping_symbol_position,
5223 Arm_reloj::Mapping_symbol_position_less,
5224 Arm_relobj::Mapping_symbols_info): New types.
5225 (Target_arm::is_mapping_symbol_name): New method definition.
5226 (Arm_relobj::do_count_local_symbols): Save information about mapping
5227 symbols.
5228
089d69dc
DK
52292010-01-11 Doug Kwan <dougkwan@google.com>
5230
5231 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5232 Arm_relocate_functions::thumb32_branch_upper,
5233 Arm_relocate_functions::thumb32_branch_lower,
5234 Arm_relocate_functions::thumb32_cond_branch_offset,
5235 Arm_relocate_functions::thumb32_cond_branch_upper,
5236 Arm_relocate_functions::thumb32_cond_branch_lower,
5237 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5238 branch offset encoding.
5239 (Arm_relocate_functions::thumb_branch_common): Use new branch
5240 offset encoding methods to avoid code duplication.
5241 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5242 (Stub_addend_reader::operator()): Use new branch encoding method
5243 to avoid code duplication.
5244
99e5bff2
DK
52452010-01-11 Doug Kwan <dougkwan@google.com>
5246
5247 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5248 (Target_arm::do_finalize_sections): Define special EXIDX section
5249 symbols only if referenced.
5250 * gc.h (Garbage_collection::add_reference): New method.
5251 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5252 code duplication.
5253
98e090bd
ILT
52542010-01-11 Ian Lance Taylor <iant@google.com>
5255
d0a91bd8
ILT
5256 * script.cc (Version_script_info::build_expression_list_lookup):
5257 Change complaing about duplicate wildcard match from error to
5258 warning.
5259
98e090bd
ILT
5260 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5261 of 2009-12-30.
5262 (Version_script_info::Version_script_info): Initialize globs_,
5263 default_version_, default_is_global_, and exact_. Don't
5264 initialize globals_ or locals_.
5265 (Version_script_info::build_lookup_tables): Build local symbols
5266 first.
5267 (Version_script_info::unquote): New function.
5268 (Version_script_info::add_exact_match): New function.
5269 (Version_script_info::build_expression_list_lookup): Remove lookup
5270 parameter. Add is_global parameter. Change all callers. Handle
5271 wildcard pattern specially. Unquote pattern. Call
5272 add_exact_match.
5273 (Version_script_info::get_name_to_match): New function.
5274 (Version_script_info::get_symbol_version): New function.
5275 (Version_script_info::get_symbol_version_helper): Remove.
5276 (Version_script_info::check_unmatched_names): Call unquote.
5277 * script.h (class Version_script_info): Change get_symbol_version
5278 to be non-inline and add is_global parameter; change all callers.
5279 Rewrite symbol_is_local. Update declarations. Define struct
5280 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5281 Remove globals_ and locals_ members. Add exact_, globs_,
5282 default_version_, is_global_.
5283 (Version_script_info::Glob): Remove pattern, add expression and
5284 is_global. Update constructor. Change all callers.
5285 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5286 default version.
5287 (Versions::symbol_section_contents): If a symbol is undefined, or
5288 defined in a dynamic object, set the version index to
5289 VER_NDX_LOCAL.
5290 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5291 symbol_is_local.
5292 (Symbol_table::add_from_pluginobj): Likewise.
5293 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5294
d56962d3
DK
52952010-01-11 Doug Kwan <dougkwan@google.com>
5296
5297 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5298 (incremental_dump_LDADD): Add linking option for libintl.
5299 * Makefile.in: Regenerate.
5300
94e6ee91
L
53012010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5302
5303 PR gold/11144
5304 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5305 instead of -Ds.
5306 * testsuite/Makefile.in: Regenerated.
5307
e96c574b
DK
53082010-01-10 Doug Kwan <dougkwan@google.com>
5309
5310 * options.h (DEFINE_var): Use parentheses around argument varname__
5311 in macro body to avoid any unintended subsequent substitutions.
5312
7198066b
ILT
53132010-01-10 Ian Lance Taylor <iant@google.com>
5314
ba4d53bf
ILT
5315 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5316 candidates before doing symbol resolution.
5317
7198066b
ILT
5318 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5319 ODR candidates if only one is weak.
5320
a2beed37
ILT
53212010-01-08 Ian Lance Taylor <iant@google.com>
5322
5323 * script.cc (Version_script_info::build_expression_list_lookup):
5324 Don't warn about ambiguous version, just record the ambiguity.
5325 (Version_script_info::get_symbol_version_helper): Give error if
5326 version is ambiguous.
5327
2fb7225c
DK
53282010-01-08 Doug Kwan <dougkwan@google.com>
5329
5330 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5331 prev_data_size_ and prev_addralign_. Remove initializer for
5332 deleted data member has_been_changed_.
5333 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5334 to determine if the table is empty.
5335 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5336 Remove.
5337 (Stub_table::add_reloc_stub): Define method in class definition
5338 instead of just declaring it there.
5339 (Stub_table::add_cortex_a8_stub): New method definition.
5340 (Stub_table::update_data_size_and_addralign): Ditto.
5341 (Stub_table::finalize_stubs): Ditto.
5342 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5343 (Stub_table::do_addralign_): Return address alignment in the
5344 (Stub_table::do_reset_address_and_file_offset): Define method in
5345 class definition instead of declaring it there. Set current data
5346 size to be the data size of the previous pass.
5347 (Stub_table::set_final_data_size): Use current data size as the
5348 final data size.
5349 (Stub_table::relocate_stub): Change parameter type of stub from
5350 Reloc_stub pointer to Stub pointer.
5351 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5352 (Stub_table::Cortex_a8_stub_list): New typedef.
5353 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5354 Stub_table::prev_addralign_): New data member.
5355 (Arm_relobj::Arm_relobj): Initialize data member
5356 section_has_cortex_a8_workaround_.
5357 (Arm_relobj::section_has_cortex_a8_workaround,
5358 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5359 definitions.
5360 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5361 declarations.
5362 (Target_arm::relocate_stub): Change parameter type of stub from
5363 Reloc_stub pointer to Stub pointer.
5364 (Insn_template::size, Insn_template::alignment): Handle
5365 THUMB16_SPECIAL_TYPE.
5366 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5367 Stub_table::update_data_size_and_addralign,
5368 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5369 definitions.
5370 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5371 (Stub_table::do_write): Ditto.
5372 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5373
880cd20d
ILT
53742010-01-08 Ian Lance Taylor <iant@google.com>
5375
5376 PR 11108
5377 * symtab.h (class Symbol): Remove fields is_target_special_ and
5378 has_plt_offset_. Add field is_defined_in_discarded_section_.
5379 (Symbol::is_defined_in_discarded_section): New function.
5380 (Symbol::set_is_defined_in_discarded_section): New function.
5381 (Symbol::has_plt_offset): Rewrite.
5382 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5383 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5384 Don't initialize is_target_special_ or has_plt_offset_.
5385 Initialize is_defined_in_discarded_section_.
5386 (Symbol_table::add_from_relobj): If appropriate, set
5387 is_defined_in_discarded_section.
5388 * resolve.cc (Symbol::override_base_with_special): Don't test
5389 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5390 * target-reloc.h (relocate_section): Do special handling for
5391 symbols defined in discarded sections for global symbols as well
5392 as local symbols.
5393
2703e3eb
ILT
53942010-01-08 Ian Lance Taylor <iant@google.com>
5395
5396 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5397 the SHT_SYMTAB case.
5398
339d40a3
ILT
53992010-01-08 Ian Lance Taylor <iant@google.com>
5400
5401 * object.cc (Sized_relobj::do_layout): Don't get confused if
5402 layout_eh_frame returns NULL.
5403
abecea76
ILT
54042010-01-08 Ian Lance Taylor <iant@google.com>
5405
5406 PR 11084
5407 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5408 dynamic symbol table, use the normal symbol table.
5409 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5410 symbol table.
5411
6b7dd3f3
ILT
54122010-01-08 Ian Lance Taylor <iant@google.com>
5413
5414 PR 11072
5415 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5416 sections.
5417
36c50e63
L
54182010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5419
5420 * version.cc (print_version): Change to "Copyright 2010".
5421
e291e7b9
ILT
54222010-01-08 Ian Lance Taylor <iant@google.com>
5423
5424 PR 10287
5425 PR 11063
5426 * i386.cc (class Target_i386): Change return type of plt_section
5427 to be non-const.
5428 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5429 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5430 tls_desc_rel_ field.
5431 (Output_data_plt_i386::rel_tls_desc): New function.
5432 (Target_i386::rel_tls_desc_section): New function.
5433 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5434 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5435 R_386_TLS_DESC reloc in rel_tls_desc_section.
5436 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5437 Define struct Tlsdesc_info.
5438 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5439 (Target_x86_64::do_reloc_symbol_index): New function.
5440 (Target_x86_64::add_tlsdesc_info): New function.
5441 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5442 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5443 tlsdesc_rel_ field.
5444 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5445 all callers.
5446 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5447 (Target_x86_64::rela_tlsdesc_section): New function.
5448 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5449 handling.
5450 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5451 (Target_x86_64::do_reloc_addend): New function.
5452 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5453 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5454 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5455 (Output_reloc::type): New function.
5456 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5457 (Output_reloc::is_target_specific): New function.
5458 (Output_reloc::target_arg): New function.
5459 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5460 absolute relocs and target specific relocs.
5461 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5462 add_target_specific.
5463 (class Output_data_reloc) [SHT_RELA]: Likewise.
5464 * output.cc (Output_reloc::Output_reloc): Add four new versions
5465 for absolute relocs and target specific relocs.
5466 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5467 (Output_reloc::get_symbol_index): Likewise.
5468 (Output_reloc::local_section_offset): Check that local_sym_index_
5469 is not TARGET_CODE or 0.
5470 (Output_reloc::symbol_value): Likewise.
5471 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5472 reloc.
5473 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5474 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5475 functions.
5476 * layout.cc (add_target_dynamic_tags): Use output section for
5477 DT_PLTRELSZ and DT_JMPREL.
5478
3a44184e
ILT
54792010-01-07 Ian Lance Taylor <iant@google.com>
5480
5481 PR 11061
5482 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5483 function.
5484 (class Output_data_reloc_generic): Define.
5485 (class Output_data_reloc_base): Change base class to
5486 Output_data_reloc_generic. Change add() method to call
5487 bump_relative_reloc_count for a relative reloc. Remove
5488 sort_relocs_ field.
5489 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5490 to sort_relocs().
5491 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5492 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5493 appropriate.
5494 * layout.h (class Layout): Update declaration.
5495
ea715a34
ILT
54962010-01-07 Ian Lance Taylor <iant@google.com>
5497
5498 * output.h (class Output_data): Add const version of
5499 output_section and do_output_section.
5500 (class Output_section_data): Add const version of
5501 do_output_section.
5502 (class Output_section): Likewise.
5503 * layout.cc (Layout::add_target_dynamic_tags): New function.
5504 * layout.h (class Layout): Update declarations.
5505 * arm.cc (Target_arm::do_finalize_sections): Use
5506 add_target_dynamic_tags.
5507 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5508 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5509 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5510 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5511
659948a4
ILT
55122010-01-07 Ian Lance Taylor <iant@google.com>
5513
5514 PR 11042
5515 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5516 object as needed.
5517
9d3b86f6
ILT
55182010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5519 Ian Lance Taylor <iant@google.com>
5520
5521 PR 11019
5522 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5523 Xindex::read_symtab_xindex.
5524
bb0d3eb0
DK
55252010-01-07 Doug Kwan <dougkwan@google.com>
5526
5527 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5528 (Insn_template::thumb16_bcond_insn): New method declaration.
5529 (Insn_template): Fix spelling.
5530 (Stub::thumb16_special): New method declaration.
5531 (Stub::do_write): Define virtual method which was previously pure
5532 virtual.
5533 (Stub::do_thumb16_special): New method declaration.
5534 (Stub::do_fixed_endian_write): New template member.
5535 (Reloc_stub::do_write): Remove.
5536 (Reloc_stub::do_fixed_endian_write): Remove.
5537 (Cortex_a8_stub): New class definition.
5538 (Stub_factory::make_cortex_a8_stub): New method definition.
5539 (Stub_factory::Stub_factory): Add missing static storage class
5540 qualifier for elf32_arm_stub_a8_veneer_blx.
5541
ffeef7df
ILT
55422010-01-07 Ian Lance Taylor <iant@google.com>
5543
dc3f80fe
ILT
5544 PR 10980
5545 * options.h (class General_options): Add --warn-unresolved-symbols
5546 and --error-unresolved-symbols.
5547 * errors.cc (Errors::undefined_symbol): Implement
5548 --warn-unresolved-symbols.
5549
ffeef7df
ILT
5550 * options.h (class General_options): Add -z text and -z textoff.
5551 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5552
f1ec9ded
ST
55532010-01-06 Sriraman Tallam <tmsriram@google.com>
5554
5555 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5556 (Garbage_collection::cident_sections): New function.
5557 (Garbage_collection::add_cident_section): New function.
5558 (Garbage_collection::cident_sections_): New member.
5559 (gc_process_relocs): Add references to sections whose names are C
5560 identifiers.
5561 * gold.h (cident_section_start_prefix): New constant.
5562 (cident_section_stop_prefix): New constant.
5563 (is_cident): New function.
5564 * layout.cc (Layout::define_section_symbols): Replace string constants
5565 with the newly defined constants.
5566 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5567 C identifiers.
5568 * testsuite/Makefile.am: Add gc_orphan_section_test.
5569 * testsuite/Makefile.in: Regenerate.
5570 * testsuite/gc_orphan_section_test.cc: New file.
5571 * testsuite/gc_orphan_section_test.sh: New file.
5572
6eda8c29
ILT
55732010-01-06 Ian Lance Taylor <iant@google.com>
5574
b9674e17
ILT
5575 PR 10980
5576 * options.h (class General_options): Add --warn-shared-textrel.
5577 * layout.cc (Layout::finish_dynamic_section): Implement
5578 --warn-shared-textrel.
5579
6eda8c29
ILT
5580 PR 10980
5581 * options.h (class General_options): Add --warn-multiple-gp.
5582
32dcd44e
ILT
55832010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5584
5585 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5586 $(THREADSLIB) and $(LIBDL).
5587 * Makefile.in: Rebuild.
5588
a192ba05
ILT
55892010-01-06 Ian Lance Taylor <iant@google.com>
5590
5591 PR 10980
5592 * options.cc (General_options::parse_section_start): New function.
5593 (General_options::section_start): New function.
5594 (General_options::General_options): Initialize all members.
5595 * options.h: Include <map>
5596 (class General_options): Add --section-start. Add section_starts_
5597 member.
5598 * layout.cc (Layout::attach_allocated_section_to_segment): If
5599 --section-start was used, set the address of the segment. Remove
5600 local sort_sections.
5601 (Layout::relaxation_loop_body): If the address of the load segment
5602 has been set by --section-start, don't use it.
5603 * output.h (Output_segment::update_flags_for_output_section): New
5604 function.
5605 * output.cc (Output_segment::add_output_section): Call
5606 update_flags_for_output_section.
5607
dde3f402
ILT
56082010-01-05 Ian Lance Taylor <iant@google.com>
5609
62dfdd4d
ILT
5610 PR 10980
5611 * options.h (class General_options): Add --undefined-version.
5612 * script.cc (struct Version_expression): Add was_matched_by_symbol
5613 field.
5614 (Version_script_info::matched_symbol): New function.
5615 (Version_script_info::get_symbol_version_helper): Call
5616 matched_symbol.
5617 (Version_script_info::check_unmatched_names): New function.
5618 * script.h (class Version_script_info): Update declarations.
5619 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5620
9c4ae156
ILT
5621 * options.h (class General_options): Use DEFINE_bool_alias for
5622 allow_multiple_definition.
5623 * resolve.cc (Symbol_table::should_override): Don't test
5624 allow_multiple_definition.
5625
dde3f402
ILT
5626 PR 10980
5627 * options.h (class General_options): Add --cref.
5628 * main.cc (main): Print cref table if --cref. Don't close mapfile
5629 until after printing cref table.
5630 * cref.cc: Include "symtab.h".
5631 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5632 (Cref_table_compare::operator()): New function.
5633 (Cref_inputs::gather_cref): New function.
5634 (filecol): New static const.
5635 (Cref_inputs::print_cref): New function.
5636 (Cref::print_cref): New function.
5637 * cref.h: Include <cstdio>.
5638 (class Cref): Update declarations.
5639 * mapfile.h (Mapfile::file): New function.
5640 * object.h (class Object): Define Symbols. Declare virtual
5641 do_get_global_symbols.
5642 (Object::get_global_symbols): New function.
5643 * object.cc (Input_objects::add_object): Pass object to cref_ if
5644 --cref.
5645 (Input_objects::archive_start): Likewise.
5646 (Input_objects::archive_stop): Likewise.
5647 (Input_objects::print_cref): New function.
5648 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5649 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5650 --cref.
5651 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5652 function.
5653 * plugin.h (class Sized_pluginobj): Update declarations.
5654
8781f709
ILT
56552010-01-05 Ian Lance Taylor <iant@google.com>
5656
5657 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5658 to is_default_version. Rename insdef to insdefault.
5659 (Symbol_table::add_from_relobj): Rename def to is_default_version
5660 and local to is_forced_local.
5661 (Symbol_table::add_from_pluginobj): Likewise.
5662 (Symbol_table::add_from_dynobj): Likewise.
5663 (Symbol_table::define_special_symbol): Rename insdef to
5664 insdefault.
5665
fe35d28d
ILT
56662010-01-04 Ian Lance Taylor <iant@google.com>
5667
30bc8c46
ILT
5668 PR 10980
5669 * options.h (class General_options): Add
5670 --allow-multiple-definition and -z muldefs.
5671 * resolve.cc (Symbol_table::should_override): Don't warn about a
5672 multiple symbol definition if --allow-multiple-definition or -z
5673 muldefs.
5674
7eaea549
ILT
5675 PR 10980
5676 * options.h (class General_options): Add --add-needed and
5677 --copy-dt-needed-entries. Tweak --as-needed help entry.
5678 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5679 error if --copy-dt-needed-entries aka --add-needed is used and
5680 would cause a change in behaviour.
5681
fe35d28d
ILT
5682 PR 10980
5683 * options.h (class General_options): Add -G as a short version of
5684 --shared. Add no-op options -assert, -g, and -i.
5685
55a2bb35
ST
56862010-01-04 Sriraman Tallam <tmsriram@google.com>
5687
5688 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5689 check for .text or .gnu.linkonce.t sections.
5690 * icf.cc (Icf::find_identical_sections): Ditto.
5691 Change the detection for mangled function name within the section
5692 name.
5693 * icf.h (is_section_foldable_candidate): New function.
5694
719328e1
ILT
56952009-12-30 Ian Lance Taylor <iant@google.com>
5696
5697 PR 10980
5698 * options.h (class General_options): Permit two dashes with
5699 --retain-symbols-file.
5700
d7bb5745
ILT
57012009-12-30 Ian Lance Taylor <iant@google.com>
5702
403a15dd
ILT
5703 PR 10979
5704 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5705 don't put the file header and segment headers in the text
5706 segment.
5707
eda294df
ILT
5708 PR 10979
5709 * common.cc (Sort_commons::operator()): Stabilize sort when both
5710 entries are NULL.
5711 (Symbol_table::do_allocate_commons_list): When allocating common
5712 symbols, skip a symbol which is no longer common.
5713 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5714 an object before checking its type.
5715 * testsuite/common_test_2.c: New file.
5716 * testsuite/common_test_3.c: New file.
5717 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5718 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5719 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5720 (common_test_2_pic.o, common_test_2.so): New targets.
5721 (common_test_3_pic.o, common_test_3.so): New targets.
5722 * testsuite/Makefile.in: Rebuild.
5723
d7bb5745
ILT
5724 PR 10979
5725 * script.cc (read_input_script): If we see a new SECTIONS clause,
5726 and we have added an input section, give an error.
5727 * layout.h (class Layout): Add have_added_input_section function.
5728 Add have_added_input_section_ field.
5729 * layout.cc (Layout::Layout): Initialize
5730 have_added_input_section_.
5731 (Layout::layout): Set have_added_input_section_.
5732 (Layout::layout_eh_frame): Likewise.
5733
fc59c572
ILT
57342009-12-30 Ian Lance Taylor <iant@google.com>
5735
5736 PR 10931
5737 * options.h (class General_options): Add --sort-common option.
5738 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5739 * common.cc (Sort_common): Add sort_order parameter to
5740 constructor. Add sort_order_ field.
5741 (Sort_commons::operator): Check sort_order_.
5742 (Symbol_table::allocate_commons): Determine the sort order.
5743 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5744 Change all callers.
5745 (Symbol_table::do_allocate_commons_list): Likewise.
5746
1c74fab0
ILT
57472009-12-30 Ian Lance Taylor <iant@google.com>
5748
5749 PR 10916
5750 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5751 symbols from this object, don't change the visibility of an
5752 undefined symbol.
5753 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5754
6affe781
ILT
57552009-12-30 Ian Lance Taylor <iant@google.com>
5756
5757 PR 10861
5758 * script.h (class Version_script_info): Define Language enum.
5759 Update declarations. Define Glob, Exact, and Lookup types. Add
5760 new fields globals_, locals_, and is_finalized_.
5761 * script.cc: Various formatting fixes.
5762 (class Parser_closure): Change language_stack_ from a vector of
5763 std::string to one of Version_script_info::Language. Adjust all
5764 uses accordingly.
5765 (class Lazy_demangler): Remove.
5766 (struct Version_expression): Change language from std::string to
5767 Version_script_info::Language.
5768 (Version_script_info::Version_script_info): New function.
5769 (Version_script_info::~Version_script_info): Don't call clear.
5770 (Version_script_info::finalize): New function.
5771 (Version_script_info::build_lookup_tables): New function.
5772 (Version_script_info::build_expression_list_lookup): New
5773 function.
5774 (Version_script_info::get_symbol_version_helper): Rewrite to use
5775 lookup tables.
5776 (Version_script_info::print_expression_list): Adjust to use
5777 Version_script_info::Language.
5778 (script_push_lex_into_version_mode): Check that the version script
5779 has not been finalized.
5780 (version_script_push_lang): Change language string to
5781 Version_script_info::Language.
5782 * options.cc (Command_line::version_script): New function.
5783 * options.h (class General_options): Add finalize_dynamic_list
5784 function. Change version_script from declaration to definition.
5785 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5786 * testsuite/version_script.map: Remove duplicate def of foo.
5787 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5788 version_script.map.
5789 * testsuite/Makefile.in: Rebuild.
5790
818bf354
ILT
57912009-12-30 Ian Lance Taylor <iant@google.com>
5792
5793 PR 10843
5794 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5795 if the input symbol index is 0, make the output symbol index 0.
5796
ebcc8304
ILT
57972009-12-30 Ian Lance Taylor <iant@google.com>
5798
5799 PR 10670
5800 * options.h (class General_options): Add -x/--discard-all.
5801 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5802 --discard-all. If the local symbol needs a dynamic entry, check
5803 that before handling --discard-locals.
5804
176fe33f
ILT
58052009-12-30 Ian Lance Taylor <iant@google.com>
5806
bb321bb1
ILT
5807 PR 10450
5808 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5809 flags to PF_R.
5810 (Output_segment::add_output_section): Don't change the flags if
5811 the type is PT_TLS.
5812
176fe33f
ILT
5813 PR 10450
5814 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5815 GNU hash table if they need a dynamic value. Otherwise, don't add
5816 them if they are defined in a dynamic object or are forced local.
5817
e8cd95c7
ILT
58182009-12-29 Ian Lance Taylor <iant@google.com>
5819
1b81fb71
ILT
5820 PR 10450
5821 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5822 .gnu.hash table for a 32-bit target.
5823
8d6d383d
ILT
5824 PR 10450
5825 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5826 regular and a dynamic object only needs a dynamic symbol table
5827 entry if it is externally visible.
5828
e785ec03
ILT
5829 PR 10450
5830 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5831 constructor. Add global_offset_table_ field.
5832 (Target_i386::got_section): Set global_offset_table_.
5833 (Target_i386::do_finalize_sections): Set global_offset_table_
5834 size.
5835 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5836 in constructor. Add global_offset_table_ field.
5837 (Target_x86_64::got_section): Set global_offset_table_.
5838 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5839 size.
5840
1a2dff53
ILT
5841 * layout.cc (Layout::Layout): Initialize increase_relro_.
5842 (Layout::get_output_section): Add is_relro, is_last_relro, and
5843 is_first_non_relro parameters. Change all callers.
5844 (Layout::choose_output_section): Likewise.
5845 (Layout::add_output_section_data): Likewise.
5846 (Layout::make_output_section): Likewise.
5847 (Layout::set_segment_offsets): Clear increase_relro when using a
5848 linker script.
5849 * layout.h (class Layout): Add increase_relro method. Add
5850 increase_relro_ field. Update declarations.
5851 * output.cc (Output_section::Output_section): Initialize
5852 is_last_relro_ and is_first_non_relro_.
5853 (Output_segment::add_output_section): Group relro sections is
5854 do_sort is true. Handle is_last_relro and is_first_non_relro.
5855 (Output_segment::maximum_alignment): Remove relro handling.
5856 (Output_segment::set_section_addresses): Add increase_relro
5857 parameter. Change all callers. Add initial alignment to align
5858 relro sections on separate page. Remove old relro handling.
5859 (Output_segment::set_section_list_addresses): Remove in_relro
5860 parameter. Change all callers.
5861 (Output_segment::set_offset): Add increase parameter. Change all
5862 callers. Remove old relro handling.
5863 * output.h (class Output_section): Add new methods: is_last_relro,
5864 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5865 Add is_last_relro_ and is_first_non_relro_ fields.
5866 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5867 Create separate .got.plt section. Call increase_relro.
5868 * x86_64.cc (Target_x86_64::got_section): Likewise.
5869 * testsuite/relro_script_test.t: Add .got.plt.
5870
f0ba79e2
ILT
5871 PR 10450
5872 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5873 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5874 (Layout::finalize): Call set_dynamic_symbol_size.
5875 (Layout::set_dynamic_symbol_size): New function.
5876 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5877 set_dynamic_symbol_size.
5878
e8cd95c7
ILT
5879 PR 10450
5880 * output.h (class Output_section): Add is_entsize_zero_ field.
5881 * output.cc (Output_section::Output_section): Initialize
5882 is_entsize_zero_.
5883 (Output_section::set_entsize): If two different entsizes are
5884 requested, force it to zero.
5885 (Output_section::add_input_section): Set flags for .debug_str
5886 before updating section flags. Set entsize.
5887 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5888 and SHF_STRING if all input sections have those flags.
5889
3e1b9a8a
RÁE
58902009-12-29 Rafael Espindola <espindola@google.com>
5891
5892 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
5893 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5894 reporting.
3e1b9a8a 5895
3dcad376
ST
58962009-12-29 Sriraman Tallam <tmsriram@google.com>
5897
5898 * options.cc (General_options::parse_version): Allow -v to exit
5899 without an error if there is nothing to link.
5900
084e2665
ILT
59012009-12-29 Ian Lance Taylor <iant@google.com>
5902
5903 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5904 using a version of gcc before 4.1.
5905 * configure: Rebuild.
5906
250acde3
CD
59072009-12-28 Chris Demetriou <cgd@google.com>
5908
5909 * attributes.cc (Output_attributes_section_data::do_write): Use
5910 std::vector::front rather than std::vector::data.
5911
99fff23b
ILT
59122009-12-28 Ian Lance Taylor <iant@google.com>
5913
5914 * symtab.h (class Symbol_table): Add enum Defined.
5915 * resolve.cc (Symbol_table::should_override): Add defined
5916 parameter. Change all callers. Test whether object is NULL
5917 before calling a method on it.
5918 (Symbol_table::report_resolve_problem): Add defined parameter.
5919 Change all callers.
5920 (Symbol_table::should_override_with_special): Likewise.
5921 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5922 parameter. Change all callers.
5923 (Symbol_table::do_define_in_output_data): Likewise.
5924 (Symbol_table::define_in_output_segment): Likewise.
5925 (Symbol_table::do_define_in_output_segment): Likewise.
5926 (Symbol_table::define_as_constant): Likewise.
5927 (Symbol_table::do_define_as_constant): Likewise.
5928 * script.h (class Symbol_assignment): Add is_defsym parameter to
5929 constructor; change all callers.
5930 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5931 parameter. Change all callers. Add is_defsym_ field.
5932 (class Parser_closure): Add parsing_defsym parameter to
5933 constructor; change all callers. Add parsing_defsym accessor
5934 function. Add parsing_defsym_ field.
5935
556bd683
ILT
59362009-12-28 Ian Lance Taylor <iant@google.com>
5937
5938 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 5939 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 5940
1782c879
ILT
59412009-12-23 Ian Lance Taylor <iant@google.com>
5942
5943 * i386.cc (Target_i386::do_calls_non_split): Recognize
5944 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
5945 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5946 -fsplit-stack prologue when using %r11.
1782c879 5947
329ca2b1
ST
59482009-12-21 Sriraman Tallam <tmsriram@google.com>
5949
5950 * options.cc (General_options::parse_version): Make -v continue and do
5951 the link like GNU ld does.
5952
d675ff46
RÁE
59532009-12-17 Rafael Avila de Espindola <espindola@google.com>
5954
5955 * Makefile.am (CCFILES): Add timer.cc.
5956 (HFILES): Add timer.h.
5957 * configure.ac: Check for sysconf and times.
5958 * main.cc: include timer.h.
5959 (main): Use Timer instead of get_run_time.
5960 * timer.cc: New.
5961 * timer.h: New.
5962 * workqueue.cc: include timer.h.
5963 (Workqueue::find_and_run_task):
5964 Report user, sys and wall time.
5965 * Makefile.in: Regenerate.
5966 * config.in: Regenerate.
5967 * configure: Regenerate.
5968
d6344fb5
DK
59692009-12-16 Doug Kwan <dougkwan@google.com>
5970
5971 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5972 sections.
5973 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5974 relaxed input sections.
5975 * output.cc (Output_section::find_relaxed_input_section): Change
5976 return type to Output_relaxed_input_section pointer. Adjust code
5977 for new type of relaxed_input_section_map_.
5978 * output.h (Output_section::find_relaxed_input_section): Change
5979 return type to Output_relaxed_input_section pointer.
5980 (Output_section::Output_relaxed_input_section_by_input_section_map):
5981 New type.
5982 (Output_section::relaxed_input_section_map_): Change type to
5983 Output_section::Output_relaxed_input_section_by_input_section_map.
5984 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5985 input section.
5986
0e0d5469
ILT
59872009-12-15 Ian Lance Taylor <iant@google.com>
5988
5989 * layout.cc (Layout::create_shstrtab): Only write out after input
5990 sections if we are compressing debug sections.
5991
0649a889
ILT
59922009-12-15 Ian Lance Taylor <iant@google.com>
5993
5994 * archive.cc (Archive::add_symbols): Only look up a symbol without
5995 a version if there is, in fact, a version.
5996
2ea97941
ILT
59972009-12-14 Ian Lance Taylor <iant@google.com>
5998
5999 Revert -Wshadow changes, all changes from:
6000 2009-12-11 Doug Kwan <dougkwan@google.com>
6001 2009-12-11 Nick Clifton <nickc@redhat.com>
6002 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
6003
b0eec2cc
DK
60042009-12-11 Doug Kwan <dougkwan@google.com>
6005
6006 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
6007 due to -Wshadow.
6008 * attributes.cc (Object_attribute::size): Ditto.
6009 (Attributes_section_data::size): Ditto.
6010 (Attributes_section_data::Attributes_section_data): Ditto.
6011 (Output_attributes_section_data::do_write): Ditto.
6012 * attributes.h (Object_attribute::set_type): Ditto.
6013 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
6014
91d6fa6a
NC
60152009-12-11 Nick Clifton <nickc@redhat.com>
6016
6017 * archive.cc: Fix shadowed variable warnings.
6018 * arm.cc: Likewise.
6019 * compressed_output.cc: Likewise.
6020 * compressed_output.h: Likewise.
6021 * configure: Likewise.
6022 * dwarf_reader.cc: Likewise.
6023 * dynobj.cc: Likewise.
6024 * dynobj.h: Likewise.
6025 * ehframe.cc: Likewise.
6026 * ehframe.h: Likewise.
6027 * errors.cc: Likewise.
6028 * expression.cc: Likewise.
6029 * fileread.cc: Likewise.
6030 * fileread.h: Likewise.
6031 * freebsd.h: Likewise.
6032 * i386.cc: Likewise.
6033 * icf.cc: Likewise.
6034 * incremental.h: Likewise.
6035 * layout.cc: Likewise.
6036 * layout.h: Likewise.
6037 * mapfile.cc: Likewise.
6038 * merge.cc: Likewise.
6039 * merge.h: Likewise.
6040 * object.cc: Likewise.
6041 * object.h: Likewise.
6042 * options.h: Likewise.
6043 * output.cc: Likewise.
6044 * output.h: Likewise.
6045 * parameters.cc: Likewise.
6046 * plugin.cc: Likewise.
6047 * powerpc.cc: Likewise.
6048 * reduced_debug_output.cc: Likewise.
6049 * reduced_debug_output.h: Likewise.
6050 * reloc.cc: Likewise.
6051 * reloc.h: Likewise.
6052 * resolve.cc: Likewise.
6053 * script-sections.cc: Likewise.
6054 * script.cc: Likewise.
6055 * script.h: Likewise.
6056 * sparc.cc: Likewise.
6057 * symtab.cc: Likewise.
6058 * symtab.h: Likewise.
6059 * target-select.cc: Likewise.
6060 * target-select.h: Likewise.
6061 * token.h: Likewise.
6062 * workqueue.cc: Likewise.
6063 * workqueue.h: Likewise.
6064 * x86_64.cc: Likewise.
6065
a0351a69
DK
60662009-12-10 Doug Kwan <dougkwan@google.com>
6067
6068 * arm.cc (attributes.h): New include.
6069 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
6070 (Arm_relobj::~Arm_relobj): Delete object pointed by
6071 attributes_section_data_.
6072 (Arm_relobj::attributes_section_data): New method definition.
6073 (Arm_relobj::attributes_section_data_): New data member declaration.
6074 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
6075 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
6076 attributes_section_data_.
6077 (Arm_dynobj::attributes_section_data): New method definition.
6078 (Arm_dynobj::attributes_section_data_): New data member declaration.
6079 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
6080 initialization value of may_use_blx_ to false.
6081 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
6082 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
6083 object attributes to compute results instead of hard-coding.
6084 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
6085 Target_arm::get_secondary_compatible_arch,
6086 Target_arm::set_secondary_compatible_arch
6087 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6088 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
6089 New method declarations.
6090 (Target_arm::get_aeabi_object_attribute): New method definition.
6091 (Target_arm::attributes_section_data_): New data member declaration.
6092 (read_arm_attributes_section): New template definition.
6093 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
6094 (Arm_dynobj::do_read_symbols): Ditto.
6095 (Target_arm::do_finalize_sections): Merge attributes sections from
6096 input. Check for BLX use after attributes section merging.
6097 Fix __exidx_start and __exidx_end visibility. Create an
6098 .ARM.attributes section if necessary.
6099 (Target_arm::get_secondary_compatible_arch,
6100 Target_arm::set_secondary_compatible_arch,
6101 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
6102 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 6103 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
6104 New method definitions.
6105
b59befec
ILT
61062009-12-09 Ian Lance Taylor <iant@google.com>
6107
6108 * plugin.cc (Plugin::load): Don't cast from void* to a function
6109 pointer.
6110
1276bc89
ILT
61112009-12-09 Ian Lance Taylor <iant@google.com>
6112
6113 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6114 information fields.
6115
2f2de248
L
61162009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6117
6118 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6119 Replace two_file_shared_1.so with two_file_shared_2.so.
6120 * testsuite/Makefile.in: Regenerated.
6121
4f787271
DK
61222009-12-08 Doug Kwan <dougkwan@google.com>
6123
6124 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6125 (HFILES): Add attributes.h and int_encoding.h.
6126 * Makefile.in: Regenerate.
6127 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6128 function definitions to int_encoding.cc
6129 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6130 prototypes to int_encoding.h
6131 * reduced_debug_output.cc (int_encoding.h): New include.
6132 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6133 function definitions to int_encoding.cc
6134 (insert_into_vector, read_from_pointer): Move template definitions to
6135 int_encoding.h
6136 * attributes.cc: New file.
6137 * attributes.h: New file.
6138 * int_encoding.cc: New file.
6139 * int_encoding.h: New file.
6140
20b52f1a
RÁE
61412009-12-07 Rafael Avila de Espindola <espindola@google.com>
6142
6143 PR gold/11055
6144 * incremental-dump.cc (dump_incremental_inputs): New.
6145 (main): Use dump_incremental_inputs.
6146
53d7974c
L
61472009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6148
6149 PR gold/10893
6150 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6151 checking elfcpp::STT_FUNC.
6152 (Target_i386::Relocate::relocate): Likewise.
6153 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6154
6155 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6156 symbols from shared libraries into normal FUNC symbols.
6157
6158 * symtab.h (Symbol): Add is_func and use it.
6159
05a352e6
DK
61602009-12-05 Doug Kwan <dougkwan@google.com>
6161
6162 * arm.cc (Target_arm::arm_info): Initialize new fields
6163 attributes_section and attributes_vendor.
6164 * i386.cc (Target_i386::i386_info): Same.
6165 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6166 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6167 fields attributes_section and attributes_vendor.
53d7974c 6168 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
6169 * target.h (Target::attributes_section, Target::attributes_vendor,
6170 Target::is_attributes_section, Target::attribute_arg_type,
6171 Target::attributes_order): New method definitions.
6172 (Target::Target_info::attributes_section,
6173 Target::Target_info::attributes_vendor): New fields.
6174 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6175 virtual method definitions.
6176 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6177 attributes_section and attributes_vendor.
6178 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6179
f4e5969c
DK
61802009-12-05 Doug Kwan <dougkwan@google.com>
6181
6182 * arm.cc: Update comments about interworking and stub generation.
6183 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6184 considered as non-PIC.
6185 (Arm_relocate_functions::base_abs): Fix formatting.
6186 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6187 of function to use GOT entry address instead of offset.
6188 (Target_arm::Scan::global): Issue an error if a symbol would need a
6189 PLT does not get one because it is untyped. Remove code to create
6190 dynamic symbols for relative branches.
6191 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6192 takes unsigned integer instead of boolean.
6193
1abce4a6
L
61942009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6195
6196 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6197 (two_file_test_LDADD): Likewise.
6198 (common_test_1_LDADD): Likewise.
6199 (exception_test_LDADD) Likewise.
6200 (weak_test_LDADD): Likewise.
6201 (many_sections_test_LDADD): Likewise.
6202 (initpri1_LDADD): Likewise.
6203 (script_test_1_LDADD): Likewise.
6204 (script_test_2_LDADD): Likewise.
6205 (justsyms_LDADD): Likewise.
6206 (binary_test_LDADD): Likewise.
6207 (large_LDADD): Likewise.
6208 * testsuite/Makefile.in: Regenerated.
6209
adcf2816 62102009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 6211
adcf2816
L
6212 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6213 (Symbol_table::override_with_special): Likewise.
6214 (Symbol_table::add_from_object): Likewise.
6215
28e67f5d
RÁE
62162009-12-04 Rafael Avila de Espindola <espindola@google.com>
6217
6218 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6219 Don't set the data_offset twice.
6220
ae10a101
RÁE
62212009-12-04 Rafael Avila de Espindola <espindola@google.com>
6222
6223 * testsuite/Makefile.in: Regenerate.
6224
f59f41f3
DK
62252009-12-03 Doug Kwan <dougkwan@google.com>
6226
6227 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6228 (Target_arm::do_finalize_sections): Add parameter for symbol table
6229 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6230 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6231 parameter for symbol table pointer.
6232 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6233 an additional parameter for a pointer to symbol table.
6234 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6235 parameter for a symbol table pointer.
6236 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6237 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6238 Ditto.
6239 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6240 parameter for a symbol table pointer.
6241
ca55d848
RÁE
62422009-12-03 Rafael Avila de Espindola <espindola@google.com>
6243
6244 * incremental.cc (Incremental_inputs_header)
6245 (Incremental_inputs_header_write, Incremental_inputs_entry)
6246 (Incremental_inputs_entry_write): Move ...
6247 * incremental.h (Incremental_inputs_header)
6248 (Incremental_inputs_header_write, Incremental_inputs_entry)
6249 (Incremental_inputs_entry_write): here.
6250
3aec4f9c
RÁE
62512009-12-02 Rafael Avila de Espindola <espindola@google.com>
6252
6253 * incremental.cc (make_sized_incremental_binary): Set the target.
6254 Error if it is incompatible.
6255 * output.h (Output_file): Add filename method.
6256
9c0ae74d
RÁE
62572009-12-02 Rafael Avila de Espindola <espindola@google.com>
6258
6259 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6260 from the get_* methods.
6261
a45500ae
RÁE
62622009-12-02 Rafael Avila de Espindola <espindola@google.com>
6263
6264 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6265 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6266 Write 0 for the data_offset of scripts.
6267
325e6408
RÁE
62682009-12-02 Rafael Avila de Espindola <espindola@google.com>
6269
6270 * testsuite/Makefile.am: Add the incremental_test.sh test.
6271 * testsuite/incremental_test.sh: New.
6272 * testsuite/incremental_test_1.c: New.
6273 * testsuite/incremental_test_2.c: New.
6274
954c3e2e
RÁE
62752009-12-01 Rafael Avila de Espindola <espindola@google.com>
6276
6277 * incremental-dump.cc (main): Fix typos.
6278
f8086623
RÁE
62792009-11-27 Rafael Avila de Espindola <espindola@google.com>
6280
6281 PR gold/11025
6282 * incremental-dump.cc (main): Use llu to print 64 bit values.
6283
3b0dd6ac
L
62842009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6285 H.J. Lu <hongjiu.lu@intel.com>
6286
6287 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6288 $(LIBDL).
6289 (incremental_dump_LDADD): Likewise.
6290 * Makefile.in: Regenerated.
6291
a6d1ef57 62922009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 6293
a6d1ef57
DK
6294 Revert:
6295
6296 2009-11-25 Doug Kwan <dougkwan@google.com>
6297
6298 * arm.cc (Target_arm::Target_arm): Move method definition
6299 outside of class definition. Add code to handle
6300 --target1-rel, --target1-abs and --target2= options.
6301 (Target_arm::get_reloc_reloc_type): Change method to be
6302 non-static and const.
6303 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6304 New data member declaration.
6305 (Target_arm::Scan::local, Target_arm::Scan::global,
6306 Target_arm::Relocate::relocate,
6307 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6308 Adjust call to Target_arm::get_real_reloc_type.
6309 (Target_arm::get_real_reloc_type): Use command line options
6310 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6311 * options.h (--target1-rel, --target1-abs, --target2): New
6312 ARM-only options.
6313
50aeb7d4
DK
63142009-11-25 Doug Kwan <dougkwan@google.com>
6315
6316 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6317 class definition. Add code to handle --target1-rel, --target1-abs
6318 and --target2= options.
6319 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6320 and const.
6321 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6322 member declaration.
6323 (Target_arm::Scan::local, Target_arm::Scan::global,
6324 Target_arm::Relocate::relocate,
6325 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6326 call to Target_arm::get_real_reloc_type.
6327 (Target_arm::get_real_reloc_type): Use command line options to
6328 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6329 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6330 options.
6331
51938283
DK
63322009-11-25 Doug Kwan <dougkwan@google.com>
6333
6334 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6335 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6336 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6337 formatting.
6338 (Arm_relocate_functions::thm_call): Replace body with a call to
6339 Arm_relocate_functions::thumb_branch_common.
6340 (Arm_relocate_functions::thm_jump24,
6341 Arm_relocate_functions::thm_xpc22): New method definitions.
6342 (Arm_relocate_functions::thumb_branch_common): New method definition.
6343 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6344 operator.
6345 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6346 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6347
e2b8f3c4
RÁE
63482009-11-24 Rafael Avila de Espindola <espindola@google.com>
6349
6350 * Makefile.am: Build incremental-dump
6351 * Makefile.in: Regenerate.
6352 * incremental-dump.cc: New.
6353 * incremental.cc (Incremental_inputs_header_data,
6354 Incremental_inputs_entry_data): Move to incremental.h
6355 * incremental.h: (Incremental_inputs_header_data,
6356 Incremental_inputs_entry_data): Move from incremental.cc
6357
bcba9aec
RÁE
63582009-11-24 Rafael Avila de Espindola <espindola@google.com>
6359
6360 * incremental.cc (Incremental_inputs_header,
6361 Incremental_inputs_header_write, Incremental_inputs_entry,
6362 Incremental_inputs_entry_write): Add a typedef with the data type.
6363
7c3afe08
RÁE
63642009-11-24 Rafael Avila de Espindola <espindola@google.com>
6365
6366 * incremental.cc (Incremental_inputs_header,
6367 Incremental_inputs_header_write, Incremental_inputs_entry,
6368 Incremental_inputs_entry_write): Update comment about which
6369 type has the filed descriptions.
6370
d204b6e9
DK
63712009-11-15 Doug Kwan <dougkwan@google.com>
6372
6373 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6374 (Arm_relocate_functions::arm_branch_common): Change method defintion
6375 in class definition to a method declaration and update list of formal
6376 parameters.
6377 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6378 Arm_relocation_functions::jump24): Adjust call to
6379 Arm_relocate_functions::arm_branch_common. Update list of formal
6380 parameters.
6381 (Arm_relocate_functions::xpc25): New method definition.
6382 (Arm_relocate_functions::arm_branch_common): Move method defintion
6383 out from class definition. Use stubs for mode-switching and extending
6384 branch ranges.
6385 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6386 specially. Change code to enable use of stubs in ARM branches.
6387
43d12afe
DK
63882009-11-10 Doug Kwan <dougkwan@google.com>
6389
6390 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6391 in method declaration.
6392 (Target_arm::relocate_stub): New method declaration.
6393 (Target_arm::default_target): Change to return a pointer instead of
6394 a const reference.
6395 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6396 Target_arm::default_target.
6397 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6398 method definition.
6399 (Target_arm::relocate_section): Adjust view.
6400 (Target_arm::relocate_stub): New method definition.
6401
ac33a407
DK
64022009-11-10 Doug Kwan <dougkwan@google.com>
6403
6404 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6405 a format warning.
6406 * incremental.cc (open_incremental_binary): Initialized local
6407 variables to avoid warnings.
6408 * object.cc (make_elf_object): Ditto.
6409 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6410 a format warning.
e1df38aa 6411
88ee28e9
L
6412009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6413
6414 PR gold/10930
6415 * testsuite/plugin_test.c: Include "config.h".
6416
2daedcd6
DK
64172009-11-09 Doug Kwan <dougkwan@google.com>
6418
6419 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6420 (arm_symbol_value): Remove.
6421 (Arm_relocate_functions::arm_branch_common,
6422 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6423 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6424 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6425 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6426 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6427 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6428 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6429 Arm_relocate_functions::thm_mobw_abs_nc,
6430 Arm_relocate_functions::thm_mov_abs,
6431 Arm_relocate_functions::movw_prel_nc,
6432 Arm_relocate_functions::thm_movt_abs,
6433 Arm_relocate_functions::movt_prel,
6434 Arm_relocate_functions::thm_movw_prel_nc,
6435 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6436 (Target_arm::Relocate::relocate): Only decompose address into two
6437 parts if relocation type uses the thumb-bit and pass the actual
6438 bit instead of a flag indicating that the thumb-bit is used. Adjust
6439 calls to methods in Arm_relocate_functions for this change.
6440
1276bc89 64412009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
6442
6443 PR 10925
6444 * reloc.cc: Instantiate
6445 Sized_relobj::initialize_input_to_output_maps and
6446 Sized_relobj:free_input_to_output_maps.
6447
e53ad1b5
ILT
64482009-11-06 Ian Lance Taylor <iant@google.com>
6449
6450 PR 10876
6451 * defstd.cc (in_segment): Set only_if_ref true for "end".
6452
eb44217c
DK
64532009-11-06 Doug Kwan <dougkwan@google.com>
6454
6455 * arm.cc (class Reloc_stub): Correct a comment.
6456 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6457 (Target_arm::scan_section_for_stubs): New method declaration.
6458 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6459 Change methods from private to protected.
6460 (Target_arm::do_may_relax): New method definition.
6461 (Target_arm::do_relax, Target_arm::group_sections,
6462 Target_arm::scan_reloc_for_stub,
6463 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6464 (Target_arm::arm_input_section_map_): New data member declaration.
6465 (Target_arm::scan_reloc_for_stub,
6466 Target_arm::scan_reloc_section_for_stubs,
6467 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6468 Target_arm::do_relax): New method definitions.
6469
5d329b7d
ILT
64702009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6471
6472 * configure.ac: Check for (struct stat)::st_mtim
6473 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6474 * config.in: Regenerate.
6475 * configure: Regenerate.
6476
96a0d71b
ILT
64772009-11-05 Ian Lance Taylor <iant@google.com>
6478
6479 PR 10910
6480 * output.cc (Output_segment::add_output_section): Add missing
6481 return statement.
6482
594c8e5e
ILT
64832009-11-04 Ian Lance Taylor <iant@google.com>
6484
6485 PR 10880
6486 * object.h (class Object): Add is_needed and set_is_needed
6487 methods. Add is_needed_ field. Make bool fields into bitfields.
6488 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6489 defined in a dynamic object and referenced by a regular object,
6490 set is_needed for the dynamic object.
6491 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6492 if the file is marked with as_needed and it is not needed.
6493
22b127cc
ILT
64942009-11-04 Ian Lance Taylor <iant@google.com>
6495
6496 PR 10887
6497 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6498 tags if data is discarded by linker script.
6499 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6500 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6501 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6502 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6503
f5c870d2
ILT
65042009-11-04 Ian Lance Taylor <iant@google.com>
6505
6506 * layout.cc (Layout::get_output_section): Add is_interp and
6507 is_dynamic_linker_section parameters. Change all callers.
6508 (Layout::choose_output_section): Likewise.
6509 (Layout::make_output_section): Likewise.
6510 (Layout::add_output_section_data): Add is_dynamic_linker_section
6511 parameter. Change all callers.
6512 * layout.h (class Layout): Update declarations.
6513 * output.h (class Output_section): Add is_interp, set_is_interp,
6514 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6515 Add is_interp_, is_dynamic_linker_section_ fields. Change
6516 generate_code_fills_at_write_ to a bitfield.
6517 * output.cc (Output_section::Output_sections): Initialize new
6518 fields.
6519 (Output_segment::add_output_section): Add do_sort parameter.
6520 Change all callers.
6521
1ae4d23b
ILT
65222009-11-03 Ian Lance Taylor <iant@google.com>
6523
6524 PR 10860
6525 * options.h (class General_options): Add --warn-common.
6526 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6527 merging two common symbols.
6528 (Symbol_table::should_override): Handle --warn-common when merging
6529 a common symbol with a defined symbol. Use report_resolve_problem
6530 for multiple definitions.
6531 (Symbol_table::report_resolve_problem): New function.
6532 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6533
55da9579
DK
65342009-11-03 Doug Kwan <dougkwan@google.com>
6535
6536 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6537 stub_factory_.
6538 (Target_arm::stub_factory): New method definition.
6539 (Target_arm::new_arm_input_section,
6540 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6541 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 6542 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
6543 New type definitions.
6544 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6545 member declarations.
6546 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6547 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6548 New method definitions.
6549
37a9ac43
ILT
65502009-11-03 Ian Lance Taylor <iant@google.com>
6551
6552 * options.h (class General_options): Add --warn_constructors.
6553
b3d6a3d4
ILT
65542009-11-03 Ian Lance Taylor <iant@google.com>
6555
6556 PR 10893
6557 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6558 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6559
934b01dd
ILT
65602009-11-03 Ian Lance Taylor <iant@google.com>
6561
6562 PR 10895
6563 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6564 --msgid-bugs-address.
6565 (install-pdf): New target.
6566 (install-data_yes): Look up one directory to find mkinstalldirs.
6567
03c1939b
L
65682009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6569
6570 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6571 tree.
6572
ebd95253
DK
65732009-10-30 Doug Kwan <dougkwan@google.com>
6574
6575 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6576
e9bbb538
DK
65772009-10-30 Doug Kwan <dougkwan@google.com>
6578
6579 * arm.cc (Stub_addend_reader): New struct template definition
6580 and partial specializations.
6581 (Stub_addend_reader::operator()): New method definition for a
6582 partially specialized template.
6583
d5b40221
DK
65842009-10-30 Doug Kwan <dougkwan@google.com>
6585
6586 * arm.cc (Arm_relobj::processor_specific_flags): New method
6587 definition.
6588 (Arm_relobj::do_read_symbols): New method declaration.
6589 (Arm_relobj::processor_specific_flags_): New data member declaration.
6590 (Arm_dynobj): New class definition.
6591 (Target_arm::do_finalize_sections): Add input_objects parameter.
6592 (Target_arm::do_adjust_elf_header): New method declaration.
6593 (Target_arm::are_eabi_versions_compatible,
6594 (Target_arm::merge_processor_specific_flags): New method declaration.
6595 (Target_arm::do_make_elf_object): New overloaded method definitions
6596 and declaration.
6597 (Arm_relobj::do_read_symbols): New method definition.
6598 (Arm_dynobj::do_read_symbols): Ditto.
6599 (Target_arm::do_finalize_sections): Add input_objects parameters.
6600 Merge processor-specific flags from all input objects.
6601 (Target_arm::are_eabi_versions_compatible,
6602 Target_arm::merge_processor_specific_flags,
6603 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6604 New method definitions.
6605 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6606 Input_objects pointer type parameter.
6607 * layout.cc (Layout::finalize): Pass input objects to target's.
6608 finalize_sections function.
6609 * output.cc (Output_file_header::do_sized_write): Set ELF file
6610 header's processor-specific flags.
6611 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6612 Input_objects pointer type parameter.
6613 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6614 * target.h (Input_objects): New forward class declaration.
6615 (Target::processor_specific_flags,
6616 Target::are_processor_specific_flags_sect): New method definitions.
6617 (Target::finalize_sections): Add input_objects parameter.
6618 (Target::Target): Initialize processor_specific_flags_ and
6619 are_processor_specific_flags_set_.
6620 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6621 parameter.
6622 (Target::set_processor_specific_flags): New method definition.
6623 (Target::processor_specific_flags_,
6624 Target::are_processor_specific_flags_set_): New data member
6625 declarations.
6626 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6627 Input_objects pointer type parameter.
6628
ebabffbd
DK
66292009-10-30 Doug Kwan <dougkwan@google.com>
6630
6631 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6632
ad0f2072
ILT
66332009-10-28 Ian Lance Taylor <iant@google.com>
6634
6635 * object.h (class Relobj): Drop options parameter from
6636 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6637 do_scan_relocs, do_relocate. Change all callers.
6638 (class Sized_relobj): Drop options parameters from
6639 do_gc_process_relocs, do_scan_relocs, do_relocate,
6640 do_relocate_sections, relocate_sections, emit_relocs_scan,
6641 emit_relocs_scan_reltype. Change all callers.
6642 (struct Relocate_info): Remove options field and all references to
6643 it.
6644 * reloc.h (class Read_relocs): Remove options constructor
6645 parameter and options_ field. Change all callers.
6646 (class Gc_process_relocs, class Scan_relocs): Likewise.
6647 (class Relocate_task): Likewise.
6648 * target-reloc.h (scan_relocs): Remove options parameter. Change
6649 all callers.
6650 (scan_relocatable_relocs): Likewise.
6651 * target.h (class Sized_target): Remove options parameter from
6652 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6653 all callers.
6654 * gc.h (gc_process_relocs): Remove options parameter. Change all
6655 callers.
6656 * arm.cc: Update functions to remove options parameters.
6657 * i386.cc: Likewise.
6658 * powerpc.cc: Likewise.
6659 * sparc.cc: Likewise.
6660 * x86_64.cc: Likewise.
6661 * testsuite/testfile.cc: Likewise.
6662
8ffa3667
DK
66632009-10-28 Doug Kwan <dougkwan@google.com>
6664
6665 * arm.cc (Arm_relobj): New class definition.
e1df38aa 6666 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
6667 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6668 New method definitions.
6669
40f36857
CC
66702009-10-28 Cary Coutant <ccoutant@google.com>
6671
6672 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6673 (Plugin::cleanup_done_): New member.
6674 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6675 (Plugin_manager::cleanup_done_): Remove.
6676 (Plugin_manager::add_input_file): Edit error message.
6677 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6678 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6679
2c849493
ILT
66802009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6681
6682 * fileread.cc: (File_read::View::~View): Use the new
6683 data_ownership_ filed.
6684 (File_read::~File_read): Dispose the new whole_file_view_.
6685 (File_read::open): Mmap the whole file if needed.
6686 (File_read::open): Use whole_file_view_ instead of contents_.
6687 (File_read::find_view): Use whole_file_view_ if applicable.
6688 (File_read::do_read): Use whole_file_view_ instead of contents_.
6689 (File_read::make_view): Use whole_file_view_ instead of contents_,
6690 update File_read::View::View call.
6691 (File_read::find_or_make_view): Update File_read::View::View
6692 call.
6693 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6694 remove contents_
6695 (File_read::View::Data_ownership): New enum.
6696 (File_read::View::View): Replace bool mapped_ with Data_ownership
6697 argument.
6698 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6699 (File_read::View::data_ownership_): New field.
6700 (File_read::contents_): Remove (replaced by whole_file_view_).
6701 (File_read::whole_file_view_): New field.
6702 * options.h (class General_options): Add --keep-files-mapped.
6703
24998053
CC
67042009-10-27 Cary Coutant <ccoutant@google.com>
6705
6706 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6707 * testsuite/Makefile.am (plugin_test_5): New test case.
6708 * testsuite/Makefile.in: Regenerate.
6709
72adc4fa
DK
67102009-10-25 Doug Kwan <dougkwan@google.com>
6711
6712 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6713 from private to protected to allow access by child class.
6714 (Sized_relobj::do_relocate_sections): New method declaration.
6715 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 6716 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
6717 Sized_relobj::relocate_sections. Instantiate template explicitly
6718 for different target sizes and endianity.
6719
07f508a2
DK
67202009-10-24 Doug Kwan <dougkwan@google.com>
6721
6722 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6723 (Arm_input_section::as_arm_input_section): New method.
6724 (Arm_output_section): New class definition.
6725 (Arm_output_section::create_stub_group,
6726 Arm_output_section::group_sections): New method definitions.
6727
10ad9fe5
DK
67282009-10-22 Doug Kwan <dougkwan@google.com>
6729
6730 * arm.cc (Arm_input_section): New class definition.
6731 (Arm_input_section::init, Arm_input_section:do_write,
6732 Arm_input_section::set_final_data_size,
6733 Arm_input_section::do_reset_address_and_file_offset): New method
6734 definitions.
6735
56ee5e00
DK
67362009-10-21 Doug Kwan <dougkwan@google.com>
6737
6738 * arm.cc (Stub_table, Arm_input_section): New forward class
6739 declarations.
6740 (Stub_table): New class defintion.
6741 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6742 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6743 New method definition.
6744
b569affa
DK
67452009-10-21 Doug Kwan <dougkwan@google.com>
6746
6747 * arm.cc: Update copyright comments.
6748 (Target_arm): New forward class template declaration.
6749 (Arm_address): New type.
6750 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6751 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6752 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6753 constants.
6754 (Insn_template): Same.
6755 (DEF_STUBS): New macro.
6756 (Stub_type): New enum type.
6757 (Stub_template): New class definition.
6758 (Stub): Same.
6759 (Reloc_stub): Same.
6760 (Stub_factory): Same.
6761 (Target_arm::Target_arm): Initialize may_use_blx_ and
6762 should_force_pic_veneer_.
6763 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6764 Target_arm::should_force_pic_veneer,
6765 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6766 Target_arm::using_thumb_only, Target_arm:;default_target): New
6767 method defintions.
6768 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6769 New data member declarations.
6770 (Insn_template::size, Insn_template::alignment): New method defintions.
6771 (Stub_template::Stub_template): New method definition.
6772 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6773 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6774 (Stub_factory::Stub_factory): New method definition.
6775 * gold.h (string_hash): New template.
6776 * output.h (Input_section_specifier::hash_value): Use
6777 gold::string_hash.
6778 (Input_section_specifier::string_hash): Remove.
6779 * stringpool.cc (Stringpool_template::string_hash): Use
6780 gold::string_hash.
6781
6c172549
DK
67822009-10-20 Doug Kwan <dougkwan@google.com>
6783
6784 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6785 symbols of relaxed input sections.
6786 * output.h (Output_section::find_relaxed_input_section): Make
6787 method public.
6788
c5617f2f
DK
67892009-10-16 Doug Kwan <dougkwan@google.com>
6790
6791 * dynobj.cc (Versions::Versions): Initialize version_script_.
6792 Only insert base version symbol definition for a shared object
6793 if version script defines any version versions.
6794 (Versions::define_base_version): New method definition.
6795 (Versions::add_def): Check that base version is not needed.
6796 (Versions::add_need): Define base version lazily.
6797 * dynobj.h (Versions::define_base_version): New method declaration.
6798 (Versions::needs_base_version_): New data member declaration.
6799 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6800 (check_DATA): Add no_version_test.stdout.
6801 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6802 New make rules.
6803 * testsuite/Makefile.in: Regenerate.
6804 * testsuite/no_version_test.c: New file.
6805 * testsuite/no_version_test.sh: Ditto.
6806
3c12dcdb
DK
68072009-10-16 Doug Kwan <dougkwan@google.com>
6808
6809 * expression.cc (class Segment_start_expression): New class definition.
6810 (Segment_start_expression::value): New method definition.
6811 (script_exp_function_segment_start): Return a new
6812 Segment_start_expression.
6813 * gold/script-c.h (script_saw_segment_start_expression): New function
6814 prototype.
6815 * script-sections.cc (Script_sections::Script_sections): Initialize
6816 SAW_SEGMENT_START_EXPRESSION_ to false.
6817 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6818 and -Tbbs options to specify section addresses if given in
6819 command line and no SEGMENT_START expression is seen in a script.
6820 * script-sections.h (Script_sections::saw_segment_start_expression,
6821 Script_sections::set_saw_segment_start_expression): New method
6822 definition.
6823 (Script_sections::saw_segment_start_expression_): New data member
6824 declaration.
6825 * script.cc (script_saw_segment_start_expression): New function.
6826 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6827 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6828 script_test_7.sh and script_test_8.sh.
6829 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6830 script_test_8.stdout.
6831 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6832 (script_test_6, script_test_6.stdout, script_test_7,
6833 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6834 * Makefile.in: Regenerate.
6835 * testsuite/script_test_6.sh: New file.
6836 * testsuite/script_test_6.t: Same.
6837 * testsuite/script_test_7.sh: Same.
6838 * testsuite/script_test_7.t: Same.
6839 * testsuite/script_test_8.sh: Same.
6840
64b1ae37
DK
68412009-10-16 Doug Kwan <dougkwan@google.com>
6842
6843 * output.cc (Output_segment::set_section_list_address): Cast
6844 expressions to unsigned long long type to avoid format warnings.
6845
661be1e2
ILT
68462009-10-15 Ian Lance Taylor <iant@google.com>
6847
12edd763 6848 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 6849 dot assignment to script_sections_.
12edd763
ILT
6850 * script-sections.cc (Script_sections::add_dot_assignment):
6851 Initialize if necessary.
6852
68b6574b
ILT
6853 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6854 program headers with no load segment if there is a linker script.
6855
661be1e2
ILT
6856 * layout.cc (Layout::set_segment_offsets): Align the file offset
6857 to the segment aligment for -N or -n with no load segment.
6858 * output.cc (Output_segment::add_output_section): Don't crash if
6859 the first section is a TLS section.
6860 (Output_segment::set_section_list_addresses): Print an error
6861 message if the address moves backward in a linker script.
6862 * script-sections.cc
6863 (Output_section_element_input::set_section_addresses): Don't
6864 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6865 (Orphan_output_section::set_section_addresses): Likewise.
6866
f15f61a7
DK
68672009-10-15 Doug Kwan <dougkwan@google.com>
6868
6869 * layout.cc (Layout::finish_dynamic_section): Generate tags
6870 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6871 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6872 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6873
82bb573a
ILT
68742009-10-14 Ian Lance Taylor <iant@google.com>
6875
6876 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6877 fields.
6878 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6879 data_shdr fields of relinfo.
6880 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6881 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6882 R_386_TLS_LDO_32, adjust based on section flags.
6883 (Target_i386::Relocate::fix_up_ldo): Remove.
6884
374ad285
ILT
68852009-10-13 Ian Lance Taylor <iant@google.com>
6886
6887 Add support for -pie.
6888 * options.h (class General_options): Add -pie and
6889 --pic-executable.
6890 (General_options::output_is_position_independent): Test -pie.
6891 (General_options::output_is_executable): Return true if not shared
6892 and not relocatable.
6893 (General_options::output_is_pie): Remove.
6894 * options.cc (General_options::finalize): Reject incompatible uses
6895 of -pie.
6896 * gold.cc (queue_middle_tasks): A -pie link is not static.
6897 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6898 * symtab.cc (Symbol::final_value_is_known): Return false if
6899 output_is_position_independent.
6900 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6901 output_is_position_independent.
6902 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6903 output_is_position_independent.
6904 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6905 output_is_position_independent.
6906 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6907 two_file_pie_test.
6908 (basic_pie_test.o, basic_pie_test): New targets.
6909 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6910 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6911 (two_file_pie_test): New target.
6912 * testsuite/Makefile.in: Rebuild.
6913 * README: Remove note saying that -pie is not supported.
6914
c6585162
ILT
69152009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6916
6917 * options.h (class General_options): Add -init and -fini.
6918 * layout.cc (Layout::finish_dynamic_section): Emit
6919 given init and fini functions.
6920
032ce4e9
ST
69212009-10-13 Sriraman Tallam <tmsriram@google.com>
6922
6923 * gc.h (gc_process_relocs): Check if icf is enabled using new
6924 function.
6925 * gold.cc (queue_initial_tasks): Likewise.
6926 (queue_middle_tasks): Likewise.
6927 * object.cc (do_layout): Likewise.
6928 * symtab.cc (is_section_folded): Likewise.
6929 * main.cc (main): Likewise.
6930 * reloc.cc (Read_relocs::run): Likewise.
6931 (Sized_relobj::do_scan_relocs): Likewise.
6932 * icf.cc (is_function_ctor_or_dtor): New function.
6933 (Icf::find_identical_sections): Check if function is ctor or dtor when
6934 safe icf is chosen.
6935 * options.h (General_options::icf): Change option to be an enum.
6936 (Icf_status): New enum.
6937 (icf_enabled): New method.
6938 (icf_safe_folding): New method.
6939 (set_icf_status): New method.
6940 (icf_status_): New variable.
6941 * (options.cc) (General_options::finalize): Set icf_status_.
6942 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6943 icf_test and icf_keep_unique_test to use the --icf enum flag.
6944 * testsuite/icf_safe_test.sh: New file.
e1df38aa 6945 * testsuite/icf_safe_test.cc: New file.
032ce4e9 6946
f345227a
ST
69472009-10-12 Sriraman Tallam <tmsriram@google.com>
6948
6949 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6950 includes to gc.h and icf.h.
6951 * arm.cc: Include gc.h.
6952 * gold.cc: Likewise.
6953 * i386.cc: Likewise.
6954 * powerpc.cc: Likewise.
6955 * sparc.cc: Likewise.
6956 * x86_64.cc: Likewise.
6957 * gc.h: Include icf.h.
6958
1c7814ed
ILT
69592009-10-11 Ian Lance Taylor <iant@google.com>
6960
6961 * plugin.cc: Include "gold.h" before other header files.
6962
ae3b5189
CD
69632009-10-10 Chris Demetriou <cgd@google.com>
6964
6965 * options.h (Input_file_argument::Input_file_type): New enum.
6966 (Input_file_argument::is_lib_): Replace with...
6967 (Input_file_argument::type_): New member.
6968 (Input_file_argument::Input_file_argument): Take Input_file_type
6969 'type' rather than boolean 'is_lib' as second argument.
6970 (Input_file_argument::is_lib): Use type_.
6971 (Input_file_argument::is_searched_file): New function.
6972 (Input_file_argument::may_need_search): Handle is_searched_file.
6973 * options.cc (General_options::parse_library): Support -l:filename.
6974 (General_options::parse_just_symbols): Update for Input_file_argument
6975 changes.
6976 (Command_line::process): Likewise.
6977 * archive.cc (Archive::get_file_and_offset): Likewise.
6978 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6979 * script.cc (read_script_file, script_add_file): Likewise.
6980 * fileread.cc (Input_file::Input_file): Likewise.
6981 (Input_file::will_search_for): Handle is_searched_file.
6982 (Input_file::open): Likewise.
6983 * readsyms.cc (Read_symbols::get_name): Likewise.
6984 * testsuite/Makefile.am (searched_file_test): New test.
6985 * testsuite/Makefile.in: Regenerate.
6986 * testsuite/searched_file_test.cc: New file.
6987 * testsuite/searched_file_test_lib.cc: New file.
6988
f3048a1d
ILT
69892009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6990 Ian Lance Taylor <iant@google.com>
6991
6992 * descriptor.cc: Include <cstdio> and "binary-io.h".
6993 (Descriptors::open): Open the files in binary mode always.
6994 * script.cc (Lex::get_token): Treat \r as whitespace.
6995
d4780e57
ILT
69962009-10-09 Ian Lance Taylor <iant@google.com>
6997
6998 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6999
d9a893b8
ILT
70002009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7001 Ian Lance Taylor <iant@google.com>
7002
7003 * configure.ac: Check for readv function also.
7004 * fileread.cc (readv): Define if not HAVE_READV.
7005 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
7006 does not exist.
7007 * config.in: Regenerate.
7008 * configure: Regenerate.
7009
c0a62865
DK
70102009-10-09 Doug Kwan <dougkwan@google.com>
7011
7012 * layout.cc (Layout::make_output_section): Call target hook to make
7013 ordinary output section.
7014 (Layout::finalize): Adjust parameter list of call the
7015 Target::may_relax().
7016 * layout.h (class Layout::section_list): New method.
7017 * merge.h (Output_merge_base::entsize): Change visibility to public.
7018 (Output_merge_base::is_string, Output_merge_base::do_is_string):
7019 New methods.
7020 (Output_merge_string::do_is_string): New method.
7021 * object.cc (Sized_relobj::do_setup): renamed from
7022 Sized_relobj::set_up.
7023 * object.h (Sized_relobj::adjust_shndx,
7024 Sized_relobj::initializ_input_to_output_maps,
7025 Sized_relobj::free_input_to_output_maps): Change visibilities to
7026 protected.
7027 (Sized_relobj::setup): Virtualize.
7028 (Sized_relobj::do_setup): New method declaration.
7029 (Sized_relobj::invalidate_section_offset,
7030 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
7031 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
7032 * options.cc (parse_int): New function.
7033 * options.h (parse_int): New declaration.
7034 (DEFINE_int): New macro.
7035 (stub_group_size): New option.
7036 * output.cc (Output_section::Output_section): Initialize memebers
7037 merge_section_map_, merge_section_by_properties_map_,
7038 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
7039 (Output_section::add_input_section): Handled deferred code-fill
7040 generation and remove an old comment.
7041 (Output_section::add_relaxed_input_section): New method definition.
7042 (Output_section::add_merge_input_section): Use merge section by
7043 properties map to speed to search. Update merge section maps
7044 as appropriate.
7045 (Output_section::build_relaxation_map): New method definition.
7046 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7047 Same.
7048 (Output_section::relax_input_section): Renamed to
7049 Output_section::convert_input_sections_to_relaxed_sections and change
7050 interface to take a vector of pointers to relaxed sections.
7051 (Output_section::find_merge_section,
7052 Output_section::find_relaxed_input_section): New method definitions.
7053 (Output_section::is_input_address_mapped,
7054 Output_section::output_offset, Output_section::output_address):
7055 Use output section data maps to speed up searching.
7056 (Output_section::find_starting_output_address): Add comments.
7057 (Output_section::do_write,
7058 Output_section::write_to_postprocessing_buffer): Do code-fill
7059 generation as appropriate.
7060 (Output_section::get_input_sections): Invalidate relaxed input section
7061 map.
7062 (Output_section::restore_states): Adjust type of checkpoint .
7063 Invalidate relaxed input section map.
7064 * output.h (Output_merge_base): New class declaration.
7065 (Input_section_specifier): New class defintion.
7066 (class Output_relaxed_input_section) Change base class to
7067 Output_section_data_build.
7068 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
7069 base class initializer.
7070 (Output_section::add_relaxed_input_section): New method declaration.
7071 (Output_section::Input_section): Change visibility to protected.
7072 (Output_section::Input_section::relobj,
7073 Output_section::Input_section::shndx): Handle relaxed input sections.
7074 Output_section::input_sections) Change visibility to protected. Also
7075 define overload to return a non-const pointer.
7076 (Output_section::Merge_section_properties): New class defintion.
7077 (Output_section::Merge_section_by_properties_map,
7078 Output_section::Output_section_data_by_input_section_map,
7079 Output_section::Relaxation_map): New types.
7080 (Output_section::relax_input_section): Rename method to
7081 Output_section::convert_input_sections_to_relaxed_sections and change
7082 interface to take a vector of relaxed section pointers.
7083 (Output_section::find_merge_section,
7084 Output_section::find_relaxed_input_section,
7085 Output_section::build_relaxation_map,
7086 Output_section::convert_input_sections_in_list_to_relaxed_sections):
7087 New method declarations.
7088 (Output_section::merge_section_map_
7089 Output_section::merge_section_by_properties_map_,
7090 Output_section::relaxed_input_section_map_,
7091 Output_section::is_relaxed_input_section_map_valid_,
7092 Output_section::generate_code_fills_at_write_): New data members.
7093 * script-sections.cc
7094 (Output_section_element_input::set_section_addresses): Call
7095 current_data_size and addralign methods of relaxed input sections.
7096 (Orphan_output_section::set_section_addresses): Call current_data_size
7097 and addralign methods of relaxed input sections.
7098 * symtab.cc (Symbol_table::compute_final_value): Extract template
7099 from the body of Symbol_table::sized_finalize_symbol.
7100 (Symbol_table::sized_finalized_symbol): Call
7101 Symbol_table::compute_final_value.
7102 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
7103 (Symbol_table::compute_final_value): New templated method declaration.
7104 * target.cc (Target::do_make_output_section): New method defintion.
7105 * target.h (Target::make_output_section): New method declaration.
7106 (Target::relax): Add more parameters for input objects, symbol table
7107 and layout. Adjust call to do_relax.
7108 (Target::do_make_output_section): New method declaration.
7109 (Target::do_relax): Add parameters for input objects, symbol table
7110 and layout.
7111
d446d6c4
ILT
71122009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7113
7114 * pread.c: Include stdio.h.
7115
bc06c745
ILT
71162009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7117
7118 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7119 defined.
7120
75aea3d0
ILT
71212009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7122
7123 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7124 Change read_shndx type to unsigned int.
7125 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7126 int.
7127 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7128 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7129 Change read_shndx type to unsigned int.
7130 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7131 int.
7132 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7133 * layout.cc (Layout::create_symtab_sections): Cast the result of
7134 local_symcount * symsize to off_t in the gold_assert.
7135
be8fcb75
ILT
71362009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7137
7138 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7139 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7140 R_ARM_BASE_ABS.
7141 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7142 (Arm_relocate_functions::thm_abs5): New function.
7143 (Arm_relocate_functions::abs12): New function.
7144 (Arm_relocate_functions::abs16): New function.
7145 (Arm_relocate_functions::base_abs): New function.
7146 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7147 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7148 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7149 R_ARM_BASE_ABS.
7150 (Scan::global): Likewise.
7151 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7152 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7153 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7154 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7155 R_ARM_BASE_ABS.
7156
c2a122b6
ILT
71572009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7158
7159 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7160 (Arm_relocate_functions::movt_prel): New function.
7161 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7162 (Arm_relocate_functions::thm_movt_prel): New function.
7163 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7164 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7165 (Scan::global, Relocate::relocate): Likewise.
7166 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7167
c4aa1e2d
ILT
71682009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7169
7170 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7171 Incremental_checker.
7172 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7173 unsigned int.
7174 (class Incremental_inputs_header): New class.
7175 (Incremental_inputs_header_writer): Edit comment.
7176 (Incremental_inputs_entry): New class.
7177 (Incremental_inputs_entry_writer): Edit comment.
7178 (Sized_incremental_binary::do_find_incremental_inputs_section):
7179 Add *strtab_shndx parameter, fill it.
7180 (Sized_incremental_binary::do_check_inputs): New method.
7181 (Incremental_checker::can_incrementally_link_output_file): Use
7182 Sized_incremental_binary::check_inputs.
7183 (Incremental_inputs::report_command_line): Save command line in
7184 command_line_.
7185 * incremental.h:
7186 (Incremental_binary::find_incremental_inputs_section): New
7187 method.
7188 (Incremental_binary::do_find_incremental_inputs_section): Add
7189 strtab_shndx parameter.
7190 (Incremental_binary::do_check_inputs): New pure virtual method.
7191 (Sized_incremental_binary::do_check_inputs): Declare.
7192 (Incremental_checker::Incremental_checker): Add incremental_inputs
7193 parameter, use it to initialize incremental_inputs_.
7194 (Incremental_checker::incremental_inputs_): New field.
7195 (Incremental_checker::command_line): New method.
7196 (Incremental_checker::inputs): New method.
7197 (Incremental_checker::command_line_): New field.
7198
c549a694
ILT
71992009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7200
7201 * incremental.cc: Include <cstdarg> and "target-select.h".
7202 (vexplain_no_incremental): New function.
7203 (explain_no_incremental): New function.
7204 (Incremental_binary::error): New method.
7205 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7206 method.
7207 (make_sized_incremental_binary): New function.
7208 (open_incremental_binary): New function.
7209 (can_incrementally_link_file): Add checks if output is ELF and has
7210 inputs section.
7211 * incremental.h: Include "elfcpp_file.h" and "output.h".
7212 (Incremental_binary): New class.
7213 (Sized_incremental_binary): New class.
7214 (open_incremental_binary): Declare.
7215 * object.cc (is_elf_object): Use
7216 elfcpp::Elf_recognizer::is_elf_file.
7217 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7218 * output.h (Output_file::filesize): New method.
7219
fd3c5f0b
ILT
72202009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7221
7222 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7223 New function.
7224 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7225 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7226 function.
7227 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7228 function.
7229 (Arm_relocate_functions::movw_abs_nc): New function.
7230 (Arm_relocate_functions::movt_abs): New function.
7231 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7232 (Arm_relocate_functions::thm_movt_abs): New function.
7233 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7234 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7235 (Scan::global): Likewise.
7236 (Relocate::relocate): Likewise.
7237 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7238
7f5309a5
ILT
72392009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7240
7241 * arm.cc (Arm_relocate_functions::got_prel) New function.
7242 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7243 (Relocate::relocate): Likewise.
7244 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7245
364c7fa5
ILT
72462009-10-06 Ian Lance Taylor <iant@google.com>
7247
7248 * options.h (class General_options): Define
7249 split_stack_adjust_size parameter.
7250 * object.h (class Object): Add uses_split_stack_ and
7251 has_no_split_stack_ fields. Add uses_split_stack and
7252 has_no_split_stack accessor functions. Declare
7253 handle_split_stack_section.
7254 (class Reloc_symbol_changes): Define.
7255 (class Sized_relobj): Define Function_offsets. Declare
7256 split_stack_adjust, split_stack_adjust_reltype, and
7257 find_functions.
7258 * object.cc (Object::handle_split_stack_section): New function.
7259 (Sized_relobj::do_layout): Call handle_split_stack_section.
7260 * dynobj.cc (Sized_dynobj::do_layout): Call
7261 handle_split_stack_section.
7262 * reloc.cc (Sized_relobj::relocate_sections): Call
7263 split_stack_adjust for executable sections in split_stack
7264 objects. Pass reloc_map to relocate_section.
7265 (Sized_relobj::split_stack_adjust): New function.
7266 (Sized_relobj::split_stack_adjust_reltype): New function.
7267 (Sized_relobj::find_functions): New function.
7268 * target-reloc.h: Include "object.h".
7269 (relocate_section): Add reloc_symbol_changes parameter. Change
7270 all callers.
7271 * target.h (class Target): Add calls_non_split method. Declare
7272 do_calls_non_split virtual method. Declare match_view and
7273 set_view_to_nop.
7274 * target.cc: Include "elfcpp.h".
7275 (Target::do_calls_non_split): New function.
7276 (Target::match_view): New function.
7277 (Target::set_view_to_nop): New function.
7278 * gold.cc (queue_middle_tasks): Give an error if mixing
7279 split-stack and non-split-stack objects with -r.
7280 * i386.cc (Target_i386::relocate_section): Add
7281 reloc_symbol_changes parameter.
7282 (Target_i386::do_calls_non_split): New function.
7283 * x86_64.cc (Target_x86_64::relocate_section): Add
7284 reloc_symbol_changes parameter.
7285 (Target_x86_64::do_calls_non_split): New function.
7286 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7287 parameter.
7288 * powerpc.cc (Target_powerpc::relocate_section): Add
7289 reloc_symbol_changes parameter.
7290 * sparc.cc (Target_sparc::relocate_section): Add
7291 reloc_symbol_changes parameter.
7292 * configure.ac: Call AM_CONDITIONAL for the default target.
7293 * configure: Rebuild.
7294 * testsuite/Makefile.am (TEST_AS): New variable.
7295 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7296 (check_DATA): Add split_i386 and split_x86_64 files.
7297 (SPLIT_DEFSYMS): Define.
7298 (split_i386_[1234n].o): New targets.
7299 (split_i386_[124]): New targets.
7300 (split_i386_[1234r].stdout): New targets.
7301 (split_x86_64_[1234n].o): New targets.
7302 (split_x86_64_[124]): New targets.
7303 (split_x86_64_[1234r].stdout): New targets.
7304 (MOSTLYCLEANFILES): Add new executables.
7305 * testsuite/split_i386.sh: New file.
7306 * testsuite/split_x86_64.sh: New file.
7307 * testsuite/split_i386_1.s: New file.
7308 * testsuite/split_i386_2.s: New file.
7309 * testsuite/split_i386_3.s: New file.
7310 * testsuite/split_i386_4.s: New file.
7311 * testsuite/split_i386_n.s: New file.
7312 * testsuite/split_x86_64_1.s: New file.
7313 * testsuite/split_x86_64_2.s: New file.
7314 * testsuite/split_x86_64_3.s: New file.
7315 * testsuite/split_x86_64_4.s: New file.
7316 * testsuite/split_x86_64_n.s: New file.
7317 * testsuite/testfile.cc (Target_test): Update relocation_section
7318 function.
7319 * testsuite/Makefile.in: Rebuild.
7320
e8a9fcda
ILT
73212009-10-06 Ian Lance Taylor <iant@google.com>
7322
7323 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7324 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7325 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7326 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7327 the address on ldo_addrs_.
7328 (Target_i386::Relocate::fix_up_ldo): New function.
7329
e99daf92
ILT
73302009-10-06 Rafael Espindola <espindola@google.com>
7331
7332 * plugin.cc (add_input_library): New.
7333 (Plugin::load): Add add_input_library to tv.
7334 (Plugin_manager::add_input_file): Add the is_lib argument.
7335 (add_input_file): Update call to Plugin_manager::add_input_file.
7336 (add_input_library): New.
7337 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7338
966d4097
DK
73392009-09-30 Doug Kwan <dougkwan@google.com>
7340
7341 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7342 symbol and call Symbol::may_need_copy_reloc to determine if
7343 a copy reloc is needed.
7344 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7345 nocopyreloc is given in command line.
7346 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7347 given in command line.
7348 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7349 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7350 of the removed Target_i386::may_need_copy_reloc.
7351 * options.h (copyreloc): New option with default value false.
7352 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7353 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7354 instead of the removed Target_powerpc::may_need_copy_reloc.
7355 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7356 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7357 instead of the removed Target_sparc::may_need_copy_reloc.
7358 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7359 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7360 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7361 instead of the removed Target_x86_64::may_need_copy_reloc.
7362
029ba973
ILT
73632009-09-30 Ian Lance Taylor <iant@google.com>
7364
7365 * object.h (class Object): Remove target_ field, and target,
7366 sized_target, and set_target methods.
7367 (Object::sized_target): Remove.
7368 (class Sized_relobj): Update declarations. Remove sized_target.
7369 * object.cc (Sized_relobj::setup): Remove target parameter.
7370 Change all callers.
7371 (Input_objects::add_object): Don't do anything with the target.
7372 (make_elf_sized_object): Add punconfigured parameter. Change all
7373 callers. Set or test parameter target.
7374 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7375 Change all callers.
7376 * parameters.cc (Parameters::set_target): Change parameter type to
7377 be non-const.
7378 (Parameters::default_target): Remove.
7379 (set_parameters_target): Change parameter type to be non-const.
7380 (parameters_force_valid_target): New function.
7381 (parameters_clear_target): New function.
7382 * parameters.h (class Parameters): Update declarations. Remove
7383 default_target method. Add sized_target and clear_target
7384 methods. Change target_ to be non-const.
7385 (set_parameters_target): Update declaration.
7386 (parameters_force_valid_target): Declare.
7387 (parameters_clear_target): Declare.
7388 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7389 as NULL if we aren't searching.
7390 (Add_symbols::run): Don't check for compatible target.
7391 * fileread.cc (Input_file::open_binary): Call
7392 parameters_force_valid_target.
7393 * gold.cc (queue_middle_tasks): Likewise.
7394 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7395 set_target on object.
7396 * dynobj.h (class Sized_dynobj): Update declarations.
7397 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7398 make_elf_object returns NULL.
7399 (Archive::include_member): Don't check whether object target is
7400 compatible.
7401 * output.cc (Output_section::add_input_section): Get target from
7402 parameters.
7403 (Output_section::relax_input_section): Likewise.
7404 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7405 parameters.
7406 (Sized_relobj::do_scan_relocs): Likewise.
7407 (Sized_relobj::relocate_sections): Likewise.
7408 * resolve.cc (Symbol_table::resolve): Likewise.
7409 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7410 parameter. Change all callers.
7411 (Symbol_table::add_from_object): Get target from parameters.
7412 (Symbol_table::add_from_relobj): Don't check object target.
7413 (Symbol_table::add_from_dynobj): Likewise.
7414 (Symbol_table::define_special_symbol): Get target from
7415 parameters.
7416 * symtab.h (class Symbol_table): Update declaration.
7417 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7418 parameter. Change all callers. Clear parameter target.
7419 (Binary_test): Test target here.
7420 * testsuite/object_unittest.cc (gold_testsuite): Remove
7421 target_test_pointer parameter. Change all callers.
7422 (Object_test): Test target here.
7423
a6a22b83
ILT
74242009-09-26 Ian Lance Taylor <iant@google.com>
7425
7426 * testsuite/initpri1.c: Don't try to use constructor priorities if
7427 compiling with gcc before 4.3.
7428
6a8f49fe
ILT
74292009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7430
7431 * testsuite/retain_symbols_file_test.sh (check_present): Change
7432 output file name to retain_symbols_file_test.stdout.
7433 (check_absent): Likewise.
7434
8c604651
CS
74352009-09-18 Craig Silverstein <csilvers@google.com>
7436
7437 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7438 * options.cc: Include <cerrno> and <fstream>.
7439 (General_options::finalize): Parse -retain-symbols-file tag.
7440 * options.h: New flag.
7441 (General_options): New method should_retain_symbol, new
7442 variable symbols_to_retain.
7443 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7444 should_retain_symbol map.
7445 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7446 * testsuite/Makefile.in: Regenerate.
7447 * testsuite/retain_symbols_file_test.sh: New file.
7448
ca58b19f
NC
74492009-09-18 Nick Clifton <nickc@redhat.com>
7450
7451 * po/es.po: Updated Spanish translation.
7452
20e6d0d6
DK
74532009-09-17 Doug Kwan <dougkwan@google.com>
7454
7455 * debug.h (DEBUG_RELAXATION): New constant.
7456 (DEBUG_ALL): Add DEBUG_RELAXATION.
7457 (debug_string_to_enum): Add relaxation debug option.
7458 * layout.cc
7459 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7460 Layout::Relaxation_debug_check::read_sections,
7461 Layout::Relaxation_debug_check::read_sections): New method definitions.
7462 (Layout::Layout): Initialize data members
7463 record_output_section_data_from_scrips_,
7464 script_output_section_data_list_ and relaxation_debug_check_.
7465 (Layout::save_segments, Layout::restore_segments,
7466 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7467 Layout::relaxation_loop_body): New method definitions.
7468 (Layout::finalize): Support relaxation. Move section layout code to
7469 Layout::relaxation_loop_body.
7470 (Layout::set_asection_address_from_script): Move code for orphan
7471 section placement out.
7472 (Layout::place_orphan_sections_in_script): New method definition.
7473 * layout.h (Output_segment_headers, Output_file_header):
7474 New forward class declarations.
7475 (Layout::~Layout): Define.
7476 (Layout::new_output_section_data_from_script): New method definition.
7477 (Layout::place_orphan_sections_in_script): New method declaration.
7478 (Layout::Segment_states): New type declaration.
7479 (Layout::save_segments, Layout::restore_segments,
7480 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7481 Layout::relaxation_loop_body): New method declarations.
7482 (Layout::Output_section_data_list): New type declaration.
7483 (Layout::Relaxation_debug_check): New class definition.
7484 (Layout::record_output_section_data_from_script_,
7485 Layout::script_output_section_data_list_, Layout::segment_states_,
7486 Layout::relaxation_debug_check_): New data members.
7487 * output.cc: (Output_section_headers::do_size): New method definition.
7488 (Output_section_headers::Output_section_headers): Move size
7489 computation to Output_section_headers::do_size.
7490 (Output_segment_headers::do_size): New method definition.
e1df38aa 7491 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
7492 Output_file_header::do_size and call it.
7493 (Output_file_header::do_size): New method definition.
7494 (Output_data_group::Output_data_group): Adjust call to
7495 Output_section_data.
7496 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7497 (Output_symtab_xindex::do_write): Add array bound check.
7498 (Output_section::Input_section::print_to_mapfile): Handle
7499 RELAXED_INPUT_SECTION_CODE.
7500 (Output_section::Output_section): Initialize data member checkpoint_.
7501 (Output_section::~Output_section): Delete checkpoint object pointed
7502 by checkpoint_.
7503 (Output_section::add_input_section): Always add an Input_section if
7504 relaxing.
7505 (Output_section::add_merge_input_section): Add assert.
7506 (Output_section::relax_input_section): New method definition.
7507 (Output_section::set_final_data_size): Set load address to zero for
7508 an unallocated section.
7509 (Output_section::do_address_and_file_offset_have_reset_values):
7510 New method definition.
7511 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7512 Handle relaxed input section.
7513 (Output_section::sort_attached_input_sections): Checkpoint input
7514 section list lazily.
7515 (Output_section::get_input_sections): Change type of input_sections to
7516 list of Simple_input_section pointers. Checkpoint input section list
7517 lazily. Also handle relaxed input sections.
7518 (Output_section::add_input_section_for_script): Take a reference to
7519 a Simple_input_section object instead of Relobj pointer and section
7520 index as parameter. Handle relaxed input sections.
7521 (Output_section::save_states, Output_section::restore_states): New
7522 method definitions.
7523 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7524 (Output_data::is_data_size_fixed): New method definition.
7525 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7526 if it is fixed.
7527 (Output_data::address_and_file_offset_have_reset_values): New method
7528 definition.
7529 (Output_data::do_address_and_file_offset_have_reset_values): New method
7530 definition.
7531 (Output_data::set_data_size): Check that data size is not fixed.
7532 (Output_data::fix_data_size): New method definition.
7533 (Output_data::is_data_size_fixed_): New data member.
7534 (Output_section_headers::set_final_data_size): New method definition.
7535 (Output_section_headers::do_size): New method declaration.
7536 (Output_segment_headers::set_final_data_size): New method definition.
7537 (Output_segment_headers::do_size): New method declaration.
7538 (Output_file_header::set_final_data_size)::New method definition.
7539 (Output_file_header::do_size)::New method declaration.
7540 (Output_section_data::Output_section_data): Add new parameter
7541 is_data_size_fixed and use it to fix data size.
7542 (Output_data_const::Output_data_const): Adjust call to base class
7543 constructor and fix data size.
7544 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7545 base class constructor and fix data size.
7546 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7547 base class constructor and fix data size.
7548 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7549 class constructor and fix data size.
7550 (Output_data_group::set_final_data_size): New method definition.
7551 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7552 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7553 class constructor and fix data size.
7554 (Output_relaxed_input_section): New class definition.
7555 (Output_section::Simple_input_section): New class definition.
7556 (Output_section::get_input_sections): Adjust parameter list.
7557 (Output_section::add_input_section_for_script): Same.
7558 (Output_section::save_states, Output_section::restore_states,
7559 Output_section::do_address_and_file_offset_have_reset_values,
7560 (Output_section::Input_section::Input_section): Handle
7561 RELAXED_INPUT_SECTION_CODE. Add new overload for
7562 Output_relaxed_input_section.
7563 (Output_section::Input_section::is_input_section,
7564 Output_section::Input_section::set_output_section): Handle relaxed
7565 input section.
7566 (Output_section::Input_section::is_relaxed_input_section,
7567 Output_section::Input_section::output_section_data,
7568 Output_section::Input_section::relaxed_input_section): New method
7569 definitions.
7570 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7571 value.
7572 (Output_section::Input_section::u1_): Update comments.
7573 (Output_section::Input_section::u2_): Add new union member poris.
7574 (Output_section::Checkpoint_output_section): New classs definition.
7575 (Output_section::relax_input_section): New method declaration.
7576 (Output_section::checkpoint_): New data member.
7577 (Output_segment): Update comments.
7578 (Output_segment::Output_segment): Un-privatize copy constructor.
7579 (Output_segment::operator=): Un-privatize.
7580 * script-sections.cc (Output_section_element::Input_section_list):
7581 Change element type to Output_section::Simple_input_section.
7582 (Output_section_element_dot_assignment::set_section_addresses):
7583 Register output section data for relaxation clean up.
7584 (Output_data_exression::Output_data_expression): Adjust call to base
7585 constructor to fix data size.
7586 (Output_section_element_data::set_section_addresses): Register
7587 Output_data_expression object for relaxation clean up.
7588 (struct Input_section_info): Replace Relobj pointer and section index
7589 pair with Output_section::Simple_input_section and Convert struct to a
7590 class.
7591 (Input_section_sorter::operator()): Adjust access to
e1df38aa 7592 Input_section_info data member to use accessors.
20e6d0d6
DK
7593 (Output_section_element_input::set_section_addresses): Use layout
7594 parameter. Adjust code to use Output_section::Simple_input_section
7595 and Input_secction_info classes. Register filler for relaxation
7596 clean up.
7597 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7598 and section index pair with Output_section::Simple_input_section
7599 class. Adjust code accordingly.
7600 (Phdrs_element::release_segment): New method definition.
7601 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7602 segment list.
7603 (Script_sections::release_segments): New method definition.
7604 * gold/script-sections.h (Script_sections::release_segments): New
7605 method declaration.
7606 * gold/target.h (Target::may_relax, Target::relax,
7607 Target::do_may_relax, Target::do_relax): New method definitions.
7608
5e445df6
ILT
76092009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7610
7611 * arm.cc (has_signed_unsigned_overflow): New function.
7612 (Arm_relocate_functions::abs8): New function.
7613 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7614 (Target_arm::Scan::global): Likewise.
7615 (Target_arm::relocate::relocate): Likewise.
7616 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7617 Likewise.
7618
8c604651 76192009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
7620
7621 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7622 * testsuite/Makefile.in: Regenerate.
7623
1e9cc1c2
NC
76242009-09-11 Nick Clifton <nickc@redhat.com>
7625
7626 * po/gold.pot: Updated by the Translation project.
7627
6a89f575
CC
76282009-09-08 Cary Coutant <ccoutant@google.com>
7629
7630 * output.cc (Output_file::open): Add execute permission to empty file.
7631 * testsuite/Makefile.am (permission_test): New test.
7632 * testsuite/Makefile.in: Regenerate.
7633
fdcac5af
ILT
76342009-09-02 Ian Lance Taylor <iant@google.com>
7635
7636 * output.cc (Output_file::resize): Call map_no_anonymous rather
7637 than map.
7638
44453f85
ILT
76392009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7640
7641 * gold.cc: Include "incremental.h".
7642 (queue_initial_tasks): Call Incremental_checker methods.
7643 * incremental.cc: Include "output.h".
7644 (Incremental_checker::can_incrementally_link_output_file): New
7645 method.
7646 * incremental.h (Incremental_checker): New class.
7647
7648 * output.cc (Output_file::open_for_modification): New method.
7649 (Output_file::map_anonymous): Changed return type to bool. Record
7650 map in base_ field.
7651 (Output_file::map_no_anonymous): New method, broken out of map.
7652 (Output_file::map): Use map_no_anonymous and map_anonymous.
7653 * output.h (class Output_file): Update declarations.
7654
293c1386
CC
76552009-08-24 Cary Coutant <ccoutant@google.com>
7656
7657 * options.h (Command_line::Pre_options): New class.
7658 (Command_line::pre_options): New member.
7659 * options.cc (gold::options::ready_to_register): New variable.
7660 (One_option::register_option): Do nothing if not registering options.
7661 Assert if same short option registered twice.
7662 (General_options::General_options): Turn off option registration when
7663 done constructing.
7664 (Command_line::Pre_options::Pre_options): New constructor.
7665
f773f3d2
CC
76662009-08-24 Cary Coutant <ccoutant@google.com>
7667
06a73cfe
CC
7668 * options.h (General_options::no_keep_memory): Remove incorrect
7669 short option.
f773f3d2 7670
a15af8e2
RW
76712009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7672
7673 * Makefile.am (am__skiplex, am__skipyacc): New.
7674 * Makefile.in: Regenerate.
7675
c462b41b
RW
76762009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7677
14ec8efd
RW
7678 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7679 (INCLUDES): ... this.
7680 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7681 (AM_CPPFLAGS): Renamed from ...
7682 (INCLUDE): ... this.
7683 * Makefile.in, testsuite/Makefile.in: Regenerate.
7684
81ecdfbb
RW
7685 * Makefile.in: Regenerate.
7686 * aclocal.m4: Likewise.
7687 * config.in: Likewise.
7688 * configure: Likewise.
7689 * testsuite/Makefile.in: Likewise.
7690
c462b41b
RW
7691 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7692 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7693 * Makefile.in: Regenerate.
7694 * testsuite/Makefile.in: Regenerate.
7695
2da73f13
CC
76962009-08-19 Cary Coutant <ccoutant@google.com>
7697
7698 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7699 symbols in shared libraries overridden by hidden or internal symbols
7700 in the main program.
7701
2db70501
CD
77022009-08-19 Chris Demetriou <cgd@google.com>
7703
7704 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7705 checking source file names in error messages.
7706
f733487b
DK
77072009-08-18 Doug Kwan <dougkwan@google.com>
7708
7709 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7710 an elcpp::Ehdr as parameter. Adjust call to set_target.
7711 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7712 an elfcpp::Ehdr as parameter.
7713 * object.cc (Object::set_target): Remove the version that looks up
7714 a target and sets it.
7715 (Sized_relobj::setup): Take a Target object instead of
7716 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7717 (make_elf_sized_object): Find target and ask target to
7718 make an ELF object.
7719 * object.h: (Object::set_target): Remove the version that looks up
7720 a target and sets it.
7721 (Sized_relobj::setup): Take a Target object instead of
7722 an elfcpp:Ehdr as parameter.
7723 * target.cc: Include dynobj.h.
7724 (Target::do_make_elf_object_implementation): New.
7725 (Target::do_make_elf_object): New.
7726 * target.h (Target::make_elf_object): New template declaration.
7727 (Target::do_make_elf_object): New method declarations.
7728 (Target::do_make_elf_object_implementation): New template declaration.
7729
cc70f101
ILT
77302009-08-14 Ian Lance Taylor <iant@google.com>
7731
7732 * gold.h (FUNCTION_NAME): Define.
7733 (gold_unreachable): Use FUNCTION_NAME.
7734
ef5e0cb1
ST
77352009-08-12 Sriraman Tallam <tmsriram@google.com>
7736
7737 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7738 symbol in the --keep-unique list is not found.
7739
48c187ce
ST
77402009-08-12 Sriraman Tallam <tmsriram@google.com>
7741
7742 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7743 been maked as --keep-unique.
7744 (Icf::unfold_section): New function.
7745 * icf.h (Icf::unfold_section): New function.
7746 * options.h (General_options::keep_unique): New option.
7747 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7748 * testsuite/Makefile.in: Regenerate.
7749 * testsuite/icf_keep_unique_test.sh: New file.
7750 * testsuite/icf_keep_unique_test.cc: New file.
7751
645afe0c
CC
77522009-08-12 Cary Coutant <ccoutant@google.com>
7753
7754 PR 10471
7755 * resolve.cc (Symbol_table::resolve): Check for references from
7756 dynamic objects to hidden and internal symbols.
7757 * testsuite/Makefile.am (hidden_test.sh): New test.
7758 * testsuite/Makefile.in: Regenerate.
7759 * testsuite/hidden_test.sh: New script.
7760 * testsuite/hidden_test_1.c: New test source.
7761 * testsuite/hidden_test_main.c: New test source.
7762
11af873f
DK
77632009-08-11 Doug Kwan <dougkwan@google.com>
7764
7765 * arm.cc: Update comments.
7766 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7767 segment to locate the .ARM.exidx section if present.
7768
b9f7d72d
DK
77692009-08-09 Doug Kwan <dougkwan@google.com>
7770
7771 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7772 patch.
7773
ddd3c53c
ST
77742009-08-07 Sriraman Tallam <tmsriram@google.com>
7775 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7776 compiler warnings.
7777
27721062
ST
77782009-08-06 Sriraman Tallam <tmsriram@google.com>
7779
7780 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7781 valid tls_segment only for non-debug-section relocations.
7782 * testsuite/Makefile.am: Add gc_tls_test.
7783 * testsuite/Makefile.in: Regenerate.
7784 * testsuite/gc_tls_test.cc: New file.
7785 * testsuite/gc_tls_test.sh: New file.
7786
ef15dade 77872009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 7788
ef15dade
ST
7789 * icf.cc: New file.
7790 * icf.h: New file.
7791 * Makefile.am (CCFILES): Add icf.cc.
7792 (HFILES): Add icf.h
7793 * Makefile.in: Regenerate.
7794 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7795 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7796 section, symbol and addend information for the relocs.
7797 * gold.cc (queue_middle_tasks): Call identical code folding.
7798 * gold.h: Add defines for multimap.
7799 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7800 to the call of finalize_local_symbols.
7801 * main.cc (main): Create object of class Icf.
7802 * object.cc (Sized_relobj::do_layout): Allow this function to be
7803 called twice during icf.
7804 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7805 to sections marked as identical by icf.
7806 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7807 when available.
7808 (Sized_relobj::do_section_entsize): New function.
7809 * object.h (Object::section_entsize): New function.
7810 (Object::do_section_entsize): New pure virtual function.
7811 (Relobj::finalize_local_symbols): Add new parameter.
7812 (Relobj::do_section_entsize): New function.
7813 * options.h (General_options::icf): New option.
7814 (General_options::icf_iterations): New option.
7815 (General_options::print_icf_sections): New option.
7816 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7817 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7818 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7819 icf.
7820 * symtab.cc (Symbol_table::is_section_folded): New function.
7821 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7822 to sections marked as identical by icf.
7823 * symtab.h (Symbol_table::set_icf): New function.
7824 (Symbol_table::icf): New function.
7825 (Symbol_table::is_section_folded): New function.
7826 (Symbol_table::icf_): New data member.
7827 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7828 * testsuite/Makefile.am: Add commands to build icf_test.
7829 * testsuite/Makefile.in: Regenerate.
7830 * testsuite/icf_test.sh: New file.
7831 * testsuite/icf_test.cc: New file.
7832
c3b65ac4
CD
78332009-07-24 Chris Demetriou <cgd@google.com>
7834
7835 * layout.cc (is_compressible_debug_section): Fix incorrect
7836 comment about compressed section names.
7837
1caf2c51
ILT
78382009-07-20 Ian Lance Taylor <ian@airs.com>
7839
7840 PR 10419
7841 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7842
1ef4d87f
ILT
78432009-07-16 Ian Lance Taylor <iant@google.com>
7844
7845 PR 10400
7846 * layout.h: #include <map>.
7847 (class Kept_section): Change from struct to class. Add accessors
7848 and setters. Add section size to Comdat_group mapping. Change
7849 Comdat_group to std::map. Add is_comdat_ field. Add
7850 linkonce_size field in union.
7851 (class Layout): Update declaration of find_or_add_kept_section.
7852 Don't declare find_kept_object.
7853 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7854 parameter. Add object, shndx, is_comdat, and is_group_name
7855 parameters. Change all callers. Adjust for new Kept_section.
7856 (Layout::find_kept_object): Remove.
7857 * object.cc (Sized_relobj::include_section_group): Update use of
7858 Kept_section. Rename secnum to shndx. Only record
7859 Kept_comdat_section if sections are the same size.
7860 (Sized_relobj::include_linkonce_section): Update use of
7861 Kept_section. Only record Kept_comdat_section if sections are the
7862 same size. Set size of linkonce section.
7863 (Sized_relobj::map_to_kept_section): Update call to
7864 get_kept_comdat_section.
7865 * object.h (class Sized_relobj): Rename fields in
7866 Kept_comdat_section to drop trailing underscores; change object
7867 field to Relobj*. Change Kept_comdat_section_table to store
7868 struct rather than pointer.
7869 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7870 Add kept_object and kept_shndx parameters. Change all callers.
7871 (Sized_relobj::get_kept_comdat_section): Change return type to
7872 bool. Add kept_object and kept_shndx parameters. Change all
7873 callers.
7874 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7875 Layout::find_or_add_kept_section.
7876
37c3b7b0
ILT
78772009-07-09 Ian Lance Taylor <iant@google.com>
7878
7879 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7880 Reserve space in the hash table.
7881
98fa85cb
ILT
78822009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7883
7884 * fileread.cc (File_read::get_mtime): New method.
7885 * fileread.h (Timespec): New structure.
7886 (File_read::get_mtime): New method.
7887 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7888 Renamed from timestamp_nsec.
7889 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7890 Elf_Xword.
e1df38aa 7891 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 7892 timestamp_nsec.
e1df38aa 7893 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
7894 (Incremental_inputs::report_obejct): Save mtime; style fix.
7895 (Incremental_inputs::report_script): Save mtime; style fix.
7896 (Incremental_inputs::finalize_inputs): Style fix.
7897 (Incremental_inputs::finalize): Style fix.
7898 (Incremental_inputs::create_input_section_data): Store inputs
7899 mtime.
7900 * incremental.h (Incremental_inputs::report_script): Add mtime
7901 argument.
7902 (Incremental_inputs::Input_info::Input_info): Intialize only one
7903 union member.
7904 (Incremental_inputs::Input_info::archive): Move to nameless
7905 union.
7906 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7907 (Incremental_inputs::Input_info::script): Move to nameless union.
7908 (Incremental_inputs::mtime): New field.
7909 * script.cc (read_input_script): Pass file mtime to
7910 Incremental_input.
7911 * script.h (Script_info::inputs): Style fix.
7912
c9d70757
ILT
79132009-07-01 Ian Lance Taylor <ian@airs.com>
7914
7915 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7916 instead of 32.
7917
9c547ec3
ILT
79182009-06-24 Ian Lance Taylor <iant@google.com>
7919
7920 PR 10156
7921 * layout.cc (Layout::choose_output_section): If we find an
7922 existing section, update the flags.
7923 (Layout::create_notes): New function, broken out of
7924 Layout::finalize.
7925 (Layout::finalize): Don't create note sections.
7926 (Layout::create_note): Don't crash if linker script discards
7927 section.
7928 (Layout::create_gold_note): Likewise.
7929 (Layout::create_build_id): Likewise. Don't set
7930 after_input_sections on the section.
7931 (Layout::create_executable_stack_info): Remove target parameter.
7932 Change caller.
7933 * layout.h (class Layout): Declare create_notes. Update
7934 declaration of create_executable_stack_info.
7935 * gold.cc (queue_middle_tasks): Call create_notes.
7936 * output.cc (Output_section::update_flags_for_input_section): Move
7937 here from output.h. If SHF_ALLOC flag is newly set, mark address
7938 invalid.
7939 * output.h (Output_data::mark_address_invalid): New function.
7940 (class Output_section): Only declare, not define,
7941 update_flags_for_input_section. Remove set_flags.
7942
55458500
ILT
79432009-06-24 Ian Lance Taylor <iant@google.com>
7944
7945 * script-sections.cc (Output_section_definition::
7946 set_section_addresses): Rename shadowing local load_address to
7947 laddr.
7948
1307d6cd
ILT
79492009-06-24 Ian Lance Taylor <iant@google.com>
7950
7951 PR 10244
7952 * reloc.cc (relocate_sections): Skip empty relocation sections.
7953
ec3f783e
ILT
79542009-06-23 Ian Lance Taylor <iant@google.com>
7955
7956 PR 10156
7957 * layout.cc (Layout::create_note): Use choose_output_section
7958 rather than make_output_section.
7959
459c9f1c
ILT
79602009-06-23 Ian Lance Taylor <iant@google.com>
7961
7962 PR 10237
7963 * options.cc (General_options::parse_V): Set printed_version_.
7964 (General_options::General_options): Initialize printed_version_.
7965 * options.h (class General_options): Add printed_version_ field.
7966 * gold.cc (queue_initial_tasks): If there are no input files,
7967 don't give a fatal error if we printed the version information.
7968 (queue_middle_tasks): If using -r with a shared object, give a
7969 fatal error rather than an ordinary error.
7970
1518dc8f
ILT
79712009-06-23 Ian Lance Taylor <iant@google.com>
7972
7973 PR 10219
7974 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7975 (Layout::make_output_section): Set have_stabstr_section_ if we see
7976 a .stab*str section.
7977 (Layout::finalize): Call link_stabs_sections.
7978 (Layout::link_stabs_sections): New file.
7979 * layout.h (class Layout): Add have_stabstr_section_ field.
7980 Declare link_stabs_sections.
7981
3d857b98
DK
79822009-06-23 Doug Kwan <dougkwan@google.com>
7983
7984 * Makefile.am (libgold_a_LIBADD): New.
7985 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7986 * Makefile.in: Regenerate.
7987 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7988 * configure: Regenerate.
7989 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7990 * fileread.cc: Include sys/state.h
7991 * gold.h: Declare memmem and strndup if found missing.
7992 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7993
0639a6f6
ILT
79942009-06-23 Ian Lance Taylor <iant@google.com>
7995
7996 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7997 * configure: Rebuild.
7998
8d63875c
ILT
79992009-06-23 Ian Lance Taylor <iant@google.com>
8000
8001 PR 10147
8002 * object.cc (Object::section_contents): Don't try to get a view if
8003 the section has length zero.
8004 (Object::handle_gnu_warning_section): If the section is empty, use
8005 the name of the section as the warning.
8006
f7c8a183
ILT
80072009-06-23 Ian Lance Taylor <iant@google.com>
8008
8009 PR 10133
8010 * stringpool.h (class Stringpool_template): Add optimize_ field.
8011 (Stringpool_template::set_optimize): New function.
8012 * stringpool.cc (Stringpool_template::Stringpool_template):
8013 Initialize optimize_ field.
8014 (Stringpool_template::set_string_offsets): Test local optimize
8015 fild rather than parameter.
8016 * layout.cc (Layout::Layout): Call set_optimize on the section
8017 name stringpool.
8018
e6a307ba
ILT
80192009-06-22 Ian Lance Taylor <iant@google.com>
8020
8021 PR 10030
8022 * yyscript.y: Parse TARGET.
8023 * script.cc (script_set_target): New function.
8024 * script-c.h (script_set_target): Declare.
8025 * options.cc (General_options::string_to_object_format): Rename
8026 from string_to_object_format in anonymous namespace. Change
8027 callers.
8028 * options.h (class General_options): Declare
8029 string_to_object_format.
8030
3ee173de
ILT
80312009-06-22 Ian Lance Taylor <iant@google.com>
8032
8033 * script-sections.cc (Script_sections::create_segments): Don't put
8034 program headers in a PT_LOAD segment if -n or -N.
8035
80362009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
8037
8038 PR 10141
8039 * options.h (class General_options): Add -z lazy and -z now. Sort
8040 -z options into alphabetical order.
8041 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
8042
cd6739a1 80432009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
8044
8045 * layout.cc (Layout::make_output_section): Call
8046 Target::new_output_section.
8047 (Layout::attach_allocated_section_to_segment): Put large section
8048 sections in a separate load segment with the large segment flag
8049 set.
8050 (Layout::segment_precedes): Sort large data segments after other
8051 load segments.
8052 (align_file_offset): New static function.
8053 (Layout::set_segment_offsets): Use align_file_offset.
8054 * output.h (class Output_section): Add is_small_section_ and
8055 is_large_section_ fields.
8056 (Output_section::is_small_section): New function.
8057 (Output_section::set_is_small_section): New function.
8058 (Output_section::is_large_section): New function.
8059 (Output_section::set_is_large_section): New function.
8060 (Output_section::is_large_data_section): New function.
8061 (class Output_segment): Add is_large_data_segment_ field.
8062 (Output_segment::is_large_data_segment): New function.
8063 (Output_segment::set_is_large_data_segment): New function.
8064 * output.cc (Output_section::Output_section): Initialize new
8065 fields.
8066 (Output_segment::Output_segment): Likewise.
8067 (Output_segment::add_output_section): Add assertion that large
8068 data sections always go in large data segments. Force small data
8069 sections to the end of the list of data sections. Force small BSS
8070 sections to the start of the list of BSS sections. For large BSS
8071 sections to the end of the list of BSS sections.
8072 * symtab.h (class Symbol): Declare is_common_shndx.
8073 (Symbol::is_defined): Check Symbol::is_common_shndx.
8074 (Symbol::is_common): Likewise.
8075 (class Symbol_table): Define enum Commons_section_type. Update
8076 declarations. Add small_commons_ and large_commons_ fields.
8077 * symtab.cc (Symbol::is_common_shndx): New function.
8078 (Symbol_table::Symbol_table): Initialize new fields.
8079 (Symbol_table::add_from_object): Put small and large common
8080 symbols in the right list.
8081 (Symbol_table::sized_finalized_symbol): Check
8082 Symbol::is_common_shndx.
8083 (Symbol_table::sized_write_globals): Likewise.
8084 * common.cc (Symbol_table::do_allocate_commons): Allocate new
8085 common symbol lists. Don't call do_allocate_commons_list if the
8086 list is empty.
8087 (Symbol_table::do_allocate_commons_list): Remove is_tls
8088 parameter. Add comons_section_type parameter. Change all
8089 callers. Handle small and large common symbols.
8090 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
8091 Symbol::is_common_shndx.
8092 * resolve.cc (symbol_to_bits): Likewise.
8093 * target.h (Target::small_common_shndx): New function.
8094 (Target::small_common_section_flags): New function.
8095 (Target::large_common_shndx): New function.
8096 (Target::large_common_section_flags): New function.
8097 (Target::new_output_section): New function.
8098 (Target::Target_info): Add small_common_shndx, large_common_shndx,
8099 small_common_section_flags, and large_common_section_flags
8100 fields.
8101 (Target::do_new_output_section): New virtual function.
8102 * arm.cc (Target_arm::arm_info): Initialize new fields.
8103 * i386.cc (Target_i386::i386_info): Likewise.
8104 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8105 Likewise.
8106 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8107 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8108 (Target_x86_64::do_new_output_section): New function.
8109 * configure.ac: Define conditional MCMODEL_MEDIUM.
8110 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8111 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8112 (large_LDFLAGS): Define.
8113 * testsuite/large.c: New file.
8114 * testsuite/testfile.cc (Target_test::test_target_info):
8115 Initialize new fields.
8116 * configure, testsuite/Makefile.in: Rebuild.
8117
bb04269c
DK
81182009-06-05 Doug Kwan <dougkwan@google.com>
8119
8120 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 8121 * Makefile.in: Regenerate.
bb04269c
DK
8122 * i386.cc (class Target_i386): Define new virtual method to
8123 override do_is_local_label_name in parent.
8124 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8125 local symbols if --discard-locals or -X is given.
8126 * options.h (class General_options): Declare new options
8127 '--discard-locals' and '-X' for discarding locals.
8128 * target.h (class Target): Define new methods is_local_label_name.
8129 Declare new virtual method do_is_local_label_name.
8130 * target.cc: New file.
8131 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8132 (check_SCRIPTS): Add discard_locals_test.sh.
8133 (check_DATA): Add discard_local_tests.syms.
8134 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8135 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8136 * testsuite/Makefile.in: Regenerate.
8137 * testsuite/discard_locals_test.c: New file.
8138 * testsuite/discard_locals_test.sh: Same.
8139
805bb01c
DK
81402009-06-05 Doug Kwan <dougkwan@google.com>
8141
8142 * object.cc (Sized_relobj::Sized_relobj): Initialize
8143 discarded_eh_frame_shndx_ to -1U.
8144 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8145 section.
8146 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8147 a discarded .eh_frame section.
8148 (Sized_relobj::do_finalize_local_symbols): Ditto.
8149 * object.h (class Sized_relobj): Declare new member
8150 discarded_eh_frame_shndx_.
8151 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8152 (local_labels_test.o, local_labels_test): New rules.
8153 * testsuite/Makefile.in: Regenerate.
8154
1dcd334d
DK
81552009-06-04 Doug Kwan <dougkwan@google.com>
8156
8157 * layout.cc (Layout::section_name_mapping): Add mapping for
8158 special ARM sections.
8159
96d49306
DK
81602009-06-03 Doug Kwan <dougkwan@google.com>
8161
8162 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8163 (utils::has_overflow): Same.
8164
dff16297
ILT
81652009-06-03 Ian Lance Taylor <iant@google.com>
8166
8167 * layout.cc (Layout::section_name_mapping): New array, replacing
8168 Layout::linkonce_mapping.
8169 (Layout::section_name_mapping_count): New variable, replacing
8170 Layout::linkonce_mapping_count.
8171 (Layout::linkonce_output_name): Remove.
8172 (Layout::output_section_name): Rewrite.
8173 * layout.h (class Layout): Rename Linkonce_mapping to
8174 Section_name_mapping, linkonce_mapping to section_name_mapping,
8175 linkonce_mapping_count to section_name_mapping_count. Don't
8176 declare linkonce_output_name.
8177
c121c671
DK
81782009-06-03 Doug Kwan <dougkwan@google.com>
8179
8180 * gold/arm.cc (namespace utils): New.
8181 (Target_arm::reloc_is_non_pic): Define new method.
8182 (class Arm_relocate_functions): New.
8183 (Target_arm::Relocate::relocate): Handle relocation types used by
8184 Android.
8185
07800fab
ILT
81862009-06-03 Ian Lance Taylor <iant@google.com>
8187
8188 * arm.cc (Target_arm::scan::global): Use || instead of |.
8189
c121c671
DK
81902009-06-02 Doug Kwan <dougkwan@google.com>
8191
8192 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8193 issued_non_pic_error_.
8194 (class Target_arm::Scan): Declare new method check_non_pic.
8195 Define new method symbol_needs_plt_entry.
8196 Declare new data member issued_non_pic_error_.
8197 (class Target_arm::Relocate): Declare new method
8198 should_apply_static_reloc.
8199 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8200 (Target_arm::Scan::check_non_pic): Define new method.
8201 (Target_arm::Scan::local): Handle a small subset of reloc types used
8202 by Android.
8203 (Target_arm::Scan::local): Same.
8204 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8205
b19b0c6d
ILT
82062009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8207
8208 * incremental.cc (Incremental_inputs::report_command_line): Filter
8209 out --incremental-* options.
8210
94cdfcff
DK
82112009-05-29 Doug Kwan <dougkwan@google.com>
8212
8213 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8214 template class.
8215 (class Target_arm): Update comment.
8216 (Target_arm::Target_arm): Initialize new data members GOT_,
8217 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8218 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8219 and Target_arm::rel_dyn_section.
8220 Declare new_enum Target_arm::Got_type.
8221 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8222 and DYNBSS_.
8223 Update commments for member do_dynsym_value.
8224 (Target_arm::got_size, Target_arm::plt_section,
8225 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8226 new methods inside class defintion.
8227 (Target_arm::got_section): Define new method.
8228 (Target_arm::rel_dyn_section): Same.
8229 (Output_data_plt_arm): New template class.
8230 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8231 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8232 (Output_data_plt_arm::add_entry): Same.
8233 (Output_data_plt_arm::first_plt_entry): Define new
8234 static data member for PLT instruction template.
8235 (Output_data_plt_arm::plt_entry): Same.
8236 (Output_data_plt_arm::do_write): Define new method.
8237 (Target_arm::make_plt_entry): Same.
8238 (Target_arm::do_finalize_sections): Same.
8239 (Target_arm::do_dynsym_value): Same.
8240
4a657b0d
DK
82412009-05-28 Doug Kwan <dougkwan@google.com>
8242
8243 * Makefile.am (TARGETSOURCES): Add arm.cc.
8244 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8245 * Makefile.in: Regenerate.
8246 * arm.cc: New file.
8247 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8248
e7ae8c36
DK
82492009-05-26 Doug Kwan <dougkwan@google.com>
8250
8251 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8252 (General_options::check_excluded_libs): Strip off directories in
8253 archive name before matching like GNU ld does.
8254 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8255 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8256 (exclude_libs_test_LDFLAGS): Add linker option
8257 -Wl,--exclude-libs,libexclude_libs_test_3
8258 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8259 an explicit archive without using -l.
8260 (alt/libexclude_libs_test_3.a): New make rule.
8261 * testsuite/Makefile.in: Regenerate.
8262 * testsuite/exclude_libs_test.c : Declare lib3_default().
8263 (main): Call it.
8264 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8265 * exclude_libs_test_3.c: New file.
8266
f12e7348
NC
82672009-05-26 Nick Clifton <nickc@redhat.com>
8268
8269 * po/id.po: New Indonesian translation.
8270 * po/gold.pot: Updated template file.
8271
4daadc0d
ST
82722009-05-22 Sriraman Tallam <tmsriram@google.com>
8273
e1df38aa 8274 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
8275 gc_comdat_test files. Add -Wl,--gc-sections to build
8276 gc_comdat_test.
8277 * testsuite/Makefile.in: Regenerate.
8278 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8279
531813ad
ST
82802009-05-21 Sriraman Tallam <tmsriram@google.com>
8281
8282 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8283 kept comdat section was garbage collected.
8284 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8285 * testsuite/Makefile.in: Regenerate.
8286 * testsuite/gc_comdat_test.sh: New file.
8287 * testsuite/gc_comdat_test_1.cc: New file.
8288 * testsuite/gc_comdat_test_2.cc: New file.
8289
65514900
CC
82902009-05-19 Doug Kwan <dougkwan@google.com>
8291
8292 * archive.cc (Archive::Archive): Move constructor from archive.h
8293 to here. Initialize no_export_.
8294 (Archive::get_elf_object_for_member): Set no_export flag of object.
8295 * archive.h (Archive::Archive): Move constructor body to
8296 archive.cc.
8297 (Archive::no_export): New method.
8298 (Archive::no_export_): New field.
8299 * object.h (Object::Object): Initialize no_export_ to false.
8300 (Object::no_export, Object::set_no_export): New methods.
8301 (Object::no_export_): New field.
8302 * options.cc (General_options::parse_exclude_libs): New method.
8303 (General_options::check_excluded_libs) Same.
8304 * options.h (exclude_libs): New option.
8305 (General_options::check_excluded_libs): New method declaration.
8306 (General_options::excluded_libs_): New field.
8307 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8308 default or protected visibility if an object has no-export flag set.
8309 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8310 (check_SCRIPTS): Add exclude_libs_test.sh.
8311 (check_DATA): Add exclude_libs_test.syms.
8312 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8313 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8314 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8315 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8316 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8317 libexclude_libs_test_2.a): New rules.
8318 * testsuite/Makefile.in: Regenerate.
8319 * testsuite/exclude_libs_test.c: New file.
8320 * testsuite/exclude_libs_test.sh: Ditto.
8321 * testsuite/exclude_libs_test_1.c: Ditto.
8322 * testsuite/exclude_libs_test_2.c: Ditto.
8323
1b77ea50
ILT
83242009-05-15 Ian Lance Taylor <iant@google.com>
8325
8326 * configure.ac: Check for declarations for cases where libiberty.h
8327 checks HAVE_DECL_xxx.
8328 * configure, config.in: Rebuild.
8329
072fe7ce
ILT
83302009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8331
8332 * gold.h (Incremental_argument_list): Remove (invalid) forward
8333 declaration.
8334 * incremental.cc (Incremental_inputs::report_achive): New method.
8335 (Incremental_inputs::report_object): New method.
8336 (Incremental_inputs::report_script): New method.
8337 (Incremental_inputs::finalize_inputs): New method.
8338 (Incremental_inputs::finalize): Call finalize_inputs().
8339 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8340 Create inputs entries.
8341 * incremental.h (Incremental_input_type): New enum.
8342 (Incremental_inputs::Incremental_input): Initialize new fields.
8343 (Incremental_inputs::report_inputs): New method.
8344 (Incremental_inputs::report_achive): New method.
8345 (Incremental_inputs::report_object): New method.
8346 (Incremental_inputs::report_script): New method.
8347 (Incremental_inputs::finalize_inputs): New method.
8348 (Incremental_inputs::Input_info): New struct.
8349 (Incremental_inputs::Input_info_map): New typedef.
8350 (Incremental_inputs::lock_): New field.
8351 (Incremental_inputs::Inputs_): New field.
8352 (Incremental_inputs::Inputs_map): New field.
8353 * main.cc (main): Call Incremental_input::report_inputs.
8354 * options.h (Input_argument_list): Typedef moved from
8355 Input_arguments.
8356 (Input_file_group::Files): Remove, use ::Input_argument_list.
8357 (Input_file_group::Input_argument_list): Remove, use
8358 ::Input_argument_list.
8359 * plugin.cc (Plugin_manager::add_input_file): Add error in
8360 incremental build.
8361 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8362 functions.
8363 * script.cc (read_input_script): Call
8364 Incremental_input::report_script.
8365 * script.h (Script_info): New class.
8366
b0481b0b
ILT
83672009-04-27 Ian Lance Taylor <iant@google.com>
8368
8369 * x86_64.cc (do_adjust_output_section): Set entsize to
8370 plt_entry_size.
8371
b22a5a41 83722009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
8373
8374 * output.cc (Output_file::close): After short writes, continue
8375 writing from the correct offset in the buffer being written.
8376
40fde488
CD
83772009-04-23 Chris Demetriou <cgd@google.com>
8378
8379 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8380 * configure: Regenerate.
8381 * config.in: Regenerate.
8382 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8383 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8384
3ce2c28e
ILT
83852009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8386
8387 * incremental.cc (Incremental_inputs_header_data): Renamed from
8388 Incremental_input_header_data.
8389 (Incremental_inputs_header_data::data_size): New field.
8390 (Incremental_inputs_header_data::put_input_file_count): Renamed
8391 from input_file_count.
8392 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8393 from command_line_offset.
8394 (Incremental_inputs_header_data::put_reserved): Renamed from
8395 put_reserved.
8396 (Incremental_inputs_entry_data): Renamed from
8397 Incremental_input_entry_data.
8398 (Incremental_inputs_entry_data::data_size): New field.
8399 (Incremental_inputs::report_command_line): New method.
8400 (Incremental_inputs::finalize): New method.
8401 (Incremental_inputs::create_incremental_inputs_data): New method.
8402 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8403 * incremental.h: New file.
8404 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8405 (Layout::finalize): Create incremental inputs section in
8406 incremental builds.
8407 (Layout::create_incremental_info_sections): New method.
8408 * layout.h (Layout::incremental_inputs): New method.
8409 (Layout::create_incremental_info_sections): New method.
8410 (Layout::incremental_inputs_): New field.
8411 * main.cc (main): Notify Incremental_input of the command line.
8412
e55bde5e
ILT
84132009-04-01 Ian Lance Taylor <iant@google.com>
8414 Mikolaj Zalewski <mikolajz@google.com>
8415
8416 * gold.h (reserve_unordered_map): Define, three versions, one for
8417 each version of Unordered_map.
8418 * layout.cc (Layout::Layout): Remove options parameter. Add
8419 number_of_input_files parameter. Don't initialize options_.
8420 Initialize number_of_input_files_ and resized_signatures_. Move
8421 sections_are_attached_.
8422 (Layout::layout_group): Reserve space for group_signatures_.
8423 (Layout::find_or_add_kept_section): Change name parameter to be a
8424 reference. Resize signatures_ map when it gets large enough.
8425 (Layout::layout_eh_frame): Use parameters->options() instead of
8426 this->options_.
8427 (Layout::make_output_section): Likewise.
8428 (Layout::attach_allocated_section_to_segment): Likewise.
8429 (Layout::finalize, Layout::create_executable_stack): Likewise.
8430 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8431 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8432 * layout.h (class Layout): Update declarations. Remove options_
8433 field. Add number_of_input_files_ and resized_signatures_
8434 fields. Move sections_are_attached_ field.
8435 * main.cc (main): Pass number of input files to Layout
8436 constructor. Don't pass options.
8437
154b857c
ILT
84382009-03-30 Ian Lance Taylor <iant@google.com>
8439
8440 * ffsll.c (ffsll): Correct implementation.
8441
2f35ab9b
ILT
84422009-03-27 Ian Lance Taylor <iant@google.com>
8443
fd03461a
ILT
8444 * ffsll.c: New file.
8445 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8446 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8447 * ftruncate.c (ftruncate): Declare before definition.
8448 * mremap.c (mremap): Likewise.
8449 * pread.c (pread): Likewise.
8450 * configure, Makefile.in, config.in: Rebuild.
8451
2f35ab9b
ILT
8452 * mremap.c: New file.
8453 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8454 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8455 (mremap): Declare if HAVE_MREMAP is not defined.
8456 * configure, Makefile.in, config.in: Rebuild.
8457
33aea2fd
CC
84582009-03-27 Cary Coutant <ccoutant@google.com>
8459
8460 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8461 position independent.
8462 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8463 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8464
6d479619
CC
84652009-03-24 Cary Coutant <ccoutant@google.com>
8466
8467 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8468 an executable.
8469 (needs_dynamic_reloc): Likewise.
8470
afc06bb8
ILT
84712009-03-24 Ian Lance Taylor <iant@google.com>
8472
8473 * yyscript.y (file_cmd): Recognize EXTERN.
8474 (extern_name_list, extern_name_list_body): New nonterminals.
8475 * script.cc (script_add_extern): Define.
8476 * script-c.h (script_add_extern): Declare.
8477
f6060a4d
ILT
84782009-03-24 Rafael Avila de Espindola <espindola@google.com>
8479
8480 * object.cc (is_elf_object): Define.
8481 * object.h (is_elf_object): Declare.
8482 * archive.cc (Archive::get_elf_object_for_member): Call
8483 is_elf_object.
33aea2fd 8484 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 8485
26736d8e
ILT
84862009-03-24 Elliott Hughes <enh@google.com>
8487
8488 * output.cc (Output_file::map_anonymous): Define.
8489 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8490 try an anonymous one. Report the size if the mmap fails.
8491 * output.h (class Output_file): Declare map_anonymous.
8492
22fd9730
ILT
84932009-03-24 Ian Lance Taylor <iant@google.com>
8494
8495 * target-select.cc (instantiate_target): Don't acquire the lock if
8496 the instantiated_target_ field has already been set.
8497
cb010894
ILT
84982009-03-23 Ian Lance Taylor <iant@google.com>
8499
7f055c20
ILT
8500 * gold-threads.h (class Initialize_lock): Define.
8501 * gold-threads.cc (class Initialize_lock_once): Define.
8502 (initialize_lock_control): New static variable.
8503 (initialize_lock_pointer): New static variable.
8504 (initialize_lock_once): New static function.
8505 (Initialize_lock::Initialize_lock): Define.
8506 (Initialize_lock::initialize): Define.
8507 * target-select.h: Include "gold-threads.h".
8508 (class Target_selector): Add lock_ and initialize_lock_ fields.
8509 Don't define instantiate_target, just declare it.
8510 * target-select.cc (Target_selector::Target_selector): Initialize
8511 new fields.
8512 (Target_selector::instantiate_target): Define.
8513 * descriptors.h: Include "gold-threads.h".
8514 (class Descriptors): Add initialize_lock_ field.
8515 * descriptors.cc (Descriptors::Descriptors): Initialize new
8516 field.
8517 (Descriptors::open): Use initialize_lock_ field
8518 * errors.h (class Errors): Add initialize_lock_ field.
8519 * errors.cc (Errors::Errors): Initialize new field.
8520 (Errors::initialize_lock): Use initialize_lock_ field.
8521 * powerpc.cc (class Target_selector_powerpc): Remove
8522 instantiated_target_ field. In do_recognize call
8523 instantiate_target rather than do_instantiate_target. In
8524 do_instantiate_target just allocate a new target.
8525 * sparc.cc (class Target_selector_sparc): Likewise.
8526
36959681
ILT
8527 * freebsd.h: New file.
8528 * i386.cc: Include "freebsd.h".
8529 (Target_i386): Derive from Target_freebsd rather than
8530 Sized_target.
8531 (Target_selector_i386): Derive from Target_selector_freebsd rather
8532 than Target_selector.
8533 * x86_64.cc: Include "freebsd.h".
8534 (Target_x86_64): Derive from Target_freebsd rather than
8535 Sized_target.
8536 (Target_selector_x86_64): Derive from Target_selector_freebsd
8537 rather than Target_selector.
8538 * target.h (class Target): Add adjust_elf_header and
8539 do_adjust_elf_header.
8540 * output.cc (Output_file_header:: do_sized_write): Call target
8541 adjust_elf_header routine.
8542 * configure.tgt: Set targ_osabi.
8543 * configure.ac: Define GOLD_DEFAULT_OSABI.
8544 * parameters.cc (Parameters::default_target): Pass
8545 GOLD_DEFAULT_OSABI to select_target.
8546 * target-select.h (class Target_selector): Make instantiate_target
8547 protected rather than private.
8548 * Makefile.am (HFILES): Add freebsd.h.
8549 * configure, Makefile.in, config.in: Rebuild.
8550
cb010894
ILT
8551 * merge.cc (do_add_input_section): Correct pend value. Change
8552 message about last entry not being null terminated from error to
8553 warning.
8554
0e879927
ILT
85552009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8556
8557 * incremental.cc: New file.
8558 * Makefile.am (CCFILES): Add incremental.cc.
8559 * Makefile.in: Rebuild.
8560
41105937
PP
85612009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8562
8563 * layout.cc (Layout::output_section_name): Preserve names
8564 of '.note.' sections.
e1df38aa 8565
60439920
ILT
85662009-03-19 Ian Lance Taylor <iant@google.com>
8567
8568 * descriptors.cc (Descriptors::open): Check that the options are
8569 valid before using them.
8570
0d371ad3
ILT
85712009-03-18 Ian Lance Taylor <iant@google.com>
8572
8573 * script-sections.h: Include <list>.
8574 (class Script_sections): Change Sections_elements from std::vector
8575 to std::list. Typedef public Elements_iterator. Add
8576 orphan_section_placement_, data_segment_align_start_, and
8577 saw_data_segment_align_ fields. Remove data_segment_align_index_
8578 field.
8579 * script-sections.cc (class Orphan_section_placement): New class.
8580 (class Sections_element): Add virtual functions is_relro and
8581 orphan_section_init. Remove virtual function place_orphan_here.
8582 (class Output_section_definition): Add is_relro and
8583 orphan_section_init. Remove place_orphan_here.
8584 (class Orphan_output_section): Likewise.
8585 (Script_sections::Script_sections): Update for field changes.
8586 (Script_sections::data_segment_align): Set saw_data_segment_align_
8587 and data_segment_align_start_, not data_segment_align_index.
8588 (Script_sections::data_segment_relro_end): Check
8589 saw_data_segment_align_. Use data_segment_align_start_ rather
8590 than data_segment_align_index_.
8591 (Script_sections::place_orphan): Rewrite to use
8592 Orphan_section_placement.
8593
9201d894
ILT
85942009-03-17 Ian Lance Taylor <iant@google.com>
8595
9c5b8369
ILT
8596 * archive.cc (Archive::add_symbols): Check for a version attached
8597 to the symbol name in the archive map.
8598 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8599 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8600 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8601 (ver_test_11.a): New target.
8602 * testsuite/Makefile.in: Rebuild.
8603
9201d894
ILT
8604 * configure.ac: Check for chsize and posix_fallocate. Replace
8605 ftruncate.
8606 * ftruncate.c: New file, from gnulib.
8607 * output.cc (posix_fallocate): Define dummy version if not
8608 HAVE_POSIX_FALLOCATE.
8609 (Output_file::map): Call posix_fallocate rather than lseek and
8610 write.
8611 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8612 * configure, Makefile.in, config.in: Rebuild.
8613
ef4ab7a8 86142009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 8615
ef4ab7a8
PP
8616 * layout.h (Layout::create_note): Add section_name parameter.
8617 * layout.cc (Layout::create_note): Likewise.
8618 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 8619
8c500701
ILT
86202009-03-17 Ian Lance Taylor <iant@google.com>
8621
e85b18e1
ILT
8622 * descriptors.cc: Include "options.h".
8623 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8624 (Descriptors::open): Always use O_CLOEXEC when opening a new
8625 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8626 then set FD_CLOEXEC.
8627
9efe6174
ILT
8628 * sparc.cc (class Target_sparc): Add has_got_section.
8629 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8630 make sure we have a GOT section.
8631
8632 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8633 (Target_sparc::Scan::local): Likewise.
8634 (Target_sparc::Scan::global): Likewise.
8635 (Target_sparc::Relocate::relocate): Likewise.
8636 (Target_sparc::Relocate::relocate_tls): Likewise.
8637
8c500701
ILT
8638 * symtab.cc (Symbol_table::define_default_version): New function,
8639 broken out of add_from_object.
8640 (Symbol_table::add_from_object): Call define_default_version.
8641 (Symbol_table::define_special_symbol): Add resolve_oldsym
8642 parameter. Change all callers. If the version for a symbol comes
8643 from a version script, resolve it with the symbol with the same
8644 name with no version. Also add the symbol without a version if
8645 appropriate.
8646 (do_define_in_output_data): If resolving with oldsym, don't delete
8647 sym.
8648 (do_define_in_output_segment): Likewise.
8649 (do_define_as_constant): Likewise.
8650 * symtab.h (class Symbol_table): Update declarations.
8651
f1ed28fb
ILT
86522009-03-13 Ian Lance Taylor <iant@google.com>
8653
15f8229b
ILT
8654 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8655 (Read_symbols::requeue): New function.
8656 (Read_symbols::do_read_symbols): If make_elf_object fails because
8657 the target type is not configured, and the file was searched for,
8658 issue a warning and retry with the next directory.
8659 (Add_symbols::run): If the file has an incompatible format, and
8660 it was searched for, requeue the Read_symbols task. On error,
8661 release the object.
8662 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8663 dirindex parameter to constructor. Change all callers. Declare
8664 incompatible_warning and requeue.
8665 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8666 input_argument_ and input_group_ fields. Add them to
8667 constructor. Change all callers.
8668 (class Read_script): Add dirindex_ field. Add it to constructor.
8669 Change all callers.
8670 * archive.cc (Archive::setup): Remove input_objects parameter.
8671 Change all callers.
8672 (Archive::get_file_and_offset): Likewise.
8673 (Archive::read_all_symbols): Likewise.
8674 (Archive::read_symbols): Likewise.
8675 (Archive::get_elf_object_for_member): Remove input_objects
8676 parameter. Add punconfigured parameter. Change all callers.
8677 (Archive::add_symbols): Change return type to bool. Check return
8678 value of include_member.
8679 (Archive::include_all_members): Likewise.
8680 (Archive::include_member): Change return type to bool. Return
8681 false if first included object has incompatible target. Set
8682 included_member_ field.
8683 (Add_archive_symbols::run): If add_symbols returns false, requeue
8684 Read_symbols task.
8685 * archive.h (class Archive): Add included_member_ field.
8686 Initialize it in constructor. Add input_file and searched_for
8687 methods. Update declarations.
8688 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8689 input_argument_ fields. Add them to constructor. Change all
8690 callers.
8691 * script.cc: Include "target-select.h".
8692 (class Parser_closure): Add skip_on_incompatible_target_ and
8693 found_incompatible_target_ fields. Add
8694 skip_on_incompatible_target parameter to constructor. Change all
8695 callers. Add methods skip_on_incompatible_target,
8696 clear_skip_on_incompatible_target, found_incompatible_target, and
8697 set_found_incompatible_target.
8698 (read_input_script): Add dirindex parameter. Change all callers.
8699 If parser finds an incompatible target, requeue Read_symbols
8700 task.
8701 (script_set_symbol): Clear skip_on_incompatible_target in
8702 closure.
8703 (script_add_assertion, script_parse_option): Likewise.
8704 (script_start_sections, script_add_phdr): Likewise.
8705 (script_check_output_format): New function.
8706 * script.h (read_input_script): Update declaration.
8707 * script-c.h (script_check_output_format): Declare.
8708 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8709 (ignore_cmd): Remove OUTPUT_FORMAT.
8710 * fileread.cc (Input_file::Input_file): Add explicit this.
8711 (Input_file::will_search_for): New function.
8712 (Input_file::open): Add pindex parameter. Change all callers.
8713 * fileread.h (class Input_file): Add input_file_argument method.
8714 Declare will_search_for. Update declarations.
8715 * object.cc (make_elf_object): Add punconfigured parameter.
8716 Change all callers.
8717 * object.h (class Object): Make input_file public. Add
8718 searched_for method.
8719 (make_elf_object): Update declaration.
8720 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8721 restart search.
8722 * dirsearch.h (class Dirsearch): Update declaration.
8723 * options.h (class General_options): Add --warn-search-mismatch.
8724 * parameters.cc (Parameters::is_compatible_target): New function.
8725 * parameters.h (class Parameters): Declare is_compatible_target.
8726 * workqueue.cc (Workqueue::add_blocker): New function.
8727 * workqueue.h (class Workqueue): Declare add_blocker.
8728
f1ed28fb
ILT
8729 * fileread.cc (Input_file::open): Remove options parameter.
8730 Change all callers.
8731 (Input_file::open_binary): Likewise.
8732 * script.cc (read_input_script): Likewise.
8733 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8734 options parameter from constructor. Change all callers.
8735 (class Read_script): Likewise.
8736 * fileread.h (class Input_file): Update declarations.
8737 * script.h (read_input_script): Update declaration.
8738
34dd024a
NC
87392009-03-10 Nick Clifton <nickc@redhat.com>
8740
8741 * po/es.po: New Spanish translation.
8742
6d71b17c
CC
87432009-03-06 Cary Coutant <ccoutant@google.com>
8744
8745 * options.cc (parse_short_option): Keep dash_z from registering itself.
8746
031cdbed
ILT
87472009-03-03 Ian Lance Taylor <iant@google.com>
8748
8749 PR 9918
8750 * target-reloc.h (relocate_section): Pass output_section to
8751 relocate.
8752 * i386.cc (Target_i386::should_apply_static_reloc): Add
8753 output_section parameter. Change all callers.
8754 (Target_i386::Relocate::relocate): Add output_section parameter.
8755 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8756 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8757 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8758 * testsuite/two_file_shared.sh: New script.
8759 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8760 (check_DATA): Add two_file_shared.dbg.
8761 (two_file_shared.dbg): New target.
8762 * testsuite/Makefile.in: Rebuild.
8763
15d5fa16
ILT
87642009-03-01 Ian Lance Taylor <iant@google.com>
8765
8766 * configure.ac: Check for byteswap.h.
8767 * configure: Rebuild.
8768 * config.in: Rebuild.
8769
8a4c0b0d
ILT
87702009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8771
8772 * layout.cc (Layout::find_or_add_kept_section): New function.
8773 (Layout::add_comdat): Removed.
8774 * layout.h (struct Kept_section): Move out of class Layout.
8775 Remove trailing underscores from field names. Add group_sections
8776 field. Rename group_ field to is_group. Change all uses.
8777 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8778 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8779 comdat_groups_ field.
8780 (Sized_relobj::include_section_group): Use
8781 find_or_add_kept_section and Kept_section::group_sections.
8782 (Sized_relobj::include_linkonce_section): Likewise.
8783 * object.cc (class Sized_relobj): Don't define Comdat_group or
8784 Comdat_group_table. Remove find_comdat_group and
8785 add_comdat_group. Remove comdat_groups_ field.
8786 * plugin.cc (include_comdat_group): Use
8787 Layout::find_or_add_kept_section.
8788
b4ecf66b
ILT
87892009-02-28 Ian Lance Taylor <iant@google.com>
8790
14359ca0
ILT
8791 * README: --gc-sections and map files are now supported. Document
8792 some build requirements.
8793
b4ecf66b
ILT
8794 PR 6992
8795 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8796 relocatable link set the value of the section symbol to zero.
8797 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8798 relocatable link don't include the section address in the local
8799 symbol value.
8800
0602e05a
ILT
88012009-02-27 Ian Lance Taylor <iant@google.com>
8802
fd9d194f
ILT
8803 PR 6811
8804 * options.h (class Search_directory): Add is_system_directory.
8805 (class General_options): Declare is_in_system_directory.
8806 * options.cc (get_relative_sysroot): Make static.
8807 (get_default_sysroot): Make static.
8808 (General_optoins::is_in_system_directory): New function.
8809 * fileread.cc (Input_file::is_in_system_directory): New function.
8810 * fileread.h (class Input_file): Declare is_in_system_directory.
8811 * object.h (class Object): Add is_in_system_directory.
8812 (class Input_objects): Remove system_library_directory_ field.
8813 * object.cc (Input_objects::add_object): Don't set
8814 system_library_directory_.
8815 (input_objects::found_in_system_library_directory): Remove.
8816 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8817 parameter. Change all callers.
8818 (Symbol_table::sized_write_globals): Likewise.
8819 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8820 Call Object::is_in_system_directory.
8821 * symtab.h (class Symbol_table): Update declarations.
8822
61edd21f
ILT
8823 PR 5990
8824 * descriptors.h (Open_descriptor): Add is_on_stack field.
8825 * descriptors.cc (Descriptors::open): If the descriptor is on the
8826 top of the stack, remove it. Initialize is_on_stack field.
8827 (Descriptors::release): Only add pod to stack if it is not on the
8828 stack already.
8829 (Descriptors::close_some_descriptor): Clear stack_next and
8830 is_on_stack fields.
8831
e29e076a
ILT
8832 PR 7091
8833 * output.cc (Output_section::find_starting_output_address): Rename
8834 from starting_output_address; add PADDR parameter; change return
8835 type.
8836 * output.h (class Output_section): Declare
8837 find_starting_output_address instead of starting_output_address.
8838 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8839 section symbol for which we can't find a merge section.
8840
0602e05a
ILT
8841 PR 9836
8842 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8843 hidden or internal, force the symbol to be local.
8844 * resolve.cc (Symbol::override_visibility): Define.
8845 (Symbol::override_base): Use override_visibility.
8846 (Symbol_table::resolve): Likewise.
8847 (Symbol::override_base_with_special): Likewise.
8848 (Symbol_table::override_with_special): If the visibility is hidden
8849 or internal, force the symbol to be local.
8850 * symtab.h (class Symbol): Add set_visibility and
8851 override_visibility.
8852 * testsuite/ver_test_1.sh: New file.
8853 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8854 (check_DATA): Add ver_test_1.syms.
8855 (ver_test_1.syms): New target.
8856 * testsuite/Makefile.in: Rebuild.
8857
401a9a73
CC
88582009-02-25 Cary Coutant <ccoutant@google.com>
8859
8860 * layout.cc (Layout::choose_output_section): Don't rename sections
8861 when using a linker script that has a SECTIONS clause.
8862 * Makefile.in: Regenerate.
8863
8864 * testsuite/Makefile.am (script_test_5.sh): New test case.
8865 * testsuite/Makefile.in: Regenerate.
8866 * testsuite/script_test_5.cc: New file.
8867 * testsuite/script_test_5.sh: New file.
8868 * testsuite/script_test_5.t: New file.
8869
f488e4b0
CC
88702009-02-13 Rafael Avila de Espindola <espindola@google.com>
8871
8872 * archive.cc (Archive::include_member): Update calls to add_symbols.
8873 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8874 the Layout argument.
8875 * dynobj.h (do_add_symbols): Add the Layout argument.
8876 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8877 Layout argument.
8878 * object.h (Object::add_symbols): Add the Layout argument.
8879 (Object::do_add_symbols): Add the Layout argument.
8880 (Sized_relobj::do_add_symbols): Add the Layout argument.
8881 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8882 Unify the two versions.
8883 (Add_plugin_symbols): Remove.
8884 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8885 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8886 (Add_plugin_symbols): Remove.
8887 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8888 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8889 (Add_symbols::run): Make it work with Pulginobj.
8890
89dd1680
ILT
88912009-02-06 Ian Lance Taylor <iant@google.com>
8892
8893 * object.cc (Sized_relobj::do_layout): Make info message start
8894 with lower case letter.
8895
266d0a74
ILT
88962009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8897
602b464e
ILT
8898 * binary.cc: Fix file comment.
8899
266d0a74
ILT
8900 * options.h (enum Incremental_disposition): Define.
8901 (class General_options): Add new options: --incremental,
8902 --incremental_changed, --incremental_unchanged,
8903 --incremental_unknown. Add incremental_disposition_ and
8904 implicit_incremental_ fields.
8905 (General_options::incremental_disposition): New function.
8906 (class Position_dependent_options): Add incremental_disposition
8907 option.
8908 (Position_dependent_options::copy_from_options): Set incremental
8909 dispositions.
8910 * options.cc (General_options::parse_incremental_changed): New
8911 function.
8912 (General_options::parse_incremental_unchanged): New function.
8913 (General_options::parse_incremental_unknown): New function.
8914 (General_options::General_options): Initialize new fields
8915 incremental_disposition_ and implicit_incremental_.
8916 (General_options::finalize): Check for uasge of --incremental-*
8917 without --incremental.
8918
f073bbf7
CD
89192009-02-06 Chris Demetriou <cgd@google.com>
8920
8921 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8922 pointer and to report location as the file name associated with
8923 the symbol.
8924 (gold_undefined_symbol_at_location): New function to replace the
8925 old gold_undefined_symbol functionality.
8926 * target-reloc.h (relocate_section): Update to use
8927 gold_undefined_symbol_at_location.
8928 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8929 Call gold_undefined_symbol function rather than gold_error.
8930 * errors.h (Errors::undefined_symbol): Take location as a
8931 string, rather than calculating it from a relocation.
8932 * errors.cc (Errors::fatal): Print "fatal error:" before the
8933 formatted message.
8934 (Errors::error, Errors::error_at_location): Print "error: "
8935 before the formatted message.
8936 (Errors::undefined_symbol): Take location as a string, rather
8937 than calculating it from a relocation.
8938 (gold_undefined_symbol_at_location): New function akin to
8939 old gold_undefined_symbol, calculates location from relocation.
8940 (gold_undefined_symbol): Change to take only a Symbol pointer
8941 and to report location as the file name associated with the symbol.
8942 * testsuite/debug_msg.sh: Update for changed error messages.
8943 * testsuite/undef_symbol.sh: Likewise.
8944
8e94a90c
ILT
89452009-02-04 Duncan Sands <baldrick@free.fr>
8946
8947 PR 9812
8948 * reduced_debug_output.h
8949 (Output_reduced_debug_abbrev_section::failed): Use format for
8950 gold_warning.
8951 (Output_reduced_debug_info_section::faild): Likewise.
8952
88a0e15b
ILT
89532009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8954
8955 * script.cc (Lazy_demangler): New class.
8956 (Version_script_info::get_symbol_version_helper): Demangle a
8957 symbol only once.
8958
5efc7cd2
CC
89592009-01-29 Cary Coutant <ccoutant@google.com>
8960
8961 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8962 to __tls_get_addr.
8963 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8964
e0ebcf42
ILT
89652009-01-28 Ian Lance Taylor <iant@google.com>
8966
5efc7cd2 8967 * version.cc (version_string): Bump to 1.9.
75fe7426 8968
e0ebcf42
ILT
8969 * gold.h: Include <cstring> and <stdint.h>.
8970 * version.cc: Include <cstdio>.
8971 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8972 warning.
8973 * reduced_debug_output.cc (insert_into_vector): Rename from
8974 Insert_into_vector; change all callers. Use Swap_unaligned to
8975 avoid aliasing issue; remove union since it is unnecessary.
8976
8e2813be 89772009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
8978
8979 * Makefile.am (CCFILES): Add gc.cc.
8980 (HFILES): Add gc.h.
8981 * Makefile.in: Regenerate.
8982 * gold.cc (Gc_runner): New class.
8983 (queue_initial_tasks): Call garbage collection related tasks
8984 when corresponding options are invoked.
8985 (queue_middle_gc_tasks): New function.
8986 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8987 processed early before laying out sections during garbage collection.
8988 * gold.h (queue_middle_gc_tasks): New function.
8989 (is_prefix_of): Move from "layout.cc".
8990 * i386.cc (Target_i386::gc_process_relocs): New function.
8991 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8992 * main.cc (main): Create object of class "Garbage_collection".
8993 * object.cc (Relobj::copy_symbols_data): New function.
8994 (Relobj::is_section_name_included): New function.
e1df38aa
NC
8995 (Sized_relobj::do_layout): Allow this function to be called twice
8996 during garbage collection and defer layout of section during the
6d03d481
ST
8997 first call.
8998 * object.h (Relobj::get_symbols_data): New function.
8999 (Relobj::is_section_name_included): New function.
9000 (Relobj::copy_symbols_data): New function.
9001 (Relobj::set_symbols_data): New function.
9002 (Relobj::get_relocs_data): New function.
9003 (Relobj::set_relocs_data): New function.
9004 (Relobj::is_output_section_offset_invalid): New pure virtual function.
9005 (Relobj::gc_process_relocs): New function.
9006 (Relobj::do_gc_process_relocs): New pure virtual function.
9007 (Relobj::sd_): New data member.
9008 (Sized_relobj::is_output_section_offset_invalid): New function.
9009 (Sized_relobj::do_gc_process_relocs): New function.
9010 * options.h (General_options::gc_sections): Modify to not be a no-op.
9011 (General_options::print_gc_sections): New option.
9012 * plugin.cc (Plugin_finish::run): Remove function call to
9013 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
9014 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
9015 * reloc.cc (Read_relocs::run): Add task to process relocs and
9016 determine unreferenced sections when doing garbage collection.
9017 (Gc_process_relocs): New class.
9018 (Sized_relobj::do_gc_process_relocs): New function.
9019 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
9020 sections that are garbage collected.
9021 * reloc.h (Gc_process_relocs): New class.
9022 * sparc.cc (Target_sparc::gc_process_relocs): New function.
9023 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
9024 symbols whose corresponding sections are garbage collected.
9025 (Symbol_table::Symbol_table): Add new parameter for the garbage
9026 collection object.
9027 (Symbol_table::gc_mark_undef_symbols): New function.
9028 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9029 (Symbol_table::gc_mark_dyn_syms): New function.
9030 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
9031 as garbage.
9032 (Symbol_table::add_from_object): Likewise.
9033 (Symbol_table::add_from_relobj): When building shared objects, do not
9034 treat externally visible symbols as garbage.
9035 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
9036 table information for static and relocatable links.
9037 * symtab.h (Symbol_table::set_gc): New function.
9038 (Symbol_table::gc): New function.
9039 (Symbol_table::gc_mark_undef_symbols): New function.
9040 (Symbol_table::gc_mark_symbol_for_shlib): New function.
9041 (Symbol_table::gc_mark_dyn_syms): New function.
9042 (Symbol_table::gc_): New data member.
e1df38aa 9043 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
9044 function.
9045 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
9046 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
9047
3b293544
CF
90482009-01-20 Chris Faylor <me.sourceware@sourceware.org>
9049
9050 * options.h (General_options::gc_sections): Define as a no-op for now.
9051 (General_options::no_keep_memory): Ditto.
9052 (General_options::Bshareable): Define.
9053 * options.cc (General_options::finalize): Honor -Bshareable.
9054
83d22aa8
AS
90552009-01-20 Andreas Schwab <schwab@suse.de>
9056
9057 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
9058 read the value in the contents, since we don't use it. Use the
9059 template endianness when writing.
9060 (Relocate::relocate): Use it for R_PPC_REL16_HA.
9061
cd536b21
AS
90622009-01-19 Andreas Schwab <schwab@suse.de>
9063
9064 * configure.tgt (powerpc64-*): Fix targ_obj.
9065
99e9a495
ILT
90662009-01-15 Ian Lance Taylor <iant@google.com>
9067
9068 * object.cc (Sized_relobj::write_local_symbols): Don't write out
9069 local symbols when stripping all symbols.
9070
bbbfea06
CC
90712009-01-14 Cary Coutant <ccoutant@google.com>
9072
99e9a495 9073 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 9074
0f7c0701
CC
90752009-01-14 Cary Coutant <ccoutant@google.com>
9076
9077 * archive.cc (Archive::get_elf_object_for_member): Remove call
9078 to File_read::claim_for_plugin.
9079 * descriptors.cc (Descriptors::open): Remove reference to
9080 is_claimed.
9081 (Descriptors::claim_for_plugin): Remove.
9082 * descriptors.h (Descriptors::claim_for_plugin): Remove.
9083 (Descriptors::is_claimed): Remove.
9084 (claim_descriptor_for_plugin): Remove.
9085 * fileread.cc (File_read::claim_for_plugin): Remove.
9086 * fileread.h (File_read::claim_for_plugin): Remove.
9087 (File_read::descriptor): Reopen descriptor if necessary.
9088 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
9089 (Plugin_manager::all_symbols_read): Add task parameter. Change
9090 all callers.
9091 (Plugin_manager::get_input_file): New function.
9092 (Plugin_manager::release_input_file): New function.
9093 (Pluginobj::Pluginobj): Add filesize parameter and initialize
9094 corresponding data member.
9095 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
9096 and pass to base constructor. Change all callers.
9097 (get_input_file, release_input_file): New functions.
9098 (make_sized_plugin_object): Add filesize parameter. Change all callers.
9099 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
9100 (Plugin_manager::all_symbols_read): Add task parameter.
9101 (Plugin_manager::get_input_file): New function.
9102 (Plugin_manager::release_input_file): New function.
9103 (Plugin_manager::task_): New data member.
9104 (Pluginobj::Pluginobj): Add filesize parameter.
9105 (Pluginobj::filename): New function.
9106 (Pluginobj::descriptor): New function.
9107 (Pluginobj::filesize): New function.
9108 (Pluginobj::filesize_): New data member.
9109 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9110 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9111 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9112
9113 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9114 with archive libraries.
9115 * testsuite/Makefile.in: Regenerate.
9116 * testsuite/plugin_test.c (struct sym_info): New type.
9117 (get_input_file, release_input_file): New static variables.
9118 (onload): Capture new transfer vector entries.
9119 (claim_file_hook): Stop reading at end of file according to filesize.
9120 Factor out parsing of readelf output into separate function.
9121 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9122 APIs and get the source file name from the symbol table. Convert
9123 source file name to corresponding object file name. Print info
9124 message when adding new input files.
9125 (parse_readelf_line): New function.
9126 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9127 * testsuite/plugin_test_2.sh: Likewise.
9128 * testsuite/plugin_test_3.sh: Likewise.
9129 * testsuite/plugin_test_4.sh: New test case.
9130
62a6d109
ILT
91312009-01-07 Ian Lance Taylor <iant@google.com>
9132
9133 * version.cc (version_string): Bump to 1.8.
9134
483620e8
CC
91352008-12-23 Cary Coutant <ccoutant@google.com>
9136
9137 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9138 * plugin.cc (Plugin_manager::finish): Rename as
9139 layout_deferred_objects. Move cleanup to separate function.
9140 (Plugin_manager::cleanup): New function.
9141 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9142 separately.
9143 * plugin.h (Plugin_manager::finish): Rename as
9144 layout_deferred_objects.
9145 (Plugin_manager::cleanup): New function.
9146 (Plugin_manager::cleanup_done): New field.
9147
d66a9eb3
CC
91482008-12-23 Cary Coutant <ccoutant@google.com>
9149
9150 * plugin.cc (is_visible_from_outside): New function.
9151 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9152 so we don't return "IR only" status for exported symbols or -r links.
9153
9154 * testsuite/Makefile.am (plugin_test_3): New test case.
9155 * testsuite/Makefile.in: Regenerate.
9156 * testsuite/plugin_test_3.sh: New file.
9157
5995b570
CC
91582008-12-22 Cary Coutant <ccoutant@google.com>
9159
9160 * object.cc (Sized_relobj::layout_section): New function.
9161 (Sized_relobj::do_layout): Defer layout of input sections until after
9162 plugin has provided replacement files.
9163 (Sized_relobj::do_layout_deferred_sections): New function.
9164 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9165 (Relobj::layout_deferred_sections): New function.
9166 (Relobj::do_layout_deferred_sections): New function.
9167 (Sized_relobj::do_layout_deferred_sections): New function.
9168 (Sized_relobj::layout_section): New function.
9169 (Sized_relobj::Deferred_layout): New structure.
9170 (Sized_relobj::deferred_layout_): New field.
9171 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9172 Change all callers. Layout deferred sections.
9173 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9174 references.
9175 (Plugin_hook::run): Move code from do_plugin_hook inline.
9176 (Plugin_hook::do_plugin_hook): Remove.
9177 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9178 (Plugin_manager::finish): Renamed, was cleanup.
9179 (Plugin_manager::should_defer_layout): New function.
9180 (Plugin_manager::add_deferred_layout_object): New function.
9181 (Plugin_manager::Deferred_layout_list): New type.
9182 (Plugin_manager::deferred_layout_objects_): New field.
9183 (Plugin_hook::do_plugin_hook): Remove.
9184
ee769c88
ILT
91852008-12-17 Ian Lance Taylor <iant@google.com>
9186
9187 * options.h (class General_options): Add --no case for
9188 --export-dynamic.
9189
abc8dcba
CC
91902008-12-16 Cary Coutant <ccoutant@google.com>
9191
9192 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9193 vector.
9194 (Plugin_manager::claim_file): Create plugin object even if
9195 plugin did not call the add_symbols callback.
9196 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9197 asking for more symbols than were added.
9198 * testsuite/Makefile.am (plugin_test_1): Add test case with
9199 no global symbols.
9200 (empty.syms): New target.
9201 * testsuite/Makefile.in: Regenerate.
9202 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9203 message. Don't call add_symbols if no globals.
9204 (all_symbols_read_hook): Don't provide replacement for empty
9205 claimed file.
9206
b0074644
ILT
92072008-12-12 Ian Lance Taylor <iant@google.com>
9208
68943102
ILT
9209 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9210 r_type == 0 for a local symbol with r_sym == 0.
9211 (scan_relocatable_relocs): Pass r_sym to
9212 local_non_section_strategy.
9213 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9214 r_sym parameter.
9215
b0074644
ILT
9216 * configure.ac: Update test for TLS descriptors: they are
9217 supported as of glibc 2.9.
9218 * configure: Rebuild.
9219
c2508178
ILT
92202008-12-11 Ian Lance Taylor <iant@google.com>
9221
9222 PR 7091
9223 * target-reloc.h (Default_scan_relocatable_relocs): For each
9224 function, map r_type == 0 to RELOC_DISCARD.
9225
2756a258
CC
92262008-12-10 Cary Coutant <ccoutant@google.com>
9227
9228 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9229 object to override a kept COMDAT group from a plugin object.
9230
bb6f53d3
ILT
92312008-12-09 Ian Lance Taylor <iant@google.com>
9232
fbc558e1
ILT
9233 PR 7088
9234 * yyscript.y (file_cmd): Handle INPUT.
9235
bb6f53d3
ILT
9236 * testsuite/initpri1.c: Change all declarations to be full
9237 prototypes by adding void, to avoid compiler warnings.
9238
4674ecfc
CC
92392008-12-05 Rafael Avila de Espindola <espindola@google.com>
9240
9241 * options.cc (General_options::parse_plugin_opt): New.
9242 (General_options::add_plugin): The argument now is just the filename.
9243 (General_options::add_plugin_option): New.
9244 * options.h (plugin_opt): New.
9245 (add_plugin): Change argument name.
9246 (add_plugin_option): New.
9247 * plugin.cc (Plugin::load): Don't parse the plugin option.
9248 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9249 (Plugin::add_option): New.
9250 (Plugin::args_): Change type.
9251 (Plugin::filename_): New.
9252 (Plugin_manager::add_plugin_option): New.
9253 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9254 * testsuite/Makefile.in: Regenerate.
9255
fd06b4aa
CC
92562008-12-05 Cary Coutant <ccoutant@google.com>
9257
9258 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9259 Handle --strip-lto-sections option.
9260 * options.h (strip_lto_sections): New option.
9261
6c52134c
CC
92622008-12-01 Cary Coutant <ccoutant@google.com>
9263
9264 * plugin.cc (ld_plugin_message): Change format parameter to const.
9265 Fix mismatch between new[] and delete.
9266
a45248e0
CC
92672008-11-14 Cary Coutant <ccoutant@google.com>
9268
9269 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9270 instead of -1U.
9271
c82fbeee
CS
92722008-11-05 Craig Silverstein <csilvers@google.com>
9273
9274 * options.cc (General_options::parse_dynamic_list): New function.
9275 * options.h (General_options): New flags dynamic_list,
9276 dynamic_list_data, dynamic_list_cpp_new, and
9277 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9278 (General_options::in_dynamic_list): New function.
9279 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9280 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9281 (Lex::can_continue_name): Likewise.
9282 (yylex): Likewise.
9283 (read_script_file): New parameter script_options.
9284 (read_dynamic_list): New function.
9285 (Script_options::define_dynamic_list): New function.
9286 (dynamic_list_keyword_parsecodes): New variable.
9287 (dynamic_list_keywords): New variable.
9288 * script.h (Script_options::define_dynamic_list): New function
9289 prototype.
9290 (read_dynamic_list): New function prototype.
9291 * symtab.cc (strprefix): New macro.
9292 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9293 dynamic_list_data, dynamic_list_cpp_new, and
9294 dynamic_list_cpp_typeinfo.
9295 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9296 (dynamic_list_expr): New rule.
9297 (dynamic_list_nodes): Likewise.
9298 (dynamic_list_node): Likewise.
9299 * testsuite/Makefile.am (dynamic_list): New test.
9300 * testsuite/Makefile.in: Regenerated.
9301 * testsuite/dynamic_list.t: New file.
9302 * testsuite/dynamic_list.sh: New file.
9303
e0bb29a5
CS
93042008-11-05 Craig Silverstein <csilvers@google.com>
9305
9306 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9307 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9308 (t11_last): Likewise.
9309 * testsuite/ver_test_6.c (main): Likewise.
9310
4e1e25e0
CC
93112008-10-07 Cary Coutant <ccoutant@google.com>
9312
9313 * options.c (General_options::finalize): Add check for -static and
9314 -shared.
9315 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9316 is not empty.
9317
92f03fcb
CC
93182008-10-02 Cary Coutant <ccoutant@google.com>
9319
9320 * plugin.cc (make_sized_plugin_object): Fix conditional
9321 compilation to work when not all targets are enabled.
9322
fbd8a257
CC
93232008-09-29 Cary Coutant <ccoutant@google.com>
9324
9325 * archive.cc (Archive::get_file_and_offset): Use filename instead
9326 of name to get library path.
9327 (Archive::include_member): Unlock external member of a thin archive.
9328
9329 * testsuite/Makefile.am (TEST_AR): New variable.
9330 (thin_archive_test_1): New test.
9331 (thin_archive_test_2): New test.
81636b3f
CC
9332 * testsuite/Makefile.in: Regenerate.
9333 * testsuite/thin_archive_main.cc: New file.
9334 * testsuite/thin_archive_test_1.cc: New file.
9335 * testsuite/thin_archive_test_2.cc: New file.
9336 * testsuite/thin_archive_test_3.cc: New file.
9337 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 9338
eff45813
CC
93392008-09-29 Cary Coutant <ccoutant@google.com>
9340
9341 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9342 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9343 instead of -1U.
9344 (Sized_relobj::do_finalize_local_symbols): Likewise.
9345 (Sized_relobj::map_to_kept_section): Likewise.
9346 * object.h (Sized_relobj::invalid_address): New constant.
9347 (Sized_relobj::do_output_section_offset): Check for invalid_address
9348 and return -1ULL.
9349 * output.cc (Output_reloc::local_section_offset): Use constant
9350 invalid_address instead of -1U.
9351 (Output_reloc::get_address): Likewise.
9352 (Output_section::output_address): Change -1U to -1ULL.
9353 * output.h (Output_reloc::invalid_address): New constant.
9354 * reloc.cc (Sized_relobj::write_sections): Use constant
9355 invalid_address instead of -1U.
9356 (Sized_relobj::relocate_sections): Likewise.
9357 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9358 values for merge sections.
9359 * target-reloc.h (relocate_for_relocatable): Use constant
9360 invalid_address instead of -1U.
9361
89fc3421
CC
93622008-09-19 Cary Coutant <ccoutant@google.com>
9363
9364 Add plugin functionality for link-time optimization (LTO).
9365 * configure.ac (plugins): Add --enable-plugins option.
9366 * configure: Regenerate.
9367 * config.in: Regenerate.
9368 * Makefile.am (LIBDL): New variable.
9369 (CCFILES): Add plugin.cc.
9370 (HFILES): Add plugin.h.
9371 (ldadd_var): Add LIBDL.
9372 * Makefile.in: Regenerate.
9373
9374 * archive.cc: Include "plugin.h".
9375 (Archive::setup): Don't preread archive symbols when using a plugin.
9376 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9377 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9378 files.
9379 (Archive::include_member): Add symbols from plugin objects.
9380 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9381 * descriptors.cc (Descriptors::open): Check for file descriptors
9382 abandoned by plugins.
9383 (Descriptors::claim_for_plugin): New function.
9384 * descriptors.h (Descriptors::claim_for_plugin): New function.
9385 (Open_descriptor::is_claimed): New field.
9386 (claim_descriptor_for_plugin): New function.
9387 * fileread.cc (File_read::claim_for_plugin): New function.
9388 * fileread.h (File_read::claim_for_plugin): New function.
9389 (File_read::descriptor): New function.
9390 * gold.cc: Include "plugin.h".
9391 (queue_initial_tasks): Add task to call plugin hooks for generating
9392 new object files.
9393 * main.cc: Include "plugin.h".
9394 (main): Load plugin libraries.
9395 * object.h (Pluginobj): Declare.
9396 (Object::pluginobj): New function.
9397 (Object::do_pluginobj): New function.
9398 (Object::set_target): New function.
9399 * options.cc: Include "plugin.h".
9400 (General_options::parse_plugin): New function.
9401 (General_options::General_options): Initialize plugins_ field.
9402 (General_options::add_plugin): New function.
9403 * options.h (Plugin_manager): Declare.
9404 (General_options): Add --plugin option.
9405 (General_options::has_plugins): New function.
9406 (General_options::plugins): New function.
9407 (General_options::add_plugin): New function.
9408 (General_options::plugins_): New field.
9409 * plugin.cc: New file.
9410 * plugin.h: New file.
9411 * readsyms.cc: Include "plugin.h".
9412 (Read_symbols::do_read_symbols): Check for archive before checking
9413 for ELF file. Call plugin hooks to claim files.
9414 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9415 from a real object file; force override when processing replacement
9416 files.
9417 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9418 (Symbol::init_base_object): Likewise.
9419 (Symbol::init_base_output_data): Likewise.
9420 (Symbol::init_base_output_segment): Likewise.
9421 (Symbol::init_base_constant): Likewise.
9422 (Symbol::init_base_undefined): Likewise.
9423 (Symbol::output_section): Assert that object is not a plugin.
9424 (Symbol_table::add_from_pluginobj): New function.
9425 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9426 undefined.
9427 (Symbol_table::sized_write_globals): Likewise.
9428 (Symbol_table::add_from_pluginobj): Instantiate template.
9429 * symtab.h (Sized_pluginobj): Declare.
9430 (Symbol::in_real_elf): New function.
9431 (Symbol::set_in_real_elf): New function.
9432 (Symbol::in_real_elf_): New field.
9433 (Symbol_table::add_from_pluginobj): New function.
9434
9435 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9436 (LIBDL): New variable.
9437 (LDADD): Add LIBDL.
9438 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9439 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9440 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9441 (MOSTLYCLEANFILES): Likewise.
9442 * testsuite/Makefile.in: Regenerate.
9443 * testsuite/plugin_test.c: New file.
9444 * testsuite/plugin_test_1.sh: New file.
9445 * testsuite/plugin_test_2.sh: New file.
9446
de31bda5
ILT
94472008-09-16 Ian Lance Taylor <iant@google.com>
9448
9c2d0ef9
ILT
9449 * target-reloc.h (relocate_section): Check whether a symbol is
9450 defined by the ABI before reporting an undefined symbol error.
9451 * target.h (Target::is_defined_by_abi): Make parameter const.
9452 (Target::do_is_defined_by_abi): Likewise.
9453 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9454 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9455 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9456 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9457 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9458 * testsuite/Makefile.in: Rebuild.
9459
de31bda5
ILT
9460 * fileread.cc (make_view): Add casts to avoid warning.
9461
9fa33bee
AO
94622008-09-16 Alexandre Oliva <aoliva@redhat.com>
9463
9464 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9465 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9466
183fd0e3
AO
94672008-09-16 Alexandre Oliva <aoliva@redhat.com>
9468
9469 * options.h (General_options::output_is_executable): New.
9470 (General_options::output_is_pie): New.
9471 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9472 for shared libraries.
9473 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9474
7be8330a
CD
94752008-09-11 Chris Demetriou <cgd@google.com>
9476
9477 * options.h (origin): New -z option.
9478 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9479 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9480 in DT_FLAGS_1.
9481
a9caad02
CC
94822008-09-05 Cary Coutant <ccoutant@google.com>
9483
9484 * fileread.cc (File_read::make_view): Add check for attempt to map
9485 beyond end of file.
9486
ae6dce4d
CC
94872008-09-05 Cary Coutant <ccoutant@google.com>
9488
9489 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9490 explicit instantiations.
9491
d7ab2a47
KVH
94922008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9493
9494 PR gold/6858
9495 * options.cc (General_options::finalize): Allow undefined symbols
9496 in shlibs if linking -shared.
9497
9498 PR gold/6859
9499 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9500 symbols as not needing a dynsym entry.
9501
1e52a9c1
CS
95022008-08-20 Craig Silverstein <csilvers@google.com>
9503
9504 * fileread.cc (File_read::open): Do not lock the file unless it
9505 was successfully opened.
9506
d85c80a3
CC
95072008-08-14 Cary Coutant <ccoutant@google.com>
9508
9509 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9510 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9511 * testsuite/tls_test.cc (struct int128): 128-bit struct
9512 for testing TLS relocs with non-zero addend.
9513 (v12): New TLS variable.
9514 (t12): New test.
9515 (t_last): Add check for v12.
9516 * testsuite/tls_test.h (t12): New function.
9517 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9518
2d924fd9
ILT
95192008-08-13 Ian Lance Taylor <iant@google.com>
9520
9521 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9522 set tls_segment_ or relro_segment_.
9523 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9524 when appropriate.
9525 * output.h (Output_section::clear_is_relro): New function.
9526 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9527 sections specially even when output_data_ is empty.
9528 (Output_segment::maximum_alignment): When first section is relro,
9529 only force alignment for PT_LOAD segments.
9530 * script.cc (script_data_segment_align): New function.
9531 (script_data_segment_relro_end): New function.
9532 * script-c.h (script_data_segment_align): Declare.
9533 (script_data_segment_relro_end): Declare.
9534 * script-sections.h (class Script_sections): Declare
9535 data_segment_align and data_segment_relro_end. Add fields
9536 segment_align_index_ and saw_relro_end_.
9537 * script-sections.cc (class Sections_element): Add set_is_relro
9538 virtual function. Add new bool* parameter to place_orphan_here.
9539 Add get_output_section virtual function.
9540 (class Output_section_definition): Add set_is_relro. Add new
9541 bool* parameter to place_orphan_here. Add get_output_section.
9542 Add is_relro_ field.
9543 (Output_section_definition::Output_section_definition): Initialize
9544 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9545 and is_relro_ fields.
9546 (Output_section_definition::place_orphan_here): Add is_relro
9547 parameter.
9548 (Output_section_definition::set_section_addresses): Set relro for
9549 output section.
9550 (Output_section_definition::alternate_constraint): Likewise.
9551 (class Orphan_output_section): Add new bool* parameter to
9552 place_orphan_here. Add get_output_section.
9553 (Orphan_output_section::place_orphan_here): Add is_relro
9554 parameter.
9555 (Script_sections::Script_sections): Initialize
9556 data_segment_align_index_ and saw_relro_end_.
9557 (Script_sections::data_segment_align): New function.
9558 (Script_sections::data_segment_relro_end): New function.
9559 (Script_sections::place_orphan): Set or clear is_relro.
9560 (Script_sections::set_section_addresses): Force alignment of first
9561 TLS section.
9562 * yyscript.y (exp): Call script_data_segment_align and
9563 script_data_segment_relro_end.
9564 * testsuite/relro_script_test.t: New file.
9565 * testsuite/relro_test.cc (using_script): Declare.
9566 (t1, t2): Test using_script.
9567 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9568 (relro_script_test_SOURCES): Define.
9569 (relro_script_test_DEPENDENCIES): Define.
9570 (relro_script_test_LDFLAGS): Define.
9571 (relro_script_test_LDADD): Define.
9572 (relro_script_test.so): New target.
9573 * testsuite/Makefile.in: Rebuild.
9574
f827c9a9
CC
95752008-08-06 Cary Coutant <ccoutant@google.com>
9576
9577 * archive.cc (Archive::total_archives, Archive::total_members)
9578 (Archive::total_members_loaded): New variables.
9579 (Archive::setup): Add parameter. Add option to preread
9580 archive symbols.
9581 (Archive::read_armap): Add counter.
9582 (Archive::get_file_and_offset): New function.
9583 (Archive::get_elf_object_for_member): New function.
9584 (Archive::read_all_symbols): New function.
9585 (Archive::read_symbols): New function.
9586 (Archive::add_symbols): Add counters.
9587 (Archive::include_all_members): Use armap to find members if it's
9588 already built.
9589 (Archive::include_member): Skip reading symbols if already read.
9590 Factored code into Archive::get_file_and_offset and
9591 Archive::get_elf_object_for_member. Changed call to
9592 Mapfile::report_include_archive_member.
9593 (Archive::print_stats): New function.
9594 * archive.h: Declare Object and Read_symbols_data classes.
9595 (Archive::Archive): Add initializers for new members.
9596 (Archive::setup): Add parameter.
9597 (Archive::print_stats): New function.
9598 (Archive::total_archives, Archive::total_members)
9599 (Archive::total_members_loaded): New variables.
9600 (Archive::get_file_and_offset): New function.
9601 (Archive::get_elf_object_for_member): New function.
9602 (Archive::read_all_symbols): New function.
9603 (Archive::read_symbols): New function.
9604 (Archive::Archive_member): New class.
9605 (Archive::members_): New member.
9606 (Archive::num_members_): New member.
9607 * main.cc: Include archive.h.
9608 (main): Call Archive::print_stats.
9609 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9610 archive parameter; member_name is now the fully-decorated name.
9611 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9612 * options.h: (General_options): Add --preread-archive-symbols option.
9613 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9614 Archive::setup.
9615
de4c45bd
ILT
96162008-08-04 Ian Lance Taylor <iant@google.com>
9617
9618 * symtab.h (Symbol::use_plt_offset): New function.
9619 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9620 * powerpc.cc (Relocate::relocate): Likewise.
9621 * sparc.cc (Relocate::relocate): Likewise.
9622 * x86_64.cc (Relocate::relocate): Likewise.
9623 * testsuite/weak_plt.sh: New test.
9624 * testsuite/weak_plt_main.cc: New test.
9625 * testsuite/weak_plt_shared.cc: New test.
9626 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9627 (check_PROGRAMS): Add weak_plt.
9628 (check_DATA): Add weak_plt_shared.so.
9629 (weak_plt_main_pic.o, weak_plt): New targets.
9630 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9631 * testsuite/Makefile.in: Rebuild.
9632
9633 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9634 gcctestdir/ld.
9635 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9636 * testsuite/Makefile.in: Rebuild.
9637
323ee3f4
AM
96382008-08-04 Alan Modra <amodra@bigpond.net.au>
9639
9640 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9641 * Makefile.in: Regenerate.
9642 * po/POTFILES.in: Regenerate.
9643
7c07ecec
ILT
96442008-07-29 Ian Lance Taylor <iant@google.com>
9645
9646 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9647 symbols before other symbols.
9648 * testsuite/script_test_2.cc (test_addr): Declare.
9649 (test_addr_alias): Declare.
9650 (main): Check that test_addr and test_addr_alias have the right
cd536b21 9651 values.
7c07ecec
ILT
9652 * testsuite/script_test_2.t: Define test_addr_alias and
9653 test_addr.
9654
5778530e
ILT
96552008-07-24 Ian Lance Taylor <iant@google.com>
9656
2a00e4fb
ILT
9657 PR 5990
9658 * descriptors.cc: New file.
9659 * descriptors.h: New file.
9660 * gold-threads.h (class Hold_optional_lock): New class.
9661 * fileread.cc: Include "descriptors.h".
9662 (File_read::~File_read): Release descriptor rather than closing
9663 it.
9664 (File_read::open) [file]: Call open_descriptor rather than open.
9665 Set is_descriptor_opened_.
9666 (File_read::open) [memory]: Assert that descriptor is not open.
9667 (File_read::reopen_descriptor): New function.
9668 (File_read::release): Release descriptor.
9669 (File_read::do_read): Make non-const. Reopen descriptor.
9670 (File_read::read): Make non-const.
9671 (File_read::make_view): Reopen descriptor.
9672 (File_read::do_readv): Likewise.
9673 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9674 Update declarations.
9675 * layout.cc: Include "descriptors.h".
9676 (Layout::create_build_id): Use open_descriptor rather than open.
9677 * output.cc: Include "descriptors.h".
9678 (Output_file::open): Use open_descriptor rather than open.
9679 * archive.cc (Archive::const_iterator): Change Archive to be
9680 non-const.
9681 (Archive::begin, Archive::end): Make non-const.
9682 (Archive::count_members): Likewise.
9683 * archive.h (class Archive): Update declarations.
9684 * object.h (Object::read): Make non-const.
9685 * Makefile.am (CCFILES): Add descriptors.cc.
9686 (HFILES): Add descriptors.h.
9687 * Makefile.in: Rebuild.
9688
801647d1
ILT
9689 PR 6716
9690 * gold.h: Always include <clocale>. Add Solaris workarounds
9691 following code in binutils/sysdep.h.
9692
5edd166e
ILT
9693 PR 6048
9694 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9695 this->eh_frame_hdr_ is NULL before using it.
9696
c89ad728
ILT
9697 * dynobj.cc (Versions::Versions): Update comment.
9698
aa86f06b
ILT
9699 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9700 the base version name.
9701
5778530e
ILT
9702 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9703 array size plus one.
9704 (Stringpool_template::set_string_offsets): Subtract one from key
9705 before using it as an array index.
9706 (Stringpool_template::get_offset_with_length): Likewise.
9707 (Stringpool_template::write_to_buffer): Likewise.
9708 * stringpool.h (Stringpool_template::get_offset_from_key):
9709 Likewise.
9710
057ead22
ILT
97112008-07-23 Ian Lance Taylor <iant@google.com>
9712
7f649c59
ILT
9713 PR 6658
9714 * object.h (Merged_symbol_value::value): Do our best to handle a
9715 negative addend.
9716
057ead22
ILT
9717 PR 6647
9718 * script.cc (Version_script_info::get_versions): Don't add empty
9719 version tag to return value.
9720 (Version_script_info::get_symbol_version_helper): Change return
9721 type to bool. Add pversion parameter. Change all callers.
9722 (script_register_vers_node): Don't require a non-NULL tag.
9723 * script.h (class Version_script_info): Update declarations.
9724 (Version_script_info::get_symbol_version): Change return type to
9725 bool. Add version parameter. Change all callers.
9726 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9727 handling. Handle an empty version from a version script.
9728 (Symbol_table::define_special_symbol): Likewise.
9729 * testsuite/ver_test_10.script: New file.
9730 * testsuite/ver_test_10.sh: New file.
9731 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9732 (check_DATA): Add ver_test_10.syms.
9733 (ver_test_10.syms, ver_test_10.so): New target.
9734 * testsuite/Makefile.in: Rebuild.
9735
58e54ac2
CD
97362008-07-23 Simon Baldwin <simonb@google.com>
9737
9738 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9739 to zero for undefined symbols from dynamic libraries.
9740
95d14cd3
ILT
97412008-07-23 Ian Lance Taylor <iant@google.com>
9742
9743 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9744 Change all callers.
9745 * symtab.h (class Symbol_table): Update declaration.
9746 * testsuite/ver_test_9.cc: New file.
9747 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9748 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9749 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9750 (ver_test_9.so, ver_test_9.o): New targets.
9751 * testsuite/Makefile.in: Rebuild.
9752
92de84a6
ILT
97532008-07-22 Ian Lance Taylor <iant@google.com>
9754
34810851
ILT
9755 * options.h (class General_options): Define --check-sections.
9756 * layout.cc (Layout::set_segment_offsets): Handle
9757 --check-sections.
9758
af6156ef
ILT
9759 * options.h (class General_options): Define -n/--nmagic and
9760 -N/--omagic.
9761 * options.cc (General_options::finalize): For -n/--nmagic or
9762 -N/--omagic, set -static.
9763 * layout.cc (Layout::attach_allocated_section_to_segment): If
9764 -N/--omagic, don't put read-only and read-write sections in
9765 different segments.
9766 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9767 finding a read-only segment.
9768 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9769 don't set the minimum segment alignment to the common page size,
9770 and don't set the file offset to the address modulo the page size.
9771 * script-sections.cc (Script_sections::create_segments): If
9772 -n/--omagic, don't put read-only and read-write sections in
9773 different segments.
9774
92de84a6
ILT
9775 * cref.cc: New file.
9776 * cref.h: New file.
9777 * options.h (class General_options): Add --print-symbol-counts.
9778 * main.cc (main): Issue defined symbol report if requested.
9779 * archive.cc (Archive::interpret_header): Make into a const member
9780 function.
9781 (Archive::add_symbols): Call Input_objects::archive_start and
9782 archive_stop.
9783 (Archive::const_iterator): Define new class.
9784 (Archive::begin, Archive::end): New functions.
9785 (Archive::include_all_members): Rewrite to use iterator.
9786 (Archive::count_members): New function.
9787 * archive.h (class Archive): Update declarations.
9788 (Archive::filename): New function.
9789 * object.cc: Include "cref.h".
9790 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9791 (Sized_relobj::do_get_global_symbol_counts): New function.
9792 (Input_objects::add_object): Add object to cross-referencer.
9793 (Input_objects::archive_start): New function.
9794 (Input_objects::archive_stop): New function.
9795 (Input_objects::print_symbol_counts): New function.
9796 * object.h: Declare Cref and Archive.
9797 (Object::get_global_symbol_counts): New function.
9798 (Object::do_get_global_symbol_counts): New pure virtual function.
9799 (class Sized_relobj): Add defined_count_ field. Update
9800 declarations.
9801 (class Input_objects): Add cref_ field. Update constructor.
9802 Update declarations.
9803 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9804 defined_count_.
9805 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9806 symbol counts.
9807 (Sized_dynobj::do_get_global_symbol_counts): New function.
9808 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9809 defined_count_. Update declarations. Define Symbols typedef.
9810 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9811 parameter. Change all callers.
9812 (Symbol_table::add_from_dynobj): Add sympointers and defined
9813 parameters. Change all callers.
9814 * symtab.h (class Symbol_table): Update declarations.
9815 * Makefile.am (CCFILES): Add cref.cc.
9816 (HFILES): Add cref.h.
9817 * Makefile.in: Rebuild.
9818
3f7c5e1d
CD
98192008-07-22 Simon Baldwin <simonb@google.com>
9820
9821 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9822 to zero when writing undefined symbols.
9823
e0b64032
ILT
98242008-07-22 Ian Lance Taylor <iant@google.com>
9825
9826 * output.cc (Output_section::add_input_section): Don't try to
9827 merge empty merge sections.
9828
096b02cf
CS
98292008-07-21 Craig Silverstein <csilvers@google.com>
9830
9831 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9832 Include symbol version in error message.
cd536b21 9833
1d1f116d
CD
98342008-07-20 Chris Demetriou <cgd@google.com>
9835
cd536b21 9836 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
9837 (RANDOM_SEED_CFLAGS): New substituted variable.
9838 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9839 * configure: Rebuild.
9840 * Makefile.in: Likewise.
9841 * testsuite/Makefile.in: Likewise.
9842
a18f591e
ILT
98432008-07-18 Ian Lance Taylor <iant@google.com>
9844
9845 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9846 where we see NAME/NULL and NAME/VERSION as separate symbols.
9847 * testsuite/ver_test_main.cc (main): Call t4.
9848 (t4, t4_2a): Define.
9849 * testsuite/ver_test_2.cc (t4_2): Define.
9850 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9851 * testsuite/ver_test_4.cc (t4_2a): Define.
9852 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9853 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9854
c6e3f6ed
ILT
98552008-07-17 Ian Lance Taylor <iant@google.com>
9856
9857 * dynobj.cc (Versions::add_def): If we give an error about a
9858 missing version, go ahead and create the version anyhow.
9859
ef9beddf
ILT
98602008-07-10 Ian Lance Taylor <iant@google.com>
9861
9862 Handle output sections with more than 0x7fffffff bytes.
9863 * object.h (class Relobj): Change map_to_output_ to
9864 output_sections_, and just keep a section pointer. Change all
9865 uses. Move comdat group support to Sized_relobj.
9866 (Relobj::is_section_specially_mapped): Remove.
9867 (Relobj::output_section): Remove poff parameter. Change all
9868 callers.
9869 (Relobj::output_section_offset): New function.
9870 (Relobj::set_section_offset): Rewrite.
9871 (Relobj::map_to_output): Remove.
9872 (Relobj::output_sections): New function.
9873 (Relobj::do_output_section_offset): New pure virtual function.
9874 (Relobj::do_set_section_offset): Likewise.
9875 (class Sized_relobj): Add section_offsets_ field. Add comdat
9876 group support from Relobj. Update declarations.
9877 (Sized_relobj::get_output_section_offset): New function.
9878 (Sized_relobj::do_output_section_offset): New function.
9879 (Sized_relobj::do_set_section_offset): New function.
9880 * object.cc (Relobj::output_section_address): Remove.
9881 (Sized_relobj::Sized_relobj): Initialize new fields.
9882 (Sized_relobj::include_section_group): Cast find_kept_object to
9883 Sized_relobj.
9884 (Sized_relobj::include_linkonce_section): Likewise.
9885 (Sized_relobj::do_layout): Use separate arrays for output section
9886 and output offset.
9887 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9888 output_sections.
9889 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9890 output_sections and section_offsets.
9891 (Sized_relobj::write_local_symbols): Likewise.
9892 (map_to_kept_section): Compute output address directly.
9893 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9894 output_sections and section_offsets.
9895 (Sized_relobj::write_sections): Likewise.
9896 (Sized_relobj::relocate_sections): Likewise.
9897 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9898 * output.h (class Output_reloc): Update declarations. Change
9899 u2_.relobj to Sized_relobj*.
9900 (class Output_data_reloc): Change add functions to use
9901 Sized_relobj*.
9902 * output.cc (Output_reloc::Output_reloc): Change relobj to
9903 Sized_relobj*.
9904 (Output_reloc::local_section_offset): Change return type to
9905 Elf_Addr. Use get_output_section_offset.
9906 (Output_reloc::get_address): Likewise.
9907 (Output_section::is_input_address_mapped): Don't call
9908 is_section_specially_mapped.
9909 (Output_section::output_offset): Likewise.
9910 (Output_section::output_address): Likewise.
9911 (Output_section::starting_output_address): Likewise.
9912 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9913 parameter to Sized_relobj*.
9914 (Copy_relocs::need_copy_reloc): Likewise.
9915 (Copy_relocs::save): Likewise.
9916 * copy-relocs.h (class Copy_relocs): Update declarations.
9917 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9918 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9919 * target-reloc.h (relocate_for_relocatable): Change
9920 offset_in_output_section type to Elf_Addr. Change code that uses
9921 it as well.
9922 * layout.cc (Layout::layout): Always set *off.
9923 * mapfile.cc (Mapfile::print_input_section): Use
9924 output_section_offset.
9925 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9926 Sized_relobj*.
9927 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9928 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9929 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9930
5cb66f97
ILT
99312008-07-03 Ian Lance Taylor <iant@google.com>
9932
9933 * layout.cc (Layout::include_section): Do not discard unrecognized
9934 SHT_STRTAB sections.
9935
afe47622
CS
99362008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9937
9938 * script.cc (Lex::can_continue_name): Make '?' allowable in
9939 version-script names.
9940 * testsuite/version_script.map: Change glob pattern to use '?'
9941
5adf9721
ILT
99422008-06-30 Manish Singh <yosh@gimp.org>
9943
9944 PR 6585
9945 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9946 Correct typo.
9947
e6fde208
ILT
99482008-06-30 Ian Lance Taylor <iant@google.com>
9949
9950 PR 6660
9951 PR 6682
9952 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9953 versions]: Don't try to read the value in the contents, since we
9954 don't use it. Use the template endianness when writing.
9955
3f2e6a2d
CC
99562008-06-25 Cary Coutant <ccoutant@google.com>
9957
9958 * fileread.cc (File_read::make_view): Assert on zero-length view.
9959 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9960 symbol table when there are no symbols to read.
9961
c43d3a48
CS
99622008-06-23 Craig Silverstein <csilvers@google.com>
9963
9964 * version.cc (version_string): Bump to 1.7
9965
5f494ea0
CS
99662008-06-18 Craig Silverstein <csilvers@google.com>
9967
9968 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9969 constant 0xFFFF to type Valtype.
9970 (Powerpc_relocate_functions::rel16_ha): Likewise.
9971
c42e122e
ILT
99722008-06-17 Ian Lance Taylor <iant@google.com>
9973
f34787f8
ILT
9974 * output.h (Output_section::Input_section): Initialize p2align_ to
9975 zero for Output_section_data constructors.
9976 (Output_section::Input_section::addralign): If not an input
9977 section, return the alignment of the Output_section_data.
9978 * testsuite/copy_test.cc: New file.
9979 * testsuite/copy_test_1.cc: New file.
9980 * testsuite/copy_test_2.cc: New file.
9981 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9982 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9983 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9984 (copy_test_1_pic.o, copy_test_1.so): New targets.
9985 (copy_test_2_pic.o, copy_test_2.so): New targets.
9986 * testsuite/Makefile.in: Rebuild.
9987
c42e122e
ILT
9988 * script-sections.cc (Script_sections::place_orphan): Initialize
9989 local variable exact.
9990
ce3ac18a
DE
99912008-06-13 David Edelsohn <edelsohn@gnu.org>
9992
9993 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9994
42cacb20
DE
99952008-06-12 David Edelsohn <edelsohn@gnu.org>
9996 David S. Miller <davem@davemloft.net>
9997
9998 * powerpc.cc: New file.
9999 * Makefile.am (TARGETSOURCES): Add powerpc.cc
10000 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
10001 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
10002 * Makefile.in: Rebuild.
10003
7b308235
ILT
100042008-06-09 Ian Lance Taylor <iant@google.com>
10005
10006 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
10007 <exception>.
10008 (throwing, orig_terminate): New static variables.
10009 (terminate_handler): New static function.
10010 (t2): Set terminate handler.
10011
f0b886e3
ILT
100122008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
10013
10014 PR 6584
cd536b21 10015 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
10016 alignment.
10017
3e90f135
CC
100182008-05-30 Cary Coutant <ccoutant@google.com>
10019
10020 * archive.cc (Archive::include_all_members) Correct to step
10021 over symbol table and extended name table in thin archives.
10022
e09ad04a
ILT
100232008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
10024
10025 PR 6407
10026 * target-reloc.h (relocate_for_relocatable): Fix new_offset
10027 calculation.
10028
62b01cb5
ILT
100292008-05-28 Caleb Howe <cshowe@google.com>
10030
10031 * reduced_debug_output.cc: New file.
10032 * reduced_debug_output.h: New file.
92de84a6 10033 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
10034 * options.cc (General_options::finalize): Add strip_debug_non_line
10035 to the strip heirarchy.
10036 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
10037 fields.
10038 * layout.cc: Include "reduced_debug_output.h".
10039 (Layout::Layout): Initialize new fields.
10040 (line_only_debug_sections): New static array.
10041 (is_lines_only_debug_sections): New static inline function.
10042 (Layout::include_section): Handle --strip-debug-non-line.
10043 (Layout::make_output_section): If --strip-debug-non-line, build
10044 new output sections for .debug_abbrev and .debug_info.
10045 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
10046 gold. Warn about possible overflow.
10047 (read_signed_LEB_128): Likewise.
10048 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
10049 (read_signed_LEB_128): Declare.
10050 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
10051 (HFILES): Add reduced_debug_output.h.
10052 * Makefile.in: Rebuild.
10053
7d9e3d98
ILT
100542008-05-21 Ian Lance Taylor <iant@google.com>
10055
10056 * mapfile.cc: New file.
10057 * mapfile.h: New file.
10058 * options.h (class General_options): Add -M/--print-map and -Map.
10059 * options.cc (General_options::finalize): Make -M equivalent to
10060 -Map -.
10061 * main.cc: Include <cstdio> and "mapfile.h".
10062 (main): Open mapfile if requested.
10063 * gold.cc (class Middle_runner): Add mapfile_ field. Update
10064 constructor. Change caller.
10065 (queue_initial_tasks): Add mapfile parameter. Change caller.
10066 (queue_middle_tasks): Likewise.
10067 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
10068 declarations.
10069 * archive.cc: Include "mapfile.h".
10070 (Archive::add_symbols): Add mapfile parameter. Change all
10071 callers. Pass mapfile, symbol, and reason to include_member.
10072 (Archive::include_all_members): Add mapfile parameter. Change all
10073 callers.
10074 (Archive::include_member): Add mapfile, sym, and why parameters.
10075 Change all callers. Report inclusion to map file.
10076 * archive.h: Include "fileread.h".
10077 (class Archive): Update declarations.
10078 (Archive::file): New const method.
10079 (class Add_archive_symbols): Add mapfile_ field. Update
10080 constructor. Change all callers.
10081 * readsyms.h (class Read_symbols): Likewise.
10082 (class Finish_group): Likewise.
10083 (class Read_script): Likewise.
10084 * common.cc: Include "mapfile.h".
10085 (Symbol_table::allocate_commons): Add mapfile parameter. Change
10086 all callers.
10087 (Symbol_table::do_allocate_commons): Likewise.
10088 (Symbol_table::do_allocate_commons_list): Likewise. Report common
10089 symbol allocation to mapfile.
10090 * common.h (class Allocate_commons_task): Add mapfile_ field.
10091 Update constructor. Change all callers.
10092 * symtab.h (class Symbol_table): Update declarations.
10093 * layout.cc: Include "mapfile.h".
10094 (Layout_task_runner::run): Print information to mapfile.
10095 (Layout::create_gold_note): Change Output_data_fixed_space to
10096 Output_data_zero_fill.
10097 (Layout::create_build_id): Likewise.
10098 (Layout::print_to_mapfile): New function.
10099 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
10100 constructor. Change caller.
10101 (class Layout): Declare print_to_mapfile.
10102 * output.cc (Output_section::Input_section::print_to_mapfile): New
10103 function.
10104 (Output_section::add_input_section): If producing a map, always
10105 add to input_sections_ list.
10106 (Output_section::do_print_to_mapfile): New function.
10107 (Output_segment::print_sections_to_mapfile): New function.
10108 (Output_segment::print_section_list_to_mapfile): New function.
10109 * output.h: Include "mapfile.h".
10110 (Output_data::print_to_mapfile): New function.
10111 (Output_data::do_print_to_mapfile): New virtual function.
10112 (Output_segment_headers::do_print_to_mapfile): New function.
10113 (Output_file_header::do_print_to_mapfile): New function.
10114 (Output_data_const::do_print_to_mapfile): New function.
10115 (class Output_data_const_buffer): Add map_name_ field. Update
10116 constructor. Change all callers. Add do_print_to_mapfile
10117 function.
10118 (class Output_data_fixed_space): Likewise.
10119 (class Output_data_space): Likewise.
10120 (class Output_data_zero_fill): New class.
10121 (Output_data_strtab::do_print_to_mapfile): New function.
10122 (Output_data_reloc_base::do_print_to_mapfile): New function.
10123 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10124 (Output_data_group::do_print_to_mapfile): New function.
10125 (Output_data_got::do_print_to_mapfile): New function.
10126 (Output_data_dynamic::do_print_to_mapfile): New function.
10127 (Output_symtab_xindex::do_print_to_mapfile): New function.
10128 (class Output_section): Declare do_print_to_mapflie. Declare
10129 print_to_mapfile in Input_section.
10130 (class Output_segment): Declare new functions.
10131 * object.h (Sized_relobj::symbol_count): New function.
10132 * script-sections.cc
10133 (Output_section_element_dot_assignment::set_section_addresses):
10134 Change Output_data_fixed_space to Output_data_zero_fill.
10135 (Output_data_expression::do_print_to_mapfile): New function.
10136 * script.cc (read_input_script): Add mapfile parameter. Change
10137 all callers.
10138 * script.h (read_input_script): Update declaration.
10139 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10140 (Eh_frame::do_print_to_mapfile): New function.
10141 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10142 (Output_merge_string::do_print_to_mapfile): New function.
10143 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10144 function.
10145 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10146 function.
10147 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10148 function.
10149 * Makefile.am (CCFILES): Add mapfile.cc.
10150 (HFILES): Add mapfile.h.
10151 * Makefile.in: Rebuild.
10152
9f1d377b
ILT
101532008-05-19 Ian Lance Taylor <iant@google.com>
10154
10155 * options.h (class General_options): Add -z relro.
10156 * layout.cc (Layout::Layout): Initialize relro_segment_.
10157 (Layout::add_output_section_data): Return the output section.
10158 (Layout::make_output_section): Rcognize relro sections and mark
10159 them appropriately.
10160 (Layout::attach_allocated_section_to_segment): Put relro sections
10161 in a PT_GNU_RELRO segment.
10162 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10163 section as relro.
10164 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10165 PT_TLS segments.
10166 (Layout::linkonce_mapping): Map d.rel.ro.local to
10167 .data.rel.ro.local.
10168 (Layout::output_section_name): Us .data.rel.ro.local for any
10169 section which begins with that.
10170 * layout.h (class Layout): Update add_output_section_data
10171 declaration. Add relro_segment_ field.
10172 * output.cc (Output_section::Output_section): Initialize is_relro_
10173 and is_relro_local_ fields.
10174 (Output_segment::add_output_section): Group relro sections.
10175 (Output_segment::is_first_section_relro): New function.
10176 (Output_segment::maximum_alignment): If there is a relro section,
10177 align the segment to the common page size.
10178 (Output_segment::set_section_addresses): Track whether we are
10179 looking at relro sections. If the last section is a relro
10180 section, align to the common page size.
10181 (Output_segment::set_section_list_addresses): Add in_relro
10182 parameter. Change all callers. Align to the page size when
10183 moving from relro to non-relro section.
10184 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10185 segment.
10186 * output.h (class Output_section): Add is_relro_ and
10187 is_relro_local_ fields.
10188 (Output_section::is_relro): New function.
10189 (Output_section::set_is_relro): New function.
10190 (Output_section::is_relro_local): New function.
10191 (Output_section::set_is_relro_local): New function.
10192 (class Output_segment): Update declarations.
10193 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10194 * sparc.cc (Target_sparc::got_section): Likewise.
10195 * x86_64.cc (Target_x86_64::got_section): Likewise.
10196 * testsuite/relro_test_main.cc: New file.
10197 * testsuite/relro_test.cc: New file.
10198 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10199 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10200 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10201 (relro_test.so, relro_test_pic.o): New targets.
10202 * testsuite/Makefile.in: Rebuild.
10203
a984ee1d
ILT
102042008-05-16 Ian Lance Taylor <iant@google.com>
10205
01676dcd
ILT
10206 * output.cc (Output_segment::add_output_section): Remove front
10207 parameter.
10208 * output.h (class Output_segment): Remove
10209 add_initial_output_section and overloaded add_output_section.
10210 Update declaration of remaining add_output_section.
10211 * layout.cc (Layout::create_interp): Call add_output_section
10212 rather than add_initial_output_section.
10213 (Layout::finish_dynamic_section): Likewise.
10214
497897f9
ILT
10215 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10216 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10217 know the dynamic type.
10218 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10219 field. Initialize it in constructor.
10220 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10221 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10222 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10223 reloc.
10224
a984ee1d
ILT
10225 * output.cc (Output_reloc::get_address): Change return type to
10226 Elf_Addr.
10227 * output.h (class Output_reloc): Update get_address declaration.
10228 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10229 for section addresses.
10230
55ba0940
ILT
102312008-05-09 Ian Lance Taylor <iant@google.com>
10232
10233 PR 6493
10234 * gold.cc (gold_nomem): Use return value of write.
10235
75517b77
ILT
102362008-05-08 Ian Lance Taylor <iant@google.com>
10237
10238 * symtab.c (Symbol::init_base_output_data): Add version
10239 parameter. Change all callers.
10240 (Symbol::init_base_output_segment): Likewise.
10241 (Symbol::init_base_constant): Likewise.
10242 (Symbol::init_base_undefined): Likewise.
10243 (Sized_symbol::init_output_data): Likewise.
10244 (Sized_symbol::init_output_segment): Likewise.
10245 (Sized_symbol::init_constant): Likewise.
10246 (Sized_symbol::init_undefined): Likewise.
10247 (Symbol_table::do_define_in_output_data): If the new symbol has a
10248 version, mark it as the default.
10249 (Symbol_table::do_define_in_output_segment): Likewise.
10250 (Symbol_table::do_define_as_constant): Likewise.
10251 * symtab.h (class Symbol): Update declarations.
10252 (class Sized_symbol): Likewise.
10253 * resolve.cc (Symbol::override_version): New function.
c42e122e 10254 (Symbol::override_base): Call override_version.
75517b77
ILT
10255 (Symbol::override_base_with_special): Likewise.
10256 * testsuite/ver_script_8.script: New file.
10257 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10258 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10259 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10260 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10261
f1f70eae
ILT
102622008-05-06 Ian Lance Taylor <iant@google.com>
10263
f3e9c5c5
ILT
10264 PR 6049
10265 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10266 functions.
10267 (class General_options): Remove existing --undefined, and add
10268 --no-undefined instead. Add new --undefined as synonym for -u.
10269 * archive.cc (Archive::add_symbols): Check whether symbol was
10270 named with -u.
10271 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10272 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10273 all uses. Add IS_UNDEFINED. Update declarations to split
10274 different versions of init_base. Declare init_base_undefined.
10275 (Symbol::is_defined): Handle IS_UNDEFINED.
10276 (Symbol::is_undefined): Likewise.
10277 (Symbol::is_weak_undefined): Call is_undefined.
10278 (Symbol::is_absolute): Handle IS_CONSTANT.
10279 (class Sized_symbol): Update declarations to split different
10280 versions of init. Declare init_undefined.
10281 (class Symbol_table): Declare new functions.
10282 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10283 Change all callers.
10284 (Symbol::init_base_output_data): Likewise.
10285 (Symbol::init_base_output_segment): Likewise.
10286 (Symbol::init_base_constant): Likewise.
10287 (Symbol::init_base_undefined): New function.
10288 (Sized_symbol::init_object): Rename from init. Change all
10289 callers.
10290 (Sized_symbol::init_output_data): Likewise.
10291 (Sized_symbol::init_output_segment): Likewise.
10292 (Sized_symbol::init_constant): Likewise.
10293 (Sized_symbol::init_undefined): New function.
10294 (Symbol_table::add_undefined_symbols_from_command_line): New
10295 function.
10296 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10297 function.
10298 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10299 (Symbol::output_section): Likewise.
10300 (Symbol::set_output_section): Likewise.
10301 (Symbol_table::sized_finalize_symbol): Likewise.
10302 (Symbol_table::sized_write_globals): Likewise.
10303 * resolve.cc (Symbol_table::should_override): Likewise.
10304 (Symbol::override_base_with_special): Likewise.
10305
8bdcdf2c
ILT
10306 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10307 symbol, change it to have default visibility.
10308 * testsuite/protected_1.cc: New file.
10309 * testsuite/protected_2.cc: New file.
10310 * testsuite/protected_3.cc: New file.
10311 * testsuite/protected_main_1.cc: New file.
10312 * testsuite/protected_main_2.cc: New file.
10313 * testsuite/protected_main_3.cc: New file.
10314 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10315 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10316 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10317 (protected_1.so): New target.
10318 (protected_1_pic.o, protected_2_pic.o): New targets.
10319 (protected_3_pic.o): New target.
10320 (check_PROGRAMS): Add protected_2.
10321 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10322 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10323 * testsuite/Makefile.in: Rebuild.
10324
2b706932
ILT
10325 * options.h (DEFINE_var): Add set_user_set_##varname__.
10326 (DEFINE_bool_alias): New macro.
10327 (class General_options): Define -Bstatic using DEFINE_bool_alias
10328 rather than DEFINE_special. Add --undefined as an alias for -z
10329 defs.
10330 * options.cc (General_options::parse_Bstatic): Remove.
10331
d82a5bcc
ILT
10332 * options.h (class General_options): Add --fatal-warnings.
10333 * main.cc (main): Implement --fatal-warnings.
10334 * errors.h (Errors::warning_count): New function.
10335
f1f70eae
ILT
10336 * options.h (class General_options): Add -Bsymbolic-functions.
10337 * symtab.h (Symbol::is_preemptible): Check for
10338 -Bsymbolic-functions.
10339
8825ac63
ILT
103402008-05-05 Ian Lance Taylor <iant@google.com>
10341
d98bc257
ILT
10342 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10343 as noVARNAME rather than no-VARNAME.
10344 (class General_options): Add option -z combreloc.
10345 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10346 get_address.
10347 (Output_reloc::sort_before) [SHT_REL]: New function.
10348 (Output_reloc::sort_before) [SHT_RELA]: New function.
10349 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10350 Sort_relocs_comparison.
10351 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10352 parameter. Change all callers.
10353 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10354 sort_relocs parameter. Change all callers.
10355 * output.cc (Output_reloc::get_address): New function, broken out
10356 of write_rel.
10357 (Output_reloc::write_rel): Call it.
10358 (Output_reloc::compare): New function.
10359 (Output_data_reloc_base::do_write): Optionally sort relocs.
10360
60b2b4e7
ILT
10361 * configure.ac: If targ_extra_obj is set, link it in.
10362 * configure.tgt: Initialize all variables.
10363 (x86_64*): Set targ_extra_obj and targ_extra_size.
10364 * configure: Rebuild.
10365
8825ac63
ILT
10366 * object.cc (Sized_relobj::include_section_group): Adjust section
10367 indexes read from group data. Build vector to pass to
10368 layout_group.
10369 * layout.cc (Layout::layout_group): Add flags and shndxes
10370 parameters. Remove contents parameter. Change caller. Update
10371 explicit instantiations.
10372 * layout.h (class Layout): Update layout_group declaration.
10373 * output.cc (Output_data_group::Output_data_group): Add flags and
10374 input_shndxes parameters. Remove contents parameter. Change
10375 caller.
10376 (Output_data_group::do_write): Change input_sections_ to
10377 input_shndxes_.
10378 * output.h (class Output_data_group): Update constructor
10379 declaration. Rename input_sections_ to input_shndxes_.
10380 * testsuite/many_sections_test.cc: Add template.
10381
e94cf127
CC
103822008-04-30 Cary Coutant <ccoutant@google.com>
10383
4418b2d5
CC
10384 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10385
e94cf127
CC
10386 * layout.cc (Layout::include_section): Refactored check for debug
10387 info section.
10388 (Layout::add_comdat): Add new parameters. Change type
10389 of signature parameter. Add object and shndx to signatures table.
10390 (Layout::find_kept_object): New function.
10391 * layout.h: Include <cstring>.
10392 (Layout::is_debug_info_section): New function.
10393 (Layout::add_comdat): Add new parameters.
10394 (Layout::find_kept_object): New function.
10395 (Layout::Kept_section): New struct.
10396 (Layout::Signatures): Change type of map range.
10397 * object.cc (Relobj::output_section_address): New function.
10398 (Sized_relobj::include_section_group): Add new parameters. Change
10399 calls to Layout::add_comdat. Change to build table of kept comdat
10400 groups and table mapping discarded sections to kept sections.
10401 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10402 (Sized_relobj::do_layout): Change calls to include_section_group and
10403 include_linkonce_section.
10404 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10405 value to zero when section is discarded.
10406 (Sized_relobj::map_to_kept_section): New function.
10407 * object.h (Relobj::output_section_address): New function.
10408 (Relobj::Comdat_group): New type.
10409 (Relobj::find_comdat_group): New function.
10410 (Relobj::Comdat_group_table): New type.
10411 (Relobj::Kept_comdat_section): New type.
10412 (Relobj::Kept_comdat_section_table): New type.
10413 (Relobj::add_comdat_group): New function.
10414 (Relobj::set_kept_comdat_section): New function.
10415 (Relobj::get_kept_comdat_section): New function.
10416 (Relobj::comdat_groups_): New field.
10417 (Relobj::kept_comdat_sections_): New field.
10418 (Symbol_value::input_value): Update comment.
10419 (Sized_relobj::map_to_kept_section) New function.
10420 (Sized_relobj::include_linkonce_section): Add new parameter.
10421 * target-reloc.h (Comdat_behavior): New type.
10422 (get_comdat_behavior): New function.
10423 (relocate_section): Add code to map a discarded section to the
10424 corresponding kept section when applying a relocation.
10425
e4e5049b
CS
104262008-04-30 Craig Silverstein <csilvers@google.com>
10427
10428 * dwarf_reader.cc (next_generation_count): New static var.
10429 (Addr2line_cache_entry): New struct.
10430 (addr2line_cache): New static var.
10431 (Dwarf_line_info::one_addr2line): Added caching.
10432 (Dwarf_line_info::clear_addr2line_cache): New function.
10433 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10434 cache-size parameter.
10435 (Dwarf_line_info::one_addr2line_cache): New function.
10436 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10437 new cache-size argument to one_addr2line(), and clear cache.
10438
d09e9154
CC
104392008-04-28 Cary Coutant <ccoutant@google.com>
10440
10441 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10442 R_386_PC8 relocations.
10443
7ef73768
ILT
104442008-04-23 Ian Lance Taylor <iant@google.com>
10445
55438702
ILT
10446 * object.cc (Sized_relobj::include_section_group): Check for
10447 invalid section group.
10448
c165fb93
ILT
10449 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10450 header size.
10451
7ef73768
ILT
10452 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10453 than read for file header.
10454 * archive.cc (Archive::include_member): Likewise.
10455
6194aaab
L
104562008-04-23 Paolo Bonzini <bonzini@gnu.org>
10457
10458 * aclocal.m4: Regenerate.
10459 * configure: Regenerate.
10460
d491d34e
ILT
104612008-04-19 Ian Lance Taylor <iant@google.com>
10462
5ea2bac6
ILT
10463 * version.cc (version_string): Bump to 1.6.
10464
7bc3e21a
ILT
10465 * testsuite/Makefile.am (many_sections_r_test): New target.
10466 (many_sections_r_test_SOURCES): Remove.
10467 (many_sections_r_test_DEPENDENCIES): Remove.
10468 (many_sections_r_test_LDFLAGS): Remove.
10469 (many_sections_r_test_LDADD): Remove.
10470
7fcd3aa9
ILT
10471 * object.cc (Sized_relobj::do_add_symbols): Always pass
10472 local_symbol_count_ to add_from_relobj.
10473
4c94d6ae
ILT
10474 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10475 every thousand variables.
10476 * testsuite/Makefile.in: Rebuild.
10477
d491d34e
ILT
10478 * object.cc (Xindex::initialize_symtab_xindex): New function.
10479 (Xindex::read_symtab_xindex): New function.
10480 (Xindex::sym_xindex_to_shndx): New function.
10481 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10482 available.
10483 (Sized_relobj::do_initialize_xindex): New function.
10484 (Sized_relobj::do_read_symbols): Adjust section links.
10485 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10486 parameter. Change all callers.
10487 (Sized_relobj::include_section_group): Adjust section links and
10488 symbol section indexes.
10489 (Sized_relobj::do_layout): Adjust section links.
10490 (Sized_relobj::do_count_local_symbols): Adjust section links and
10491 symbol section indexes.
10492 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10493 ordinary and special symbols.
10494 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10495 dynsym_xindex parameters. Change all callers. Adjust section
10496 links. Use SHN_XINDEX when needed.
10497 (Sized_relobj::get_symbol_location_info): Adjust section links.
10498 Don't get fooled by special symbols.
10499 * object.h (class Xindex): Define.
10500 (class Object): Add xindex_ parameter. Declare virtual functoin
10501 do_initialize_xindex.
10502 (Object::adjust_sym_shndx): New function.
10503 (Object::set_xindex): New protected function.
10504 (class Symbol_value): Add is_ordinary_shndx_ field.
10505 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10506 (Symbol_value::value): Assert ordinary section.
10507 (Symbol_value::initialize_input_to_output_map): Likewise.
10508 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10509 Change all callers.
10510 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10511 all callers.
10512 (class Sized_relobj): Update declarations.
10513 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10514 parameter. Change all callers.
10515 (Sized_relobj::adjust_shndx): New function.
10516 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10517 field.
10518 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10519 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10520 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10521 (Sized_dynobj::read_dynsym_section): Adjust section links.
10522 (Sized_dynobj::read_dynamic): Likewise.
10523 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10524 section links.
10525 (Sized_dynobj::do_initialize_xindex): New function.
10526 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10527 do_initialize_xindex.
10528 (Sized_dynobj::adjust_shndx): New function.
10529 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10530 dynsym_xindex_ fields.
10531 (Layout::finalize): Add a call to set_section_indexes before
10532 creating the symtab sections.
10533 (Layout::set_section_indexes): Don't do anything if the section
10534 already has a section index.
10535 (Layout::create_symtab_sections): Add shnum parameter. Change
10536 caller. Create .symtab_shndx section if needed.
10537 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10538 caller.
10539 (Layout::allocated_output_section_count): New function.
10540 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10541 needed.
10542 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10543 fields. Update declarations.
10544 (Layout::symtab_xindex): New function.
10545 (Layout::dynsym_xindex): New function.
10546 (class Write_symbols_task): Add layout_ field.
10547 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10548 Change caller.
10549 * output.cc (Output_section_headers::Output_section_headers): Add
10550 shstrtab_section parameter. Change all callers.
10551 (Output_section_headers::do_sized_write): Store overflow values
10552 for section count and section string table section index in
10553 section header zero.
10554 (Output_file_header::do_sized_write): Check for overflow of
10555 section count and section string table section index.
10556 (Output_symtab_xindex::do_write): New function.
10557 (Output_symtab_xindex::endian_do_write): New function.
10558 * output.h (class Output_section_headers): Add shstrtab_section_.
10559 Update declarations.
10560 (class Output_symtab_xindex): Define.
10561 (Output_section::has_out_shndx): New function.
10562 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10563 field.
10564 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10565 Change all callers.
10566 (Sized_symbol::init): Likewise.
10567 (Symbol::output_section): Check for ordinary symbol.
10568 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10569 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10570 callers.
10571 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10572 Change all callers. Simplify handling of symbols from sections
10573 not included in the link.
10574 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10575 distinction.
10576 (Weak_alias_sorter::operator()): Assert that symbols are
10577 ordinary.
10578 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10579 distinction.
10580 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10581 parameters. Change all callers.
10582 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10583 symbol distinction. Use SHN_XINDEX when needed.
10584 (Symbol_table::write_section_symbol): Add symtab_xindex
10585 parameter. Change all callers.
10586 (Symbol_table::sized_write_section_symbol): Likewise. Use
10587 SHN_XINDEX when needed.
10588 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10589 declarations.
10590 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10591 (Symbol::is_defined): Check is_ordinary.
10592 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10593 (Symbol::is_absolute, Symbol::is_common): Likewise.
10594 (class Sized_symbol): Update declarations.
10595 (class Symbol_table): Update declarations.
10596 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10597 parameters. Change all callers.
10598 (Sized_symbol::override): Likewise.
10599 (Symbol_table::override): Likewise.
10600 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10601 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10602 is_ordinary, and orig_st_shndx parameters. Change all callers.
10603 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10604 to be in an ordinary section.
10605 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10606 object and is_ordinary parameters. Change all callers.
10607 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10608 Change all callers. Don't add undefined or non-ordinary symbols
10609 to reloc_map_.
10610 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10611 Change all callers.
10612 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10613 declarations.
10614 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10615 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10616 (Sized_relobj::relocate_sections): Likewise.
10617 * target-reloc.h (scan_relocs): Adjust section symbol index.
10618 (scan_relocatable_relocs): Likewise.
10619 * i386.cc (Scan::local): Check for ordinary symbols.
10620 * sparc.cc (Scan::local): Likewise.
10621 * x86_64.cc (Scan::local): Likewise.
10622 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10623 to symbol_section_and_value.
10624 * testsuite/many_sections_test.cc: New file.
10625 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10626 (check_PROGRAMS): Add many_sections_test.
10627 (many_sections_test_SOURCES): Define.
10628 (many_sections_test_DEPENDENCIES): Define.
10629 (many_sections_test_LDFLAGS): Define.
10630 (BUILT_SOURCES): Add many_sections_define.h.
10631 (many_sections_define.h): New target.
10632 (BUILT_SOURCES): Add many_sections_check.h.
10633 (many_sections_check.h): New target.
10634 (check_PROGRAMS): Add many_sections_r_test.
10635 (many_sections_r_test_SOURCES): Define.
10636 (many_sections_r_test_DEPENDENCIES): Define.
10637 (many_sections_r_test_LDFLAGS): Define.
10638 (many_sections_r_test_LDADD): Define.
10639 (many_sections_r_test.o): New target.
10640 * testsuite/Makefile.in: Rebuild.
10641
c5818ff1
CC
106422008-04-17 Cary Coutant <ccoutant@google.com>
10643
10644 * errors.cc (Errors::info): New function.
10645 (gold_info): New function.
10646 * errors.h (Errors::info): New function.
10647 * gold.h (gold_info): New function.
10648 * object.cc (Input_objects::add_object): Print trace output.
10649 * options.cc (options::parse_set): New function.
10650 (General_options::parse_wrap): Deleted.
10651 (General_options::General_options): Deleted initializer.
10652 * options.h (options::String_set): New typedef.
10653 (options::parse_set): New function.
10654 (DEFINE_set): New macro.
10655 (General_options::wrap): Changed to use DEFINE_set. Changed
10656 callers of any_wrap_symbols and is_wrap_symbol.
10657 (General_options::trace, General_options::trace_symbol):
10658 New options.
10659 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10660 (General_options::wrap_symbols_): Deleted.
10661 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10662
b5be4a7c
DM
106632008-04-17 David S. Miller <davem@davemloft.net>
10664
10665 * options.cc (General_options::parse_V): New function.
10666 * options.h: Add entries for -V and -Qy.
10667
155a0dd7
ILT
106682008-04-17 Ian Lance Taylor <iant@google.com>
10669
10670 * common.cc (Symbol_table::allocate_commons): Remove options
10671 parameter. Change caller.
10672 (Symbol_table::do_allocate_commons): Remove options parameter.
10673 Change caller. Just call do_allocate_commons_list twice.
10674 (Symbol_table::do_allocate_commons_list): New function, broken out
10675 of do_allocate_commons.
10676 * common.h (class Allocate_commons_task): Remove options_ field.
10677 Update constructor.
10678 * symtab.cc (Symbol_table::Symbol_table): Initialize
10679 tls_commons_.
10680 (Symbol_table::add_from_object): Put TLS common symbols on
10681 tls_commons_ list.
10682 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10683 which are IN_OUTPUT_DATA.
10684 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10685 allocate_commons and do_allocate_commons declarations. Declare
10686 do_allocate_commons_list.
10687 * gold.cc (queue_middle_tasks): Update creation of
10688 Allocate_commons_task to not pass options.
10689 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10690 (TLS_TEST_C_FLAGS): New variable.
10691 (tls_test_c_pic.o): New target.
10692 (tls_test_shared.so): Link in tls_test_c_pic.o.
10693 (tls_test_c_pic_ie.o): New target.
10694 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10695 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10696 (tls_test_c.o): New target.
10697 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10698 (tls_pic_test_LDADD): Likewise.
10699 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10700 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10701 (tls_test_c_gnu2.o): New target.
10702 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10703 tls_test_c_gnu2.o.
10704 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10705 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10706 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10707 * testsuite/tls_test.cc: Include "config.h".
10708 (t_last): Call t11_last.
10709 * testsuite/tls_test.h (t11, t11_last): Declare.
10710 * testsuite/tls_test_c.c: New file.
10711 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10712 * configure.ac: Check for OpenMP support.
10713 * configure, config.in, Makefile.in: Rebuild.
10714 * testsuite/Makefile.in: Rebuild.
10715
edfbb029
CC
107162008-04-16 Cary Coutant <ccoutant@google.com>
10717
10718 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10719 (Target_i386::tls_base_symbol_defined_): New field.
10720 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10721 (Target_i386::Scan::global): Likewise.
10722 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10723 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10724 (Target_x86_64::tls_base_symbol_defined_): New field.
10725 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10726 (Target_x86_64::Scan::global): Likewise.
10727
f3c69fca
CC
107282008-04-16 Cary Coutant <ccoutant@google.com>
10729
10730 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10731 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10732 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10733 building shared libraries.
10734 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10735 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10736 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10737 * testsuite/Makefile.in: Rebuild.
10738 * testsuite/weak_undef.h: New file.
10739 * testsuite/weak_undef_file1.cc: Add extra test cases.
10740 * testsuite/weak_undef_file2.cc: Likewise.
10741 * testsuite/weak_undef_test.cc: Likewise.
10742
7c414435
DM
107432008-04-16 David S. Miller <davem@davemloft.net>
10744
32b769e1
DM
10745 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10746 Add issued_non_pic_error_ field. Declare check_non_pic.
10747 (Target_sparc::Scan::check_non_pic): New function.
10748 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10749 (Target_sparc::Scan::global): Likewise.
10750
11936fb1
DM
10751 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10752 * configure: Rebuild.
10753
7c414435
DM
10754 * options.h (DEFINE_enable): New macro.
10755 (new_dtags): New enable option.
10756 (initfirst, interpose, loadfltr, nodefaultlib,
10757 nodelete, nodlopen, nodump): New -z options.
10758 * layout.cc (Layout:finish_dynamic_section): If new
10759 dtags enabled, emit DT_RUNPATH. Also, emit a
10760 DT_FLAGS_1 containing any specified -z flags.
10761
85c7bf8b
ILT
107622008-04-16 Ian Lance Taylor <iant@google.com>
10763
12c0daef
ILT
10764 * copy-relocs.cc: New file.
10765 * copy-relocs.h: New file.
10766 * reloc.cc: Remove Copy_relocs code.
10767 * reloc.h: Likewise.
10768 * reloc-types.h (struct Reloc_types) [both versions]: Add
10769 get_reloc_addend_noerror.
10770 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10771 variants of add_global which take an addend which must be zero.
10772 * i386.cc: Include "copy-relocs.h".
10773 (class Target_i386): Change type of copy_relocs_ to variable,
10774 update initializer.
10775 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10776 Change all callers.
10777 (Target_i386::do_finalize_sections): Change handling of
10778 copy_relocs_.
10779 * sparc.cc: Include "copy-relocs.h".
10780 (class Target_sparc): Change type of copy_relocs_ to variable,
10781 update initializer.
10782 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10783 Change all callers.
10784 (Target_sparc::do_finalize_sections): Change handling of
10785 copy_relocs_.
10786 * x86_64.cc: Include "copy-relocs.h".
10787 (class Target_x86_64): Change type of copy_relocs_ to variable,
10788 update initializer.
10789 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10790 class. Change all callers.
10791 (Target_x86_64::do_finalize_sections): Change handling of
10792 copy_relocs_.
10793 * Makefile.am (CCFILES): Add copy-relocs.cc.
10794 (HFILES): Add copy-relocs.h.
10795
4f4995b6
ILT
10796 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10797
85c7bf8b
ILT
10798 * testsuite/script_test_4.sh: Permit leading zeroes.
10799
4f2a9edd
ILT
108002008-04-15 Ian Lance Taylor <iant@google.com>
10801
e6188289
ILT
10802 * script-sections.cc (Script_sections::create_segments): Use
10803 header_size_adjustment even when there is enough room for the
10804 headers.
10805 * testsuite/script_test_4.sh: New file.
10806 * testsuite/script_test_4.t: New file.
10807 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10808 (check_DATA): Add script_test_4.stdout.
10809 (MOSTLYCLEANFILES): Likewise.
10810 (script_test_4): New target.
10811 (script_test_4.stdout): New target.
10812 * testsuite/Makefile.in: Rebuild.
10813
4f2a9edd
ILT
10814 * sparc.cc: Add definitions for Output_data_plt_sparc class
10815 constants.
10816
f5314dd5
DM
108172008-04-14 David S. Miller <davem@davemloft.net>
10818
10819 * sparc.cc: New file.
10820 * Makefile.am (TARGETSOURCES): Add sparc.cc
10821 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10822 * configure.tgt: Document targ_extra_size and
10823 targ_extra_big_endian. Add entries for sparc-* and
10824 sparc64-*.
10825 * configure.ac: Handle targ_extra_size and
10826 targ_extra_big_endian.
10827 * Makefile.in: Rebuild.
10828 * configure: Likewise.
10829 * po/POTFILES.in: Likewise.
10830 * po/gold.pot: Likewise.
10831
154e0e9a
ILT
108322008-04-14 Ian Lance Taylor <iant@google.com>
10833
10834 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10835 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10836 in the name/type/flags to section mapping. Don't call
10837 allocate_output_section.
10838 (Layout::choose_output_section): Change parameter from adjust_name
10839 to is_input_section. Don't permit input sections after sections
10840 are attached to segments. Don't call allocate_output_section.
10841 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10842 not write_enable_output_section.
10843 (Layout::make_output_section): Don't push to
10844 unattached_section_list_ nor call attach_to_segment. Call
10845 attach_section_to_segment if sections are attached.
10846 (Layout::attach_sections_to_segments): New function.
10847 (Layout::attach_section_to_segment): New function.
10848 (Layout::attach_allocated_section_to_segment): Rename from
10849 attach_to_segment. Remove flags parameter.
10850 (Layout::allocate_output_section): Remove function.
10851 (Layout::write_enable_output_section): Remove function.
10852 * layout.h (class Layout): Update for above changes. Add new
10853 field sections_are_attached_.
10854 * output.h (Output_section::update_flags_for_input_section): New
10855 function.
10856 * output.cc (Output_section::add_input_section): Call
10857 update_flags_for_input_section.
10858 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10859
009a67a2
CC
108602008-04-11 Cary Coutant <ccoutant@google.com>
10861
10862 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10863 thought unnecessary.
10864 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10865
759b1a24
ILT
108662008-04-11 Ian Lance Taylor <iant@google.com>
10867
10868 * output.h (class Output_section_data): Remove inline definition
10869 of set_addralign.
10870 * output.cc (Output_section_data::set_addralign): New function.
10871
c2b45e22
CC
108722008-04-11 Cary Coutant <ccoutant@google.com>
10873
10874 Add support for TLS descriptors for i386 and x86_64.
10875 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10876 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10877 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10878 GOT_TYPE_TLS_DESC.
10879 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10880 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10881 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10882 relocations.
10883 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10884 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10885 Fix problem with initial-exec relocations.
10886 (Target_i386::Relocate::relocate_tls): Likewise.
10887 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10888 relaxation.
10889 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10890 support for section-plus-offset dynamic table entries.
10891 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10892 (Output_data_dynamic::Dynamic_entry): Add support for
10893 section-plus-offset dynamic table entries.
10894 (Output_data_dynamic::Classification): Likewise.
10895 (Output_data_dynamic::classification_): Renamed offset_.
10896 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10897 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10898 (Target_x86_64::make_plt_section): New function.
10899 (Target_x86_64::reserve_tlsdesc_entries): New function.
10900 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10901 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10902 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10903 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10904 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10905 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10906 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10907 add extra PLT entry for TLS descriptors.
10908 (Output_data_plt_x86_64::got_): New field.
10909 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10910 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10911 fields.
10912 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10913 descriptors.
10914 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10915 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10916 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10917 R_386_TLS_DESC_CALL relocations.
10918 (Target_x86_64::Scan::global): Likewise.
10919 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10920 for TLS descriptors.
10921 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10922 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10923 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10924 GD-to-IE relaxation.
10925 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10926 and TLS_DESCRIPTORS.
10927 * Makefile.in: Rebuild.
10928 * configure: Rebuild.
10929 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10930 (tls_test_shared2.so): New target.
10931 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10932 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10933 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10934 (tls_shared_gd_to_ie_test_LDADD): New variable.
10935 (tls_shared_gnu2_gd_to_ie_test): New target.
10936 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10937 New targets.
10938 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10939 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10940 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10941 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10942 (tls_shared_gnu2_test): New target.
10943 (tls_test_gnu2_shared.so): New target.
10944 (tls_shared_gnu2_test_SOURCES): New variable.
10945 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10946 (tls_shared_gnu2_test_LDFLAGS): New variable.
10947 (tls_shared_gnu2_test_LDADD): New variable.
10948 * testsuite/Makefile.in: Rebuild.
10949 * testsuite/Makefile.
10950
83bfb6b7
ILT
109512008-04-11 Ian Lance Taylor <iant@google.com>
10952
10953 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10954 justsyms.t.
10955 * testsuite/Makefile.in: Rebuild.
10956
10957 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10958 long.
10959 * testsuite/script_test_2.cc (main): Adjust test.
10960
706e1f5e
ILT
109612008-04-11 David S. Miller <davem@davemloft.net>
10962 Ian Lance Taylor <iant@google.com>
10963
10964 * options.h (General_options): Add entries for '-Y' and
10965 '-relax'.
10966 * options.cc (General_options:finalize): If -Y was used, add those
10967 entries to the library path instead of the default "/lib" and
10968 "/usr/lib".
10969
7c98e6bb
DM
109702008-04-11 David S. Miller <davem@davemloft.net>
10971
10972 * testsuite/justsyms.t: Start at 0x100.
10973 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
10974 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10975 long.
10976 * testsuite/script_test_2.cc: Adjust string and section length
10977 checks.
7c98e6bb 10978
99a37bfd
ILT
109792008-04-09 Ian Lance Taylor <iant@google.com>
10980
2cefc357
ILT
10981 PR gold/5996
10982 * script-sections.cc (Sections_element::allocate_to_segment): Add
10983 orphan parameter.
10984 (Output_section_definition::allocate_to_segment): Likewise.
10985 (Orphan_output_section::allocate_to_segment): Likewise.
10986 (Script_sections::attach_sections_using_phdrs_clause): Don't
10987 propagate non-PT_LOAD segments to orphan sections.
10988 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10989 readelf rather than objdump.
10990 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10991 .interp section and PT_INTERP segment are the same size.
10992 * testsuite/Makefile.in: Rebuild.
10993
99a37bfd
ILT
10994 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10995 aliases for symbols defined in the same object.
10996 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10997 (weak_alias_test_SOURCES): New variable.
10998 (weak_alias_test_DEPENDENCIES): New variable.
10999 (weak_alias_test_LDFLAGS): New variable.
11000 (weak_alias_test_LDADD): New variable.
11001 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
11002 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
11003 (weak_alias_test_3.o): New target.
11004 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
11005 * testsuite/weak_alias_test_main.cc: New file.
11006 * testsuite/weak_alias_test_1.cc: New file.
11007 * testsuite/weak_alias_test_2.cc: New file.
11008 * testsuite/weak_alias_test_3.cc: New file.
11009
780e49c5
ILT
110102008-04-08 Ian Lance Taylor <iant@google.com>
11011
cdb0b8f5
ILT
11012 * options.h (class General_options): Add --noinhibit-exec option.
11013 * main.cc (main): Check --noinhibit-exec.
11014
0864d551
ILT
11015 * options.h (class General_options): Define --wrap as a special
11016 option. Add wrap_symbols_ field.
11017 (General_options::any_wrap_symbols): New function.
11018 (General_options::is_wrap_symbol): New function.
11019 * options.cc (General_options::parse_wrap): New function.
11020 (General_options::General_options): Initialize wrap_symbols_.
11021 * symtab.cc (Symbol_table::wrap_symbol): New function.
11022 (Symbol_table::add_from_object): Handle --wrap.
11023 * symtab.h (class Symbol_table): Declare wrap_symbol.
11024 * target.h (Target::wrap_char): New function.
11025 (Target::Target_info): Add wrap_char field.
11026 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
11027 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11028 * testsuite/testfile.cc (Target_test::test_target_info):
11029 Likewise.
11030
789aa6de
ILT
11031 * errors.cc (Errors::undefined_symbol): Mention symbol version if
11032 there is one.
11033
2c38906f
ILT
11034 * layout.h (class Layout): Add added_eh_frame_data_ field.
11035 * layout.cc (Layout::Layout): Initialize new field.
11036 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
11037 output section until we find a section we merged successfully.
11038 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
11039 that the size be non-zero.
11040
780e49c5
ILT
11041 * merge.cc (Object_merge_map::get_output_offset): Remove inline
11042 qualifier.
11043
7fcd0256
ILT
110442008-04-08 Craig Silverstein <csilvers@google.com>
11045
11046 * configure.ac: Export new conditional variable HAVE_ZLIB.
11047 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
11048 on HAVE_ZLIB.
11049 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
11050 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11051
6835af53
ILT
110522008-04-07 Ian Lance Taylor <iant@google.com>
11053
e24f324c
ILT
11054 * version.cc (version_string): Set to "1.5".
11055
a036edd8
ILT
11056 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
11057 Add issued_non_pic_error_ field. Declare check_non_pic.
11058 (Target_x86_64::Scan::check_non_pic): New function.
11059 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
11060 (Target_x86_64::Scan::global): Likewise.
11061
624f8810
ILT
11062 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
11063 addend parameter. Change caller. Handle merge sections.
11064 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
11065 Address to Addend. Don't add in the result of
11066 local_section_offset, pass down the addend and use the returned
11067 value.
11068 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
11069 Update declarations of local_section_offset and symbol_value.
11070 * testsuite/two_file_test_1.cc (t18): New function.
11071 * testsuite/two_file_test_2.cc (f18): New function.
11072 * testsuite/two_file_test_main.cc (main): Call t18.
11073 * testsuite/two_file_test.h (t18, f18): Declare.
11074
6835af53
ILT
11075 * configure.ac: Don't test for objdump, c++filt, or readelf.
11076 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
11077 conditionals.
11078 (TEST_READELF): New variable.
11079 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
11080 (check_PROGRAMS): Add two_file_strip_test.
11081 (two_file_strip_test): New target.
11082 (check_PROGRAMS): Add two_file_same_shared_strip_test.
11083 (two_file_same_shared_strip_test_SOURCES): New variable.
11084 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
11085 (two_file_same_shared_strip_test_LDFLAGS): New variable.
11086 (two_file_same_shared_strip_test_LDADD): New variable.
11087 (two_file_shared_strip.so): New target.
11088 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
11089 (ver_test_5.syms, ver_test_7.syms): Likewise.
11090 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
11091 (strip_test_3.stdout): Use TEST_OBJDUMP.
11092 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11093
86925eef
CC
110942008-04-04 Cary Coutant <ccoutant@google.com>
11095
11096 * symtab.h (Symbol::is_weak_undefined): New function.
11097 (Symbol::is_strong_undefined): New function.
11098 (Symbol::is_absolute): New function.
11099 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
11100 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
11101 absolute symbols.
11102 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
11103 (weak_undef_test): New target.
11104 * testsuite/Makefile.in: Rebuild.
11105 * testsuite/weak_undef_file1.cc: New file.
11106 * testsuite/weak_undef_file2.cc: New file.
11107 * testsuite/weak_undef_test.cc: New file.
11108
126f3ece
ILT
111092008-04-03 Craig Silverstein <csilvers@google.com>
11110
11111 * compressed_output.h (class Output_compressed_section): Use
11112 unsigned buffer.
11113 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11114 add zlib header.
11115 (zlib_compressed_suffix): Removed.
11116 (Output_compressed_section::set_final_data_size): Use unsigned
11117 buffers.
11118 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11119 Fix linker invocation.
11120 (flagstest_o_specialfile_and_compress_debug_sections):
11121 Likewise.
11122 * testsuite/Makefile.in: Regenerated.
11123
deae2a14
DM
111242008-04-02 David S. Miller <davem@davemloft.net>
11125
11126 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11127 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11128
70752818
ILT
111292008-04-02 Craig Silverstein <csilvers@google.com>
11130
11131 * TODO: New file.
11132
39d0cb0e
ILT
111332008-04-02 Ian Lance Taylor <iant@google.com>
11134
11135 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11136 parameters. Update for new key type to views_. Change all
11137 callers.
11138 (File_read::read): Adjust for byteshift in returned view.
11139 (File_read::add_view): New function, broken out of
11140 find_and_make_view.
11141 (File_read::make_view): New function, broken out of
11142 find_and_make_view.
11143 (File_read::find_or_make_view): Add offset and aligned
11144 parameters. Rewrite accordingly. Change all callers.
11145 (File_read::get_view): Add offset and aligned parameters. Adjust
11146 for byteshift in return value.
11147 (File_read::get_lasting_view): Likewise.
11148 * fileread.h (class File_read): Update declarations.
11149 (class File_read::View): Add byteshift_ field. Add byteshift to
11150 constructor. Add byteshift method.
11151 * archive.h (Archive::clear_uncached_views): New function.
11152 (Archive::get_view): Add aligned parameter. Change all callers.
11153 * object.h (Object::get_view): Add aligned parameter. Change all
11154 callers.
11155 (Object::get_lasting_view): Likewise.
11156
11157 * fileread.cc (File_read::release): Don't call clear_views if
11158 there are multiple objects.
11159 * fileread.h (File_read::clear_uncached_views): New function.
11160 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11161 on the archive.
11162
a1207466
CC
111632008-03-31 Cary Coutant <ccoutant@google.com>
11164
11165 Add thin archive support.
11166 * archive.cc (Archive::armagt): New const.
11167 (Archive::setup): Remove task parameter and calls to unlock.
11168 (Archive::unlock_nested_archives): New function.
11169 (Archive::read_header): Add nested_off parameter. Change
11170 all callers.
11171 (Archive::interpret_header): Likewise.
11172 (Archive::include_all_members): Change to handle thin
11173 archives.
11174 (Archive::include_member): Likewise.
11175 * archive.h (Archive::Archive): Add new parameters and
11176 initializers.
11177 (Archive::armagt): New const.
11178 (Archive::setup): Remove task parameter.
11179 (Archive::unlock_nested_archives): New function.
11180 (Archive::read_header): Add nested_off parameter.
11181 (Archive::interpret_header): Likewise.
11182 (Archive::Nested_archive_table): New typedef.
11183 (Archive::is_thin_archive_): New field.
11184 (Archive::nested_archives_): New field.
11185 (Archive::options_): New field.
11186 (Archive::dirpath_): New field.
11187 (Archive::task_): New field.
11188 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11189 for thin archives. Pass additional parameters to
11190 Archive::Archive. Unlock the archive file after calling
11191 Archive::setup.
cd536b21 11192
479f6503
ILT
111932008-03-29 Ian Lance Taylor <iant@google.com>
11194
686c8caf
ILT
11195 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11196 version symbol to be local.
11197 * testsuite/ver_test_4.sh: New file.
11198 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11199 (check_DATA): Add ver_test_4.syms.
11200 (ver_test_4.syms): New target.
11201 * testsuite/Makefile.in: Rebuild.
11202
ab794b6b
ILT
11203 * output.cc
11204 (Output_section::Input_section_sort_entry::has_priority): New
11205 function.
11206 (Output_section::Input_section_sort_entry::match_file_name): New
11207 function.
11208 (Output_section::Input_section_sort_entry::match_section_name):
11209 Remove.
11210 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11211 Remove.
11212 (Output_section::Input_section_sort_entry::match_section_file):
11213 Remove.
11214 (Output_section::Input_section_sort_compare::operator()): Rewrite
11215 using new Input_section_sort_entry functions. Sort crtbegin and
11216 crtend first. Sort sections with no priority before sections with
11217 a priority.
11218 * testsuite/initpri1.c (d3): Check j != 4.
11219 (cd5): New constructor/destructor function.
11220 (main): Check j != 2.
11221
479f6503
ILT
11222 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11223 new symbol when resolving, don't call set_is_default.
11224 * testsuite/ver_test_7.cc: New file.
11225 * testsuite/ver_test_7.sh: New file.
11226 * testsuite/Makefile.am (ver_test_7.so): New target.
11227 (ver_test_7.o): New target.
11228 (check_SCRIPTS): Add ver_test_7.sh.
11229 (check_DATA): Add ver_test_7.syms.
11230 (ver_test_7.syms): New target.
11231
2fd32231
ILT
112322008-03-28 Ian Lance Taylor <iant@google.com>
11233
11234 * layout.cc (Layout::layout): If we see an input section with a
11235 name that needs sorting, set the must_sort flag for the output
11236 section.
11237 (Layout::make_output_section): If the name of the output section
11238 indicates that it might require sorting, set the may_sort flag.
11239 * output.h (Output_section::may_sort_attached_input_sections): New
11240 function.
11241 (Output_section::set_may_sort_attached_input_sections): New
11242 function.
11243 (Output_section::must_sort_attached_input_sections): New
11244 function.
11245 (Output_section::set_must_sort_attached_input_sections): New
11246 function.
11247 (class Output_section): Declare Input_section_sort_entry. Define
11248 Input_section_sort_compare. Declare
11249 sort_attached_input_sections. Add new fields:
11250 may_sort_attached_input_sections_,
11251 must_sort_attached_input_sections_,
11252 attached_input_sections_are_sorted_.
11253 * output.cc (Output_section::Output_section): Initialize new
11254 fields.
11255 (Output_section::add_input_section): Add an entry to
11256 input_sections_ if may_sort or must_sort are true.
11257 (Output_section::set_final_data_size): Call
11258 sort_attached_input_sections if necessary.
11259 (Output_section::Input_section_sort_entry): Define new class.
11260 (Output_section::Input_section_sort_compare::operator()): New
11261 function.
11262 (Output_section::sort_attached_input_sections): New function.
11263 * configure.ac: Check whether the compiler supports constructor
11264 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11265 * testsuite/initpri1.c: New file.
11266 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11267 CONSTRUCTOR_PRIORITY.
11268 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11269 (initpri1_LDFLAGS): New variable.
11270 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11271
18e6b24e
ILT
112722008-03-27 Ian Lance Taylor <iant@google.com>
11273
49bdd526
ILT
11274 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11275 * testsuite/common_test_1.c: New file.
11276 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11277 (common_test_1_SOURCES): New variable.
11278 (common_test_1_DEPENDENCIES): New variable.
11279 (common_test_1_LDFLAGS): New variable.
11280
18e6b24e
ILT
11281 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11282 and commons_ correctly when NAME/VERSION does not override
11283 NAME/NULL.
11284 * testsuite/ver_test_6.c: New file.
11285 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11286 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11287 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11288
04bf7072
ILT
112892008-03-26 Ian Lance Taylor <iant@google.com>
11290
5871526f
ILT
11291 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11292 of an undefined symbol from a version script.
11293 * testsuite/Makefile.am (ver_test_5.so): New target.
11294 (ver_test_5.o): New target.
11295 (check_SCRIPTS): Add ver_test_5.sh.
11296 (check_DATA): Add ver_test_5.syms.
11297 (ver_test_5.syms): New target.
11298 * testsuite/ver_test_5.cc: New file.
11299 * testsuite/ver_test_5.script: New file.
11300 * testsuite/ver_test_5.sh: New file.
11301 * Makefile.in, testsuite/Makefile.in: Rebuild.
11302
04bf7072
ILT
11303 PR gold/5986
11304 Fix problems building gold with gcc 4.3.0.
11305 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11306 (gold_error_at_location, gold_warning_at_location): Use it.
11307 * configure.ac: Check whether we can compile and use a template
11308 function with a printf attribute.
11309 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11310 when jumping over bytes.
11311 * object.cc: Instantiate Object::read_section_data.
11312 * debug.h: Include <cstring>
11313 * dwarf_reader.cc: Include <algorithm>
11314 * main.cc: Include <cstring>.
11315 * options.cc: Include <cstring>.
11316 * output.cc: Include <cstring>.
11317 * script.cc: Include <cstring>.
11318 * script.h: Include <string>.
11319 * symtab.cc: Include <cstring> and <algorithm>.
11320 * target-select.cc: Include <cstring>.
11321 * version.cc: Include <string>.
11322 * testsuite/testmain.cc: Include <cstdlib>.
11323 * configure, config.in: Rebuild.
11324
874c5b28
ILT
113252008-03-25 Ian Lance Taylor <iant@google.com>
11326
819d6c3a
ILT
11327 * options.cc: Include "../bfd/bfdver.h".
11328 (options::help): Print bug reporting address.
11329
f4b2c6f5
ILT
11330 * version.cc (print_version): Adjust output for current value of
11331 BFD_VERSION_STRING.
11332
11333 * NEWS: New file.
11334
e96caa79
ILT
11335 * options.cc (options::help): Print list of supported targets.
11336 * target-select.h: Include <vector>.
11337 (class Target_selector): Make machine_, size_, and is_big_endian_
11338 fields const. Add bfd_name_ and instantiated_target_ fields.
11339 (Target_selector::Target_selector): Add bfd_name parameter.
11340 (Target_selector::recognize): Make non-virtual, call
11341 do_recognize.
11342 (Target_selector::recognize_by_name): Make non-virtual, call
11343 do_recognize_by_name.
11344 (Target_selector::supported_names): New function.
11345 (Target_selector::bfd_name): New function.
11346 (Target_selector::do_instantiate_target): New pure virtual
11347 function.
11348 (Target_selector::do_recognize): New virtual function.
11349 (Target_selector::do_recognize_by_name): New virtual function.
11350 (Target_selector::instantiate_target): New private function.
11351 (supported_target_names): Declare.
11352 * target-select.cc (Target_selector::Target_selector): Update for
11353 new parameter and fields.
11354 (select_target_by_name): Check that the name matches before
11355 calling recognize_by_name.
11356 (supported_target_names): New function.
11357 * i386.cc (class Target_selector_i386): Update Target_selector
11358 constructor call. Remove recognize and recognize_by_name. Add
11359 do_instantiate_target.
11360 * x86_64.cc (class Target_selector_x86_64): Likewise.
11361 * testsuite/testfile.cc (class Target_selector_test): Update for
11362 changes to Target_selector.
11363
874c5b28
ILT
11364 * README: Rewrite, with some notes on unsupported features.
11365
0a65a3a7
CC
113662008-03-24 Cary Coutant <ccoutant@google.com>
11367
11368 * i386.cc (Target_i386::Got_type): New enum declaration.
11369 (Target_i386::Scan::local): Updated callers of Output_data_got
11370 member functions.
11371 (Target_i386::Scan::global): Likewise.
11372 (Target_i386::Relocate::relocate): Likewise.
11373 (Target_i386::Relocate::relocate_tls): Likewise.
11374 * object.h (Got_offset_list): New class.
11375 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11376 (Sized_relobj::local_got_offset): Likewise.
11377 (Sized_relobj::set_local_got_offset): Likewise.
11378 (Sized_relobj::local_has_tls_got_offset): Removed.
11379 (Sized_relobj::local_tls_got_offset): Removed.
11380 (Sized_relobj::set_local_tls_got_offset): Removed.
11381 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11382 * output.cc (Output_data_got::add_global): Added got_type parameter.
11383 (Output_data_got::add_global_with_rel): Likewise.
11384 (Output_data_got::add_global_with_rela): Likewise.
11385 (Output_data_got::add_global_pair_with_rel): New function.
11386 (Output_data_got::add_global_pair_with_rela): New function.
11387 (Output_data_got::add_local): Added got_type parameter.
11388 (Output_data_got::add_local_with_rel): Likewise.
11389 (Output_data_got::add_local_with_rela): Likewise.
11390 (Output_data_got::add_local_pair_with_rel): New function.
11391 (Output_data_got::add_local_pair_with_rela): New function.
11392 (Output_data_got::add_global_tls): Removed.
11393 (Output_data_got::add_global_tls_with_rel): Removed.
11394 (Output_data_got::add_global_tls_with_rela): Removed.
11395 (Output_data_got::add_local_tls): Removed.
11396 (Output_data_got::add_local_tls_with_rel): Removed.
11397 (Output_data_got::add_local_tls_with_rela): Removed.
11398 * output.h (Output_data_got::add_global): Added got_type parameter.
11399 (Output_data_got::add_global_with_rel): Likewise.
11400 (Output_data_got::add_global_with_rela): Likewise.
11401 (Output_data_got::add_global_pair_with_rel): New function.
11402 (Output_data_got::add_global_pair_with_rela): New function.
11403 (Output_data_got::add_local): Added got_type parameter.
11404 (Output_data_got::add_local_with_rel): Likewise.
11405 (Output_data_got::add_local_with_rela): Likewise.
11406 (Output_data_got::add_local_pair_with_rel): New function.
11407 (Output_data_got::add_local_pair_with_rela): New function.
11408 (Output_data_got::add_global_tls): Removed.
11409 (Output_data_got::add_global_tls_with_rel): Removed.
11410 (Output_data_got::add_global_tls_with_rela): Removed.
11411 (Output_data_got::add_local_tls): Removed.
11412 (Output_data_got::add_local_tls_with_rel): Removed.
11413 (Output_data_got::add_local_tls_with_rela): Removed.
11414 * resolve.cc (Symbol::override_base_with_special): Removed
11415 reference to has_got_offset_ field.
11416 * symtab.cc (Symbol::init_fields): Replaced initialization
11417 of got_offset_ with got_offsets_. Removed initialization
11418 of has_got_offset_
53fcba31 11419 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
11420 (Symbol::got_offset): Likewise.
11421 (Symbol::set_got_offset): Likewise.
11422 (Symbol::has_tls_got_offset): Removed.
11423 (Symbol::tls_got_offset): Removed.
11424 (Symbol::set_tls_got_offset): Removed.
11425 (Symbol::got_offset_): Removed.
11426 (Symbol::tls_mod_got_offset_): Removed.
11427 (Symbol::tls_pair_got_offset_): Removed.
11428 (Symbol::got_offsets_): New field.
11429 (Symbol::has_got_offset): Removed.
11430 (Symbol::has_tls_mod_got_offset): Removed.
11431 (Symbol::has_tls_pair_got_offset): Removed.
11432 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11433 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11434 member functions.
11435 (Target_x86_64::Scan::global): Likewise.
11436 (Target_x86_64::Relocate::relocate): Likewise.
11437 (Target_x86_64::Relocate::relocate_tls): Likewise.
11438
bd52eafb
BE
114392008-03-25 Ben Elliston <bje@au.ibm.com>
11440
11441 * yyscript.y: Fix spelling error in comment.
11442
8b105e34
ILT
114432008-03-24 Ian Lance Taylor <iant@google.com>
11444
8ed814a9
ILT
11445 * options.h (class General_options): Define build_id option.
11446 * layout.h (class Layout): Declare write_build_id, create_note,
11447 create_build_id. Add build_id_note_ member.
11448 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11449 "libiberty.h", "md5.h", "sha1.h".
11450 (Layout::Layout): Initialize eh_frame_data_,
11451 eh_frame_hdr_section_, and build_id_note_.
11452 (Layout::finalize): Call create_build_id.
11453 (Layout::create_note): New function, broken out of
11454 Layout::create_gold_note.
11455 (Layout::create_gold_note): Call create_note.
11456 (Layout::create_build_id): New function.
11457 (Layout::write_build_id): New function.
11458 (Close_task_runner::run): Call write_build_id.
11459
8b105e34
ILT
11460 * x86_64.cc: Correct license to GPLv3.
11461
086a1841
ILT
114622008-03-23 Ian Lance Taylor <iant@google.com>
11463
11464 * options.cc: Include "demangle.h".
11465 (parse_optional_string): New function.
11466 (parse_long_option): Handle takes_optional_argument.
11467 (parse_short_option): Update dash_z initializer. Handle
11468 takes_optional_argument.
11469 (General_options::General_options): Initialize do_demangle_.
11470 (General_options::finalize): Set do_demangle_. Handle demangling
11471 style.
11472 * options.h (parse_optional_string): Declare.
11473 (struct One_option): Add optional_arg field. Update constructor.
11474 Update call constructor calls. Add takes_optional_argument
11475 function.
11476 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11477 (DEFINE_optional_string): Define.
11478 (General_options::demangle): Change from DEFINE_bool to
11479 DEFINE_optional_string.
11480 (General_options::no_demangle): New function.
11481 (General_options::do_demangle): New function.
11482 (General_options::set_do_demangle): New function.
11483 (General_options::execstack_status_): Move definition to end of
11484 class definition.
11485 (General_options::static_): Likewise.
11486 (General_options::do_demangle_): New field.
11487 * object.cc (big_endian>::get_symbol_location_info): Call
11488 Options::do_demangle, not Options::demangle.
11489 * symtab.cc (demangle): Likewise.
11490
cbb93e63
ILT
114912008-03-22 Ian Lance Taylor <iant@google.com>
11492
11493 * gold.h: Include <cstddef> and <sys/types.h>
11494 * options.h: Include <cstring>.
11495
ec531623
ILT
114962008-03-21 Ian Lance Taylor <iant@google.com>
11497
11498 * Added source code to GNU binutils.
This page took 0.694149 seconds and 4 git commands to generate.