bfb9a4087645867358b9d2b6b008ea188dfe0687
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2011-06-29 Ian Lance Taylor <iant@google.com>
2
3 PR gold/12695
4 * layout.cc (Layout::symtab_section_shndx): New function.
5 * layout.h (class Layout): Declare symtab_section_shndx.
6 * output.cc (Output_section::write_header): Call it.
7
8 2011-06-29 Ian Lance Taylor <iant@google.com>
9
10 PR gold/12818
11 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
12 symbols which are not used in a relocation.
13
14 2011-06-28 Ian Lance Taylor <iant@google.com>
15
16 PR gold/12898
17 * layout.cc (Layout::segment_precedes): Don't crash if a linker
18 script create indistinguishable segments.
19 (Layout::set_segment_offsets): Use stable_sort when sorting
20 segments. Pass this to Compare_segments constructor.
21 * layout.h (class Layout): Make segment_precedes non-static.
22 (class Compare_segments): Change from struct to class. Add
23 layout_ field. Add constructor.
24 * script-sections.cc
25 (Script_sections::attach_sections_using_phdrs_clause): Rename
26 local orphan to is_orphan. Don't report failure to put empty
27 section in segment. On attachment failure, report name of
28 section, and attach to first PT_LOAD segment.
29
30 2011-06-28 Ian Lance Taylor <iant@google.com>
31
32 PR gold/12934
33 * target-select.cc (Target_selector::Target_selector): Add
34 emulation parameter. Change all callers.
35 (select_target_by_bfd_name): Rename from select_target_by_name.
36 Change all callers.
37 (select_target_by_emulation): New function.
38 (supported_emulation_names): New function.
39 * target-select.h (class Target_selector): Add emulation_ field.
40 Update declarations.
41 (Target_selector::recognize_by_bfd_name): Rename from
42 recognize_by_name. Change all callers.
43 (Target_selector::supported_bfd_names): Rename from
44 supported_names. Change all callers.
45 (Target_selector::recognize_by_emulation): New function.
46 (Target_selector::supported_emulations): New function.
47 (Target_selector::emulation): New function.
48 (Target_selector::do_recognize_by_bfd_name): Rename from
49 do_recognize_by_name. Change all callers.
50 (Target_selector::do_supported_bfd_names): Rename from
51 do_supported_names. Change all callers.
52 (Target_selector::do_recognize_by_emulation): New function.
53 (Target_selector::do_supported_emulations): New function.
54 (select_target_by_bfd_name): Change name in declaration.
55 (select_target_by_emulation): Declare.
56 (supported_emulation_names): Declare.
57 * parameters.cc (parameters_force_valid_target): Try to find
58 target based on emulation from -m option.
59 * options.h (class General_options): Change doc string for -m.
60 * options.cc (help): Print emulations.
61 (General_options::parse_V): Likewise.
62 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
63 Add emulation parameter. Change all callers.
64
65 2011-06-28 Ian Lance Taylor <iant@google.com>
66
67 * target.h (class Target): Add osabi_ field.
68 (Target::osabi): New function.
69 (Target::set_osabi): New function.
70 (Target::Target): Initialize osabi_.
71 (Target::do_adjust_elf_header): Make pure virtual.
72 (Sized_target::do_adjust_elf_header): Declare.
73 * target.cc (Sized_target::do_adjust_elf_header): New function.
74 (class Sized_target): Instantiate all versions.
75 * freebsd.h (class Target_freebsd): Remove.
76 (Target_selector_freebsd::do_recognize): Call set_osabi on
77 Target.
78 (Target_selector_freebsd::do_recognize_by_name): Likewise.
79 (Target_selector_freebsd::set_osabi): Remove.
80 * i386.cc (class Target_i386): Inherit from Sized_target rather
81 than Target_freebsd.
82 * x86_64.cc (class Target_x86_64): Likewise.
83
84 2011-06-28 Ian Lance Taylor <iant@google.com>
85
86 * target.h (Target::can_check_for_function_pointers): Rewrite.
87 Make non-virtual.
88 (Target::can_icf_inline_merge_sections): Likewise.
89 (Target::section_may_have_icf_unsafe_poineters): Likewise.
90 (Target::Target_info): Add can_icf_inline_merge_sections field.
91 (Target::do_can_check_for_function_pointers): New virtual
92 function.
93 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
94 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
95 from can_check_for_function_pointers, move in file.
96 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
97 section_may_have_icf_unsafe_poineters, move in file.
98 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
99 * i386.cc (Target_i386::do_can_check_for_function_pointers):
100 Rename from can_check_for_function_pointers, move in file.
101 (Target_i386::can_icf_inline_merge_sections): Remove.
102 (Target_i386::i386_info): Initialize
103 can_icf_inline_merge_sections.
104 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
105 Initialize can_icf_inline_merge_sections.
106 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
107 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
108 Rename from can_check_for_function_pointers, move in file.
109 (Target_x86_64::can_icf_inline_merge_sections): Remove.
110 (Target_x86_64::x86_64_info): Initialize
111 can_icf_inline_merge_sections.
112 * testsuite/testfile.cc (Target_test::test_target_info):
113 Likewise.
114 * icf.cc (get_section_contents): Correct formatting.
115
116 2011-06-27 Ian Lance Taylor <iant@google.com>
117
118 * symtab.cc (Symbol::versioned_name): New function.
119 (Symbol_table::add_to_final_symtab): Use versioned_name when
120 appropriate.
121 (Symbol_table::sized_write_symbol): Likewise.
122 * symtab.h (class Symbol): Declare versioned_name.
123 * stringpool.h (class Stringpool_template): Add variant of add
124 which takes a std::basic_string.
125 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
126 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
127 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
128 (ver_test_12.o): New target.
129 * testsuite/Makefile.in: Rebuild.
130
131 2011-06-27 Doug Kwan <dougkwan@google.com>
132
133 * arm.cc (Arm_relocate_functions::thm_jump8,
134 Arm_relocate_functions::thm_jump11): Use a wider signed
135 type to compute offset.
136 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
137 arm_thm_jump8.
138 * testsuite/Makefile.in: Regenerate.
139 * testsuite/arm_branch_in_range.sh: Check test results of
140 arm_thm_jump11 and arm_thm_jump8.
141 * testsuite/arm_thm_jump11.s: New test source file.
142 * testsuite/arm_thm_jump11.t: New linker script.
143 * testsuite/arm_thm_jump8.s: New test source file.
144 * testsuite/arm_thm_jump8.t: New linker script.
145
146 2011-06-24 Ian Lance Taylor <iant@google.com>
147
148 * layout.cc: Include "object.h".
149 (ctors_sections_in_init_array): New static variable.
150 (Layout::is_ctors_in_init_array): New function.
151 (Layout::layout): Add entry to ctors_sections_in_init_array if
152 appropriate.
153 * layout.h (class Layout): Declare is_ctors_in_init_array.
154 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
155 is_ctors_reverse_view is set.
156 (Sized_relobj_file::write_sections): Add layout parameter. Change
157 all callers. Set is_ctors_reverse_view field of View_size.
158 (Sized_relobj_file::reverse_words): New function.
159 * object.h (Sized_relobj_file::View_size): Add
160 is_ctors_reverse_view field.
161 (class Sized_relobj_file): Update declarations.
162 * testsuite/initpri3.c: New test.
163 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
164 initpri3b.
165 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
166 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
167 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
168 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
169 * testsuite/Makefile.in: Rebuild.
170
171 2011-06-24 Cary Coutant <ccoutant@google.com>
172
173 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
174 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
175 (debug_msg_cdebug.err): New targets.
176 * testsuite/Makefile.in: Regenerate.
177 * testsuite/debug_msg.sh: Check output of link with compressed debug.
178 Fix checks for link with shared library.
179
180 2011-06-24 Doug Kwan <dougkwan@google.com>
181
182 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
183 skip empty text sections.
184 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
185
186 2011-06-22 Ian Lance Taylor <iant@google.com>
187
188 PR gold/12910
189 * options.h (class General_options): Add --ctors-in-init-array.
190 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
191 friends as SHT_PROGBITS for merging sections.
192 (Layout::layout): Remove special handling of .init_array and
193 friends. Don't sort if doing relocatable link. Sort for .ctors
194 and .dtors if ctors_in_init_array.
195 (Layout::make_output_section): Force correct section types for
196 .init_array and friends. Don't sort if doing relocatable link,
197 Don't sort .ctors and .dtors if ctors_in_init_array.
198 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
199 (Layout::output_section_name): Add relobj parameter. Change all
200 callers. Handle .ctors. and .dtors. in code rather than table.
201 Handle .ctors and .dtors if ctors_in_init_array.
202 (Layout::match_file_name): New function, moved from output.cc.
203 * layout.h (class Layout): Update declarations.
204 * output.cc: Include "layout.h".
205 (Input_section_sort_entry::get_priority): New function.
206 (Input_section_sort_entry::match_file_name): Just call
207 Layout::match_file_name.
208 (Output_section::Input_section_sort_init_fini_compare::operator()):
209 Handle .ctors and .dtors. Sort by explicit priority rather than
210 by name.
211 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
212 * testsuite/initpri2.c: New test.
213 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
214 (check_PROGRAMS): Add initpri2.
215 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
216 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
217 * configure, testsuite/Makefile.in: Rebuild.
218
219 2011-06-19 Ian Lance Taylor <iant@google.com>
220
221 PR gold/12880
222 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
223 .interp section to a PT_INTERP segment even if we have seen a
224 --dynamic-linker option. Don't do it if we have seen a PHDRS
225 clause in a linker script.
226 (Layout::finalize): Don't create a .interp section if we've
227 already create a PT_INTERP segment.
228 (Layout::create_interp): Always call choose_output_section (revert
229 patch of 2011-06-17). Don't create PT_INTERP segment.
230 * script-sections.cc
231 (Script_sections::create_note_and_tls_segments): Add a .interp
232 section to a PT_INTERP segment even if we have seen a
233 --dynamic-linker option.
234
235 2011-06-18 Ian Lance Taylor <iant@google.com>
236
237 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
238 merely because a non-PT_LOAD segment has a dynamic reloc.
239
240 2011-06-18 Ian Lance Taylor <iant@google.com>
241
242 * layout.cc (Layout::finish_dynamic_section): Don't create
243 DT_FLAGS entry if not needed.
244
245 2011-06-18 Ian Lance Taylor <iant@google.com>
246
247 PR gold/12745
248 * layout.cc (Layout::layout_eh_frame): Correct handling of
249 writable .eh_frame section.
250
251 2011-06-17 Ian Lance Taylor <iant@google.com>
252
253 PR gold/12893
254 * resolve.cc (Symbol_table::resolve): Don't give an error if a
255 symbol is redefined with the exact same object and value.
256
257 2011-06-17 Ian Lance Taylor <iant@google.com>
258
259 PR gold/12880
260 * layout.h (class Layout): Add interp_segment_ field.
261 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
262 (Layout::attach_allocated_section_to_segment): If making shared
263 library, put .interp section in PT_INTERP segment.
264 (Layout::finalize): Also call create_interp if -dynamic-linker
265 option was used.
266 (Layout::create_interp): Assert that there is no PT_INTERP
267 segment. If not using a SECTIONS clause, use make_output_section.
268 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
269 * script-sections.cc
270 (Script_sections::create_note_and_tls_segments): If making shared
271 library, put .interp section in PT_INTERP segment.
272
273 2011-06-17 Ian Lance Taylor <iant@google.com>
274
275 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
276 when making a shared library.
277
278 2011-06-17 Ian Lance Taylor <iant@google.com>
279
280 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
281 parameter. Change all callers. Don't issue warning about PC32
282 against locally defined symbol.
283
284 2011-06-16 Ian Lance Taylor <iant@google.com>
285
286 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
287 occurs in same object.
288
289 2011-06-14 Alan Modra <amodra@gmail.com>
290
291 * po/POTFILES.in: Regenerate.
292
293 2011-06-09 Ian Lance Taylor <iant@google.com>
294
295 * script-sections.cc
296 (Orphan_output_section::set_section_addresses): For a relocatable
297 link set address to 0.
298
299 2011-06-09 Cary Coutant <ccoutant@google.com>
300
301 PR gold/12804
302 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
303 used with --compress-debug-sections.
304 * gold/object.cc (Sized_relobj_file::do_layout): Report
305 uncompressed size of compressed input sections.
306
307 2011-06-08 Cary Coutant <ccoutant@google.com>
308
309 PR gold/12804
310 * testsuite/two_file_test_2_v1.cc: Change initialization of
311 v2 to keep it in .data.
312
313 2011-06-07 Cary Coutant <ccoutant@google.com>
314
315 * common.cc (Symbol_table::do_allocate_commons_list): Call
316 gold_fallback.
317 * errors.cc (Errors::fatal): Adjust call to gold_exit.
318 (Errors::fallback): New function.
319 (gold_fallback): New function.
320 * errors.h (Errors::fallback): New function.
321 * gold.cc (gold_exit): Change status parameter to enum; adjust
322 all callers.
323 (queue_initial_tasks): Call gold_fallback.
324 * gold.h: Include cstdlib.
325 (Exit_status): New enum type.
326 (gold_exit): Change status parameter to enum.
327 (gold_fallback): New function.
328 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
329 (Layout::create_symtab_sections): Likewise.
330 (Layout::create_shdrs): Likewise.
331 * main.cc (main): Adjust call to gold_exit.
332 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
333 (Output_data_got::add_got_entry_pair): Likewise.
334 (Output_section::add_input_section): Likewise.
335 (Output_section::add_output_section_data): Likewise.
336 (Output_segment::set_section_list_addresses): Likewise.
337 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
338
339 2011-06-07 Cary Coutant <ccoutant@google.com>
340
341 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
342 for incremental links.
343 * output.cc (Output_segment::set_section_list_addresses): Remove
344 FIXME and test for TLS or BSS.
345
346 2011-06-07 Cary Coutant <ccoutant@google.com>
347
348 * testsuite/Makefile.am: Add incremental_copy_test,
349 incremental_common_test_1.
350 * testsuite/Makefile.in: Regenerate.
351 * testsuite/common_test_1_v1.c: New source file.
352 * testsuite/common_test_1_v2.c: New source file.
353 * testsuite/copy_test_v1.cc: New source file.
354
355 2011-06-07 Cary Coutant <ccoutant@google.com>
356
357 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
358 update, allocate common from bss section's free list.
359 * incremental-dump.cc (dump_incremental_inputs): Print flag for
360 linker-defined symbols.
361 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
362 Skip GOT and PLT entries that are no longer referenced.
363 (Output_section_incremental_inputs::write_info_blocks): Mark
364 linker-defined symbols.
365 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
366 * output.cc (Output_section::allocate): New function.
367 * output.h (Output_section::allocate): New function.
368 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
369 linker-defined symbols.
370 (Symbol::override_base_with_special): Copy is_predefined_ flag.
371 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
372 (Symbol::init_base_output_data): Likewise.
373 (Symbol::init_base_output_segment): Likewise.
374 (Symbol::init_base_constant): Likewise.
375 (Sized_symbol::init_output_data): Likewise.
376 (Sized_symbol::init_output_segment): Likewise.
377 (Sized_symbol::init_constant): Likewise.
378 (Symbol_table::do_define_in_output_data): Likewise.
379 (Symbol_table::do_define_in_output_segment): Likewise.
380 (Symbol_table::do_define_as_constant): Likewise.
381 * symtab.h (Symbol::is_predefined): New function.
382 (Symbol::init_base_output_data): Add is_predefined parameter.
383 (Symbol::init_base_output_segment): Likewise.
384 (Symbol::init_base_constant): Likewise.
385 (Symbol::is_predefined_): New data member.
386 (Sized_symbol::init_output_data): Add is_predefined parameter.
387 (Sized_symbol::init_output_segment): Likewise.
388 (Sized_symbol::init_constant): Likewise.
389 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
390
391 2011-06-07 Cary Coutant <ccoutant@google.com>
392
393 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
394 instead of emit_copy_reloc.
395 (Copy_relocs::emit_copy_reloc): Refactor.
396 (Copy_relocs::make_copy_reloc): New function.
397 (Copy_relocs::add_copy_reloc): Remove.
398 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
399 section.
400 (Copy_relocs::make_copy_reloc): New function.
401 (Copy_relocs::add_copy_reloc): Remove.
402 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
403 unchanged input files.
404 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
405 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
406 Reserve BSS space for COPY relocations.
407 (Sized_incremental_binary::do_emit_copy_relocs): New function.
408 (Output_section_incremental_inputs::write_info_blocks): Record
409 whether a symbol is copied from a shared object.
410 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
411 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
412 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
413 (Incremental_input_entry_reader::get_output_symbol_index): Add
414 is_copy parameter.
415 (Incremental_binary::emit_copy_relocs): New function.
416 (Incremental_binary::do_emit_copy_relocs): New function.
417 (Sized_incremental_binary::Sized_incremental_binary): Initialize
418 new data member.
419 (Sized_incremental_binary::add_copy_reloc): New function.
420 (Sized_incremental_binary::do_emit_copy_relocs): New function.
421 (Sized_incremental_binary::Copy_reloc): New struct.
422 (Sized_incremental_binary::Copy_relocs): New typedef.
423 (Sized_incremental_binary::copy_relocs_): New data member.
424 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
425 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
426 * target.h (Sized_target::emit_copy_reloc): New function.
427 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
428
429 2011-06-02 Cary Coutant <ccoutant@google.com>
430
431 PR gold/12163
432 * gold/archive.cc (Archive::Archive): Initialize new data member.
433 (Archive::include_all_members): Return if archive has already been
434 included.
435 * gold/archive.h (Archive::include_all_members_): New data member.
436
437 2011-06-02 Nick Clifton <nickc@redhat.com>
438
439 * dynobj.h: Fix spelling mistake in comment.
440 * output.cc: Likewise.
441
442 2011-05-31 Doug Kwan <dougkwan@google.com>
443 Asier Llano
444
445 PR gold/12826
446 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
447 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
448 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
449 redundant arm_exidx_test.so.
450 * testsuite/Makefile.in: Regenerate.
451 (check_SCRIPTS): Add pr12826.sh
452 (check_DATA): Add pr12826.stdout
453 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
454 * testsuite/pr12826.sh: New file.
455 * testsuite/pr12826_1.s: Ditto.
456 * testsuite/pr12826_1.s: Ditto.
457
458 2011-05-30 Ian Lance Taylor <iant@google.com>
459
460 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
461 sections.
462
463 2011-05-29 Ian Lance Taylor <iant@google.com>
464
465 PR gold/12804
466 * testsuite/Makefile.am: Use different file name for two_file_test
467 temporary file for each incremental test.
468 * testsuite/Makefile.in: Rebuild.
469
470 2011-05-29 Ian Lance Taylor <iant@google.com>
471
472 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
473 binary input file is empty.
474
475 2011-05-27 Ian Lance Taylor <iant@google.com>
476
477 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
478 (ver_test_9.so): Likewise.
479 * testsuite/Makefile.in: Rebuild.
480
481 2011-05-26 Cary Coutant <ccoutant@google.com>
482
483 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
484 * incremental.cc (Incremental_inputs::report_input_section): Fix
485 comment, indentation.
486 (Incremental_inputs::report_comdat_group): New function.
487 (Output_section_incremental_inputs::set_final_data_size): Adjust size
488 of data for incremental input file entry.
489 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
490 group count, COMDAT group signatures.
491 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
492 an unchanged input file.
493 * incremental.h (Incremental_object_entry::Incremental_object_entry):
494 Initialize new data member.
495 (Incremental_object_entry::add_comdat_group): New function.
496 (Incremental_object_entry::get_comdat_group_count): New function.
497 (Incremental_object_entry::get_comdat_signature_key): New function.
498 (Incremental_object_entry::groups_): New data member.
499 (Incremental_inputs::report_comdat_group): New function.
500 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
501 data for incremental input file entry.
502 (Incremental_input_entry_reader::get_comdat_group_count): New function.
503 (Incremental_input_entry_reader::get_input_section): Adjust size of
504 data for incremental input file entry.
505 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
506 (Incremental_input_entry_reader::get_comdat_group_signature): New
507 function.
508 * object.cc (Sized_relobj::include_section_group): Report kept
509 COMDAT groups for incremental links.
510
511 2011-05-24 David Meyer <pdox@google.com>
512
513 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
514 with name parameter. Add found_name parameter.
515 * fileread.cc (Input_file::find_file): Adjust code accordingly.
516 * dirsearch.h (class Dirsearch): Update declaration.
517
518 2011-05-24 Ian Lance Taylor <iant@google.com>
519
520 * archive.cc (Library_base::should_include_member): Pull in object
521 from archive if it defines the entry symbol.
522 * parameters.cc (Parameters::entry): New function.
523 * parameters.h (class Parameters): Declare entry.
524 * output.h (class Output_file_header): Remove entry_ field.
525 * output.cc (Output_file_header::Output_file_header): Remove entry
526 parameter. Change all callers.
527 (Output_file_header::entry): Use parameters->entry.
528 * gold.cc (queue_middle_tasks): Likewise.
529 * plugin.cc (Plugin_hook::run): Likewise.
530
531 2011-05-24 Cary Coutant <ccoutant@google.com>
532
533 * gold.cc (queue_initial_tasks): Pass incremental base filename
534 to Output_file::open_base_file; don't print error message.
535 * incremental-dump.cc (main): Adjust call to
536 Output_file::open_for_modification.
537 * incremental-dump.cc (main): Likewise.
538 * incremental.cc (Incremental_inputs::report_command_line):
539 Ignore --incremental-base option when comparing command lines.
540 Ignore parameter when given as separate argument.
541 * options.h (class General_options): Add --incremental-base.
542 * output.cc (Output_file::Output_file):
543 (Output_file::open_base_file): Add base_name and writable parameters;
544 read base file into new file; print error message here.
545 (Output_file::map_no_anonymous): Add writable parameter; adjust all
546 callers.
547 * output.h (Output_file::open_for_modification): Rename to...
548 (Output_file::open_base_file): ...this; add base_name and
549 writable parameters; adjust all callers.
550 (Output_file::map_no_anonymous): Add writable parameter; adjust all
551 callers.
552 * testsuite/Makefile.am (incremental_test_4): Test
553 --incremental-base.
554 * testsuite/Makefile.in: Regenerate.
555
556 2011-05-24 Cary Coutant <ccoutant@google.com>
557
558 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
559 incremental_test_4.
560 * testsuite/Makefile.in: Regenerate.
561 * testsuite/two_file_test_1_v1.cc: New test source file.
562 * testsuite/two_file_test_1b_v1.cc: New test source file.
563 * testsuite/two_file_test_2_v1.cc: New test source file.
564
565 2011-05-24 Cary Coutant <ccoutant@google.com>
566
567 * dynobj.h (Dynobj::do_dynobj): New function.
568 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
569 flag and soname for shared objects.
570 * incremental.cc (Incremental_inputs::report_object): Make
571 either Incremental_object_entry or Incremental_dynobj_entry; add
572 soname to string table.
573 (Incremental_inputs::report_input_section): Add assertion.
574 (Output_section_incremental_inputs::set_final_data_size): Adjust
575 type of input file entry for shared libraries; adjust size of
576 shared library info entry.
577 (Output_section_incremental_inputs::write_input_files): Write
578 as_needed flag for shared libraries.
579 (Output_section_incremental_inputs::write_info_blocks): Adjust type
580 of input file entry for shared libraries; write soname.
581 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
582 soname from incremental info.
583 * incremental.h (enum Incremental_input_flags): Add
584 INCREMENTAL_INPUT_AS_NEEDED.
585 (Incremental_input_entry::Incremental_input_entry): Initialize new
586 data member.
587 (Incremental_input_entry::set_as_needed): New function.
588 (Incremental_input_entry::as_needed): New function.
589 (Incremental_input_entry::do_dynobj_entry): New function.
590 (Incremental_input_entry::as_needed_): New data member.
591 (Incremental_object_entry::Incremental_object_entry): Don't check
592 for shared library.
593 (Incremental_object_entry::do_type): Likewise.
594 (class Incremental_dynobj_entry): New class.
595 (Incremental_input_entry_reader::as_needed): New function.
596 (Incremental_input_entry_reader::get_soname): New function.
597 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
598 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
599 size of shared library info entry.
600 * layout.cc (Layout::finish_dynamic_section): Don't test for
601 incremental link when adding DT_NEEDED entries.
602 * object.h (Object::Object): Initialize new data member.
603 (Object::dynobj): New function.
604 (Object::set_as_needed): New function.
605 (Object::as_needed): New function.
606 (Object::do_dynobj): New function.
607 (Object::as_needed_): New data member.
608
609 2011-05-24 Cary Coutant <ccoutant@google.com>
610
611 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
612 info; adjust display of GOT entries.
613 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
614 vector of input objects; remove file_status_.
615 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
616 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
617 got_plt reader; call target hooks to reserve GOT entries.
618 (Output_section_incremental_inputs::set_final_data_size): Adjust size
619 of input file info header and GOT info entry.
620 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
621 relocation info.
622 (Got_plt_view_info::got_descriptor): Remove.
623 (Got_plt_view_info::sym_index): New data member.
624 (Got_plt_view_info::input_index): New data member.
625 (Local_got_offset_visitor::visit): Write input file index.
626 (Global_got_offset_visitor::visit): Write 0 for input file index.
627 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
628 with sym_index and input_index.
629 (Output_section_incremental_inputs::write_got_plt): Adjust size of
630 incremental info GOT entry; replace got_descriptor with input_index.
631 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
632 map from input file index to object.
633 (Sized_relobj_incr::do_layout): Replace direct data member reference
634 with accessor function.
635 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
636 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
637 Adjust size of input file info header.
638 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
639 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
640 (Incremental_input_entry_reader::get_input_section): Adjust size of
641 input file info header.
642 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
643 of incremental info GOT entry.
644 (Incremental_got_plt_reader::get_got_desc): Remove.
645 (Incremental_got_plt_reader::get_got_symndx): New function.
646 (Incremental_got_plt_reader::get_got_input_index): New function.
647 (Sized_incremental_binary::Sized_incremental_binary): Remove
648 file_status_; add input_objects_.
649 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
650 (Sized_incremental_binary::set_file_is_unchanged): Remove.
651 (Sized_incremental_binary::file_is_unchanged): Remove.
652 (Sized_incremental_binary::set_input_object): New function.
653 (Sized_incremental_binary::input_object): New function.
654 (Sized_incremental_binary::file_status_): Remove.
655 (Sized_incremental_binary::input_objects_): New data member.
656 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
657 references.
658 (Sized_relobj_incr::invalid_address): Move to base class.
659 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
660 class.
661 (Sized_relobj_incr::do_output_section_offset): Likewise.
662 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
663 (Sized_relobj_incr::section_offsets_): Likewise.
664 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
665 function.
666 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
667 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
668 with accessor function.
669 (Sized_relobj_file::do_layout): Likewise.
670 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
671 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
672 (Sized_relobj_file::compute_final_local_value): Replace refs to
673 section_offsets_ with accessor function.
674 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
675 * object.h (Relobj::Relobj): Initialize new data members.
676 (Relobj::add_dyn_reloc): New function.
677 (Relobj::first_dyn_reloc): New function.
678 (Relobj::dyn_reloc_count): New function.
679 (Relobj::first_dyn_reloc_): New data member.
680 (Relobj::dyn_reloc_count_): New data member.
681 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
682 references.
683 (Sized_relobj::Address): New typedef.
684 (Sized_relobj::invalid_address): Move here from child class.
685 (Sized_relobj::Sized_relobj): Initialize new data members.
686 (Sized_relobj::sized_relobj): New function.
687 (Sized_relobj::is_output_section_offset_invalid): Move here from
688 child class.
689 (Sized_relobj::get_output_section_offset): Likewise.
690 (Sized_relobj::local_has_got_offset): Likewise.
691 (Sized_relobj::local_got_offset): Likewise.
692 (Sized_relobj::set_local_got_offset): Likewise.
693 (Sized_relobj::do_for_all_local_got_entries): Likewise.
694 (Sized_relobj::clear_got_offsets): New function.
695 (Sized_relobj::section_offsets): Move here from child class.
696 (Sized_relobj::do_output_section_offset): Likewise.
697 (Sized_relobj::do_set_section_offset): Likewise.
698 (Sized_relobj::Local_got_offsets): Likewise.
699 (Sized_relobj::local_got_offsets_): Likewise.
700 (Sized_relobj::section_offsets_): Likewise.
701 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
702 references.
703 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
704 class.
705 (Sized_relobj_file::sized_relobj): New function
706 (Sized_relobj_file::local_has_got_offset): Move to base class.
707 (Sized_relobj_file::local_got_offset): Likewise.
708 (Sized_relobj_file::set_local_got_offset): Likewise.
709 (Sized_relobj_file::get_output_section_offset): Likewise.
710 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
711 (Sized_relobj_file::do_output_section_offset): Likewise.
712 (Sized_relobj_file::do_set_section_offset): Likewise.
713 (Sized_relobj_file::Local_got_offsets): Likewise.
714 (Sized_relobj_file::local_got_offsets_): Likewise.
715 (Sized_relobj_file::section_offsets_): Likewise.
716 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
717 (all constructors).
718 (set_needs_dynsym_index): Convert relobj to derived class pointer.
719 (Output_reloc::get_symbol_index): Likewise.
720 (Output_reloc::local_section_offset): Likewise.
721 (Output_reloc::get_address): Likewise.
722 (Output_reloc::symbol_value): Likewise.
723 (Output_data_got::reserve_slot): Move to class definition.
724 (Output_data_got::reserve_local): New function.
725 (Output_data_got::reserve_slot_for_global): Remove.
726 (Output_data_got::reserve_global): New function.
727 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
728 (all constructors, two instantiations).
729 (Output_reloc::get_relobj): New function (two instantiations).
730 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
731 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
732 (Output_data_reloc::add_global): Adjust type of relobj.
733 (Output_data_reloc::add_global_relative): Likewise.
734 (Output_data_reloc::add_symbolless_global_addend): Likewise.
735 (Output_data_reloc::add_local): Likewise.
736 (Output_data_reloc::add_local_relative): Likewise.
737 (Output_data_reloc::add_symbolless_local_addend): Likewise.
738 (Output_data_reloc::add_local_section): Likewise.
739 (Output_data_reloc::add_output_section): Likewise.
740 (Output_data_reloc::add_absolute): Likewise.
741 (Output_data_reloc::add_target_specific): Likewise.
742 (Output_data_got::reserve_slot): Move definition here.
743 (Output_data_got::reserve_local): New function.
744 (Output_data_got::reserve_global): New function.
745 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
746 section_offsets_ with accessor function.
747 (Sized_relobj_file::write_sections): Likewise.
748 (Sized_relobj_file::do_relocate_sections): Likewise.
749 * target.h (Sized_target::reserve_local_got_entry): New function.
750 (Sized_target::reserve_global_got_entry): New function.
751 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
752 (Target_x86_64::reserve_global_got_entry): New function.
753 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
754
755 2011-05-23 Cary Coutant <ccoutant@google.com>
756
757 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
758 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
759 bit when checking got_type.
760 * incremental.cc (Sized_incremental_binary::setup_readers):
761 Store symbol table and string table locations; initialize bit vector
762 of file status flags.
763 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
764 unchanged files.
765 (Sized_incremental_binary::do_process_got_plt): New function.
766 (Sized_incremental_binary::get_symtab_view): Use stored locations.
767 (Output_section_incremental_inputs::set_final_data_size): Record
768 file index for each input file.
769 (Output_section_incremental_inputs::write_got_plt): Store file index
770 instead of input entry offset for each GOT entry.
771 * incremental.h
772 (Incremental_input_entry::Incremental_input_entry): Initialize new
773 data member.
774 (Incremental_input_entry::set_offset): Store file index.
775 (Incremental_input_entry::get_file_index): New function.
776 (Incremental_input_entry::file_index_): New data member.
777 (Incremental_binary::process_got_plt): New function.
778 (Incremental_binary::do_process_got_plt): New function.
779 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
780 data members.
781 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
782 (Sized_incremental_binary::set_file_is_unchanged): New function.
783 (Sized_incremental_binary::file_is_unchanged): New function.
784 (Sized_incremental_binary::do_process_got_plt): New function.
785 (Sized_incremental_binary::file_status_): New data member.
786 (Sized_incremental_binary::main_symtab_loc_): New data member.
787 (Sized_incremental_binary::main_strtab_loc_): New data member.
788 * output.cc (Output_data_got::Got_entry::write): Add case
789 RESERVED_CODE.
790 (Output_data_got::add_global): Call add_got_entry.
791 (Output_data_got::add_global_plt): Likewise.
792 (Output_data_got::add_global_with_rel): Likewise.
793 (Output_data_got::add_global_with_rela): Likewise.
794 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
795 (Output_data_got::add_global_pair_with_rela): Likewise.
796 (Output_data_got::add_local): Call add_got_entry.
797 (Output_data_got::add_local_plt): Likewise.
798 (Output_data_got::add_local_with_rel): Likewise.
799 (Output_data_got::add_local_with_rela): Likewise.
800 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
801 (Output_data_got::add_local_pair_with_rela): Likewise.
802 (Output_data_got::reserve_slot): New function.
803 (Output_data_got::reserve_slot_for_global): New function.
804 (Output_data_got::add_got_entry): New function.
805 (Output_data_got::add_got_entry_pair): New function.
806 (Output_section::add_output_section_data): Edit FIXME.
807 * output.h
808 (Output_section_data_build::Output_section_data_build): New
809 constructor with size parameter.
810 (Output_data_space::Output_data_space): Likewise.
811 (Output_data_got::Output_data_got): Initialize new data member; new
812 constructor with size parameter.
813 (Output_data_got::add_constant): Call add_got_entry.
814 (Output_data_got::reserve_slot): New function.
815 (Output_data_got::reserve_slot_for_global): New function.
816 (class Output_data_got::Got_entry): Add RESERVED_CODE.
817 (Output_data_got::add_got_entry): New function.
818 (Output_data_got::add_got_entry_pair): New function.
819 (Output_data_got::free_list_): New data member.
820 * target.h (Sized_target::init_got_plt_for_update): New function.
821 (Sized_target::register_global_plt_entry): New function.
822 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
823 Initialize new data member; call init; add constructor with PLT count.
824 (Output_data_plt_x86_64::init): New function.
825 (Output_data_plt_x86_64::add_relocation): New function.
826 (Output_data_plt_x86_64::reserve_slot): New function.
827 (Output_data_plt_x86_64::free_list_): New data member.
828 (Target_x86_64::init_got_plt_for_update): New function.
829 (Target_x86_64::register_global_plt_entry): New function.
830 (Output_data_plt_x86_64::add_entry): Allocate from free list for
831 incremental updates.
832 (Output_data_plt_x86_64::add_relocation): New function.
833 * testsuite/object_unittest.cc (Object_test): Set default options.
834
835 2011-05-16 Ian Lance Taylor <iant@google.com>
836
837 * options.h (class General_options): Make -i a synonym for -r.
838
839 2011-05-16 Ian Lance Taylor <iant@google.com>
840
841 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
842
843 2011-05-10 Cary Coutant <ccoutant@google.com>
844
845 * object.cc (Sized_relobj::do_count_local_symbols): Check for
846 strip_all (-s).
847
848 2011-05-06 Ian Lance Taylor <iant@google.com>
849
850 * layout.cc (Layout::layout): If the output section flags change,
851 update the ordering.
852
853 2011-04-25 Cary Coutant <ccoutant@google.com>
854
855 * incremental-dump.cc (dump_incremental_inputs): Print local
856 symbol info for each input file.
857 * incremental.cc
858 (Output_section_incremental_inputs::set_final_data_size): Add local
859 symbol info to input file entries in incremental info.
860 (Output_section_incremental_inputs::write_info_blocks): Likewise.
861 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
862 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
863 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
864 implementation.
865 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
866 (Sized_incr_relobj::do_relocate): Write the local symbols.
867 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
868 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
869 Adjust size of input file header.
870 (Incremental_inputs_reader::get_local_symbol_offset): New function.
871 (Incremental_inputs_reader::get_local_symbol_count): New function.
872 (Incremental_inputs_reader::get_input_section): Adjust size of input
873 file header.
874 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
875 (Sized_incr_relobj::This): New typedef.
876 (Sized_incr_relobj::sym_size): New const data member.
877 (Sized_incr_relobj::Local_symbol): New struct.
878 (Sized_incr_relobj::do_output_local_symbol_count): New function.
879 (Sized_incr_relobj::do_local_symbol_offset): New function.
880 (Sized_incr_relobj::local_symbol_count_): New data member.
881 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
882 (Sized_incr_relobj::local_symbol_index_): New data member.
883 (Sized_incr_relobj::local_symbol_offset_): New data member.
884 (Sized_incr_relobj::local_dynsym_offset_): New data member.
885 (Sized_incr_relobj::local_symbols_): New data member.
886 * object.h (Relobj::output_local_symbol_count): New function.
887 (Relobj::local_symbol_offset): New function.
888 (Relobj::do_output_local_symbol_count): New function.
889 (Relobj::do_local_symbol_offset): New function.
890 (Sized_relobj::do_output_local_symbol_count): New function.
891 (Sized_relobj::do_local_symbol_offset): New function.
892
893 2011-04-22 Vladimir Simonov <sv@sw.ru>
894
895 * descriptors.cc (set_close_on_exec): New function.
896 (Descriptors::open): Use set_close_on_exec.
897 * output.cc (S_ISLNK): Define if not defined.
898
899 2011-04-22 Cary Coutant <ccoutant@google.com>
900
901 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
902 global symbol map.
903 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
904 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
905 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
906 relocations.
907 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
908 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
909 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
910 * incremental.h
911 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
912 function.
913 (Incremental_binary::apply_incremental_relocs): New function.
914 (Incremental_binary::do_apply_incremental_relocs): New function.
915 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
916 data member.
917 (Sized_incremental_binary::add_global_symbol): New function.
918 (Sized_incremental_binary::global_symbol): New function.
919 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
920 (Sized_incremental_binary::symbol_map_): New data member.
921 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
922 * target.h (Sized_target::apply_relocation): New function.
923 * target-reloc.h (apply_relocation): New function.
924 * x86_64.cc (Target_x86_64::apply_relocation): New function.
925
926 2011-04-22 Doug Kwan <dougkwan@google.com>
927
928 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
929 flag of a SHT_ARM_EXIDX section.
930 * testsuite/Makefile.am (arm_exidx_test): New test rules.
931 * testsuite/Makefile.in: Regenerate.
932 * testsuite/arm_exidx_test.s: New file.
933 * testsuite/arm_exidx_test.sh: Same.
934
935 2011-04-20 Cary Coutant <ccoutant@google.com>
936
937 PR gold/12689
938 * archive.h (Incremental_archive_entry::Archive_member):
939 Initialize arg_serial_ (second constructor).
940
941 2011-04-17 Ian Lance Taylor <iant@google.com>
942
943 * object.cc (Relocate_info::location): Simplify location string.
944 * errors.cc (Errors::error_at_location): Don't print program
945 name.
946 (Errors::warning_at_location): Likewise.
947 (Errors::undefined_symbol): Likewise.
948 * testsuite/debug_msg.sh: Update accordingly.
949
950 2011-04-14 Cary Coutant <ccoutant@google.com>
951
952 * gold/layout.cc (Layout::symtab_section_offset): New function.
953 * gold/layout.h (Layout::symtab_section_offset): New function.
954 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
955
956 2011-04-12 Ian Lance Taylor <iant@google.com>
957
958 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
959 with MREMAP_MAYMOVE.
960 * output.h (class Output_file): Add map_is_allocated_ field.
961 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
962 not available, provide stubs. If mremap is not available, #define
963 it to gold_mremap.
964 (MREMAP_MAYMOVE): Define if not defined.
965 (Output_file::Output_file): Initialize map_is_allocated_.
966 (Output_file::resize): Check map_is_allocated_.
967 (Output_file::map_anonymous): If mmap fails, use malloc.
968 (Output_file::unmap): Don't do anything for an anonymous map.
969 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
970 is not available, provide stubs.
971 (File_read::View::~View): Use free rather than delete[].
972 (File_read::make_view): Use malloc rather than new[]. If mmap
973 fails, use malloc.
974 (File_read::find_or_make_view): Use malloc rather than new[].
975 * gold.h: Remove HAVE_REMAP code.
976 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
977 exists. Rename mremap to gold_mremap. If mmap is not available
978 don't do anything.
979 * configure, config.in: Rebuild.
980
981 2011-04-11 Ian Lance Taylor <iant@google.com>
982
983 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
984 initialize local variable v.
985
986 2011-04-11 Cary Coutant <ccoutant@google.com>
987
988 * archive.cc (Archive::include_member): Adjust call to
989 report_object.
990 (Add_archive_symbols::run): Track argument serial numbers.
991 (Lib_group::include_member): Likewise.
992 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
993 * archive.h (Incremental_archive_entry::Archive_member):
994 Initialize arg_serial_.
995 (Archive_member::arg_serial_): New data member.
996 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
997 (Sized_dynobj::do_add_symbols): Track symbols when doing an
998 incremental link.
999 (Sized_dynobj::do_for_all_local_got_entries): New function.
1000 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1001 function.
1002 * fileread.cc (get_mtime): New function.
1003 * fileread.h (get_mtime): New function.
1004 * gold.cc (queue_initial_tasks): Check for incremental update.
1005 (process_incremental_input): New function.
1006 (queue_middle_tasks): Don't force valid target for incremental
1007 update.
1008 * incremental-dump.cc (find_input_containing_global): Adjust
1009 size of symbol info entry.
1010 (dump_incremental_inputs): Dump argument serial number and
1011 in_system_directory flag; bias shndx by 1; print symbol names
1012 when dumping per-file symbol lists; use new symbol info readers.
1013 * incremental.cc
1014 (Output_section_incremental_inputs:update_data_size): New function.
1015 (Sized_incremental_binary::setup_readers): Setup input readers
1016 for each input file; build maps for files added from libraries
1017 and scripts.
1018 (Sized_incremental_binary::check_input_args): New function.
1019 (Sized_incremental_binary::do_check_inputs): Build map of argument
1020 serial numbers to input arguments.
1021 (Sized_incremental_binary::do_file_has_changed): Rename
1022 do_file_is_unchanged to this; compare file modification times.
1023 (Sized_incremental_binary::do_init_layout): New function.
1024 (Sized_incremental_binary::do_reserve_layout): New function.
1025 (Sized_incremental_binary::do_get_input_reader): Remove.
1026 (Sized_incremental_binary::get_symtab_view): New function.
1027 (Incremental_checker::can_incrementally_link_output_file): Remove.
1028 (Incremental_inputs::report_command_line): Exclude --debug options.
1029 (Incremental_inputs::report_archive_begin): Add parameter; track
1030 argument serial numbers; don't put input file entry for archive
1031 before archive members.
1032 (Incremental_inputs::report_archive_end): Put input file entry
1033 for archive after archive members.
1034 (Incremental_inputs::report_object): Add parameter; track argument
1035 serial numbers and in_system_directory flag.
1036 (Incremental_inputs::report_script): Add parameter; track argument
1037 serial numbers.
1038 (Output_section_incremental_inputs::set_final_data_size): Adjust
1039 size of symbol info entry; check for forwarding symbols.
1040 (Output_section_incremental_inputs::write_input_files): Write
1041 in_system_directory flag and argument serial number.
1042 (Output_section_incremental_inputs::write_info_blocks): Map section
1043 indices between incremental info and original input file; store
1044 input section index for each symbol.
1045 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1046 change operator() to visit().
1047 (class Global_got_offset_visitor): Likewise.
1048 (class Global_symbol_visitor_got_plt):
1049 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1050 classes.
1051 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1052 (Sized_incr_relobj::do_read_symbols): New function.
1053 (Sized_incr_relobj::do_layout): New function.
1054 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1055 (Sized_incr_relobj::do_add_symbols): New function.
1056 (Sized_incr_relobj::do_should_include_member): New function.
1057 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1058 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1059 (Sized_incr_relobj::do_section_size): New function.
1060 (Sized_incr_relobj::do_section_name): New function.
1061 (Sized_incr_relobj::do_section_contents): New function.
1062 (Sized_incr_relobj::do_section_flags): New function.
1063 (Sized_incr_relobj::do_section_entsize): New function.
1064 (Sized_incr_relobj::do_section_address): New function.
1065 (Sized_incr_relobj::do_section_type): New function.
1066 (Sized_incr_relobj::do_section_link): New function.
1067 (Sized_incr_relobj::do_section_info): New function.
1068 (Sized_incr_relobj::do_section_addralign): New function.
1069 (Sized_incr_relobj::do_initialize_xindex): New function.
1070 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1071 (Sized_incr_relobj::do_read_relocs): New function.
1072 (Sized_incr_relobj::do_gc_process_relocs): New function.
1073 (Sized_incr_relobj::do_scan_relocs): New function.
1074 (Sized_incr_relobj::do_count_local_symbols): New function.
1075 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1076 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1077 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1078 (Sized_incr_relobj::do_relocate): New function.
1079 (Sized_incr_relobj::do_set_section_offset): New function.
1080 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1081 (Sized_incr_dynobj::do_read_symbols): New function.
1082 (Sized_incr_dynobj::do_layout): New function.
1083 (Sized_incr_dynobj::do_add_symbols): New function.
1084 (Sized_incr_dynobj::do_should_include_member): New function.
1085 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1086 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1087 (Sized_incr_dynobj::do_section_size): New function.
1088 (Sized_incr_dynobj::do_section_name): New function.
1089 (Sized_incr_dynobj::do_section_contents): New function.
1090 (Sized_incr_dynobj::do_section_flags): New function.
1091 (Sized_incr_dynobj::do_section_entsize): New function.
1092 (Sized_incr_dynobj::do_section_address): New function.
1093 (Sized_incr_dynobj::do_section_type): New function.
1094 (Sized_incr_dynobj::do_section_link): New function.
1095 (Sized_incr_dynobj::do_section_info): New function.
1096 (Sized_incr_dynobj::do_section_addralign): New function.
1097 (Sized_incr_dynobj::do_initialize_xindex): New function.
1098 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1099 (make_sized_incremental_object): New function.
1100 (Incremental_library::copy_unused_symbols): New function.
1101 (Incremental_library::do_for_all_unused_symbols): New function.
1102 * incremental.h (enum Incremental_input_flags): New type.
1103 (class Incremental_checker): Remove.
1104 (Incremental_input_entry::Incremental_input_entry): Add argument
1105 serial number.
1106 (Incremental_input_entry::arg_serial): New function.
1107 (Incremental_input_entry::set_is_in_system_directory): New function.
1108 (Incremental_input_entry::is_in_system_directory): New function.
1109 (Incremental_input_entry::arg_serial_): New data member.
1110 (Incremental_input_entry::is_in_system_directory_): New data member.
1111 (class Script_info): Move here from script.h.
1112 (Script_info::Script_info): Add filename parameter.
1113 (Script_info::filename): New function.
1114 (Script_info::filename_): New data member.
1115 (Incremental_script_entry::Incremental_script_entry): Add argument
1116 serial number.
1117 (Incremental_object_entry::Incremental_object_entry): Likewise.
1118 (Incremental_object_entry::add_input_section): Build list of input
1119 sections with map to original shndx.
1120 (Incremental_object_entry::get_input_section_index): New function.
1121 (Incremental_object_entry::shndx_): New data member.
1122 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1123 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1124 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1125 serial number.
1126 (Incremental_inputs::report_archive_begin): Likewise.
1127 (Incremental_inputs::report_object): Likewise.
1128 (Incremental_inputs::report_script): Likewise.
1129 (class Incremental_global_symbol_reader): New class.
1130 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1131 and store flags and input file type.
1132 (Incremental_input_entry_reader::arg_serial): New function.
1133 (Incremental_input_entry_reader::type): Extract type from flags.
1134 (Incremental_input_entry_reader::is_in_system_directory): New function.
1135 (Incremental_input_entry_reader::get_input_section_count): Call
1136 accessor function for type.
1137 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1138 function for type; adjust size of global symbol entry.
1139 (Incremental_input_entry_reader::get_global_symbol_count): Call
1140 accessor function for type.
1141 (Incremental_input_entry_reader::get_object_count): Likewise.
1142 (Incremental_input_entry_reader::get_object_offset): Likewise.
1143 (Incremental_input_entry_reader::get_member_count): Likewise.
1144 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1145 (Incremental_input_entry_reader::get_member_offset): Likewise.
1146 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1147 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1148 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1149 (Incremental_input_entry_reader::get_global_symbol_reader): New
1150 function.
1151 (Incremental_input_entry_reader::get_output_symbol_index): New
1152 function.
1153 (Incremental_input_entry_reader::type_): Remove.
1154 (Incremental_input_entry_reader::flags_): New data member.
1155 (Incremental_inputs_reader::input_file_offset): New function.
1156 (Incremental_inputs_reader::input_file_index): New function.
1157 (Incremental_inputs_reader::input_file): Call input_file_offset.
1158 (Incremental_inputs_reader::input_file_at_offset): New function.
1159 (Incremental_relocs_reader::get_r_type): Reformat.
1160 (Incremental_relocs_reader::get_r_shndx): Reformat.
1161 (Incremental_relocs_reader::get_r_offset): Reformat.
1162 (Incremental_relocs_reader::data): New function.
1163 (Incremental_binary::Incremental_binary): Initialize new data members.
1164 (Incremental_binary::check_inputs): Add cmdline parameter.
1165 (Incremental_binary::file_is_unchanged): Remove.
1166 (Input_reader::arg_serial): New function.
1167 (Input_reader::get_unused_symbol_count): New function.
1168 (Input_reader::get_unused_symbol): New function.
1169 (Input_reader::do_arg_serial): New function.
1170 (Input_reader::do_get_unused_symbol_count): New function.
1171 (Input_reader::do_get_unused_symbol): New function.
1172 (Incremental_binary::input_file_count): New function.
1173 (Incremental_binary::get_input_reader): Change signature to use
1174 index instead of filename.
1175 (Incremental_binary::file_has_changed): New function.
1176 (Incremental_binary::get_input_argument): New function.
1177 (Incremental_binary::get_library): New function.
1178 (Incremental_binary::get_script_info): New function.
1179 (Incremental_binary::init_layout): New function.
1180 (Incremental_binary::reserve_layout): New function.
1181 (Incremental_binary::output_file): New function.
1182 (Incremental_binary::do_check_inputs): New function.
1183 (Incremental_binary::do_file_is_unchanged): Remove.
1184 (Incremental_binary::do_file_has_changed): New function.
1185 (Incremental_binary::do_init_layout): New function.
1186 (Incremental_binary::do_reserve_layout): New function.
1187 (Incremental_binary::do_input_file_count): New function.
1188 (Incremental_binary::do_get_input_reader): Change signature.
1189 (Incremental_binary::input_args_map_): New data member.
1190 (Incremental_binary::library_map_): New data member.
1191 (Incremental_binary::script_map_): New data member.
1192 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1193 new data members.
1194 (Sized_incremental_binary::output_section): New function.
1195 (Sized_incremental_binary::inputs_reader): Add const.
1196 (Sized_incremental_binary::symtab_reader): Add const.
1197 (Sized_incremental_binary::relocs_reader): Add const.
1198 (Sized_incremental_binary::got_plt_reader): Add const.
1199 (Sized_incremental_binary::get_symtab_view): New function.
1200 (Sized_incremental_binary::Inputs_reader): New typedef.
1201 (Sized_incremental_binary::Input_entry_reader): New typedef.
1202 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1203 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1204 (Sized_incremental_binary::do_file_has_changed): New function.
1205 (Sized_incremental_binary::do_init_layout): New function.
1206 (Sized_incremental_binary::do_reserve_layout): New function.
1207 (Sized_input_reader::Inputs_reader): Remove.
1208 (Sized_input_reader::Input_entry_reader): Remove.
1209 (Sized_input_reader::do_arg_serial): New function.
1210 (Sized_input_reader::do_get_unused_symbol_count): New function.
1211 (Sized_input_reader::do_get_unused_symbol): New function.
1212 (Sized_incremental_binary::do_input_file_count): New function.
1213 (Sized_incremental_binary::do_get_input_reader): Change signature;
1214 use index instead of filename.
1215 (Sized_incremental_binary::section_map_): New data member.
1216 (Sized_incremental_binary::input_entry_readers_): New data member.
1217 (class Sized_incr_relobj): New class.
1218 (class Sized_incr_dynobj): New class.
1219 (make_sized_incremental_object): New function.
1220 (class Incremental_library): New class.
1221 * layout.cc (Free_list::num_lists): New static data member.
1222 (Free_list::num_nodes): New static data member.
1223 (Free_list::num_removes): New static data member.
1224 (Free_list::num_remove_visits): New static data member.
1225 (Free_list::num_allocates): New static data member.
1226 (Free_list::num_allocate_visits): New static data member.
1227 (Free_list::init): New function.
1228 (Free_list::remove): New function.
1229 (Free_list::allocate): New function.
1230 (Free_list::dump): New function.
1231 (Free_list::print_stats): New function.
1232 (Layout_task_runner::run): Resize output file for incremental updates.
1233 (Layout::Layout): Initialize new data members.
1234 (Layout::set_incremental_base): New function.
1235 (Layout::init_fixed_output_section): New function.
1236 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1237 incremental updates.
1238 (Layout::create_gold_note): Do not create gold note section for
1239 incremental updates.
1240 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1241 for incremental updates.
1242 (Layout::set_section_offsets): For incremental updates, allocate space
1243 from free list.
1244 (Layout::create_symtab_sections): Layout with offsets relative to
1245 start of section; for incremental updates, allocate space from free
1246 list.
1247 (Layout::create_shdrs): For incremental updates, allocate space from
1248 free list.
1249 (Layout::finish_dynamic_section): For incremental updates, do not
1250 check --as-needed (fixed in subsequent patch).
1251 * layout.h (class Free_list): New class.
1252 (Layout::set_incremental_base): New function.
1253 (Layout::incremental_base): New function.
1254 (Layout::init_fixed_output_section): New function.
1255 (Layout::allocate): New function.
1256 (Layout::incremental_base_): New data member.
1257 (Layout::free_list_): New data member.
1258 * main.cc (main): Print Free_list statistics.
1259 * object.cc (Relobj::finalize_incremental_relocs): Add
1260 clear_counts parameter; clear counts only when clear_counts is set.
1261 (Sized_relobj::Sized_relobj): Initialize new base class.
1262 (Sized_relobj::do_layout): Don't report special sections.
1263 (Sized_relobj::do_for_all_local_got_entries): New function.
1264 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1265 symtab_off to all symbol table offsets.
1266 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1267 * object.h (class Got_offset_list): Move to top of file.
1268 (Object::Object): Allow case where input_file == NULL.
1269 (Object::~Object): Likewise.
1270 (Object::input_file): Assert that input_file != NULL.
1271 (Object::lock): Allow case where input_file == NULL.
1272 (Object::unlock): Likewise.
1273 (Object::is_locked): Likewise.
1274 (Object::token): Likewise.
1275 (Object::release): Likewise.
1276 (Object::is_incremental): New function.
1277 (Object::get_mtime): New function.
1278 (Object::for_all_local_got_entries): New function.
1279 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1280 (Object::set_is_in_system_directory): New function.
1281 (Object::is_in_system_directory): New function.
1282 (Object::do_is_incremental): New function.
1283 (Object::do_get_mtime): New function.
1284 (Object::do_for_all_local_got_entries): New function.
1285 (Object::is_in_system_directory_): New data member.
1286 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1287 (class Sized_relobj_base): New class.
1288 (class Sized_relobj): Derive from Sized_relobj_base.
1289 (class Sized_relobj::Symbols): Redeclare from base class.
1290 (class Sized_relobj::local_got_offset_list): Remove.
1291 (class Sized_relobj::Output_sections): Redeclare from base class.
1292 (class Sized_relobj::do_for_all_local_got_entries): New function.
1293 (class Sized_relobj::write_local_symbols): Add offset parameter.
1294 (class Sized_relobj::local_symbol_offset_): Update comment.
1295 (class Sized_relobj::local_dynsym_offset_): Update comment.
1296 * options.cc (Input_arguments::add_file): Remove const.
1297 * options.h (Input_file_argument::Input_file_argument):
1298 Initialize arg_serial_ (all constructors).
1299 (Input_file_argument::set_arg_serial): New function.
1300 (Input_file_argument::arg_serial): New function.
1301 (Input_file_argument::arg_serial_): New data member.
1302 (Input_arguments::Input_arguments): Initialize file_count_.
1303 (Input_arguments::add_file): Remove const.
1304 (Input_arguments::number_of_input_files): New function.
1305 (Input_arguments::file_count_): New data member.
1306 (Command_line::number_of_input_files): Call
1307 Input_arguments::number_of_input_files.
1308 * output.cc (Output_segment_headers::Output_segment_headers):
1309 Set current size.
1310 (Output_section::Input_section::current_data_size): New function.
1311 (Output_section::Output_section): Initialize new data members.
1312 (Output_section::add_input_section): Don't do merge sections for
1313 an incremental link; allocate space from free list for an
1314 incremental update.
1315 (Output_section::add_output_section_data): Allocate space from
1316 free list for an incremental update.
1317 (Output_section::update_data_size): New function.
1318 (Output_section::set_fixed_layout): New function.
1319 (Output_section::reserve): New function.
1320 (Output_segment::set_section_addresses): Remove const.
1321 (Output_segment::set_section_list_addresses): Remove const; allocate
1322 space from free list for an incremental update.
1323 (Output_segment::set_offset): Adjust size of RELRO segment for an
1324 incremental update.
1325 * output.h (Output_data::current_data_size): Move here from
1326 child classes.
1327 (Output_data::pre_finalize_data_size): New function.
1328 (Output_data::update_data_size): New function.
1329 (Output_section_headers::update_data_size): new function.
1330 (Output_section_data_build::current_data_size): Move to Output_data.
1331 (Output_data_strtab::update_data_size): New function.
1332 (Output_section::current_data_size): Move to Output_data.
1333 (Output_section::set_fixed_layout): New function.
1334 (Output_section::has_fixed_layout): New function.
1335 (Output_section::reserve): New function.
1336 (Output_section::update_data_size): New function.
1337 (Output_section::has_fixed_layout_): New data member.
1338 (Output_section::free_list_): New data member.
1339 (Output_segment::set_section_addresses): Remove const.
1340 (Output_segment::set_section_list_addresses): Remove const.
1341 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1342 New function.
1343 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1344 New function.
1345 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1346 parameter when calling Add_symbols constructor; store argument
1347 serial number for members of a lib group.
1348 (Add_symbols::locks): Allow case where token == NULL.
1349 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1350 (Read_member::~Read_member): New function.
1351 (Read_member::is_runnable): New function.
1352 (Read_member::locks): New function.
1353 (Read_member::run): New function.
1354 (Check_script::~Check_script): New function.
1355 (Check_script::is_runnable): New function.
1356 (Check_script::locks): New function.
1357 (Check_script::run): New function.
1358 (Check_library::~Check_library): New function.
1359 (Check_library::is_runnable): New function.
1360 (Check_library::locks): New function.
1361 (Check_library::run): New function.
1362 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1363 (Add_symbols::library_): New data member.
1364 (class Read_member): New class.
1365 (class Check_script): New class.
1366 (class Check_library): New class.
1367 * reloc.cc (Read_relocs::is_runnable): Allow case where
1368 token == NULL.
1369 (Read_relocs::locks): Likewise.
1370 (Scan_relocs::locks): Likewise.
1371 (Relocate_task::locks): Likewise.
1372 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1373 to clear counters.
1374 (Sized_relobj::incremental_relocs_scan): Fix comment.
1375 (Sized_relobj::do_relocate): Pass output file offset to
1376 write_local_symbols.
1377 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1378 from class declaration.
1379 * script.cc (read_input_script): Allocate Script_info; pass
1380 argument serial number to report_script.
1381 * script.h (class Script_info): Move to incremental.h.
1382 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1383 * symtab.h (Symbol_table::add_from_incrobj): New function.
1384 (Symbol_table::set_file_offset): New function.
1385
1386 2011-04-05 Cary Coutant <ccoutant@google.com>
1387
1388 * incremental-dump.cc (dump_incremental_inputs): Change signature
1389 to take a Sized_incremental_binary; change caller. Use readers
1390 in Sized_incremental_binary.
1391 * incremental.cc
1392 (Sized_incremental_binary::find_incremental_inputs_sections):
1393 Rename do_find_incremental_inputs_sections to this.
1394 (Sized_incremental_binary::setup_readers): New function.
1395 (Sized_incremental_binary::do_check_inputs): Check
1396 has_incremental_info_ flag; move setup code to setup_readers;
1397 use input readers.
1398 (Sized_incremental_binary::do_file_is_unchanged): New function.
1399 (Sized_incremental_binary::do_get_input_reader): New function.
1400 * incremental.h (class Incremental_binary): Move to end of file.
1401 (Incremental_binary::file_is_unchanged): New function.
1402 (Incremental_binary::do_file_is_unchanged): New function.
1403 (Incremental_binary::Input_reader): New class.
1404 (Incremental_binary::get_input_reader): New function.
1405 (class Sized_incremental_binary): Move to end of file.
1406 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1407 input section reader classes.
1408 (Sized_incremental_binary::has_incremental_info): New function.
1409 (Sized_incremental_binary::inputs_reader): New function.
1410 (Sized_incremental_binary::symtab_reader): New function.
1411 (Sized_incremental_binary::relocs_reader): New function.
1412 (Sized_incremental_binary::got_plt_reader): New function.
1413 (Sized_incremental_binary::do_file_is_unchanged): New function.
1414 (Sized_incremental_binary::Sized_input_reader): New class.
1415 (Sized_incremental_binary::get_input_reader): New function.
1416 (Sized_incremental_binary::find_incremental_inputs_sections):
1417 Rename do_find_incremental_inputs_sections to this.
1418 (Sized_incremental_binary::setup_readers): New function.
1419 (Sized_incremental_binary::has_incremental_info_): New data member.
1420 (Sized_incremental_binary::inputs_reader_): New data member.
1421 (Sized_incremental_binary::symtab_reader_): New data member.
1422 (Sized_incremental_binary::relocs_reader_): New data member.
1423 (Sized_incremental_binary::got_plt_reader_): New data member.
1424 (Sized_incremental_binary::current_input_file_): New data member.
1425
1426 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1427
1428 PR gold/12640
1429 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1430 violation.
1431
1432 2011-03-30 Cary Coutant <ccoutant@google.com>
1433
1434 * archive.cc (Archive::include_member): Adjust call to report_object.
1435 (Add_archive_symbols::run): Add script_info to call to
1436 report_archive_begin.
1437 (Lib_group::include_member): Adjust call to report_object.
1438 (Add_lib_group_symbols::run): Adjust call to report_object.
1439 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1440 blocks. Add object count for script input files.
1441 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1442 script_info parameter; change all callers.
1443 (Incremental_inputs::report_object): Add script_info parameter;
1444 change all callers.
1445 (Incremental_inputs::report_script): Store backpointer to
1446 incremental info entry.
1447 (Output_section_incremental_inputs::set_final_data_size): Record
1448 additional information for scripts.
1449 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1450 * incremental.h (Incremental_script_entry::add_object): New function.
1451 (Incremental_script_entry::get_object_count): New function.
1452 (Incremental_script_entry::get_object): New function.
1453 (Incremental_script_entry::objects_): New data member; adjust
1454 constructor.
1455 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1456 (Incremental_inputs::report_object): Add script_info parameter.
1457 (Incremental_inputs_reader::get_object_count): New function.
1458 (Incremental_inputs_reader::get_object_offset): New function.
1459 * options.cc (Input_arguments::add_file): Return reference to
1460 new input argument.
1461 * options.h (Input_argument::set_script_info): New function.
1462 (Input_argument::script_info): New function.
1463 (Input_argument::script_info_): New data member; adjust all
1464 constructors.
1465 (Input_file_group::add_file): Return reference to new input argument.
1466 (Input_file_lib::add_file): Likewise.
1467 (Input_arguments::add_file): Likewise.
1468 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1469 * script.cc (Parser_closure::Parser_closure): Add script_info
1470 parameter; adjust all callers.
1471 (Parser_closure::script_info): New function.
1472 (Parser_closure::script_info_): New data member.
1473 (read_input_script): Report scripts earlier to incremental info.
1474 (script_add_file): Set script_info in Input_argument.
1475 (script_add_library): Likewise.
1476 * script.h (Script_options::Script_info): Rewrite class.
1477
1478 2011-03-29 Cary Coutant <ccoutant@google.com>
1479
1480 * archive.cc (Library_base::should_include_member): Move
1481 method here from class Archive.
1482 (Archive::Archive): Initialize base class.
1483 (Archive::should_include_member): Move to base class.
1484 (Archive::do_for_all_unused_symbols): New function.
1485 (Add_archive_symbols::run): Remove redundant access to
1486 incremental_inputs.
1487 (Lib_group::Lib_group): Initialize base class.
1488 (Lib_group::do_filename): New function.
1489 (Lib_group::include_member): Pass pointer to Lib_group to
1490 report_object.
1491 (Lib_group::do_for_all_unused_symbols): New function.
1492 (Add_lib_group_symbols::run): Report archive information for
1493 incremental links.
1494 * archive.h (class Library_base): New base class.
1495 (class Archive): Derive from Library_base.
1496 (Archive::filename): Move to base class.
1497 (Archive::set_incremental_info): Likewise.
1498 (Archive::incremental_info): Likewise.
1499 (Archive::Should_include): Likewise.
1500 (Archive::should_include_member): Likewise.
1501 (Archive::Armap_entry): Remove.
1502 (Archive::Unused_symbol_iterator): Remove.
1503 (Archive::unused_symbols_begin): Remove.
1504 (Archive::unused_symbols_end): Remove.
1505 (Archive::do_filename): New function.
1506 (Archive::do_get_mtime): New function.
1507 (Archive::do_for_all_unused_symbols): New function.
1508 (Archive::task_): Move to base class.
1509 (Archive::incremental_info_): Likewise.
1510 (class Lib_group): Derive from Library_base.
1511 (Lib_group::do_filename): New function.
1512 (Lib_group::do_get_mtime): New function.
1513 (Lib_group::do_for_all_unused_symbols): New function.
1514 (Lib_group::task_): Move to base class.
1515 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1516 function.
1517 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1518 function.
1519 * incremental.cc (Incremental_inputs::report_archive_begin):
1520 Use Library_base; call library's get_mtime; add incremental inputs
1521 entry before members.
1522 (class Unused_symbol_visitor): New class.
1523 (Incremental_inputs::report_archive_end): Use Library_base; use
1524 visitor class to record unused symbols; don't add incremental inputs
1525 entry after members.
1526 (Incremental_inputs::report_object): Use Library_base.
1527 * incremental.h
1528 (Incremental_archive_entry::Incremental_archive_entry): Remove
1529 unused Archive parameter.
1530 (Incremental_inputs::report_archive_begin): Use Library_base.
1531 (Incremental_inputs::report_archive_end): Likewise.
1532 (Incremental_inputs::report_object): Likewise.
1533 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1534 function.
1535 * object.h (Object::for_all_global_symbols): New function.
1536 (Object::do_for_all_global_symbols): New function.
1537 (Sized_relobj::do_for_all_global_symbols): New function.
1538 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1539 function.
1540 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1541 function.
1542
1543 2011-03-27 Ian Lance Taylor <iant@google.com>
1544
1545 * archive.cc (Archive::interpret_header): Return -1 if something
1546 goes wrong. Change callers accordingly.
1547
1548 2011-03-25 Cary Coutant <ccoutant@google.com>
1549
1550 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1551 * testsuite/Makefile.in: Regenerate.
1552
1553 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1554
1555 * plugin.cc (get_view): New.
1556 (Plugin::load): Pass get_view to the plugin.
1557 (Plugin_manager::get_view): New.
1558
1559 2011-03-21 Ian Lance Taylor <iant@google.com>
1560
1561 * testsuite/final_layout.sh: Rewrite to not use dc.
1562 * testsuite/relro_test.sh: Fail if dc is not present.
1563
1564 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1565
1566 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1567 Change == to -eq.
1568 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1569 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1570 Change == to -eq.
1571 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1572 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1573
1574 2011-03-14 Ian Lance Taylor <iant@google.com>
1575
1576 * script-sections.cc (Sort_output_sections::script_compare):
1577 Rename from is_before, change return type.
1578 (Sort_output_sections::operator()): Adjust accordingly.
1579
1580 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1581
1582 PR gold/12572
1583 * testsuite/odr_violation2.cc: Add comment to make all error line
1584 numbers double digits.
1585 * testsuite/debug_msg.sh: Adjust expected errors.
1586
1587 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1588
1589 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1590 but mark earlier ones as non-canonical
1591 (offset_to_iterator): Update search target and example
1592 (do_addr2line): Return extra lines in a vector*
1593 (format_file_lineno): Extract from do_addr2line
1594 (one_addr2line): Add vector* out-param
1595 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1596 when a lineno entry appeared last for its instruction
1597 (Dwarf_line_info): Add vector* out-param
1598 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1599 * symtab.cc (Odr_violation_compare): Include the lineno in the
1600 comparison again.
1601 (linenos_from_loc): New. Combine the canonical line for an
1602 address with its other lines.
1603 (True_if_intersect): New. Helper functor to make
1604 std::set_intersection a query.
1605 (detect_odr_violations): Compare sets of lines instead of just
1606 one line for each function. This became less deterministic, but
1607 has fewer false positives.
1608 * symtab.h: Declarations.
1609 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1610 mix an optimized and non-optimized object in the same binary
1611 (odr_violation2.so): Same.
1612 * testsuite/Makefile.in: Regenerate from Makefile.am.
1613 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1614 * testsuite/debug_msg.sh: Update line numbers and add
1615 assertions.
1616 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1617 non-optimized context.
1618 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1619 isn't inlined, and use OdrDerived in an optimized context.
1620 * testsuite/odr_header1.h: Defines OdrDerived, where
1621 optimization will change the
1622 first-instruction-in-the-destructor's file and line number.
1623 * testsuite/odr_header2.h: Defines OdrBase.
1624
1625 2011-03-09 Ian Lance Taylor <iant@google.com>
1626
1627 * fileread.cc (File_read::clear_views): Don't delete the whole
1628 file view.
1629
1630 2011-03-08 Ian Lance Taylor <iant@google.com>
1631
1632 PR gold/12525
1633 * fileread.cc: #include <climits>.
1634 (GOLD_IOV_MAX): Define.
1635 (File_read::read_multiple): Limit number of entries by iov_max.
1636 * fileread.h (class File_read): Always set max_readv_entries to
1637 128.
1638
1639 2011-03-07 Ian Lance Taylor <iant@google.com>
1640
1641 PR gold/12525
1642 * options.h (class General_options): Add -dy and -dn.
1643
1644 2011-03-02 Cary Coutant <ccoutant@google.com>
1645
1646 * testsuite/script_test_9.t: Add TLS segment.
1647
1648 2011-03-02 Simon Baldwin <simonb@google.com>
1649
1650 * configure.ac: Add check for gnu_indirect_function support in
1651 the toolchain building binutils.
1652 * configure: Rebuild.
1653
1654 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1655
1656 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1657 plugin only symbols.
1658 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1659 in plugin files as not needed in the symbol table.
1660
1661 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1662
1663 * output.cc (Output_section::add_input_section): Delay fill
1664 generation for section ordering.
1665
1666 2011-02-09 Ian Lance Taylor <iant@google.com>
1667
1668 PR gold/12316
1669 * object.h (class Sized_relobj): Remove clear_local_symbols.
1670 * reloc.cc (Sized_relobj::do_relocate): Don't call
1671 clear_local_symbols.
1672
1673 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1674
1675 * plugin.cc (is_visible_from_outside): Return true for symbols
1676 in the -u option.
1677
1678 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1679
1680 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1681 filename.
1682
1683 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1684
1685 * icf.h (is_section_foldable_candidate): Change type of parameter
1686 to std::string.
1687 * icf.cc (Icf::find_identical_sections): Change type of local variable
1688 section_name to be std::string.
1689 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1690
1691 2011-01-25 Ian Lance Taylor <iant@google.com>
1692
1693 * script.cc (script_add_extern): Rewrite to use
1694 add_symbol_reference.
1695
1696 2011-01-25 Doug Kwan <dougkwan@google.com>
1697
1698 * icf.cc (get_section_contents): Always lock section's object.
1699
1700 2011-01-24 Ian Lance Taylor <iant@google.com>
1701
1702 * options.h (class General_options): Accept
1703 --no-detect-odr-violations.
1704
1705 2011-01-24 Ian Lance Taylor <iant@google.com>
1706
1707 * version.cc (version_string): Bump to 1.11.
1708
1709 2011-01-24 Ian Lance Taylor <iant@google.com>
1710
1711 * plugin.cc (class Plugin_rescan): Define new class.
1712 (Plugin_manager::claim_file): Set any_claimed_.
1713 (Plugin_manager::save_archive): New function.
1714 (Plugin_manager::save_input_group): New function.
1715 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1716 necessary.
1717 (Plugin_manager::new_undefined_symbol): New function.
1718 (Plugin_manager::rescan): New function.
1719 (Plugin_manager::rescannable_defines): New function.
1720 (Plugin_manager::add_input_file): Set any_added_.
1721 * plugin.h (class Plugin_manager): define new fields rescannable_,
1722 undefined_symbols_, any_claimed_, and any_added_. Declare
1723 Plugin_rescan as friend. Declare new functions.
1724 (Plugin_manager::Rescannable): Define type.
1725 (Plugin_manager::Rescannable_list): Define type.
1726 (Plugin_manager::Undefined_symbol_list): Define type.
1727 (Plugin_manager::Plugin_manager): Initialize new fields.
1728 * archive.cc (Archive::defines_symbol): New function.
1729 (Add_archive_symbols::run): Pass archive to plugins if any.
1730 * archive.h (class Archive): Declare defines_symbol.
1731 * readsyms.cc (Input_group::~Input_group): New function.
1732 (Finish_group::run): Pass input_group to plugins if any.
1733 * readsyms.h (class Input_group): Declare destructor.
1734 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1735 any.
1736
1737 2011-01-10 Ian Lance Taylor <iant@google.com>
1738
1739 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1740 section as relro.
1741 (Layout::set_segment_offsets): Reset increase_relro before calling
1742 set_section_addresses a second time.
1743
1744 2011-01-04 Cary Coutant <ccoutant@google.com>
1745
1746 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1747 sections before NOBITS sections.
1748
1749 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1750
1751 * version.cc (print_version): Update copyright to 2011.
1752
1753 2010-12-23 Cary Coutant <ccoutant@google.com>
1754
1755 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1756 of OS to this->add. Add OD parameter to second form of the function.
1757
1758 2010-12-20 Ian Lance Taylor <iant@google.com>
1759
1760 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1761 second of two consecutive entries with same offset.
1762
1763 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1764
1765 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1766 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1767 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1768 to avoid unneeded links against $(LDADD).
1769 * testsuite/Makefile.in: Regenerate.
1770
1771 2010-12-15 Ian Lance Taylor <iant@google.com>
1772
1773 PR gold/12324
1774 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1775 for R_X86_64_32 and R_X86_64_PC32.
1776 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1777 ver_matching_def_pic.o.
1778 (ver_matching_def_pic.o): New target.
1779
1780 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1781
1782 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1783 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1784 Move definition before File_read::View member definitions.
1785 (File_read::View::~View): Initialize and hold lock before
1786 updating current_mapped_bytes.
1787
1788 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1789
1790 * dwarf_reader.cc: Remove outdated comment.
1791 * gold-threads.cc: Fix typo in error message.
1792 * archive.cc: Fix typos in comments.
1793 * archive.h: Likewise.
1794 * arm-reloc-property.cc: Likewise.
1795 * arm-reloc-property.h: Likewise.
1796 * arm-reloc.def: Likewise.
1797 * arm.cc: Likewise.
1798 * attributes.h: Likewise.
1799 * cref.cc: Likewise.
1800 * ehframe.cc: Likewise.
1801 * fileread.h: Likewise.
1802 * gold.h: Likewise.
1803 * i386.cc: Likewise.
1804 * icf.cc: Likewise.
1805 * incremental.h: Likewise.
1806 * int_encoding.cc: Likewise.
1807 * layout.h: Likewise.
1808 * main.cc: Likewise.
1809 * merge.h: Likewise.
1810 * object.cc: Likewise.
1811 * object.h: Likewise.
1812 * options.cc: Likewise.
1813 * readsyms.cc: Likewise.
1814 * reduced_debug_output.cc: Likewise.
1815 * reloc.cc: Likewise.
1816 * script-sections.cc: Likewise.
1817 * sparc.cc: Likewise.
1818 * symtab.h: Likewise.
1819 * target-reloc.h: Likewise.
1820 * target.cc: Likewise.
1821 * target.h: Likewise.
1822 * timer.cc: Likewise.
1823 * timer.h: Likewise.
1824 * x86_64.cc: Likewise.
1825
1826 2010-12-09 Cary Coutant <ccoutant@google.com>
1827
1828 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1829 stack.
1830 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1831 parameter; change all callers.
1832 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1833 * options.h (warn_execstack): New option.
1834
1835 2010-12-07 Doug Kwan <dougkwan@google.com>
1836
1837 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1838 like function call relocations.
1839
1840 2010-12-07 Ian Lance Taylor <iant@google.com>
1841
1842 * archive.cc (Archive::get_elf_object_for_member): Permit
1843 punconfigured to be NULL.
1844 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1845 (Archive::include_member): Pass NULL to get_elf_object_for_member
1846 if we searched for the archive and this is the first included
1847 object.
1848
1849 2010-12-01 Ian Lance Taylor <iant@google.com>
1850
1851 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1852 track_relocs_type_ field.
1853 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1854 Set track_relocs_type_.
1855 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1856 contents when using RELA relocs.
1857 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1858 reloc_map_.
1859 * reloc.cc (Track_relocs::next_addend): New function.
1860 * reloc.h (class Track_relocs): Declare next_addend.
1861
1862 2010-12-01 Ian Lance Taylor <iant@google.com>
1863
1864 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1865 virtual destructor.
1866
1867 2010-12-01 Ian Lance Taylor <iant@google.com>
1868
1869 * README: Update compilers known to work and fail.
1870
1871 2010-11-23 Matthias Klose <doko@ubuntu.com>
1872
1873 * configure.in: For --enable-gold, handle value `default' instead of
1874 `both*'. Always install ld as ld.bfd, install as ld if gold is
1875 not the default.
1876 * configure: Regenerate.
1877
1878 2010-11-18 Doug Kwan <dougkwan@google.com>
1879
1880 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1881 and right_alignment to be zero. Store result alignment only if it is
1882 greater than existing alignment.
1883
1884 2010-11-16 Cary Coutant <ccoutant@google.com>
1885
1886 PR gold/12220
1887 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1888 Check for ".zdebug_line".
1889
1890 2010-11-16 Doug Kwan <dougkwan@google.com>
1891 Cary Coutant <ccoutant@google.com>
1892
1893 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1894 by reference; adjust all callers.
1895 * output.cc (Output_segment::set_section_addresses): Adjust references
1896 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1897 list is empty.
1898 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1899 end at page boundary.
1900
1901 2010-11-16 Cary Coutant <ccoutant@google.com>
1902
1903 PR gold/12220
1904 * layout.cc (Layout::choose_output_section): Transform names of
1905 compressed sections even when using a script with a SECTIONS clause.
1906 (Layout::output_section_name): Remove code to transform
1907 compressed debug section names.
1908 * output.cc (Output_section::add_input_section): Use uncompressed
1909 section size when tracking input sections.
1910
1911 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1912
1913 * symtab.h (Symbol::NON_PIC_REF): Remove.
1914 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1915 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1916 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1917 (Symbol::use_plt_offset): Take a flags argument and pass it
1918 directly to needs_dynamic_reloc. Restrict check for undefined
1919 weak symbols to function calls.
1920 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1921 (Target_arm::Scan::global): Use it.
1922 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1923 (Target_arm::Relocate::relocate): Likewise.
1924 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1925 parameter with an r_type parameter. Use get_reference_flags
1926 to get the flags.
1927 (Target_arm::Relocate::relocate): Update accordingly.
1928 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1929 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1930 (Target_i386::Scan::global): Likewise.
1931 (Target_i386::Relocate::relocate): Likewise.
1932 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1933 parameter with an r_type parameter. Use get_reference_flags
1934 to get the flags.
1935 (Target_i386::Relocate::relocate): Update accordingly.
1936 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1937 (Target_powerpc::Scan::global): Use it.
1938 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1939 (Target_powerpc::Relocate::relocate): Likewise.
1940 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1941 (Target_sparc::Scan::global): Use it.
1942 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1943 (Target_sparc::Relocate::relocate): Likewise.
1944 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1945 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1946 (Target_x86_64::Scan::global): Likewise.
1947 (Target_x86_64::Relocate::relocate): Likewise.
1948
1949 2010-11-08 Doug Kwan <dougkwan@google.com>
1950 Cary Coutant <ccoutant@google.com>
1951
1952 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1953 (Arm_exidx_merge_section::section_contents_): New data member.
1954 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1955 (Arm_input_section::~Arm_input_section): De-allocate memory.
1956 (Arm_input_section::original_contents_): New data member.
1957 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1958 in parameters instead of calling Object::section_contents without
1959 locking.
1960 (Arm_output_section::group_section): New parameter TASK. Pass it
1961 to callees that need locking objects.
1962 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1963 to lock EXIDX input sections. Fix a formatting issue. Call
1964 Arm_exidx_merged_section::build_contents to create merged section
1965 contents.
1966 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1967 to lock object of stub table owner.
1968 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1969 TEXT_SIZE to initialize data member TEXT_SIZE_.
1970 (Arm_exidx_input_section::addralign): Fix typo in comment.
1971 (Arm_exidx_input_section::text_size): New method.
1972 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1973 that require locking objects. Lock objects before scanning for stubs
1974 and updating local symbols.
1975 (Arm_input_section<big_endian>::init): Copy contents of original
1976 input section.
1977 (Arm_input_section<big_endian>::do_write): Use saved contents of
1978 original input section instead of calling Object::section_contents
1979 without locking.
1980 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1981 size without calling Object::section_size().
1982 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1983 for size. Allocate a buffer for merged EXIDX entries.
1984 (Arm_exidx_merged_section::build_contents): New method.
1985 (Arm_exidx_merged_section::do_write): Move merge section contents
1986 building code to Arm_exidx_merged_section::build_contetns. Write
1987 out contetns in buffer instead of building it on the fly.
1988 (Arm_relobj::make_exidx_input_section): Also pass text section size
1989 to Arm_exidx_input_section constructor.
1990 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1991 (Arm_dynobj::do_read_symbols): Fix memory leak.
1992 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1993 * target.h: (class Task): Add forward declaration.
1994 (Target::relax): Add new parameter TASK and pass it to
1995 Target::do_relax().
1996 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1997
1998 2010-11-05 Cary Coutant <ccoutant@google.com>
1999
2000 PR gold/10708
2001 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2002 object when reading from the file.
2003 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2004 second layout pass.
2005 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2006 when reading section contents.
2007 (get_section_contents): Likewise.
2008 (icf::find_identical_sections): Likewise.
2009 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2010 object when reading from the file.
2011 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2012 the object when doing deferred section layout.
2013
2014 2010-11-03 Nick Clifton <nickc@redhat.com>
2015
2016 PR gold/12001
2017 * script.h (class Symbol_assignment: name): New member. Returns
2018 the name of the symbol.
2019 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2020 Returns true if the given symbol name is on the list of
2021 assignments wating to be processed.
2022 * archive.cc (should_incldue_member): If the symbol is undefined,
2023 check to see if it is on the list of symbols pending assignment.
2024
2025 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2026
2027 * script-sections.cc (Script_sections::find_memory_region): Check
2028 for a NULL output section pointer.
2029
2030 2010-10-29 Doug Kwan <dougkwan@google.com>
2031
2032 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2033 Output_section::add_relaxed_input_section.
2034 * output.cc (Output_section::add_relaxed_input_section): Add new
2035 arguments LAYOUT and NAME. Set section order index.
2036 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2037 Copy section order index.
2038 * output.h (Output_section::add_relaxed_input_section): Add new
2039 arguments LAYOUT and NAME.
2040
2041 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2042
2043 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2044 NATIVE_OR_CROSS_LINKER.
2045 * testsuite/Makefile.in: Regenerate.
2046
2047 2010-10-20 Doug Kwan <dougkwan@google.com>
2048
2049 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2050 without SHF_LINK_ORDER flags.
2051 * layout.cc (Layout::choose_output_section): Do not filter
2052 SHF_LINK_ORDER flag in a relocatable link.
2053
2054 2010-10-17 Cary Coutant <ccoutant@google.com>
2055
2056 * output.h (Output_segment::set_section_addresses): Change function
2057 signature. Update all callers.
2058 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2059 sections.
2060 (Output_segment::set_section_addresses): Align after last TLS
2061 section. Add padding before last relro section instead of after.
2062
2063 2010-10-17 Doug Kwan <dougkwan@google.com>
2064
2065 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2066 GOT output section to be writable.
2067
2068 2010-10-14 Cary Coutant <ccoutant@google.com>
2069
2070 * debug.h (DEBUG_INCREMENTAL): New flag.
2071 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2072 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2073 mode.
2074 * incremental.cc (report_command_line): Ignore all forms of
2075 --incremental.
2076 * layout.cc (Layout::Layout): Check parameters for incremental link
2077 mode.
2078 * options.cc (General_options::parse_incremental): New function.
2079 (General_options::parse_no_incremental): New function.
2080 (General_options::parse_incremental_full): New function.
2081 (General_options::parse_incremental_update): New function.
2082 (General_options::incremental_mode_): New data member.
2083 (General_options::finalize): Check incremental_mode_.
2084 * options.h (General_options): Update help text for --incremental.
2085 Add --no-incremental, --incremental-full, --incremental-update.
2086 (General_options::Incremental_mode): New enum type.
2087 (General_options::incremental_mode): New function.
2088 (General_options::incremental_mode_): New data member.
2089 * parameters.cc (Parameters::incremental_mode_): New data member.
2090 (Parameters::set_options): Set incremental_mode_.
2091 (Parameters::set_incremental_full): New function.
2092 (Parameters::incremental): New function.
2093 (Parameters::incremental_update): New function.
2094 (set_parameters_incremental_full): New function.
2095 * parameters.h (Parameters::set_incremental_full): New function.
2096 (Parameters::incremental): New function.
2097 (Parameters::incremental_update): New function.
2098 (Parameters::incremental_mode_): New data member.
2099 (set_parameters_incremental_full): New function.
2100 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2101 incremental link mode.
2102 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2103 (Sized_relobj::do_relocate_sections): Likewise.
2104 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2105 option.
2106 * testsuite/Makefile.in: Regenerate.
2107 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2108
2109 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2110
2111 * script-sections.h (class Script_sections): Make
2112 Sections_elements typedef public.
2113 * script-sections.cc (class Sort_output_sections): Add elements_
2114 field. Add constructor which sets it; change all callers.
2115 (Sort_output_sections::is_before): New function.
2116 (Sort_output_sections::operator()): Call is_before.
2117 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2118 conditional.
2119 * testsuite/script_test_10.sh: New test. Test script section
2120 order.
2121 * testsuite/script_test_10.t: Likewise.
2122 * testsuite/script_test_10.s: Likewise.
2123 * testsuite/Makefile.am: Wrap the cross linker tests and the
2124 common tests into NATIVE_OR_CROSS_LINKER.
2125 (check_SCRIPTS): Add script_test_10.sh.
2126 (check_DATA): Add script_test_10.stdout.
2127 (script_test_10.o, script_test_10): New targets.
2128 (script_test_10.stdout): New target.
2129 * configure, testsuite/Makefile.in: Regenerate.
2130
2131 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2132
2133 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2134 error for the deprecated relocations.
2135 (Target_arm::Scan::global): Likewise.
2136 (Target_arm::Relocate::relocate): Likewise.
2137
2138 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2139
2140 * fileread.cc (Input_file::find_file): Initialize *found_name
2141 and *namep when using the fallback search for case 4.
2142
2143 2010-10-11 Cary Coutant <ccoutant@google.com>
2144
2145 * options.h (class General_options): Redefine -z lazy as an alias for
2146 the negation of -z now.
2147
2148 2010-10-11 Ian Lance Taylor <iant@google.com>
2149
2150 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2151 binding.
2152
2153 2010-10-06 Nick Clifton <nickc@redhat.com>
2154
2155 * script-sections.cc(class Memory_region): Remove
2156 current_lma_offset_ field. Rename current_vma_offset_ to
2157 current_offset_. Add last_section_ field.
2158 (Memory_region::get_current_vma_address): Rename to
2159 get_current_address.
2160 (Memory_region::get_current_lma_address): Delete.
2161 (Memory_region::increment_vma_offset): Rename to
2162 increment_offset.
2163 (Memory_region::increment_lma_offset): Delete.
2164 (Memory_region::attributes_compatible): New method. Returns
2165 true if the provided section is compatible with the region.
2166 (Memory_region::get_last_section): New method. Returns the last
2167 section to use the region.
2168 (Memory_region::set_last_section): New method. Stores the last
2169 section to use the region.
2170 (Script_sections::block_in_region): New method. Returns true if
2171 a block of memory is contained within a region.
2172 (Script_sections::find_memory_region): New method. Locates a
2173 memory region to be used to set a VMA or LMA address.
2174 (Output_section_definition::set_section_addresses): Add code to
2175 check for addresses set by memory regions.
2176 (Output_segment::set_section_addresses): Remove memory region
2177 walking code.
2178 (Script_sections::create_segment): Add a warning if a header
2179 segment is created outside of any region.
2180 * script-sections.h (class Script_sections): Add prototypes for
2181 find_memory_region and block_in_region methods.
2182 * testsuite/memory_test.s: Use .long instead of .word.
2183 * testsuite/memory_test.t: Add some more output sections.
2184 * testsuite/memory_test.sh: Update expected output.
2185
2186 2010-10-02 Doug Kwan <dougkwan@google.com>
2187
2188 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2189 defintion to symtab.h
2190 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2191 declaration to defintion.
2192
2193 2010-10-01 Nick Clifton <nickc@redhat.com>
2194
2195 * expression.cc (eval): Replace dummy argument with NULL.
2196 (eval_maybe_dot): Check for a NULL result section pointer.
2197 (Symbol_expression::value): Likewise.
2198 (Dot_expression::value): Likewise.
2199 (BINARY_EXPRESSION): Likewise.
2200 (Max_expression::value): Likewise.
2201 (Min_expression::value): Likewise.
2202 (Absolute_expression::value): Likewise.
2203 (Addr_expression::value_from_output_section): Likewise.
2204 (Loaddddr_expression::value_from_output_section): Likewise.
2205 (Segment_start_expression::value): Likewise.
2206 * script-sections.cc
2207 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2208 argument with NULL.
2209 (Sections_elememt_dot_assignment::set_section_addresses):
2210 Likewise.
2211 (Output_data_expression::do_write_to_buffer): Likewise.
2212 (Output_section_definition::finalize_symbols): Likewise.
2213 (Output_section_definition::set_section_addresses): Likewise.
2214
2215 2010-09-30 Doug Kwan <dougkwan@google.com>
2216
2217 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2218
2219 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2220
2221 * target.h (Target::can_icf_inline_merge_sections): New virtual
2222 function.
2223 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2224 virtual function.
2225 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2226 virtual function.
2227 * icf.cc (get_section_contents): Inline merge sections only when
2228 target allows it.
2229
2230 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2231
2232 * configure: Regenerate.
2233
2234 2010-09-17 Ian Lance Taylor <iant@google.com>
2235
2236 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2237 * testsuite/Makefile.am (memory_test.o): New target.
2238 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2239 memory_test.t.
2240 * testsuite/Makefile.in: Rebuild.
2241
2242 2010-09-17 Doug Kwan <dougkwan@google.com>
2243
2244 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2245 defintion if relocation uses GOT entries of the symbol.
2246 * testsuite/icf_safe_test.sh: Fix test.
2247 * testsuite/icf_safe_so_test.sh: Fix test.
2248
2249 2010-09-16 Cary Coutant <ccoutant@google.com>
2250
2251 * script_sections.cc (class Memory_region): Remove "NULL" from
2252 vector initializations.
2253
2254 2010-09-15 Cary Coutant <ccoutant@google.com>
2255
2256 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2257 Resolve forwarding symbols.
2258
2259 2010-09-15 Doug Kwan <dougkwan@google.com>
2260
2261 * gold/testsuite/script_test_3.t: Add ARM special sections.
2262 * gold/testsuite/script_test_4.t: Same.
2263 * gold/testsuite/script_test_5.t: Same.
2264 * gold/testsuite/script_test_6.t: Same.
2265 * gold/testsuite/script_test_7.t: Same.
2266 * gold/testsuite/script_test_7.t: Same.
2267 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2268
2269 2010-09-14 Cary Coutant <ccoutant@google.com>
2270
2271 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2272 (Target_x86_64::Relocate::relocate_tls): Replace check for
2273 saw_tls_block_reloc_ with test for executable section.
2274
2275 2010-09-12 Cary Coutant <ccoutant@google.com>
2276
2277 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2278 position-independent executables to shared libraries need dynamic
2279 relocations.
2280 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2281 position-independent executables.
2282 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2283 * testsuite/Makefile.in: Regenerate.
2284
2285 2010-09-10 Nick Clifton <nickc@redhat.com>
2286
2287 PR gold/11997
2288 * testsuite/memory_test.t: Discard any sections that are not
2289 needed.
2290
2291 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2292
2293 PR gold/11996
2294 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2295 "This::" to work around a bug in gcc 4.2.
2296
2297 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2298
2299 2010-09-09 Rafael Espindola <espindola@google.com>
2300
2301 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2302 sections with different PF_X flags in the same segment.
2303 (Layout::find_first_load_seg): Search all segments to find the first
2304 one.
2305 * options.h (rosegment): New.
2306
2307 2010-09-08 Rafael Espindola <espindola@google.com>
2308
2309 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2310
2311 2010-09-08 Doug Kwan <dougkwan@google.com>
2312
2313 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2314 (Arm_relobj::do_relocate_sections): Add new parameter for output
2315 file to match the parent.
2316 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2317 of local symbols instead of input values. Update code to track
2318 changes in gold::relocate_section.
2319 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2320 (Sized_relobj::compute_final_local_value_internal): New methods.
2321 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2322 body into private version of Sized_relobj::compute_final_local_value.
2323 Call the inline method.
2324 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2325 merged symbol value if there is one.
2326 (Symbol_value::has_output_value): New method defintiion.
2327 (Sized_relobj::Compute_final_local_value_status): New enum type.
2328 (Sized_relobj::compute_final_local_value): New methods.
2329 (Sized_relobj::compute_final_local_value_internal): New methods.
2330 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2331 and arm_cortex_a8.sh.
2332 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2333 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2334 New tests.
2335 * Makefile.in: Regenerate.
2336 * testsuite/arm_bl_out_of_range.s: Update test.
2337 * testsuite/thumb_bl_out_of_range.s: Ditto.
2338 * testsuite/thumb_blx_out_of_range.s: Ditto.
2339 * testsuite/arm_branch_out_of_range.sh: New file.
2340 * testsuite/arm_cortex_a8.sh: Ditto.
2341 * testsuite/arm_cortex_a8_b.s: Ditto.
2342 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2343 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2344 * testsuite/arm_cortex_a8_bl.s: Ditto.
2345 * testsuite/arm_cortex_a8_blx.s: Ditto.
2346 * testsuite/arm_cortex_a8_local.s: Ditto.
2347 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2348 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2349
2350 2010-09-08 Rafael Espindola <espindola@google.com>
2351
2352 * Makefile.am (memory_test.stdout): Run readelf with -W.
2353 * Makefile.in: Regenerate.
2354 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2355 64 bit output.
2356
2357 2010-09-08 Rafael Espindola <espindola@google.com>
2358
2359 * script-sections.cc (Script_sections::add_memory_region): Convert
2360 field precision to int.
2361 * script.cc (script_set_section_region, script_set_section_region):
2362 Convert field precision to int.
2363
2364 2010-09-08 Rafael Espindola <espindola@google.com>
2365
2366 * arm.cc (do_finalize_sections): Create the __exidx_start and
2367 __exdix_end symbols even when the section is missing.
2368
2369 2010-09-08 Nick Clifton <nickc@redhat.com>
2370
2371 * README: Remove claim that MEMORY is not supported.
2372 * expression.cc (script_exp_function_origin)
2373 (script_exp_function_length): Move from here to ...
2374 * script.cc: ... here.
2375 (script_set_section_region, script_add_memory)
2376 (script_parse_memory_attr, script_include_directive): New
2377 functions.
2378 * script-sections.cc
2379 (class Memory_region): New class.
2380 (class Output_section_definition): Add set_memory_region,
2381 set_section_vma, set_section_lma and get_section_name methods.
2382 (class Script_Sections): Add add_memory_region,
2383 find_memory_region, find_memory_region_origin,
2384 find_memory_region_length and set_memory_region methods.
2385 Have set_section_addresses method walk the list of set memory
2386 regions.
2387 Extend the print methos to display memory regions.
2388 * script-sections.h: Add prototypes for new methods.
2389 Add enum for MEMORY region attributes.
2390 * yyscript.y: Add support for parsing MEMORY regions.
2391 * script-c.h: Add prototypes for new functions.
2392 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2393 * testsuite/Makefile.in: Regenerate.
2394 * testsuite/memory_test.sh: New script.
2395 * testsuite/memory_test.s: New assembler source file.
2396 * testsuite/memory_test.t: New linker script.
2397
2398 2010-08-27 Doug Kwan <dougkwan@google.com>
2399
2400 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2401 reference override an existing dynamic weak reference.
2402 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2403 * testsuite/Makefile.in: Regenerate.
2404 * testsuite/dyn_weak_ref.sh: New file.
2405 * testsuite/dyn_weak_ref_1.c: Ditto.
2406 * testsuite/dyn_weak_ref_2.c: Ditto.
2407
2408 2010-08-27 Ian Lance Taylor <iant@google.com>
2409
2410 * incremental.h (class Incremental_input_entry): Add virtual
2411 destructor.
2412
2413 2010-08-27 Ian Lance Taylor <iant@google.com>
2414
2415 * testsuite/start_lib_test_3.c: Mark t3 as used.
2416
2417 2010-08-27 Nick Clifton <nickc@redhat.com>
2418
2419 * options.cc (version_script): Fix small typo in previous
2420 whitespace tidyup.
2421
2422 2010-08-25 Nick Clifton <nickc@redhat.com>
2423
2424 * archive.cc: Formatting fixes: Remove whitespace between
2425 typename and following asterisk. Remove whitespace between
2426 function name and opening parenthesis.
2427 * archive.h: Likewise.
2428 * arm.cc: Likewise.
2429 * attributes.cc: Likewise.
2430 * attributes.h: Likewise.
2431 * common.cc: Likewise.
2432 * copy-relocs.cc: Likewise.
2433 * dirsearch.h: Likewise.
2434 * dynobj.cc: Likewise.
2435 * ehframe.cc: Likewise.
2436 * ehframe.h: Likewise.
2437 * expression.cc: Likewise.
2438 * fileread.cc: Likewise.
2439 * fileread.h: Likewise.
2440 * gc.h: Likewise.
2441 * gold-threads.cc: Likewise.
2442 * gold.cc: Likewise.
2443 * i386.cc: Likewise.
2444 * icf.h: Likewise.
2445 * incremental-dump.cc: Likewise.
2446 * incremental.cc: Likewise.
2447 * layout.cc: Likewise.
2448 * layout.h: Likewise.
2449 * main.cc: Likewise.
2450 * merge.cc: Likewise.
2451 * merge.h: Likewise.
2452 * object.cc: Likewise.
2453 * object.h: Likewise.
2454 * options.cc: Likewise.
2455 * options.h: Likewise.
2456 * output.cc: Likewise.
2457 * output.h: Likewise.
2458 * plugin.cc: Likewise.
2459 * plugin.h: Likewise.
2460 * powerpc.cc: Likewise.
2461 * reloc.cc: Likewise.
2462 * script-c.h: Likewise.
2463 * script-sections.cc: Likewise.
2464 * script.cc: Likewise.
2465 * stringpool.cc: Likewise.
2466 * symtab.cc: Likewise.
2467 * symtab.h: Likewise.
2468 * target.cc: Likewise.
2469 * timer.cc: Likewise.
2470 * timer.h: Likewise.
2471 * version.cc: Likewise.
2472 * x86_64.cc: Likewise.
2473
2474 2010-08-24 Nick Clifton <nickc@redhat.com>
2475
2476 PR 11899
2477 * layout.cc (segment_precedes): Sort segments by their physical
2478 addresses, if they have been set.
2479
2480 2010-08-23 Cary Coutant <ccoutant@google.com>
2481
2482 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2483 symbols data.
2484 (Lib_group::include_member): Unlock object after deleting its
2485 symbols data.
2486 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2487 the bug fixed here.
2488
2489 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2490 Cary Coutant <ccoutant@google.com>
2491
2492 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2493 constructor, and set_blocker.
2494 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2495 readsyms_blocker_.
2496 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2497 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2498 * testsuite/Makefile.am (start_lib_test): New test case.
2499 * testsuite/Makefile.in: Regenerate.
2500 * testsuite/start_lib_test_main.c: New file.
2501 * testsuite/start_lib_test_1.c: New file.
2502 * testsuite/start_lib_test_2.c: New file.
2503 * testsuite/start_lib_test_3.c: New file.
2504
2505 2010-08-19 Ian Lance Taylor <iant@google.com>
2506
2507 * Makefile.in: Rebuild with automake 1.11.1.
2508 * aclocal.m4: Likewise.
2509 * testsuite/Makefile.in: Likewise.
2510
2511 2010-08-19 Ian Lance Taylor <iant@google.com>
2512
2513 PR 10893
2514 * i386.cc (class Output_data_plt_i386): Update declarations.
2515 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2516 local_ifuncs_ fields.
2517 (Target_i386::do_plt_section_for_global): New function.
2518 (Target_i386::do_plt_section_for_local): New function.
2519 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2520 parameter; change all callers. Initialize global_ifuncs_ and
2521 local_ifuncs_. If doing a static link define __rel_iplt_start and
2522 __rel_iplt_end.
2523 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2524 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2525 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2526 symbols.
2527 (Target_i386::make_plt_section): New function, broken out of
2528 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2529 (Target_i386::make_plt_entry): Call make_plt_section.
2530 (Target_i386::make_local_ifunc_plt_entry): New function.
2531 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2532 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2533 R_386_IRELATIVE to switch.
2534 (Target_i386::Scan::global): Likewise.
2535 (Target_i386::Relocate::relocate): Likewise.
2536 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2537 switch.
2538 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2539 (Target_x86_64::do_plt_section_for_global): New function.
2540 (Target_x86_64::do_plt_section_for_local): New function.
2541 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2542 parameter; change all callers. If doing a static link define
2543 __rela_iplt_start and __rela_iplt_end.
2544 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2545 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2546 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2547 to point to .plt.
2548 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2549 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2550 switch.
2551 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2552 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2553 R_X86_64_IRELATIVE to switch.
2554 (Target_x86_64::Scan::global): Likewise.
2555 (Target_x86_64::Relocate::relocate): Likewise.
2556 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2557 switch.
2558 * target.h (class Target): Add plt_section_for_global and
2559 plt_section_for_local functions. Add do_plt_section_for_global
2560 and do_plt_section_for_local virtual functions.
2561 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2562 clarifying comments.
2563 (Symbol::use_plt_offset): Handle IFUNC symbol.
2564 * object.cc (Sized_relobj::Sized_relobj): Initialize
2565 local_plt_offsets_.
2566 (Sized_relobj::local_has_plt_offset): New function.
2567 (Sized_relobj::local_plt_offset): New function.
2568 (Sized_relobj::set_local_plt_offset): New function.
2569 (Sized_relobj::do_count): Handle IFUNC symbol.
2570 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2571 a bit away from input_shndx_ field. Add set_is_func_symbol and
2572 is_ifunc_symbol functions.
2573 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2574 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2575 local_plt_offsets_ field.
2576 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2577 * output.h (class Output_section_data): Add non-const
2578 output_section function.
2579 (class Output_data_got): Update declarations.
2580 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2581 Add use_plt_offset parameter to global and local constructors.
2582 Change all callers. Change local_sym_index_ field to 31 bits.
2583 Change GSYM_CODE and CONSTANT_CODE accordingly.
2584 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2585 doing a static link don't set sh_link field.
2586 (Output_data_got::Got_entry::write): Use PLT offset if
2587 appropriate.
2588 (Output_data_got::add_global_plt): New function.
2589 (Output_data_got::add_local_plt): New function.
2590 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2591 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2592 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2593 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2594 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2595 IFUNC conditional.
2596 * testsuite/ifunc-sel.h: New file.
2597 * testsuite/ifuncmain1.c: New file.
2598 * testsuite/ifuncmain1vis.c: New file.
2599 * testsuite/ifuncmod1.c: New file.
2600 * testsuite/ifuncdep2.c: New file.
2601 * testsuite/ifuncmain2.c: New file.
2602 * testsuite/ifuncmain3.c: New file.
2603 * testsuite/ifuncmod3.c: New file.
2604 * testsuite/ifuncmain4.c: New file.
2605 * testsuite/ifuncmain5.c: New file.
2606 * testsuite/ifuncmod5.c: New file.
2607 * testsuite/ifuncmain6pie.c: New file.
2608 * testsuite/ifuncmod6.c: New file.
2609 * testsuite/ifuncmain7.c: New file.
2610 * configure, testsuite/Makefile.in: Rebuild.
2611
2612 2010-08-18 Ian Lance Taylor <iant@google.com>
2613
2614 * incremental.cc
2615 (Output_section_incremental_inputs::write_input_files): Add cast
2616 to avoid signed/unsigned comparison warning.
2617 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2618
2619 2010-08-12 Cary Coutant <ccoutant@google.com>
2620
2621 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2622
2623 2010-08-13 Ian Lance Taylor <iant@google.com>
2624
2625 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2626
2627 2010-08-12 Cary Coutant <ccoutant@google.com>
2628 Doug Kwan <dougkwan@google.com>
2629
2630 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2631 defintion overrides non-weak undef, remember that the original undef
2632 is not weak.
2633 * symtab.cc (Symbol_table::sized_write_global): For undef without
2634 an original weak binding, set binding to global in output.
2635 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2636 * testsuite/Makefile.in: Regenerate.
2637 * testsuite/strong_ref_weak_def.sh: New file.
2638 * testsuite/strong_ref_weak_def_1.c: Ditto.
2639 * testsuite/strong_ref_weak_def_2.c: Ditto.
2640
2641 2010-08-12 Cary Coutant <ccoutant@google.com>
2642
2643 * testsuite/incremental_test.sh: Rewrite.
2644 * testsuite/incremental_test_1.c: Rewrite.
2645 * testsuite/incremental_test_2.c: Rewrite.
2646
2647 2010-08-12 Cary Coutant <ccoutant@google.com>
2648
2649 * arm.cc (Target_arm::got_size): Add const.
2650 (Target_arm::got_entry_count): New function.
2651 (Target_arm::plt_entry_count): New function.
2652 (Target_arm::first_plt_entry_offset): New function.
2653 (Target_arm::plt_entry_size): New function.
2654 (Output_data_plt_arm::entry_count): New function.
2655 (Output_data_plt_arm::first_plt_entry_offset): New function.
2656 (Output_data_plt_arm::get_plt_entry_size): New function.
2657 * i386.cc (Target_i386::got_size): Add const.
2658 (Target_i386::got_entry_count): New function.
2659 (Target_i386::plt_entry_count): New function.
2660 (Target_i386::first_plt_entry_offset): New function.
2661 (Target_i386::plt_entry_size): New function.
2662 (Output_data_plt_i386::entry_count): New function.
2663 (Output_data_plt_i386::first_plt_entry_offset): New function.
2664 (Output_data_plt_i386::get_plt_entry_size): New function.
2665 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2666 find_incremental_inputs_sections. Dump incremental_got_plt section.
2667 * incremental.cc: Include target.h.
2668 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2669 parameter. Adjust all callers. Find incremental_got_plt section.
2670 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2671 section.
2672 (Output_section_incremental_inputs::set_final_data_size): Calculate
2673 size of incremental_got_plt section.
2674 (Output_section_incremental_inputs::do_write): Write the
2675 incremental_got_plt section.
2676 (Got_plt_view_info): New struct.
2677 (Local_got_offset_visitor): New class.
2678 (Global_got_offset_visitor): New class.
2679 (Global_symbol_visitor_got_plt): New class.
2680 (Output_section_incremental_inputs::write_got_plt): New function.
2681 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2682 Add parameter. Adjust all callers.
2683 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2684 (Incremental_inputs::got_plt_section): New function.
2685 (Incremental_inputs::got_plt_section_): New data member.
2686 (Incremental_got_plt_reader): New class.
2687 * layout.cc (Layout::create_incremental_info_sections): Add the
2688 incremental_got_plt section.
2689 * object.h (Got_offset_list::get_list): New function.
2690 (Got offset_list::for_all_got_offsets): New function.
2691 (Sized_relobj::local_got_offset_list): New function.
2692 * powerpc.cc (Target_powerpc::got_size): Add const.
2693 (Target_powerpc::got_entry_count): New function.
2694 (Target_powerpc::plt_entry_count): New function.
2695 (Target_powerpc::first_plt_entry_offset): New function.
2696 (Target_powerpc::plt_entry_size): New function.
2697 (Output_data_plt_powerpc::entry_count): New function.
2698 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2699 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2700 * sparc.cc (Target_sparc::got_size): Add const.
2701 (Target_sparc::got_entry_count): New function.
2702 (Target_sparc::plt_entry_count): New function.
2703 (Target_sparc::first_plt_entry_offset): New function.
2704 (Target_sparc::plt_entry_size): New function.
2705 (Output_data_plt_sparc::entry_count): New function.
2706 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2707 (Output_data_plt_sparc::get_plt_entry_size): New function.
2708 * symtab.h (Symbol::got_offset_list): New function.
2709 (Symbol_table::for_all_symbols): New function.
2710 * target.h (Sized_target::got_entry_count): New function.
2711 (Sized_target::plt_entry_count): New function.
2712 (Sized_target::plt_entry_size): New function.
2713 * x86_64.cc (Target_x86_64::got_size): Add const.
2714 (Target_x86_64::got_entry_count): New function.
2715 (Target_x86_64::plt_entry_count): New function.
2716 (Target_x86_64::first_plt_entry_offset): New function.
2717 (Target_x86_64::plt_entry_size): New function.
2718 (Output_data_plt_x86_64::entry_count): New function.
2719 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2720 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2721
2722 2010-08-12 Cary Coutant <ccoutant@google.com>
2723
2724 * archive.cc: Include incremental.h.
2725 (Archive::Archive): Initialize incremental_info_.
2726 (Archive::include_member): Record archive members in incremental info.
2727 (Add_archive_symbols::run): Record begin and end of an archive in
2728 incremental info.
2729 (Lib_group::include_member): Record objects in incremental info.
2730 * archive.h (Incremental_archive_entry): Forward declaration.
2731 (Archive::set_incremental_info): New member function.
2732 (Archive::incremental_info): New member function.
2733 (Archive::Unused_symbol_iterator): New class.
2734 (Archive::unused_symbols_begin): New member function.
2735 (Archive::unused_symbols_end): New member function.
2736 (Archive::incremental_info_): New data member.
2737 * incremental-dump.cc (find_input_containing_global): New function.
2738 (dump_incremental_inputs): Dump new incremental info sections.
2739 * incremental.cc: Include symtab.h.
2740 (Output_section_incremental_inputs): New class.
2741 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2742 new incremental info sections.
2743 (Sized_incremental_binary::do_check_inputs): Likewise.
2744 (Incremental_inputs::report_archive): Remove.
2745 (Incremental_inputs::report_archive_begin): New function.
2746 (Incremental_inputs::report_archive_end): New function.
2747 (Incremental_inputs::report_object): New function.
2748 (Incremental_inputs::finalize_inputs): Remove.
2749 (Incremental_inputs::report_input_section): New function.
2750 (Incremental_inputs::report_script): Rewrite.
2751 (Incremental_inputs::finalize): Do nothing but finalize string table.
2752 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2753 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2754 (Incremental_inputs::create_data_sections): New function.
2755 (Incremental_inputs::relocs_entsize): New function.
2756 (Output_section_incremental_inputs::set_final_data_size): New function.
2757 (Output_section_incremental_inputs::do_write): New function.
2758 (Output_section_incremental_inputs::write_header): New function.
2759 (Output_section_incremental_inputs::write_input_files): New function.
2760 (Output_section_incremental_inputs::write_info_blocks): New function.
2761 (Output_section_incremental_inputs::write_symtab): New function.
2762 * incremental.h (Incremental_script_entry): Forward declaration.
2763 (Incremental_object_entry): Forward declaration.
2764 (Incremental_archive_entry): Forward declaration.
2765 (Incremental_inputs): Forward declaration.
2766 (Incremental_inputs_header_data): Remove.
2767 (Incremental_inputs_header): Remove.
2768 (Incremental_inputs_header_write): Remove.
2769 (Incremental_inputs_entry_data): Remove.
2770 (Incremental_inputs_entry): Remove.
2771 (Incremental_inputs_entry_write): Remove.
2772 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2773 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2774 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2775 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2776 Likewise.
2777 (Incremental_input_entry): New class.
2778 (Incremental_script_entry): New class.
2779 (Incremental_object_entry): New class.
2780 (Incremental_archive_entry): New class.
2781 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2782 (Incremental_inputs::report_inputs): Remove.
2783 (Incremental_inputs::report_archive): Remove.
2784 (Incremental_inputs::report_archive_begin): New function.
2785 (Incremental_inputs::report_archive_end): New function.
2786 (Incremental_inputs::report_object): Change prototype.
2787 (Incremental_inputs::report_input_section): New function.
2788 (Incremental_inputs::report_script): Change prototype.
2789 (Incremental_inputs::get_reloc_count): New function.
2790 (Incremental_inputs::set_reloc_count): New function.
2791 (Incremental_inputs::create_data_sections): New function.
2792 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2793 (Incremental_inputs::inputs_section): New function.
2794 (Incremental_inputs::symtab_section): New function.
2795 (Incremental_inputs::relocs_section): New function.
2796 (Incremental_inputs::get_stringpool): Add const.
2797 (Incremental_inputs::command_line): Add const.
2798 (Incremental_inputs::inputs): Remove.
2799 (Incremental_inputs::command_line_key): New function.
2800 (Incremental_inputs::input_file_count): New function.
2801 (Incremental_inputs::input_files): New function.
2802 (Incremental_inputs::relocs_entsize): New function.
2803 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2804 (Incremental_inputs::finalize_inputs): Remove.
2805 (Incremental_inputs::Input_info): Remove.
2806 (Incremental_inputs::lock_): Remove.
2807 (Incremental_inputs::inputs_): Change type.
2808 (Incremental_inputs::inputs_map_): Remove.
2809 (Incremental_inputs::current_object_entry_): New data member.
2810 (Incremental_inputs::inputs_section_): New data member.
2811 (Incremental_inputs::symtab_section_): New data member.
2812 (Incremental_inputs::relocs_section_): New data member.
2813 (Incremental_inputs::reloc_count_): New data member.
2814 (Incremental_inputs_reader): New class.
2815 (Incremental_symtab_reader): New class.
2816 (Incremental_relocs_reader): New class.
2817 * layout.cc (Layout::finalize): Move finalization of incremental info
2818 and creation of incremental info sections to follow finalization of
2819 symbol table. Set offsets for postprocessing sections.
2820 (Layout::create_incremental_info_sections): Call
2821 Incremental_inputs::create_data_sections. Add incremental symtab
2822 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2823 sections to layout after input sections.
2824 * layout.h (struct Timespec): Forward declaration.
2825 (Layout::incremental_inputs): Add const.
2826 (Layout::create_incremental_info_sections): Add parameter.
2827 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2828 * object.cc: Include incremental.h.
2829 (Relobj::finalize_incremental_relocs): New function.
2830 (Sized_relobj::do_layout): Record input sections in incremental info.
2831 * object.h (Object::output_section): New function.
2832 (Object::output_section_offset): Moved from Relobj.
2833 (Object::get_incremental_reloc_base): New function.
2834 (Object::get_incremental_reloc_count): New function.
2835 (Object::do_output_section): New function.
2836 (Object::do_output_section_offset): Moved from Relobj.
2837 (Object::do_get_incremental_reloc_base): New function.
2838 (Object::do_get_incremental_reloc_count): New function.
2839 (Object::Object): Initialize new data members.
2840 (Relobj::output_section): Renamed do_output_section and moved to
2841 protected.
2842 (Relobj::output_section_offset): Moved to Object.
2843 (Relobj::do_get_incremental_reloc_base): New function.
2844 (Relobj::do_get_incremental_reloc_count): New function.
2845 (Relobj::allocate_incremental_reloc_counts): New function.
2846 (Relobj::count_incremental_reloc): New function.
2847 (Relobj::finalize_incremental_relocs): New function.
2848 (Relobj::next_incremental_reloc_index): New function.
2849 (Relobj::reloc_counts_): New data member.
2850 (Relobj::reloc_bases_): New data member.
2851 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2852 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2853 (Sized_relobj::incremental_relocs_scan): New function.
2854 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2855 (Sized_relobj::incremental_relocs_write): New function.
2856 (Sized_relobj::incremental_relocs_write_reltype): New function.
2857 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2858 incremental link.
2859 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2860 archives and object files elsewhere.
2861 (Add_symbols::run): Report object files here.
2862 (Finish_group::run): Report end of archive at end of group.
2863 * reloc.cc: Include layout.h, incremental.h.
2864 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2865 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2866 (Sized_relobj::incremental_relocs_scan): New function.
2867 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2868 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2869 (Sized_relobj::incremental_relocs_write): New function.
2870 (Sized_relobj::incremental_relocs_write_reltype): New function.
2871 * script.cc (read_input_script): Rewrite test for incremental link.
2872 Change call to Incremental_inputs::report_script.
2873 * symtab.h (Symbol_table::first_global_index): New function.
2874 (Symbol_table::output_count): New function.
2875
2876 2010-08-12 Doug Kwan <dougkwan@google.com>
2877
2878 * arm.cc (Target_arm::merge_object_attributes): Check command line
2879 options --no-wchar-size-warning and --no-enum-size-warning.
2880 * options.h (General_options): Add ld-compatible options
2881 --no-enum-size-warning and --no-wchar-size-warning.
2882
2883 2010-08-04 Ian Lance Taylor <iant@google.com>
2884
2885 * x86_64.cc (Target_x86_64::Scan::local): Use
2886 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2887 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2888 (Target_x86_64::Scan::global): Likewise.
2889 (Target_x86_64::Relocate::relocate): Likewise.
2890 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2891 Likewise.
2892
2893 2010-08-03 Cary Coutant <ccoutant@google.com>
2894
2895 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2896 to reserve space in merged_strings vector. Keep total input size
2897 for stats.
2898 (Output_merge_string::do_print_merge_stats): Print total input size.
2899 * merge.h (Output_merge_string): Add input_size_ field.
2900 * stringpool.cc (Stringpool_template::string_length): Move
2901 implementations out of Stringpool_template class and place in
2902 stringpool.h.
2903 * stringpool.h (string_length): Move out of Stringpool_template.
2904
2905 2010-08-03 Ian Lance Taylor <iant@google.com>
2906
2907 PR 11712
2908 * layout.cc (relaxation_loop_body): If address of load segment is
2909 set, adjust address to include headers if possible.
2910
2911 2010-08-03 Ian Lance Taylor <iant@google.com>
2912
2913 * version.cc (version_string): Bump to 1.10.
2914
2915 2010-08-03 Ian Lance Taylor <iant@google.com>
2916
2917 PR 11805
2918 * layout.h (enum Output_section_order): Define.
2919 (class Layout): Update declarations.
2920 * layout.cc (Layout::get_output_section): Add order parameter.
2921 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2922 is_first_non_relro parameters. Change all callers.
2923 (Layout::choose_output_section): Likewise.
2924 (Layout::add_output_section_data): Likewise.
2925 (Layout::make_output_section): Likewise. Set order.
2926 (Layout::default_section_order): New function.
2927 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2928 * output.cc (Output_section::Output_section): Initialize order_.
2929 Don't initialize deleted fields.
2930 (Output_segment::Output_segment): Don't initialize deleted
2931 fields.
2932 (Output_segment::add_output_section_to_load): New function
2933 replacing add_output_section. Change all callers to call this or
2934 add_output_section_to_nonload.
2935 (Output_segment::add_output_section_to_nonload): New function.
2936 (Output_segment::remove_output_section): Rewrite.
2937 (Output_segment::add_initial_output_data): Likewise.
2938 (Output_segment::has_any_data_sections): Likewise.
2939 (Output_segment::is_first_section_relro): Likewise.
2940 (Output_segment::maximum_alignment): Likewise.
2941 (Output_segment::has_dynamic_reloc): New function replacing
2942 dynamic_reloc_count. Change all callers.
2943 (Output_segment::has_dynamic_reloc_list): New function replacing
2944 dynamic_reloc_count_list. Change all callers.
2945 (Output_segment::set_section_addresses): Rewrite.
2946 (Output_segment::set_offset): Rewrite.
2947 (Output_segment::find_first_and_last_list): Remove.
2948 (Output_segment::set_tls_offsets): Rewrite.
2949 (Output_segment::first_section_load_address): Likewise.
2950 (Output_segment::output_section_count): Likewise.
2951 (Output_segment::section_with_lowest_load_address): Likewise.
2952 (Output_segment::write_section_headers): Likewise.
2953 (Output_segment::print_sections_to_map): Likewise.
2954 * output.h (class Output_data): Remove dynamic_reloc_count_
2955 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2956 (Output_data::add_dynamic_reloc): Rewrite.
2957 (Output_data::has_dynamic_reloc): New function.
2958 (Output_data::dynamic_reloc_count): Remove.
2959 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2960 is_last_relro_, is_first_non_relro_, is_interp_,
2961 is_dynamic_linker_section_ fields. Add order and set_order
2962 functions. Remove is_relro_local, set_is_relro_local,
2963 is_last_relro, set_is_last_relro, is_first_non_relro,
2964 set_is_first_non_relro functions, is_interp, set_is_interp,
2965 is_dynamic_linker_section, and set_is_dynamic_linker_section
2966 functions.
2967 (class Output_segment): Change Output_data_list from std::list to
2968 std:;vector. Add output_lists_ field. Remove output_data_ and
2969 output_bss_ fields. Update declarations.
2970
2971 2010-08-02 Ian Lance Taylor <iant@google.com>
2972
2973 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2974 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2975 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2976
2977 2010-08-02 Ian Lance Taylor <iant@google.com>
2978
2979 PR 11855
2980 * script.cc (Script_options::Script_options): Initialize
2981 symbol_definitions_ and symbol_references_.
2982 (Script_options::add_symbol_assignment): Update
2983 symbol_definitions_ and symbol_references_.
2984 (Script_options::add_symbol_reference): New function.
2985 (script_symbol): New function.
2986 * script.h (class Script_options): Add symbol_definitions_ and
2987 symbol_references_ fields.
2988 (Script_options::referenced_const_iterator): New type.
2989 (Script_options::referenced_begin): New function.
2990 (Script_options::referenced_end): New function.
2991 (Script_options::is_referenced): New function.
2992 (Script_options::any_unreferenced): New function.
2993 * script-c.h (script_symbol): Declare.
2994 * yyscript.y (exp): Call script_symbol.
2995 * symtab.cc: Include "script.h".
2996 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2997 Change all callers. Check symbols referenced by scripts.
2998 (Symbol_table::add_undefined_symbols_from_command_line): Add
2999 layout parameter. Change all callers.
3000 (Symbol_table::do_add_undefined_symbols_from_command_line):
3001 Likewise. Break out loop body. Check symbols referenced by
3002 scripts.
3003 (Symbol_table::add_undefined_symbol_from_command_line): New
3004 function broken out of
3005 do_add_undefined_symbols_from_command_line.
3006 * symtab.h (class Symbol_table): Update declarations.
3007 * archive.cc: Include "layout.h".
3008 (Archive::should_include_member): Add layout parameter. Change
3009 all callers. Check for symbol mentioned in expression.
3010 * archive.h (class Archive): Update declaration.
3011 * object.cc (Sized_relobj::do_should_include_member): Add layout
3012 parameter.
3013 * object.h (Object::should_include_member): Add layout parameter.
3014 Change all callers.
3015 (Object::do_should_include_member): Add layout parameter.
3016 (class Sized_relobj): Update declaration.
3017 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3018 parameter.
3019 * dynobj.h (class Sized_dynobj): Update declaration.
3020 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3021 layout parameter.
3022 * plugin.h (class Sized_pluginobj): Update declaration.
3023
3024 2010-08-02 Ian Lance Taylor <iant@google.com>
3025
3026 PR 11866
3027 * output.cc (Output_segment::set_offset): Search for the first and
3028 last sections rather than assuming that the list is in order.
3029 (Output_segment::find_first_and_last_list): New function.
3030 * output.h (class Output_segment): Update declarations.
3031 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3032 (relro_strip_test_SOURCES): New variable.
3033 (relro_strip_test_DEPENDENCIES): New variable.
3034 (relro_strip_test_LDFLAGS): New variable.
3035 (relro_strip_test_LDADD): New variable.
3036 (relro_strip_test.so): New target.
3037
3038 2010-08-02 Ian Lance Taylor <iant@google.com>
3039
3040 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3041 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3042 (Target_i386::got_tlsdesc_section): New function.
3043 (Target_i386::got_section): Create space for GOT entries for
3044 TLSDESC relocations.
3045 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3046 R_386_TLS_GOTDESC.
3047 (Target_i386::Scan::global): Likewise.
3048 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3049 using TLSDESC GOT.
3050 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3051 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3052 (Target_x86_64::got_tlsdesc_section): New function.
3053 (Target_x86_64::got_section): Create space for GOT entries for
3054 TLSDESC relocations.
3055 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3056 R_386_TLS_GOTDESC.
3057 (Target_x86_64::Scan::global): Likewise.
3058 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3059 using TLSDESC GOT.
3060
3061 2010-08-02 Ian Lance Taylor <iant@google.com>
3062
3063 * testsuite/final_layout.sh: Use dc to convert from hex to
3064 decimal.
3065
3066 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3067
3068 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3069 paramter to the call to gold::gc_process_relocs.
3070 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3071 paramter to the call to gold::gc_process_relocs.
3072 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3073 parameter to the call to gold::gc_process_relocs.
3074 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3075 template parameter to the call to gold::gc_process_relocs.
3076 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3077 paramter to the call to gold::gc_process_relocs.
3078 * gc.h (get_embedded_addend_size): New function.
3079 (gc_process_relocs): Save the size of the reloc for use by ICF.
3080 * icf.cc (get_section_contents): Get the addend from the text section
3081 for SHT_REL relocation sections.
3082 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3083 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3084 * int_encoding.h (read_from_pointer): New overloaded function.
3085 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3086 * testsuite/icf_sht_rel_addend_test.sh: New file.
3087 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3088 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3089
3090 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3091
3092 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3093 * Makefile.in: Regenerate.
3094 * testsuite/Makefile.in: Regenerate.
3095
3096 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3097
3098 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3099 * gold/testsuite/debug_msg.cc: Likewise.
3100 * gold/testsuite/odr_violation1.cc
3101 * gold/testsuite/odr_violation2.cc
3102
3103 2010-07-21 Cary Coutant <ccoutant@google.com>
3104
3105 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3106 string, and length fields.
3107 (Output_merge_string::Merged_strings_list): New type.
3108 (Output_merge_string::Merged_strings_lists): New typedef.
3109 (Output_merge_string): Replace merged_strings_ with
3110 merged_strings_lists_.
3111 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3112 Merged_strings_list per input object and section. Don't store pointer
3113 to the string. Don't store length with each merged string entry.
3114 (Output_merge_string::finalize_merged_data): Loop over list of merged
3115 strings lists. Recompute length of each merged string.
3116
3117 2010-07-15 Cary Coutant <ccoutant@google.com>
3118
3119 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3120 here.
3121
3122 2010-07-14 Ian Lance Taylor <iant@google.com>
3123
3124 * descriptors.cc (Descriptors::open): Report correct name in error
3125 message.
3126
3127 2010-07-13 Doug Kwan <dougkwan@google.com>
3128
3129 * arm.cc (Arm_input_section::Arm_input_section): For a
3130 SHT_ARM_EXIDX section, always keeps the input sections.
3131 (Arm_input_section::set_exidx_section_link): New method.
3132 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3133 has_errors_ to false.
3134 (Arm_exidx_input_section::has_errors,
3135 Arm_exidx_input_section::set_has_errors): New methods.
3136 (Arm_exidx_input_section::has_errors_): New data member.
3137 (Arm_relobj::get_exidx_shndx_list): New method.
3138 (Arm_output_section::append_text_sections_to_list): Do not skip
3139 section without SHF_EXECINSTR.
3140 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3141 errors.
3142 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3143 section header. Make error messages more verbose. Check for
3144 a non-executable section linked to an EXIDX section.
3145 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3146 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3147 check that there is no deferred EXIDX section if we exit early.
3148 Instead of not making an EXIDX section in case of an error, make one
3149 and set the has_errors flag of it.
3150 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3151 in a relocatable link.
3152 (Target_arm::do_relax): Look for the EXIDX output section instead of
3153 assuming that it is called .ARM.exidx.
3154 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3155 section list. Do not check for SHF_EXECINSTR section flags but
3156 skip any input section with errors.
3157 * output.cc (Output_section::Output_section): Initialize
3158 always_keeps_input_sections_ to false.
3159 (Output_section::add_input_section): Check for
3160 always_keeps_input_sections_.
3161 * output.h (Output_section::always_keeps_input_sections,
3162 Output_section::set_always_keeps_input_sections): New methods.
3163 (Output_section::always_keeps_input_sections): New data member.
3164
3165 2010-07-13 Rafael Espindola <espindola@google.com>
3166
3167 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3168 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3169
3170 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3171 Ian Lance Taylor <iant@google.com>
3172
3173 * output.h (Output_section_lookup_maps::add_merge_section):
3174 Correct check of whether value was inserted.
3175 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3176 (Output_section_lookup_maps::add_relaxed_input_section):
3177 Likewise.
3178 * arm.cc (Target_arm::got_section): Remove used local os.
3179 * i386.cc (Target_i386::got_section): Likewise.
3180 * x86_64.cc (Target_x86_64::got_section): Likewise.
3181 * sparc.cc (Target_sparc::got_section): Likewise.
3182 (Target_sparc::relocate): Remove unused local have_got_offset.
3183 * powerpc.cc (Target_powerpc::relocate): Likewise.
3184
3185 2010-07-13 Ian Lance Taylor <iant@google.com>
3186
3187 * compressed_output.cc (zlib_decompress): Fix signature in
3188 !HAVE_ZLIB_H case.
3189
3190 * archive.cc (Archive::include_member): Unlock an external member
3191 of a thin archive. Don't bother to delete an object we know is
3192 NULL.
3193
3194 2010-07-12 Cary Coutant <ccoutant@google.com>
3195
3196 * compressed_output.cc (zlib_decompress): New function.
3197 (get_uncompressed_size): New function.
3198 (decompress_input_section): New function.
3199 * compressed_output.h (get_uncompressed_size): New function.
3200 (decompress_input_section): New function.
3201 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3202 Handle compressed debug sections.
3203 * layout.cc (is_compressed_debug_section): New function.
3204 (Layout::output_section_name): Map compressed section names to
3205 canonical names.
3206 * layout.h (is_compressed_debug_section): New function.
3207 (is_debug_info_section): Recognize compressed debug sections.
3208 * merge.cc: Include compressed_output.h.
3209 (Output_merge_data::do_add_input_section): Handle compressed
3210 debug sections.
3211 (Output_merge_string::do_add_input_section): Handle compressed
3212 debug sections.
3213 * object.cc: Include compressed_output.h.
3214 (Sized_relobj::Sized_relobj): Initialize new data members.
3215 (build_compressed_section_map): New function.
3216 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3217 * object.h (Object::section_is_compressed): New method.
3218 (Object::do_section_is_compressed): New method.
3219 (Sized_relobj::Compressed_section_map): New type.
3220 (Sized_relobj::do_section_is_compressed): New method.
3221 (Sized_relobj::compressed_sections_): New data member.
3222 * output.cc (Output_section::add_input_section): Handle compressed
3223 debug sections.
3224 * reloc.cc: Include compressed_output.h.
3225 (Sized_relobj::write_sections): Handle compressed debug sections.
3226
3227 2010-07-08 Cary Coutant <ccoutant@google.com>
3228
3229 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3230 weak when resolving to a dynamic def.
3231 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3232 for weak undef/dynamic def cases. Adjust callers.
3233 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3234 undef_binding_weak_.
3235 (Symbol_table::sized_write_globals): Adjust symbol binding.
3236 (Symbol_table::sized_write_symbol): Add binding parameter.
3237 * symtab.h (Symbol::set_undef_binding): New method.
3238 (Symbol::is_undef_binding_weak): New method.
3239 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3240 (Symbol_table::should_override): Add new parameter.
3241 (Symbol_table::sized_write_symbol): Add new parameter.
3242
3243 * testsuite/weak_undef_file1.cc: Add new test case.
3244 * testsuite/weak_undef_file2.cc: Fix header comment.
3245 * testsuite/weak_undef_test.cc: Add new test case.
3246
3247 2010-06-29 Doug Kwan <dougkwan@google.com>
3248
3249 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3250 Initialize USE_SYMBOL_.
3251 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3252 definition.
3253 (Arm_reloc_property::uses_symbol_): New data member declaration.
3254 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3255 uses symbol value and symbol is undefined but not weakly undefined.
3256
3257 2010-06-28 Rafael Espindola <espindola@google.com>
3258
3259 * plugin.cc (Plugin::load): Use dlerror.
3260
3261 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3262
3263 * symtab.cc (detect_odr_violations): When reporting an ODR
3264 violation, report an object where the symbol is defined.
3265
3266 2010-06-25 Doug Kwan <dougkwan@google.com>
3267
3268 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3269 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3270 definition.
3271 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3272 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3273 target hook to detect function points.
3274 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3275 * icf.h (Icf::check_section_for_function_pointers): Change type of
3276 parameter SECTION_NAME to const reference to std::string. Use
3277 target hook to determine if section may have unsafe pointers.
3278 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3279 method definition.
3280
3281 2010-06-21 Rafael Espindola <espindola@google.com>
3282
3283 * fileread.cc (Input_file::find_fie): New
3284 (Input_file::open): Use Input_file::find_fie.
3285 * fileread.h (Input_file::find_fie): New
3286 * plugin.cc (set_extra_library_path): New.
3287 (Plugin::load): Add set_extra_library_path to the transfer vector.
3288 (Plugin_manager::set_extra_library_path): New.
3289 (Plugin_manager::add_input_file): Use the extra search path if set.
3290 (set_extra_library_path(): New.
3291 * plugin.h (Plugin_manager): Add set_extra_library_path and
3292 extra_search_path_.
3293
3294 2010-06-19 Cary Coutant <ccoutant@google.com>
3295
3296 * layout.cc (gdb_sections): Add .debug_types.
3297 (lines_only_debug_sections): Likewise.
3298
3299 2010-06-18 Rafael Espindola <espindola@google.com>
3300
3301 * plugin.cc (add_input_file,add_input_library)
3302 (Plugin_manager::add_input_file): Make filename arguments const.
3303 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3304 const.
3305
3306 2010-06-16 Doug Kwan <dougkwan@google.com>
3307
3308 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3309 .ARM.attributes section if we have not merged any input
3310 attributes sections.
3311
3312 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3313
3314 * arm.cc: Allow combining objects with no EABI version
3315 information.
3316
3317 2010-06-15 Rafael Espindola <espindola@google.com>
3318
3319 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3320
3321 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3322
3323 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3324 (struct iovec): Correct !HAVE_READV definition.
3325
3326 2010-06-10 Cary Coutant <ccoutant@google.com>
3327
3328 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3329 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3330 reloc sections.
3331 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3332
3333 PR 11683
3334 * symtab.h (Symbol::is_placeholder): New member function.
3335 * target-reloc.h (relocate_section): Check for placeholder symbols.
3336
3337 * testsuite/Makefile.am (plugin_test_8): New test.
3338 (plugin_test_9): New test.
3339 * testsuite/Makefile.in: Regenerate.
3340
3341 2010-06-09 Nick Clifton <nickc@redhat.com>
3342
3343 * yyscript.y (input_list_element): Allow strings prefixed with
3344 the '-' character. Treat these as libraries.
3345 * script.cc (script_add_library): New function. Adds a library
3346 specified by "-l<name>" found in an input script.
3347 * script-c.h: Add prototype for script_add_library.
3348
3349 2010-06-07 Doug Kwan <dougkwan@google.com>
3350
3351 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3352 Restrict stub-group size to be within long conditional branch
3353 range when working around cortex-A8 erratum.
3354
3355 2010-06-07 Damien Diederen <dd@crosstwine.com>
3356
3357 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3358 #ifdef typo.
3359
3360 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3361
3362 PR gold/11658
3363 * output.cc
3364 (Output_section::Input_section_sort_entry::compare_section_ordering):
3365 Change to return non-zero correctly.
3366 (Output_section::Input_section_sort_section_order_index_compare
3367 ::operator()): Change to fix ambiguity in comparisons.
3368
3369 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3370
3371 * gold.h (is_wildcard_string): New function.
3372 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3373 (Layout::layout_eh_frame): Ditto.
3374 (Layout::find_section_order_index): New method.
3375 (Layout::read_layout_from_file): New method.
3376 * layout.h (Layout::find_section_order_index): New method.
3377 (Layout::read_layout_from_file): New method.
3378 (Layout::input_section_position_): New private member.
3379 (Layout::input_section_glob_): New private member.
3380 * main.cc (main): Call read_layout_from_file here.
3381 * options.h (--section-ordering-file): New option.
3382 * output.cc (Output_section::input_section_order_specified_): New
3383 member.
3384 (Output_section::Output_section): Initialize new member.
3385 (Output_section::add_input_section): Add new parameter.
3386 Keep input sections when --section-ordering-file is used.
3387 (Output_section::set_final_data_size): Sort input sections when
3388 section ordering file is specified.
3389 (Output_section::Input_section_sort_entry): Add new parameter.
3390 Check sorting type.
3391 (Output_section::Input_section_sort_entry::compare_section_ordering):
3392 New method.
3393 (Output_section::Input_section_sort_compare::operator()): Change to
3394 consider section_order_index.
3395 (Output_section::Input_section_sort_init_fini_compare::operator()):
3396 Change to consider section_order_index.
3397 (Output_section::Input_section_sort_section_order_index_compare
3398 ::operator()): New method.
3399 (Output_section::sort_attached_input_sections): Change to sort
3400 according to section order when specified.
3401 (Output_section::add_input_section<32, true>): Add new parameter.
3402 (Output_section::add_input_section<64, true>): Add new parameter.
3403 (Output_section::add_input_section<32, false>): Add new parameter.
3404 (Output_section::add_input_section<64, false>): Add new parameter.
3405 * output.h (Output_section::add_input_section): Add new parameter.
3406 (Output_section::input_section_order_specified): New
3407 method.
3408 (Output_section::set_input_section_order_specified): New method.
3409 (Input_section::Input_section): Initialize section_order_index_.
3410 (Input_section::section_order_index): New method.
3411 (Input_section::set_section_order_index): New method.
3412 (Input_section::section_order_index_): New member.
3413 (Input_section::Input_section_sort_section_order_index_compare): New
3414 struct.
3415 (Output_section::input_section_order_specified_): New member.
3416 * script-sections.cc (is_wildcard_string): Delete and move modified
3417 method to gold.h.
3418 (Output_section_element_input::Output_section_element_input): Modify
3419 call to is_wildcard_string.
3420 (Output_section_element_input::Input_section_pattern
3421 ::Input_section_pattern): Ditto.
3422 (Output_section_element_input::Output_section_element_input): Ditto.
3423 * testsuite/Makefile.am (final_layout): New test case.
3424 * testsuite/Makefile.in: Regenerate.
3425 * testsuite/final_layout.cc: New file.
3426 * testsuite/final_layout.sh: New file.
3427
3428 2010-06-01 Rafael Espindola <espindola@google.com>
3429
3430 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3431
3432 2010-06-01 Rafael Espindola <espindola@google.com>
3433
3434 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3435 visibility of symbols.
3436
3437 2010-05-27 Doug Kwan <dougkwan@google.com>
3438
3439 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3440 from start of output section instead of address for a local symbol
3441 in a merged or relaxed section when doing a relocatable link.
3442
3443 2010-05-26 Rafael Espindola <espindola@google.com>
3444
3445 PR 11604
3446 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3447 adding sections the garbage collector removed.
3448 * gold/testsuite/Makefile.am: Add test.
3449 * gold/testsuite/Makefile.in: Regenerate.
3450 * gold/testsuite/plugin_test_7.sh: New.
3451 * gold/testsuite/plugin_test_7_1.c: New.
3452 * gold/testsuite/plugin_test_7_2.c: New.
3453
3454 2010-05-26 Rafael Espindola <espindola@google.com>
3455
3456 * script-sections.cc (Output_section_definition::set_section_addresses):
3457 Check for --section-start.
3458
3459 2010-05-26 Doug Kwan <dougkwan@google.com>
3460
3461 * arm.cc (Arm_scan_relocatable_relocs): New class.
3462 (Target_arm::relocate_special_relocatable): New method.
3463 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3464 (Arm_relocate_functions::thumb_branch_common): Same.
3465 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3466 instead of Default_scan_relocatable_relocs.
3467 * target-reloc.h (relocate_for_relocatable): Let target handle
3468 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3469 * target.h (Sized_target::relocate_special_relocatable): New method.
3470
3471 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3472
3473 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3474
3475 2010-05-23 Doug Kwan <dougkwan@google.com>
3476
3477 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3478 instead of a cast.
3479 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3480 with a direct branch, not a conditional branch, to a stub.
3481 * merge.cc (Output_merge_base::record_input_section): New method
3482 defintion.
3483 (Output_merge_data::do_add_input_section): Record input section if
3484 keeps-input-sections flag is set.
3485 (Output_merge_string::do_add_input_section): Ditto.
3486 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3487 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3488 INPUT_SECTIONS_.
3489 (Output_merge_base::keeps_input_sections,
3490 Output_merge_base::set_keeps_input_sections,
3491 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3492 method definitions.
3493 (Output_merge_base::Input_sections): New type declaration.
3494 (Output_merge_base::input_sections_begin,
3495 Output_merge_base::input_sections_end,
3496 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3497 (Output_merge_base::bool keeps_input_sections_,
3498 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3499 Output_merge_base::input_sections_): New data members.
3500 (Output_merge_data::do_set_keeps_input_sections): New method
3501 defintion.
3502 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3503 * output.cc (Output_section::Input_section::relobj): Move method
3504 defintion from class declaration to here and handle merge sections.
3505 (Output_section::Input_section::shndx): Ditto.
3506 (Output_section::Output_section): Remove initializations of removed
3507 data members and initialize new data member LOOKUP_MAPS_.
3508 (Output_section::add_input_section): Set keeps-input-sections flag
3509 for a newly created merge output section as appropriate. Adjust code
3510 to use Output_section_lookup_maps class.
3511 (Output_section::add_relaxed_input_section): Adjst code for lookup
3512 maps code refactoring.
3513 (Output_section::add_merge_input_section): Add a new parameter
3514 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3515 class. If adding input section to a newly created merge output
3516 section fails, remove the new merge section.
3517 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3518 Adjust code for use of the Output_section_lookup_maps class.
3519 (Output_section::find_merge_section): Ditto.
3520 (Output_section::build_lookup_maps): New method defintion.
3521 (Output_section::find_relaxed_input_section): Adjust code to use
3522 Output_section_lookup_maps class.
3523 (Output_section::get_input_sections): Export merge sections. Adjust
3524 code to use Output_section_lookup_maps class.
3525 (Output_section:::add_script_input_section): Adjust code to use
3526 Output_section_lookup_maps class. Update lookup maps for merge
3527 sections also.
3528 (Output_section::discard_states): Use Output_section_lookup_maps.
3529 (Output_section::restore_states): Same.
3530 * output.h (Merge_section_properties): Move class defintion out of
3531 Output_section.
3532 (Output_section_lookup_maps): New class.
3533 (Output_section::Input_section::is_merge_section): New method
3534 defintion.
3535 (Output_section::Input_section::relobj): Move defintion out of class
3536 defintion. Declare method only.
3537 (Output_section::Input_section::shndx): Ditto.
3538 (Output_section::Input_section::output_merge_base): New method defintion.
3539 (Output_section::Input_section::u2_.pomb): New union field.
3540 (Output_section::Merge_section_by_properties_map,
3541 Output_section::Output_section_data_by_input_section_map,
3542 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3543 Remove types.
3544 (Output_section::add_merge_input_section): Add new parameter
3545 KEEPS_INPUT_SECTIONS.
3546 (Output_section::build_lookup_maps): New method declaration.
3547 (Output_section::merge_section_map_,
3548 Output_section::merge_section_by_properties_map_,
3549 Output_section::relaxed_input_section_map_,
3550 Output_section::is_relaxed_input_section_map_valid_): Remove data
3551 members.
3552 (Output_section::lookup_maps_): New data member.
3553
3554 2010-05-21 Doug Kwan <dougkwan@google.com>
3555
3556 PR gold/11619
3557 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3558 avoid a compilation error.
3559
3560 2010-05-19 Rafael Espindola <espindola@google.com>
3561
3562 * script-sections.cc (Output_section_definition::allocate_to_segment):
3563 Update the phdrs_list even when the output section is NULL.
3564 * testsuite/Makefile.am: Add test.
3565 * testsuite/Makefile.in: Regenerate.
3566 * testsuite/script_test_9.cc: New.
3567 * testsuite/script_test_9.sh: New.
3568 * testsuite/script_test_9.t: New.
3569
3570 2010-05-19 Doug Kwan <dougkwan@google.com>
3571
3572 * arm.cc (Arm_input_section::original_size): New method.
3573 (Arm_input_section::do_addralign): Add a cast.
3574 (Arm_input_section::do_output_offset): Remove static cast.
3575 (Arm_input_section::original_addralign,
3576 Arm_input_section::original_size_): Change type to uint32_t.
3577 (Arm_input_section::init): Add safe casts for section alignment
3578 and size.
3579 (Arm_input_section::set_final_data_size): Do not set address and
3580 offset of stub table.
3581 (Arm_output_section::fix_exidx_coverage): Change use of of
3582 Output_section::Simple_input_section to that of
3583 Output_section::Input_section.
3584 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3585 except for the first pass.
3586 * output.cc (Output_section::get_input_sections): Change type of
3587 input_sections to std::list<Input_section>.
3588 (Output_section::add_script_input_section): Rename from
3589 Output_section::add_simple_input_section. Change type of SIS
3590 parameter from Simple_input_section to Input_section.
3591 * output.h (Output_section::Simple_input_section): Remove class.
3592 (Output_section::Input_section): Change class visibility to public.
3593 (Output_section::Input_section::addralign): Use stored alignments
3594 for special input sections if set.
3595 (Output_section::Input_section::set_addralign): New method.
3596 (Output_section::get_input_sections): Change parameter type from
3597 list of Simple_input_section to list of Input_section.
3598 (Output_section::add_script_input_section): Rename from
3599 Output_section::add_simple_input_section. Change first parameter's
3600 type from Simple_input_section to Input_section and remove the
3601 second and third parameters.
3602 * script-sections.cc (Input_section::Input_section_list): Change
3603 type to list of Output_section::Input_section/
3604 (Input_section_info::Input_section_info): Change parameter type of
3605 INPUT_SECTION to Output_section::Input_section.
3606 (Input_section_info::input_section): Change return type.
3607 (Input_section_info::input_section_): Change type to
3608 Output_section::Input_section.
3609 (Output_section_element_input::set_section_addresses): Adjust code
3610 to use Output_section::Input_section instead of
3611 Output_section::Simple_input_section. Adjust code for renaming
3612 of Output_section::add_simple_input_section.
3613 (Orphan_output_section::set_section_addresses): Ditto.
3614
3615 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3616
3617 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3618 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3619
3620 2010-05-18 Rafael Espindola <espindola@google.com>
3621
3622 * options.cc (General_options::finalize): Handle -nostdlib.
3623 * options.h (nostdlib): New option.
3624 * script.cc (script_add_search_dir): Handle -nostdlib.
3625
3626 2010-05-12 Doug Kwan <dougkwan@google.com>
3627
3628 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3629 attributes section only if there no attributes section after merging.
3630 (Target_arm::merge_object_attributes): Move value of
3631 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3632 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3633 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3634 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3635 and arm_attr_merge_7.stdout.
3636 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3637 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3638 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3639 arm_attr_merge_7b.o): New rules.
3640 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3641 arm_attr_merge_7
3642 * testsuite/Makefile.in: Regenerate.
3643 * testsuite/arm_attr_merge.sh: New file.
3644 * testsuite/arm_attr_merge_[67][ab].s: Same.
3645
3646 2010-05-05 Nick Clifton <nickc@redhat.com>
3647
3648 * po/es.po: Updated Spanish translation.
3649
3650 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3651
3652 * Makefile.am (install-exec-local): Properly install gold as
3653 default cross linker.
3654 * Makefile.in: Regenerated.
3655
3656 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3657 Nick Clifton <nickc@redhat.com>
3658
3659 * configure.ac (install_as_default): Define and set to false
3660 unless --enable-gold or --enable-gold=both/gold has been
3661 specified.
3662 * configure: Regenerate.
3663
3664 * Makefile.am (install-exec-local): Install the executable as
3665 'ld.gold'. If install_as_default is true then also install it as
3666 'ld'.
3667 * Makefile.in: Regenerated.
3668
3669 2010-04-24 Ian Lance Taylor <iant@google.com>
3670
3671 * layout.cc (Layout::layout_reloc): In relocatable link don't
3672 combine reloc sections for grouped sections.
3673
3674 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3675
3676 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3677 sections that are not ordinary to icf.
3678 * icf.cc (get_section_contents): Handle relocation pointing to section
3679 with no object or shndx information.
3680 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3681 * testsuite/Makefile.in: Regenerate.
3682 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3683 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3684
3685 2010-04-22 Ian Lance Taylor <iant@google.com>
3686
3687 * expression.cc (Expression::Expression_eval_info): Add
3688 result_alignment_pointer field.
3689 (Expression::eval_with_dot): Add result_alignment_pointer
3690 parameter. Change all callers.
3691 (Expression::eval_maybe_dot): Likewise.
3692 (class Binary_expression): Add alignment_pointer parameter to
3693 left_value and right_value. Change all callers.
3694 (BINARY_EXPRESSION): Set result alignment.
3695 (class Trinary_expression): Add alignment_pointer parameter to
3696 arg2_value and arg3_value. Change all callers.
3697 (Trinary_cond::value): Set result alignment.
3698 (Max_expression::value, Min_expression::value): Likewise.
3699 (Align_expression::value): Likewise.
3700 * script-sections.cc (class Sections_element): Add dot_alignment
3701 parameter to set_section_addresses virtual function. Update
3702 instantiations.
3703 (class Output_section_element): Likewise.
3704 (Script_sections::create_segments): Add dot_alignment parameter.
3705 Change all callers.
3706 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3707 (Script_sections::set_phdrs_clause_addresses): Likewise.
3708 * script-sections.h: Update declarations.
3709 * script.h: Update declarations.
3710 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3711 min_p_align.
3712 * testsuite/script_test_3.t: Set large alignment.
3713 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3714 segment has expected alignment.
3715
3716 2010-04-22 Nick Clifton <nickc@redhat.com>
3717
3718 * po/gold.pot: Updated by the Translation project.
3719 * po/vi.po: Updated Vietnamese translation.
3720
3721 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3722
3723 * testsuite/Makefile.am (check_PROGRAMS): Add
3724 icf_virtual_function_folding_test.
3725 * testsuite/Makefile.in: Regenerated.
3726
3727 2010-04-15 Andrew Haley <aph@redhat.com>
3728
3729 * options.h (merge_exidx_entries): New option.
3730 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3731 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3732 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3733 (Target_arm::merge_exidx_entries): New function.
3734 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3735 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3736 to Arm_exidx_fixup constructor.
3737 Add new arg, merge_exidx_entries.
3738 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3739 Arm_output_section::fix_exidx_coverage.
3740
3741 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3742
3743 * icf.cc (get_section_contents): Check for preemptible functions.
3744 Ignore addend when appropriate.
3745 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3746 section folded.
3747 (add_from_relobj): Check for section folded.
3748 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3749 * symtab.h (should_add_dynsym_entry): Add new parameter.
3750 * target-reloc.h (scan_relocs): Check for section folded.
3751 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3752 Check reloc types for function pointers in shared objects.
3753 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3754 case.
3755 (icf_preemptible_functions_test): New test case.
3756 (icf_string_merge_test): New test case.
3757 * testsuite.Makefile.in: Regenerate.
3758 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3759 bar_glob. Refactor code.
3760 * testsuite/icf_preemptible_functions_test.cc: New file.
3761 * testsuite/icf_preemptible_functions_test.sh: New file.
3762 * testsuite/icf_string_merge_test.cc: New file.
3763 * testsuite/icf_string_merge_test.sh: New file.
3764 * testsuite/icf_virtual_function_folding_test.cc: New file.
3765 * testsuite/icf_virtual_function_folding_test.sh: New file.
3766
3767 2010-04-14 Doug Kwan <dougkwan@google.com>
3768
3769 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3770 for local symbol recounting if we remove a section due to ICF.
3771 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3772 there are no regular objects in input.
3773
3774 2010-04-13 Doug Kwan <dougkwan@google.com>
3775
3776 * arm.cc (Arm_input_section::set_final_data_size): Compute
3777 accurate final data size instead of using current data size.
3778
3779 2010-04-09 Doug Kwan <dougkwan@google.com>
3780
3781 * layout.cc (Layout::choose_output_section): Handle script section
3782 types.
3783 (Layout::make_output_section_for_script): Add section type parameter.
3784 Handle script section types.
3785 * layout.h (Layout::make_output_section_for_script): Add section
3786 type parameter.
3787 * output.cc (Output_section::Output_section): Initialize data member
3788 is_noload_.
3789 (Output_section::do_reset_address_and_file_offset): Do not set address
3790 to 0 if section is a NOLOAD section.
3791 * output.h (Output_section::is_noload): New method.
3792 (Output_section::set_is_noload): Ditto.
3793 (Output_section::is_noload_): New data member.
3794 * script-c.h (Script_section_type): New enum type.
3795 (struct Parser_output_section_header): Add new file section_type.
3796 * script-sections.cc (Sections_element::output_section_name): Add
3797 parameter for returning script section type.
3798 (Output_section_definition::output_section_name): Ditto.
3799 (Output_section_definition::section_type)P; New method.
3800 (Output_section_definiton::script_section_type_name): Ditto.
3801 (Output_section_definition::script_section_type_): New data member.
3802 (Output_section_definition::Output_section_definition): Initialize
3803 data member Output_section_definition::script_section_type_.
3804 (Output_section_definition::create_sections): Pass script section type
3805 to Layout::make_output_section_for_script.
3806 (Output_section_definition::output_section_name): Return script
3807 section type to caller.
3808 (Output_section_definition::set_section_address): Do not advance
3809 dot value and load address if section type is NOLOAD. Set address
3810 of NOLOAD sections regardless of section flags.
3811 (Output_section_definition::print): Print section type if it is
3812 not SCRIPT_SECTION_TYPE_NONE.
3813 (Output_section_definition::section_type): New method.
3814 (Output_section_definition::script_section_type_name): Ditto.
3815 (Script_sections::output_section_name): Add new parameter
3816 PSECTION_TYPE for returning script section type. Pass it to
3817 section elements. Handle discard sections.
3818 (Sort_output_sections::operator()): Handle NOLOAD sections.
3819 * script-sections.h (Script_sections::Section_type): New enum type.
3820 (Script_sections::output_section_name): Add a new parameter for
3821 returning script section type.
3822 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3823 INFO and NOLOAD.
3824 * yyscript.y (union): Add new field SECTION_TYPE.
3825 (COPY, DSECT, INFO, NOLOAD): New tokens.
3826 (opt_address_and_section_type): Change type to output_section_header.
3827 (section_type): New non-terminal
3828 (section_header): Handle section type.
3829 (opt_address_and_section_type): Return section type value.
3830
3831 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3832
3833 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3834 * testsuite/plugin_common_test_2.c (foo): Likewise.
3835
3836 2010-04-08 Doug Kwan <dougkwan@google.com>
3837
3838 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3839 Output_merge_data.
3840 * output.cc (Output_section::add_merge_input_section): Simplify
3841 code and return status of Output_merge_base::add_input_section.
3842 Update merge section map only if Output_merge_base::add_input_section
3843 returns true.
3844
3845 2010-04-07 Doug Kwan <dougkwan@google.com>
3846
3847 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3848 if section is marked as containing instructions but has no mapping
3849 symbols.
3850 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3851 correct section index.
3852 (Arm_relobj::find_linked_text_section): Ditto.
3853
3854 2010-04-07 Cary Coutant <ccoutant@google.com>
3855
3856 * archive.cc (include_member): Destroy Read_symbols_data object before
3857 releasing file.
3858 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3859 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3860 (Read_symbols_data::~Read_symbols_data) New destructor.
3861 (Section_relocs::Section_relocs) New constructor.
3862 (Section_relocs::~Section_relocs) New destructor.
3863 (Read_relocs_data::Read_relocs_data) New constructor.
3864 (Read_relocs_data::~Read_relocs_data) New destructor.
3865 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3866 pointers to NULL after deleting.
3867
3868 2010-04-07 Doug Kwan <dougkwan@google.com>
3869
3870 * arm.cc: Replace "endianity" with "endianness" in comments.
3871 (Arm_exidx_cantunwind): Ditto.
3872 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3873 (Arm_relobj::merge_flags_and_attributes): New method.
3874 (Arm_relobj::merge_flags_and_attributes_): New data member.
3875 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3876 (Arm_relobj::scan_sections_for_stubs): Ditto.
3877 (Arm_relobj::do_read_symbols): Check to see if we really want to
3878 merge processor-specific flags and attributes. Exit early if
3879 an object is empty except for section names and the undefined symbol.
3880 (Target_arm::do_finalize_sections): Move check for ELF format to
3881 Arm_relobj::do_read_symbols. Merge processor specific flags and
3882 attributes from a regular object only when we have determined that
3883 it is aapropriate. Do not create an .ARM.attributes section in
3884 output if there is no regular input object.
3885 (Target_arm::merge_processor_specific_flags): Check
3886 --warn-mismatch before printing any error.
3887 (Target_arm::merge_object_attributes): Ditto.
3888 * gold.cc (queue_middle_tasks): Handle the case in which there is
3889 no regular object in input.
3890 * options.cc (General_options::parse_EB): New method.
3891 (General_options::parse_EL): Same.
3892 (General_options::General_options): Initialize endianness_.
3893 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3894 New options.
3895 (General_options::Endianness): New enum.
3896 (General_options::endianness): New method.
3897 (General_options::endianness_): New data member.
3898 * parameters.cc (Parameters::set_options): Check target endianness.
3899 (Parameters::set_target_once): Ditto.
3900 (Parameters::check_target_endianness): New method.
3901 (parameters_force_valid_target): If either -EL or -EB is specified,
3902 use it to define endianness of default target.
3903 * parameters.h (Parameters::check_target_endianness): New method
3904 declaration.
3905 * target.h (class Target): Change "endianity" to "endianness"
3906 in comments.
3907
3908 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3909
3910 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3911 * configure: Regenerate.
3912 * Makefile.in: Regenerate.
3913 * testsuite/Makefile.in: Regenerate.
3914
3915 2010-04-06 Cary Coutant <ccoutant@google.com>
3916
3917 gcc PR lto/42757
3918 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3919 prevailing definitions of common symbols.
3920 * testsuite/plugin_test_6.sh: New test case.
3921 * testsuite/plugin_common_test_1.c: New test case.
3922 * testsuite/plugin_common_test_2.c: New test case.
3923 * testsuite/Makefile.am (plugin_test_6): New test case.
3924 * testsuite/Makefile.in: Regenerate.
3925
3926 2010-04-06 Nick Clifton <nickc@redhat.com>
3927
3928 * po/vi.po: New Vietnamese translation.
3929
3930 2010-03-30 Doug Kwan <dougkwan@google.com>
3931
3932 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3933
3934 2010-03-25 Doug Kwan <dougkwan@google.com>
3935
3936 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3937 to avoid a conversion warning on a 32-bit host.
3938
3939 2010-03-24 Ian Lance Taylor <iant@google.com>
3940
3941 * testsuite/script_test_3.t: Add a TLS segment.
3942 * testsuite/Makefile.am (check_PROGRAMS): Add
3943 tls_phdrs_script_test.
3944 (tls_phdrs_script_test_SOURCES): Define.
3945 (tls_phdrs_script_test_DEPENDENCIES): Define.
3946 (tls_phdrs_script_test_LDFLAGS): Define.
3947 (tls_phdrs_script_test_LDADD): Define.
3948 * testsuite/Makefile.in: Rebuild.
3949
3950 2010-03-23 Cary Coutant <ccoutant@google.com>
3951
3952 * fileread.cc (find_or_make_view): Fix comment.
3953
3954 2010-03-23 Ian Lance Taylor <iant@google.com>
3955
3956 * script-sections.cc (class Orphan_section_placement): Define
3957 PLACE_TLS and PLACE_TLS_BSS.
3958 (Orphan_section_placement::Orphan_section_placement): Initialize
3959 new places.
3960 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3961 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3962 (tls_script_test_SOURCES): Define.
3963 (tls_script_test_DEPENDENCIES): Define.
3964 (tls_script_test_LDFLAGS): Define.
3965 (tls_script_test_LDADD): Define.
3966 * testsuite/Makefile.in: Rebuild.
3967
3968 2010-03-22 Doug Kwan <dougkwan@google.com>
3969
3970 * arm.cc (Arm_relocate_functions::abs8,
3971 Arm_relocate_functions::abs16): Use correct check for overflow
3972 specified in the ARM ELF specs.
3973 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3974 target of a BLX instruction specially.
3975 (Reloc_stub::stub_type_for_reloc): Ditto.
3976 (Relocate::relocate): Use symbolic names instead of numeric relocation
3977 codes to report error.
3978 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3979 workaround.
3980 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3981 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3982 thumb2_blx_out_of_range.stdout
3983 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3984 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3985 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3986 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3987 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3988 thumb2_blx_in_range, thumb2_blx_in_range.o,
3989 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3990 thumb2_blx_out_of_range.o): New rules.
3991 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3992 thumb2_blx_in_range and thumb2_blx_out_of_range.
3993 * testsuite/Makefile.in: Regenerate.
3994 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3995 * testsuite/thumb_blx_in_range.s: New file.
3996 * testsuite/thumb_blx_out_of_range.s: New file.
3997
3998 2010-03-22 Rafael Espindola <espindola@google.com>
3999
4000 * archive.cc (Should_include): Move to archive.h.
4001 (should_include_member): Make it a member of Archive.
4002 (Lib_group): New.
4003 (Add_lib_group_symbols): New.
4004 * archive.h: Include options.h.
4005 (Archive_member): Moved from Archive.
4006 (Should_include): Moved from archive.cc.
4007 (Lib_group): New.
4008 (Add_lib_group_symbols): New.
4009 * dynobj.cc (do_should_include_member): New.
4010 * dynobj.h (do_should_include_member): New.
4011 * gold.cc (queue_initial_tasks): Update call to queue.
4012 * main.cc (main): Print lib group stats.
4013 * object.cc (do_should_include_member): New.
4014 * object.h: Include archive.h.
4015 (Object::should_include_member): New.
4016 (Object::do_should_include_member): New.
4017 (Sized_relobj::do_should_include_member): New.
4018 * options.cc (General_options::parse_start_lib): New.
4019 (General_options::parse_end_lib): New.
4020 (Input_arguments::add_file): Handle lib groups.
4021 (Input_arguments::start_group): Check we are not in a lib.
4022 (Input_arguments::start_lib): New.
4023 (Input_arguments::end_lib): New.
4024 * options.h (General_options): Add start_lib and end_lib.
4025 (Input_argument::lib_): New.
4026 (Input_argument::lib): New.
4027 (Input_argument::is_lib): New.
4028 (Input_file_lib): New.
4029 (Input_arguments::in_lib_): New.
4030 (Input_arguments::in_lib): New.
4031 (Input_arguments::start_lib): New.
4032 (Input_arguments::end_lib_): New.
4033 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4034 in unused members as preempted.
4035 (Sized_pluginobj::do_should_include_member): New.
4036 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4037 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4038 return the blocker.
4039 (Read_symbols::do_whole_lib_group): New.
4040 (Read_symbols::do_lib_group): New.
4041 (Read_symbols::do_read_symbols): Handle lib groups.
4042 (Read_symbols::get_name): Handle lib groups.
4043 * readsyms.h (Read_symbols): Add an archive member pointer.
4044 (Read_symbols::do_whole_lib_group): New.
4045 (Read_symbols::do_lib_group): New.
4046 (Read_symbols::member_): New.
4047 * script.cc (read_input_script): Update call to queue_soon.
4048
4049 2010-03-19 Doug Kwan <dougkwan@google.com>
4050
4051 * arm.cc (Stub_table::Stub_table): Initialize new data members
4052 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4053 (Stub_table::add_reloc_stub): Assign stub offset and update
4054 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4055 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4056 New data members.
4057 (Stub_table::update_data_size_and_addralign): Use
4058 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4059 instead of going over all reloc stubs.
4060 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4061 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4062 Stringpool_template::offset_ to size of Stringpool_char.
4063 (Stringpool_template::new_key_offset): Remove code to initialize
4064 Stringpool_template::offset_.
4065 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4066 Stringpool_template::offset_ to zero.
4067
4068 2010-03-15 Doug Kwan <dougkwan@google.com>
4069
4070 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4071 offset_.
4072 (Stringpool_template::new_key_offset): New method.
4073 (Stringpool_template::add_string): Assign offsets when adding new
4074 strings.
4075 (Stringpool_template::set_string_offsets): Do not set string offsets
4076 when not optimizing.
4077 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4078 member size_.
4079 (Chunked_vector::clear): Clear size_.
4080 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4081 (Chunked_vector::size): Return size_.
4082 (Chunked_vector::push_back): Use size_ to find insert position.
4083 (Chunked_vector::size_): New data member.
4084 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4085 (Stringpool_template::new_key_offset): New method declaration.
4086 (Stringpool_template::offset_): New data member.
4087
4088 2010-03-15 Rafael Espindola <espindola@google.com>
4089
4090 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4091 Add_symbols' constructor.
4092 * readsyms.h (Add_symbols): Remove the input_group member.
4093
4094 2010-03-10 Ian Lance Taylor <iant@google.com>
4095
4096 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4097 target to ask whether a reference to a symbol requires a stack
4098 split.
4099 * target.h (Target::is_call_to_non_split): New function.
4100 (Target::do_is_call_to_non_split): Declare virtual function.
4101 * target.cc: Include "symtab.h".
4102 (Target::do_is_call_to_non_split): New function.
4103 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4104
4105 2010-03-10 Cary Coutant <ccoutant@google.com>
4106
4107 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4108 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4109 (File_read::open[2]): Add whole_file_view_ to list of views.
4110 (File_read::make_view): Remove test of whole_file_view_.
4111 (File_read::find_or_make_view): Create whole_file_view_ if
4112 necessary.
4113 (File_read::clear_views): Replace bool parameter with enum;
4114 adjust all callers. Don't delete views with permanent data;
4115 do delete cached views and views from archives if
4116 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4117 if clearing the corresponding view.
4118 * fileread.h (File_read::Clear_views_mode): New enum.
4119 (File_read::View::is_permanent_view): New method.
4120 (File_read::clear_views): Replace bool parameter
4121 with enum; adjust all callers.
4122 * options.h (General_options): Change keep_files_mapped option;
4123 add map_whole_files.
4124 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4125 releasing the file.
4126 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4127 the file.
4128
4129 2010-03-10 David S. Miller <davem@davemloft.net>
4130
4131 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4132
4133 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4134
4135 * icf.cc (get_section_contents): Add '@' marker after processing the
4136 merge reloc.
4137
4138 2010-03-08 Doug Kwan <dougkwan@google.com>
4139
4140 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4141 due to a conversion warning.
4142 (Arm_relobj::update_output_local_symbol_count): Check for local
4143 symbol with unset output index.
4144
4145 2010-03-05 Ian Lance Taylor <iant@google.com>
4146
4147 * options.h (class General_options): Add --spare-dynamic-tags.
4148 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4149 --spare-dynamic-tags.
4150
4151 2010-03-05 Ian Lance Taylor <iant@google.com>
4152
4153 * incremental.cc: Include "libiberty.h".
4154
4155 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4156
4157 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4158 function, is_info_ member.
4159 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4160 (Versions::Versions): Update caller.
4161 (Versions::define_base_version): Likewise.
4162 (Versions::add_def): Likewise.
4163
4164 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4165
4166 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4167 (Scan::possible_function_pointer_reloc): New function.
4168 (Scan::local_reloc_may_be_function_pointer): Change to call
4169 possible_function_pointer_reloc.
4170 (Scan::global_reloc_may_be_function_pointer): Ditto.
4171 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4172 relocations in ".data.rel.ro._ZTV" section.
4173 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4174 * testsuite/icf_safe_so_test.cc: Ditto.
4175 * testsuite/icf_safe_test.cc: Ditto.
4176 * testsuite/icf_safe_test.sh: Ditto.
4177
4178 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4179 Ian Lance Taylor <iant@google.com>
4180
4181 * target-reloc.h (relocate_section): Check the symbol table index
4182 for -1U before setting the local symbol index.
4183 (scan_relocatable_relocs): If copying the relocation, record that
4184 the local symbol is required.
4185 * object.h (Symbol_value::is_output_symtab_index_set): New
4186 function.
4187 (Symbol_value::may_be_discarded_from_output_symtab): New
4188 function.
4189 (Symbol_value::has_output_symtab_entry): New function.
4190 (Symbol_value::needs_output_symtab_entry): Remove.
4191 (Symbol_value::output_symtab_index): Make sure the symbol index is
4192 set.
4193 (Symbol_value::set_output_symtab_index): Make sure the symbol
4194 index is not set. Make sure the new index is valid.
4195 (Symbol_value::set_must_have_output_symtab_entry): New function.
4196 (Symbol_value::has_output_dynsym_entry): New function.
4197 (Symbol_value::set_output_dynsym_index): Make sure the new index
4198 is valid.
4199 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4200 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4201 local symbol if permitted.
4202 (Sized_relobj::do_finalize_local_symbols): Call
4203 is_output_symtab_index_set rather than needs_output_symtab_entry.
4204 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4205 rather than needs_output_symtab_entry. Call
4206 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4207 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4208 is_output_symtab_index_set rather than needs_output_symtab_entry.
4209 * testsuite/discard_locals_relocatable_test.c: New file.
4210 * testsuite/discard_locals_test.sh: Test -r.
4211 * testsuite/Makefile.am (check_DATA): Add
4212 discard_locals_relocatable_test1.syms,
4213 discard_local_relocatable_test2.syms.
4214 (MOSTLYCLEANFILES): Likewise. Also add
4215 discard_locals_relocatable_test1.lout and
4216 discard_locals_relocatable_test2.out.
4217 (discard_locals_relocatable_test1.syms): New target.
4218 (discard_locals_relocatable_test.o): New target.
4219 (discard_locals_relocatable_test1.out): New target.
4220 (discard_locals_relocatable_test2.syms): New target.
4221 (discard_locals_relocatable_test2.out): New target.
4222 (various): Add missing ../ld-new dependencies.
4223 * testsuite/Makefile.in: Rebuild.
4224
4225 2010-03-03 Nick Clifton <nickc@redhat.com>
4226
4227 * po/fi.po: New Finnish translation.
4228
4229 2010-03-01 Doug Kwan <dougkwan@google.com>
4230
4231 * layout.cc (Layout::Layout): Force section types of .init_array*,
4232 .preinit_array* and .fini_array* sections.
4233 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4234 Fix check of return value of std::string::find.().
4235 (Output_section::Input_section_sort_compare::operator()): Remove
4236 comment about .init_array.
4237 (Output_section::Input_section_sort_init_fini_compare::operator()):
4238 New method.
4239 (Output_section::sort_attached_input_sections): Handle .init_array
4240 and .fini_array specially.
4241 * output.h (Output_section::Inut_section_sort_compare): Update
4242 comment.
4243 (Output_section::Input_section_sort_init_fini_compare): New struct.
4244
4245 2010-02-26 Doug Kwan <dougkwan@google.com>
4246
4247 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4248 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4249 * testsuite/debug_msg.sh: Avoid matching source line number for
4250 use of global variable undef_int.
4251
4252 2010-02-26 Doug Kwan <dougkwan@google.com>
4253
4254 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4255 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4256 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4257 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4258 * options.cc (General_options::General_options): Initialize member
4259 fix_v4bx_.
4260 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4261 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4262 and rm_no_fix_v4bx.stdout
4263 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4264 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4265 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4266 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4267 and arm_no_fix_v4bx.
4268 * Makefile.in: Regenerate.
4269 * testsuite/arm_fix_v4bx.s: New file.
4270 * testsuite/arm_fix_v4bx.sh: Ditto.
4271
4272 2010-02-24 Doug Kwan <dougkwan@google.com>
4273
4274 * arm.cc (Target_arm::got_section): Make the .got section the first
4275 non RELRO section in the data segment.
4276 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4277 suffixes of section names.
4278
4279 2010-02-24 Doug Kwan <dougkwan@google.com>
4280
4281 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4282 flags and attributes merging if an input file is a binary file.
4283 * fileread.cc (Input_file::open): Record format of original file.
4284 * fileread.h (Input_file::Format): New enum type.
4285 (Input_file::Input_file): Initialize data member format_.
4286 (Input_file::format): New method definition.
4287 (Input_file::format_):: New data member.
4288
4289 2010-02-24 Doug Kwan <dougkwan@google.com>
4290
4291 * arm.cc (Arm_output_data_got): New class.
4292 (ARM_TCB_SIZE): New constant
4293 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4294 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4295 If user uses a script with a SECTIONS clause, issue only a warning
4296 for a misplaced EXIDX input section. Otherwise, issue an error.
4297 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4298 garbage collection.
4299 (Target_arm::got_mode_index_entry): Handle static linking.
4300 (Target_arm::Scan::local): Ditto.
4301 (Target_arm::Scan::global): Ditto.
4302 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4303 all incorrectly implemented relocations.
4304 (Target_arm::fix_exidx_coverage): Pass layout to
4305 Arm_output_section::fix_exidx_coverage.
4306 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4307 from ".ARM.exidx." and ".ARM.extab.".
4308
4309 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4310
4311 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4312 section if it does not already exist.
4313 * attributes.cc (Attributes_section_data::Attributes_section_data):
4314 Don't crash if size is zero.
4315
4316 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4317 Ian Lance Taylor <iant@google.com>
4318
4319 * gold.cc (queue_middle_tasks): If no input files were opened,
4320 exit.
4321 * workqueue.h (Task_function::Task_function): Assert that there is
4322 a blocker.
4323
4324 2010-02-22 Doug Kwan <dougkwan@google.com>
4325
4326 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4327 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4328 types to avoid warnings due to different uint64_t implementations
4329 on different hosts.
4330
4331 2010-02-21 Doug Kwan <dougkwan@google.com>
4332
4333 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4334 handling of the maximum backward branch offset.
4335 (Arm_relocate_functions::thumb_branch_common): Ditto.
4336 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4337 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4338 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4339 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4340 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4341 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4342 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4343 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4344 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4345 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4346 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4347 thumb2_bl_out_of_range.o): New rules.
4348 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4349 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4350 thumb2_bl_out_of_range
4351 * testsuite/Makefile.in: Regenerate.
4352 * testsuite/arm_bl_in_range.s: New file.
4353 * testsuite/arm_bl_out_of_range.s: Ditto.
4354 * testsuite/arm_branch_in_range.sh: Ditto.
4355 * testsuite/arm_branch_range.t: Ditto.
4356 * testsuite/thumb2_branch_range.t: Ditto.
4357 * testsuite/thumb_bl_in_range.s: Ditto.
4358 * testsuite/thumb_bl_out_of_range.s: Ditto.
4359 * testsuite/thumb_branch_range.t: Ditto.
4360
4361 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4362
4363 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4364 Add reloc offset information.
4365 * icf.cc (get_section_contents): Change iterators to point to the new
4366 vectors. Add reloc offset information to the contents.
4367 * icf.h (Icf::Sections_reachable_info): New typedef.
4368 (Icf::Sections_reachable_list): New typedef.
4369 (Icf::Offset_info): New typedef.
4370 (Icf::Reloc_info): New struct typedef.
4371 (Icf::Reloc_info_list): New typedef.
4372 (Icf::symbol_reloc_list): Delete method.
4373 (Icf::addend_reloc_list): Delete method.
4374 (Icf::section_reloc_list): Delete method.
4375 (Icf::reloc_info_list): New method.
4376 (Icf::reloc_info_list_): New member.
4377
4378 2010-02-19 Doug Kwan <dougkwan@google.com>
4379
4380 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4381 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4382 * arm.cc (Arm_relocation_functions): New forward declaration.
4383 (Target_arm::Target_arm): Initialize new data members
4384 got_mod_index_offset_ and tls_base_symbol_defined_.
4385 (Target_arm::Relocate::relocate_tls): New method.
4386 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4387 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4388 New methods.
4389 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4390 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4391 (Target_arm::got_mod_index_offset_,
4392 Target_arm::tls_base_symbol_defined_): New data members.
4393 (Target_arm::Scan::local, Target::Scan::global,
4394 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4395 relocations.
4396
4397 2010-02-18 Doug Kwan <dougkwan@google.com>
4398
4399 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4400 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4401 text section as a parameter becuase some broken tools may not set
4402 the link in section header.
4403 (Target_arm::has_got_section): New method.
4404 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4405 without any mapping symbol as data only. Remove warning.
4406 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4407 link in its section header, try to discover the link by inspecting the
4408 REL31 relocation at the beginning of the section.
4409 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4410 in error message.
4411 (Target_arm::Scan::global): Treat any reference to the symbol
4412 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4413
4414 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4415
4416 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4417 (Scan::global_reloc_may_be_function_pointer): New function.
4418 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4419 (Scan::global_reloc_may_be_function_pointer): New function.
4420 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4421 (Scan::global_reloc_may_be_function_pointer): New function.
4422 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4423 (Scan::global_reloc_may_be_function_pointer): New function.
4424 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4425 (Scan::global_reloc_may_be_function_pointer): New function.
4426 (Scan::possible_function_pointer_reloc): New function.
4427 (Target_x86_64::can_check_for_function_pointers): New function.
4428 * gc.h (gc_process_relocs): Scan relocation types to determine if
4429 function pointers were taken for targets that support it.
4430 * icf.cc (Icf::find_identical_sections): Include functions for
4431 folding in safe ICF whose pointer is not taken.
4432 * icf.h (Secn_fptr_taken_set): New typedef.
4433 (fptr_section_id_): New member.
4434 (section_has_function_pointers): New function.
4435 (set_section_has_function_pointers): New function.
4436 (check_section_for_function_pointers): New function.
4437 * options.h: Fix comment for safe ICF option.
4438 * target.h (can_check_for_function_pointers): New function.
4439 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4440 Modify icf_safe_test for X86-64.
4441 * testsuite/Makefile.in: Regenerate.
4442 * testsuite/icf_safe_so_test.cc: New file.
4443 * testsuite/icf_safe_so_test.sh: New file.
4444 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4445 (main): Change to take pointer to function kept_func_3.
4446 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4447 folding is done correctly for X86-64.
4448
4449 2010-02-12 David S. Miller <davem@davemloft.net>
4450
4451 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4452 is_symbolless parameter.
4453 (Output_reloc<SHT_REL>::is_symbolless): New.
4454 (Output_reloc<SHT_REL>::is_symbolless_): New.
4455 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4456 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4457 (Output_reloc<SHT_RELA>::is_symbolless): New.
4458 (Output_data_reloc::add_global): Handle is_symbolless.
4459 (Output_data_reloc::add_global_relative): Likewise.
4460 (Output_data_reloc::add_local): Likewise.
4461 (Output_data_reloc::add_local_relative): Likewise.
4462 (Output_data_reloc::add_symbolless_global_addend): New.
4463 (Output_data_reloc::add_symbolless_local_addend): New.
4464 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4465 is_symbolless.
4466 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4467 instead of ->is_relative_
4468 (Output_reloc::write): Likewise.
4469 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4470 (Output_reloc::write_rel): Simplify.
4471
4472 * sparc.cc (Target_sparc::Scan::local): Use
4473 ->add_symbolless_local_addend as needed.
4474 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4475 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4476 based upon relocation offset.
4477
4478 2010-02-11 Doug Kwan <dougkwan@google.com>
4479
4480 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4481 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4482 beginning of function.
4483 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4484 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4485 parameter is_32bit in calls to should_apply_static_reloc.
4486 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4487 (check_DATA): Add arm_abs_global.stdout.
4488 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4489 arm_abs_global.stdout): New rules.
4490 (MOSTLLYCLEANFILES): Add arm_abs_global
4491 * Makefile.in: Regenerate.
4492 * testsuite/arm_abs_global.s: New file.
4493 * testsuite/arm_abs_global.sh: Ditto.
4494 * testsuite/arm_abs_lib.s: Ditto.
4495
4496 2010-02-11 Ian Lance Taylor <iant@google.com>
4497
4498 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4499 Read_relocs task.
4500 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4501 Allocate_commons_task first.
4502 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4503 task, rather than symtab_lock_.
4504 (Gc_process_relocs::~Gc_process_relocs): New function.
4505 (Gc_process_relocs::is_runnable): Check this_blocker_.
4506 (Gc_process_relocs::locks): Use next_blocker_ rather than
4507 blocker_.
4508 (Scan_relocs::~Scan_relocs): New function.
4509 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4510 symtab_lock_.
4511 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4512 next_blocker_.
4513 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4514 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4515 constructor accordingly.
4516 (class Gc_process_relocs): Likewise.
4517 (class Scan_relocs): Likewise.
4518 * common.h (class Allocate_commons_task): Remove symtab_lock_
4519 field, and corresponding constructor parameter.
4520 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4521 symtab_lock_.
4522 (Allocate_commons_task::locks): Likewise.
4523
4524 2010-02-11 Ian Lance Taylor <iant@google.com>
4525
4526 * gold-threads.h (class Once): Define.
4527 (class Initialize_lock): Rewrite as child of Once.
4528 * gold-threads.cc (class Once_initialize): Define.
4529 (once_pointer_control): New static variable.
4530 (once_pointer, once_arg): New static variables.
4531 (c_run_once): New static function.
4532 (Once::Once, Once::run_once, Once::internal_run): New functions.
4533 (class Initialize_lock_once): Remove.
4534 (initialize_lock_control): Remove.
4535 (initialize_lock_pointer): Remove.
4536 (initialize_lock_once): Remove.
4537 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4538 (Initialize_lock::initialize): Rewrite.
4539 (Initialize_lock::do_run_once): New function.
4540 * archive.cc (Archive::interpret_header): Only clear name if it is
4541 not already empty.
4542 * fileread.cc: Include "gold-threads.h"
4543 (file_counts_lock): New static variable.
4544 (file_counts_initialize_lock): Likewise.
4545 (File_read::release): Only increment counts when using --stats.
4546 Use a lock around the increment.
4547 * parameters.cc (class Set_parameters_target_once): Define.
4548 (set_parameters_target_once): New static variable.
4549 (Parameters::Parameters): Move here from parameters.h.
4550 (Parameters::set_target): Rewrite.
4551 (Parameters::set_target_once): New function.
4552 (Parameters::clear_target): Move here and rewrite.
4553 * parameters.h (class Parameters): Update declarations. Add
4554 set_parameters_target_once_ field.
4555 (Parameters::Parameters): Move to parameters.cc.
4556 (Parameters::clear_target): Likewise.
4557 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4558 task.
4559 (Start_group::~Start_group): New function.
4560 (Start_group::is_runnable): New function.
4561 (Start_group::locks, Start_group::run): New functions.
4562 (Finish_group::run): Change saw_undefined to size_t.
4563 * readsyms.h (class Start_group): Define.
4564 (class Finish_group): Change saw_undefined_ field to size_t.
4565 (Finish_group::Finish_group): Remove saw_undefined and
4566 this_blocker parameters. Change all callers.
4567 (Finish_group::set_saw_undefined): New function.
4568 (Finish_group::set_blocker): New function.
4569 * symtab.h (class Symbol_table): Change saw_undefined to return
4570 size_t. Change saw_undefined_ field to size_t.
4571 * target-select.cc (Set_target_once::do_run_once): New function.
4572 (Target_selector::Target_selector): Initialize set_target_once_
4573 field. Don't initialize lock_ and initialize_lock_ fields.
4574 (Target_selector::instantiate_target): Rewrite.
4575 (Target_selector::set_target): New function.
4576 * target-select.h (class Set_target_once): Define.
4577 (class Target_selector): Update declarations. Make
4578 Set_target_once a friend. Remove lock_ and initialize_lock_
4579 fields. Add set_target_once_ field.
4580
4581 2010-02-10 Ian Lance Taylor <iant@google.com>
4582
4583 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4584 queueing any tasks.
4585 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4586 (queue_middle_tasks): Add all blockers before queueing any tasks.
4587 (queue_final_tasks): Likewise.
4588 * token.h (Task_token::add_blockers): New function.
4589 * object.h (Input_objects::number_of_relobjs): New function.
4590
4591 2010-02-10 Ian Lance Taylor <iant@google.com>
4592
4593 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4594 shared, not if not position independent.
4595 * x86_64.cc (Relocate::relocate_tls): Likewise.
4596 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4597 (tls_pie_pic_test): New target.
4598 * testsuite/Makefile.in: Rebuild.
4599
4600 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4601 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4602 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4603 * testsuite/Makefile.in: Rebuild.
4604
4605 2010-02-09 David S. Miller <davem@davemloft.net>
4606
4607 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4608 R_SPARC_RELATIVE using ->add_local_relative().
4609 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4610
4611 * output.h (Output_data_dynamic::add_section_size): New method
4612 that takes two Output_data objects.
4613 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4614 entry param. Handle it in initializers.
4615 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4616 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4617 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4618 arg.
4619 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4620 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4621 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4622 for dynrel_includes_plt.
4623 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4624 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4625 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4626 before .rela.plt
4627 (Target_sparc::do_finalize_sections): Update to pass true for
4628 dynrel_includes_plt.
4629 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4630 output before .rela.plt
4631 (Target_powerpc::do_finalize_sections): Update to pass true for
4632 dynrel_includes_plt when 32-bit.
4633
4634 2010-02-08 Doug Kwan <dougkwan@google.com>
4635
4636 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4637 method.
4638 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4639 Arm_relobj::scan_section_for_cortex_a8_stubs,
4640 Arm_relobj::do_relocation_section): Instead of calling
4641 Output_section::output_address, use faster
4642 Arm_relobj::simple_input_section_output_address.
4643
4644 2010-02-08 David S. Miller <davem@davemloft.net>
4645
4646 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4647 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4648 relocation helper function.
4649
4650 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4651 just like R_SPARC_GOT{10,13,22}.
4652 (Target_sparc::Scan::local): Likewise.
4653 (Target_sparc::Relocate:relocate): Likewise.
4654
4655 2010-02-06 Ian Lance Taylor <iant@google.com>
4656
4657 * configure.ac: Rewrite targetobjs duplicate removal code to use
4658 only shell constructs.
4659 * configure: Rebuild.
4660
4661 2010-02-05 Doug Kwan <dougkwan@google.com>
4662
4663 PR 11247
4664 * arm.cc (Arm_relobj::section_is_scannable): New method.
4665 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4666 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4667
4668 2010-02-04 Doug Kwan <dougkwan@google.com>
4669
4670 PR 11247
4671 * arm-reloc-property.cc (cstdio): Include.
4672 * configure.ac (targetobjs): Remove duplicates.
4673 * configure: Regenerate.
4674 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4675 big and little endian version for a given address size.
4676
4677 2010-02-03 Doug Kwan <dougkwan@google.com>
4678
4679 * arm-reloc-property.cc
4680 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4681 definition.
4682 * arm-reloc-property.h
4683 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4684 New method definition.
4685 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4686 declaration.
4687 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4688 overflow to N.
4689 (GOT_PREL): Change implemented to Y.
4690 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4691 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4692 (Arm_relocate_functions::movw_abs_nc): Remove method.
4693 (Arm_relocate_functions::movt_abs): Ditto.
4694 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4695 (Arm_relocate_functions::thm_movt_abs): Ditto.
4696 (Arm_relocate_functions::movw_rel_nc): Ditto.
4697 (Arm_relocate_functions::movw_rel): Ditto.
4698 (Arm_relocate_functions::movt_rel): Ditto.
4699 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4700 (Arm_relocate_functions:thm_movw_rel): Ditto.
4701 (Arm_relocate_functions:thm_movt_rel): Ditto.
4702 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4703 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4704 New method definitions.
4705 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4706 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4707 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4708 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4709 (Target_arm::Relocate::relocate): Check for non-static or
4710 unimplemented relocation code and exit early. Change calls to
4711 Target_arm::reloc_uses_thumb_bit and
4712 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4713 instead. Refactor code to handle similar relocations to increase
4714 code sharing. Remove check for unsupported relocation code in switch
4715 statement.
4716 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4717 relocation property table to find out size. Change error message to
4718 print out the name of a relocation code instead of the numeric value.
4719 (Target_arm::scan_reloc_for_stub): Use relocation property table
4720 instead of calling Target_arm::reloc_uses_thumb_bit().
4721
4722 2010-02-02 Doug Kwan <dougkwan@google.com>
4723
4724 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4725 types of relaxed input section.
4726
4727 2010-02-02 Doug Kwan <dougkwan@google.com>
4728
4729 * Makefile.am (HFILES): Add arm-reloc-property.h.
4730 (DEFFILES): New.
4731 (TARGETSOURCES): Add arm-reloc-property.cc
4732 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4733 (libgold_a_SOURCES): $(DEFFILES)
4734 * Makefile.in: Regenerate.
4735 * arm-reloc-property.cc: New file.
4736 * arm-reloc-property.h: New file.
4737 * arm-reloc.def: New file.
4738 * arm.cc: Update comments.
4739 (arm-reloc-property.h): New included header.
4740 (arm_reloc_property_table): New global variable.
4741 (Target_arm::do_select_as_default_target): New method definition.
4742 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4743 arm-reloc-property to targ_extra_obj.
4744 * parameters.cc (set_parameters_target): Call
4745 Target::select_as_default_target().
4746 * target.h (Target::select_as_default_target): New method definition.
4747 (Target::do_select_as_default_target): Same.
4748
4749 2010-02-01 Doug Kwan <dougkwan@google.com>
4750
4751 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4752 first_output_text_section_.
4753 (Arm_exidx_fixup::first_output_text_section): New method definition.
4754 (Arm_exidx_fixup::first_output_text_section_): New data member.
4755 (Arm_exidx_fixup::process_exidx_section): Record the first text
4756 output section seen.
4757 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4758 and entsize in output section header.
4759
4760 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4761
4762 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4763 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4764 (Arm_relocate_functions::thm_alu11): New Method.
4765 (Arm_relocate_functions::thm_pc8): New Method.
4766 (Arm_relocate_functions::thm_pc12): New Method.
4767 (Target_arm::Scan::local): Handle the relocations.
4768 (Target_arm::Scan::global): Likewise.
4769 (Target_arm::Relocate::relocate): Likewise.
4770 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4771
4772 2010-01-29 Doug Kwan <dougkwan@google.com>
4773
4774 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4775 of relocation types as ld.
4776
4777 2010-01-29 Doug Kwan <dougkwan@google.com>
4778
4779 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4780 to public.
4781 (Arm_relocate_functions::thumb_branch_common): Ditto.
4782 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4783 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4784 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4785 Arm_relocate_functions::jump24): Remove.
4786 (Target_arm::Relocate::relocate): Adjust code to call
4787 Arm_relocation_functions::arm_branch_common and
4788 Arm_relocation_functions::thumb_branch_common instead of their removed
4789 wrappers. Merge switch-cases together to reduce source code size.
4790
4791 2010-01-29 Doug Kwan <dougkwan@google.com>
4792
4793 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4794 output_local_symbol_count_needs_update_.
4795 (Arm_relobj::output_local_symbol_count_needs_update,
4796 Arm_relobj::set_output_local_symbol_count_needs_update,
4797 Arm_relobj::update_output_local_symbol_count): New methods.
4798 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4799 member.
4800 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4801 of pointed function as in a R_ARM_PREL31 relocation.
4802 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4803 for output local symbol count updating.
4804 (Target_arm::do_relax): Update output local symbol counts in objects
4805 if necessary.
4806 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4807
4808 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4809
4810 * arm.cc: Added support for the ARM relocations:
4811 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4812 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4813 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4814 movw_prel_nc).
4815 (Arm_relocate_functions::movw_rel): New method.
4816 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4817 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4818 thm_movw_prel_nc).
4819 (Arm_relocate_functions::thm_movw_rel): New method.
4820 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4821 thm_movt_prel).
4822 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4823 relocations.
4824 (Target_arm::Scan::global): Likewise.
4825 (Target_arm::Relocate::relocate): Likewise.
4826 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4827 Likewise.
4828
4829 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4830
4831 * arm.cc: Added support for ARM group relocations.
4832 (Target_arm::reloc_needs_sym_origin): New method.
4833 (Arm_relocate_functions::calc_grp_kn): New method.
4834 (Arm_relocate_functions::calc_grp_residual): New method.
4835 (Arm_relocate_functions::calc_grp_gn): New method.
4836 (Arm_relocate_functions::arm_grp_alu): New Method.
4837 (Arm_relocate_functions::arm_grp_ldr): New Method.
4838 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4839 (Arm_relocate_functions::arm_grp_ldc): New Method.
4840 (Target_arm::Scan::local): Handle the ARM group relocations.
4841 (Target_arm::Scan::global): Likewise.
4842 (Target_arm::Relocate::relocate): Likewise.
4843 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4844 Likewise.
4845
4846 2010-01-26 Doug Kwan <dougkwan@google.com>
4847
4848 * arm.cc (set): Include.
4849 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4850 pointer type.
4851 (Arm_output_section::Text_section_list): New type.
4852 (Arm_output_section::append_text_sections_to_list): New method.
4853 (Arm_output_section::fix_exidx_coverage): Ditto.
4854 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4855 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4856 Relobj::set_section_offset() instead of
4857 Sized_relobj::invalidate_section_offset().
4858 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4859 parameter for section headers. Ignore relocation sections for
4860 unallocated sections and EXIDX sections.
4861 (Target_arm::fix_exidx_coverage): New method.
4862 (Target_arm::output_section_address_less_than): New type.
4863 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4864 linked text section instead of the EXIDX section.
4865 (Arm_output_section::create_stub_group): Add an assertion to check
4866 that this is not an EXIDX output section.
4867 (Arm_output_section::append_text_sections_to_list): New method.
4868 (Arm_output_section::fix_exidx_coverage): Ditto.
4869 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4870 Arm_relobj::section_needs_reloc_stub_scanning.
4871 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4872 first pass.
4873 (Target_arm::fix_exidx_coverage): New method.
4874 * object.h (Relobj::set_output_section): New method.
4875 (Sized_relobj::invalidate_section_offset): Remove method.
4876 (Sized_relobj::do_invalidate_section_offset): Remove method.
4877 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4878
4879 2010-01-25 Doug Kwan <dougkwan@google.com>
4880
4881 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4882 Fix warning due to signed and unsigned comparison on a 32-bit host.
4883
4884 2010-01-22 Doug Kwan <dougkwan@google.com>
4885
4886 * arm.cc (Target_arm::do_relax): Record an output section for section
4887 offset adjustment it contains any stub table that has changed.
4888 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4889 offsets in an output section if necessary.
4890 * output.cc (Output_section::Output_section): Initialize
4891 section_offsets_need_adjustments_.
4892 (Output_section::add_input_section_for_script): Renamed to
4893 Output_section::add_simple_input_section.
4894 (Output_section::save_states): Add a comment.
4895 (Output_section::discard_states): New method defintion.
4896 (Output_section::adjust_section_offsets): Same.
4897 * output.h (Output_section::add_input_section_for_script): Renamed to
4898 Output_section::add_simple_input_section.
4899 (Output_section::discard_states): New method declaration.
4900 (Output_section::adjust_section_offsets): Same.
4901 (Output_section::section_offsets_need_adjustment,
4902 Output_section::set_section_offsets_need_adjustment): New method
4903 definitions.
4904 (Output_section::section_offsets_need_adjustment_): New data member.
4905 * script-sections.cc
4906 (Output_section_element_input::set_section_address): Adjust code for
4907 renaming of Output_section::add_input_section_for_script.
4908 (Orphan_output_section::set_section_address): Same.
4909
4910 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4911
4912 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4913 Fix_v4bx enum values .
4914 * gold/options.h (General_options): New option definitions.
4915 (General_options::fix_v4bx): New method.
4916 (General_options::Fix_v4bx): New enum.
4917 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4918 (General_options::parse_fix_v4bx_interworking): New method.
4919
4920 2010-01-22 Doug Kwan <dougkwan@google.com>
4921
4922 * arm.cc (Arm_exidx_fixup): New class.
4923
4924 2010-01-21 Doug Kwan <dougkwan@google.com>
4925
4926 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4927 classes.
4928 (Arm_exidx_section_offset_map): New type.
4929
4930 2010-01-21 Doug Kwan <dougkwan@google.com>
4931
4932 * arm.cc (Arm_exidx_input_section): New class.
4933 (Arm_relobj::exidx_input_section_by_link,
4934 Arm_relobj::exidx_input_section_by_shndx,
4935 Arm_relobj::make_exidx_input_section): New methods.
4936 (read_arm_attributes_section): Remove.
4937 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4938 information about them.
4939 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4940 to here.
4941
4942 2010-01-20 Doug Kwan <dougkwan@google.com>
4943
4944 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4945 Input_section_specifier to Section_id.
4946 (Target_arm::new_arm_input_section: Adjust code for change of key
4947 type.
4948 (Target_arm::find_arm_input_section): Ditto.
4949 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4950 (Section_id): Remove.
4951 (Garbage_collection::Section_id_hash): Remove.
4952 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4953 (Section_id): Remove.
4954 (Icf::Section_id_hash): Remove.
4955 * object.h (Section_id, Const_section_id, Section_id_hash,
4956 Const_section_id_hash): New type definitions.
4957 * output.cc (Output_section::add_relaxed_input_section): Change to
4958 use Const_section_id instead of Input_section_specifier as key type.
4959 (Output_section::add_merge_input_section): Ditto.
4960 (Output_section::build_relaxation_map): Change to use Section_id
4961 instead of Input_section_specifier as key type.
4962 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4963 Ditto.
4964 (Output_section::convert_input_sections_to_relaxed_sections): Change
4965 to use Const_section_id instead of Input_section_specifier as key type.
4966 (Output_section::find_merge_section): Ditto.
4967 (Output_section::find_relaxed_input_section): Ditto.
4968 * output.h (Input_section_specifier): Remove class.
4969 (Output_section::Output_section_data_by_input_section_map): Change
4970 key type to Const_section_id.
4971 (Output_section::Output_relaxed_input_section_by_input_section_map):
4972 Ditto.
4973 (Output_section::Relaxation_map): Change key type to Section_id.
4974
4975 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4976
4977 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4978 (class Arm_v4bx_stub): New class.
4979 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4980 (Stub_factory::make_arm_v4bx_stub): New method.
4981 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4982 (Stub_table::empty): Handle v4bx stubs.
4983 (Stub_table::add_arm_v4bx_stub): New method.
4984 (Stub_table::find_arm_v4bx_stub): New method.
4985 (Arm_relocate_functions::v4bx): New method.
4986 (Target_arm::fix_v4bx): New method.
4987 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4988 (Stub_table::relocate_stubs): Likewise.
4989 (Stub_table::do_write): Likewise.
4990 (Stub_table::update_data_size_and_addralign): Likewise.
4991 (Stub_table::finalize_stubs): Likewise.
4992 (Target_arm::Scan::local): Likewise.
4993 (Target_arm::Scan::global): Likewise.
4994 (Target_arm::do_finalize_sections): Likewise.
4995 (Target_arm::Relocate::relocate): Likewise.
4996 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4997 Likewise.
4998 (Target_arm::scan_reloc_for_stub): Likewise.
4999 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5000
5001 2010-01-19 Ian Lance Taylor <iant@google.com>
5002
5003 * output.cc (Output_section_headers::do_sized_write): Write large
5004 segment count to sh_info field.
5005 (Output_file_header::do_sized_write): For large segment count,
5006 write PN_XNUM to e_phnum field.
5007
5008 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5009
5010 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5011 (Arm_relocate_functions::thm_jump8): New function.
5012 (Arm_relocate_functions::thm_jump11): New function.
5013 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5014 R_ARM_THM_JUMP11.
5015 (Target_arm::Scan::global): Likewise.
5016 (Target_arm::Relocate::relocate): Likewise.
5017 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5018 Likewise.
5019
5020 2010-01-14 Doug Kwan <dougkwan@google.com>
5021
5022 * arm.cc (map, utility): Include headers.
5023 (Target_arm::apply_cortex_a8_workaround): New method.
5024 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5025 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5026 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5027 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5028 the --[no-]fix-cortex-a8 command line options.
5029 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5030 (Target_arm::relocate_stub): Use addend in instruction template.
5031 * options.h (DEFINE_bool): Set the user-set flag.
5032 (General_options): Add --[no-]-fix-cortex options.
5033 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5034 : Update fast look-up map after conversion.
5035
5036 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5037
5038 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5039 in the first pass of do_layout.
5040
5041 2010-01-13 Doug Kwan <dougkwan@google.com>
5042
5043 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5044 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5045 apparent compiler problem of not folding static constant integral
5046 data members of elfcpp::Elf_sizes<32>.
5047
5048 2010-01-13 Doug Kwan <dougkwan@google.com>
5049
5050 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5051 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5052 Arm_relobj::scan_section_for_cortex_a8_erratum,
5053 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5054 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5055 sections to scan for relocation stubs into a new method
5056 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5057 relocation and Cortex-A8 stub scanning.
5058 (Target_arm::do_relax): Force stubs to be after stubbed sections
5059 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5060 the beginning of a new relaxation pass. Update a comment.
5061 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5062
5063 2010-01-12 Ian Lance Taylor <iant@google.com>
5064
5065 * target-reloc.h (visibility_error): New inline function.
5066 (relocate_section): Call visibility_error.
5067 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5068 (MOSTLYCLEANFILES): Likewise.
5069 (protected_4_pic.o, protected_3.err): New targets.
5070 * testsuite/protected_4.cc: New file.
5071
5072 2010-01-12 Doug Kwan <dougkwan@google.com>
5073
5074 * arm.cc (Cortex_a8_reloc): New class.
5075 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5076 and cortex_a8_relocs_info_.
5077 (Target_arm::fix_cortex_a8): New method definition.
5078 (Target_arm::Cortex_a8_relocs_info): New type.
5079 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5080 New data member declarations.
5081 (Target_arm::scan_reloc_for_stub): Record information about
5082 relocations for THUMB branches that might be exempted from the
5083 Cortex-A8 workaround.
5084 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5085 at the beginning of a relaxation pass.
5086
5087 2010-01-12 Doug Kwan <dougkwan@google.com>
5088
5089 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5090 (Arm_relobj::Mapping_symbol_position,
5091 Arm_reloj::Mapping_symbol_position_less,
5092 Arm_relobj::Mapping_symbols_info): New types.
5093 (Target_arm::is_mapping_symbol_name): New method definition.
5094 (Arm_relobj::do_count_local_symbols): Save information about mapping
5095 symbols.
5096
5097 2010-01-11 Doug Kwan <dougkwan@google.com>
5098
5099 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5100 Arm_relocate_functions::thumb32_branch_upper,
5101 Arm_relocate_functions::thumb32_branch_lower,
5102 Arm_relocate_functions::thumb32_cond_branch_offset,
5103 Arm_relocate_functions::thumb32_cond_branch_upper,
5104 Arm_relocate_functions::thumb32_cond_branch_lower,
5105 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5106 branch offset encoding.
5107 (Arm_relocate_functions::thumb_branch_common): Use new branch
5108 offset encoding methods to avoid code duplication.
5109 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5110 (Stub_addend_reader::operator()): Use new branch encoding method
5111 to avoid code duplication.
5112
5113 2010-01-11 Doug Kwan <dougkwan@google.com>
5114
5115 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5116 (Target_arm::do_finalize_sections): Define special EXIDX section
5117 symbols only if referenced.
5118 * gc.h (Garbage_collection::add_reference): New method.
5119 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5120 code duplication.
5121
5122 2010-01-11 Ian Lance Taylor <iant@google.com>
5123
5124 * script.cc (Version_script_info::build_expression_list_lookup):
5125 Change complaing about duplicate wildcard match from error to
5126 warning.
5127
5128 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5129 of 2009-12-30.
5130 (Version_script_info::Version_script_info): Initialize globs_,
5131 default_version_, default_is_global_, and exact_. Don't
5132 initialize globals_ or locals_.
5133 (Version_script_info::build_lookup_tables): Build local symbols
5134 first.
5135 (Version_script_info::unquote): New function.
5136 (Version_script_info::add_exact_match): New function.
5137 (Version_script_info::build_expression_list_lookup): Remove lookup
5138 parameter. Add is_global parameter. Change all callers. Handle
5139 wildcard pattern specially. Unquote pattern. Call
5140 add_exact_match.
5141 (Version_script_info::get_name_to_match): New function.
5142 (Version_script_info::get_symbol_version): New function.
5143 (Version_script_info::get_symbol_version_helper): Remove.
5144 (Version_script_info::check_unmatched_names): Call unquote.
5145 * script.h (class Version_script_info): Change get_symbol_version
5146 to be non-inline and add is_global parameter; change all callers.
5147 Rewrite symbol_is_local. Update declarations. Define struct
5148 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5149 Remove globals_ and locals_ members. Add exact_, globs_,
5150 default_version_, is_global_.
5151 (Version_script_info::Glob): Remove pattern, add expression and
5152 is_global. Update constructor. Change all callers.
5153 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5154 default version.
5155 (Versions::symbol_section_contents): If a symbol is undefined, or
5156 defined in a dynamic object, set the version index to
5157 VER_NDX_LOCAL.
5158 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5159 symbol_is_local.
5160 (Symbol_table::add_from_pluginobj): Likewise.
5161 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5162
5163 2010-01-11 Doug Kwan <dougkwan@google.com>
5164
5165 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5166 (incremental_dump_LDADD): Add linking option for libintl.
5167 * Makefile.in: Regenerate.
5168
5169 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5170
5171 PR gold/11144
5172 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5173 instead of -Ds.
5174 * testsuite/Makefile.in: Regenerated.
5175
5176 2010-01-10 Doug Kwan <dougkwan@google.com>
5177
5178 * options.h (DEFINE_var): Use parentheses around argument varname__
5179 in macro body to avoid any unintended subsequent substitutions.
5180
5181 2010-01-10 Ian Lance Taylor <iant@google.com>
5182
5183 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5184 candidates before doing symbol resolution.
5185
5186 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5187 ODR candidates if only one is weak.
5188
5189 2010-01-08 Ian Lance Taylor <iant@google.com>
5190
5191 * script.cc (Version_script_info::build_expression_list_lookup):
5192 Don't warn about ambiguous version, just record the ambiguity.
5193 (Version_script_info::get_symbol_version_helper): Give error if
5194 version is ambiguous.
5195
5196 2010-01-08 Doug Kwan <dougkwan@google.com>
5197
5198 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5199 prev_data_size_ and prev_addralign_. Remove initializer for
5200 deleted data member has_been_changed_.
5201 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5202 to determine if the table is empty.
5203 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5204 Remove.
5205 (Stub_table::add_reloc_stub): Define method in class definition
5206 instead of just declaring it there.
5207 (Stub_table::add_cortex_a8_stub): New method definition.
5208 (Stub_table::update_data_size_and_addralign): Ditto.
5209 (Stub_table::finalize_stubs): Ditto.
5210 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5211 (Stub_table::do_addralign_): Return address alignment in the
5212 (Stub_table::do_reset_address_and_file_offset): Define method in
5213 class definition instead of declaring it there. Set current data
5214 size to be the data size of the previous pass.
5215 (Stub_table::set_final_data_size): Use current data size as the
5216 final data size.
5217 (Stub_table::relocate_stub): Change parameter type of stub from
5218 Reloc_stub pointer to Stub pointer.
5219 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5220 (Stub_table::Cortex_a8_stub_list): New typedef.
5221 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5222 Stub_table::prev_addralign_): New data member.
5223 (Arm_relobj::Arm_relobj): Initialize data member
5224 section_has_cortex_a8_workaround_.
5225 (Arm_relobj::section_has_cortex_a8_workaround,
5226 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5227 definitions.
5228 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5229 declarations.
5230 (Target_arm::relocate_stub): Change parameter type of stub from
5231 Reloc_stub pointer to Stub pointer.
5232 (Insn_template::size, Insn_template::alignment): Handle
5233 THUMB16_SPECIAL_TYPE.
5234 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5235 Stub_table::update_data_size_and_addralign,
5236 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5237 definitions.
5238 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5239 (Stub_table::do_write): Ditto.
5240 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5241
5242 2010-01-08 Ian Lance Taylor <iant@google.com>
5243
5244 PR 11108
5245 * symtab.h (class Symbol): Remove fields is_target_special_ and
5246 has_plt_offset_. Add field is_defined_in_discarded_section_.
5247 (Symbol::is_defined_in_discarded_section): New function.
5248 (Symbol::set_is_defined_in_discarded_section): New function.
5249 (Symbol::has_plt_offset): Rewrite.
5250 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5251 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5252 Don't initialize is_target_special_ or has_plt_offset_.
5253 Initialize is_defined_in_discarded_section_.
5254 (Symbol_table::add_from_relobj): If appropriate, set
5255 is_defined_in_discarded_section.
5256 * resolve.cc (Symbol::override_base_with_special): Don't test
5257 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5258 * target-reloc.h (relocate_section): Do special handling for
5259 symbols defined in discarded sections for global symbols as well
5260 as local symbols.
5261
5262 2010-01-08 Ian Lance Taylor <iant@google.com>
5263
5264 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5265 the SHT_SYMTAB case.
5266
5267 2010-01-08 Ian Lance Taylor <iant@google.com>
5268
5269 * object.cc (Sized_relobj::do_layout): Don't get confused if
5270 layout_eh_frame returns NULL.
5271
5272 2010-01-08 Ian Lance Taylor <iant@google.com>
5273
5274 PR 11084
5275 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5276 dynamic symbol table, use the normal symbol table.
5277 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5278 symbol table.
5279
5280 2010-01-08 Ian Lance Taylor <iant@google.com>
5281
5282 PR 11072
5283 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5284 sections.
5285
5286 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5287
5288 * version.cc (print_version): Change to "Copyright 2010".
5289
5290 2010-01-08 Ian Lance Taylor <iant@google.com>
5291
5292 PR 10287
5293 PR 11063
5294 * i386.cc (class Target_i386): Change return type of plt_section
5295 to be non-const.
5296 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5297 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5298 tls_desc_rel_ field.
5299 (Output_data_plt_i386::rel_tls_desc): New function.
5300 (Target_i386::rel_tls_desc_section): New function.
5301 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5302 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5303 R_386_TLS_DESC reloc in rel_tls_desc_section.
5304 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5305 Define struct Tlsdesc_info.
5306 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5307 (Target_x86_64::do_reloc_symbol_index): New function.
5308 (Target_x86_64::add_tlsdesc_info): New function.
5309 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5310 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5311 tlsdesc_rel_ field.
5312 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5313 all callers.
5314 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5315 (Target_x86_64::rela_tlsdesc_section): New function.
5316 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5317 handling.
5318 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5319 (Target_x86_64::do_reloc_addend): New function.
5320 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5321 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5322 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5323 (Output_reloc::type): New function.
5324 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5325 (Output_reloc::is_target_specific): New function.
5326 (Output_reloc::target_arg): New function.
5327 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5328 absolute relocs and target specific relocs.
5329 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5330 add_target_specific.
5331 (class Output_data_reloc) [SHT_RELA]: Likewise.
5332 * output.cc (Output_reloc::Output_reloc): Add four new versions
5333 for absolute relocs and target specific relocs.
5334 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5335 (Output_reloc::get_symbol_index): Likewise.
5336 (Output_reloc::local_section_offset): Check that local_sym_index_
5337 is not TARGET_CODE or 0.
5338 (Output_reloc::symbol_value): Likewise.
5339 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5340 reloc.
5341 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5342 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5343 functions.
5344 * layout.cc (add_target_dynamic_tags): Use output section for
5345 DT_PLTRELSZ and DT_JMPREL.
5346
5347 2010-01-07 Ian Lance Taylor <iant@google.com>
5348
5349 PR 11061
5350 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5351 function.
5352 (class Output_data_reloc_generic): Define.
5353 (class Output_data_reloc_base): Change base class to
5354 Output_data_reloc_generic. Change add() method to call
5355 bump_relative_reloc_count for a relative reloc. Remove
5356 sort_relocs_ field.
5357 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5358 to sort_relocs().
5359 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5360 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5361 appropriate.
5362 * layout.h (class Layout): Update declaration.
5363
5364 2010-01-07 Ian Lance Taylor <iant@google.com>
5365
5366 * output.h (class Output_data): Add const version of
5367 output_section and do_output_section.
5368 (class Output_section_data): Add const version of
5369 do_output_section.
5370 (class Output_section): Likewise.
5371 * layout.cc (Layout::add_target_dynamic_tags): New function.
5372 * layout.h (class Layout): Update declarations.
5373 * arm.cc (Target_arm::do_finalize_sections): Use
5374 add_target_dynamic_tags.
5375 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5376 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5377 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5378 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5379
5380 2010-01-07 Ian Lance Taylor <iant@google.com>
5381
5382 PR 11042
5383 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5384 object as needed.
5385
5386 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5387 Ian Lance Taylor <iant@google.com>
5388
5389 PR 11019
5390 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5391 Xindex::read_symtab_xindex.
5392
5393 2010-01-07 Doug Kwan <dougkwan@google.com>
5394
5395 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5396 (Insn_template::thumb16_bcond_insn): New method declaration.
5397 (Insn_template): Fix spelling.
5398 (Stub::thumb16_special): New method declaration.
5399 (Stub::do_write): Define virtual method which was previously pure
5400 virtual.
5401 (Stub::do_thumb16_special): New method declaration.
5402 (Stub::do_fixed_endian_write): New template member.
5403 (Reloc_stub::do_write): Remove.
5404 (Reloc_stub::do_fixed_endian_write): Remove.
5405 (Cortex_a8_stub): New class definition.
5406 (Stub_factory::make_cortex_a8_stub): New method definition.
5407 (Stub_factory::Stub_factory): Add missing static storage class
5408 qualifier for elf32_arm_stub_a8_veneer_blx.
5409
5410 2010-01-07 Ian Lance Taylor <iant@google.com>
5411
5412 PR 10980
5413 * options.h (class General_options): Add --warn-unresolved-symbols
5414 and --error-unresolved-symbols.
5415 * errors.cc (Errors::undefined_symbol): Implement
5416 --warn-unresolved-symbols.
5417
5418 * options.h (class General_options): Add -z text and -z textoff.
5419 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5420
5421 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5422
5423 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5424 (Garbage_collection::cident_sections): New function.
5425 (Garbage_collection::add_cident_section): New function.
5426 (Garbage_collection::cident_sections_): New member.
5427 (gc_process_relocs): Add references to sections whose names are C
5428 identifiers.
5429 * gold.h (cident_section_start_prefix): New constant.
5430 (cident_section_stop_prefix): New constant.
5431 (is_cident): New function.
5432 * layout.cc (Layout::define_section_symbols): Replace string constants
5433 with the newly defined constants.
5434 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5435 C identifiers.
5436 * testsuite/Makefile.am: Add gc_orphan_section_test.
5437 * testsuite/Makefile.in: Regenerate.
5438 * testsuite/gc_orphan_section_test.cc: New file.
5439 * testsuite/gc_orphan_section_test.sh: New file.
5440
5441 2010-01-06 Ian Lance Taylor <iant@google.com>
5442
5443 PR 10980
5444 * options.h (class General_options): Add --warn-shared-textrel.
5445 * layout.cc (Layout::finish_dynamic_section): Implement
5446 --warn-shared-textrel.
5447
5448 PR 10980
5449 * options.h (class General_options): Add --warn-multiple-gp.
5450
5451 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5452
5453 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5454 $(THREADSLIB) and $(LIBDL).
5455 * Makefile.in: Rebuild.
5456
5457 2010-01-06 Ian Lance Taylor <iant@google.com>
5458
5459 PR 10980
5460 * options.cc (General_options::parse_section_start): New function.
5461 (General_options::section_start): New function.
5462 (General_options::General_options): Initialize all members.
5463 * options.h: Include <map>
5464 (class General_options): Add --section-start. Add section_starts_
5465 member.
5466 * layout.cc (Layout::attach_allocated_section_to_segment): If
5467 --section-start was used, set the address of the segment. Remove
5468 local sort_sections.
5469 (Layout::relaxation_loop_body): If the address of the load segment
5470 has been set by --section-start, don't use it.
5471 * output.h (Output_segment::update_flags_for_output_section): New
5472 function.
5473 * output.cc (Output_segment::add_output_section): Call
5474 update_flags_for_output_section.
5475
5476 2010-01-05 Ian Lance Taylor <iant@google.com>
5477
5478 PR 10980
5479 * options.h (class General_options): Add --undefined-version.
5480 * script.cc (struct Version_expression): Add was_matched_by_symbol
5481 field.
5482 (Version_script_info::matched_symbol): New function.
5483 (Version_script_info::get_symbol_version_helper): Call
5484 matched_symbol.
5485 (Version_script_info::check_unmatched_names): New function.
5486 * script.h (class Version_script_info): Update declarations.
5487 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5488
5489 * options.h (class General_options): Use DEFINE_bool_alias for
5490 allow_multiple_definition.
5491 * resolve.cc (Symbol_table::should_override): Don't test
5492 allow_multiple_definition.
5493
5494 PR 10980
5495 * options.h (class General_options): Add --cref.
5496 * main.cc (main): Print cref table if --cref. Don't close mapfile
5497 until after printing cref table.
5498 * cref.cc: Include "symtab.h".
5499 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5500 (Cref_table_compare::operator()): New function.
5501 (Cref_inputs::gather_cref): New function.
5502 (filecol): New static const.
5503 (Cref_inputs::print_cref): New function.
5504 (Cref::print_cref): New function.
5505 * cref.h: Include <cstdio>.
5506 (class Cref): Update declarations.
5507 * mapfile.h (Mapfile::file): New function.
5508 * object.h (class Object): Define Symbols. Declare virtual
5509 do_get_global_symbols.
5510 (Object::get_global_symbols): New function.
5511 * object.cc (Input_objects::add_object): Pass object to cref_ if
5512 --cref.
5513 (Input_objects::archive_start): Likewise.
5514 (Input_objects::archive_stop): Likewise.
5515 (Input_objects::print_cref): New function.
5516 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5517 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5518 --cref.
5519 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5520 function.
5521 * plugin.h (class Sized_pluginobj): Update declarations.
5522
5523 2010-01-05 Ian Lance Taylor <iant@google.com>
5524
5525 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5526 to is_default_version. Rename insdef to insdefault.
5527 (Symbol_table::add_from_relobj): Rename def to is_default_version
5528 and local to is_forced_local.
5529 (Symbol_table::add_from_pluginobj): Likewise.
5530 (Symbol_table::add_from_dynobj): Likewise.
5531 (Symbol_table::define_special_symbol): Rename insdef to
5532 insdefault.
5533
5534 2010-01-04 Ian Lance Taylor <iant@google.com>
5535
5536 PR 10980
5537 * options.h (class General_options): Add
5538 --allow-multiple-definition and -z muldefs.
5539 * resolve.cc (Symbol_table::should_override): Don't warn about a
5540 multiple symbol definition if --allow-multiple-definition or -z
5541 muldefs.
5542
5543 PR 10980
5544 * options.h (class General_options): Add --add-needed and
5545 --copy-dt-needed-entries. Tweak --as-needed help entry.
5546 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5547 error if --copy-dt-needed-entries aka --add-needed is used and
5548 would cause a change in behaviour.
5549
5550 PR 10980
5551 * options.h (class General_options): Add -G as a short version of
5552 --shared. Add no-op options -assert, -g, and -i.
5553
5554 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5555
5556 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5557 check for .text or .gnu.linkonce.t sections.
5558 * icf.cc (Icf::find_identical_sections): Ditto.
5559 Change the detection for mangled function name within the section
5560 name.
5561 * icf.h (is_section_foldable_candidate): New function.
5562
5563 2009-12-30 Ian Lance Taylor <iant@google.com>
5564
5565 PR 10980
5566 * options.h (class General_options): Permit two dashes with
5567 --retain-symbols-file.
5568
5569 2009-12-30 Ian Lance Taylor <iant@google.com>
5570
5571 PR 10979
5572 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5573 don't put the file header and segment headers in the text
5574 segment.
5575
5576 PR 10979
5577 * common.cc (Sort_commons::operator()): Stabilize sort when both
5578 entries are NULL.
5579 (Symbol_table::do_allocate_commons_list): When allocating common
5580 symbols, skip a symbol which is no longer common.
5581 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5582 an object before checking its type.
5583 * testsuite/common_test_2.c: New file.
5584 * testsuite/common_test_3.c: New file.
5585 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5586 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5587 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5588 (common_test_2_pic.o, common_test_2.so): New targets.
5589 (common_test_3_pic.o, common_test_3.so): New targets.
5590 * testsuite/Makefile.in: Rebuild.
5591
5592 PR 10979
5593 * script.cc (read_input_script): If we see a new SECTIONS clause,
5594 and we have added an input section, give an error.
5595 * layout.h (class Layout): Add have_added_input_section function.
5596 Add have_added_input_section_ field.
5597 * layout.cc (Layout::Layout): Initialize
5598 have_added_input_section_.
5599 (Layout::layout): Set have_added_input_section_.
5600 (Layout::layout_eh_frame): Likewise.
5601
5602 2009-12-30 Ian Lance Taylor <iant@google.com>
5603
5604 PR 10931
5605 * options.h (class General_options): Add --sort-common option.
5606 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5607 * common.cc (Sort_common): Add sort_order parameter to
5608 constructor. Add sort_order_ field.
5609 (Sort_commons::operator): Check sort_order_.
5610 (Symbol_table::allocate_commons): Determine the sort order.
5611 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5612 Change all callers.
5613 (Symbol_table::do_allocate_commons_list): Likewise.
5614
5615 2009-12-30 Ian Lance Taylor <iant@google.com>
5616
5617 PR 10916
5618 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5619 symbols from this object, don't change the visibility of an
5620 undefined symbol.
5621 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5622
5623 2009-12-30 Ian Lance Taylor <iant@google.com>
5624
5625 PR 10861
5626 * script.h (class Version_script_info): Define Language enum.
5627 Update declarations. Define Glob, Exact, and Lookup types. Add
5628 new fields globals_, locals_, and is_finalized_.
5629 * script.cc: Various formatting fixes.
5630 (class Parser_closure): Change language_stack_ from a vector of
5631 std::string to one of Version_script_info::Language. Adjust all
5632 uses accordingly.
5633 (class Lazy_demangler): Remove.
5634 (struct Version_expression): Change language from std::string to
5635 Version_script_info::Language.
5636 (Version_script_info::Version_script_info): New function.
5637 (Version_script_info::~Version_script_info): Don't call clear.
5638 (Version_script_info::finalize): New function.
5639 (Version_script_info::build_lookup_tables): New function.
5640 (Version_script_info::build_expression_list_lookup): New
5641 function.
5642 (Version_script_info::get_symbol_version_helper): Rewrite to use
5643 lookup tables.
5644 (Version_script_info::print_expression_list): Adjust to use
5645 Version_script_info::Language.
5646 (script_push_lex_into_version_mode): Check that the version script
5647 has not been finalized.
5648 (version_script_push_lang): Change language string to
5649 Version_script_info::Language.
5650 * options.cc (Command_line::version_script): New function.
5651 * options.h (class General_options): Add finalize_dynamic_list
5652 function. Change version_script from declaration to definition.
5653 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5654 * testsuite/version_script.map: Remove duplicate def of foo.
5655 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5656 version_script.map.
5657 * testsuite/Makefile.in: Rebuild.
5658
5659 2009-12-30 Ian Lance Taylor <iant@google.com>
5660
5661 PR 10843
5662 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5663 if the input symbol index is 0, make the output symbol index 0.
5664
5665 2009-12-30 Ian Lance Taylor <iant@google.com>
5666
5667 PR 10670
5668 * options.h (class General_options): Add -x/--discard-all.
5669 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5670 --discard-all. If the local symbol needs a dynamic entry, check
5671 that before handling --discard-locals.
5672
5673 2009-12-30 Ian Lance Taylor <iant@google.com>
5674
5675 PR 10450
5676 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5677 flags to PF_R.
5678 (Output_segment::add_output_section): Don't change the flags if
5679 the type is PT_TLS.
5680
5681 PR 10450
5682 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5683 GNU hash table if they need a dynamic value. Otherwise, don't add
5684 them if they are defined in a dynamic object or are forced local.
5685
5686 2009-12-29 Ian Lance Taylor <iant@google.com>
5687
5688 PR 10450
5689 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5690 .gnu.hash table for a 32-bit target.
5691
5692 PR 10450
5693 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5694 regular and a dynamic object only needs a dynamic symbol table
5695 entry if it is externally visible.
5696
5697 PR 10450
5698 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5699 constructor. Add global_offset_table_ field.
5700 (Target_i386::got_section): Set global_offset_table_.
5701 (Target_i386::do_finalize_sections): Set global_offset_table_
5702 size.
5703 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5704 in constructor. Add global_offset_table_ field.
5705 (Target_x86_64::got_section): Set global_offset_table_.
5706 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5707 size.
5708
5709 * layout.cc (Layout::Layout): Initialize increase_relro_.
5710 (Layout::get_output_section): Add is_relro, is_last_relro, and
5711 is_first_non_relro parameters. Change all callers.
5712 (Layout::choose_output_section): Likewise.
5713 (Layout::add_output_section_data): Likewise.
5714 (Layout::make_output_section): Likewise.
5715 (Layout::set_segment_offsets): Clear increase_relro when using a
5716 linker script.
5717 * layout.h (class Layout): Add increase_relro method. Add
5718 increase_relro_ field. Update declarations.
5719 * output.cc (Output_section::Output_section): Initialize
5720 is_last_relro_ and is_first_non_relro_.
5721 (Output_segment::add_output_section): Group relro sections is
5722 do_sort is true. Handle is_last_relro and is_first_non_relro.
5723 (Output_segment::maximum_alignment): Remove relro handling.
5724 (Output_segment::set_section_addresses): Add increase_relro
5725 parameter. Change all callers. Add initial alignment to align
5726 relro sections on separate page. Remove old relro handling.
5727 (Output_segment::set_section_list_addresses): Remove in_relro
5728 parameter. Change all callers.
5729 (Output_segment::set_offset): Add increase parameter. Change all
5730 callers. Remove old relro handling.
5731 * output.h (class Output_section): Add new methods: is_last_relro,
5732 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5733 Add is_last_relro_ and is_first_non_relro_ fields.
5734 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5735 Create separate .got.plt section. Call increase_relro.
5736 * x86_64.cc (Target_x86_64::got_section): Likewise.
5737 * testsuite/relro_script_test.t: Add .got.plt.
5738
5739 PR 10450
5740 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5741 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5742 (Layout::finalize): Call set_dynamic_symbol_size.
5743 (Layout::set_dynamic_symbol_size): New function.
5744 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5745 set_dynamic_symbol_size.
5746
5747 PR 10450
5748 * output.h (class Output_section): Add is_entsize_zero_ field.
5749 * output.cc (Output_section::Output_section): Initialize
5750 is_entsize_zero_.
5751 (Output_section::set_entsize): If two different entsizes are
5752 requested, force it to zero.
5753 (Output_section::add_input_section): Set flags for .debug_str
5754 before updating section flags. Set entsize.
5755 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5756 and SHF_STRING if all input sections have those flags.
5757
5758 2009-12-29 Rafael Espindola <espindola@google.com>
5759
5760 * main.cc (main): Fix the sys time reporting.
5761 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5762 reporting.
5763
5764 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5765
5766 * options.cc (General_options::parse_version): Allow -v to exit
5767 without an error if there is nothing to link.
5768
5769 2009-12-29 Ian Lance Taylor <iant@google.com>
5770
5771 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5772 using a version of gcc before 4.1.
5773 * configure: Rebuild.
5774
5775 2009-12-28 Chris Demetriou <cgd@google.com>
5776
5777 * attributes.cc (Output_attributes_section_data::do_write): Use
5778 std::vector::front rather than std::vector::data.
5779
5780 2009-12-28 Ian Lance Taylor <iant@google.com>
5781
5782 * symtab.h (class Symbol_table): Add enum Defined.
5783 * resolve.cc (Symbol_table::should_override): Add defined
5784 parameter. Change all callers. Test whether object is NULL
5785 before calling a method on it.
5786 (Symbol_table::report_resolve_problem): Add defined parameter.
5787 Change all callers.
5788 (Symbol_table::should_override_with_special): Likewise.
5789 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5790 parameter. Change all callers.
5791 (Symbol_table::do_define_in_output_data): Likewise.
5792 (Symbol_table::define_in_output_segment): Likewise.
5793 (Symbol_table::do_define_in_output_segment): Likewise.
5794 (Symbol_table::define_as_constant): Likewise.
5795 (Symbol_table::do_define_as_constant): Likewise.
5796 * script.h (class Symbol_assignment): Add is_defsym parameter to
5797 constructor; change all callers.
5798 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5799 parameter. Change all callers. Add is_defsym_ field.
5800 (class Parser_closure): Add parsing_defsym parameter to
5801 constructor; change all callers. Add parsing_defsym accessor
5802 function. Add parsing_defsym_ field.
5803
5804 2009-12-28 Ian Lance Taylor <iant@google.com>
5805
5806 * gold.cc (queue_middle_tasks): Fix formatting.
5807 * object.cc (Relobj::is_section_name_included): Likewise.
5808
5809 2009-12-23 Ian Lance Taylor <iant@google.com>
5810
5811 * i386.cc (Target_i386::do_calls_non_split): Recognize
5812 -fsplit-stack prologue for a function with a static chain.
5813 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5814 -fsplit-stack prologue when using %r11.
5815
5816 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5817
5818 * options.cc (General_options::parse_version): Make -v continue and do
5819 the link like GNU ld does.
5820
5821 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5822
5823 * Makefile.am (CCFILES): Add timer.cc.
5824 (HFILES): Add timer.h.
5825 * configure.ac: Check for sysconf and times.
5826 * main.cc: include timer.h.
5827 (main): Use Timer instead of get_run_time.
5828 * timer.cc: New.
5829 * timer.h: New.
5830 * workqueue.cc: include timer.h.
5831 (Workqueue::find_and_run_task):
5832 Report user, sys and wall time.
5833 * Makefile.in: Regenerate.
5834 * config.in: Regenerate.
5835 * configure: Regenerate.
5836
5837 2009-12-16 Doug Kwan <dougkwan@google.com>
5838
5839 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5840 sections.
5841 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5842 relaxed input sections.
5843 * output.cc (Output_section::find_relaxed_input_section): Change
5844 return type to Output_relaxed_input_section pointer. Adjust code
5845 for new type of relaxed_input_section_map_.
5846 * output.h (Output_section::find_relaxed_input_section): Change
5847 return type to Output_relaxed_input_section pointer.
5848 (Output_section::Output_relaxed_input_section_by_input_section_map):
5849 New type.
5850 (Output_section::relaxed_input_section_map_): Change type to
5851 Output_section::Output_relaxed_input_section_by_input_section_map.
5852 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5853 input section.
5854
5855 2009-12-15 Ian Lance Taylor <iant@google.com>
5856
5857 * layout.cc (Layout::create_shstrtab): Only write out after input
5858 sections if we are compressing debug sections.
5859
5860 2009-12-15 Ian Lance Taylor <iant@google.com>
5861
5862 * archive.cc (Archive::add_symbols): Only look up a symbol without
5863 a version if there is, in fact, a version.
5864
5865 2009-12-14 Ian Lance Taylor <iant@google.com>
5866
5867 Revert -Wshadow changes, all changes from:
5868 2009-12-11 Doug Kwan <dougkwan@google.com>
5869 2009-12-11 Nick Clifton <nickc@redhat.com>
5870 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5871
5872 2009-12-11 Doug Kwan <dougkwan@google.com>
5873
5874 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5875 due to -Wshadow.
5876 * attributes.cc (Object_attribute::size): Ditto.
5877 (Attributes_section_data::size): Ditto.
5878 (Attributes_section_data::Attributes_section_data): Ditto.
5879 (Output_attributes_section_data::do_write): Ditto.
5880 * attributes.h (Object_attribute::set_type): Ditto.
5881 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5882
5883 2009-12-11 Nick Clifton <nickc@redhat.com>
5884
5885 * archive.cc: Fix shadowed variable warnings.
5886 * arm.cc: Likewise.
5887 * compressed_output.cc: Likewise.
5888 * compressed_output.h: Likewise.
5889 * configure: Likewise.
5890 * dwarf_reader.cc: Likewise.
5891 * dynobj.cc: Likewise.
5892 * dynobj.h: Likewise.
5893 * ehframe.cc: Likewise.
5894 * ehframe.h: Likewise.
5895 * errors.cc: Likewise.
5896 * expression.cc: Likewise.
5897 * fileread.cc: Likewise.
5898 * fileread.h: Likewise.
5899 * freebsd.h: Likewise.
5900 * i386.cc: Likewise.
5901 * icf.cc: Likewise.
5902 * incremental.h: Likewise.
5903 * layout.cc: Likewise.
5904 * layout.h: Likewise.
5905 * mapfile.cc: Likewise.
5906 * merge.cc: Likewise.
5907 * merge.h: Likewise.
5908 * object.cc: Likewise.
5909 * object.h: Likewise.
5910 * options.h: Likewise.
5911 * output.cc: Likewise.
5912 * output.h: Likewise.
5913 * parameters.cc: Likewise.
5914 * plugin.cc: Likewise.
5915 * powerpc.cc: Likewise.
5916 * reduced_debug_output.cc: Likewise.
5917 * reduced_debug_output.h: Likewise.
5918 * reloc.cc: Likewise.
5919 * reloc.h: Likewise.
5920 * resolve.cc: Likewise.
5921 * script-sections.cc: Likewise.
5922 * script.cc: Likewise.
5923 * script.h: Likewise.
5924 * sparc.cc: Likewise.
5925 * symtab.cc: Likewise.
5926 * symtab.h: Likewise.
5927 * target-select.cc: Likewise.
5928 * target-select.h: Likewise.
5929 * token.h: Likewise.
5930 * workqueue.cc: Likewise.
5931 * workqueue.h: Likewise.
5932 * x86_64.cc: Likewise.
5933
5934 2009-12-10 Doug Kwan <dougkwan@google.com>
5935
5936 * arm.cc (attributes.h): New include.
5937 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5938 (Arm_relobj::~Arm_relobj): Delete object pointed by
5939 attributes_section_data_.
5940 (Arm_relobj::attributes_section_data): New method definition.
5941 (Arm_relobj::attributes_section_data_): New data member declaration.
5942 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5943 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5944 attributes_section_data_.
5945 (Arm_dynobj::attributes_section_data): New method definition.
5946 (Arm_dynobj::attributes_section_data_): New data member declaration.
5947 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5948 initialization value of may_use_blx_ to false.
5949 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5950 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5951 object attributes to compute results instead of hard-coding.
5952 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5953 Target_arm::get_secondary_compatible_arch,
5954 Target_arm::set_secondary_compatible_arch
5955 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5956 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5957 New method declarations.
5958 (Target_arm::get_aeabi_object_attribute): New method definition.
5959 (Target_arm::attributes_section_data_): New data member declaration.
5960 (read_arm_attributes_section): New template definition.
5961 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5962 (Arm_dynobj::do_read_symbols): Ditto.
5963 (Target_arm::do_finalize_sections): Merge attributes sections from
5964 input. Check for BLX use after attributes section merging.
5965 Fix __exidx_start and __exidx_end visibility. Create an
5966 .ARM.attributes section if necessary.
5967 (Target_arm::get_secondary_compatible_arch,
5968 Target_arm::set_secondary_compatible_arch,
5969 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5970 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5971 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5972 New method definitions.
5973
5974 2009-12-09 Ian Lance Taylor <iant@google.com>
5975
5976 * plugin.cc (Plugin::load): Don't cast from void* to a function
5977 pointer.
5978
5979 2009-12-09 Ian Lance Taylor <iant@google.com>
5980
5981 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5982 information fields.
5983
5984 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5985
5986 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5987 Replace two_file_shared_1.so with two_file_shared_2.so.
5988 * testsuite/Makefile.in: Regenerated.
5989
5990 2009-12-08 Doug Kwan <dougkwan@google.com>
5991
5992 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5993 (HFILES): Add attributes.h and int_encoding.h.
5994 * Makefile.in: Regenerate.
5995 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5996 function definitions to int_encoding.cc
5997 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5998 prototypes to int_encoding.h
5999 * reduced_debug_output.cc (int_encoding.h): New include.
6000 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6001 function definitions to int_encoding.cc
6002 (insert_into_vector, read_from_pointer): Move template definitions to
6003 int_encoding.h
6004 * attributes.cc: New file.
6005 * attributes.h: New file.
6006 * int_encoding.cc: New file.
6007 * int_encoding.h: New file.
6008
6009 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6010
6011 PR gold/11055
6012 * incremental-dump.cc (dump_incremental_inputs): New.
6013 (main): Use dump_incremental_inputs.
6014
6015 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6016
6017 PR gold/10893
6018 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6019 checking elfcpp::STT_FUNC.
6020 (Target_i386::Relocate::relocate): Likewise.
6021 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6022
6023 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6024 symbols from shared libraries into normal FUNC symbols.
6025
6026 * symtab.h (Symbol): Add is_func and use it.
6027
6028 2009-12-05 Doug Kwan <dougkwan@google.com>
6029
6030 * arm.cc (Target_arm::arm_info): Initialize new fields
6031 attributes_section and attributes_vendor.
6032 * i386.cc (Target_i386::i386_info): Same.
6033 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6034 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6035 fields attributes_section and attributes_vendor.
6036 * sparc.cc (Target_sparc::sparc_info): Same.
6037 * target.h (Target::attributes_section, Target::attributes_vendor,
6038 Target::is_attributes_section, Target::attribute_arg_type,
6039 Target::attributes_order): New method definitions.
6040 (Target::Target_info::attributes_section,
6041 Target::Target_info::attributes_vendor): New fields.
6042 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6043 virtual method definitions.
6044 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6045 attributes_section and attributes_vendor.
6046 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6047
6048 2009-12-05 Doug Kwan <dougkwan@google.com>
6049
6050 * arm.cc: Update comments about interworking and stub generation.
6051 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6052 considered as non-PIC.
6053 (Arm_relocate_functions::base_abs): Fix formatting.
6054 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6055 of function to use GOT entry address instead of offset.
6056 (Target_arm::Scan::global): Issue an error if a symbol would need a
6057 PLT does not get one because it is untyped. Remove code to create
6058 dynamic symbols for relative branches.
6059 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6060 takes unsigned integer instead of boolean.
6061
6062 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6063
6064 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6065 (two_file_test_LDADD): Likewise.
6066 (common_test_1_LDADD): Likewise.
6067 (exception_test_LDADD) Likewise.
6068 (weak_test_LDADD): Likewise.
6069 (many_sections_test_LDADD): Likewise.
6070 (initpri1_LDADD): Likewise.
6071 (script_test_1_LDADD): Likewise.
6072 (script_test_2_LDADD): Likewise.
6073 (justsyms_LDADD): Likewise.
6074 (binary_test_LDADD): Likewise.
6075 (large_LDADD): Likewise.
6076 * testsuite/Makefile.in: Regenerated.
6077
6078 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6079
6080 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6081 (Symbol_table::override_with_special): Likewise.
6082 (Symbol_table::add_from_object): Likewise.
6083
6084 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6085
6086 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6087 Don't set the data_offset twice.
6088
6089 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6090
6091 * testsuite/Makefile.in: Regenerate.
6092
6093 2009-12-03 Doug Kwan <dougkwan@google.com>
6094
6095 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6096 (Target_arm::do_finalize_sections): Add parameter for symbol table
6097 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6098 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6099 parameter for symbol table pointer.
6100 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6101 an additional parameter for a pointer to symbol table.
6102 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6103 parameter for a symbol table pointer.
6104 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6105 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6106 Ditto.
6107 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6108 parameter for a symbol table pointer.
6109
6110 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6111
6112 * incremental.cc (Incremental_inputs_header)
6113 (Incremental_inputs_header_write, Incremental_inputs_entry)
6114 (Incremental_inputs_entry_write): Move ...
6115 * incremental.h (Incremental_inputs_header)
6116 (Incremental_inputs_header_write, Incremental_inputs_entry)
6117 (Incremental_inputs_entry_write): here.
6118
6119 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6120
6121 * incremental.cc (make_sized_incremental_binary): Set the target.
6122 Error if it is incompatible.
6123 * output.h (Output_file): Add filename method.
6124
6125 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6126
6127 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6128 from the get_* methods.
6129
6130 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6131
6132 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6133 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6134 Write 0 for the data_offset of scripts.
6135
6136 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6137
6138 * testsuite/Makefile.am: Add the incremental_test.sh test.
6139 * testsuite/incremental_test.sh: New.
6140 * testsuite/incremental_test_1.c: New.
6141 * testsuite/incremental_test_2.c: New.
6142
6143 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6144
6145 * incremental-dump.cc (main): Fix typos.
6146
6147 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6148
6149 PR gold/11025
6150 * incremental-dump.cc (main): Use llu to print 64 bit values.
6151
6152 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6153 H.J. Lu <hongjiu.lu@intel.com>
6154
6155 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6156 $(LIBDL).
6157 (incremental_dump_LDADD): Likewise.
6158 * Makefile.in: Regenerated.
6159
6160 2009-11-25 Doug Kwan <dougkwan@google.com>
6161
6162 Revert:
6163
6164 2009-11-25 Doug Kwan <dougkwan@google.com>
6165
6166 * arm.cc (Target_arm::Target_arm): Move method definition
6167 outside of class definition. Add code to handle
6168 --target1-rel, --target1-abs and --target2= options.
6169 (Target_arm::get_reloc_reloc_type): Change method to be
6170 non-static and const.
6171 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6172 New data member declaration.
6173 (Target_arm::Scan::local, Target_arm::Scan::global,
6174 Target_arm::Relocate::relocate,
6175 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6176 Adjust call to Target_arm::get_real_reloc_type.
6177 (Target_arm::get_real_reloc_type): Use command line options
6178 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6179 * options.h (--target1-rel, --target1-abs, --target2): New
6180 ARM-only options.
6181
6182 2009-11-25 Doug Kwan <dougkwan@google.com>
6183
6184 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6185 class definition. Add code to handle --target1-rel, --target1-abs
6186 and --target2= options.
6187 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6188 and const.
6189 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6190 member declaration.
6191 (Target_arm::Scan::local, Target_arm::Scan::global,
6192 Target_arm::Relocate::relocate,
6193 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6194 call to Target_arm::get_real_reloc_type.
6195 (Target_arm::get_real_reloc_type): Use command line options to
6196 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6197 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6198 options.
6199
6200 2009-11-25 Doug Kwan <dougkwan@google.com>
6201
6202 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6203 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6204 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6205 formatting.
6206 (Arm_relocate_functions::thm_call): Replace body with a call to
6207 Arm_relocate_functions::thumb_branch_common.
6208 (Arm_relocate_functions::thm_jump24,
6209 Arm_relocate_functions::thm_xpc22): New method definitions.
6210 (Arm_relocate_functions::thumb_branch_common): New method definition.
6211 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6212 operator.
6213 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6214 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6215
6216 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6217
6218 * Makefile.am: Build incremental-dump
6219 * Makefile.in: Regenerate.
6220 * incremental-dump.cc: New.
6221 * incremental.cc (Incremental_inputs_header_data,
6222 Incremental_inputs_entry_data): Move to incremental.h
6223 * incremental.h: (Incremental_inputs_header_data,
6224 Incremental_inputs_entry_data): Move from incremental.cc
6225
6226 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6227
6228 * incremental.cc (Incremental_inputs_header,
6229 Incremental_inputs_header_write, Incremental_inputs_entry,
6230 Incremental_inputs_entry_write): Add a typedef with the data type.
6231
6232 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6233
6234 * incremental.cc (Incremental_inputs_header,
6235 Incremental_inputs_header_write, Incremental_inputs_entry,
6236 Incremental_inputs_entry_write): Update comment about which
6237 type has the filed descriptions.
6238
6239 2009-11-15 Doug Kwan <dougkwan@google.com>
6240
6241 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6242 (Arm_relocate_functions::arm_branch_common): Change method defintion
6243 in class definition to a method declaration and update list of formal
6244 parameters.
6245 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6246 Arm_relocation_functions::jump24): Adjust call to
6247 Arm_relocate_functions::arm_branch_common. Update list of formal
6248 parameters.
6249 (Arm_relocate_functions::xpc25): New method definition.
6250 (Arm_relocate_functions::arm_branch_common): Move method defintion
6251 out from class definition. Use stubs for mode-switching and extending
6252 branch ranges.
6253 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6254 specially. Change code to enable use of stubs in ARM branches.
6255
6256 2009-11-10 Doug Kwan <dougkwan@google.com>
6257
6258 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6259 in method declaration.
6260 (Target_arm::relocate_stub): New method declaration.
6261 (Target_arm::default_target): Change to return a pointer instead of
6262 a const reference.
6263 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6264 Target_arm::default_target.
6265 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6266 method definition.
6267 (Target_arm::relocate_section): Adjust view.
6268 (Target_arm::relocate_stub): New method definition.
6269
6270 2009-11-10 Doug Kwan <dougkwan@google.com>
6271
6272 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6273 a format warning.
6274 * incremental.cc (open_incremental_binary): Initialized local
6275 variables to avoid warnings.
6276 * object.cc (make_elf_object): Ditto.
6277 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6278 a format warning.
6279
6280 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6281
6282 PR gold/10930
6283 * testsuite/plugin_test.c: Include "config.h".
6284
6285 2009-11-09 Doug Kwan <dougkwan@google.com>
6286
6287 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6288 (arm_symbol_value): Remove.
6289 (Arm_relocate_functions::arm_branch_common,
6290 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6291 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6292 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6293 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6294 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6295 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6296 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6297 Arm_relocate_functions::thm_mobw_abs_nc,
6298 Arm_relocate_functions::thm_mov_abs,
6299 Arm_relocate_functions::movw_prel_nc,
6300 Arm_relocate_functions::thm_movt_abs,
6301 Arm_relocate_functions::movt_prel,
6302 Arm_relocate_functions::thm_movw_prel_nc,
6303 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6304 (Target_arm::Relocate::relocate): Only decompose address into two
6305 parts if relocation type uses the thumb-bit and pass the actual
6306 bit instead of a flag indicating that the thumb-bit is used. Adjust
6307 calls to methods in Arm_relocate_functions for this change.
6308
6309 2009-11-08 Ian Lance Taylor <iant@google.com>
6310
6311 PR 10925
6312 * reloc.cc: Instantiate
6313 Sized_relobj::initialize_input_to_output_maps and
6314 Sized_relobj:free_input_to_output_maps.
6315
6316 2009-11-06 Ian Lance Taylor <iant@google.com>
6317
6318 PR 10876
6319 * defstd.cc (in_segment): Set only_if_ref true for "end".
6320
6321 2009-11-06 Doug Kwan <dougkwan@google.com>
6322
6323 * arm.cc (class Reloc_stub): Correct a comment.
6324 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6325 (Target_arm::scan_section_for_stubs): New method declaration.
6326 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6327 Change methods from private to protected.
6328 (Target_arm::do_may_relax): New method definition.
6329 (Target_arm::do_relax, Target_arm::group_sections,
6330 Target_arm::scan_reloc_for_stub,
6331 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6332 (Target_arm::arm_input_section_map_): New data member declaration.
6333 (Target_arm::scan_reloc_for_stub,
6334 Target_arm::scan_reloc_section_for_stubs,
6335 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6336 Target_arm::do_relax): New method definitions.
6337
6338 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6339
6340 * configure.ac: Check for (struct stat)::st_mtim
6341 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6342 * config.in: Regenerate.
6343 * configure: Regenerate.
6344
6345 2009-11-05 Ian Lance Taylor <iant@google.com>
6346
6347 PR 10910
6348 * output.cc (Output_segment::add_output_section): Add missing
6349 return statement.
6350
6351 2009-11-04 Ian Lance Taylor <iant@google.com>
6352
6353 PR 10880
6354 * object.h (class Object): Add is_needed and set_is_needed
6355 methods. Add is_needed_ field. Make bool fields into bitfields.
6356 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6357 defined in a dynamic object and referenced by a regular object,
6358 set is_needed for the dynamic object.
6359 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6360 if the file is marked with as_needed and it is not needed.
6361
6362 2009-11-04 Ian Lance Taylor <iant@google.com>
6363
6364 PR 10887
6365 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6366 tags if data is discarded by linker script.
6367 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6368 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6369 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6370 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6371
6372 2009-11-04 Ian Lance Taylor <iant@google.com>
6373
6374 * layout.cc (Layout::get_output_section): Add is_interp and
6375 is_dynamic_linker_section parameters. Change all callers.
6376 (Layout::choose_output_section): Likewise.
6377 (Layout::make_output_section): Likewise.
6378 (Layout::add_output_section_data): Add is_dynamic_linker_section
6379 parameter. Change all callers.
6380 * layout.h (class Layout): Update declarations.
6381 * output.h (class Output_section): Add is_interp, set_is_interp,
6382 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6383 Add is_interp_, is_dynamic_linker_section_ fields. Change
6384 generate_code_fills_at_write_ to a bitfield.
6385 * output.cc (Output_section::Output_sections): Initialize new
6386 fields.
6387 (Output_segment::add_output_section): Add do_sort parameter.
6388 Change all callers.
6389
6390 2009-11-03 Ian Lance Taylor <iant@google.com>
6391
6392 PR 10860
6393 * options.h (class General_options): Add --warn-common.
6394 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6395 merging two common symbols.
6396 (Symbol_table::should_override): Handle --warn-common when merging
6397 a common symbol with a defined symbol. Use report_resolve_problem
6398 for multiple definitions.
6399 (Symbol_table::report_resolve_problem): New function.
6400 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6401
6402 2009-11-03 Doug Kwan <dougkwan@google.com>
6403
6404 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6405 stub_factory_.
6406 (Target_arm::stub_factory): New method definition.
6407 (Target_arm::new_arm_input_section,
6408 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6409 Target_arm::reloc_uses_thumb_bit): New method declarations.
6410 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6411 New type definitions.
6412 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6413 member declarations.
6414 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6415 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6416 New method definitions.
6417
6418 2009-11-03 Ian Lance Taylor <iant@google.com>
6419
6420 * options.h (class General_options): Add --warn_constructors.
6421
6422 2009-11-03 Ian Lance Taylor <iant@google.com>
6423
6424 PR 10893
6425 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6426 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6427
6428 2009-11-03 Ian Lance Taylor <iant@google.com>
6429
6430 PR 10895
6431 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6432 --msgid-bugs-address.
6433 (install-pdf): New target.
6434 (install-data_yes): Look up one directory to find mkinstalldirs.
6435
6436 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6437
6438 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6439 tree.
6440
6441 2009-10-30 Doug Kwan <dougkwan@google.com>
6442
6443 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6444
6445 2009-10-30 Doug Kwan <dougkwan@google.com>
6446
6447 * arm.cc (Stub_addend_reader): New struct template definition
6448 and partial specializations.
6449 (Stub_addend_reader::operator()): New method definition for a
6450 partially specialized template.
6451
6452 2009-10-30 Doug Kwan <dougkwan@google.com>
6453
6454 * arm.cc (Arm_relobj::processor_specific_flags): New method
6455 definition.
6456 (Arm_relobj::do_read_symbols): New method declaration.
6457 (Arm_relobj::processor_specific_flags_): New data member declaration.
6458 (Arm_dynobj): New class definition.
6459 (Target_arm::do_finalize_sections): Add input_objects parameter.
6460 (Target_arm::do_adjust_elf_header): New method declaration.
6461 (Target_arm::are_eabi_versions_compatible,
6462 (Target_arm::merge_processor_specific_flags): New method declaration.
6463 (Target_arm::do_make_elf_object): New overloaded method definitions
6464 and declaration.
6465 (Arm_relobj::do_read_symbols): New method definition.
6466 (Arm_dynobj::do_read_symbols): Ditto.
6467 (Target_arm::do_finalize_sections): Add input_objects parameters.
6468 Merge processor-specific flags from all input objects.
6469 (Target_arm::are_eabi_versions_compatible,
6470 Target_arm::merge_processor_specific_flags,
6471 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6472 New method definitions.
6473 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6474 Input_objects pointer type parameter.
6475 * layout.cc (Layout::finalize): Pass input objects to target's.
6476 finalize_sections function.
6477 * output.cc (Output_file_header::do_sized_write): Set ELF file
6478 header's processor-specific flags.
6479 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6480 Input_objects pointer type parameter.
6481 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6482 * target.h (Input_objects): New forward class declaration.
6483 (Target::processor_specific_flags,
6484 Target::are_processor_specific_flags_sect): New method definitions.
6485 (Target::finalize_sections): Add input_objects parameter.
6486 (Target::Target): Initialize processor_specific_flags_ and
6487 are_processor_specific_flags_set_.
6488 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6489 parameter.
6490 (Target::set_processor_specific_flags): New method definition.
6491 (Target::processor_specific_flags_,
6492 Target::are_processor_specific_flags_set_): New data member
6493 declarations.
6494 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6495 Input_objects pointer type parameter.
6496
6497 2009-10-30 Doug Kwan <dougkwan@google.com>
6498
6499 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6500
6501 2009-10-28 Ian Lance Taylor <iant@google.com>
6502
6503 * object.h (class Relobj): Drop options parameter from
6504 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6505 do_scan_relocs, do_relocate. Change all callers.
6506 (class Sized_relobj): Drop options parameters from
6507 do_gc_process_relocs, do_scan_relocs, do_relocate,
6508 do_relocate_sections, relocate_sections, emit_relocs_scan,
6509 emit_relocs_scan_reltype. Change all callers.
6510 (struct Relocate_info): Remove options field and all references to
6511 it.
6512 * reloc.h (class Read_relocs): Remove options constructor
6513 parameter and options_ field. Change all callers.
6514 (class Gc_process_relocs, class Scan_relocs): Likewise.
6515 (class Relocate_task): Likewise.
6516 * target-reloc.h (scan_relocs): Remove options parameter. Change
6517 all callers.
6518 (scan_relocatable_relocs): Likewise.
6519 * target.h (class Sized_target): Remove options parameter from
6520 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6521 all callers.
6522 * gc.h (gc_process_relocs): Remove options parameter. Change all
6523 callers.
6524 * arm.cc: Update functions to remove options parameters.
6525 * i386.cc: Likewise.
6526 * powerpc.cc: Likewise.
6527 * sparc.cc: Likewise.
6528 * x86_64.cc: Likewise.
6529 * testsuite/testfile.cc: Likewise.
6530
6531 2009-10-28 Doug Kwan <dougkwan@google.com>
6532
6533 * arm.cc (Arm_relobj): New class definition.
6534 (Arm_relobj::scan_sections_for_stubs,
6535 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6536 New method definitions.
6537
6538 2009-10-28 Cary Coutant <ccoutant@google.com>
6539
6540 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6541 (Plugin::cleanup_done_): New member.
6542 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6543 (Plugin_manager::cleanup_done_): Remove.
6544 (Plugin_manager::add_input_file): Edit error message.
6545 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6546 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6547
6548 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6549
6550 * fileread.cc: (File_read::View::~View): Use the new
6551 data_ownership_ filed.
6552 (File_read::~File_read): Dispose the new whole_file_view_.
6553 (File_read::open): Mmap the whole file if needed.
6554 (File_read::open): Use whole_file_view_ instead of contents_.
6555 (File_read::find_view): Use whole_file_view_ if applicable.
6556 (File_read::do_read): Use whole_file_view_ instead of contents_.
6557 (File_read::make_view): Use whole_file_view_ instead of contents_,
6558 update File_read::View::View call.
6559 (File_read::find_or_make_view): Update File_read::View::View
6560 call.
6561 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6562 remove contents_
6563 (File_read::View::Data_ownership): New enum.
6564 (File_read::View::View): Replace bool mapped_ with Data_ownership
6565 argument.
6566 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6567 (File_read::View::data_ownership_): New field.
6568 (File_read::contents_): Remove (replaced by whole_file_view_).
6569 (File_read::whole_file_view_): New field.
6570 * options.h (class General_options): Add --keep-files-mapped.
6571
6572 2009-10-27 Cary Coutant <ccoutant@google.com>
6573
6574 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6575 * testsuite/Makefile.am (plugin_test_5): New test case.
6576 * testsuite/Makefile.in: Regenerate.
6577
6578 2009-10-25 Doug Kwan <dougkwan@google.com>
6579
6580 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6581 from private to protected to allow access by child class.
6582 (Sized_relobj::do_relocate_sections): New method declaration.
6583 (Sized_relobj::relocate_sections): Virtualize.
6584 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6585 Sized_relobj::relocate_sections. Instantiate template explicitly
6586 for different target sizes and endianity.
6587
6588 2009-10-24 Doug Kwan <dougkwan@google.com>
6589
6590 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6591 (Arm_input_section::as_arm_input_section): New method.
6592 (Arm_output_section): New class definition.
6593 (Arm_output_section::create_stub_group,
6594 Arm_output_section::group_sections): New method definitions.
6595
6596 2009-10-22 Doug Kwan <dougkwan@google.com>
6597
6598 * arm.cc (Arm_input_section): New class definition.
6599 (Arm_input_section::init, Arm_input_section:do_write,
6600 Arm_input_section::set_final_data_size,
6601 Arm_input_section::do_reset_address_and_file_offset): New method
6602 definitions.
6603
6604 2009-10-21 Doug Kwan <dougkwan@google.com>
6605
6606 * arm.cc (Stub_table, Arm_input_section): New forward class
6607 declarations.
6608 (Stub_table): New class defintion.
6609 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6610 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6611 New method definition.
6612
6613 2009-10-21 Doug Kwan <dougkwan@google.com>
6614
6615 * arm.cc: Update copyright comments.
6616 (Target_arm): New forward class template declaration.
6617 (Arm_address): New type.
6618 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6619 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6620 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6621 constants.
6622 (Insn_template): Same.
6623 (DEF_STUBS): New macro.
6624 (Stub_type): New enum type.
6625 (Stub_template): New class definition.
6626 (Stub): Same.
6627 (Reloc_stub): Same.
6628 (Stub_factory): Same.
6629 (Target_arm::Target_arm): Initialize may_use_blx_ and
6630 should_force_pic_veneer_.
6631 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6632 Target_arm::should_force_pic_veneer,
6633 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6634 Target_arm::using_thumb_only, Target_arm:;default_target): New
6635 method defintions.
6636 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6637 New data member declarations.
6638 (Insn_template::size, Insn_template::alignment): New method defintions.
6639 (Stub_template::Stub_template): New method definition.
6640 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6641 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6642 (Stub_factory::Stub_factory): New method definition.
6643 * gold.h (string_hash): New template.
6644 * output.h (Input_section_specifier::hash_value): Use
6645 gold::string_hash.
6646 (Input_section_specifier::string_hash): Remove.
6647 * stringpool.cc (Stringpool_template::string_hash): Use
6648 gold::string_hash.
6649
6650 2009-10-20 Doug Kwan <dougkwan@google.com>
6651
6652 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6653 symbols of relaxed input sections.
6654 * output.h (Output_section::find_relaxed_input_section): Make
6655 method public.
6656
6657 2009-10-16 Doug Kwan <dougkwan@google.com>
6658
6659 * dynobj.cc (Versions::Versions): Initialize version_script_.
6660 Only insert base version symbol definition for a shared object
6661 if version script defines any version versions.
6662 (Versions::define_base_version): New method definition.
6663 (Versions::add_def): Check that base version is not needed.
6664 (Versions::add_need): Define base version lazily.
6665 * dynobj.h (Versions::define_base_version): New method declaration.
6666 (Versions::needs_base_version_): New data member declaration.
6667 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6668 (check_DATA): Add no_version_test.stdout.
6669 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6670 New make rules.
6671 * testsuite/Makefile.in: Regenerate.
6672 * testsuite/no_version_test.c: New file.
6673 * testsuite/no_version_test.sh: Ditto.
6674
6675 2009-10-16 Doug Kwan <dougkwan@google.com>
6676
6677 * expression.cc (class Segment_start_expression): New class definition.
6678 (Segment_start_expression::value): New method definition.
6679 (script_exp_function_segment_start): Return a new
6680 Segment_start_expression.
6681 * gold/script-c.h (script_saw_segment_start_expression): New function
6682 prototype.
6683 * script-sections.cc (Script_sections::Script_sections): Initialize
6684 SAW_SEGMENT_START_EXPRESSION_ to false.
6685 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6686 and -Tbbs options to specify section addresses if given in
6687 command line and no SEGMENT_START expression is seen in a script.
6688 * script-sections.h (Script_sections::saw_segment_start_expression,
6689 Script_sections::set_saw_segment_start_expression): New method
6690 definition.
6691 (Script_sections::saw_segment_start_expression_): New data member
6692 declaration.
6693 * script.cc (script_saw_segment_start_expression): New function.
6694 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6695 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6696 script_test_7.sh and script_test_8.sh.
6697 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6698 script_test_8.stdout.
6699 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6700 (script_test_6, script_test_6.stdout, script_test_7,
6701 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6702 * Makefile.in: Regenerate.
6703 * testsuite/script_test_6.sh: New file.
6704 * testsuite/script_test_6.t: Same.
6705 * testsuite/script_test_7.sh: Same.
6706 * testsuite/script_test_7.t: Same.
6707 * testsuite/script_test_8.sh: Same.
6708
6709 2009-10-16 Doug Kwan <dougkwan@google.com>
6710
6711 * output.cc (Output_segment::set_section_list_address): Cast
6712 expressions to unsigned long long type to avoid format warnings.
6713
6714 2009-10-15 Ian Lance Taylor <iant@google.com>
6715
6716 * script.cc (Script_options::add_symbol_assignment): Always add a
6717 dot assignment to script_sections_.
6718 * script-sections.cc (Script_sections::add_dot_assignment):
6719 Initialize if necessary.
6720
6721 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6722 program headers with no load segment if there is a linker script.
6723
6724 * layout.cc (Layout::set_segment_offsets): Align the file offset
6725 to the segment aligment for -N or -n with no load segment.
6726 * output.cc (Output_segment::add_output_section): Don't crash if
6727 the first section is a TLS section.
6728 (Output_segment::set_section_list_addresses): Print an error
6729 message if the address moves backward in a linker script.
6730 * script-sections.cc
6731 (Output_section_element_input::set_section_addresses): Don't
6732 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6733 (Orphan_output_section::set_section_addresses): Likewise.
6734
6735 2009-10-15 Doug Kwan <dougkwan@google.com>
6736
6737 * layout.cc (Layout::finish_dynamic_section): Generate tags
6738 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6739 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6740 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6741
6742 2009-10-14 Ian Lance Taylor <iant@google.com>
6743
6744 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6745 fields.
6746 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6747 data_shdr fields of relinfo.
6748 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6749 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6750 R_386_TLS_LDO_32, adjust based on section flags.
6751 (Target_i386::Relocate::fix_up_ldo): Remove.
6752
6753 2009-10-13 Ian Lance Taylor <iant@google.com>
6754
6755 Add support for -pie.
6756 * options.h (class General_options): Add -pie and
6757 --pic-executable.
6758 (General_options::output_is_position_independent): Test -pie.
6759 (General_options::output_is_executable): Return true if not shared
6760 and not relocatable.
6761 (General_options::output_is_pie): Remove.
6762 * options.cc (General_options::finalize): Reject incompatible uses
6763 of -pie.
6764 * gold.cc (queue_middle_tasks): A -pie link is not static.
6765 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6766 * symtab.cc (Symbol::final_value_is_known): Return false if
6767 output_is_position_independent.
6768 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6769 output_is_position_independent.
6770 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6771 output_is_position_independent.
6772 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6773 output_is_position_independent.
6774 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6775 two_file_pie_test.
6776 (basic_pie_test.o, basic_pie_test): New targets.
6777 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6778 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6779 (two_file_pie_test): New target.
6780 * testsuite/Makefile.in: Rebuild.
6781 * README: Remove note saying that -pie is not supported.
6782
6783 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6784
6785 * options.h (class General_options): Add -init and -fini.
6786 * layout.cc (Layout::finish_dynamic_section): Emit
6787 given init and fini functions.
6788
6789 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6790
6791 * gc.h (gc_process_relocs): Check if icf is enabled using new
6792 function.
6793 * gold.cc (queue_initial_tasks): Likewise.
6794 (queue_middle_tasks): Likewise.
6795 * object.cc (do_layout): Likewise.
6796 * symtab.cc (is_section_folded): Likewise.
6797 * main.cc (main): Likewise.
6798 * reloc.cc (Read_relocs::run): Likewise.
6799 (Sized_relobj::do_scan_relocs): Likewise.
6800 * icf.cc (is_function_ctor_or_dtor): New function.
6801 (Icf::find_identical_sections): Check if function is ctor or dtor when
6802 safe icf is chosen.
6803 * options.h (General_options::icf): Change option to be an enum.
6804 (Icf_status): New enum.
6805 (icf_enabled): New method.
6806 (icf_safe_folding): New method.
6807 (set_icf_status): New method.
6808 (icf_status_): New variable.
6809 * (options.cc) (General_options::finalize): Set icf_status_.
6810 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6811 icf_test and icf_keep_unique_test to use the --icf enum flag.
6812 * testsuite/icf_safe_test.sh: New file.
6813 * testsuite/icf_safe_test.cc: New file.
6814
6815 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6816
6817 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6818 includes to gc.h and icf.h.
6819 * arm.cc: Include gc.h.
6820 * gold.cc: Likewise.
6821 * i386.cc: Likewise.
6822 * powerpc.cc: Likewise.
6823 * sparc.cc: Likewise.
6824 * x86_64.cc: Likewise.
6825 * gc.h: Include icf.h.
6826
6827 2009-10-11 Ian Lance Taylor <iant@google.com>
6828
6829 * plugin.cc: Include "gold.h" before other header files.
6830
6831 2009-10-10 Chris Demetriou <cgd@google.com>
6832
6833 * options.h (Input_file_argument::Input_file_type): New enum.
6834 (Input_file_argument::is_lib_): Replace with...
6835 (Input_file_argument::type_): New member.
6836 (Input_file_argument::Input_file_argument): Take Input_file_type
6837 'type' rather than boolean 'is_lib' as second argument.
6838 (Input_file_argument::is_lib): Use type_.
6839 (Input_file_argument::is_searched_file): New function.
6840 (Input_file_argument::may_need_search): Handle is_searched_file.
6841 * options.cc (General_options::parse_library): Support -l:filename.
6842 (General_options::parse_just_symbols): Update for Input_file_argument
6843 changes.
6844 (Command_line::process): Likewise.
6845 * archive.cc (Archive::get_file_and_offset): Likewise.
6846 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6847 * script.cc (read_script_file, script_add_file): Likewise.
6848 * fileread.cc (Input_file::Input_file): Likewise.
6849 (Input_file::will_search_for): Handle is_searched_file.
6850 (Input_file::open): Likewise.
6851 * readsyms.cc (Read_symbols::get_name): Likewise.
6852 * testsuite/Makefile.am (searched_file_test): New test.
6853 * testsuite/Makefile.in: Regenerate.
6854 * testsuite/searched_file_test.cc: New file.
6855 * testsuite/searched_file_test_lib.cc: New file.
6856
6857 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6858 Ian Lance Taylor <iant@google.com>
6859
6860 * descriptor.cc: Include <cstdio> and "binary-io.h".
6861 (Descriptors::open): Open the files in binary mode always.
6862 * script.cc (Lex::get_token): Treat \r as whitespace.
6863
6864 2009-10-09 Ian Lance Taylor <iant@google.com>
6865
6866 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6867
6868 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6869 Ian Lance Taylor <iant@google.com>
6870
6871 * configure.ac: Check for readv function also.
6872 * fileread.cc (readv): Define if not HAVE_READV.
6873 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6874 does not exist.
6875 * config.in: Regenerate.
6876 * configure: Regenerate.
6877
6878 2009-10-09 Doug Kwan <dougkwan@google.com>
6879
6880 * layout.cc (Layout::make_output_section): Call target hook to make
6881 ordinary output section.
6882 (Layout::finalize): Adjust parameter list of call the
6883 Target::may_relax().
6884 * layout.h (class Layout::section_list): New method.
6885 * merge.h (Output_merge_base::entsize): Change visibility to public.
6886 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6887 New methods.
6888 (Output_merge_string::do_is_string): New method.
6889 * object.cc (Sized_relobj::do_setup): renamed from
6890 Sized_relobj::set_up.
6891 * object.h (Sized_relobj::adjust_shndx,
6892 Sized_relobj::initializ_input_to_output_maps,
6893 Sized_relobj::free_input_to_output_maps): Change visibilities to
6894 protected.
6895 (Sized_relobj::setup): Virtualize.
6896 (Sized_relobj::do_setup): New method declaration.
6897 (Sized_relobj::invalidate_section_offset,
6898 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6899 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6900 * options.cc (parse_int): New function.
6901 * options.h (parse_int): New declaration.
6902 (DEFINE_int): New macro.
6903 (stub_group_size): New option.
6904 * output.cc (Output_section::Output_section): Initialize memebers
6905 merge_section_map_, merge_section_by_properties_map_,
6906 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6907 (Output_section::add_input_section): Handled deferred code-fill
6908 generation and remove an old comment.
6909 (Output_section::add_relaxed_input_section): New method definition.
6910 (Output_section::add_merge_input_section): Use merge section by
6911 properties map to speed to search. Update merge section maps
6912 as appropriate.
6913 (Output_section::build_relaxation_map): New method definition.
6914 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6915 Same.
6916 (Output_section::relax_input_section): Renamed to
6917 Output_section::convert_input_sections_to_relaxed_sections and change
6918 interface to take a vector of pointers to relaxed sections.
6919 (Output_section::find_merge_section,
6920 Output_section::find_relaxed_input_section): New method definitions.
6921 (Output_section::is_input_address_mapped,
6922 Output_section::output_offset, Output_section::output_address):
6923 Use output section data maps to speed up searching.
6924 (Output_section::find_starting_output_address): Add comments.
6925 (Output_section::do_write,
6926 Output_section::write_to_postprocessing_buffer): Do code-fill
6927 generation as appropriate.
6928 (Output_section::get_input_sections): Invalidate relaxed input section
6929 map.
6930 (Output_section::restore_states): Adjust type of checkpoint .
6931 Invalidate relaxed input section map.
6932 * output.h (Output_merge_base): New class declaration.
6933 (Input_section_specifier): New class defintion.
6934 (class Output_relaxed_input_section) Change base class to
6935 Output_section_data_build.
6936 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6937 base class initializer.
6938 (Output_section::add_relaxed_input_section): New method declaration.
6939 (Output_section::Input_section): Change visibility to protected.
6940 (Output_section::Input_section::relobj,
6941 Output_section::Input_section::shndx): Handle relaxed input sections.
6942 Output_section::input_sections) Change visibility to protected. Also
6943 define overload to return a non-const pointer.
6944 (Output_section::Merge_section_properties): New class defintion.
6945 (Output_section::Merge_section_by_properties_map,
6946 Output_section::Output_section_data_by_input_section_map,
6947 Output_section::Relaxation_map): New types.
6948 (Output_section::relax_input_section): Rename method to
6949 Output_section::convert_input_sections_to_relaxed_sections and change
6950 interface to take a vector of relaxed section pointers.
6951 (Output_section::find_merge_section,
6952 Output_section::find_relaxed_input_section,
6953 Output_section::build_relaxation_map,
6954 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6955 New method declarations.
6956 (Output_section::merge_section_map_
6957 Output_section::merge_section_by_properties_map_,
6958 Output_section::relaxed_input_section_map_,
6959 Output_section::is_relaxed_input_section_map_valid_,
6960 Output_section::generate_code_fills_at_write_): New data members.
6961 * script-sections.cc
6962 (Output_section_element_input::set_section_addresses): Call
6963 current_data_size and addralign methods of relaxed input sections.
6964 (Orphan_output_section::set_section_addresses): Call current_data_size
6965 and addralign methods of relaxed input sections.
6966 * symtab.cc (Symbol_table::compute_final_value): Extract template
6967 from the body of Symbol_table::sized_finalize_symbol.
6968 (Symbol_table::sized_finalized_symbol): Call
6969 Symbol_table::compute_final_value.
6970 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6971 (Symbol_table::compute_final_value): New templated method declaration.
6972 * target.cc (Target::do_make_output_section): New method defintion.
6973 * target.h (Target::make_output_section): New method declaration.
6974 (Target::relax): Add more parameters for input objects, symbol table
6975 and layout. Adjust call to do_relax.
6976 (Target::do_make_output_section): New method declaration.
6977 (Target::do_relax): Add parameters for input objects, symbol table
6978 and layout.
6979
6980 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6981
6982 * pread.c: Include stdio.h.
6983
6984 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6985
6986 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6987 defined.
6988
6989 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6990
6991 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6992 Change read_shndx type to unsigned int.
6993 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6994 int.
6995 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6996 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6997 Change read_shndx type to unsigned int.
6998 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6999 int.
7000 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7001 * layout.cc (Layout::create_symtab_sections): Cast the result of
7002 local_symcount * symsize to off_t in the gold_assert.
7003
7004 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7005
7006 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7007 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7008 R_ARM_BASE_ABS.
7009 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7010 (Arm_relocate_functions::thm_abs5): New function.
7011 (Arm_relocate_functions::abs12): New function.
7012 (Arm_relocate_functions::abs16): New function.
7013 (Arm_relocate_functions::base_abs): New function.
7014 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7015 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7016 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7017 R_ARM_BASE_ABS.
7018 (Scan::global): Likewise.
7019 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7020 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7021 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7022 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7023 R_ARM_BASE_ABS.
7024
7025 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7026
7027 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7028 (Arm_relocate_functions::movt_prel): New function.
7029 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7030 (Arm_relocate_functions::thm_movt_prel): New function.
7031 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7032 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7033 (Scan::global, Relocate::relocate): Likewise.
7034 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7035
7036 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7037
7038 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7039 Incremental_checker.
7040 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7041 unsigned int.
7042 (class Incremental_inputs_header): New class.
7043 (Incremental_inputs_header_writer): Edit comment.
7044 (Incremental_inputs_entry): New class.
7045 (Incremental_inputs_entry_writer): Edit comment.
7046 (Sized_incremental_binary::do_find_incremental_inputs_section):
7047 Add *strtab_shndx parameter, fill it.
7048 (Sized_incremental_binary::do_check_inputs): New method.
7049 (Incremental_checker::can_incrementally_link_output_file): Use
7050 Sized_incremental_binary::check_inputs.
7051 (Incremental_inputs::report_command_line): Save command line in
7052 command_line_.
7053 * incremental.h:
7054 (Incremental_binary::find_incremental_inputs_section): New
7055 method.
7056 (Incremental_binary::do_find_incremental_inputs_section): Add
7057 strtab_shndx parameter.
7058 (Incremental_binary::do_check_inputs): New pure virtual method.
7059 (Sized_incremental_binary::do_check_inputs): Declare.
7060 (Incremental_checker::Incremental_checker): Add incremental_inputs
7061 parameter, use it to initialize incremental_inputs_.
7062 (Incremental_checker::incremental_inputs_): New field.
7063 (Incremental_checker::command_line): New method.
7064 (Incremental_checker::inputs): New method.
7065 (Incremental_checker::command_line_): New field.
7066
7067 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7068
7069 * incremental.cc: Include <cstdarg> and "target-select.h".
7070 (vexplain_no_incremental): New function.
7071 (explain_no_incremental): New function.
7072 (Incremental_binary::error): New method.
7073 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7074 method.
7075 (make_sized_incremental_binary): New function.
7076 (open_incremental_binary): New function.
7077 (can_incrementally_link_file): Add checks if output is ELF and has
7078 inputs section.
7079 * incremental.h: Include "elfcpp_file.h" and "output.h".
7080 (Incremental_binary): New class.
7081 (Sized_incremental_binary): New class.
7082 (open_incremental_binary): Declare.
7083 * object.cc (is_elf_object): Use
7084 elfcpp::Elf_recognizer::is_elf_file.
7085 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7086 * output.h (Output_file::filesize): New method.
7087
7088 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7089
7090 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7091 New function.
7092 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7093 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7094 function.
7095 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7096 function.
7097 (Arm_relocate_functions::movw_abs_nc): New function.
7098 (Arm_relocate_functions::movt_abs): New function.
7099 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7100 (Arm_relocate_functions::thm_movt_abs): New function.
7101 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7102 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7103 (Scan::global): Likewise.
7104 (Relocate::relocate): Likewise.
7105 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7106
7107 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7108
7109 * arm.cc (Arm_relocate_functions::got_prel) New function.
7110 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7111 (Relocate::relocate): Likewise.
7112 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7113
7114 2009-10-06 Ian Lance Taylor <iant@google.com>
7115
7116 * options.h (class General_options): Define
7117 split_stack_adjust_size parameter.
7118 * object.h (class Object): Add uses_split_stack_ and
7119 has_no_split_stack_ fields. Add uses_split_stack and
7120 has_no_split_stack accessor functions. Declare
7121 handle_split_stack_section.
7122 (class Reloc_symbol_changes): Define.
7123 (class Sized_relobj): Define Function_offsets. Declare
7124 split_stack_adjust, split_stack_adjust_reltype, and
7125 find_functions.
7126 * object.cc (Object::handle_split_stack_section): New function.
7127 (Sized_relobj::do_layout): Call handle_split_stack_section.
7128 * dynobj.cc (Sized_dynobj::do_layout): Call
7129 handle_split_stack_section.
7130 * reloc.cc (Sized_relobj::relocate_sections): Call
7131 split_stack_adjust for executable sections in split_stack
7132 objects. Pass reloc_map to relocate_section.
7133 (Sized_relobj::split_stack_adjust): New function.
7134 (Sized_relobj::split_stack_adjust_reltype): New function.
7135 (Sized_relobj::find_functions): New function.
7136 * target-reloc.h: Include "object.h".
7137 (relocate_section): Add reloc_symbol_changes parameter. Change
7138 all callers.
7139 * target.h (class Target): Add calls_non_split method. Declare
7140 do_calls_non_split virtual method. Declare match_view and
7141 set_view_to_nop.
7142 * target.cc: Include "elfcpp.h".
7143 (Target::do_calls_non_split): New function.
7144 (Target::match_view): New function.
7145 (Target::set_view_to_nop): New function.
7146 * gold.cc (queue_middle_tasks): Give an error if mixing
7147 split-stack and non-split-stack objects with -r.
7148 * i386.cc (Target_i386::relocate_section): Add
7149 reloc_symbol_changes parameter.
7150 (Target_i386::do_calls_non_split): New function.
7151 * x86_64.cc (Target_x86_64::relocate_section): Add
7152 reloc_symbol_changes parameter.
7153 (Target_x86_64::do_calls_non_split): New function.
7154 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7155 parameter.
7156 * powerpc.cc (Target_powerpc::relocate_section): Add
7157 reloc_symbol_changes parameter.
7158 * sparc.cc (Target_sparc::relocate_section): Add
7159 reloc_symbol_changes parameter.
7160 * configure.ac: Call AM_CONDITIONAL for the default target.
7161 * configure: Rebuild.
7162 * testsuite/Makefile.am (TEST_AS): New variable.
7163 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7164 (check_DATA): Add split_i386 and split_x86_64 files.
7165 (SPLIT_DEFSYMS): Define.
7166 (split_i386_[1234n].o): New targets.
7167 (split_i386_[124]): New targets.
7168 (split_i386_[1234r].stdout): New targets.
7169 (split_x86_64_[1234n].o): New targets.
7170 (split_x86_64_[124]): New targets.
7171 (split_x86_64_[1234r].stdout): New targets.
7172 (MOSTLYCLEANFILES): Add new executables.
7173 * testsuite/split_i386.sh: New file.
7174 * testsuite/split_x86_64.sh: New file.
7175 * testsuite/split_i386_1.s: New file.
7176 * testsuite/split_i386_2.s: New file.
7177 * testsuite/split_i386_3.s: New file.
7178 * testsuite/split_i386_4.s: New file.
7179 * testsuite/split_i386_n.s: New file.
7180 * testsuite/split_x86_64_1.s: New file.
7181 * testsuite/split_x86_64_2.s: New file.
7182 * testsuite/split_x86_64_3.s: New file.
7183 * testsuite/split_x86_64_4.s: New file.
7184 * testsuite/split_x86_64_n.s: New file.
7185 * testsuite/testfile.cc (Target_test): Update relocation_section
7186 function.
7187 * testsuite/Makefile.in: Rebuild.
7188
7189 2009-10-06 Ian Lance Taylor <iant@google.com>
7190
7191 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7192 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7193 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7194 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7195 the address on ldo_addrs_.
7196 (Target_i386::Relocate::fix_up_ldo): New function.
7197
7198 2009-10-06 Rafael Espindola <espindola@google.com>
7199
7200 * plugin.cc (add_input_library): New.
7201 (Plugin::load): Add add_input_library to tv.
7202 (Plugin_manager::add_input_file): Add the is_lib argument.
7203 (add_input_file): Update call to Plugin_manager::add_input_file.
7204 (add_input_library): New.
7205 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7206
7207 2009-09-30 Doug Kwan <dougkwan@google.com>
7208
7209 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7210 symbol and call Symbol::may_need_copy_reloc to determine if
7211 a copy reloc is needed.
7212 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7213 nocopyreloc is given in command line.
7214 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7215 given in command line.
7216 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7217 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7218 of the removed Target_i386::may_need_copy_reloc.
7219 * options.h (copyreloc): New option with default value false.
7220 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7221 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7222 instead of the removed Target_powerpc::may_need_copy_reloc.
7223 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7224 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7225 instead of the removed Target_sparc::may_need_copy_reloc.
7226 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7227 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7228 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7229 instead of the removed Target_x86_64::may_need_copy_reloc.
7230
7231 2009-09-30 Ian Lance Taylor <iant@google.com>
7232
7233 * object.h (class Object): Remove target_ field, and target,
7234 sized_target, and set_target methods.
7235 (Object::sized_target): Remove.
7236 (class Sized_relobj): Update declarations. Remove sized_target.
7237 * object.cc (Sized_relobj::setup): Remove target parameter.
7238 Change all callers.
7239 (Input_objects::add_object): Don't do anything with the target.
7240 (make_elf_sized_object): Add punconfigured parameter. Change all
7241 callers. Set or test parameter target.
7242 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7243 Change all callers.
7244 * parameters.cc (Parameters::set_target): Change parameter type to
7245 be non-const.
7246 (Parameters::default_target): Remove.
7247 (set_parameters_target): Change parameter type to be non-const.
7248 (parameters_force_valid_target): New function.
7249 (parameters_clear_target): New function.
7250 * parameters.h (class Parameters): Update declarations. Remove
7251 default_target method. Add sized_target and clear_target
7252 methods. Change target_ to be non-const.
7253 (set_parameters_target): Update declaration.
7254 (parameters_force_valid_target): Declare.
7255 (parameters_clear_target): Declare.
7256 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7257 as NULL if we aren't searching.
7258 (Add_symbols::run): Don't check for compatible target.
7259 * fileread.cc (Input_file::open_binary): Call
7260 parameters_force_valid_target.
7261 * gold.cc (queue_middle_tasks): Likewise.
7262 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7263 set_target on object.
7264 * dynobj.h (class Sized_dynobj): Update declarations.
7265 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7266 make_elf_object returns NULL.
7267 (Archive::include_member): Don't check whether object target is
7268 compatible.
7269 * output.cc (Output_section::add_input_section): Get target from
7270 parameters.
7271 (Output_section::relax_input_section): Likewise.
7272 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7273 parameters.
7274 (Sized_relobj::do_scan_relocs): Likewise.
7275 (Sized_relobj::relocate_sections): Likewise.
7276 * resolve.cc (Symbol_table::resolve): Likewise.
7277 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7278 parameter. Change all callers.
7279 (Symbol_table::add_from_object): Get target from parameters.
7280 (Symbol_table::add_from_relobj): Don't check object target.
7281 (Symbol_table::add_from_dynobj): Likewise.
7282 (Symbol_table::define_special_symbol): Get target from
7283 parameters.
7284 * symtab.h (class Symbol_table): Update declaration.
7285 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7286 parameter. Change all callers. Clear parameter target.
7287 (Binary_test): Test target here.
7288 * testsuite/object_unittest.cc (gold_testsuite): Remove
7289 target_test_pointer parameter. Change all callers.
7290 (Object_test): Test target here.
7291
7292 2009-09-26 Ian Lance Taylor <iant@google.com>
7293
7294 * testsuite/initpri1.c: Don't try to use constructor priorities if
7295 compiling with gcc before 4.3.
7296
7297 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7298
7299 * testsuite/retain_symbols_file_test.sh (check_present): Change
7300 output file name to retain_symbols_file_test.stdout.
7301 (check_absent): Likewise.
7302
7303 2009-09-18 Craig Silverstein <csilvers@google.com>
7304
7305 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7306 * options.cc: Include <cerrno> and <fstream>.
7307 (General_options::finalize): Parse -retain-symbols-file tag.
7308 * options.h: New flag.
7309 (General_options): New method should_retain_symbol, new
7310 variable symbols_to_retain.
7311 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7312 should_retain_symbol map.
7313 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7314 * testsuite/Makefile.in: Regenerate.
7315 * testsuite/retain_symbols_file_test.sh: New file.
7316
7317 2009-09-18 Nick Clifton <nickc@redhat.com>
7318
7319 * po/es.po: Updated Spanish translation.
7320
7321 2009-09-17 Doug Kwan <dougkwan@google.com>
7322
7323 * debug.h (DEBUG_RELAXATION): New constant.
7324 (DEBUG_ALL): Add DEBUG_RELAXATION.
7325 (debug_string_to_enum): Add relaxation debug option.
7326 * layout.cc
7327 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7328 Layout::Relaxation_debug_check::read_sections,
7329 Layout::Relaxation_debug_check::read_sections): New method definitions.
7330 (Layout::Layout): Initialize data members
7331 record_output_section_data_from_scrips_,
7332 script_output_section_data_list_ and relaxation_debug_check_.
7333 (Layout::save_segments, Layout::restore_segments,
7334 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7335 Layout::relaxation_loop_body): New method definitions.
7336 (Layout::finalize): Support relaxation. Move section layout code to
7337 Layout::relaxation_loop_body.
7338 (Layout::set_asection_address_from_script): Move code for orphan
7339 section placement out.
7340 (Layout::place_orphan_sections_in_script): New method definition.
7341 * layout.h (Output_segment_headers, Output_file_header):
7342 New forward class declarations.
7343 (Layout::~Layout): Define.
7344 (Layout::new_output_section_data_from_script): New method definition.
7345 (Layout::place_orphan_sections_in_script): New method declaration.
7346 (Layout::Segment_states): New type declaration.
7347 (Layout::save_segments, Layout::restore_segments,
7348 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7349 Layout::relaxation_loop_body): New method declarations.
7350 (Layout::Output_section_data_list): New type declaration.
7351 (Layout::Relaxation_debug_check): New class definition.
7352 (Layout::record_output_section_data_from_script_,
7353 Layout::script_output_section_data_list_, Layout::segment_states_,
7354 Layout::relaxation_debug_check_): New data members.
7355 * output.cc: (Output_section_headers::do_size): New method definition.
7356 (Output_section_headers::Output_section_headers): Move size
7357 computation to Output_section_headers::do_size.
7358 (Output_segment_headers::do_size): New method definition.
7359 (Output_file_header::Output_file_header): Move size computation to
7360 Output_file_header::do_size and call it.
7361 (Output_file_header::do_size): New method definition.
7362 (Output_data_group::Output_data_group): Adjust call to
7363 Output_section_data.
7364 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7365 (Output_symtab_xindex::do_write): Add array bound check.
7366 (Output_section::Input_section::print_to_mapfile): Handle
7367 RELAXED_INPUT_SECTION_CODE.
7368 (Output_section::Output_section): Initialize data member checkpoint_.
7369 (Output_section::~Output_section): Delete checkpoint object pointed
7370 by checkpoint_.
7371 (Output_section::add_input_section): Always add an Input_section if
7372 relaxing.
7373 (Output_section::add_merge_input_section): Add assert.
7374 (Output_section::relax_input_section): New method definition.
7375 (Output_section::set_final_data_size): Set load address to zero for
7376 an unallocated section.
7377 (Output_section::do_address_and_file_offset_have_reset_values):
7378 New method definition.
7379 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7380 Handle relaxed input section.
7381 (Output_section::sort_attached_input_sections): Checkpoint input
7382 section list lazily.
7383 (Output_section::get_input_sections): Change type of input_sections to
7384 list of Simple_input_section pointers. Checkpoint input section list
7385 lazily. Also handle relaxed input sections.
7386 (Output_section::add_input_section_for_script): Take a reference to
7387 a Simple_input_section object instead of Relobj pointer and section
7388 index as parameter. Handle relaxed input sections.
7389 (Output_section::save_states, Output_section::restore_states): New
7390 method definitions.
7391 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7392 (Output_data::is_data_size_fixed): New method definition.
7393 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7394 if it is fixed.
7395 (Output_data::address_and_file_offset_have_reset_values): New method
7396 definition.
7397 (Output_data::do_address_and_file_offset_have_reset_values): New method
7398 definition.
7399 (Output_data::set_data_size): Check that data size is not fixed.
7400 (Output_data::fix_data_size): New method definition.
7401 (Output_data::is_data_size_fixed_): New data member.
7402 (Output_section_headers::set_final_data_size): New method definition.
7403 (Output_section_headers::do_size): New method declaration.
7404 (Output_segment_headers::set_final_data_size): New method definition.
7405 (Output_segment_headers::do_size): New method declaration.
7406 (Output_file_header::set_final_data_size)::New method definition.
7407 (Output_file_header::do_size)::New method declaration.
7408 (Output_section_data::Output_section_data): Add new parameter
7409 is_data_size_fixed and use it to fix data size.
7410 (Output_data_const::Output_data_const): Adjust call to base class
7411 constructor and fix data size.
7412 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7413 base class constructor and fix data size.
7414 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7415 base class constructor and fix data size.
7416 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7417 class constructor and fix data size.
7418 (Output_data_group::set_final_data_size): New method definition.
7419 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7420 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7421 class constructor and fix data size.
7422 (Output_relaxed_input_section): New class definition.
7423 (Output_section::Simple_input_section): New class definition.
7424 (Output_section::get_input_sections): Adjust parameter list.
7425 (Output_section::add_input_section_for_script): Same.
7426 (Output_section::save_states, Output_section::restore_states,
7427 Output_section::do_address_and_file_offset_have_reset_values,
7428 (Output_section::Input_section::Input_section): Handle
7429 RELAXED_INPUT_SECTION_CODE. Add new overload for
7430 Output_relaxed_input_section.
7431 (Output_section::Input_section::is_input_section,
7432 Output_section::Input_section::set_output_section): Handle relaxed
7433 input section.
7434 (Output_section::Input_section::is_relaxed_input_section,
7435 Output_section::Input_section::output_section_data,
7436 Output_section::Input_section::relaxed_input_section): New method
7437 definitions.
7438 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7439 value.
7440 (Output_section::Input_section::u1_): Update comments.
7441 (Output_section::Input_section::u2_): Add new union member poris.
7442 (Output_section::Checkpoint_output_section): New classs definition.
7443 (Output_section::relax_input_section): New method declaration.
7444 (Output_section::checkpoint_): New data member.
7445 (Output_segment): Update comments.
7446 (Output_segment::Output_segment): Un-privatize copy constructor.
7447 (Output_segment::operator=): Un-privatize.
7448 * script-sections.cc (Output_section_element::Input_section_list):
7449 Change element type to Output_section::Simple_input_section.
7450 (Output_section_element_dot_assignment::set_section_addresses):
7451 Register output section data for relaxation clean up.
7452 (Output_data_exression::Output_data_expression): Adjust call to base
7453 constructor to fix data size.
7454 (Output_section_element_data::set_section_addresses): Register
7455 Output_data_expression object for relaxation clean up.
7456 (struct Input_section_info): Replace Relobj pointer and section index
7457 pair with Output_section::Simple_input_section and Convert struct to a
7458 class.
7459 (Input_section_sorter::operator()): Adjust access to
7460 Input_section_info data member to use accessors.
7461 (Output_section_element_input::set_section_addresses): Use layout
7462 parameter. Adjust code to use Output_section::Simple_input_section
7463 and Input_secction_info classes. Register filler for relaxation
7464 clean up.
7465 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7466 and section index pair with Output_section::Simple_input_section
7467 class. Adjust code accordingly.
7468 (Phdrs_element::release_segment): New method definition.
7469 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7470 segment list.
7471 (Script_sections::release_segments): New method definition.
7472 * gold/script-sections.h (Script_sections::release_segments): New
7473 method declaration.
7474 * gold/target.h (Target::may_relax, Target::relax,
7475 Target::do_may_relax, Target::do_relax): New method definitions.
7476
7477 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7478
7479 * arm.cc (has_signed_unsigned_overflow): New function.
7480 (Arm_relocate_functions::abs8): New function.
7481 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7482 (Target_arm::Scan::global): Likewise.
7483 (Target_arm::relocate::relocate): Likewise.
7484 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7485 Likewise.
7486
7487 2009-09-16 Cary Coutant <ccoutant@google.com>
7488
7489 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7490 * testsuite/Makefile.in: Regenerate.
7491
7492 2009-09-11 Nick Clifton <nickc@redhat.com>
7493
7494 * po/gold.pot: Updated by the Translation project.
7495
7496 2009-09-08 Cary Coutant <ccoutant@google.com>
7497
7498 * output.cc (Output_file::open): Add execute permission to empty file.
7499 * testsuite/Makefile.am (permission_test): New test.
7500 * testsuite/Makefile.in: Regenerate.
7501
7502 2009-09-02 Ian Lance Taylor <iant@google.com>
7503
7504 * output.cc (Output_file::resize): Call map_no_anonymous rather
7505 than map.
7506
7507 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7508
7509 * gold.cc: Include "incremental.h".
7510 (queue_initial_tasks): Call Incremental_checker methods.
7511 * incremental.cc: Include "output.h".
7512 (Incremental_checker::can_incrementally_link_output_file): New
7513 method.
7514 * incremental.h (Incremental_checker): New class.
7515
7516 * output.cc (Output_file::open_for_modification): New method.
7517 (Output_file::map_anonymous): Changed return type to bool. Record
7518 map in base_ field.
7519 (Output_file::map_no_anonymous): New method, broken out of map.
7520 (Output_file::map): Use map_no_anonymous and map_anonymous.
7521 * output.h (class Output_file): Update declarations.
7522
7523 2009-08-24 Cary Coutant <ccoutant@google.com>
7524
7525 * options.h (Command_line::Pre_options): New class.
7526 (Command_line::pre_options): New member.
7527 * options.cc (gold::options::ready_to_register): New variable.
7528 (One_option::register_option): Do nothing if not registering options.
7529 Assert if same short option registered twice.
7530 (General_options::General_options): Turn off option registration when
7531 done constructing.
7532 (Command_line::Pre_options::Pre_options): New constructor.
7533
7534 2009-08-24 Cary Coutant <ccoutant@google.com>
7535
7536 * options.h (General_options::no_keep_memory): Remove incorrect
7537 short option.
7538
7539 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7540
7541 * Makefile.am (am__skiplex, am__skipyacc): New.
7542 * Makefile.in: Regenerate.
7543
7544 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7545
7546 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7547 (INCLUDES): ... this.
7548 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7549 (AM_CPPFLAGS): Renamed from ...
7550 (INCLUDE): ... this.
7551 * Makefile.in, testsuite/Makefile.in: Regenerate.
7552
7553 * Makefile.in: Regenerate.
7554 * aclocal.m4: Likewise.
7555 * config.in: Likewise.
7556 * configure: Likewise.
7557 * testsuite/Makefile.in: Likewise.
7558
7559 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7560 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7561 * Makefile.in: Regenerate.
7562 * testsuite/Makefile.in: Regenerate.
7563
7564 2009-08-19 Cary Coutant <ccoutant@google.com>
7565
7566 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7567 symbols in shared libraries overridden by hidden or internal symbols
7568 in the main program.
7569
7570 2009-08-19 Chris Demetriou <cgd@google.com>
7571
7572 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7573 checking source file names in error messages.
7574
7575 2009-08-18 Doug Kwan <dougkwan@google.com>
7576
7577 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7578 an elcpp::Ehdr as parameter. Adjust call to set_target.
7579 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7580 an elfcpp::Ehdr as parameter.
7581 * object.cc (Object::set_target): Remove the version that looks up
7582 a target and sets it.
7583 (Sized_relobj::setup): Take a Target object instead of
7584 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7585 (make_elf_sized_object): Find target and ask target to
7586 make an ELF object.
7587 * object.h: (Object::set_target): Remove the version that looks up
7588 a target and sets it.
7589 (Sized_relobj::setup): Take a Target object instead of
7590 an elfcpp:Ehdr as parameter.
7591 * target.cc: Include dynobj.h.
7592 (Target::do_make_elf_object_implementation): New.
7593 (Target::do_make_elf_object): New.
7594 * target.h (Target::make_elf_object): New template declaration.
7595 (Target::do_make_elf_object): New method declarations.
7596 (Target::do_make_elf_object_implementation): New template declaration.
7597
7598 2009-08-14 Ian Lance Taylor <iant@google.com>
7599
7600 * gold.h (FUNCTION_NAME): Define.
7601 (gold_unreachable): Use FUNCTION_NAME.
7602
7603 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7604
7605 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7606 symbol in the --keep-unique list is not found.
7607
7608 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7609
7610 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7611 been maked as --keep-unique.
7612 (Icf::unfold_section): New function.
7613 * icf.h (Icf::unfold_section): New function.
7614 * options.h (General_options::keep_unique): New option.
7615 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7616 * testsuite/Makefile.in: Regenerate.
7617 * testsuite/icf_keep_unique_test.sh: New file.
7618 * testsuite/icf_keep_unique_test.cc: New file.
7619
7620 2009-08-12 Cary Coutant <ccoutant@google.com>
7621
7622 PR 10471
7623 * resolve.cc (Symbol_table::resolve): Check for references from
7624 dynamic objects to hidden and internal symbols.
7625 * testsuite/Makefile.am (hidden_test.sh): New test.
7626 * testsuite/Makefile.in: Regenerate.
7627 * testsuite/hidden_test.sh: New script.
7628 * testsuite/hidden_test_1.c: New test source.
7629 * testsuite/hidden_test_main.c: New test source.
7630
7631 2009-08-11 Doug Kwan <dougkwan@google.com>
7632
7633 * arm.cc: Update comments.
7634 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7635 segment to locate the .ARM.exidx section if present.
7636
7637 2009-08-09 Doug Kwan <dougkwan@google.com>
7638
7639 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7640 patch.
7641
7642 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7643 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7644 compiler warnings.
7645
7646 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7647
7648 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7649 valid tls_segment only for non-debug-section relocations.
7650 * testsuite/Makefile.am: Add gc_tls_test.
7651 * testsuite/Makefile.in: Regenerate.
7652 * testsuite/gc_tls_test.cc: New file.
7653 * testsuite/gc_tls_test.sh: New file.
7654
7655 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7656
7657 * icf.cc: New file.
7658 * icf.h: New file.
7659 * Makefile.am (CCFILES): Add icf.cc.
7660 (HFILES): Add icf.h
7661 * Makefile.in: Regenerate.
7662 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7663 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7664 section, symbol and addend information for the relocs.
7665 * gold.cc (queue_middle_tasks): Call identical code folding.
7666 * gold.h: Add defines for multimap.
7667 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7668 to the call of finalize_local_symbols.
7669 * main.cc (main): Create object of class Icf.
7670 * object.cc (Sized_relobj::do_layout): Allow this function to be
7671 called twice during icf.
7672 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7673 to sections marked as identical by icf.
7674 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7675 when available.
7676 (Sized_relobj::do_section_entsize): New function.
7677 * object.h (Object::section_entsize): New function.
7678 (Object::do_section_entsize): New pure virtual function.
7679 (Relobj::finalize_local_symbols): Add new parameter.
7680 (Relobj::do_section_entsize): New function.
7681 * options.h (General_options::icf): New option.
7682 (General_options::icf_iterations): New option.
7683 (General_options::print_icf_sections): New option.
7684 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7685 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7686 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7687 icf.
7688 * symtab.cc (Symbol_table::is_section_folded): New function.
7689 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7690 to sections marked as identical by icf.
7691 * symtab.h (Symbol_table::set_icf): New function.
7692 (Symbol_table::icf): New function.
7693 (Symbol_table::is_section_folded): New function.
7694 (Symbol_table::icf_): New data member.
7695 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7696 * testsuite/Makefile.am: Add commands to build icf_test.
7697 * testsuite/Makefile.in: Regenerate.
7698 * testsuite/icf_test.sh: New file.
7699 * testsuite/icf_test.cc: New file.
7700
7701 2009-07-24 Chris Demetriou <cgd@google.com>
7702
7703 * layout.cc (is_compressible_debug_section): Fix incorrect
7704 comment about compressed section names.
7705
7706 2009-07-20 Ian Lance Taylor <ian@airs.com>
7707
7708 PR 10419
7709 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7710
7711 2009-07-16 Ian Lance Taylor <iant@google.com>
7712
7713 PR 10400
7714 * layout.h: #include <map>.
7715 (class Kept_section): Change from struct to class. Add accessors
7716 and setters. Add section size to Comdat_group mapping. Change
7717 Comdat_group to std::map. Add is_comdat_ field. Add
7718 linkonce_size field in union.
7719 (class Layout): Update declaration of find_or_add_kept_section.
7720 Don't declare find_kept_object.
7721 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7722 parameter. Add object, shndx, is_comdat, and is_group_name
7723 parameters. Change all callers. Adjust for new Kept_section.
7724 (Layout::find_kept_object): Remove.
7725 * object.cc (Sized_relobj::include_section_group): Update use of
7726 Kept_section. Rename secnum to shndx. Only record
7727 Kept_comdat_section if sections are the same size.
7728 (Sized_relobj::include_linkonce_section): Update use of
7729 Kept_section. Only record Kept_comdat_section if sections are the
7730 same size. Set size of linkonce section.
7731 (Sized_relobj::map_to_kept_section): Update call to
7732 get_kept_comdat_section.
7733 * object.h (class Sized_relobj): Rename fields in
7734 Kept_comdat_section to drop trailing underscores; change object
7735 field to Relobj*. Change Kept_comdat_section_table to store
7736 struct rather than pointer.
7737 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7738 Add kept_object and kept_shndx parameters. Change all callers.
7739 (Sized_relobj::get_kept_comdat_section): Change return type to
7740 bool. Add kept_object and kept_shndx parameters. Change all
7741 callers.
7742 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7743 Layout::find_or_add_kept_section.
7744
7745 2009-07-09 Ian Lance Taylor <iant@google.com>
7746
7747 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7748 Reserve space in the hash table.
7749
7750 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7751
7752 * fileread.cc (File_read::get_mtime): New method.
7753 * fileread.h (Timespec): New structure.
7754 (File_read::get_mtime): New method.
7755 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7756 Renamed from timestamp_nsec.
7757 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7758 Elf_Xword.
7759 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7760 timestamp_nsec.
7761 (Incremental_inputs::report_archive): Save mtime; style fix.
7762 (Incremental_inputs::report_obejct): Save mtime; style fix.
7763 (Incremental_inputs::report_script): Save mtime; style fix.
7764 (Incremental_inputs::finalize_inputs): Style fix.
7765 (Incremental_inputs::finalize): Style fix.
7766 (Incremental_inputs::create_input_section_data): Store inputs
7767 mtime.
7768 * incremental.h (Incremental_inputs::report_script): Add mtime
7769 argument.
7770 (Incremental_inputs::Input_info::Input_info): Intialize only one
7771 union member.
7772 (Incremental_inputs::Input_info::archive): Move to nameless
7773 union.
7774 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7775 (Incremental_inputs::Input_info::script): Move to nameless union.
7776 (Incremental_inputs::mtime): New field.
7777 * script.cc (read_input_script): Pass file mtime to
7778 Incremental_input.
7779 * script.h (Script_info::inputs): Style fix.
7780
7781 2009-07-01 Ian Lance Taylor <ian@airs.com>
7782
7783 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7784 instead of 32.
7785
7786 2009-06-24 Ian Lance Taylor <iant@google.com>
7787
7788 PR 10156
7789 * layout.cc (Layout::choose_output_section): If we find an
7790 existing section, update the flags.
7791 (Layout::create_notes): New function, broken out of
7792 Layout::finalize.
7793 (Layout::finalize): Don't create note sections.
7794 (Layout::create_note): Don't crash if linker script discards
7795 section.
7796 (Layout::create_gold_note): Likewise.
7797 (Layout::create_build_id): Likewise. Don't set
7798 after_input_sections on the section.
7799 (Layout::create_executable_stack_info): Remove target parameter.
7800 Change caller.
7801 * layout.h (class Layout): Declare create_notes. Update
7802 declaration of create_executable_stack_info.
7803 * gold.cc (queue_middle_tasks): Call create_notes.
7804 * output.cc (Output_section::update_flags_for_input_section): Move
7805 here from output.h. If SHF_ALLOC flag is newly set, mark address
7806 invalid.
7807 * output.h (Output_data::mark_address_invalid): New function.
7808 (class Output_section): Only declare, not define,
7809 update_flags_for_input_section. Remove set_flags.
7810
7811 2009-06-24 Ian Lance Taylor <iant@google.com>
7812
7813 * script-sections.cc (Output_section_definition::
7814 set_section_addresses): Rename shadowing local load_address to
7815 laddr.
7816
7817 2009-06-24 Ian Lance Taylor <iant@google.com>
7818
7819 PR 10244
7820 * reloc.cc (relocate_sections): Skip empty relocation sections.
7821
7822 2009-06-23 Ian Lance Taylor <iant@google.com>
7823
7824 PR 10156
7825 * layout.cc (Layout::create_note): Use choose_output_section
7826 rather than make_output_section.
7827
7828 2009-06-23 Ian Lance Taylor <iant@google.com>
7829
7830 PR 10237
7831 * options.cc (General_options::parse_V): Set printed_version_.
7832 (General_options::General_options): Initialize printed_version_.
7833 * options.h (class General_options): Add printed_version_ field.
7834 * gold.cc (queue_initial_tasks): If there are no input files,
7835 don't give a fatal error if we printed the version information.
7836 (queue_middle_tasks): If using -r with a shared object, give a
7837 fatal error rather than an ordinary error.
7838
7839 2009-06-23 Ian Lance Taylor <iant@google.com>
7840
7841 PR 10219
7842 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7843 (Layout::make_output_section): Set have_stabstr_section_ if we see
7844 a .stab*str section.
7845 (Layout::finalize): Call link_stabs_sections.
7846 (Layout::link_stabs_sections): New file.
7847 * layout.h (class Layout): Add have_stabstr_section_ field.
7848 Declare link_stabs_sections.
7849
7850 2009-06-23 Doug Kwan <dougkwan@google.com>
7851
7852 * Makefile.am (libgold_a_LIBADD): New.
7853 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7854 * Makefile.in: Regenerate.
7855 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7856 * configure: Regenerate.
7857 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7858 * fileread.cc: Include sys/state.h
7859 * gold.h: Declare memmem and strndup if found missing.
7860 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7861
7862 2009-06-23 Ian Lance Taylor <iant@google.com>
7863
7864 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7865 * configure: Rebuild.
7866
7867 2009-06-23 Ian Lance Taylor <iant@google.com>
7868
7869 PR 10147
7870 * object.cc (Object::section_contents): Don't try to get a view if
7871 the section has length zero.
7872 (Object::handle_gnu_warning_section): If the section is empty, use
7873 the name of the section as the warning.
7874
7875 2009-06-23 Ian Lance Taylor <iant@google.com>
7876
7877 PR 10133
7878 * stringpool.h (class Stringpool_template): Add optimize_ field.
7879 (Stringpool_template::set_optimize): New function.
7880 * stringpool.cc (Stringpool_template::Stringpool_template):
7881 Initialize optimize_ field.
7882 (Stringpool_template::set_string_offsets): Test local optimize
7883 fild rather than parameter.
7884 * layout.cc (Layout::Layout): Call set_optimize on the section
7885 name stringpool.
7886
7887 2009-06-22 Ian Lance Taylor <iant@google.com>
7888
7889 PR 10030
7890 * yyscript.y: Parse TARGET.
7891 * script.cc (script_set_target): New function.
7892 * script-c.h (script_set_target): Declare.
7893 * options.cc (General_options::string_to_object_format): Rename
7894 from string_to_object_format in anonymous namespace. Change
7895 callers.
7896 * options.h (class General_options): Declare
7897 string_to_object_format.
7898
7899 2009-06-22 Ian Lance Taylor <iant@google.com>
7900
7901 * script-sections.cc (Script_sections::create_segments): Don't put
7902 program headers in a PT_LOAD segment if -n or -N.
7903
7904 2009-06-22 Ian Lance Taylor <iant@google.com>
7905
7906 PR 10141
7907 * options.h (class General_options): Add -z lazy and -z now. Sort
7908 -z options into alphabetical order.
7909 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7910
7911 2009-06-21 Ian Lance Taylor <iant@google.com>
7912
7913 * layout.cc (Layout::make_output_section): Call
7914 Target::new_output_section.
7915 (Layout::attach_allocated_section_to_segment): Put large section
7916 sections in a separate load segment with the large segment flag
7917 set.
7918 (Layout::segment_precedes): Sort large data segments after other
7919 load segments.
7920 (align_file_offset): New static function.
7921 (Layout::set_segment_offsets): Use align_file_offset.
7922 * output.h (class Output_section): Add is_small_section_ and
7923 is_large_section_ fields.
7924 (Output_section::is_small_section): New function.
7925 (Output_section::set_is_small_section): New function.
7926 (Output_section::is_large_section): New function.
7927 (Output_section::set_is_large_section): New function.
7928 (Output_section::is_large_data_section): New function.
7929 (class Output_segment): Add is_large_data_segment_ field.
7930 (Output_segment::is_large_data_segment): New function.
7931 (Output_segment::set_is_large_data_segment): New function.
7932 * output.cc (Output_section::Output_section): Initialize new
7933 fields.
7934 (Output_segment::Output_segment): Likewise.
7935 (Output_segment::add_output_section): Add assertion that large
7936 data sections always go in large data segments. Force small data
7937 sections to the end of the list of data sections. Force small BSS
7938 sections to the start of the list of BSS sections. For large BSS
7939 sections to the end of the list of BSS sections.
7940 * symtab.h (class Symbol): Declare is_common_shndx.
7941 (Symbol::is_defined): Check Symbol::is_common_shndx.
7942 (Symbol::is_common): Likewise.
7943 (class Symbol_table): Define enum Commons_section_type. Update
7944 declarations. Add small_commons_ and large_commons_ fields.
7945 * symtab.cc (Symbol::is_common_shndx): New function.
7946 (Symbol_table::Symbol_table): Initialize new fields.
7947 (Symbol_table::add_from_object): Put small and large common
7948 symbols in the right list.
7949 (Symbol_table::sized_finalized_symbol): Check
7950 Symbol::is_common_shndx.
7951 (Symbol_table::sized_write_globals): Likewise.
7952 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7953 common symbol lists. Don't call do_allocate_commons_list if the
7954 list is empty.
7955 (Symbol_table::do_allocate_commons_list): Remove is_tls
7956 parameter. Add comons_section_type parameter. Change all
7957 callers. Handle small and large common symbols.
7958 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7959 Symbol::is_common_shndx.
7960 * resolve.cc (symbol_to_bits): Likewise.
7961 * target.h (Target::small_common_shndx): New function.
7962 (Target::small_common_section_flags): New function.
7963 (Target::large_common_shndx): New function.
7964 (Target::large_common_section_flags): New function.
7965 (Target::new_output_section): New function.
7966 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7967 small_common_section_flags, and large_common_section_flags
7968 fields.
7969 (Target::do_new_output_section): New virtual function.
7970 * arm.cc (Target_arm::arm_info): Initialize new fields.
7971 * i386.cc (Target_i386::i386_info): Likewise.
7972 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7973 Likewise.
7974 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7975 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7976 (Target_x86_64::do_new_output_section): New function.
7977 * configure.ac: Define conditional MCMODEL_MEDIUM.
7978 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7979 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7980 (large_LDFLAGS): Define.
7981 * testsuite/large.c: New file.
7982 * testsuite/testfile.cc (Target_test::test_target_info):
7983 Initialize new fields.
7984 * configure, testsuite/Makefile.in: Rebuild.
7985
7986 2009-06-05 Doug Kwan <dougkwan@google.com>
7987
7988 * Makefile.am (CCFILES): Add target.cc.
7989 * Makefile.in: Regenerate.
7990 * i386.cc (class Target_i386): Define new virtual method to
7991 override do_is_local_label_name in parent.
7992 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7993 local symbols if --discard-locals or -X is given.
7994 * options.h (class General_options): Declare new options
7995 '--discard-locals' and '-X' for discarding locals.
7996 * target.h (class Target): Define new methods is_local_label_name.
7997 Declare new virtual method do_is_local_label_name.
7998 * target.cc: New file.
7999 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8000 (check_SCRIPTS): Add discard_locals_test.sh.
8001 (check_DATA): Add discard_local_tests.syms.
8002 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8003 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8004 * testsuite/Makefile.in: Regenerate.
8005 * testsuite/discard_locals_test.c: New file.
8006 * testsuite/discard_locals_test.sh: Same.
8007
8008 2009-06-05 Doug Kwan <dougkwan@google.com>
8009
8010 * object.cc (Sized_relobj::Sized_relobj): Initialize
8011 discarded_eh_frame_shndx_ to -1U.
8012 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8013 section.
8014 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8015 a discarded .eh_frame section.
8016 (Sized_relobj::do_finalize_local_symbols): Ditto.
8017 * object.h (class Sized_relobj): Declare new member
8018 discarded_eh_frame_shndx_.
8019 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8020 (local_labels_test.o, local_labels_test): New rules.
8021 * testsuite/Makefile.in: Regenerate.
8022
8023 2009-06-04 Doug Kwan <dougkwan@google.com>
8024
8025 * layout.cc (Layout::section_name_mapping): Add mapping for
8026 special ARM sections.
8027
8028 2009-06-03 Doug Kwan <dougkwan@google.com>
8029
8030 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8031 (utils::has_overflow): Same.
8032
8033 2009-06-03 Ian Lance Taylor <iant@google.com>
8034
8035 * layout.cc (Layout::section_name_mapping): New array, replacing
8036 Layout::linkonce_mapping.
8037 (Layout::section_name_mapping_count): New variable, replacing
8038 Layout::linkonce_mapping_count.
8039 (Layout::linkonce_output_name): Remove.
8040 (Layout::output_section_name): Rewrite.
8041 * layout.h (class Layout): Rename Linkonce_mapping to
8042 Section_name_mapping, linkonce_mapping to section_name_mapping,
8043 linkonce_mapping_count to section_name_mapping_count. Don't
8044 declare linkonce_output_name.
8045
8046 2009-06-03 Doug Kwan <dougkwan@google.com>
8047
8048 * gold/arm.cc (namespace utils): New.
8049 (Target_arm::reloc_is_non_pic): Define new method.
8050 (class Arm_relocate_functions): New.
8051 (Target_arm::Relocate::relocate): Handle relocation types used by
8052 Android.
8053
8054 2009-06-03 Ian Lance Taylor <iant@google.com>
8055
8056 * arm.cc (Target_arm::scan::global): Use || instead of |.
8057
8058 2009-06-02 Doug Kwan <dougkwan@google.com>
8059
8060 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8061 issued_non_pic_error_.
8062 (class Target_arm::Scan): Declare new method check_non_pic.
8063 Define new method symbol_needs_plt_entry.
8064 Declare new data member issued_non_pic_error_.
8065 (class Target_arm::Relocate): Declare new method
8066 should_apply_static_reloc.
8067 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8068 (Target_arm::Scan::check_non_pic): Define new method.
8069 (Target_arm::Scan::local): Handle a small subset of reloc types used
8070 by Android.
8071 (Target_arm::Scan::local): Same.
8072 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8073
8074 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8075
8076 * incremental.cc (Incremental_inputs::report_command_line): Filter
8077 out --incremental-* options.
8078
8079 2009-05-29 Doug Kwan <dougkwan@google.com>
8080
8081 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8082 template class.
8083 (class Target_arm): Update comment.
8084 (Target_arm::Target_arm): Initialize new data members GOT_,
8085 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8086 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8087 and Target_arm::rel_dyn_section.
8088 Declare new_enum Target_arm::Got_type.
8089 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8090 and DYNBSS_.
8091 Update commments for member do_dynsym_value.
8092 (Target_arm::got_size, Target_arm::plt_section,
8093 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8094 new methods inside class defintion.
8095 (Target_arm::got_section): Define new method.
8096 (Target_arm::rel_dyn_section): Same.
8097 (Output_data_plt_arm): New template class.
8098 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8099 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8100 (Output_data_plt_arm::add_entry): Same.
8101 (Output_data_plt_arm::first_plt_entry): Define new
8102 static data member for PLT instruction template.
8103 (Output_data_plt_arm::plt_entry): Same.
8104 (Output_data_plt_arm::do_write): Define new method.
8105 (Target_arm::make_plt_entry): Same.
8106 (Target_arm::do_finalize_sections): Same.
8107 (Target_arm::do_dynsym_value): Same.
8108
8109 2009-05-28 Doug Kwan <dougkwan@google.com>
8110
8111 * Makefile.am (TARGETSOURCES): Add arm.cc.
8112 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8113 * Makefile.in: Regenerate.
8114 * arm.cc: New file.
8115 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8116
8117 2009-05-26 Doug Kwan <dougkwan@google.com>
8118
8119 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8120 (General_options::check_excluded_libs): Strip off directories in
8121 archive name before matching like GNU ld does.
8122 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8123 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8124 (exclude_libs_test_LDFLAGS): Add linker option
8125 -Wl,--exclude-libs,libexclude_libs_test_3
8126 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8127 an explicit archive without using -l.
8128 (alt/libexclude_libs_test_3.a): New make rule.
8129 * testsuite/Makefile.in: Regenerate.
8130 * testsuite/exclude_libs_test.c : Declare lib3_default().
8131 (main): Call it.
8132 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8133 * exclude_libs_test_3.c: New file.
8134
8135 2009-05-26 Nick Clifton <nickc@redhat.com>
8136
8137 * po/id.po: New Indonesian translation.
8138 * po/gold.pot: Updated template file.
8139
8140 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8141
8142 * testsuite/Makefile.am: Add -ffunction-sections to compile
8143 gc_comdat_test files. Add -Wl,--gc-sections to build
8144 gc_comdat_test.
8145 * testsuite/Makefile.in: Regenerate.
8146 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8147
8148 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8149
8150 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8151 kept comdat section was garbage collected.
8152 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8153 * testsuite/Makefile.in: Regenerate.
8154 * testsuite/gc_comdat_test.sh: New file.
8155 * testsuite/gc_comdat_test_1.cc: New file.
8156 * testsuite/gc_comdat_test_2.cc: New file.
8157
8158 2009-05-19 Doug Kwan <dougkwan@google.com>
8159
8160 * archive.cc (Archive::Archive): Move constructor from archive.h
8161 to here. Initialize no_export_.
8162 (Archive::get_elf_object_for_member): Set no_export flag of object.
8163 * archive.h (Archive::Archive): Move constructor body to
8164 archive.cc.
8165 (Archive::no_export): New method.
8166 (Archive::no_export_): New field.
8167 * object.h (Object::Object): Initialize no_export_ to false.
8168 (Object::no_export, Object::set_no_export): New methods.
8169 (Object::no_export_): New field.
8170 * options.cc (General_options::parse_exclude_libs): New method.
8171 (General_options::check_excluded_libs) Same.
8172 * options.h (exclude_libs): New option.
8173 (General_options::check_excluded_libs): New method declaration.
8174 (General_options::excluded_libs_): New field.
8175 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8176 default or protected visibility if an object has no-export flag set.
8177 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8178 (check_SCRIPTS): Add exclude_libs_test.sh.
8179 (check_DATA): Add exclude_libs_test.syms.
8180 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8181 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8182 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8183 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8184 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8185 libexclude_libs_test_2.a): New rules.
8186 * testsuite/Makefile.in: Regenerate.
8187 * testsuite/exclude_libs_test.c: New file.
8188 * testsuite/exclude_libs_test.sh: Ditto.
8189 * testsuite/exclude_libs_test_1.c: Ditto.
8190 * testsuite/exclude_libs_test_2.c: Ditto.
8191
8192 2009-05-15 Ian Lance Taylor <iant@google.com>
8193
8194 * configure.ac: Check for declarations for cases where libiberty.h
8195 checks HAVE_DECL_xxx.
8196 * configure, config.in: Rebuild.
8197
8198 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8199
8200 * gold.h (Incremental_argument_list): Remove (invalid) forward
8201 declaration.
8202 * incremental.cc (Incremental_inputs::report_achive): New method.
8203 (Incremental_inputs::report_object): New method.
8204 (Incremental_inputs::report_script): New method.
8205 (Incremental_inputs::finalize_inputs): New method.
8206 (Incremental_inputs::finalize): Call finalize_inputs().
8207 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8208 Create inputs entries.
8209 * incremental.h (Incremental_input_type): New enum.
8210 (Incremental_inputs::Incremental_input): Initialize new fields.
8211 (Incremental_inputs::report_inputs): New method.
8212 (Incremental_inputs::report_achive): New method.
8213 (Incremental_inputs::report_object): New method.
8214 (Incremental_inputs::report_script): New method.
8215 (Incremental_inputs::finalize_inputs): New method.
8216 (Incremental_inputs::Input_info): New struct.
8217 (Incremental_inputs::Input_info_map): New typedef.
8218 (Incremental_inputs::lock_): New field.
8219 (Incremental_inputs::Inputs_): New field.
8220 (Incremental_inputs::Inputs_map): New field.
8221 * main.cc (main): Call Incremental_input::report_inputs.
8222 * options.h (Input_argument_list): Typedef moved from
8223 Input_arguments.
8224 (Input_file_group::Files): Remove, use ::Input_argument_list.
8225 (Input_file_group::Input_argument_list): Remove, use
8226 ::Input_argument_list.
8227 * plugin.cc (Plugin_manager::add_input_file): Add error in
8228 incremental build.
8229 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8230 functions.
8231 * script.cc (read_input_script): Call
8232 Incremental_input::report_script.
8233 * script.h (Script_info): New class.
8234
8235 2009-04-27 Ian Lance Taylor <iant@google.com>
8236
8237 * x86_64.cc (do_adjust_output_section): Set entsize to
8238 plt_entry_size.
8239
8240 2009-04-23 Elliott Hughes <enh@google.com>
8241
8242 * output.cc (Output_file::close): After short writes, continue
8243 writing from the correct offset in the buffer being written.
8244
8245 2009-04-23 Chris Demetriou <cgd@google.com>
8246
8247 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8248 * configure: Regenerate.
8249 * config.in: Regenerate.
8250 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8251 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8252
8253 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8254
8255 * incremental.cc (Incremental_inputs_header_data): Renamed from
8256 Incremental_input_header_data.
8257 (Incremental_inputs_header_data::data_size): New field.
8258 (Incremental_inputs_header_data::put_input_file_count): Renamed
8259 from input_file_count.
8260 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8261 from command_line_offset.
8262 (Incremental_inputs_header_data::put_reserved): Renamed from
8263 put_reserved.
8264 (Incremental_inputs_entry_data): Renamed from
8265 Incremental_input_entry_data.
8266 (Incremental_inputs_entry_data::data_size): New field.
8267 (Incremental_inputs::report_command_line): New method.
8268 (Incremental_inputs::finalize): New method.
8269 (Incremental_inputs::create_incremental_inputs_data): New method.
8270 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8271 * incremental.h: New file.
8272 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8273 (Layout::finalize): Create incremental inputs section in
8274 incremental builds.
8275 (Layout::create_incremental_info_sections): New method.
8276 * layout.h (Layout::incremental_inputs): New method.
8277 (Layout::create_incremental_info_sections): New method.
8278 (Layout::incremental_inputs_): New field.
8279 * main.cc (main): Notify Incremental_input of the command line.
8280
8281 2009-04-01 Ian Lance Taylor <iant@google.com>
8282 Mikolaj Zalewski <mikolajz@google.com>
8283
8284 * gold.h (reserve_unordered_map): Define, three versions, one for
8285 each version of Unordered_map.
8286 * layout.cc (Layout::Layout): Remove options parameter. Add
8287 number_of_input_files parameter. Don't initialize options_.
8288 Initialize number_of_input_files_ and resized_signatures_. Move
8289 sections_are_attached_.
8290 (Layout::layout_group): Reserve space for group_signatures_.
8291 (Layout::find_or_add_kept_section): Change name parameter to be a
8292 reference. Resize signatures_ map when it gets large enough.
8293 (Layout::layout_eh_frame): Use parameters->options() instead of
8294 this->options_.
8295 (Layout::make_output_section): Likewise.
8296 (Layout::attach_allocated_section_to_segment): Likewise.
8297 (Layout::finalize, Layout::create_executable_stack): Likewise.
8298 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8299 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8300 * layout.h (class Layout): Update declarations. Remove options_
8301 field. Add number_of_input_files_ and resized_signatures_
8302 fields. Move sections_are_attached_ field.
8303 * main.cc (main): Pass number of input files to Layout
8304 constructor. Don't pass options.
8305
8306 2009-03-30 Ian Lance Taylor <iant@google.com>
8307
8308 * ffsll.c (ffsll): Correct implementation.
8309
8310 2009-03-27 Ian Lance Taylor <iant@google.com>
8311
8312 * ffsll.c: New file.
8313 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8314 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8315 * ftruncate.c (ftruncate): Declare before definition.
8316 * mremap.c (mremap): Likewise.
8317 * pread.c (pread): Likewise.
8318 * configure, Makefile.in, config.in: Rebuild.
8319
8320 * mremap.c: New file.
8321 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8322 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8323 (mremap): Declare if HAVE_MREMAP is not defined.
8324 * configure, Makefile.in, config.in: Rebuild.
8325
8326 2009-03-27 Cary Coutant <ccoutant@google.com>
8327
8328 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8329 position independent.
8330 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8331 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8332
8333 2009-03-24 Cary Coutant <ccoutant@google.com>
8334
8335 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8336 an executable.
8337 (needs_dynamic_reloc): Likewise.
8338
8339 2009-03-24 Ian Lance Taylor <iant@google.com>
8340
8341 * yyscript.y (file_cmd): Recognize EXTERN.
8342 (extern_name_list, extern_name_list_body): New nonterminals.
8343 * script.cc (script_add_extern): Define.
8344 * script-c.h (script_add_extern): Declare.
8345
8346 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8347
8348 * object.cc (is_elf_object): Define.
8349 * object.h (is_elf_object): Declare.
8350 * archive.cc (Archive::get_elf_object_for_member): Call
8351 is_elf_object.
8352 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8353
8354 2009-03-24 Elliott Hughes <enh@google.com>
8355
8356 * output.cc (Output_file::map_anonymous): Define.
8357 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8358 try an anonymous one. Report the size if the mmap fails.
8359 * output.h (class Output_file): Declare map_anonymous.
8360
8361 2009-03-24 Ian Lance Taylor <iant@google.com>
8362
8363 * target-select.cc (instantiate_target): Don't acquire the lock if
8364 the instantiated_target_ field has already been set.
8365
8366 2009-03-23 Ian Lance Taylor <iant@google.com>
8367
8368 * gold-threads.h (class Initialize_lock): Define.
8369 * gold-threads.cc (class Initialize_lock_once): Define.
8370 (initialize_lock_control): New static variable.
8371 (initialize_lock_pointer): New static variable.
8372 (initialize_lock_once): New static function.
8373 (Initialize_lock::Initialize_lock): Define.
8374 (Initialize_lock::initialize): Define.
8375 * target-select.h: Include "gold-threads.h".
8376 (class Target_selector): Add lock_ and initialize_lock_ fields.
8377 Don't define instantiate_target, just declare it.
8378 * target-select.cc (Target_selector::Target_selector): Initialize
8379 new fields.
8380 (Target_selector::instantiate_target): Define.
8381 * descriptors.h: Include "gold-threads.h".
8382 (class Descriptors): Add initialize_lock_ field.
8383 * descriptors.cc (Descriptors::Descriptors): Initialize new
8384 field.
8385 (Descriptors::open): Use initialize_lock_ field
8386 * errors.h (class Errors): Add initialize_lock_ field.
8387 * errors.cc (Errors::Errors): Initialize new field.
8388 (Errors::initialize_lock): Use initialize_lock_ field.
8389 * powerpc.cc (class Target_selector_powerpc): Remove
8390 instantiated_target_ field. In do_recognize call
8391 instantiate_target rather than do_instantiate_target. In
8392 do_instantiate_target just allocate a new target.
8393 * sparc.cc (class Target_selector_sparc): Likewise.
8394
8395 * freebsd.h: New file.
8396 * i386.cc: Include "freebsd.h".
8397 (Target_i386): Derive from Target_freebsd rather than
8398 Sized_target.
8399 (Target_selector_i386): Derive from Target_selector_freebsd rather
8400 than Target_selector.
8401 * x86_64.cc: Include "freebsd.h".
8402 (Target_x86_64): Derive from Target_freebsd rather than
8403 Sized_target.
8404 (Target_selector_x86_64): Derive from Target_selector_freebsd
8405 rather than Target_selector.
8406 * target.h (class Target): Add adjust_elf_header and
8407 do_adjust_elf_header.
8408 * output.cc (Output_file_header:: do_sized_write): Call target
8409 adjust_elf_header routine.
8410 * configure.tgt: Set targ_osabi.
8411 * configure.ac: Define GOLD_DEFAULT_OSABI.
8412 * parameters.cc (Parameters::default_target): Pass
8413 GOLD_DEFAULT_OSABI to select_target.
8414 * target-select.h (class Target_selector): Make instantiate_target
8415 protected rather than private.
8416 * Makefile.am (HFILES): Add freebsd.h.
8417 * configure, Makefile.in, config.in: Rebuild.
8418
8419 * merge.cc (do_add_input_section): Correct pend value. Change
8420 message about last entry not being null terminated from error to
8421 warning.
8422
8423 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8424
8425 * incremental.cc: New file.
8426 * Makefile.am (CCFILES): Add incremental.cc.
8427 * Makefile.in: Rebuild.
8428
8429 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8430
8431 * layout.cc (Layout::output_section_name): Preserve names
8432 of '.note.' sections.
8433
8434 2009-03-19 Ian Lance Taylor <iant@google.com>
8435
8436 * descriptors.cc (Descriptors::open): Check that the options are
8437 valid before using them.
8438
8439 2009-03-18 Ian Lance Taylor <iant@google.com>
8440
8441 * script-sections.h: Include <list>.
8442 (class Script_sections): Change Sections_elements from std::vector
8443 to std::list. Typedef public Elements_iterator. Add
8444 orphan_section_placement_, data_segment_align_start_, and
8445 saw_data_segment_align_ fields. Remove data_segment_align_index_
8446 field.
8447 * script-sections.cc (class Orphan_section_placement): New class.
8448 (class Sections_element): Add virtual functions is_relro and
8449 orphan_section_init. Remove virtual function place_orphan_here.
8450 (class Output_section_definition): Add is_relro and
8451 orphan_section_init. Remove place_orphan_here.
8452 (class Orphan_output_section): Likewise.
8453 (Script_sections::Script_sections): Update for field changes.
8454 (Script_sections::data_segment_align): Set saw_data_segment_align_
8455 and data_segment_align_start_, not data_segment_align_index.
8456 (Script_sections::data_segment_relro_end): Check
8457 saw_data_segment_align_. Use data_segment_align_start_ rather
8458 than data_segment_align_index_.
8459 (Script_sections::place_orphan): Rewrite to use
8460 Orphan_section_placement.
8461
8462 2009-03-17 Ian Lance Taylor <iant@google.com>
8463
8464 * archive.cc (Archive::add_symbols): Check for a version attached
8465 to the symbol name in the archive map.
8466 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8467 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8468 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8469 (ver_test_11.a): New target.
8470 * testsuite/Makefile.in: Rebuild.
8471
8472 * configure.ac: Check for chsize and posix_fallocate. Replace
8473 ftruncate.
8474 * ftruncate.c: New file, from gnulib.
8475 * output.cc (posix_fallocate): Define dummy version if not
8476 HAVE_POSIX_FALLOCATE.
8477 (Output_file::map): Call posix_fallocate rather than lseek and
8478 write.
8479 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8480 * configure, Makefile.in, config.in: Rebuild.
8481
8482 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8483
8484 * layout.h (Layout::create_note): Add section_name parameter.
8485 * layout.cc (Layout::create_note): Likewise.
8486 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8487
8488 2009-03-17 Ian Lance Taylor <iant@google.com>
8489
8490 * descriptors.cc: Include "options.h".
8491 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8492 (Descriptors::open): Always use O_CLOEXEC when opening a new
8493 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8494 then set FD_CLOEXEC.
8495
8496 * sparc.cc (class Target_sparc): Add has_got_section.
8497 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8498 make sure we have a GOT section.
8499
8500 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8501 (Target_sparc::Scan::local): Likewise.
8502 (Target_sparc::Scan::global): Likewise.
8503 (Target_sparc::Relocate::relocate): Likewise.
8504 (Target_sparc::Relocate::relocate_tls): Likewise.
8505
8506 * symtab.cc (Symbol_table::define_default_version): New function,
8507 broken out of add_from_object.
8508 (Symbol_table::add_from_object): Call define_default_version.
8509 (Symbol_table::define_special_symbol): Add resolve_oldsym
8510 parameter. Change all callers. If the version for a symbol comes
8511 from a version script, resolve it with the symbol with the same
8512 name with no version. Also add the symbol without a version if
8513 appropriate.
8514 (do_define_in_output_data): If resolving with oldsym, don't delete
8515 sym.
8516 (do_define_in_output_segment): Likewise.
8517 (do_define_as_constant): Likewise.
8518 * symtab.h (class Symbol_table): Update declarations.
8519
8520 2009-03-13 Ian Lance Taylor <iant@google.com>
8521
8522 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8523 (Read_symbols::requeue): New function.
8524 (Read_symbols::do_read_symbols): If make_elf_object fails because
8525 the target type is not configured, and the file was searched for,
8526 issue a warning and retry with the next directory.
8527 (Add_symbols::run): If the file has an incompatible format, and
8528 it was searched for, requeue the Read_symbols task. On error,
8529 release the object.
8530 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8531 dirindex parameter to constructor. Change all callers. Declare
8532 incompatible_warning and requeue.
8533 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8534 input_argument_ and input_group_ fields. Add them to
8535 constructor. Change all callers.
8536 (class Read_script): Add dirindex_ field. Add it to constructor.
8537 Change all callers.
8538 * archive.cc (Archive::setup): Remove input_objects parameter.
8539 Change all callers.
8540 (Archive::get_file_and_offset): Likewise.
8541 (Archive::read_all_symbols): Likewise.
8542 (Archive::read_symbols): Likewise.
8543 (Archive::get_elf_object_for_member): Remove input_objects
8544 parameter. Add punconfigured parameter. Change all callers.
8545 (Archive::add_symbols): Change return type to bool. Check return
8546 value of include_member.
8547 (Archive::include_all_members): Likewise.
8548 (Archive::include_member): Change return type to bool. Return
8549 false if first included object has incompatible target. Set
8550 included_member_ field.
8551 (Add_archive_symbols::run): If add_symbols returns false, requeue
8552 Read_symbols task.
8553 * archive.h (class Archive): Add included_member_ field.
8554 Initialize it in constructor. Add input_file and searched_for
8555 methods. Update declarations.
8556 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8557 input_argument_ fields. Add them to constructor. Change all
8558 callers.
8559 * script.cc: Include "target-select.h".
8560 (class Parser_closure): Add skip_on_incompatible_target_ and
8561 found_incompatible_target_ fields. Add
8562 skip_on_incompatible_target parameter to constructor. Change all
8563 callers. Add methods skip_on_incompatible_target,
8564 clear_skip_on_incompatible_target, found_incompatible_target, and
8565 set_found_incompatible_target.
8566 (read_input_script): Add dirindex parameter. Change all callers.
8567 If parser finds an incompatible target, requeue Read_symbols
8568 task.
8569 (script_set_symbol): Clear skip_on_incompatible_target in
8570 closure.
8571 (script_add_assertion, script_parse_option): Likewise.
8572 (script_start_sections, script_add_phdr): Likewise.
8573 (script_check_output_format): New function.
8574 * script.h (read_input_script): Update declaration.
8575 * script-c.h (script_check_output_format): Declare.
8576 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8577 (ignore_cmd): Remove OUTPUT_FORMAT.
8578 * fileread.cc (Input_file::Input_file): Add explicit this.
8579 (Input_file::will_search_for): New function.
8580 (Input_file::open): Add pindex parameter. Change all callers.
8581 * fileread.h (class Input_file): Add input_file_argument method.
8582 Declare will_search_for. Update declarations.
8583 * object.cc (make_elf_object): Add punconfigured parameter.
8584 Change all callers.
8585 * object.h (class Object): Make input_file public. Add
8586 searched_for method.
8587 (make_elf_object): Update declaration.
8588 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8589 restart search.
8590 * dirsearch.h (class Dirsearch): Update declaration.
8591 * options.h (class General_options): Add --warn-search-mismatch.
8592 * parameters.cc (Parameters::is_compatible_target): New function.
8593 * parameters.h (class Parameters): Declare is_compatible_target.
8594 * workqueue.cc (Workqueue::add_blocker): New function.
8595 * workqueue.h (class Workqueue): Declare add_blocker.
8596
8597 * fileread.cc (Input_file::open): Remove options parameter.
8598 Change all callers.
8599 (Input_file::open_binary): Likewise.
8600 * script.cc (read_input_script): Likewise.
8601 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8602 options parameter from constructor. Change all callers.
8603 (class Read_script): Likewise.
8604 * fileread.h (class Input_file): Update declarations.
8605 * script.h (read_input_script): Update declaration.
8606
8607 2009-03-10 Nick Clifton <nickc@redhat.com>
8608
8609 * po/es.po: New Spanish translation.
8610
8611 2009-03-06 Cary Coutant <ccoutant@google.com>
8612
8613 * options.cc (parse_short_option): Keep dash_z from registering itself.
8614
8615 2009-03-03 Ian Lance Taylor <iant@google.com>
8616
8617 PR 9918
8618 * target-reloc.h (relocate_section): Pass output_section to
8619 relocate.
8620 * i386.cc (Target_i386::should_apply_static_reloc): Add
8621 output_section parameter. Change all callers.
8622 (Target_i386::Relocate::relocate): Add output_section parameter.
8623 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8624 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8625 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8626 * testsuite/two_file_shared.sh: New script.
8627 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8628 (check_DATA): Add two_file_shared.dbg.
8629 (two_file_shared.dbg): New target.
8630 * testsuite/Makefile.in: Rebuild.
8631
8632 2009-03-01 Ian Lance Taylor <iant@google.com>
8633
8634 * configure.ac: Check for byteswap.h.
8635 * configure: Rebuild.
8636 * config.in: Rebuild.
8637
8638 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8639
8640 * layout.cc (Layout::find_or_add_kept_section): New function.
8641 (Layout::add_comdat): Removed.
8642 * layout.h (struct Kept_section): Move out of class Layout.
8643 Remove trailing underscores from field names. Add group_sections
8644 field. Rename group_ field to is_group. Change all uses.
8645 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8646 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8647 comdat_groups_ field.
8648 (Sized_relobj::include_section_group): Use
8649 find_or_add_kept_section and Kept_section::group_sections.
8650 (Sized_relobj::include_linkonce_section): Likewise.
8651 * object.cc (class Sized_relobj): Don't define Comdat_group or
8652 Comdat_group_table. Remove find_comdat_group and
8653 add_comdat_group. Remove comdat_groups_ field.
8654 * plugin.cc (include_comdat_group): Use
8655 Layout::find_or_add_kept_section.
8656
8657 2009-02-28 Ian Lance Taylor <iant@google.com>
8658
8659 * README: --gc-sections and map files are now supported. Document
8660 some build requirements.
8661
8662 PR 6992
8663 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8664 relocatable link set the value of the section symbol to zero.
8665 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8666 relocatable link don't include the section address in the local
8667 symbol value.
8668
8669 2009-02-27 Ian Lance Taylor <iant@google.com>
8670
8671 PR 6811
8672 * options.h (class Search_directory): Add is_system_directory.
8673 (class General_options): Declare is_in_system_directory.
8674 * options.cc (get_relative_sysroot): Make static.
8675 (get_default_sysroot): Make static.
8676 (General_optoins::is_in_system_directory): New function.
8677 * fileread.cc (Input_file::is_in_system_directory): New function.
8678 * fileread.h (class Input_file): Declare is_in_system_directory.
8679 * object.h (class Object): Add is_in_system_directory.
8680 (class Input_objects): Remove system_library_directory_ field.
8681 * object.cc (Input_objects::add_object): Don't set
8682 system_library_directory_.
8683 (input_objects::found_in_system_library_directory): Remove.
8684 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8685 parameter. Change all callers.
8686 (Symbol_table::sized_write_globals): Likewise.
8687 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8688 Call Object::is_in_system_directory.
8689 * symtab.h (class Symbol_table): Update declarations.
8690
8691 PR 5990
8692 * descriptors.h (Open_descriptor): Add is_on_stack field.
8693 * descriptors.cc (Descriptors::open): If the descriptor is on the
8694 top of the stack, remove it. Initialize is_on_stack field.
8695 (Descriptors::release): Only add pod to stack if it is not on the
8696 stack already.
8697 (Descriptors::close_some_descriptor): Clear stack_next and
8698 is_on_stack fields.
8699
8700 PR 7091
8701 * output.cc (Output_section::find_starting_output_address): Rename
8702 from starting_output_address; add PADDR parameter; change return
8703 type.
8704 * output.h (class Output_section): Declare
8705 find_starting_output_address instead of starting_output_address.
8706 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8707 section symbol for which we can't find a merge section.
8708
8709 PR 9836
8710 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8711 hidden or internal, force the symbol to be local.
8712 * resolve.cc (Symbol::override_visibility): Define.
8713 (Symbol::override_base): Use override_visibility.
8714 (Symbol_table::resolve): Likewise.
8715 (Symbol::override_base_with_special): Likewise.
8716 (Symbol_table::override_with_special): If the visibility is hidden
8717 or internal, force the symbol to be local.
8718 * symtab.h (class Symbol): Add set_visibility and
8719 override_visibility.
8720 * testsuite/ver_test_1.sh: New file.
8721 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8722 (check_DATA): Add ver_test_1.syms.
8723 (ver_test_1.syms): New target.
8724 * testsuite/Makefile.in: Rebuild.
8725
8726 2009-02-25 Cary Coutant <ccoutant@google.com>
8727
8728 * layout.cc (Layout::choose_output_section): Don't rename sections
8729 when using a linker script that has a SECTIONS clause.
8730 * Makefile.in: Regenerate.
8731
8732 * testsuite/Makefile.am (script_test_5.sh): New test case.
8733 * testsuite/Makefile.in: Regenerate.
8734 * testsuite/script_test_5.cc: New file.
8735 * testsuite/script_test_5.sh: New file.
8736 * testsuite/script_test_5.t: New file.
8737
8738 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8739
8740 * archive.cc (Archive::include_member): Update calls to add_symbols.
8741 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8742 the Layout argument.
8743 * dynobj.h (do_add_symbols): Add the Layout argument.
8744 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8745 Layout argument.
8746 * object.h (Object::add_symbols): Add the Layout argument.
8747 (Object::do_add_symbols): Add the Layout argument.
8748 (Sized_relobj::do_add_symbols): Add the Layout argument.
8749 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8750 Unify the two versions.
8751 (Add_plugin_symbols): Remove.
8752 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8753 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8754 (Add_plugin_symbols): Remove.
8755 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8756 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8757 (Add_symbols::run): Make it work with Pulginobj.
8758
8759 2009-02-06 Ian Lance Taylor <iant@google.com>
8760
8761 * object.cc (Sized_relobj::do_layout): Make info message start
8762 with lower case letter.
8763
8764 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8765
8766 * binary.cc: Fix file comment.
8767
8768 * options.h (enum Incremental_disposition): Define.
8769 (class General_options): Add new options: --incremental,
8770 --incremental_changed, --incremental_unchanged,
8771 --incremental_unknown. Add incremental_disposition_ and
8772 implicit_incremental_ fields.
8773 (General_options::incremental_disposition): New function.
8774 (class Position_dependent_options): Add incremental_disposition
8775 option.
8776 (Position_dependent_options::copy_from_options): Set incremental
8777 dispositions.
8778 * options.cc (General_options::parse_incremental_changed): New
8779 function.
8780 (General_options::parse_incremental_unchanged): New function.
8781 (General_options::parse_incremental_unknown): New function.
8782 (General_options::General_options): Initialize new fields
8783 incremental_disposition_ and implicit_incremental_.
8784 (General_options::finalize): Check for uasge of --incremental-*
8785 without --incremental.
8786
8787 2009-02-06 Chris Demetriou <cgd@google.com>
8788
8789 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8790 pointer and to report location as the file name associated with
8791 the symbol.
8792 (gold_undefined_symbol_at_location): New function to replace the
8793 old gold_undefined_symbol functionality.
8794 * target-reloc.h (relocate_section): Update to use
8795 gold_undefined_symbol_at_location.
8796 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8797 Call gold_undefined_symbol function rather than gold_error.
8798 * errors.h (Errors::undefined_symbol): Take location as a
8799 string, rather than calculating it from a relocation.
8800 * errors.cc (Errors::fatal): Print "fatal error:" before the
8801 formatted message.
8802 (Errors::error, Errors::error_at_location): Print "error: "
8803 before the formatted message.
8804 (Errors::undefined_symbol): Take location as a string, rather
8805 than calculating it from a relocation.
8806 (gold_undefined_symbol_at_location): New function akin to
8807 old gold_undefined_symbol, calculates location from relocation.
8808 (gold_undefined_symbol): Change to take only a Symbol pointer
8809 and to report location as the file name associated with the symbol.
8810 * testsuite/debug_msg.sh: Update for changed error messages.
8811 * testsuite/undef_symbol.sh: Likewise.
8812
8813 2009-02-04 Duncan Sands <baldrick@free.fr>
8814
8815 PR 9812
8816 * reduced_debug_output.h
8817 (Output_reduced_debug_abbrev_section::failed): Use format for
8818 gold_warning.
8819 (Output_reduced_debug_info_section::faild): Likewise.
8820
8821 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8822
8823 * script.cc (Lazy_demangler): New class.
8824 (Version_script_info::get_symbol_version_helper): Demangle a
8825 symbol only once.
8826
8827 2009-01-29 Cary Coutant <ccoutant@google.com>
8828
8829 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8830 to __tls_get_addr.
8831 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8832
8833 2009-01-28 Ian Lance Taylor <iant@google.com>
8834
8835 * version.cc (version_string): Bump to 1.9.
8836
8837 * gold.h: Include <cstring> and <stdint.h>.
8838 * version.cc: Include <cstdio>.
8839 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8840 warning.
8841 * reduced_debug_output.cc (insert_into_vector): Rename from
8842 Insert_into_vector; change all callers. Use Swap_unaligned to
8843 avoid aliasing issue; remove union since it is unnecessary.
8844
8845 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8846
8847 * Makefile.am (CCFILES): Add gc.cc.
8848 (HFILES): Add gc.h.
8849 * Makefile.in: Regenerate.
8850 * gold.cc (Gc_runner): New class.
8851 (queue_initial_tasks): Call garbage collection related tasks
8852 when corresponding options are invoked.
8853 (queue_middle_gc_tasks): New function.
8854 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8855 processed early before laying out sections during garbage collection.
8856 * gold.h (queue_middle_gc_tasks): New function.
8857 (is_prefix_of): Move from "layout.cc".
8858 * i386.cc (Target_i386::gc_process_relocs): New function.
8859 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8860 * main.cc (main): Create object of class "Garbage_collection".
8861 * object.cc (Relobj::copy_symbols_data): New function.
8862 (Relobj::is_section_name_included): New function.
8863 (Sized_relobj::do_layout): Allow this function to be called twice
8864 during garbage collection and defer layout of section during the
8865 first call.
8866 * object.h (Relobj::get_symbols_data): New function.
8867 (Relobj::is_section_name_included): New function.
8868 (Relobj::copy_symbols_data): New function.
8869 (Relobj::set_symbols_data): New function.
8870 (Relobj::get_relocs_data): New function.
8871 (Relobj::set_relocs_data): New function.
8872 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8873 (Relobj::gc_process_relocs): New function.
8874 (Relobj::do_gc_process_relocs): New pure virtual function.
8875 (Relobj::sd_): New data member.
8876 (Sized_relobj::is_output_section_offset_invalid): New function.
8877 (Sized_relobj::do_gc_process_relocs): New function.
8878 * options.h (General_options::gc_sections): Modify to not be a no-op.
8879 (General_options::print_gc_sections): New option.
8880 * plugin.cc (Plugin_finish::run): Remove function call to
8881 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8882 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8883 * reloc.cc (Read_relocs::run): Add task to process relocs and
8884 determine unreferenced sections when doing garbage collection.
8885 (Gc_process_relocs): New class.
8886 (Sized_relobj::do_gc_process_relocs): New function.
8887 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8888 sections that are garbage collected.
8889 * reloc.h (Gc_process_relocs): New class.
8890 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8891 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8892 symbols whose corresponding sections are garbage collected.
8893 (Symbol_table::Symbol_table): Add new parameter for the garbage
8894 collection object.
8895 (Symbol_table::gc_mark_undef_symbols): New function.
8896 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8897 (Symbol_table::gc_mark_dyn_syms): New function.
8898 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8899 as garbage.
8900 (Symbol_table::add_from_object): Likewise.
8901 (Symbol_table::add_from_relobj): When building shared objects, do not
8902 treat externally visible symbols as garbage.
8903 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8904 table information for static and relocatable links.
8905 * symtab.h (Symbol_table::set_gc): New function.
8906 (Symbol_table::gc): New function.
8907 (Symbol_table::gc_mark_undef_symbols): New function.
8908 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8909 (Symbol_table::gc_mark_dyn_syms): New function.
8910 (Symbol_table::gc_): New data member.
8911 * target.h (Sized_target::gc_process_relocs): New pure virtual
8912 function.
8913 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8914 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8915
8916 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8917
8918 * options.h (General_options::gc_sections): Define as a no-op for now.
8919 (General_options::no_keep_memory): Ditto.
8920 (General_options::Bshareable): Define.
8921 * options.cc (General_options::finalize): Honor -Bshareable.
8922
8923 2009-01-20 Andreas Schwab <schwab@suse.de>
8924
8925 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8926 read the value in the contents, since we don't use it. Use the
8927 template endianness when writing.
8928 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8929
8930 2009-01-19 Andreas Schwab <schwab@suse.de>
8931
8932 * configure.tgt (powerpc64-*): Fix targ_obj.
8933
8934 2009-01-15 Ian Lance Taylor <iant@google.com>
8935
8936 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8937 local symbols when stripping all symbols.
8938
8939 2009-01-14 Cary Coutant <ccoutant@google.com>
8940
8941 * output.cc (Output_reloc): Add explicit instantiations.
8942
8943 2009-01-14 Cary Coutant <ccoutant@google.com>
8944
8945 * archive.cc (Archive::get_elf_object_for_member): Remove call
8946 to File_read::claim_for_plugin.
8947 * descriptors.cc (Descriptors::open): Remove reference to
8948 is_claimed.
8949 (Descriptors::claim_for_plugin): Remove.
8950 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8951 (Descriptors::is_claimed): Remove.
8952 (claim_descriptor_for_plugin): Remove.
8953 * fileread.cc (File_read::claim_for_plugin): Remove.
8954 * fileread.h (File_read::claim_for_plugin): Remove.
8955 (File_read::descriptor): Reopen descriptor if necessary.
8956 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8957 (Plugin_manager::all_symbols_read): Add task parameter. Change
8958 all callers.
8959 (Plugin_manager::get_input_file): New function.
8960 (Plugin_manager::release_input_file): New function.
8961 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8962 corresponding data member.
8963 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8964 and pass to base constructor. Change all callers.
8965 (get_input_file, release_input_file): New functions.
8966 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8967 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8968 (Plugin_manager::all_symbols_read): Add task parameter.
8969 (Plugin_manager::get_input_file): New function.
8970 (Plugin_manager::release_input_file): New function.
8971 (Plugin_manager::task_): New data member.
8972 (Pluginobj::Pluginobj): Add filesize parameter.
8973 (Pluginobj::filename): New function.
8974 (Pluginobj::descriptor): New function.
8975 (Pluginobj::filesize): New function.
8976 (Pluginobj::filesize_): New data member.
8977 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8978 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8979 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8980
8981 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8982 with archive libraries.
8983 * testsuite/Makefile.in: Regenerate.
8984 * testsuite/plugin_test.c (struct sym_info): New type.
8985 (get_input_file, release_input_file): New static variables.
8986 (onload): Capture new transfer vector entries.
8987 (claim_file_hook): Stop reading at end of file according to filesize.
8988 Factor out parsing of readelf output into separate function.
8989 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8990 APIs and get the source file name from the symbol table. Convert
8991 source file name to corresponding object file name. Print info
8992 message when adding new input files.
8993 (parse_readelf_line): New function.
8994 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8995 * testsuite/plugin_test_2.sh: Likewise.
8996 * testsuite/plugin_test_3.sh: Likewise.
8997 * testsuite/plugin_test_4.sh: New test case.
8998
8999 2009-01-07 Ian Lance Taylor <iant@google.com>
9000
9001 * version.cc (version_string): Bump to 1.8.
9002
9003 2008-12-23 Cary Coutant <ccoutant@google.com>
9004
9005 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9006 * plugin.cc (Plugin_manager::finish): Rename as
9007 layout_deferred_objects. Move cleanup to separate function.
9008 (Plugin_manager::cleanup): New function.
9009 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9010 separately.
9011 * plugin.h (Plugin_manager::finish): Rename as
9012 layout_deferred_objects.
9013 (Plugin_manager::cleanup): New function.
9014 (Plugin_manager::cleanup_done): New field.
9015
9016 2008-12-23 Cary Coutant <ccoutant@google.com>
9017
9018 * plugin.cc (is_visible_from_outside): New function.
9019 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9020 so we don't return "IR only" status for exported symbols or -r links.
9021
9022 * testsuite/Makefile.am (plugin_test_3): New test case.
9023 * testsuite/Makefile.in: Regenerate.
9024 * testsuite/plugin_test_3.sh: New file.
9025
9026 2008-12-22 Cary Coutant <ccoutant@google.com>
9027
9028 * object.cc (Sized_relobj::layout_section): New function.
9029 (Sized_relobj::do_layout): Defer layout of input sections until after
9030 plugin has provided replacement files.
9031 (Sized_relobj::do_layout_deferred_sections): New function.
9032 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9033 (Relobj::layout_deferred_sections): New function.
9034 (Relobj::do_layout_deferred_sections): New function.
9035 (Sized_relobj::do_layout_deferred_sections): New function.
9036 (Sized_relobj::layout_section): New function.
9037 (Sized_relobj::Deferred_layout): New structure.
9038 (Sized_relobj::deferred_layout_): New field.
9039 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9040 Change all callers. Layout deferred sections.
9041 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9042 references.
9043 (Plugin_hook::run): Move code from do_plugin_hook inline.
9044 (Plugin_hook::do_plugin_hook): Remove.
9045 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9046 (Plugin_manager::finish): Renamed, was cleanup.
9047 (Plugin_manager::should_defer_layout): New function.
9048 (Plugin_manager::add_deferred_layout_object): New function.
9049 (Plugin_manager::Deferred_layout_list): New type.
9050 (Plugin_manager::deferred_layout_objects_): New field.
9051 (Plugin_hook::do_plugin_hook): Remove.
9052
9053 2008-12-17 Ian Lance Taylor <iant@google.com>
9054
9055 * options.h (class General_options): Add --no case for
9056 --export-dynamic.
9057
9058 2008-12-16 Cary Coutant <ccoutant@google.com>
9059
9060 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9061 vector.
9062 (Plugin_manager::claim_file): Create plugin object even if
9063 plugin did not call the add_symbols callback.
9064 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9065 asking for more symbols than were added.
9066 * testsuite/Makefile.am (plugin_test_1): Add test case with
9067 no global symbols.
9068 (empty.syms): New target.
9069 * testsuite/Makefile.in: Regenerate.
9070 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9071 message. Don't call add_symbols if no globals.
9072 (all_symbols_read_hook): Don't provide replacement for empty
9073 claimed file.
9074
9075 2008-12-12 Ian Lance Taylor <iant@google.com>
9076
9077 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9078 r_type == 0 for a local symbol with r_sym == 0.
9079 (scan_relocatable_relocs): Pass r_sym to
9080 local_non_section_strategy.
9081 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9082 r_sym parameter.
9083
9084 * configure.ac: Update test for TLS descriptors: they are
9085 supported as of glibc 2.9.
9086 * configure: Rebuild.
9087
9088 2008-12-11 Ian Lance Taylor <iant@google.com>
9089
9090 PR 7091
9091 * target-reloc.h (Default_scan_relocatable_relocs): For each
9092 function, map r_type == 0 to RELOC_DISCARD.
9093
9094 2008-12-10 Cary Coutant <ccoutant@google.com>
9095
9096 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9097 object to override a kept COMDAT group from a plugin object.
9098
9099 2008-12-09 Ian Lance Taylor <iant@google.com>
9100
9101 PR 7088
9102 * yyscript.y (file_cmd): Handle INPUT.
9103
9104 * testsuite/initpri1.c: Change all declarations to be full
9105 prototypes by adding void, to avoid compiler warnings.
9106
9107 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9108
9109 * options.cc (General_options::parse_plugin_opt): New.
9110 (General_options::add_plugin): The argument now is just the filename.
9111 (General_options::add_plugin_option): New.
9112 * options.h (plugin_opt): New.
9113 (add_plugin): Change argument name.
9114 (add_plugin_option): New.
9115 * plugin.cc (Plugin::load): Don't parse the plugin option.
9116 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9117 (Plugin::add_option): New.
9118 (Plugin::args_): Change type.
9119 (Plugin::filename_): New.
9120 (Plugin_manager::add_plugin_option): New.
9121 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9122 * testsuite/Makefile.in: Regenerate.
9123
9124 2008-12-05 Cary Coutant <ccoutant@google.com>
9125
9126 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9127 Handle --strip-lto-sections option.
9128 * options.h (strip_lto_sections): New option.
9129
9130 2008-12-01 Cary Coutant <ccoutant@google.com>
9131
9132 * plugin.cc (ld_plugin_message): Change format parameter to const.
9133 Fix mismatch between new[] and delete.
9134
9135 2008-11-14 Cary Coutant <ccoutant@google.com>
9136
9137 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9138 instead of -1U.
9139
9140 2008-11-05 Craig Silverstein <csilvers@google.com>
9141
9142 * options.cc (General_options::parse_dynamic_list): New function.
9143 * options.h (General_options): New flags dynamic_list,
9144 dynamic_list_data, dynamic_list_cpp_new, and
9145 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9146 (General_options::in_dynamic_list): New function.
9147 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9148 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9149 (Lex::can_continue_name): Likewise.
9150 (yylex): Likewise.
9151 (read_script_file): New parameter script_options.
9152 (read_dynamic_list): New function.
9153 (Script_options::define_dynamic_list): New function.
9154 (dynamic_list_keyword_parsecodes): New variable.
9155 (dynamic_list_keywords): New variable.
9156 * script.h (Script_options::define_dynamic_list): New function
9157 prototype.
9158 (read_dynamic_list): New function prototype.
9159 * symtab.cc (strprefix): New macro.
9160 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9161 dynamic_list_data, dynamic_list_cpp_new, and
9162 dynamic_list_cpp_typeinfo.
9163 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9164 (dynamic_list_expr): New rule.
9165 (dynamic_list_nodes): Likewise.
9166 (dynamic_list_node): Likewise.
9167 * testsuite/Makefile.am (dynamic_list): New test.
9168 * testsuite/Makefile.in: Regenerated.
9169 * testsuite/dynamic_list.t: New file.
9170 * testsuite/dynamic_list.sh: New file.
9171
9172 2008-11-05 Craig Silverstein <csilvers@google.com>
9173
9174 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9175 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9176 (t11_last): Likewise.
9177 * testsuite/ver_test_6.c (main): Likewise.
9178
9179 2008-10-07 Cary Coutant <ccoutant@google.com>
9180
9181 * options.c (General_options::finalize): Add check for -static and
9182 -shared.
9183 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9184 is not empty.
9185
9186 2008-10-02 Cary Coutant <ccoutant@google.com>
9187
9188 * plugin.cc (make_sized_plugin_object): Fix conditional
9189 compilation to work when not all targets are enabled.
9190
9191 2008-09-29 Cary Coutant <ccoutant@google.com>
9192
9193 * archive.cc (Archive::get_file_and_offset): Use filename instead
9194 of name to get library path.
9195 (Archive::include_member): Unlock external member of a thin archive.
9196
9197 * testsuite/Makefile.am (TEST_AR): New variable.
9198 (thin_archive_test_1): New test.
9199 (thin_archive_test_2): New test.
9200 * testsuite/Makefile.in: Regenerate.
9201 * testsuite/thin_archive_main.cc: New file.
9202 * testsuite/thin_archive_test_1.cc: New file.
9203 * testsuite/thin_archive_test_2.cc: New file.
9204 * testsuite/thin_archive_test_3.cc: New file.
9205 * testsuite/thin_archive_test_4.cc: New file.
9206
9207 2008-09-29 Cary Coutant <ccoutant@google.com>
9208
9209 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9210 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9211 instead of -1U.
9212 (Sized_relobj::do_finalize_local_symbols): Likewise.
9213 (Sized_relobj::map_to_kept_section): Likewise.
9214 * object.h (Sized_relobj::invalid_address): New constant.
9215 (Sized_relobj::do_output_section_offset): Check for invalid_address
9216 and return -1ULL.
9217 * output.cc (Output_reloc::local_section_offset): Use constant
9218 invalid_address instead of -1U.
9219 (Output_reloc::get_address): Likewise.
9220 (Output_section::output_address): Change -1U to -1ULL.
9221 * output.h (Output_reloc::invalid_address): New constant.
9222 * reloc.cc (Sized_relobj::write_sections): Use constant
9223 invalid_address instead of -1U.
9224 (Sized_relobj::relocate_sections): Likewise.
9225 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9226 values for merge sections.
9227 * target-reloc.h (relocate_for_relocatable): Use constant
9228 invalid_address instead of -1U.
9229
9230 2008-09-19 Cary Coutant <ccoutant@google.com>
9231
9232 Add plugin functionality for link-time optimization (LTO).
9233 * configure.ac (plugins): Add --enable-plugins option.
9234 * configure: Regenerate.
9235 * config.in: Regenerate.
9236 * Makefile.am (LIBDL): New variable.
9237 (CCFILES): Add plugin.cc.
9238 (HFILES): Add plugin.h.
9239 (ldadd_var): Add LIBDL.
9240 * Makefile.in: Regenerate.
9241
9242 * archive.cc: Include "plugin.h".
9243 (Archive::setup): Don't preread archive symbols when using a plugin.
9244 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9245 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9246 files.
9247 (Archive::include_member): Add symbols from plugin objects.
9248 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9249 * descriptors.cc (Descriptors::open): Check for file descriptors
9250 abandoned by plugins.
9251 (Descriptors::claim_for_plugin): New function.
9252 * descriptors.h (Descriptors::claim_for_plugin): New function.
9253 (Open_descriptor::is_claimed): New field.
9254 (claim_descriptor_for_plugin): New function.
9255 * fileread.cc (File_read::claim_for_plugin): New function.
9256 * fileread.h (File_read::claim_for_plugin): New function.
9257 (File_read::descriptor): New function.
9258 * gold.cc: Include "plugin.h".
9259 (queue_initial_tasks): Add task to call plugin hooks for generating
9260 new object files.
9261 * main.cc: Include "plugin.h".
9262 (main): Load plugin libraries.
9263 * object.h (Pluginobj): Declare.
9264 (Object::pluginobj): New function.
9265 (Object::do_pluginobj): New function.
9266 (Object::set_target): New function.
9267 * options.cc: Include "plugin.h".
9268 (General_options::parse_plugin): New function.
9269 (General_options::General_options): Initialize plugins_ field.
9270 (General_options::add_plugin): New function.
9271 * options.h (Plugin_manager): Declare.
9272 (General_options): Add --plugin option.
9273 (General_options::has_plugins): New function.
9274 (General_options::plugins): New function.
9275 (General_options::add_plugin): New function.
9276 (General_options::plugins_): New field.
9277 * plugin.cc: New file.
9278 * plugin.h: New file.
9279 * readsyms.cc: Include "plugin.h".
9280 (Read_symbols::do_read_symbols): Check for archive before checking
9281 for ELF file. Call plugin hooks to claim files.
9282 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9283 from a real object file; force override when processing replacement
9284 files.
9285 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9286 (Symbol::init_base_object): Likewise.
9287 (Symbol::init_base_output_data): Likewise.
9288 (Symbol::init_base_output_segment): Likewise.
9289 (Symbol::init_base_constant): Likewise.
9290 (Symbol::init_base_undefined): Likewise.
9291 (Symbol::output_section): Assert that object is not a plugin.
9292 (Symbol_table::add_from_pluginobj): New function.
9293 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9294 undefined.
9295 (Symbol_table::sized_write_globals): Likewise.
9296 (Symbol_table::add_from_pluginobj): Instantiate template.
9297 * symtab.h (Sized_pluginobj): Declare.
9298 (Symbol::in_real_elf): New function.
9299 (Symbol::set_in_real_elf): New function.
9300 (Symbol::in_real_elf_): New field.
9301 (Symbol_table::add_from_pluginobj): New function.
9302
9303 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9304 (LIBDL): New variable.
9305 (LDADD): Add LIBDL.
9306 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9307 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9308 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9309 (MOSTLYCLEANFILES): Likewise.
9310 * testsuite/Makefile.in: Regenerate.
9311 * testsuite/plugin_test.c: New file.
9312 * testsuite/plugin_test_1.sh: New file.
9313 * testsuite/plugin_test_2.sh: New file.
9314
9315 2008-09-16 Ian Lance Taylor <iant@google.com>
9316
9317 * target-reloc.h (relocate_section): Check whether a symbol is
9318 defined by the ABI before reporting an undefined symbol error.
9319 * target.h (Target::is_defined_by_abi): Make parameter const.
9320 (Target::do_is_defined_by_abi): Likewise.
9321 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9322 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9323 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9324 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9325 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9326 * testsuite/Makefile.in: Rebuild.
9327
9328 * fileread.cc (make_view): Add casts to avoid warning.
9329
9330 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9331
9332 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9333 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9334
9335 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9336
9337 * options.h (General_options::output_is_executable): New.
9338 (General_options::output_is_pie): New.
9339 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9340 for shared libraries.
9341 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9342
9343 2008-09-11 Chris Demetriou <cgd@google.com>
9344
9345 * options.h (origin): New -z option.
9346 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9347 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9348 in DT_FLAGS_1.
9349
9350 2008-09-05 Cary Coutant <ccoutant@google.com>
9351
9352 * fileread.cc (File_read::make_view): Add check for attempt to map
9353 beyond end of file.
9354
9355 2008-09-05 Cary Coutant <ccoutant@google.com>
9356
9357 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9358 explicit instantiations.
9359
9360 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9361
9362 PR gold/6858
9363 * options.cc (General_options::finalize): Allow undefined symbols
9364 in shlibs if linking -shared.
9365
9366 PR gold/6859
9367 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9368 symbols as not needing a dynsym entry.
9369
9370 2008-08-20 Craig Silverstein <csilvers@google.com>
9371
9372 * fileread.cc (File_read::open): Do not lock the file unless it
9373 was successfully opened.
9374
9375 2008-08-14 Cary Coutant <ccoutant@google.com>
9376
9377 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9378 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9379 * testsuite/tls_test.cc (struct int128): 128-bit struct
9380 for testing TLS relocs with non-zero addend.
9381 (v12): New TLS variable.
9382 (t12): New test.
9383 (t_last): Add check for v12.
9384 * testsuite/tls_test.h (t12): New function.
9385 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9386
9387 2008-08-13 Ian Lance Taylor <iant@google.com>
9388
9389 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9390 set tls_segment_ or relro_segment_.
9391 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9392 when appropriate.
9393 * output.h (Output_section::clear_is_relro): New function.
9394 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9395 sections specially even when output_data_ is empty.
9396 (Output_segment::maximum_alignment): When first section is relro,
9397 only force alignment for PT_LOAD segments.
9398 * script.cc (script_data_segment_align): New function.
9399 (script_data_segment_relro_end): New function.
9400 * script-c.h (script_data_segment_align): Declare.
9401 (script_data_segment_relro_end): Declare.
9402 * script-sections.h (class Script_sections): Declare
9403 data_segment_align and data_segment_relro_end. Add fields
9404 segment_align_index_ and saw_relro_end_.
9405 * script-sections.cc (class Sections_element): Add set_is_relro
9406 virtual function. Add new bool* parameter to place_orphan_here.
9407 Add get_output_section virtual function.
9408 (class Output_section_definition): Add set_is_relro. Add new
9409 bool* parameter to place_orphan_here. Add get_output_section.
9410 Add is_relro_ field.
9411 (Output_section_definition::Output_section_definition): Initialize
9412 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9413 and is_relro_ fields.
9414 (Output_section_definition::place_orphan_here): Add is_relro
9415 parameter.
9416 (Output_section_definition::set_section_addresses): Set relro for
9417 output section.
9418 (Output_section_definition::alternate_constraint): Likewise.
9419 (class Orphan_output_section): Add new bool* parameter to
9420 place_orphan_here. Add get_output_section.
9421 (Orphan_output_section::place_orphan_here): Add is_relro
9422 parameter.
9423 (Script_sections::Script_sections): Initialize
9424 data_segment_align_index_ and saw_relro_end_.
9425 (Script_sections::data_segment_align): New function.
9426 (Script_sections::data_segment_relro_end): New function.
9427 (Script_sections::place_orphan): Set or clear is_relro.
9428 (Script_sections::set_section_addresses): Force alignment of first
9429 TLS section.
9430 * yyscript.y (exp): Call script_data_segment_align and
9431 script_data_segment_relro_end.
9432 * testsuite/relro_script_test.t: New file.
9433 * testsuite/relro_test.cc (using_script): Declare.
9434 (t1, t2): Test using_script.
9435 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9436 (relro_script_test_SOURCES): Define.
9437 (relro_script_test_DEPENDENCIES): Define.
9438 (relro_script_test_LDFLAGS): Define.
9439 (relro_script_test_LDADD): Define.
9440 (relro_script_test.so): New target.
9441 * testsuite/Makefile.in: Rebuild.
9442
9443 2008-08-06 Cary Coutant <ccoutant@google.com>
9444
9445 * archive.cc (Archive::total_archives, Archive::total_members)
9446 (Archive::total_members_loaded): New variables.
9447 (Archive::setup): Add parameter. Add option to preread
9448 archive symbols.
9449 (Archive::read_armap): Add counter.
9450 (Archive::get_file_and_offset): New function.
9451 (Archive::get_elf_object_for_member): New function.
9452 (Archive::read_all_symbols): New function.
9453 (Archive::read_symbols): New function.
9454 (Archive::add_symbols): Add counters.
9455 (Archive::include_all_members): Use armap to find members if it's
9456 already built.
9457 (Archive::include_member): Skip reading symbols if already read.
9458 Factored code into Archive::get_file_and_offset and
9459 Archive::get_elf_object_for_member. Changed call to
9460 Mapfile::report_include_archive_member.
9461 (Archive::print_stats): New function.
9462 * archive.h: Declare Object and Read_symbols_data classes.
9463 (Archive::Archive): Add initializers for new members.
9464 (Archive::setup): Add parameter.
9465 (Archive::print_stats): New function.
9466 (Archive::total_archives, Archive::total_members)
9467 (Archive::total_members_loaded): New variables.
9468 (Archive::get_file_and_offset): New function.
9469 (Archive::get_elf_object_for_member): New function.
9470 (Archive::read_all_symbols): New function.
9471 (Archive::read_symbols): New function.
9472 (Archive::Archive_member): New class.
9473 (Archive::members_): New member.
9474 (Archive::num_members_): New member.
9475 * main.cc: Include archive.h.
9476 (main): Call Archive::print_stats.
9477 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9478 archive parameter; member_name is now the fully-decorated name.
9479 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9480 * options.h: (General_options): Add --preread-archive-symbols option.
9481 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9482 Archive::setup.
9483
9484 2008-08-04 Ian Lance Taylor <iant@google.com>
9485
9486 * symtab.h (Symbol::use_plt_offset): New function.
9487 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9488 * powerpc.cc (Relocate::relocate): Likewise.
9489 * sparc.cc (Relocate::relocate): Likewise.
9490 * x86_64.cc (Relocate::relocate): Likewise.
9491 * testsuite/weak_plt.sh: New test.
9492 * testsuite/weak_plt_main.cc: New test.
9493 * testsuite/weak_plt_shared.cc: New test.
9494 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9495 (check_PROGRAMS): Add weak_plt.
9496 (check_DATA): Add weak_plt_shared.so.
9497 (weak_plt_main_pic.o, weak_plt): New targets.
9498 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9499 * testsuite/Makefile.in: Rebuild.
9500
9501 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9502 gcctestdir/ld.
9503 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9504 * testsuite/Makefile.in: Rebuild.
9505
9506 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9507
9508 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9509 * Makefile.in: Regenerate.
9510 * po/POTFILES.in: Regenerate.
9511
9512 2008-07-29 Ian Lance Taylor <iant@google.com>
9513
9514 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9515 symbols before other symbols.
9516 * testsuite/script_test_2.cc (test_addr): Declare.
9517 (test_addr_alias): Declare.
9518 (main): Check that test_addr and test_addr_alias have the right
9519 values.
9520 * testsuite/script_test_2.t: Define test_addr_alias and
9521 test_addr.
9522
9523 2008-07-24 Ian Lance Taylor <iant@google.com>
9524
9525 PR 5990
9526 * descriptors.cc: New file.
9527 * descriptors.h: New file.
9528 * gold-threads.h (class Hold_optional_lock): New class.
9529 * fileread.cc: Include "descriptors.h".
9530 (File_read::~File_read): Release descriptor rather than closing
9531 it.
9532 (File_read::open) [file]: Call open_descriptor rather than open.
9533 Set is_descriptor_opened_.
9534 (File_read::open) [memory]: Assert that descriptor is not open.
9535 (File_read::reopen_descriptor): New function.
9536 (File_read::release): Release descriptor.
9537 (File_read::do_read): Make non-const. Reopen descriptor.
9538 (File_read::read): Make non-const.
9539 (File_read::make_view): Reopen descriptor.
9540 (File_read::do_readv): Likewise.
9541 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9542 Update declarations.
9543 * layout.cc: Include "descriptors.h".
9544 (Layout::create_build_id): Use open_descriptor rather than open.
9545 * output.cc: Include "descriptors.h".
9546 (Output_file::open): Use open_descriptor rather than open.
9547 * archive.cc (Archive::const_iterator): Change Archive to be
9548 non-const.
9549 (Archive::begin, Archive::end): Make non-const.
9550 (Archive::count_members): Likewise.
9551 * archive.h (class Archive): Update declarations.
9552 * object.h (Object::read): Make non-const.
9553 * Makefile.am (CCFILES): Add descriptors.cc.
9554 (HFILES): Add descriptors.h.
9555 * Makefile.in: Rebuild.
9556
9557 PR 6716
9558 * gold.h: Always include <clocale>. Add Solaris workarounds
9559 following code in binutils/sysdep.h.
9560
9561 PR 6048
9562 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9563 this->eh_frame_hdr_ is NULL before using it.
9564
9565 * dynobj.cc (Versions::Versions): Update comment.
9566
9567 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9568 the base version name.
9569
9570 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9571 array size plus one.
9572 (Stringpool_template::set_string_offsets): Subtract one from key
9573 before using it as an array index.
9574 (Stringpool_template::get_offset_with_length): Likewise.
9575 (Stringpool_template::write_to_buffer): Likewise.
9576 * stringpool.h (Stringpool_template::get_offset_from_key):
9577 Likewise.
9578
9579 2008-07-23 Ian Lance Taylor <iant@google.com>
9580
9581 PR 6658
9582 * object.h (Merged_symbol_value::value): Do our best to handle a
9583 negative addend.
9584
9585 PR 6647
9586 * script.cc (Version_script_info::get_versions): Don't add empty
9587 version tag to return value.
9588 (Version_script_info::get_symbol_version_helper): Change return
9589 type to bool. Add pversion parameter. Change all callers.
9590 (script_register_vers_node): Don't require a non-NULL tag.
9591 * script.h (class Version_script_info): Update declarations.
9592 (Version_script_info::get_symbol_version): Change return type to
9593 bool. Add version parameter. Change all callers.
9594 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9595 handling. Handle an empty version from a version script.
9596 (Symbol_table::define_special_symbol): Likewise.
9597 * testsuite/ver_test_10.script: New file.
9598 * testsuite/ver_test_10.sh: New file.
9599 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9600 (check_DATA): Add ver_test_10.syms.
9601 (ver_test_10.syms, ver_test_10.so): New target.
9602 * testsuite/Makefile.in: Rebuild.
9603
9604 2008-07-23 Simon Baldwin <simonb@google.com>
9605
9606 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9607 to zero for undefined symbols from dynamic libraries.
9608
9609 2008-07-23 Ian Lance Taylor <iant@google.com>
9610
9611 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9612 Change all callers.
9613 * symtab.h (class Symbol_table): Update declaration.
9614 * testsuite/ver_test_9.cc: New file.
9615 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9616 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9617 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9618 (ver_test_9.so, ver_test_9.o): New targets.
9619 * testsuite/Makefile.in: Rebuild.
9620
9621 2008-07-22 Ian Lance Taylor <iant@google.com>
9622
9623 * options.h (class General_options): Define --check-sections.
9624 * layout.cc (Layout::set_segment_offsets): Handle
9625 --check-sections.
9626
9627 * options.h (class General_options): Define -n/--nmagic and
9628 -N/--omagic.
9629 * options.cc (General_options::finalize): For -n/--nmagic or
9630 -N/--omagic, set -static.
9631 * layout.cc (Layout::attach_allocated_section_to_segment): If
9632 -N/--omagic, don't put read-only and read-write sections in
9633 different segments.
9634 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9635 finding a read-only segment.
9636 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9637 don't set the minimum segment alignment to the common page size,
9638 and don't set the file offset to the address modulo the page size.
9639 * script-sections.cc (Script_sections::create_segments): If
9640 -n/--omagic, don't put read-only and read-write sections in
9641 different segments.
9642
9643 * cref.cc: New file.
9644 * cref.h: New file.
9645 * options.h (class General_options): Add --print-symbol-counts.
9646 * main.cc (main): Issue defined symbol report if requested.
9647 * archive.cc (Archive::interpret_header): Make into a const member
9648 function.
9649 (Archive::add_symbols): Call Input_objects::archive_start and
9650 archive_stop.
9651 (Archive::const_iterator): Define new class.
9652 (Archive::begin, Archive::end): New functions.
9653 (Archive::include_all_members): Rewrite to use iterator.
9654 (Archive::count_members): New function.
9655 * archive.h (class Archive): Update declarations.
9656 (Archive::filename): New function.
9657 * object.cc: Include "cref.h".
9658 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9659 (Sized_relobj::do_get_global_symbol_counts): New function.
9660 (Input_objects::add_object): Add object to cross-referencer.
9661 (Input_objects::archive_start): New function.
9662 (Input_objects::archive_stop): New function.
9663 (Input_objects::print_symbol_counts): New function.
9664 * object.h: Declare Cref and Archive.
9665 (Object::get_global_symbol_counts): New function.
9666 (Object::do_get_global_symbol_counts): New pure virtual function.
9667 (class Sized_relobj): Add defined_count_ field. Update
9668 declarations.
9669 (class Input_objects): Add cref_ field. Update constructor.
9670 Update declarations.
9671 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9672 defined_count_.
9673 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9674 symbol counts.
9675 (Sized_dynobj::do_get_global_symbol_counts): New function.
9676 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9677 defined_count_. Update declarations. Define Symbols typedef.
9678 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9679 parameter. Change all callers.
9680 (Symbol_table::add_from_dynobj): Add sympointers and defined
9681 parameters. Change all callers.
9682 * symtab.h (class Symbol_table): Update declarations.
9683 * Makefile.am (CCFILES): Add cref.cc.
9684 (HFILES): Add cref.h.
9685 * Makefile.in: Rebuild.
9686
9687 2008-07-22 Simon Baldwin <simonb@google.com>
9688
9689 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9690 to zero when writing undefined symbols.
9691
9692 2008-07-22 Ian Lance Taylor <iant@google.com>
9693
9694 * output.cc (Output_section::add_input_section): Don't try to
9695 merge empty merge sections.
9696
9697 2008-07-21 Craig Silverstein <csilvers@google.com>
9698
9699 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9700 Include symbol version in error message.
9701
9702 2008-07-20 Chris Demetriou <cgd@google.com>
9703
9704 * configure.ac (gold_cv_c_random_seed): New configured variable.
9705 (RANDOM_SEED_CFLAGS): New substituted variable.
9706 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9707 * configure: Rebuild.
9708 * Makefile.in: Likewise.
9709 * testsuite/Makefile.in: Likewise.
9710
9711 2008-07-18 Ian Lance Taylor <iant@google.com>
9712
9713 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9714 where we see NAME/NULL and NAME/VERSION as separate symbols.
9715 * testsuite/ver_test_main.cc (main): Call t4.
9716 (t4, t4_2a): Define.
9717 * testsuite/ver_test_2.cc (t4_2): Define.
9718 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9719 * testsuite/ver_test_4.cc (t4_2a): Define.
9720 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9721 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9722
9723 2008-07-17 Ian Lance Taylor <iant@google.com>
9724
9725 * dynobj.cc (Versions::add_def): If we give an error about a
9726 missing version, go ahead and create the version anyhow.
9727
9728 2008-07-10 Ian Lance Taylor <iant@google.com>
9729
9730 Handle output sections with more than 0x7fffffff bytes.
9731 * object.h (class Relobj): Change map_to_output_ to
9732 output_sections_, and just keep a section pointer. Change all
9733 uses. Move comdat group support to Sized_relobj.
9734 (Relobj::is_section_specially_mapped): Remove.
9735 (Relobj::output_section): Remove poff parameter. Change all
9736 callers.
9737 (Relobj::output_section_offset): New function.
9738 (Relobj::set_section_offset): Rewrite.
9739 (Relobj::map_to_output): Remove.
9740 (Relobj::output_sections): New function.
9741 (Relobj::do_output_section_offset): New pure virtual function.
9742 (Relobj::do_set_section_offset): Likewise.
9743 (class Sized_relobj): Add section_offsets_ field. Add comdat
9744 group support from Relobj. Update declarations.
9745 (Sized_relobj::get_output_section_offset): New function.
9746 (Sized_relobj::do_output_section_offset): New function.
9747 (Sized_relobj::do_set_section_offset): New function.
9748 * object.cc (Relobj::output_section_address): Remove.
9749 (Sized_relobj::Sized_relobj): Initialize new fields.
9750 (Sized_relobj::include_section_group): Cast find_kept_object to
9751 Sized_relobj.
9752 (Sized_relobj::include_linkonce_section): Likewise.
9753 (Sized_relobj::do_layout): Use separate arrays for output section
9754 and output offset.
9755 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9756 output_sections.
9757 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9758 output_sections and section_offsets.
9759 (Sized_relobj::write_local_symbols): Likewise.
9760 (map_to_kept_section): Compute output address directly.
9761 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9762 output_sections and section_offsets.
9763 (Sized_relobj::write_sections): Likewise.
9764 (Sized_relobj::relocate_sections): Likewise.
9765 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9766 * output.h (class Output_reloc): Update declarations. Change
9767 u2_.relobj to Sized_relobj*.
9768 (class Output_data_reloc): Change add functions to use
9769 Sized_relobj*.
9770 * output.cc (Output_reloc::Output_reloc): Change relobj to
9771 Sized_relobj*.
9772 (Output_reloc::local_section_offset): Change return type to
9773 Elf_Addr. Use get_output_section_offset.
9774 (Output_reloc::get_address): Likewise.
9775 (Output_section::is_input_address_mapped): Don't call
9776 is_section_specially_mapped.
9777 (Output_section::output_offset): Likewise.
9778 (Output_section::output_address): Likewise.
9779 (Output_section::starting_output_address): Likewise.
9780 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9781 parameter to Sized_relobj*.
9782 (Copy_relocs::need_copy_reloc): Likewise.
9783 (Copy_relocs::save): Likewise.
9784 * copy-relocs.h (class Copy_relocs): Update declarations.
9785 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9786 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9787 * target-reloc.h (relocate_for_relocatable): Change
9788 offset_in_output_section type to Elf_Addr. Change code that uses
9789 it as well.
9790 * layout.cc (Layout::layout): Always set *off.
9791 * mapfile.cc (Mapfile::print_input_section): Use
9792 output_section_offset.
9793 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9794 Sized_relobj*.
9795 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9796 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9797 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9798
9799 2008-07-03 Ian Lance Taylor <iant@google.com>
9800
9801 * layout.cc (Layout::include_section): Do not discard unrecognized
9802 SHT_STRTAB sections.
9803
9804 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9805
9806 * script.cc (Lex::can_continue_name): Make '?' allowable in
9807 version-script names.
9808 * testsuite/version_script.map: Change glob pattern to use '?'
9809
9810 2008-06-30 Manish Singh <yosh@gimp.org>
9811
9812 PR 6585
9813 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9814 Correct typo.
9815
9816 2008-06-30 Ian Lance Taylor <iant@google.com>
9817
9818 PR 6660
9819 PR 6682
9820 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9821 versions]: Don't try to read the value in the contents, since we
9822 don't use it. Use the template endianness when writing.
9823
9824 2008-06-25 Cary Coutant <ccoutant@google.com>
9825
9826 * fileread.cc (File_read::make_view): Assert on zero-length view.
9827 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9828 symbol table when there are no symbols to read.
9829
9830 2008-06-23 Craig Silverstein <csilvers@google.com>
9831
9832 * version.cc (version_string): Bump to 1.7
9833
9834 2008-06-18 Craig Silverstein <csilvers@google.com>
9835
9836 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9837 constant 0xFFFF to type Valtype.
9838 (Powerpc_relocate_functions::rel16_ha): Likewise.
9839
9840 2008-06-17 Ian Lance Taylor <iant@google.com>
9841
9842 * output.h (Output_section::Input_section): Initialize p2align_ to
9843 zero for Output_section_data constructors.
9844 (Output_section::Input_section::addralign): If not an input
9845 section, return the alignment of the Output_section_data.
9846 * testsuite/copy_test.cc: New file.
9847 * testsuite/copy_test_1.cc: New file.
9848 * testsuite/copy_test_2.cc: New file.
9849 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9850 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9851 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9852 (copy_test_1_pic.o, copy_test_1.so): New targets.
9853 (copy_test_2_pic.o, copy_test_2.so): New targets.
9854 * testsuite/Makefile.in: Rebuild.
9855
9856 * script-sections.cc (Script_sections::place_orphan): Initialize
9857 local variable exact.
9858
9859 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9860
9861 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9862
9863 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9864 David S. Miller <davem@davemloft.net>
9865
9866 * powerpc.cc: New file.
9867 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9868 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9869 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9870 * Makefile.in: Rebuild.
9871
9872 2008-06-09 Ian Lance Taylor <iant@google.com>
9873
9874 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9875 <exception>.
9876 (throwing, orig_terminate): New static variables.
9877 (terminate_handler): New static function.
9878 (t2): Set terminate handler.
9879
9880 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9881
9882 PR 6584
9883 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9884 alignment.
9885
9886 2008-05-30 Cary Coutant <ccoutant@google.com>
9887
9888 * archive.cc (Archive::include_all_members) Correct to step
9889 over symbol table and extended name table in thin archives.
9890
9891 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9892
9893 PR 6407
9894 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9895 calculation.
9896
9897 2008-05-28 Caleb Howe <cshowe@google.com>
9898
9899 * reduced_debug_output.cc: New file.
9900 * reduced_debug_output.h: New file.
9901 * options.h (class General_options): Add --strip-debug-non-line.
9902 * options.cc (General_options::finalize): Add strip_debug_non_line
9903 to the strip heirarchy.
9904 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9905 fields.
9906 * layout.cc: Include "reduced_debug_output.h".
9907 (Layout::Layout): Initialize new fields.
9908 (line_only_debug_sections): New static array.
9909 (is_lines_only_debug_sections): New static inline function.
9910 (Layout::include_section): Handle --strip-debug-non-line.
9911 (Layout::make_output_section): If --strip-debug-non-line, build
9912 new output sections for .debug_abbrev and .debug_info.
9913 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9914 gold. Warn about possible overflow.
9915 (read_signed_LEB_128): Likewise.
9916 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9917 (read_signed_LEB_128): Declare.
9918 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9919 (HFILES): Add reduced_debug_output.h.
9920 * Makefile.in: Rebuild.
9921
9922 2008-05-21 Ian Lance Taylor <iant@google.com>
9923
9924 * mapfile.cc: New file.
9925 * mapfile.h: New file.
9926 * options.h (class General_options): Add -M/--print-map and -Map.
9927 * options.cc (General_options::finalize): Make -M equivalent to
9928 -Map -.
9929 * main.cc: Include <cstdio> and "mapfile.h".
9930 (main): Open mapfile if requested.
9931 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9932 constructor. Change caller.
9933 (queue_initial_tasks): Add mapfile parameter. Change caller.
9934 (queue_middle_tasks): Likewise.
9935 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9936 declarations.
9937 * archive.cc: Include "mapfile.h".
9938 (Archive::add_symbols): Add mapfile parameter. Change all
9939 callers. Pass mapfile, symbol, and reason to include_member.
9940 (Archive::include_all_members): Add mapfile parameter. Change all
9941 callers.
9942 (Archive::include_member): Add mapfile, sym, and why parameters.
9943 Change all callers. Report inclusion to map file.
9944 * archive.h: Include "fileread.h".
9945 (class Archive): Update declarations.
9946 (Archive::file): New const method.
9947 (class Add_archive_symbols): Add mapfile_ field. Update
9948 constructor. Change all callers.
9949 * readsyms.h (class Read_symbols): Likewise.
9950 (class Finish_group): Likewise.
9951 (class Read_script): Likewise.
9952 * common.cc: Include "mapfile.h".
9953 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9954 all callers.
9955 (Symbol_table::do_allocate_commons): Likewise.
9956 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9957 symbol allocation to mapfile.
9958 * common.h (class Allocate_commons_task): Add mapfile_ field.
9959 Update constructor. Change all callers.
9960 * symtab.h (class Symbol_table): Update declarations.
9961 * layout.cc: Include "mapfile.h".
9962 (Layout_task_runner::run): Print information to mapfile.
9963 (Layout::create_gold_note): Change Output_data_fixed_space to
9964 Output_data_zero_fill.
9965 (Layout::create_build_id): Likewise.
9966 (Layout::print_to_mapfile): New function.
9967 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9968 constructor. Change caller.
9969 (class Layout): Declare print_to_mapfile.
9970 * output.cc (Output_section::Input_section::print_to_mapfile): New
9971 function.
9972 (Output_section::add_input_section): If producing a map, always
9973 add to input_sections_ list.
9974 (Output_section::do_print_to_mapfile): New function.
9975 (Output_segment::print_sections_to_mapfile): New function.
9976 (Output_segment::print_section_list_to_mapfile): New function.
9977 * output.h: Include "mapfile.h".
9978 (Output_data::print_to_mapfile): New function.
9979 (Output_data::do_print_to_mapfile): New virtual function.
9980 (Output_segment_headers::do_print_to_mapfile): New function.
9981 (Output_file_header::do_print_to_mapfile): New function.
9982 (Output_data_const::do_print_to_mapfile): New function.
9983 (class Output_data_const_buffer): Add map_name_ field. Update
9984 constructor. Change all callers. Add do_print_to_mapfile
9985 function.
9986 (class Output_data_fixed_space): Likewise.
9987 (class Output_data_space): Likewise.
9988 (class Output_data_zero_fill): New class.
9989 (Output_data_strtab::do_print_to_mapfile): New function.
9990 (Output_data_reloc_base::do_print_to_mapfile): New function.
9991 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9992 (Output_data_group::do_print_to_mapfile): New function.
9993 (Output_data_got::do_print_to_mapfile): New function.
9994 (Output_data_dynamic::do_print_to_mapfile): New function.
9995 (Output_symtab_xindex::do_print_to_mapfile): New function.
9996 (class Output_section): Declare do_print_to_mapflie. Declare
9997 print_to_mapfile in Input_section.
9998 (class Output_segment): Declare new functions.
9999 * object.h (Sized_relobj::symbol_count): New function.
10000 * script-sections.cc
10001 (Output_section_element_dot_assignment::set_section_addresses):
10002 Change Output_data_fixed_space to Output_data_zero_fill.
10003 (Output_data_expression::do_print_to_mapfile): New function.
10004 * script.cc (read_input_script): Add mapfile parameter. Change
10005 all callers.
10006 * script.h (read_input_script): Update declaration.
10007 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10008 (Eh_frame::do_print_to_mapfile): New function.
10009 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10010 (Output_merge_string::do_print_to_mapfile): New function.
10011 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10012 function.
10013 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10014 function.
10015 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10016 function.
10017 * Makefile.am (CCFILES): Add mapfile.cc.
10018 (HFILES): Add mapfile.h.
10019 * Makefile.in: Rebuild.
10020
10021 2008-05-19 Ian Lance Taylor <iant@google.com>
10022
10023 * options.h (class General_options): Add -z relro.
10024 * layout.cc (Layout::Layout): Initialize relro_segment_.
10025 (Layout::add_output_section_data): Return the output section.
10026 (Layout::make_output_section): Rcognize relro sections and mark
10027 them appropriately.
10028 (Layout::attach_allocated_section_to_segment): Put relro sections
10029 in a PT_GNU_RELRO segment.
10030 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10031 section as relro.
10032 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10033 PT_TLS segments.
10034 (Layout::linkonce_mapping): Map d.rel.ro.local to
10035 .data.rel.ro.local.
10036 (Layout::output_section_name): Us .data.rel.ro.local for any
10037 section which begins with that.
10038 * layout.h (class Layout): Update add_output_section_data
10039 declaration. Add relro_segment_ field.
10040 * output.cc (Output_section::Output_section): Initialize is_relro_
10041 and is_relro_local_ fields.
10042 (Output_segment::add_output_section): Group relro sections.
10043 (Output_segment::is_first_section_relro): New function.
10044 (Output_segment::maximum_alignment): If there is a relro section,
10045 align the segment to the common page size.
10046 (Output_segment::set_section_addresses): Track whether we are
10047 looking at relro sections. If the last section is a relro
10048 section, align to the common page size.
10049 (Output_segment::set_section_list_addresses): Add in_relro
10050 parameter. Change all callers. Align to the page size when
10051 moving from relro to non-relro section.
10052 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10053 segment.
10054 * output.h (class Output_section): Add is_relro_ and
10055 is_relro_local_ fields.
10056 (Output_section::is_relro): New function.
10057 (Output_section::set_is_relro): New function.
10058 (Output_section::is_relro_local): New function.
10059 (Output_section::set_is_relro_local): New function.
10060 (class Output_segment): Update declarations.
10061 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10062 * sparc.cc (Target_sparc::got_section): Likewise.
10063 * x86_64.cc (Target_x86_64::got_section): Likewise.
10064 * testsuite/relro_test_main.cc: New file.
10065 * testsuite/relro_test.cc: New file.
10066 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10067 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10068 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10069 (relro_test.so, relro_test_pic.o): New targets.
10070 * testsuite/Makefile.in: Rebuild.
10071
10072 2008-05-16 Ian Lance Taylor <iant@google.com>
10073
10074 * output.cc (Output_segment::add_output_section): Remove front
10075 parameter.
10076 * output.h (class Output_segment): Remove
10077 add_initial_output_section and overloaded add_output_section.
10078 Update declaration of remaining add_output_section.
10079 * layout.cc (Layout::create_interp): Call add_output_section
10080 rather than add_initial_output_section.
10081 (Layout::finish_dynamic_section): Likewise.
10082
10083 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10084 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10085 know the dynamic type.
10086 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10087 field. Initialize it in constructor.
10088 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10089 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10090 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10091 reloc.
10092
10093 * output.cc (Output_reloc::get_address): Change return type to
10094 Elf_Addr.
10095 * output.h (class Output_reloc): Update get_address declaration.
10096 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10097 for section addresses.
10098
10099 2008-05-09 Ian Lance Taylor <iant@google.com>
10100
10101 PR 6493
10102 * gold.cc (gold_nomem): Use return value of write.
10103
10104 2008-05-08 Ian Lance Taylor <iant@google.com>
10105
10106 * symtab.c (Symbol::init_base_output_data): Add version
10107 parameter. Change all callers.
10108 (Symbol::init_base_output_segment): Likewise.
10109 (Symbol::init_base_constant): Likewise.
10110 (Symbol::init_base_undefined): Likewise.
10111 (Sized_symbol::init_output_data): Likewise.
10112 (Sized_symbol::init_output_segment): Likewise.
10113 (Sized_symbol::init_constant): Likewise.
10114 (Sized_symbol::init_undefined): Likewise.
10115 (Symbol_table::do_define_in_output_data): If the new symbol has a
10116 version, mark it as the default.
10117 (Symbol_table::do_define_in_output_segment): Likewise.
10118 (Symbol_table::do_define_as_constant): Likewise.
10119 * symtab.h (class Symbol): Update declarations.
10120 (class Sized_symbol): Likewise.
10121 * resolve.cc (Symbol::override_version): New function.
10122 (Symbol::override_base): Call override_version.
10123 (Symbol::override_base_with_special): Likewise.
10124 * testsuite/ver_script_8.script: New file.
10125 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10126 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10127 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10128 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10129
10130 2008-05-06 Ian Lance Taylor <iant@google.com>
10131
10132 PR 6049
10133 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10134 functions.
10135 (class General_options): Remove existing --undefined, and add
10136 --no-undefined instead. Add new --undefined as synonym for -u.
10137 * archive.cc (Archive::add_symbols): Check whether symbol was
10138 named with -u.
10139 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10140 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10141 all uses. Add IS_UNDEFINED. Update declarations to split
10142 different versions of init_base. Declare init_base_undefined.
10143 (Symbol::is_defined): Handle IS_UNDEFINED.
10144 (Symbol::is_undefined): Likewise.
10145 (Symbol::is_weak_undefined): Call is_undefined.
10146 (Symbol::is_absolute): Handle IS_CONSTANT.
10147 (class Sized_symbol): Update declarations to split different
10148 versions of init. Declare init_undefined.
10149 (class Symbol_table): Declare new functions.
10150 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10151 Change all callers.
10152 (Symbol::init_base_output_data): Likewise.
10153 (Symbol::init_base_output_segment): Likewise.
10154 (Symbol::init_base_constant): Likewise.
10155 (Symbol::init_base_undefined): New function.
10156 (Sized_symbol::init_object): Rename from init. Change all
10157 callers.
10158 (Sized_symbol::init_output_data): Likewise.
10159 (Sized_symbol::init_output_segment): Likewise.
10160 (Sized_symbol::init_constant): Likewise.
10161 (Sized_symbol::init_undefined): New function.
10162 (Symbol_table::add_undefined_symbols_from_command_line): New
10163 function.
10164 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10165 function.
10166 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10167 (Symbol::output_section): Likewise.
10168 (Symbol::set_output_section): Likewise.
10169 (Symbol_table::sized_finalize_symbol): Likewise.
10170 (Symbol_table::sized_write_globals): Likewise.
10171 * resolve.cc (Symbol_table::should_override): Likewise.
10172 (Symbol::override_base_with_special): Likewise.
10173
10174 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10175 symbol, change it to have default visibility.
10176 * testsuite/protected_1.cc: New file.
10177 * testsuite/protected_2.cc: New file.
10178 * testsuite/protected_3.cc: New file.
10179 * testsuite/protected_main_1.cc: New file.
10180 * testsuite/protected_main_2.cc: New file.
10181 * testsuite/protected_main_3.cc: New file.
10182 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10183 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10184 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10185 (protected_1.so): New target.
10186 (protected_1_pic.o, protected_2_pic.o): New targets.
10187 (protected_3_pic.o): New target.
10188 (check_PROGRAMS): Add protected_2.
10189 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10190 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10191 * testsuite/Makefile.in: Rebuild.
10192
10193 * options.h (DEFINE_var): Add set_user_set_##varname__.
10194 (DEFINE_bool_alias): New macro.
10195 (class General_options): Define -Bstatic using DEFINE_bool_alias
10196 rather than DEFINE_special. Add --undefined as an alias for -z
10197 defs.
10198 * options.cc (General_options::parse_Bstatic): Remove.
10199
10200 * options.h (class General_options): Add --fatal-warnings.
10201 * main.cc (main): Implement --fatal-warnings.
10202 * errors.h (Errors::warning_count): New function.
10203
10204 * options.h (class General_options): Add -Bsymbolic-functions.
10205 * symtab.h (Symbol::is_preemptible): Check for
10206 -Bsymbolic-functions.
10207
10208 2008-05-05 Ian Lance Taylor <iant@google.com>
10209
10210 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10211 as noVARNAME rather than no-VARNAME.
10212 (class General_options): Add option -z combreloc.
10213 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10214 get_address.
10215 (Output_reloc::sort_before) [SHT_REL]: New function.
10216 (Output_reloc::sort_before) [SHT_RELA]: New function.
10217 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10218 Sort_relocs_comparison.
10219 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10220 parameter. Change all callers.
10221 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10222 sort_relocs parameter. Change all callers.
10223 * output.cc (Output_reloc::get_address): New function, broken out
10224 of write_rel.
10225 (Output_reloc::write_rel): Call it.
10226 (Output_reloc::compare): New function.
10227 (Output_data_reloc_base::do_write): Optionally sort relocs.
10228
10229 * configure.ac: If targ_extra_obj is set, link it in.
10230 * configure.tgt: Initialize all variables.
10231 (x86_64*): Set targ_extra_obj and targ_extra_size.
10232 * configure: Rebuild.
10233
10234 * object.cc (Sized_relobj::include_section_group): Adjust section
10235 indexes read from group data. Build vector to pass to
10236 layout_group.
10237 * layout.cc (Layout::layout_group): Add flags and shndxes
10238 parameters. Remove contents parameter. Change caller. Update
10239 explicit instantiations.
10240 * layout.h (class Layout): Update layout_group declaration.
10241 * output.cc (Output_data_group::Output_data_group): Add flags and
10242 input_shndxes parameters. Remove contents parameter. Change
10243 caller.
10244 (Output_data_group::do_write): Change input_sections_ to
10245 input_shndxes_.
10246 * output.h (class Output_data_group): Update constructor
10247 declaration. Rename input_sections_ to input_shndxes_.
10248 * testsuite/many_sections_test.cc: Add template.
10249
10250 2008-04-30 Cary Coutant <ccoutant@google.com>
10251
10252 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10253
10254 * layout.cc (Layout::include_section): Refactored check for debug
10255 info section.
10256 (Layout::add_comdat): Add new parameters. Change type
10257 of signature parameter. Add object and shndx to signatures table.
10258 (Layout::find_kept_object): New function.
10259 * layout.h: Include <cstring>.
10260 (Layout::is_debug_info_section): New function.
10261 (Layout::add_comdat): Add new parameters.
10262 (Layout::find_kept_object): New function.
10263 (Layout::Kept_section): New struct.
10264 (Layout::Signatures): Change type of map range.
10265 * object.cc (Relobj::output_section_address): New function.
10266 (Sized_relobj::include_section_group): Add new parameters. Change
10267 calls to Layout::add_comdat. Change to build table of kept comdat
10268 groups and table mapping discarded sections to kept sections.
10269 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10270 (Sized_relobj::do_layout): Change calls to include_section_group and
10271 include_linkonce_section.
10272 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10273 value to zero when section is discarded.
10274 (Sized_relobj::map_to_kept_section): New function.
10275 * object.h (Relobj::output_section_address): New function.
10276 (Relobj::Comdat_group): New type.
10277 (Relobj::find_comdat_group): New function.
10278 (Relobj::Comdat_group_table): New type.
10279 (Relobj::Kept_comdat_section): New type.
10280 (Relobj::Kept_comdat_section_table): New type.
10281 (Relobj::add_comdat_group): New function.
10282 (Relobj::set_kept_comdat_section): New function.
10283 (Relobj::get_kept_comdat_section): New function.
10284 (Relobj::comdat_groups_): New field.
10285 (Relobj::kept_comdat_sections_): New field.
10286 (Symbol_value::input_value): Update comment.
10287 (Sized_relobj::map_to_kept_section) New function.
10288 (Sized_relobj::include_linkonce_section): Add new parameter.
10289 * target-reloc.h (Comdat_behavior): New type.
10290 (get_comdat_behavior): New function.
10291 (relocate_section): Add code to map a discarded section to the
10292 corresponding kept section when applying a relocation.
10293
10294 2008-04-30 Craig Silverstein <csilvers@google.com>
10295
10296 * dwarf_reader.cc (next_generation_count): New static var.
10297 (Addr2line_cache_entry): New struct.
10298 (addr2line_cache): New static var.
10299 (Dwarf_line_info::one_addr2line): Added caching.
10300 (Dwarf_line_info::clear_addr2line_cache): New function.
10301 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10302 cache-size parameter.
10303 (Dwarf_line_info::one_addr2line_cache): New function.
10304 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10305 new cache-size argument to one_addr2line(), and clear cache.
10306
10307 2008-04-28 Cary Coutant <ccoutant@google.com>
10308
10309 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10310 R_386_PC8 relocations.
10311
10312 2008-04-23 Ian Lance Taylor <iant@google.com>
10313
10314 * object.cc (Sized_relobj::include_section_group): Check for
10315 invalid section group.
10316
10317 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10318 header size.
10319
10320 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10321 than read for file header.
10322 * archive.cc (Archive::include_member): Likewise.
10323
10324 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10325
10326 * aclocal.m4: Regenerate.
10327 * configure: Regenerate.
10328
10329 2008-04-19 Ian Lance Taylor <iant@google.com>
10330
10331 * version.cc (version_string): Bump to 1.6.
10332
10333 * testsuite/Makefile.am (many_sections_r_test): New target.
10334 (many_sections_r_test_SOURCES): Remove.
10335 (many_sections_r_test_DEPENDENCIES): Remove.
10336 (many_sections_r_test_LDFLAGS): Remove.
10337 (many_sections_r_test_LDADD): Remove.
10338
10339 * object.cc (Sized_relobj::do_add_symbols): Always pass
10340 local_symbol_count_ to add_from_relobj.
10341
10342 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10343 every thousand variables.
10344 * testsuite/Makefile.in: Rebuild.
10345
10346 * object.cc (Xindex::initialize_symtab_xindex): New function.
10347 (Xindex::read_symtab_xindex): New function.
10348 (Xindex::sym_xindex_to_shndx): New function.
10349 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10350 available.
10351 (Sized_relobj::do_initialize_xindex): New function.
10352 (Sized_relobj::do_read_symbols): Adjust section links.
10353 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10354 parameter. Change all callers.
10355 (Sized_relobj::include_section_group): Adjust section links and
10356 symbol section indexes.
10357 (Sized_relobj::do_layout): Adjust section links.
10358 (Sized_relobj::do_count_local_symbols): Adjust section links and
10359 symbol section indexes.
10360 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10361 ordinary and special symbols.
10362 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10363 dynsym_xindex parameters. Change all callers. Adjust section
10364 links. Use SHN_XINDEX when needed.
10365 (Sized_relobj::get_symbol_location_info): Adjust section links.
10366 Don't get fooled by special symbols.
10367 * object.h (class Xindex): Define.
10368 (class Object): Add xindex_ parameter. Declare virtual functoin
10369 do_initialize_xindex.
10370 (Object::adjust_sym_shndx): New function.
10371 (Object::set_xindex): New protected function.
10372 (class Symbol_value): Add is_ordinary_shndx_ field.
10373 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10374 (Symbol_value::value): Assert ordinary section.
10375 (Symbol_value::initialize_input_to_output_map): Likewise.
10376 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10377 Change all callers.
10378 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10379 all callers.
10380 (class Sized_relobj): Update declarations.
10381 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10382 parameter. Change all callers.
10383 (Sized_relobj::adjust_shndx): New function.
10384 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10385 field.
10386 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10387 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10388 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10389 (Sized_dynobj::read_dynsym_section): Adjust section links.
10390 (Sized_dynobj::read_dynamic): Likewise.
10391 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10392 section links.
10393 (Sized_dynobj::do_initialize_xindex): New function.
10394 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10395 do_initialize_xindex.
10396 (Sized_dynobj::adjust_shndx): New function.
10397 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10398 dynsym_xindex_ fields.
10399 (Layout::finalize): Add a call to set_section_indexes before
10400 creating the symtab sections.
10401 (Layout::set_section_indexes): Don't do anything if the section
10402 already has a section index.
10403 (Layout::create_symtab_sections): Add shnum parameter. Change
10404 caller. Create .symtab_shndx section if needed.
10405 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10406 caller.
10407 (Layout::allocated_output_section_count): New function.
10408 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10409 needed.
10410 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10411 fields. Update declarations.
10412 (Layout::symtab_xindex): New function.
10413 (Layout::dynsym_xindex): New function.
10414 (class Write_symbols_task): Add layout_ field.
10415 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10416 Change caller.
10417 * output.cc (Output_section_headers::Output_section_headers): Add
10418 shstrtab_section parameter. Change all callers.
10419 (Output_section_headers::do_sized_write): Store overflow values
10420 for section count and section string table section index in
10421 section header zero.
10422 (Output_file_header::do_sized_write): Check for overflow of
10423 section count and section string table section index.
10424 (Output_symtab_xindex::do_write): New function.
10425 (Output_symtab_xindex::endian_do_write): New function.
10426 * output.h (class Output_section_headers): Add shstrtab_section_.
10427 Update declarations.
10428 (class Output_symtab_xindex): Define.
10429 (Output_section::has_out_shndx): New function.
10430 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10431 field.
10432 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10433 Change all callers.
10434 (Sized_symbol::init): Likewise.
10435 (Symbol::output_section): Check for ordinary symbol.
10436 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10437 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10438 callers.
10439 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10440 Change all callers. Simplify handling of symbols from sections
10441 not included in the link.
10442 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10443 distinction.
10444 (Weak_alias_sorter::operator()): Assert that symbols are
10445 ordinary.
10446 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10447 distinction.
10448 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10449 parameters. Change all callers.
10450 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10451 symbol distinction. Use SHN_XINDEX when needed.
10452 (Symbol_table::write_section_symbol): Add symtab_xindex
10453 parameter. Change all callers.
10454 (Symbol_table::sized_write_section_symbol): Likewise. Use
10455 SHN_XINDEX when needed.
10456 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10457 declarations.
10458 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10459 (Symbol::is_defined): Check is_ordinary.
10460 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10461 (Symbol::is_absolute, Symbol::is_common): Likewise.
10462 (class Sized_symbol): Update declarations.
10463 (class Symbol_table): Update declarations.
10464 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10465 parameters. Change all callers.
10466 (Sized_symbol::override): Likewise.
10467 (Symbol_table::override): Likewise.
10468 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10469 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10470 is_ordinary, and orig_st_shndx parameters. Change all callers.
10471 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10472 to be in an ordinary section.
10473 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10474 object and is_ordinary parameters. Change all callers.
10475 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10476 Change all callers. Don't add undefined or non-ordinary symbols
10477 to reloc_map_.
10478 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10479 Change all callers.
10480 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10481 declarations.
10482 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10483 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10484 (Sized_relobj::relocate_sections): Likewise.
10485 * target-reloc.h (scan_relocs): Adjust section symbol index.
10486 (scan_relocatable_relocs): Likewise.
10487 * i386.cc (Scan::local): Check for ordinary symbols.
10488 * sparc.cc (Scan::local): Likewise.
10489 * x86_64.cc (Scan::local): Likewise.
10490 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10491 to symbol_section_and_value.
10492 * testsuite/many_sections_test.cc: New file.
10493 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10494 (check_PROGRAMS): Add many_sections_test.
10495 (many_sections_test_SOURCES): Define.
10496 (many_sections_test_DEPENDENCIES): Define.
10497 (many_sections_test_LDFLAGS): Define.
10498 (BUILT_SOURCES): Add many_sections_define.h.
10499 (many_sections_define.h): New target.
10500 (BUILT_SOURCES): Add many_sections_check.h.
10501 (many_sections_check.h): New target.
10502 (check_PROGRAMS): Add many_sections_r_test.
10503 (many_sections_r_test_SOURCES): Define.
10504 (many_sections_r_test_DEPENDENCIES): Define.
10505 (many_sections_r_test_LDFLAGS): Define.
10506 (many_sections_r_test_LDADD): Define.
10507 (many_sections_r_test.o): New target.
10508 * testsuite/Makefile.in: Rebuild.
10509
10510 2008-04-17 Cary Coutant <ccoutant@google.com>
10511
10512 * errors.cc (Errors::info): New function.
10513 (gold_info): New function.
10514 * errors.h (Errors::info): New function.
10515 * gold.h (gold_info): New function.
10516 * object.cc (Input_objects::add_object): Print trace output.
10517 * options.cc (options::parse_set): New function.
10518 (General_options::parse_wrap): Deleted.
10519 (General_options::General_options): Deleted initializer.
10520 * options.h (options::String_set): New typedef.
10521 (options::parse_set): New function.
10522 (DEFINE_set): New macro.
10523 (General_options::wrap): Changed to use DEFINE_set. Changed
10524 callers of any_wrap_symbols and is_wrap_symbol.
10525 (General_options::trace, General_options::trace_symbol):
10526 New options.
10527 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10528 (General_options::wrap_symbols_): Deleted.
10529 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10530
10531 2008-04-17 David S. Miller <davem@davemloft.net>
10532
10533 * options.cc (General_options::parse_V): New function.
10534 * options.h: Add entries for -V and -Qy.
10535
10536 2008-04-17 Ian Lance Taylor <iant@google.com>
10537
10538 * common.cc (Symbol_table::allocate_commons): Remove options
10539 parameter. Change caller.
10540 (Symbol_table::do_allocate_commons): Remove options parameter.
10541 Change caller. Just call do_allocate_commons_list twice.
10542 (Symbol_table::do_allocate_commons_list): New function, broken out
10543 of do_allocate_commons.
10544 * common.h (class Allocate_commons_task): Remove options_ field.
10545 Update constructor.
10546 * symtab.cc (Symbol_table::Symbol_table): Initialize
10547 tls_commons_.
10548 (Symbol_table::add_from_object): Put TLS common symbols on
10549 tls_commons_ list.
10550 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10551 which are IN_OUTPUT_DATA.
10552 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10553 allocate_commons and do_allocate_commons declarations. Declare
10554 do_allocate_commons_list.
10555 * gold.cc (queue_middle_tasks): Update creation of
10556 Allocate_commons_task to not pass options.
10557 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10558 (TLS_TEST_C_FLAGS): New variable.
10559 (tls_test_c_pic.o): New target.
10560 (tls_test_shared.so): Link in tls_test_c_pic.o.
10561 (tls_test_c_pic_ie.o): New target.
10562 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10563 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10564 (tls_test_c.o): New target.
10565 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10566 (tls_pic_test_LDADD): Likewise.
10567 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10568 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10569 (tls_test_c_gnu2.o): New target.
10570 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10571 tls_test_c_gnu2.o.
10572 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10573 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10574 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10575 * testsuite/tls_test.cc: Include "config.h".
10576 (t_last): Call t11_last.
10577 * testsuite/tls_test.h (t11, t11_last): Declare.
10578 * testsuite/tls_test_c.c: New file.
10579 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10580 * configure.ac: Check for OpenMP support.
10581 * configure, config.in, Makefile.in: Rebuild.
10582 * testsuite/Makefile.in: Rebuild.
10583
10584 2008-04-16 Cary Coutant <ccoutant@google.com>
10585
10586 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10587 (Target_i386::tls_base_symbol_defined_): New field.
10588 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10589 (Target_i386::Scan::global): Likewise.
10590 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10591 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10592 (Target_x86_64::tls_base_symbol_defined_): New field.
10593 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10594 (Target_x86_64::Scan::global): Likewise.
10595
10596 2008-04-16 Cary Coutant <ccoutant@google.com>
10597
10598 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10599 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10600 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10601 building shared libraries.
10602 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10603 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10604 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10605 * testsuite/Makefile.in: Rebuild.
10606 * testsuite/weak_undef.h: New file.
10607 * testsuite/weak_undef_file1.cc: Add extra test cases.
10608 * testsuite/weak_undef_file2.cc: Likewise.
10609 * testsuite/weak_undef_test.cc: Likewise.
10610
10611 2008-04-16 David S. Miller <davem@davemloft.net>
10612
10613 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10614 Add issued_non_pic_error_ field. Declare check_non_pic.
10615 (Target_sparc::Scan::check_non_pic): New function.
10616 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10617 (Target_sparc::Scan::global): Likewise.
10618
10619 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10620 * configure: Rebuild.
10621
10622 * options.h (DEFINE_enable): New macro.
10623 (new_dtags): New enable option.
10624 (initfirst, interpose, loadfltr, nodefaultlib,
10625 nodelete, nodlopen, nodump): New -z options.
10626 * layout.cc (Layout:finish_dynamic_section): If new
10627 dtags enabled, emit DT_RUNPATH. Also, emit a
10628 DT_FLAGS_1 containing any specified -z flags.
10629
10630 2008-04-16 Ian Lance Taylor <iant@google.com>
10631
10632 * copy-relocs.cc: New file.
10633 * copy-relocs.h: New file.
10634 * reloc.cc: Remove Copy_relocs code.
10635 * reloc.h: Likewise.
10636 * reloc-types.h (struct Reloc_types) [both versions]: Add
10637 get_reloc_addend_noerror.
10638 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10639 variants of add_global which take an addend which must be zero.
10640 * i386.cc: Include "copy-relocs.h".
10641 (class Target_i386): Change type of copy_relocs_ to variable,
10642 update initializer.
10643 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10644 Change all callers.
10645 (Target_i386::do_finalize_sections): Change handling of
10646 copy_relocs_.
10647 * sparc.cc: Include "copy-relocs.h".
10648 (class Target_sparc): Change type of copy_relocs_ to variable,
10649 update initializer.
10650 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10651 Change all callers.
10652 (Target_sparc::do_finalize_sections): Change handling of
10653 copy_relocs_.
10654 * x86_64.cc: Include "copy-relocs.h".
10655 (class Target_x86_64): Change type of copy_relocs_ to variable,
10656 update initializer.
10657 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10658 class. Change all callers.
10659 (Target_x86_64::do_finalize_sections): Change handling of
10660 copy_relocs_.
10661 * Makefile.am (CCFILES): Add copy-relocs.cc.
10662 (HFILES): Add copy-relocs.h.
10663
10664 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10665
10666 * testsuite/script_test_4.sh: Permit leading zeroes.
10667
10668 2008-04-15 Ian Lance Taylor <iant@google.com>
10669
10670 * script-sections.cc (Script_sections::create_segments): Use
10671 header_size_adjustment even when there is enough room for the
10672 headers.
10673 * testsuite/script_test_4.sh: New file.
10674 * testsuite/script_test_4.t: New file.
10675 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10676 (check_DATA): Add script_test_4.stdout.
10677 (MOSTLYCLEANFILES): Likewise.
10678 (script_test_4): New target.
10679 (script_test_4.stdout): New target.
10680 * testsuite/Makefile.in: Rebuild.
10681
10682 * sparc.cc: Add definitions for Output_data_plt_sparc class
10683 constants.
10684
10685 2008-04-14 David S. Miller <davem@davemloft.net>
10686
10687 * sparc.cc: New file.
10688 * Makefile.am (TARGETSOURCES): Add sparc.cc
10689 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10690 * configure.tgt: Document targ_extra_size and
10691 targ_extra_big_endian. Add entries for sparc-* and
10692 sparc64-*.
10693 * configure.ac: Handle targ_extra_size and
10694 targ_extra_big_endian.
10695 * Makefile.in: Rebuild.
10696 * configure: Likewise.
10697 * po/POTFILES.in: Likewise.
10698 * po/gold.pot: Likewise.
10699
10700 2008-04-14 Ian Lance Taylor <iant@google.com>
10701
10702 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10703 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10704 in the name/type/flags to section mapping. Don't call
10705 allocate_output_section.
10706 (Layout::choose_output_section): Change parameter from adjust_name
10707 to is_input_section. Don't permit input sections after sections
10708 are attached to segments. Don't call allocate_output_section.
10709 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10710 not write_enable_output_section.
10711 (Layout::make_output_section): Don't push to
10712 unattached_section_list_ nor call attach_to_segment. Call
10713 attach_section_to_segment if sections are attached.
10714 (Layout::attach_sections_to_segments): New function.
10715 (Layout::attach_section_to_segment): New function.
10716 (Layout::attach_allocated_section_to_segment): Rename from
10717 attach_to_segment. Remove flags parameter.
10718 (Layout::allocate_output_section): Remove function.
10719 (Layout::write_enable_output_section): Remove function.
10720 * layout.h (class Layout): Update for above changes. Add new
10721 field sections_are_attached_.
10722 * output.h (Output_section::update_flags_for_input_section): New
10723 function.
10724 * output.cc (Output_section::add_input_section): Call
10725 update_flags_for_input_section.
10726 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10727
10728 2008-04-11 Cary Coutant <ccoutant@google.com>
10729
10730 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10731 thought unnecessary.
10732 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10733
10734 2008-04-11 Ian Lance Taylor <iant@google.com>
10735
10736 * output.h (class Output_section_data): Remove inline definition
10737 of set_addralign.
10738 * output.cc (Output_section_data::set_addralign): New function.
10739
10740 2008-04-11 Cary Coutant <ccoutant@google.com>
10741
10742 Add support for TLS descriptors for i386 and x86_64.
10743 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10744 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10745 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10746 GOT_TYPE_TLS_DESC.
10747 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10748 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10749 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10750 relocations.
10751 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10752 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10753 Fix problem with initial-exec relocations.
10754 (Target_i386::Relocate::relocate_tls): Likewise.
10755 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10756 relaxation.
10757 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10758 support for section-plus-offset dynamic table entries.
10759 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10760 (Output_data_dynamic::Dynamic_entry): Add support for
10761 section-plus-offset dynamic table entries.
10762 (Output_data_dynamic::Classification): Likewise.
10763 (Output_data_dynamic::classification_): Renamed offset_.
10764 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10765 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10766 (Target_x86_64::make_plt_section): New function.
10767 (Target_x86_64::reserve_tlsdesc_entries): New function.
10768 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10769 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10770 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10771 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10772 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10773 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10774 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10775 add extra PLT entry for TLS descriptors.
10776 (Output_data_plt_x86_64::got_): New field.
10777 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10778 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10779 fields.
10780 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10781 descriptors.
10782 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10783 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10784 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10785 R_386_TLS_DESC_CALL relocations.
10786 (Target_x86_64::Scan::global): Likewise.
10787 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10788 for TLS descriptors.
10789 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10790 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10791 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10792 GD-to-IE relaxation.
10793 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10794 and TLS_DESCRIPTORS.
10795 * Makefile.in: Rebuild.
10796 * configure: Rebuild.
10797 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10798 (tls_test_shared2.so): New target.
10799 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10800 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10801 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10802 (tls_shared_gd_to_ie_test_LDADD): New variable.
10803 (tls_shared_gnu2_gd_to_ie_test): New target.
10804 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10805 New targets.
10806 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10807 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10808 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10809 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10810 (tls_shared_gnu2_test): New target.
10811 (tls_test_gnu2_shared.so): New target.
10812 (tls_shared_gnu2_test_SOURCES): New variable.
10813 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10814 (tls_shared_gnu2_test_LDFLAGS): New variable.
10815 (tls_shared_gnu2_test_LDADD): New variable.
10816 * testsuite/Makefile.in: Rebuild.
10817 * testsuite/Makefile.
10818
10819 2008-04-11 Ian Lance Taylor <iant@google.com>
10820
10821 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10822 justsyms.t.
10823 * testsuite/Makefile.in: Rebuild.
10824
10825 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10826 long.
10827 * testsuite/script_test_2.cc (main): Adjust test.
10828
10829 2008-04-11 David S. Miller <davem@davemloft.net>
10830 Ian Lance Taylor <iant@google.com>
10831
10832 * options.h (General_options): Add entries for '-Y' and
10833 '-relax'.
10834 * options.cc (General_options:finalize): If -Y was used, add those
10835 entries to the library path instead of the default "/lib" and
10836 "/usr/lib".
10837
10838 2008-04-11 David S. Miller <davem@davemloft.net>
10839
10840 * testsuite/justsyms.t: Start at 0x100.
10841 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10842 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10843 long.
10844 * testsuite/script_test_2.cc: Adjust string and section length
10845 checks.
10846
10847 2008-04-09 Ian Lance Taylor <iant@google.com>
10848
10849 PR gold/5996
10850 * script-sections.cc (Sections_element::allocate_to_segment): Add
10851 orphan parameter.
10852 (Output_section_definition::allocate_to_segment): Likewise.
10853 (Orphan_output_section::allocate_to_segment): Likewise.
10854 (Script_sections::attach_sections_using_phdrs_clause): Don't
10855 propagate non-PT_LOAD segments to orphan sections.
10856 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10857 readelf rather than objdump.
10858 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10859 .interp section and PT_INTERP segment are the same size.
10860 * testsuite/Makefile.in: Rebuild.
10861
10862 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10863 aliases for symbols defined in the same object.
10864 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10865 (weak_alias_test_SOURCES): New variable.
10866 (weak_alias_test_DEPENDENCIES): New variable.
10867 (weak_alias_test_LDFLAGS): New variable.
10868 (weak_alias_test_LDADD): New variable.
10869 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10870 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10871 (weak_alias_test_3.o): New target.
10872 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10873 * testsuite/weak_alias_test_main.cc: New file.
10874 * testsuite/weak_alias_test_1.cc: New file.
10875 * testsuite/weak_alias_test_2.cc: New file.
10876 * testsuite/weak_alias_test_3.cc: New file.
10877
10878 2008-04-08 Ian Lance Taylor <iant@google.com>
10879
10880 * options.h (class General_options): Add --noinhibit-exec option.
10881 * main.cc (main): Check --noinhibit-exec.
10882
10883 * options.h (class General_options): Define --wrap as a special
10884 option. Add wrap_symbols_ field.
10885 (General_options::any_wrap_symbols): New function.
10886 (General_options::is_wrap_symbol): New function.
10887 * options.cc (General_options::parse_wrap): New function.
10888 (General_options::General_options): Initialize wrap_symbols_.
10889 * symtab.cc (Symbol_table::wrap_symbol): New function.
10890 (Symbol_table::add_from_object): Handle --wrap.
10891 * symtab.h (class Symbol_table): Declare wrap_symbol.
10892 * target.h (Target::wrap_char): New function.
10893 (Target::Target_info): Add wrap_char field.
10894 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10895 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10896 * testsuite/testfile.cc (Target_test::test_target_info):
10897 Likewise.
10898
10899 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10900 there is one.
10901
10902 * layout.h (class Layout): Add added_eh_frame_data_ field.
10903 * layout.cc (Layout::Layout): Initialize new field.
10904 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10905 output section until we find a section we merged successfully.
10906 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10907 that the size be non-zero.
10908
10909 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10910 qualifier.
10911
10912 2008-04-08 Craig Silverstein <csilvers@google.com>
10913
10914 * configure.ac: Export new conditional variable HAVE_ZLIB.
10915 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10916 on HAVE_ZLIB.
10917 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10918 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10919
10920 2008-04-07 Ian Lance Taylor <iant@google.com>
10921
10922 * version.cc (version_string): Set to "1.5".
10923
10924 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10925 Add issued_non_pic_error_ field. Declare check_non_pic.
10926 (Target_x86_64::Scan::check_non_pic): New function.
10927 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10928 (Target_x86_64::Scan::global): Likewise.
10929
10930 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10931 addend parameter. Change caller. Handle merge sections.
10932 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10933 Address to Addend. Don't add in the result of
10934 local_section_offset, pass down the addend and use the returned
10935 value.
10936 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10937 Update declarations of local_section_offset and symbol_value.
10938 * testsuite/two_file_test_1.cc (t18): New function.
10939 * testsuite/two_file_test_2.cc (f18): New function.
10940 * testsuite/two_file_test_main.cc (main): Call t18.
10941 * testsuite/two_file_test.h (t18, f18): Declare.
10942
10943 * configure.ac: Don't test for objdump, c++filt, or readelf.
10944 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10945 conditionals.
10946 (TEST_READELF): New variable.
10947 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10948 (check_PROGRAMS): Add two_file_strip_test.
10949 (two_file_strip_test): New target.
10950 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10951 (two_file_same_shared_strip_test_SOURCES): New variable.
10952 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10953 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10954 (two_file_same_shared_strip_test_LDADD): New variable.
10955 (two_file_shared_strip.so): New target.
10956 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10957 (ver_test_5.syms, ver_test_7.syms): Likewise.
10958 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10959 (strip_test_3.stdout): Use TEST_OBJDUMP.
10960 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10961
10962 2008-04-04 Cary Coutant <ccoutant@google.com>
10963
10964 * symtab.h (Symbol::is_weak_undefined): New function.
10965 (Symbol::is_strong_undefined): New function.
10966 (Symbol::is_absolute): New function.
10967 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10968 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10969 absolute symbols.
10970 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10971 (weak_undef_test): New target.
10972 * testsuite/Makefile.in: Rebuild.
10973 * testsuite/weak_undef_file1.cc: New file.
10974 * testsuite/weak_undef_file2.cc: New file.
10975 * testsuite/weak_undef_test.cc: New file.
10976
10977 2008-04-03 Craig Silverstein <csilvers@google.com>
10978
10979 * compressed_output.h (class Output_compressed_section): Use
10980 unsigned buffer.
10981 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10982 add zlib header.
10983 (zlib_compressed_suffix): Removed.
10984 (Output_compressed_section::set_final_data_size): Use unsigned
10985 buffers.
10986 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10987 Fix linker invocation.
10988 (flagstest_o_specialfile_and_compress_debug_sections):
10989 Likewise.
10990 * testsuite/Makefile.in: Regenerated.
10991
10992 2008-04-02 David S. Miller <davem@davemloft.net>
10993
10994 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10995 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10996
10997 2008-04-02 Craig Silverstein <csilvers@google.com>
10998
10999 * TODO: New file.
11000
11001 2008-04-02 Ian Lance Taylor <iant@google.com>
11002
11003 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11004 parameters. Update for new key type to views_. Change all
11005 callers.
11006 (File_read::read): Adjust for byteshift in returned view.
11007 (File_read::add_view): New function, broken out of
11008 find_and_make_view.
11009 (File_read::make_view): New function, broken out of
11010 find_and_make_view.
11011 (File_read::find_or_make_view): Add offset and aligned
11012 parameters. Rewrite accordingly. Change all callers.
11013 (File_read::get_view): Add offset and aligned parameters. Adjust
11014 for byteshift in return value.
11015 (File_read::get_lasting_view): Likewise.
11016 * fileread.h (class File_read): Update declarations.
11017 (class File_read::View): Add byteshift_ field. Add byteshift to
11018 constructor. Add byteshift method.
11019 * archive.h (Archive::clear_uncached_views): New function.
11020 (Archive::get_view): Add aligned parameter. Change all callers.
11021 * object.h (Object::get_view): Add aligned parameter. Change all
11022 callers.
11023 (Object::get_lasting_view): Likewise.
11024
11025 * fileread.cc (File_read::release): Don't call clear_views if
11026 there are multiple objects.
11027 * fileread.h (File_read::clear_uncached_views): New function.
11028 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11029 on the archive.
11030
11031 2008-03-31 Cary Coutant <ccoutant@google.com>
11032
11033 Add thin archive support.
11034 * archive.cc (Archive::armagt): New const.
11035 (Archive::setup): Remove task parameter and calls to unlock.
11036 (Archive::unlock_nested_archives): New function.
11037 (Archive::read_header): Add nested_off parameter. Change
11038 all callers.
11039 (Archive::interpret_header): Likewise.
11040 (Archive::include_all_members): Change to handle thin
11041 archives.
11042 (Archive::include_member): Likewise.
11043 * archive.h (Archive::Archive): Add new parameters and
11044 initializers.
11045 (Archive::armagt): New const.
11046 (Archive::setup): Remove task parameter.
11047 (Archive::unlock_nested_archives): New function.
11048 (Archive::read_header): Add nested_off parameter.
11049 (Archive::interpret_header): Likewise.
11050 (Archive::Nested_archive_table): New typedef.
11051 (Archive::is_thin_archive_): New field.
11052 (Archive::nested_archives_): New field.
11053 (Archive::options_): New field.
11054 (Archive::dirpath_): New field.
11055 (Archive::task_): New field.
11056 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11057 for thin archives. Pass additional parameters to
11058 Archive::Archive. Unlock the archive file after calling
11059 Archive::setup.
11060
11061 2008-03-29 Ian Lance Taylor <iant@google.com>
11062
11063 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11064 version symbol to be local.
11065 * testsuite/ver_test_4.sh: New file.
11066 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11067 (check_DATA): Add ver_test_4.syms.
11068 (ver_test_4.syms): New target.
11069 * testsuite/Makefile.in: Rebuild.
11070
11071 * output.cc
11072 (Output_section::Input_section_sort_entry::has_priority): New
11073 function.
11074 (Output_section::Input_section_sort_entry::match_file_name): New
11075 function.
11076 (Output_section::Input_section_sort_entry::match_section_name):
11077 Remove.
11078 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11079 Remove.
11080 (Output_section::Input_section_sort_entry::match_section_file):
11081 Remove.
11082 (Output_section::Input_section_sort_compare::operator()): Rewrite
11083 using new Input_section_sort_entry functions. Sort crtbegin and
11084 crtend first. Sort sections with no priority before sections with
11085 a priority.
11086 * testsuite/initpri1.c (d3): Check j != 4.
11087 (cd5): New constructor/destructor function.
11088 (main): Check j != 2.
11089
11090 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11091 new symbol when resolving, don't call set_is_default.
11092 * testsuite/ver_test_7.cc: New file.
11093 * testsuite/ver_test_7.sh: New file.
11094 * testsuite/Makefile.am (ver_test_7.so): New target.
11095 (ver_test_7.o): New target.
11096 (check_SCRIPTS): Add ver_test_7.sh.
11097 (check_DATA): Add ver_test_7.syms.
11098 (ver_test_7.syms): New target.
11099
11100 2008-03-28 Ian Lance Taylor <iant@google.com>
11101
11102 * layout.cc (Layout::layout): If we see an input section with a
11103 name that needs sorting, set the must_sort flag for the output
11104 section.
11105 (Layout::make_output_section): If the name of the output section
11106 indicates that it might require sorting, set the may_sort flag.
11107 * output.h (Output_section::may_sort_attached_input_sections): New
11108 function.
11109 (Output_section::set_may_sort_attached_input_sections): New
11110 function.
11111 (Output_section::must_sort_attached_input_sections): New
11112 function.
11113 (Output_section::set_must_sort_attached_input_sections): New
11114 function.
11115 (class Output_section): Declare Input_section_sort_entry. Define
11116 Input_section_sort_compare. Declare
11117 sort_attached_input_sections. Add new fields:
11118 may_sort_attached_input_sections_,
11119 must_sort_attached_input_sections_,
11120 attached_input_sections_are_sorted_.
11121 * output.cc (Output_section::Output_section): Initialize new
11122 fields.
11123 (Output_section::add_input_section): Add an entry to
11124 input_sections_ if may_sort or must_sort are true.
11125 (Output_section::set_final_data_size): Call
11126 sort_attached_input_sections if necessary.
11127 (Output_section::Input_section_sort_entry): Define new class.
11128 (Output_section::Input_section_sort_compare::operator()): New
11129 function.
11130 (Output_section::sort_attached_input_sections): New function.
11131 * configure.ac: Check whether the compiler supports constructor
11132 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11133 * testsuite/initpri1.c: New file.
11134 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11135 CONSTRUCTOR_PRIORITY.
11136 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11137 (initpri1_LDFLAGS): New variable.
11138 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11139
11140 2008-03-27 Ian Lance Taylor <iant@google.com>
11141
11142 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11143 * testsuite/common_test_1.c: New file.
11144 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11145 (common_test_1_SOURCES): New variable.
11146 (common_test_1_DEPENDENCIES): New variable.
11147 (common_test_1_LDFLAGS): New variable.
11148
11149 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11150 and commons_ correctly when NAME/VERSION does not override
11151 NAME/NULL.
11152 * testsuite/ver_test_6.c: New file.
11153 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11154 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11155 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11156
11157 2008-03-26 Ian Lance Taylor <iant@google.com>
11158
11159 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11160 of an undefined symbol from a version script.
11161 * testsuite/Makefile.am (ver_test_5.so): New target.
11162 (ver_test_5.o): New target.
11163 (check_SCRIPTS): Add ver_test_5.sh.
11164 (check_DATA): Add ver_test_5.syms.
11165 (ver_test_5.syms): New target.
11166 * testsuite/ver_test_5.cc: New file.
11167 * testsuite/ver_test_5.script: New file.
11168 * testsuite/ver_test_5.sh: New file.
11169 * Makefile.in, testsuite/Makefile.in: Rebuild.
11170
11171 PR gold/5986
11172 Fix problems building gold with gcc 4.3.0.
11173 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11174 (gold_error_at_location, gold_warning_at_location): Use it.
11175 * configure.ac: Check whether we can compile and use a template
11176 function with a printf attribute.
11177 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11178 when jumping over bytes.
11179 * object.cc: Instantiate Object::read_section_data.
11180 * debug.h: Include <cstring>
11181 * dwarf_reader.cc: Include <algorithm>
11182 * main.cc: Include <cstring>.
11183 * options.cc: Include <cstring>.
11184 * output.cc: Include <cstring>.
11185 * script.cc: Include <cstring>.
11186 * script.h: Include <string>.
11187 * symtab.cc: Include <cstring> and <algorithm>.
11188 * target-select.cc: Include <cstring>.
11189 * version.cc: Include <string>.
11190 * testsuite/testmain.cc: Include <cstdlib>.
11191 * configure, config.in: Rebuild.
11192
11193 2008-03-25 Ian Lance Taylor <iant@google.com>
11194
11195 * options.cc: Include "../bfd/bfdver.h".
11196 (options::help): Print bug reporting address.
11197
11198 * version.cc (print_version): Adjust output for current value of
11199 BFD_VERSION_STRING.
11200
11201 * NEWS: New file.
11202
11203 * options.cc (options::help): Print list of supported targets.
11204 * target-select.h: Include <vector>.
11205 (class Target_selector): Make machine_, size_, and is_big_endian_
11206 fields const. Add bfd_name_ and instantiated_target_ fields.
11207 (Target_selector::Target_selector): Add bfd_name parameter.
11208 (Target_selector::recognize): Make non-virtual, call
11209 do_recognize.
11210 (Target_selector::recognize_by_name): Make non-virtual, call
11211 do_recognize_by_name.
11212 (Target_selector::supported_names): New function.
11213 (Target_selector::bfd_name): New function.
11214 (Target_selector::do_instantiate_target): New pure virtual
11215 function.
11216 (Target_selector::do_recognize): New virtual function.
11217 (Target_selector::do_recognize_by_name): New virtual function.
11218 (Target_selector::instantiate_target): New private function.
11219 (supported_target_names): Declare.
11220 * target-select.cc (Target_selector::Target_selector): Update for
11221 new parameter and fields.
11222 (select_target_by_name): Check that the name matches before
11223 calling recognize_by_name.
11224 (supported_target_names): New function.
11225 * i386.cc (class Target_selector_i386): Update Target_selector
11226 constructor call. Remove recognize and recognize_by_name. Add
11227 do_instantiate_target.
11228 * x86_64.cc (class Target_selector_x86_64): Likewise.
11229 * testsuite/testfile.cc (class Target_selector_test): Update for
11230 changes to Target_selector.
11231
11232 * README: Rewrite, with some notes on unsupported features.
11233
11234 2008-03-24 Cary Coutant <ccoutant@google.com>
11235
11236 * i386.cc (Target_i386::Got_type): New enum declaration.
11237 (Target_i386::Scan::local): Updated callers of Output_data_got
11238 member functions.
11239 (Target_i386::Scan::global): Likewise.
11240 (Target_i386::Relocate::relocate): Likewise.
11241 (Target_i386::Relocate::relocate_tls): Likewise.
11242 * object.h (Got_offset_list): New class.
11243 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11244 (Sized_relobj::local_got_offset): Likewise.
11245 (Sized_relobj::set_local_got_offset): Likewise.
11246 (Sized_relobj::local_has_tls_got_offset): Removed.
11247 (Sized_relobj::local_tls_got_offset): Removed.
11248 (Sized_relobj::set_local_tls_got_offset): Removed.
11249 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11250 * output.cc (Output_data_got::add_global): Added got_type parameter.
11251 (Output_data_got::add_global_with_rel): Likewise.
11252 (Output_data_got::add_global_with_rela): Likewise.
11253 (Output_data_got::add_global_pair_with_rel): New function.
11254 (Output_data_got::add_global_pair_with_rela): New function.
11255 (Output_data_got::add_local): Added got_type parameter.
11256 (Output_data_got::add_local_with_rel): Likewise.
11257 (Output_data_got::add_local_with_rela): Likewise.
11258 (Output_data_got::add_local_pair_with_rel): New function.
11259 (Output_data_got::add_local_pair_with_rela): New function.
11260 (Output_data_got::add_global_tls): Removed.
11261 (Output_data_got::add_global_tls_with_rel): Removed.
11262 (Output_data_got::add_global_tls_with_rela): Removed.
11263 (Output_data_got::add_local_tls): Removed.
11264 (Output_data_got::add_local_tls_with_rel): Removed.
11265 (Output_data_got::add_local_tls_with_rela): Removed.
11266 * output.h (Output_data_got::add_global): Added got_type parameter.
11267 (Output_data_got::add_global_with_rel): Likewise.
11268 (Output_data_got::add_global_with_rela): Likewise.
11269 (Output_data_got::add_global_pair_with_rel): New function.
11270 (Output_data_got::add_global_pair_with_rela): New function.
11271 (Output_data_got::add_local): Added got_type parameter.
11272 (Output_data_got::add_local_with_rel): Likewise.
11273 (Output_data_got::add_local_with_rela): Likewise.
11274 (Output_data_got::add_local_pair_with_rel): New function.
11275 (Output_data_got::add_local_pair_with_rela): New function.
11276 (Output_data_got::add_global_tls): Removed.
11277 (Output_data_got::add_global_tls_with_rel): Removed.
11278 (Output_data_got::add_global_tls_with_rela): Removed.
11279 (Output_data_got::add_local_tls): Removed.
11280 (Output_data_got::add_local_tls_with_rel): Removed.
11281 (Output_data_got::add_local_tls_with_rela): Removed.
11282 * resolve.cc (Symbol::override_base_with_special): Removed
11283 reference to has_got_offset_ field.
11284 * symtab.cc (Symbol::init_fields): Replaced initialization
11285 of got_offset_ with got_offsets_. Removed initialization
11286 of has_got_offset_
11287 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11288 (Symbol::got_offset): Likewise.
11289 (Symbol::set_got_offset): Likewise.
11290 (Symbol::has_tls_got_offset): Removed.
11291 (Symbol::tls_got_offset): Removed.
11292 (Symbol::set_tls_got_offset): Removed.
11293 (Symbol::got_offset_): Removed.
11294 (Symbol::tls_mod_got_offset_): Removed.
11295 (Symbol::tls_pair_got_offset_): Removed.
11296 (Symbol::got_offsets_): New field.
11297 (Symbol::has_got_offset): Removed.
11298 (Symbol::has_tls_mod_got_offset): Removed.
11299 (Symbol::has_tls_pair_got_offset): Removed.
11300 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11301 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11302 member functions.
11303 (Target_x86_64::Scan::global): Likewise.
11304 (Target_x86_64::Relocate::relocate): Likewise.
11305 (Target_x86_64::Relocate::relocate_tls): Likewise.
11306
11307 2008-03-25 Ben Elliston <bje@au.ibm.com>
11308
11309 * yyscript.y: Fix spelling error in comment.
11310
11311 2008-03-24 Ian Lance Taylor <iant@google.com>
11312
11313 * options.h (class General_options): Define build_id option.
11314 * layout.h (class Layout): Declare write_build_id, create_note,
11315 create_build_id. Add build_id_note_ member.
11316 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11317 "libiberty.h", "md5.h", "sha1.h".
11318 (Layout::Layout): Initialize eh_frame_data_,
11319 eh_frame_hdr_section_, and build_id_note_.
11320 (Layout::finalize): Call create_build_id.
11321 (Layout::create_note): New function, broken out of
11322 Layout::create_gold_note.
11323 (Layout::create_gold_note): Call create_note.
11324 (Layout::create_build_id): New function.
11325 (Layout::write_build_id): New function.
11326 (Close_task_runner::run): Call write_build_id.
11327
11328 * x86_64.cc: Correct license to GPLv3.
11329
11330 2008-03-23 Ian Lance Taylor <iant@google.com>
11331
11332 * options.cc: Include "demangle.h".
11333 (parse_optional_string): New function.
11334 (parse_long_option): Handle takes_optional_argument.
11335 (parse_short_option): Update dash_z initializer. Handle
11336 takes_optional_argument.
11337 (General_options::General_options): Initialize do_demangle_.
11338 (General_options::finalize): Set do_demangle_. Handle demangling
11339 style.
11340 * options.h (parse_optional_string): Declare.
11341 (struct One_option): Add optional_arg field. Update constructor.
11342 Update call constructor calls. Add takes_optional_argument
11343 function.
11344 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11345 (DEFINE_optional_string): Define.
11346 (General_options::demangle): Change from DEFINE_bool to
11347 DEFINE_optional_string.
11348 (General_options::no_demangle): New function.
11349 (General_options::do_demangle): New function.
11350 (General_options::set_do_demangle): New function.
11351 (General_options::execstack_status_): Move definition to end of
11352 class definition.
11353 (General_options::static_): Likewise.
11354 (General_options::do_demangle_): New field.
11355 * object.cc (big_endian>::get_symbol_location_info): Call
11356 Options::do_demangle, not Options::demangle.
11357 * symtab.cc (demangle): Likewise.
11358
11359 2008-03-22 Ian Lance Taylor <iant@google.com>
11360
11361 * gold.h: Include <cstddef> and <sys/types.h>
11362 * options.h: Include <cstring>.
11363
11364 2008-03-21 Ian Lance Taylor <iant@google.com>
11365
11366 * Added source code to GNU binutils.
This page took 0.324223 seconds and 4 git commands to generate.